decocms 3.78.0 → 3.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-Caru_t3W.js → AlertCircle-CKei65yQ.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-B2Dt0814.js → ArrowUpRight-BygwtcZ2.js} +1 -1
- package/dist/client/assets/{CheckCircle-CpjuZYS5.js → CheckCircle-BZlFJbF8.js} +1 -1
- package/dist/client/assets/{ChevronDown-DeW1WG4N.js → ChevronDown-DXOZkIso.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DhtKqfYa.js → ChevronLeft-DPLHregZ.js} +1 -1
- package/dist/client/assets/{ChevronRight-DSC2aiCG.js → ChevronRight-BkBgwZxs.js} +1 -1
- package/dist/client/assets/{ChevronUp-CiZNoBS5.js → ChevronUp-BCwumcyZ.js} +1 -1
- package/dist/client/assets/{DotsVertical-CAFbny0A.js → DotsVertical-DQDEDjEX.js} +1 -1
- package/dist/client/assets/{Eye-BSAOg3tU.js → Eye-IocHlobo.js} +1 -1
- package/dist/client/assets/{FilterLines-BWsEA6cc.js → FilterLines-dauCx8Za.js} +1 -1
- package/dist/client/assets/{Globe01-B8cJAk0V.js → Globe01-CQy0Cxa-.js} +1 -1
- package/dist/client/assets/{Globe04-BHoeDf9U.js → Globe04-CBuYvlRn.js} +1 -1
- package/dist/client/assets/{HardDrive-Ca-rpUZp.js → HardDrive-DSj8WeP3.js} +1 -1
- package/dist/client/assets/{Key01-hqliL23I.js → Key01-ktWRCkRP.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DfLCxQJZ.js → LayoutLeft-TAhoC2xE.js} +1 -1
- package/dist/client/assets/{LinkExternal01-C-uuQSHY.js → LinkExternal01-BenQb5F0.js} +1 -1
- package/dist/client/assets/{Monitor01-C4mUj5DO.js → Monitor01-CF5y8J9X.js} +1 -1
- package/dist/client/assets/{Palette-BqPdnSvn.js → Palette-ZSzAttfE.js} +1 -1
- package/dist/client/assets/{Play-u3Xpo-3H.js → Play-BrJBHlm8.js} +1 -1
- package/dist/client/assets/{Plus-e8vsh1yI.js → Plus-DptVePQj.js} +1 -1
- package/dist/client/assets/{SearchMd-pbTyIZQ0.js → SearchMd-DmrRiPsU.js} +1 -1
- package/dist/client/assets/{Settings02-1OASYAA8.js → Settings02-BynaGT2l.js} +1 -1
- package/dist/client/assets/{Shield01-BZP4Q_Vm.js → Shield01-CGOi4o3B.js} +1 -1
- package/dist/client/assets/{Star01-BokvC0Yc.js → Star01-G7bzpuzw.js} +1 -1
- package/dist/client/assets/{Stars01-CM7BslwP.js → Stars01-BxW6Ze_W.js} +1 -1
- package/dist/client/assets/{Stars02-DTDItJ62.js → Stars02-CJJhFv2L.js} +1 -1
- package/dist/client/assets/{Sun-CO5Z2lcQ.js → Sun-CUZqy0kq.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DCwdrg-O.js → SwitchHorizontal01-D04vL0_f.js} +1 -1
- package/dist/client/assets/{Tool01-BDvWQGEc.js → Tool01-hkwqrr6Q.js} +1 -1
- package/dist/client/assets/{Trash01-C3khOwsb.js → Trash01-Ds3jbDQE.js} +1 -1
- package/dist/client/assets/{Upload01-BWq8M5mQ.js → Upload01-Cuswrale.js} +1 -1
- package/dist/client/assets/{User01-B5NDreK2.js → User01-DJhz4tmk.js} +1 -1
- package/dist/client/assets/{Users01-BM4ZmEbl.js → Users01-D1GekRvz.js} +1 -1
- package/dist/client/assets/{Users03-DPSOJZh_.js → Users03-CjtA3d84.js} +1 -1
- package/dist/client/assets/{X-CdcmL6WW.js → X-CvnlrpyG.js} +1 -1
- package/dist/client/assets/{XCircle-YOrPaSTA.js → XCircle-CTJX6MKF.js} +1 -1
- package/dist/client/assets/{XClose-B1WSb9MQ.js → XClose-BbKrO-bh.js} +1 -1
- package/dist/client/assets/{Zap-CJ80I152.js → Zap-B-ccy6C4.js} +1 -1
- package/dist/client/assets/{ZapSquare-CgWRLEJy.js → ZapSquare-bUJqwnW3.js} +1 -1
- package/dist/client/assets/{ZoomOut-OytsIYD1.js → ZoomOut-DRnFWZo9.js} +1 -1
- package/dist/client/assets/{access-gate-DqzudH0L.js → access-gate-CAr_jPZ4.js} +1 -1
- package/dist/client/assets/{add-section-modal-kp6f6erO.js → add-section-modal-DpjAnzTC.js} +1 -1
- package/dist/client/assets/{agent-icon-DY5w59uF.js → agent-icon-BB2_1lHd.js} +1 -1
- package/dist/client/assets/{agents-list-DDHbeg5p.js → agents-list-DhbMkPNU.js} +1 -1
- package/dist/client/assets/{ai-providers-P8q844Dm.js → ai-providers-B6285-0G.js} +1 -1
- package/dist/client/assets/{alert-FbljLOaQ.js → alert-B39DYg6q.js} +1 -1
- package/dist/client/assets/{alert-dialog-BO7X_BMw.js → alert-dialog-gK63ktIU.js} +1 -1
- package/dist/client/assets/{app-editor-C4YX8u15.js → app-editor-CB02ERjc.js} +1 -1
- package/dist/client/assets/{auth-DpDDb6PJ.js → auth-DxKMCtEO.js} +1 -1
- package/dist/client/assets/{auth-catchall-BwEPZ9sp.js → auth-catchall-DAcTzerO.js} +1 -1
- package/dist/client/assets/auth-entry-Bu3ut1b9.js +1 -0
- package/dist/client/assets/{auth-split-layout-6kbG-q9M.js → auth-split-layout-Bo7x5X53.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-SkR5Q2kF.js → authenticate-and-persist-oauth-CXYJ_57C.js} +1 -1
- package/dist/client/assets/{automation-list-row-BZROLPDh.js → automation-list-row-BYfl9414.js} +1 -1
- package/dist/client/assets/{automation-runs-VqVE_yW9.js → automation-runs-DiHYOI-G.js} +1 -1
- package/dist/client/assets/{automations-1DiKFOBq.js → automations-Bqn5XkdY.js} +1 -1
- package/dist/client/assets/{avatar-C7RfbSV0.js → avatar-CfKY2_hs.js} +1 -1
- package/dist/client/assets/{badge-S-QCOrNN.js → badge-tlnu_6T3.js} +1 -1
- package/dist/client/assets/{block-document-CLeG1P-N.js → block-document-D35IO4X3.js} +1 -1
- package/dist/client/assets/{brand-context-GZiNd5v6.js → brand-context-CkTeGoic.js} +1 -1
- package/dist/client/assets/{buckets-DTeRBDWJ.js → buckets-CDBAN8NB.js} +1 -1
- package/dist/client/assets/{calendar-katBc34c.js → calendar-CaxcRF1k.js} +1 -1
- package/dist/client/assets/{capability-load-error-D72JLeT1.js → capability-load-error-Bab-5zvo.js} +1 -1
- package/dist/client/assets/{card-B0EjU25K.js → card-DU2I8eHH.js} +1 -1
- package/dist/client/assets/category-editor-CL_UxJoz.js +1 -0
- package/dist/client/assets/{chat-context-DdkEgZ9_.js → chat-context-CdOsOHQ0.js} +1 -1
- package/dist/client/assets/{checkbox-DbzbLYfL.js → checkbox-H7xxQ3iC.js} +1 -1
- package/dist/client/assets/{cli-auth-success-C9MRaugF.js → cli-auth-success-K-z0R_Ah.js} +1 -1
- package/dist/client/assets/{collection-detail-DU1VM1YR.js → collection-detail-C5Wn5oY4.js} +1 -1
- package/dist/client/assets/{collection-display-button-BNnw7G4D.js → collection-display-button-DTs9IB7s.js} +1 -1
- package/dist/client/assets/{collection-search-hESxl20y.js → collection-search-ClGGT1KV.js} +1 -1
- package/dist/client/assets/{collection-tabs-99Rq6QsS.js → collection-tabs-xD0Ry7Iv.js} +1 -1
- package/dist/client/assets/{command-DJiJXkzC.js → command-CLZq7t6J.js} +1 -1
- package/dist/client/assets/commerce-onboarding-3oBhw9NK.js +1 -0
- package/dist/client/assets/{connect-desktop-dialog-DR4-xhbf.js → connect-desktop-dialog-BCsFp2qg.js} +1 -1
- package/dist/client/assets/{connection-card-CJjprKft.js → connection-card-CrUjfVJB.js} +1 -1
- package/dist/client/assets/{connection-detail-DZAfgvu2.js → connection-detail-BaKSwWVH.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-DT5c99yt.js → connection-form-helpers-BqpyRjgd.js} +1 -1
- package/dist/client/assets/{connections-B3yso__h.js → connections-W9DsG8aw.js} +1 -1
- package/dist/client/assets/{context-menu-B3oZHh4c.js → context-menu-CqLno4KJ.js} +1 -1
- package/dist/client/assets/{decopilot-KvFscv5D.js → decopilot-B2PnahSO.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-C9VeVJ93.js → decopilot-sse-pool-D8ZetksK.js} +1 -1
- package/dist/client/assets/{dialog-jX6bYdqO.js → dialog-9Dal6l7D.js} +1 -1
- package/dist/client/assets/{domain-settings-DSTf_XC1.js → domain-settings-L_Aj9ndM.js} +1 -1
- package/dist/client/assets/{drawer-EgN8HzIq.js → drawer-DW4IYbB1.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BOrPFviJ.js → dropdown-menu-DveShRRm.js} +1 -1
- package/dist/client/assets/{empty-state-BZIY4ETU.js → empty-state-b7tnb7q2.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Dz1SJTDF.js → extract-connection-data-BL81V9PY.js} +1 -1
- package/dist/client/assets/{file-explorer-CtIkaECZ.js → file-explorer-0kznGCON.js} +1 -1
- package/dist/client/assets/{file-type-icon-CiTHpOyi.js → file-type-icon-hjib5alc.js} +1 -1
- package/dist/client/assets/{files-D4cQybZ3.js → files-x3Ne7hb6.js} +1 -1
- package/dist/client/assets/{form-D-Lg2Vno.js → form-6Nre8f-k.js} +1 -1
- package/dist/client/assets/{general-BLLTGXVC.js → general-BuYCdj0r.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BtGY0bTC.js → github-repo-picker-CdGt5INt.js} +1 -1
- package/dist/client/assets/{hooks-Bq2gpnHq.js → hooks-Gm6nJHH5.js} +1 -1
- package/dist/client/assets/{image-field-CopsGD8K.js → image-field-CfVmwwEw.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-DTeSs8zZ.js → import-from-deco-dialog-COzfTmtE.js} +1 -1
- package/dist/client/assets/{index-OWX18MdF.js → index-ARPJar1Z.js} +1 -1
- package/dist/client/assets/{index-an-q9BoC.js → index-BsTDFmrB.js} +1 -1
- package/dist/client/assets/{index-B_T2Tm_n.js → index-C5uKx36f.js} +1 -1
- package/dist/client/assets/{index-D9cso_OE.js → index-C6QaS0Zh.js} +3 -3
- package/dist/client/assets/{index-DjsYubVL.js → index-CaL7muMy.js} +1 -1
- package/dist/client/assets/{index-DsuFa3M3.js → index-DB4Y8lPy.js} +1 -1
- package/dist/client/assets/{index-TfVSao84.js → index-DXWbUTbb.js} +1 -1
- package/dist/client/assets/index-DYNdZRHD.css +1 -0
- package/dist/client/assets/{index-CwCkKeIW.js → index-DcLVAN0f.js} +1 -1
- package/dist/client/assets/{index-CApC7A2-.js → index-DllFGtwL.js} +1 -1
- package/dist/client/assets/{index-BIlZxD1s.js → index-SIbEiNOY.js} +1 -1
- package/dist/client/assets/{index-FMQJTdgj.js → index-_NByWM-i.js} +1 -1
- package/dist/client/assets/{index-CpN1_PlS.js → index-gAhVY6Qu.js} +1 -1
- package/dist/client/assets/{index-DJ0Ge3cT.js → index-ki8HSB2c.js} +4 -4
- package/dist/client/assets/{index-redirect-B5cnslmT.js → index-redirect-ChQQXx0A.js} +1 -1
- package/dist/client/assets/{index-BMuKOY-R.js → index-royGCF58.js} +1 -1
- package/dist/client/assets/{input-aftZq0qp.js → input-szhd6Snj.js} +1 -1
- package/dist/client/assets/integration-icon-XSMgSpds.js +1 -0
- package/dist/client/assets/{label-BlTB1rsr.js → label-Bjb_vEVQ.js} +1 -1
- package/dist/client/assets/{login-DwqD6H9f.js → login-C6SDd68X.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DYo7_iWt.js → mcp-oauth-8Oqz2kjD.js} +1 -1
- package/dist/client/assets/{members-BAmGZs_l.js → members-BZMsTuPj.js} +1 -1
- package/dist/client/assets/{monaco-editor-dFjmNtXr.js → monaco-editor-Bzp2tCW_.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DXzyXSPo.js → monitoring-stats-row-Q-gDhXN7.js} +1 -1
- package/dist/client/assets/{oauth-callback-BnUvVOzM.js → oauth-callback-C41rH1zN.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CtGpymDw.js → oauth-callback-ai-provider-L9Z7KnVB.js} +1 -1
- package/dist/client/assets/{onboarding-tHyZv_uW.js → onboarding-sxFOChym.js} +1 -1
- package/dist/client/assets/{org-install-BJnctrXU.js → org-install-DjUJMgS3.js} +1 -1
- package/dist/client/assets/{org-layout-DgadVfYy.js → org-layout-C4CQO9nz.js} +1 -1
- package/dist/client/assets/{organization-choice-HfpQcKxS.js → organization-choice-CPVuyoim.js} +1 -1
- package/dist/client/assets/{page-seo-form-j7a8Z1BY.js → page-seo-form--ih05Y7N.js} +1 -1
- package/dist/client/assets/page-seo-sheet-BGthAy6g.js +1 -0
- package/dist/client/assets/{popover-D43tJ8in.js → popover-CJ-idfVW.js} +1 -1
- package/dist/client/assets/{post-editor-XU3B2wmV.js → post-editor-BhGUUjQx.js} +1 -1
- package/dist/client/assets/{preview-dialog-BrHmAwG0.js → preview-dialog-WfNb4k8L.js} +1 -1
- package/dist/client/assets/{primitives-BRyBxVlk.js → primitives-BmQhQ3Bl.js} +1 -1
- package/dist/client/assets/{profile-CLM3LuOb.js → profile-C2hbZXR_.js} +1 -1
- package/dist/client/assets/project-app-view-QWISlKTP.js +1 -0
- package/dist/client/assets/record-editor-D9nFQqRP.js +1 -0
- package/dist/client/assets/registry-C4EXobcg.js +2 -0
- package/dist/client/assets/{registry-layout-pqx5X3wF.js → registry-layout-BSbINHnj.js} +1 -1
- package/dist/client/assets/{require-capability-BQ22Wt23.js → require-capability-D2kIyw8V.js} +1 -1
- package/dist/client/assets/{required-auth-layout-wApn6jVI.js → required-auth-layout-BbLd1LMa.js} +1 -1
- package/dist/client/assets/{reset-password-deaGgEkO.js → reset-password-lidTRlgJ.js} +1 -1
- package/dist/client/assets/{roles-RG2bRHsu.js → roles-7cj_C6tf.js} +1 -1
- package/dist/client/assets/save-referenced-block-Dw7QM0hK.js +1 -0
- package/dist/client/assets/{save-status-BiRx7JAD.js → save-status-BkW3fzUs.js} +1 -1
- package/dist/client/assets/{schema-form-sBBUMk07.js → schema-form-Cg7Lxy8-.js} +1 -1
- package/dist/client/assets/{scroll-area-BSGl-_zx.js → scroll-area-Dz-FqKWj.js} +1 -1
- package/dist/client/assets/{search-input-Cn14rzZS.js → search-input-DjVPTtCb.js} +1 -1
- package/dist/client/assets/{secrets-D-nSpmHI.js → secrets-BJZgSFDD.js} +1 -1
- package/dist/client/assets/{sections-editor-NjvzZlHu.js → sections-editor-ez2BbDtS.js} +1 -1
- package/dist/client/assets/{select-BGb-ZPds.js → select-FwtHY18v.js} +1 -1
- package/dist/client/assets/{select-model-C_rVNd_q.js → select-model-Bf7O5MiJ.js} +1 -1
- package/dist/client/assets/{seo-editor-Bvd2538m.js → seo-editor-BtQCMu5l.js} +1 -1
- package/dist/client/assets/{settings-layout-CrGAcHuU.js → settings-layout-DDlBA-ta.js} +1 -1
- package/dist/client/assets/{settings-section-Bc3yjWcB.js → settings-section-PIk2gDH0.js} +1 -1
- package/dist/client/assets/{sheet-HFHR_AuU.js → sheet-BvSpiY2r.js} +1 -1
- package/dist/client/assets/{shell-controls-HLzK4I7E.js → shell-controls-C08RpHmT.js} +1 -1
- package/dist/client/assets/{shell-layout-LI1vyNzj.js → shell-layout-BWQLmjyW.js} +1 -1
- package/dist/client/assets/{shell-route-loading-BDOpNoYP.js → shell-route-loading-Cf96p6By.js} +1 -1
- package/dist/client/assets/{sidebar-BGJoJ5IQ.js → sidebar-LVNues-1.js} +1 -1
- package/dist/client/assets/{skeleton-hFHnIcZ0.js → skeleton-B8_-zyKb.js} +1 -1
- package/dist/client/assets/{sortable.esm-DIVJmvz6.js → sortable.esm-DHMK7_tT.js} +1 -1
- package/dist/client/assets/{sso-Bn468zRH.js → sso-CRuWYtBt.js} +1 -1
- package/dist/client/assets/{store-DytIJvdt.js → store-73nRfAHP.js} +1 -1
- package/dist/client/assets/store-registry-Dj2QFrh5.js +2 -0
- package/dist/client/assets/{studio-tools-eP_o-Bzq.js → studio-tools-CJMVZA0W.js} +1 -1
- package/dist/client/assets/{switch-DalcHZ66.js → switch-YOR9drgK.js} +1 -1
- package/dist/client/assets/{table-CnWjZkvw.js → table-COWO-rWc.js} +1 -1
- package/dist/client/assets/{tabs-BhJfCfA3.js → tabs-CsXXbMGG.js} +1 -1
- package/dist/client/assets/{task-status-BwSSlnug.js → task-status-D4qDcTy4.js} +1 -1
- package/dist/client/assets/{textarea-DTW1SKGc.js → textarea-BTbunR8j.js} +1 -1
- package/dist/client/assets/{toggle-group-CRnMovNn.js → toggle-group-CSMS4HAA.js} +1 -1
- package/dist/client/assets/{toolbar-BVgga9fW.js → toolbar-CvxN3T7P.js} +1 -1
- package/dist/client/assets/{tooltip-DVHwyu-W.js → tooltip-BdbfQCYl.js} +1 -1
- package/dist/client/assets/{types-B1E3Ybp7.js → types-D18PqArI.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DP8qFD8W.js → use-ai-providers-CiBlqHeC.js} +1 -1
- package/dist/client/assets/{use-automations-QBk1wzKE.js → use-automations-44dHfXzj.js} +1 -1
- package/dist/client/assets/{use-capability-D3mzXNBE.js → use-capability-DH5i0nun.js} +1 -1
- package/dist/client/assets/{use-clock-tick-YCiBQpNz.js → use-clock-tick-bD6VBNNM.js} +1 -1
- package/dist/client/assets/{use-collections-sgcijgPQ.js → use-collections-DaAI2dS_.js} +1 -1
- package/dist/client/assets/{use-connection-CFC8WumP.js → use-connection-z93iohVP.js} +1 -1
- package/dist/client/assets/{use-copy-BVyzmTt4.js → use-copy-_XYMvM2G.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-40n1TbuY.js → use-create-virtual-mcp-BA4rAHKP.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-tiHawAIR.js → use-debounced-autosave-CaWQv8Ap.js} +1 -1
- package/dist/client/assets/{use-deco-credits-C1ftH3If.js → use-deco-credits-C3sjfJyT.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CUd76KVl.js → use-delete-connection-ftKt28t_.js} +1 -1
- package/dist/client/assets/{use-file-configs-C2ceyi4L.js → use-file-configs-CS1kf1Mx.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CvmJXJdB.js → use-infinite-scroll-CUe3Elw1.js} +1 -1
- package/dist/client/assets/{use-join-requests-CRlCmWm0.js → use-join-requests-iCFOb_l5.js} +1 -1
- package/dist/client/assets/{use-mcp-client-DFe1X8lW.js → use-mcp-client-DZQbnef-.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-4cCmLVZX.js → use-mcp-prompts-CDHTi3et.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-DI9Jj-_Y.js → use-mcp-tools-DOD2Zkcv.js} +1 -1
- package/dist/client/assets/{use-members-KDk_htTJ.js → use-members-Cgp-qtNm.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-D9iFw7Zt.js → use-navigate-to-agent-DUbEZuBm.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-SaCcE0Qc.js → use-org-auth-client-TLh9Nsd6.js} +1 -1
- package/dist/client/assets/{use-org-sso-4n2o97PC.js → use-org-sso-BhXMb9mL.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BXjlJlvC.js → use-organization-roles-Dua0G_kp.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CJJ_tXSe.js → use-organization-settings-Bjk_kH1I.js} +1 -1
- package/dist/client/assets/{use-registry-connections-DGZtDiY8.js → use-registry-connections-DfipPXqa.js} +1 -1
- package/dist/client/assets/{use-secrets-DOmnFlDE.js → use-secrets-DCPSjnYq.js} +1 -1
- package/dist/client/assets/{use-status-sounds-C7IKQ0M3.js → use-status-sounds-DFtMiuOm.js} +1 -1
- package/dist/client/assets/{use-view-mode-5sHRttq3.js → use-view-mode-tunDtZ1F.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-Dt17nZX7.js → use-virtual-mcp-BCkbHrLW.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CX9x55X-.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-C_SaQkGF.js +1 -0
- package/dist/client/assets/{variant-calendar-DBaInJsx.js → variant-calendar-hE6C_kQd.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-dVNz8sR0.js → view-mode-toggle-B1Thrh1l.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/auth-entry-9rxagxJL.js +0 -1
- package/dist/client/assets/category-editor-C-xyYK6m.js +0 -1
- package/dist/client/assets/commerce-onboarding-YO2BywhJ.js +0 -1
- package/dist/client/assets/index-BITgxoqa.css +0 -1
- package/dist/client/assets/integration-icon-Dn8UgHow.js +0 -1
- package/dist/client/assets/page-seo-sheet-C5rR31Cs.js +0 -1
- package/dist/client/assets/project-app-view-Bojee27q.js +0 -1
- package/dist/client/assets/record-editor-Cb2nxa0o.js +0 -1
- package/dist/client/assets/registry-DJ2WJB-k.js +0 -2
- package/dist/client/assets/save-referenced-block-B0RkutY2.js +0 -1
- package/dist/client/assets/store-registry-C32JZ3Yi.js +0 -2
- package/dist/client/assets/useInfiniteQuery-LattvRM6.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-JNoud7Ca.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{c as H,r as P,l as le,j as n,i as Ne,v as Ae,a as vi,a2 as Jt,b as Mt,u as wn,e as Nh,s as im,L as rm,k as As,K as Tt,m as qs,a3 as Cn,a4 as nm,a5 as om,t as ae,B as oe,a6 as Eh,a7 as am,a8 as lm,q as Ie,a9 as Th,aa as cm,ab as kn,ac as ar,ad as Dt,ae as hm,E as Ph,C as dm,x as um,af as It,P as Ah,ag as fm,U as mm,$ as Rh,W as pm,ah as gm,Q as _m,ai as vm,d as xi,y as Fr,aj as Ui,z as Yt,ak as Ut}from"./index-D9cso_OE.js";import{C as Ue,a as xm,w as bm,u as ya,s as bo,T as ym,b as Sm,g as wm,c as Cm}from"./index-OWX18MdF.js";import{u as Gs,a as ys,b as Sa,c as Dh,S as wa,t as km,d as jm}from"./chat-context-DdkEgZ9_.js";import{i as _r}from"./AlertCircle-Caru_t3W.js";import{i as Ih}from"./CheckCircle-CpjuZYS5.js";import{n as Dl}from"./ChevronLeft-DhtKqfYa.js";import{a as Nm,i as Em}from"./XCircle-YOrPaSTA.js";import{s as Ps}from"./XClose-B1WSb9MQ.js";import{a as ds,u as Ca,b as Lh,c as Tm}from"./use-virtual-mcp-Dt17nZX7.js";import{c as Pm,u as Am,a as Bh,O as Rm,t as yo,S as jn,T as Dm,b as Mh,R as Im,C as Lm,G as Bm,g as Mm,s as Om,d as $m,e as zm,f as Fm}from"./scroll-area-BSGl-_zx.js";import{I as us}from"./integration-icon-Dn8UgHow.js";import{a as Oh,u as vt,S as ka,b as Hm,c as Wm,i as Um,d as $h}from"./use-mcp-client-DFe1X8lW.js";import{a as Km}from"./Users03-DPSOJZh_.js";import{t as Rs}from"./ChevronDown-DeW1WG4N.js";import{u as Vm,h as qm,a as vr,c as zh,d as Ws,g as Gm,A as Ym,f as Xm,e as Jm}from"./use-deco-credits-C1ftH3If.js";import{u as Fh}from"./use-ai-providers-DP8qFD8W.js";import{u as Zm}from"./connect-desktop-dialog-DR4-xhbf.js";import{r as Qm,b as ja,i as ep}from"./shell-layout-LI1vyNzj.js";import{u as Na,T as Ce,a as ke,b as je,c as Hh}from"./tooltip-DVHwyu-W.js";import{u as tp}from"./use-status-sounds-C7IKQ0M3.js";import{E as Yr}from"./empty-state-BZIY4ETU.js";import{r as So,a as sp,p as Wh,f as Il,b as Uh,c as Kh,d as Vh,e as ip,F as rp,i as np,g as op,h as qh,j as Gh}from"./tab-id-BptcWVWa.js";import{u as Yh,a as Xh}from"./hooks-Bq2gpnHq.js";import{T as Ll,a as Ki}from"./toolbar-BVgga9fW.js";import{u as ap,a as lp,b as cp,c as hp,g as dp,d as Jh,e as Bl,F as up,f as fp,h as mp,i as pp,j as gp,k as _p,l as vp,H as xp,L as bp,R as Zh,m as yp,n as Sp,T as Ea,o as wp,p as Cp}from"./preview-dialog-BrHmAwG0.js";import{g as lr,h as Ta,j as Qh,k as kp,p as Nn,l as En,m as Pa,n as ed,o as wo,q as Hn,r as Ml,A as Ol,s as jp,t as Np,u as Ep,v as Tp,w as Pp,x as Ap,y as Rp,z as Dp,B as Ip,C as Lp,D as Tn,E as Bp,F as $l,G as zl,H as Mp,d as Op,I as $p,J as zp,K as Aa,L as Xr,M as Ra,N as Co,O as Pn,P as Fp,Q as Hp,R as Wp,S as Up,T as Kp,U as Vp,V as qp,W as Fl,X as Gp,Y as Yp,Z as Xp,_ as td,$ as Jp}from"./agent-icon-DY5w59uF.js";import{i as xr,n as Zp}from"./Globe01-B8cJAk0V.js";import{i as sd}from"./Monitor01-C4mUj5DO.js";import{u as br,a as Da,b as id}from"./use-connection-CFC8WumP.js";import{u as An,a as rd,b as nd}from"./use-mcp-tools-DI9Jj-_Y.js";import{g as od}from"./types-B1E3Ybp7.js";import{u as bi}from"./studio-tools-eP_o-Bzq.js";import{u as Qp}from"./use-capability-D3mzXNBE.js";import{F as ui,M as Ia,O as eg}from"./file-type-icon-CiTHpOyi.js";import{P as Ys,a as Xs,b as Js}from"./popover-D43tJ8in.js";import{b as jt,c as Lt,S as Nt,a as Ye,d as Et}from"./select-BGb-ZPds.js";import{D as os,a as as,b as ls,c as We,d as ko,e as jo,f as No,g as er,h as cr,i as Wn,j as Un}from"./dropdown-menu-BOrPFviJ.js";import{d as Kt,c as Vt,D as fs,a as ms,e as Zs,b as Rn}from"./dialog-jX6bYdqO.js";import{I as st}from"./input-aftZq0qp.js";import{T as Os,a as La,b as tr,c as Ba}from"./tabs-BhJfCfA3.js";import{T as Jr}from"./textarea-DTW1SKGc.js";import{a as bs,s as tg}from"./Eye-BSAOg3tU.js";import{t as $s}from"./Stars01-CM7BslwP.js";import{l as sg,w as ig}from"./index-BIlZxD1s.js";import{i as ad}from"./ChevronRight-DSC2aiCG.js";import{a as Eo,b as ld}from"./ZoomOut-OytsIYD1.js";import{S as rg}from"./shell-route-loading-BDOpNoYP.js";import{a as ng}from"./extract-connection-data-Dz1SJTDF.js";import{A as Kn}from"./avatar-C7RfbSV0.js";import{T as cd,u as hd,I as og,R as ag,a as lg}from"./index-CApC7A2-.js";import{a as cg,i as Hl}from"./mcp-oauth-DYo7_iWt.js";import{s as dd,g as hg}from"./connection-slug-eyAPH6o3.js";import{f as Zr,a as Qr,b as en,c as tn,d as sn,e as rn,A as nn,g as on}from"./alert-dialog-BO7X_BMw.js";import{C as Ma,a as an}from"./card-B0EjU25K.js";import{L as _t}from"./label-BlTB1rsr.js";import{S as ln}from"./switch-DalcHZ66.js";import{i as fi}from"./Play-u3Xpo-3H.js";import{s as Bt}from"./Plus-e8vsh1yI.js";import{a as dg,i as ud}from"./Settings02-1OASYAA8.js";import{s as Us}from"./Trash01-C3khOwsb.js";import{u as cn}from"./use-debounced-autosave-tiHawAIR.js";import{i as hr}from"./SearchMd-pbTyIZQ0.js";import{i as ug}from"./Upload01-BWq8M5mQ.js";import{i as fg}from"./LayoutLeft-DfLCxQJZ.js";import{P as Zt}from"./index-DsuFa3M3.js";import{C as yi}from"./checkbox-DbzbLYfL.js";import{S as fd}from"./search-input-Cn14rzZS.js";import{C as md}from"./collection-tabs-99Rq6QsS.js";import{u as mg}from"./use-mcp-prompts-4cCmLVZX.js";import{b as pg,a as gg,D as _g}from"./drawer-EgN8HzIq.js";import{i as Si}from"./ChevronUp-CiZNoBS5.js";import{i as Oa}from"./Key01-hqliL23I.js";import{a as pd,G as vg}from"./github-repo-picker-BtGY0bTC.js";import{S as gd}from"./skeleton-hFHnIcZ0.js";import{s as xg}from"./User01-B5NDreK2.js";import{t as Dn}from"./Users01-BM4ZmEbl.js";import{u as bg,a as yg}from"./use-secrets-DOmnFlDE.js";import{f as Sg}from"./formatDistanceToNow-Cb2QZZJn.js";import{n as wi}from"./LinkExternal01-C-uuQSHY.js";import{s as mi}from"./Star01-BokvC0Yc.js";import{i as _d,s as sr}from"./Stars02-DTDItJ62.js";import{V as wg}from"./view-mode-toggle-dVNz8sR0.js";import{n as To}from"./ZapSquare-CgWRLEJy.js";import{i as $a,a as Cg,b as za}from"./Tool01-BDvWQGEc.js";import{c as vd,i as kg}from"./SwitchHorizontal01-DCwdrg-O.js";import{i as xd}from"./X-CdcmL6WW.js";import{i as jg}from"./DotsVertical-CAFbny0A.js";import{B as Ng}from"./badge-S-QCOrNN.js";import{C as Eg,e as Wl,d as Tg,b as Pg,c as Ag,a as Rg}from"./command-DJiJXkzC.js";import{M as Dg}from"./select-model-C_rVNd_q.js";import{u as yr,a as Ig,b as Lg,c as Bg,d as Mg}from"./use-automations-QBk1wzKE.js";import{i as dr}from"./Zap-CJ80I152.js";import{M as Og}from"./monaco-editor-dFjmNtXr.js";import{A as $g}from"./automation-runs-VqVE_yW9.js";import{A as zg}from"./automation-list-row-BZROLPDh.js";function Ri(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Ul(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 Fg(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Hg(t){const e=H.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Wg),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=n.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Wg(t){return n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[n.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),n.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Ug(t){const e=H.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,o=s+i+r,a=o>0?s/o*100:0,l=o>0?i/o*100:0,h=o>0?r/o*100:0;let c;e[0]!==a?(c=a>0&&n.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==l?(d=l>0&&n.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=d):d=e[3];let u;e[4]!==h?(u=h>0&&n.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==d||e[8]!==u?(f=n.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=m):m=e[10];let p;e[11]!==a?(p=a.toFixed(1),e[11]=a,e[12]=p):p=e[12];let g;e[13]!==p?(g=n.jsxs("div",{className:"flex items-center gap-1.5",children:[m,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",p,"%"]})]}),e[13]=p,e[14]=g):g=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=v):v=e[15];let b;e[16]!==l?(b=l.toFixed(1),e[16]=l,e[17]=b):b=e[17];let x;e[18]!==b?(x=n.jsxs("div",{className:"flex items-center gap-1.5",children:[v,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",b,"%"]})]}),e[18]=b,e[19]=x):x=e[19];let _;e[20]!==h||e[21]!==r?(_=r>0&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=_):_=e[22];let y;e[23]!==x||e[24]!==_||e[25]!==g?(y=n.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[g,x,_]}),e[23]=x,e[24]=_,e[25]=g,e[26]=y):y=e[26];let S;return e[27]!==y||e[28]!==f?(S=n.jsxs("div",{className:"flex flex-col gap-2",children:[f,y]}),e[27]=y,e[28]=f,e[29]=S):S=e[29],S}function Kg(t){const e=H.c(11),{agentId:s,isError:i}=t,r=ds(s),o=r?.title??"Subtask",a=r?.icon??null;let l;e[0]!==a||e[1]!==o?(l=n.jsx(us,{icon:a,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=o,e[2]=l):l=e[2];const h=i?"text-destructive":"text-foreground";let c;e[3]!==h?(c=le("shrink-0 font-medium",h),e[3]=h,e[4]=c):c=e[4];let d;e[5]!==o||e[6]!==c?(d=n.jsx("span",{className:c,children:o}),e[5]=o,e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==l||e[9]!==d?(u=n.jsxs(n.Fragment,{children:[l,d]}),e[8]=l,e[9]=d,e[10]=u):u=e[10],u}function Vg(t){const e=H.c(5),{isError:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(us,{icon:null,name:"Subtask",size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=i):i=e[0];const r=s?"text-destructive":"text-foreground";let o;e[1]!==r?(o=le("shrink-0 font-medium",r),e[1]=r,e[2]=o):o=e[2];let a;return e[3]!==o?(a=n.jsxs(n.Fragment,{children:[i,n.jsx("span",{className:o,children:"Subtask"})]}),e[3]=o,e[4]=a):a=e[4],a}function qg(t){const e=H.c(18),{part:s}=t,i=s.input?.agent_id,r=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",a=s.state==="approval-requested";let l;e[0]!==o?(l=n.jsx(Vg,{isError:o}),e[0]=o,e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==o?(h=n.jsx(Kg,{agentId:i,isError:o}),e[2]=i,e[3]=o,e[4]=h):h=e[4];let c;e[5]!==l||e[6]!==h?(c=n.jsx(P.Suspense,{fallback:l,children:h}),e[5]=l,e[6]=h,e[7]=c):c=e[7];let d;e[8]!==s.input?(d=s.input?.prompt&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground/50",children:"·"}),n.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==o||e[12]!==r?(u=n.jsx("span",{className:"ml-auto shrink-0",children:r?n.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"}):o?n.jsx(Nm,{size:12,className:"text-destructive"}):a?n.jsx(_r,{size:12,className:"text-warning"}):n.jsx(Ih,{size:12,className:"text-emerald-500"})}),e[10]=a,e[11]=o,e[12]=r,e[13]=u):u=e[13];let f;return e[14]!==c||e[15]!==d||e[16]!==u?(f=n.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[c,d,u]}),e[14]=c,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function Gg(t){const e=H.c(55),{onClose:s,back:i,className:r}=t,[o,a]=P.useState(null),{messages:l}=Gs(),{activeTask:h}=ys(),{selectedModel:c,selectedVirtualMcp:d}=Sa();let u,f,m,p,g,v,b,x;if(e[0]!==h||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==s||e[5]!==o?.id||e[6]!==c||e[7]!==d?.title){x=Symbol.for("react.early_return_sentinel");e:{const S=Pm(l),w=[...l].reverse().find(n_),j=w?.metadata?.usage,E=w?.metadata?.modelLimits?.contextWindow??c?.limits?.contextWindow??null,T=j?.contextTokens??0,A=E&&E>0?(T/E*100).toFixed(1):null,R=l;let k;e[16]!==R?(k=R.filter(r_).reduce(i_,0),e[16]=R,e[17]=k):k=e[17];const C=k,D=l;let N;e[18]!==D?(N=D.filter(s_).reduce(t_,0),e[18]=D,e[19]=N):N=e[19];const L=N,B=Math.max(0,S.totalTokens-C-L),I=l[0],M=l.at(-1),O=I?.metadata?.created_at??h?.created_at,F=M?.metadata?.created_at??h?.updated_at,z=l.filter(e_),V=l.flatMap(Zg),G=c?.modelId?Fg(c.modelId):"—",X=d?.title??"Decopilot",ie=[{label:"Session",value:h?.title??"New chat"},{label:"Messages",value:z.length},{label:"Agent",value:X},{label:"Model",value:G},{label:"Context Limit",value:E?Ri(E):"—"},{label:"Session Tokens (billed)",value:S.totalTokens>0?Ri(S.totalTokens):"0"},{label:"Usage",value:A!==null?`${A}%`:"—"},{label:"Input Tokens",value:S.inputTokens>0?Ri(S.inputTokens):"0"},{label:"Output Tokens",value:S.outputTokens>0?Ri(S.outputTokens):"0"},{label:"Reasoning Tokens",value:S.reasoningTokens>0?Ri(S.reasoningTokens):"0"},{label:"Cost",value:S.cost>0?`$${S.cost<.001?S.cost.toFixed(6):S.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Ul(O)},{label:"Last Activity",value:Ul(F)}];if(!h&&z.length===0){let $;e[20]!==r?($=le("flex flex-col h-full w-full border-l border-border bg-background",r),e[20]=r,e[21]=$):$=e[21];let Z;e[22]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[22]=Z):Z=e[22];let K;e[23]!==i?(K=i?n.jsx(Dl,{size:14,className:"text-muted-foreground"}):n.jsx(Ps,{size:14,className:"text-muted-foreground"}),e[23]=i,e[24]=K):K=e[24];let ee;e[25]!==s||e[26]!==K?(ee=n.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[Z,n.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:K})]}),e[25]=s,e[26]=K,e[27]=ee):ee=e[27];let Q;e[28]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:n.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[28]=Q):Q=e[28];let fe;e[29]!==$||e[30]!==ee?(fe=n.jsxs("div",{className:$,children:[ee,Q]}),e[29]=$,e[30]=ee,e[31]=fe):fe=e[31],x=fe;break e}e[32]!==r?(v=le("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[32]=r,e[33]=v):v=e[33];let U;e[34]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[34]=U):U=e[34];let Y;e[35]!==i?(Y=i?n.jsx(Dl,{size:14}):n.jsx(Ps,{size:14}),e[35]=i,e[36]=Y):Y=e[36],e[37]!==s||e[38]!==Y?(b=n.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[U,n.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[37]=s,e[38]=Y,e[39]=b):b=e[39],u="flex flex-col gap-8 p-6",f=V.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),n.jsx("div",{className:"flex flex-col gap-1",children:V.map(Jg)})]}),m=n.jsx(Hg,{items:ie});let ne;e[40]===Symbol.for("react.memo_cache_sentinel")?(ne=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[40]=ne):ne=e[40],e[41]!==L||e[42]!==B||e[43]!==C?(p=n.jsxs("div",{className:"flex flex-col gap-3",children:[ne,n.jsx(Ug,{userTokens:C,assistantTokens:L,otherTokens:B})]}),e[41]=L,e[42]=B,e[43]=C,e[44]=p):p=e[44],g=z.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),n.jsx("div",{className:"flex flex-col gap-1",children:z.map($=>{const Z=$.metadata?.created_at,K=o?.id===$.id;return n.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[n.jsxs("button",{type:"button",onClick:()=>a(K?null:$),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:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:le("shrink-0 font-medium",$.role==="user"?"text-chart-1":"text-chart-2"),children:$.role}),n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsx("span",{className:"truncate text-muted-foreground font-mono",children:$.id})]}),Z&&n.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(Z).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),K&&n.jsxs(n.Fragment,{children:[$.role==="assistant"&&(()=>{const ee=$.metadata?._request;if(!ee)return null;const Q=ee.systemSections??[],fe=Math.max(1,...Q.map(Xg)),me=Q.reduce(Yg,0);return n.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-medium text-foreground",children:"Request"}),n.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[ee.activeTools??0," / ",ee.tools??0," ","tools active"]})]}),Q.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",n.jsxs("span",{className:"tabular-nums",children:["~",Math.round(me/4).toLocaleString()," ","tok"]})]}),Q.map((_e,J)=>{const se=_e.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${J}`,pe=_e.chars/fe*100,ge=Math.round(_e.chars/4);return n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-mono text-foreground truncate",children:se}),n.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",ge.toLocaleString()," tok"]})]}),n.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:n.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${pe}%`}})})]},J)})]})]})})(),n.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($,null,2)})]})]},$.id)})})]})}e[0]=h,e[1]=i,e[2]=r,e[3]=l,e[4]=s,e[5]=o?.id,e[6]=c,e[7]=d?.title,e[8]=u,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=x}else u=e[8],f=e[9],m=e[10],p=e[11],g=e[12],v=e[13],b=e[14],x=e[15];if(x!==Symbol.for("react.early_return_sentinel"))return x;let _;e[45]!==u||e[46]!==f||e[47]!==m||e[48]!==p||e[49]!==g?(_=n.jsxs("div",{className:u,children:[f,m,p,g]}),e[45]=u,e[46]=f,e[47]=m,e[48]=p,e[49]=g,e[50]=_):_=e[50];let y;return e[51]!==v||e[52]!==b||e[53]!==_?(y=n.jsxs("div",{className:v,children:[b,_]}),e[51]=v,e[52]=b,e[53]=_,e[54]=y):y=e[54],y}function Yg(t,e){return t+e.chars}function Xg(t){return t.chars}function Jg(t,e){return n.jsx(qg,{part:t},e)}function Zg(t){return(t.parts??[]).filter(Qg)}function Qg(t){return t.type==="tool-subtask"}function e_(t){return t.role!=="system"}function t_(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function s_(t){return t.role==="assistant"}function i_(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function r_(t){return t.role==="user"}function n_(t){return t.role==="assistant"&&t.metadata?.usage}function o_(t){const e=H.c(13),{readOnly:s,identity:i,aboveRow:r,input:o,iceBreakers:a}=t,l=!s&&i?i:null;let h;e[0]!==r||e[1]!==s?(h=!s&&r?n.jsx("div",{"data-chat-above-row":"true",className:"@container/chat-bottom flex justify-start gap-1",children:r}):null,e[0]=r,e[1]=s,e[2]=h):h=e[2];let c;e[3]!==o||e[4]!==h?(c=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,o]}),e[3]=o,e[4]=h,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==s?(d=!s&&a?n.jsx("div",{className:"w-full",children:a}):null,e[6]=a,e[7]=s,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==c||e[11]!==d?(u=n.jsx("div",{"data-chat-centered":"true",className:"h-full w-full flex flex-col items-center justify-center px-4 gap-6",children:n.jsxs("div",{className:"w-full max-w-3xl flex flex-col gap-6",children:[l,c,d]})}),e[9]=l,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function a_(t){const e=H.c(25),{onOpenContextPanel:s}=t,{org:i}=Ae(),{selectedVirtualMcp:r}=Sa();let o;e[0]!==i.id?(o=Oh(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=r??o,h=ds(l.id),c=Dh(),{data:d}=vi.useSession(),u=d?.user?.id,f=c?.activeTask??null,m=!!(u&&f?.created_by&&f.created_by!==u);let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Km,{size:32}),e[2]=p):p=e[2];let g;e[3]!==l.icon||e[4]!==l.title?(g=n.jsx(us,{icon:l.icon,name:l.title,size:"lg",fallbackIcon:p,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),e[3]=l.icon,e[4]=l.title,e[5]=g):g=e[5];let v;e[6]!==l.title?(v=n.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:l.title}),e[6]=l.title,e[7]=v):v=e[7];const b=l.description??"Ask anything about configuring model providers or using MCP Mesh.";let x;e[8]!==b?(x=n.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:b}),e[8]=b,e[9]=x):x=e[9];let _;e[10]!==g||e[11]!==v||e[12]!==x?(_=n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[g,v,x]}),e[10]=g,e[11]=v,e[12]=x,e[13]=_):_=e[13];const y=c?.currentBranch??null;let S;e[14]!==h||e[15]!==y?(S=n.jsx(xm,{virtualMcp:h,currentBranch:y}),e[14]=h,e[15]=y,e[16]=S):S=e[16];let w;e[17]!==s?(w=n.jsx(Ue.Input,{onOpenContextPanel:s}),e[17]=s,e[18]=w):w=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ue.IceBreakers,{}),e[19]=j):j=e[19];let E;return e[20]!==m||e[21]!==w||e[22]!==_||e[23]!==S?(E=n.jsx(o_,{readOnly:m,identity:_,aboveRow:S,input:w,iceBreakers:j}),e[20]=m,e[21]=w,e[22]=_,e[23]=S,e[24]=E):E=e[24],E}function Kl(t){const e=H.c(17),{outputs:s,collapsed:i,onToggle:r,variant:o}=t,a=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let l;e[0]!==a?(l=le(a),e[0]=a,e[1]=l):l=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=h):h=e[2];const c=i&&"-rotate-90";let d;e[3]!==c?(d=le("size-4 text-muted-foreground transition-transform",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==d?(u=n.jsx(Rs,{className:d}),e[5]=d,e[6]=u):u=e[6];let f;e[7]!==r||e[8]!==u?(f=n.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[h,u]}),e[7]=r,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==i||e[11]!==s?(m=!i&&n.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(l_)}),e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==l||e[14]!==f||e[15]!==m?(p=n.jsxs("div",{className:l,children:[f,m]}),e[13]=l,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function l_(t){return n.jsx(Rm,{file:t},t.key)}function c_(){const t=H.c(13),e=Dh()?.taskId??null,s=Am();let i;t[0]!==s?(i={enabled:s},t[0]=s,t[1]=i):i=t[1];const{data:r}=Bh(e,i),[o,a]=P.useState(!1),[l,h]=P.useState(!0);if(!e||!r||r.length===0)return null;let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(d_),t[2]=c):c=t[2];let d;t[3]!==o||t[4]!==r?(d=n.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:n.jsx(Kl,{variant:"card",outputs:r,collapsed:o,onToggle:c})}),t[3]=o,t[4]=r,t[5]=d):d=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>h(h_),t[6]=u):u=t[6];let f;t[7]!==l||t[8]!==r?(f=n.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:n.jsx(Kl,{variant:"bar",outputs:r,collapsed:l,onToggle:u})}),t[7]=l,t[8]=r,t[9]=f):f=t[9];let m;return t[10]!==d||t[11]!==f?(m=n.jsxs(n.Fragment,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=m):m=t[12],m}function h_(t){return!t}function d_(t){return!t}function u_(){const t=H.c(26),{org:e}=Ae(),s=Fh(),{isChatEmpty:i}=Gs(),[r,o]=P.useState("chat"),a=Vm(),l=Zm();if(s.length===0&&!qm(l)){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(Ue,{className:"animate-in fade-in-0 duration-200",children:n.jsx(Ue.Main,{className:"flex flex-col items-center",children:n.jsx(Ue.EmptyState,{children:n.jsx(Ue.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let c;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(c=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!bm(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=c):c=t[7];const d=c;let u;t[8]!==d?(u=d&&n.jsx(Ue.CreditsEmptyState,{}),t[8]=d,t[9]=u):u=t[9];const f=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let m;t[10]!==f?(m=le("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]!==i?(p=i?n.jsx(Ue.Main,{children:n.jsx(a_,{onOpenContextPanel:()=>o("context")})}):n.jsxs(n.Fragment,{children:[n.jsxs(Ue.Main,{className:"relative flex flex-col overflow-hidden @container",children:[n.jsx(c_,{}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Ue.Messages,{})})]}),n.jsx(Ue.Footer,{children:n.jsx(Ue.Input,{onOpenContextPanel:()=>o("context")})})]}),t[12]=i,t[13]=p):p=t[13];let g;t[14]!==m||t[15]!==p?(g=n.jsx("div",{className:m,children:p}),t[14]=m,t[15]=p,t[16]=g):g=t[16];const v=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let b;t[17]!==v?(b=le("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",v),t[17]=v,t[18]=b):b=t[18];let x;t[19]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Gg,{back:!0,onClose:()=>o("chat")}),t[19]=x):x=t[19];let _;t[20]!==b?(_=n.jsx("div",{className:b,children:x}),t[20]=b,t[21]=_):_=t[21];let y;return t[22]!==u||t[23]!==g||t[24]!==_?(y=n.jsxs(Ue,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[u,g,_]}),t[22]=u,t[23]=g,t[24]=_,t[25]=y):y=t[25],y}function bd(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Ue.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Jt,{fallback:e,children:n.jsx(P.Suspense,{fallback:n.jsx(Ue.Skeleton,{}),children:n.jsx(u_,{})})}),t[1]=s):s=t[1],s}function f_(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",i=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:i,chatOpen:r}}function Vl(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function m_(t,e){return t===1?!0:t===0?!1:e}function p_(t,e){const s=Mt(),i=wn({strict:!1}),r=Nh({strict:!1}),{create:o}=Yh(),{locator:a}=Ae(),{virtualMcpId:l,orgSlug:h,isAgentRoute:c}=e,d=f_({entityMetadata:t,mainParamPresent:i.main!==void 0,mainParamValue:i.main}),u=m_(i.chat,d.chatOpen),f=d.mainOpen,m=P.useRef(crypto.randomUUID()),p=r.taskId??m.current,g="/$org/$taskId",v=T=>({org:h,taskId:T}),b=c?{virtualmcpid:l}:{},x=(T,A)=>{s({to:g,params:v(p),search:R=>({...R,...T}),replace:A?.replace??!1})},_=(T,A)=>{s({to:g,params:v(T),search:R=>{const k={};return A?k.virtualmcpid=A:c&&(k.virtualmcpid=l),k}})},y=()=>{f?x({main:"0"},{replace:!0}):x({main:So(t)},{replace:!0})},S=()=>{x({chat:u?0:1},{replace:!0})},w=()=>{u||x({chat:1},{replace:!0})},j=async()=>{const T=crypto.randomUUID(),A=Qm(h,a,p);try{await o({id:T,virtual_mcp_id:l,...A?{branch:A}:{}})}catch{}s({to:g,params:v(T),search:R=>({...b,chat:1})})},E=T=>{x({main:T},{replace:!0})};return{taskId:p,mainOpen:f,chatOpen:u,mainParam:i.main,setTaskId:_,toggleMain:y,toggleChat:S,openChat:w,createNewTask:j,openTab:E}}const Fa=45;function yd(t,e=Fa){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function g_(t){return yd(t,Fa)}function __(){const t=H.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=rm.decoChatPanelWidth(),t[0]=e):e=t[0];const[s,i]=im(e,g_);let r;t[1]!==s?(r=yd(s,Fa),t[1]=s,t[2]=r):r=t[2];const o=r;let a;return t[3]!==i||t[4]!==o?(a=[o,i],t[3]=i,t[4]=o,t[5]=a):a=t[5],a}function v_(t){try{return JSON.parse(t)}catch{return null}}function x_(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,i=s?v_(s):null,r=e.structuredContent;return r==null?i:typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0?i??r:r}function Qs(t){const e=x_(t);return e===null?null:e}function Ha(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 b_(t){if(!t||typeof t!="object")return null;const e=t.content?.find(r=>r.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],i=Ha(s);return!i||!s?null:{number:i,htmlUrl:s}}const ql=/[\r\n<>]/,y_=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Sr(t){const e=t?.userName?.trim();if(!e||ql.test(e))return null;const s=t?.userEmail?.trim();return!s||ql.test(s)?{userName:e}:y_.test(s)?{userName:e,userEmail:s}:{userName:e}}function S_(t){return t.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-ez2BbDtS.js","assets/index-C6QaS0Zh.js","assets/index-DYNdZRHD.css","assets/ChevronDown-DXOZkIso.js","assets/ChevronLeft-DPLHregZ.js","assets/ChevronRight-BkBgwZxs.js","assets/ChevronUp-BCwumcyZ.js","assets/agent-icon-BB2_1lHd.js","assets/AlertCircle-CKei65yQ.js","assets/Tool01-hkwqrr6Q.js","assets/SwitchHorizontal01-D04vL0_f.js","assets/Settings02-BynaGT2l.js","assets/XCircle-CTJX6MKF.js","assets/ArrowUpRight-BygwtcZ2.js","assets/ZapSquare-bUJqwnW3.js","assets/Users03-CjtA3d84.js","assets/CheckCircle-BZlFJbF8.js","assets/DotsVertical-DQDEDjEX.js","assets/Stars02-CJJhFv2L.js","assets/Eye-IocHlobo.js","assets/ZoomOut-DRnFWZo9.js","assets/Globe01-CQy0Cxa-.js","assets/FilterLines-dauCx8Za.js","assets/Star01-G7bzpuzw.js","assets/Globe04-CBuYvlRn.js","assets/HardDrive-DSj8WeP3.js","assets/Key01-ktWRCkRP.js","assets/LayoutLeft-TAhoC2xE.js","assets/LinkExternal01-BenQb5F0.js","assets/Monitor01-CF5y8J9X.js","assets/Sun-CUZqy0kq.js","assets/Palette-ZSzAttfE.js","assets/Play-BrJBHlm8.js","assets/Plus-DptVePQj.js","assets/SearchMd-DmrRiPsU.js","assets/Shield01-CGOi4o3B.js","assets/Stars01-BxW6Ze_W.js","assets/Trash01-Ds3jbDQE.js","assets/Upload01-Cuswrale.js","assets/User01-DJhz4tmk.js","assets/Users01-D1GekRvz.js","assets/XClose-BbKrO-bh.js","assets/X-CvnlrpyG.js","assets/Zap-B-ccy6C4.js","assets/scroll-area-Dz-FqKWj.js","assets/use-clock-tick-bD6VBNNM.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-_XYMvM2G.js","assets/tooltip-BdbfQCYl.js","assets/file-type-icon-hjib5alc.js","assets/dialog-9Dal6l7D.js","assets/tab-id-BptcWVWa.js","assets/content-blocks-o63cs2vh.js","assets/types-D18PqArI.js","assets/use-mcp-client-DZQbnef-.js","assets/auth-DxKMCtEO.js","assets/chat-context-CdOsOHQ0.js","assets/hooks-Gm6nJHH5.js","assets/decopilot-sse-pool-D8ZetksK.js","assets/backoff-CrEUbyZT.js","assets/delay-CnY5UFtP.js","assets/use-virtual-mcp-BCkbHrLW.js","assets/use-collections-DaAI2dS_.js","assets/use-ai-providers-CiBlqHeC.js","assets/studio-tools-CJMVZA0W.js","assets/use-organization-settings-Bjk_kH1I.js","assets/shell-layout-BWQLmjyW.js","assets/avatar-CfKY2_hs.js","assets/required-auth-layout-BbLd1LMa.js","assets/use-org-sso-BhXMb9mL.js","assets/sheet-BvSpiY2r.js","assets/integration-icon-XSMgSpds.js","assets/use-navigate-to-agent-DUbEZuBm.js","assets/use-connection-z93iohVP.js","assets/use-mcp-prompts-CDHTi3et.js","assets/form-6Nre8f-k.js","assets/label-Bjb_vEVQ.js","assets/input-szhd6Snj.js","assets/select-FwtHY18v.js","assets/dropdown-menu-DveShRRm.js","assets/sortable.esm-DHMK7_tT.js","assets/schema-form-Cg7Lxy8-.js","assets/calendar-CaxcRF1k.js","assets/popover-CJ-idfVW.js","assets/textarea-BTbunR8j.js","assets/switch-YOR9drgK.js","assets/image-field-CfVmwwEw.js","assets/skeleton-B8_-zyKb.js","assets/tabs-CsXXbMGG.js","assets/use-file-configs-CS1kf1Mx.js","assets/useInfiniteQuery-CX9x55X-.js","assets/use-infinite-scroll-CUe3Elw1.js","assets/command-CLZq7t6J.js","assets/index-DcLVAN0f.js","assets/page-seo-form--ih05Y7N.js","assets/add-section-modal-DpjAnzTC.js","assets/index-ARPJar1Z.js","assets/drawer-DW4IYbB1.js","assets/collection-search-ClGGT1KV.js","assets/toggle-group-CSMS4HAA.js","assets/use-deco-credits-C3sjfJyT.js","assets/connection-slug-eyAPH6o3.js","assets/connection-card-CrUjfVJB.js","assets/use-registry-connections-DfipPXqa.js","assets/extract-connection-data-BL81V9PY.js","assets/card-DU2I8eHH.js","assets/collection-tabs-xD0Ry7Iv.js","assets/badge-tlnu_6T3.js","assets/connection-form-helpers-BqpyRjgd.js","assets/authenticate-and-persist-oauth-CXYJ_57C.js","assets/mcp-oauth-8Oqz2kjD.js","assets/useSuspenseInfiniteQuery-C_SaQkGF.js","assets/connect-desktop-dialog-BCsFp2qg.js","assets/decopilot-B2PnahSO.js","assets/checkbox-H7xxQ3iC.js","assets/ai-providers-logos-DD3qZ33J.js","assets/settings-section-PIk2gDH0.js","assets/question-004-sINsf4GQ.js","assets/use-status-sounds-DFtMiuOm.js","assets/empty-state-b7tnb7q2.js","assets/toolbar-CvxN3T7P.js","assets/preview-dialog-WfNb4k8L.js","assets/index-SIbEiNOY.js","assets/use-mcp-tools-DOD2Zkcv.js","assets/use-capability-DH5i0nun.js","assets/shell-route-loading-Cf96p6By.js","assets/index-DllFGtwL.js","assets/alert-dialog-gK63ktIU.js","assets/use-debounced-autosave-CaWQv8Ap.js","assets/index-DB4Y8lPy.js","assets/sidebar-LVNues-1.js","assets/search-input-DjVPTtCb.js","assets/github-repo-picker-CdGt5INt.js","assets/use-secrets-DCPSjnYq.js","assets/formatDistanceToNow-Cb2QZZJn.js","assets/view-mode-toggle-B1Thrh1l.js","assets/select-model-Bf7O5MiJ.js","assets/use-automations-44dHfXzj.js","assets/monaco-editor-Bzp2tCW_.js","assets/automation-runs-DiHYOI-G.js","assets/table-COWO-rWc.js","assets/use-members-Cgp-qtNm.js","assets/use-org-auth-client-TLh9Nsd6.js","assets/task-status-D4qDcTy4.js","assets/automation-list-row-BYfl9414.js","assets/save-referenced-block-Dw7QM0hK.js","assets/page-seo-sheet-BGthAy6g.js","assets/file-explorer-0kznGCON.js","assets/context-menu-CqLno4KJ.js","assets/app-editor-CB02ERjc.js","assets/save-status-BkW3fzUs.js","assets/post-editor-BhGUUjQx.js","assets/primitives-BmQhQ3Bl.js","assets/block-document-D35IO4X3.js","assets/record-editor-D9nFQqRP.js","assets/category-editor-CL_UxJoz.js","assets/seo-editor-BtQCMu5l.js","assets/variant-calendar-hE6C_kQd.js","assets/project-app-view-QWISlKTP.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as H,r as P,l as le,j as n,i as Ne,v as Ae,a as vi,a2 as Jt,b as Mt,u as wn,e as Nh,s as im,L as rm,k as As,K as Tt,m as qs,a3 as Cn,a4 as nm,a5 as om,t as ae,B as oe,a6 as Eh,a7 as am,a8 as lm,q as Ie,a9 as Th,aa as cm,ab as kn,ac as ar,ad as Dt,ae as hm,E as Ph,C as dm,x as um,af as It,P as Ah,ag as fm,U as mm,$ as Rh,W as pm,ah as gm,Q as _m,ai as vm,d as xi,y as Fr,aj as Ui,z as Yt,ak as Ut}from"./index-C6QaS0Zh.js";import{C as Ue,a as xm,w as bm,u as ya,s as bo,T as ym,b as Sm,g as wm,c as Cm}from"./index-ARPJar1Z.js";import{u as Gs,a as ys,b as Sa,c as Dh,S as wa,t as km,d as jm}from"./chat-context-CdOsOHQ0.js";import{i as _r}from"./AlertCircle-CKei65yQ.js";import{i as Ih}from"./CheckCircle-BZlFJbF8.js";import{n as Dl}from"./ChevronLeft-DPLHregZ.js";import{a as Nm,i as Em}from"./XCircle-CTJX6MKF.js";import{s as Ps}from"./XClose-BbKrO-bh.js";import{a as ds,u as Ca,b as Lh,c as Tm}from"./use-virtual-mcp-BCkbHrLW.js";import{c as Pm,u as Am,a as Bh,O as Rm,t as yo,S as jn,T as Dm,b as Mh,R as Im,C as Lm,G as Bm,g as Mm,s as Om,d as $m,e as zm,f as Fm}from"./scroll-area-Dz-FqKWj.js";import{I as us}from"./integration-icon-XSMgSpds.js";import{a as Oh,u as vt,S as ka,b as Hm,c as Wm,i as Um,d as $h}from"./use-mcp-client-DZQbnef-.js";import{a as Km}from"./Users03-CjtA3d84.js";import{t as Rs}from"./ChevronDown-DXOZkIso.js";import{u as Vm,h as qm,a as vr,c as zh,d as Ws,g as Gm,A as Ym,f as Xm,e as Jm}from"./use-deco-credits-C3sjfJyT.js";import{u as Fh}from"./use-ai-providers-CiBlqHeC.js";import{u as Zm}from"./connect-desktop-dialog-BCsFp2qg.js";import{r as Qm,b as ja,i as ep}from"./shell-layout-BWQLmjyW.js";import{u as Na,T as Ce,a as ke,b as je,c as Hh}from"./tooltip-BdbfQCYl.js";import{u as tp}from"./use-status-sounds-DFtMiuOm.js";import{E as Yr}from"./empty-state-b7tnb7q2.js";import{r as So,a as sp,p as Wh,f as Il,b as Uh,c as Kh,d as Vh,e as ip,F as rp,i as np,g as op,h as qh,j as Gh}from"./tab-id-BptcWVWa.js";import{u as Yh,a as Xh}from"./hooks-Gm6nJHH5.js";import{T as Ll,a as Ki}from"./toolbar-CvxN3T7P.js";import{u as ap,a as lp,b as cp,c as hp,g as dp,d as Jh,e as Bl,F as up,f as fp,h as mp,i as pp,j as gp,k as _p,l as vp,H as xp,L as bp,R as Zh,m as yp,n as Sp,T as Ea,o as wp,p as Cp}from"./preview-dialog-WfNb4k8L.js";import{g as lr,h as Ta,j as Qh,k as kp,p as Nn,l as En,m as Pa,n as ed,o as wo,q as Hn,r as Ml,A as Ol,s as jp,t as Np,u as Ep,v as Tp,w as Pp,x as Ap,y as Rp,z as Dp,B as Ip,C as Lp,D as Tn,E as Bp,F as $l,G as zl,H as Mp,d as Op,I as $p,J as zp,K as Aa,L as Xr,M as Ra,N as Co,O as Pn,P as Fp,Q as Hp,R as Wp,S as Up,T as Kp,U as Vp,V as qp,W as Fl,X as Gp,Y as Yp,Z as Xp,_ as td,$ as Jp}from"./agent-icon-BB2_1lHd.js";import{i as xr,n as Zp}from"./Globe01-CQy0Cxa-.js";import{i as sd}from"./Monitor01-CF5y8J9X.js";import{u as br,a as Da,b as id}from"./use-connection-z93iohVP.js";import{u as An,a as rd,b as nd}from"./use-mcp-tools-DOD2Zkcv.js";import{g as od}from"./types-D18PqArI.js";import{u as bi}from"./studio-tools-CJMVZA0W.js";import{u as Qp}from"./use-capability-DH5i0nun.js";import{F as ui,M as Ia,O as eg}from"./file-type-icon-hjib5alc.js";import{P as Ys,a as Xs,b as Js}from"./popover-CJ-idfVW.js";import{b as jt,c as Lt,S as Nt,a as Ye,d as Et}from"./select-FwtHY18v.js";import{D as os,a as as,b as ls,c as We,d as ko,e as jo,f as No,g as er,h as cr,i as Wn,j as Un}from"./dropdown-menu-DveShRRm.js";import{d as Kt,c as Vt,D as fs,a as ms,e as Zs,b as Rn}from"./dialog-9Dal6l7D.js";import{I as st}from"./input-szhd6Snj.js";import{T as Os,a as La,b as tr,c as Ba}from"./tabs-CsXXbMGG.js";import{T as Jr}from"./textarea-BTbunR8j.js";import{a as bs,s as tg}from"./Eye-IocHlobo.js";import{t as $s}from"./Stars01-BxW6Ze_W.js";import{l as sg,w as ig}from"./index-SIbEiNOY.js";import{i as ad}from"./ChevronRight-BkBgwZxs.js";import{a as Eo,b as ld}from"./ZoomOut-DRnFWZo9.js";import{S as rg}from"./shell-route-loading-Cf96p6By.js";import{a as ng}from"./extract-connection-data-BL81V9PY.js";import{A as Kn}from"./avatar-CfKY2_hs.js";import{T as cd,u as hd,I as og,R as ag,a as lg}from"./index-DllFGtwL.js";import{a as cg,i as Hl}from"./mcp-oauth-8Oqz2kjD.js";import{s as dd,g as hg}from"./connection-slug-eyAPH6o3.js";import{f as Zr,a as Qr,b as en,c as tn,d as sn,e as rn,A as nn,g as on}from"./alert-dialog-gK63ktIU.js";import{C as Ma,a as an}from"./card-DU2I8eHH.js";import{L as _t}from"./label-Bjb_vEVQ.js";import{S as ln}from"./switch-YOR9drgK.js";import{i as fi}from"./Play-BrJBHlm8.js";import{s as Bt}from"./Plus-DptVePQj.js";import{a as dg,i as ud}from"./Settings02-BynaGT2l.js";import{s as Us}from"./Trash01-Ds3jbDQE.js";import{u as cn}from"./use-debounced-autosave-CaWQv8Ap.js";import{i as hr}from"./SearchMd-DmrRiPsU.js";import{i as ug}from"./Upload01-Cuswrale.js";import{i as fg}from"./LayoutLeft-TAhoC2xE.js";import{P as Zt}from"./index-DB4Y8lPy.js";import{C as yi}from"./checkbox-H7xxQ3iC.js";import{S as fd}from"./search-input-DjVPTtCb.js";import{C as md}from"./collection-tabs-xD0Ry7Iv.js";import{u as mg}from"./use-mcp-prompts-CDHTi3et.js";import{b as pg,a as gg,D as _g}from"./drawer-DW4IYbB1.js";import{i as Si}from"./ChevronUp-BCwumcyZ.js";import{i as Oa}from"./Key01-ktWRCkRP.js";import{a as pd,G as vg}from"./github-repo-picker-CdGt5INt.js";import{S as gd}from"./skeleton-B8_-zyKb.js";import{s as xg}from"./User01-DJhz4tmk.js";import{t as Dn}from"./Users01-D1GekRvz.js";import{u as bg,a as yg}from"./use-secrets-DCPSjnYq.js";import{f as Sg}from"./formatDistanceToNow-Cb2QZZJn.js";import{n as wi}from"./LinkExternal01-BenQb5F0.js";import{s as mi}from"./Star01-G7bzpuzw.js";import{i as _d,s as sr}from"./Stars02-CJJhFv2L.js";import{V as wg}from"./view-mode-toggle-B1Thrh1l.js";import{n as To}from"./ZapSquare-bUJqwnW3.js";import{i as $a,a as Cg,b as za}from"./Tool01-hkwqrr6Q.js";import{c as vd,i as kg}from"./SwitchHorizontal01-D04vL0_f.js";import{i as xd}from"./X-CvnlrpyG.js";import{i as jg}from"./DotsVertical-DQDEDjEX.js";import{B as Ng}from"./badge-tlnu_6T3.js";import{C as Eg,e as Wl,d as Tg,b as Pg,c as Ag,a as Rg}from"./command-CLZq7t6J.js";import{M as Dg}from"./select-model-Bf7O5MiJ.js";import{u as yr,a as Ig,b as Lg,c as Bg,d as Mg}from"./use-automations-44dHfXzj.js";import{i as dr}from"./Zap-B-ccy6C4.js";import{M as Og}from"./monaco-editor-Bzp2tCW_.js";import{A as $g}from"./automation-runs-DiHYOI-G.js";import{A as zg}from"./automation-list-row-BYfl9414.js";function Ri(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function Ul(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 Fg(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Hg(t){const e=H.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Wg),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=n.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Wg(t){return n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[n.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),n.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Ug(t){const e=H.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,o=s+i+r,a=o>0?s/o*100:0,l=o>0?i/o*100:0,h=o>0?r/o*100:0;let c;e[0]!==a?(c=a>0&&n.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==l?(d=l>0&&n.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=d):d=e[3];let u;e[4]!==h?(u=h>0&&n.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==d||e[8]!==u?(f=n.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=m):m=e[10];let p;e[11]!==a?(p=a.toFixed(1),e[11]=a,e[12]=p):p=e[12];let g;e[13]!==p?(g=n.jsxs("div",{className:"flex items-center gap-1.5",children:[m,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",p,"%"]})]}),e[13]=p,e[14]=g):g=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=v):v=e[15];let b;e[16]!==l?(b=l.toFixed(1),e[16]=l,e[17]=b):b=e[17];let x;e[18]!==b?(x=n.jsxs("div",{className:"flex items-center gap-1.5",children:[v,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",b,"%"]})]}),e[18]=b,e[19]=x):x=e[19];let _;e[20]!==h||e[21]!==r?(_=r>0&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=_):_=e[22];let y;e[23]!==x||e[24]!==_||e[25]!==g?(y=n.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[g,x,_]}),e[23]=x,e[24]=_,e[25]=g,e[26]=y):y=e[26];let S;return e[27]!==y||e[28]!==f?(S=n.jsxs("div",{className:"flex flex-col gap-2",children:[f,y]}),e[27]=y,e[28]=f,e[29]=S):S=e[29],S}function Kg(t){const e=H.c(11),{agentId:s,isError:i}=t,r=ds(s),o=r?.title??"Subtask",a=r?.icon??null;let l;e[0]!==a||e[1]!==o?(l=n.jsx(us,{icon:a,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=o,e[2]=l):l=e[2];const h=i?"text-destructive":"text-foreground";let c;e[3]!==h?(c=le("shrink-0 font-medium",h),e[3]=h,e[4]=c):c=e[4];let d;e[5]!==o||e[6]!==c?(d=n.jsx("span",{className:c,children:o}),e[5]=o,e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==l||e[9]!==d?(u=n.jsxs(n.Fragment,{children:[l,d]}),e[8]=l,e[9]=d,e[10]=u):u=e[10],u}function Vg(t){const e=H.c(5),{isError:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(us,{icon:null,name:"Subtask",size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=i):i=e[0];const r=s?"text-destructive":"text-foreground";let o;e[1]!==r?(o=le("shrink-0 font-medium",r),e[1]=r,e[2]=o):o=e[2];let a;return e[3]!==o?(a=n.jsxs(n.Fragment,{children:[i,n.jsx("span",{className:o,children:"Subtask"})]}),e[3]=o,e[4]=a):a=e[4],a}function qg(t){const e=H.c(18),{part:s}=t,i=s.input?.agent_id,r=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",a=s.state==="approval-requested";let l;e[0]!==o?(l=n.jsx(Vg,{isError:o}),e[0]=o,e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==o?(h=n.jsx(Kg,{agentId:i,isError:o}),e[2]=i,e[3]=o,e[4]=h):h=e[4];let c;e[5]!==l||e[6]!==h?(c=n.jsx(P.Suspense,{fallback:l,children:h}),e[5]=l,e[6]=h,e[7]=c):c=e[7];let d;e[8]!==s.input?(d=s.input?.prompt&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground/50",children:"·"}),n.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==o||e[12]!==r?(u=n.jsx("span",{className:"ml-auto shrink-0",children:r?n.jsx(Ne,{size:12,className:"animate-spin text-muted-foreground"}):o?n.jsx(Nm,{size:12,className:"text-destructive"}):a?n.jsx(_r,{size:12,className:"text-warning"}):n.jsx(Ih,{size:12,className:"text-emerald-500"})}),e[10]=a,e[11]=o,e[12]=r,e[13]=u):u=e[13];let f;return e[14]!==c||e[15]!==d||e[16]!==u?(f=n.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[c,d,u]}),e[14]=c,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function Gg(t){const e=H.c(55),{onClose:s,back:i,className:r}=t,[o,a]=P.useState(null),{messages:l}=Gs(),{activeTask:h}=ys(),{selectedModel:c,selectedVirtualMcp:d}=Sa();let u,f,m,p,g,v,b,x;if(e[0]!==h||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==s||e[5]!==o?.id||e[6]!==c||e[7]!==d?.title){x=Symbol.for("react.early_return_sentinel");e:{const S=Pm(l),w=[...l].reverse().find(n_),j=w?.metadata?.usage,E=w?.metadata?.modelLimits?.contextWindow??c?.limits?.contextWindow??null,T=j?.contextTokens??0,A=E&&E>0?(T/E*100).toFixed(1):null,R=l;let k;e[16]!==R?(k=R.filter(r_).reduce(i_,0),e[16]=R,e[17]=k):k=e[17];const C=k,D=l;let N;e[18]!==D?(N=D.filter(s_).reduce(t_,0),e[18]=D,e[19]=N):N=e[19];const L=N,B=Math.max(0,S.totalTokens-C-L),I=l[0],M=l.at(-1),O=I?.metadata?.created_at??h?.created_at,F=M?.metadata?.created_at??h?.updated_at,z=l.filter(e_),V=l.flatMap(Zg),G=c?.modelId?Fg(c.modelId):"—",X=d?.title??"Decopilot",ie=[{label:"Session",value:h?.title??"New chat"},{label:"Messages",value:z.length},{label:"Agent",value:X},{label:"Model",value:G},{label:"Context Limit",value:E?Ri(E):"—"},{label:"Session Tokens (billed)",value:S.totalTokens>0?Ri(S.totalTokens):"0"},{label:"Usage",value:A!==null?`${A}%`:"—"},{label:"Input Tokens",value:S.inputTokens>0?Ri(S.inputTokens):"0"},{label:"Output Tokens",value:S.outputTokens>0?Ri(S.outputTokens):"0"},{label:"Reasoning Tokens",value:S.reasoningTokens>0?Ri(S.reasoningTokens):"0"},{label:"Cost",value:S.cost>0?`$${S.cost<.001?S.cost.toFixed(6):S.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:Ul(O)},{label:"Last Activity",value:Ul(F)}];if(!h&&z.length===0){let $;e[20]!==r?($=le("flex flex-col h-full w-full border-l border-border bg-background",r),e[20]=r,e[21]=$):$=e[21];let Z;e[22]===Symbol.for("react.memo_cache_sentinel")?(Z=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[22]=Z):Z=e[22];let K;e[23]!==i?(K=i?n.jsx(Dl,{size:14,className:"text-muted-foreground"}):n.jsx(Ps,{size:14,className:"text-muted-foreground"}),e[23]=i,e[24]=K):K=e[24];let ee;e[25]!==s||e[26]!==K?(ee=n.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[Z,n.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:K})]}),e[25]=s,e[26]=K,e[27]=ee):ee=e[27];let Q;e[28]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:n.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[28]=Q):Q=e[28];let fe;e[29]!==$||e[30]!==ee?(fe=n.jsxs("div",{className:$,children:[ee,Q]}),e[29]=$,e[30]=ee,e[31]=fe):fe=e[31],x=fe;break e}e[32]!==r?(v=le("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[32]=r,e[33]=v):v=e[33];let U;e[34]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[34]=U):U=e[34];let Y;e[35]!==i?(Y=i?n.jsx(Dl,{size:14}):n.jsx(Ps,{size:14}),e[35]=i,e[36]=Y):Y=e[36],e[37]!==s||e[38]!==Y?(b=n.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[U,n.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[37]=s,e[38]=Y,e[39]=b):b=e[39],u="flex flex-col gap-8 p-6",f=V.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),n.jsx("div",{className:"flex flex-col gap-1",children:V.map(Jg)})]}),m=n.jsx(Hg,{items:ie});let ne;e[40]===Symbol.for("react.memo_cache_sentinel")?(ne=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[40]=ne):ne=e[40],e[41]!==L||e[42]!==B||e[43]!==C?(p=n.jsxs("div",{className:"flex flex-col gap-3",children:[ne,n.jsx(Ug,{userTokens:C,assistantTokens:L,otherTokens:B})]}),e[41]=L,e[42]=B,e[43]=C,e[44]=p):p=e[44],g=z.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),n.jsx("div",{className:"flex flex-col gap-1",children:z.map($=>{const Z=$.metadata?.created_at,K=o?.id===$.id;return n.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[n.jsxs("button",{type:"button",onClick:()=>a(K?null:$),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:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:le("shrink-0 font-medium",$.role==="user"?"text-chart-1":"text-chart-2"),children:$.role}),n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsx("span",{className:"truncate text-muted-foreground font-mono",children:$.id})]}),Z&&n.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(Z).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),K&&n.jsxs(n.Fragment,{children:[$.role==="assistant"&&(()=>{const ee=$.metadata?._request;if(!ee)return null;const Q=ee.systemSections??[],fe=Math.max(1,...Q.map(Xg)),me=Q.reduce(Yg,0);return n.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-medium text-foreground",children:"Request"}),n.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[ee.activeTools??0," / ",ee.tools??0," ","tools active"]})]}),Q.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",n.jsxs("span",{className:"tabular-nums",children:["~",Math.round(me/4).toLocaleString()," ","tok"]})]}),Q.map((_e,J)=>{const se=_e.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${J}`,pe=_e.chars/fe*100,ge=Math.round(_e.chars/4);return n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-mono text-foreground truncate",children:se}),n.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",ge.toLocaleString()," tok"]})]}),n.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:n.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${pe}%`}})})]},J)})]})]})})(),n.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($,null,2)})]})]},$.id)})})]})}e[0]=h,e[1]=i,e[2]=r,e[3]=l,e[4]=s,e[5]=o?.id,e[6]=c,e[7]=d?.title,e[8]=u,e[9]=f,e[10]=m,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=x}else u=e[8],f=e[9],m=e[10],p=e[11],g=e[12],v=e[13],b=e[14],x=e[15];if(x!==Symbol.for("react.early_return_sentinel"))return x;let _;e[45]!==u||e[46]!==f||e[47]!==m||e[48]!==p||e[49]!==g?(_=n.jsxs("div",{className:u,children:[f,m,p,g]}),e[45]=u,e[46]=f,e[47]=m,e[48]=p,e[49]=g,e[50]=_):_=e[50];let y;return e[51]!==v||e[52]!==b||e[53]!==_?(y=n.jsxs("div",{className:v,children:[b,_]}),e[51]=v,e[52]=b,e[53]=_,e[54]=y):y=e[54],y}function Yg(t,e){return t+e.chars}function Xg(t){return t.chars}function Jg(t,e){return n.jsx(qg,{part:t},e)}function Zg(t){return(t.parts??[]).filter(Qg)}function Qg(t){return t.type==="tool-subtask"}function e_(t){return t.role!=="system"}function t_(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function s_(t){return t.role==="assistant"}function i_(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function r_(t){return t.role==="user"}function n_(t){return t.role==="assistant"&&t.metadata?.usage}function o_(t){const e=H.c(13),{readOnly:s,identity:i,aboveRow:r,input:o,iceBreakers:a}=t,l=!s&&i?i:null;let h;e[0]!==r||e[1]!==s?(h=!s&&r?n.jsx("div",{"data-chat-above-row":"true",className:"@container/chat-bottom flex justify-start gap-1",children:r}):null,e[0]=r,e[1]=s,e[2]=h):h=e[2];let c;e[3]!==o||e[4]!==h?(c=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,o]}),e[3]=o,e[4]=h,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==s?(d=!s&&a?n.jsx("div",{className:"w-full",children:a}):null,e[6]=a,e[7]=s,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==c||e[11]!==d?(u=n.jsx("div",{"data-chat-centered":"true",className:"h-full w-full flex flex-col items-center justify-center px-4 gap-6",children:n.jsxs("div",{className:"w-full max-w-3xl flex flex-col gap-6",children:[l,c,d]})}),e[9]=l,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function a_(t){const e=H.c(25),{onOpenContextPanel:s}=t,{org:i}=Ae(),{selectedVirtualMcp:r}=Sa();let o;e[0]!==i.id?(o=Oh(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=r??o,h=ds(l.id),c=Dh(),{data:d}=vi.useSession(),u=d?.user?.id,f=c?.activeTask??null,m=!!(u&&f?.created_by&&f.created_by!==u);let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Km,{size:32}),e[2]=p):p=e[2];let g;e[3]!==l.icon||e[4]!==l.title?(g=n.jsx(us,{icon:l.icon,name:l.title,size:"lg",fallbackIcon:p,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),e[3]=l.icon,e[4]=l.title,e[5]=g):g=e[5];let v;e[6]!==l.title?(v=n.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:l.title}),e[6]=l.title,e[7]=v):v=e[7];const b=l.description??"Ask anything about configuring model providers or using MCP Mesh.";let x;e[8]!==b?(x=n.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:b}),e[8]=b,e[9]=x):x=e[9];let _;e[10]!==g||e[11]!==v||e[12]!==x?(_=n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[g,v,x]}),e[10]=g,e[11]=v,e[12]=x,e[13]=_):_=e[13];const y=c?.currentBranch??null;let S;e[14]!==h||e[15]!==y?(S=n.jsx(xm,{virtualMcp:h,currentBranch:y}),e[14]=h,e[15]=y,e[16]=S):S=e[16];let w;e[17]!==s?(w=n.jsx(Ue.Input,{onOpenContextPanel:s}),e[17]=s,e[18]=w):w=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ue.IceBreakers,{}),e[19]=j):j=e[19];let E;return e[20]!==m||e[21]!==w||e[22]!==_||e[23]!==S?(E=n.jsx(o_,{readOnly:m,identity:_,aboveRow:S,input:w,iceBreakers:j}),e[20]=m,e[21]=w,e[22]=_,e[23]=S,e[24]=E):E=e[24],E}function Kl(t){const e=H.c(17),{outputs:s,collapsed:i,onToggle:r,variant:o}=t,a=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let l;e[0]!==a?(l=le(a),e[0]=a,e[1]=l):l=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=h):h=e[2];const c=i&&"-rotate-90";let d;e[3]!==c?(d=le("size-4 text-muted-foreground transition-transform",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==d?(u=n.jsx(Rs,{className:d}),e[5]=d,e[6]=u):u=e[6];let f;e[7]!==r||e[8]!==u?(f=n.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[h,u]}),e[7]=r,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==i||e[11]!==s?(m=!i&&n.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(l_)}),e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==l||e[14]!==f||e[15]!==m?(p=n.jsxs("div",{className:l,children:[f,m]}),e[13]=l,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function l_(t){return n.jsx(Rm,{file:t},t.key)}function c_(){const t=H.c(13),e=Dh()?.taskId??null,s=Am();let i;t[0]!==s?(i={enabled:s},t[0]=s,t[1]=i):i=t[1];const{data:r}=Bh(e,i),[o,a]=P.useState(!1),[l,h]=P.useState(!0);if(!e||!r||r.length===0)return null;let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(d_),t[2]=c):c=t[2];let d;t[3]!==o||t[4]!==r?(d=n.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:n.jsx(Kl,{variant:"card",outputs:r,collapsed:o,onToggle:c})}),t[3]=o,t[4]=r,t[5]=d):d=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>h(h_),t[6]=u):u=t[6];let f;t[7]!==l||t[8]!==r?(f=n.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:n.jsx(Kl,{variant:"bar",outputs:r,collapsed:l,onToggle:u})}),t[7]=l,t[8]=r,t[9]=f):f=t[9];let m;return t[10]!==d||t[11]!==f?(m=n.jsxs(n.Fragment,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=m):m=t[12],m}function h_(t){return!t}function d_(t){return!t}function u_(){const t=H.c(26),{org:e}=Ae(),s=Fh(),{isChatEmpty:i}=Gs(),[r,o]=P.useState("chat"),a=Vm(),l=Zm();if(s.length===0&&!qm(l)){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(Ue,{className:"animate-in fade-in-0 duration-200",children:n.jsx(Ue.Main,{className:"flex flex-col items-center",children:n.jsx(Ue.EmptyState,{children:n.jsx(Ue.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let c;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(c=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!bm(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=c):c=t[7];const d=c;let u;t[8]!==d?(u=d&&n.jsx(Ue.CreditsEmptyState,{}),t[8]=d,t[9]=u):u=t[9];const f=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let m;t[10]!==f?(m=le("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]!==i?(p=i?n.jsx(Ue.Main,{children:n.jsx(a_,{onOpenContextPanel:()=>o("context")})}):n.jsxs(n.Fragment,{children:[n.jsxs(Ue.Main,{className:"relative flex flex-col overflow-hidden @container",children:[n.jsx(c_,{}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Ue.Messages,{})})]}),n.jsx(Ue.Footer,{children:n.jsx(Ue.Input,{onOpenContextPanel:()=>o("context")})})]}),t[12]=i,t[13]=p):p=t[13];let g;t[14]!==m||t[15]!==p?(g=n.jsx("div",{className:m,children:p}),t[14]=m,t[15]=p,t[16]=g):g=t[16];const v=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let b;t[17]!==v?(b=le("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",v),t[17]=v,t[18]=b):b=t[18];let x;t[19]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Gg,{back:!0,onClose:()=>o("chat")}),t[19]=x):x=t[19];let _;t[20]!==b?(_=n.jsx("div",{className:b,children:x}),t[20]=b,t[21]=_):_=t[21];let y;return t[22]!==u||t[23]!==g||t[24]!==_?(y=n.jsxs(Ue,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[u,g,_]}),t[22]=u,t[23]=g,t[24]=_,t[25]=y):y=t[25],y}function bd(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Ue.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Jt,{fallback:e,children:n.jsx(P.Suspense,{fallback:n.jsx(Ue.Skeleton,{}),children:n.jsx(u_,{})})}),t[1]=s):s=t[1],s}function f_(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",i=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:i,chatOpen:r}}function Vl(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function m_(t,e){return t===1?!0:t===0?!1:e}function p_(t,e){const s=Mt(),i=wn({strict:!1}),r=Nh({strict:!1}),{create:o}=Yh(),{locator:a}=Ae(),{virtualMcpId:l,orgSlug:h,isAgentRoute:c}=e,d=f_({entityMetadata:t,mainParamPresent:i.main!==void 0,mainParamValue:i.main}),u=m_(i.chat,d.chatOpen),f=d.mainOpen,m=P.useRef(crypto.randomUUID()),p=r.taskId??m.current,g="/$org/$taskId",v=T=>({org:h,taskId:T}),b=c?{virtualmcpid:l}:{},x=(T,A)=>{s({to:g,params:v(p),search:R=>({...R,...T}),replace:A?.replace??!1})},_=(T,A)=>{s({to:g,params:v(T),search:R=>{const k={};return A?k.virtualmcpid=A:c&&(k.virtualmcpid=l),k}})},y=()=>{f?x({main:"0"},{replace:!0}):x({main:So(t)},{replace:!0})},S=()=>{x({chat:u?0:1},{replace:!0})},w=()=>{u||x({chat:1},{replace:!0})},j=async()=>{const T=crypto.randomUUID(),A=Qm(h,a,p);try{await o({id:T,virtual_mcp_id:l,...A?{branch:A}:{}})}catch{}s({to:g,params:v(T),search:R=>({...b,chat:1})})},E=T=>{x({main:T},{replace:!0})};return{taskId:p,mainOpen:f,chatOpen:u,mainParam:i.main,setTaskId:_,toggleMain:y,toggleChat:S,openChat:w,createNewTask:j,openTab:E}}const Fa=45;function yd(t,e=Fa){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function g_(t){return yd(t,Fa)}function __(){const t=H.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=rm.decoChatPanelWidth(),t[0]=e):e=t[0];const[s,i]=im(e,g_);let r;t[1]!==s?(r=yd(s,Fa),t[1]=s,t[2]=r):r=t[2];const o=r;let a;return t[3]!==i||t[4]!==o?(a=[o,i],t[3]=i,t[4]=o,t[5]=a):a=t[5],a}function v_(t){try{return JSON.parse(t)}catch{return null}}function x_(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,i=s?v_(s):null,r=e.structuredContent;return r==null?i:typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0?i??r:r}function Qs(t){const e=x_(t);return e===null?null:e}function Ha(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 b_(t){if(!t||typeof t!="object")return null;const e=t.content?.find(r=>r.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],i=Ha(s);return!i||!s?null:{number:i,htmlUrl:s}}const ql=/[\r\n<>]/,y_=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Sr(t){const e=t?.userName?.trim();if(!e||ql.test(e))return null;const s=t?.userEmail?.trim();return!s||ql.test(s)?{userName:e}:y_.test(s)?{userName:e,userEmail:s}:{userName:e}}function S_(t){return t.split(`
|
|
3
3
|
`).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
|
|
4
4
|
`).trimEnd()}function w_(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function Sd(t,e){const s=Sr(e);if(!s)return t;const i=S_(t),r=w_(s);if(i.includes(r))return i;const o=i.trimEnd();return o.length>0?`${o}
|
|
5
5
|
|
|
@@ -463,7 +463,7 @@ ${Z}`:Z;c.setValue("metadata.instructions",K,{shouldDirty:!0})},X=new Set(d.map(
|
|
|
463
463
|
8% { opacity: 1; }
|
|
464
464
|
22% { opacity: 0; }
|
|
465
465
|
}
|
|
466
|
-
`}),e[26]=y):y=e[26];let S;return e[27]!==_||e[28]!==d?(S=n.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:[d,_,y]}),e[27]=_,e[28]=d,e[29]=S):S=e[29],S}function Dr(t){const e=H.c(10),{phase:s,current:i,children:r}=t,o=s-i,a=o<0,l=o===0,h=a?90:o*-22,c=a?.94:1-Math.max(o,0)*.04,d=a?0:l?1:o===1?.8:.55,u=a?10:30-o,f=!l;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=le("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(${h}px) scale(${c})`,g=l?"auto":"none";let v;e[1]!==d||e[2]!==p||e[3]!==g||e[4]!==u?(v={transform:p,opacity:d,zIndex:u,transitionDuration:"1000ms",pointerEvents:g},e[1]=d,e[2]=p,e[3]=g,e[4]=u,e[5]=v):v=e[5];let b;return e[6]!==r||e[7]!==f||e[8]!==v?(b=n.jsx("div",{"aria-hidden":f,className:m,style:v,children:r}),e[6]=r,e[7]=f,e[8]=v,e[9]=b):b=e[9],b}function Bn(t){const e=H.c(7),{showUrl:s}=t,i=s===void 0?!1:s;let r,o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:le("size-2.5 rounded-full",Ft)}),o=n.jsx("div",{className:le("size-2.5 rounded-full",Ft)}),a=n.jsx("div",{className:le("size-2.5 rounded-full",Ft)}),e[0]=r,e[1]=o,e[2]=a):(r=e[0],o=e[1],a=e[2]);let l;e[3]!==i?(l=i&&n.jsx("div",{className:le("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",rs)}),e[3]=i,e[4]=l):l=e[4];let h;return e[5]!==l?(h=n.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[r,o,a,l]}),e[5]=l,e[6]=h):h=e[6],h}function Vb(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Bn,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"flex flex-1 px-8 py-5",children:n.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:zb.map(qb)})})]}),t[1]=s):s=t[1],s}function qb(t,e){if(e===Au)return n.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 n.jsx("div",{className:le("relative rounded-md",Ft),children:n.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${Ru}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function Gb(){const t=H.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Bn,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:le("w-[18%] rounded-md",rs),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=n.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]=i):i=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.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]=r):r=t[3];let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[i,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[r,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[n.jsx("div",{className:le("rounded-md",rs),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),n.jsx("div",{className:le("rounded-md",rs),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function Yb(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Bn,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:n.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:Wb.map(Xb)})})]}),t[1]=s):s=t[1],s}function Xb(t,e){return n.jsx("div",{className:le("aspect-square rounded-md",Ub[e]?"bg-chart-2/70":Ft),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function Jb(){const t=H.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Bn,{showUrl:!0}),t[0]=e):e=t[0];let s,i,r,o,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),i=n.jsx("div",{className:le("h-1.5 w-[70%] rounded-sm",Ft)}),r=n.jsx("div",{className:le("h-1.5 w-[55%] rounded-sm",Ft)}),o=n.jsx("div",{className:le("h-1.5 w-[80%] rounded-sm",Ft)}),a=n.jsx("div",{className:le("h-1.5 w-[50%] rounded-sm",Ft)}),t[1]=s,t[2]=i,t[3]=r,t[4]=o,t[5]=a):(s=t[1],i=t[2],r=t[3],o=t[4],a=t[5]);let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,i,r,o,a,n.jsx("div",{className:"mt-auto",children:n.jsx("div",{className:le("h-4 rounded-md",Ft)})})]}),t[6]=l):l=t[6];let h;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:n.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[n.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),n.jsx("div",{className:le("h-1.5 w-[55%] rounded-sm",rs)})]})}),t[7]=h):h=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[n.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),n.jsx("div",{className:le("h-4 w-10 rounded-full",rs)}),n.jsx("div",{className:le("h-4 w-14 rounded-full",rs)})]}),t[8]=c):c=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs("div",{className:le("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",rs),children:[n.jsx("div",{className:le("h-1.5 w-[50%] rounded-sm",Ft)}),n.jsx("div",{className:le("h-1 w-[75%] rounded-sm",Ft)})]}),t[9]=d):d=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1",children:[l,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[c,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[d,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[n.jsx("div",{className:le("rounded-md",rs)}),n.jsx("div",{className:le("rounded-md",rs)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function mn(t){const e=H.c(9);if(t.kind==="starting"){let l;return e[0]!==t.claimPhase||e[1]!==t.progress?(l=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsx(Kb,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=l):l=e[2],l}let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Bp,{className:"size-12 text-blue-500"}),e[3]=s):s=e[3];let i,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("h3",{className:"text-lg font-medium",children:Ob("suspended")}),r=n.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Resume to continue."}),e[4]=i,e[5]=r):(i=e[4],r=e[5]);let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(fi,{className:"size-4"}),e[6]=o):o=e[6];let a;return e[7]!==t.onResume?(a=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[s,i,r,n.jsxs(oe,{onClick:t.onResume,className:"mt-2",children:[o," Resume"]})]})}),e[7]=t.onResume,e[8]=a):a=e[8],a}function Zb(t){const e=H.c(12),{orgSlug:s,virtualMcpId:i,branch:r,enabled:o}=t,a=o===void 0?!0:o;let l;e[0]!==r||e[1]!==s||e[2]!==i?(l=Tt.sandboxRepoDir(s,i,r),e[0]=r,e[1]=s,e[2]=i,e[3]=l):l=e[3];let h;e[4]!==r||e[5]!==s||e[6]!==i?(h=async()=>{const u=`/api/${s}/sandbox/${encodeURIComponent(i)}/${encodeURIComponent(r)}/config`,f=await fetch(u);return f.ok?(await f.json()).repoDir??null:null},e[4]=r,e[5]=s,e[6]=i,e[7]=h):h=e[7];let c;return e[8]!==a||e[9]!==l||e[10]!==h?(c={queryKey:l,queryFn:h,enabled:a,staleTime:1/0},e[8]=a,e[9]=l,e[10]=h,e[11]=c):c=e[11],As(c).data??null}const pc="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",gc="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",Qb=P.lazy(()=>Ut(()=>import("./sections-editor-NjvzZlHu.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])).then(t=>({default:t.SectionsEditor}))),ey=P.lazy(()=>Ut(()=>import("./page-seo-sheet-C5rR31Cs.js"),__vite__mapDeps([146,1,2,70,42,44,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,43,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,71,72,73,74,75,76,77,78,94,85,81,82,83,84,80,79,86,87,88,89,90,91,92,93,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])).then(t=>({default:t.SeoSheet}))),ty=P.lazy(()=>Ut(()=>import("./file-explorer-CtIkaECZ.js"),__vite__mapDeps([147,1,2,122,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,127,148,121,87,79,83,96,97,98,88,99,100,101,102,103,90,91,104,105,106,107,84,108,109,110,111,112,113,114,115,116,92,93,117,118,119,120,123,124,125,126,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144])).then(t=>({default:t.FileExplorer}))),Zn=500,sy={mobile:375,tablet:768,desktop:null},Qn=["desktop","mobile","tablet"],iy={mobile:"Mobile (375px)",tablet:"Tablet (768px)",desktop:"Desktop"},ry="website/sections/Rendering/Lazy.tsx";function Io(t,e){let s=t,i=typeof s?.__resolveType=="string"?s.__resolveType:"";for(let r=0;i&&r<5;r++){const o=e[i];if(o&&typeof o=="object"&&"__resolveType"in o){const a=o.__resolveType;if(typeof a=="string"&&a&&a!==i){s=o,i=a;continue}}break}if(!i)return[];if(i.includes("flags/multivariate")){const r=Array.isArray(s.variants)?s.variants:[],o=[];for(const a of r){const l=a?.value;if(l&&typeof l=="object")for(const h of Io(l,e))o.includes(h)||o.push(h)}return o}if(i===ry){const r=s.section&&typeof s.section=="object"?Io(s.section,e):[];return r.length?[i,...r]:[i]}return[i]}function ny(t,e){const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}function oy(){const t=Er(),{currentBranch:e}=ys(),[s,i]=P.useState("preview"),[r,o]=P.useState("desktop"),[a,l]=P.useState(null),h=P.useRef(null),c=s==="cms",[d,u]=P.useState(null),[f,m]=P.useState(null),[p,g]=P.useState(384),v=P.useRef(!1),b=P.useRef(0),x=P.useRef(0),_=P.useRef(null),[y,S]=P.useState(!1),[w,j]=P.useState(""),E=P.useRef(null),[T,A]=P.useState(!1),[R,k]=P.useState(),[C,D]=P.useState(null),[N,L]=P.useState(null),[B,I]=P.useState("/"),[M,O]=P.useState(null),[F,z]=P.useState(!1),[V,G]=P.useState(!1),[X,ie]=P.useState(null),U=t?.entity?.id??null,{org:Y}=Ae(),ne=ps(),$=al(),Z=$.vmEntry,K=$.previewUrl,ee=ne.lifecycle.phase,Q=ee==="running",fe=Z?.sandboxProviderKind==="user-desktop",me=Zb({orgSlug:Y.slug,virtualMcpId:U??"",branch:e??"",enabled:fe&&Q&&!!U&&!!e}),_e=fe?me:null,J=U&&e&&Q?{orgSlug:Y.slug,virtualMcpId:U,branch:e,previewUrl:K}:null,{data:se}=qa(J,{fetchEnabled:Q}),{data:pe}=Ga(J,{fetchEnabled:Q}),ge=U&&e?{orgSlug:Y.slug,virtualMcpId:U,branch:e}:null,Be=Eb(ge),Le=se?nl(se).sort((te,ye)=>te.name.localeCompare(ye.name)):[],Ee=se&&pe?ol(se,pe):[],Ze=hi,ct=Le.filter(te=>{if(!w)return!0;const ye=w.toLowerCase();return te.name.toLowerCase().includes(ye)||te.path.toLowerCase().includes(ye)}),yt=Ee.filter(te=>{if(!w)return!0;const ye=w.toLowerCase();return te.name.toLowerCase().includes(ye)||te.key.toLowerCase().includes(ye)||te.resolveType.toLowerCase().includes(ye)}),mt=C?null:ov(Le,B,M),St=C?C.name:mt?.name,qe=mt?.key??null,wt=se&&qe?ju(se,qe,0):[],qt=se?fb(wt,se):[],pt=qt.map(te=>te.isSavedBlock?te.label:""),Ot=qt.map(te=>te.isSavedBlock?"global":te.isMultivariate?"variant":"normal"),Ct=wt.map(te=>Io(te,se??{})),xe=P.useRef(null),he=P.useRef(null);_v(()=>{const te=h.current,ye=xe.current;!te||!ye||(te.src=ye)});const Pe=ne.status.state==="paused",ze=ne.phase,Re=Pu({claimPhase:ze,lifecycle:ne.lifecycle}),Oe=$.previewState,q=$.userStopped,W=Oe.kind==="iframe"?ub(ny(N??new URL(B,Oe.previewUrl).href,r),c&&f?f:[]):null,[de,ve]=P.useState(null);if(Oe.kind==="iframe"&&de!==Oe.previewUrl){const te=de!==null;ve(Oe.previewUrl),te&&(he.current=null,I("/"),L(null),O(null),D(null))}xe.current=W;const Te=!!U&&!!e&&!ne.notFound&&!q&&!Pe&&(ze?.kind==="ready"||ee!=="idle"),Qe=Oe.kind!=="iframe"&&(s==="visual"||s==="cms")?"preview":s;P.useEffect(()=>{if(!K)return;let te;try{te=new URL(K,window.location.href).origin}catch{return}const ye=ht=>{if(ht.origin===te){if(ht.data?.type==="visual-editor::element-clicked"){const dt=Pb.safeParse(ht.data.payload);dt.success&&l(dt.data)}else if(ht.data?.type==="cms-editor::section-clicked"){const dt=Rb.safeParse(ht.data.payload);dt.success&&u(dt.data.sectionIndex)}}};return window.addEventListener("message",ye),()=>window.removeEventListener("message",ye)},[K]),P.useEffect(()=>{if(!y)return;const te=ye=>{E.current?.contains(ye.target)||(S(!1),j(""))};return document.addEventListener("pointerdown",te),()=>document.removeEventListener("pointerdown",te)},[y]),P.useEffect(()=>{if(!c)return;const te=ht=>{const dt=ht.target;dt&&dt!==h.current&&(_.current=dt)},ye=()=>{requestAnimationFrame(()=>{const ht=document.activeElement;(ht===document.body||ht===h.current)&&_.current&&_.current.focus()})};return document.addEventListener("focusin",te),document.addEventListener("blur",ye,!0),()=>{document.removeEventListener("focusin",te),document.removeEventListener("blur",ye,!0)}},[c]);const si=()=>{const te=h.current?.contentWindow;te&&te.postMessage({type:"visual-editor::activate",script:Ab},"*")},Tr=()=>{const te=h.current?.contentWindow;te&&te.postMessage({type:"visual-editor::deactivate"},"*")},Al=()=>{const te=h.current?.contentWindow;te&&(te.postMessage({type:"visual-editor::activate",script:Db},"*"),te.postMessage({type:"cms-editor::set-labels",labels:pt,kinds:Ot,keys:Ct},"*"))},Kf=()=>{const te=h.current?.contentWindow;te&&te.postMessage({type:"cms-editor::deactivate"},"*")},Ai=te=>{const ye=s;i(te),l(null),te!=="code"&&ie(null),te!=="cms"&&(u(null),m(null)),ye==="visual"&&Tr(),ye==="cms"&&Kf(),te==="visual"&&si(),te==="cms"&&Al()},Vf=()=>{if(!h.current||!W)return;const te=h.current;te.src=W},qf=te=>{m(te)},Gf=()=>{const te=h.current;if(!te)return;const ye=document.activeElement,ht=te.tabIndex;te.tabIndex=-1,te.style.pointerEvents="none",te.blur();try{te.contentWindow?.location.reload()}catch{const Gt=xe.current;Gt&&(te.src=Gt)}const dt=()=>{te.tabIndex=ht,te.style.pointerEvents="",ye?.focus(),te.removeEventListener("load",dt)};te.addEventListener("load",dt),setTimeout(dt,3e3)},Yf=()=>{if(!h.current||!W)return;const te=W.includes("?")?"&":"?";h.current.src=`${W}${te}_r=${Date.now()}`},Xf=()=>{const te=Qn.indexOf(r);o(Qn[(te+1)%Qn.length])},Jf=()=>{const te=h.current?.contentWindow?.location?.href??W??K;te&&navigator.clipboard.writeText(te)},Zf=(()=>{if(!K)return"No server running";if(C)return C.name;try{const te=new URL(K),ye=B==="/"?"":B;return`${te.host}${ye}`}catch{return K}})(),Rl=te=>{he.current=te.path,D(null),L(null),O(te.key),I(te.path),u(null),z(!1)},Qf=te=>{if(!K||!pe){ae.error("Preview metadata not ready yet");return}he.current=null;const ye=zd(pe),ht=Cb(K,ye,te.key);D(te),L(ht),u(null)},em=async({name:te,path:ye})=>{if(!U||!e)return;const ht=tl(ye);if(ht){k(ht);return}const dt=ye.trim().startsWith("/")?ye.trim():`/${ye.trim()}`;if(Le.some(Gt=>Ze(Gt.path)===Ze(dt))){k(`A page with path "${dt}" already exists.`);return}k(void 0);try{const Gt=await Be.mutateAsync({name:te,path:dt});A(!1),ae.success(`Page "${te}" created`),await new Promise(sm=>setTimeout(sm,Zn)),Rl({key:Gt.key,name:Gt.name,path:Gt.path}),Ai("cms")}catch(Gt){k(Gt instanceof Error?Gt.message:"Failed to create page")}},tm=[{value:"preview",icon:n.jsx($l,{size:14}),tooltip:"Interactive"},...Oe.kind==="iframe"?[{value:"visual",icon:n.jsx(zl,{size:14}),tooltip:"Visual editor"}]:[],...Oe.kind==="iframe"&&rl(se,pe)?[{value:"cms",icon:n.jsx(Mp,{size:14}),tooltip:"Sections editor"}]:[],{value:"code",icon:n.jsx(Op,{size:14}),tooltip:"Code editor"}];return n.jsxs("div",{className:"flex flex-col w-full h-full",children:[Te&&n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-4 border-b border-border/60 px-3 md:px-4",children:[n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n.jsx(wg,{value:Qe,onValueChange:Ai,options:tm,size:"sm",className:"shrink-0 bg-foreground/4.5"})}),Oe.kind==="iframe"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:le("flex min-w-0 flex-1 items-center gap-0.5 ml-2",s==="code"&&"hidden"),children:[n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:Vf,children:n.jsx(ar,{size:14})})}),n.jsx(ke,{side:"bottom",children:"Refresh"})]}),n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:Xf,children:n.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[r==="mobile"&&n.jsx($p,{size:14}),r==="tablet"&&n.jsx(zp,{size:14}),r==="desktop"&&n.jsx($l,{size:14})]},r)})}),n.jsx(ke,{side:"bottom",children:iy[r]})]}),n.jsxs("div",{ref:E,className:"relative min-w-0 flex-1",children:[n.jsxs("button",{type:"button",className:"flex h-8 w-full min-w-0 items-center gap-1 rounded-md bg-background px-2 transition-colors duration-200 hover:bg-accent",onClick:()=>S(te=>!te),children:[C&&n.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:[n.jsx(mi,{size:11}),"Global"]}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[12px] text-foreground/88",children:Zf}),St&&!C&&n.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:St}),n.jsx(Rs,{size:12,className:le("shrink-0 text-muted-foreground transition-transform",y&&"rotate-180")})]}),y&&n.jsxs("div",{className:"absolute left-0 right-0 top-full z-50 mt-1.5 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[n.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[n.jsx(_d,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),n.jsx("input",{type:"text",value:w,onChange:te=>j(te.target.value),placeholder:"Search pages and components...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),n.jsx("div",{className:"p-1.5 border-b",children:n.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:te=>{te.preventDefault(),S(!1),j(""),k(void 0),A(!0)},children:[n.jsx(Bt,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"flex-1 font-medium",children:"Create new page"})]})}),ct.length===0&&yt.length===0?n.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Le.length===0&&Ee.length===0?"No pages found in this site.":"No results match your search."}):n.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[ct.length>0&&n.jsx("div",{className:"p-1.5",children:ct.map(te=>n.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:ye=>{ye.preventDefault(),S(!1),j(""),Rl(te)},children:[n.jsx(Aa,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:te.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:te.path})]},te.key))}),yt.length>0&&n.jsxs("div",{className:le("p-1.5",ct.length>0&&"border-t"),children:[n.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Global components"}),yt.map(te=>n.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:ye=>{ye.preventDefault(),S(!1),j(""),Qf(te)},children:[n.jsx(mi,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:te.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:te.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},te.key))]})]})]})]})]}),n.jsxs("div",{className:le("flex shrink-0 items-center gap-0.5",s==="code"&&"hidden"),children:[n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>{const te=W??Oe.previewUrl;te&&window.open(te,"_blank","noopener")},children:n.jsx(wi,{size:14})})}),n.jsx(ke,{side:"bottom",children:"Open in new tab"})]}),n.jsxs(os,{children:[n.jsx(as,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",children:n.jsx(Tn,{size:14})})}),n.jsxs(ls,{align:"end",className:"w-44",children:[n.jsx(We,{onClick:Yf,children:"Hard Reload"}),n.jsx(We,{onClick:Jf,children:"Copy Current URL"}),se&&pe&&n.jsxs(n.Fragment,{children:[n.jsx(er,{}),qe&&n.jsxs(We,{onClick:()=>{z(!0),Ai("cms")},children:[n.jsx(Xr,{size:14}),"Edit SEO"]}),qe&&n.jsxs(We,{onClick:()=>{try{ie(Bl(qe)),Ai("code")}catch{ae.error("Invalid page block key")}},children:[n.jsx(Ra,{size:14}),"View JSON"]}),n.jsxs(We,{onClick:()=>G(!0),children:[n.jsx(Xr,{size:14}),"Site SEO"]})]}),_e&&n.jsxs(n.Fragment,{children:[n.jsx(er,{}),n.jsxs(We,{onClick:()=>window.open(`vscode://file${_e}?windowId=_blank`),children:[n.jsx("img",{src:pc,alt:"VSCode",width:14,height:14}),"Open in VSCode"]}),n.jsxs(We,{onClick:()=>window.open(`cursor://file${_e}?windowId=_blank`),children:[n.jsx("img",{src:gc,alt:"Cursor",width:14,height:14}),"Open in Cursor"]})]})]})]})]})]}),s==="code"&&_e&&n.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon","aria-label":"Open in VSCode",onClick:()=>window.open(`vscode://file${_e}?windowId=_blank`),children:n.jsx("img",{src:pc,alt:"VSCode",width:14,height:14})})}),n.jsx(ke,{side:"bottom",children:"Open in VSCode"})]}),n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon","aria-label":"Open in Cursor",onClick:()=>window.open(`cursor://file${_e}?windowId=_blank`),children:n.jsx("img",{src:gc,alt:"Cursor",width:14,height:14})})}),n.jsx(ke,{side:"bottom",children:"Open in Cursor"})]})]})]}),n.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c&&K&&e&&U&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"shrink-0 border-r overflow-hidden",style:{width:p},children:n.jsx(P.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(Qb,{orgSlug:Y.slug,virtualMcpId:U,branch:e,previewReady:Q,previewUrl:K,currentPath:B,activePageBlockKey:qe,activeGlobalBlockKey:C?.key??null,externalSelectedIndex:C?null:d,onSaved:()=>{setTimeout(Gf,Zn)},initialEditSeo:F,onExitSeo:()=>z(!1),onViewJsonFile:te=>{try{ie(Bl(te)),Ai("code")}catch{ae.error("Invalid page block key")}},onVariantPreviewOverride:qf})})}),n.jsx("div",{className:"w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-border transition-colors",onPointerDown:te=>{v.current=!0,b.current=te.clientX,x.current=p,te.currentTarget.setPointerCapture(te.pointerId)},onPointerMove:te=>{if(!v.current)return;const ye=te.clientX-b.current;g(Math.max(240,Math.min(640,x.current+ye)))},onPointerUp:()=>{v.current=!1}})]}),n.jsxs("div",{className:le("flex-1 relative overflow-hidden",r!=="desktop"&&Oe.kind==="iframe"&&s!=="code"&&"flex justify-center bg-muted/30"),children:[Oe.kind==="starting"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(mn,{kind:"starting",progress:Re,claimPhase:ze})}),Oe.kind==="suspended"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(mn,{kind:"suspended",onResume:$.resume})}),Qe==="visual"&&!a&&n.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:[n.jsx(zl,{size:12}),"Click any element to ask the AI"]}),Qe==="visual"&&a&&n.jsx(Bb,{element:a,onDismiss:()=>l(null)}),s==="code"&&Te&&U&&e&&n.jsx("div",{className:"absolute inset-0 z-10 bg-background",children:n.jsx(P.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(ty,{orgSlug:Y.slug,virtualMcpId:U,branch:e,openPath:X})})}),Oe.kind==="iframe"&&W&&n.jsx("div",{className:le("h-full transition-[width] duration-250 [transition-timing-function:var(--ease-in-out-cubic)]",r!=="desktop"&&s!=="code"&&"w-full max-w-full border-x border-border bg-background shadow-sm"),style:{width:r==="desktop"||s==="code"?"100%":`${sy[r]}px`},children:n.jsx("iframe",{ref:h,src:W,className:le("w-full h-full border-0",s==="code"&&"invisible"),title:"Dev Server Preview",tabIndex:c?-1:void 0,onLoad:()=>{if(Ie("vm_preview_loaded",{view_mode:s,vm_id:Z?.sandboxHandle??null}),!C)try{const te=h.current?.contentWindow?.location?.pathname;if(!te)return;const ye=he.current;if(ye!==null){he.current=null,Ze(te)===Ze(ye)&&I(te);return}I(te)}catch{}s==="visual"&&si(),s==="cms"&&Al()}},Oe.previewUrl)})]})]}),n.jsx(Tb,{open:T,onOpenChange:A,isPending:Be.isPending,error:R,onSubmit:em}),V&&se&&pe&&n.jsx(P.Suspense,{fallback:null,children:n.jsx(ey,{open:V,onOpenChange:G,orgSlug:Y.slug,virtualMcpId:U??"",branch:e??"",decofile:se,meta:pe,onSaved:()=>{setTimeout(()=>{const te=h.current;if(te)try{te.contentWindow?.location.reload()}catch{const ye=xe.current;ye&&(te.src=ye)}},Zn)},target:{kind:"site"}})})]})}function ay(t){const e=H.c(2),{virtualMcpId:s}=t,i=ds(s);if(!Ws(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(_r,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No source to preview."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Connections tab to enable Preview."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(oy,{}),e[1]=o):o=e[1],o}function ly(t){const e=H.c(8);let s,i;e[0]!==t?({className:s,...i}=t,e[0]=t,e[1]=s,e[2]=i):(s=e[1],i=e[2]);let r;e[3]!==s?(r=le("grid gap-3",s),e[3]=s,e[4]=r):r=e[4];let o;return e[5]!==i||e[6]!==r?(o=n.jsx(ag,{"data-slot":"radio-group",className:r,...i}),e[5]=i,e[6]=r,e[7]=o):o=e[7],o}function _c(t){const e=H.c(9);let s,i;e[0]!==t?({className:s,...i}=t,e[0]=t,e[1]=s,e[2]=i):(s=e[1],i=e[2]);let r;e[3]!==s?(r=le("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[2px] disabled:opacity-50",s),e[3]=s,e[4]=r):r=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(lg,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:n.jsx(jg,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=o):o=e[5];let a;return e[6]!==i||e[7]!==r?(a=n.jsx(og,{"data-slot":"radio-group-item",className:r,...i,children:o}),e[6]=i,e[7]=r,e[8]=a):a=e[8],a}function cy(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!e.includes(i)));return Object.keys(s).length>0?{...t,properties:s}:t}function hy(t,e,s){return typeof t!="string"?null:cy(Md(t,e),s)}function Du(t,e,s){if(!e||typeof t!="string")return!1;const i=hy(t,e,s);return!!i&&Object.keys(i.properties??{}).length>0}function dy({orgSlug:t,virtualMcpId:e,branch:s}){const i=qs();return xi({mutationFn:async({blockKey:r})=>{const o=Jh(r),a=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:o})});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Error(l.error??`Delete failed (${a.status})`)}return a.json()},onMutate:async({blockKey:r})=>{const o=`${t}/${e}/${s}`,a=Tt.decofile(o);await i.cancelQueries({queryKey:a});const l=i.getQueryData(a);return i.setQueryData(a,h=>{if(!h)return h;const{[r]:c,...d}=h;return d}),{previous:l,queryKey:a}},onError:(r,o,a)=>{a?.queryKey&&i.setQueryData(a.queryKey,a.previous)},onSuccess:()=>{const r=`${t}/${e}/${s}`;i.invalidateQueries({queryKey:Tt.liveMeta(r)})}})}function Mn(t,e){return`${t}-${e}`}function Iu(t,e){return`site/apps/${t}/${e}.ts`}function Lu(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 uy(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function fy(t){return t==="local"?"Custom":"Installed"}function Bu(t,e,s){const i=new Set([Mn(t,e),e].map(o=>o.toLowerCase())),r=Iu(t,e);for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(i.has(o.toLowerCase())||l.__resolveType===r)return o}return null}function my(t,e){const s=t.vendor.alias,i=t.name,r=Bu(s,i,e);return{id:Mn(s,i),app:i,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Iu(s,i),blockKey:r,installed:r!==null}}function py(t,e,s){if(t===il)return null;const i=Lu(t);if(!i)return null;const{vendor:r,app:o}=i,a=Bu(r,o,s),l=Ci(t,e);return{id:Mn(r,o),app:o,vendor:r,title:l.title??o,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function gy(t,e,s){const i=e.__resolveType;if(typeof i!="string"||hn(t,e)||!Bd(i))return null;const r=Lu(i)??uy(t);if(!r)return null;const o=Ci(i,s),{vendor:a,app:l}=r;return{id:Mn(a,l),app:l,vendor:a,title:o.title??dn(t,e,s),description:o.description??"",category:fy(a),logo:o.logo??o.icon,resolveType:i,blockKey:t,installed:!0}}function _y(t,e,s){const i=new Map;for(const o of t){const a=my(o,s);i.set(a.id,a)}const r=e.manifest?.blocks?.apps??{};for(const o of Object.keys(r)){const a=py(o,e,s);!a||i.has(a.id)||i.set(a.id,a)}for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=gy(o,a,e);!l||i.has(l.id)||i.set(l.id,l)}return[...i.values()].sort(vy)}function vy(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function xy(){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 by(t,e,s){const i=H.c(12),r=s?.enabled??!0;let o;i[0]===Symbol.for("react.memo_cache_sentinel")?(o=Tt.decoApps(),i[0]=o):o=i[0];let a;i[1]!==r?(a={queryKey:o,queryFn:xy,staleTime:3e5,retry:1,enabled:r},i[1]=r,i[2]=a):a=i[2];const l=As(a);let h;i[3]!==e||i[4]!==t||i[5]!==l.data?(h=t&&e?_y(l.data??[],t,e):[],i[3]=e,i[4]=t,i[5]=l.data,i[6]=h):h=i[6];const c=h,d=l.isLoading&&!l.isError;let u;return i[7]!==c||i[8]!==l.isError||i[9]!==l.refetch||i[10]!==d?(u={catalog:c,isLoading:d,isError:l.isError,refetch:l.refetch},i[7]=c,i[8]=l.isError,i[9]=l.refetch,i[10]=d,i[11]=u):u=i[11],u}function vc(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),i=`${s} (copy)`;if(!t.has(i))return i;for(let r=2;r<1e3;r++){const o=`${s} (copy ${r})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function yy(t,e){const s=hi,i=e.replace(/-copy(?:-\d+)?$/,""),r=`${i}-copy`;if(!t.has(s(r)))return r;for(let o=2;o<1e3;o++){const a=`${i}-copy-${o}`;if(!t.has(s(a)))return a}return`${i}-copy-${Date.now()}`}function Mu(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),i=`${s}_copy`;if(!Object.hasOwn(t,i))return i;for(let r=2;r<1e3;r++){const o=`${s}_copy_${r}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function Sy(t){const e=pl(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function wy(t,e){return Eu(t,e)}const Cy=1e3;function ky(t,e){for(let s=0;s<Cy;s++){const i=pl(e);if(!Object.hasOwn(t,i))return i}throw new Error("Could not generate a unique page block key")}function jy(t,e){const s=(t.title||t.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",r=Mu(e,i);return{blockKey:r,data:{__resolveType:t.resolveType,name:r}}}const Ny={create:"Create new page",duplicate:"Duplicate page",rename:"Rename page"},Ey={create:"Create",duplicate:"Duplicate",rename:"Save"},Ty={create:"Creating…",duplicate:"Duplicating…",rename:"Saving…"};function Py(t){const e=H.c(54),{open:s,mode:i,initialName:r,initialPath:o,isPending:a,error:l,validate:h,onSubmit:c,onOpenChange:d}=t,u=a===void 0?!1:a,[f,m]=P.useState(r),[p,g]=P.useState(o),[v,b]=P.useState(null),[x,_]=P.useState(s);s!==x&&(_(s),s&&(m(r),g(o),b(null)));let y;e[0]!==u||e[1]!==d?(y=U=>{!U&&!u&&(b(null),d(!1))},e[0]=u,e[1]=d,e[2]=y):y=e[2];const S=y;let w;e[3]!==u||e[4]!==f||e[5]!==c||e[6]!==p||e[7]!==h?(w=async U=>{U.preventDefault();const Y=f.trim(),ne=p.trim();if(!Y||!ne||u)return;const $=tl(ne);if($){b($);return}const Z=h?.({name:Y,path:ne});if(Z){b(Z);return}b(null),await c({name:Y,path:ne})},e[3]=u,e[4]=f,e[5]=c,e[6]=p,e[7]=h,e[8]=w):w=e[8];const j=w,E=v??l,T=Ny[i];let A;e[9]!==T?(A=n.jsx(fs,{children:n.jsx(ms,{children:T})}),e[9]=T,e[10]=A):A=e[10];let R;e[11]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[11]=R):R=e[11];let k;e[12]===Symbol.for("react.memo_cache_sentinel")?(k=U=>m(U.target.value),e[12]=k):k=e[12];let C;e[13]!==u||e[14]!==f?(C=n.jsxs("div",{className:"space-y-1.5",children:[R,n.jsx(st,{id:"page-form-name",value:f,onChange:k,placeholder:"My page",autoFocus:!0,disabled:u})]}),e[13]=u,e[14]=f,e[15]=C):C=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:"Path"}),e[16]=D):D=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=U=>g(U.target.value),e[17]=N):N=e[17];let L;e[18]!==u||e[19]!==p?(L=n.jsxs("div",{className:"space-y-1.5",children:[D,n.jsx(st,{id:"page-form-path",value:p,onChange:N,placeholder:"/example",disabled:u})]}),e[18]=u,e[19]=p,e[20]=L):L=e[20];let B;e[21]!==E?(B=E&&n.jsx("p",{className:"text-xs text-destructive",children:E}),e[21]=E,e[22]=B):B=e[22];let I;e[23]!==L||e[24]!==B||e[25]!==C?(I=n.jsxs("div",{className:"space-y-4 py-4",children:[C,L,B]}),e[23]=L,e[24]=B,e[25]=C,e[26]=I):I=e[26];let M;e[27]!==d?(M=()=>d(!1),e[27]=d,e[28]=M):M=e[28];let O;e[29]!==u||e[30]!==M?(O=n.jsx(oe,{type:"button",variant:"outline",onClick:M,disabled:u,children:"Cancel"}),e[29]=u,e[30]=M,e[31]=O):O=e[31];let F;e[32]!==u||e[33]!==f||e[34]!==p?(F=!f.trim()||!p.trim()||u,e[32]=u,e[33]=f,e[34]=p,e[35]=F):F=e[35];let z;e[36]!==u||e[37]!==i?(z=u?n.jsxs(n.Fragment,{children:[n.jsx(Ne,{size:14,className:"animate-spin"}),Ty[i]]}):Ey[i],e[36]=u,e[37]=i,e[38]=z):z=e[38];let V;e[39]!==F||e[40]!==z?(V=n.jsx(oe,{type:"submit",disabled:F,children:z}),e[39]=F,e[40]=z,e[41]=V):V=e[41];let G;e[42]!==O||e[43]!==V?(G=n.jsxs(Zs,{children:[O,V]}),e[42]=O,e[43]=V,e[44]=G):G=e[44];let X;e[45]!==j||e[46]!==I||e[47]!==G||e[48]!==A?(X=n.jsx(Vt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:j,children:[A,I,G]})}),e[45]=j,e[46]=I,e[47]=G,e[48]=A,e[49]=X):X=e[49];let ie;return e[50]!==S||e[51]!==s||e[52]!==X?(ie=n.jsx(Kt,{open:s,onOpenChange:S,children:X}),e[50]=S,e[51]=s,e[52]=X,e[53]=ie):ie=e[53],ie}function Ay(t){const e=H.c(43),{open:s,blockKey:i,initialName:r,isPending:o,onSubmit:a,onOpenChange:l}=t,h=o===void 0?!1:o,[c,d]=P.useState(r),[u,f]=P.useState(s);s!==u&&(f(s),s&&d(r));let m;e[0]!==h||e[1]!==l?(m=L=>{!L&&!h&&l(!1)},e[0]=h,e[1]=l,e[2]=m):m=e[2];const p=m;let g;e[3]!==h||e[4]!==c||e[5]!==a?(g=async L=>{L.preventDefault();const B=c.trim();!B||h||await a(B)},e[3]=h,e[4]=c,e[5]=a,e[6]=g):g=e[6];const v=g;let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsxs(fs,{children:[n.jsx(ms,{children:"Rename section"}),n.jsx(Rn,{children:"Updates the display name. The internal key stays the same so pages referencing this section keep working."})]}),e[7]=b):b=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[8]=x):x=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=L=>d(L.target.value),e[9]=_):_=e[9];let y;e[10]!==h||e[11]!==c?(y=n.jsxs("div",{className:"space-y-1.5",children:[x,n.jsx(st,{id:"section-rename-name",value:c,onChange:_,autoFocus:!0,disabled:h})]}),e[10]=h,e[11]=c,e[12]=y):y=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Key"}),e[13]=S):S=e[13];let w;e[14]!==i?(w=n.jsxs("div",{className:"space-y-1.5",children:[S,n.jsx(st,{value:i,readOnly:!0,disabled:!0,className:"font-mono"})]}),e[14]=i,e[15]=w):w=e[15];let j;e[16]!==y||e[17]!==w?(j=n.jsxs("div",{className:"space-y-4 py-4",children:[y,w]}),e[16]=y,e[17]=w,e[18]=j):j=e[18];let E;e[19]!==l?(E=()=>l(!1),e[19]=l,e[20]=E):E=e[20];let T;e[21]!==h||e[22]!==E?(T=n.jsx(oe,{type:"button",variant:"outline",onClick:E,disabled:h,children:"Cancel"}),e[21]=h,e[22]=E,e[23]=T):T=e[23];let A;e[24]!==h||e[25]!==c?(A=!c.trim()||h,e[24]=h,e[25]=c,e[26]=A):A=e[26];let R;e[27]!==h?(R=h?n.jsxs(n.Fragment,{children:[n.jsx(Ne,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[27]=h,e[28]=R):R=e[28];let k;e[29]!==A||e[30]!==R?(k=n.jsx(oe,{type:"submit",disabled:A,children:R}),e[29]=A,e[30]=R,e[31]=k):k=e[31];let C;e[32]!==T||e[33]!==k?(C=n.jsxs(Zs,{children:[T,k]}),e[32]=T,e[33]=k,e[34]=C):C=e[34];let D;e[35]!==v||e[36]!==j||e[37]!==C?(D=n.jsx(Vt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:v,children:[b,j,C]})}),e[35]=v,e[36]=j,e[37]=C,e[38]=D):D=e[38];let N;return e[39]!==p||e[40]!==s||e[41]!==D?(N=n.jsx(Kt,{open:s,onOpenChange:p,children:D}),e[39]=p,e[40]=s,e[41]=D,e[42]=N):N=e[42],N}const eo={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},_l=["posts","authors","categories"],ir={posts:"post",authors:"author",categories:"category"};function rr(t){return _l.includes(t)}const vl={posts:"post",authors:"author",categories:"category"},Ou={posts:eo.post,authors:eo.author,categories:eo.category},Ry=Object.fromEntries(Object.entries(Ou).map(([t,e])=>[e,t]));function Dy(t){return typeof t=="string"?Ry[t]??null:null}function pi(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Xt(t){return typeof t=="string"?t:""}function Iy(t,e){switch(t){case"posts":return{label:Xt(e.title)||"Untitled post",subtitle:Xt(e.slug)};case"authors":return{label:Xt(e.name)||"Unnamed author",subtitle:Xt(e.email)};case"categories":return{label:Xt(e.name)||"Unnamed category",subtitle:Xt(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function $u(t){const e={posts:[],authors:[],categories:[]};for(const[s,i]of Object.entries(t)){const r=pi(i);if(!r)continue;const o=Dy(r.__resolveType);if(!o)continue;const a=pi(r[vl[o]])??{},{label:l,subtitle:h}=Iy(o,a);e[o].push({key:s,kind:o,label:l,subtitle:h})}for(const s of _l)e[s].sort((i,r)=>i.label.localeCompare(r.label));return e}function Ly(t,e){return $u(t)[e]}function pn(t,e){return Ly(t,e).map(s=>({key:s.key,payload:Lo(pi(t[s.key])??void 0,e)}))}function Lo(t,e){return t?pi(t[vl[e]])??{}:{}}function to(t,e,s){return{name:t,__resolveType:Ou[e],[vl[e]]:s}}function zu(t){return`.deco/blocks/${encodeURIComponent(t)}.json`}function gn(t){return Array.isArray(t)?t:[]}function xl(t){if(typeof t=="string")return t;const e=pi(t);return e?Xt(e.slug):""}function By(t){if(typeof t=="string")return t;const e=pi(t);return e?Xt(e.email):""}function My(t){return pn(t,"posts").map(({key:e,payload:s})=>({key:e,title:Xt(s.title)||"Untitled post",slug:Xt(s.slug),date:Xt(s.date),categorySlugs:gn(s.categories).map(xl).filter(Boolean),authorEmails:gn(s.authors).map(By).filter(Boolean)}))}function Oy(t,e){const s=gn(t.categories);return s.some(i=>xl(i)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function $y(t,e){const s=gn(t.categories);return s.length===1&&xl(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function Bo(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 xc(t,e){const s=`collections/blog/${e}/${Bo(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function zy(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Bo(8)}`,date:new Date().toISOString().slice(0,10),image:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Bo(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Fy={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"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},bc="Box";function Hy(t){return t.startsWith("site/")?"site":"app"}function Wy(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Ii(...t){for(const e of t)if(e!==void 0)return e}function Zj(t){const e=new Set,s=[],i=t.manifest?.blocks??{};for(const r of Object.values(i))for(const o of Object.keys(r)){if(!Vy(o)||e.has(o))continue;e.add(o);const a=Ci(o,t),l=Uy(o),h=Fy[l],c=Hy(o),d=(c==="site"?Ii(a.title,h?.title):Ii(h?.title,a.title))??l,u=c==="site"?Ii(a.description,h?.description):Ii(h?.description,a.description),f=c==="site"?a.icon:void 0,m=f&&Wy(f)?f:void 0,p=m!==void 0?h?.iconName??bc:Ii(f,h?.iconName)??bc;s.push({resolveType:o,title:d,description:u,iconName:p,iconUrl:m,source:c})}return s.sort((r,o)=>r.title.localeCompare(o.title))}function Uy(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Ky=["blog/sections/blocks/","site/sections/Blog/Post/"];function Vy(t){return Ky.some(e=>t.startsWith(e))}function Fu({orgSlug:t,virtualMcpId:e,branch:s}){return Tt.decofile(`${t}/${e}/${s}`)}function Hu({orgSlug:t,virtualMcpId:e,branch:s},i){return`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/${i}`}function qy(t){const e=H.c(11),s=qs();let i;e[0]!==t?(i=async l=>{const{blockKey:h,data:c}=l,d=await fetch(Hu(t,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:zu(h),content:JSON.stringify(c,null,2)})});if(!d.ok){const u=await d.json().catch(Gy);throw new Error(u.error??`Write failed (${d.status})`)}return d.json()},e[0]=t,e[1]=i):i=e[1];let r;e[2]!==t||e[3]!==s?(r=async l=>{const{blockKey:h,data:c}=l,d=Fu(t);await s.cancelQueries({queryKey:d});const u=s.getQueryData(d);return s.setQueryData(d,f=>({...f??{},[h]:c})),{previous:u,queryKey:d}},e[2]=t,e[3]=s,e[4]=r):r=e[4];let o;e[5]!==s?(o=(l,h,c)=>{c?.queryKey&&s.setQueryData(c.queryKey,c.previous)},e[5]=s,e[6]=o):o=e[6];let a;return e[7]!==i||e[8]!==r||e[9]!==o?(a={mutationFn:i,onMutate:r,onError:o},e[7]=i,e[8]=r,e[9]=o,e[10]=a):a=e[10],xi(a)}function Gy(){return{}}function Yy(t){const e=qs();return xi({mutationFn:async({blockKey:s})=>{const i=await fetch(Hu(t,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:zu(s)})});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.error??`Delete failed (${i.status})`)}return i.json()},onMutate:async({blockKey:s})=>{const i=Fu(t);await e.cancelQueries({queryKey:i});const r=e.getQueryData(i);return e.setQueryData(i,o=>{if(!o)return o;const{[s]:a,...l}=o;return l}),{previous:r,queryKey:i}},onError:(s,i,r)=>{r?.queryKey&&e.setQueryData(r.queryKey,r.previous)}})}function Xy(t){const e=H.c(20),{open:s,onOpenChange:i,pageKey:r,decofile:o}=t,[a,l]=P.useState(!1),h=o[r];let c;e[0]!==h?(c=h===void 0?"// Page not found.":JSON.stringify(h,null,2),e[0]=h,e[1]=c):c=e[1];const d=c;let u;e[2]!==d?(u=()=>{navigator.clipboard.writeText(d).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},e[2]=d,e[3]=u):u=e[3];const f=u;let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ms,{className:"text-sm font-semibold",children:"Page JSON"}),e[4]=m):m=e[4];let p;e[5]!==a?(p=a?n.jsx(Ih,{size:12}):n.jsx(bs,{size:12}),e[5]=a,e[6]=p):p=e[6];const g=a?"Copied":"Copy";let v;e[7]!==f||e[8]!==p||e[9]!==g?(v=n.jsxs(fs,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[m,n.jsxs(oe,{variant:"ghost",size:"sm",onClick:f,className:"h-7 gap-1.5 text-xs",children:[p,g]})]}),e[7]=f,e[8]=p,e[9]=g,e[10]=v):v=e[10];let b;e[11]!==d?(b=n.jsx(jn,{className:"max-h-[70vh]",children:n.jsx("pre",{className:"p-4 text-xs font-mono text-foreground/90 whitespace-pre overflow-auto",children:d})}),e[11]=d,e[12]=b):b=e[12];let x;e[13]!==v||e[14]!==b?(x=n.jsxs(Vt,{className:"max-w-2xl p-0 gap-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=x):x=e[15];let _;return e[16]!==i||e[17]!==s||e[18]!==x?(_=n.jsx(Kt,{open:s,onOpenChange:i,children:x}),e[16]=i,e[17]=s,e[18]=x,e[19]=_):_=e[19],_}const yc=P.lazy(()=>Ut(()=>import("./app-editor-C4YX8u15.js"),__vite__mapDeps([149,1,2,5,44,7,8,9,10,11,12,13,14,15,16,6,3,4,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,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,95,96,97,98,88,99,100,101,102,103,90,91,104,105,106,107,84,108,109,110,111,112,113,114,87,115,116,83,92,93,79,117,118,119,120,121,122,123,124,125,126,127,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,81,82,80,86,89,150])).then(t=>({default:t.AppEditor}))),Jy=P.lazy(()=>Ut(()=>import("./post-editor-XU3B2wmV.js"),__vite__mapDeps([151,1,2,3,28,7,8,9,10,11,12,13,14,15,16,6,4,5,17,18,19,20,21,22,23,24,25,26,27,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,139,90,91,105,140,119,141,142,143,137,111,107,114,92,93,83,84,86,79,87,88,89,81,82,85,80,152,150,153,96,97,98,99,100,101,102,103,104,106,108,109,110,112,113,115,116,117,118,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,138,144])).then(t=>({default:t.PostEditor}))),Zy=P.lazy(()=>Ut(()=>import("./record-editor-Cb2nxa0o.js"),__vite__mapDeps([154,1,2,77,76,84,86,9,37,38,8,6,19,17,7,10,11,12,13,14,15,16,3,4,5,18,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,39,40,41,42,43,50,79,87,88,89,64,90,91,152,150,96,56,57,54,55,58,59,60,61,62,63,51,65,44,45,46,47,48,49,52,53,66,67,68,69,70,71,72,73,74,75,78,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,83,92,93,117,118,119,120,121,122,123,124,125,126,127,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144])).then(t=>({default:t.RecordEditor}))),Qy=P.lazy(()=>Ut(()=>import("./category-editor-C-xyYK6m.js"),__vite__mapDeps([155,1,2,12,7,8,9,10,11,13,14,15,16,6,3,4,5,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,77,76,152,150,153,80,92,93,50,83,81,82,84,44,45,46,47,48,49,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,78,85,79,86,87,88,89,90,91,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])).then(t=>({default:t.CategoryEditor}))),e0=P.lazy(()=>Ut(()=>import("./sections-editor-NjvzZlHu.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])).then(t=>({default:t.SectionsEditor}))),t0=P.lazy(()=>Ut(()=>import("./seo-editor-Bvd2538m.js"),__vite__mapDeps([156,1,2,5,7,8,9,10,11,12,13,14,15,16,6,3,4,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,94,85,81,82,83,84,80,79,86,87,88,89,90,91,92,93,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])).then(t=>({default:t.SeoEditor}))),s0=P.lazy(()=>Ut(()=>import("./add-section-modal-kp6f6erO.js"),__vite__mapDeps([95,1,2,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,50,77,96,56,57,54,55,58,59,60,61,62,63,64,51,65,44,45,46,47,48,49,52,53,66,67,68,69,70,71,72,73,74,75,76,78,97,98,88,99,100,101,102,103,90,91,104,105,106,107,84,108,109,110,111,112,113,114,87,115,116,83,92,93,79,117,118,119,120,121,122,123,124,125,126,127,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144])).then(t=>({default:t.AddSectionModal}))),i0=P.lazy(()=>Ut(()=>import("./variant-calendar-DBaInJsx.js"),__vite__mapDeps([157,1,2,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,135])).then(t=>({default:t.VariantCalendar}))),Mo="oklch(0.65 0.15 160)";function r0(){const t=H.c(18),e=Er(),{data:s}=vi.useSession(),{currentBranch:i}=ys(),{org:r}=Ae(),o=e?.entity?.id??null,a=s?.user?.id,l=e?.entity?.metadata,h=a&&i?Cn(l?.sandboxMap?.[a]?.[i]):{},c=Object.values(h),u=(c.find(n0)??c[0])?.previewUrl??null,f=ps(),m=e?.entity?.organization_id??"";let p;t[0]!==r.slug||t[1]!==m?(p={connectionId:ka,orgId:m,orgSlug:r.slug},t[0]=r.slug,t[1]=m,t[2]=p):p=t[2];const g=vt(p),v=ya(g);let b;t[3]!==i||t[4]!==v||t[5]!==o?(b=()=>{if(!o)return;const w={virtualMcpId:o};i&&(w.branch=i),v.mutate(w)},t[3]=i,t[4]=v,t[5]=o,t[6]=b):b=t[6];const x=b,_=!!o&&!!i&&bo.isStopped(o,i),y=qd({previewUrl:u,appPaused:f.status.state==="paused",userStopped:_});if(y.kind!=="iframe"){let w;return t[7]!==y||t[8]!==x||t[9]!==f.lifecycle||t[10]!==f.phase?(w=n.jsx(k0,{state:y,claimPhase:f.phase,lifecycle:f.lifecycle,onStart:x}),t[7]=y,t[8]=x,t[9]=f.lifecycle,t[10]=f.phase,t[11]=w):w=t[11],w}if(!o||!i){let w;return t[12]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Gi,{title:"Waiting for sandbox context…"}),t[12]=w):w=t[12],w}let S;return t[13]!==i||t[14]!==r.slug||t[15]!==u||t[16]!==o?(S=n.jsx(a0,{orgSlug:r.slug,virtualMcpId:o,branch:i,previewUrl:u}),t[13]=i,t[14]=r.slug,t[15]=u,t[16]=o,t[17]=S):S=t[17],S}function n0(t){return t.sandboxProviderKind!=="user-desktop"}const Sc=2e3,o0=15;function wc(t,e,s,i){return typeof e!="string"||s&&(Du(e,s,i)||t.state.dataUpdateCount>=o0)?!1:Sc}function a0({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:i}){const r={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:i},{data:o,isLoading:a}=qa(r),[l,h]=P.useState("pages"),[c,d]=P.useState(null),[u,f]=P.useState(null),[m,p]=P.useState(""),[g,v]=P.useState(null),[b,x]=P.useState(null),[_,y]=P.useState("date-desc"),[S,w]=P.useState(()=>new Set),[j,E]=P.useState(l);j!==l&&(E(l),p(""),v(null),x(null),y("date-desc"),w(new Set));const{data:T,isLoading:A,isFetching:R}=Ga(r,{refetchInterval:q=>{const W=q.state.data;if(l==="apps"&&c&&c.collection==="apps"){const de=o?.[c.key];return wc(q,typeof de?.__resolveType=="string"?de.__resolveType:void 0,W)}if(l==="site"&&o){const de=W?Ao(o,W):null,ve=o.site,Te=de?.resolveType??(typeof ve?.__resolveType=="string"?ve.__resolveType:void 0);return wc(q,Te,W,["seo"])}return!1}}),k=(q,W)=>!Du(q,T,W)&&(A||R),{catalog:C,isLoading:D}=by(T??void 0,o??void 0,{enabled:l==="apps"}),N=gl(r),L=dy(r),B=qy(r),I=Yy(r),[M,O]=P.useState(null),[F,z]=P.useState(),[V,G]=P.useState(!1),[X,ie]=P.useState(null),[U,Y]=P.useState(null),[ne,$]=P.useState(null),[Z,K]=P.useState(null);if(a||A)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!T)return n.jsx(Gi,{title:"Could not load site data."});const ee=nl(o).sort((q,W)=>q.name.localeCompare(W.name)),Q=ol(o,T),fe=Ao(o,T),me=$u(o),_e=_l.some(q=>me[q].length>0),J=rr(l)?me[l]:[],se=(_e?pn(o,"categories"):[]).map(({key:q,payload:W})=>{const de=typeof W.slug=="string"?W.slug:"",ve=typeof W.name=="string"?W.name:"";return{slug:de||q,name:ve||de||q}}).filter(q=>q.slug).sort((q,W)=>q.name.localeCompare(W.name));if(!rl(o,T)&&!_e)return n.jsx(Gi,{icon:_r,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, or apps."});const pe={pages:ee.length,sections:Q.length,apps:C.length,posts:me.posts.length,authors:me.authors.length,categories:me.categories.length},ge=new Set(ee.map(q=>hi(q.path))),Be=new Set(ee.map(q=>q.name)),Le=new Set(Q.map(q=>q.name)),Ee=async q=>{const W=o[q.key];if(!W)return;const de=ku(o,q.key),ve=ju(o,q.key,Math.max(0,de-1)),Te=Sb(W.sections,ve);if(Te)try{await N.mutateAsync({blockKey:q.key,data:{...W,sections:Te}}),ae.success(`Variant added to "${q.name}"`),d({collection:"pages",key:q.key,path:q.path})}catch(Qe){ae.error(Qe instanceof Error?Qe.message:"Could not add variant")}},Ze=()=>{z(void 0),O({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},ct=q=>{z(void 0),O({mode:"duplicate",sourceKey:q.key,initialName:vc(Be,q.name),initialPath:yy(ge,q.path)})},yt=q=>{z(void 0),O({mode:"rename",sourceKey:q.key,initialName:q.name,initialPath:q.path})},mt=async q=>{if(!M)return;const{mode:W,sourceKey:de}=M;try{if(W==="create"){const ve=wy(q.name,q.path),Te=ky(o,q.name);await N.mutateAsync({blockKey:Te,data:ve}),ae.success(`Created "${q.name}"`),d({collection:"pages",key:Te,path:q.path})}else if(W==="duplicate"&&de){const ve=o[de];if(!ve)throw new Error("Source page not found");const{key:Te,data:Qe}=Sy({source:ve,pages:ee,newName:q.name,newPath:q.path});await N.mutateAsync({blockKey:Te,data:Qe}),ae.success(`Duplicated as "${q.name}"`),d({collection:"pages",key:Te,path:q.path})}else if(W==="rename"&&de){const ve=o[de];if(!ve)throw new Error("Page not found");const Te={...ve,name:q.name,path:q.path};await N.mutateAsync({blockKey:de,data:Te}),ae.success("Page updated"),c?.collection==="pages"&&c.key===de&&d({collection:"pages",key:de,path:q.path})}O(null)}catch(ve){z(ve instanceof Error?ve.message:"Save failed")}},St=({path:q})=>{if(!M)return null;const W=hi(q);return(M.mode==="rename"?hi(M.initialPath):null)!==W&&ge.has(W)?`A page with path "${q}" already exists.`:null},qe=async q=>{const{blockKey:W,data:de}=jy(q,o);try{await N.mutateAsync({blockKey:W,data:de}),ae.success(`Created section "${W}"`),G(!1),d({collection:"sections",key:W})}catch(ve){ae.error(ve instanceof Error?ve.message:"Could not create section")}},wt=async q=>{const W=o[q.key];if(!W){ae.error("Section not found.");return}const de=Mu(o,q.key),ve=vc(Le,q.name),Te={...W,name:ve};try{await N.mutateAsync({blockKey:de,data:Te}),ae.success(`Duplicated "${q.name}"`),d({collection:"sections",key:de})}catch(Qe){ae.error(Qe instanceof Error?Qe.message:"Duplicate failed")}},qt=async q=>{if(!X)return;const W=o[X];if(!W){ae.error("Section not found.");return}try{await N.mutateAsync({blockKey:X,data:{...W,name:q}}),ae.success("Section renamed"),ie(null)}catch(de){ae.error(de instanceof Error?de.message:"Rename failed")}},pt=async q=>{const W=xc(o,q),de=to(W,q,zy(q));try{await B.mutateAsync({blockKey:W,data:de}),ae.success(`Created ${ir[q]}`),d({collection:q,key:W})}catch(ve){ae.error(ve instanceof Error?ve.message:"Could not create")}},Ot=async q=>{const W=o[q.key];if(!W){ae.error("Record not found.");return}const de=xc(o,q.kind),ve=q.kind==="posts"?"title":"name",Te={...structuredClone(Lo(W,q.kind)),[ve]:`${q.label} (copy)`};try{await B.mutateAsync({blockKey:de,data:to(de,q.kind,Te)}),ae.success(`Duplicated "${q.label}"`),d({collection:q.kind,key:de})}catch(Qe){ae.error(Qe instanceof Error?Qe.message:"Duplicate failed")}},Ct=q=>{w(W=>{const de=new Set(W);return de.has(q)?de.delete(q):de.add(q),de})},xe=q=>{h("posts"),E("posts"),d(null),f(null),p(""),v(q),x(null),y("date-desc"),w(new Set)},he=async(q,W)=>{const de=[...S];let ve=0;for(const Te of de){const Qe=o[Te],si=Lo(Qe,"posts"),Tr=q==="add"?Oy(si,W):$y(si,W);Tr!==si&&(await B.mutateAsync({blockKey:Te,data:to(Te,"posts",Tr)}),ve+=1)}return ve},Pe=async(q,W)=>{const de=S.size;try{const ve=await he(q,W),Te=q==="add"?"Added to":"Moved",Qe=de-ve;ae.success(`${Te} ${ve} ${ve===1?"post":"posts"}`+(Qe>0?` (${Qe} already set)`:"")),w(new Set),K(null)}catch(ve){ae.error(ve instanceof Error?ve.message:"Bulk update failed")}},ze=async()=>{if(U)try{if(U.kind==="blog-bulk"){for(const ve of U.keys)await I.mutateAsync({blockKey:ve});ae.success(`Deleted ${U.count} ${U.count===1?"post":"posts"}`),c&&U.keys.includes(c.key)&&d(null),w(new Set),Y(null);return}const{kind:q,key:W,label:de}=U;q==="blog"?await I.mutateAsync({blockKey:W}):await L.mutateAsync({blockKey:W}),ae.success(`Deleted "${de}"`),c&&c.key===W&&d(null),Y(null)}catch(q){ae.error(q instanceof Error?q.message:"Delete failed")}},Re=L.isPending||I.isPending,Oe=U?.kind==="blog"?ir[U.blogKind]:U?.kind==="blog-bulk"?`${U.count} ${U.count===1?"post":"posts"}`:U?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(l0,{active:l,counts:pe,showBlog:_e,onSelect:q=>{h(q),d(null),f(null)}}),l!=="seo"&&l!=="site"&&l!=="calendar"&&n.jsx(c0,{activeCollection:l,pages:ee,sections:Q,appCatalog:C,appCatalogLoading:D,blogEntries:J,decofile:o,searchQuery:m,onSearchChange:p,postCategoryFilter:g,postAuthorFilter:b,postSort:_,onPostCategoryFilterChange:q=>{v(q),w(new Set)},onPostAuthorFilterChange:q=>{x(q),w(new Set)},onPostSortChange:y,selectedPostKeys:S,onTogglePostSelect:Ct,onSelectAllPosts:q=>w(new Set(q)),onClearPostSelection:()=>w(new Set),onBulkUpdateCategory:()=>K({count:S.size}),onBulkDeletePosts:()=>Y({kind:"blog-bulk",keys:[...S],count:S.size}),selection:c,onSelect:q=>{d(q),f(null)},previewUrl:i,onCreate:()=>{l==="pages"?Ze():rr(l)?pt(l):i?G(!0):ae.error("Start the preview dev server to add sections.")},onDuplicatePage:ct,onRenamePage:yt,onAddPageVariant:Ee,onDeletePage:q=>Y({kind:"page",key:q.key,label:q.name}),onEditPageSeo:q=>{d({collection:"pages",key:q.key,path:q.path}),f(q.key)},onViewPageJson:q=>$(q.key),onDuplicateSection:wt,onRenameSection:q=>ie(q.key),onDeleteSection:q=>Y({kind:"section",key:q.key,label:q.name}),onDuplicateBlog:Ot,onDeleteBlog:q=>Y({kind:"blog",blogKind:q.kind,key:q.key,label:q.label})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(P.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})}),children:l==="calendar"?n.jsx(i0,{decofile:o}):l==="site"?fe?n.jsx(yc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:fe.key,block:o[fe.key],decofile:o,meta:T,title:"Site",excludeFields:["seo"],schemaPending:k(fe.resolveType,["seo"]),previewBaseUrl:i},`site:${fe.key}`):n.jsx(Gi,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):l==="seo"?n.jsx(t0,{orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:T,target:{kind:"site"},previewBaseUrl:i}):c?c.collection==="apps"?n.jsx(yc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:T,previewBaseUrl:i,schemaPending:k(typeof o[c.key]?.__resolveType=="string"?String(o[c.key].__resolveType):void 0)},`app:${c.key}`):c.collection==="posts"?n.jsx(Jy,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:T,previewBaseUrl:i},`post:${c.key}`):c.collection==="categories"?n.jsx(Qy,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:T,onManagePosts:xe},`category:${c.key}`):c.collection==="authors"?n.jsx(Zy,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:c.key,block:o[c.key]},`authors:${c.key}`):n.jsx(e0,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:i??void 0,currentPath:c.collection==="pages"?c.path:"/",activePageBlockKey:c.collection==="pages"?c.key:null,activeGlobalBlockKey:c.collection==="sections"?c.key:null,initialEditSeo:c.collection==="pages"&&u===c.key,onExitSeo:()=>f(null)},c.collection==="pages"?`page:${c.key}`:`section:${c.key}`):n.jsx(Gi,{title:`Select ${rr(l)?`a ${ir[l]}`:l==="pages"?"a page":l==="apps"?"an app":"a section"} to edit`,description:l==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),M&&n.jsx(Py,{open:!!M,mode:M.mode,initialName:M.initialName,initialPath:M.initialPath,isPending:N.isPending,error:F,validate:St,onSubmit:mt,onOpenChange:q=>{q||(O(null),z(void 0))}}),X&&n.jsx(Ay,{open:!!X,blockKey:X,initialName:Q.find(q=>q.key===X)?.name??X,isPending:N.isPending,onSubmit:qt,onOpenChange:q=>{q||ie(null)}}),V&&i&&n.jsx(P.Suspense,{fallback:null,children:n.jsx(s0,{open:V,onOpenChange:G,meta:T,decofile:o,previewBaseUrl:i,onSelect:qe})}),ne&&n.jsx(Xy,{open:!!ne,onOpenChange:q=>{q||$(null)},pageKey:ne,decofile:o}),Z&&n.jsx(y0,{count:Z.count,categories:se,isPending:B.isPending,onApply:(q,W)=>{Pe(q,W)},onOpenChange:q=>{!q&&!B.isPending&&K(null)}}),n.jsx(Zr,{open:!!U,onOpenChange:q=>{!q&&!Re&&Y(null)},children:n.jsxs(Qr,{children:[n.jsxs(en,{children:[n.jsx(tn,{children:`Delete ${Oe}?`}),n.jsx(sn,{children:U?.kind==="section"?`"${U.label}" will be removed. Pages that still reference it will lose this section.`:U?.kind==="blog-bulk"?`${U.count} ${U.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:U?`"${U.label}" will be removed permanently. This can't be undone.`:null})]}),n.jsxs(rn,{children:[n.jsx(nn,{disabled:Re,children:"Cancel"}),n.jsx(on,{onClick:q=>{q.preventDefault(),ze()},disabled:Re,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Re?n.jsxs(n.Fragment,{children:[n.jsx(Ne,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function l0(t){const e=H.c(37),{active:s,counts:i,showBlog:r,onSelect:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children:"Content"})}),e[0]=a):a=e[0];const l=s==="pages";let h;e[1]!==i.pages||e[2]!==o||e[3]!==l?(h=n.jsx(gs,{id:"pages",icon:Aa,label:"Pages",count:i.pages,active:l,onSelect:o}),e[1]=i.pages,e[2]=o,e[3]=l,e[4]=h):h=e[4];const c=s==="sections";let d;e[5]!==i.sections||e[6]!==o||e[7]!==c?(d=n.jsx(gs,{id:"sections",icon:mi,label:"Sections",count:i.sections,active:c,onSelect:o}),e[5]=i.sections,e[6]=o,e[7]=c,e[8]=d):d=e[8];const u=s==="apps";let f;e[9]!==i.apps||e[10]!==o||e[11]!==u?(f=n.jsx(gs,{id:"apps",icon:vd,label:"Apps",count:i.apps,active:u,onSelect:o}),e[9]=i.apps,e[10]=o,e[11]=u,e[12]=f):f=e[12];const m=s==="calendar";let p;e[13]!==o||e[14]!==m?(p=n.jsx(gs,{id:"calendar",icon:Fp,label:"Calendar",active:m,onSelect:o}),e[13]=o,e[14]=m,e[15]=p):p=e[15];let g;e[16]!==s||e[17]!==i.authors||e[18]!==i.categories||e[19]!==i.posts||e[20]!==o||e[21]!==r?(g=r&&n.jsxs(n.Fragment,{children:[n.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:[n.jsx(To,{size:13,className:"shrink-0"}),"Blog"]}),n.jsx(gs,{id:"posts",icon:Co,label:"Posts",count:i.posts,active:s==="posts",onSelect:o}),n.jsx(gs,{id:"authors",icon:Dn,label:"Authors",count:i.authors,active:s==="authors",onSelect:o}),n.jsx(gs,{id:"categories",icon:Pn,label:"Categories",count:i.categories,active:s==="categories",onSelect:o})]}),e[16]=s,e[17]=i.authors,e[18]=i.categories,e[19]=i.posts,e[20]=o,e[21]=r,e[22]=g):g=e[22];const v=s==="site";let b;e[23]!==o||e[24]!==v?(b=n.jsx(gs,{id:"site",icon:Hp,label:"Site",active:v,onSelect:o}),e[23]=o,e[24]=v,e[25]=b):b=e[25];const x=s==="seo";let _;e[26]!==o||e[27]!==x?(_=n.jsx(gs,{id:"seo",icon:Xr,label:"SEO",active:x,onSelect:o}),e[26]=o,e[27]=x,e[28]=_):_=e[28];let y;return e[29]!==g||e[30]!==b||e[31]!==_||e[32]!==h||e[33]!==d||e[34]!==f||e[35]!==p?(y=n.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[a,n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,d,f,p,g,b,_]})]}),e[29]=g,e[30]=b,e[31]=_,e[32]=h,e[33]=d,e[34]=f,e[35]=p,e[36]=y):y=e[36],y}function gs(t){const e=H.c(18),{id:s,icon:i,label:r,count:o,active:a,onSelect:l}=t;let h;e[0]!==s||e[1]!==l?(h=()=>l(s),e[0]=s,e[1]=l,e[2]=h):h=e[2];const c=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let d;e[3]!==c?(d=le("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==i?(u=n.jsx(i,{size:16,className:"shrink-0"}),e[5]=i,e[6]=u):u=e[6];let f;e[7]!==r?(f=n.jsx("span",{className:"flex-1 truncate",children:r}),e[7]=r,e[8]=f):f=e[8];let m;e[9]!==a||e[10]!==o?(m=o!==void 0&&n.jsx("span",{className:le("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=a,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==f||e[16]!==m?(p=n.jsxs("button",{type:"button",onClick:h,className:d,children:[u,f,m]}),e[12]=h,e[13]=d,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function c0(t){const e=H.c(77),{activeCollection:s,pages:i,sections:r,appCatalog:o,appCatalogLoading:a,blogEntries:l,decofile:h,previewUrl:c,searchQuery:d,onSearchChange:u,postCategoryFilter:f,postAuthorFilter:m,postSort:p,onPostCategoryFilterChange:g,onPostAuthorFilterChange:v,onPostSortChange:b,selectedPostKeys:x,onTogglePostSelect:_,onSelectAllPosts:y,onClearPostSelection:S,onBulkUpdateCategory:w,onBulkDeletePosts:j,selection:E,onSelect:T,onCreate:A,onDuplicatePage:R,onRenamePage:k,onAddPageVariant:C,onDeletePage:D,onEditPageSeo:N,onViewPageJson:L,onDuplicateSection:B,onRenameSection:I,onDeleteSection:M,onDuplicateBlog:O,onDeleteBlog:F}=t;let z,V,G,X,ie,U,Y;if(e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==l||e[4]!==h||e[5]!==C||e[6]!==j||e[7]!==w||e[8]!==S||e[9]!==A||e[10]!==F||e[11]!==D||e[12]!==M||e[13]!==O||e[14]!==R||e[15]!==B||e[16]!==N||e[17]!==v||e[18]!==g||e[19]!==b||e[20]!==k||e[21]!==I||e[22]!==u||e[23]!==T||e[24]!==y||e[25]!==_||e[26]!==L||e[27]!==i||e[28]!==m||e[29]!==f||e[30]!==p||e[31]!==c||e[32]!==d||e[33]!==r||e[34]!==x||e[35]!==E){const K=d.toLowerCase(),ee=i.filter(W=>!K||W.name.toLowerCase().includes(K)||W.path.toLowerCase().includes(K)),Q=r.filter(W=>!K||W.name.toLowerCase().includes(K)||W.key.toLowerCase().includes(K)||W.resolveType.toLowerCase().includes(K)),fe=o.filter(W=>!K||W.title.toLowerCase().includes(K)||W.app.toLowerCase().includes(K)||W.vendor.toLowerCase().includes(K)||W.category.toLowerCase().includes(K)),me=l.filter(W=>!K||W.label.toLowerCase().includes(K)||W.subtitle.toLowerCase().includes(K)),_e=s==="posts",J=f0,se=_e?My(h):[],pe=new Map,ge=new Map;for(const W of se){for(const de of W.categorySlugs)pe.set(de,(pe.get(de)??0)+1);for(const de of W.authorEmails)ge.set(de,(ge.get(de)??0)+1)}const Be=(_e?pn(h,"categories"):[]).map(W=>{const{key:de,payload:ve}=W,Te=J(ve.slug)||de;return{slug:Te,name:J(ve.name)||J(ve.slug)||de,count:pe.get(Te)??0}}).filter(u0),Le=(_e?pn(h,"authors"):[]).map(W=>{const{key:de,payload:ve}=W,Te=J(ve.email);return{email:Te,name:J(ve.name)||J(ve.email)||de,count:ge.get(Te)??0}}).filter(d0);let Ee;e[43]!==f?(Ee=W=>!f||W.categorySlugs.includes(f),e[43]=f,e[44]=Ee):Ee=e[44];let Ze;e[45]!==m?(Ze=W=>!m||W.authorEmails.includes(m),e[45]=m,e[46]=Ze):Ze=e[46];let ct;e[47]!==p?(ct=(W,de)=>{if(p==="az")return W.title.localeCompare(de.title);if(p==="za")return de.title.localeCompare(W.title);const ve=W.date.localeCompare(de.date);return p==="date-asc"?ve:-ve},e[47]=p,e[48]=ct):ct=e[48];const yt=se.filter(W=>!K||W.title.toLowerCase().includes(K)||W.slug.toLowerCase().includes(K)).filter(Ee).filter(Ze).sort(ct),mt=x.size,St=yt.map(h0),qe=St.length>0&&St.every(W=>x.has(W)),wt=mt>0,qt=()=>{qe?S():y(St)},pt=`Search ${s}…`,Ot=rr(s)?`Create new ${ir[s]}`:s==="pages"?"Create new page":"Create new section",Ct=s==="sections"&&!c,xe=s!=="apps",he=Ct,Pe=Ct?"Start the preview dev server to add sections":void 0;ie="w-[300px] shrink-0 border-r flex flex-col min-h-0";let ze;e[49]===Symbol.for("react.memo_cache_sentinel")?(ze=n.jsx(_d,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[49]=ze):ze=e[49];let Re;e[50]!==u?(Re=W=>u(W.target.value),e[50]=u,e[51]=Re):Re=e[51];let Oe;e[52]!==pt||e[53]!==d||e[54]!==Re?(Oe=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[ze,n.jsx("input",{type:"text",value:d,onChange:Re,placeholder:pt,"aria-label":pt,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[52]=pt,e[53]=d,e[54]=Re,e[55]=Oe):Oe=e[55];let q;e[56]!==he||e[57]!==Pe||e[58]!==Ot||e[59]!==A||e[60]!==xe?(q=xe&&n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:A,disabled:he,"aria-label":Ot,"aria-disabled":he,children:n.jsx(Bt,{size:14})})}),n.jsx(ke,{side:"bottom",children:Pe??Ot})]}),e[56]=he,e[57]=Pe,e[58]=Ot,e[59]=A,e[60]=xe,e[61]=q):q=e[61],e[62]!==Oe||e[63]!==q?(U=n.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Oe,q]}),e[62]=Oe,e[63]=q,e[64]=U):U=e[64],Y=_e&&(wt?n.jsx(b0,{count:mt,allSelected:qe,onToggleSelectAll:qt,onUpdateCategory:w,onDelete:j,onClear:S}):n.jsx(p0,{categories:Be,authors:Le,categoryFilter:f,authorFilter:m,sort:p,hasPosts:se.length>0,allSelected:qe,onToggleSelectAll:qt,onCategoryFilterChange:g,onAuthorFilterChange:v,onSortChange:b})),z=jn,X="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",V="flex flex-col gap-1 p-1.5",G=s==="pages"?ee.length===0?n.jsx(Bi,{hasItems:i.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):ee.map(W=>{const de=E?.collection==="pages"&&E.key===W.key,ve=ku(h,W.key);return n.jsx(Li,{icon:Aa,title:W.name,subtitle:W.path,active:de,variantCount:ve,onClick:()=>T({collection:"pages",key:W.key,path:W.path}),menu:n.jsx(Ir,{onDuplicate:()=>R(W),onRename:()=>k(W),onAddVariant:()=>C(W),onEditSeo:()=>N(W),onViewJson:()=>L(W),onDelete:()=>D(W)})},W.key)}):s==="sections"?Q.length===0?n.jsx(Bi,{hasItems:r.length>0,emptyLabel:"No saved sections yet.",emptyHint:'Click "+" to create one, or save a section from a page.'}):Q.map(W=>{const de=E?.collection==="sections"&&E.key===W.key,ve=W.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return n.jsx(Li,{icon:mi,title:W.name,subtitle:ve??W.resolveType,active:de,onClick:()=>T({collection:"sections",key:W.key}),menu:n.jsx(Ir,{onDuplicate:()=>B(W),onRename:()=>I(W),onDelete:()=>M(W)})},W.key)}):s==="apps"?a?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}):fe.length===0?n.jsx(Bi,{hasItems:o.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):fe.map(W=>{const de=E?.collection==="apps"&&W.blockKey!==null&&E.key===W.blockKey;return n.jsx(Li,{icon:vd,logoUrl:W.logo,title:W.title,subtitle:W.category,active:de,trailing:W.installed?n.jsx("span",{className:"shrink-0 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-700 dark:text-emerald-400",children:"Installed"}):void 0,onClick:()=>{if(!W.installed||!W.blockKey){ae.message(`${W.title} is not installed on this site.`);return}T({collection:"apps",key:W.blockKey})}},W.id)}):_e?yt.length===0?n.jsx(Bi,{hasItems:se.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):yt.map(W=>{const de={key:W.key,kind:"posts",label:W.title,subtitle:W.slug};return n.jsx(Li,{icon:Co,title:W.title,subtitle:W.slug,active:E?.collection==="posts"&&E.key===W.key,selectable:!0,selectionActive:wt,selected:x.has(W.key),onToggleSelect:()=>_(W.key),onClick:()=>T({collection:"posts",key:W.key}),menu:n.jsx(Ir,{onDuplicate:()=>O(de),onDelete:()=>F(de)})},W.key)}):me.length===0?n.jsx(Bi,{hasItems:l.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${rr(s)?ir[s]:"item"}.`}):me.map(W=>{const de=E?.collection===W.kind&&E.key===W.key;return n.jsx(Li,{icon:W.kind==="posts"?Co:W.kind==="authors"?Dn:Pn,title:W.label,subtitle:W.subtitle,active:de,onClick:()=>T({collection:W.kind,key:W.key}),menu:n.jsx(Ir,{onDuplicate:()=>O(W),onDelete:()=>F(W)})},W.key)}),e[0]=s,e[1]=o,e[2]=a,e[3]=l,e[4]=h,e[5]=C,e[6]=j,e[7]=w,e[8]=S,e[9]=A,e[10]=F,e[11]=D,e[12]=M,e[13]=O,e[14]=R,e[15]=B,e[16]=N,e[17]=v,e[18]=g,e[19]=b,e[20]=k,e[21]=I,e[22]=u,e[23]=T,e[24]=y,e[25]=_,e[26]=L,e[27]=i,e[28]=m,e[29]=f,e[30]=p,e[31]=c,e[32]=d,e[33]=r,e[34]=x,e[35]=E,e[36]=z,e[37]=V,e[38]=G,e[39]=X,e[40]=ie,e[41]=U,e[42]=Y}else z=e[36],V=e[37],G=e[38],X=e[39],ie=e[40],U=e[41],Y=e[42];let ne;e[65]!==V||e[66]!==G?(ne=n.jsx("div",{className:V,children:G}),e[65]=V,e[66]=G,e[67]=ne):ne=e[67];let $;e[68]!==z||e[69]!==X||e[70]!==ne?($=n.jsx(z,{className:X,children:ne}),e[68]=z,e[69]=X,e[70]=ne,e[71]=$):$=e[71];let Z;return e[72]!==ie||e[73]!==U||e[74]!==Y||e[75]!==$?(Z=n.jsxs("div",{className:ie,children:[U,Y,$]}),e[72]=ie,e[73]=U,e[74]=Y,e[75]=$,e[76]=Z):Z=e[76],Z}function h0(t){return t.key}function d0(t){return t.email}function u0(t){return t.slug}function f0(t){return typeof t=="string"?t:""}const ni="__all__",Wu={"date-desc":"Newest first","date-asc":"Oldest first",az:"Title A–Z",za:"Title Z–A"},m0={"date-desc":"Newest","date-asc":"Oldest",az:"A–Z",za:"Z–A"},so=P.forwardRef(function(e,s){const i=H.c(20);let r,o,a,l,h;i[0]!==e?({icon:r,active:o,value:h,className:a,...l}=e,i[0]=e,i[1]=r,i[2]=o,i[3]=a,i[4]=l,i[5]=h):(r=i[1],o=i[2],a=i[3],l=i[4],h=i[5]);const c=o?"text-foreground":"text-muted-foreground";let d;i[6]!==a||i[7]!==c?(d=le("h-7 gap-1 px-1.5 text-xs",c,a),i[6]=a,i[7]=c,i[8]=d):d=i[8];let u;i[9]!==r?(u=n.jsx(r,{size:14,className:"shrink-0"}),i[9]=r,i[10]=u):u=i[10];let f;i[11]!==h?(f=h&&n.jsx("span",{className:"min-w-0 flex-1 truncate",children:h}),i[11]=h,i[12]=f):f=i[12];let m;i[13]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Rs,{size:12,className:"shrink-0 opacity-60"}),i[13]=m):m=i[13];let p;return i[14]!==l||i[15]!==s||i[16]!==d||i[17]!==u||i[18]!==f?(p=n.jsxs(oe,{ref:s,type:"button",variant:"ghost",size:"sm",className:d,...l,children:[u,f,m]}),i[14]=l,i[15]=s,i[16]=d,i[17]=u,i[18]=f,i[19]=p):p=i[19],p});function Uu(t){const e=H.c(2),{count:s}=t;let i;return e[0]!==s?(i=n.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=i):i=e[1],i}function p0(t){const e=H.c(64),{categories:s,authors:i,categoryFilter:r,authorFilter:o,sort:a,hasPosts:l,allSelected:h,onToggleSelectAll:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onSortChange:f}=t;let m;if(e[0]!==s||e[1]!==r){let K;e[3]!==r?(K=ee=>ee.slug===r,e[3]=r,e[4]=K):K=e[4],m=s.find(K),e[0]=s,e[1]=r,e[2]=m}else m=e[2];const p=m;let g;if(e[5]!==o||e[6]!==i){let K;e[8]!==o?(K=ee=>ee.email===o,e[8]=o,e[9]=K):K=e[9],g=i.find(K),e[5]=o,e[6]=i,e[7]=g}else g=e[7];const v=g,b=!l;let x;e[10]!==h||e[11]!==c||e[12]!==b?(x=n.jsx(Ku,{checked:h,disabled:b,onToggle:c}),e[10]=h,e[11]=c,e[12]=b,e[13]=x):x=e[13];const _=!!r,y=p?.name;let S;e[14]!==_||e[15]!==y?(S=n.jsx(as,{asChild:!0,children:n.jsx(so,{icon:Pn,active:_,value:y,className:"min-w-0 shrink"})}),e[14]=_,e[15]=y,e[16]=S):S=e[16];let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Wn,{children:"Filter by category"}),e[17]=w):w=e[17];const j=r??ni;let E;e[18]!==d?(E=K=>d(K===ni?null:K),e[18]=d,e[19]=E):E=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(cr,{value:ni,children:"All categories"}),e[20]=T):T=e[20];let A;e[21]!==s?(A=s.map(v0),e[21]=s,e[22]=A):A=e[22];let R;e[23]!==E||e[24]!==A||e[25]!==j?(R=n.jsxs(ls,{align:"start",className:"max-h-80 w-56 overflow-y-auto",children:[w,n.jsxs(Un,{value:j,onValueChange:E,children:[T,A]})]}),e[23]=E,e[24]=A,e[25]=j,e[26]=R):R=e[26];let k;e[27]!==R||e[28]!==S?(k=n.jsxs(os,{children:[S,R]}),e[27]=R,e[28]=S,e[29]=k):k=e[29];const C=!!o,D=v?.name;let N;e[30]!==C||e[31]!==D?(N=n.jsx(as,{asChild:!0,children:n.jsx(so,{icon:Dn,active:C,value:D,className:"min-w-0 shrink"})}),e[30]=C,e[31]=D,e[32]=N):N=e[32];let L;e[33]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(Wn,{children:"Filter by author"}),e[33]=L):L=e[33];const B=o??ni;let I;e[34]!==u?(I=K=>u(K===ni?null:K),e[34]=u,e[35]=I):I=e[35];let M;e[36]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx(cr,{value:ni,children:"All authors"}),e[36]=M):M=e[36];let O;e[37]!==i?(O=i.map(_0),e[37]=i,e[38]=O):O=e[38];let F;e[39]!==B||e[40]!==I||e[41]!==O?(F=n.jsxs(ls,{align:"start",className:"max-h-80 w-56 overflow-y-auto",children:[L,n.jsxs(Un,{value:B,onValueChange:I,children:[M,O]})]}),e[39]=B,e[40]=I,e[41]=O,e[42]=F):F=e[42];let z;e[43]!==N||e[44]!==F?(z=n.jsxs(os,{children:[N,F]}),e[43]=N,e[44]=F,e[45]=z):z=e[45];const V=m0[a];let G;e[46]!==V?(G=n.jsx(as,{asChild:!0,children:n.jsx(so,{icon:Wp,active:!0,value:V})}),e[46]=V,e[47]=G):G=e[47];let X;e[48]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(Wn,{children:"Sort by"}),e[48]=X):X=e[48];let ie;e[49]!==f?(ie=K=>f(K),e[49]=f,e[50]=ie):ie=e[50];let U;e[51]===Symbol.for("react.memo_cache_sentinel")?(U=Object.keys(Wu),e[51]=U):U=e[51];let Y;e[52]===Symbol.for("react.memo_cache_sentinel")?(Y=U.map(g0),e[52]=Y):Y=e[52];let ne;e[53]!==a||e[54]!==ie?(ne=n.jsxs(ls,{align:"end",className:"w-44",children:[X,n.jsx(Un,{value:a,onValueChange:ie,children:Y})]}),e[53]=a,e[54]=ie,e[55]=ne):ne=e[55];let $;e[56]!==G||e[57]!==ne?($=n.jsxs(os,{children:[G,ne]}),e[56]=G,e[57]=ne,e[58]=$):$=e[58];let Z;return e[59]!==k||e[60]!==z||e[61]!==$||e[62]!==x?(Z=n.jsxs("div",{className:"flex min-w-0 items-center gap-0.5 overflow-hidden border-b px-2 py-1.5",children:[x,k,z,$]}),e[59]=k,e[60]=z,e[61]=$,e[62]=x,e[63]=Z):Z=e[63],Z}function g0(t){return n.jsx(cr,{value:t,children:Wu[t]},t)}function _0(t){return n.jsxs(cr,{value:t.email,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx(Uu,{count:t.count})]},t.email)}function v0(t){return n.jsxs(cr,{value:t.slug,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx(Uu,{count:t.count})]},t.slug)}function Ku(t){const e=H.c(12),{checked:s,disabled:i,onToggle:r}=t;let o;e[0]!==r?(o=()=>r(),e[0]=r,e[1]=o):o=e[1];const a=s?"Deselect all posts":"Select all posts";let l;e[2]!==s||e[3]!==i||e[4]!==o||e[5]!==a?(l=n.jsx(Ce,{asChild:!0,children:n.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:x0,children:n.jsx(yi,{checked:s,disabled:i,onCheckedChange:o,"aria-label":a})})}),e[2]=s,e[3]=i,e[4]=o,e[5]=a,e[6]=l):l=e[6];const h=s?"Deselect all":"Select all";let c;e[7]!==h?(c=n.jsx(ke,{side:"bottom",children:h}),e[7]=h,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=n.jsxs(je,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function x0(t){return t.stopPropagation()}function b0(t){const e=H.c(31),{count:s,allSelected:i,onToggleSelectAll:r,onUpdateCategory:o,onDelete:a,onClear:l}=t;let h;e[0]!==i||e[1]!==r?(h=n.jsx(Ku,{checked:i,onToggle:r}),e[0]=i,e[1]=r,e[2]=h):h=e[2];let c;e[3]!==s?(c=n.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[s," selected"]}),e[3]=s,e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Pn,{size:14}),e[5]=d):d=e[5];let u;e[6]!==o?(u=n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:o,"aria-label":"Update category for selected posts",children:[d,"Category"]})}),e[6]=o,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ke,{side:"bottom",children:"Update category"}),e[8]=f):f=e[8];let m;e[9]!==u?(m=n.jsxs(je,{children:[u,f]}),e[9]=u,e[10]=m):m=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Us,{size:14}),e[11]=p):p=e[11];let g;e[12]!==a?(g=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:a,"aria-label":"Delete selected posts",children:p})}),e[12]=a,e[13]=g):g=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(ke,{side:"bottom",children:"Delete selected"}),e[14]=v):v=e[14];let b;e[15]!==g?(b=n.jsxs(je,{children:[g,v]}),e[15]=g,e[16]=b):b=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(xd,{size:14}),e[17]=x):x=e[17];let _;e[18]!==l?(_=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":"Clear selection",children:x})}),e[18]=l,e[19]=_):_=e[19];let y;e[20]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ke,{side:"bottom",children:"Clear selection"}),e[20]=y):y=e[20];let S;e[21]!==_?(S=n.jsxs(je,{children:[_,y]}),e[21]=_,e[22]=S):S=e[22];let w;e[23]!==b||e[24]!==S||e[25]!==m?(w=n.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[m,b,S]}),e[23]=b,e[24]=S,e[25]=m,e[26]=w):w=e[26];let j;return e[27]!==h||e[28]!==w||e[29]!==c?(j=n.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[h,c,w]}),e[27]=h,e[28]=w,e[29]=c,e[30]=j):j=e[30],j}function y0(t){const e=H.c(48),{count:s,categories:i,isPending:r,onApply:o,onOpenChange:a}=t,[l,h]=P.useState(i[0]?.slug??""),[c,d]=P.useState("add");let u;if(e[0]!==i||e[1]!==l){let I;e[3]!==l?(I=M=>M.slug===l,e[3]=l,e[4]=I):I=e[4],u=i.find(I),e[0]=i,e[1]=l,e[2]=u}else u=e[2];const f=u;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ms,{children:"Update category"}),e[5]=m):m=e[5];const p=s===1?"post":"posts";let g;e[6]!==s||e[7]!==p?(g=n.jsxs(fs,{children:[m,n.jsxs(Rn,{children:["Choose a category to apply to ",s," ",p,"."]})]}),e[6]=s,e[7]=p,e[8]=g):g=e[8];let v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(_t,{children:"Category"}),e[9]=v):v=e[9];let b;e[10]!==i||e[11]!==l?(b=n.jsxs("div",{className:"space-y-2",children:[v,i.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No categories yet — create one in the Categories collection."}):n.jsxs(Et,{value:l,onValueChange:h,children:[n.jsx(jt,{className:"w-full",children:n.jsx(Lt,{placeholder:"Select a category"})}),n.jsx(Nt,{children:i.map(S0)})]})]}),e[10]=i,e[11]=l,e[12]=b):b=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=I=>d(I),e[13]=x):x=e[13];let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(_c,{value:"add",id:"cat-mode-add",className:"mt-0.5"}),e[14]=_):_=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsxs(_t,{htmlFor:"cat-mode-add",className:"flex cursor-pointer items-start gap-2.5 rounded-lg border p-3",children:[_,n.jsxs("span",{className:"space-y-0.5",children:[n.jsx("span",{className:"block text-sm font-medium",children:"Add category"}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:"Keep existing categories and add this one."})]})]}),e[15]=y):y=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(_c,{value:"replace",id:"cat-mode-replace",className:"mt-0.5"}),e[16]=S):S=e[16];let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsxs(_t,{htmlFor:"cat-mode-replace",className:"flex cursor-pointer items-start gap-2.5 rounded-lg border p-3",children:[S,n.jsxs("span",{className:"space-y-0.5",children:[n.jsx("span",{className:"block text-sm font-medium",children:"Replace category"}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:"Remove all current categories and set only this one."})]})]}),e[17]=w):w=e[17];let j;e[18]!==c?(j=n.jsxs(ly,{value:c,onValueChange:x,className:"gap-2",children:[y,w]}),e[18]=c,e[19]=j):j=e[19];let E;e[20]!==j||e[21]!==b?(E=n.jsxs("div",{className:"space-y-4 py-2",children:[b,j]}),e[20]=j,e[21]=b,e[22]=E):E=e[22];let T;e[23]!==a?(T=()=>a(!1),e[23]=a,e[24]=T):T=e[24];let A;e[25]!==r||e[26]!==T?(A=n.jsx(oe,{type:"button",variant:"outline",onClick:T,disabled:r,children:"Cancel"}),e[25]=r,e[26]=T,e[27]=A):A=e[27];const R=!f||r;let k;e[28]!==c||e[29]!==o||e[30]!==f?(k=()=>f&&o(c,{name:f.name,slug:f.slug}),e[28]=c,e[29]=o,e[30]=f,e[31]=k):k=e[31];let C;e[32]!==r?(C=r?n.jsxs(n.Fragment,{children:[n.jsx(Ne,{size:14,className:"animate-spin"}),"Updating…"]}):"Apply",e[32]=r,e[33]=C):C=e[33];let D;e[34]!==R||e[35]!==k||e[36]!==C?(D=n.jsx(oe,{type:"button",disabled:R,onClick:k,children:C}),e[34]=R,e[35]=k,e[36]=C,e[37]=D):D=e[37];let N;e[38]!==A||e[39]!==D?(N=n.jsxs(Zs,{children:[A,D]}),e[38]=A,e[39]=D,e[40]=N):N=e[40];let L;e[41]!==E||e[42]!==N||e[43]!==g?(L=n.jsxs(Vt,{className:"sm:max-w-md",children:[g,E,N]}),e[41]=E,e[42]=N,e[43]=g,e[44]=L):L=e[44];let B;return e[45]!==a||e[46]!==L?(B=n.jsx(Kt,{open:!0,onOpenChange:a,children:L}),e[45]=a,e[46]=L,e[47]=B):B=e[47],B}function S0(t){return n.jsx(Ye,{value:t.slug,children:n.jsx("span",{className:"truncate",children:t.name})},t.slug)}function Li(t){const e=H.c(36),{icon:s,logoUrl:i,title:r,subtitle:o,active:a,variantCount:l,trailing:h,selectable:c,selectionActive:d,selected:u,onToggleSelect:f,onClick:m,menu:p}=t;let g;e[0]!==s||e[1]!==a||e[2]!==i||e[3]!==l?(g=l&&l>1?n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(s,{size:16,className:"shrink-0",style:{color:Mo}})}),n.jsxs(ke,{side:"right",children:[l," variants"]})]})}):i?n.jsx("img",{src:i,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted",children:n.jsx(s,{size:16,className:le("shrink-0",a?"text-accent-foreground":"text-muted-foreground")})}),e[0]=s,e[1]=a,e[2]=i,e[3]=l,e[4]=g):g=e[4];const v=g,b=a?"bg-accent text-accent-foreground":"hover:bg-muted";let x;e[5]!==b?(x=le("group relative flex min-w-0 items-center rounded-md transition-colors",b),e[5]=b,e[6]=x):x=e[6];let _;e[7]!==f||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==r?(_=c&&n.jsx("span",{className:le("flex shrink-0 items-center pl-2.5 transition-opacity",u||d?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:w0,children:n.jsx(yi,{checked:u,onCheckedChange:()=>f?.(),"aria-label":`Select ${r}`})}),e[7]=f,e[8]=c,e[9]=u,e[10]=d,e[11]=r,e[12]=_):_=e[12];let y;e[13]!==r?(y=n.jsx("span",{className:"block truncate text-sm font-medium",children:r}),e[13]=r,e[14]=y):y=e[14];const S=a?"text-accent-foreground/70":"text-muted-foreground";let w;e[15]!==S?(w=le("block truncate text-xs",S),e[15]=S,e[16]=w):w=e[16];let j;e[17]!==o||e[18]!==w?(j=n.jsx("span",{className:w,children:o}),e[17]=o,e[18]=w,e[19]=j):j=e[19];let E;e[20]!==y||e[21]!==j?(E=n.jsxs("span",{className:"min-w-0 flex-1",children:[y,j]}),e[20]=y,e[21]=j,e[22]=E):E=e[22];let T;e[23]!==m||e[24]!==v||e[25]!==E||e[26]!==h?(T=n.jsxs("button",{type:"button",onClick:m,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[v,E,h]}),e[23]=m,e[24]=v,e[25]=E,e[26]=h,e[27]=T):T=e[27];let A;e[28]!==a||e[29]!==p?(A=p&&n.jsx("div",{className:le("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:p}),e[28]=a,e[29]=p,e[30]=A):A=e[30];let R;return e[31]!==T||e[32]!==A||e[33]!==x||e[34]!==_?(R=n.jsxs("div",{className:x,children:[_,T,A]}),e[31]=T,e[32]=A,e[33]=x,e[34]=_,e[35]=R):R=e[35],R}function w0(t){return t.stopPropagation()}function Ir(t){const e=H.c(21),{onDuplicate:s,onRename:i,onAddVariant:r,onEditSeo:o,onViewJson:a,onDelete:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(as,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"More actions",className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:C0,children:n.jsx(Tn,{size:14})})}),e[0]=h):h=e[0];let c;e[1]!==i?(c=i&&n.jsxs(We,{onClick:i,children:[n.jsx($a,{size:14}),"Rename"]}),e[1]=i,e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(bs,{size:14}),e[3]=d):d=e[3];let u;e[4]!==s?(u=n.jsxs(We,{onClick:s,children:[d,"Duplicate"]}),e[4]=s,e[5]=u):u=e[5];let f;e[6]!==r?(f=r&&n.jsxs(n.Fragment,{children:[n.jsx(er,{}),n.jsxs(We,{onClick:r,className:"cursor-pointer",style:{color:Mo},children:[n.jsx(Up,{size:14,style:{color:Mo}}),"Add variant"]})]}),e[6]=r,e[7]=f):f=e[7];let m;e[8]!==o||e[9]!==a?(m=(o||a)&&n.jsxs(n.Fragment,{children:[n.jsx(er,{}),o&&n.jsxs(We,{onClick:o,children:[n.jsx(Xr,{size:14}),"Edit SEO"]}),a&&n.jsxs(We,{onClick:a,children:[n.jsx(Ra,{size:14}),"View JSON"]})]}),e[8]=o,e[9]=a,e[10]=m):m=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(er,{}),e[11]=p):p=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Us,{size:14}),e[12]=g):g=e[12];let v;e[13]!==l?(v=n.jsxs(We,{onClick:l,className:"text-destructive focus:text-destructive",children:[g,"Delete"]}),e[13]=l,e[14]=v):v=e[14];let b;return e[15]!==c||e[16]!==u||e[17]!==f||e[18]!==m||e[19]!==v?(b=n.jsxs(os,{children:[h,n.jsxs(ls,{align:"end",className:"w-44",children:[c,u,f,m,p,v]})]}),e[15]=c,e[16]=u,e[17]=f,e[18]=m,e[19]=v,e[20]=b):b=e[20],b}function C0(t){return t.stopPropagation()}function Bi(t){const e=H.c(6),{hasItems:s,emptyLabel:i,emptyHint:r}=t;let o;e[0]!==r||e[1]!==i||e[2]!==s?(o=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:i}),n.jsx("div",{className:"mt-1 text-muted-foreground/80",children:r})]}),e[0]=r,e[1]=i,e[2]=s,e[3]=o):o=e[3];let a;return e[4]!==o?(a=n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=a):a=e[5],a}function k0(t){const e=H.c(8),{state:s,claimPhase:i,lifecycle:r,onStart:o}=t;switch(s.kind){case"starting":{let a;e[0]!==i||e[1]!==r?(a=Pu({claimPhase:i,lifecycle:r}),e[0]=i,e[1]=r,e[2]=a):a=e[2];let l;return e[3]!==i||e[4]!==a?(l=n.jsx(mn,{kind:"starting",progress:a,claimPhase:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5],l}case"suspended":{let a;return e[6]!==o?(a=n.jsx(mn,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}}}function Gi(t){const e=H.c(10),{icon:s,title:i,description:r}=t;let o;e[0]!==s?(o=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let a;e[2]!==i?(a=n.jsx("div",{children:i}),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r&&n.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:r}),e[4]=r,e[5]=l):l=e[5];let h;return e[6]!==o||e[7]!==a||e[8]!==l?(h=n.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,a,l]}),e[6]=o,e[7]=a,e[8]=l,e[9]=h):h=e[9],h}function j0(t){const e=H.c(2),{virtualMcpId:s}=t,i=ds(s);if(!Ws(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(_r,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No content to edit."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Settings tab to enable Content."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(r0,{}),e[1]=o):o=e[1],o}const io={fast:{label:"Fast",subtitle:"Quick responses for simple tasks",icon:Qh},smart:{label:"Smart",subtitle:"Balanced quality and speed",icon:$s},thinking:{label:"Thinking",subtitle:"Deeper reasoning for hard tasks",icon:Gp}},N0=["fast","smart","thinking"];function E0(t){const e=H.c(15),{tier:s,onSelect:i}=t,[r,o]=P.useState(!1),a=io[s].icon;let l;e[0]!==a?(l=n.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=l):l=e[1];const h=io[s];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Rs,{size:14,className:"text-muted-foreground"}),e[2]=c):c=e[2];let d;e[3]!==l||e[4]!==h.label?(d=n.jsx(Xs,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[l,h.label,c]})}),e[3]=l,e[4]=h.label,e[5]=d):d=e[5];let u;e[6]!==i||e[7]!==s?(u=N0.map(p=>{const g=io[p],v=g.icon;return n.jsxs("button",{type:"button",onClick:()=>{i(p),o(!1)},className:le("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[n.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm",children:g.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:g.subtitle})]}),p===s&&n.jsx(Si,{size:14,className:"text-foreground mt-0.5"})]},p)}),e[6]=i,e[7]=s,e[8]=u):u=e[8];let f;e[9]!==u?(f=n.jsx(Js,{align:"start",className:"p-1 w-64",children:n.jsx("div",{className:"flex flex-col",children:u})}),e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==d||e[13]!==f?(m=n.jsxs(Ys,{open:r,onOpenChange:o,children:[d,f]}),e[11]=r,e[12]=d,e[13]=f,e[14]=m):m=e[14],m}function T0(t){const e=H.c(15),{tier:s,onTierChange:i,override:r,onOverrideChange:o}=t,[a,l]=P.useState(r!==null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Model"}),e[0]=h):h=e[0];let c;e[1]!==o||e[2]!==i||e[3]!==r||e[4]!==s||e[5]!==a?(c=a?n.jsx(P.Suspense,{fallback:n.jsx(oe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:"Loading models…"}),children:n.jsx(P0,{override:r,onOverrideChange:o})}):n.jsx(E0,{tier:s,onSelect:i}),e[1]=o,e[2]=i,e[3]=r,e[4]=s,e[5]=a,e[6]=c):c=e[6];let d;e[7]!==o?(d=m=>{l(m),m||o(null)},e[7]=o,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==a?(u=n.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(ln,{checked:a,onCheckedChange:d,className:"cursor-pointer"}),"Specific model"]}),e[9]=d,e[10]=a,e[11]=u):u=e[11];let f;return e[12]!==c||e[13]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[c,u]})]}),e[12]=c,e[13]=u,e[14]=f):f=e[14],f}function P0(t){const e=H.c(10),{override:s,onOverrideChange:i}=t,r=Fh(),o=r[0]?.id??null,[a,l]=P.useState(s?.credentialId??o);let h;e[0]!==s?(h=s?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[0]=s,e[1]=h):h=e[1];const c=h;if(r.length===0){let f;return e[2]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Connect an AI provider in settings to pick a specific model."}),e[2]=f):f=e[2],f}let d;e[3]!==a||e[4]!==i?(d=f=>{const m=f.keyId??a??"";l(m),i({modelId:f.modelId,credentialId:m,title:f.title??f.modelId})},e[3]=a,e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==a||e[7]!==c||e[8]!==d?(u=n.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:n.jsx(Dg,{variant:"bordered",placeholder:"Pick a model",model:c,credentialId:a,onCredentialChange:l,onModelChange:d})}),e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9],u}const Vu=[{key:"capabilities",heading:"Built-in capabilities",icon:za,tools:[{name:"web_search",title:"Web search",description:"Look up current information on the web",icon:xr},{name:"generate_image",title:"Generate image",description:"Create images from a text prompt",icon:Cg},{name:"subtask",title:"Subtask",description:"Spawn a focused sub-agent to handle part of the work",icon:lr},{name:"user_ask",title:"Ask the user",description:"Pause to ask the user a clarifying question",icon:Kp}]},{key:"files",heading:"Files & code",icon:Eo,tools:[{name:"read",title:"Read File",description:"Read a file from the workspace",icon:ld},{name:"write",title:"Write File",description:"Create or overwrite a file",icon:$a},{name:"edit",title:"Edit File",description:"Make targeted edits to an existing file",icon:Vp},{name:"grep",title:"Search Content",description:"Search file contents by pattern",icon:hr},{name:"glob",title:"Find Files",description:"Find files by name pattern",icon:Eo},{name:"bash",title:"Run Command",description:"Run shell commands in the sandbox",icon:qp}]},{key:"context",heading:"Context",icon:Fl,tools:[{name:"read_resource",title:"Read Resource",description:"Read an MCP resource by URI",icon:Fl},{name:"read_prompt",title:"Read Prompt",description:"Read an MCP prompt definition",icon:To},{name:"skill",title:"Load Skill",description:"Load a skill's full instructions (SKILL.md) by id",icon:To}]},{key:"browser",heading:"Browser",icon:mi,tools:[{name:"take_screenshot",title:"Take Screenshot",description:"Capture a screenshot of a web page",icon:sd},{name:"scrape_url",title:"Scrape URL",description:"Fetch and extract content from a URL",icon:mi},{name:"inspect_page",title:"Inspect Page",description:"Inspect a web page's structure",icon:Ra}]}],A0=Vu.flatMap(t=>t.tools.map(e=>e.name));function R0(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function D0(t){const e=H.c(5),{agentId:s,value:i,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Tools"}),e[0]=o):o=e[0];let a;return e[1]!==s||e[2]!==r||e[3]!==i?(a=n.jsxs("div",{className:"flex flex-col gap-2",children:[o,s?n.jsx(P.Suspense,{fallback:n.jsxs(oe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[n.jsx(za,{size:14}),"Loading tools…"]}),children:n.jsx(I0,{agentId:s,value:i,onChange:r})}):n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Pick an agent first"})]}),e[1]=s,e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function Cc(t){const e=H.c(17),{value:s,checked:i,onToggle:r,title:o,description:a,leading:l}=t;let h;e[0]!==i?(h=n.jsx(yi,{checked:i,className:"pointer-events-none mt-0.5"}),e[0]=i,e[1]=h):h=e[1];let c;e[2]!==l?(c=l&&n.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==o?(d=n.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=d):d=e[5];let u;e[6]!==a?(u=a&&n.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=n.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==h||e[13]!==c||e[14]!==f||e[15]!==s?(m=n.jsxs(Rg,{value:s,onSelect:r,className:"items-start gap-2.5 py-2",children:[h,c,f]}),e[11]=r,e[12]=h,e[13]=c,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function kc(t){const e=H.c(20),{conn:s,label:i,icon:r,on:o,total:a,onToggle:l}=t,h=o===a;let c;e[0]!==r||e[1]!==s?(c=s?n.jsx(us,{icon:s.icon,name:s.title,size:"2xs"}):r?n.jsx(r,{size:14,className:"text-muted-foreground"}):n.jsx(Yp,{size:14,className:"text-muted-foreground"}),e[0]=r,e[1]=s,e[2]=c):c=e[2];const d=s?.title??i??"Other tools";let u;e[3]!==d?(u=n.jsx("span",{className:"truncate",children:d}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==o||e[6]!==a?(f=n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",a]}),e[5]=o,e[6]=a,e[7]=f):f=e[7];let m;e[8]!==l?(m=x=>{x.stopPropagation(),l()},e[8]=l,e[9]=m):m=e[9];const p=h?"None":"All";let g;e[10]!==m||e[11]!==p?(g=n.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:p}),e[10]=m,e[11]=p,e[12]=g):g=e[12];let v;e[13]!==f||e[14]!==g?(v=n.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[f,g]}),e[13]=f,e[14]=g,e[15]=v):v=e[15];let b;return e[16]!==c||e[17]!==u||e[18]!==v?(b=n.jsxs("div",{className:"flex items-center gap-2",children:[c,u,v]}),e[16]=c,e[17]=u,e[18]=v,e[19]=b):b=e[19],b}function I0(t){const e=H.c(70),{agentId:s,value:i,onChange:r}=t,{org:o}=Ae(),[a,l]=P.useState(!1);let h;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(h={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=h):h=e[3];const c=vt(h);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u,isLoading:f}=rd(d),m=br();let p,g,v,b,x,_,y,S,w,j,E,T,A;if(e[6]!==m||e[7]!==u?.tools||e[8]!==f||e[9]!==r||e[10]!==a||e[11]!==i){const N=new Map(m.map($0)),L=new Map;for(const J of u?.tools??[]){const se=Mm(J._meta)??"__other__",pe=Om(J.name,se==="__other__"?void 0:se),ge=J.title,Be=ge&&ge!==J.name?ge:R0(pe);L.has(se)||L.set(se,{clientId:se,conn:N.get(se),tools:[]}),L.get(se).tools.push({name:J.name,display:Be,description:J.description})}const B=[...L.values()].sort(O0),I=(u?.tools??[]).map(M0),M=[...A0,...I],O=i===null?new Set(M):new Set(i),F=M.every(J=>O.has(J)),z=J=>r(M.every(se=>J.has(se))?null:[...J]),V=J=>{const se=new Set(O);se.has(J)?se.delete(J):se.add(J),z(se)},G=(J,se)=>{const pe=new Set(O);for(const ge of J)se?pe.add(ge):pe.delete(ge);z(pe)};b=Ys,A=a,x=l;let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(za,{size:14,className:"text-muted-foreground"}),e[25]=X):X=e[25];const ie=F?"All tools":"Tools",U=!F&&n.jsxs(Ng,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[O.size,"/",M.length]});let Y;e[26]===Symbol.for("react.memo_cache_sentinel")?(Y=n.jsx(Rs,{size:14,className:"text-muted-foreground"}),e[26]=Y):Y=e[26],e[27]!==ie||e[28]!==U?(_=n.jsx(Xs,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[X,ie,U,Y]})}),e[27]=ie,e[28]=U,e[29]=_):_=e[29],v=Js,E="p-0 w-80",T="start",g=Tg,e[30]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Pg,{placeholder:"Search tools..."}),e[30]=w):w=e[30];const ne=F?`All ${M.length} tools enabled`:`${O.size} of ${M.length} enabled`;let $;e[31]!==ne?($=n.jsx("span",{className:"text-xs text-muted-foreground",children:ne}),e[31]=ne,e[32]=$):$=e[32];let Z;e[33]!==r?(Z=()=>r(null),e[33]=r,e[34]=Z):Z=e[34];let K;e[35]!==F||e[36]!==Z?(K=n.jsx("button",{type:"button",onClick:Z,disabled:F,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Select all"}),e[35]=F,e[36]=Z,e[37]=K):K=e[37];let ee;e[38]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[38]=ee):ee=e[38];let Q;e[39]!==r?(Q=()=>r([]),e[39]=r,e[40]=Q):Q=e[40];const fe=O.size===0;let me;e[41]!==Q||e[42]!==fe?(me=n.jsx("button",{type:"button",onClick:Q,disabled:fe,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Clear"}),e[41]=Q,e[42]=fe,e[43]=me):me=e[43];let _e;e[44]!==K||e[45]!==me?(_e=n.jsxs("div",{className:"flex items-center gap-2",children:[K,ee,me]}),e[44]=K,e[45]=me,e[46]=_e):_e=e[46],e[47]!==$||e[48]!==_e?(j=n.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[$,_e]}),e[47]=$,e[48]=_e,e[49]=j):j=e[49],p=Ag,y="max-h-80",S=f?n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading tools…"}):n.jsxs(n.Fragment,{children:[n.jsx(Eg,{children:"No tools found"}),Vu.map(J=>{const se=J.tools.map(B0),pe=se.filter(ge=>O.has(ge)).length;return n.jsx(Wl,{heading:n.jsx(kc,{label:J.heading,icon:J.icon,on:pe,total:se.length,onToggle:()=>G(se,pe!==se.length)}),children:J.tools.map(ge=>n.jsx(Cc,{value:`${ge.title} ${ge.name}`,checked:O.has(ge.name),onToggle:()=>V(ge.name),title:ge.title,description:ge.description,leading:n.jsx(ge.icon,{size:16,className:"text-muted-foreground"})},ge.name))},J.key)}),B.map(J=>{const se=J.tools.map(L0),pe=se.filter(ge=>O.has(ge)).length;return n.jsx(Wl,{heading:n.jsx(kc,{conn:J.conn,on:pe,total:se.length,onToggle:()=>G(se,pe!==se.length)}),children:J.tools.map(ge=>n.jsx(Cc,{value:`${ge.display} ${ge.name} ${J.conn?.title??""}`,checked:O.has(ge.name),onToggle:()=>V(ge.name),title:ge.display,description:ge.description},ge.name))},J.clientId)})]}),e[6]=m,e[7]=u?.tools,e[8]=f,e[9]=r,e[10]=a,e[11]=i,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=x,e[17]=_,e[18]=y,e[19]=S,e[20]=w,e[21]=j,e[22]=E,e[23]=T,e[24]=A}else p=e[12],g=e[13],v=e[14],b=e[15],x=e[16],_=e[17],y=e[18],S=e[19],w=e[20],j=e[21],E=e[22],T=e[23],A=e[24];let R;e[50]!==p||e[51]!==y||e[52]!==S?(R=n.jsx(p,{className:y,children:S}),e[50]=p,e[51]=y,e[52]=S,e[53]=R):R=e[53];let k;e[54]!==g||e[55]!==R||e[56]!==w||e[57]!==j?(k=n.jsxs(g,{children:[w,j,R]}),e[54]=g,e[55]=R,e[56]=w,e[57]=j,e[58]=k):k=e[58];let C;e[59]!==v||e[60]!==k||e[61]!==E||e[62]!==T?(C=n.jsx(v,{className:E,align:T,children:k}),e[59]=v,e[60]=k,e[61]=E,e[62]=T,e[63]=C):C=e[63];let D;return e[64]!==b||e[65]!==x||e[66]!==_||e[67]!==C||e[68]!==A?(D=n.jsxs(b,{open:A,onOpenChange:x,children:[_,C]}),e[64]=b,e[65]=x,e[66]=_,e[67]=C,e[68]=A,e[69]=D):D=e[69],D}function L0(t){return t.name}function B0(t){return t.name}function M0(t){return t.name}function O0(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function $0(t){return[t.id,t]}function nr(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function z0(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 i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return`Every ${i[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const l=(o[2]??"0").padStart(2,"0"),h=(o[1]??"0").padStart(2,"0");return`Every day at ${l}:${h} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",c=(a[2]??"0").padStart(2,"0"),d=(a[1]??"0").padStart(2,"0");return`Every ${h} at ${c}:${d} UTC`}return t}function F0(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 H0(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 i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return{count:parseInt(i[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const o=parseInt(r[1]);return o%7===0?{count:o/7,unit:"weeks"}:{count:o,unit:"days"}}return null}function W0(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const U0=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function K0({automationId:t,open:e,onOpenChange:s,onCustomSelect:i,onEventSelect:r,onWebhookCreated:o}){const{triggerAdd:a}=yr(),[l,h]=P.useState(!1),c=e??l,d=m=>{s?s(m):h(m)},u=async m=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),ae.success("Starter added"),d(!1)}catch(p){const g=p instanceof Error?p.message:"Failed to add starter";ae.error(g)}},f=async()=>{try{const m=await a.mutateAsync({automation_id:t,type:"webhook"});d(!1),m.webhook?o?.(m.webhook):ae.success("Webhook starter added")}catch(m){const p=m instanceof Error?m.message:"Failed to add webhook starter";ae.error(p)}};return n.jsxs(os,{open:c,onOpenChange:d,children:[n.jsx(as,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",children:[n.jsx(Bt,{size:14}),"Add Starter"]})}),n.jsxs(ls,{align:"end",className:"w-[200px]",children:[n.jsxs(ko,{children:[n.jsxs(jo,{className:"gap-2.5",children:[n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}),"Every..."]}),n.jsx(No,{className:"w-[160px]",children:U0.map(m=>n.jsxs(We,{className:"gap-2.5",onSelect:()=>u(m.cron),disabled:a.isPending,children:[n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}),"Every ",m.label]},m.cron))})]}),n.jsxs(We,{className:"gap-2.5",onSelect:()=>{d(!1),i?.()},children:[n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}),"Custom (cron)"]}),n.jsxs(We,{className:"gap-2.5",onSelect:()=>{d(!1),r?.()},children:[n.jsx(dr,{size:14,className:"text-muted-foreground shrink-0"}),"Event"]}),n.jsxs(We,{className:"gap-2.5",onSelect:()=>{f()},disabled:a.isPending,children:[n.jsx(xr,{size:14,className:"text-muted-foreground shrink-0"}),"Webhook"]})]})]})}function qu(t){const e=H.c(31),{open:s,onOpenChange:i,url:r,token:o,title:a,description:l}=t,h=a===void 0?"Webhook ready":a,c=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,[d,u]=P.useState(null),[f,m]=P.useState("curl"),[p,g]=P.useState("header"),v=P.useId();let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=async(N,L)=>{try{await navigator.clipboard.writeText(N),u(L),ae.success("Copied"),setTimeout(()=>u(null),1500)}catch{ae.error("Failed to copy")}},e[0]=b):b=e[0];const x=b;let _;e[1]!==p||e[2]!==o||e[3]!==r?(_=r&&o&&p==="url"?`${r.replace(/\/$/,"")}/${o}`:r??"",e[1]=p,e[2]=o,e[3]=r,e[4]=_):_=e[4];const y=_,S=r&&o?p==="header"?`curl -X POST "${y}" \\
|
|
466
|
+
`}),e[26]=y):y=e[26];let S;return e[27]!==_||e[28]!==d?(S=n.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:[d,_,y]}),e[27]=_,e[28]=d,e[29]=S):S=e[29],S}function Dr(t){const e=H.c(10),{phase:s,current:i,children:r}=t,o=s-i,a=o<0,l=o===0,h=a?90:o*-22,c=a?.94:1-Math.max(o,0)*.04,d=a?0:l?1:o===1?.8:.55,u=a?10:30-o,f=!l;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=le("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(${h}px) scale(${c})`,g=l?"auto":"none";let v;e[1]!==d||e[2]!==p||e[3]!==g||e[4]!==u?(v={transform:p,opacity:d,zIndex:u,transitionDuration:"1000ms",pointerEvents:g},e[1]=d,e[2]=p,e[3]=g,e[4]=u,e[5]=v):v=e[5];let b;return e[6]!==r||e[7]!==f||e[8]!==v?(b=n.jsx("div",{"aria-hidden":f,className:m,style:v,children:r}),e[6]=r,e[7]=f,e[8]=v,e[9]=b):b=e[9],b}function Bn(t){const e=H.c(7),{showUrl:s}=t,i=s===void 0?!1:s;let r,o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:le("size-2.5 rounded-full",Ft)}),o=n.jsx("div",{className:le("size-2.5 rounded-full",Ft)}),a=n.jsx("div",{className:le("size-2.5 rounded-full",Ft)}),e[0]=r,e[1]=o,e[2]=a):(r=e[0],o=e[1],a=e[2]);let l;e[3]!==i?(l=i&&n.jsx("div",{className:le("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",rs)}),e[3]=i,e[4]=l):l=e[4];let h;return e[5]!==l?(h=n.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[r,o,a,l]}),e[5]=l,e[6]=h):h=e[6],h}function Vb(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Bn,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"flex flex-1 px-8 py-5",children:n.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:zb.map(qb)})})]}),t[1]=s):s=t[1],s}function qb(t,e){if(e===Au)return n.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 n.jsx("div",{className:le("relative rounded-md",Ft),children:n.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${Ru}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function Gb(){const t=H.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Bn,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:le("w-[18%] rounded-md",rs),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=n.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]=i):i=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.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]=r):r=t[3];let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[i,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[r,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[n.jsx("div",{className:le("rounded-md",rs),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),n.jsx("div",{className:le("rounded-md",rs),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function Yb(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Bn,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:n.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:Wb.map(Xb)})})]}),t[1]=s):s=t[1],s}function Xb(t,e){return n.jsx("div",{className:le("aspect-square rounded-md",Ub[e]?"bg-chart-2/70":Ft),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function Jb(){const t=H.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Bn,{showUrl:!0}),t[0]=e):e=t[0];let s,i,r,o,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),i=n.jsx("div",{className:le("h-1.5 w-[70%] rounded-sm",Ft)}),r=n.jsx("div",{className:le("h-1.5 w-[55%] rounded-sm",Ft)}),o=n.jsx("div",{className:le("h-1.5 w-[80%] rounded-sm",Ft)}),a=n.jsx("div",{className:le("h-1.5 w-[50%] rounded-sm",Ft)}),t[1]=s,t[2]=i,t[3]=r,t[4]=o,t[5]=a):(s=t[1],i=t[2],r=t[3],o=t[4],a=t[5]);let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,i,r,o,a,n.jsx("div",{className:"mt-auto",children:n.jsx("div",{className:le("h-4 rounded-md",Ft)})})]}),t[6]=l):l=t[6];let h;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:n.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[n.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),n.jsx("div",{className:le("h-1.5 w-[55%] rounded-sm",rs)})]})}),t[7]=h):h=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[n.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),n.jsx("div",{className:le("h-4 w-10 rounded-full",rs)}),n.jsx("div",{className:le("h-4 w-14 rounded-full",rs)})]}),t[8]=c):c=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs("div",{className:le("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",rs),children:[n.jsx("div",{className:le("h-1.5 w-[50%] rounded-sm",Ft)}),n.jsx("div",{className:le("h-1 w-[75%] rounded-sm",Ft)})]}),t[9]=d):d=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1",children:[l,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[c,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[d,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[n.jsx("div",{className:le("rounded-md",rs)}),n.jsx("div",{className:le("rounded-md",rs)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function mn(t){const e=H.c(9);if(t.kind==="starting"){let l;return e[0]!==t.claimPhase||e[1]!==t.progress?(l=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsx(Kb,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=l):l=e[2],l}let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Bp,{className:"size-12 text-blue-500"}),e[3]=s):s=e[3];let i,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("h3",{className:"text-lg font-medium",children:Ob("suspended")}),r=n.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Resume to continue."}),e[4]=i,e[5]=r):(i=e[4],r=e[5]);let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(fi,{className:"size-4"}),e[6]=o):o=e[6];let a;return e[7]!==t.onResume?(a=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[s,i,r,n.jsxs(oe,{onClick:t.onResume,className:"mt-2",children:[o," Resume"]})]})}),e[7]=t.onResume,e[8]=a):a=e[8],a}function Zb(t){const e=H.c(12),{orgSlug:s,virtualMcpId:i,branch:r,enabled:o}=t,a=o===void 0?!0:o;let l;e[0]!==r||e[1]!==s||e[2]!==i?(l=Tt.sandboxRepoDir(s,i,r),e[0]=r,e[1]=s,e[2]=i,e[3]=l):l=e[3];let h;e[4]!==r||e[5]!==s||e[6]!==i?(h=async()=>{const u=`/api/${s}/sandbox/${encodeURIComponent(i)}/${encodeURIComponent(r)}/config`,f=await fetch(u);return f.ok?(await f.json()).repoDir??null:null},e[4]=r,e[5]=s,e[6]=i,e[7]=h):h=e[7];let c;return e[8]!==a||e[9]!==l||e[10]!==h?(c={queryKey:l,queryFn:h,enabled:a,staleTime:1/0},e[8]=a,e[9]=l,e[10]=h,e[11]=c):c=e[11],As(c).data??null}const pc="https://decoims.com/decocms/01b321bd-4613-4b2c-9348-35058444d210/Visual_Studio_Code_1.35_icon.svg.png",gc="https://decoims.com/decocms/7583d3b5-81d0-4afb-becf-6a59bbb3a68e/cursor-logo-icon-freelogovectors.net_.png",Qb=P.lazy(()=>Ut(()=>import("./sections-editor-ez2BbDtS.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])).then(t=>({default:t.SectionsEditor}))),ey=P.lazy(()=>Ut(()=>import("./page-seo-sheet-BGthAy6g.js"),__vite__mapDeps([146,1,2,70,42,44,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,43,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,71,72,73,74,75,76,77,78,94,85,81,82,83,84,80,79,86,87,88,89,90,91,92,93,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])).then(t=>({default:t.SeoSheet}))),ty=P.lazy(()=>Ut(()=>import("./file-explorer-0kznGCON.js"),__vite__mapDeps([147,1,2,122,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,127,148,121,87,79,83,96,97,98,88,99,100,101,102,103,90,91,104,105,106,107,84,108,109,110,111,112,113,114,115,116,92,93,117,118,119,120,123,124,125,126,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144])).then(t=>({default:t.FileExplorer}))),Zn=500,sy={mobile:375,tablet:768,desktop:null},Qn=["desktop","mobile","tablet"],iy={mobile:"Mobile (375px)",tablet:"Tablet (768px)",desktop:"Desktop"},ry="website/sections/Rendering/Lazy.tsx";function Io(t,e){let s=t,i=typeof s?.__resolveType=="string"?s.__resolveType:"";for(let r=0;i&&r<5;r++){const o=e[i];if(o&&typeof o=="object"&&"__resolveType"in o){const a=o.__resolveType;if(typeof a=="string"&&a&&a!==i){s=o,i=a;continue}}break}if(!i)return[];if(i.includes("flags/multivariate")){const r=Array.isArray(s.variants)?s.variants:[],o=[];for(const a of r){const l=a?.value;if(l&&typeof l=="object")for(const h of Io(l,e))o.includes(h)||o.push(h)}return o}if(i===ry){const r=s.section&&typeof s.section=="object"?Io(s.section,e):[];return r.length?[i,...r]:[i]}return[i]}function ny(t,e){const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}function oy(){const t=Er(),{currentBranch:e}=ys(),[s,i]=P.useState("preview"),[r,o]=P.useState("desktop"),[a,l]=P.useState(null),h=P.useRef(null),c=s==="cms",[d,u]=P.useState(null),[f,m]=P.useState(null),[p,g]=P.useState(384),v=P.useRef(!1),b=P.useRef(0),x=P.useRef(0),_=P.useRef(null),[y,S]=P.useState(!1),[w,j]=P.useState(""),E=P.useRef(null),[T,A]=P.useState(!1),[R,k]=P.useState(),[C,D]=P.useState(null),[N,L]=P.useState(null),[B,I]=P.useState("/"),[M,O]=P.useState(null),[F,z]=P.useState(!1),[V,G]=P.useState(!1),[X,ie]=P.useState(null),U=t?.entity?.id??null,{org:Y}=Ae(),ne=ps(),$=al(),Z=$.vmEntry,K=$.previewUrl,ee=ne.lifecycle.phase,Q=ee==="running",fe=Z?.sandboxProviderKind==="user-desktop",me=Zb({orgSlug:Y.slug,virtualMcpId:U??"",branch:e??"",enabled:fe&&Q&&!!U&&!!e}),_e=fe?me:null,J=U&&e&&Q?{orgSlug:Y.slug,virtualMcpId:U,branch:e,previewUrl:K}:null,{data:se}=qa(J,{fetchEnabled:Q}),{data:pe}=Ga(J,{fetchEnabled:Q}),ge=U&&e?{orgSlug:Y.slug,virtualMcpId:U,branch:e}:null,Be=Eb(ge),Le=se?nl(se).sort((te,ye)=>te.name.localeCompare(ye.name)):[],Ee=se&&pe?ol(se,pe):[],Ze=hi,ct=Le.filter(te=>{if(!w)return!0;const ye=w.toLowerCase();return te.name.toLowerCase().includes(ye)||te.path.toLowerCase().includes(ye)}),yt=Ee.filter(te=>{if(!w)return!0;const ye=w.toLowerCase();return te.name.toLowerCase().includes(ye)||te.key.toLowerCase().includes(ye)||te.resolveType.toLowerCase().includes(ye)}),mt=C?null:ov(Le,B,M),St=C?C.name:mt?.name,qe=mt?.key??null,wt=se&&qe?ju(se,qe,0):[],qt=se?fb(wt,se):[],pt=qt.map(te=>te.isSavedBlock?te.label:""),Ot=qt.map(te=>te.isSavedBlock?"global":te.isMultivariate?"variant":"normal"),Ct=wt.map(te=>Io(te,se??{})),xe=P.useRef(null),he=P.useRef(null);_v(()=>{const te=h.current,ye=xe.current;!te||!ye||(te.src=ye)});const Pe=ne.status.state==="paused",ze=ne.phase,Re=Pu({claimPhase:ze,lifecycle:ne.lifecycle}),Oe=$.previewState,q=$.userStopped,W=Oe.kind==="iframe"?ub(ny(N??new URL(B,Oe.previewUrl).href,r),c&&f?f:[]):null,[de,ve]=P.useState(null);if(Oe.kind==="iframe"&&de!==Oe.previewUrl){const te=de!==null;ve(Oe.previewUrl),te&&(he.current=null,I("/"),L(null),O(null),D(null))}xe.current=W;const Te=!!U&&!!e&&!ne.notFound&&!q&&!Pe&&(ze?.kind==="ready"||ee!=="idle"),Qe=Oe.kind!=="iframe"&&(s==="visual"||s==="cms")?"preview":s;P.useEffect(()=>{if(!K)return;let te;try{te=new URL(K,window.location.href).origin}catch{return}const ye=ht=>{if(ht.origin===te){if(ht.data?.type==="visual-editor::element-clicked"){const dt=Pb.safeParse(ht.data.payload);dt.success&&l(dt.data)}else if(ht.data?.type==="cms-editor::section-clicked"){const dt=Rb.safeParse(ht.data.payload);dt.success&&u(dt.data.sectionIndex)}}};return window.addEventListener("message",ye),()=>window.removeEventListener("message",ye)},[K]),P.useEffect(()=>{if(!y)return;const te=ye=>{E.current?.contains(ye.target)||(S(!1),j(""))};return document.addEventListener("pointerdown",te),()=>document.removeEventListener("pointerdown",te)},[y]),P.useEffect(()=>{if(!c)return;const te=ht=>{const dt=ht.target;dt&&dt!==h.current&&(_.current=dt)},ye=()=>{requestAnimationFrame(()=>{const ht=document.activeElement;(ht===document.body||ht===h.current)&&_.current&&_.current.focus()})};return document.addEventListener("focusin",te),document.addEventListener("blur",ye,!0),()=>{document.removeEventListener("focusin",te),document.removeEventListener("blur",ye,!0)}},[c]);const si=()=>{const te=h.current?.contentWindow;te&&te.postMessage({type:"visual-editor::activate",script:Ab},"*")},Tr=()=>{const te=h.current?.contentWindow;te&&te.postMessage({type:"visual-editor::deactivate"},"*")},Al=()=>{const te=h.current?.contentWindow;te&&(te.postMessage({type:"visual-editor::activate",script:Db},"*"),te.postMessage({type:"cms-editor::set-labels",labels:pt,kinds:Ot,keys:Ct},"*"))},Kf=()=>{const te=h.current?.contentWindow;te&&te.postMessage({type:"cms-editor::deactivate"},"*")},Ai=te=>{const ye=s;i(te),l(null),te!=="code"&&ie(null),te!=="cms"&&(u(null),m(null)),ye==="visual"&&Tr(),ye==="cms"&&Kf(),te==="visual"&&si(),te==="cms"&&Al()},Vf=()=>{if(!h.current||!W)return;const te=h.current;te.src=W},qf=te=>{m(te)},Gf=()=>{const te=h.current;if(!te)return;const ye=document.activeElement,ht=te.tabIndex;te.tabIndex=-1,te.style.pointerEvents="none",te.blur();try{te.contentWindow?.location.reload()}catch{const Gt=xe.current;Gt&&(te.src=Gt)}const dt=()=>{te.tabIndex=ht,te.style.pointerEvents="",ye?.focus(),te.removeEventListener("load",dt)};te.addEventListener("load",dt),setTimeout(dt,3e3)},Yf=()=>{if(!h.current||!W)return;const te=W.includes("?")?"&":"?";h.current.src=`${W}${te}_r=${Date.now()}`},Xf=()=>{const te=Qn.indexOf(r);o(Qn[(te+1)%Qn.length])},Jf=()=>{const te=h.current?.contentWindow?.location?.href??W??K;te&&navigator.clipboard.writeText(te)},Zf=(()=>{if(!K)return"No server running";if(C)return C.name;try{const te=new URL(K),ye=B==="/"?"":B;return`${te.host}${ye}`}catch{return K}})(),Rl=te=>{he.current=te.path,D(null),L(null),O(te.key),I(te.path),u(null),z(!1)},Qf=te=>{if(!K||!pe){ae.error("Preview metadata not ready yet");return}he.current=null;const ye=zd(pe),ht=Cb(K,ye,te.key);D(te),L(ht),u(null)},em=async({name:te,path:ye})=>{if(!U||!e)return;const ht=tl(ye);if(ht){k(ht);return}const dt=ye.trim().startsWith("/")?ye.trim():`/${ye.trim()}`;if(Le.some(Gt=>Ze(Gt.path)===Ze(dt))){k(`A page with path "${dt}" already exists.`);return}k(void 0);try{const Gt=await Be.mutateAsync({name:te,path:dt});A(!1),ae.success(`Page "${te}" created`),await new Promise(sm=>setTimeout(sm,Zn)),Rl({key:Gt.key,name:Gt.name,path:Gt.path}),Ai("cms")}catch(Gt){k(Gt instanceof Error?Gt.message:"Failed to create page")}},tm=[{value:"preview",icon:n.jsx($l,{size:14}),tooltip:"Interactive"},...Oe.kind==="iframe"?[{value:"visual",icon:n.jsx(zl,{size:14}),tooltip:"Visual editor"}]:[],...Oe.kind==="iframe"&&rl(se,pe)?[{value:"cms",icon:n.jsx(Mp,{size:14}),tooltip:"Sections editor"}]:[],{value:"code",icon:n.jsx(Op,{size:14}),tooltip:"Code editor"}];return n.jsxs("div",{className:"flex flex-col w-full h-full",children:[Te&&n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-4 border-b border-border/60 px-3 md:px-4",children:[n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n.jsx(wg,{value:Qe,onValueChange:Ai,options:tm,size:"sm",className:"shrink-0 bg-foreground/4.5"})}),Oe.kind==="iframe"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:le("flex min-w-0 flex-1 items-center gap-0.5 ml-2",s==="code"&&"hidden"),children:[n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:Vf,children:n.jsx(ar,{size:14})})}),n.jsx(ke,{side:"bottom",children:"Refresh"})]}),n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:Xf,children:n.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[r==="mobile"&&n.jsx($p,{size:14}),r==="tablet"&&n.jsx(zp,{size:14}),r==="desktop"&&n.jsx($l,{size:14})]},r)})}),n.jsx(ke,{side:"bottom",children:iy[r]})]}),n.jsxs("div",{ref:E,className:"relative min-w-0 flex-1",children:[n.jsxs("button",{type:"button",className:"flex h-8 w-full min-w-0 items-center gap-1 rounded-md bg-background px-2 transition-colors duration-200 hover:bg-accent",onClick:()=>S(te=>!te),children:[C&&n.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:[n.jsx(mi,{size:11}),"Global"]}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[12px] text-foreground/88",children:Zf}),St&&!C&&n.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:St}),n.jsx(Rs,{size:12,className:le("shrink-0 text-muted-foreground transition-transform",y&&"rotate-180")})]}),y&&n.jsxs("div",{className:"absolute left-0 right-0 top-full z-50 mt-1.5 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[n.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[n.jsx(_d,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),n.jsx("input",{type:"text",value:w,onChange:te=>j(te.target.value),placeholder:"Search pages and components...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),n.jsx("div",{className:"p-1.5 border-b",children:n.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:te=>{te.preventDefault(),S(!1),j(""),k(void 0),A(!0)},children:[n.jsx(Bt,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"flex-1 font-medium",children:"Create new page"})]})}),ct.length===0&&yt.length===0?n.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:Le.length===0&&Ee.length===0?"No pages found in this site.":"No results match your search."}):n.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[ct.length>0&&n.jsx("div",{className:"p-1.5",children:ct.map(te=>n.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:ye=>{ye.preventDefault(),S(!1),j(""),Rl(te)},children:[n.jsx(Aa,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:te.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:te.path})]},te.key))}),yt.length>0&&n.jsxs("div",{className:le("p-1.5",ct.length>0&&"border-t"),children:[n.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Global components"}),yt.map(te=>n.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:ye=>{ye.preventDefault(),S(!1),j(""),Qf(te)},children:[n.jsx(mi,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:te.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:te.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},te.key))]})]})]})]})]}),n.jsxs("div",{className:le("flex shrink-0 items-center gap-0.5",s==="code"&&"hidden"),children:[n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>{const te=W??Oe.previewUrl;te&&window.open(te,"_blank","noopener")},children:n.jsx(wi,{size:14})})}),n.jsx(ke,{side:"bottom",children:"Open in new tab"})]}),n.jsxs(os,{children:[n.jsx(as,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",children:n.jsx(Tn,{size:14})})}),n.jsxs(ls,{align:"end",className:"w-44",children:[n.jsx(We,{onClick:Yf,children:"Hard Reload"}),n.jsx(We,{onClick:Jf,children:"Copy Current URL"}),se&&pe&&n.jsxs(n.Fragment,{children:[n.jsx(er,{}),qe&&n.jsxs(We,{onClick:()=>{z(!0),Ai("cms")},children:[n.jsx(Xr,{size:14}),"Edit SEO"]}),qe&&n.jsxs(We,{onClick:()=>{try{ie(Bl(qe)),Ai("code")}catch{ae.error("Invalid page block key")}},children:[n.jsx(Ra,{size:14}),"View JSON"]}),n.jsxs(We,{onClick:()=>G(!0),children:[n.jsx(Xr,{size:14}),"Site SEO"]})]}),_e&&n.jsxs(n.Fragment,{children:[n.jsx(er,{}),n.jsxs(We,{onClick:()=>window.open(`vscode://file${_e}?windowId=_blank`),children:[n.jsx("img",{src:pc,alt:"VSCode",width:14,height:14}),"Open in VSCode"]}),n.jsxs(We,{onClick:()=>window.open(`cursor://file${_e}?windowId=_blank`),children:[n.jsx("img",{src:gc,alt:"Cursor",width:14,height:14}),"Open in Cursor"]})]})]})]})]})]}),s==="code"&&_e&&n.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon","aria-label":"Open in VSCode",onClick:()=>window.open(`vscode://file${_e}?windowId=_blank`),children:n.jsx("img",{src:pc,alt:"VSCode",width:14,height:14})})}),n.jsx(ke,{side:"bottom",children:"Open in VSCode"})]}),n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon","aria-label":"Open in Cursor",onClick:()=>window.open(`cursor://file${_e}?windowId=_blank`),children:n.jsx("img",{src:gc,alt:"Cursor",width:14,height:14})})}),n.jsx(ke,{side:"bottom",children:"Open in Cursor"})]})]})]}),n.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c&&K&&e&&U&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"shrink-0 border-r overflow-hidden",style:{width:p},children:n.jsx(P.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(Qb,{orgSlug:Y.slug,virtualMcpId:U,branch:e,previewReady:Q,previewUrl:K,currentPath:B,activePageBlockKey:qe,activeGlobalBlockKey:C?.key??null,externalSelectedIndex:C?null:d,onSaved:()=>{setTimeout(Gf,Zn)},initialEditSeo:F,onExitSeo:()=>z(!1),onViewJsonFile:te=>{try{ie(Bl(te)),Ai("code")}catch{ae.error("Invalid page block key")}},onVariantPreviewOverride:qf})})}),n.jsx("div",{className:"w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-border transition-colors",onPointerDown:te=>{v.current=!0,b.current=te.clientX,x.current=p,te.currentTarget.setPointerCapture(te.pointerId)},onPointerMove:te=>{if(!v.current)return;const ye=te.clientX-b.current;g(Math.max(240,Math.min(640,x.current+ye)))},onPointerUp:()=>{v.current=!1}})]}),n.jsxs("div",{className:le("flex-1 relative overflow-hidden",r!=="desktop"&&Oe.kind==="iframe"&&s!=="code"&&"flex justify-center bg-muted/30"),children:[Oe.kind==="starting"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(mn,{kind:"starting",progress:Re,claimPhase:ze})}),Oe.kind==="suspended"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(mn,{kind:"suspended",onResume:$.resume})}),Qe==="visual"&&!a&&n.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:[n.jsx(zl,{size:12}),"Click any element to ask the AI"]}),Qe==="visual"&&a&&n.jsx(Bb,{element:a,onDismiss:()=>l(null)}),s==="code"&&Te&&U&&e&&n.jsx("div",{className:"absolute inset-0 z-10 bg-background",children:n.jsx(P.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(ty,{orgSlug:Y.slug,virtualMcpId:U,branch:e,openPath:X})})}),Oe.kind==="iframe"&&W&&n.jsx("div",{className:le("h-full transition-[width] duration-250 [transition-timing-function:var(--ease-in-out-cubic)]",r!=="desktop"&&s!=="code"&&"w-full max-w-full border-x border-border bg-background shadow-sm"),style:{width:r==="desktop"||s==="code"?"100%":`${sy[r]}px`},children:n.jsx("iframe",{ref:h,src:W,className:le("w-full h-full border-0",s==="code"&&"invisible"),title:"Dev Server Preview",tabIndex:c?-1:void 0,onLoad:()=>{if(Ie("vm_preview_loaded",{view_mode:s,vm_id:Z?.sandboxHandle??null}),!C)try{const te=h.current?.contentWindow?.location?.pathname;if(!te)return;const ye=he.current;if(ye!==null){he.current=null,Ze(te)===Ze(ye)&&I(te);return}I(te)}catch{}s==="visual"&&si(),s==="cms"&&Al()}},Oe.previewUrl)})]})]}),n.jsx(Tb,{open:T,onOpenChange:A,isPending:Be.isPending,error:R,onSubmit:em}),V&&se&&pe&&n.jsx(P.Suspense,{fallback:null,children:n.jsx(ey,{open:V,onOpenChange:G,orgSlug:Y.slug,virtualMcpId:U??"",branch:e??"",decofile:se,meta:pe,onSaved:()=>{setTimeout(()=>{const te=h.current;if(te)try{te.contentWindow?.location.reload()}catch{const ye=xe.current;ye&&(te.src=ye)}},Zn)},target:{kind:"site"}})})]})}function ay(t){const e=H.c(2),{virtualMcpId:s}=t,i=ds(s);if(!Ws(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(_r,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No source to preview."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Connections tab to enable Preview."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(oy,{}),e[1]=o):o=e[1],o}function ly(t){const e=H.c(8);let s,i;e[0]!==t?({className:s,...i}=t,e[0]=t,e[1]=s,e[2]=i):(s=e[1],i=e[2]);let r;e[3]!==s?(r=le("grid gap-3",s),e[3]=s,e[4]=r):r=e[4];let o;return e[5]!==i||e[6]!==r?(o=n.jsx(ag,{"data-slot":"radio-group",className:r,...i}),e[5]=i,e[6]=r,e[7]=o):o=e[7],o}function _c(t){const e=H.c(9);let s,i;e[0]!==t?({className:s,...i}=t,e[0]=t,e[1]=s,e[2]=i):(s=e[1],i=e[2]);let r;e[3]!==s?(r=le("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[2px] disabled:opacity-50",s),e[3]=s,e[4]=r):r=e[4];let o;e[5]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(lg,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:n.jsx(jg,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=o):o=e[5];let a;return e[6]!==i||e[7]!==r?(a=n.jsx(og,{"data-slot":"radio-group-item",className:r,...i,children:o}),e[6]=i,e[7]=r,e[8]=a):a=e[8],a}function cy(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([i])=>!e.includes(i)));return Object.keys(s).length>0?{...t,properties:s}:t}function hy(t,e,s){return typeof t!="string"?null:cy(Md(t,e),s)}function Du(t,e,s){if(!e||typeof t!="string")return!1;const i=hy(t,e,s);return!!i&&Object.keys(i.properties??{}).length>0}function dy({orgSlug:t,virtualMcpId:e,branch:s}){const i=qs();return xi({mutationFn:async({blockKey:r})=>{const o=Jh(r),a=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:o})});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Error(l.error??`Delete failed (${a.status})`)}return a.json()},onMutate:async({blockKey:r})=>{const o=`${t}/${e}/${s}`,a=Tt.decofile(o);await i.cancelQueries({queryKey:a});const l=i.getQueryData(a);return i.setQueryData(a,h=>{if(!h)return h;const{[r]:c,...d}=h;return d}),{previous:l,queryKey:a}},onError:(r,o,a)=>{a?.queryKey&&i.setQueryData(a.queryKey,a.previous)},onSuccess:()=>{const r=`${t}/${e}/${s}`;i.invalidateQueries({queryKey:Tt.liveMeta(r)})}})}function Mn(t,e){return`${t}-${e}`}function Iu(t,e){return`site/apps/${t}/${e}.ts`}function Lu(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 uy(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function fy(t){return t==="local"?"Custom":"Installed"}function Bu(t,e,s){const i=new Set([Mn(t,e),e].map(o=>o.toLowerCase())),r=Iu(t,e);for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(i.has(o.toLowerCase())||l.__resolveType===r)return o}return null}function my(t,e){const s=t.vendor.alias,i=t.name,r=Bu(s,i,e);return{id:Mn(s,i),app:i,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Iu(s,i),blockKey:r,installed:r!==null}}function py(t,e,s){if(t===il)return null;const i=Lu(t);if(!i)return null;const{vendor:r,app:o}=i,a=Bu(r,o,s),l=Ci(t,e);return{id:Mn(r,o),app:o,vendor:r,title:l.title??o,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function gy(t,e,s){const i=e.__resolveType;if(typeof i!="string"||hn(t,e)||!Bd(i))return null;const r=Lu(i)??uy(t);if(!r)return null;const o=Ci(i,s),{vendor:a,app:l}=r;return{id:Mn(a,l),app:l,vendor:a,title:o.title??dn(t,e,s),description:o.description??"",category:fy(a),logo:o.logo??o.icon,resolveType:i,blockKey:t,installed:!0}}function _y(t,e,s){const i=new Map;for(const o of t){const a=my(o,s);i.set(a.id,a)}const r=e.manifest?.blocks?.apps??{};for(const o of Object.keys(r)){const a=py(o,e,s);!a||i.has(a.id)||i.set(a.id,a)}for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=gy(o,a,e);!l||i.has(l.id)||i.set(l.id,l)}return[...i.values()].sort(vy)}function vy(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function xy(){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 by(t,e,s){const i=H.c(12),r=s?.enabled??!0;let o;i[0]===Symbol.for("react.memo_cache_sentinel")?(o=Tt.decoApps(),i[0]=o):o=i[0];let a;i[1]!==r?(a={queryKey:o,queryFn:xy,staleTime:3e5,retry:1,enabled:r},i[1]=r,i[2]=a):a=i[2];const l=As(a);let h;i[3]!==e||i[4]!==t||i[5]!==l.data?(h=t&&e?_y(l.data??[],t,e):[],i[3]=e,i[4]=t,i[5]=l.data,i[6]=h):h=i[6];const c=h,d=l.isLoading&&!l.isError;let u;return i[7]!==c||i[8]!==l.isError||i[9]!==l.refetch||i[10]!==d?(u={catalog:c,isLoading:d,isError:l.isError,refetch:l.refetch},i[7]=c,i[8]=l.isError,i[9]=l.refetch,i[10]=d,i[11]=u):u=i[11],u}function vc(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),i=`${s} (copy)`;if(!t.has(i))return i;for(let r=2;r<1e3;r++){const o=`${s} (copy ${r})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function yy(t,e){const s=hi,i=e.replace(/-copy(?:-\d+)?$/,""),r=`${i}-copy`;if(!t.has(s(r)))return r;for(let o=2;o<1e3;o++){const a=`${i}-copy-${o}`;if(!t.has(s(a)))return a}return`${i}-copy-${Date.now()}`}function Mu(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),i=`${s}_copy`;if(!Object.hasOwn(t,i))return i;for(let r=2;r<1e3;r++){const o=`${s}_copy_${r}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function Sy(t){const e=pl(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function wy(t,e){return Eu(t,e)}const Cy=1e3;function ky(t,e){for(let s=0;s<Cy;s++){const i=pl(e);if(!Object.hasOwn(t,i))return i}throw new Error("Could not generate a unique page block key")}function jy(t,e){const s=(t.title||t.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),i=/^[A-Za-z]/.test(s)&&s.length>0?s:"Section",r=Mu(e,i);return{blockKey:r,data:{__resolveType:t.resolveType,name:r}}}const Ny={create:"Create new page",duplicate:"Duplicate page",rename:"Rename page"},Ey={create:"Create",duplicate:"Duplicate",rename:"Save"},Ty={create:"Creating…",duplicate:"Duplicating…",rename:"Saving…"};function Py(t){const e=H.c(54),{open:s,mode:i,initialName:r,initialPath:o,isPending:a,error:l,validate:h,onSubmit:c,onOpenChange:d}=t,u=a===void 0?!1:a,[f,m]=P.useState(r),[p,g]=P.useState(o),[v,b]=P.useState(null),[x,_]=P.useState(s);s!==x&&(_(s),s&&(m(r),g(o),b(null)));let y;e[0]!==u||e[1]!==d?(y=U=>{!U&&!u&&(b(null),d(!1))},e[0]=u,e[1]=d,e[2]=y):y=e[2];const S=y;let w;e[3]!==u||e[4]!==f||e[5]!==c||e[6]!==p||e[7]!==h?(w=async U=>{U.preventDefault();const Y=f.trim(),ne=p.trim();if(!Y||!ne||u)return;const $=tl(ne);if($){b($);return}const Z=h?.({name:Y,path:ne});if(Z){b(Z);return}b(null),await c({name:Y,path:ne})},e[3]=u,e[4]=f,e[5]=c,e[6]=p,e[7]=h,e[8]=w):w=e[8];const j=w,E=v??l,T=Ny[i];let A;e[9]!==T?(A=n.jsx(fs,{children:n.jsx(ms,{children:T})}),e[9]=T,e[10]=A):A=e[10];let R;e[11]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[11]=R):R=e[11];let k;e[12]===Symbol.for("react.memo_cache_sentinel")?(k=U=>m(U.target.value),e[12]=k):k=e[12];let C;e[13]!==u||e[14]!==f?(C=n.jsxs("div",{className:"space-y-1.5",children:[R,n.jsx(st,{id:"page-form-name",value:f,onChange:k,placeholder:"My page",autoFocus:!0,disabled:u})]}),e[13]=u,e[14]=f,e[15]=C):C=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:"Path"}),e[16]=D):D=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=U=>g(U.target.value),e[17]=N):N=e[17];let L;e[18]!==u||e[19]!==p?(L=n.jsxs("div",{className:"space-y-1.5",children:[D,n.jsx(st,{id:"page-form-path",value:p,onChange:N,placeholder:"/example",disabled:u})]}),e[18]=u,e[19]=p,e[20]=L):L=e[20];let B;e[21]!==E?(B=E&&n.jsx("p",{className:"text-xs text-destructive",children:E}),e[21]=E,e[22]=B):B=e[22];let I;e[23]!==L||e[24]!==B||e[25]!==C?(I=n.jsxs("div",{className:"space-y-4 py-4",children:[C,L,B]}),e[23]=L,e[24]=B,e[25]=C,e[26]=I):I=e[26];let M;e[27]!==d?(M=()=>d(!1),e[27]=d,e[28]=M):M=e[28];let O;e[29]!==u||e[30]!==M?(O=n.jsx(oe,{type:"button",variant:"outline",onClick:M,disabled:u,children:"Cancel"}),e[29]=u,e[30]=M,e[31]=O):O=e[31];let F;e[32]!==u||e[33]!==f||e[34]!==p?(F=!f.trim()||!p.trim()||u,e[32]=u,e[33]=f,e[34]=p,e[35]=F):F=e[35];let z;e[36]!==u||e[37]!==i?(z=u?n.jsxs(n.Fragment,{children:[n.jsx(Ne,{size:14,className:"animate-spin"}),Ty[i]]}):Ey[i],e[36]=u,e[37]=i,e[38]=z):z=e[38];let V;e[39]!==F||e[40]!==z?(V=n.jsx(oe,{type:"submit",disabled:F,children:z}),e[39]=F,e[40]=z,e[41]=V):V=e[41];let G;e[42]!==O||e[43]!==V?(G=n.jsxs(Zs,{children:[O,V]}),e[42]=O,e[43]=V,e[44]=G):G=e[44];let X;e[45]!==j||e[46]!==I||e[47]!==G||e[48]!==A?(X=n.jsx(Vt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:j,children:[A,I,G]})}),e[45]=j,e[46]=I,e[47]=G,e[48]=A,e[49]=X):X=e[49];let ie;return e[50]!==S||e[51]!==s||e[52]!==X?(ie=n.jsx(Kt,{open:s,onOpenChange:S,children:X}),e[50]=S,e[51]=s,e[52]=X,e[53]=ie):ie=e[53],ie}function Ay(t){const e=H.c(43),{open:s,blockKey:i,initialName:r,isPending:o,onSubmit:a,onOpenChange:l}=t,h=o===void 0?!1:o,[c,d]=P.useState(r),[u,f]=P.useState(s);s!==u&&(f(s),s&&d(r));let m;e[0]!==h||e[1]!==l?(m=L=>{!L&&!h&&l(!1)},e[0]=h,e[1]=l,e[2]=m):m=e[2];const p=m;let g;e[3]!==h||e[4]!==c||e[5]!==a?(g=async L=>{L.preventDefault();const B=c.trim();!B||h||await a(B)},e[3]=h,e[4]=c,e[5]=a,e[6]=g):g=e[6];const v=g;let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsxs(fs,{children:[n.jsx(ms,{children:"Rename section"}),n.jsx(Rn,{children:"Updates the display name. The internal key stays the same so pages referencing this section keep working."})]}),e[7]=b):b=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[8]=x):x=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=L=>d(L.target.value),e[9]=_):_=e[9];let y;e[10]!==h||e[11]!==c?(y=n.jsxs("div",{className:"space-y-1.5",children:[x,n.jsx(st,{id:"section-rename-name",value:c,onChange:_,autoFocus:!0,disabled:h})]}),e[10]=h,e[11]=c,e[12]=y):y=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Key"}),e[13]=S):S=e[13];let w;e[14]!==i?(w=n.jsxs("div",{className:"space-y-1.5",children:[S,n.jsx(st,{value:i,readOnly:!0,disabled:!0,className:"font-mono"})]}),e[14]=i,e[15]=w):w=e[15];let j;e[16]!==y||e[17]!==w?(j=n.jsxs("div",{className:"space-y-4 py-4",children:[y,w]}),e[16]=y,e[17]=w,e[18]=j):j=e[18];let E;e[19]!==l?(E=()=>l(!1),e[19]=l,e[20]=E):E=e[20];let T;e[21]!==h||e[22]!==E?(T=n.jsx(oe,{type:"button",variant:"outline",onClick:E,disabled:h,children:"Cancel"}),e[21]=h,e[22]=E,e[23]=T):T=e[23];let A;e[24]!==h||e[25]!==c?(A=!c.trim()||h,e[24]=h,e[25]=c,e[26]=A):A=e[26];let R;e[27]!==h?(R=h?n.jsxs(n.Fragment,{children:[n.jsx(Ne,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[27]=h,e[28]=R):R=e[28];let k;e[29]!==A||e[30]!==R?(k=n.jsx(oe,{type:"submit",disabled:A,children:R}),e[29]=A,e[30]=R,e[31]=k):k=e[31];let C;e[32]!==T||e[33]!==k?(C=n.jsxs(Zs,{children:[T,k]}),e[32]=T,e[33]=k,e[34]=C):C=e[34];let D;e[35]!==v||e[36]!==j||e[37]!==C?(D=n.jsx(Vt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:v,children:[b,j,C]})}),e[35]=v,e[36]=j,e[37]=C,e[38]=D):D=e[38];let N;return e[39]!==p||e[40]!==s||e[41]!==D?(N=n.jsx(Kt,{open:s,onOpenChange:p,children:D}),e[39]=p,e[40]=s,e[41]=D,e[42]=N):N=e[42],N}const eo={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},_l=["posts","authors","categories"],ir={posts:"post",authors:"author",categories:"category"};function rr(t){return _l.includes(t)}const vl={posts:"post",authors:"author",categories:"category"},Ou={posts:eo.post,authors:eo.author,categories:eo.category},Ry=Object.fromEntries(Object.entries(Ou).map(([t,e])=>[e,t]));function Dy(t){return typeof t=="string"?Ry[t]??null:null}function pi(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Xt(t){return typeof t=="string"?t:""}function Iy(t,e){switch(t){case"posts":return{label:Xt(e.title)||"Untitled post",subtitle:Xt(e.slug)};case"authors":return{label:Xt(e.name)||"Unnamed author",subtitle:Xt(e.email)};case"categories":return{label:Xt(e.name)||"Unnamed category",subtitle:Xt(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function $u(t){const e={posts:[],authors:[],categories:[]};for(const[s,i]of Object.entries(t)){const r=pi(i);if(!r)continue;const o=Dy(r.__resolveType);if(!o)continue;const a=pi(r[vl[o]])??{},{label:l,subtitle:h}=Iy(o,a);e[o].push({key:s,kind:o,label:l,subtitle:h})}for(const s of _l)e[s].sort((i,r)=>i.label.localeCompare(r.label));return e}function Ly(t,e){return $u(t)[e]}function pn(t,e){return Ly(t,e).map(s=>({key:s.key,payload:Lo(pi(t[s.key])??void 0,e)}))}function Lo(t,e){return t?pi(t[vl[e]])??{}:{}}function to(t,e,s){return{name:t,__resolveType:Ou[e],[vl[e]]:s}}function zu(t){return`.deco/blocks/${encodeURIComponent(t)}.json`}function gn(t){return Array.isArray(t)?t:[]}function xl(t){if(typeof t=="string")return t;const e=pi(t);return e?Xt(e.slug):""}function By(t){if(typeof t=="string")return t;const e=pi(t);return e?Xt(e.email):""}function My(t){return pn(t,"posts").map(({key:e,payload:s})=>({key:e,title:Xt(s.title)||"Untitled post",slug:Xt(s.slug),date:Xt(s.date),categorySlugs:gn(s.categories).map(xl).filter(Boolean),authorEmails:gn(s.authors).map(By).filter(Boolean)}))}function Oy(t,e){const s=gn(t.categories);return s.some(i=>xl(i)===e.slug)?t:{...t,categories:[...s,{name:e.name,slug:e.slug}]}}function $y(t,e){const s=gn(t.categories);return s.length===1&&xl(s[0])===e.slug?t:{...t,categories:[{name:e.name,slug:e.slug}]}}function Bo(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 xc(t,e){const s=`collections/blog/${e}/${Bo(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function zy(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Bo(8)}`,date:new Date().toISOString().slice(0,10),image:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Bo(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Fy={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"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},bc="Box";function Hy(t){return t.startsWith("site/")?"site":"app"}function Wy(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function Ii(...t){for(const e of t)if(e!==void 0)return e}function Zj(t){const e=new Set,s=[],i=t.manifest?.blocks??{};for(const r of Object.values(i))for(const o of Object.keys(r)){if(!Vy(o)||e.has(o))continue;e.add(o);const a=Ci(o,t),l=Uy(o),h=Fy[l],c=Hy(o),d=(c==="site"?Ii(a.title,h?.title):Ii(h?.title,a.title))??l,u=c==="site"?Ii(a.description,h?.description):Ii(h?.description,a.description),f=c==="site"?a.icon:void 0,m=f&&Wy(f)?f:void 0,p=m!==void 0?h?.iconName??bc:Ii(f,h?.iconName)??bc;s.push({resolveType:o,title:d,description:u,iconName:p,iconUrl:m,source:c})}return s.sort((r,o)=>r.title.localeCompare(o.title))}function Uy(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Ky=["blog/sections/blocks/","site/sections/Blog/Post/"];function Vy(t){return Ky.some(e=>t.startsWith(e))}function Fu({orgSlug:t,virtualMcpId:e,branch:s}){return Tt.decofile(`${t}/${e}/${s}`)}function Hu({orgSlug:t,virtualMcpId:e,branch:s},i){return`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/${i}`}function qy(t){const e=H.c(11),s=qs();let i;e[0]!==t?(i=async l=>{const{blockKey:h,data:c}=l,d=await fetch(Hu(t,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:zu(h),content:JSON.stringify(c,null,2)})});if(!d.ok){const u=await d.json().catch(Gy);throw new Error(u.error??`Write failed (${d.status})`)}return d.json()},e[0]=t,e[1]=i):i=e[1];let r;e[2]!==t||e[3]!==s?(r=async l=>{const{blockKey:h,data:c}=l,d=Fu(t);await s.cancelQueries({queryKey:d});const u=s.getQueryData(d);return s.setQueryData(d,f=>({...f??{},[h]:c})),{previous:u,queryKey:d}},e[2]=t,e[3]=s,e[4]=r):r=e[4];let o;e[5]!==s?(o=(l,h,c)=>{c?.queryKey&&s.setQueryData(c.queryKey,c.previous)},e[5]=s,e[6]=o):o=e[6];let a;return e[7]!==i||e[8]!==r||e[9]!==o?(a={mutationFn:i,onMutate:r,onError:o},e[7]=i,e[8]=r,e[9]=o,e[10]=a):a=e[10],xi(a)}function Gy(){return{}}function Yy(t){const e=qs();return xi({mutationFn:async({blockKey:s})=>{const i=await fetch(Hu(t,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:zu(s)})});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.error??`Delete failed (${i.status})`)}return i.json()},onMutate:async({blockKey:s})=>{const i=Fu(t);await e.cancelQueries({queryKey:i});const r=e.getQueryData(i);return e.setQueryData(i,o=>{if(!o)return o;const{[s]:a,...l}=o;return l}),{previous:r,queryKey:i}},onError:(s,i,r)=>{r?.queryKey&&e.setQueryData(r.queryKey,r.previous)}})}function Xy(t){const e=H.c(20),{open:s,onOpenChange:i,pageKey:r,decofile:o}=t,[a,l]=P.useState(!1),h=o[r];let c;e[0]!==h?(c=h===void 0?"// Page not found.":JSON.stringify(h,null,2),e[0]=h,e[1]=c):c=e[1];const d=c;let u;e[2]!==d?(u=()=>{navigator.clipboard.writeText(d).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},e[2]=d,e[3]=u):u=e[3];const f=u;let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ms,{className:"text-sm font-semibold",children:"Page JSON"}),e[4]=m):m=e[4];let p;e[5]!==a?(p=a?n.jsx(Ih,{size:12}):n.jsx(bs,{size:12}),e[5]=a,e[6]=p):p=e[6];const g=a?"Copied":"Copy";let v;e[7]!==f||e[8]!==p||e[9]!==g?(v=n.jsxs(fs,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[m,n.jsxs(oe,{variant:"ghost",size:"sm",onClick:f,className:"h-7 gap-1.5 text-xs",children:[p,g]})]}),e[7]=f,e[8]=p,e[9]=g,e[10]=v):v=e[10];let b;e[11]!==d?(b=n.jsx(jn,{className:"max-h-[70vh]",children:n.jsx("pre",{className:"p-4 text-xs font-mono text-foreground/90 whitespace-pre overflow-auto",children:d})}),e[11]=d,e[12]=b):b=e[12];let x;e[13]!==v||e[14]!==b?(x=n.jsxs(Vt,{className:"max-w-2xl p-0 gap-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=x):x=e[15];let _;return e[16]!==i||e[17]!==s||e[18]!==x?(_=n.jsx(Kt,{open:s,onOpenChange:i,children:x}),e[16]=i,e[17]=s,e[18]=x,e[19]=_):_=e[19],_}const yc=P.lazy(()=>Ut(()=>import("./app-editor-CB02ERjc.js"),__vite__mapDeps([149,1,2,5,44,7,8,9,10,11,12,13,14,15,16,6,3,4,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,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,95,96,97,98,88,99,100,101,102,103,90,91,104,105,106,107,84,108,109,110,111,112,113,114,87,115,116,83,92,93,79,117,118,119,120,121,122,123,124,125,126,127,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,81,82,80,86,89,150])).then(t=>({default:t.AppEditor}))),Jy=P.lazy(()=>Ut(()=>import("./post-editor-BhGUUjQx.js"),__vite__mapDeps([151,1,2,3,28,7,8,9,10,11,12,13,14,15,16,6,4,5,17,18,19,20,21,22,23,24,25,26,27,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,139,90,91,105,140,119,141,142,143,137,111,107,114,92,93,83,84,86,79,87,88,89,81,82,85,80,152,150,153,96,97,98,99,100,101,102,103,104,106,108,109,110,112,113,115,116,117,118,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,138,144])).then(t=>({default:t.PostEditor}))),Zy=P.lazy(()=>Ut(()=>import("./record-editor-D9nFQqRP.js"),__vite__mapDeps([154,1,2,77,76,84,86,9,37,38,8,6,19,17,7,10,11,12,13,14,15,16,3,4,5,18,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,39,40,41,42,43,50,79,87,88,89,64,90,91,152,150,96,56,57,54,55,58,59,60,61,62,63,51,65,44,45,46,47,48,49,52,53,66,67,68,69,70,71,72,73,74,75,78,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,83,92,93,117,118,119,120,121,122,123,124,125,126,127,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144])).then(t=>({default:t.RecordEditor}))),Qy=P.lazy(()=>Ut(()=>import("./category-editor-CL_UxJoz.js"),__vite__mapDeps([155,1,2,12,7,8,9,10,11,13,14,15,16,6,3,4,5,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,77,76,152,150,153,80,92,93,50,83,81,82,84,44,45,46,47,48,49,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,78,85,79,86,87,88,89,90,91,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])).then(t=>({default:t.CategoryEditor}))),e0=P.lazy(()=>Ut(()=>import("./sections-editor-ez2BbDtS.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])).then(t=>({default:t.SectionsEditor}))),t0=P.lazy(()=>Ut(()=>import("./seo-editor-BtQCMu5l.js"),__vite__mapDeps([156,1,2,5,7,8,9,10,11,12,13,14,15,16,6,3,4,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,94,85,81,82,83,84,80,79,86,87,88,89,90,91,92,93,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])).then(t=>({default:t.SeoEditor}))),s0=P.lazy(()=>Ut(()=>import("./add-section-modal-DpjAnzTC.js"),__vite__mapDeps([95,1,2,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,50,77,96,56,57,54,55,58,59,60,61,62,63,64,51,65,44,45,46,47,48,49,52,53,66,67,68,69,70,71,72,73,74,75,76,78,97,98,88,99,100,101,102,103,90,91,104,105,106,107,84,108,109,110,111,112,113,114,87,115,116,83,92,93,79,117,118,119,120,121,122,123,124,125,126,127,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144])).then(t=>({default:t.AddSectionModal}))),i0=P.lazy(()=>Ut(()=>import("./variant-calendar-hE6C_kQd.js"),__vite__mapDeps([157,1,2,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,135])).then(t=>({default:t.VariantCalendar}))),Mo="oklch(0.65 0.15 160)";function r0(){const t=H.c(18),e=Er(),{data:s}=vi.useSession(),{currentBranch:i}=ys(),{org:r}=Ae(),o=e?.entity?.id??null,a=s?.user?.id,l=e?.entity?.metadata,h=a&&i?Cn(l?.sandboxMap?.[a]?.[i]):{},c=Object.values(h),u=(c.find(n0)??c[0])?.previewUrl??null,f=ps(),m=e?.entity?.organization_id??"";let p;t[0]!==r.slug||t[1]!==m?(p={connectionId:ka,orgId:m,orgSlug:r.slug},t[0]=r.slug,t[1]=m,t[2]=p):p=t[2];const g=vt(p),v=ya(g);let b;t[3]!==i||t[4]!==v||t[5]!==o?(b=()=>{if(!o)return;const w={virtualMcpId:o};i&&(w.branch=i),v.mutate(w)},t[3]=i,t[4]=v,t[5]=o,t[6]=b):b=t[6];const x=b,_=!!o&&!!i&&bo.isStopped(o,i),y=qd({previewUrl:u,appPaused:f.status.state==="paused",userStopped:_});if(y.kind!=="iframe"){let w;return t[7]!==y||t[8]!==x||t[9]!==f.lifecycle||t[10]!==f.phase?(w=n.jsx(k0,{state:y,claimPhase:f.phase,lifecycle:f.lifecycle,onStart:x}),t[7]=y,t[8]=x,t[9]=f.lifecycle,t[10]=f.phase,t[11]=w):w=t[11],w}if(!o||!i){let w;return t[12]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Gi,{title:"Waiting for sandbox context…"}),t[12]=w):w=t[12],w}let S;return t[13]!==i||t[14]!==r.slug||t[15]!==u||t[16]!==o?(S=n.jsx(a0,{orgSlug:r.slug,virtualMcpId:o,branch:i,previewUrl:u}),t[13]=i,t[14]=r.slug,t[15]=u,t[16]=o,t[17]=S):S=t[17],S}function n0(t){return t.sandboxProviderKind!=="user-desktop"}const Sc=2e3,o0=15;function wc(t,e,s,i){return typeof e!="string"||s&&(Du(e,s,i)||t.state.dataUpdateCount>=o0)?!1:Sc}function a0({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:i}){const r={orgSlug:t,virtualMcpId:e,branch:s,previewUrl:i},{data:o,isLoading:a}=qa(r),[l,h]=P.useState("pages"),[c,d]=P.useState(null),[u,f]=P.useState(null),[m,p]=P.useState(""),[g,v]=P.useState(null),[b,x]=P.useState(null),[_,y]=P.useState("date-desc"),[S,w]=P.useState(()=>new Set),[j,E]=P.useState(l);j!==l&&(E(l),p(""),v(null),x(null),y("date-desc"),w(new Set));const{data:T,isLoading:A,isFetching:R}=Ga(r,{refetchInterval:q=>{const W=q.state.data;if(l==="apps"&&c&&c.collection==="apps"){const de=o?.[c.key];return wc(q,typeof de?.__resolveType=="string"?de.__resolveType:void 0,W)}if(l==="site"&&o){const de=W?Ao(o,W):null,ve=o.site,Te=de?.resolveType??(typeof ve?.__resolveType=="string"?ve.__resolveType:void 0);return wc(q,Te,W,["seo"])}return!1}}),k=(q,W)=>!Du(q,T,W)&&(A||R),{catalog:C,isLoading:D}=by(T??void 0,o??void 0,{enabled:l==="apps"}),N=gl(r),L=dy(r),B=qy(r),I=Yy(r),[M,O]=P.useState(null),[F,z]=P.useState(),[V,G]=P.useState(!1),[X,ie]=P.useState(null),[U,Y]=P.useState(null),[ne,$]=P.useState(null),[Z,K]=P.useState(null);if(a||A)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!T)return n.jsx(Gi,{title:"Could not load site data."});const ee=nl(o).sort((q,W)=>q.name.localeCompare(W.name)),Q=ol(o,T),fe=Ao(o,T),me=$u(o),_e=_l.some(q=>me[q].length>0),J=rr(l)?me[l]:[],se=(_e?pn(o,"categories"):[]).map(({key:q,payload:W})=>{const de=typeof W.slug=="string"?W.slug:"",ve=typeof W.name=="string"?W.name:"";return{slug:de||q,name:ve||de||q}}).filter(q=>q.slug).sort((q,W)=>q.name.localeCompare(W.name));if(!rl(o,T)&&!_e)return n.jsx(Gi,{icon:_r,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, or apps."});const pe={pages:ee.length,sections:Q.length,apps:C.length,posts:me.posts.length,authors:me.authors.length,categories:me.categories.length},ge=new Set(ee.map(q=>hi(q.path))),Be=new Set(ee.map(q=>q.name)),Le=new Set(Q.map(q=>q.name)),Ee=async q=>{const W=o[q.key];if(!W)return;const de=ku(o,q.key),ve=ju(o,q.key,Math.max(0,de-1)),Te=Sb(W.sections,ve);if(Te)try{await N.mutateAsync({blockKey:q.key,data:{...W,sections:Te}}),ae.success(`Variant added to "${q.name}"`),d({collection:"pages",key:q.key,path:q.path})}catch(Qe){ae.error(Qe instanceof Error?Qe.message:"Could not add variant")}},Ze=()=>{z(void 0),O({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},ct=q=>{z(void 0),O({mode:"duplicate",sourceKey:q.key,initialName:vc(Be,q.name),initialPath:yy(ge,q.path)})},yt=q=>{z(void 0),O({mode:"rename",sourceKey:q.key,initialName:q.name,initialPath:q.path})},mt=async q=>{if(!M)return;const{mode:W,sourceKey:de}=M;try{if(W==="create"){const ve=wy(q.name,q.path),Te=ky(o,q.name);await N.mutateAsync({blockKey:Te,data:ve}),ae.success(`Created "${q.name}"`),d({collection:"pages",key:Te,path:q.path})}else if(W==="duplicate"&&de){const ve=o[de];if(!ve)throw new Error("Source page not found");const{key:Te,data:Qe}=Sy({source:ve,pages:ee,newName:q.name,newPath:q.path});await N.mutateAsync({blockKey:Te,data:Qe}),ae.success(`Duplicated as "${q.name}"`),d({collection:"pages",key:Te,path:q.path})}else if(W==="rename"&&de){const ve=o[de];if(!ve)throw new Error("Page not found");const Te={...ve,name:q.name,path:q.path};await N.mutateAsync({blockKey:de,data:Te}),ae.success("Page updated"),c?.collection==="pages"&&c.key===de&&d({collection:"pages",key:de,path:q.path})}O(null)}catch(ve){z(ve instanceof Error?ve.message:"Save failed")}},St=({path:q})=>{if(!M)return null;const W=hi(q);return(M.mode==="rename"?hi(M.initialPath):null)!==W&&ge.has(W)?`A page with path "${q}" already exists.`:null},qe=async q=>{const{blockKey:W,data:de}=jy(q,o);try{await N.mutateAsync({blockKey:W,data:de}),ae.success(`Created section "${W}"`),G(!1),d({collection:"sections",key:W})}catch(ve){ae.error(ve instanceof Error?ve.message:"Could not create section")}},wt=async q=>{const W=o[q.key];if(!W){ae.error("Section not found.");return}const de=Mu(o,q.key),ve=vc(Le,q.name),Te={...W,name:ve};try{await N.mutateAsync({blockKey:de,data:Te}),ae.success(`Duplicated "${q.name}"`),d({collection:"sections",key:de})}catch(Qe){ae.error(Qe instanceof Error?Qe.message:"Duplicate failed")}},qt=async q=>{if(!X)return;const W=o[X];if(!W){ae.error("Section not found.");return}try{await N.mutateAsync({blockKey:X,data:{...W,name:q}}),ae.success("Section renamed"),ie(null)}catch(de){ae.error(de instanceof Error?de.message:"Rename failed")}},pt=async q=>{const W=xc(o,q),de=to(W,q,zy(q));try{await B.mutateAsync({blockKey:W,data:de}),ae.success(`Created ${ir[q]}`),d({collection:q,key:W})}catch(ve){ae.error(ve instanceof Error?ve.message:"Could not create")}},Ot=async q=>{const W=o[q.key];if(!W){ae.error("Record not found.");return}const de=xc(o,q.kind),ve=q.kind==="posts"?"title":"name",Te={...structuredClone(Lo(W,q.kind)),[ve]:`${q.label} (copy)`};try{await B.mutateAsync({blockKey:de,data:to(de,q.kind,Te)}),ae.success(`Duplicated "${q.label}"`),d({collection:q.kind,key:de})}catch(Qe){ae.error(Qe instanceof Error?Qe.message:"Duplicate failed")}},Ct=q=>{w(W=>{const de=new Set(W);return de.has(q)?de.delete(q):de.add(q),de})},xe=q=>{h("posts"),E("posts"),d(null),f(null),p(""),v(q),x(null),y("date-desc"),w(new Set)},he=async(q,W)=>{const de=[...S];let ve=0;for(const Te of de){const Qe=o[Te],si=Lo(Qe,"posts"),Tr=q==="add"?Oy(si,W):$y(si,W);Tr!==si&&(await B.mutateAsync({blockKey:Te,data:to(Te,"posts",Tr)}),ve+=1)}return ve},Pe=async(q,W)=>{const de=S.size;try{const ve=await he(q,W),Te=q==="add"?"Added to":"Moved",Qe=de-ve;ae.success(`${Te} ${ve} ${ve===1?"post":"posts"}`+(Qe>0?` (${Qe} already set)`:"")),w(new Set),K(null)}catch(ve){ae.error(ve instanceof Error?ve.message:"Bulk update failed")}},ze=async()=>{if(U)try{if(U.kind==="blog-bulk"){for(const ve of U.keys)await I.mutateAsync({blockKey:ve});ae.success(`Deleted ${U.count} ${U.count===1?"post":"posts"}`),c&&U.keys.includes(c.key)&&d(null),w(new Set),Y(null);return}const{kind:q,key:W,label:de}=U;q==="blog"?await I.mutateAsync({blockKey:W}):await L.mutateAsync({blockKey:W}),ae.success(`Deleted "${de}"`),c&&c.key===W&&d(null),Y(null)}catch(q){ae.error(q instanceof Error?q.message:"Delete failed")}},Re=L.isPending||I.isPending,Oe=U?.kind==="blog"?ir[U.blogKind]:U?.kind==="blog-bulk"?`${U.count} ${U.count===1?"post":"posts"}`:U?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(l0,{active:l,counts:pe,showBlog:_e,onSelect:q=>{h(q),d(null),f(null)}}),l!=="seo"&&l!=="site"&&l!=="calendar"&&n.jsx(c0,{activeCollection:l,pages:ee,sections:Q,appCatalog:C,appCatalogLoading:D,blogEntries:J,decofile:o,searchQuery:m,onSearchChange:p,postCategoryFilter:g,postAuthorFilter:b,postSort:_,onPostCategoryFilterChange:q=>{v(q),w(new Set)},onPostAuthorFilterChange:q=>{x(q),w(new Set)},onPostSortChange:y,selectedPostKeys:S,onTogglePostSelect:Ct,onSelectAllPosts:q=>w(new Set(q)),onClearPostSelection:()=>w(new Set),onBulkUpdateCategory:()=>K({count:S.size}),onBulkDeletePosts:()=>Y({kind:"blog-bulk",keys:[...S],count:S.size}),selection:c,onSelect:q=>{d(q),f(null)},previewUrl:i,onCreate:()=>{l==="pages"?Ze():rr(l)?pt(l):i?G(!0):ae.error("Start the preview dev server to add sections.")},onDuplicatePage:ct,onRenamePage:yt,onAddPageVariant:Ee,onDeletePage:q=>Y({kind:"page",key:q.key,label:q.name}),onEditPageSeo:q=>{d({collection:"pages",key:q.key,path:q.path}),f(q.key)},onViewPageJson:q=>$(q.key),onDuplicateSection:wt,onRenameSection:q=>ie(q.key),onDeleteSection:q=>Y({kind:"section",key:q.key,label:q.name}),onDuplicateBlog:Ot,onDeleteBlog:q=>Y({kind:"blog",blogKind:q.kind,key:q.key,label:q.label})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(P.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})}),children:l==="calendar"?n.jsx(i0,{decofile:o}):l==="site"?fe?n.jsx(yc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:fe.key,block:o[fe.key],decofile:o,meta:T,title:"Site",excludeFields:["seo"],schemaPending:k(fe.resolveType,["seo"]),previewBaseUrl:i},`site:${fe.key}`):n.jsx(Gi,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):l==="seo"?n.jsx(t0,{orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:T,target:{kind:"site"},previewBaseUrl:i}):c?c.collection==="apps"?n.jsx(yc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:T,previewBaseUrl:i,schemaPending:k(typeof o[c.key]?.__resolveType=="string"?String(o[c.key].__resolveType):void 0)},`app:${c.key}`):c.collection==="posts"?n.jsx(Jy,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:T,previewBaseUrl:i},`post:${c.key}`):c.collection==="categories"?n.jsx(Qy,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:T,onManagePosts:xe},`category:${c.key}`):c.collection==="authors"?n.jsx(Zy,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:c.key,block:o[c.key]},`authors:${c.key}`):n.jsx(e0,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:i??void 0,currentPath:c.collection==="pages"?c.path:"/",activePageBlockKey:c.collection==="pages"?c.key:null,activeGlobalBlockKey:c.collection==="sections"?c.key:null,initialEditSeo:c.collection==="pages"&&u===c.key,onExitSeo:()=>f(null)},c.collection==="pages"?`page:${c.key}`:`section:${c.key}`):n.jsx(Gi,{title:`Select ${rr(l)?`a ${ir[l]}`:l==="pages"?"a page":l==="apps"?"an app":"a section"} to edit`,description:l==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),M&&n.jsx(Py,{open:!!M,mode:M.mode,initialName:M.initialName,initialPath:M.initialPath,isPending:N.isPending,error:F,validate:St,onSubmit:mt,onOpenChange:q=>{q||(O(null),z(void 0))}}),X&&n.jsx(Ay,{open:!!X,blockKey:X,initialName:Q.find(q=>q.key===X)?.name??X,isPending:N.isPending,onSubmit:qt,onOpenChange:q=>{q||ie(null)}}),V&&i&&n.jsx(P.Suspense,{fallback:null,children:n.jsx(s0,{open:V,onOpenChange:G,meta:T,decofile:o,previewBaseUrl:i,onSelect:qe})}),ne&&n.jsx(Xy,{open:!!ne,onOpenChange:q=>{q||$(null)},pageKey:ne,decofile:o}),Z&&n.jsx(y0,{count:Z.count,categories:se,isPending:B.isPending,onApply:(q,W)=>{Pe(q,W)},onOpenChange:q=>{!q&&!B.isPending&&K(null)}}),n.jsx(Zr,{open:!!U,onOpenChange:q=>{!q&&!Re&&Y(null)},children:n.jsxs(Qr,{children:[n.jsxs(en,{children:[n.jsx(tn,{children:`Delete ${Oe}?`}),n.jsx(sn,{children:U?.kind==="section"?`"${U.label}" will be removed. Pages that still reference it will lose this section.`:U?.kind==="blog-bulk"?`${U.count} ${U.count===1?"post":"posts"} will be removed permanently. This can't be undone.`:U?`"${U.label}" will be removed permanently. This can't be undone.`:null})]}),n.jsxs(rn,{children:[n.jsx(nn,{disabled:Re,children:"Cancel"}),n.jsx(on,{onClick:q=>{q.preventDefault(),ze()},disabled:Re,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Re?n.jsxs(n.Fragment,{children:[n.jsx(Ne,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function l0(t){const e=H.c(37),{active:s,counts:i,showBlog:r,onSelect:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children:"Content"})}),e[0]=a):a=e[0];const l=s==="pages";let h;e[1]!==i.pages||e[2]!==o||e[3]!==l?(h=n.jsx(gs,{id:"pages",icon:Aa,label:"Pages",count:i.pages,active:l,onSelect:o}),e[1]=i.pages,e[2]=o,e[3]=l,e[4]=h):h=e[4];const c=s==="sections";let d;e[5]!==i.sections||e[6]!==o||e[7]!==c?(d=n.jsx(gs,{id:"sections",icon:mi,label:"Sections",count:i.sections,active:c,onSelect:o}),e[5]=i.sections,e[6]=o,e[7]=c,e[8]=d):d=e[8];const u=s==="apps";let f;e[9]!==i.apps||e[10]!==o||e[11]!==u?(f=n.jsx(gs,{id:"apps",icon:vd,label:"Apps",count:i.apps,active:u,onSelect:o}),e[9]=i.apps,e[10]=o,e[11]=u,e[12]=f):f=e[12];const m=s==="calendar";let p;e[13]!==o||e[14]!==m?(p=n.jsx(gs,{id:"calendar",icon:Fp,label:"Calendar",active:m,onSelect:o}),e[13]=o,e[14]=m,e[15]=p):p=e[15];let g;e[16]!==s||e[17]!==i.authors||e[18]!==i.categories||e[19]!==i.posts||e[20]!==o||e[21]!==r?(g=r&&n.jsxs(n.Fragment,{children:[n.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:[n.jsx(To,{size:13,className:"shrink-0"}),"Blog"]}),n.jsx(gs,{id:"posts",icon:Co,label:"Posts",count:i.posts,active:s==="posts",onSelect:o}),n.jsx(gs,{id:"authors",icon:Dn,label:"Authors",count:i.authors,active:s==="authors",onSelect:o}),n.jsx(gs,{id:"categories",icon:Pn,label:"Categories",count:i.categories,active:s==="categories",onSelect:o})]}),e[16]=s,e[17]=i.authors,e[18]=i.categories,e[19]=i.posts,e[20]=o,e[21]=r,e[22]=g):g=e[22];const v=s==="site";let b;e[23]!==o||e[24]!==v?(b=n.jsx(gs,{id:"site",icon:Hp,label:"Site",active:v,onSelect:o}),e[23]=o,e[24]=v,e[25]=b):b=e[25];const x=s==="seo";let _;e[26]!==o||e[27]!==x?(_=n.jsx(gs,{id:"seo",icon:Xr,label:"SEO",active:x,onSelect:o}),e[26]=o,e[27]=x,e[28]=_):_=e[28];let y;return e[29]!==g||e[30]!==b||e[31]!==_||e[32]!==h||e[33]!==d||e[34]!==f||e[35]!==p?(y=n.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[a,n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,d,f,p,g,b,_]})]}),e[29]=g,e[30]=b,e[31]=_,e[32]=h,e[33]=d,e[34]=f,e[35]=p,e[36]=y):y=e[36],y}function gs(t){const e=H.c(18),{id:s,icon:i,label:r,count:o,active:a,onSelect:l}=t;let h;e[0]!==s||e[1]!==l?(h=()=>l(s),e[0]=s,e[1]=l,e[2]=h):h=e[2];const c=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let d;e[3]!==c?(d=le("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==i?(u=n.jsx(i,{size:16,className:"shrink-0"}),e[5]=i,e[6]=u):u=e[6];let f;e[7]!==r?(f=n.jsx("span",{className:"flex-1 truncate",children:r}),e[7]=r,e[8]=f):f=e[8];let m;e[9]!==a||e[10]!==o?(m=o!==void 0&&n.jsx("span",{className:le("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=a,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==f||e[16]!==m?(p=n.jsxs("button",{type:"button",onClick:h,className:d,children:[u,f,m]}),e[12]=h,e[13]=d,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function c0(t){const e=H.c(77),{activeCollection:s,pages:i,sections:r,appCatalog:o,appCatalogLoading:a,blogEntries:l,decofile:h,previewUrl:c,searchQuery:d,onSearchChange:u,postCategoryFilter:f,postAuthorFilter:m,postSort:p,onPostCategoryFilterChange:g,onPostAuthorFilterChange:v,onPostSortChange:b,selectedPostKeys:x,onTogglePostSelect:_,onSelectAllPosts:y,onClearPostSelection:S,onBulkUpdateCategory:w,onBulkDeletePosts:j,selection:E,onSelect:T,onCreate:A,onDuplicatePage:R,onRenamePage:k,onAddPageVariant:C,onDeletePage:D,onEditPageSeo:N,onViewPageJson:L,onDuplicateSection:B,onRenameSection:I,onDeleteSection:M,onDuplicateBlog:O,onDeleteBlog:F}=t;let z,V,G,X,ie,U,Y;if(e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==l||e[4]!==h||e[5]!==C||e[6]!==j||e[7]!==w||e[8]!==S||e[9]!==A||e[10]!==F||e[11]!==D||e[12]!==M||e[13]!==O||e[14]!==R||e[15]!==B||e[16]!==N||e[17]!==v||e[18]!==g||e[19]!==b||e[20]!==k||e[21]!==I||e[22]!==u||e[23]!==T||e[24]!==y||e[25]!==_||e[26]!==L||e[27]!==i||e[28]!==m||e[29]!==f||e[30]!==p||e[31]!==c||e[32]!==d||e[33]!==r||e[34]!==x||e[35]!==E){const K=d.toLowerCase(),ee=i.filter(W=>!K||W.name.toLowerCase().includes(K)||W.path.toLowerCase().includes(K)),Q=r.filter(W=>!K||W.name.toLowerCase().includes(K)||W.key.toLowerCase().includes(K)||W.resolveType.toLowerCase().includes(K)),fe=o.filter(W=>!K||W.title.toLowerCase().includes(K)||W.app.toLowerCase().includes(K)||W.vendor.toLowerCase().includes(K)||W.category.toLowerCase().includes(K)),me=l.filter(W=>!K||W.label.toLowerCase().includes(K)||W.subtitle.toLowerCase().includes(K)),_e=s==="posts",J=f0,se=_e?My(h):[],pe=new Map,ge=new Map;for(const W of se){for(const de of W.categorySlugs)pe.set(de,(pe.get(de)??0)+1);for(const de of W.authorEmails)ge.set(de,(ge.get(de)??0)+1)}const Be=(_e?pn(h,"categories"):[]).map(W=>{const{key:de,payload:ve}=W,Te=J(ve.slug)||de;return{slug:Te,name:J(ve.name)||J(ve.slug)||de,count:pe.get(Te)??0}}).filter(u0),Le=(_e?pn(h,"authors"):[]).map(W=>{const{key:de,payload:ve}=W,Te=J(ve.email);return{email:Te,name:J(ve.name)||J(ve.email)||de,count:ge.get(Te)??0}}).filter(d0);let Ee;e[43]!==f?(Ee=W=>!f||W.categorySlugs.includes(f),e[43]=f,e[44]=Ee):Ee=e[44];let Ze;e[45]!==m?(Ze=W=>!m||W.authorEmails.includes(m),e[45]=m,e[46]=Ze):Ze=e[46];let ct;e[47]!==p?(ct=(W,de)=>{if(p==="az")return W.title.localeCompare(de.title);if(p==="za")return de.title.localeCompare(W.title);const ve=W.date.localeCompare(de.date);return p==="date-asc"?ve:-ve},e[47]=p,e[48]=ct):ct=e[48];const yt=se.filter(W=>!K||W.title.toLowerCase().includes(K)||W.slug.toLowerCase().includes(K)).filter(Ee).filter(Ze).sort(ct),mt=x.size,St=yt.map(h0),qe=St.length>0&&St.every(W=>x.has(W)),wt=mt>0,qt=()=>{qe?S():y(St)},pt=`Search ${s}…`,Ot=rr(s)?`Create new ${ir[s]}`:s==="pages"?"Create new page":"Create new section",Ct=s==="sections"&&!c,xe=s!=="apps",he=Ct,Pe=Ct?"Start the preview dev server to add sections":void 0;ie="w-[300px] shrink-0 border-r flex flex-col min-h-0";let ze;e[49]===Symbol.for("react.memo_cache_sentinel")?(ze=n.jsx(_d,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[49]=ze):ze=e[49];let Re;e[50]!==u?(Re=W=>u(W.target.value),e[50]=u,e[51]=Re):Re=e[51];let Oe;e[52]!==pt||e[53]!==d||e[54]!==Re?(Oe=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[ze,n.jsx("input",{type:"text",value:d,onChange:Re,placeholder:pt,"aria-label":pt,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[52]=pt,e[53]=d,e[54]=Re,e[55]=Oe):Oe=e[55];let q;e[56]!==he||e[57]!==Pe||e[58]!==Ot||e[59]!==A||e[60]!==xe?(q=xe&&n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:A,disabled:he,"aria-label":Ot,"aria-disabled":he,children:n.jsx(Bt,{size:14})})}),n.jsx(ke,{side:"bottom",children:Pe??Ot})]}),e[56]=he,e[57]=Pe,e[58]=Ot,e[59]=A,e[60]=xe,e[61]=q):q=e[61],e[62]!==Oe||e[63]!==q?(U=n.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Oe,q]}),e[62]=Oe,e[63]=q,e[64]=U):U=e[64],Y=_e&&(wt?n.jsx(b0,{count:mt,allSelected:qe,onToggleSelectAll:qt,onUpdateCategory:w,onDelete:j,onClear:S}):n.jsx(p0,{categories:Be,authors:Le,categoryFilter:f,authorFilter:m,sort:p,hasPosts:se.length>0,allSelected:qe,onToggleSelectAll:qt,onCategoryFilterChange:g,onAuthorFilterChange:v,onSortChange:b})),z=jn,X="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",V="flex flex-col gap-1 p-1.5",G=s==="pages"?ee.length===0?n.jsx(Bi,{hasItems:i.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):ee.map(W=>{const de=E?.collection==="pages"&&E.key===W.key,ve=ku(h,W.key);return n.jsx(Li,{icon:Aa,title:W.name,subtitle:W.path,active:de,variantCount:ve,onClick:()=>T({collection:"pages",key:W.key,path:W.path}),menu:n.jsx(Ir,{onDuplicate:()=>R(W),onRename:()=>k(W),onAddVariant:()=>C(W),onEditSeo:()=>N(W),onViewJson:()=>L(W),onDelete:()=>D(W)})},W.key)}):s==="sections"?Q.length===0?n.jsx(Bi,{hasItems:r.length>0,emptyLabel:"No saved sections yet.",emptyHint:'Click "+" to create one, or save a section from a page.'}):Q.map(W=>{const de=E?.collection==="sections"&&E.key===W.key,ve=W.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return n.jsx(Li,{icon:mi,title:W.name,subtitle:ve??W.resolveType,active:de,onClick:()=>T({collection:"sections",key:W.key}),menu:n.jsx(Ir,{onDuplicate:()=>B(W),onRename:()=>I(W),onDelete:()=>M(W)})},W.key)}):s==="apps"?a?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(Ne,{size:18,className:"animate-spin text-muted-foreground"})}):fe.length===0?n.jsx(Bi,{hasItems:o.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):fe.map(W=>{const de=E?.collection==="apps"&&W.blockKey!==null&&E.key===W.blockKey;return n.jsx(Li,{icon:vd,logoUrl:W.logo,title:W.title,subtitle:W.category,active:de,trailing:W.installed?n.jsx("span",{className:"shrink-0 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-700 dark:text-emerald-400",children:"Installed"}):void 0,onClick:()=>{if(!W.installed||!W.blockKey){ae.message(`${W.title} is not installed on this site.`);return}T({collection:"apps",key:W.blockKey})}},W.id)}):_e?yt.length===0?n.jsx(Bi,{hasItems:se.length>0,emptyLabel:"No posts yet.",emptyHint:'Click "+" to create your first post.'}):yt.map(W=>{const de={key:W.key,kind:"posts",label:W.title,subtitle:W.slug};return n.jsx(Li,{icon:Co,title:W.title,subtitle:W.slug,active:E?.collection==="posts"&&E.key===W.key,selectable:!0,selectionActive:wt,selected:x.has(W.key),onToggleSelect:()=>_(W.key),onClick:()=>T({collection:"posts",key:W.key}),menu:n.jsx(Ir,{onDuplicate:()=>O(de),onDelete:()=>F(de)})},W.key)}):me.length===0?n.jsx(Bi,{hasItems:l.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${rr(s)?ir[s]:"item"}.`}):me.map(W=>{const de=E?.collection===W.kind&&E.key===W.key;return n.jsx(Li,{icon:W.kind==="posts"?Co:W.kind==="authors"?Dn:Pn,title:W.label,subtitle:W.subtitle,active:de,onClick:()=>T({collection:W.kind,key:W.key}),menu:n.jsx(Ir,{onDuplicate:()=>O(W),onDelete:()=>F(W)})},W.key)}),e[0]=s,e[1]=o,e[2]=a,e[3]=l,e[4]=h,e[5]=C,e[6]=j,e[7]=w,e[8]=S,e[9]=A,e[10]=F,e[11]=D,e[12]=M,e[13]=O,e[14]=R,e[15]=B,e[16]=N,e[17]=v,e[18]=g,e[19]=b,e[20]=k,e[21]=I,e[22]=u,e[23]=T,e[24]=y,e[25]=_,e[26]=L,e[27]=i,e[28]=m,e[29]=f,e[30]=p,e[31]=c,e[32]=d,e[33]=r,e[34]=x,e[35]=E,e[36]=z,e[37]=V,e[38]=G,e[39]=X,e[40]=ie,e[41]=U,e[42]=Y}else z=e[36],V=e[37],G=e[38],X=e[39],ie=e[40],U=e[41],Y=e[42];let ne;e[65]!==V||e[66]!==G?(ne=n.jsx("div",{className:V,children:G}),e[65]=V,e[66]=G,e[67]=ne):ne=e[67];let $;e[68]!==z||e[69]!==X||e[70]!==ne?($=n.jsx(z,{className:X,children:ne}),e[68]=z,e[69]=X,e[70]=ne,e[71]=$):$=e[71];let Z;return e[72]!==ie||e[73]!==U||e[74]!==Y||e[75]!==$?(Z=n.jsxs("div",{className:ie,children:[U,Y,$]}),e[72]=ie,e[73]=U,e[74]=Y,e[75]=$,e[76]=Z):Z=e[76],Z}function h0(t){return t.key}function d0(t){return t.email}function u0(t){return t.slug}function f0(t){return typeof t=="string"?t:""}const ni="__all__",Wu={"date-desc":"Newest first","date-asc":"Oldest first",az:"Title A–Z",za:"Title Z–A"},m0={"date-desc":"Newest","date-asc":"Oldest",az:"A–Z",za:"Z–A"},so=P.forwardRef(function(e,s){const i=H.c(20);let r,o,a,l,h;i[0]!==e?({icon:r,active:o,value:h,className:a,...l}=e,i[0]=e,i[1]=r,i[2]=o,i[3]=a,i[4]=l,i[5]=h):(r=i[1],o=i[2],a=i[3],l=i[4],h=i[5]);const c=o?"text-foreground":"text-muted-foreground";let d;i[6]!==a||i[7]!==c?(d=le("h-7 gap-1 px-1.5 text-xs",c,a),i[6]=a,i[7]=c,i[8]=d):d=i[8];let u;i[9]!==r?(u=n.jsx(r,{size:14,className:"shrink-0"}),i[9]=r,i[10]=u):u=i[10];let f;i[11]!==h?(f=h&&n.jsx("span",{className:"min-w-0 flex-1 truncate",children:h}),i[11]=h,i[12]=f):f=i[12];let m;i[13]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Rs,{size:12,className:"shrink-0 opacity-60"}),i[13]=m):m=i[13];let p;return i[14]!==l||i[15]!==s||i[16]!==d||i[17]!==u||i[18]!==f?(p=n.jsxs(oe,{ref:s,type:"button",variant:"ghost",size:"sm",className:d,...l,children:[u,f,m]}),i[14]=l,i[15]=s,i[16]=d,i[17]=u,i[18]=f,i[19]=p):p=i[19],p});function Uu(t){const e=H.c(2),{count:s}=t;let i;return e[0]!==s?(i=n.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=i):i=e[1],i}function p0(t){const e=H.c(64),{categories:s,authors:i,categoryFilter:r,authorFilter:o,sort:a,hasPosts:l,allSelected:h,onToggleSelectAll:c,onCategoryFilterChange:d,onAuthorFilterChange:u,onSortChange:f}=t;let m;if(e[0]!==s||e[1]!==r){let K;e[3]!==r?(K=ee=>ee.slug===r,e[3]=r,e[4]=K):K=e[4],m=s.find(K),e[0]=s,e[1]=r,e[2]=m}else m=e[2];const p=m;let g;if(e[5]!==o||e[6]!==i){let K;e[8]!==o?(K=ee=>ee.email===o,e[8]=o,e[9]=K):K=e[9],g=i.find(K),e[5]=o,e[6]=i,e[7]=g}else g=e[7];const v=g,b=!l;let x;e[10]!==h||e[11]!==c||e[12]!==b?(x=n.jsx(Ku,{checked:h,disabled:b,onToggle:c}),e[10]=h,e[11]=c,e[12]=b,e[13]=x):x=e[13];const _=!!r,y=p?.name;let S;e[14]!==_||e[15]!==y?(S=n.jsx(as,{asChild:!0,children:n.jsx(so,{icon:Pn,active:_,value:y,className:"min-w-0 shrink"})}),e[14]=_,e[15]=y,e[16]=S):S=e[16];let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Wn,{children:"Filter by category"}),e[17]=w):w=e[17];const j=r??ni;let E;e[18]!==d?(E=K=>d(K===ni?null:K),e[18]=d,e[19]=E):E=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsx(cr,{value:ni,children:"All categories"}),e[20]=T):T=e[20];let A;e[21]!==s?(A=s.map(v0),e[21]=s,e[22]=A):A=e[22];let R;e[23]!==E||e[24]!==A||e[25]!==j?(R=n.jsxs(ls,{align:"start",className:"max-h-80 w-56 overflow-y-auto",children:[w,n.jsxs(Un,{value:j,onValueChange:E,children:[T,A]})]}),e[23]=E,e[24]=A,e[25]=j,e[26]=R):R=e[26];let k;e[27]!==R||e[28]!==S?(k=n.jsxs(os,{children:[S,R]}),e[27]=R,e[28]=S,e[29]=k):k=e[29];const C=!!o,D=v?.name;let N;e[30]!==C||e[31]!==D?(N=n.jsx(as,{asChild:!0,children:n.jsx(so,{icon:Dn,active:C,value:D,className:"min-w-0 shrink"})}),e[30]=C,e[31]=D,e[32]=N):N=e[32];let L;e[33]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(Wn,{children:"Filter by author"}),e[33]=L):L=e[33];const B=o??ni;let I;e[34]!==u?(I=K=>u(K===ni?null:K),e[34]=u,e[35]=I):I=e[35];let M;e[36]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx(cr,{value:ni,children:"All authors"}),e[36]=M):M=e[36];let O;e[37]!==i?(O=i.map(_0),e[37]=i,e[38]=O):O=e[38];let F;e[39]!==B||e[40]!==I||e[41]!==O?(F=n.jsxs(ls,{align:"start",className:"max-h-80 w-56 overflow-y-auto",children:[L,n.jsxs(Un,{value:B,onValueChange:I,children:[M,O]})]}),e[39]=B,e[40]=I,e[41]=O,e[42]=F):F=e[42];let z;e[43]!==N||e[44]!==F?(z=n.jsxs(os,{children:[N,F]}),e[43]=N,e[44]=F,e[45]=z):z=e[45];const V=m0[a];let G;e[46]!==V?(G=n.jsx(as,{asChild:!0,children:n.jsx(so,{icon:Wp,active:!0,value:V})}),e[46]=V,e[47]=G):G=e[47];let X;e[48]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(Wn,{children:"Sort by"}),e[48]=X):X=e[48];let ie;e[49]!==f?(ie=K=>f(K),e[49]=f,e[50]=ie):ie=e[50];let U;e[51]===Symbol.for("react.memo_cache_sentinel")?(U=Object.keys(Wu),e[51]=U):U=e[51];let Y;e[52]===Symbol.for("react.memo_cache_sentinel")?(Y=U.map(g0),e[52]=Y):Y=e[52];let ne;e[53]!==a||e[54]!==ie?(ne=n.jsxs(ls,{align:"end",className:"w-44",children:[X,n.jsx(Un,{value:a,onValueChange:ie,children:Y})]}),e[53]=a,e[54]=ie,e[55]=ne):ne=e[55];let $;e[56]!==G||e[57]!==ne?($=n.jsxs(os,{children:[G,ne]}),e[56]=G,e[57]=ne,e[58]=$):$=e[58];let Z;return e[59]!==k||e[60]!==z||e[61]!==$||e[62]!==x?(Z=n.jsxs("div",{className:"flex min-w-0 items-center gap-0.5 overflow-hidden border-b px-2 py-1.5",children:[x,k,z,$]}),e[59]=k,e[60]=z,e[61]=$,e[62]=x,e[63]=Z):Z=e[63],Z}function g0(t){return n.jsx(cr,{value:t,children:Wu[t]},t)}function _0(t){return n.jsxs(cr,{value:t.email,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx(Uu,{count:t.count})]},t.email)}function v0(t){return n.jsxs(cr,{value:t.slug,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx(Uu,{count:t.count})]},t.slug)}function Ku(t){const e=H.c(12),{checked:s,disabled:i,onToggle:r}=t;let o;e[0]!==r?(o=()=>r(),e[0]=r,e[1]=o):o=e[1];const a=s?"Deselect all posts":"Select all posts";let l;e[2]!==s||e[3]!==i||e[4]!==o||e[5]!==a?(l=n.jsx(Ce,{asChild:!0,children:n.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:x0,children:n.jsx(yi,{checked:s,disabled:i,onCheckedChange:o,"aria-label":a})})}),e[2]=s,e[3]=i,e[4]=o,e[5]=a,e[6]=l):l=e[6];const h=s?"Deselect all":"Select all";let c;e[7]!==h?(c=n.jsx(ke,{side:"bottom",children:h}),e[7]=h,e[8]=c):c=e[8];let d;return e[9]!==l||e[10]!==c?(d=n.jsxs(je,{children:[l,c]}),e[9]=l,e[10]=c,e[11]=d):d=e[11],d}function x0(t){return t.stopPropagation()}function b0(t){const e=H.c(31),{count:s,allSelected:i,onToggleSelectAll:r,onUpdateCategory:o,onDelete:a,onClear:l}=t;let h;e[0]!==i||e[1]!==r?(h=n.jsx(Ku,{checked:i,onToggle:r}),e[0]=i,e[1]=r,e[2]=h):h=e[2];let c;e[3]!==s?(c=n.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[s," selected"]}),e[3]=s,e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Pn,{size:14}),e[5]=d):d=e[5];let u;e[6]!==o?(u=n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:o,"aria-label":"Update category for selected posts",children:[d,"Category"]})}),e[6]=o,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ke,{side:"bottom",children:"Update category"}),e[8]=f):f=e[8];let m;e[9]!==u?(m=n.jsxs(je,{children:[u,f]}),e[9]=u,e[10]=m):m=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Us,{size:14}),e[11]=p):p=e[11];let g;e[12]!==a?(g=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:a,"aria-label":"Delete selected posts",children:p})}),e[12]=a,e[13]=g):g=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(ke,{side:"bottom",children:"Delete selected"}),e[14]=v):v=e[14];let b;e[15]!==g?(b=n.jsxs(je,{children:[g,v]}),e[15]=g,e[16]=b):b=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(xd,{size:14}),e[17]=x):x=e[17];let _;e[18]!==l?(_=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:l,"aria-label":"Clear selection",children:x})}),e[18]=l,e[19]=_):_=e[19];let y;e[20]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ke,{side:"bottom",children:"Clear selection"}),e[20]=y):y=e[20];let S;e[21]!==_?(S=n.jsxs(je,{children:[_,y]}),e[21]=_,e[22]=S):S=e[22];let w;e[23]!==b||e[24]!==S||e[25]!==m?(w=n.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[m,b,S]}),e[23]=b,e[24]=S,e[25]=m,e[26]=w):w=e[26];let j;return e[27]!==h||e[28]!==w||e[29]!==c?(j=n.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[h,c,w]}),e[27]=h,e[28]=w,e[29]=c,e[30]=j):j=e[30],j}function y0(t){const e=H.c(48),{count:s,categories:i,isPending:r,onApply:o,onOpenChange:a}=t,[l,h]=P.useState(i[0]?.slug??""),[c,d]=P.useState("add");let u;if(e[0]!==i||e[1]!==l){let I;e[3]!==l?(I=M=>M.slug===l,e[3]=l,e[4]=I):I=e[4],u=i.find(I),e[0]=i,e[1]=l,e[2]=u}else u=e[2];const f=u;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ms,{children:"Update category"}),e[5]=m):m=e[5];const p=s===1?"post":"posts";let g;e[6]!==s||e[7]!==p?(g=n.jsxs(fs,{children:[m,n.jsxs(Rn,{children:["Choose a category to apply to ",s," ",p,"."]})]}),e[6]=s,e[7]=p,e[8]=g):g=e[8];let v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(_t,{children:"Category"}),e[9]=v):v=e[9];let b;e[10]!==i||e[11]!==l?(b=n.jsxs("div",{className:"space-y-2",children:[v,i.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"No categories yet — create one in the Categories collection."}):n.jsxs(Et,{value:l,onValueChange:h,children:[n.jsx(jt,{className:"w-full",children:n.jsx(Lt,{placeholder:"Select a category"})}),n.jsx(Nt,{children:i.map(S0)})]})]}),e[10]=i,e[11]=l,e[12]=b):b=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=I=>d(I),e[13]=x):x=e[13];let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(_c,{value:"add",id:"cat-mode-add",className:"mt-0.5"}),e[14]=_):_=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsxs(_t,{htmlFor:"cat-mode-add",className:"flex cursor-pointer items-start gap-2.5 rounded-lg border p-3",children:[_,n.jsxs("span",{className:"space-y-0.5",children:[n.jsx("span",{className:"block text-sm font-medium",children:"Add category"}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:"Keep existing categories and add this one."})]})]}),e[15]=y):y=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(_c,{value:"replace",id:"cat-mode-replace",className:"mt-0.5"}),e[16]=S):S=e[16];let w;e[17]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsxs(_t,{htmlFor:"cat-mode-replace",className:"flex cursor-pointer items-start gap-2.5 rounded-lg border p-3",children:[S,n.jsxs("span",{className:"space-y-0.5",children:[n.jsx("span",{className:"block text-sm font-medium",children:"Replace category"}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:"Remove all current categories and set only this one."})]})]}),e[17]=w):w=e[17];let j;e[18]!==c?(j=n.jsxs(ly,{value:c,onValueChange:x,className:"gap-2",children:[y,w]}),e[18]=c,e[19]=j):j=e[19];let E;e[20]!==j||e[21]!==b?(E=n.jsxs("div",{className:"space-y-4 py-2",children:[b,j]}),e[20]=j,e[21]=b,e[22]=E):E=e[22];let T;e[23]!==a?(T=()=>a(!1),e[23]=a,e[24]=T):T=e[24];let A;e[25]!==r||e[26]!==T?(A=n.jsx(oe,{type:"button",variant:"outline",onClick:T,disabled:r,children:"Cancel"}),e[25]=r,e[26]=T,e[27]=A):A=e[27];const R=!f||r;let k;e[28]!==c||e[29]!==o||e[30]!==f?(k=()=>f&&o(c,{name:f.name,slug:f.slug}),e[28]=c,e[29]=o,e[30]=f,e[31]=k):k=e[31];let C;e[32]!==r?(C=r?n.jsxs(n.Fragment,{children:[n.jsx(Ne,{size:14,className:"animate-spin"}),"Updating…"]}):"Apply",e[32]=r,e[33]=C):C=e[33];let D;e[34]!==R||e[35]!==k||e[36]!==C?(D=n.jsx(oe,{type:"button",disabled:R,onClick:k,children:C}),e[34]=R,e[35]=k,e[36]=C,e[37]=D):D=e[37];let N;e[38]!==A||e[39]!==D?(N=n.jsxs(Zs,{children:[A,D]}),e[38]=A,e[39]=D,e[40]=N):N=e[40];let L;e[41]!==E||e[42]!==N||e[43]!==g?(L=n.jsxs(Vt,{className:"sm:max-w-md",children:[g,E,N]}),e[41]=E,e[42]=N,e[43]=g,e[44]=L):L=e[44];let B;return e[45]!==a||e[46]!==L?(B=n.jsx(Kt,{open:!0,onOpenChange:a,children:L}),e[45]=a,e[46]=L,e[47]=B):B=e[47],B}function S0(t){return n.jsx(Ye,{value:t.slug,children:n.jsx("span",{className:"truncate",children:t.name})},t.slug)}function Li(t){const e=H.c(36),{icon:s,logoUrl:i,title:r,subtitle:o,active:a,variantCount:l,trailing:h,selectable:c,selectionActive:d,selected:u,onToggleSelect:f,onClick:m,menu:p}=t;let g;e[0]!==s||e[1]!==a||e[2]!==i||e[3]!==l?(g=l&&l>1?n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center",children:n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(s,{size:16,className:"shrink-0",style:{color:Mo}})}),n.jsxs(ke,{side:"right",children:[l," variants"]})]})}):i?n.jsx("img",{src:i,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted",children:n.jsx(s,{size:16,className:le("shrink-0",a?"text-accent-foreground":"text-muted-foreground")})}),e[0]=s,e[1]=a,e[2]=i,e[3]=l,e[4]=g):g=e[4];const v=g,b=a?"bg-accent text-accent-foreground":"hover:bg-muted";let x;e[5]!==b?(x=le("group relative flex min-w-0 items-center rounded-md transition-colors",b),e[5]=b,e[6]=x):x=e[6];let _;e[7]!==f||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==r?(_=c&&n.jsx("span",{className:le("flex shrink-0 items-center pl-2.5 transition-opacity",u||d?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:w0,children:n.jsx(yi,{checked:u,onCheckedChange:()=>f?.(),"aria-label":`Select ${r}`})}),e[7]=f,e[8]=c,e[9]=u,e[10]=d,e[11]=r,e[12]=_):_=e[12];let y;e[13]!==r?(y=n.jsx("span",{className:"block truncate text-sm font-medium",children:r}),e[13]=r,e[14]=y):y=e[14];const S=a?"text-accent-foreground/70":"text-muted-foreground";let w;e[15]!==S?(w=le("block truncate text-xs",S),e[15]=S,e[16]=w):w=e[16];let j;e[17]!==o||e[18]!==w?(j=n.jsx("span",{className:w,children:o}),e[17]=o,e[18]=w,e[19]=j):j=e[19];let E;e[20]!==y||e[21]!==j?(E=n.jsxs("span",{className:"min-w-0 flex-1",children:[y,j]}),e[20]=y,e[21]=j,e[22]=E):E=e[22];let T;e[23]!==m||e[24]!==v||e[25]!==E||e[26]!==h?(T=n.jsxs("button",{type:"button",onClick:m,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[v,E,h]}),e[23]=m,e[24]=v,e[25]=E,e[26]=h,e[27]=T):T=e[27];let A;e[28]!==a||e[29]!==p?(A=p&&n.jsx("div",{className:le("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:p}),e[28]=a,e[29]=p,e[30]=A):A=e[30];let R;return e[31]!==T||e[32]!==A||e[33]!==x||e[34]!==_?(R=n.jsxs("div",{className:x,children:[_,T,A]}),e[31]=T,e[32]=A,e[33]=x,e[34]=_,e[35]=R):R=e[35],R}function w0(t){return t.stopPropagation()}function Ir(t){const e=H.c(21),{onDuplicate:s,onRename:i,onAddVariant:r,onEditSeo:o,onViewJson:a,onDelete:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(as,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"More actions",className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:C0,children:n.jsx(Tn,{size:14})})}),e[0]=h):h=e[0];let c;e[1]!==i?(c=i&&n.jsxs(We,{onClick:i,children:[n.jsx($a,{size:14}),"Rename"]}),e[1]=i,e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(bs,{size:14}),e[3]=d):d=e[3];let u;e[4]!==s?(u=n.jsxs(We,{onClick:s,children:[d,"Duplicate"]}),e[4]=s,e[5]=u):u=e[5];let f;e[6]!==r?(f=r&&n.jsxs(n.Fragment,{children:[n.jsx(er,{}),n.jsxs(We,{onClick:r,className:"cursor-pointer",style:{color:Mo},children:[n.jsx(Up,{size:14,style:{color:Mo}}),"Add variant"]})]}),e[6]=r,e[7]=f):f=e[7];let m;e[8]!==o||e[9]!==a?(m=(o||a)&&n.jsxs(n.Fragment,{children:[n.jsx(er,{}),o&&n.jsxs(We,{onClick:o,children:[n.jsx(Xr,{size:14}),"Edit SEO"]}),a&&n.jsxs(We,{onClick:a,children:[n.jsx(Ra,{size:14}),"View JSON"]})]}),e[8]=o,e[9]=a,e[10]=m):m=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(er,{}),e[11]=p):p=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Us,{size:14}),e[12]=g):g=e[12];let v;e[13]!==l?(v=n.jsxs(We,{onClick:l,className:"text-destructive focus:text-destructive",children:[g,"Delete"]}),e[13]=l,e[14]=v):v=e[14];let b;return e[15]!==c||e[16]!==u||e[17]!==f||e[18]!==m||e[19]!==v?(b=n.jsxs(os,{children:[h,n.jsxs(ls,{align:"end",className:"w-44",children:[c,u,f,m,p,v]})]}),e[15]=c,e[16]=u,e[17]=f,e[18]=m,e[19]=v,e[20]=b):b=e[20],b}function C0(t){return t.stopPropagation()}function Bi(t){const e=H.c(6),{hasItems:s,emptyLabel:i,emptyHint:r}=t;let o;e[0]!==r||e[1]!==i||e[2]!==s?(o=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:i}),n.jsx("div",{className:"mt-1 text-muted-foreground/80",children:r})]}),e[0]=r,e[1]=i,e[2]=s,e[3]=o):o=e[3];let a;return e[4]!==o?(a=n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=a):a=e[5],a}function k0(t){const e=H.c(8),{state:s,claimPhase:i,lifecycle:r,onStart:o}=t;switch(s.kind){case"starting":{let a;e[0]!==i||e[1]!==r?(a=Pu({claimPhase:i,lifecycle:r}),e[0]=i,e[1]=r,e[2]=a):a=e[2];let l;return e[3]!==i||e[4]!==a?(l=n.jsx(mn,{kind:"starting",progress:a,claimPhase:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5],l}case"suspended":{let a;return e[6]!==o?(a=n.jsx(mn,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}}}function Gi(t){const e=H.c(10),{icon:s,title:i,description:r}=t;let o;e[0]!==s?(o=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let a;e[2]!==i?(a=n.jsx("div",{children:i}),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r&&n.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:r}),e[4]=r,e[5]=l):l=e[5];let h;return e[6]!==o||e[7]!==a||e[8]!==l?(h=n.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,a,l]}),e[6]=o,e[7]=a,e[8]=l,e[9]=h):h=e[9],h}function j0(t){const e=H.c(2),{virtualMcpId:s}=t,i=ds(s);if(!Ws(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(_r,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No content to edit."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Settings tab to enable Content."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(r0,{}),e[1]=o):o=e[1],o}const io={fast:{label:"Fast",subtitle:"Quick responses for simple tasks",icon:Qh},smart:{label:"Smart",subtitle:"Balanced quality and speed",icon:$s},thinking:{label:"Thinking",subtitle:"Deeper reasoning for hard tasks",icon:Gp}},N0=["fast","smart","thinking"];function E0(t){const e=H.c(15),{tier:s,onSelect:i}=t,[r,o]=P.useState(!1),a=io[s].icon;let l;e[0]!==a?(l=n.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=l):l=e[1];const h=io[s];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Rs,{size:14,className:"text-muted-foreground"}),e[2]=c):c=e[2];let d;e[3]!==l||e[4]!==h.label?(d=n.jsx(Xs,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[l,h.label,c]})}),e[3]=l,e[4]=h.label,e[5]=d):d=e[5];let u;e[6]!==i||e[7]!==s?(u=N0.map(p=>{const g=io[p],v=g.icon;return n.jsxs("button",{type:"button",onClick:()=>{i(p),o(!1)},className:le("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[n.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm",children:g.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:g.subtitle})]}),p===s&&n.jsx(Si,{size:14,className:"text-foreground mt-0.5"})]},p)}),e[6]=i,e[7]=s,e[8]=u):u=e[8];let f;e[9]!==u?(f=n.jsx(Js,{align:"start",className:"p-1 w-64",children:n.jsx("div",{className:"flex flex-col",children:u})}),e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==d||e[13]!==f?(m=n.jsxs(Ys,{open:r,onOpenChange:o,children:[d,f]}),e[11]=r,e[12]=d,e[13]=f,e[14]=m):m=e[14],m}function T0(t){const e=H.c(15),{tier:s,onTierChange:i,override:r,onOverrideChange:o}=t,[a,l]=P.useState(r!==null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Model"}),e[0]=h):h=e[0];let c;e[1]!==o||e[2]!==i||e[3]!==r||e[4]!==s||e[5]!==a?(c=a?n.jsx(P.Suspense,{fallback:n.jsx(oe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:"Loading models…"}),children:n.jsx(P0,{override:r,onOverrideChange:o})}):n.jsx(E0,{tier:s,onSelect:i}),e[1]=o,e[2]=i,e[3]=r,e[4]=s,e[5]=a,e[6]=c):c=e[6];let d;e[7]!==o?(d=m=>{l(m),m||o(null)},e[7]=o,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==a?(u=n.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(ln,{checked:a,onCheckedChange:d,className:"cursor-pointer"}),"Specific model"]}),e[9]=d,e[10]=a,e[11]=u):u=e[11];let f;return e[12]!==c||e[13]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[c,u]})]}),e[12]=c,e[13]=u,e[14]=f):f=e[14],f}function P0(t){const e=H.c(10),{override:s,onOverrideChange:i}=t,r=Fh(),o=r[0]?.id??null,[a,l]=P.useState(s?.credentialId??o);let h;e[0]!==s?(h=s?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[0]=s,e[1]=h):h=e[1];const c=h;if(r.length===0){let f;return e[2]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Connect an AI provider in settings to pick a specific model."}),e[2]=f):f=e[2],f}let d;e[3]!==a||e[4]!==i?(d=f=>{const m=f.keyId??a??"";l(m),i({modelId:f.modelId,credentialId:m,title:f.title??f.modelId})},e[3]=a,e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==a||e[7]!==c||e[8]!==d?(u=n.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:n.jsx(Dg,{variant:"bordered",placeholder:"Pick a model",model:c,credentialId:a,onCredentialChange:l,onModelChange:d})}),e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9],u}const Vu=[{key:"capabilities",heading:"Built-in capabilities",icon:za,tools:[{name:"web_search",title:"Web search",description:"Look up current information on the web",icon:xr},{name:"generate_image",title:"Generate image",description:"Create images from a text prompt",icon:Cg},{name:"subtask",title:"Subtask",description:"Spawn a focused sub-agent to handle part of the work",icon:lr},{name:"user_ask",title:"Ask the user",description:"Pause to ask the user a clarifying question",icon:Kp}]},{key:"files",heading:"Files & code",icon:Eo,tools:[{name:"read",title:"Read File",description:"Read a file from the workspace",icon:ld},{name:"write",title:"Write File",description:"Create or overwrite a file",icon:$a},{name:"edit",title:"Edit File",description:"Make targeted edits to an existing file",icon:Vp},{name:"grep",title:"Search Content",description:"Search file contents by pattern",icon:hr},{name:"glob",title:"Find Files",description:"Find files by name pattern",icon:Eo},{name:"bash",title:"Run Command",description:"Run shell commands in the sandbox",icon:qp}]},{key:"context",heading:"Context",icon:Fl,tools:[{name:"read_resource",title:"Read Resource",description:"Read an MCP resource by URI",icon:Fl},{name:"read_prompt",title:"Read Prompt",description:"Read an MCP prompt definition",icon:To},{name:"skill",title:"Load Skill",description:"Load a skill's full instructions (SKILL.md) by id",icon:To}]},{key:"browser",heading:"Browser",icon:mi,tools:[{name:"take_screenshot",title:"Take Screenshot",description:"Capture a screenshot of a web page",icon:sd},{name:"scrape_url",title:"Scrape URL",description:"Fetch and extract content from a URL",icon:mi},{name:"inspect_page",title:"Inspect Page",description:"Inspect a web page's structure",icon:Ra}]}],A0=Vu.flatMap(t=>t.tools.map(e=>e.name));function R0(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function D0(t){const e=H.c(5),{agentId:s,value:i,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Tools"}),e[0]=o):o=e[0];let a;return e[1]!==s||e[2]!==r||e[3]!==i?(a=n.jsxs("div",{className:"flex flex-col gap-2",children:[o,s?n.jsx(P.Suspense,{fallback:n.jsxs(oe,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[n.jsx(za,{size:14}),"Loading tools…"]}),children:n.jsx(I0,{agentId:s,value:i,onChange:r})}):n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Pick an agent first"})]}),e[1]=s,e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function Cc(t){const e=H.c(17),{value:s,checked:i,onToggle:r,title:o,description:a,leading:l}=t;let h;e[0]!==i?(h=n.jsx(yi,{checked:i,className:"pointer-events-none mt-0.5"}),e[0]=i,e[1]=h):h=e[1];let c;e[2]!==l?(c=l&&n.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==o?(d=n.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=d):d=e[5];let u;e[6]!==a?(u=a&&n.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=n.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==h||e[13]!==c||e[14]!==f||e[15]!==s?(m=n.jsxs(Rg,{value:s,onSelect:r,className:"items-start gap-2.5 py-2",children:[h,c,f]}),e[11]=r,e[12]=h,e[13]=c,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function kc(t){const e=H.c(20),{conn:s,label:i,icon:r,on:o,total:a,onToggle:l}=t,h=o===a;let c;e[0]!==r||e[1]!==s?(c=s?n.jsx(us,{icon:s.icon,name:s.title,size:"2xs"}):r?n.jsx(r,{size:14,className:"text-muted-foreground"}):n.jsx(Yp,{size:14,className:"text-muted-foreground"}),e[0]=r,e[1]=s,e[2]=c):c=e[2];const d=s?.title??i??"Other tools";let u;e[3]!==d?(u=n.jsx("span",{className:"truncate",children:d}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==o||e[6]!==a?(f=n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",a]}),e[5]=o,e[6]=a,e[7]=f):f=e[7];let m;e[8]!==l?(m=x=>{x.stopPropagation(),l()},e[8]=l,e[9]=m):m=e[9];const p=h?"None":"All";let g;e[10]!==m||e[11]!==p?(g=n.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:p}),e[10]=m,e[11]=p,e[12]=g):g=e[12];let v;e[13]!==f||e[14]!==g?(v=n.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[f,g]}),e[13]=f,e[14]=g,e[15]=v):v=e[15];let b;return e[16]!==c||e[17]!==u||e[18]!==v?(b=n.jsxs("div",{className:"flex items-center gap-2",children:[c,u,v]}),e[16]=c,e[17]=u,e[18]=v,e[19]=b):b=e[19],b}function I0(t){const e=H.c(70),{agentId:s,value:i,onChange:r}=t,{org:o}=Ae(),[a,l]=P.useState(!1);let h;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(h={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=h):h=e[3];const c=vt(h);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u,isLoading:f}=rd(d),m=br();let p,g,v,b,x,_,y,S,w,j,E,T,A;if(e[6]!==m||e[7]!==u?.tools||e[8]!==f||e[9]!==r||e[10]!==a||e[11]!==i){const N=new Map(m.map($0)),L=new Map;for(const J of u?.tools??[]){const se=Mm(J._meta)??"__other__",pe=Om(J.name,se==="__other__"?void 0:se),ge=J.title,Be=ge&&ge!==J.name?ge:R0(pe);L.has(se)||L.set(se,{clientId:se,conn:N.get(se),tools:[]}),L.get(se).tools.push({name:J.name,display:Be,description:J.description})}const B=[...L.values()].sort(O0),I=(u?.tools??[]).map(M0),M=[...A0,...I],O=i===null?new Set(M):new Set(i),F=M.every(J=>O.has(J)),z=J=>r(M.every(se=>J.has(se))?null:[...J]),V=J=>{const se=new Set(O);se.has(J)?se.delete(J):se.add(J),z(se)},G=(J,se)=>{const pe=new Set(O);for(const ge of J)se?pe.add(ge):pe.delete(ge);z(pe)};b=Ys,A=a,x=l;let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(za,{size:14,className:"text-muted-foreground"}),e[25]=X):X=e[25];const ie=F?"All tools":"Tools",U=!F&&n.jsxs(Ng,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[O.size,"/",M.length]});let Y;e[26]===Symbol.for("react.memo_cache_sentinel")?(Y=n.jsx(Rs,{size:14,className:"text-muted-foreground"}),e[26]=Y):Y=e[26],e[27]!==ie||e[28]!==U?(_=n.jsx(Xs,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[X,ie,U,Y]})}),e[27]=ie,e[28]=U,e[29]=_):_=e[29],v=Js,E="p-0 w-80",T="start",g=Tg,e[30]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Pg,{placeholder:"Search tools..."}),e[30]=w):w=e[30];const ne=F?`All ${M.length} tools enabled`:`${O.size} of ${M.length} enabled`;let $;e[31]!==ne?($=n.jsx("span",{className:"text-xs text-muted-foreground",children:ne}),e[31]=ne,e[32]=$):$=e[32];let Z;e[33]!==r?(Z=()=>r(null),e[33]=r,e[34]=Z):Z=e[34];let K;e[35]!==F||e[36]!==Z?(K=n.jsx("button",{type:"button",onClick:Z,disabled:F,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Select all"}),e[35]=F,e[36]=Z,e[37]=K):K=e[37];let ee;e[38]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[38]=ee):ee=e[38];let Q;e[39]!==r?(Q=()=>r([]),e[39]=r,e[40]=Q):Q=e[40];const fe=O.size===0;let me;e[41]!==Q||e[42]!==fe?(me=n.jsx("button",{type:"button",onClick:Q,disabled:fe,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Clear"}),e[41]=Q,e[42]=fe,e[43]=me):me=e[43];let _e;e[44]!==K||e[45]!==me?(_e=n.jsxs("div",{className:"flex items-center gap-2",children:[K,ee,me]}),e[44]=K,e[45]=me,e[46]=_e):_e=e[46],e[47]!==$||e[48]!==_e?(j=n.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[$,_e]}),e[47]=$,e[48]=_e,e[49]=j):j=e[49],p=Ag,y="max-h-80",S=f?n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading tools…"}):n.jsxs(n.Fragment,{children:[n.jsx(Eg,{children:"No tools found"}),Vu.map(J=>{const se=J.tools.map(B0),pe=se.filter(ge=>O.has(ge)).length;return n.jsx(Wl,{heading:n.jsx(kc,{label:J.heading,icon:J.icon,on:pe,total:se.length,onToggle:()=>G(se,pe!==se.length)}),children:J.tools.map(ge=>n.jsx(Cc,{value:`${ge.title} ${ge.name}`,checked:O.has(ge.name),onToggle:()=>V(ge.name),title:ge.title,description:ge.description,leading:n.jsx(ge.icon,{size:16,className:"text-muted-foreground"})},ge.name))},J.key)}),B.map(J=>{const se=J.tools.map(L0),pe=se.filter(ge=>O.has(ge)).length;return n.jsx(Wl,{heading:n.jsx(kc,{conn:J.conn,on:pe,total:se.length,onToggle:()=>G(se,pe!==se.length)}),children:J.tools.map(ge=>n.jsx(Cc,{value:`${ge.display} ${ge.name} ${J.conn?.title??""}`,checked:O.has(ge.name),onToggle:()=>V(ge.name),title:ge.display,description:ge.description},ge.name))},J.clientId)})]}),e[6]=m,e[7]=u?.tools,e[8]=f,e[9]=r,e[10]=a,e[11]=i,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=x,e[17]=_,e[18]=y,e[19]=S,e[20]=w,e[21]=j,e[22]=E,e[23]=T,e[24]=A}else p=e[12],g=e[13],v=e[14],b=e[15],x=e[16],_=e[17],y=e[18],S=e[19],w=e[20],j=e[21],E=e[22],T=e[23],A=e[24];let R;e[50]!==p||e[51]!==y||e[52]!==S?(R=n.jsx(p,{className:y,children:S}),e[50]=p,e[51]=y,e[52]=S,e[53]=R):R=e[53];let k;e[54]!==g||e[55]!==R||e[56]!==w||e[57]!==j?(k=n.jsxs(g,{children:[w,j,R]}),e[54]=g,e[55]=R,e[56]=w,e[57]=j,e[58]=k):k=e[58];let C;e[59]!==v||e[60]!==k||e[61]!==E||e[62]!==T?(C=n.jsx(v,{className:E,align:T,children:k}),e[59]=v,e[60]=k,e[61]=E,e[62]=T,e[63]=C):C=e[63];let D;return e[64]!==b||e[65]!==x||e[66]!==_||e[67]!==C||e[68]!==A?(D=n.jsxs(b,{open:A,onOpenChange:x,children:[_,C]}),e[64]=b,e[65]=x,e[66]=_,e[67]=C,e[68]=A,e[69]=D):D=e[69],D}function L0(t){return t.name}function B0(t){return t.name}function M0(t){return t.name}function O0(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function $0(t){return[t.id,t]}function nr(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function z0(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 i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return`Every ${i[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const l=(o[2]??"0").padStart(2,"0"),h=(o[1]??"0").padStart(2,"0");return`Every day at ${l}:${h} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",c=(a[2]??"0").padStart(2,"0"),d=(a[1]??"0").padStart(2,"0");return`Every ${h} at ${c}:${d} UTC`}return t}function F0(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 H0(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 i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return{count:parseInt(i[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const o=parseInt(r[1]);return o%7===0?{count:o/7,unit:"weeks"}:{count:o,unit:"days"}}return null}function W0(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const U0=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function K0({automationId:t,open:e,onOpenChange:s,onCustomSelect:i,onEventSelect:r,onWebhookCreated:o}){const{triggerAdd:a}=yr(),[l,h]=P.useState(!1),c=e??l,d=m=>{s?s(m):h(m)},u=async m=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),ae.success("Starter added"),d(!1)}catch(p){const g=p instanceof Error?p.message:"Failed to add starter";ae.error(g)}},f=async()=>{try{const m=await a.mutateAsync({automation_id:t,type:"webhook"});d(!1),m.webhook?o?.(m.webhook):ae.success("Webhook starter added")}catch(m){const p=m instanceof Error?m.message:"Failed to add webhook starter";ae.error(p)}};return n.jsxs(os,{open:c,onOpenChange:d,children:[n.jsx(as,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",children:[n.jsx(Bt,{size:14}),"Add Starter"]})}),n.jsxs(ls,{align:"end",className:"w-[200px]",children:[n.jsxs(ko,{children:[n.jsxs(jo,{className:"gap-2.5",children:[n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}),"Every..."]}),n.jsx(No,{className:"w-[160px]",children:U0.map(m=>n.jsxs(We,{className:"gap-2.5",onSelect:()=>u(m.cron),disabled:a.isPending,children:[n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}),"Every ",m.label]},m.cron))})]}),n.jsxs(We,{className:"gap-2.5",onSelect:()=>{d(!1),i?.()},children:[n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}),"Custom (cron)"]}),n.jsxs(We,{className:"gap-2.5",onSelect:()=>{d(!1),r?.()},children:[n.jsx(dr,{size:14,className:"text-muted-foreground shrink-0"}),"Event"]}),n.jsxs(We,{className:"gap-2.5",onSelect:()=>{f()},disabled:a.isPending,children:[n.jsx(xr,{size:14,className:"text-muted-foreground shrink-0"}),"Webhook"]})]})]})}function qu(t){const e=H.c(31),{open:s,onOpenChange:i,url:r,token:o,title:a,description:l}=t,h=a===void 0?"Webhook ready":a,c=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,[d,u]=P.useState(null),[f,m]=P.useState("curl"),[p,g]=P.useState("header"),v=P.useId();let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=async(N,L)=>{try{await navigator.clipboard.writeText(N),u(L),ae.success("Copied"),setTimeout(()=>u(null),1500)}catch{ae.error("Failed to copy")}},e[0]=b):b=e[0];const x=b;let _;e[1]!==p||e[2]!==o||e[3]!==r?(_=r&&o&&p==="url"?`${r.replace(/\/$/,"")}/${o}`:r??"",e[1]=p,e[2]=o,e[3]=r,e[4]=_):_=e[4];const y=_,S=r&&o?p==="header"?`curl -X POST "${y}" \\
|
|
467
467
|
-H "Authorization: Bearer ${o}" \\
|
|
468
468
|
-H "Content-Type: application/json" \\
|
|
469
469
|
-d '{"hello":"world"}'`:`curl -X POST "${y}" \\
|
|
@@ -482,7 +482,7 @@ ${Z}`:Z;c.setValue("metadata.instructions",K,{shouldDirty:!0})},X=new Set(d.map(
|
|
|
482
482
|
},
|
|
483
483
|
body: JSON.stringify({ hello: "world" }),
|
|
484
484
|
});`:"",j=f==="curl"?S:w;let E;e[5]!==h?(E=n.jsx(ms,{children:h}),e[5]=h,e[6]=E):E=e[6];let T;e[7]!==c?(T=n.jsx(Rn,{children:c}),e[7]=c,e[8]=T):T=e[8];let A;e[9]!==E||e[10]!==T?(A=n.jsxs(fs,{children:[E,T]}),e[9]=E,e[10]=T,e[11]=A):A=e[11];let R;e[12]!==p||e[13]!==d||e[14]!==y||e[15]!==f||e[16]!==j||e[17]!==o||e[18]!==v||e[19]!==r?(R=r&&o?n.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"URL"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:y}),n.jsxs(oe,{size:"sm",variant:"outline",onClick:()=>x(y,"url"),children:[n.jsx(bs,{size:13}),d==="url"?"Copied":"Copy"]})]})]}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Token (shown once)"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:o}),n.jsxs(oe,{size:"sm",variant:"outline",onClick:()=>x(o,"token"),children:[n.jsx(bs,{size:13}),d==="token"?"Copied":"Copy"]})]})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Snippet"}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Ba,{value:f,onValueChange:N=>m(N),children:n.jsxs(La,{className:"h-8 p-[2px]",children:[n.jsx(Os,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),n.jsx(Os,{value:"fetch",className:"h-7 px-2.5 text-xs",children:"fetch"})]})}),n.jsxs("label",{htmlFor:v,className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(yi,{id:v,checked:p==="url",onCheckedChange:N=>g(N?"url":"header")}),"Token in URL"]})]}),n.jsxs(oe,{size:"sm",variant:"outline",onClick:()=>x(j,"example"),children:[n.jsx(bs,{size:13}),d==="example"?"Copied":"Copy"]})]}),n.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:n.jsx(Og,{code:j,language:f==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[12]=p,e[13]=d,e[14]=y,e[15]=f,e[16]=j,e[17]=o,e[18]=v,e[19]=r,e[20]=R):R=e[20];let k;e[21]!==i?(k=n.jsx(Zs,{children:n.jsx(oe,{onClick:()=>i(!1),children:"Done"})}),e[21]=i,e[22]=k):k=e[22];let C;e[23]!==A||e[24]!==R||e[25]!==k?(C=n.jsxs(Vt,{className:"max-w-lg",children:[A,R,k]}),e[23]=A,e[24]=R,e[25]=k,e[26]=C):C=e[26];let D;return e[27]!==i||e[28]!==s||e[29]!==C?(D=n.jsx(Kt,{open:s,onOpenChange:i,children:C}),e[27]=i,e[28]=s,e[29]=C,e[30]=D):D=e[30],D}function V0(t){const e=H.c(83),{trigger:s,automationId:i,connectionName:r}=t,{triggerAdd:o,triggerRemove:a,triggerRotateToken:l}=yr(),[h,c]=P.useState(!1),[d,u]=P.useState(!1),[f,m]=P.useState(null);let p;e[0]!==s.cron_expression?(p=s.cron_expression?H0(s.cron_expression):null,e[0]=s.cron_expression,e[1]=p):p=e[1];const g=p,[v,b]=P.useState(g?.count??1),[x,_]=P.useState(!1),[y,S]=P.useState(s.cron_expression??""),w=a.isPending||o.isPending||l.isPending,j=s.type==="cron",E=s.type==="webhook";let T;e[2]!==i||e[3]!==a||e[4]!==s.id?(T=async()=>{try{await a.mutateAsync({trigger_id:s.id,automation_id:i}),ae.success("Starter removed")}catch{ae.error("Failed to remove starter")}c(!1)},e[2]=i,e[3]=a,e[4]=s.id,e[5]=T):T=e[5];const A=T;let R;e[6]!==o||e[7]!==i||e[8]!==y||e[9]!==a||e[10]!==s.cron_expression||e[11]!==s.id?(R=async()=>{const se=y.trim();if(!se||!nr(se)||se===s.cron_expression){_(!1),S(s.cron_expression??"");return}try{await o.mutateAsync({automation_id:i,type:"cron",cron_expression:se}),await a.mutateAsync({trigger_id:s.id,automation_id:i}),_(!1)}catch{ae.error("Failed to update starter"),S(s.cron_expression??""),_(!1)}},e[6]=o,e[7]=i,e[8]=y,e[9]=a,e[10]=s.cron_expression,e[11]=s.id,e[12]=R):R=e[12];const k=R;let C;e[13]!==i||e[14]!==l||e[15]!==s.id?(C=async()=>{u(!1);try{const se=await l.mutateAsync({trigger_id:s.id,automation_id:i});m({url:se.url,token:se.token})}catch(se){const pe=se,ge=pe instanceof Error?pe.message:"Failed to rotate token";ae.error(ge)}},e[13]=i,e[14]=l,e[15]=s.id,e[16]=C):C=e[16];const D=C;let N;e[17]!==o||e[18]!==i||e[19]!==g||e[20]!==a||e[21]!==s.cron_expression||e[22]!==s.id?(N=async se=>{if(!g)return;const pe=g.unit==="minutes"?5:1,ge=Math.max(pe,se);ge!==se&&b(ge);const Be=F0(ge,g.unit);if(Be!==s.cron_expression)try{await o.mutateAsync({automation_id:i,type:"cron",cron_expression:Be}),await a.mutateAsync({trigger_id:s.id,automation_id:i})}catch{ae.error("Failed to update starter"),b(g.count)}},e[17]=o,e[18]=i,e[19]=g,e[20]=a,e[21]=s.cron_expression,e[22]=s.id,e[23]=N):N=e[23];const L=N;let B;e[24]!==j||e[25]!==E?(B=j?n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}):E?n.jsx(xr,{size:14,className:"text-muted-foreground shrink-0"}):n.jsx(dr,{size:14,className:"text-muted-foreground shrink-0"}),e[24]=j,e[25]=E,e[26]=B):B=e[26];let I;e[27]!==r||e[28]!==v||e[29]!==y||e[30]!==L||e[31]!==k||e[32]!==g||e[33]!==j||e[34]!==x||e[35]!==w||e[36]!==E||e[37]!==s.cron_expression||e[38]!==s.event_type||e[39]!==s.params?(I=g&&j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-sm text-muted-foreground",children:"Every"}),n.jsx("input",{type:"number",min:g.unit==="minutes"?5:1,value:v,onChange:se=>b(parseInt(se.target.value)||1),onBlur:()=>L(v),onKeyDown:se=>{se.key==="Enter"&&se.target.blur(),se.key==="Escape"&&b(g.count)},disabled:w,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),n.jsx("span",{className:"text-sm",children:W0(g.unit,v)})]}):j&&x?n.jsxs(n.Fragment,{children:[n.jsx("input",{type:"text",value:y,onChange:se=>S(se.target.value),onBlur:k,onKeyDown:se=>{se.key==="Enter"&&se.target.blur(),se.key==="Escape"&&(_(!1),S(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),y&&!nr(y)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"})]}):n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[n.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:j?z0(s.cron_expression??""):E?"Webhook · POST to fire":`${s.event_type}${r?` · ${r}`:""}`}),!j&&!E&&s.params&&Object.keys(s.params).length>0&&n.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(q0).join(", ")})]}),e[27]=r,e[28]=v,e[29]=y,e[30]=L,e[31]=k,e[32]=g,e[33]=j,e[34]=x,e[35]=w,e[36]=E,e[37]=s.cron_expression,e[38]=s.event_type,e[39]=s.params,e[40]=I):I=e[40];let M;e[41]!==w?(M=w&&n.jsx(Ne,{size:13,className:"animate-spin text-muted-foreground"}),e[41]=w,e[42]=M):M=e[42];let O;e[43]!==g||e[44]!==j||e[45]!==x||e[46]!==s.cron_expression?(O=j&&!g&&!x&&n.jsx(oe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{S(s.cron_expression??""),_(!0)},children:n.jsx($a,{size:13,className:"text-muted-foreground"})}),e[43]=g,e[44]=j,e[45]=x,e[46]=s.cron_expression,e[47]=O):O=e[47];let F;e[48]!==E?(F=E&&n.jsx(oe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:"Rotate token",onClick:()=>u(!0),children:n.jsx(ar,{size:13,className:"text-muted-foreground"})}),e[48]=E,e[49]=F):F=e[49];let z;e[50]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx(oe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:n.jsx(Ps,{size:13,className:"text-muted-foreground"})}),e[50]=z):z=e[50];let V;e[51]!==F||e[52]!==M||e[53]!==O?(V=n.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[M,O,F,z]}),e[51]=F,e[52]=M,e[53]=O,e[54]=V):V=e[54];let G;e[55]!==V||e[56]!==B||e[57]!==I?(G=n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[B,I,V]}),e[55]=V,e[56]=B,e[57]=I,e[58]=G):G=e[58];let X;e[59]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsxs(en,{children:[n.jsx(tn,{children:"Remove Starter"}),n.jsx(sn,{children:"Are you sure you want to remove this starter?"})]}),e[59]=X):X=e[59];let ie;e[60]===Symbol.for("react.memo_cache_sentinel")?(ie=n.jsx(nn,{children:"Cancel"}),e[60]=ie):ie=e[60];let U;e[61]!==A?(U=n.jsxs(Qr,{children:[X,n.jsxs(rn,{children:[ie,n.jsx(on,{onClick:A,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),e[61]=A,e[62]=U):U=e[62];let Y;e[63]!==h||e[64]!==U?(Y=n.jsx(Zr,{open:h,onOpenChange:c,children:U}),e[63]=h,e[64]=U,e[65]=Y):Y=e[65];let ne;e[66]===Symbol.for("react.memo_cache_sentinel")?(ne=n.jsxs(en,{children:[n.jsx(tn,{children:"Rotate webhook token"}),n.jsx(sn,{children:"A new token will be generated and the current token will stop working. Any senders using the old token must be updated."})]}),e[66]=ne):ne=e[66];let $;e[67]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(nn,{children:"Cancel"}),e[67]=$):$=e[67];let Z;e[68]!==D?(Z=n.jsxs(Qr,{children:[ne,n.jsxs(rn,{children:[$,n.jsx(on,{onClick:D,children:"Rotate"})]})]}),e[68]=D,e[69]=Z):Z=e[69];let K;e[70]!==d||e[71]!==Z?(K=n.jsx(Zr,{open:d,onOpenChange:u,children:Z}),e[70]=d,e[71]=Z,e[72]=K):K=e[72];const ee=f!==null;let Q;e[73]===Symbol.for("react.memo_cache_sentinel")?(Q=se=>{se||m(null)},e[73]=Q):Q=e[73];const fe=f?.url??null,me=f?.token??null;let _e;e[74]!==ee||e[75]!==fe||e[76]!==me?(_e=n.jsx(qu,{open:ee,onOpenChange:Q,url:fe,token:me,title:"New webhook token",description:"The previous token has been revoked. Copy the new token now — it will not be shown again."}),e[74]=ee,e[75]=fe,e[76]=me,e[77]=_e):_e=e[77];let J;return e[78]!==G||e[79]!==Y||e[80]!==K||e[81]!==_e?(J=n.jsxs(n.Fragment,{children:[G,Y,K,_e]}),e[78]=G,e[79]=Y,e[80]=K,e[81]=_e,e[82]=J):J=e[82],J}function q0(t){const[e,s]=t;return`${e}: ${s}`}const G0=30;function Y0(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},i=new Set(s.fields);for(const r of e.fields)i.add(r);return{...s,fields:i,saveCount:s.saveCount+1}}case"reset":return null}}function X0(t){const e=H.c(55),{automationId:s,onDone:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const o=br(r),[a,l]=P.useState(),[h,c]=P.useState();let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d={},e[1]=d):d=e[1];const[u,f]=P.useState(d),{triggerAdd:m}=yr(),{data:p,isLoading:g}=Ig(a);let v,b,x,_,y,S;if(e[2]!==m||e[3]!==s||e[4]!==a||e[5]!==h||e[6]!==g||e[7]!==i||e[8]!==u||e[9]!==o||e[10]!==p){const E=p?.find(I=>I.type===h);let T;e[17]!==m||e[18]!==s||e[19]!==a||e[20]!==h||e[21]!==i||e[22]!==u?(T=async()=>{if(!(!a||!h))try{await m.mutateAsync({automation_id:s,type:"event",event_type:h,connection_id:a,params:u}),Ie("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:a,event_type:h}),ae.success("Event trigger added"),i()}catch{ae.error("Failed to add event trigger")}},e[17]=m,e[18]=s,e[19]=a,e[20]=h,e[21]=i,e[22]=u,e[23]=T):T=e[23],v=T,b="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let A,R;e[24]===Symbol.for("react.memo_cache_sentinel")?(R=n.jsx(dr,{size:14,className:"text-muted-foreground shrink-0"}),A=n.jsx("span",{className:"text-sm font-medium",children:"Event trigger"}),e[24]=A,e[25]=R):(A=e[24],R=e[25]);let k;e[26]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(Ps,{size:13}),e[26]=k):k=e[26],e[27]!==i?(x=n.jsxs("div",{className:"flex items-center gap-2",children:[R,A,n.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:i,children:k})]}),e[27]=i,e[28]=x):x=e[28];const C=a??"";let D;e[29]===Symbol.for("react.memo_cache_sentinel")?(D=I=>{l(I),c(void 0),f({})},e[29]=D):D=e[29];let N;e[30]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(jt,{className:"w-full",children:n.jsx(Lt,{placeholder:"Select connection..."})}),e[30]=N):N=e[30];let L;e[31]!==o?(L=o.length===0?n.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"No connections with trigger support"}):o.map(Q0),e[31]=o,e[32]=L):L=e[32];let B;e[33]!==L?(B=n.jsx(Nt,{children:L}),e[33]=L,e[34]=B):B=e[34],e[35]!==C||e[36]!==B?(_=n.jsxs(Et,{value:C,onValueChange:D,children:[N,B]}),e[35]=C,e[36]=B,e[37]=_):_=e[37],e[38]!==a||e[39]!==h||e[40]!==g||e[41]!==p?(y=a&&n.jsxs(Et,{value:h??"",onValueChange:I=>{c(I),f({})},children:[n.jsx(jt,{className:"w-full",children:g?n.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[n.jsx(Ne,{size:13,className:"animate-spin"}),"Loading events..."]}):n.jsx(Lt,{placeholder:"Select event type...",children:h??"Select event type..."})}),n.jsx(Nt,{children:p?.map(Z0)})]}),e[38]=a,e[39]=h,e[40]=g,e[41]=p,e[42]=y):y=e[42],S=E?.paramsSchema&&Object.keys(E.paramsSchema).length>0&&n.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(E.paramsSchema).map(I=>{const[M,O]=I;return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("label",{className:"text-xs text-muted-foreground",children:[M,O.description&&n.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",O.description]})]}),O.enum?n.jsxs(Et,{value:u[M]??"",onValueChange:F=>f(z=>({...z,[M]:F})),children:[n.jsx(jt,{className:"w-full",children:n.jsx(Lt,{placeholder:`Select ${M}...`})}),n.jsx(Nt,{children:O.enum.map(J0)})]}):n.jsx("input",{type:"text",value:u[M]??"",onChange:F=>f(z=>({...z,[M]:F.target.value})),placeholder:O.description??M,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},M)})}),e[2]=m,e[3]=s,e[4]=a,e[5]=h,e[6]=g,e[7]=i,e[8]=u,e[9]=o,e[10]=p,e[11]=v,e[12]=b,e[13]=x,e[14]=_,e[15]=y,e[16]=S}else v=e[11],b=e[12],x=e[13],_=e[14],y=e[15],S=e[16];let w;e[43]!==m||e[44]!==a||e[45]!==h||e[46]!==v?(w=a&&h&&n.jsx(oe,{size:"sm",onClick:v,disabled:m.isPending,children:m.isPending?n.jsx(Ne,{size:13,className:"animate-spin"}):"Add trigger"}),e[43]=m,e[44]=a,e[45]=h,e[46]=v,e[47]=w):w=e[47];let j;return e[48]!==b||e[49]!==x||e[50]!==_||e[51]!==y||e[52]!==S||e[53]!==w?(j=n.jsxs("div",{className:b,children:[x,_,y,S,w]}),e[48]=b,e[49]=x,e[50]=_,e[51]=y,e[52]=S,e[53]=w,e[54]=j):j=e[54],j}function J0(t){return n.jsx(Ye,{value:t,children:t},t)}function Z0(t){return n.jsx(Ye,{value:t.type,children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:t.type}),n.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function Q0(t){return n.jsx(Ye,{value:t.id,children:t.title},t.id)}function eS({automationId:t,automation:e,onBack:s,onDelete:i}){const r=e.virtual_mcp_id,{org:o}=Ae(),{update:a,triggerAdd:l,run:h}=yr(),c=br(),d=new Map(c.map(Q=>[Q.id,Q.title])),{openTask:u}=ys(),{setChatOpen:f}=ja(),{sendMessage:m}=Gs(),p=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[g,v]=P.useState(p),[b,x]=P.useState(!1),[_,y]=P.useState(!1),[S,w]=P.useState(!1),[j,E]=P.useState(""),[T,A]=P.useState(!1),[R,k]=P.useState(null),[C,D]=P.useState(!1),[N,L]=P.useState(!1),[B,I]=P.useState(!1),M=async()=>{if(C)return;const fe=jm(g).filter(me=>me.type==="text").map(me=>me.text).join(`
|
|
485
|
-
`);if(fe.trim()){D(!0);try{Z(),Ie("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:fe.length}),f(!0),await m({tiptapDoc:Yd({managerAgentId:$h.AUTOMATION_MANAGER(o.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:fe})})}finally{D(!1)}}},O=e.models?.tier??"smart",F=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,z=Ph({defaultValues:{name:e.name,active:e.active,tier:O,modelOverride:F,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),V=z.watch("active"),[G,X]=P.useReducer(Y0,null),ie=()=>{G!==null&&(Ie("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(G.fields),save_count:G.saveCount,edit_duration_ms:Date.now()-G.start}),X({type:"reset"}))},U=async()=>{const Q=z.control._formState.dirtyFields,fe=Object.keys(Q);if(fe.length===0&&!B)return!0;const me=z.getValues(),_e=z.control._defaultValues;z.reset(me,{keepValues:!0});const J=B;I(!1);const se={tier:me.tier,...me.modelOverride?{modelId:me.modelOverride.modelId,credentialId:me.modelOverride.credentialId,modelTitle:me.modelOverride.title}:{}},pe={id:t,name:me.name,active:me.active,models:se,tools:me.tools,maxAgentSteps:me.maxAgentSteps,messages:km(g),temperature:0};try{await a.mutateAsync(pe)}catch{return z.reset(_e,{keepValues:!0}),J&&I(!0),!1}const ge=[...fe];return J&&ge.push("messages"),X({type:"accumulate",now:Date.now(),fields:ge}),$(),!0},{schedule:Y,flush:ne}=cn({save:U}),{schedule:$,flush:Z}=cn({delayMs:3e4,save:async()=>ie()});P.useEffect(()=>{const Q=z.watch(()=>Y());return()=>Q.unsubscribe()},[]);const K=Q=>{if(v(Q),!N){L(!0);return}I(!0),Y()},ee=async()=>{Ie("automation_test_clicked",{automation_id:t,agent_id:r});const Q=await ne();if(Z(),!!Q){if(!g){ae.error("No instructions configured for this automation");return}try{const fe=await h.mutateAsync(t);fe.threadId&&(f(!0),u(fe.threadId))}catch{}}};return n.jsxs(n.Fragment,{children:[s&&n.jsx("div",{className:"flex items-center pb-4 shrink-0",children:n.jsxs(oe,{variant:"ghost",size:"sm",onClick:s,children:[n.jsx(ud,{size:14}),"Back to list"]})}),n.jsxs("div",{className:"flex flex-col gap-8",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx(Dt,{control:z.control,name:"name",render:({field:Q})=>n.jsx(st,{...Q,placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),i&&n.jsx(oe,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:n.jsx(Us,{size:14})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Dt,{control:z.control,name:"active",render:({field:Q})=>n.jsx(ln,{checked:Q.value,onCheckedChange:fe=>{Q.onChange(fe),ne()},className:"cursor-pointer"})}),n.jsx("span",{className:"text-sm text-muted-foreground",children:V?"Active":"Inactive"}),n.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),n.jsx(Xd,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),n.jsx(K0,{automationId:t,open:b,onOpenChange:x,onCustomSelect:()=>{w(!0),A(!1),E("")},onEventSelect:()=>{A(!0),w(!1)},onWebhookCreated:Q=>{Ie("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),k(Q)}})]}),e.triggers.length===0&&!S?n.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",n.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>x(!0),children:"Add a starter"})," ","to get going."]})}):n.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Q=>n.jsx(V0,{trigger:Q,automationId:t,connectionName:Q.connection_id?d.get(Q.connection_id):void 0},Q.id))}),S&&n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}),n.jsx("input",{type:"text",value:j,onChange:Q=>E(Q.target.value),onBlur:async()=>{const Q=j.trim();if(!(!Q||!nr(Q)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:Q}),Ie("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ae.success("Starter added"),w(!1),E("")}catch{ae.error("Failed to add starter")}},onKeyDown:async Q=>{const fe=j.trim();Q.key==="Enter"&&fe&&nr(fe)&&Q.target.blur(),Q.key==="Escape"&&(w(!1),E(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),j&&!nr(j)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&n.jsx(Ne,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),n.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{w(!1),E("")},children:n.jsx(Ps,{size:13})})]}),T&&n.jsx(P.Suspense,{fallback:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[n.jsx(Ne,{size:13,className:"animate-spin text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:n.jsx(X0,{automationId:t,onDone:()=>A(!1)})}),n.jsx(qu,{open:R!==null,onOpenChange:Q=>{Q||k(null)},url:R?.url??null,token:R?.token??null})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),n.jsxs(oe,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:C||!g,onClick:M,children:[n.jsx($s,{size:13}),"Improve"]})]}),n.jsx(ym,{tiptapDoc:g,setTiptapDoc:K,placeholder:"What should this automation do?",children:n.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[n.jsx(Sm,{virtualMcpId:r||null,className:"max-h-[45vh]"}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:ee,disabled:!r,children:[n.jsx(kg,{size:16}),"Test"]})}),n.jsx(ke,{children:"Test Automation"})]})})]})})]}),n.jsxs($m,{open:_,onOpenChange:y,className:"flex flex-col gap-2.5",children:[n.jsxs(zm,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Advanced"}),n.jsx(Rs,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),n.jsxs(Fm,{className:"flex flex-col gap-5 pt-0.5",children:[n.jsx(T0,{tier:z.watch("tier"),onTierChange:Q=>z.setValue("tier",Q,{shouldDirty:!0}),override:z.watch("modelOverride"),onOverrideChange:Q=>z.setValue("modelOverride",Q,{shouldDirty:!0})}),n.jsx(D0,{agentId:r||null,value:z.watch("tools"),onChange:Q=>z.setValue("tools",Q,{shouldDirty:!0})}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Max steps"}),n.jsx(st,{type:"number",min:1,max:100,className:"w-40",placeholder:`${G0} (default)`,value:z.watch("maxAgentSteps")??"",onChange:Q=>{const fe=Q.target.value.trim(),me=fe===""?null:Number(fe);z.setValue("maxAgentSteps",me===null||Number.isNaN(me)?null:me,{shouldDirty:!0})}})]})]})]})]})]})}function gi(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Gu=[{key:"24h",label:"Last 24 hours",ms:1440*60*1e3},{key:"7d",label:"Last 7 days",ms:10080*60*1e3},{key:"30d",label:"Last 30 days",ms:720*60*60*1e3}];function Yu(t){const e=Gu.find(i=>i.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function tS(t){const e=H.c(12),{automationId:s,triggerIds:i}=t,[r,o]=P.useState("30d"),[a,l]=P.useState(iS);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=p=>{const g=p;o(g),l(Yu(g))},e[0]=h):h=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(jt,{className:"w-44",children:n.jsx(Lt,{})}),e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Nt,{children:Gu.map(sS)}),e[2]=d):d=e[2];let u;e[3]!==r?(u=n.jsx("div",{className:"flex items-center justify-end",children:n.jsxs(Et,{value:r,onValueChange:h,children:[c,d]})}),e[3]=r,e[4]=u):u=e[4];let f;e[5]!==s||e[6]!==a||e[7]!==i?(f=n.jsx($g,{automationId:s,triggerIds:i,range:a}),e[5]=s,e[6]=a,e[7]=i,e[8]=f):f=e[8];let m;return e[9]!==u||e[10]!==f?(m=n.jsxs("div",{className:"flex flex-col gap-5",children:[u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function sS(t){return n.jsx(Ye,{value:t.key,children:t.label},t.key)}function iS(){return Yu("30d")}function rS(t){const e=H.c(5),{tabId:s}=t;let i;e[0]!==s?(i=Wh(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(gi,{}),e[2]=o):o=e[2];let a;return e[3]!==r.id?(a=n.jsx(P.Suspense,{fallback:o,children:n.jsx(nS,{id:r.id})}),e[3]=r.id,e[4]=a):a=e[4],a}function nS(t){const e=H.c(24),{id:s}=t,i=Mt(),{data:r,isLoading:o}=Lg(s),[a,l]=P.useState("settings");let h;e[0]!==i?(h=()=>{i({to:".",search:aS,replace:!0})},e[0]=i,e[1]=h):h=e[1];const c=h;if(o){let y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(gi,{}),e[2]=y):y=e[2],y}if(!r){let y;return e[3]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=y):y=e[3],y}let d;e[4]!==r.triggers?(d=r.triggers.map(oS),e[4]=r.triggers,e[5]=d):d=e[5];const u=d;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ud,{size:14}),e[6]=f):f=e[6];let m;e[7]!==c?(m=n.jsxs(oe,{variant:"ghost",size:"sm",onClick:c,children:[f,"Back to list"]}),e[7]=c,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=[{id:"settings",label:"Settings"},{id:"runs",label:"Runs"}],e[9]=p):p=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=y=>l(y),e[10]=g):g=e[10];let v;e[11]!==a?(v=n.jsx(md,{tabs:p,activeTab:a,onTabChange:g}),e[11]=a,e[12]=v):v=e[12];let b;e[13]!==m||e[14]!==v?(b=n.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[m,v]}),e[13]=m,e[14]=v,e[15]=b):b=e[15];let x;e[16]!==r||e[17]!==s||e[18]!==a||e[19]!==u?(x=a==="settings"?n.jsx(eS,{automationId:s,automation:r}):n.jsx(tS,{automationId:s,triggerIds:u}),e[16]=r,e[17]=s,e[18]=a,e[19]=u,e[20]=x):x=e[20];let _;return e[21]!==b||e[22]!==x?(_=n.jsx(Zt,{children:n.jsx(Zt.Content,{children:n.jsxs(Zt.Body,{children:[b,x]})})}),e[21]=b,e[22]=x,e[23]=_):_=e[23],_}function oS(t){return t.id}function aS(t){return{...t,main:"automations"}}function lS(t){const e=H.c(20),{virtualMcpId:s}=t,i=Mt(),{data:r}=Bg(s),o=r===void 0?[]:r,{create:a}=yr(),[l,h]=P.useState(""),c=l.toLowerCase(),d=o.filter(R=>R.name.toLowerCase().includes(c));let u;e[0]!==i?(u=R=>i({to:".",search:k=>({...k,main:"automation:"+R}),replace:!0}),e[0]=i,e[1]=u):u=e[1];const f=u,m=async()=>{if(a.isPending)return;Ie("automation_new_clicked",{virtual_mcp_id:s,existing_count:o.length});const R=await a.mutateAsync(Mg(s));f(R.id)};let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Bt,{size:14}),e[2]=p):p=e[2];let g;e[3]!==a.isPending||e[4]!==m?(g=n.jsxs(oe,{size:"sm",onClick:m,disabled:a.isPending,children:[p,"New automation"]}),e[3]=a.isPending,e[4]=m,e[5]=g):g=e[5];const v=g,b=Zt,x=Zt,_=Zt;let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Zt.Title,{children:"Automations"}),e[6]=y):y=e[6];const S=o.length>0&&n.jsx(fd,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let w;e[7]!==v||e[8]!==S?(w=n.jsxs("div",{className:"flex flex-col gap-6",children:[y,n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[S,v]})]}),e[7]=v,e[8]=S,e[9]=w):w=e[9];const j=o.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(Yr,{image:n.jsx(dr,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:v})}):d.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(Yr,{image:n.jsx(dr,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):n.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:d.map(R=>n.jsx(zg,{automation:R,onClick:()=>f(R.id)},R.id))});let E;e[10]!==j||e[11]!==_.Body||e[12]!==w?(E=n.jsxs(_.Body,{children:[w,j]}),e[10]=j,e[11]=_.Body,e[12]=w,e[13]=E):E=e[13];let T;e[14]!==E||e[15]!==x.Content?(T=n.jsx(x.Content,{children:E}),e[14]=E,e[15]=x.Content,e[16]=T):T=e[16];let A;return e[17]!==b||e[18]!==T?(A=n.jsx(b,{children:T}),e[17]=b,e[18]=T,e[19]=A):A=e[19],A}function cS(t){const e=H.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(gi,{}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=n.jsx(P.Suspense,{fallback:i,children:n.jsx(lS,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}function hS(t){const e=H.c(37),{file:s,onClose:i}=t;let r,o;e[0]!==s.filename?(r=n.jsx(ui,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),o=n.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=o):(r=e[1],o=e[2]);let a;e[3]!==s.size?(a=mp(s.size),e[3]=s.size,e[4]=a):a=e[4];let l;e[5]!==a?(l=n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=l):l=e[6];let h;e[7]!==r||e[8]!==o||e[9]!==l?(h=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,o,l]}),e[7]=r,e[8]=o,e[9]=l,e[10]=h):h=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Zp,{size:14}),e[11]=c):c=e[11];let d;e[12]!==s.downloadUrl||e[13]!==s.filename?(d=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",asChild:!0,children:n.jsx("a",{href:s.downloadUrl,download:s.filename,children:c})})}),e[12]=s.downloadUrl,e[13]=s.filename,e[14]=d):d=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(ke,{side:"bottom",children:"Download"}),e[15]=u):u=e[15];let f;e[16]!==d?(f=n.jsxs(je,{children:[d,u]}),e[16]=d,e[17]=f):f=e[17];let m;e[18]!==s.downloadUrl?(m=()=>window.open(s.downloadUrl,"_blank","noopener"),e[18]=s.downloadUrl,e[19]=m):m=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(wi,{size:14}),e[20]=p):p=e[20];let g;e[21]!==m?(g=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:m,children:p})}),e[21]=m,e[22]=g):g=e[22];let v;e[23]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(ke,{side:"bottom",children:"Open in new tab"}),e[23]=v):v=e[23];let b;e[24]!==g?(b=n.jsxs(je,{children:[g,v]}),e[24]=g,e[25]=b):b=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ps,{size:14}),e[26]=x):x=e[26];let _;e[27]!==i?(_=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:i,children:x})}),e[27]=i,e[28]=_):_=e[28];let y;e[29]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ke,{side:"bottom",children:"Close"}),e[29]=y):y=e[29];let S;e[30]!==_?(S=n.jsxs(je,{children:[_,y]}),e[30]=_,e[31]=S):S=e[31];let w;return e[32]!==b||e[33]!==S||e[34]!==h||e[35]!==f?(w=n.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[h,f,b,S]}),e[32]=b,e[33]=S,e[34]=h,e[35]=f,e[36]=w):w=e[36],w}function dS(t){const e=H.c(24),{fileKey:s,taskId:i}=t,r=Mt(),{data:o,isPending:a}=Bh(i);let l;e[0]!==s||e[1]!==o?(l=o?.find(p=>p.key===s)??null,e[0]=s,e[1]=o,e[2]=l):l=e[2];const h=l;let c;e[3]!==r?(c=()=>r({to:".",search:uS,replace:!0}),e[3]=r,e[4]=c):c=e[4];const d=c;if(!h){if(a){let _;return e[5]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx("div",{className:"h-full w-full bg-background",children:n.jsx(up,{})}),e[5]=_):_=e[5],_}let p;e[6]!==s?(p=s.split("/").pop()??s,e[6]=s,e[7]=p):p=e[7];let g;e[8]!==p?(g=n.jsx(ui,{filename:p,className:"h-7.5 w-6"}),e[8]=p,e[9]=g):g=e[9];let v;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."}),e[10]=v):v=e[10];let b;e[11]!==d?(b=n.jsx(oe,{variant:"ghost",size:"sm",onClick:d,children:"Close"}),e[11]=d,e[12]=b):b=e[12];let x;return e[13]!==g||e[14]!==b?(x=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[g,v,b]}),e[13]=g,e[14]=b,e[15]=x):x=e[15],x}let u;e[16]!==h||e[17]!==d?(u=n.jsx(hS,{file:h,onClose:d}),e[16]=h,e[17]=d,e[18]=u):u=e[18];let f;e[19]!==h?(f=n.jsx("div",{className:"relative min-h-0 flex-1",children:n.jsx(fp,{file:h})}),e[19]=h,e[20]=f):f=e[20];let m;return e[21]!==u||e[22]!==f?(m=n.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[u,f]}),e[21]=u,e[22]=f,e[23]=m):m=e[23],m}function uS(t){return{...t,main:"0"}}const ro="home";function fS(t){const e=H.c(5),{label:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(gd,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=r):r=e[2];let o;return e[3]!==r?(o=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[i,r]}),e[3]=r,e[4]=o):o=e[4],o}function mS(t){const e=H.c(15),{path:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={refetchIntervalWhenAbsent:2e3},e[0]=i):i=e[0];const r=pp(ro,s,i),o=gp(ro)(s);if(r.isPending||!r.data){const f=!r.isPending&&!r.data?"Waiting for the deck to sync…":void 0;let m;return e[1]!==f?(m=n.jsx(fS,{label:f}),e[1]=f,e[2]=m):m=e[2],m}let a;e[3]!==r.data?(a=_p(r.data),e[3]=r.data,e[4]=a):a=e[4];const l=r.data.shareMode??"private",h=r.data.effectivePublic??!1,c=window.location.origin+o;let d;e[5]!==s||e[6]!==l||e[7]!==h||e[8]!==c?(d=n.jsx(vp,{volume:ro,path:s,shareMode:l,effectivePublic:h,url:c}),e[5]=s,e[6]=l,e[7]=h,e[8]=c,e[9]=d):d=e[9];let u;return e[10]!==s||e[11]!==o||e[12]!==a||e[13]!==d?(u=n.jsx(xp,{readUrl:o,marker:a,title:s,savePath:s,trailing:d}),e[10]=s,e[11]=o,e[12]=a,e[13]=d,e[14]=u):u=e[14],u}function pS(t){const e=H.c(5),{path:s}=t,i=Mt();let r;e[0]!==i?(r=()=>i({to:".",search:gS,replace:!0}),e[0]=i,e[1]=r):r=e[1];const o=r;let a;return e[2]!==o||e[3]!==s?(a=n.jsx(bp,{previewPath:s,onClose:o,showSeeInLibrary:!0}),e[2]=o,e[3]=s,e[4]=a):a=e[4],a}function gS(t){return{...t,main:"0"}}const jc=P.lazy(()=>Ut(()=>import("./project-app-view-Bojee27q.js"),__vite__mapDeps([158,1,2,44,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,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,123,96,97,98,88,99,100,101,102,103,90,91,104,105,106,107,84,108,109,110,111,112,113,114,87,115,116,83,92,93,79,117,118,119,120,121,122,124,125,126,127,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144])).then(t=>({default:t.AppViewContent})));function _S(t){const e=H.c(53),{activeTab:s,virtualMcpId:i,taskId:r,layoutTabs:o,expandedTools:a,automationTabParsed:l}=t;if(np(s)){let _;return e[0]!==i?(_=n.jsx(ac,{virtualMcpId:i}),e[0]=i,e[1]=_):_=e[1],_}if(s==="git"){let _;return e[2]!==i?(_=n.jsx(ib,{virtualMcpId:i}),e[2]=i,e[3]=_):_=e[3],_}if(s==="automations"){let _;return e[4]!==i?(_=n.jsx(cS,{virtualMcpId:i}),e[4]=i,e[5]=_):_=e[5],_}if(s==="preview"){let _;return e[6]!==i?(_=n.jsx(ay,{virtualMcpId:i}),e[6]=i,e[7]=_):_=e[7],_}if(s==="content"){let _;return e[8]!==i?(_=n.jsx(j0,{virtualMcpId:i}),e[8]=i,e[9]=_):_=e[9],_}if(l){let _;return e[10]!==s?(_=n.jsx(rS,{tabId:s}),e[10]=s,e[11]=_):_=e[11],_}let h;e[12]!==s?(h=Kh(s),e[12]=s,e[13]=h):h=e[13];const c=h;if(c){let _;return e[14]!==c.path?(_=n.jsx(mS,{path:c.path},c.path),e[14]=c.path,e[15]=_):_=e[15],_}let d;e[16]!==s?(d=Uh(s),e[16]=s,e[17]=d):d=e[17];const u=d;if(u){let _;return e[18]!==u.key||e[19]!==r?(_=n.jsx(dS,{fileKey:u.key,taskId:r}),e[18]=u.key,e[19]=r,e[20]=_):_=e[20],_}let f;e[21]!==s?(f=Vh(s),e[21]=s,e[22]=f):f=e[22];const m=f;if(m){let _;return e[23]!==m.path?(_=n.jsx(pS,{path:m.path},m.path),e[23]=m.path,e[24]=_):_=e[24],_}let p;e[25]!==s?(p=op(s),e[25]=s,e[26]=p):p=e[26];const g=p;if(g){let _;if(e[27]!==a||e[28]!==g.connectionId||e[29]!==g.toolName){let E;e[31]!==g.connectionId||e[32]!==g.toolName?(E=T=>T.appId===g.connectionId&&T.toolName===g.toolName,e[31]=g.connectionId,e[32]=g.toolName,e[33]=E):E=e[33],_=a.find(E),e[27]=a,e[28]=g.connectionId,e[29]=g.toolName,e[30]=_}else _=e[30];const y=_;let S;e[34]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(gi,{}),e[34]=S):S=e[34];const w=y?.args;let j;return e[35]!==s||e[36]!==g.connectionId||e[37]!==g.toolName||e[38]!==w?(j=n.jsx(P.Suspense,{fallback:S,children:n.jsx(jc,{connectionId:g.connectionId,toolName:g.toolName,args:w},s)}),e[35]=s,e[36]=g.connectionId,e[37]=g.toolName,e[38]=w,e[39]=j):j=e[39],j}let v;if(e[40]!==s||e[41]!==o){let _;e[43]!==s?(_=y=>y.id===s,e[43]=s,e[44]=_):_=e[44],v=o.find(_),e[40]=s,e[41]=o,e[42]=v}else v=e[42];const b=v;if(b){let _;e[45]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(gi,{}),e[45]=_):_=e[45];let y;return e[46]!==s||e[47]!==b.id||e[48]!==b.view.appId||e[49]!==b.view.args?(y=n.jsx(P.Suspense,{fallback:_,children:n.jsx(jc,{connectionId:b.view.appId,toolName:b.id,args:b.view.args},s)}),e[46]=s,e[47]=b.id,e[48]=b.view.appId,e[49]=b.view.args,e[50]=y):y=e[50],y}let x;return e[51]!==i?(x=n.jsx(ac,{virtualMcpId:i}),e[51]=i,e[52]=x):x=e[52],x}function vS(t){const e=H.c(14),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:o,layoutTabs:a,expandedTools:l,automationTabParsed:h}=ll(r);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(gi,{}),e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==h||e[6]!==l||e[7]!==a||e[8]!==s||e[9]!==i?(d=n.jsx(P.Suspense,{fallback:c,children:n.jsx(_S,{activeTab:o,virtualMcpId:i,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:h})}),e[4]=o,e[5]=h,e[6]=l,e[7]=a,e[8]=s,e[9]=i,e[10]=d):d=e[10];let u;return e[11]!==o||e[12]!==d?(u=n.jsx(Jt,{children:d},o),e[11]=o,e[12]=d,e[13]=u):u=e[13],u}const Fs="setup";function xS(t){const e=H.c(35);let s;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let m;e[3]!==t.scriptTabs?(m=p=>!t.scriptTabs.includes(p),e[3]=t.scriptTabs,e[4]=m):m=e[4],s=t.scripts.filter(m),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=s}else s=e[2];const i=s;let r;e[5]!==t?(r=()=>{t.active===Fs?t.onToggle():t.onSelectTab(Fs)},e[5]=t,e[6]=r):r=e[6];const o=r,a=t.active===Fs;let l;e[7]!==o||e[8]!==t.open||e[9]!==a?(l=n.jsx(bS,{active:a,open:t.open,onClick:o}),e[7]=o,e[8]=t.open,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==t?(h=t.scriptTabs.map(m=>n.jsx(SS,{active:t.active===m,onClick:()=>{t.active===m?t.onToggle():t.onSelectTab(m)},onClose:()=>t.onCloseScript(m),children:m},m)),e[11]=t,e[12]=h):h=e[12];let c;e[13]!==i||e[14]!==t.onAddScript?(c=n.jsx(wS,{scripts:i,onRun:t.onAddScript}),e[13]=i,e[14]=t.onAddScript,e[15]=c):c=e[15];let d;e[16]!==l||e[17]!==h||e[18]!==c?(d=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[l,h,c]}),e[16]=l,e[17]=h,e[18]=c,e[19]=d):d=e[19];let u;e[20]!==t.onRestart||e[21]!==t.onResume||e[22]!==t.onRetry||e[23]!==t.onRunActiveScript||e[24]!==t.onStart||e[25]!==t.onStop||e[26]!==t.onStopActiveScript||e[27]!==t.scriptIsKilling||e[28]!==t.scriptIsRunning||e[29]!==t.showScriptControls||e[30]!==t.status?(u=t.showScriptControls?n.jsx(CS,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript}):n.jsx(yS,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry}),e[20]=t.onRestart,e[21]=t.onResume,e[22]=t.onRetry,e[23]=t.onRunActiveScript,e[24]=t.onStart,e[25]=t.onStop,e[26]=t.onStopActiveScript,e[27]=t.scriptIsKilling,e[28]=t.scriptIsRunning,e[29]=t.showScriptControls,e[30]=t.status,e[31]=u):u=e[31];let f;return e[32]!==d||e[33]!==u?(f=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-3",children:[d,u]}),e[32]=d,e[33]=u,e[34]=f):f=e[34],f}function bS(t){const e=H.c(8),{active:s,open:i,onClick:r}=t,o=s&&i,a=s&&i,l=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let h;e[0]!==l?(h=le("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-xs",l),e[0]=l,e[1]=h):h=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Xp,{className:"size-3.5"}),e[2]=c):c=e[2];let d;return e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==h?(d=n.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:h,children:[c,"sandbox"]}),e[3]=r,e[4]=o,e[5]=a,e[6]=h,e[7]=d):d=e[7],d}function yS(t){const e=H.c(24),{status:s,onStart:i,onStop:r,onRestart:o,onResume:a,onRetry:l}=t;if(s==="idle"&&i){let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(fi,{className:"size-3.5"}),e[0]=h):h=e[0];let c;return e[1]!==i?(c=n.jsxs(oe,{variant:"outline",size:"sm",onClick:i,children:[h," Start"]}),e[1]=i,e[2]=c):c=e[2],c}if(s==="suspended"&&a){let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(fi,{className:"size-3.5"}),e[3]=h):h=e[3];let c;return e[4]!==a?(c=n.jsxs(oe,{variant:"outline",size:"sm",onClick:a,children:[h," Resume"]}),e[4]=a,e[5]=c):c=e[5],c}if(s==="errored"&&l){let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(ar,{className:"size-3.5"}),e[6]=h):h=e[6];let c;return e[7]!==l?(c=n.jsxs(oe,{variant:"outline",size:"sm",onClick:l,children:[h," Retry"]}),e[7]=l,e[8]=c):c=e[8],c}if(s==="starting"||s==="running"){const h=s==="running"&&!!o,c=h?"rounded-r-none border-r-0":void 0;let d;e[9]!==c?(d=le(c),e[9]=c,e[10]=d):d=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(td,{className:"size-3.5"}),e[11]=u):u=e[11];let f;e[12]!==r||e[13]!==d?(f=n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",onClick:r,className:d,children:[u," Stop"]})}),e[12]=r,e[13]=d,e[14]=f):f=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ke,{children:"Stop sandbox"}),e[15]=m):m=e[15];let p;e[16]!==f?(p=n.jsxs(je,{children:[f,m]}),e[16]=f,e[17]=p):p=e[17];let g;e[18]!==o||e[19]!==h?(g=h&&n.jsxs(os,{children:[n.jsx(as,{asChild:!0,children:n.jsx(oe,{variant:"outline",size:"sm",className:"rounded-l-none px-1",children:n.jsx(Rs,{className:"size-3"})})}),n.jsx(ls,{align:"end",children:n.jsxs(We,{onClick:o,children:[n.jsx(ar,{className:"size-3.5"})," Restart"]})})]}),e[18]=o,e[19]=h,e[20]=g):g=e[20];let v;return e[21]!==p||e[22]!==g?(v=n.jsxs("div",{className:"flex items-center",children:[p,g]}),e[21]=p,e[22]=g,e[23]=v):v=e[23],v}return null}function SS(t){const e=H.c(16),{active:s,onClick:i,onClose:r,children:o}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let l;e[0]!==a?(l=le("flex h-7 items-center rounded-md border text-xs",a),e[0]=a,e[1]=l):l=e[1];const h=r?"pl-2.5 pr-1":"px-2.5",c=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==h||e[3]!==c?(d=le("flex h-full items-center",h,c),e[2]=h,e[3]=c,e[4]=d):d=e[4];let u;e[5]!==o||e[6]!==i||e[7]!==d?(u=n.jsx("button",{type:"button",onClick:i,className:d,children:o}),e[5]=o,e[6]=i,e[7]=d,e[8]=u):u=e[8];let f;e[9]!==o||e[10]!==r?(f=r&&n.jsx("button",{type:"button","aria-label":`Close ${o}`,onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:n.jsx(xd,{className:"size-3"})}),e[9]=o,e[10]=r,e[11]=f):f=e[11];let m;return e[12]!==l||e[13]!==u||e[14]!==f?(m=n.jsxs("div",{className:l,children:[u,f]}),e[12]=l,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function wS(t){const e=H.c(10),{scripts:s,onRun:i}=t,[r,o]=P.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(Xs,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"sm","aria-label":"Run script",children:n.jsx(Bt,{className:"size-3.5"})})})}),n.jsx(ke,{children:"Run script"})]}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:"run a script"}),e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==s?(h=s.length===0?n.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No scripts found"}):s.map(u=>n.jsxs("button",{type:"button",onClick:()=>{o(!1),i(u)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",u]},u)),e[2]=i,e[3]=s,e[4]=h):h=e[4];let c;e[5]!==h?(c=n.jsxs(Js,{align:"start",className:"p-1 w-56",children:[l,h]}),e[5]=h,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==c?(d=n.jsxs(Ys,{open:r,onOpenChange:o,children:[a,c]}),e[7]=r,e[8]=c,e[9]=d):d=e[9],d}function CS(t){const e=H.c(13),{isRunning:s,isKilling:i,onRun:r,onStop:o}=t;if(i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs(oe,{variant:"outline",size:"sm",disabled:!0,children:[n.jsx(Ne,{className:"size-3.5 animate-spin"})," Stopping…"]}),e[0]=d):d=e[0],d}if(!s){let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(fi,{className:"size-3.5"}),e[1]=d):d=e[1];let u;e[2]!==r?(u=n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",onClick:r,children:[d," Run"]})}),e[2]=r,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ke,{children:"Start process"}),e[4]=f):f=e[4];let m;return e[5]!==u?(m=n.jsxs(je,{children:[u,f]}),e[5]=u,e[6]=m):m=e[6],m}let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(td,{className:"size-3.5"}),e[7]=a):a=e[7];let l;e[8]!==o?(l=n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",onClick:o,children:[a," Stop"]})}),e[8]=o,e[9]=l):l=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(ke,{children:"Stop process"}),e[10]=h):h=e[10];let c;return e[11]!==l?(c=n.jsxs(je,{children:[l,h]}),e[11]=l,e[12]=c):c=e[12],c}var Xu=Object.defineProperty,kS=Object.getOwnPropertyDescriptor,jS=(t,e)=>{for(var s in e)Xu(t,s,{get:e[s],enumerable:!0})},Ve=(t,e,s,i)=>{for(var r=i>1?void 0:i?kS(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,s,r):a(r))||r);return i&&r&&Xu(e,s,r),r},ue=(t,e)=>(s,i)=>e(s,i,t),Nc="Terminal input",Oo={get:()=>Nc,set:t=>Nc=t},Ec="Too much output to announce, navigate to rows manually to read",$o={get:()=>Ec,set:t=>Ec=t};function NS(t){return t.replace(/\r?\n/g,"\r")}function ES(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function TS(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function PS(t,e,s,i){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");Ju(r,e,s,i)}}function Ju(t,e,s,i){t=NS(t),t=ES(t,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Zu(t,e,s){let i=s.getBoundingClientRect(),r=t.clientX-i.left-10,o=t.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function Tc(t,e,s,i,r){Zu(t,e,s),r&&i.rightClickSelect(t),e.value=i.selectionText,e.select()}function Ns(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function On(t,e=0,s=t.length){let i="";for(let r=e;r<s;++r){let o=t[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var AS=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r=0;if(this._interim){let o=t.charCodeAt(r++);56320<=o&&o<=57343?e[i++]=(this._interim-55296)*1024+o-56320+65536:(e[i++]=this._interim,e[i++]=o),this._interim=0}for(let o=r;o<s;++o){let a=t.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return this._interim=a,i;let l=t.charCodeAt(o);56320<=l&&l<=57343?e[i++]=(a-55296)*1024+l-56320+65536:(e[i++]=a,e[i++]=l);continue}a!==65279&&(e[i++]=a)}return i}},RS=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r,o,a,l,h=0,c=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 v=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=v-p;for(;c<b;){if(c>=s)return 0;if(g=t[c++],(g&192)!==128){c--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(v===2?m<128?c--:e[i++]=m:v===3?m<2048||m>=55296&&m<=57343||m===65279||(e[i++]=m):m<65536||m>1114111||(e[i++]=m)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!((r=t[u])&128)&&!((o=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[i++]=r,e[i++]=o,e[i++]=a,e[i++]=l,u+=4;if(r=t[u++],r<128)e[i++]=r;else if((r&224)===192){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(h=(r&31)<<6|o&63,h<128){u--;continue}e[i++]=h}else if((r&240)===224){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(h=(r&15)<<12|(o&63)<<6|a&63,h<2048||h>=55296&&h<=57343||h===65279)continue;e[i++]=h}else if((r&248)===240){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=a,i;if(l=t[u++],(l&192)!==128){u--;continue}if(h=(r&7)<<18|(o&63)<<12|(a&63)<<6|l&63,h<65536||h>1114111)continue;e[i++]=h}}return i}},Qu="",Es=" ",Cr=class ef{constructor(){this.fg=0,this.bg=0,this.extended=new _n}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 ef;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}},_n=class tf{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 tf(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Wt=class sf extends Cr{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _n,this.combinedData=""}static fromCharData(e){let s=new sf;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?Ns(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 i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-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()]}},Pc="di$target",zo="di$dependencies",no=new Map;function DS(t){return t[zo]||[]}function lt(t){if(no.has(t))return no.get(t);let e=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");IS(e,s,r)};return e._id=t,no.set(t,e),e}function IS(t,e,s){e[Pc]===e?e[zo].push({id:t,index:s}):(e[zo]=[{id:t,index:s}],e[Pc]=e)}var xt=lt("BufferService"),rf=lt("CoreMouseService"),ti=lt("CoreService"),LS=lt("CharsetService"),bl=lt("InstantiationService"),nf=lt("LogService"),bt=lt("OptionsService"),of=lt("OscLinkService"),BS=lt("UnicodeService"),kr=lt("DecorationService"),Fo=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 i=[],r=this._optionsService.rawOptions.linkHandler,o=new Wt,a=s.getTrimmedLength(),l=-1,h=-1,c=!1;for(let d=0;d<a;d++)if(!(h===-1&&!s.hasContent(d))){if(s.loadCell(d,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=d,l=o.extended.urlId;continue}else c=o.extended.urlId!==l;else h!==-1&&(c=!0);if(c||h!==-1&&d===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:h+1,y:t},end:{x:d+(!c&&d===a-1?1:0),y:t}},m=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||i.push({text:u,range:f,activate:(p,g)=>r?r.activate(p,g,f):MS(p,g),hover:(p,g)=>r?.hover?.(p,g,f),leave:(p,g)=>r?.leave?.(p,g,f)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=d,l=o.extended.urlId):(h=-1,l=-1)}}e(i)}};Fo=Ve([ue(0,xt),ue(1,bt),ue(2,of)],Fo);function MS(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
485
|
+
`);if(fe.trim()){D(!0);try{Z(),Ie("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:fe.length}),f(!0),await m({tiptapDoc:Yd({managerAgentId:$h.AUTOMATION_MANAGER(o.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:fe})})}finally{D(!1)}}},O=e.models?.tier??"smart",F=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,z=Ph({defaultValues:{name:e.name,active:e.active,tier:O,modelOverride:F,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),V=z.watch("active"),[G,X]=P.useReducer(Y0,null),ie=()=>{G!==null&&(Ie("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(G.fields),save_count:G.saveCount,edit_duration_ms:Date.now()-G.start}),X({type:"reset"}))},U=async()=>{const Q=z.control._formState.dirtyFields,fe=Object.keys(Q);if(fe.length===0&&!B)return!0;const me=z.getValues(),_e=z.control._defaultValues;z.reset(me,{keepValues:!0});const J=B;I(!1);const se={tier:me.tier,...me.modelOverride?{modelId:me.modelOverride.modelId,credentialId:me.modelOverride.credentialId,modelTitle:me.modelOverride.title}:{}},pe={id:t,name:me.name,active:me.active,models:se,tools:me.tools,maxAgentSteps:me.maxAgentSteps,messages:km(g),temperature:0};try{await a.mutateAsync(pe)}catch{return z.reset(_e,{keepValues:!0}),J&&I(!0),!1}const ge=[...fe];return J&&ge.push("messages"),X({type:"accumulate",now:Date.now(),fields:ge}),$(),!0},{schedule:Y,flush:ne}=cn({save:U}),{schedule:$,flush:Z}=cn({delayMs:3e4,save:async()=>ie()});P.useEffect(()=>{const Q=z.watch(()=>Y());return()=>Q.unsubscribe()},[]);const K=Q=>{if(v(Q),!N){L(!0);return}I(!0),Y()},ee=async()=>{Ie("automation_test_clicked",{automation_id:t,agent_id:r});const Q=await ne();if(Z(),!!Q){if(!g){ae.error("No instructions configured for this automation");return}try{const fe=await h.mutateAsync(t);fe.threadId&&(f(!0),u(fe.threadId))}catch{}}};return n.jsxs(n.Fragment,{children:[s&&n.jsx("div",{className:"flex items-center pb-4 shrink-0",children:n.jsxs(oe,{variant:"ghost",size:"sm",onClick:s,children:[n.jsx(ud,{size:14}),"Back to list"]})}),n.jsxs("div",{className:"flex flex-col gap-8",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx(Dt,{control:z.control,name:"name",render:({field:Q})=>n.jsx(st,{...Q,placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),i&&n.jsx(oe,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:n.jsx(Us,{size:14})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Dt,{control:z.control,name:"active",render:({field:Q})=>n.jsx(ln,{checked:Q.value,onCheckedChange:fe=>{Q.onChange(fe),ne()},className:"cursor-pointer"})}),n.jsx("span",{className:"text-sm text-muted-foreground",children:V?"Active":"Inactive"}),n.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),n.jsx(Xd,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),n.jsx(K0,{automationId:t,open:b,onOpenChange:x,onCustomSelect:()=>{w(!0),A(!1),E("")},onEventSelect:()=>{A(!0),w(!1)},onWebhookCreated:Q=>{Ie("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),k(Q)}})]}),e.triggers.length===0&&!S?n.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",n.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>x(!0),children:"Add a starter"})," ","to get going."]})}):n.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(Q=>n.jsx(V0,{trigger:Q,automationId:t,connectionName:Q.connection_id?d.get(Q.connection_id):void 0},Q.id))}),S&&n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[n.jsx(sr,{size:14,className:"text-muted-foreground shrink-0"}),n.jsx("input",{type:"text",value:j,onChange:Q=>E(Q.target.value),onBlur:async()=>{const Q=j.trim();if(!(!Q||!nr(Q)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:Q}),Ie("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ae.success("Starter added"),w(!1),E("")}catch{ae.error("Failed to add starter")}},onKeyDown:async Q=>{const fe=j.trim();Q.key==="Enter"&&fe&&nr(fe)&&Q.target.blur(),Q.key==="Escape"&&(w(!1),E(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),j&&!nr(j)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&n.jsx(Ne,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),n.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{w(!1),E("")},children:n.jsx(Ps,{size:13})})]}),T&&n.jsx(P.Suspense,{fallback:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[n.jsx(Ne,{size:13,className:"animate-spin text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:n.jsx(X0,{automationId:t,onDone:()=>A(!1)})}),n.jsx(qu,{open:R!==null,onOpenChange:Q=>{Q||k(null)},url:R?.url??null,token:R?.token??null})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),n.jsxs(oe,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:C||!g,onClick:M,children:[n.jsx($s,{size:13}),"Improve"]})]}),n.jsx(ym,{tiptapDoc:g,setTiptapDoc:K,placeholder:"What should this automation do?",children:n.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[n.jsx(Sm,{virtualMcpId:r||null,className:"max-h-[45vh]"}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:ee,disabled:!r,children:[n.jsx(kg,{size:16}),"Test"]})}),n.jsx(ke,{children:"Test Automation"})]})})]})})]}),n.jsxs($m,{open:_,onOpenChange:y,className:"flex flex-col gap-2.5",children:[n.jsxs(zm,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Advanced"}),n.jsx(Rs,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),n.jsxs(Fm,{className:"flex flex-col gap-5 pt-0.5",children:[n.jsx(T0,{tier:z.watch("tier"),onTierChange:Q=>z.setValue("tier",Q,{shouldDirty:!0}),override:z.watch("modelOverride"),onOverrideChange:Q=>z.setValue("modelOverride",Q,{shouldDirty:!0})}),n.jsx(D0,{agentId:r||null,value:z.watch("tools"),onChange:Q=>z.setValue("tools",Q,{shouldDirty:!0})}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Max steps"}),n.jsx(st,{type:"number",min:1,max:100,className:"w-40",placeholder:`${G0} (default)`,value:z.watch("maxAgentSteps")??"",onChange:Q=>{const fe=Q.target.value.trim(),me=fe===""?null:Number(fe);z.setValue("maxAgentSteps",me===null||Number.isNaN(me)?null:me,{shouldDirty:!0})}})]})]})]})]})]})}function gi(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:n.jsx(Ne,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const Gu=[{key:"24h",label:"Last 24 hours",ms:1440*60*1e3},{key:"7d",label:"Last 7 days",ms:10080*60*1e3},{key:"30d",label:"Last 30 days",ms:720*60*60*1e3}];function Yu(t){const e=Gu.find(i=>i.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function tS(t){const e=H.c(12),{automationId:s,triggerIds:i}=t,[r,o]=P.useState("30d"),[a,l]=P.useState(iS);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=p=>{const g=p;o(g),l(Yu(g))},e[0]=h):h=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(jt,{className:"w-44",children:n.jsx(Lt,{})}),e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Nt,{children:Gu.map(sS)}),e[2]=d):d=e[2];let u;e[3]!==r?(u=n.jsx("div",{className:"flex items-center justify-end",children:n.jsxs(Et,{value:r,onValueChange:h,children:[c,d]})}),e[3]=r,e[4]=u):u=e[4];let f;e[5]!==s||e[6]!==a||e[7]!==i?(f=n.jsx($g,{automationId:s,triggerIds:i,range:a}),e[5]=s,e[6]=a,e[7]=i,e[8]=f):f=e[8];let m;return e[9]!==u||e[10]!==f?(m=n.jsxs("div",{className:"flex flex-col gap-5",children:[u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function sS(t){return n.jsx(Ye,{value:t.key,children:t.label},t.key)}function iS(){return Yu("30d")}function rS(t){const e=H.c(5),{tabId:s}=t;let i;e[0]!==s?(i=Wh(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(gi,{}),e[2]=o):o=e[2];let a;return e[3]!==r.id?(a=n.jsx(P.Suspense,{fallback:o,children:n.jsx(nS,{id:r.id})}),e[3]=r.id,e[4]=a):a=e[4],a}function nS(t){const e=H.c(24),{id:s}=t,i=Mt(),{data:r,isLoading:o}=Lg(s),[a,l]=P.useState("settings");let h;e[0]!==i?(h=()=>{i({to:".",search:aS,replace:!0})},e[0]=i,e[1]=h):h=e[1];const c=h;if(o){let y;return e[2]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(gi,{}),e[2]=y):y=e[2],y}if(!r){let y;return e[3]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=y):y=e[3],y}let d;e[4]!==r.triggers?(d=r.triggers.map(oS),e[4]=r.triggers,e[5]=d):d=e[5];const u=d;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ud,{size:14}),e[6]=f):f=e[6];let m;e[7]!==c?(m=n.jsxs(oe,{variant:"ghost",size:"sm",onClick:c,children:[f,"Back to list"]}),e[7]=c,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=[{id:"settings",label:"Settings"},{id:"runs",label:"Runs"}],e[9]=p):p=e[9];let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g=y=>l(y),e[10]=g):g=e[10];let v;e[11]!==a?(v=n.jsx(md,{tabs:p,activeTab:a,onTabChange:g}),e[11]=a,e[12]=v):v=e[12];let b;e[13]!==m||e[14]!==v?(b=n.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[m,v]}),e[13]=m,e[14]=v,e[15]=b):b=e[15];let x;e[16]!==r||e[17]!==s||e[18]!==a||e[19]!==u?(x=a==="settings"?n.jsx(eS,{automationId:s,automation:r}):n.jsx(tS,{automationId:s,triggerIds:u}),e[16]=r,e[17]=s,e[18]=a,e[19]=u,e[20]=x):x=e[20];let _;return e[21]!==b||e[22]!==x?(_=n.jsx(Zt,{children:n.jsx(Zt.Content,{children:n.jsxs(Zt.Body,{children:[b,x]})})}),e[21]=b,e[22]=x,e[23]=_):_=e[23],_}function oS(t){return t.id}function aS(t){return{...t,main:"automations"}}function lS(t){const e=H.c(20),{virtualMcpId:s}=t,i=Mt(),{data:r}=Bg(s),o=r===void 0?[]:r,{create:a}=yr(),[l,h]=P.useState(""),c=l.toLowerCase(),d=o.filter(R=>R.name.toLowerCase().includes(c));let u;e[0]!==i?(u=R=>i({to:".",search:k=>({...k,main:"automation:"+R}),replace:!0}),e[0]=i,e[1]=u):u=e[1];const f=u,m=async()=>{if(a.isPending)return;Ie("automation_new_clicked",{virtual_mcp_id:s,existing_count:o.length});const R=await a.mutateAsync(Mg(s));f(R.id)};let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Bt,{size:14}),e[2]=p):p=e[2];let g;e[3]!==a.isPending||e[4]!==m?(g=n.jsxs(oe,{size:"sm",onClick:m,disabled:a.isPending,children:[p,"New automation"]}),e[3]=a.isPending,e[4]=m,e[5]=g):g=e[5];const v=g,b=Zt,x=Zt,_=Zt;let y;e[6]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Zt.Title,{children:"Automations"}),e[6]=y):y=e[6];const S=o.length>0&&n.jsx(fd,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let w;e[7]!==v||e[8]!==S?(w=n.jsxs("div",{className:"flex flex-col gap-6",children:[y,n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[S,v]})]}),e[7]=v,e[8]=S,e[9]=w):w=e[9];const j=o.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(Yr,{image:n.jsx(dr,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:v})}):d.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(Yr,{image:n.jsx(dr,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):n.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:d.map(R=>n.jsx(zg,{automation:R,onClick:()=>f(R.id)},R.id))});let E;e[10]!==j||e[11]!==_.Body||e[12]!==w?(E=n.jsxs(_.Body,{children:[w,j]}),e[10]=j,e[11]=_.Body,e[12]=w,e[13]=E):E=e[13];let T;e[14]!==E||e[15]!==x.Content?(T=n.jsx(x.Content,{children:E}),e[14]=E,e[15]=x.Content,e[16]=T):T=e[16];let A;return e[17]!==b||e[18]!==T?(A=n.jsx(b,{children:T}),e[17]=b,e[18]=T,e[19]=A):A=e[19],A}function cS(t){const e=H.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(gi,{}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=n.jsx(P.Suspense,{fallback:i,children:n.jsx(lS,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}function hS(t){const e=H.c(37),{file:s,onClose:i}=t;let r,o;e[0]!==s.filename?(r=n.jsx(ui,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),o=n.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=o):(r=e[1],o=e[2]);let a;e[3]!==s.size?(a=mp(s.size),e[3]=s.size,e[4]=a):a=e[4];let l;e[5]!==a?(l=n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=l):l=e[6];let h;e[7]!==r||e[8]!==o||e[9]!==l?(h=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,o,l]}),e[7]=r,e[8]=o,e[9]=l,e[10]=h):h=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Zp,{size:14}),e[11]=c):c=e[11];let d;e[12]!==s.downloadUrl||e[13]!==s.filename?(d=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",asChild:!0,children:n.jsx("a",{href:s.downloadUrl,download:s.filename,children:c})})}),e[12]=s.downloadUrl,e[13]=s.filename,e[14]=d):d=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(ke,{side:"bottom",children:"Download"}),e[15]=u):u=e[15];let f;e[16]!==d?(f=n.jsxs(je,{children:[d,u]}),e[16]=d,e[17]=f):f=e[17];let m;e[18]!==s.downloadUrl?(m=()=>window.open(s.downloadUrl,"_blank","noopener"),e[18]=s.downloadUrl,e[19]=m):m=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(wi,{size:14}),e[20]=p):p=e[20];let g;e[21]!==m?(g=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:m,children:p})}),e[21]=m,e[22]=g):g=e[22];let v;e[23]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(ke,{side:"bottom",children:"Open in new tab"}),e[23]=v):v=e[23];let b;e[24]!==g?(b=n.jsxs(je,{children:[g,v]}),e[24]=g,e[25]=b):b=e[25];let x;e[26]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ps,{size:14}),e[26]=x):x=e[26];let _;e[27]!==i?(_=n.jsx(Ce,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"icon",onClick:i,children:x})}),e[27]=i,e[28]=_):_=e[28];let y;e[29]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ke,{side:"bottom",children:"Close"}),e[29]=y):y=e[29];let S;e[30]!==_?(S=n.jsxs(je,{children:[_,y]}),e[30]=_,e[31]=S):S=e[31];let w;return e[32]!==b||e[33]!==S||e[34]!==h||e[35]!==f?(w=n.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[h,f,b,S]}),e[32]=b,e[33]=S,e[34]=h,e[35]=f,e[36]=w):w=e[36],w}function dS(t){const e=H.c(24),{fileKey:s,taskId:i}=t,r=Mt(),{data:o,isPending:a}=Bh(i);let l;e[0]!==s||e[1]!==o?(l=o?.find(p=>p.key===s)??null,e[0]=s,e[1]=o,e[2]=l):l=e[2];const h=l;let c;e[3]!==r?(c=()=>r({to:".",search:uS,replace:!0}),e[3]=r,e[4]=c):c=e[4];const d=c;if(!h){if(a){let _;return e[5]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx("div",{className:"h-full w-full bg-background",children:n.jsx(up,{})}),e[5]=_):_=e[5],_}let p;e[6]!==s?(p=s.split("/").pop()??s,e[6]=s,e[7]=p):p=e[7];let g;e[8]!==p?(g=n.jsx(ui,{filename:p,className:"h-7.5 w-6"}),e[8]=p,e[9]=g):g=e[9];let v;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."}),e[10]=v):v=e[10];let b;e[11]!==d?(b=n.jsx(oe,{variant:"ghost",size:"sm",onClick:d,children:"Close"}),e[11]=d,e[12]=b):b=e[12];let x;return e[13]!==g||e[14]!==b?(x=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[g,v,b]}),e[13]=g,e[14]=b,e[15]=x):x=e[15],x}let u;e[16]!==h||e[17]!==d?(u=n.jsx(hS,{file:h,onClose:d}),e[16]=h,e[17]=d,e[18]=u):u=e[18];let f;e[19]!==h?(f=n.jsx("div",{className:"relative min-h-0 flex-1",children:n.jsx(fp,{file:h})}),e[19]=h,e[20]=f):f=e[20];let m;return e[21]!==u||e[22]!==f?(m=n.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[u,f]}),e[21]=u,e[22]=f,e[23]=m):m=e[23],m}function uS(t){return{...t,main:"0"}}const ro="home";function fS(t){const e=H.c(5),{label:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(gd,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=r):r=e[2];let o;return e[3]!==r?(o=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[i,r]}),e[3]=r,e[4]=o):o=e[4],o}function mS(t){const e=H.c(15),{path:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={refetchIntervalWhenAbsent:2e3},e[0]=i):i=e[0];const r=pp(ro,s,i),o=gp(ro)(s);if(r.isPending||!r.data){const f=!r.isPending&&!r.data?"Waiting for the deck to sync…":void 0;let m;return e[1]!==f?(m=n.jsx(fS,{label:f}),e[1]=f,e[2]=m):m=e[2],m}let a;e[3]!==r.data?(a=_p(r.data),e[3]=r.data,e[4]=a):a=e[4];const l=r.data.shareMode??"private",h=r.data.effectivePublic??!1,c=window.location.origin+o;let d;e[5]!==s||e[6]!==l||e[7]!==h||e[8]!==c?(d=n.jsx(vp,{volume:ro,path:s,shareMode:l,effectivePublic:h,url:c}),e[5]=s,e[6]=l,e[7]=h,e[8]=c,e[9]=d):d=e[9];let u;return e[10]!==s||e[11]!==o||e[12]!==a||e[13]!==d?(u=n.jsx(xp,{readUrl:o,marker:a,title:s,savePath:s,trailing:d}),e[10]=s,e[11]=o,e[12]=a,e[13]=d,e[14]=u):u=e[14],u}function pS(t){const e=H.c(5),{path:s}=t,i=Mt();let r;e[0]!==i?(r=()=>i({to:".",search:gS,replace:!0}),e[0]=i,e[1]=r):r=e[1];const o=r;let a;return e[2]!==o||e[3]!==s?(a=n.jsx(bp,{previewPath:s,onClose:o,showSeeInLibrary:!0}),e[2]=o,e[3]=s,e[4]=a):a=e[4],a}function gS(t){return{...t,main:"0"}}const jc=P.lazy(()=>Ut(()=>import("./project-app-view-QWISlKTP.js"),__vite__mapDeps([158,1,2,44,7,8,9,10,11,12,13,14,15,16,6,3,4,5,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,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,123,96,97,98,88,99,100,101,102,103,90,91,104,105,106,107,84,108,109,110,111,112,113,114,87,115,116,83,92,93,79,117,118,119,120,121,122,124,125,126,127,85,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144])).then(t=>({default:t.AppViewContent})));function _S(t){const e=H.c(53),{activeTab:s,virtualMcpId:i,taskId:r,layoutTabs:o,expandedTools:a,automationTabParsed:l}=t;if(np(s)){let _;return e[0]!==i?(_=n.jsx(ac,{virtualMcpId:i}),e[0]=i,e[1]=_):_=e[1],_}if(s==="git"){let _;return e[2]!==i?(_=n.jsx(ib,{virtualMcpId:i}),e[2]=i,e[3]=_):_=e[3],_}if(s==="automations"){let _;return e[4]!==i?(_=n.jsx(cS,{virtualMcpId:i}),e[4]=i,e[5]=_):_=e[5],_}if(s==="preview"){let _;return e[6]!==i?(_=n.jsx(ay,{virtualMcpId:i}),e[6]=i,e[7]=_):_=e[7],_}if(s==="content"){let _;return e[8]!==i?(_=n.jsx(j0,{virtualMcpId:i}),e[8]=i,e[9]=_):_=e[9],_}if(l){let _;return e[10]!==s?(_=n.jsx(rS,{tabId:s}),e[10]=s,e[11]=_):_=e[11],_}let h;e[12]!==s?(h=Kh(s),e[12]=s,e[13]=h):h=e[13];const c=h;if(c){let _;return e[14]!==c.path?(_=n.jsx(mS,{path:c.path},c.path),e[14]=c.path,e[15]=_):_=e[15],_}let d;e[16]!==s?(d=Uh(s),e[16]=s,e[17]=d):d=e[17];const u=d;if(u){let _;return e[18]!==u.key||e[19]!==r?(_=n.jsx(dS,{fileKey:u.key,taskId:r}),e[18]=u.key,e[19]=r,e[20]=_):_=e[20],_}let f;e[21]!==s?(f=Vh(s),e[21]=s,e[22]=f):f=e[22];const m=f;if(m){let _;return e[23]!==m.path?(_=n.jsx(pS,{path:m.path},m.path),e[23]=m.path,e[24]=_):_=e[24],_}let p;e[25]!==s?(p=op(s),e[25]=s,e[26]=p):p=e[26];const g=p;if(g){let _;if(e[27]!==a||e[28]!==g.connectionId||e[29]!==g.toolName){let E;e[31]!==g.connectionId||e[32]!==g.toolName?(E=T=>T.appId===g.connectionId&&T.toolName===g.toolName,e[31]=g.connectionId,e[32]=g.toolName,e[33]=E):E=e[33],_=a.find(E),e[27]=a,e[28]=g.connectionId,e[29]=g.toolName,e[30]=_}else _=e[30];const y=_;let S;e[34]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(gi,{}),e[34]=S):S=e[34];const w=y?.args;let j;return e[35]!==s||e[36]!==g.connectionId||e[37]!==g.toolName||e[38]!==w?(j=n.jsx(P.Suspense,{fallback:S,children:n.jsx(jc,{connectionId:g.connectionId,toolName:g.toolName,args:w},s)}),e[35]=s,e[36]=g.connectionId,e[37]=g.toolName,e[38]=w,e[39]=j):j=e[39],j}let v;if(e[40]!==s||e[41]!==o){let _;e[43]!==s?(_=y=>y.id===s,e[43]=s,e[44]=_):_=e[44],v=o.find(_),e[40]=s,e[41]=o,e[42]=v}else v=e[42];const b=v;if(b){let _;e[45]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(gi,{}),e[45]=_):_=e[45];let y;return e[46]!==s||e[47]!==b.id||e[48]!==b.view.appId||e[49]!==b.view.args?(y=n.jsx(P.Suspense,{fallback:_,children:n.jsx(jc,{connectionId:b.view.appId,toolName:b.id,args:b.view.args},s)}),e[46]=s,e[47]=b.id,e[48]=b.view.appId,e[49]=b.view.args,e[50]=y):y=e[50],y}let x;return e[51]!==i?(x=n.jsx(ac,{virtualMcpId:i}),e[51]=i,e[52]=x):x=e[52],x}function vS(t){const e=H.c(14),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:o,layoutTabs:a,expandedTools:l,automationTabParsed:h}=ll(r);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(gi,{}),e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==h||e[6]!==l||e[7]!==a||e[8]!==s||e[9]!==i?(d=n.jsx(P.Suspense,{fallback:c,children:n.jsx(_S,{activeTab:o,virtualMcpId:i,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:h})}),e[4]=o,e[5]=h,e[6]=l,e[7]=a,e[8]=s,e[9]=i,e[10]=d):d=e[10];let u;return e[11]!==o||e[12]!==d?(u=n.jsx(Jt,{children:d},o),e[11]=o,e[12]=d,e[13]=u):u=e[13],u}const Fs="setup";function xS(t){const e=H.c(35);let s;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let m;e[3]!==t.scriptTabs?(m=p=>!t.scriptTabs.includes(p),e[3]=t.scriptTabs,e[4]=m):m=e[4],s=t.scripts.filter(m),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=s}else s=e[2];const i=s;let r;e[5]!==t?(r=()=>{t.active===Fs?t.onToggle():t.onSelectTab(Fs)},e[5]=t,e[6]=r):r=e[6];const o=r,a=t.active===Fs;let l;e[7]!==o||e[8]!==t.open||e[9]!==a?(l=n.jsx(bS,{active:a,open:t.open,onClick:o}),e[7]=o,e[8]=t.open,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==t?(h=t.scriptTabs.map(m=>n.jsx(SS,{active:t.active===m,onClick:()=>{t.active===m?t.onToggle():t.onSelectTab(m)},onClose:()=>t.onCloseScript(m),children:m},m)),e[11]=t,e[12]=h):h=e[12];let c;e[13]!==i||e[14]!==t.onAddScript?(c=n.jsx(wS,{scripts:i,onRun:t.onAddScript}),e[13]=i,e[14]=t.onAddScript,e[15]=c):c=e[15];let d;e[16]!==l||e[17]!==h||e[18]!==c?(d=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[l,h,c]}),e[16]=l,e[17]=h,e[18]=c,e[19]=d):d=e[19];let u;e[20]!==t.onRestart||e[21]!==t.onResume||e[22]!==t.onRetry||e[23]!==t.onRunActiveScript||e[24]!==t.onStart||e[25]!==t.onStop||e[26]!==t.onStopActiveScript||e[27]!==t.scriptIsKilling||e[28]!==t.scriptIsRunning||e[29]!==t.showScriptControls||e[30]!==t.status?(u=t.showScriptControls?n.jsx(CS,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript}):n.jsx(yS,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry}),e[20]=t.onRestart,e[21]=t.onResume,e[22]=t.onRetry,e[23]=t.onRunActiveScript,e[24]=t.onStart,e[25]=t.onStop,e[26]=t.onStopActiveScript,e[27]=t.scriptIsKilling,e[28]=t.scriptIsRunning,e[29]=t.showScriptControls,e[30]=t.status,e[31]=u):u=e[31];let f;return e[32]!==d||e[33]!==u?(f=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-3",children:[d,u]}),e[32]=d,e[33]=u,e[34]=f):f=e[34],f}function bS(t){const e=H.c(8),{active:s,open:i,onClick:r}=t,o=s&&i,a=s&&i,l=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let h;e[0]!==l?(h=le("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-xs",l),e[0]=l,e[1]=h):h=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Xp,{className:"size-3.5"}),e[2]=c):c=e[2];let d;return e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==h?(d=n.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:h,children:[c,"sandbox"]}),e[3]=r,e[4]=o,e[5]=a,e[6]=h,e[7]=d):d=e[7],d}function yS(t){const e=H.c(24),{status:s,onStart:i,onStop:r,onRestart:o,onResume:a,onRetry:l}=t;if(s==="idle"&&i){let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(fi,{className:"size-3.5"}),e[0]=h):h=e[0];let c;return e[1]!==i?(c=n.jsxs(oe,{variant:"outline",size:"sm",onClick:i,children:[h," Start"]}),e[1]=i,e[2]=c):c=e[2],c}if(s==="suspended"&&a){let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(fi,{className:"size-3.5"}),e[3]=h):h=e[3];let c;return e[4]!==a?(c=n.jsxs(oe,{variant:"outline",size:"sm",onClick:a,children:[h," Resume"]}),e[4]=a,e[5]=c):c=e[5],c}if(s==="errored"&&l){let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(ar,{className:"size-3.5"}),e[6]=h):h=e[6];let c;return e[7]!==l?(c=n.jsxs(oe,{variant:"outline",size:"sm",onClick:l,children:[h," Retry"]}),e[7]=l,e[8]=c):c=e[8],c}if(s==="starting"||s==="running"){const h=s==="running"&&!!o,c=h?"rounded-r-none border-r-0":void 0;let d;e[9]!==c?(d=le(c),e[9]=c,e[10]=d):d=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(td,{className:"size-3.5"}),e[11]=u):u=e[11];let f;e[12]!==r||e[13]!==d?(f=n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",onClick:r,className:d,children:[u," Stop"]})}),e[12]=r,e[13]=d,e[14]=f):f=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ke,{children:"Stop sandbox"}),e[15]=m):m=e[15];let p;e[16]!==f?(p=n.jsxs(je,{children:[f,m]}),e[16]=f,e[17]=p):p=e[17];let g;e[18]!==o||e[19]!==h?(g=h&&n.jsxs(os,{children:[n.jsx(as,{asChild:!0,children:n.jsx(oe,{variant:"outline",size:"sm",className:"rounded-l-none px-1",children:n.jsx(Rs,{className:"size-3"})})}),n.jsx(ls,{align:"end",children:n.jsxs(We,{onClick:o,children:[n.jsx(ar,{className:"size-3.5"})," Restart"]})})]}),e[18]=o,e[19]=h,e[20]=g):g=e[20];let v;return e[21]!==p||e[22]!==g?(v=n.jsxs("div",{className:"flex items-center",children:[p,g]}),e[21]=p,e[22]=g,e[23]=v):v=e[23],v}return null}function SS(t){const e=H.c(16),{active:s,onClick:i,onClose:r,children:o}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let l;e[0]!==a?(l=le("flex h-7 items-center rounded-md border text-xs",a),e[0]=a,e[1]=l):l=e[1];const h=r?"pl-2.5 pr-1":"px-2.5",c=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==h||e[3]!==c?(d=le("flex h-full items-center",h,c),e[2]=h,e[3]=c,e[4]=d):d=e[4];let u;e[5]!==o||e[6]!==i||e[7]!==d?(u=n.jsx("button",{type:"button",onClick:i,className:d,children:o}),e[5]=o,e[6]=i,e[7]=d,e[8]=u):u=e[8];let f;e[9]!==o||e[10]!==r?(f=r&&n.jsx("button",{type:"button","aria-label":`Close ${o}`,onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:n.jsx(xd,{className:"size-3"})}),e[9]=o,e[10]=r,e[11]=f):f=e[11];let m;return e[12]!==l||e[13]!==u||e[14]!==f?(m=n.jsxs("div",{className:l,children:[u,f]}),e[12]=l,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function wS(t){const e=H.c(10),{scripts:s,onRun:i}=t,[r,o]=P.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs(je,{children:[n.jsx(Ce,{asChild:!0,children:n.jsx(Xs,{asChild:!0,children:n.jsx(oe,{variant:"ghost",size:"sm","aria-label":"Run script",children:n.jsx(Bt,{className:"size-3.5"})})})}),n.jsx(ke,{children:"Run script"})]}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:"run a script"}),e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==s?(h=s.length===0?n.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No scripts found"}):s.map(u=>n.jsxs("button",{type:"button",onClick:()=>{o(!1),i(u)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",u]},u)),e[2]=i,e[3]=s,e[4]=h):h=e[4];let c;e[5]!==h?(c=n.jsxs(Js,{align:"start",className:"p-1 w-56",children:[l,h]}),e[5]=h,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==c?(d=n.jsxs(Ys,{open:r,onOpenChange:o,children:[a,c]}),e[7]=r,e[8]=c,e[9]=d):d=e[9],d}function CS(t){const e=H.c(13),{isRunning:s,isKilling:i,onRun:r,onStop:o}=t;if(i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs(oe,{variant:"outline",size:"sm",disabled:!0,children:[n.jsx(Ne,{className:"size-3.5 animate-spin"})," Stopping…"]}),e[0]=d):d=e[0],d}if(!s){let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(fi,{className:"size-3.5"}),e[1]=d):d=e[1];let u;e[2]!==r?(u=n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",onClick:r,children:[d," Run"]})}),e[2]=r,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ke,{children:"Start process"}),e[4]=f):f=e[4];let m;return e[5]!==u?(m=n.jsxs(je,{children:[u,f]}),e[5]=u,e[6]=m):m=e[6],m}let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(td,{className:"size-3.5"}),e[7]=a):a=e[7];let l;e[8]!==o?(l=n.jsx(Ce,{asChild:!0,children:n.jsxs(oe,{variant:"outline",size:"sm",onClick:o,children:[a," Stop"]})}),e[8]=o,e[9]=l):l=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(ke,{children:"Stop process"}),e[10]=h):h=e[10];let c;return e[11]!==l?(c=n.jsxs(je,{children:[l,h]}),e[11]=l,e[12]=c):c=e[12],c}var Xu=Object.defineProperty,kS=Object.getOwnPropertyDescriptor,jS=(t,e)=>{for(var s in e)Xu(t,s,{get:e[s],enumerable:!0})},Ve=(t,e,s,i)=>{for(var r=i>1?void 0:i?kS(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,s,r):a(r))||r);return i&&r&&Xu(e,s,r),r},ue=(t,e)=>(s,i)=>e(s,i,t),Nc="Terminal input",Oo={get:()=>Nc,set:t=>Nc=t},Ec="Too much output to announce, navigate to rows manually to read",$o={get:()=>Ec,set:t=>Ec=t};function NS(t){return t.replace(/\r?\n/g,"\r")}function ES(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function TS(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function PS(t,e,s,i){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");Ju(r,e,s,i)}}function Ju(t,e,s,i){t=NS(t),t=ES(t,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function Zu(t,e,s){let i=s.getBoundingClientRect(),r=t.clientX-i.left-10,o=t.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function Tc(t,e,s,i,r){Zu(t,e,s),r&&i.rightClickSelect(t),e.value=i.selectionText,e.select()}function Ns(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function On(t,e=0,s=t.length){let i="";for(let r=e;r<s;++r){let o=t[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var AS=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r=0;if(this._interim){let o=t.charCodeAt(r++);56320<=o&&o<=57343?e[i++]=(this._interim-55296)*1024+o-56320+65536:(e[i++]=this._interim,e[i++]=o),this._interim=0}for(let o=r;o<s;++o){let a=t.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return this._interim=a,i;let l=t.charCodeAt(o);56320<=l&&l<=57343?e[i++]=(a-55296)*1024+l-56320+65536:(e[i++]=a,e[i++]=l);continue}a!==65279&&(e[i++]=a)}return i}},RS=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r,o,a,l,h=0,c=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 v=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=v-p;for(;c<b;){if(c>=s)return 0;if(g=t[c++],(g&192)!==128){c--,f=!0;break}else this.interim[p++]=g,m<<=6,m|=g&63}f||(v===2?m<128?c--:e[i++]=m:v===3?m<2048||m>=55296&&m<=57343||m===65279||(e[i++]=m):m<65536||m>1114111||(e[i++]=m)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!((r=t[u])&128)&&!((o=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[i++]=r,e[i++]=o,e[i++]=a,e[i++]=l,u+=4;if(r=t[u++],r<128)e[i++]=r;else if((r&224)===192){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(h=(r&31)<<6|o&63,h<128){u--;continue}e[i++]=h}else if((r&240)===224){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(h=(r&15)<<12|(o&63)<<6|a&63,h<2048||h>=55296&&h<=57343||h===65279)continue;e[i++]=h}else if((r&248)===240){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=a,i;if(l=t[u++],(l&192)!==128){u--;continue}if(h=(r&7)<<18|(o&63)<<12|(a&63)<<6|l&63,h<65536||h>1114111)continue;e[i++]=h}}return i}},Qu="",Es=" ",Cr=class ef{constructor(){this.fg=0,this.bg=0,this.extended=new _n}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 ef;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}},_n=class tf{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 tf(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Wt=class sf extends Cr{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new _n,this.combinedData=""}static fromCharData(e){let s=new sf;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?Ns(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 i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-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()]}},Pc="di$target",zo="di$dependencies",no=new Map;function DS(t){return t[zo]||[]}function lt(t){if(no.has(t))return no.get(t);let e=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");IS(e,s,r)};return e._id=t,no.set(t,e),e}function IS(t,e,s){e[Pc]===e?e[zo].push({id:t,index:s}):(e[zo]=[{id:t,index:s}],e[Pc]=e)}var xt=lt("BufferService"),rf=lt("CoreMouseService"),ti=lt("CoreService"),LS=lt("CharsetService"),bl=lt("InstantiationService"),nf=lt("LogService"),bt=lt("OptionsService"),of=lt("OscLinkService"),BS=lt("UnicodeService"),kr=lt("DecorationService"),Fo=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 i=[],r=this._optionsService.rawOptions.linkHandler,o=new Wt,a=s.getTrimmedLength(),l=-1,h=-1,c=!1;for(let d=0;d<a;d++)if(!(h===-1&&!s.hasContent(d))){if(s.loadCell(d,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=d,l=o.extended.urlId;continue}else c=o.extended.urlId!==l;else h!==-1&&(c=!0);if(c||h!==-1&&d===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:h+1,y:t},end:{x:d+(!c&&d===a-1?1:0),y:t}},m=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||i.push({text:u,range:f,activate:(p,g)=>r?r.activate(p,g,f):MS(p,g),hover:(p,g)=>r?.hover?.(p,g,f),leave:(p,g)=>r?.leave?.(p,g,f)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=d,l=o.extended.urlId):(h=-1,l=-1)}}e(i)}};Fo=Ve([ue(0,xt),ue(1,bt),ue(2,of)],Fo);function MS(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
486
486
|
|
|
487
487
|
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 $n=lt("CharSizeService"),Ss=lt("CoreBrowserService"),yl=lt("MouseService"),ws=lt("RenderService"),OS=lt("SelectionService"),af=lt("CharacterJoinerService"),Ti=lt("ThemeService"),lf=lt("LinkProviderService"),$S=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Ac.isErrorNoTelemetry(t)?new Ac(t.message+`
|
|
488
488
|
|