decocms 3.36.8 → 3.37.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-diUVbO2-.js → AlertCircle-B8wgh1Ly.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-DZao7AcN.js → ArrowUpRight-DFourmXp.js} +1 -1
- package/dist/client/assets/{Check-BKIJF1cF.js → Check-D0urCyzd.js} +1 -1
- package/dist/client/assets/{CheckCircle-BEdczdw2.js → CheckCircle-Qyp95spV.js} +1 -1
- package/dist/client/assets/{ChevronDown-CibD7WLD.js → ChevronDown-DwPK2mcP.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DnwnYIMW.js → ChevronLeft-C357wJbK.js} +1 -1
- package/dist/client/assets/{ChevronRight-BkNktb2f.js → ChevronRight-pxM9WiYB.js} +1 -1
- package/dist/client/assets/{ChevronUp-DGD0GGvF.js → ChevronUp-DNp3BStr.js} +1 -1
- package/dist/client/assets/{Container-u2OVN7H1.js → Container-CwEfFXez.js} +1 -1
- package/dist/client/assets/{DotsVertical-CJXQkRAx.js → DotsVertical-DE_SmTP3.js} +1 -1
- package/dist/client/assets/{Eye-Dl4wUVA0.js → Eye-Cfv_RGHV.js} +1 -1
- package/dist/client/assets/{FilterLines-Ckb-C13v.js → FilterLines-91VA8muG.js} +1 -1
- package/dist/client/assets/{Globe01-DuXtiXmT.js → Globe01-ho0SCMcq.js} +1 -1
- package/dist/client/assets/{HardDrive-DsvvHov8.js → HardDrive-B_FOclPu.js} +1 -1
- package/dist/client/assets/{Key01-CamRGqdp.js → Key01-iwxkuIvh.js} +1 -1
- package/dist/client/assets/{LayoutLeft-RNub1vlB.js → LayoutLeft-UZ6_8WBi.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CkMjIxNM.js → LinkExternal01-Zwfdiaw5.js} +1 -1
- package/dist/client/assets/{Monitor01-CMEyE7XK.js → Monitor01-CwZrvxuC.js} +1 -1
- package/dist/client/assets/{Palette-3y8-lyYx.js → Palette-D6gsHlnc.js} +1 -1
- package/dist/client/assets/{Play-BWUsEKn-.js → Play-CvfmKRq2.js} +1 -1
- package/dist/client/assets/{Plus-CKCNLZUU.js → Plus-BCfK0mBl.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Gjck8qdC.js → RefreshCcw01-k5H1KZCV.js} +1 -1
- package/dist/client/assets/{SearchMd-C9j-gudR.js → SearchMd-CPNqbMGc.js} +1 -1
- package/dist/client/assets/{Settings02-CYtGjYiT.js → Settings02-sp3cCEp1.js} +1 -1
- package/dist/client/assets/{Shield01-CnPBBwr9.js → Shield01-BnTZT70O.js} +1 -1
- package/dist/client/assets/{Star01-DkjN3wmL.js → Star01-C3iVmnF7.js} +1 -1
- package/dist/client/assets/{Stars01-CGinyuoF.js → Stars01-spNf2CVt.js} +1 -1
- package/dist/client/assets/{Stars02-8XRN5mVg.js → Stars02-DTJjqSl_.js} +1 -1
- package/dist/client/assets/{Sun-B5JsbdJQ.js → Sun-Bd_n5MS2.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-D_ioy5qF.js → SwitchHorizontal01--RQkLq3s.js} +1 -1
- package/dist/client/assets/{Tool01-WP19hvhy.js → Tool01-UC0L2ZqT.js} +1 -1
- package/dist/client/assets/{Trash01-ysxYI5Wr.js → Trash01-C89-wTac.js} +1 -1
- package/dist/client/assets/{Upload01-BEUiJeg2.js → Upload01-CvoLArfG.js} +1 -1
- package/dist/client/assets/{User01--nPpP5WD.js → User01-CHDBPbMe.js} +1 -1
- package/dist/client/assets/{Users01-CJfUt2eU.js → Users01-AMiQvbzx.js} +1 -1
- package/dist/client/assets/{Users03-C0zNVryE.js → Users03-z8pz4cwj.js} +1 -1
- package/dist/client/assets/{X-Dk_6ic2Z.js → X-ncGdMje6.js} +1 -1
- package/dist/client/assets/{XCircle-CbslYmbl.js → XCircle-BOJh16Ag.js} +1 -1
- package/dist/client/assets/{XClose-MySSOydc.js → XClose-xAOdH2ec.js} +1 -1
- package/dist/client/assets/{Zap-qtt4gXCs.js → Zap-DRqUuFzT.js} +1 -1
- package/dist/client/assets/{ZapSquare-DiFDNaz3.js → ZapSquare-CgDDvUYJ.js} +1 -1
- package/dist/client/assets/{ZoomOut-BEjoQvI4.js → ZoomOut-BX0KAK4E.js} +1 -1
- package/dist/client/assets/{access-gate-ngcc1WVS.js → access-gate--AqGaZB3.js} +1 -1
- package/dist/client/assets/{accordion-BOcO2Sna.js → accordion-BuZO_I6n.js} +1 -1
- package/dist/client/assets/{add-section-modal-CJp9aW-b.js → add-section-modal-rYMlcfZK.js} +1 -1
- package/dist/client/assets/agent-capabilities-CqovZOHW.js +3 -0
- package/dist/client/assets/{agent-icon-DDCLA9rm.js → agent-icon-BSv2ZliY.js} +1 -1
- package/dist/client/assets/{agents-list-B0tfBLmN.js → agents-list-CmYCHfAQ.js} +1 -1
- package/dist/client/assets/{ai-providers-CFrOqxsn.js → ai-providers-6F9F9DIs.js} +1 -1
- package/dist/client/assets/{alert-BBvLAZ8F.js → alert-CcZNr6SG.js} +1 -1
- package/dist/client/assets/{alert-dialog-Czjj9xUL.js → alert-dialog-CAUF2lG9.js} +1 -1
- package/dist/client/assets/app-editor-B-eeqhg_.js +1 -0
- package/dist/client/assets/{auth-CiDtyFcv.js → auth-BL0nL9hg.js} +1 -1
- package/dist/client/assets/{auth-catchall-B0-jSWZU.js → auth-catchall-BOZa6JWc.js} +1 -1
- package/dist/client/assets/{auth-split-layout-BIBJaUjk.js → auth-split-layout-DPGpfEMf.js} +1 -1
- package/dist/client/assets/{automation-list-row-ComFNSHa.js → automation-list-row-6ykDco-o.js} +1 -1
- package/dist/client/assets/{automation-runs-CwgZcPxU.js → automation-runs-DqEY9N3m.js} +1 -1
- package/dist/client/assets/{automations-CmFLKPOX.js → automations-DYa5K7uf.js} +1 -1
- package/dist/client/assets/{avatar-B0oOQW3w.js → avatar-CKQTxZ1l.js} +1 -1
- package/dist/client/assets/{badge-CPbLyufC.js → badge-8nbtF57a.js} +1 -1
- package/dist/client/assets/{brand-context-BNo29QkS.js → brand-context-Keh-FgCI.js} +1 -1
- package/dist/client/assets/{buckets-BTWRkLl1.js → buckets-v205fCPo.js} +1 -1
- package/dist/client/assets/{calendar-LmdrkG8B.js → calendar-BvmyrwZT.js} +1 -1
- package/dist/client/assets/{capability-load-error-BU8SCPcT.js → capability-load-error-CgPvQ3DP.js} +1 -1
- package/dist/client/assets/{card-DdkEdLE9.js → card-CSrfjLPK.js} +1 -1
- package/dist/client/assets/chat-context-CX93kZ3t.js +21 -0
- package/dist/client/assets/{checkbox-BC4wIenO.js → checkbox-emZqfNka.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DL51rx0C.js → cli-auth-success-TnF4DMg7.js} +1 -1
- package/dist/client/assets/{collection-detail-BiWubvHL.js → collection-detail-BT1eAXzt.js} +1 -1
- package/dist/client/assets/{collection-display-button-tErBbn-6.js → collection-display-button-Cn53vdgk.js} +1 -1
- package/dist/client/assets/{collection-search-GY1bal72.js → collection-search-DtWJHNG9.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BLpY2FjH.js → collection-table-wrapper-5l1s21E3.js} +1 -1
- package/dist/client/assets/{collection-tabs-VcC-MXis.js → collection-tabs-BfVE1VBn.js} +1 -1
- package/dist/client/assets/{collections-DFUCvejZ.js → collections-CccDziah.js} +1 -1
- package/dist/client/assets/{command-DTlk4TO1.js → command-B9-QuD3I.js} +1 -1
- package/dist/client/assets/connect-desktop-dialog-Brphey_z.js +1 -0
- package/dist/client/assets/{connection-card-J_SBwL8x.js → connection-card-BT3OrnD0.js} +1 -1
- package/dist/client/assets/{connection-detail-BiRkgy_l.js → connection-detail-CbSv2HSL.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-BkqhduE1.js → connection-form-helpers-jwqRoSno.js} +1 -1
- package/dist/client/assets/{connections-BcU9kTAE.js → connections-Ye6Uy5rT.js} +1 -1
- package/dist/client/assets/{decopilot-BIeINY_s.js → decopilot-qvpc7Sek.js} +2 -2
- package/dist/client/assets/decopilot-sse-pool-C1TU9aOA.js +1 -0
- package/dist/client/assets/{dialog-BQ75yEwF.js → dialog-NPdsRr2K.js} +1 -1
- package/dist/client/assets/{domain-settings-e1Vus4xL.js → domain-settings-CkRknwBG.js} +1 -1
- package/dist/client/assets/{drawer-DHZ6TiZV.js → drawer-C8_o0ImI.js} +1 -1
- package/dist/client/assets/{dropdown-menu-C9Apf8St.js → dropdown-menu-B7tRotB5.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-uPTvMT1i.js → dynamic-plugin-layout-BOuZuhA_.js} +1 -1
- package/dist/client/assets/{empty-state-lFjdJT7F.js → empty-state-B5-XU_Qq.js} +1 -1
- package/dist/client/assets/{empty-state-DneBSEGo.js → empty-state-DAGj9d4y.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DY_wdsqB.js → extract-connection-data-gSFD29EZ.js} +1 -1
- package/dist/client/assets/{features-9TbsLZr4.js → features-d8fgsMPi.js} +1 -1
- package/dist/client/assets/{file-explorer-9WRP-9UQ.js → file-explorer-DQz3ihEX.js} +1 -1
- package/dist/client/assets/{file-type-icon-BMtzYhxY.js → file-type-icon-BQd_cgeD.js} +1 -1
- package/dist/client/assets/{files-Dhl8Q6Au.js → files-BbwS0mtG.js} +1 -1
- package/dist/client/assets/{form-CvLuR0Gb.js → form-Cj4RGsYg.js} +1 -1
- package/dist/client/assets/{general-2s032ZcY.js → general-BpEOoyW8.js} +1 -1
- package/dist/client/assets/{generate-id-Df1_2KNe.js → generate-id-ofakiB8n.js} +1 -1
- package/dist/client/assets/{github-repo-picker-DC8oHexa.js → github-repo-picker-mW07O8yJ.js} +1 -1
- package/dist/client/assets/{header-tab-button-BfAGzd8m.js → header-tab-button-D7VApmY0.js} +1 -1
- package/dist/client/assets/{hover-card-4KBIFi9j.js → hover-card-6VdpmsDU.js} +1 -1
- package/dist/client/assets/{image-field-KauoRkxt.js → image-field-Bcq-hVOg.js} +1 -1
- package/dist/client/assets/{index-6v8yQXXA.js → index-B9ecm8uM.js} +1 -1
- package/dist/client/assets/{index-D1RdoGnd.js → index-BtFMBt2v.js} +1 -1
- package/dist/client/assets/{index-CHcXeW8J.js → index-C81KKEdc.js} +1 -1
- package/dist/client/assets/{index-CZmaPtza.js → index-CH6rJ--L.js} +24 -24
- package/dist/client/assets/index-CTTuPnXB.js +1 -0
- package/dist/client/assets/{index-Bge_3NUT.js → index-CZc_n55l.js} +1 -1
- package/dist/client/assets/{index-BBsNs16v.js → index-Cl6oCTqk.js} +1 -1
- package/dist/client/assets/{index-CiA0zZvI.js → index-DF2vRBkT.js} +1 -1
- package/dist/client/assets/{index-D7zMM4W4.js → index-DGGjIheX.js} +3 -3
- package/dist/client/assets/{index-CfcqKeX1.js → index-DK5lK69Y.js} +1 -1
- package/dist/client/assets/{index-BkjOXm-U.js → index-DP7f4jv4.js} +1 -1
- package/dist/client/assets/{index-DAz0gT0O.js → index-Dx3qMd9z.js} +1 -1
- package/dist/client/assets/{index-DOOpysP1.js → index-b2M5sZOB.js} +1 -1
- package/dist/client/assets/{index-DY-zRdhZ.js → index-pTlAPI8b.js} +1 -1
- package/dist/client/assets/{index-redirect-DHEXmWaA.js → index-redirect-ByzWgrxP.js} +1 -1
- package/dist/client/assets/{index-DAqaT6Rd.js → index-u7WCkeqH.js} +1 -1
- package/dist/client/assets/{input-DlpqEr8E.js → input-DYsPOaw4.js} +1 -1
- package/dist/client/assets/{integration-icon-CBAKG0Pi.js → integration-icon-DPU9dY8x.js} +1 -1
- package/dist/client/assets/{label-BCg8KKvZ.js → label-Mdkg-a4K.js} +1 -1
- package/dist/client/assets/{layout-DXZ4W4co.js → layout-CU5iFDsE.js} +1 -1
- package/dist/client/assets/{login-CojfjNfQ.js → login-d0pplMa6.js} +1 -1
- package/dist/client/assets/{mcp-oauth-X7hs3Ag9.js → mcp-oauth-Volcctly.js} +1 -1
- package/dist/client/assets/{members-B8fViDTN.js → members-BK5L7JQD.js} +1 -1
- package/dist/client/assets/{monaco-editor-CIH-AKEP.js → monaco-editor-4CF0qu1C.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CCcAAEao.js → monitoring-stats-row-CFGsDpK7.js} +1 -1
- package/dist/client/assets/{oauth-callback-CZccUhJ6.js → oauth-callback-DhqXwpa8.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CFS2UJsP.js → oauth-callback-ai-provider-BHSpzZke.js} +1 -1
- package/dist/client/assets/{onboarding-BRAoHg0Y.js → onboarding-DUe6TykK.js} +1 -1
- package/dist/client/assets/{org-install-DcjkeQWQ.js → org-install-DamvG0TG.js} +1 -1
- package/dist/client/assets/{org-layout-CoTqhSTr.js → org-layout-3uHDqMYh.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-OiLrrpvb.js → org-plugin-layout-CP8-PFlP.js} +1 -1
- package/dist/client/assets/{page-seo-form-29P9gMgJ.js → page-seo-form-Co3gV6nS.js} +1 -1
- package/dist/client/assets/page-seo-sheet-DlQgt1ce.js +1 -0
- package/dist/client/assets/{pair-DbqLAr7H.js → pair-nJ1ZiPVr.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-clkVquTR.js → plugin-empty-state-B_fcTgAM.js} +1 -1
- package/dist/client/assets/{plugin-header-CvCFe8sm.js → plugin-header-zj7BhYV0.js} +1 -1
- package/dist/client/assets/{plugin-layout-bpk5-ppI.js → plugin-layout-BXugA7sH.js} +1 -1
- package/dist/client/assets/{popover-CGxVd8dj.js → popover-CCUenseZ.js} +1 -1
- package/dist/client/assets/{post-editor-BRDFK_L9.js → post-editor-BmGcYIO1.js} +1 -1
- package/dist/client/assets/{primitives-BjOQ6kiW.js → primitives-DDWQanLc.js} +1 -1
- package/dist/client/assets/{profile-DXYWvJhr.js → profile-pOgFJgzN.js} +1 -1
- package/dist/client/assets/project-app-view-DADZJkAJ.js +1 -0
- package/dist/client/assets/record-editor-DwZPV8Tp.js +1 -0
- package/dist/client/assets/registry-DpZxa23w.js +2 -0
- package/dist/client/assets/{registry-layout-KpLfwb01.js → registry-layout-vrycAExD.js} +1 -1
- package/dist/client/assets/{require-capability-siE8o61Y.js → require-capability-DDdNdDdz.js} +1 -1
- package/dist/client/assets/{required-auth-layout-B6wlMeXp.js → required-auth-layout-Dvl8wW25.js} +1 -1
- package/dist/client/assets/{reset-password-DMGhuy3g.js → reset-password-BO9Tpk_q.js} +1 -1
- package/dist/client/assets/{resizable-DvU979g4.js → resizable-FPwEQu4J.js} +1 -1
- package/dist/client/assets/{roles-BbRFWJFf.js → roles-B5S-JsJi.js} +1 -1
- package/dist/client/assets/save-referenced-block-xyiiUgMo.js +1 -0
- package/dist/client/assets/{save-status-DMf7Ki8m.js → save-status-CDo7AlvY.js} +1 -1
- package/dist/client/assets/{schema-form-CmUF2bFS.js → schema-form-B5X_jnCS.js} +1 -1
- package/dist/client/assets/{scroll-area-DAQuWOFc.js → scroll-area-86Op8ApP.js} +1 -1
- package/dist/client/assets/{search-input-C0c6vwO5.js → search-input-DFrDstX6.js} +1 -1
- package/dist/client/assets/{secrets-D1HBT99G.js → secrets-C4XubnGB.js} +1 -1
- package/dist/client/assets/{sections-editor-Bcy_4zFJ.js → sections-editor-BGpn_Sa9.js} +1 -1
- package/dist/client/assets/{select-BTJH3S1Y.js → select-DIImlu5H.js} +1 -1
- package/dist/client/assets/{select-model-DPxYg0zJ.js → select-model-DMM38IJD.js} +1 -1
- package/dist/client/assets/{seo-editor-b_pr82NE.js → seo-editor-tNuhLm3d.js} +1 -1
- package/dist/client/assets/{settings-layout-Daps0DJ2.js → settings-layout-tNiJIWIn.js} +1 -1
- package/dist/client/assets/{settings-section-B5i82NgR.js → settings-section-8TfsFzZk.js} +1 -1
- package/dist/client/assets/{sheet-CCipW2FH.js → sheet-qXjZ6ijq.js} +1 -1
- package/dist/client/assets/{shell-controls-Ce5fzkhT.js → shell-controls-YPeEwMMG.js} +1 -1
- package/dist/client/assets/{shell-layout-CTQMbW4a.js → shell-layout-BZuowLaO.js} +1 -1
- package/dist/client/assets/{shell-route-loading-BwBOB-GI.js → shell-route-loading-DLvkliSc.js} +1 -1
- package/dist/client/assets/{sidebar-vUZgGPF7.js → sidebar-DV_8rP5O.js} +1 -1
- package/dist/client/assets/{skeleton-DWiCZKLu.js → skeleton-BAqUrlIk.js} +1 -1
- package/dist/client/assets/{sortable.esm-B_SnIoCf.js → sortable.esm-CwxymQUp.js} +1 -1
- package/dist/client/assets/{spinner-Cf-IAzXM.js → spinner-BNJ1ntL6.js} +1 -1
- package/dist/client/assets/{sso-BVINRo2Z.js → sso-d2lJzN6l.js} +1 -1
- package/dist/client/assets/{store-BW1GY6_F.js → store-BnlTxhhC.js} +1 -1
- package/dist/client/assets/store-registry-BFDp8lS0.js +2 -0
- package/dist/client/assets/{studio-tools-LMNN2joX.js → studio-tools-VmDH_tkD.js} +1 -1
- package/dist/client/assets/{switch-DJP3r5vJ.js → switch-BLdRz6LH.js} +1 -1
- package/dist/client/assets/{tab-id-ByXHuOlI.js → tab-id-BuwvvoKA.js} +1 -1
- package/dist/client/assets/{table-B2KlLYRM.js → table-DLTcBxkL.js} +1 -1
- package/dist/client/assets/{tabs-V4XsHC7f.js → tabs-BfsyXeV7.js} +1 -1
- package/dist/client/assets/{task-status-CEXxjU1X.js → task-status-BebHkyud.js} +1 -1
- package/dist/client/assets/{textarea-Bc-j0SM5.js → textarea-DOxc062C.js} +1 -1
- package/dist/client/assets/{toggle-group-COWeQ2c6.js → toggle-group-CUnJVdhY.js} +1 -1
- package/dist/client/assets/{toolbar-PSYvcVzm.js → toolbar-C-goTyi1.js} +1 -1
- package/dist/client/assets/{tools-list-DTOKH1D-.js → tools-list-BMPh17xT.js} +1 -1
- package/dist/client/assets/{tooltip-B5iep7Ko.js → tooltip-AlbIxSnB.js} +1 -1
- package/dist/client/assets/{types-BAMtYEey.js → types-B6A14fRD.js} +1 -1
- package/dist/client/assets/{use-ai-providers-DzrkIvyk.js → use-ai-providers-Bm_rqURb.js} +1 -1
- package/dist/client/assets/{use-automations-tXwjiHAc.js → use-automations-BGZXYpIN.js} +1 -1
- package/dist/client/assets/{use-capability-DXVx5Xxx.js → use-capability-JDGz96yw.js} +1 -1
- package/dist/client/assets/{use-clock-tick-BDCCVICH.js → use-clock-tick-ApetjkK0.js} +1 -1
- package/dist/client/assets/{use-collections-DxiinEjJ.js → use-collections-X9suE0Rz.js} +1 -1
- package/dist/client/assets/{use-connection-7gOEmOWX.js → use-connection-H42b0qTa.js} +1 -1
- package/dist/client/assets/{use-copy-CRVb47fM.js → use-copy-Ch4eJC6W.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CjtM4q6t.js → use-create-virtual-mcp-BiMPRmS0.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DeRUhFjV.js → use-debounced-autosave-bupcMtLI.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CKkxX1yi.js → use-delete-connection--wxVFqSC.js} +1 -1
- package/dist/client/assets/{use-file-configs-DihB1CSn.js → use-file-configs-B-TRPlGa.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-D1XgBgMg.js → use-infinite-scroll-CD71xyIK.js} +1 -1
- package/dist/client/assets/{use-list-state-CqG6kyCV.js → use-list-state-7-M0Oy-p.js} +1 -1
- package/dist/client/assets/{use-mcp-client-CrjmswbX.js → use-mcp-client-DVIPuDIp.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-CcgUU2va.js → use-mcp-prompts-Cc0asrBz.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-SSgHcUph.js → use-mcp-tools-Ce2De-n9.js} +1 -1
- package/dist/client/assets/{use-members-7_urfNyQ.js → use-members-1AkYrlKa.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BkTVNUaN.js → use-navigate-to-agent-BIO7CjS7.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-45Kq_uI1.js → use-org-auth-client-Dd-mOXzl.js} +1 -1
- package/dist/client/assets/{use-org-sso-gUWGH-aK.js → use-org-sso-DGDlZviB.js} +1 -1
- package/dist/client/assets/{use-organization-roles-lBuv_PBX.js → use-organization-roles-CjQiMsg2.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CNaysSS7.js → use-organization-settings-DVnlfq4p.js} +1 -1
- package/dist/client/assets/use-registry-connections-DhiOfiCw.js +1 -0
- package/dist/client/assets/{use-secrets-CFUYkFk-.js → use-secrets-BiDXoWq-.js} +1 -1
- package/dist/client/assets/{use-status-sounds-B3I8SIeo.js → use-status-sounds--1cQ7Gwq.js} +1 -1
- package/dist/client/assets/{use-view-mode-Br-x5WnV.js → use-view-mode-Bc8_FKXN.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-YDOoOiIE.js → use-virtual-mcp-D9H9aNMJ.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DBPdoIhC.js +1 -0
- package/dist/client/assets/{useRouterState-B-4iWxA3.js → useRouterState-Ba9Tqr45.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BGLS34hq.js +1 -0
- package/dist/client/assets/{user-XzqpqM8M.js → user-CfS8x4lp.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-EHbZdESt.js → view-mode-toggle-DaV2KCBn.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-B2UHmnkn.js → watch-sse-pool-CbLJ0uWL.js} +1 -1
- package/dist/client/assets/{workflow-BvCi7RsT.js → workflow-BwGcPmPE.js} +1 -1
- package/dist/client/assets/workflow-detail-CYjYJeGk.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +425 -425
- package/dist/server/server.js +256 -256
- package/package.json +1 -1
- package/dist/client/assets/agent-capabilities-DYA4_FQC.js +0 -3
- package/dist/client/assets/app-editor-BHLxWfgZ.js +0 -1
- package/dist/client/assets/chat-context-CD2JvZDF.js +0 -21
- package/dist/client/assets/connect-desktop-dialog-SmaY4SKp.js +0 -1
- package/dist/client/assets/decopilot-sse-pool-BXXKMHET.js +0 -1
- package/dist/client/assets/index-DRHoPy-V.js +0 -1
- package/dist/client/assets/page-seo-sheet-SyZrVZNj.js +0 -1
- package/dist/client/assets/project-app-view-BJauens7.js +0 -1
- package/dist/client/assets/record-editor-ZJ1XN9iZ.js +0 -1
- package/dist/client/assets/registry-BSzFy0xA.js +0 -2
- package/dist/client/assets/save-referenced-block-lBPwVOlw.js +0 -1
- package/dist/client/assets/store-registry-GHPfrbOP.js +0 -2
- package/dist/client/assets/use-registry-connections-CC5drynS.js +0 -1
- package/dist/client/assets/useInfiniteQuery-B4yLyRTD.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BfueowGJ.js +0 -1
- package/dist/client/assets/workflow-detail-BmwDA1AR.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{F as Be,r as w,ar as zs,ap as Bs,e as O,p as le,c as B,j as s,E as Us,n as ae,P as pe,aE as Ks,R as _e,aF as Pt,L as qs,B as re,G as Qs,H as Ys,aG as Hs,aH as Gs,Y as Ie,C as Ws,aI as Pe,aJ as Wt,f as st,a as Dt,t as G,aK as Js,s as Rn,M as Zs,T as Xs,aL as er,b as Tn,aM as tr,aN as Pn,aO as nr,aP as ce,aQ as xt,aR as sr,aS as rr,aT as gt,aU as or,aV as ar,aW as ir,aX as lr,q as cr,K as Oe,aY as ur,aZ as dr,a_ as Vr,a$ as fr,b0 as Dn,b1 as Fe,m as mr,l as pr,D as Mn}from"./index-DGGjIheX.js";import{b as Ve,u as Ue,c as rt,a as hr,e as xr,f as Fn,A as gr,g as br}from"./chat-context-CX93kZ3t.js";import{e as On,s as ot,g as ue,P as Je,f as Mt,t as vr,h as yr,M as Ar,i as jr,j as Le,k as wr,l as Sr,F as Cr,c as Nr,S as kr,m as _r,n as Jt}from"./pair-nJ1ZiPVr.js";import{S as St}from"./spinner-BNJ1ntL6.js";import{c as Ct,u as Ir,T as he,a as xe,b as ge}from"./tooltip-AlbIxSnB.js";import{b as at,c as it,a as lt,D as ct,e as Ft}from"./dialog-NPdsRr2K.js";import{c as Er,D as Rr,a as Tr,b as Pr}from"./drawer-C8_o0ImI.js";import{C as Dr}from"./collection-search-DtWJHNG9.js";import{g as ut,u as Ee,a as Mr,i as Zt}from"./use-mcp-client-DVIPuDIp.js";import{u as Fr,g as dt,l as Nt}from"./use-mcp-prompts-Cc0asrBz.js";import{t as Vt}from"./ChevronDown-DwPK2mcP.js";import{i as De}from"./X-ncGdMje6.js";import{t as Or,z as Lr,u as $r,w as zr,A as Br}from"./tab-id-BuwvvoKA.js";import{K as Ur,i as Kr}from"./shell-layout-BZuowLaO.js";import{a as qr,u as Qr}from"./use-virtual-mcp-D9H9aNMJ.js";import{i as Yr}from"./SwitchHorizontal01--RQkLq3s.js";import{n as Ln}from"./ZapSquare-CgDDvUYJ.js";import{i as Ke}from"./Check-D0urCyzd.js";import{s as $n}from"./Star01-C3iVmnF7.js";import{a as zn}from"./Tool01-UC0L2ZqT.js";import{a1 as ft,o as Hr,M as Bn,a2 as Gr,A as Un,i as He,b as Wr,P as Jr,a3 as Zr,s as Xr,a4 as eo,a5 as to,Y as Kn}from"./agent-icon-BSv2ZliY.js";import{i as no}from"./Upload01-CvoLArfG.js";import{i as qn}from"./AlertCircle-B8wgh1Ly.js";import{a as so}from"./Eye-Cfv_RGHV.js";import{a as kt,b as Ot,d as Lt,f as $t,F as Qn}from"./form-Cj4RGsYg.js";import{b as ro,d as oo,c as ao,S as io,a as lo}from"./select-DIImlu5H.js";import{i as co}from"./RefreshCcw01-k5H1KZCV.js";import{a as Yn,t as _t,b as uo}from"./XCircle-BOJh16Ag.js";import{b as Vo,c as fo}from"./tabs-BfsyXeV7.js";import{T as Hn,a as Ze}from"./toggle-group-CUnJVdhY.js";import{I as Gn}from"./input-DYsPOaw4.js";import{u as Wn,g as Jn,A as mo}from"./sortable.esm-CwxymQUp.js";import{u as Zn}from"./studio-tools-VmDH_tkD.js";import{i as zt}from"./Monitor01-CwZrvxuC.js";import{u as Xn,C as po,a as es,b as ts}from"./connect-desktop-dialog-Brphey_z.js";import{m as mt,i as ho,g as ns,a as xo,N as go}from"./decopilot-qvpc7Sek.js";import{P as Bt,a as Ut,b as Kt}from"./popover-CCUenseZ.js";import{a as Xt,e as en,f as bo,c as vo,C as yo,d as Ao,b as jo}from"./command-B9-QuD3I.js";import{u as wo}from"./useInfiniteQuery-DBPdoIhC.js";import{t as So}from"./Stars01-spNf2CVt.js";import{P as It,a as Co,b as No,u as ko,E as _o,c as qt,i as Io,d as Eo}from"./scroll-area-86Op8ApP.js";import{S as Ro}from"./index-BtFMBt2v.js";import{D as To,a as Po,b as Do,c as fe,d as tn,e as nn,f as sn,h as Mo,i as Fo}from"./dropdown-menu-B7tRotB5.js";import{s as rn}from"./Plus-BCfK0mBl.js";import{p as Oo,q as Lo}from"./question-004-sINsf4GQ.js";import{i as $o}from"./ChevronRight-pxM9WiYB.js";function zo(t,e){const n=Be(e);return Bo({filters:{...t,status:"pending"}},n).length}function on(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function Bo(t={},e){const n=Be(e).getMutationCache(),r=w.useRef(t),o=w.useRef(null);return o.current===null&&(o.current=on(n,t)),w.useEffect(()=>{r.current=t}),w.useSyncExternalStore(w.useCallback(a=>n.subscribe(()=>{const i=zs(o.current,on(n,r.current));o.current!==i&&(o.current=i,Bs.schedule(a))}),[n]),()=>o.current,()=>o.current)}const an=3,ss="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",Uo="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function rs(t){const e=O.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:i}=t,c=i===void 0?"pill":i,{prompt:u}=n;let d;if(e[0]!==u._meta||e[1]!==u.name||e[2]!==u.title){const k=ue(u._meta);d=u.title??Mt(u.name,k),e[0]=u._meta,e[1]=u.name,e[2]=u.title,e[3]=d}else d=e[3];const V=d,l=u.description||null;if(c==="card"){let k;e[4]!==r||e[5]!==u?(k=()=>r(u),e[4]=r,e[5]=u,e[6]=k):k=e[6];const S=a||o,C=o&&"bg-accent/40",D=(a||o)&&"cursor-not-allowed opacity-50";let N;e[7]!==C||e[8]!==D?(N=B(Uo,"hover:bg-accent/60 text-foreground",C,D),e[7]=C,e[8]=D,e[9]=N):N=e[9];let P;e[10]!==V?(P=s.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=P):P=e[11];let T;e[12]!==o?(T=o&&s.jsx(St,{size:"xs"}),e[12]=o,e[13]=T):T=e[13];let _;e[14]!==P||e[15]!==T?(_=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[P,T]}),e[14]=P,e[15]=T,e[16]=_):_=e[16];let R;e[17]!==l?(R=l&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:l}),e[17]=l,e[18]=R):R=e[18];let F;return e[19]!==_||e[20]!==R||e[21]!==k||e[22]!==S||e[23]!==N?(F=s.jsxs("button",{type:"button",onClick:k,disabled:S,className:N,children:[_,R]}),e[19]=_,e[20]=R,e[21]=k,e[22]=S,e[23]=N,e[24]=F):F=e[24],F}let m;e[25]!==r||e[26]!==u?(m=()=>r(u),e[25]=r,e[26]=u,e[27]=m):m=e[27];const f=a||o,x=o&&"bg-muted/50",p=(a||o)&&"cursor-not-allowed opacity-50";let h;e[28]!==x||e[29]!==p?(h=B(ss,"hover:bg-muted/70 hover:text-foreground",x,p),e[28]=x,e[29]=p,e[30]=h):h=e[30];let b;e[31]!==V?(b=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=b):b=e[32];let g;e[33]!==o?(g=o&&s.jsx(St,{size:"xs"}),e[33]=o,e[34]=g):g=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==h||e[38]!==b||e[39]!==g?(v=s.jsx(he,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:h,children:[b,g]})}),e[35]=m,e[36]=f,e[37]=h,e[38]=b,e[39]=g,e[40]=v):v=e[40];const y=l??V;let A;e[41]!==y?(A=s.jsx(xe,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=A):A=e[42];let j;return e[43]!==v||e[44]!==A?(j=s.jsxs(ge,{delayDuration:400,children:[v,A]}),e[43]=v,e[44]=A,e[45]=j):j=e[45],j}function Ko(t){const e=O.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:i}=t,[c,u]=w.useState(""),d=!!i;let V;e[0]!==n||e[1]!==c?(V=c.trim()?n.filter(S=>{const C=c.toLowerCase();return S.prompt.name.toLowerCase().includes(C)||(S.prompt.title??"").toLowerCase().includes(C)||(S.prompt.description??"").toLowerCase().includes(C)}):n,e[0]=n,e[1]=c,e[2]=V):V=e[2];const l=V,m=Ir();let f;e[3]!==l.length||e[4]!==c?(f=l.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=l.length,e[4]=c,e[5]=f):f=e[5];let x;if(e[6]!==l||e[7]!==d||e[8]!==i?.name||e[9]!==o||e[10]!==a){let S;e[12]!==d||e[13]!==i?.name||e[14]!==o||e[15]!==a?(S=C=>s.jsx(rs,{item:C,variant:"card",onSelect:D=>{o(!1),a(D)},isLoading:i?.name===C.prompt.name,isDisabled:d&&i?.name!==C.prompt.name},C.prompt.name),e[12]=d,e[13]=i?.name,e[14]=o,e[15]=a,e[16]=S):S=e[16],x=l.map(S),e[6]=l,e[7]=d,e[8]=i?.name,e[9]=o,e[10]=a,e[11]=x}else x=e[11];let p;e[17]!==f||e[18]!==x?(p=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,x]})}),e[17]=f,e[18]=x,e[19]=p):p=e[19];const h=p;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=S=>{S.key==="Escape"&&u("")},e[20]=b):b=e[20];let g;e[21]!==c?(g=s.jsx(Dr,{value:c,onChange:u,placeholder:"Search prompts...",onKeyDown:b}),e[21]=c,e[22]=g):g=e[22];const v=g;if(m){let S;e[23]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Er,{className:"sr-only",children:s.jsx(Rr,{children:"All prompts"})}),e[23]=S):S=e[23];let C;e[24]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=C):C=e[24];let D;e[25]!==h||e[26]!==v?(D=s.jsxs(Tr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[S,C,v,h]}),e[25]=h,e[26]=v,e[27]=D):D=e[27];let N;return e[28]!==o||e[29]!==r||e[30]!==D?(N=s.jsx(Ct,{delayDuration:400,children:s.jsx(Pr,{open:r,onOpenChange:o,children:D})}),e[28]=o,e[29]=r,e[30]=D,e[31]=N):N=e[31],N}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(at,{className:"sr-only",children:s.jsx(it,{children:"All prompts"})}),e[32]=y):y=e[32];let A;e[33]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=A):A=e[33];let j;e[34]!==h||e[35]!==v?(j=s.jsxs(lt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,A,v,h]}),e[34]=h,e[35]=v,e[36]=j):j=e[36];let k;return e[37]!==o||e[38]!==r||e[39]!==j?(k=s.jsx(Ct,{delayDuration:400,children:s.jsx(ct,{open:r,onOpenChange:o,children:j})}),e[37]=o,e[38]=r,e[39]=j,e[40]=k):k=e[40],k}function qo(t){const e=O.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[i,c]=w.useState(!1);if(n.length===0)return null;let u,d,V;if(e[0]!==n||e[1]!==o||e[2]!==r){const b=n.slice(0,an);let g;e[6]!==n?(g=n.slice(an),e[6]=n,e[7]=g):g=e[7],u=g,d=!!o;let v;e[8]!==d||e[9]!==o?.name||e[10]!==r?(v=y=>s.jsx(rs,{item:y,onSelect:r,isLoading:o?.name===y.prompt.name,isDisabled:d&&o?.name!==y.prompt.name},y.prompt.name),e[8]=d,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],V=b.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=u,e[4]=d,e[5]=V}else u=e[3],d=e[4],V=e[5];const l=V;let m;e[12]!==a?(m=B("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==u.length||e[15]!==d?(f=u.length>0&&s.jsxs("button",{type:"button",disabled:d,onClick:()=>c(!0),className:B(ss,"hover:bg-muted/70 hover:text-foreground",d&&"opacity-50 cursor-not-allowed"),children:["+",u.length," more"]}),e[14]=u.length,e[15]=d,e[16]=f):f=e[16];let x;e[17]!==l||e[18]!==m||e[19]!==f?(x=s.jsxs("div",{className:m,children:[l,f]}),e[17]=l,e[18]=m,e[19]=f,e[20]=x):x=e[20];let p;e[21]!==n||e[22]!==o||e[23]!==i||e[24]!==r?(p=s.jsx(Ko,{items:n,open:i,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=i,e[24]=r,e[25]=p):p=e[25];let h;return e[26]!==x||e[27]!==p?(h=s.jsxs(Ct,{delayDuration:400,children:[x,p]}),e[26]=x,e[27]=p,e[28]=h):h=e[28],h}function Qo(){return null}function Yo(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function Ho(t){const e=O.c(30),{connectionId:n}=t,{sendMessage:r}=Ue(),{org:o}=le();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const i=Ee(a);let c;e[4]!==i?(c={client:i,staleTime:6e4},e[4]=i,e[5]=c):c=e[5];const{data:u}=Fr(c);let d;e[6]!==u?.prompts?(d=u?.prompts??[],e[6]=u?.prompts,e[7]=d):d=e[7];const V=d;let l;e[8]!==V?(l=V.map(Go),e[8]=V,e[9]=l):l=e[9];const m=l;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[x,p]=w.useReducer(Yo,f),[h,b]=w.useState(null);let g;e[11]!==i||e[12]!==r?(g=async(T,_)=>{if(!i){ae.error("MCP client not available"),p({type:"RESET"});return}try{const R=await dt(i,T.name,_);p({type:"RESET"});const F={type:"doc",content:[{type:"paragraph",content:[On({id:T.name,name:ot(T.name,ue(T._meta)),metadata:R.messages,char:"/",kind:"prompt",args:_}),{type:"text",text:" "}]}]};await r(F)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),ae.error("Failed to load prompt. Please try again."),p({type:"RESET"})}},e[11]=i,e[12]=r,e[13]=g):g=e[13];const v=g;let y;e[14]!==v?(y=async T=>{if(T.arguments&&T.arguments.length>0){p({type:"SELECT_PROMPT",prompt:T}),b(T);return}p({type:"START_LOADING",prompt:T}),await v(T)},e[14]=v,e[15]=y):y=e[15];const A=y;let j;e[16]!==h||e[17]!==v?(j=async T=>{h&&(p({type:"START_LOADING",prompt:h,arguments:T}),b(null),await v(h,T))},e[16]=h,e[17]=v,e[18]=j):j=e[18];const k=j;if(m.length===0)return null;const S=x.stage==="loading"?x.prompt:null;let C;e[19]!==A||e[20]!==m||e[21]!==S?(C=s.jsx(qo,{items:m,onSelect:A,loadingPrompt:S}),e[19]=A,e[20]=m,e[21]=S,e[22]=C):C=e[22];let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=()=>{b(null),p({type:"RESET"})},e[23]=D):D=e[23];let N;e[24]!==h||e[25]!==k?(N=s.jsx(Je,{prompt:h,setPrompt:D,onSubmit:k}),e[24]=h,e[25]=k,e[26]=N):N=e[26];let P;return e[27]!==C||e[28]!==N?(P=s.jsxs(s.Fragment,{children:[C,N]}),e[27]=C,e[28]=N,e[29]=P):P=e[29],P}function Go(t){return{prompt:t}}function Wo(t){const e=O.c(13),{className:n}=t,{selectedVirtualMcp:r}=Ve(),{org:o}=le();let a;e[0]!==o.id?(a=ut(o.id),e[0]=o.id,e[1]=a):a=e[1];const i=a.id,c=r?.id??i;let u;e[2]!==n?(u=B("w-full @container",n),e[2]=n,e[3]=u):u=e[3];const d=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(Qo,{}),e[4]=V):V=e[4];let l;e[5]!==c?(l=s.jsx(Ho,{connectionId:c}),e[5]=c,e[6]=l):l=e[6];let m;e[7]!==d||e[8]!==l?(m=s.jsx(Us,{fallback:null,children:s.jsx(w.Suspense,{fallback:V,children:l},d)}),e[7]=d,e[8]=l,e[9]=m):m=e[9];let f;return e[10]!==u||e[11]!==m?(f=s.jsx("div",{className:u,children:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f}const bt="cubic-bezier(0.645, 0.045, 0.355, 1)",Jo=44,Zo={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},Xo={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},ea={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function de(t){const e=O.c(61),{icon:n,label:r,count:o,title:a,footerLeft:i,footerRight:c,children:u,defaultExpanded:d,variant:V,onClose:l}=t,m=V===void 0?"default":V,[f,x]=w.useState(d),[p,h]=w.useState(!1);let b;e[0]!==l?(b=()=>{h(!0),l?.()},e[0]=l,e[1]=b):b=e[1];const g=b;if(p)return null;const v=Xo[m],y=Zo[m];let A;e[2]!==v||e[3]!==y?(A=B("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,y),e[2]=v,e[3]=y,e[4]=A):A=e[4];let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=()=>x(ta),e[5]=j):j=e[5];const k=f&&"rounded-b-none",S=!f&&"rounded-b-xl";let C;e[6]!==k||e[7]!==S?(C=B("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,S),e[6]=k,e[7]=S,e[8]=C):C=e[8];const D=ea[m];let N;e[9]!==D?(N=B("shrink-0",D),e[9]=D,e[10]=N):N=e[10];let P;e[11]!==n||e[12]!==N?(P=s.jsx("span",{className:N,children:n}),e[11]=n,e[12]=N,e[13]=P):P=e[13];let T;e[14]!==r?(T=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=T):T=e[15];let _;e[16]!==o?(_=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=_):_=e[17];const R=f?"rotate(180deg)":"rotate(0deg)";let F;e[18]!==R?(F=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(Vt,{size:16,style:{transform:R,transition:`transform 180ms ${bt}`}})}),e[18]=R,e[19]=F):F=e[19];let E,I;e[20]!==g?(E=Z=>{Z.stopPropagation(),g()},I=Z=>{(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),Z.stopPropagation(),g())},e[20]=g,e[21]=E,e[22]=I):(E=e[21],I=e[22]);let $;e[23]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(De,{size:16}),e[23]=$):$=e[23];let z;e[24]!==E||e[25]!==I?(z=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:E,onKeyDown:I,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:$}),e[24]=E,e[25]=I,e[26]=z):z=e[26];let L;e[27]!==f||e[28]!==P||e[29]!==T||e[30]!==_||e[31]!==F||e[32]!==z||e[33]!==C?(L=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:j,className:C,children:[P,T,_,F,z]}),e[27]=f,e[28]=P,e[29]=T,e[30]=_,e[31]=F,e[32]=z,e[33]=C,e[34]=L):L=e[34];const Q=f?"1fr":"0fr";let M;e[35]!==Q?(M={display:"grid",gridTemplateRows:Q,transition:`grid-template-rows 180ms ${bt}`},e[35]=Q,e[36]=M):M=e[36];let U;e[37]===Symbol.for("react.memo_cache_sentinel")?(U={overflow:"hidden",minHeight:0},e[37]=U):U=e[37];const q=f?1:0;let K;e[38]!==q?(K={opacity:q,transition:`opacity 120ms ${bt}`},e[38]=q,e[39]=K):K=e[39];let Y;e[40]!==a?(Y=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=Y):Y=e[41];let ne;e[42]!==u||e[43]!==a?(ne=u?s.jsx("div",{className:B("overflow-clip pb-4",!a&&"pt-4"),children:u}):null,e[42]=u,e[43]=a,e[44]=ne):ne=e[44];let X;e[45]!==i||e[46]!==c?(X=i||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:i}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=i,e[46]=c,e[47]=X):X=e[47];let ee;e[48]!==K||e[49]!==Y||e[50]!==ne||e[51]!==X?(ee=s.jsx("div",{style:U,children:s.jsxs("div",{style:K,children:[Y,ne,X]})}),e[48]=K,e[49]=Y,e[50]=ne,e[51]=X,e[52]=ee):ee=e[52];let W;e[53]!==M||e[54]!==ee?(W=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:M,children:ee}),e[53]=M,e[54]=ee,e[55]=W):W=e[55];let J;return e[56]!==L||e[57]!==W||e[58]!==A||e[59]!==m?(J=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:A,children:[L,W]}),e[56]=L,e[57]=W,e[58]=A,e[59]=m,e[60]=J):J=e[60],J}function ta(t){return!t}const na=pe({content:_e().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Pt(["pending","in_progress","completed"]),activeForm:_e().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),os=pe({todos:Ks(na)}),sa="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";Or({description:sa,inputSchema:Lr(os),execute:async({todos:t})=>({ok:!0,count:t.length})});const ra="tool-todo_write",oa=new Set(["input-available","output-available"]);function as(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==ra||typeof a.state!="string"||!oa.has(a.state))continue;const i=os.safeParse(a.input);if(i.success)return i.data.todos}}return[]}function is(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:vr(yr(r)),input:n.input})}return e}function ls(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function aa(t){return t?t.message.startsWith("[CREDITS]"):!1}const ia={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function la(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&aa(n))return{...ia,isCreditExhausted:!0};const i=e.at(-1),c=i?.role==="assistant"?i.parts:[],u=c,V=!!u.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,l=ls(c),m=is(u),f=as(e),x=!o&&!!n,p=m.length>0||o&&a,h=l.length>0,g=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||p||h))&&!x;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:x,showWarning:g,hasApprovals:p,hasPlans:h,isWaitingForUserInput:V}}function cs(){const t=O.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Ue(),i=n??null,c=r??null;let u;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==i||t[4]!==c?(u=la({messages:e,error:i,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=i,t[4]=c,t[5]=u):u=t[5],u}function ca(){const t=cs();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function us(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const ua="__home__";function Qt(t,e){return qs.chatDraft(t,e)}function da(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function Va(t,e,n,r,o){const a=Qt(e,n);if(us(r)){t.removeItem(a);return}const i={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(i);try{t.setItem(a,c)}catch(u){if(ma(u)){const d=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:d});return}throw u}}function ln(t,e,n){const r=Qt(e,n),o=t.getItem(r),a=da(o);return o!==null&&a===null&&t.removeItem(r),a}function fa(t,e,n){t.removeItem(Qt(e,n))}function ma(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function pa(t){const e=O.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const i=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let u;e[0]!==c?(u=B("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=u):u=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(co,{size:14}),e[2]=d):d=e[2];let V;e[3]!==o||e[4]!==i||e[5]!==u?(V=s.jsx("button",{type:"button",onClick:o,disabled:i,className:u,"aria-label":"Previous question",children:d}),e[3]=o,e[4]=i,e[5]=u,e[6]=V):V=e[6];const l=n+1;let m;e[7]!==l||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[l," of ",r]}),e[7]=l,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,x=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let p;e[10]!==x?(p=B("p-0.5 rounded transition-colors",x),e[10]=x,e[11]=p):p=e[11];let h;e[12]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Yn,{size:14}),e[12]=h):h=e[12];let b;e[13]!==a||e[14]!==p||e[15]!==f?(b=s.jsx("button",{type:"button",onClick:a,disabled:f,className:p,"aria-label":"Next question",children:h}),e[13]=a,e[14]=p,e[15]=f,e[16]=b):b=e[16];let g;return e[17]!==b||e[18]!==V||e[19]!==m?(g=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,b]}),e[17]=b,e[18]=V,e[19]=m,e[20]=g):g=e[20],g}function ds(t){const e=O.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:i}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(pa,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let u;return e[5]!==i||e[6]!==c?(u=s.jsxs("div",{className:"flex items-center gap-2",children:[c,i]}),e[5]=i,e[6]=c,e[7]=u):u=e[7],u}function ha(t){const e=O.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:i,nextLabel:c}=t,V=r?i===void 0?"Submit":i:c===void 0?"Next":c,l=r?n:!o,m=l?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==l||e[1]!==a?(f=()=>{l||a()},e[0]=l,e[1]=a,e[2]=f):f=e[2];const x=l&&"opacity-50 cursor-not-allowed";let p;e[3]!==x?(p=B("h-7 px-2.5 text-xs",x),e[3]=x,e[4]=p):p=e[4];let h;e[5]!==l||e[6]!==V||e[7]!==f||e[8]!==p?(h=s.jsx(re,{type:"button",size:"sm","aria-disabled":l,onClick:f,className:p,children:V}),e[5]=l,e[6]=V,e[7]=f,e[8]=p,e[9]=h):h=e[9];const b=h;if(!m)return b;let g;e[10]!==b?(g=s.jsx(he,{asChild:!0,children:b}),e[10]=b,e[11]=g):g=e[11];let v;e[12]!==m?(v=s.jsx(xe,{children:m}),e[12]=m,e[13]=v):v=e[13];let y;return e[14]!==g||e[15]!==v?(y=s.jsxs(ge,{children:[g,v]}),e[14]=g,e[15]=v,e[16]=y):y=e[16],y}function Vs(t,e,n){return t.findIndex(r=>e(r)===n)}function cn(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function un(t,e,n,r,o){if(t.length===0)return null;const a=Vs(t,e,o);for(let i=1;i<=t.length;i++){const c=t[(a+i)%t.length];if(!c)continue;const u=e(c);if(u!==o&&!r(n[u]))return u}return null}function xa(t){return!t.isStreaming&&t.allAnswered}function fs(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:i,onSubmit:c}=t,u=e[0]?n(e[0]):"",[d,V]=w.useState(u),[l,m]=w.useState(!1),f=Qs({resolver:Ys(r),defaultValues:o}),x=f.watch(),p=Vs(e,n,d),h=p>=0?e[p]:void 0,b=i(x[d]),g=cn(e,n,x,i),v=xa({isStreaming:a,allAnswered:g}),y=()=>{if(p>0){const N=e[p-1];N&&V(n(N))}},A=()=>{if(p>=0&&p<e.length-1){const N=e[p+1];N&&V(n(N))}},j=()=>{const N=f.getValues(),P=un(e,n,N,i,d);P&&V(P)},k=()=>{f.handleSubmit(N=>{const P=N;for(const T of e)c(T,P[n(T)])})()},S=w.useRef(k);S.current=k;const C=()=>{v&&(m(!1),S.current())},D=()=>{const N=f.getValues();if(cn(e,n,N,i)){if(a){m(!0);return}m(!1),S.current()}else{const P=un(e,n,N,i,d);P&&V(P)}};return w.useEffect(()=>{if(l&&!a){if(!g){m(!1);return}m(!1),S.current()}},[l,a,g]),{form:f,activeKey:d,setActiveKey:V,currentIndex:p,currentPart:h,isCurrentAnswered:b,isAllAnswered:g,canSubmit:v,goPrev:y,goNext:A,advanceToNextUnanswered:j,submit:C,submitOrAdvance:D}}const ms="User denied this tool call, give other alternatives.";function ps(t){const e=O.c(9),{onYolo:n}=t,[r,o]=Ie();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=V=>{const l=V;o({...r,toolApprovalLevel:l}),l==="auto"&&n(l)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const i=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(io,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:ba,children:s.jsx(lo,{})}),e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ro,{children:Pe.map(ga)}),e[5]=u):u=e[5];let d;return e[6]!==i||e[7]!==r.toolApprovalLevel?(d=s.jsxs(oo,{value:r.toolApprovalLevel,onValueChange:i,children:[c,u]}),e[6]=i,e[7]=r.toolApprovalLevel,e[8]=d):d=e[8],d}function ga(t){return s.jsx(ao,{value:t.value,children:t.label},t.value)}function ba(t){return t.stopPropagation()}function hs(t){const e=O.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[3]=r,e[4]=o):o=e[4],o}function va(t){const e=O.c(28),{approval:n,onRespond:r}=t,[o]=Ie(),a=o.toolApprovalLevel??"readonly";let i;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(i=()=>r(n.approvalId,!1,ms,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=i):i=e[3];const c=i;let u;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(u=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=u):u=e[7];const d=u;let V;e[8]!==n.approvalId||e[9]!==r?(V=A=>r(n.approvalId,!0,void 0,A),e[8]=n.approvalId,e[9]=r,e[10]=V):V=e[10];const l=V;let m;e[11]!==l?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(ps,{onYolo:l})}),e[11]=l,e[12]=m):m=e[12];const f=m;let x;e[13]!==c?(x=s.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:"Deny"}),e[13]=c,e[14]=x):x=e[14];let p;e[15]!==d?(p=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:d,children:"Accept"}),e[15]=d,e[16]=p):p=e[16];let h;e[17]!==x||e[18]!==p?(h=s.jsxs(s.Fragment,{children:[x,p]}),e[17]=x,e[18]=p,e[19]=h):h=e[19];const b=h;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ft,{size:14}),e[20]=g):g=e[20];let v;e[21]!==n.input?(v=s.jsx(hs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let y;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==b||e[26]!==v?(y=s.jsx(de,{icon:g,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:b,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=b,e[26]=v,e[27]=y):y=e[27],y}const ya=Hs(_e(),pe({approved:Gs().optional(),levelOverride:Pt(["auto","readonly"]).optional()}));function Aa(t){const e=O.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Ie(),i=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(Sa)),e[0]=n,e[1]=c):c=e[1];const u=c;let d;e[2]!==i||e[3]!==o?(d=(D,N)=>{const P=N;typeof P?.approved=="boolean"&&o(D.approvalId,P.approved,P.approved===!1?ms:void 0,P.levelOverride??i)},e[2]=i,e[3]=o,e[4]=d):d=e[4];let V;e[5]!==n||e[6]!==u||e[7]!==r||e[8]!==d?(V={parts:n,partKey:wa,schema:ya,defaultValues:u,isStreaming:r,hasAnswer:ja,onSubmit:d},e[5]=n,e[6]=u,e[7]=r,e[8]=d,e[9]=V):V=e[9];const l=fs(V);let m;e[10]!==n||e[11]!==l?(m=D=>{l.form.reset(Object.fromEntries(n.map(N=>[N.approvalId,{approved:!0,levelOverride:D}]))),l.submitOrAdvance()},e[10]=n,e[11]=l,e[12]=m):m=e[12];const f=m,x=l.currentPart;let p;e[13]!==l?(p=D=>{D.preventDefault(),l.submit()},e[13]=l,e[14]=p):p=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(ft,{size:14}),e[15]=h):h=e[15];const b=`${n.length} approvals pending`,g=x?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(ps,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let y;e[18]!==n.length||e[19]!==l.currentIndex||e[20]!==l.goNext||e[21]!==l.goPrev||e[22]!==v?(y=s.jsx(ds,{currentIndex:l.currentIndex,total:n.length,onPrev:l.goPrev,onNext:l.goNext,extraLeft:v}),e[18]=n.length,e[19]=l.currentIndex,e[20]=l.goNext,e[21]=l.goPrev,e[22]=v,e[23]=y):y=e[23];let A;e[24]!==x||e[25]!==l.form.control||e[26]!==l.submitOrAdvance?(A=x?s.jsx(Ca,{approvalId:x.approvalId,control:l.form.control,onChange:l.submitOrAdvance}):null,e[24]=x,e[25]=l.form.control,e[26]=l.submitOrAdvance,e[27]=A):A=e[27];let j;e[28]!==x?(j=x?s.jsx(hs,{input:x.input}):null,e[28]=x,e[29]=j):j=e[29];let k;e[30]!==y||e[31]!==A||e[32]!==j||e[33]!==b||e[34]!==g?(k=s.jsx(de,{icon:h,label:b,title:g,defaultExpanded:!0,footerLeft:y,footerRight:A,children:j}),e[30]=y,e[31]=A,e[32]=j,e[33]=b,e[34]=g,e[35]=k):k=e[35];let S;e[36]!==k||e[37]!==p?(S=s.jsx("form",{onSubmit:p,children:k}),e[36]=k,e[37]=p,e[38]=S):S=e[38];let C;return e[39]!==l.form||e[40]!==S?(C=s.jsx(kt,{...l.form,children:S}),e[39]=l.form,e[40]=S,e[41]=C):C=e[41],C}function ja(t){return typeof t?.approved=="boolean"}function wa(t){return t.approvalId}function Sa(t){return[t.approvalId,{approved:void 0}]}function Ca(t){const e=O.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let i;e[0]!==o?(i=u=>{const{field:d}=u,V=d.value===!0,l=d.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(re,{type:"button",variant:l?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{d.onChange(!1),o()},"aria-pressed":l,children:"Deny"}),s.jsx(re,{type:"button",variant:V?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{d.onChange(!0),o()},"aria-pressed":V,children:"Accept"})]})},e[0]=o,e[1]=i):i=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==i?(c=s.jsx(Ws,{control:r,name:a,render:i}),e[2]=r,e[3]=a,e[4]=i,e[5]=c):c=e[5],c}function Na(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(ft,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function ka(t){const e=O.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Na,{}),e[0]=i):i=e[0],i}if(n.length===0)return null;if(n.length===1){const i=n[0];if(!i)return null;let c;return e[1]!==o||e[2]!==i?(c=s.jsx(va,{approval:i,onRespond:o}),e[1]=o,e[2]=i,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(Aa,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function _a(t){const e=O.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const i=a;let c;e[3]!==o?(c=s.jsx(re,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:o,children:"Keep iterating"}),e[3]=o,e[4]=c):c=e[4];let u;e[5]!==i?(u=s.jsx(re,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:i,children:"Let's go"}),e[5]=i,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==u?(d=s.jsxs(s.Fragment,{children:[c,u]}),e[7]=c,e[8]=u,e[9]=d):d=e[9];const V=d;let l;e[10]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Hr,{size:14}),e[10]=l):l=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(Ar,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=s.jsx(de,{icon:l,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:V,children:m}),e[13]=V,e[14]=m,e[15]=f):f=e[15],f}function Ia(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(Ke,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function Ea(t){const e=O.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ia,{}),e[0]=d):d=e[0],d}let i;e[1]!==n?(i=n.at(-1),e[1]=n,e[2]=i):i=e[2];const c=i;if(!c)return null;let u;return e[3]!==c||e[4]!==o||e[5]!==a?(u=s.jsx(_a,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=u):u=e[6],u}function xs(t){return t?"response"in t?t.response:t.option??t.draft:""}const dn=pe({response:_e().min(1,"Response is required")}),Ra=pe({option:_e().nullable(),draft:_e()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Ta=pe({response:Pt(["yes","no"])});function Pa(t){switch(t.type){case"text":return dn;case"choice":return Ra;case"confirm":return Ta;default:return dn}}function Da(t){const e={};for(const n of t)e[n.toolCallId]=Pa(n.input);return pe(e)}function Ma(t){const e=O.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:u}=c,d=u.value??"";return s.jsxs(Ot,{children:[s.jsx(Lt,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Bn,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...u,value:d,type:"text",placeholder:o||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),s.jsx($t,{})]})},e[0]=o,e[1]=a):a=e[1];let i;return e[2]!==n||e[3]!==r||e[4]!==a?(i=s.jsx(Qn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=i):i=e[5],i}function gs(t,e){const n=O.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=i=>{const c=i.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||i.metaKey||i.ctrlKey||i.altKey)return;const u=Number.parseInt(i.key,10);u>=1&&u<=t&&(i.preventDefault(),e(u-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),w.useEffect(r,o)}function Fa(t){const e=O.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let i;e[0]!==n||e[1]!==a?(i={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=i):i=e[2];const{field:c}=Wt(i),u=`${r}.draft`;let d;e[3]!==n||e[4]!==u?(d={control:n,name:u,defaultValue:""},e[3]=n,e[4]=u,e[5]=d):d=e[5];const{field:V}=Wt(d),l=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==o?(f=P=>{const T=o[P];T!=null&&c.onChange(T)},e[6]=c,e[7]=o,e[8]=f):f=e[8],gs(o.length,f),o.length===0)return null;const x=l===null;let p;if(e[9]!==c||e[10]!==l||e[11]!==o){let P;e[13]!==c||e[14]!==l?(P=(T,_)=>{const R=l===T;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(T),className:B("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",R&&"bg-accent/50",!R&&"hover:bg-accent/30"),"aria-label":`Select ${T}`,children:[s.jsx("span",{className:B("flex items-center justify-center size-6 rounded-md text-sm shrink-0",R?"bg-chart-1 text-white":"bg-muted text-foreground"),children:_+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:T})]},`${_}-${T}`)},e[13]=c,e[14]=l,e[15]=P):P=e[15],p=o.map(P),e[9]=c,e[10]=l,e[11]=o,e[12]=p}else p=e[12];const h=x&&"bg-accent/50",b=!x&&"hover:bg-accent/30";let g;e[16]!==h||e[17]!==b?(g=B("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",h,b),e[16]=h,e[17]=b,e[18]=g):g=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Bn,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const y=x?m:"";let A;e[20]!==V||e[21]!==c||e[22]!==l?(A=P=>{V.onChange(P.target.value),l!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=l,e[23]=A):A=e[23];let j;e[24]!==c||e[25]!==l?(j=()=>{l!==null&&c.onChange(null)},e[24]=c,e[25]=l,e[26]=j):j=e[26];let k;e[27]!==y||e[28]!==A||e[29]!==j?(k=s.jsx("input",{type:"text",value:y,onChange:A,onFocus:j,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=y,e[28]=A,e[29]=j,e[30]=k):k=e[30];let S;e[31]!==k||e[32]!==g?(S=s.jsxs("label",{className:g,children:[v,k]}),e[31]=k,e[32]=g,e[33]=S):S=e[33];let C;e[34]!==S||e[35]!==p?(C=s.jsx(Lt,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[p,S]})}),e[34]=S,e[35]=p,e[36]=C):C=e[36];let D;e[37]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx($t,{}),e[37]=D):D=e[37];let N;return e[38]!==C?(N=s.jsxs(Ot,{children:[C,D]}),e[38]=C,e[39]=N):N=e[39],N}function Oa(t){const e=O.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,i=w.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{i.current?.onChange(a[V]??"")},e[1]=c):c=e[1],gs(a.length,c);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=V=>{const{field:l}=V;return i.current=l,s.jsxs(Ot,{children:[s.jsx(Lt,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=l.value===m;return s.jsxs("button",{type:"button",onClick:()=>l.onChange(m),className:B("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[s.jsx("span",{className:B("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx($t,{})]})},e[2]=u):u=e[2];let d;return e[3]!==n||e[4]!==r?(d=s.jsx(Qn,{control:n,name:r,render:u}),e[3]=n,e[4]=r,e[5]=d):d=e[5],d}function Vn(t){const e=O.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let i;return e[0]!==r||e[1]!==n.default||e[2]!==a?(i=s.jsx(Ma,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=i):i=e[3],i}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const i=a;let c;return e[6]!==r||e[7]!==i||e[8]!==o?(c=s.jsx(Fa,{control:r,name:o,options:i}),e[6]=r,e[7]=i,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let i;return e[10]!==r||e[11]!==a?(i=s.jsx(Oa,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=i):i=e[12],i}default:return null}}function La(t){const e=O.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=Da(n.map(Ua)),e[0]=n,e[1]=a):a=e[1];const i=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(Ba)),e[2]=n,e[3]=c):c=e[3];const u=c;let d;e[4]!==o?(d=(E,I)=>{const $=xs(I);$&&o(E,$)},e[4]=o,e[5]=d):d=e[5];let V;e[6]!==u||e[7]!==r||e[8]!==n||e[9]!==i||e[10]!==d?(V={parts:n,partKey:za,schema:i,defaultValues:u,isStreaming:r,hasAnswer:$a,onSubmit:d},e[6]=u,e[7]=r,e[8]=n,e[9]=i,e[10]=d,e[11]=V):V=e[11];const l=fs(V),m=l.currentPart;let f;e[12]!==m||e[13]!==l?(f=()=>{const E=m;if(!E)return;const I=E.toolCallId;E.input?.type==="choice"?(l.form.setValue(`${I}.option`,null),l.form.setValue(`${I}.draft`,"user has skip this question")):l.form.setValue(`${I}.response`,"user has skip this question"),l.advanceToNextUnanswered()},e[12]=m,e[13]=l,e[14]=f):f=e[14];const x=f;let p;e[15]!==l.currentIndex||e[16]!==l.goNext||e[17]!==l.goPrev||e[18]!==n.length?(p=s.jsx(ds,{currentIndex:l.currentIndex,total:n.length,onPrev:l.goPrev,onNext:l.goNext}),e[15]=l.currentIndex,e[16]=l.goNext,e[17]=l.goPrev,e[18]=n.length,e[19]=p):p=e[19];const h=p;let b;e[20]!==x?(b=s.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:x,className:"h-7",children:"Skip"}),e[20]=x,e[21]=b):b=e[21];let g;e[22]!==l.isAllAnswered||e[23]!==l.isCurrentAnswered||e[24]!==l.submitOrAdvance||e[25]!==r?(g=s.jsx(ha,{isStreaming:r,isAllAnswered:l.isAllAnswered,isCurrentAnswered:l.isCurrentAnswered,onAdvanceOrSubmit:l.submitOrAdvance}),e[22]=l.isAllAnswered,e[23]=l.isCurrentAnswered,e[24]=l.submitOrAdvance,e[25]=r,e[26]=g):g=e[26];let v;e[27]!==b||e[28]!==g?(v=s.jsxs(s.Fragment,{children:[b,g]}),e[27]=b,e[28]=g,e[29]=v):v=e[29];const y=v;if(n.length===1){const E=n[0];if(!E?.input)return null;let I;e[30]!==l?(I=K=>{K.preventDefault(),l.submit()},e[30]=l,e[31]=I):I=e[31];let $;e[32]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(_t,{size:14}),e[32]=$):$=e[32];const z=E.input?.prompt??"Question",L=E.input;let Q;e[33]!==l.form.control||e[34]!==E.toolCallId||e[35]!==L?(Q=s.jsx(Vn,{input:L,control:l.form.control,toolCallId:E.toolCallId}),e[33]=l.form.control,e[34]=E.toolCallId,e[35]=L,e[36]=Q):Q=e[36];let M;e[37]!==y||e[38]!==z||e[39]!==Q?(M=s.jsx(de,{icon:$,label:"Question pending",title:z,defaultExpanded:!0,footerRight:y,children:Q}),e[37]=y,e[38]=z,e[39]=Q,e[40]=M):M=e[40];let U;e[41]!==I||e[42]!==M?(U=s.jsx("form",{onSubmit:I,autoComplete:"off",children:M}),e[41]=I,e[42]=M,e[43]=U):U=e[43];let q;return e[44]!==l.form||e[45]!==U?(q=s.jsx(kt,{...l.form,children:U}),e[44]=l.form,e[45]=U,e[46]=q):q=e[46],q}const A=l.form;let j;e[47]!==l?(j=E=>{E.preventDefault(),l.submit()},e[47]=l,e[48]=j):j=e[48];let k;e[49]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(_t,{size:14}),e[49]=k):k=e[49];const S=`${l.currentIndex+1} of ${n.length}`,C=m?.input?.prompt??"Question",D=l.activeKey,N=l.setActiveKey;let P;if(e[50]!==l.form||e[51]!==n){let E;e[53]!==l.form?(E=I=>s.jsx(Vo,{value:I.toolCallId,className:"mt-0",children:s.jsx(Vn,{input:I.input,control:l.form.control,toolCallId:I.toolCallId})},I.toolCallId),e[53]=l.form,e[54]=E):E=e[54],P=n.map(E),e[50]=l.form,e[51]=n,e[52]=P}else P=e[52];let T;e[55]!==l.activeKey||e[56]!==l.setActiveKey||e[57]!==P?(T=s.jsx(fo,{value:D,onValueChange:N,children:P}),e[55]=l.activeKey,e[56]=l.setActiveKey,e[57]=P,e[58]=T):T=e[58];let _;e[59]!==h||e[60]!==y||e[61]!==S||e[62]!==C||e[63]!==T?(_=s.jsx(de,{icon:k,label:"Question pending",count:S,title:C,defaultExpanded:!0,footerLeft:h,footerRight:y,children:T}),e[59]=h,e[60]=y,e[61]=S,e[62]=C,e[63]=T,e[64]=_):_=e[64];let R;e[65]!==j||e[66]!==_?(R=s.jsx("form",{onSubmit:j,autoComplete:"off",children:_}),e[65]=j,e[66]=_,e[67]=R):R=e[67];let F;return e[68]!==l.form||e[69]!==R?(F=s.jsx(kt,{...A,children:R}),e[68]=l.form,e[69]=R,e[70]=F):F=e[70],F}function $a(t){return!!xs(t)}function za(t){return t.toolCallId}function Ba(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function Ua(t){return{toolCallId:t.toolCallId,input:t.input}}function Ka(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(_t,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function bs(t){const e=O.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(qa),e[0]=n,e[1]=a):a=e[1];const i=a;if(i.length===0){if(r){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ka,{}),e[2]=u):u=e[2],u}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==i?(c=s.jsx(La,{parts:i,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=i,e[6]=c):c=e[6],c}function qa(t){return t.state==="input-available"}function Qa(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function Ya(){const t=O.c(21),{messages:e}=Ue();let n,r,o,a,i,c,u,d,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=as(e);if(f.length===0){V=null;break e}const x=Qa(f);n=de,i=s.jsx(Ja,{status:x.icon}),c=x.activity,u=x.progress,d=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(Ha)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=i,t[6]=c,t[7]=u,t[8]=d,t[9]=V}else n=t[1],r=t[2],o=t[3],a=t[4],i=t[5],c=t[6],u=t[7],d=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let l;t[10]!==r||t[11]!==o||t[12]!==a?(l=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=l):l=t[13];let m;return t[14]!==n||t[15]!==i||t[16]!==c||t[17]!==u||t[18]!==d||t[19]!==l?(m=s.jsx(n,{icon:i,label:c,count:u,defaultExpanded:d,children:l}),t[14]=n,t[15]=i,t[16]=c,t[17]=u,t[18]=d,t[19]=l,t[20]=m):m=t[20],m}function Ha(t,e){return s.jsx(Ga,{todo:t},e)}function Ga(t){const e=O.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let i;e[0]!==n.status?(i=s.jsx(Wa,{status:n.status}),e[0]=n.status,e[1]=i):i=e[1];const c=r&&"text-muted-foreground";let u;e[2]!==c?(u=B("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=u):u=e[3];const d=r?"100%":"0%",V=r?"width 300ms ease 200ms":"width 150ms ease";let l;e[4]!==d||e[5]!==V?(l=s.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:d,transition:V}}),e[4]=d,e[5]=V,e[6]=l):l=e[6];let m;e[7]!==a||e[8]!==u||e[9]!==l?(m=s.jsxs("span",{className:u,children:[a,l]}),e[7]=a,e[8]=u,e[9]=l,e[10]=m):m=e[10];let f;return e[11]!==i||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[i,m]}),e[11]=i,e[12]=m,e[13]=f):f=e[13],f}function Wa(t){const e=O.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=a):a=e[0];let i;return e[1]!==r||e[2]!==o?(i=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=i):i=e[3],i}function Ja(t){const e=O.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=r):r=e[2],r}const Za={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},Xa=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function vs(t){const e=O.c(41),{onDismiss:n}=t,{org:r}=le(),o=st(),{decoKeyId:a}=Wn(),i=Zn(),[c,u]=w.useState(""),[d,V]=w.useState(!1),[l,m]=w.useState("usd"),f=l==="brl"?"R$":"$";let x,p;e[0]!==r.id?(x=()=>{G("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[0]=r.id,e[1]=x,e[2]=p):(x=e[1],p=e[2]),w.useEffect(x,p);let h;e[3]!==l||e[4]!==i?(h=async E=>{const{url:I}=await i.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:E,currency:l});return I},e[3]=l,e[4]=i,e[5]=h):h=e[5];let b;e[6]!==n?(b=E=>{E&&window.open(E,"_blank","noopener,noreferrer"),n?.()},e[6]=n,e[7]=b):b=e[7];let g;e[8]!==h||e[9]!==b?(g={mutationFn:h,onSuccess:b,onError:ni},e[8]=h,e[9]=b,e[10]=g):g=e[10];const{mutate:v,isPending:y}=Dt(g),A=parseFloat(c),j=!isNaN(A)&&A>=1;let k;e[11]!==n?(k=E=>!E&&n?.(),e[11]=n,e[12]=k):k=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[13]=S):S=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:S.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[14]=C):C=e[14];let D;e[15]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[C,s.jsxs(at,{className:"relative gap-4",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsxs("div",{children:[s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx(Ft,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[15]=D):D=e[15];let N;e[16]!==l||e[17]!==f||e[18]!==c||e[19]!==A||e[20]!==a||e[21]!==j||e[22]!==y||e[23]!==d||e[24]!==v?(N=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Hn,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:E=>{E&&m(E)},children:[s.jsx(Ze,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Ze,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Za[l].map(E=>{const{dollars:I,label:$}=E;return s.jsxs("button",{type:"button",disabled:y,onClick:()=>{G("credits_topup_clicked",{amount_cents:I*100,currency:l,tier_label:$,source:"exhausted_banner"}),v(I*100)},className:B("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,I]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:$})]},I)})}),d?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Gn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:E=>u(E.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!j||y,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(A*100),currency:l,tier_label:"custom",source:"exhausted_banner"}),v(Math.round(A*100))},children:y?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:Xa.map(ei)})]}),e[16]=l,e[17]=f,e[18]=c,e[19]=A,e[20]=a,e[21]=j,e[22]=y,e[23]=d,e[24]=v,e[25]=N):N=e[25];let P;e[26]!==n?(P=s.jsx(re,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[26]=n,e[27]=P):P=e[27];let T;e[28]!==o||e[29]!==n||e[30]!==r.slug?(T=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[28]=o,e[29]=n,e[30]=r.slug,e[31]=T):T=e[31];let _;e[32]!==P||e[33]!==T?(_=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[P,T]}),e[32]=P,e[33]=T,e[34]=_):_=e[34];let R;e[35]!==N||e[36]!==_?(R=s.jsxs(lt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ti,children:[D,N,_]}),e[35]=N,e[36]=_,e[37]=R):R=e[37];let F;return e[38]!==R||e[39]!==k?(F=s.jsx(ct,{open:!0,onOpenChange:k,children:R}),e[38]=R,e[39]=k,e[40]=F):F=e[40],F}function ei(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(Ke,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function ti(t){return t.preventDefault()}function ni(t){ae.error(`Top-up failed: ${t.message}`)}function si(){const t=O.c(5),e=rt(),n=Xn(),[r,o]=w.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(zt,{size:14}),t[0]=i):i=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(re,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(de,{icon:i,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms@latest link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=u):u=t[2];let d;return t[3]!==r?(d=s.jsxs(s.Fragment,{children:[u,s.jsx(po,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=d):d=t[4],d}function ri(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),i=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const u=c[1]?.trim().replace(/\.$/,"");return{summary:u?`Your sandbox didn't finish starting up (${u}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms@latest link` in a terminal on it, then try again.",rawDetails:t}:r||n&&i?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||i?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const oi={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function Xe(t){const e=O.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",i=o?qn:Rn,c=o?t.error.message:oi[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let u;e[0]!==o||e[1]!==c?(u=o?ri(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=u):u=e[2];const{summary:d,rawDetails:V}=u;let l;e[3]!==i?(l=s.jsx(i,{size:14}),e[3]=i,e[4]=l):l=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(re,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==V?(f=V?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(V).then(ii).catch(ai)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(so,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:V})]})]}):null,e[9]=V,e[10]=f):f=e[10];let x;return e[11]!==a||e[12]!==r||e[13]!==d||e[14]!==l||e[15]!==m||e[16]!==f||e[17]!==n?(x=s.jsx(de,{icon:l,label:a,title:d,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=d,e[14]=l,e[15]=m,e[16]=f,e[17]=n,e[18]=x):x=e[18],x}function ai(){return ae.error("Could not copy")}function ii(){return ae.success("Copied to clipboard")}function pt(){const t=O.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:i,submit:c,sendMessage:u}=Ue(),[d,V]=Ie(),{virtualMcpId:l,createTaskWithMessage:m}=hr(),{chatMode:f,simpleModeTier:x}=Ve();let p;t[0]!==f||t[1]!==x||t[2]!==l?(p=te=>({tier:x,mode:f,toolApprovalLevel:te,agent:l?{id:l}:void 0}),t[0]=f,t[1]=x,t[2]=l,t[3]=p):p=t[3];const h=p;let b;t[4]!==d.toolApprovalLevel?(b=d.toolApprovalLevel??Js(),t[4]=d.toolApprovalLevel,t[5]=b):b=t[5];const g=b,v=a.at(-1),y=v?.role==="assistant"?v.parts:[],A=y.filter(di),j=ls(y),k=is(y);let S;t[6]!==e||t[7]!==u?(S=()=>{if(e){const se={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};u(se)}},t[6]=e,t[7]=u,t[8]=S):S=t[8];const C=S;let D;t[9]!==u?(D=()=>{u({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=u,t[10]=D):D=t[10];const N=D;let P;t[11]!==h||t[12]!==g||t[13]!==c?(P=(te,se)=>{c({kind:"toolOutput",toolCallId:te.toolCallId,output:{response:se}},h(g))},t[11]=h,t[12]=g,t[13]=c,t[14]=P):P=t[14];const T=P;let _;t[15]!==m||t[16]!==d||t[17]!==V||t[18]!==l?(_=te=>{V({...d,toolApprovalLevel:"auto"}),m({virtualMcpId:l,message:{parts:[{type:"text",text:`Implement this plan:
|
|
2
|
+
|
|
3
|
+
${te}`}]}})},t[15]=m,t[16]=d,t[17]=V,t[18]=l,t[19]=_):_=t[19];const R=_,F=ui;let E;t[20]!==h||t[21]!==c?(E=(te,se,H,ie)=>{c({kind:"approval",approvalId:te,approved:se,...H?{reason:H}:{}},h(ie))},t[20]=h,t[21]=c,t[22]=E):E=t[22];const I=E,$=cs();if($.isCreditExhausted){let te;return t[23]!==n?(te=s.jsx(vs,{onDismiss:n}),t[23]=n,t[24]=te):te=t[24],te}const{showError:z,showWarning:L,hasApprovals:Q}=$,M=A.map(ci).join("|"),U=j[0]?.toolCallId??"",q=k.map(li).join("|");let K,Y;t[25]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ya,{}),Y=s.jsx(si,{}),t[25]=K,t[26]=Y):(K=t[25],Y=t[26]);let ne;t[27]!==n||t[28]!==e||t[29]!==C||t[30]!==z?(ne=z&&s.jsx(Xe,{variant:"error",error:e,onDismiss:n,onFixInChat:C}),t[27]=n,t[28]=e,t[29]=C,t[30]=z,t[31]=ne):ne=t[31];let X;t[32]!==o||t[33]!==r||t[34]!==N||t[35]!==L?(X=L&&s.jsx(Xe,{variant:"warning",finishReason:r,onDismiss:o,onContinue:N}),t[32]=o,t[33]=r,t[34]=N,t[35]=L,t[36]=X):X=t[36];let ee;t[37]!==q||t[38]!==I||t[39]!==Q||t[40]!==i||t[41]!==k?(ee=Q&&s.jsx(ka,{approvals:k,isStreaming:i,onRespond:I},q),t[37]=q,t[38]=I,t[39]=Q,t[40]=i,t[41]=k,t[42]=ee):ee=t[42];let W;t[43]!==$.hasPlans||t[44]!==R||t[45]!==F||t[46]!==i||t[47]!==j||t[48]!==U?(W=$.hasPlans&&s.jsx(Ea,{plans:j,isStreaming:i,onApprove:R,onDismiss:F},U),t[43]=$.hasPlans,t[44]=R,t[45]=F,t[46]=i,t[47]=j,t[48]=U,t[49]=W):W=t[49];let J;t[50]!==$.isWaitingForUserInput||t[51]!==T||t[52]!==i||t[53]!==M||t[54]!==A?(J=$.isWaitingForUserInput&&s.jsx(bs,{userAskParts:A,isStreaming:i,onSubmit:T},M),t[50]=$.isWaitingForUserInput,t[51]=T,t[52]=i,t[53]=M,t[54]=A,t[55]=J):J=t[55];let Z;return t[56]!==X||t[57]!==ee||t[58]!==W||t[59]!==J||t[60]!==ne?(Z=s.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[K,Y,ne,X,ee,W,J]}),t[56]=X,t[57]=ee,t[58]=W,t[59]=J,t[60]=ne,t[61]=Z):Z=t[61],Z}function li(t){return t.approvalId}function ci(t){return t.toolCallId}function ui(){document.querySelector("[data-chat-input]")?.focus()}function di(t){return t.type==="tool-user_ask"}pt.Error=function(e){return s.jsx(Xe,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};pt.Warning=function(e){return s.jsx(Xe,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};pt.UserAskQuestion=bs;async function Vi(t,e,n){const r=await t.callTool({name:e,arguments:n});if(r.isError){const o=r.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(o)}return r}const ys=["SANDBOX_START"],Qe=new Map,fi=t=>`${t.virtualMcpId}::${t.branch??""}`,vt=new Set,mi={mark:(t,e)=>vt.add(`${t}::${e}`),clear:(t,e)=>vt.delete(`${t}::${e}`),isStopped:(t,e)=>vt.has(`${t}::${e}`)};function pi(t){const e=Be();return Dt({mutationKey:ys,mutationFn:async n=>{n.branch&&mi.clear(n.virtualMcpId,n.branch);const r=fi(n),o=Qe.get(r);if(o)return o;const a=(async()=>(await Vi(t,"SANDBOX_START",n)).structuredContent)();Qe.set(r,a);try{return await a}finally{Qe.get(r)===a&&Qe.delete(r)}},onSuccess:()=>{Zs(e)}})}function rd(t,e){const n=O.c(3);let r;return n[0]!==e||n[1]!==t?(r={mutationKey:ys,predicate:a=>{if(!t)return!1;const i=a.state.variables;return!i||i.virtualMcpId!==t?!1:(i.branch??"")===(e??"")}},n[0]=e,n[1]=t,n[2]=r):r=n[2],zo(r)>0}function hi(){const t=O.c(11),e=Xn(),n=Xs();let r;t[0]!==e.capabilities||t[1]!==e.online?(r=e.online&&e.capabilities.includes("claude-code"),t[0]=e.capabilities,t[1]=e.online,t[2]=r):r=t[2];let o;t[3]!==e.capabilities||t[4]!==e.online?(o=e.online&&e.capabilities.includes("codex"),t[3]=e.capabilities,t[4]=e.online,t[5]=o):o=t[5];let a;return t[6]!==e.online||t[7]!==n.runtime.agentSandbox||t[8]!==r||t[9]!==o?(a={agentSandbox:n.runtime.agentSandbox,userDesktop:e.online,claudeCode:r,codex:o},t[6]=e.online,t[7]=n.runtime.agentSandbox,t[8]=r,t[9]=o,t[10]=a):a=t[10],a}const xi={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5"},smart:{modelId:"claude-code:sonnet",label:"Sonnet 4.6"},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M"}},gi={fast:{modelId:"codex:gpt-5.4-mini",label:"GPT-5.4 Mini"},smart:{modelId:"codex:gpt-5.4",label:"GPT-5.4"},thinking:{modelId:"codex:gpt-5.5",label:"GPT-5.5"}};function bi(t){return t==="claude-code"?xi:t==="codex"?gi:null}function fn(t,e){return bi(t)?.[e]??null}const vi={"cloud-decopilot":"decopilot","local-decopilot":"decopilot-desktop","local-claude-code":"claude-code-desktop","local-codex":"codex-desktop"},yi={decopilot:"cloud-decopilot","decopilot-desktop":"local-decopilot","claude-code-desktop":"local-claude-code","codex-desktop":"local-codex"};function Ai(t){return vi[t]}function As(t){return t===null?"cloud-decopilot":yi[t]}function js(){const t=O.c(2),{pendingAgentOption:e}=Ve();let n;return t[0]!==e?(n=As(e),t[0]=e,t[1]=n):n=t[1],n}function ji(){const t=O.c(2),{setPendingAgentOption:e}=Ve();let n;return t[0]!==e?(n=r=>e(Ai(r)),t[0]=e,t[1]=n):n=t[1],n}function wi(){return Ve().simpleModeTier}function Si(){return Ve().setSimpleModeTier}const Ci={fast:"Quicker responses",smart:"Balanced quality",thinking:"Deeper reasoning"};function Ni(t,e){return t==="local-claude-code"?fn("claude-code",e)?.label??null:t==="local-codex"?fn("codex",e)?.label??null:Ci[e]}const ki={decopilot:"Decopilot","claude-code":"Claude Code",codex:"Codex"},_i=ut("").icon;function et(t){const e=O.c(4),{compact:n}=t,o=(n===void 0?!1:n)?"size-3.5 rounded-sm":"size-4 rounded-sm";let a;e[0]!==o?(a=B(o),e[0]=o,e[1]=a):a=e[1];let i;return e[2]!==a?(i=s.jsx(Un,{icon:_i,name:"Decopilot",size:"2xs",className:a}),e[2]=a,e[3]=i):i=e[3],i}const Ii={mode:"cloud-decopilot",label:"Decopilot",description:"Runs in an agent sandbox",group:"cloud",icon:s.jsx(et,{}),isAvailable:t=>t.agentSandbox},Ei={mode:"local-decopilot",label:"Decopilot",description:"Runs on your desktop",group:"local",icon:s.jsx(et,{}),isAvailable:t=>t.userDesktop},Ri={mode:"local-claude-code",label:"Claude Code",description:"Runs via Claude Code CLI",group:"local",icon:s.jsx(es,{size:16}),isAvailable:t=>t.userDesktop&&t.claudeCode},Ti={mode:"local-codex",label:"Codex",description:"Runs via Codex CLI",group:"local",icon:s.jsx(ts,{size:16}),isAvailable:t=>t.userDesktop&&t.codex},mn=[Ii,Ei,Ri,Ti];function Pi(t,e){return t==="claude-code"?"local-claude-code":t==="codex"?"local-codex":e==="user-desktop"?"local-decopilot":"cloud-decopilot"}function Di({selectedMode:t,lockedHarness:e,lockedSandbox:n,isThreadLocked:r}){if(r&&e!=null){const o=xr(e,n);return o?As(o):Pi(e,n)}return t}function ws(t){return t==="local-decopilot"?{icon:s.jsx(et,{compact:!0}),text:"Decopilot"}:t==="local-claude-code"?{icon:s.jsx(es,{size:14}),text:"Claude Code"}:t==="local-codex"?{icon:s.jsx(ts,{size:14}),text:"Codex"}:{icon:s.jsx(et,{compact:!0}),text:"Decopilot"}}function Mi(t){const{text:e}=ws(t);return{icon:t==="cloud-decopilot"?s.jsx(Gr,{size:14}):s.jsx(zt,{size:14}),text:e}}function yt(t){return t==="cloud-decopilot"?"cloud":"desktop"}const Fi="text-muted-foreground hover:text-foreground text-xs transition-[gap] duration-200",Oi="text-success hover:text-success";function Li(t){const e=O.c(89),{mode:n,availability:r,locked:o,lockedHarness:a,onSelect:i}=t,[c,u]=w.useState(!1);let d;e[0]!==o||e[1]!==n?(d=o?ws(n):Mi(n),e[0]=o,e[1]=n,e[2]=d):d=e[2];const{icon:V,text:l}=d;let m;e[3]!==n?(m=yt(n),e[3]=n,e[4]=m):m=e[4];const f=`${l} on ${m}`,x=n!=="cloud-decopilot",p=a!=null,h=a?ki[a]:null;let b,g,v,y,A,j,k,S,C,D,N,P,T;if(e[5]!==r||e[6]!==h||e[7]!==V||e[8]!==x||e[9]!==f||e[10]!==o||e[11]!==n||e[12]!==i||e[13]!==c||e[14]!==p||e[15]!==l){const E=mn.filter(zi),I=mn.filter($i);let $;e[29]!==i?($=se=>{i(se),u(!1)},e[29]=i,e[30]=$):$=e[30];const z=$;g=Bt,y=c,A=o?void 0:u;let L;e[31]!==h||e[32]!==f||e[33]!==n||e[34]!==p?(L=p&&h?`This chat is using ${h} on ${yt(n)}. Start a new chat to use a different runtime.`:f,e[31]=h,e[32]=f,e[33]=n,e[34]=p,e[35]=L):L=e[35];const Q=o?"mode-picker-locked":"mode-picker",M=x&&Oi,U=o?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5";let q;e[36]!==M||e[37]!==U?(q=B(Fi,M,"shrink min-w-0",U),e[36]=M,e[37]=U,e[38]=q):q=e[38];const K=!o&&"@[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100";let Y;e[39]!==K?(Y=B("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0",K),e[39]=K,e[40]=Y):Y=e[40];let ne;e[41]!==Y||e[42]!==l?(ne=s.jsx("span",{className:Y,children:l}),e[41]=Y,e[42]=l,e[43]=ne):ne=e[43];let X;e[44]!==o?(X=!o&&s.jsx(Vt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[44]=o,e[45]=X):X=e[45];let ee;e[46]!==V||e[47]!==o||e[48]!==L||e[49]!==Q||e[50]!==q||e[51]!==ne||e[52]!==X?(ee=s.jsx(he,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Ut,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":L,disabled:o,"data-testid":Q,className:q,children:[V,ne,X]})})})}),e[46]=V,e[47]=o,e[48]=L,e[49]=Q,e[50]=q,e[51]=ne,e[52]=X,e[53]=ee):ee=e[53];let W;e[54]!==h||e[55]!==f||e[56]!==n||e[57]!==p?(W=p&&h?`This chat is using ${h} on ${yt(n)}. Start a new chat to use a different runtime.`:f,e[54]=h,e[55]=f,e[56]=n,e[57]=p,e[58]=W):W=e[58];let J;e[59]!==W?(J=s.jsx(xe,{children:W}),e[59]=W,e[60]=J):J=e[60],e[61]!==ee||e[62]!==J?(j=s.jsxs(ge,{children:[ee,J]}),e[61]=ee,e[62]=J,e[63]=j):j=e[63],b=Kt,T="start",v="p-1 w-64",k="menu",S="flex flex-col",C=E.length>0&&s.jsx(pn,{title:"Cloud"});let Z;e[64]!==z||e[65]!==n?(Z=se=>s.jsx(hn,{row:se,active:n===se.mode,onSelect:z},se.mode),e[64]=z,e[65]=n,e[66]=Z):Z=e[66],D=E.map(Z),N=I.length>0&&s.jsx(pn,{title:"Local",variant:"success",icon:s.jsx(zt,{size:12,"data-testid":"local-section-desktop-icon"}),testId:"local-section-header"});let te;e[67]!==r||e[68]!==z||e[69]!==n?(te=se=>{const H=se.isAvailable(r);return s.jsx(hn,{row:se,active:n===se.mode,onSelect:z,unavailableHint:H?void 0:r.userDesktop?"Not detected on your desktop":"Desktop not detected"},se.mode)},e[67]=r,e[68]=z,e[69]=n,e[70]=te):te=e[70],P=I.map(te),e[5]=r,e[6]=h,e[7]=V,e[8]=x,e[9]=f,e[10]=o,e[11]=n,e[12]=i,e[13]=c,e[14]=p,e[15]=l,e[16]=b,e[17]=g,e[18]=v,e[19]=y,e[20]=A,e[21]=j,e[22]=k,e[23]=S,e[24]=C,e[25]=D,e[26]=N,e[27]=P,e[28]=T}else b=e[16],g=e[17],v=e[18],y=e[19],A=e[20],j=e[21],k=e[22],S=e[23],C=e[24],D=e[25],N=e[26],P=e[27],T=e[28];let _;e[71]!==k||e[72]!==S||e[73]!==C||e[74]!==D||e[75]!==N||e[76]!==P?(_=s.jsxs("div",{role:k,className:S,children:[C,D,N,P]}),e[71]=k,e[72]=S,e[73]=C,e[74]=D,e[75]=N,e[76]=P,e[77]=_):_=e[77];let R;e[78]!==b||e[79]!==v||e[80]!==_||e[81]!==T?(R=s.jsx(b,{align:T,className:v,children:_}),e[78]=b,e[79]=v,e[80]=_,e[81]=T,e[82]=R):R=e[82];let F;return e[83]!==g||e[84]!==y||e[85]!==A||e[86]!==j||e[87]!==R?(F=s.jsxs(g,{open:y,onOpenChange:A,children:[j,R]}),e[83]=g,e[84]=y,e[85]=A,e[86]=j,e[87]=R,e[88]=F):F=e[88],F}function $i(t){return t.group==="local"}function zi(t){return t.group==="cloud"}function pn(t){const e=O.c(9),{title:n,variant:r,icon:o,testId:a}=t,c=(r===void 0?"muted":r)==="success"?"bg-success/10 text-success":"text-muted-foreground";let u;e[0]!==c?(u=B("inline-flex w-fit items-center gap-2 mx-1 mt-2 mb-1 px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide",c),e[0]=c,e[1]=u):u=e[1];let d;e[2]!==n?(d=s.jsx("span",{children:n}),e[2]=n,e[3]=d):d=e[3];let V;return e[4]!==o||e[5]!==u||e[6]!==d||e[7]!==a?(V=s.jsxs("div",{"data-testid":a,className:u,children:[o,d]}),e[4]=o,e[5]=u,e[6]=d,e[7]=a,e[8]=V):V=e[8],V}function hn(t){const e=O.c(20),{row:n,active:r,onSelect:o,unavailableHint:a}=t;let i;e[0]!==o||e[1]!==n.mode?(i=()=>o(n.mode),e[0]=o,e[1]=n.mode,e[2]=i):i=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=B("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),e[3]=c):c=e[3];let u;e[4]!==n.icon?(u=s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:n.icon}),e[4]=n.icon,e[5]=u):u=e[5];let d;e[6]!==n.label?(d=s.jsx("div",{className:"text-sm",children:n.label}),e[6]=n.label,e[7]=d):d=e[7];const V=a??n.description;let l;e[8]!==V?(l=s.jsx("div",{className:"text-xs text-muted-foreground",children:V}),e[8]=V,e[9]=l):l=e[9];let m;e[10]!==d||e[11]!==l?(m=s.jsxs("div",{className:"flex-1",children:[d,l]}),e[10]=d,e[11]=l,e[12]=m):m=e[12];let f;e[13]!==r?(f=r&&s.jsx(Ke,{size:14,className:"text-foreground mt-0.5"}),e[13]=r,e[14]=f):f=e[14];let x;return e[15]!==i||e[16]!==u||e[17]!==m||e[18]!==f?(x=s.jsxs("button",{type:"button",role:"menuitem",onClick:i,className:c,children:[u,m,f]}),e[15]=i,e[16]=u,e[17]=m,e[18]=f,e[19]=x):x=e[19],x}function Bi(t){const e=O.c(19),{locked:n,currentBranch:r,virtualMcpId:o}=t,a=js(),i=ji(),{org:c}=le();let u;e[0]!==c.id||e[1]!==c.slug?(u={connectionId:Mr,orgId:c.id,orgSlug:c.slug},e[0]=c.id,e[1]=c.slug,e[2]=u):u=e[2];const d=Ee(u),V=pi(d),l=rt(),m=l?.lockedHarness??null,f=l?.lockedSandbox??null,x=l?.isThreadLocked??!1,p=hi();let h;e[3]!==x||e[4]!==m||e[5]!==f||e[6]!==a?(h=Di({selectedMode:a,lockedHarness:m,lockedSandbox:f,isThreadLocked:x}),e[3]=x,e[4]=m,e[5]=f,e[6]=a,e[7]=h):h=e[7];const b=h;let g;e[8]!==r||e[9]!==i||e[10]!==V||e[11]!==o?(g=A=>{i(A),G("agent_mode_selected",{mode:A}),r&&V.mutate({virtualMcpId:o,branch:r,sandboxProviderKind:A==="cloud-decopilot"?"agent-sandbox":"user-desktop"})},e[8]=r,e[9]=i,e[10]=V,e[11]=o,e[12]=g):g=e[12];const v=g;let y;return e[13]!==p||e[14]!==v||e[15]!==n||e[16]!==m||e[17]!==b?(y=s.jsx(s.Fragment,{children:s.jsx(Li,{mode:b,availability:p,locked:n,lockedHarness:m,onSelect:v})}),e[13]=p,e[14]=v,e[15]=n,e[16]=m,e[17]=b,e[18]=y):y=e[18],y}const xn=["alpha","beta","gamma","delta","epsilon","zeta","eta","theta","iota","kappa","lambda","mu","nu","xi","omicron","pi","rho","sigma","tau","upsilon","phi","chi","psi","omega"],gn=["andromedae","antliae","apodis","aquarii","aquilae","arae","arietis","aurigae","bootis","caeli","camelopardalis","cancri","capricorni","carinae","cassiopeiae","centauri","cephei","ceti","chamaeleontis","circini","columbae","corvi","crateris","crucis","cygni","delphini","doradus","draconis","equulei","eridani","fornacis","geminorum","gruis","herculis","horologii","hydrae","hydri","indi","lacertae","leonis","leporis","librae","lupi","lyncis","lyrae","mensae","microscopii","monocerotis","muscae","normae","octantis","ophiuchi","orionis","pavonis","pegasi","persei","phoenicis","pictoris","piscium","puppis","pyxidis","reticuli","sagittae","sagittarii","scorpii","sculptoris","scuti","serpentis","sextantis","tauri","telescopii","trianguli","tucanae","velorum","virginis","volantis","vulpeculae"];function Ui(){const t=xn[Math.floor(Math.random()*xn.length)],e=gn[Math.floor(Math.random()*gn.length)];return`${t}-${e}`}const Ge=100;function Ki(t,e,n){const r=e.trim().toLowerCase();return r?(t??[]).some(o=>o.branches.some(a=>typeof a.name=="string"&&!n.has(a.name)&&a.name.toLowerCase().includes(r))):!0}function qi(t,e){const n=e.trim().toLowerCase();return n?[...t].some(r=>r.toLowerCase().includes(n)):!0}function Qi(t){const e=t;if(e.structuredContent)return e.structuredContent;const n=e.content?.find(r=>r.type==="text")?.text;if(n)try{return JSON.parse(n)}catch{return[]}return[]}function Yi(t){const e=O.c(48),{orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:i,owner:c,repo:u,enabled:d}=t,V=d===void 0?!0:d,l=a??null;let m;e[0]!==n||e[1]!==r||e[2]!==l?(m={connectionId:l,orgId:n,orgSlug:r},e[0]=n,e[1]=r,e[2]=l,e[3]=m):m=e[3];const f=Ee(m);let x;e[4]!==a||e[5]!==n||e[6]!==r||e[7]!==c||e[8]!==u?(x=er.githubBranches(n,r,a,c,u),e[4]=a,e[5]=n,e[6]=r,e[7]=c,e[8]=u,e[9]=x):x=e[9];const p=V&&!!a&&!!c&&!!u;let h;e[10]!==f||e[11]!==c||e[12]!==u?(h=async L=>{const{pageParam:Q,signal:M}=L,U=Number(Q),q=await f.callTool({name:"list_branches",arguments:{owner:c,repo:u,page:U,perPage:Ge}},void 0,{signal:M}),K=Qi(q);return{branches:Array.isArray(K)?K:K.branches??[],default_branch:Array.isArray(K)?null:K.default_branch??null,page:U}},e[10]=f,e[11]=c,e[12]=u,e[13]=h):h=e[13];let b;e[14]!==x||e[15]!==p||e[16]!==h?(b={queryKey:x,enabled:p,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:h,getNextPageParam:Xi},e[14]=x,e[15]=p,e[16]=h,e[17]=b):b=e[17];const{data:g,isLoading:v,isError:y,hasNextPage:A,isFetchingNextPage:j,fetchNextPage:k}=wo(b);let S,C;e[18]!==i||e[19]!==o?(C=new Set(Object.keys(i?.[o]??{})),S=[...C].sort().map(Zi),e[18]=i,e[19]=o,e[20]=S,e[21]=C):(S=e[20],C=e[21]);const D=S;let N;if(e[22]!==g?.pages){const L=new Map;for(const M of g?.pages??[])for(const U of M.branches)typeof U.name=="string"&&L.set(U.name,U);N=[...L.values()].filter(Ji),e[22]=g?.pages,e[23]=N}else N=e[23];let P;e[24]!==N||e[25]!==C?(P=N.filter(L=>!C.has(L.name)).map(Wi),e[24]=N,e[25]=C,e[26]=P):P=e[26];const T=P;let _;e[27]!==g?.pages?(_=g?.pages.find(Gi)?.default_branch??null,e[27]=g?.pages,e[28]=_):_=e[28];const R=_;let F;e[29]!==g?.pages||e[30]!==k||e[31]!==j||e[32]!==C?(F=async(L,Q)=>{const M=Q===void 0?Hi:Q;if(!M()||qi(C,L)||j)return;let U=g?.pages??[];for(;M()&&!Ki(U,L,C)&&(U.at(-1)?.branches.length??Ge)>=Ge;){const q=await k();if(!M())break;const K=q.data?.pages??U;if(K.length===U.length)break;U=K}},e[29]=g?.pages,e[30]=k,e[31]=j,e[32]=C,e[33]=F):F=e[33];const E=F,I=A??!1;let $;e[34]!==k||e[35]!==A||e[36]!==j?($=()=>{A&&!j&&k()},e[34]=k,e[35]=A,e[36]=j,e[37]=$):$=e[37];let z;return e[38]!==R||e[39]!==E||e[40]!==y||e[41]!==j||e[42]!==v||e[43]!==T||e[44]!==I||e[45]!==$||e[46]!==D?(z={yours:D,others:T,defaultBase:R,isLoading:v,isError:y,hasMore:I,isFetchingMore:j,fetchMore:$,fetchUntilMatch:E},e[38]=R,e[39]=E,e[40]=y,e[41]=j,e[42]=v,e[43]=T,e[44]=I,e[45]=$,e[46]=D,e[47]=z):z=e[47],z}function Hi(){return!0}function Gi(t){return t.default_branch}function Wi(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Ji(t){return typeof t.name=="string"}function Zi(t){return{name:t,source:"yours"}}function Xi(t){if(!(t.branches.length<Ge))return t.page+1}function el(t){const e=O.c(84),{orgId:n,orgSlug:r,userId:o,connectionId:a,owner:i,repo:c,sandboxMap:u,value:d,onChange:V,disabled:l,placement:m}=t,f=l===void 0?!1:l,p=(m===void 0?"chat":m)==="header",[h,b]=w.useState(!1),[g,v]=w.useState(""),[y,A]=w.useState(!1),j=w.useRef(0);let k;e[0]!==a||e[1]!==h||e[2]!==n||e[3]!==r||e[4]!==i||e[5]!==c||e[6]!==u||e[7]!==o?(k={orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:u,owner:i,repo:c,enabled:h},e[0]=a,e[1]=h,e[2]=n,e[3]=r,e[4]=i,e[5]=c,e[6]=u,e[7]=o,e[8]=k):k=e[8];const{yours:S,others:C,isLoading:D,isError:N,hasMore:P,isFetchingMore:T,fetchMore:_,fetchUntilMatch:R}=Yi(k);let F;e[9]!==V?(F=oe=>{V(oe),b(!1)},e[9]=V,e[10]=F):F=e[10];const E=F,I=d??"Select branch…";let $;e[11]!==R?($=oe=>{v(oe),j.current=j.current+1;const Ne=j.current,ht=oe.trim();if(!ht){A(!1);return}A(!0),R(ht,()=>Ne===j.current).finally(()=>{Ne===j.current&&A(!1)})},e[11]=R,e[12]=$):$=e[12];const z=$;let L;e[13]!==_?(L=oe=>{const Ne=oe.currentTarget;Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight<48&&_()},e[13]=_,e[14]=L):L=e[14];const Q=L,M=f?void 0:b,U=p?"outline":"ghost",q=p?"sm":"default";let K;e[15]!==f||e[16]!==p?(K=B("font-mono shrink min-w-0 max-w-[200px]",p?"gap-1.5 text-xs":B("text-xs text-muted-foreground hover:text-foreground transition-[gap] duration-200",f?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5")),e[15]=f,e[16]=p,e[17]=K):K=e[17];let Y;e[18]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx(He,{className:"h-3.5 w-3.5 shrink-0"}),e[18]=Y):Y=e[18];const ne=p?"":"transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[200px] @[320px]/chat-bottom:opacity-100";let X;e[19]!==ne?(X=B("min-w-0 truncate",ne),e[19]=ne,e[20]=X):X=e[20];let ee;e[21]!==I||e[22]!==X?(ee=s.jsx("span",{className:X,children:I}),e[21]=I,e[22]=X,e[23]=ee):ee=e[23];let W;e[24]!==f||e[25]!==p?(W=!f&&s.jsx(Vt,{size:12,className:B("opacity-60 shrink-0",p?"":"hidden @[320px]/chat-bottom:inline-block")}),e[24]=f,e[25]=p,e[26]=W):W=e[26];let J;e[27]!==f||e[28]!==I||e[29]!==K||e[30]!==ee||e[31]!==W||e[32]!==U||e[33]!==q?(J=s.jsx(he,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Ut,{asChild:!0,children:s.jsxs(re,{variant:U,size:q,"aria-label":I,disabled:f,className:K,children:[Y,ee,W]})})})}),e[27]=f,e[28]=I,e[29]=K,e[30]=ee,e[31]=W,e[32]=U,e[33]=q,e[34]=J):J=e[34];let Z;e[35]!==I?(Z=s.jsx(xe,{children:I}),e[35]=I,e[36]=Z):Z=e[36];let te;e[37]!==J||e[38]!==Z?(te=s.jsxs(ge,{children:[J,Z]}),e[37]=J,e[38]=Z,e[39]=te):te=e[39];let se;e[40]!==z||e[41]!==g?(se=s.jsx(vo,{placeholder:"Search loaded branches…",value:g,onValueChange:z}),e[40]=z,e[41]=g,e[42]=se):se=e[42];let H;e[43]!==E?(H=s.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>E(Ui()),children:"New"}),e[43]=E,e[44]=H):H=e[44];let ie;e[45]!==se||e[46]!==H?(ie=s.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[se,H]}),e[45]=se,e[46]=H,e[47]=ie):ie=e[47];let be;e[48]!==N?(be=N&&s.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[48]=N,e[49]=be):be=e[49];let ve;e[50]!==P||e[51]!==N||e[52]!==D?(ve=!N&&!D&&s.jsx(yo,{children:P?"Looking through more branches...":"No branches found."}),e[50]=P,e[51]=N,e[52]=D,e[53]=ve):ve=e[53];let ye;e[54]!==E||e[55]!==S?(ye=S.length>0&&s.jsx(Xt,{heading:"Your branches",children:S.map(oe=>s.jsxs(en,{value:oe.name,onSelect:()=>E(oe.name),children:[s.jsx(He,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:oe.name})]},oe.name))}),e[54]=E,e[55]=S,e[56]=ye):ye=e[56];let Ae;e[57]!==C||e[58]!==E?(Ae=C.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(bo,{}),s.jsx(Xt,{heading:"Other branches in repo",children:C.map(oe=>s.jsxs(en,{value:oe.name,onSelect:()=>E(oe.name),children:[s.jsx(He,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:oe.name}),oe.author&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",oe.author]})]},oe.name))})]}),e[57]=C,e[58]=E,e[59]=Ae):Ae=e[59];let je;e[60]!==_||e[61]!==P||e[62]!==T||e[63]!==y?(je=P&&s.jsx("div",{className:"border-t p-2",children:s.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:T,onClick:_,children:T||y?"Loading more…":"Load more branches"})}),e[60]=_,e[61]=P,e[62]=T,e[63]=y,e[64]=je):je=e[64];let we;e[65]!==P||e[66]!==C.length?(we=!P&&C.length>0&&s.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:"All loaded"}),e[65]=P,e[66]=C.length,e[67]=we):we=e[67];let Se;e[68]!==Q||e[69]!==be||e[70]!==ve||e[71]!==ye||e[72]!==Ae||e[73]!==je||e[74]!==we?(Se=s.jsxs(Ao,{onScroll:Q,children:[be,ve,ye,Ae,je,we]}),e[68]=Q,e[69]=be,e[70]=ve,e[71]=ye,e[72]=Ae,e[73]=je,e[74]=we,e[75]=Se):Se=e[75];let Ce;e[76]!==ie||e[77]!==Se?(Ce=s.jsx(Kt,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:s.jsxs(jo,{children:[ie,Se]})}),e[76]=ie,e[77]=Se,e[78]=Ce):Ce=e[78];let qe;return e[79]!==h||e[80]!==te||e[81]!==Ce||e[82]!==M?(qe=s.jsxs(Bt,{open:h,onOpenChange:M,children:[te,Ce]}),e[79]=h,e[80]=te,e[81]=Ce,e[82]=M,e[83]=qe):qe=e[83],qe}function tl(t){const e=O.c(25);let n,r,o,a;e[0]!==t?({locked:n,placement:r,value:a,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a):(n=e[1],r=e[2],o=e[3],a=e[4]);const i=r==="header";if(n){const u=a??"(no branch)",d=i?"h-8 gap-1.5 border border-input bg-background px-2.5":"h-9 gap-0 px-2";let V;e[5]!==d?(V=B("inline-flex items-center rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",d),e[5]=d,e[6]=V):V=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(He,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[7]=l):l=e[7];const m=i?"":"max-w-0 opacity-0";let f;e[8]!==m?(f=B("min-w-0 truncate",m),e[8]=m,e[9]=f):f=e[9];let x;e[10]!==u||e[11]!==f?(x=s.jsx("span",{className:f,children:u}),e[10]=u,e[11]=f,e[12]=x):x=e[12];let p;e[13]!==V||e[14]!==x?(p=s.jsx(he,{asChild:!0,children:s.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:V,children:[l,x]})}),e[13]=V,e[14]=x,e[15]=p):p=e[15];let h;e[16]!==u?(h=s.jsxs(xe,{children:["This chat is using branch ",u,". Start a new chat to use a different branch."]}),e[16]=u,e[17]=h):h=e[17];let b;return e[18]!==p||e[19]!==h?(b=s.jsxs(ge,{children:[p,h]}),e[18]=p,e[19]=h,e[20]=b):b=e[20],b}let c;return e[21]!==r||e[22]!==o||e[23]!==a?(c=s.jsx(el,{...o,value:a,placement:r}),e[21]=r,e[22]=o,e[23]=a,e[24]=c):c=e[24],c}function nl(t){const e=O.c(3),{branchPill:n,modePicker:r}=t;if(!n&&!r)return null;let o;return e[0]!==n||e[1]!==r?(o=s.jsxs(s.Fragment,{children:[r,n]}),e[0]=n,e[1]=r,e[2]=o):o=e[2],o}function sl(t){const e=O.c(22),{virtualMcp:n,currentBranch:r}=t,o=Fn(),a=rt();let i;e[0]!==o?.messages||e[1]!==a?.isThreadLocked?(i=(o?.messages??[]).length>0||(a?.isThreadLocked??!1),e[0]=o?.messages,e[1]=a?.isThreadLocked,e[2]=i):i=e[2];const c=i,u=a?.setCurrentTaskBranch;let d;e[3]!==n?(d=Jn(n),e[3]=n,e[4]=d):d=e[4];const V=d,l=V?.connectionId,{data:m}=Tn.useSession(),f=m?.user?.id??"",{org:x}=le();let p;e[5]!==l||e[6]!==r||e[7]!==V||e[8]!==c||e[9]!==x||e[10]!==u||e[11]!==f||e[12]!==n?.id||e[13]!==n?.metadata?.sandboxMap?(p=V&&l?s.jsx(tl,{orgId:x.id,orgSlug:x.slug,userId:f,virtualMcpId:n?.id??"",connectionId:l,owner:V.owner,repo:V.name,sandboxMap:n?.metadata?.sandboxMap,value:r,onChange:A=>{u&&u(A)},locked:c,placement:"chat"}):null,e[5]=l,e[6]=r,e[7]=V,e[8]=c,e[9]=x,e[10]=u,e[11]=f,e[12]=n?.id,e[13]=n?.metadata?.sandboxMap,e[14]=p):p=e[14];const h=p,b=n?.id??"";let g;e[15]!==r||e[16]!==c||e[17]!==b?(g=s.jsx(Bi,{locked:c,currentBranch:r,virtualMcpId:b}),e[15]=r,e[16]=c,e[17]=b,e[18]=g):g=e[18];const v=g;let y;return e[19]!==h||e[20]!==v?(y=s.jsx(nl,{branchPill:h,modePicker:v}),e[19]=h,e[20]=v,e[21]=y):y=e[21],y}const rl=["fast","smart","thinking"],Re={fast:"Fast",smart:"Smart",thinking:"Thinking"};function ol(t){const e=O.c(30),{tier:n,subtitleFor:r,iconFor:o,onSelect:a}=t,[i,c]=w.useState(!1);let u;e[0]!==a?(u=S=>{a(S),c(!1)},e[0]=a,e[1]=u):u=e[1];const d=u,V=Re[n];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=B("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[2]=l):l=e[2];let m;e[3]!==o||e[4]!==n?(m=o?.(n),e[3]=o,e[4]=n,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=B("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[6]=f):f=e[6];const x=Re[n];let p;e[7]!==x?(p=s.jsx("span",{className:f,children:x}),e[7]=x,e[8]=p):p=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Vt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[9]=h):h=e[9];let b;e[10]!==V||e[11]!==m||e[12]!==p?(b=s.jsx(he,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Ut,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":V,className:l,children:[m,p,h]})})})}),e[10]=V,e[11]=m,e[12]=p,e[13]=b):b=e[13];const g=Re[n];let v;e[14]!==g?(v=s.jsx(xe,{children:g}),e[14]=g,e[15]=v):v=e[15];let y;e[16]!==v||e[17]!==b?(y=s.jsxs(ge,{children:[b,v]}),e[16]=v,e[17]=b,e[18]=y):y=e[18];let A;e[19]!==d||e[20]!==o||e[21]!==r||e[22]!==n?(A=rl.map(S=>{const C=r(S),D=o?.(S),N=S===n;return s.jsxs("button",{type:"button",role:"menuitem","aria-label":Re[S],onClick:()=>d(S),className:B("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),children:[D&&s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:D}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-sm",children:Re[S]}),C&&s.jsx("div",{className:"text-xs text-muted-foreground",children:C})]}),N&&s.jsx(Ke,{size:14,className:"text-foreground mt-0.5"})]},S)}),e[19]=d,e[20]=o,e[21]=r,e[22]=n,e[23]=A):A=e[23];let j;e[24]!==A?(j=s.jsx(Kt,{align:"end",className:"p-1 w-56",children:s.jsx("div",{role:"menu",className:"flex flex-col",children:A})}),e[24]=A,e[25]=j):j=e[25];let k;return e[26]!==i||e[27]!==y||e[28]!==j?(k=s.jsxs(Bt,{open:i,onOpenChange:c,children:[y,j]}),e[26]=i,e[27]=y,e[28]=j,e[29]=k):k=e[29],k}function al(t){return t==="fast"?s.jsx(Wr,{size:16}):t==="thinking"?s.jsx(Jr,{size:16}):s.jsx(So,{size:16})}function il(){const t=O.c(6),e=wi(),n=Si(),r=js();let o;t[0]!==r?(o=c=>Ni(r,c),t[0]=r,t[1]=o):o=t[1];const a=o;let i;return t[2]!==n||t[3]!==a||t[4]!==e?(i=s.jsx(ol,{tier:e,subtitleFor:a,iconFor:al,onSelect:n}),t[2]=n,t[3]=a,t[4]=e,t[5]=i):i=t[5],i}async function Yt(t,e,n,r,o){if(!mt(e)){ae.error("Selected model does not support file uploads");return}const a=n.type||"application/octet-stream";if(!ho(a,e)){const c=ns(e),u=e?.title??"This model";o?o({fileName:n.name,modelName:u,accepted:c}):ae.error(`"${n.name}" can't be attached`,{description:`${u} accepts ${c}.`});return}const i=10*1024*1024;if(n.size>i){ae.error(`File "${n.name}" exceeds 10MB limit`);return}try{const c=new FileReader,u=new Promise((l,m)=>{c.onload=()=>{const f=c.result;if(typeof f!="string"){m(new Error("Failed to read file as data URL"));return}const x=f.includes(",")?f.split(",")[1]??f:f;l(x)},c.onerror=m});c.readAsDataURL(n);const d=await u,V={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:d};jr(t,{from:r,to:r},V)}catch(c){console.error("Failed to process file:",c),ae.error(`Failed to load file "${n.name}"`)}}function ll(t){const e=O.c(8),{editor:n,selectedModel:r,onUnsupportedFile:o}=t,a=w.useRef(ul);let i,c;e[0]!==n||e[1]!==o||e[2]!==r?(i=()=>{a.current=async(V,l)=>{await Yt(n,r,V,l,o)}},c=[n,r,o],e[0]=n,e[1]=o,e[2]=r,e[3]=i,e[4]=c):(i=e[3],c=e[4]),w.useEffect(i,c);let u,d;return e[5]!==n?(u=()=>{if(n?.isDestroyed)return;const V=new It("fileDropHandler");n.state.plugins.find(f=>f.spec.key===V)&&n.unregisterPlugin(V);const m=new Co({key:V,props:{handleDrop:(f,x,p,h)=>{if(h)return!1;const b=x.dataTransfer?.files;if(!b||b.length===0)return!1;x.preventDefault();const g=f.posAtCoords({left:x.clientX,top:x.clientY});if(!g)return!1;const v=Array.from(b),y=g.pos;for(const A of v)a.current?.(A,y);return!0},handlePaste:(f,x)=>{const p=x.clipboardData?.items;if(!p)return!1;const h=Array.from(p).filter(cl);if(h.length===0)return!1;x.preventDefault();const{from:b}=f.state.selection;for(const g of h){const v=g.getAsFile();v&&a.current?.(v,b)}return!0}}});return n.registerPlugin(m),()=>{n?.isDestroyed||n.unregisterPlugin(V)}},d=[n],e[5]=n,e[6]=u,e[7]=d):(u=e[6],d=e[7]),w.useEffect(u,d),null}function cl(t){return t.kind==="file"}function ul(){return Promise.resolve()}function dl(t){const e=O.c(26),{info:n,onClose:r}=t,o=n!==null;let a;e[0]!==r?(a=A=>!A&&r(),e[0]=r,e[1]=a):a=e[1];let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=i):i=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:i.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let u,d;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-amber-500/15 text-amber-600 dark:text-amber-400",children:s.jsx(Rn,{size:18})}),d=s.jsx(it,{className:"text-xl font-semibold tracking-tight",children:"File type not supported"}),e[4]=u,e[5]=d):(u=e[4],d=e[5]);const V=n?.fileName;let l;e[6]!==V?(l=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,s.jsxs(at,{className:"relative gap-4",children:[u,s.jsxs("div",{children:[d,s.jsxs(Ft,{className:"mt-1.5 text-sm leading-relaxed",children:[s.jsxs("span",{className:"font-medium text-foreground",children:["“",V,"”"]})," ","can't be attached to this chat."]})]})]})]}),e[6]=V,e[7]=l):l=e[7];const m=n?.modelName;let f;e[8]!==m?(f=s.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:[m," accepts"]}),e[8]=m,e[9]=f):f=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Zr,{size:14,className:"text-muted-foreground"}),e[10]=x):x=e[10];const p=n?.accepted;let h;e[11]!==p?(h=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[x,s.jsx("span",{className:"capitalize",children:p})]}),e[11]=p,e[12]=h):h=e[12];let b;e[13]!==f||e[14]!==h?(b=s.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:s.jsxs("div",{className:"rounded-xl border border-border p-4",children:[f,h]})}),e[13]=f,e[14]=h,e[15]=b):b=e[15];let g;e[16]!==r?(g=s.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:s.jsx(re,{onClick:r,children:"Got it"})}),e[16]=r,e[17]=g):g=e[17];let v;e[18]!==b||e[19]!==g||e[20]!==l?(v=s.jsxs(lt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Vl,children:[l,b,g]}),e[18]=b,e[19]=g,e[20]=l,e[21]=v):v=e[21];let y;return e[22]!==o||e[23]!==v||e[24]!==a?(y=s.jsx(ct,{open:o,onOpenChange:a,children:v}),e[22]=o,e[23]=v,e[24]=a,e[25]=y):y=e[25],y}function Vl(t){return t.preventDefault()}function fl(){const t=O.c(3),[e,n]=w.useState(null);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>n(null),t[0]=r):r=t[0];let o;return t[1]!==e?(o={unsupportedFile:e,onUnsupportedFile:n,clearUnsupportedFile:r},t[1]=e,t[2]=o):o=t[2],o}var ml=No;var pl=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Et=pl.join(","),Ss=typeof Element>"u",$e=Ss?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,tt=!Ss&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},nt=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=o===""||o==="true",i=a||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):nt(e.parentNode));return i},hl=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},xl=function(e,n,r){if(nt(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Et));return n&&$e.call(e,Et)&&o.unshift(e),o=o.filter(r),o},Rt=function(e,n,r){for(var o=[],a=Array.from(e);a.length;){var i=a.shift();if(!nt(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),u=c.length?c:i.children,d=Rt(u,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:i,candidates:d})}else{var V=$e.call(i,Et);V&&r.filter(i)&&(n||!e.includes(i))&&o.push(i);var l=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),m=!nt(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(l&&m){var f=Rt(l===!0?i.children:l.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else a.unshift.apply(a,i.children)}}return o},Cs=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ns=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||hl(e))&&!Cs(e)?0:e.tabIndex},gl=function(e,n){var r=Ns(e);return r<0&&n&&!Cs(e)?0:r},bl=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},ks=function(e){return e.tagName==="INPUT"},vl=function(e){return ks(e)&&e.type==="hidden"},yl=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},Al=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},jl=function(e){if(!e.name)return!0;var n=e.form||tt(e),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var a=Al(o,e.form);return!a||a===e},wl=function(e){return ks(e)&&e.type==="radio"},Sl=function(e){return wl(e)&&!jl(e)},Cl=function(e){var n,r=e&&tt(e),o=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==e){var i,c,u;for(a=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||e!=null&&(u=e.ownerDocument)!==null&&u!==void 0&&u.contains(e));!a&&o;){var d,V,l;r=tt(o),o=(d=r)===null||d===void 0?void 0:d.host,a=!!((V=o)!==null&&V!==void 0&&(l=V.ownerDocument)!==null&&l!==void 0&&l.contains(o))}}return a},bn=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},Nl=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var i=$e.call(e,"details>summary:first-of-type"),c=i?e.parentElement:e;if($e.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var u=e;e;){var d=e.parentElement,V=tt(e);if(d&&!d.shadowRoot&&o(d)===!0)return bn(e);e.assignedSlot?e=e.assignedSlot:!d&&V!==e.ownerDocument?e=V.host:e=d}e=u}if(Cl(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bn(e);return!1},kl=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return $e.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},_l=function(e,n){return!(n.disabled||vl(n)||Nl(n,e)||yl(n)||kl(n))},vn=function(e,n){return!(Sl(n)||Ns(n)<0||!_l(e,n))},Il=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},_s=function(e){var n=[],r=[];return e.forEach(function(o,a){var i=!!o.scopeParent,c=i?o.scopeParent:o,u=gl(c,i),d=i?_s(o.candidates):c;u===0?i?n.push.apply(n,d):n.push(c):r.push({documentOrder:a,tabIndex:u,item:o,isScope:i,content:d})}),r.sort(bl).reduce(function(o,a){return a.isScope?o.push.apply(o,a.content):o.push(a.content),o},[]).concat(n)},Is=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Rt([e],n.includeContainer,{filter:vn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Il}):r=xl(e,n.includeContainer,vn.bind(null,n)),_s(r)};function El(){return/apple/i.test(navigator.vendor)}const yn="data-floating-ui-focusable";function Rl(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function Tt(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&tr(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Te(t){return"composedPath"in t?t.composedPath()[0]:t.target}function At(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Tl(t){return t.matches("html,body")}function ze(t){return t?.ownerDocument||document}function Pl(t){return t?t.hasAttribute(yn)?t:t.querySelector("["+yn+"]")||t:null}function We(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var a;return o.parentId===e&&(!n||((a=o.context)==null?void 0:a.open))}).flatMap(o=>[o,...We(t,o.id,n)])}function Dl(t){return"nativeEvent"in t}var Ml=typeof document<"u",Fl=function(){},me=Ml?w.useLayoutEffect:Fl;const Ol={...Pn},Ll=Ol.useInsertionEffect,$l=Ll||(t=>t());function ke(t){const e=w.useRef(()=>{});return $l(()=>{e.current=t}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const Es=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Rs(t,e){const n=Is(t,Es()),r=n.length;if(r===0)return;const o=Rl(ze(t)),a=n.indexOf(o),i=a===-1?e===1?0:r-1:a+e;return n[i]}function zl(t){return Rs(ze(t).body,1)||t}function Bl(t){return Rs(ze(t).body,-1)||t}function jt(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Tt(n,r)}function Ul(t){Is(t,Es()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function An(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Kl="data-floating-ui-focusable",jn="active",wn="selected",ql={...Pn};let Sn=!1,Ql=0;const Cn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Ql++;function Yl(){const[t,e]=w.useState(()=>Sn?Cn():void 0);return me(()=>{t==null&&e(Cn())},[]),w.useEffect(()=>{Sn=!0},[]),t}const Hl=ql.useId,Ht=Hl||Yl;function Gl(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const Wl=w.createContext(null),Jl=w.createContext(null),Ts=()=>{var t;return((t=w.useContext(Wl))==null?void 0:t.id)||null},Ps=()=>w.useContext(Jl);function Gt(t){return"data-floating-ui-"+t}const Zl={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Nn=w.forwardRef(function(e,n){const[r,o]=w.useState();me(()=>{El()&&o("button")},[]);const a={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Gt("focus-guard")]:"",style:Zl};return s.jsx("span",{...e,...a})}),Xl={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ds=w.createContext(null),kn=Gt("portal");function ec(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Ht(),o=nc(),[a,i]=w.useState(null),c=w.useRef(null);return me(()=>()=>{a?.remove(),queueMicrotask(()=>{c.current=null})},[a]),me(()=>{if(!r||c.current)return;const u=e?document.getElementById(e):null;if(!u)return;const d=document.createElement("div");d.id=r,d.setAttribute(kn,""),u.appendChild(d),c.current=d,i(d)},[e,r]),me(()=>{if(n===null||!r||c.current)return;let u=n||o?.portalNode;u&&!lr(u)&&(u=u.current),u=u||document.body;let d=null;e&&(d=document.createElement("div"),d.id=e,u.appendChild(d));const V=document.createElement("div");V.id=r,V.setAttribute(kn,""),u=d||u,u.appendChild(V),c.current=V,i(V)},[e,n,r,o]),a}function tc(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,a=ec({id:n,root:r}),[i,c]=w.useState(null),u=w.useRef(null),d=w.useRef(null),V=w.useRef(null),l=w.useRef(null),m=i?.modal,f=i?.open,x=!!i&&!i.modal&&i.open&&o&&!!(r||a);return w.useEffect(()=>{if(!a||!o||m)return;function p(h){a&&jt(h)&&(h.type==="focusin"?An:Ul)(a)}return a.addEventListener("focusin",p,!0),a.addEventListener("focusout",p,!0),()=>{a.removeEventListener("focusin",p,!0),a.removeEventListener("focusout",p,!0)}},[a,o,m]),w.useEffect(()=>{a&&(f||An(a))},[f,a]),s.jsxs(Ds.Provider,{value:w.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:u,afterOutsideRef:d,beforeInsideRef:V,afterInsideRef:l,portalNode:a,setFocusManagerState:c}),[o,a]),children:[x&&a&&s.jsx(Nn,{"data-type":"outside",ref:u,onFocus:p=>{if(jt(p,a)){var h;(h=V.current)==null||h.focus()}else{const b=i?i.domReference:null,g=Bl(b);g?.focus()}}}),x&&a&&s.jsx("span",{"aria-owns":a.id,style:Xl}),a&&sr.createPortal(e,a),x&&a&&s.jsx(Nn,{"data-type":"outside",ref:d,onFocus:p=>{if(jt(p,a)){var h;(h=l.current)==null||h.focus()}else{const b=i?i.domReference:null,g=zl(b);g?.focus(),i?.closeOnFocusOut&&i?.onOpenChange(!1,p.nativeEvent,"focus-out")}}})]})}const nc=()=>w.useContext(Ds),sc={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},rc={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},_n=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function oc(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:a}=t,{enabled:i=!0,escapeKey:c=!0,outsidePress:u=!0,outsidePressEvent:d="pointerdown",referencePress:V=!1,referencePressEvent:l="pointerdown",ancestorScroll:m=!1,bubbles:f,capture:x}=e,p=Ps(),h=ke(typeof u=="function"?u:()=>!1),b=typeof u=="function"?h:u,g=w.useRef(!1),{escapeKey:v,outsidePress:y}=_n(f),{escapeKey:A,outsidePress:j}=_n(x),k=w.useRef(!1),S=ke(_=>{var R;if(!n||!i||!c||_.key!=="Escape"||k.current)return;const F=(R=a.current.floatingContext)==null?void 0:R.nodeId,E=p?We(p.nodesRef.current,F):[];if(!v&&(_.stopPropagation(),E.length>0)){let I=!0;if(E.forEach($=>{var z;if((z=$.context)!=null&&z.open&&!$.context.dataRef.current.__escapeKeyBubbles){I=!1;return}}),!I)return}r(!1,Dl(_)?_.nativeEvent:_,"escape-key")}),C=ke(_=>{var R;const F=()=>{var E;S(_),(E=Te(_))==null||E.removeEventListener("keydown",F)};(R=Te(_))==null||R.addEventListener("keydown",F)}),D=ke(_=>{var R;const F=a.current.insideReactTree;a.current.insideReactTree=!1;const E=g.current;if(g.current=!1,d==="click"&&E||F||typeof b=="function"&&!b(_))return;const I=Te(_),$="["+Gt("inert")+"]",z=ze(o.floating).querySelectorAll($);let L=ce(I)?I:null;for(;L&&!gt(L);){const q=or(L);if(gt(q)||!ce(q))break;L=q}if(z.length&&ce(I)&&!Tl(I)&&!Tt(I,o.floating)&&Array.from(z).every(q=>!Tt(L,q)))return;if(ar(I)&&T){const q=gt(I),K=ir(I),Y=/auto|scroll/,ne=q||Y.test(K.overflowX),X=q||Y.test(K.overflowY),ee=ne&&I.clientWidth>0&&I.scrollWidth>I.clientWidth,W=X&&I.clientHeight>0&&I.scrollHeight>I.clientHeight,J=K.direction==="rtl",Z=W&&(J?_.offsetX<=I.offsetWidth-I.clientWidth:_.offsetX>I.clientWidth),te=ee&&_.offsetY>I.clientHeight;if(Z||te)return}const Q=(R=a.current.floatingContext)==null?void 0:R.nodeId,M=p&&We(p.nodesRef.current,Q).some(q=>{var K;return At(_,(K=q.context)==null?void 0:K.elements.floating)});if(At(_,o.floating)||At(_,o.domReference)||M)return;const U=p?We(p.nodesRef.current,Q):[];if(U.length>0){let q=!0;if(U.forEach(K=>{var Y;if((Y=K.context)!=null&&Y.open&&!K.context.dataRef.current.__outsidePressBubbles){q=!1;return}}),!q)return}r(!1,_,"outside-press")}),N=ke(_=>{var R;const F=()=>{var E;D(_),(E=Te(_))==null||E.removeEventListener(d,F)};(R=Te(_))==null||R.addEventListener(d,F)});w.useEffect(()=>{if(!n||!i)return;a.current.__escapeKeyBubbles=v,a.current.__outsidePressBubbles=y;let _=-1;function R(z){r(!1,z,"ancestor-scroll")}function F(){window.clearTimeout(_),k.current=!0}function E(){_=window.setTimeout(()=>{k.current=!1},rr()?5:0)}const I=ze(o.floating);c&&(I.addEventListener("keydown",A?C:S,A),I.addEventListener("compositionstart",F),I.addEventListener("compositionend",E)),b&&I.addEventListener(d,j?N:D,j);let $=[];return m&&(ce(o.domReference)&&($=xt(o.domReference)),ce(o.floating)&&($=$.concat(xt(o.floating))),!ce(o.reference)&&o.reference&&o.reference.contextElement&&($=$.concat(xt(o.reference.contextElement)))),$=$.filter(z=>{var L;return z!==((L=I.defaultView)==null?void 0:L.visualViewport)}),$.forEach(z=>{z.addEventListener("scroll",R,{passive:!0})}),()=>{c&&(I.removeEventListener("keydown",A?C:S,A),I.removeEventListener("compositionstart",F),I.removeEventListener("compositionend",E)),b&&I.removeEventListener(d,j?N:D,j),$.forEach(z=>{z.removeEventListener("scroll",R)}),window.clearTimeout(_)}},[a,o,c,b,d,n,r,m,i,v,y,S,A,C,D,j,N]),w.useEffect(()=>{a.current.insideReactTree=!1},[a,b,d]);const P=w.useMemo(()=>({onKeyDown:S,...V&&{[sc[l]]:_=>{r(!1,_.nativeEvent,"reference-press")},...l!=="click"&&{onClick(_){r(!1,_.nativeEvent,"reference-press")}}}}),[S,r,V,l]),T=w.useMemo(()=>{function _(R){R.button===0&&(g.current=!0)}return{onKeyDown:S,onMouseDown:_,onMouseUp:_,[rc[d]]:()=>{a.current.insideReactTree=!0}}},[S,d,a]);return w.useMemo(()=>i?{reference:P,floating:T}:{},[i,P,T])}function ac(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Ht(),a=w.useRef({}),[i]=w.useState(()=>Gl()),c=Ts()!=null,[u,d]=w.useState(r.reference),V=ke((f,x,p)=>{a.current.openEvent=f?x:void 0,i.emit("openchange",{open:f,event:x,reason:p,nested:c}),n?.(f,x,p)}),l=w.useMemo(()=>({setPositionReference:d}),[]),m=w.useMemo(()=>({reference:u||r.reference||null,floating:r.floating||null,domReference:r.reference}),[u,r.reference,r.floating]);return w.useMemo(()=>({dataRef:a,open:e,onOpenChange:V,elements:m,events:i,floatingId:o,refs:l}),[e,V,m,i,o,l])}function ic(t){t===void 0&&(t={});const{nodeId:e}=t,n=ac({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[a,i]=w.useState(null),[c,u]=w.useState(null),V=o?.domReference||a,l=w.useRef(null),m=Ps();me(()=>{V&&(l.current=V)},[V]);const f=nr({...t,elements:{...o,...c&&{reference:c}}}),x=w.useCallback(v=>{const y=ce(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),getClientRects:()=>v.getClientRects(),contextElement:v}:v;u(y),f.refs.setReference(y)},[f.refs]),p=w.useCallback(v=>{(ce(v)||v===null)&&(l.current=v,i(v)),(ce(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!ce(v))&&f.refs.setReference(v)},[f.refs]),h=w.useMemo(()=>({...f.refs,setReference:p,setPositionReference:x,domReference:l}),[f.refs,p,x]),b=w.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),g=w.useMemo(()=>({...f,...r,refs:h,elements:b,nodeId:e}),[f,h,b,e,r]);return me(()=>{r.dataRef.current.floatingContext=g;const v=m?.nodesRef.current.find(y=>y.id===e);v&&(v.context=g)}),w.useMemo(()=>({...f,context:g,refs:h,elements:b}),[f,h,b,g])}function wt(t,e,n){const r=new Map,o=n==="item";let a=t;if(o&&t){const{[jn]:i,[wn]:c,...u}=t;a=u}return{...n==="floating"&&{tabIndex:-1,[Kl]:""},...a,...e.map(i=>{const c=i?i[n]:null;return typeof c=="function"?t?c(t):null:c}).concat(t).reduce((i,c)=>(c&&Object.entries(c).forEach(u=>{let[d,V]=u;if(!(o&&[jn,wn].includes(d)))if(d.indexOf("on")===0){if(r.has(d)||r.set(d,[]),typeof V=="function"){var l;(l=r.get(d))==null||l.push(V),i[d]=function(){for(var m,f=arguments.length,x=new Array(f),p=0;p<f;p++)x[p]=arguments[p];return(m=r.get(d))==null?void 0:m.map(h=>h(...x)).find(h=>h!==void 0)}}}else i[d]=V}),i),{})}}function lc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),o=w.useCallback(c=>wt(c,t,"reference"),e),a=w.useCallback(c=>wt(c,t,"floating"),n),i=w.useCallback(c=>wt(c,t,"item"),r);return w.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:i}),[o,a,i])}const cc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function uc(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:a,floatingId:i}=t,{enabled:c=!0,role:u="dialog"}=e,d=Ht(),V=((n=a.domReference)==null?void 0:n.id)||d,l=w.useMemo(()=>{var g;return((g=Pl(a.floating))==null?void 0:g.id)||i},[a.floating,i]),m=(r=cc.get(u))!=null?r:u,x=Ts()!=null,p=w.useMemo(()=>m==="tooltip"||u==="label"?{["aria-"+(u==="label"?"labelledby":"describedby")]:o?l:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":o?l:void 0,...m==="listbox"&&{role:"combobox"},...m==="menu"&&{id:V},...m==="menu"&&x&&{role:"menuitem"},...u==="select"&&{"aria-autocomplete":"none"},...u==="combobox"&&{"aria-autocomplete":"list"}},[m,l,x,o,V,u]),h=w.useMemo(()=>{const g={id:l,...m&&{role:m}};return m==="tooltip"||u==="label"?g:{...g,...m==="menu"&&{"aria-labelledby":V}}},[m,l,V,u]),b=w.useCallback(g=>{let{active:v,selected:y}=g;const A={role:"option",...v&&{id:l+"-fui-option"}};switch(u){case"select":case"combobox":return{...A,"aria-selected":y}}return{}},[l,u]);return w.useMemo(()=>c?{reference:p,floating:h,item:b}:{},[c,p,h,b])}function dc(t){const e=O.c(24),{editor:n,query:r,items:o,onSelect:a,onClose:i}=t,[c,u]=w.useState(0),d=w.useRef(o),V=w.useRef(c),l=w.useRef(a),m=w.useRef(i),f=w.useDeferredValue(r);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{u(0)},e[0]=x):x=e[0];let p;e[1]!==f?(p=[f],e[1]=f,e[2]=p):p=e[2],w.useEffect(x,p);let h,b;e[3]!==o.length||e[4]!==c?(h=()=>{c>=o.length&&o.length>0&&u(0)},b=[o.length,c],e[3]=o.length,e[4]=c,e[5]=h,e[6]=b):(h=e[5],b=e[6]),w.useEffect(h,b);let g,v;e[7]!==o?(g=()=>{d.current=o},v=[o],e[7]=o,e[8]=g,e[9]=v):(g=e[8],v=e[9]),w.useEffect(g,v);let y,A;e[10]!==c?(y=()=>{V.current=c},A=[c],e[10]=c,e[11]=y,e[12]=A):(y=e[11],A=e[12]),w.useEffect(y,A);let j,k;e[13]!==a?(k=()=>{l.current=a},j=[a],e[13]=a,e[14]=j,e[15]=k):(j=e[14],k=e[15]),w.useEffect(k,j);let S,C;e[16]!==i?(S=()=>{m.current=i},C=[i],e[16]=i,e[17]=S,e[18]=C):(S=e[17],C=e[18]),w.useEffect(S,C);let D,N;e[19]!==n?(D=()=>{if(n?.isDestroyed)return;let _;try{_=n.view.dom}catch{return}if(!_)return;const R=E=>{const I=d.current;if(!I.length)return!1;const $=()=>u(L=>(L+1)%I.length),z=()=>u(L=>(L-1+I.length)%I.length);switch(E.key){case"ArrowUp":return E.preventDefault(),z(),!0;case"ArrowDown":return E.preventDefault(),$(),!0;case"Tab":return E.preventDefault(),E.shiftKey?z():$(),!0;case"Home":return E.preventDefault(),u(0),!0;case"End":return E.preventDefault(),u(I.length-1),!0;case"Enter":{if(E.isComposing)return!1;E.preventDefault();const L=V.current;return L!==-1&&I[L]&&l.current?.(I[L],L),!0}case"Escape":return E.preventDefault(),m.current?.(),!0;default:return!1}},F=E=>{R(E)};return _.addEventListener("keydown",F,!0),()=>{_?.removeEventListener("keydown",F,!0)}},N=[n],e[19]=n,e[20]=D,e[21]=N):(D=e[20],N=e[21]),w.useEffect(D,N);const P=o.length?c:void 0;let T;return e[22]!==P?(T={selectedIndex:P,setSelectedIndex:u},e[22]=P,e[23]=T):T=e[23],T}function Vc(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const Ms=w.createContext(void 0);function Fs(){const t=w.useContext(Ms);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function fc({editor:t,char:e,pluginKey:n,allow:r,onOpenChange:o}){const[a,i]=w.useReducer(Vc,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=w.useRef(o);return c.current=o,w.useEffect(()=>{if(t?.isDestroyed)return;const u=n instanceof It?n:new It(n);t.state.plugins.find(l=>l.spec.key===u)&&t.unregisterPlugin(u);const V=Ro({pluginKey:u,editor:t,char:e,allow(l){const m=t.state.doc.resolve(l.range.from);for(let f=m.depth;f>0;f--)if(m.node(f).type.name==="image")return!1;return!(r&&!r(l))},command(){},render:()=>({onStart:l=>{i({type:"ON_START",payload:{element:l.decorationNode??null,query:l.query,range:l.range}}),c.current?.(!0)},onUpdate:l=>{i({type:"ON_UPDATE",payload:{element:l.decorationNode??null,query:l.query,range:l.range}})},onKeyDown:l=>l.event.key==="Escape"?(i({type:"ON_EXIT"}),!0):!1,onExit:()=>{i({type:"ON_EXIT"}),c.current?.(!1)}}),items:()=>[]});return t.registerPlugin(V),()=>{t?.isDestroyed||t.unregisterPlugin(u)}},[t,n,e,i,r]),{state:a,dispatch:i}}function mc({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:o,dispatch:a}=Fs(),i=w.useDeferredValue(o.query),{data:c}=cr({queryKey:Oe.suggestionItems(e,o.open,i),queryFn:()=>o.open?n({query:i}):[]}),u=()=>{a({type:"ON_EXIT"})},d=async(l,m)=>{if(!(o.selectedItem!==null||!o.range)){a({type:"SET_SELECTED_ITEM",payload:l});try{const{view:f}=t,p=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),h=o.range?{...o.range}:{from:0,to:0};p&&o.range&&(h.to+=1),await r({range:h,item:l})===!1?a({type:"SET_SELECTED_ITEM",payload:null}):u()}catch{u()}}},{selectedIndex:V}=dc({editor:t,query:i,items:c,onSelect:d,onClose:u});return{selectedItem:o.selectedItem,items:c,selectedIndex:V,close:u,onSelect:d}}function pc({children:t}){const{state:e,dispatch:n}=Fs(),{open:r,element:o}=e,a=()=>{n({type:"ON_EXIT"})},{refs:i,floatingStyles:c,context:u}=ic({placement:"bottom-start",open:r,onOpenChange:m=>{m||a()},elements:{reference:o},middleware:[ur(10),dr(),Vr()],whileElementsMounted:fr}),d=oc(u,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=uc(u,{role:"listbox"}),{getFloatingProps:l}=lc([d,V]);return r?s.jsx(tc,{children:s.jsx("div",{ref:i.setFloating,style:c,...l(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const hc=t=>{const e=O.c(29),{item:n,isSelected:r,onSelect:o,isLoading:a,ref:i}=t;let c;if(e[0]!==n){const j=ue(n._meta);c=n.title||Mt(n.name,j),e[0]=n,e[1]=c}else c=e[1];const u=c,d=n.description||null,V=n.icon,l=r&&"bg-accent text-accent-foreground",m=a&&"pointer-events-none opacity-50";let f;e[2]!==l||e[3]!==m?(f=B("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",l,m),e[2]=l,e[3]=m,e[4]=f):f=e[4];let x;e[5]!==V||e[6]!==u?(x=V!==void 0&&s.jsx(Un,{icon:V,name:u,size:"xs",className:"mr-2"}),e[5]=V,e[6]=u,e[7]=x):x=e[7];let p;e[8]!==u?(p=s.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:u}),e[8]=u,e[9]=p):p=e[9];let h;e[10]!==a?(h=a&&s.jsx(St,{size:"xs"}),e[10]=a,e[11]=h):h=e[11];let b;e[12]!==p||e[13]!==h?(b=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p,h]}),e[12]=p,e[13]=h,e[14]=b):b=e[14];let g;e[15]!==d?(g=d&&s.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:d}),e[15]=d,e[16]=g):g=e[16];let v;e[17]!==b||e[18]!==g?(v=s.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,g]}),e[17]=b,e[18]=g,e[19]=v):v=e[19];let y;e[20]!==n.drillable?(y=n.drillable&&s.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=n.drillable,e[21]=y):y=e[21];let A;return e[22]!==o||e[23]!==i||e[24]!==v||e[25]!==y||e[26]!==f||e[27]!==x?(A=s.jsxs("div",{ref:i,onClick:o,className:f,children:[x,v,y]}),e[22]=o,e[23]=i,e[24]=v,e[25]=y,e[26]=f,e[27]=x,e[28]=A):A=e[28],A},xc=t=>{const e=O.c(18),{editor:n,queryKey:r,queryFn:o,onSelect:a}=t;let i;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(i={editor:n,queryKey:r,queryFn:o,onSelect:a},e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=i):i=e[4];const{items:c,selectedIndex:u,onSelect:d,selectedItem:V}=mc(i);if(!c.length){let x;return e[5]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=x):x=e[5],x}let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[6]=l):l=e[6];let m;if(e[7]!==d||e[8]!==c||e[9]!==u||e[10]!==V?.name){let x;e[12]!==d||e[13]!==u||e[14]!==V?.name?(x=(p,h)=>s.jsx(hc,{item:p,isSelected:h===u,ref:h===u?vc:void 0,onSelect:()=>d(p,h),isLoading:V?.name===p.name},p.name),e[12]=d,e[13]=u,e[14]=V?.name,e[15]=x):x=e[15],m=c.map(x),e[7]=d,e[8]=c,e[9]=u,e[10]=V?.name,e[11]=m}else m=e[11];let f;return e[16]!==m?(f=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:l,children:s.jsx("div",{className:"p-1",children:m})}),e[16]=m,e[17]=f):f=e[17],f};function gc(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"p-1",children:[...Array(3)].map(bc)}),t[0]=e):e=t[0],e}function bc(t,e){return s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[s.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),s.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Os(t){const e=O.c(18),{editor:n,char:r,pluginKey:o,queryKey:a,queryFn:i,onSelect:c,allow:u,onOpenChange:d}=t;let V;e[0]!==u||e[1]!==r||e[2]!==n||e[3]!==d||e[4]!==o?(V={editor:n,char:r,pluginKey:o,allow:u,onOpenChange:d},e[0]=u,e[1]=r,e[2]=n,e[3]=d,e[4]=o,e[5]=V):V=e[5];const{state:l,dispatch:m}=fc(V);let f;e[6]!==m||e[7]!==l?(f={state:l,dispatch:m},e[6]=m,e[7]=l,e[8]=f):f=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(gc,{}),e[9]=x):x=e[9];let p;e[10]!==n||e[11]!==c||e[12]!==i||e[13]!==a?(p=s.jsx(pc,{children:s.jsx(w.Suspense,{fallback:x,children:s.jsx(xc,{editor:n,queryKey:a,queryFn:i,onSelect:c})})}),e[10]=n,e[11]=c,e[12]=i,e[13]=a,e[14]=p):p=e[14];let h;return e[15]!==f||e[16]!==p?(h=s.jsx(Ms.Provider,{value:f,children:p}),e[15]=f,e[16]=p,e[17]=h):h=e[17],h}function vc(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const yc=[{name:"agents",title:"Agents",description:"Mention an agent to hand off work",kind:"category",drillable:!0},{name:"resources",title:"Resources",description:"Attach a resource as context",kind:"category",drillable:!0}],Ac=({editor:t,virtualMcpId:e})=>{const n=Be(),{org:r}=le(),o=qr(),a=Ee({connectionId:e,orgId:r.id,orgSlug:r.slug}),i=Oe.virtualMcpResources(e,r.id),[c,u]=w.useState("categories"),d=w.useRef(c);d.current=c;const V=w.useRef(null),l=w.useRef(!1),m=["at-mention",r.id,e??"default",c],f=async({item:h,range:b})=>{if(G("chat_picker_item_selected",{picker:"@",item_kind:h.kind,item_name:h.name}),h.kind!=="category"&&(l.current=!0),h.kind==="category")return u(h.name==="agents"?"agents":"resources"),!1;if(h.kind==="agent"&&h.agentId){Le(t,b,{id:h.agentId,name:h.name,metadata:{agentId:h.agentId,title:h.name},char:"@"}),u("categories");return}if(h.kind==="resource"&&h.uri&&a){try{const g=await Dn(a,h.uri);Le(t,b,{id:h.uri,name:h.uri,metadata:g.contents,char:"@"})}catch(g){console.error("[at-mention] Failed to fetch resource:",g),ae.error("Failed to load resource. Please try again.")}u("categories");return}},x=async h=>{const{query:b}=h,g=d.current;if(g==="categories"){if(!b.trim())return yc;const A=b.toLowerCase(),j=o.filter(S=>S.status==="active"&&(!S.id||!Zt(S.id))&&S.id!==e&&(S.title.toLowerCase().includes(A)||S.description?.toLowerCase().includes(A))).map(S=>({name:S.title,title:S.title,description:S.description??void 0,icon:S.icon??null,kind:"agent",agentId:S.id})),k=await(async()=>{if(!a)return[];let S=n.getQueryData(i);return S||(S=await n.fetchQuery({queryKey:i,queryFn:()=>Fe(a),staleTime:6e4})),(S?.resources??[]).filter(C=>C.uri.toLowerCase().includes(A)||C.name?.toLowerCase().includes(A)||C.description?.toLowerCase().includes(A)).map(C=>({name:C.name??C.uri,title:C.name,description:C.description,kind:"resource",uri:C.uri}))})();return[...j,...k]}if(g==="agents"){let A=o.filter(j=>j.status==="active"&&(!j.id||!Zt(j.id))&&j.id!==e);if(b.trim()){const j=b.toLowerCase();A=A.filter(k=>k.title.toLowerCase().includes(j)||k.description?.toLowerCase().includes(j))}return A.map(j=>({name:j.title,title:j.title,description:j.description??void 0,icon:j.icon??null,kind:"agent",agentId:j.id}))}if(!a)return[];let v=n.getQueryData(i);v?n.fetchQuery({queryKey:i,queryFn:()=>Fe(a),staleTime:6e4}).catch(()=>{}):v=await n.fetchQuery({queryKey:i,queryFn:()=>Fe(a),staleTime:6e4});let y=v?.resources??[];if(b.trim()){const A=b.toLowerCase();y=y.filter(j=>j.uri.toLowerCase().includes(A)||j.name?.toLowerCase().includes(A)||j.description?.toLowerCase().includes(A))}return y.map(A=>({name:A.name??A.uri,title:A.name,description:A.description,kind:"resource",uri:A.uri}))},p=h=>{if(h)V.current=Date.now(),l.current=!1,G("chat_picker_opened",{picker:"@"});else{const b=V.current;G("chat_picker_closed",{picker:"@",outcome:l.current?"selected":"dismissed",duration_ms:b?Date.now()-b:null}),V.current=null,u("categories")}};return s.jsx(Os,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:m,queryFn:x,onSelect:f,onOpenChange:p})};async function In(t,e,n,r,o,a){try{const i=await dt(n,r,a);Le(t,e,{id:r,name:ot(r,o),metadata:i.messages,char:"/",kind:"prompt",args:a})}catch(i){console.error("[slash] Failed to fetch prompt:",i),ae.error("Failed to load prompt. Please try again.")}}async function jc(t,e,n,r){try{const o=await Dn(n,r);Le(t,e,{id:r,name:r,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),ae.error("Failed to load resource. Please try again.")}}const wc=({editor:t,virtualMcpId:e})=>{const n=Be(),{org:r}=le(),o=Ee({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=Oe.virtualMcpPrompts(e,r.id),i=Oe.virtualMcpResources(e,r.id),c=["slash-mention",r.id,e??"default"],[u,d]=w.useState(null),[V,l]=w.useState(null),m=wr(t);m&&(m.onEditChip=async y=>{if(o)try{const j=(await En(n,a,o)).find(k=>k.name===y.promptId);if(!j?.arguments||j.arguments.length===0)return;l({...y,prompt:j})}catch(A){console.error("[slash] Failed to load prompt for editing:",A),ae.error("Failed to load prompt. Please try again.")}});const f=w.useRef(null),x=w.useRef(!1),p=async({item:y,range:A})=>{if(G("chat_picker_item_selected",{picker:"/",item_kind:y.kind,item_name:y.name}),x.current=!0,!!o)if(y.kind==="prompt"){if(y.arguments&&y.arguments.length>0){d({range:A,item:y});return}const j=ue(y._meta);await In(t,A,o,y.name,j)}else y.uri&&await jc(t,A,o,y.uri)},h=async y=>{if(!u||!o)return;const{range:A,item:j}=u,k=ue(j._meta);await In(t,A,o,j.name,k,y),d(null)},b=async y=>{if(!(!V||!o)){try{const A=await dt(o,V.promptId,y),j=ue(V.prompt._meta);t.chain().focus().setNodeSelection(V.pos).deleteSelection().insertContentAt(V.pos,On({id:V.promptId,name:ot(V.promptId,j),metadata:A.messages,char:"/",kind:"prompt",args:y})).run(),G("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:V.promptId})}catch(A){console.error("[slash] Failed to update prompt:",A),ae.error("Failed to update prompt. Please try again.")}l(null)}},g=async y=>{const{query:A}=y;if(!o)return[];const[j,k]=await Promise.all([En(n,a,o),Sc(n,i,o)]),S=A.trim().toLowerCase(),C=(j??[]).filter(N=>!S||N.name.toLowerCase().includes(S)||N.title?.toLowerCase().includes(S)||N.description?.toLowerCase().includes(S)).map(N=>({name:N.name,title:N.title,description:N.description,kind:"prompt",arguments:N.arguments,_meta:N._meta})),D=(k??[]).filter(N=>!S||N.uri.toLowerCase().includes(S)||N.name?.toLowerCase().includes(S)||N.description?.toLowerCase().includes(S)).map(N=>({name:N.name??N.uri,title:N.name,description:N.description,kind:"resource",uri:N.uri}));return[...C,...D]},v=u?.item.kind==="prompt"?{name:u.item.name,title:u.item.title,arguments:u.item.arguments,description:u.item.description,_meta:u.item._meta}:null;return s.jsxs(s.Fragment,{children:[s.jsx(Os,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:c,queryFn:g,onSelect:p,onOpenChange:y=>{if(y)f.current=Date.now(),x.current=!1,G("chat_picker_opened",{picker:"/"});else{const A=f.current;G("chat_picker_closed",{picker:"/",outcome:x.current?"selected":"dismissed",duration_ms:A?Date.now()-A:null}),f.current=null}}}),s.jsx(Je,{prompt:v,setPrompt:()=>d(null),onSubmit:h}),s.jsx(Je,{prompt:V?.prompt??null,setPrompt:()=>l(null),onSubmit:b,defaultValues:V?.args},V?`edit-${V.promptId}-${V.pos}`:"edit-idle")]})};async function En(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>Nt(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>Nt(n),staleTime:6e4}),r?.prompts??[]}async function Sc(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>Fe(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>Fe(n),staleTime:6e4}),r?.resources??[]}function Cc(t){return[Io.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),ml.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),Sr,Cr]}function Nc({tiptapDoc:t,setTiptapDoc:e,disabled:n=!1,enterToSubmit:r=!1,placeholder:o,onSubmit:a,children:i}){const c=w.useRef(a),u=w.useRef(e),d=w.useRef(r),V=w.useRef(o),l=ko({extensions:Cc(V),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,f)=>f.key==="Enter"&&!f.shiftKey&&d.current?(f.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{u.current(m?.getJSON())}});return w.useEffect(()=>{l?.setEditable(!n)},[l,n]),w.useEffect(()=>{c.current=a},[a]),w.useEffect(()=>{u.current=e},[e]),w.useEffect(()=>{d.current=r},[r]),w.useEffect(()=>{V.current=o},[o]),w.useEffect(()=>{if(!l||l.isDestroyed)return;const m=JSON.stringify(l.getJSON()),f=JSON.stringify(t||{type:"doc",content:[]});m!==f&&l.commands.setContent(t||{type:"doc",content:[]})},[l,t]),s.jsx(_o.Provider,{value:{editor:l},children:i})}function kc(t){const e=O.c(26),{disabled:n,virtualMcpId:r,showFileUploader:o,selectedModel:a,onUnsupportedFile:i,ref:c,className:u}=t,d=n===void 0?!1:n,V=o===void 0?!1:o,{editor:l}=qt();let m,f;if(e[0]!==l?(m=()=>({focus:()=>{l?.commands.focus()},clear:()=>{l?.commands.clearContent(!0)},appendText:S=>{if(!l)return;const C=l.state.doc.textContent.trim()==="";l.commands.focus("end"),C||l.commands.insertContent(" "),l.commands.insertContent(S)},syncVoiceText:(S,C)=>{if(l&&(l.commands.setContent(S||{type:"doc",content:[]}),C)){l.commands.focus("end");const D=l.state.doc.textContent.trim().length>0;l.commands.insertContent(D?" "+C:C)}},restoreContent:S=>{l&&l.commands.setContent(S||{type:"doc",content:[]})}}),f=[l],e[0]=l,e[1]=m,e[2]=f):(m=e[1],f=e[2]),w.useImperativeHandle(c??null,m,f),!l)return null;const x=d&&"cursor-not-allowed opacity-70",p=d&&"[&_.ProseMirror]:cursor-not-allowed";let h;e[3]!==u||e[4]!==x||e[5]!==p?(h=B("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",u,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",x,p),e[3]=u,e[4]=x,e[5]=p,e[6]=h):h=e[6];let b;e[7]!==l||e[8]!==h?(b=s.jsx(Eo,{editor:l,className:h}),e[7]=l,e[8]=h,e[9]=b):b=e[9];const g=r??null;let v;e[10]!==l||e[11]!==g?(v=s.jsx(w.Suspense,{fallback:null,children:s.jsx(wc,{editor:l,virtualMcpId:g})}),e[10]=l,e[11]=g,e[12]=v):v=e[12];const y=r??null;let A;e[13]!==l||e[14]!==y?(A=s.jsx(w.Suspense,{fallback:null,children:s.jsx(Ac,{editor:l,virtualMcpId:y})}),e[13]=l,e[14]=y,e[15]=A):A=e[15];let j;e[16]!==l||e[17]!==i||e[18]!==a||e[19]!==V?(j=V&&a?s.jsx(ll,{editor:l,selectedModel:a,onUnsupportedFile:i}):null,e[16]=l,e[17]=i,e[18]=a,e[19]=V,e[20]=j):j=e[20];let k;return e[21]!==v||e[22]!==A||e[23]!==j||e[24]!==b?(k=s.jsxs(s.Fragment,{children:[b,v,A,j]}),e[21]=v,e[22]=A,e[23]=j,e[24]=b,e[25]=k):k=e[25],k}function Ls(t){const e=O.c(3),[n]=Ie();let r;return e[0]!==n.enableSounds||e[1]!==t?(r=()=>{n.enableSounds&&Oo(t.dataUri).catch(a=>{console.warn(`[sound] ${t.name} playback failed:`,a)})},e[0]=n.enableSounds,e[1]=t,e[2]=r):r=e[2],r}const _c={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},Ic=Ur.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),Ec=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function Rc(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1.5",children:Ec.map(Tc)}),t[0]=e):e=t[0],e}function Tc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function Pc({disabled:t,onOpenConnections:e,virtualMcpId:n,selectedModel:r,isStreaming:o,onUnsupportedFile:a}){const[i,c]=w.useState(!1),u=Ls(_c),{org:d}=le(),{editor:V}=qt(),l=w.useRef(null),m=mt(r),f=()=>{!m||o||(c(!1),l.current?.click())},x=async M=>{const U=M.target.files;if(!U||U.length===0||!V)return;const q=Array.from(U),{from:K}=V.state.selection;try{for(const Y of q)await Yt(V,r??null,Y,K,a)}finally{l.current&&(l.current.value="")}},p=Ee({connectionId:n,orgId:d.id,orgSlug:d.slug}),h=Oe.virtualMcpPrompts(n,d.id),{data:b,isLoading:g}=mr({queryKey:h,queryFn:()=>Nt(p),staleTime:6e4,enabled:i&&!!p}),v=b?.prompts??[],[y,A]=w.useState(null),{chatMode:j,setChatMode:k}=Ve(),[S,C]=Ie(),N=(Pe.find(M=>M.value===S.toolApprovalLevel)??Pe[0]).short,P=M=>{const U=Pe.find(q=>q.value===M);if(U){if(U.value===S.toolApprovalLevel){c(!1);return}u(),G("chat_approval_level_changed",{from_level:S.toolApprovalLevel,to_level:U.value,source:"tools_popover"}),C({...S,toolApprovalLevel:U.value}),c(!1)}},T=j==="plan",_=()=>{u();const M=T?"default":"plan";G("chat_mode_changed",{from_mode:j,to_mode:M,source:"tools_popover"}),k(M),c(!1)},R=()=>{e(),c(!1)},F=async(M,U)=>{if(!V||!p)return;const q=ue(M._meta),K={from:V.state.selection.from,to:V.state.selection.to};try{const Y=await dt(p,M.name,U);Le(V,K,{id:M.name,name:ot(M.name,q),metadata:Y.messages,char:"/",kind:"prompt",args:U})}catch{ae.error("Failed to load prompt. Please try again.")}},E=async M=>{c(!1);const U=!!(M.arguments&&M.arguments.length>0);if(G("chat_prompt_inserted",{prompt_name:M.name,with_arguments:U}),U){A(M);return}await F(M)},I=async M=>{y&&(await F(y,M),A(null))},$=()=>{u();const M=j==="gen-image"?"default":"gen-image";G("chat_mode_changed",{from_mode:j,to_mode:M,source:"tools_popover"}),k(M),c(!1)},z=()=>{u();const M=j==="web-search"?"default":"web-search";G("chat_mode_changed",{from_mode:j,to_mode:M,source:"tools_popover"}),k(M),c(!1)},L=j==="gen-image",Q=j==="web-search";return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:l,type:"file",multiple:!0,accept:xo(r??null),className:"hidden",onChange:x,disabled:o}),s.jsxs(To,{open:i,onOpenChange:M=>{M&&!i&&G("chat_tools_popover_opened",{chat_mode:j}),c(M)},children:[s.jsx(Po,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default",disabled:t,title:"Tools","aria-label":"Tools",className:B("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[s.jsx(Xr,{size:14}),s.jsx("span",{className:B("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:"Tools"})]})}),s.jsxs(Do,{align:"start",className:"w-52 p-1.5 space-y-1",children:[m?s.jsxs(fe,{onClick:f,disabled:o,children:[s.jsx(rn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]}):s.jsxs(ge,{children:[s.jsx(he,{asChild:!0,children:s.jsxs(fe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:M=>M.preventDefault(),children:[s.jsx(rn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]})}),s.jsx(xe,{side:"right",children:"The selected model does not support reading files or images."})]}),s.jsxs(fe,{onClick:_,className:B(T&&"text-violet-600 dark:text-violet-400"),children:[s.jsx(Ln,{size:16,className:B(T&&"text-violet-500")}),s.jsx("span",{className:"flex-1",children:"Plan mode"}),s.jsx("span",{className:B("text-xs text-muted-foreground",T&&"text-violet-500 font-medium"),children:Ic})]}),s.jsxs(fe,{onClick:$,className:B(L&&"text-pink-600 dark:text-pink-400"),children:[s.jsx(zn,{size:16,className:B(L&&"text-pink-500")}),s.jsx("span",{className:"flex-1",children:"Create image"}),L&&s.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),s.jsxs(fe,{onClick:z,className:B(Q&&"text-blue-600 dark:text-blue-400"),children:[s.jsx($n,{size:16,className:B(Q&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Web search"}),Q&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(tn,{children:[s.jsxs(nn,{className:"gap-2",children:[s.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),s.jsx("span",{className:"flex-1",children:"Prompts"})]}),s.jsx(sn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:g?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[s.jsx(pr,{size:14,className:"animate-spin"}),"Loading prompts…"]}):v.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):v.map(M=>s.jsxs(fe,{onClick:()=>E(M),className:"flex flex-col items-start gap-0.5",children:[s.jsx("span",{className:"font-medium text-sm capitalize",children:M.title||Mt(M.name,ue(M._meta))}),M.description&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:M.description})]},M.name))})]}),s.jsxs(tn,{children:[s.jsxs(nn,{className:"gap-2",children:[s.jsx(ft,{size:16}),s.jsx("span",{className:"flex-1",children:"Approval"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:N})]}),s.jsx(sn,{className:"w-48 p-1.5",children:s.jsx(Mo,{value:S.toolApprovalLevel,onValueChange:P,children:Pe.map(M=>s.jsx(Fo,{value:M.value,children:M.label},M.value))})})]}),s.jsxs(fe,{onClick:R,children:[s.jsx(uo,{size:16}),s.jsx("span",{className:"flex-1",children:"Connections"}),s.jsx(w.Suspense,{children:s.jsx(Rc,{})})]})]})]}),s.jsx(Je,{prompt:y,setPrompt:A,onSubmit:I})]})}const Dc=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function Mc(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1",children:Dc.map(Fc)}),t[0]=e):e=t[0],e}function Fc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function Oc(t){const e=O.c(6),{onClick:n}=t;let r,o,a,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=B("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),o=s.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),a=s.jsx(Mc,{}),i=s.jsx($o,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=r,e[1]=o,e[2]=a,e[3]=i):(r=e[0],o=e[1],a=e[2],i=e[3]);let c;return e[4]!==n?(c=s.jsxs("button",{type:"button",onClick:n,className:r,children:[o,a,i]}),e[4]=n,e[5]=c):c=e[5],c}const Me=48;function Lc(){const t=O.c(9),[e,n]=w.useState("idle"),[r,o]=w.useState(""),[a,i]=w.useState(""),[c,u]=w.useState(Bc),d=w.useRef(null),V=w.useRef(null),l=w.useRef(null),m=w.useRef(null),f=w.useRef(0),x=w.useRef(!1),p=w.useRef(""),h=w.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let g;t[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),V.current?.close().catch(zc),m.current?.getTracks().forEach($c),l.current=null,V.current=null,m.current=null},t[0]=g):g=t[0];const v=g;let y;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const N=P=>{m.current=P;const T=new AudioContext;V.current=T;const _=T.createMediaStreamSource(P),R=T.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,_.connect(R),l.current=R;const F=new Uint8Array(R.frequencyBinCount),E=()=>{if(!l.current)return;l.current.getByteFrequencyData(F);const I=[];for(let $=0;$<Me;$++){const z=Math.floor($/Me*F.length);I.push(Math.max(.04,(F[z]??0)/255))}u(I),f.current=requestAnimationFrame(E)};E()};y=async()=>{const P=window.SpeechRecognition||window.webkitSpeechRecognition;if(!P){n("unsupported");return}let T;try{T=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{n("permission-denied");return}o(""),i(""),h.current="",p.current="",x.current=!0,n("recording"),N(T);const _=new P;d.current=_,_.interimResults=!0,_.continuous=!0,_.lang=navigator.language||"en-US",_.onresult=R=>{let F="",E="";for(let I=R.resultIndex;I<R.results.length;I++){const $=R.results[I],z=$?.[0]?.transcript??"";$?.isFinal?E=E+z:F=F+z}E&&(p.current=p.current+E,o(p.current)),h.current=F,i(F)},_.onend=()=>{if(x.current)try{_.start()}catch{}};try{_.start()}catch{n("idle")}},t[1]=y}else y=t[1];const A=y;let j;t[2]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{x.current=!1,d.current?.stop(),v(),n("idle"),u(Array(Me).fill(.05)),i("");const N=(p.current+(h.current?" "+h.current:"")).trim();return o(""),p.current="",h.current="",N},t[2]=j):j=t[2];const k=j;let S;t[3]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{x.current=!1,d.current?.abort(),v(),n("idle"),o(""),i(""),u(Array(Me).fill(.05)),p.current="",h.current=""},t[3]=S):S=t[3];const C=S;let D;return t[4]!==a||t[5]!==e||t[6]!==r||t[7]!==c?(D={status:e,transcript:r,interimTranscript:a,waveformData:c,isSupported:b,startRecording:A,stopRecording:k,cancelRecording:C},t[4]=a,t[5]=e,t[6]=r,t[7]=c,t[8]=D):D=t[8],D}function $c(t){return t.stop()}function zc(){}function Bc(){return Array(Me).fill(.05)}function Uc(t){const e=O.c(4),{data:n}=t;let r;e[0]!==n?(r=n.map(Kc),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:r}),e[2]=r,e[3]=o):o=e[3],o}function Kc(t,e){return s.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function qc({messageCount:t,showConnectionsBanner:e}){return t>0||e}function Qc(t){const e=O.c(3),{message:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Mn,{size:14,className:"shrink-0"}),e[0]=r):r=e[0];let o;return e[1]!==n?(o=s.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[r,s.jsx("span",{className:"text-sm",children:n})]}),e[1]=n,e[2]=o):o=e[2],o}function Yc(t,e){const n=O.c(5),{editor:r}=qt(),[o,a]=w.useState(!1),i=w.useRef(0);let c,u;return n[0]!==r||n[1]!==e||n[2]!==t?(c=()=>{const d=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),i.current=i.current+1,a(!0))},V=f=>{f.preventDefault(),i.current=Math.max(0,i.current-1),i.current===0&&a(!1)},l=Hc,m=f=>{if(f.preventDefault(),i.current=0,a(!1),!r||!t||!mt(t))return;const x=f.dataTransfer?.files;if(!x||x.length===0)return;const{from:p}=r.state.selection;for(const h of Array.from(x))Yt(r,t,h,p,e)};return window.addEventListener("dragenter",d),window.addEventListener("dragleave",V),window.addEventListener("dragover",l),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",d),window.removeEventListener("dragleave",V),window.removeEventListener("dragover",l),window.removeEventListener("drop",m)}},u=[r,t,e],n[0]=r,n[1]=e,n[2]=t,n[3]=c,n[4]=u):(c=n[3],u=n[4]),w.useEffect(c,u),o}function Hc(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function Gc(t){const e=O.c(11),{selectedModel:n,onUnsupportedFile:r}=t,o=Yc(n,r);let a;e[0]!==n?(a=mt(n),e[0]=n,e[1]=a):a=e[1];const i=a,c=o?"opacity-100":"opacity-0 pointer-events-none",u=i?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let d;e[2]!==c||e[3]!==u?(d=B("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,u),e[2]=c,e[3]=u,e[4]=d):d=e[4];let V;e[5]!==n||e[6]!==i?(V=i?s.jsxs(s.Fragment,{children:[s.jsx(no,{size:24}),s.jsxs("span",{className:"text-sm font-medium",children:["Drop ",ns(n)," here"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Mn,{size:24}),s.jsx("span",{className:"text-sm font-medium",children:"This model can't read attachments — switch to one with vision or file support"})]}),e[5]=n,e[6]=i,e[7]=V):V=e[7];let l;return e[8]!==d||e[9]!==V?(l=s.jsx("div",{className:d,children:V}),e[8]=d,e[9]=V,e[10]=l):l=e[10],l}function Wc(){const t=O.c(6),e=st(),{org:n,locator:r}=le(),{create:o}=$r();let a;return t[0]!==o||t[1]!==r||t[2]!==e||t[3]!==n.id||t[4]!==n.slug?(a=async i=>{const{tiptapDoc:c,virtualMcp:u}=i,d=crypto.randomUUID(),V=u?.id??ut(n.id).id;zr(sessionStorage,r,d,{tiptapDoc:c});try{await o({id:d,virtual_mcp_id:V})}catch{}const l={virtualmcpid:V,autosend:Br};e({to:"/$org/$taskId",params:{org:n.slug,taskId:d},search:l})},t[0]=o,t[1]=r,t[2]=e,t[3]=n.id,t[4]=n.slug,t[5]=a):a=t[5],a}function Jc({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const n=Fn(),r=rt(),o=n?.messages??[],a=n?.isStreaming??!1,i=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),u=r?.taskId??"",d=u||ua,V=Wc(),{selectedModel:l,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:x,imageModel:p,deepResearchModel:h,chatMode:b,setChatMode:g}=Ve(),{data:v}=Tn.useSession(),y=v?.user?.id,{org:A,locator:j}=le(),k=ut(A.id).id,S=Qr(m?.id??k),C=Ls(Lo),[D,N]=w.useState(!1),{unsupportedFile:P,onUnsupportedFile:T,clearUnsupportedFile:_}=fl(),R=Lc(),F=w.useRef(void 0),E=async()=>{F.current=L,await R.startRecording();const H=R.status==="recording"?"started":R.status==="unsupported"?"unsupported":R.status==="permission-denied"?"permission_denied":"unknown";G("chat_voice_started",{thread_id:u,outcome:H})},I=()=>{G("chat_voice_confirmed",{thread_id:u});const H=R.stopRecording();Y.current?.syncVoiceText(F.current,H),Y.current?.focus()},$=()=>{G("chat_voice_cancelled",{thread_id:u}),R.cancelRecording(),Y.current?.restoreContent(F.current)};w.useEffect(()=>{if(R.status!=="recording")return;const H=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();Y.current?.syncVoiceText(F.current,H)},[R.transcript,R.interimTranscript,R.status]);const z=r?.activeTask??null,[L,Q]=w.useState(()=>ln(sessionStorage,j,d)??void 0),M=H=>{Q(H),x.current=H,Va(sessionStorage,j,d,H,{onQuotaExceeded:({docSizeBytes:ie})=>{G("chat_draft_quota_exceeded",{thread_id:u||null,doc_size_bytes:ie}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},U=w.useRef(u);if(U.current!==u){U.current=u;const H=ln(sessionStorage,j,d)??void 0;Q(H),x.current=H}const K=[...o].reverse().find(H=>H.role==="assistant")?.metadata?.modelLimits?.contextWindow??l?.limits?.contextWindow,Y=w.useRef(null),ne=b==="plan";w.useEffect(()=>{const H=ie=>{Kr(ie)&&ie.code==="KeyL"&&(ie.preventDefault(),ie.shiftKey&&g(b==="plan"?"default":"plan"),Y.current?.focus())};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[b,g]);const X=Nr(o),W=[...o].reverse().find(H=>H.role==="assistant"&&H.metadata?.usage)?.metadata?.usage?.contextTokens??0,J=!a&&!f&&!us(L),Z=a||i,te=qc({messageCount:o.length,showConnectionsBanner:e}),se=H=>{H?.preventDefault(),a?(G("chat_message_stopped",{thread_id:u}),c()):i?(G("chat_message_stopped",{thread_id:u}),c()):J&&L&&(G("chat_message_sent",{thread_id:u||null,mode:b,model_id:l?.modelId??null,model_provider:l?.providerId??null,virtual_mcp_id:m?.id??null,submission:H?"button_or_enter":"programmatic"}),n?n.sendMessage(L):V({tiptapDoc:L,virtualMcp:m}),fa(sessionStorage,j,d),M(void 0))};return y&&z?.created_by&&z.created_by!==y?s.jsx(Qc,{message:"Read only - you're viewing someone else's thread"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col w-full justify-end",children:s.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&s.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&r&&s.jsx(pt,{}),s.jsx(Nc,{tiptapDoc:L,setTiptapDoc:M,disabled:a,enterToSubmit:!0,onSubmit:se,children:s.jsxs("form",{onSubmit:se,className:B("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[s.jsx(Gc,{selectedModel:l,onUnsupportedFile:T}),s.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:s.jsx(kc,{ref:Y,disabled:a||R.status==="recording",virtualMcpId:m?.id??k,showFileUploader:!0,selectedModel:l,onUnsupportedFile:T})}),s.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:R.status==="recording"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx(Uc,{data:R.waveformData.slice(0,28)}),s.jsx("button",{type:"button",onClick:$,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Cancel recording",children:s.jsx(De,{size:16})}),s.jsx("button",{type:"button",onClick:I,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":"Use transcription",children:s.jsx(Ke,{size:16})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Pc,{disabled:a,onOpenConnections:()=>{G("connections_dialog_opened",{source:"tools_popover",mode:"add"}),N(!0)},virtualMcpId:m?.id??k,selectedModel:l,isStreaming:a,onUnsupportedFile:T}),ne&&s.jsxs("button",{type:"button",onClick:()=>{C(),G("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),g("default")},title:"Plan mode","aria-label":"Plan mode",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 group min-w-0 shrink animate-in fade-in duration-200",children:[s.jsx(Ln,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100",children:"Plan mode"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),b==="gen-image"&&p&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{C(),G("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),g("default")},title:"Create image","aria-label":"Create image",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(zn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Create image"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),b==="web-search"&&h&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{C(),G("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),g("default")},title:"Web search","aria-label":"Web search",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx($n,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Web search"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),K&&W>0&&s.jsx(kr,{usage:X,totalTokens:W,contextWindow:K,onOpenContextPanel:t})]}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[te&&s.jsx(sl,{virtualMcp:S,currentBranch:r?.currentBranch??null}),s.jsx(il,{}),R.isSupported&&s.jsx(re,{type:"button",onClick:E,disabled:a||i,variant:"ghost",size:"icon",className:B("size-8 rounded-lg transition-colors",R.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:R.status==="permission-denied"?"Microphone access denied — click to try again":"Voice input",children:s.jsx(eo,{size:18})}),s.jsx(re,{type:Z?"button":"submit",onClick:H=>{Z&&(H.preventDefault(),H.stopPropagation(),c())},variant:J||Z?"default":"ghost",size:"icon",disabled:!J&&!Z,className:B("size-8 rounded-lg transition-all",!J&&!Z&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:a?"Stop generating":i?"Cancel run":"Send message (Enter)",children:Z?s.jsx(to,{size:20}):s.jsx(Yr,{size:20})})]})]})})]})},u),e&&s.jsx(Oc,{onClick:()=>{G("connections_banner_clicked",{source:"home_chat_input"}),G("connections_dialog_opened",{source:"home_banner",mode:"add"}),N(!0)}})]})}),s.jsx(mo,{mode:"browse",open:D,onOpenChange:N,defaultTab:"all"}),s.jsx(dl,{info:P,onClose:_})]})}const Zc={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]};function $s(t){return`deco-credits-empty-dismissed:${t}`}function od(t){try{return localStorage.getItem($s(t))==="1"}catch{return!1}}function Xc(){const t=O.c(47),{org:e}=le(),n=st(),{decoKeyId:r}=Wn(),o=Zn(),[a,i]=w.useState(!0),[c,u]=w.useState(""),[d,V]=w.useState(!1),[l,m]=w.useState("usd"),f=l==="brl"?"R$":"$";let x;t[0]!==e.id?(x=()=>{G("credits_empty_state_dismissed",{organization_id:e.id}),i(!1);try{localStorage.setItem($s(e.id),"1")}catch{}},t[0]=e.id,t[1]=x):x=t[1];const p=x;let h,b;t[2]!==a||t[3]!==e.id?(h=()=>{a&&G("credits_empty_state_shown",{organization_id:e.id})},b=[a,e.id],t[2]=a,t[3]=e.id,t[4]=h,t[5]=b):(h=t[4],b=t[5]),w.useEffect(h,b);let g;t[6]!==l||t[7]!==o?(g=async L=>{const{url:Q}=await o.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:L,currency:l});return Q},t[6]=l,t[7]=o,t[8]=g):g=t[8];let v;t[9]!==p?(v=L=>{L&&window.open(L,"_blank","noopener,noreferrer"),p()},t[9]=p,t[10]=v):v=t[10];let y;t[11]!==g||t[12]!==v?(y={mutationFn:g,onSuccess:v,onError:tu},t[11]=g,t[12]=v,t[13]=y):y=t[13];const{mutate:A,isPending:j}=Dt(y),k=parseFloat(c),S=!isNaN(k)&&k>=1;if(!a)return null;let C;t[14]!==p?(C=L=>!L&&p(),t[14]=p,t[15]=C):C=t[15];let D;t[16]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-amber-500/8 to-transparent pointer-events-none rounded-t-lg"}),t[16]=D):D=t[16];let N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-100 dark:bg-amber-900/40 border border-amber-200/60 dark:border-amber-800/40 mx-auto",children:s.jsx(Kn,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[17]=N):N=t[17];let P;t[18]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[D,s.jsxs(at,{className:"relative gap-3",children:[N,s.jsxs("div",{className:"text-center",children:[s.jsx(it,{className:"text-lg font-semibold",children:"This workspace has no credits"}),s.jsx(Ft,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:"Your free credits were used in another workspace. Add credits to use AI here."})]})]})]}),t[18]=P):P=t[18];let T;t[19]!==l||t[20]!==f||t[21]!==c||t[22]!==k||t[23]!==r||t[24]!==S||t[25]!==j||t[26]!==d||t[27]!==A?(T=r&&s.jsxs("div",{className:"px-6 pb-5",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Hn,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:L=>{L&&m(L)},children:[s.jsx(Ze,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Ze,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Zc[l].map(L=>{const{dollars:Q,label:M}=L;return s.jsxs("button",{type:"button",disabled:j,onClick:()=>{G("credits_topup_clicked",{amount_cents:Q*100,currency:l,tier_label:M,source:"empty_state"}),A(Q*100)},className:B("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[f,Q]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:M})]},Q)})}),d?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:f}),s.jsx(Gn,{type:"number",min:"1",step:"1",placeholder:"50",value:c,onChange:L=>u(L.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(re,{className:"h-10",disabled:!S||j,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(k*100),currency:l,tier_label:"custom",source:"empty_state"}),A(Math.round(k*100))},children:j?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>V(!0),children:"Enter custom amount"})]}),t[19]=l,t[20]=f,t[21]=c,t[22]=k,t[23]=r,t[24]=S,t[25]=j,t[26]=d,t[27]=A,t[28]=T):T=t[28];let _;t[29]!==p||t[30]!==n||t[31]!==e.slug?(_=()=>{n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),p()},t[29]=p,t[30]=n,t[31]=e.slug,t[32]=_):_=t[32];let R;t[33]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Yn,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[33]=R):R=t[33];let F;t[34]!==_?(F=s.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:_,children:["Use your own provider",R]}),t[34]=_,t[35]=F):F=t[35];let E;t[36]!==p?(E=s.jsx(re,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:p,children:"Skip for now"}),t[36]=p,t[37]=E):E=t[37];let I;t[38]!==F||t[39]!==E?(I=s.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[F,E]}),t[38]=F,t[39]=E,t[40]=I):I=t[40];let $;t[41]!==T||t[42]!==I?($=s.jsxs(lt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:eu,children:[P,T,I]}),t[41]=T,t[42]=I,t[43]=$):$=t[43];let z;return t[44]!==$||t[45]!==C?(z=s.jsx(ct,{open:!0,onOpenChange:C,children:$}),t[44]=$,t[45]=C,t[46]=z):z=t[46],z}function eu(t){return t.preventDefault()}function tu(t){ae.error(`Top-up failed: ${t.message}`)}function nu(t){const e=O.c(6),{balanceDollars:n}=t;let r;e[0]!==n?(r=n.toFixed(2),e[0]=n,e[1]=r):r=e[1];const o=r;let a,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=B("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-emerald-50 dark:bg-emerald-950/30","border border-emerald-200/60 dark:border-emerald-800/40","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),i=s.jsx(Kn,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=a,e[3]=i):(a=e[2],i=e[3]);let c;return e[4]!==o?(c=s.jsxs("div",{className:a,children:[i,s.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",o," in credits to get started"]})]}),e[4]=o,e[5]=c):c=e[5],c}function su(){const t=O.c(8),{org:e}=le(),n=st();let r;t[0]!==n||t[1]!==e.slug?(r=()=>n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=n,t[1]=e.slug,t[2]=r):r=t[2];let o,a,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=B("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-amber-50 dark:bg-amber-950/30","border border-amber-200/60 dark:border-amber-800/40","hover:bg-amber-100/60 dark:hover:bg-amber-900/30","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=s.jsx(qn,{size:13,className:"text-amber-600 dark:text-amber-400"}),i=s.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:"No credits remaining · Add more"}),t[3]=o,t[4]=a,t[5]=i):(o=t[3],a=t[4],i=t[5]);let c;return t[6]!==r?(c=s.jsxs("button",{type:"button",onClick:r,className:o,children:[a,i]}),t[6]=r,t[7]=c):c=t[7],c}function ru(t){const e=O.c(11),{className:n}=t;let r;e[0]!==n?(r=B("flex h-full w-full flex-col bg-background",n),e[0]=n,e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=o):o=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex items-center gap-3",children:[o,s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),s.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=a):a=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),s.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=i):i=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:s.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[s.jsx(Ye,{align:"right",width:"w-3/4"}),s.jsx(Ye,{align:"left",width:"w-full",lines:3}),s.jsx(Ye,{align:"right",width:"w-2/3"}),s.jsx(Ye,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:s.jsx("div",{className:"relative flex-1",children:s.jsxs("div",{className:"space-y-2 p-2",children:[s.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),s.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"flex items-center gap-1",children:s.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=d):d=e[7];let V;e[8]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx("div",{className:"px-4 py-4",children:s.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[u,s.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[d,s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),s.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=V):V=e[8];let l;return e[9]!==r?(l=s.jsxs("div",{className:r,children:[i,c,V]}),e[9]=r,e[10]=l):l=e[10],l}function Ye(t){const e=O.c(22),{align:n,width:r,lines:o}=t,a=r===void 0?"w-full":r,i=o===void 0?1:o,c=n==="right"?"flex-row-reverse":"flex-row";let u;e[0]!==c?(u=B("flex w-full gap-4 px-4 py-2",c),e[0]=c,e[1]=u):u=e[1];const d=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let V;e[2]!==d?(V=B("flex min-w-0 flex-col gap-2",d),e[2]=d,e[3]=V):V=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=l):l=e[4];const m=n==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==m||e[6]!==a?(f=B("min-w-0 rounded-2xl p-4",m,a),e[5]=m,e[6]=a,e[7]=f):f=e[7];let x;e[8]!==i?(x=Array.from({length:i}),e[8]=i,e[9]=x):x=e[9];let p;e[10]!==i||e[11]!==x?(p=s.jsx("div",{className:"space-y-2",children:x.map((v,y)=>s.jsx("div",{className:B("h-3 rounded bg-muted-foreground/20 animate-pulse",y===i-1?"w-3/4":"w-full"),style:{animationDelay:`${y*.1}s`}},y))}),e[10]=i,e[11]=x,e[12]=p):p=e[12];let h;e[13]!==p||e[14]!==f?(h=s.jsx("div",{className:f,children:p}),e[13]=p,e[14]=f,e[15]=h):h=e[15];let b;e[16]!==h||e[17]!==V?(b=s.jsxs("div",{className:V,children:[l,h]}),e[16]=h,e[17]=V,e[18]=b):b=e[18];let g;return e[19]!==b||e[20]!==u?(g=s.jsx("div",{className:u,children:b}),e[19]=b,e[20]=u,e[21]=g):g=e[21],g}function ou(t){const e=O.c(7),{scrollRef:n,sentinelRef:r,hasMoreOlder:o,isFetchingOlder:a,fetchOlderMessages:i}=t;let c,u;e[0]!==i||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==r?(c=()=>{const d=r.current,V=n.current;if(!d||!V||!o)return;const l=new IntersectionObserver(async m=>{if(!m[0]?.isIntersecting||a||!o)return;const x=V.scrollHeight,p=V.scrollTop;await i(),requestAnimationFrame(()=>{const h=V.scrollHeight;V.scrollTop=p+(h-x)})},{root:V,rootMargin:"200px 0px 0px 0px"});return l.observe(d),()=>l.disconnect()},u=[n,r,o,a,i],e[0]=i,e[1]=o,e[2]=a,e[3]=n,e[4]=r,e[5]=c,e[6]=u):(c=e[5],u=e[6]),w.useEffect(c,u)}function au(t){const e=O.c(5),{className:n,children:r}=t;let o;e[0]!==n?(o=B("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",n),e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==r||e[3]!==o?(a=s.jsx("div",{className:o,children:r}),e[2]=r,e[3]=o,e[4]=a):a=e[4],a}function iu(t){const e=O.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=B("flex-1 min-h-0 overflow-y-auto isolate",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}function lu(t){const e=O.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:n}),e[0]=n,e[1]=r):r=e[1],r}function cu(){const t=O.c(27),{messages:e,status:n,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a}=Ue(),i=_r(e);let c;t[0]!==i?(c=i.at(-1),t[0]=i,t[1]=c):c=t[1];const u=c,V=ca()*Jo+16,l=w.useRef(null),m=w.useRef(null);let f;t[2]!==a||t[3]!==r||t[4]!==o?(f={scrollRef:l,sentinelRef:m,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a},t[2]=a,t[3]=r,t[4]=o,t[5]=f):f=t[5],ou(f);let x;t[6]!==V?(x={paddingBottom:V},t[6]=V,t[7]=x):x=t[7];let p;t[8]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("div",{ref:m,"aria-hidden":!0,className:"h-px"}),t[8]=p):p=t[8];let h;t[9]!==o?(h=o&&s.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:"Loading older messages…"}),t[9]=o,t[10]=h):h=t[10];let b;if(t[11]!==i||t[12]!==n){let A;t[14]!==i.length||t[15]!==n?(A=(j,k)=>s.jsx(Jt,{pair:j,isLastPair:!1,status:k===i.length-1?n:void 0},`pair-${j.user?.id??j.assistant?.id}`),t[14]=i.length,t[15]=n,t[16]=A):A=t[16],b=i.slice(0,-1).map(A),t[11]=i,t[12]=n,t[13]=b}else b=t[13];let g;t[17]!==h||t[18]!==b?(g=s.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[p,h,b]}),t[17]=h,t[18]=b,t[19]=g):g=t[19];let v;t[20]!==u||t[21]!==n?(v=u&&s.jsx("div",{className:"min-h-full min-w-0 max-w-2xl mx-auto w-full",children:s.jsx(Jt,{pair:u,isLastPair:!0,status:n},`pair-${u.user?.id??u.assistant?.id}`)}),t[20]=u,t[21]=n,t[22]=v):v=t[22];let y;return t[23]!==x||t[24]!==g||t[25]!==v?(y=s.jsxs("div",{ref:l,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",style:x,children:[g,v]}),t[23]=x,t[24]=g,t[25]=v,t[26]=y):y=t[26],y}function uu(t){const e=O.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=B("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}const ad=Object.assign(au,{Main:iu,Messages:cu,EmptyState:lu,Footer:uu,Input:Jc,Provider:br,ActiveTaskProvider:gr,Skeleton:ru,IceBreakers:Wo,NoAiProviderEmptyState:go,CreditsEmptyState:Xc,CreditsEyebrow:nu,NoCreditsEyebrow:su,CreditsExhaustedBanner:vs});function id(t){if(typeof t!="object"||t===null)return!1;const n=t.githubRepo?.url;return typeof n=="string"&&n.length>0}function du(t){return!!Jn(t??null)?.connectionId}function ld(t){return du(t)}function cd(t){return t.online?t.capabilities.includes("claude-code")||t.capabilities.includes("codex"):!1}export{ad as C,Nc as T,sl as a,id as b,du as c,kc as d,ld as e,rd as f,Ui as g,cd as h,ml as i,mi as s,pi as u,od as w};
|