@decocms/mesh 2.14.0 → 2.15.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-DeHvJZzp.js → AlertCircle-CIFhWg2i.js} +1 -1
- package/dist/client/assets/{ArrowLeft-Dan_IIKP.js → ArrowLeft-D0vIuW0V.js} +1 -1
- package/dist/client/assets/{ArrowUp-B2eKsIZo.js → ArrowUp-MjJJcV-O.js} +1 -1
- package/dist/client/assets/{Check-VfxUlV5P.js → Check-LvJ1lSFr.js} +1 -1
- package/dist/client/assets/{ChevronDown-OK90XtVB.js → ChevronDown-QF_Tgl2v.js} +1 -1
- package/dist/client/assets/{Clock-CRgmR_1n.js → Clock-CiIkKpUg.js} +1 -1
- package/dist/client/assets/{Code01-B9DNMb5j.js → Code01-Du8Lx-Uw.js} +1 -1
- package/dist/client/assets/{Copy01-dbjgqDL6.js → Copy01-CunLN8rc.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-BpvBcoMa.js → DotsHorizontal-WE50knOB.js} +1 -1
- package/dist/client/assets/{DotsVertical-XnGZcIeo.js → DotsVertical-CuQjcY-h.js} +1 -1
- package/dist/client/assets/{Download01-C8jw9jFZ.js → Download01-syi4c4iH.js} +1 -1
- package/dist/client/assets/{Edit01-Ddbn6DsS.js → Edit01-DVUwOcf8.js} +1 -1
- package/dist/client/assets/{File06-DCHrHfbn.js → File06-BM3BX-NC.js} +1 -1
- package/dist/client/assets/{FilterLines-BzWlfPby.js → FilterLines-DS1pmySA.js} +1 -1
- package/dist/client/assets/{FlipBackward-Bum_Ktlp.js → FlipBackward-BKppcJN9.js} +1 -1
- package/dist/client/assets/{GitBranch01-CVAiK8ZD.js → GitBranch01-C3ShOPmQ.js} +1 -1
- package/dist/client/assets/{Grid01-AMlhaaWH.js → Grid01-DwtrqYPx.js} +1 -1
- package/dist/client/assets/{Home02-CnvrJTir.js → Home02-DlsAgg82.js} +1 -1
- package/dist/client/assets/{Image01-Bch9iOev.js → Image01-Bw2o5F05.js} +1 -1
- package/dist/client/assets/{Inbox01-y9RgqkXP.js → Inbox01-CSDhYGLL.js} +1 -1
- package/dist/client/assets/{InfoCircle-HrYndWCZ.js → InfoCircle-xFKFZGrj.js} +1 -1
- package/dist/client/assets/{Key01-DS2WWoiQ.js → Key01-S9eZFu7R.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DzBB4jwo.js → LinkExternal01-Dbxh7ZV2.js} +1 -1
- package/dist/client/assets/{List-BDW462gC.js → List-D2PJPXod.js} +1 -1
- package/dist/client/assets/{Loading01-OB_JRXd5.js → Loading01-BhuF3K1g.js} +1 -1
- package/dist/client/assets/{Lock01-B_KYH87b.js → Lock01-jUZQmYfl.js} +1 -1
- package/dist/client/assets/{Play-VfPQ9yON.js → Play-BxDRmyN-.js} +1 -1
- package/dist/client/assets/{Plus-CgcZFggs.js → Plus-DCVckKM0.js} +1 -1
- package/dist/client/assets/{SearchMd-DRJ07Awx.js → SearchMd-tLR3QB8E.js} +1 -1
- package/dist/client/assets/{Terminal-FTJQx4pc.js → Terminal-DwE3k3eb.js} +1 -1
- package/dist/client/assets/{Trash01-BDWyzvD2.js → Trash01-Dg5Q9OUO.js} +1 -1
- package/dist/client/assets/{Upload01-CB1SFmVO.js → Upload01-BJUxi5ck.js} +1 -1
- package/dist/client/assets/{X-CVhiWYv-.js → X-DKF1oh5v.js} +1 -1
- package/dist/client/assets/{XClose-C895iFVX.js → XClose-BACMQGhN.js} +1 -1
- package/dist/client/assets/{alert-dialog-D9k51qgG.js → alert-dialog-BryTAX-J.js} +2 -2
- package/dist/client/assets/{auth-catchall-BDKZr3VK.js → auth-catchall-B3H5JOvc.js} +1 -1
- package/dist/client/assets/{avatar-BLmwViC3.js → avatar-BtMYdv0U.js} +1 -1
- package/dist/client/assets/{badge-CMZTNGZo.js → badge-Do7WFlPI.js} +1 -1
- package/dist/client/assets/{binder-Bcr51BHa.js → binder-B3GXUIAu.js} +1 -1
- package/dist/client/assets/{button-2azNqzUx.js → button-ClkQLR3o.js} +1 -1
- package/dist/client/assets/{card-WAuUk8Uz.js → card-CwMKn79y.js} +1 -1
- package/dist/client/assets/{checkbox-E6g3eWVz.js → checkbox-C6hBycBx.js} +1 -1
- package/dist/client/assets/{collection-detail-DiFfTEhG.js → collection-detail-C-m2H10s.js} +2 -2
- package/dist/client/assets/{collection-display-button-B3beugJ4.js → collection-display-button-CdHXoeVD.js} +1 -1
- package/dist/client/assets/{collection-header-MCgfYSgE.js → collection-header-CeBQhXWy.js} +1 -1
- package/dist/client/assets/{collection-page-CB_Az4GO.js → collection-page-pMUw63Yr.js} +1 -1
- package/dist/client/assets/{collection-search-DL-7oL5d.js → collection-search-CF1o4yO7.js} +1 -1
- package/dist/client/assets/{collection-tab-C_pl92IS.js → collection-tab-ChPNT80-.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CAH6fKB1.js → collection-table-wrapper-jfSAC6dF.js} +1 -1
- package/dist/client/assets/{connection-CXC8d3Ae.js → connection-BcYehfdK.js} +2 -2
- package/dist/client/assets/{connection-card-BTOP5EHD.js → connection-card-DO3ahSdV.js} +1 -1
- package/dist/client/assets/connection-detail-i_lj-oMr.js +1 -0
- package/dist/client/assets/{connections-Cm-7oBJu.js → connections-CMzrwOZS.js} +1 -1
- package/dist/client/assets/constants-BIwbIZhE.js +1 -0
- package/dist/client/assets/create-organization-dialog-BydMMM5g.js +1 -0
- package/dist/client/assets/{dialog-DSU0GEtE.js → dialog-Y0g8yyzz.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DRkETp4T.js → dropdown-menu-C4Ypstre.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-CXggkl7m.js → dynamic-plugin-layout-Cds2rM_Z.js} +1 -1
- package/dist/client/assets/{empty-state-C3NzxCFI.js → empty-state-C0gi-aAx.js} +1 -1
- package/dist/client/assets/{empty-state-DKa1iDdq.js → empty-state-Dx0NLAxy.js} +1 -1
- package/dist/client/assets/env-vars-editor-GTn7Eu5T.js +1 -0
- package/dist/client/assets/{error-boundary-DU6_J5et.js → error-boundary-D2ZJQHnD.js} +1 -1
- package/dist/client/assets/extract-connection-data-nsOyk4eb.js +1 -0
- package/dist/client/assets/{file-browser-B8xb3wGm.js → file-browser-s8pLbWaW.js} +2 -2
- package/dist/client/assets/{form-DM9msJYn.js → form-DDdl0439.js} +1 -1
- package/dist/client/assets/{gateway-detail-6QzPV4MT.js → gateway-detail-NHGkjgTy.js} +1 -1
- package/dist/client/assets/{gateways-DcbIYmOg.js → gateways-Bv1uyRdE.js} +1 -1
- package/dist/client/assets/{grid-view-DjeV3XAc.js → grid-view-DNPq1Y__.js} +1 -1
- package/dist/client/assets/{home-BkFYrMbJ.js → home-9eTtEa0h.js} +1 -1
- package/dist/client/assets/{index-Dk3lubBQ.js → index-C5FDJtAp.js} +2 -2
- package/dist/client/assets/index-Cbsnfme0.js +25 -0
- package/dist/client/assets/{index-BQiKVu3k.js → index-D6aVJNvm.js} +1 -1
- package/dist/client/assets/{index-CYR9-1-4.js → index-DqVdeyIE.js} +1 -1
- package/dist/client/assets/index-JAPwCHXJ.css +1 -0
- package/dist/client/assets/index-hEHbC4y4.js +88 -0
- package/dist/client/assets/{infiniteQueryObserver-CUXkVkPG.js → infiniteQueryObserver-BnxPLCEe.js} +1 -1
- package/dist/client/assets/{input-CBrhxHNe.js → input-BbWUShhD.js} +1 -1
- package/dist/client/assets/{layout-MOaKucBL.js → layout-BnqnCJOk.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-C2ClCxhY.js → lazy-highlighter-BHJogLPz.js} +1 -1
- package/dist/client/assets/{localstorage-keys-BJk6gyyN.js → localstorage-keys-BZEjwsD0.js} +1 -1
- package/dist/client/assets/{login-RFCnTbJl.js → login-DGLLQl3L.js} +1 -1
- package/dist/client/assets/mcp-oauth-CkuEWYY4.js +1 -0
- package/dist/client/assets/{mcp-server-card-DYesFUUw.js → mcp-server-card-D4bCdTAY.js} +1 -1
- package/dist/client/assets/mcp-server-detail-Cy2l0hPz.js +1 -0
- package/dist/client/assets/{members-wdr88rOm.js → members-CXuNIHGD.js} +2 -2
- package/dist/client/assets/{monaco-editor-B2ZJ-0S4.js → monaco-editor-BnXEGbzY.js} +4 -4
- package/dist/client/assets/{monitoring-Cr82twHN.js → monitoring-vPlAvNfN.js} +2 -2
- package/dist/client/assets/{oauth-callback-BddKzzFQ.js → oauth-callback-I_aRwsB5.js} +1 -1
- package/dist/client/assets/{page-D_NhUEfH.js → page-DPsdZaOi.js} +1 -1
- package/dist/client/assets/page-fWJ76jbj.js +35 -0
- package/dist/client/assets/{pin-to-sidebar-button-CVN6Bdsp.js → pin-to-sidebar-button-DTR_Oj1s.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-srmGKRQU.js → plugin-empty-state-RYQHQ0B6.js} +1 -1
- package/dist/client/assets/{plugin-header-Dg9-cQAj.js → plugin-header-BPW1tb_d.js} +1 -1
- package/dist/client/assets/{plugins-Dawnh_sQ.js → plugins-DN4-aMVD.js} +1 -1
- package/dist/client/assets/{popover-HE15ABOl.js → popover-DLFe45bO.js} +1 -1
- package/dist/client/assets/{project-context-provider-B1gr9e2f.js → project-context-provider-DH0iqA5D.js} +1 -1
- package/dist/client/assets/{registry-utils-COqteFH4.js → registry-utils-BPPApxjf.js} +1 -1
- package/dist/client/assets/{resizable-B8j7Xubf.js → resizable-C6uSLZAk.js} +1 -1
- package/dist/client/assets/{resource-tabs-B1oXSRkv.js → resource-tabs-CKatVKnl.js} +1 -1
- package/dist/client/assets/select-CSzUpxmC.js +1 -0
- package/dist/client/assets/{settings-Clme5cH0.js → settings-Dk6-Mm8r.js} +1 -1
- package/dist/client/assets/shell-layout-P7XxC3ZF.js +3 -0
- package/dist/client/assets/{spinner-Dwr2EFZD.js → spinner-CUAQv_4V.js} +1 -1
- package/dist/client/assets/{standalone-Cva4pL7v.js → standalone-Cutp_BhH.js} +1 -1
- package/dist/client/assets/{switch-C9XtHYD0.js → switch-ZAqg3LbP.js} +1 -1
- package/dist/client/assets/{textarea-CyM57U4B.js → textarea-BDJhX5-9.js} +1 -1
- package/dist/client/assets/{tool-set-selector-B9-4X5pd.js → tool-set-selector-D26m7PpE.js} +1 -1
- package/dist/client/assets/{tools-list-DJqzZm19.js → tools-list-pl3Bsjpf.js} +1 -1
- package/dist/client/assets/{tooltip-DHS6wGWv.js → tooltip-DXYcokUT.js} +1 -1
- package/dist/client/assets/use-binding-Cmi2FEqF.js +23 -0
- package/dist/client/assets/{use-collections-CbsNEj5T.js → use-collections-DxMxR_jZ.js} +1 -1
- package/dist/client/assets/{use-connection-BhdfednN.js → use-connection-ClVfoZWG.js} +1 -1
- package/dist/client/assets/{use-connection-resources-D6kK3b1i.js → use-connection-resources-nXRlJNhx.js} +1 -1
- package/dist/client/assets/{use-create-gateway-dtd5LmVR.js → use-create-gateway-UkmAQbcu.js} +1 -1
- package/dist/client/assets/{use-gateway-Ck94EUZ3.js → use-gateway-D_zdUoI4.js} +1 -1
- package/dist/client/assets/{use-gateway-system-prompt-C9-1moLN.js → use-gateway-system-prompt-CYi0Zo4K.js} +1 -1
- package/dist/client/assets/{use-list-state-CQtVDn-T.js → use-list-state-G6sniPDx.js} +1 -1
- package/dist/client/assets/{use-mcp-C1X3fEnH.js → use-mcp-hlkUt7pz.js} +1 -1
- package/dist/client/assets/{use-members-Bh37cZiw.js → use-members-3RqzErHO.js} +1 -1
- package/dist/client/assets/{use-mobile-CuBmA9jm.js → use-mobile-DT1cwytU.js} +1 -1
- package/dist/client/assets/use-model-state-Bc4MpPVu.js +20 -0
- package/dist/client/assets/{use-organization-settings-BNK4p5TK.js → use-organization-settings-D46q7SyU.js} +1 -1
- package/dist/client/assets/{use-tool-call-DzBMga46.js → use-tool-call-BH-yOcTy.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-Dl93eV8h.js +1 -0
- package/dist/client/assets/{useMutation-BEX5R6ly.js → useMutation-DEocBykZ.js} +1 -1
- package/dist/client/assets/useQuery-Dakt0IBq.js +1 -0
- package/dist/client/assets/{value-UH6V0tmj.js → value-C9Bb1t7X.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-kdDPGpPT.js → view-mode-toggle-C5hz9T3M.js} +1 -1
- package/dist/client/assets/{workflow-DgZwuETF.js → workflow-BJoyVBBY.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +164 -157
- package/dist/server/migrate.js +130 -123
- package/dist/server/server.js +160 -153
- package/package.json +1 -1
- package/dist/client/assets/connection-detail-BHduC6at.js +0 -1
- package/dist/client/assets/constants-B-ATh8ff.js +0 -1
- package/dist/client/assets/create-organization-dialog-MS4oQ7Sl.js +0 -1
- package/dist/client/assets/env-vars-editor-D54i65KN.js +0 -1
- package/dist/client/assets/extract-connection-data-Hjw19oaR.js +0 -1
- package/dist/client/assets/index-C5xxIZ3a.js +0 -88
- package/dist/client/assets/index-DUfEAj2z.js +0 -25
- package/dist/client/assets/index-fFpUC2Bx.css +0 -1
- package/dist/client/assets/mcp-oauth-CuMRVoyP.js +0 -1
- package/dist/client/assets/mcp-server-detail-CBjpnL21.js +0 -1
- package/dist/client/assets/page-DhI0Qooi.js +0 -35
- package/dist/client/assets/select-DkAjMxeq.js +0 -1
- package/dist/client/assets/shell-layout-BuirxVot.js +0 -3
- package/dist/client/assets/thread-history-popover-DlGwptvV.js +0 -20
- package/dist/client/assets/use-binding-Cn24Ren1.js +0 -23
- package/dist/client/assets/useInfiniteQuery-B7UO0aOm.js +0 -1
- package/dist/client/assets/useQuery-BbeI5BfO.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as S,e as es,a as q,j as n,f as ze,t as Y,c as h,R as ts,T as ss,D as ns,C as as,P as os,g as is,O as ls,h as rs,i as cs,k as Nt,p as ds,l as ms,d as wt,G as fs,m as us,S as yt,n as ps,o as hs,N as xs,q as gs,K as bs,s as Ct}from"./index-Dk3lubBQ.js";import{E as lt}from"./error-boundary-DU6_J5et.js";import{B as J,c as T}from"./button-2azNqzUx.js";import{P as _t,a as kt,b as It}from"./popover-HE15ABOl.js";import{B as ft}from"./badge-CMZTNGZo.js";import{i as Ge}from"./Check-VfxUlV5P.js";import{n as ut}from"./Inbox01-y9RgqkXP.js";import{s as pt}from"./XClose-C895iFVX.js";import{i as js}from"./File06-DCHrHfbn.js";import{i as $e}from"./X-CVhiWYv-.js";import{u as Me}from"./use-mobile-CuBmA9jm.js";import{T as $t,a as zt,b as Mt,c as Ot}from"./tooltip-DHS6wGWv.js";import{S as Tt,u as vs,a as Ss,b as Ns,c as ws,N as ys,G as at,T as Cs,d as _s,D as ks}from"./thread-history-popover-DlGwptvV.js";import{u as rt,a as Is}from"./use-organization-settings-BNK4p5TK.js";import{u as Fe,L as ht,P as $s,O as zs}from"./project-context-provider-B1gr9e2f.js";import{n as Ms,I as xt}from"./empty-state-C3NzxCFI.js";import{i as ot}from"./use-gateway-Ck94EUZ3.js";import{a as Os}from"./Home02-CnvrJTir.js";import{C as Ts}from"./create-organization-dialog-MS4oQ7Sl.js";import{I as As}from"./input-CBrhxHNe.js";import{A as ee}from"./avatar-BLmwViC3.js";import{c as Rs}from"./Grid01-AMlhaaWH.js";import{D as Es,a as Ps,b as Ds,c as Ls,u as Bs,d as Hs,e as Us,C as P,f as gt,g as Gs,h as Fs,i as Ws,U as Vs,G as Ks,M as Zs}from"./index-C5xxIZ3a.js";import{D as Ys,a as qs,b as Js,c as Xs,d as bt}from"./dropdown-menu-DRkETp4T.js";import{a as At}from"./Copy01-dbjgqDL6.js";import{n as jt}from"./LinkExternal01-DzBB4jwo.js";import{D as Qs,a as en,b as tn,c as sn,d as nn}from"./dialog-DSU0GEtE.js";import{L as an}from"./form-DM9msJYn.js";import{S as on}from"./switch-C9XtHYD0.js";import{i as ln}from"./Code01-B9DNMb5j.js";import{u as We,L as Ve}from"./localstorage-keys-BJk6gyyN.js";import{R as Rt,a as rn,b as cn}from"./resizable-B8j7Xubf.js";import{s as dn}from"./Plus-CgcZFggs.js";import{u as mn}from"./use-connection-BhdfednN.js";import{u as fn}from"./use-binding-Cn24Ren1.js";import"./use-gateway-system-prompt-C9-1moLN.js";import"./ChevronDown-OK90XtVB.js";import"./Edit01-Ddbn6DsS.js";import"./well-known-mcp-D13f-8h2.js";import"./generate-id-Dyweu44Y.js";import"./Clock-CRgmR_1n.js";import"./SearchMd-DRJ07Awx.js";import"./Trash01-BDWyzvD2.js";import"./useMutation-BEX5R6ly.js";import"./connection-CXC8d3Ae.js";import"./use-collections-CbsNEj5T.js";import"./alert-dialog-D9k51qgG.js";import"./spinner-Dwr2EFZD.js";import"./use-create-gateway-dtd5LmVR.js";import"./AlertCircle-DeHvJZzp.js";import"./ArrowUp-B2eKsIZo.js";import"./textarea-CyM57U4B.js";import"./Terminal-FTJQx4pc.js";import"./monaco-editor-B2ZJ-0S4.js";import"./select-DkAjMxeq.js";import"./Image01-Bch9iOev.js";import"./InfoCircle-HrYndWCZ.js";import"./useQuery-BbeI5BfO.js";import"./binder-Bcr51BHa.js";const Et=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M9 7H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 7.76 3 8.04 3 8.6v10.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21H9m0 0h6m-6 0V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 3 10.04 3 10.6 3h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 3.76 15 4.04 15 4.6V21m0-10h4.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C21 11.76 21 12.04 21 12.6v6.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C20.24 21 19.96 21 19.4 21H15"}));Et.displayName="BarChart10";const Pt=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M15 21v-5.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C14.24 14 13.96 14 13.4 14h-2.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C9 14.76 9 15.04 9 15.6V21M3 7a3 3 0 0 0 6 0 3 3 0 1 0 6 0 3 3 0 1 0 6 0M6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3H6.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21Z"}));Pt.displayName="Building02";const Dt=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));Dt.displayName="ChevronSelectorVertical";const Lt=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M2 12h20M2 12c0 5.523 4.477 10 10 10M2 12C2 6.477 6.477 2 12 2m10 10c0 5.523-4.477 10-10 10m10-10c0-5.523-4.477-10-10-10m0 0a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10m0-20a15.3 15.3 0 0 0-4 10 15.3 15.3 0 0 0 4 10"}));Lt.displayName="Globe01";const Bt=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M15 3v18M7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3Z"}));Bt.displayName="LayoutRight";const Ht=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m16 17 5-5m0 0-5-5m5 5H9m0-9H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21H9"}));Ht.displayName="LogOut01";const Ut=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m2 7 8.165 5.715c.661.463.992.695 1.351.784a2 2 0 0 0 .968 0c.36-.09.69-.32 1.351-.784L22 7M6.8 20h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 17.72 22 16.88 22 15.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 4 18.88 4 17.2 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 6.28 2 7.12 2 8.8v6.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 20 5.12 20 6.8 20Z"}));Ut.displayName="Mail01";const ct=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),S.createElement("path",{d:"M18.727 14.727a1.5 1.5 0 0 0 .3 1.655l.055.054a1.816 1.816 0 0 1 0 2.573 1.818 1.818 0 0 1-2.573 0l-.055-.055a1.5 1.5 0 0 0-1.654-.3 1.5 1.5 0 0 0-.91 1.373v.155a1.818 1.818 0 1 1-3.636 0V20.1a1.5 1.5 0 0 0-.981-1.373 1.5 1.5 0 0 0-1.655.3l-.054.055a1.818 1.818 0 0 1-3.106-1.287 1.818 1.818 0 0 1 .533-1.286l.054-.055a1.5 1.5 0 0 0 .3-1.654 1.5 1.5 0 0 0-1.372-.91h-.155a1.818 1.818 0 1 1 0-3.636H3.9a1.5 1.5 0 0 0 1.373-.981 1.5 1.5 0 0 0-.3-1.655l-.055-.054A1.818 1.818 0 1 1 7.491 4.99l.054.054a1.5 1.5 0 0 0 1.655.3h.073a1.5 1.5 0 0 0 .909-1.372v-.155a1.818 1.818 0 0 1 3.636 0V3.9a1.499 1.499 0 0 0 .91 1.373 1.5 1.5 0 0 0 1.654-.3l.054-.055a1.817 1.817 0 0 1 2.573 0 1.819 1.819 0 0 1 0 2.573l-.055.054a1.5 1.5 0 0 0-.3 1.655v.073a1.5 1.5 0 0 0 1.373.909h.155a1.818 1.818 0 0 1 0 3.636H20.1a1.499 1.499 0 0 0-1.373.91Z"}));ct.displayName="Settings01";const Gt=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M22 21v-2a4.002 4.002 0 0 0-3-3.874M15.5 3.291a4.001 4.001 0 0 1 0 7.418M17 21c0-1.864 0-2.796-.305-3.53a4 4 0 0 0-2.164-2.165C13.796 15 12.864 15 11 15H8c-1.864 0-2.796 0-3.53.305a4 4 0 0 0-2.166 2.164C2 18.204 2 19.136 2 21M13.5 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"}));Gt.displayName="Users01";const Ft=({size:t=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M13 2 4.093 12.688c-.348.418-.523.628-.525.804a.5.5 0 0 0 .185.397c.138.111.41.111.955.111H12l-1 8 8.907-10.688c.348-.418.523-.628.525-.804a.5.5 0 0 0-.185-.397c-.138-.111-.41-.111-.955-.111H12l1-8Z"}));Ft.displayName="Zap";function un({invitation:t,onStatusChange:e}){const[s,a]=S.useState(!1),[o,i]=S.useState(!1),l=ze(),r=async()=>{a(!0);try{const u=await q.organization.acceptInvitation({invitationId:t.id});if(u.error)Y.error(u.error.message),a(!1);else{e(t.id,"accepted");const x=await q.organization.setActive({organizationId:t.organizationId});x?.data?.slug?(Y.success("Invitation accepted!"),l({to:"/$org",params:{org:x.data.slug}})):(Y.success("Invitation accepted! Redirecting..."),l({to:"/"}))}}catch{Y.error("Failed to accept invitation"),a(!1)}},c=async()=>{i(!0);try{const u=await q.organization.rejectInvitation({invitationId:t.id});u.error?(Y.error(u.error.message),i(!1)):(Y.success("Invitation rejected"),e(t.id,"rejected"),i(!1))}catch{Y.error("Failed to reject invitation"),i(!1)}},d=t.organizationName||t.organizationId,m=t.inviter?.name||t.inviter?.email||t.email||"Someone",f=t.status==="pending",p=t.status==="accepted",b=t.status==="rejected";return n.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 h-12 border-b border-border/50 last:border-b-0 ${f?"":"opacity-50"}`,children:[n.jsx("div",{className:"shrink-0 size-5 flex items-center justify-center",children:n.jsx(Ut,{size:16,className:"text-muted-foreground"})}),n.jsxs("p",{className:"flex-1 text-sm text-foreground min-w-0 whitespace-nowrap overflow-hidden",children:[n.jsx("span",{className:"font-semibold inline-block max-w-[120px] truncate align-bottom",children:m})," invited you to join ",n.jsx("span",{className:"font-semibold inline-block max-w-[200px] truncate align-bottom",children:d})]}),n.jsx("div",{className:"flex items-center gap-1 shrink-0",children:f?n.jsxs(n.Fragment,{children:[n.jsx(J,{variant:"ghost",size:"icon",onClick:c,disabled:s||o,className:"h-8 w-8",children:n.jsx(pt,{size:14})}),n.jsx(J,{variant:"outline",size:"icon",onClick:r,disabled:s||o,className:"h-8 w-8",children:n.jsx(Ge,{size:14})})]}):p?n.jsxs(ft,{variant:"outline",className:"h-6 px-2 text-xs",children:[n.jsx(Ge,{size:12}),"Accepted"]}):b?n.jsxs(ft,{variant:"outline",className:"h-6 px-2 text-xs",children:[n.jsx(pt,{size:12}),"Declined"]}):null})]})}function pn(){const[t,e]=S.useState(!1),s=S.useContext(es),{data:a}=s.hooks.useListUserInvitations(),{data:o}=q.useListOrganizations(),[i,l]=S.useState({}),d=(a??[]).map(u=>{const x=(o??[]).find(g=>g.id===u.organizationId);return{...u,organizationSlug:x?.slug||u.organizationSlug,organizationName:x?.name||u.organizationName}}).map(u=>({...u,status:i[u.id]||u.status})),m=[...d].sort((u,x)=>{const g={pending:0,accepted:1,rejected:2};return(g[u.status]??999)-(g[x.status]??999)}),p=d.filter(u=>u.status==="pending").length>0,b=(u,x)=>{l(g=>({...g,[u]:x}))};return n.jsxs(_t,{open:t,onOpenChange:e,children:[n.jsx(kt,{asChild:!0,children:n.jsxs(J,{variant:"ghost",size:"sm",className:"relative h-7 w-7 p-0","aria-label":"Inbox",children:[n.jsx(ut,{size:18,className:"text-muted-foreground"}),p&&n.jsx("span",{className:"absolute bottom-1 right-0.5 h-2 w-2 rounded-full bg-destructive ring-2 ring-background"})]})}),n.jsxs(It,{align:"end",className:"w-[480px] p-0 overflow-hidden",children:[n.jsx("div",{className:"px-4 py-3 border-b border-border",children:n.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Inbox"})}),n.jsx("div",{className:"max-h-96 overflow-auto",children:m.length>0?m.map(u=>n.jsx(un,{invitation:u,onStatusChange:b},u.id)):n.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[n.jsx(ut,{size:32,className:"text-muted-foreground/40 mb-2"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"No invitations at the moment"})]})})]})]})}function hn(t){const e=h.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n.jsx(ts,{"data-slot":"sheet",...s}),e[2]=s,e[3]=a):a=e[3],a}function xn(t){const e=h.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n.jsx(os,{"data-slot":"sheet-portal",...s}),e[2]=s,e[3]=a):a=e[3],a}function gn(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx(ls,{"data-slot":"sheet-overlay",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function bn(t){const e=h.c(17);let s,a,o,i;e[0]!==t?({className:a,children:s,side:i,...o}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i):(s=e[1],a=e[2],o=e[3],i=e[4]);const l=i===void 0?"right":i;let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(gn,{}),e[5]=r):r=e[5];const c=l==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",d=l==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",m=l==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",f=l==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t";let p;e[6]!==a||e[7]!==c||e[8]!==d||e[9]!==m||e[10]!==f?(p=T("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",c,d,m,f,a),e[6]=a,e[7]=c,e[8]=d,e[9]=m,e[10]=f,e[11]=p):p=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsxs(is,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[n.jsx($e,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]}),e[12]=b):b=e[12];let u;return e[13]!==s||e[14]!==o||e[15]!==p?(u=n.jsxs(xn,{children:[r,n.jsxs(as,{"data-slot":"sheet-content",className:p,...o,children:[s,b]})]}),e[13]=s,e[14]=o,e[15]=p,e[16]=u):u=e[16],u}function jn(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("flex flex-col gap-1.5 p-4",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"sheet-header",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function vn(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("text-foreground font-semibold",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx(ss,{"data-slot":"sheet-title",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Sn(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("text-muted-foreground text-sm",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx(ns,{"data-slot":"sheet-description",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}const Nn="sidebar_state",wn=3600*24*7,yn="16rem",Cn="18rem",_n="3rem",kn="b",Wt=S.createContext(null);function dt(){const t=S.useContext(Wt);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function In(t){const e=h.c(21),{defaultOpen:s,open:a,onOpenChange:o,children:i}=t,l=s===void 0?!0:s,r=Me(),[c,d]=S.useState(!1),[m,f]=S.useState(l),p=a??m;let b;e[0]!==p||e[1]!==o?(b=O=>{const _=typeof O=="function"?O(p):O;o?o(_):f(_),document.cookie=`${Nn}=${_}; path=/; max-age=${wn}`},e[0]=p,e[1]=o,e[2]=b):b=e[2];const u=b;let x;e[3]!==r||e[4]!==u?(x=()=>r?d(zn):u($n),e[3]=r,e[4]=u,e[5]=x):x=e[5];const g=x;let j,v;e[6]!==g?(j=()=>{const O=_=>{if(_.key===kn&&(_.metaKey||_.ctrlKey)){const M=_.target;if(M.tagName==="INPUT"||M.tagName==="TEXTAREA"||M.isContentEditable)return;_.preventDefault(),g()}};return globalThis.addEventListener("keydown",O),()=>globalThis.removeEventListener("keydown",O)},v=[g],e[6]=g,e[7]=j,e[8]=v):(j=e[7],v=e[8]),S.useEffect(j,v);const w=p?"expanded":"collapsed";let $;e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==u||e[13]!==w||e[14]!==g?($={state:w,open:p,setOpen:u,isMobile:r,openMobile:c,setOpenMobile:d,toggleSidebar:g},e[9]=r,e[10]=p,e[11]=c,e[12]=u,e[13]=w,e[14]=g,e[15]=$):$=e[15];const y=$;let N;e[16]!==i?(N=n.jsx(zt,{delayDuration:0,children:i}),e[16]=i,e[17]=N):N=e[17];let C;return e[18]!==y||e[19]!==N?(C=n.jsx(Wt.Provider,{value:y,children:N}),e[18]=y,e[19]=N,e[20]=C):C=e[20],C}function $n(t){return!t}function zn(t){return!t}function Mn(t){const e=h.c(14);let s,a,o,i;e[0]!==t?({className:a,style:i,children:s,...o}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i):(s=e[1],a=e[2],o=e[3],i=e[4]);let l;e[5]!==i?(l={"--sidebar-width":yn,"--sidebar-width-icon":_n,...i},e[5]=i,e[6]=l):l=e[6];const r=l;let c;e[7]!==a?(c=T("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",a),e[7]=a,e[8]=c):c=e[8];let d;return e[9]!==s||e[10]!==o||e[11]!==r||e[12]!==c?(d=n.jsx("div",{"data-slot":"sidebar-wrapper",style:r,className:c,...o,children:s}),e[9]=s,e[10]=o,e[11]=r,e[12]=c,e[13]=d):d=e[13],d}function On(t){const e=h.c(46);let s,a,o,i,l,r;e[0]!==t?({side:i,variant:l,collapsible:r,className:a,children:s,...o}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i,e[5]=l,e[6]=r):(s=e[1],a=e[2],o=e[3],i=e[4],l=e[5],r=e[6]);const c=i===void 0?"left":i,d=l===void 0?"sidebar":l,m=r===void 0?"offcanvas":r,{isMobile:f,state:p,openMobile:b,setOpenMobile:u}=dt();if(m==="none"){let _;e[7]!==a?(_=T("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",a),e[7]=a,e[8]=_):_=e[8];let M;return e[9]!==s||e[10]!==o||e[11]!==_?(M=n.jsx("div",{"data-slot":"sidebar",className:_,...o,children:s}),e[9]=s,e[10]=o,e[11]=_,e[12]=M):M=e[12],M}if(f){let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_={"--sidebar-width":Cn},e[13]=_):_=e[13];let M;e[14]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsxs(jn,{className:"sr-only",children:[n.jsx(vn,{children:"Sidebar"}),n.jsx(Sn,{children:"Displays the mobile sidebar."})]}),e[14]=M):M=e[14];let k;e[15]!==s?(k=n.jsx("div",{className:"flex h-full w-full flex-col",children:s}),e[15]=s,e[16]=k):k=e[16];let I;e[17]!==c||e[18]!==k?(I=n.jsxs(bn,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:_,side:c,children:[M,k]}),e[17]=c,e[18]=k,e[19]=I):I=e[19];let A;return e[20]!==b||e[21]!==o||e[22]!==u||e[23]!==I?(A=n.jsx(hn,{open:b,onOpenChange:u,...o,children:I}),e[20]=b,e[21]=o,e[22]=u,e[23]=I,e[24]=A):A=e[24],A}const x=p==="collapsed"?m:"",g=d==="floating"||d==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let j;e[25]!==g?(j=T("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",g),e[25]=g,e[26]=j):j=e[26];let v;e[27]!==j?(v=n.jsx("div",{"data-slot":"sidebar-gap",className:j}),e[27]=j,e[28]=v):v=e[28];const w=c==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",$=d==="floating"||d==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let y;e[29]!==a||e[30]!==w||e[31]!==$?(y=T("fixed top-12 bottom-0 z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",w,$,a),e[29]=a,e[30]=w,e[31]=$,e[32]=y):y=e[32];let N;e[33]!==s?(N=n.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border py-2 flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s}),e[33]=s,e[34]=N):N=e[34];let C;e[35]!==o||e[36]!==y||e[37]!==N?(C=n.jsx("div",{"data-slot":"sidebar-container",className:y,...o,children:N}),e[35]=o,e[36]=y,e[37]=N,e[38]=C):C=e[38];let O;return e[39]!==c||e[40]!==p||e[41]!==C||e[42]!==x||e[43]!==v||e[44]!==d?(O=n.jsxs("div",{className:"group peer text-foreground hidden md:block border-r","data-state":p,"data-collapsible":x,"data-variant":d,"data-side":c,"data-slot":"sidebar",children:[v,C]}),e[39]=c,e[40]=p,e[41]=C,e[42]=x,e[43]=v,e[44]=d,e[45]=O):O=e[45],O}function Tn(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("bg-background relative flex w-full flex-1 flex-col min-w-0","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("main",{"data-slot":"sidebar-inset",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function An(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("h-4 m-0! w-full",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-sidebar":"separator",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Rn(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function En(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Pn(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("w-full text-sm",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Dn(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("flex w-full min-w-0 flex-col gap-1",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Ke(t){const e=h.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=T("group/menu-item relative",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}const Ln=rs("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg px-2 py-1.5 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding,colors] transition-colors duration-150 ease-out hover:transition-none focus-visible:ring-2 active:bg-sidebar-accent/75 disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent/75 [&>span:last-child]:truncate [&>svg]:size-[18px] [&>svg]:shrink-0 [&>svg]:text-muted-foreground",{variants:{variant:{default:"hover:bg-sidebar-accent text-sidebar-foreground/80 active:text-sidebar-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-7 text-sm font-[450]",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Vt(t){const e=h.c(28);let s,a,o,i,l,r,c;e[0]!==t?({asChild:o,isActive:i,variant:l,size:r,tooltip:c,className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i,e[5]=l,e[6]=r,e[7]=c):(s=e[1],a=e[2],o=e[3],i=e[4],l=e[5],r=e[6],c=e[7]);const d=o===void 0?!1:o,m=i===void 0?!1:i,f=l===void 0?"default":l,p=r===void 0?"default":r,b=d?cs:"button",{isMobile:u,state:x}=dt();let g;e[8]!==s||e[9]!==p||e[10]!==f?(g=T(Ln({variant:f,size:p}),s),e[8]=s,e[9]=p,e[10]=f,e[11]=g):g=e[11];let j;e[12]!==b||e[13]!==m||e[14]!==a||e[15]!==p||e[16]!==g?(j=n.jsx(b,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":p,"data-active":m,className:g,...a}),e[12]=b,e[13]=m,e[14]=a,e[15]=p,e[16]=g,e[17]=j):j=e[17];const v=j;if(!c)return v;if(typeof c=="string"){let C;e[18]!==c?(C={children:c},e[18]=c,e[19]=C):C=e[19],c=C}let w;e[20]!==v?(w=n.jsx(Mt,{asChild:!0,children:v}),e[20]=v,e[21]=w):w=e[21];const $=x!=="collapsed"||u;let y;e[22]!==$||e[23]!==c?(y=n.jsx($t,{side:"right",align:"center",hidden:$,...c}),e[22]=$,e[23]=c,e[24]=y):y=e[24];let N;return e[25]!==w||e[26]!==y?(N=n.jsxs(Ot,{children:[w,y]}),e[25]=w,e[26]=y,e[27]=N):N=e[27],N}function Bn(t){const e=h.c(26),{item:s}=t,a=ze(),{org:o}=Fe(),i=rt(o.id),l=Is(o.id);let r;e[0]!==l.update||e[1]!==s.url||e[2]!==i?.sidebar_items?(r=async()=>{const $=(i?.sidebar_items||[]).filter(y=>y.url!==s.url);await l.update.mutateAsync({sidebar_items:$})},e[0]=l.update,e[1]=s.url,e[2]=i?.sidebar_items,e[3]=r):r=e[3];const c=r;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=/^https?:\/\/.+/,e[4]=d):d=e[4];let m;e[5]!==s.icon?(m=d.test(s.icon),e[5]=s.icon,e[6]=m):m=e[6];const f=m;let p;e[7]!==s.url||e[8]!==a?(p=()=>{a({to:s.url})},e[7]=s.url,e[8]=a,e[9]=p):p=e[9];const b=s.title;let u;e[10]!==f||e[11]!==s.icon||e[12]!==s.title?(u=n.jsx("div",{className:"flex items-center justify-center shrink-0",children:f?n.jsx("img",{src:s.icon,alt:s.title,className:"h-4 w-4 rounded object-cover"}):n.jsx(js,{size:16,className:"text-muted-foreground group-hover/item:text-foreground transition-colors"})}),e[10]=f,e[11]=s.icon,e[12]=s.title,e[13]=u):u=e[13];let x;e[14]!==s.title?(x=s.title.toLocaleLowerCase(),e[14]=s.title,e[15]=x):x=e[15];let g;e[16]!==x?(g=n.jsx("div",{className:"flex-1 min-w-0 flex flex-col items-start",children:n.jsx("span",{className:"truncate text-sm w-full capitalize",children:x})}),e[16]=x,e[17]=g):g=e[17];let j;e[18]!==c?(j=n.jsx($e,{size:16,className:"text-muted-foreground opacity-0 group-hover/item:opacity-50 hover:opacity-100 cursor-pointer",onClick:w=>{w.preventDefault(),w.stopPropagation(),c()}}),e[18]=c,e[19]=j):j=e[19];let v;return e[20]!==s.title||e[21]!==p||e[22]!==u||e[23]!==g||e[24]!==j?(v=n.jsx(Ke,{children:n.jsxs(Vt,{className:"w-full pr-2 group/item relative cursor-pointer text-foreground/90 hover:text-foreground",onClick:p,tooltip:b,children:[u,g,j]})}),e[20]=s.title,e[21]=p,e[22]=u,e[23]=g,e[24]=j,e[25]=v):v=e[25],v}function Hn(){const t=h.c(4),{org:e}=Fe(),a=rt(e.id)?.sidebar_items;if(!a?.length)return null;let o;t[0]!==a?(o=a.map(Un),t[0]=a,t[1]=o):o=t[1];let i;return t[2]!==o?(i=n.jsx(Kt,{children:o}),t[2]=o,t[3]=i):i=t[3],i}function Un(t){return n.jsx(Bn,{item:t},t.url)}function vt(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Ke,{children:n.jsx("div",{className:"flex items-center gap-2 px-4 py-2",children:n.jsx(Tt,{className:"h-4 flex-1"})})}),t[0]=e):e=t[0],e}function Kt(t){const e=h.c(4),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(An,{className:"my-2 -ml-1"}),e[0]=a):a=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Ke,{children:n.jsx("div",{className:"group-data-[collapsible=icon]:hidden px-2 py-0 text-xs font-medium h-6 text-muted-foreground flex items-center justify-between",children:n.jsx("span",{className:"whitespace-nowrap",children:"Pinned Views"})})}),e[1]=o):o=e[1];let i;return e[2]!==s?(i=n.jsxs(n.Fragment,{children:[a,o,s]}),e[2]=s,e[3]=i):i=e[3],i}function Gn(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(S.Suspense,{fallback:n.jsxs(Kt,{children:[n.jsx(vt,{}),n.jsx(vt,{})]}),children:n.jsx(Hn,{})}),t[0]=e):e=t[0],e}function Fn(){const t=h.c(14),{locator:e,org:s}=Fe(),a=ze(),o=Nt(),{org:i}=ht.parse(e);let l;t[0]!==e?(l=ht.isOrgAdminProject(e),t[0]=e,t[1]=l):l=t[1];const r=l,c=rt(s.id);let d;t[2]!==c?.enabled_plugins?(d=c?.enabled_plugins??[],t[2]=c?.enabled_plugins,t[3]=d):d=t[3];const m=d;let f;t[4]!==m?(f=C=>m.includes(C.pluginId),t[4]=m,t[5]=f):f=t[5];const p=ds.filter(f),b=o.location.pathname===`/${i}`||o.location.pathname===`/${i}/`;let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Os,{}),t[6]=u):u=t[6];let x;t[7]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Pt,{}),t[7]=x):x=t[7];let g;t[8]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Ms,{}),t[8]=g):g=t[8];let j;t[9]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(ot,{}),t[9]=j):j=t[9];let v;t[10]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Ft,{}),t[10]=v):v=t[10];let w;t[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Et,{}),t[11]=w):w=t[11];let $;t[12]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(Gt,{}),t[12]=$):$=t[12];let y;t[13]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(ct,{}),t[13]=y):y=t[13];const N=[{key:"home",label:"Home",icon:u,onClick:()=>{b?window.dispatchEvent(new CustomEvent("reset-home-view")):a({to:"/$org",params:{org:i}})}},{key:"store",label:"Store",icon:x,onClick:()=>a({to:"/$org/store",params:{org:i}})},...p.map(C=>({key:C.pluginId,label:C.label,icon:C.icon,onClick:()=>a({to:"/$org/$pluginId",params:{org:i,pluginId:C.pluginId}})})),{key:"mcps",label:"Connections",icon:g,onClick:()=>a({to:"/$org/mcps",params:{org:i}})},{key:"gateways",label:"Agents",icon:j,onClick:()=>a({to:"/$org/gateways",params:{org:i}})},{key:"workflow",label:"Workflows",icon:v,onClick:()=>a({to:"/$org/workflows",params:{org:i}})},{key:"monitoring",label:"Monitoring",icon:w,onClick:()=>a({to:"/$org/monitoring",params:{org:i}})},{key:"members",label:"Members",icon:$,onClick:()=>a({to:"/$org/members",params:{org:i}})},{key:"settings",label:"Settings",icon:y,onClick:()=>a({to:"/$org/settings",params:{org:i}})}];return r?N:[]}function Zt(t){const e=h.c(10),{navigationItems:s,footer:a,additionalContent:o,variant:i,collapsible:l}=t,r=i===void 0?"sidebar":i,c=l===void 0?"icon":l;let d;e[0]!==s?(d=s.map(Wn),e[0]=s,e[1]=d):d=e[1];let m;e[2]!==o||e[3]!==d?(m=n.jsx(Rn,{className:"flex-1 overflow-x-hidden",children:n.jsx(En,{className:"font-medium",children:n.jsx(Pn,{children:n.jsxs(Dn,{className:"gap-0.5",children:[d,o]})})})}),e[2]=o,e[3]=d,e[4]=m):m=e[4];let f;return e[5]!==c||e[6]!==a||e[7]!==m||e[8]!==r?(f=n.jsxs(On,{variant:r,collapsible:c,children:[m,a]}),e[5]=c,e[6]=a,e[7]=m,e[8]=r,e[9]=f):f=e[9],f}function Wn(t){return n.jsx(Ke,{children:n.jsxs(Vt,{className:"group/nav-item cursor-pointer text-foreground/90 hover:text-foreground",onClick:t.onClick,isActive:t.isActive,tooltip:t.label,children:[n.jsx("span",{className:"text-muted-foreground group-hover/nav-item:text-foreground transition-colors [&>svg]:size-4",children:t.icon}),n.jsx("span",{className:"truncate",children:t.label})]})},t.key)}Zt.Skeleton=function(){return n.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>n.jsx("div",{className:"w-full h-8",children:n.jsx(Tt,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function Vn(){const t=h.c(3),e=Fn();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(n.Fragment,{children:n.jsx(lt,{children:n.jsx(S.Suspense,{fallback:null,children:n.jsx(Gn,{})})})}),t[0]=s):s=t[0];let a;return t[1]!==e?(a=n.jsx(Zt,{navigationItems:e,additionalContent:s}),t[1]=e,t[2]=a):a=t[2],a}function Kn(t){const e=h.c(12);let s,a,o,i;e[0]!==t?({className:s,orientation:o,decorative:i,...a}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i):(s=e[1],a=e[2],o=e[3],i=e[4]);const l=o===void 0?"horizontal":o,r=i===void 0?!0:i;let c;e[5]!==s?(c=T("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==l||e[9]!==a||e[10]!==c?(d=n.jsx(ms,{"data-slot":"separator-root",decorative:r,orientation:l,className:c,...a}),e[7]=r,e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}const Yt=S.createContext(null);function Zn(){const t=S.useContext(Yt);if(!t)throw new Error("TopbarSwitcher compound components must be used within TopbarSwitcher.Root");return t}function Yn(t){const e=h.c(10),{children:s,onItemHover:a}=t,[o,i]=S.useState(null);let l;e[0]!==a?(l=f=>{i(f),a?.(f)},e[0]=a,e[1]=l):l=e[1];const r=l;let c;e[2]!==o||e[3]!==r?(c={hoveredItem:o,setHoveredItem:r},e[2]=o,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==s?(d=n.jsx(_t,{children:s}),e[5]=s,e[6]=d):d=e[6];let m;return e[7]!==c||e[8]!==d?(m=n.jsx(Yt.Provider,{value:c,children:d}),e[7]=c,e[8]=d,e[9]=m):m=e[9],m}function qn(t){const e=h.c(6),{children:s,onClick:a}=t;let o;e[0]!==s||e[1]!==a?(o=n.jsx(J,{variant:"link",className:"p-0.5 h-auto",onClick:a,type:"button",children:s}),e[0]=s,e[1]=a,e[2]=o):o=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(kt,{asChild:!0,children:n.jsx(J,{size:"icon",variant:"ghost",className:"w-6 h-6 p-0",children:n.jsx(Dt,{size:16,className:"opacity-50"})})}),e[3]=i):i=e[3];let l;return e[4]!==o?(l=n.jsxs("div",{className:"flex items-center gap-1",children:[o,i]}),e[4]=o,e[5]=l):l=e[5],l}function Jn(t){const e=h.c(8),{item:s,fallback:a}=t,o=a===void 0?"":a,i=s?.avatarUrl??"",l=s?.name??o;let r;e[0]!==i||e[1]!==l?(r=n.jsx(ee,{url:i,fallback:l,size:"xs",objectFit:"contain"}),e[0]=i,e[1]=l,e[2]=r):r=e[2];const c=s?.name??o;let d;e[3]!==c?(d=n.jsx("span",{children:c}),e[3]=c,e[4]=d):d=e[4];let m;return e[5]!==r||e[6]!==d?(m=n.jsxs("div",{className:"flex items-center gap-2",children:[r,d]}),e[5]=r,e[6]=d,e[7]=m):m=e[7],m}function Xn(t){const e=h.c(6),{children:s,align:a}=t,o=a===void 0?"start":a,l=S.Children.toArray(s).filter(Qn).length===1?"280px":"480px";let r;e[0]!==l?(r={width:l},e[0]=l,e[1]=r):r=e[1];let c;return e[2]!==o||e[3]!==s||e[4]!==r?(c=n.jsx(It,{align:o,className:"p-0 flex items-start",style:r,children:s}),e[2]=o,e[3]=s,e[4]=r,e[5]=c):c=e[5],c}function Qn(t){return S.isValidElement(t)&&(t.type===Jt||t.type===qt)}function qt(t){const e=h.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=T("flex flex-col border-border w-[240px] border-r last:border-r-0 last:w-full",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}const Jt=qt;function ea(t){const e=h.c(6),{placeholder:s,value:a,onChange:o}=t,i=s===void 0?"Search...":s;let l;e[0]!==o?(l=c=>o(c.target.value),e[0]=o,e[1]=l):l=e[1];let r;return e[2]!==i||e[3]!==l||e[4]!==a?(r=n.jsx(As,{placeholder:i,value:a,onChange:l,className:"rounded-none border-t-0 border-x-0 focus-visible:border-border focus-visible:ring-0"}),e[2]=i,e[3]=l,e[4]=a,e[5]=r):r=e[5],r}function ta(t){const e=h.c(6),{children:s,emptyMessage:a}=t,o=a===void 0?"No items found.":a,i=S.Children.count(s)>0;let l;e[0]!==o||e[1]!==i?(l=!i&&n.jsx("div",{className:"text-muted-foreground text-sm px-1 py-8 text-center",children:o}),e[0]=o,e[1]=i,e[2]=l):l=e[2];let r;return e[3]!==s||e[4]!==l?(r=n.jsxs("div",{className:"flex flex-col gap-0.5 p-1 max-h-44 overflow-y-auto",children:[l,s]}),e[3]=s,e[4]=l,e[5]=r):r=e[5],r}function sa(t){const e=h.c(15),{item:s,onClick:a,onHover:o,children:i}=t,l=Zn();let r;e[0]!==l||e[1]!==s||e[2]!==o?(r=()=>{l.setHoveredItem(s.slug),o?.(s)},e[0]=l,e[1]=s,e[2]=o,e[3]=r):r=e[3];const c=r;let d;e[4]!==s||e[5]!==a?(d=()=>a(s),e[4]=s,e[5]=a,e[6]=d):d=e[6];let m;e[7]!==i||e[8]!==s.avatarUrl||e[9]!==s.name?(m=i||n.jsxs(n.Fragment,{children:[n.jsx(ee,{url:s.avatarUrl??"",fallback:s.name,size:"xs",className:"w-[22px]! h-[22px]!",objectFit:"contain"}),n.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.name})]}),e[7]=i,e[8]=s.avatarUrl,e[9]=s.name,e[10]=m):m=e[10];let f;return e[11]!==c||e[12]!==d||e[13]!==m?(f=n.jsx(J,{onClick:d,onMouseEnter:c,variant:"ghost",size:"sm",className:"w-full justify-start font-normal",children:m}),e[11]=c,e[12]=d,e[13]=m,e[14]=f):f=e[14],f}function na(t){const e=h.c(2),{children:s}=t;let a;return e[0]!==s?(a=n.jsx("div",{className:"px-1 pb-1 pt-0.5",children:s}),e[0]=s,e[1]=a):a=e[1],a}function aa(t){const e=h.c(11),{onClick:s,icon:a,children:o,variant:i}=t,r=(i===void 0?"default":i)==="muted"&&"text-muted-foreground";let c;e[0]!==r?(c=T("w-full justify-start font-normal",r),e[0]=r,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&n.jsx("span",{className:"[&>svg]:size-4",children:a}),e[2]=a,e[3]=d):d=e[3];let m;e[4]!==o?(m=n.jsx("span",{children:o}),e[4]=o,e[5]=m):m=e[5];let f;return e[6]!==s||e[7]!==c||e[8]!==d||e[9]!==m?(f=n.jsxs(J,{variant:"ghost",size:"sm",className:c,onClick:s,children:[d,m]}),e[6]=s,e[7]=c,e[8]=d,e[9]=m,e[10]=f):f=e[10],f}function oa(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Kn,{}),t[0]=e):e=t[0],e}function ia(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"h-4 w-16 bg-accent rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const G=Object.assign(Yn,{Trigger:qn,CurrentItem:Jn,Content:Xn,Panel:Jt,Search:ea,Items:ta,Item:sa,Actions:na,Action:aa,Separator:oa,Skeleton:ia});function it(){const t=h.c(59);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=wt(e),{data:a}=q.useListOrganizations(),o=ze();let i;t[1]!==s||t[2]!==a?(i=a?.find(R=>R.slug===s),t[1]=s,t[2]=a,t[3]=i):i=t[3];const l=i,[r,c]=S.useState(""),[d,m]=S.useState(!1);let f,p,b,u,x,g,j,v;if(t[4]!==l||t[5]!==o||t[6]!==s||t[7]!==r||t[8]!==a){const L=(a?(()=>{const D=a.filter(V=>V.name.toLowerCase().includes(r.toLowerCase()));if(s){const V=D.findIndex(X=>X.slug===s);if(V>0){const X=D[V];X&&(D.splice(V,1),D.unshift(X))}}return D})():[]).map(la);let B;t[17]!==l?(B=l?{slug:l.slug,name:l.name,avatarUrl:l.logo}:void 0,t[17]=l,t[18]=B):B=t[18];const z=B;u=G;let U;t[19]!==o||t[20]!==s?(U=()=>o({to:"/$org",params:{org:s??""}}),t[19]=o,t[20]=s,t[21]=U):U=t[21];let E;t[22]!==z?(E=n.jsx(G.CurrentItem,{item:z}),t[22]=z,t[23]=E):E=t[23],t[24]!==U||t[25]!==E?(v=n.jsx(G.Trigger,{onClick:U,children:E}),t[24]=U,t[25]=E,t[26]=v):v=t[26],b=G.Content,p=G.Panel,t[27]!==r?(j=n.jsx(G.Search,{placeholder:"Search organizations...",value:r,onChange:c}),t[27]=r,t[28]=j):j=t[28],f=G.Items,x="No organizations found.";let F;t[29]!==o?(F=D=>n.jsx(G.Item,{item:D,onClick:V=>o({to:"/$org",params:{org:V.slug}})},D.slug),t[29]=o,t[30]=F):F=t[30],g=L.map(F),t[4]=l,t[5]=o,t[6]=s,t[7]=r,t[8]=a,t[9]=f,t[10]=p,t[11]=b,t[12]=u,t[13]=x,t[14]=g,t[15]=j,t[16]=v}else f=t[9],p=t[10],b=t[11],u=t[12],x=t[13],g=t[14],j=t[15],v=t[16];let w;t[31]!==f||t[32]!==x||t[33]!==g?(w=n.jsx(f,{emptyMessage:x,children:g}),t[31]=f,t[32]=x,t[33]=g,t[34]=w):w=t[34];let $,y;t[35]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(G.Actions,{children:n.jsx(G.Action,{onClick:()=>m(!0),variant:"muted",children:"+ Create organization"})}),y=n.jsx(G.Separator,{}),t[35]=$,t[36]=y):($=t[35],y=t[36]);let N;t[37]!==o?(N=()=>o({to:"/"}),t[37]=o,t[38]=N):N=t[38];let C;t[39]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(Rs,{}),t[39]=C):C=t[39];let O;t[40]!==N?(O=n.jsx(G.Actions,{children:n.jsx(G.Action,{onClick:N,icon:C,children:"See all organizations"})}),t[40]=N,t[41]=O):O=t[41];let _;t[42]!==p||t[43]!==O||t[44]!==j||t[45]!==w?(_=n.jsxs(p,{children:[j,w,$,y,O]}),t[42]=p,t[43]=O,t[44]=j,t[45]=w,t[46]=_):_=t[46];let M;t[47]!==b||t[48]!==_?(M=n.jsx(b,{children:_}),t[47]=b,t[48]=_,t[49]=M):M=t[49];let k;t[50]!==u||t[51]!==M||t[52]!==v?(k=n.jsxs(u,{children:[v,M]}),t[50]=u,t[51]=M,t[52]=v,t[53]=k):k=t[53];let I;t[54]!==d?(I=n.jsx(Ts,{open:d,onOpenChange:m}),t[54]=d,t[55]=I):I=t[55];let A;return t[56]!==k||t[57]!==I?(A=n.jsxs(n.Fragment,{children:[k,I]}),t[56]=k,t[57]=I,t[58]=A):A=t[58],A}function la(t){return{slug:t.slug,name:t.name,avatarUrl:t.logo}}it.Skeleton=G.Skeleton;const Xt=S.createContext({setOpen:()=>{}}),ra=()=>S.useContext(Xt),ca=t=>{const e=h.c(25);let s,a,o,i,l;e[0]!==t?({children:s,defaultOpen:a,open:i,onOpenChange:o,...l}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i,e[5]=l):(s=e[1],a=e[2],o=e[3],i=e[4],l=e[5]);const r=a??!1;let c;e[6]!==o||e[7]!==i||e[8]!==r?(c={prop:i,defaultProp:r,onChange:o},e[6]=o,e[7]=i,e[8]=r,e[9]=c):c=e[9];const[d,m]=Bs(c);let f;e[10]!==m?(f={setOpen:m},e[10]=m,e[11]=f):f=e[11];let p;e[12]!==s||e[13]!==d||e[14]!==l||e[15]!==m?(p=n.jsx(Hs,{open:d,onOpenChange:m,...l,children:s}),e[12]=s,e[13]=d,e[14]=l,e[15]=m,e[16]=p):p=e[16];let b;e[17]!==d||e[18]!==l||e[19]!==m||e[20]!==p?(b=n.jsx(Js,{open:d,onOpenChange:m,...l,children:p}),e[17]=d,e[18]=l,e[19]=m,e[20]=p,e[21]=b):b=e[21];let u;return e[22]!==f||e[23]!==b?(u=n.jsx(Xt.Provider,{value:f,children:b}),e[22]=f,e[23]=b,e[24]=u):u=e[24],u},da=t=>{const{children:e,title:s,...a}=t,o=Me(),{className:i,...l}=a;return o?n.jsxs(Ps,{...l,children:[n.jsx(Ds,{className:"hidden",children:n.jsx(Ls,{children:s})}),n.jsx("div",{className:T("flex flex-col gap-2 p-2 py-4",i),children:e})]}):n.jsx(qs,{...a,children:e})},ma=t=>{const{children:e,...s}=t,{setOpen:a}=ra(),o=Me(),{className:i,...l}=s;return o?n.jsx("div",{...l,onClick:r=>{a(!1);const{onClick:c}=l;c?.(r)},className:T("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",i),children:e}):n.jsx(Xs,{...s,children:e})},fa=t=>{const e=h.c(7);let s,a;e[0]!==t?({children:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);const o=Me();let i;return e[3]!==s||e[4]!==o||e[5]!==a?(i=o?n.jsx(Es,{asChild:!0,children:s}):n.jsx(Ys,{...a,children:s}),e[3]=s,e[4]=o,e[5]=a,e[6]=i):i=e[6],i},ua=t=>{const e=h.c(7);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);const o=Me();let i;return e[3]!==s||e[4]!==o||e[5]!==a?(i=o?n.jsx(bt,{className:T(s),...a}):n.jsx(bt,{className:T(s),...a}),e[3]=s,e[4]=o,e[5]=a,e[6]=i):i=e[6],i};function pa(t){const e=h.c(11),{user:s,trigger:a,align:o,children:i}=t,l=o===void 0?"start":o;let r;e[0]!==a||e[1]!==s?(r=a(s),e[0]=a,e[1]=s,e[2]=r):r=e[2];let c;e[3]!==r?(c=n.jsx(fa,{asChild:!0,children:n.jsx("div",{children:r})}),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==l||e[6]!==i?(d=n.jsx(da,{side:"top",align:l,className:"md:w-[240px]",children:i}),e[5]=l,e[6]=i,e[7]=d):d=e[7];let m;return e[8]!==c||e[9]!==d?(m=n.jsxs(ca,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=m):m=e[10],m}function ha(t){const e=h.c(8),{children:s,onClick:a,className:o,asChild:i}=t;let l;e[0]!==i||e[1]!==s||e[2]!==a?(l=i?s:n.jsx("button",{type:"button",className:"flex items-center gap-2 text-sm w-full cursor-pointer",onClick:a,children:s}),e[0]=i,e[1]=s,e[2]=a,e[3]=l):l=e[3];let r;return e[4]!==i||e[5]!==o||e[6]!==l?(r=n.jsx(ma,{asChild:i,className:o,children:l}),e[4]=i,e[5]=o,e[6]=l,e[7]=r):r=e[7],r}function xa(t){const e=h.c(2),{className:s}=t;let a;return e[0]!==s?(a=n.jsx(ua,{className:s}),e[0]=s,e[1]=a):a=e[1],a}function ga(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const Z=Object.assign(pa,{Item:ha,Separator:xa,Skeleton:ga});function ba(t){const e=h.c(48),{open:s,onOpenChange:a,user:o,userImage:i}=t,[l,r]=Us(),[c,d]=S.useState(!1);let m;e[0]!==o.id?(m=()=>{navigator.clipboard.writeText(o.id),d(!0),setTimeout(()=>d(!1),2e3)},e[0]=o.id,e[1]=m):m=e[1];const f=m;let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Qs,{className:"text-base",children:"Profile Settings"}),e[2]=p):p=e[2];let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsxs(en,{className:"px-6 pt-6 pb-4 border-b border-border shrink-0 relative",children:[p,n.jsxs(tn,{className:"absolute top-1/2 right-4 -translate-y-1/2 cursor-pointer rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[n.jsx($e,{size:16}),n.jsx("span",{className:"sr-only",children:"Close"})]})]}),e[3]=b):b=e[3];const u=o.name||"U";let x;e[4]!==u||e[5]!==i?(x=n.jsx(ee,{url:i,fallback:u,shape:"circle",size:"xl",className:"h-16 w-16"}),e[4]=u,e[5]=i,e[6]=x):x=e[6];const g=o.name||"User";let j;e[7]!==g?(j=n.jsx("span",{className:"text-base font-medium text-foreground",children:g}),e[7]=g,e[8]=j):j=e[8];let v;e[9]!==o.email?(v=n.jsx("span",{className:"text-sm text-muted-foreground",children:o.email}),e[9]=o.email,e[10]=v):v=e[10];let w;e[11]!==j||e[12]!==v?(w=n.jsxs("div",{className:"flex flex-col gap-1",children:[j,v]}),e[11]=j,e[12]=v,e[13]=w):w=e[13];let $;e[14]!==x||e[15]!==w?($=n.jsxs("div",{className:"flex items-center gap-4",children:[x,w]}),e[14]=x,e[15]=w,e[16]=$):$=e[16];let y;e[17]!==l||e[18]!==r?(y=()=>r(!l),e[17]=l,e[18]=r,e[19]=y):y=e[19];let N;e[20]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",children:[n.jsxs(an,{className:"text-sm font-medium text-foreground flex items-center gap-2 pointer-events-none",children:[n.jsx(ln,{size:16,className:"text-muted-foreground"}),"Developer Mode"]}),n.jsx("p",{className:"text-xs text-muted-foreground pointer-events-none",children:"Show technical details like JSON input/output for tool calls"})]}),e[20]=N):N=e[20];let C;e[21]!==l||e[22]!==r?(C=n.jsx("div",{onClick:ja,children:n.jsx(on,{checked:l,onCheckedChange:r})}),e[21]=l,e[22]=r,e[23]=C):C=e[23];let O;e[24]!==y||e[25]!==C?(O=n.jsxs("button",{type:"button",onClick:y,className:"flex items-center justify-between gap-4 p-4 rounded-lg border border-border hover:bg-accent/50 transition-colors text-left w-full cursor-pointer",children:[N,C]}),e[24]=y,e[25]=C,e[26]=O):O=e[26];let _;e[27]!==$||e[28]!==O?(_=n.jsxs("div",{className:"p-5 space-y-6 min-h-[225px]",children:[$,O]}),e[27]=$,e[28]=O,e[29]=_):_=e[29];let M;e[30]!==o.id?(M=n.jsx("span",{className:"font-mono text-xs",children:o.id}),e[30]=o.id,e[31]=M):M=e[31];let k;e[32]!==c?(k=c?n.jsx(Ge,{size:14,className:"text-green-600"}):n.jsx(At,{size:14,className:"opacity-0 group-hover:opacity-100 transition-opacity"}),e[32]=c,e[33]=k):k=e[33];let I;e[34]!==f||e[35]!==M||e[36]!==k?(I=n.jsx(Mt,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:f,className:"group flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[M,k]})}),e[34]=f,e[35]=M,e[36]=k,e[37]=I):I=e[37];let A;e[38]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx($t,{side:"top",children:n.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[38]=A):A=e[38];let R;e[39]!==I?(R=n.jsx("div",{className:"border-t border-border px-5 py-4 flex items-center shrink-0",children:n.jsx(zt,{children:n.jsxs(Ot,{children:[I,A]})})}),e[39]=I,e[40]=R):R=e[40];let L;e[41]!==_||e[42]!==R?(L=n.jsxs(sn,{className:"sm:max-w-lg sm:max-h-[85vh] p-0 flex flex-col",closeButtonClassName:"hidden",children:[b,n.jsxs("div",{className:"flex flex-col",children:[_,R]})]}),e[41]=_,e[42]=R,e[43]=L):L=e[43];let B;return e[44]!==a||e[45]!==s||e[46]!==L?(B=n.jsx(nn,{open:s,onOpenChange:a,children:L}),e[44]=a,e[45]=s,e[46]=L,e[47]=B):B=e[47],B}function ja(t){return t.stopPropagation()}function va(t){const e=h.c(47),{user:s,userImage:a}=t,[o,i]=S.useState(!1),[l,r]=S.useState(!1);let c;e[0]!==s.email||e[1]!==s.id||e[2]!==s.name?(c=()=>{const B=`ID: ${s.id}
|
|
2
|
-
Name: ${s.name||"N/A"}
|
|
3
|
-
Email: ${s.email}`;navigator.clipboard.writeText(B),r(!0),Y.success("User info copied to clipboard"),setTimeout(()=>r(!1),2e3)},e[0]=s.email,e[1]=s.id,e[2]=s.name,e[3]=c):c=e[3];const d=c;let m;e[4]!==s.email||e[5]!==s.name||e[6]!==a?(m=()=>n.jsx(ee,{url:a,fallback:s.name||s.email||"U",shape:"circle",size:"sm",className:"cursor-pointer hover:ring-2 ring-muted-foreground transition-all h-7 w-7"}),e[4]=s.email,e[5]=s.name,e[6]=a,e[7]=m):m=e[7];const f=s.name||s.email||"U";let p;e[8]!==f||e[9]!==a?(p=n.jsx(ee,{url:a,fallback:f,shape:"circle",size:"sm"}),e[8]=f,e[9]=a,e[10]=p):p=e[10];const b=s.name||"User";let u;e[11]!==b?(u=n.jsx("div",{className:"text-sm font-medium truncate",children:b}),e[11]=b,e[12]=u):u=e[12];let x;e[13]!==s.email?(x=n.jsx("div",{className:"text-xs text-muted-foreground truncate",children:s.email}),e[13]=s.email,e[14]=x):x=e[14];let g;e[15]!==u||e[16]!==x?(g=n.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[u,x]}),e[15]=u,e[16]=x,e[17]=g):g=e[17];let j;e[18]!==l?(j=n.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:l?n.jsx(Ge,{size:16,className:"text-green-600"}):n.jsx(At,{size:16,className:"text-muted-foreground"})}),e[18]=l,e[19]=j):j=e[19];let v;e[20]!==p||e[21]!==g||e[22]!==j?(v=n.jsxs("div",{className:"group flex items-center gap-3 w-full py-1",children:[p,g,j]}),e[20]=p,e[21]=g,e[22]=j,e[23]=v):v=e[23];let w;e[24]!==d||e[25]!==v?(w=n.jsx(Z.Item,{onClick:d,children:v}),e[24]=d,e[25]=v,e[26]=w):w=e[26];let $;e[27]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(Z.Separator,{}),e[27]=$):$=e[27];let y,N;e[28]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsxs(Z.Item,{onClick:()=>i(!0),children:[n.jsx(ct,{className:"text-muted-foreground",size:18}),"Profile Settings"]}),N=n.jsx(Z.Separator,{}),e[28]=y,e[29]=N):(y=e[28],N=e[29]);let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(fs,{className:"w-4 h-4 text-muted-foreground"}),e[30]=C):C=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(Z.Item,{asChild:!0,children:n.jsxs("a",{href:"https://github.com/decocms/admin",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[C,"decocms/admin",n.jsx(jt,{size:18,className:"text-muted-foreground ml-auto"})]})}),e[31]=O):O=e[31];let _;e[32]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(Lt,{className:"text-muted-foreground",size:18}),e[32]=_):_=e[32];let M,k;e[33]===Symbol.for("react.memo_cache_sentinel")?(M=n.jsx(Z.Item,{asChild:!0,children:n.jsxs("a",{href:"https://decocms.com",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[_,"Homepage",n.jsx(jt,{size:18,className:"ml-auto text-muted-foreground"})]})}),k=n.jsx(Z.Separator,{}),e[33]=M,e[34]=k):(M=e[33],k=e[34]);let I;e[35]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsxs(Z.Item,{onClick:Sa,children:[n.jsx(Ht,{size:18,className:"text-muted-foreground"}),"Log out"]}),e[35]=I):I=e[35];let A;e[36]!==w||e[37]!==m||e[38]!==s?(A=n.jsxs(Z,{user:s,trigger:m,align:"end",children:[w,$,y,N,O,M,k,I]}),e[36]=w,e[37]=m,e[38]=s,e[39]=A):A=e[39];let R;e[40]!==o||e[41]!==s||e[42]!==a?(R=o&&n.jsx(ba,{open:o,onOpenChange:i,user:s,userImage:a}),e[40]=o,e[41]=s,e[42]=a,e[43]=R):R=e[43];let L;return e[44]!==A||e[45]!==R?(L=n.jsxs(n.Fragment,{children:[A,R]}),e[44]=A,e[45]=R,e[46]=L):L=e[46],L}function Sa(){return q.signOut()}function Na(){const t=h.c(7),{data:e}=q.useSession();if(!e?.user){let c;return t[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(ee,{url:void 0,fallback:"U",shape:"circle",size:"sm",className:"cursor-pointer h-7 w-7",muted:!0}),t[0]=c):c=t[0],c}const s=e.user,a=s.name??void 0;let o;t[1]!==a||t[2]!==s?(o={...s,name:a},t[1]=a,t[2]=s,t[3]=o):o=t[3];const i=o,l=s.image;let r;return t[4]!==l||t[5]!==i?(r=n.jsx(va,{user:i,userImage:l}),t[4]=l,t[5]=i,t[6]=r):r=t[6],r}function mt(){const t=h.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ve.decoChatOpen(),t[0]=e):e=t[0];const[s,a]=We(e,wa);let o;return t[1]!==s||t[2]!==a?(o=[s,a],t[1]=s,t[2]=a,t[3]=o):o=t[3],o}function wa(t){return!!(t??!1)}function ya(t){const e=h.c(6),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(us,{children:n.jsx(yt,{})}),e[0]=a):a=e[0];let o;e[1]!==s?(o=n.jsx(ps,{children:s}),e[1]=s,e[2]=o):o=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(hs,{children:n.jsx(xs,{to:"/login",replace:!0})}),e[3]=i):i=e[3];let l;return e[4]!==o?(l=n.jsxs(n.Fragment,{children:[a,o,i]}),e[4]=o,e[5]=l):l=e[5],l}function Ca(t){const e=h.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=T("fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function _a(t){const e=h.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=T("flex items-center justify-center px-2.5 h-full border-r border-border",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function ka(t){const e=h.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=T("flex items-center gap-2 px-2 h-full",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function Ia(t){const e=h.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=T("flex items-center gap-2 px-2 h-full flex-1",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function $a(t){const e=h.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=T("flex items-center gap-2 px-2 h-full ml-auto",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function za(){const t=h.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center justify-center px-2 h-full border-r border-border",children:n.jsx("div",{className:"w-8 h-8 bg-muted rounded-md animate-pulse"})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex items-center gap-2 px-2 h-full",children:n.jsx("div",{className:"w-32 h-6 bg-muted rounded-md animate-pulse"})}),t[1]=s):s=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",children:[e,s,n.jsx("div",{className:"flex items-center gap-2 px-2 h-full ml-auto",children:n.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"})})]}),t[2]=a):a=t[2],a}const Ue=Object.assign(Ca,{Sidebar:_a,Left:ka,Center:Ia,Right:$a,Skeleton:za});function Qt(){const t=h.c(3),{toggleSidebar:e}=dt();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Bt,{className:"text-muted-foreground/85 group-hover:text-foreground transition-colors",size:18}),t[0]=s):s=t[0];let a;return t[1]!==e?(a=n.jsx(n.Fragment,{children:n.jsx(J,{onClick:e,size:"icon",variant:"ghost",className:"w-7 h-7 rounded-md",children:s})}),t[1]=e,t[2]=a):a=t[2],a}Qt.Skeleton=function(){return n.jsx("div",{className:"w-7 h-7 bg-muted rounded-md animate-pulse"})};const Ma="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function Oa(){const t=h.c(147),{org:e,locator:s}=Fe(),{slug:a,id:o}=e,[,i]=mt(),l=ze(),{data:r}=q.useSession(),c=r?.user,{createThread:d,activeThreadId:m,setActiveThreadId:f,hideThread:p}=gt(),{threads:b,refetch:u}=Gs(),x=Fs(),g=Ws(),j=mn();let v;t[0]!==j?(v={connections:j,binding:"LLMS"},t[0]=j,t[1]=v):v=t[1];const[w]=fn(v),$=!!w;let y;t[2]!==s?(y=Ve.chatSelectedModel(s),t[2]=s,t[3]=y):y=t[3];const[N,C]=vs(y,g,Ta),[O,_]=We(`${s}:selected-gateway-id`,null);let M;t[4]!==x||t[5]!==O?(M=O?x.find(H=>H.id===O)??null:null,t[4]=x,t[5]=O,t[6]=M):M=t[6];const k=M,I=k?.id??null,A=Ss(I),R=Ns(),L=I??void 0;let B;t[7]!==m||t[8]!==A||t[9]!==R||t[10]!==L?(B={threadId:m,systemPrompt:A,onToolCall:R,gatewayId:L},t[7]=m,t[8]=A,t[9]=R,t[10]=L,t[11]=B):B=t[11];const z=ws(B),{inputValue:U,setInputValue:E,branchContext:F,clearBranch:D}=gt(),{isEmpty:V}=z,X=!I;let Oe;t[12]!==F||t[13]!==D||t[14]!==f||t[15]!==E?(Oe=()=>{F&&(f(F.originalThreadId),D(),E(""))},t[12]=F,t[13]=D,t[14]=f,t[15]=E,t[16]=Oe):Oe=t[16];const Ze=Oe;let Te;t[17]!==m||t[18]!==z||t[19]!==D||t[20]!==I||t[21]!==N||t[22]!==E||t[23]!==c?.image||t[24]!==c?.name?(Te=async H=>{if(!N){Y.error("No model configured");return}E(""),D();const Q={created_at:new Date().toISOString(),thread_id:m,model:{id:N.id,connectionId:N.connectionId,provider:N.provider??void 0,limits:N.limits??void 0},gateway:{id:I},user:{avatar:c?.image??void 0,name:c?.name??"you"}};await z.sendMessage(H,Q)},t[17]=m,t[18]=z,t[19]=D,t[20]=I,t[21]=N,t[22]=E,t[23]=c?.image,t[24]=c?.name,t[25]=Te):Te=t[25];const W=Te;let Ae;t[26]!==C?(Ae=H=>{C(H)},t[26]=C,t[27]=Ae):Ae=t[27];const Ye=Ae;let Re;t[28]!==_?(Re=H=>{_(H)},t[28]=_,t[29]=Re):Re=t[29];const te=Re,K=z.status==="submitted"||z.status==="streaming";if(!$){let H;t[30]===Symbol.for("react.memo_cache_sentinel")?(H=n.jsxs(P.Header.Left,{children:[n.jsx("img",{src:Ma,alt:"deco chat",className:"size-5 rounded"}),n.jsx("span",{className:"text-sm font-medium",children:"deco chat"})]}),t[30]=H):H=t[30];let Q;t[31]!==i?(Q=()=>i(!1),t[31]=i,t[32]=Q):Q=t[32];let Be;t[33]===Symbol.for("react.memo_cache_sentinel")?(Be=n.jsx($e,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[33]=Be):Be=t[33];let _e;t[34]!==Q?(_e=n.jsxs(P.Header,{children:[H,n.jsx(P.Header.Right,{children:n.jsx("button",{type:"button",onClick:Q,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:Be})})]}),t[34]=Q,t[35]=_e):_e=t[35];const nt=c?.id??"";let ke;t[36]!==l||t[37]!==a?(ke=()=>l({to:"/$org/mcps",params:{org:a},search:{action:"create"}}),t[36]=l,t[37]=a,t[38]=ke):ke=t[38];let Ie;t[39]!==j||t[40]!==o||t[41]!==a||t[42]!==nt||t[43]!==ke?(Ie=n.jsx(P.Main,{className:"flex flex-col items-center",children:n.jsx(P.EmptyState,{children:n.jsx(ys,{title:"No model provider connected",description:"Connect to a model provider to unlock AI-powered features.",orgSlug:a,orgId:o,userId:nt,allConnections:j,onInstallMcpServer:ke})})}),t[39]=j,t[40]=o,t[41]=a,t[42]=nt,t[43]=ke,t[44]=Ie):Ie=t[44];let He;return t[45]!==_e||t[46]!==Ie?(He=n.jsxs(P,{children:[_e,Ie]}),t[45]=_e,t[46]=Ie,t[47]=He):He=t[47],He}const qe=k?.icon??"/favicon.svg",Je=k?.title??"deco chat";let Ee;t[48]===Symbol.for("react.memo_cache_sentinel")?(Ee=n.jsx(ot,{size:12}),t[48]=Ee):Ee=t[48];let se;t[49]!==qe||t[50]!==Je?(se=n.jsx(xt,{icon:qe,name:Je,size:"xs",fallbackIcon:Ee}),t[49]=qe,t[50]=Je,t[51]=se):se=t[51];const Xe=k?.title||"deco chat";let ne;t[52]!==Xe?(ne=n.jsx("span",{className:"text-sm font-medium",children:Xe}),t[52]=Xe,t[53]=ne):ne=t[53];let ae;t[54]!==se||t[55]!==ne?(ae=n.jsxs(P.Header.Left,{children:[se,ne]}),t[54]=se,t[55]=ne,t[56]=ae):ae=t[56];let oe;t[57]!==d?(oe=()=>d(),t[57]=d,t[58]=oe):oe=t[58];let Pe;t[59]===Symbol.for("react.memo_cache_sentinel")?(Pe=n.jsx(dn,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[59]=Pe):Pe=t[59];let ie;t[60]!==oe?(ie=n.jsx("button",{type:"button",onClick:oe,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"New chat",children:Pe}),t[60]=oe,t[61]=ie):ie=t[61];let le;t[62]!==u?(le=()=>u(),t[62]=u,t[63]=le):le=t[63];let re;t[64]!==m||t[65]!==p||t[66]!==f||t[67]!==le||t[68]!==b?(re=n.jsx(Cs,{threads:b,activeThreadId:m,onSelectThread:f,onRemoveThread:p,onOpen:le}),t[64]=m,t[65]=p,t[66]=f,t[67]=le,t[68]=b,t[69]=re):re=t[69];let ce;t[70]!==i?(ce=()=>i(!1),t[70]=i,t[71]=ce):ce=t[71];let De;t[72]===Symbol.for("react.memo_cache_sentinel")?(De=n.jsx($e,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[72]=De):De=t[72];let de;t[73]!==ce?(de=n.jsx("button",{type:"button",onClick:ce,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:De}),t[73]=ce,t[74]=de):de=t[74];let me;t[75]!==ie||t[76]!==re||t[77]!==de?(me=n.jsxs(P.Header.Right,{children:[ie,re,de]}),t[75]=ie,t[76]=re,t[77]=de,t[78]=me):me=t[78];let fe;t[79]!==ae||t[80]!==me?(fe=n.jsxs(P.Header,{children:[ae,me]}),t[79]=ae,t[80]=me,t[81]=fe):fe=t[81];let ue;t[82]!==z.messages||t[83]!==z.status||t[84]!==W||t[85]!==V||t[86]!==k?.description||t[87]!==k?.icon||t[88]!==k?.title||t[89]!==I?(ue=n.jsx(P.Main,{children:V?n.jsx(P.EmptyState,{children:n.jsxs("div",{className:"flex flex-col items-center gap-6 w-full px-4",children:[n.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-0 text-center",children:[n.jsx(xt,{icon:k?.icon??"/favicon.svg",name:k?.title||"deco chat",size:"lg",fallbackIcon:n.jsx(ot,{size:32}),className:"size-[60px]! rounded-[18px]!"}),n.jsx("h3",{className:"text-xl font-medium text-foreground",children:k?.title||"Ask deco chat"}),n.jsx("div",{className:"text-muted-foreground text-center text-sm max-w-md",children:k?.description??"Ask anything about configuring model providers or using MCP Mesh."})]}),n.jsx(at.Container,{children:I&&n.jsx(lt,{fallback:null,children:n.jsx(S.Suspense,{fallback:n.jsx(at.Fallback,{}),children:n.jsx(at,{gatewayId:I,onSelect:H=>{W(H.description??H.name)}})})},I)})]})}):n.jsx(P.Messages,{messages:z.messages,status:z.status,minHeightOffset:280})}),t[82]=z.messages,t[83]=z.status,t[84]=W,t[85]=V,t[86]=k?.description,t[87]=k?.icon,t[88]=k?.title,t[89]=I,t[90]=ue):ue=t[90];let pe;t[91]!==z.error||t[92]!==W?(pe=()=>{z.error&&W(`I encountered this error: ${z.error.message}. Can you help me fix it?`)},t[91]=z.error,t[92]=W,t[93]=pe):pe=t[93];let he;t[94]!==z.clearError||t[95]!==z.error||t[96]!==pe?(he=n.jsx(P.ErrorBanner,{error:z.error,onFixInChat:pe,onDismiss:z.clearError}),t[94]=z.clearError,t[95]=z.error,t[96]=pe,t[97]=he):he=t[97];let xe;t[98]!==W?(xe=()=>{W("Please continue.")},t[98]=W,t[99]=xe):xe=t[99];let ge;t[100]!==z.clearFinishReason||t[101]!==z.finishReason||t[102]!==xe?(ge=n.jsx(P.FinishReasonWarning,{finishReason:z.finishReason,onContinue:xe,onDismiss:z.clearFinishReason}),t[100]=z.clearFinishReason,t[101]=z.finishReason,t[102]=xe,t[103]=ge):ge=t[103];let be;t[104]!==F||t[105]!==D||t[106]!==Ze||t[107]!==E?(be=n.jsx(P.BranchPreview,{branchContext:F,clearBranchContext:D,onGoToOriginalMessage:Ze,setInputValue:E}),t[104]=F,t[105]=D,t[106]=Ze,t[107]=E,t[108]=be):be=t[108];const Qe=k??void 0;let je;t[109]!==W||t[110]!==U?(je=async()=>{U.trim()&&await W(U.trim())},t[109]=W,t[110]=U,t[111]=je):je=t[111];const et=!N,tt=N?"Ask anything or @ for context":"Select a model to start chatting";let ve;t[112]!==te||t[113]!==K||t[114]!==I||t[115]!==X?(ve=X&&n.jsx(Ks,{selectedGatewayId:I,onGatewayChange:te,placeholder:"Agent",disabled:K}),t[112]=te,t[113]=K,t[114]=I,t[115]=X,t[116]=ve):ve=t[116];const st=N??void 0;let Se;t[117]!==Ye||t[118]!==st?(Se=n.jsx(Zs,{selectedModel:st,onModelChange:Ye,placeholder:"Model",variant:"borderless"}),t[117]=Ye,t[118]=st,t[119]=Se):Se=t[119];let Ne;t[120]!==z.messages?(Ne=n.jsx(Vs,{messages:z.messages}),t[120]=z.messages,t[121]=Ne):Ne=t[121];let we;t[122]!==z.stop||t[123]!==U||t[124]!==K||t[125]!==E||t[126]!==je||t[127]!==et||t[128]!==tt||t[129]!==ve||t[130]!==Se||t[131]!==Ne?(we=n.jsxs(P.Input,{value:U,onChange:E,onSubmit:je,onStop:z.stop,disabled:et,isStreaming:K,placeholder:tt,children:[ve,Se,Ne]}),t[122]=z.stop,t[123]=U,t[124]=K,t[125]=E,t[126]=je,t[127]=et,t[128]=tt,t[129]=ve,t[130]=Se,t[131]=Ne,t[132]=we):we=t[132];let ye;t[133]!==te||t[134]!==K||t[135]!==Qe||t[136]!==we?(ye=n.jsx(_s,{gateway:Qe,onGatewayChange:te,disabled:K,children:we}),t[133]=te,t[134]=K,t[135]=Qe,t[136]=we,t[137]=ye):ye=t[137];let Ce;t[138]!==he||t[139]!==ge||t[140]!==be||t[141]!==ye?(Ce=n.jsx(P.Footer,{children:n.jsxs("div",{className:"flex flex-col gap-2",children:[he,ge,be,ye]})}),t[138]=he,t[139]=ge,t[140]=be,t[141]=ye,t[142]=Ce):Ce=t[142];let Le;return t[143]!==fe||t[144]!==ue||t[145]!==Ce?(Le=n.jsxs(P,{children:[fe,ue,Ce]}),t[143]=fe,t[144]=ue,t[145]=Ce,t[146]=Le):Le=t[146],Le}function Ta(t,e){return t.id===e.id&&t.connectionId===e.connectionId}function Aa(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(P.Provider,{children:n.jsx(Oa,{})}),t[0]=e):e=t[0],e}const Ra="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function St({showSidebarToggle:t=!1,showOrgSwitcher:e=!1,showDecoChat:s=!1,disableDecoChat:a=!1}){const[o,i]=mt(),l=S.useRef(a);a&&o&&l.current!==a&&i(!1),l.current=a;const r=()=>{a||i(c=>!c)};return n.jsxs(Ue,{children:[t&&n.jsx(Ue.Sidebar,{children:n.jsx(Qt,{})}),n.jsx(Ue.Left,{children:e&&n.jsx(S.Suspense,{fallback:n.jsx(it.Skeleton,{}),children:n.jsx(it,{})})}),n.jsxs(Ue.Right,{className:"gap-2",children:[n.jsx(pn,{}),s&&!a&&n.jsxs(J,{size:"sm",variant:"default",onClick:r,className:"h-7",children:[n.jsx(ee,{url:Ra,fallback:"DC",size:"2xs",className:"rounded-sm"}),"deco chat"]}),n.jsx(Na,{})]})]})}function Ea(t){const e=h.c(10),{children:s,className:a}=t,[,o]=S.useTransition();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Ve.decoChatPanelWidth(),e[0]=i):i=e[0];const[l,r]=We(i,30);let c;e[1]!==r?(c=p=>o(()=>r(p)),e[1]=r,e[2]=c):c=e[2];const d=c;let m;e[3]!==a?(m=T("min-w-0",a),e[3]=a,e[4]=m):m=e[4];let f;return e[5]!==l||e[6]!==s||e[7]!==d||e[8]!==m?(f=n.jsx(Rt,{defaultSize:l,minSize:20,className:m,onResize:d,children:s}),e[5]=l,e[6]=s,e[7]=d,e[8]=m,e[9]=f):f=e[9],f}function Pa(t){const e=h.c(5),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=Ve.sidebarOpen(),e[0]=a):a=e[0];const[o,i]=We(a,!0);let l;return e[1]!==s||e[2]!==i||e[3]!==o?(l=n.jsx(In,{open:o,onOpenChange:i,children:s}),e[1]=s,e[2]=i,e[3]=o,e[4]=l):l=e[4],l}function Da(t){const e=h.c(10),{disableChat:s}=t,a=s===void 0?!1:s,[o]=mt(),i=o&&!a;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Rt,{className:"bg-background",children:n.jsx(Ct,{})}),e[0]=l):l=e[0];let r;e[1]!==a||e[2]!==i?(r=!a&&n.jsx(rn,{withHandle:i}),e[1]=a,e[2]=i,e[3]=r):r=e[3];const c=i?"max-w-none":"max-w-0";let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(lt,{children:n.jsx(S.Suspense,{fallback:n.jsx(ks,{}),children:n.jsx(Aa,{})})}),e[4]=d):d=e[4];let m;e[5]!==c?(m=n.jsx(Ea,{className:c,children:d}),e[5]=c,e[6]=m):m=e[6];let f;return e[7]!==r||e[8]!==m?(f=n.jsxs(cn,{direction:"horizontal",children:[l,r,m]}),e[7]=r,e[8]=m,e[9]=f):f=e[9],f}function La(){const t=h.c(22);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=wt(e),a=Nt(),o=a.location.pathname===`/${s}`||a.location.pathname===`/${s}/`;let i;t[1]!==s?(i=bs.activeOrganization(s),t[1]=s,t[2]=i):i=t[2];let l;t[3]!==s?(l=async()=>{if(!s)return null;const{data:x}=await q.organization.setActive({organizationSlug:s});return{org:x,project:{slug:zs}}},t[3]=s,t[4]=l):l=t[4];let r;t[5]!==i||t[6]!==l?(r={queryKey:i,queryFn:l,gcTime:1/0,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1},t[5]=i,t[6]=l,t[7]=r):r=t[7];const{data:c}=gs(r);if(!c){let x;t[8]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(St,{}),t[8]=x):x=t[8];let g;return t[9]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsxs("div",{className:"min-h-screen bg-background",children:[x,n.jsx("div",{className:"pt-12",children:n.jsx(Ct,{})})]}),t[9]=g):g=t[9],g}let d;t[10]!==o?(d=n.jsx(St,{showSidebarToggle:!0,showOrgSwitcher:!0,showDecoChat:!0,disableDecoChat:o}),t[10]=o,t[11]=d):d=t[11];let m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m={"--sidebar-width":"13rem","--sidebar-width-mobile":"11rem"},t[12]=m):m=t[12];let f;t[13]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Vn,{}),t[13]=f):f=t[13];let p;t[14]!==o?(p=n.jsxs(Mn,{className:"flex-1 bg-sidebar",style:m,children:[f,n.jsx(Tn,{className:"pt-12",children:n.jsx(Da,{disableChat:o})})]}),t[14]=o,t[15]=p):p=t[15];let b;t[16]!==d||t[17]!==p?(b=n.jsx(Pa,{children:n.jsxs("div",{className:"flex flex-col h-screen",children:[d,p]})}),t[16]=d,t[17]=p,t[18]=b):b=t[18];let u;return t[19]!==c||t[20]!==b?(u=n.jsx($s,{...c,children:b}),t[19]=c,t[20]=b,t[21]=u):u=t[21],u}function Vo(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(ya,{children:n.jsx(S.Suspense,{fallback:n.jsx(yt,{}),children:n.jsx(La,{})})}),t[0]=e):e=t[0],e}export{Vo as default};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{r as B,c as z,j as p,v as da,d as Ot,K as Mt,t as ze,F as pa,H as ma,I as fa,J as W,x as g,_ as Me,L as Pt,M as ha,Q as ga,U as va,V as q,W as Ee,X as Te,w as O,Y as _,Z as oe,$ as ya,a0 as M,a1 as ba,a2 as xa,f as kt,q as _a}from"./index-Dk3lubBQ.js";import{c as J,B as Pe}from"./button-2azNqzUx.js";import{u as He}from"./project-context-provider-B1gr9e2f.js";import{l as wa,m as Ea,n as Ia,o as Na,h as Sa,p as Ta}from"./index-C5xxIZ3a.js";import{u as Ca}from"./localstorage-keys-BJk6gyyN.js";import{u as Ra}from"./use-gateway-system-prompt-C9-1moLN.js";import{I as ja,E as Aa}from"./empty-state-C3NzxCFI.js";import{b as Qe,a as Xe,P as Ke}from"./popover-HE15ABOl.js";import{t as Oa}from"./ChevronDown-OK90XtVB.js";import{i as Ma}from"./use-gateway-Ck94EUZ3.js";import{i as Pa}from"./Edit01-Ddbn6DsS.js";import{c as et,b as tt,T as at,a as Dt}from"./tooltip-DHS6wGWv.js";import{a as ka}from"./use-connection-BhdfednN.js";import{O as Da,a as $a,g as Za}from"./well-known-mcp-D13f-8h2.js";import{g as La}from"./generate-id-Dyweu44Y.js";import{s as it}from"./Clock-CRgmR_1n.js";import{i as Ua}from"./SearchMd-DRJ07Awx.js";import{s as Ba}from"./Trash01-BDWyzvD2.js";var Ie;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const n={};for(const i of r)n[i]=i;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of n)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},t.find=(r,n)=>{for(const i of r)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Ie||(Ie={}));var lt;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(lt||(lt={}));Ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ie.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ke extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(n){return n.message},s={_errors:[]},r=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(a(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(a(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof ke))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),s=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];a[n]=a[n]||[],a[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}ke.create=t=>new ke(t);var ct;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ct||(ct={}));var E;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(E||(E={}));const $t=({size:t=24,color:e="currentColor",...a})=>B.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},B.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));$t.displayName="XCircle";function ut(t){const e=z.c(8);let a,s;e[0]!==t?({className:a,...s}=t,e[0]=t,e[1]=a,e[2]=s):(a=e[1],s=e[2]);let r;e[3]!==a?(r=J("bg-accent animate-pulse rounded-md",a),e[3]=a,e[4]=r):r=e[4];let n;return e[5]!==s||e[6]!==r?(n=p.jsx("div",{"data-slot":"skeleton",className:r,...s}),e[5]=s,e[6]=r,e[7]=n):n=e[7],n}function cn(){const t=z.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),t[0]=e):e=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsxs("div",{className:"flex items-center gap-3",children:[e,p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),p.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),t[1]=a):a=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:p.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,p.jsxs("div",{className:"flex items-end gap-2",children:[p.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),p.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:p.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[p.jsx(je,{align:"right",width:"w-3/4"}),p.jsx(je,{align:"left",width:"w-full",lines:3}),p.jsx(je,{align:"right",width:"w-2/3"}),p.jsx(je,{align:"left",width:"w-5/6",lines:2})]})}),t[3]=r):r=t[3];let n;t[4]===Symbol.for("react.memo_cache_sentinel")?(n=p.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:p.jsx("div",{className:"relative flex-1",children:p.jsxs("div",{className:"space-y-2 p-2",children:[p.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),p.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),t[4]=n):n=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx("div",{className:"flex items-center gap-1",children:p.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),t[5]=i):i=t[5];let o;return t[6]===Symbol.for("react.memo_cache_sentinel")?(o=p.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[s,r,p.jsx("div",{className:"px-4 py-4",children:p.jsx("div",{className:"mx-auto w-full max-w-2xl",children:p.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[n,p.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[i,p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),p.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=o):o=t[6],o}function je(t){const e=z.c(22),{align:a,width:s,lines:r}=t,n=s===void 0?"w-full":s,i=r===void 0?1:r,o=a==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==o?(c=J("flex w-full gap-4 px-4 py-2",o),e[0]=o,e[1]=c):c=e[1];const l=a==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let d;e[2]!==l?(d=J("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=d):d=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=p.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=m):m=e[4];const h=a==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==h||e[6]!==n?(f=J("min-w-0 rounded-2xl p-4",h,n),e[5]=h,e[6]=n,e[7]=f):f=e[7];let v;e[8]!==i?(v=Array.from({length:i}),e[8]=i,e[9]=v):v=e[9];let b;e[10]!==i||e[11]!==v?(b=p.jsx("div",{className:"space-y-2",children:v.map((u,T)=>p.jsx("div",{className:J("h-3 rounded bg-muted-foreground/20 animate-pulse",T===i-1?"w-3/4":"w-full"),style:{animationDelay:`${T*.1}s`}},T))}),e[10]=i,e[11]=v,e[12]=b):b=e[12];let y;e[13]!==b||e[14]!==f?(y=p.jsx("div",{className:f,children:b}),e[13]=b,e[14]=f,e[15]=y):y=e[15];let x;e[16]!==y||e[17]!==d?(x=p.jsxs("div",{className:d,children:[m,y]}),e[16]=y,e[17]=d,e[18]=x):x=e[18];let N;return e[19]!==x||e[20]!==c?(N=p.jsx("div",{className:c,children:x}),e[19]=x,e[20]=c,e[21]=N):N=e[21],N}function un(){const t=z.c(5),e=da(),{org:a}=He();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=Ot(s);let n;return t[1]!==a||t[2]!==r||t[3]!==e?(n=i=>{const c=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!c||!c[1])return;const l=c[1],d=r.connectionId;if(!d)return;e.invalidateQueries({queryKey:Mt.collection(a.slug,d,l)});const m=l.toLowerCase().replace(/_/g," ");ze.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=n):n=t[4],n}var Zt="vercel.ai.error",za=Symbol.for(Zt),dt,pt,ue=class Lt extends(pt=Error,dt=za,pt){constructor({name:e,message:a,cause:s}){super(a),this[dt]=!0,this.name=e,this.cause=s}static isInstance(e){return Lt.hasMarker(e,Zt)}static hasMarker(e,a){const s=Symbol.for(a);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};function Ut(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Bt="AI_InvalidArgumentError",zt=`vercel.ai.error.${Bt}`,Fa=Symbol.for(zt),mt,ft,Va=class extends(ft=ue,mt=Fa,ft){constructor({message:t,cause:e,argument:a}){super({name:Bt,message:t,cause:e}),this[mt]=!0,this.argument=a}static isInstance(t){return ue.hasMarker(t,zt)}},Ft="AI_JSONParseError",Vt=`vercel.ai.error.${Ft}`,qa=Symbol.for(Vt),ht,gt,vt=class extends(gt=ue,ht=qa,gt){constructor({text:t,cause:e}){super({name:Ft,message:`JSON parsing failed: Text: ${t}.
|
|
2
|
-
Error message: ${Ut(e)}`,cause:e}),this[ht]=!0,this.text=t}static isInstance(t){return ue.hasMarker(t,Vt)}},qt="AI_TypeValidationError",Jt=`vercel.ai.error.${qt}`,Ja=Symbol.for(Jt),yt,bt,be=class Fe extends(bt=ue,yt=Ja,bt){constructor({value:e,cause:a}){super({name:qt,message:`Type validation failed: Value: ${JSON.stringify(e)}.
|
|
3
|
-
Error message: ${Ut(a)}`,cause:a}),this[yt]=!0,this.value=e}static isInstance(e){return ue.hasMarker(e,Jt)}static wrap({value:e,cause:a}){return Fe.isInstance(a)&&a.value===e?a:new Fe({value:e,cause:a})}},Ce=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const n=a.length,i=new Array(e);for(let o=0;o<e;o++)i[o]=a[Math.random()*n|0];return i.join("")};if(t==null)return r;if(a.includes(s))throw new Va({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Wa=Ce();function xt(t=globalThis){var e,a,s;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(s=(a=t.process)==null?void 0:a.versions)!=null&&s.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function pe(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((a,s)=>{e[s.toLowerCase()]=a});else{Array.isArray(t)||(t=Object.entries(t));for(const[a,s]of t)s!=null&&(e[a.toLowerCase()]=s)}return e}function _t(t,...e){const a=new Headers(pe(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var Ga=/"__proto__"\s*:/,Ya=/"constructor"\s*:/;function wt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Ga.test(t)===!1&&Ya.test(t)===!1?e:Ha(e)}function Ha(t){let e=[t];for(;e.length;){const a=e;e=[];for(const s of a){if(Object.prototype.hasOwnProperty.call(s,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in s){const n=s[r];n&&typeof n=="object"&&e.push(n)}}}return t}function Qa(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return wt(t)}try{return wt(t)}finally{Error.stackTraceLimit=e}}function st(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const s of Object.keys(a))a[s]=de(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(de):de(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(de)),t.allOf!=null&&(t.allOf=t.allOf.map(de)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(de));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=de(e[a]);return t}function de(t){return typeof t=="boolean"?t:st(t)}var Xa=Symbol("Let zodToJsonSchema decide on which parser to use"),Et={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Ka=t=>typeof t=="string"?{...Et,name:t}:{...Et,...t};function Y(){return{}}function es(t,e){var a,s,r;const n={type:"array"};return(a=t.type)!=null&&a._def&&((r=(s=t.type)==null?void 0:s._def)==null?void 0:r.typeName)!==E.ZodAny&&(n.items=A(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(n.minItems=t.minLength.value),t.maxLength&&(n.maxItems=t.maxLength.value),t.exactLength&&(n.minItems=t.exactLength.value,n.maxItems=t.exactLength.value),n}function ts(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function as(){return{type:"boolean"}}function Wt(t,e){return A(t.type._def,e)}var ss=(t,e)=>A(t.innerType._def,e);function Gt(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Gt(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return rs(t)}}var rs=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function ns(t,e){return{...A(t.innerType._def,e),default:t.defaultValue()}}function os(t,e){return e.effectStrategy==="input"?A(t.schema._def,e):Y()}function is(t){return{type:"string",enum:Array.from(t.values)}}var ls=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function cs(t,e){const a=[A(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),A(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(ls(r))s.push(...r.allOf);else{let n=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...o}=r;n=o}s.push(n)}}),s.length?{allOf:s}:void 0}function us(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Le=void 0,K={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Le===void 0&&(Le=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Le),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Yt(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"email":switch(e.emailStrategy){case"format:email":ee(a,"email",s.message,e);break;case"format:idn-email":ee(a,"idn-email",s.message,e);break;case"pattern:zod":V(a,K.email,s.message,e);break}break;case"url":ee(a,"uri",s.message,e);break;case"uuid":ee(a,"uuid",s.message,e);break;case"regex":V(a,s.regex,s.message,e);break;case"cuid":V(a,K.cuid,s.message,e);break;case"cuid2":V(a,K.cuid2,s.message,e);break;case"startsWith":V(a,RegExp(`^${Ue(s.value,e)}`),s.message,e);break;case"endsWith":V(a,RegExp(`${Ue(s.value,e)}$`),s.message,e);break;case"datetime":ee(a,"date-time",s.message,e);break;case"date":ee(a,"date",s.message,e);break;case"time":ee(a,"time",s.message,e);break;case"duration":ee(a,"duration",s.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"includes":{V(a,RegExp(Ue(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&ee(a,"ipv4",s.message,e),s.version!=="v4"&&ee(a,"ipv6",s.message,e);break}case"base64url":V(a,K.base64url,s.message,e);break;case"jwt":V(a,K.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&V(a,K.ipv4Cidr,s.message,e),s.version!=="v4"&&V(a,K.ipv6Cidr,s.message,e);break}case"emoji":V(a,K.emoji(),s.message,e);break;case"ulid":{V(a,K.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ee(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{V(a,K.base64,s.message,e);break}}break}case"nanoid":V(a,K.nanoid,s.message,e)}return a}function Ue(t,e){return e.patternStrategy==="escape"?ps(t):t}var ds=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ps(t){let e="";for(let a=0;a<t.length;a++)ds.has(t[a])||(e+="\\"),e+=t[a];return e}function ee(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function V(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:It(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=It(e,s)}function It(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const s={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=s.i?t.source.toLowerCase():t.source;let n="",i=!1,o=!1,c=!1;for(let l=0;l<r.length;l++){if(i){n+=r[l],i=!1;continue}if(s.i){if(o){if(r[l].match(/[a-z]/)){c?(n+=r[l],n+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((a=r[l+2])!=null&&a.match(/[a-z]/))?(n+=r[l],c=!0):n+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){n+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(s.m){if(r[l]==="^"){n+=`(^|(?<=[\r
|
|
4
|
-
]))`;continue}else if(r[l]==="$"){n+=`($|(?=[\r
|
|
5
|
-
]))`;continue}}if(s.s&&r[l]==="."){n+=o?`${r[l]}\r
|
|
6
|
-
`:`[${r[l]}\r
|
|
7
|
-
]`;continue}n+=r[l],r[l]==="\\"?i=!0:o&&r[l]==="]"?o=!1:!o&&r[l]==="["&&(o=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function Ht(t,e){var a,s,r,n,i,o;const c={type:"object",additionalProperties:(a=A(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((s=t.keyType)==null?void 0:s._def.typeName)===E.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...d}=Yt(t.keyType._def,e);return{...c,propertyNames:d}}else{if(((n=t.keyType)==null?void 0:n._def.typeName)===E.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===E.ZodBranded&&t.keyType._def.type._def.typeName===E.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:l,...d}=Wt(t.keyType._def,e);return{...c,propertyNames:d}}}return c}function ms(t,e){if(e.mapStrategy==="record")return Ht(t,e);const a=A(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Y(),s=A(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Y();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function fs(t){const e=t.values,s=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function hs(){return{not:Y()}}function gs(){return{type:"null"}}var Ve={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function vs(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in Ve&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=Ve[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(a.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=a.reduce((r,n)=>{const i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];default:return r}},[]);if(s.length===a.length){const r=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:a.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(a.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return ys(t,e)}var ys=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>A(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return a.length?{anyOf:a}:void 0};function bs(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[Ve[t.innerType._def.typeName],"null"]};const a=A(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function xs(t){const e={type:"number"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"int":e.type="integer";break;case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function _s(t,e){const a={type:"object",properties:{}},s=[],r=t.shape();for(const i in r){let o=r[i];if(o===void 0||o._def===void 0)continue;const c=Es(o),l=A(o._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});l!==void 0&&(a.properties[i]=l,c||s.push(i))}s.length&&(a.required=s);const n=ws(t,e);return n!==void 0&&(a.additionalProperties=n),a}function ws(t,e){if(t.catchall._def.typeName!=="ZodNever")return A(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Es(t){try{return t.isOptional()}catch{return!0}}var Is=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return A(t.innerType._def,e);const s=A(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:Y()},s]}:Y()},Ns=(t,e)=>{if(e.pipeStrategy==="input")return A(t.in._def,e);if(e.pipeStrategy==="output")return A(t.out._def,e);const a=A(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=A(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Ss(t,e){return A(t.type._def,e)}function Ts(t,e){const s={type:"array",uniqueItems:!0,items:A(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(s.minItems=t.minSize.value),t.maxSize&&(s.maxItems=t.maxSize.value),s}function Cs(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>A(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:A(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>A(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Rs(){return{not:Y()}}function js(){return Y()}var As=(t,e)=>A(t.innerType._def,e),Os=(t,e,a)=>{switch(e){case E.ZodString:return Yt(t,a);case E.ZodNumber:return xs(t);case E.ZodObject:return _s(t,a);case E.ZodBigInt:return ts(t);case E.ZodBoolean:return as();case E.ZodDate:return Gt(t,a);case E.ZodUndefined:return Rs();case E.ZodNull:return gs();case E.ZodArray:return es(t,a);case E.ZodUnion:case E.ZodDiscriminatedUnion:return vs(t,a);case E.ZodIntersection:return cs(t,a);case E.ZodTuple:return Cs(t,a);case E.ZodRecord:return Ht(t,a);case E.ZodLiteral:return us(t);case E.ZodEnum:return is(t);case E.ZodNativeEnum:return fs(t);case E.ZodNullable:return bs(t,a);case E.ZodOptional:return Is(t,a);case E.ZodMap:return ms(t,a);case E.ZodSet:return Ts(t,a);case E.ZodLazy:return()=>t.getter()._def;case E.ZodPromise:return Ss(t,a);case E.ZodNaN:case E.ZodNever:return hs();case E.ZodEffects:return os(t,a);case E.ZodAny:return Y();case E.ZodUnknown:return js();case E.ZodDefault:return ns(t,a);case E.ZodBranded:return Wt(t,a);case E.ZodReadonly:return As(t,a);case E.ZodCatch:return ss(t,a);case E.ZodPipeline:return Ns(t,a);case E.ZodFunction:case E.ZodVoid:case E.ZodSymbol:return;default:return(s=>{})()}},Ms=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function A(t,e,a=!1){var s;const r=e.seen.get(t);if(e.override){const c=(s=e.override)==null?void 0:s.call(e,t,e,r,a);if(c!==Xa)return c}if(r&&!a){const c=Ps(r,e);if(c!==void 0)return c}const n={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,n);const i=Os(t,t.typeName,e),o=typeof i=="function"?A(i(),e):i;if(o&&ks(t,e,o),e.postProcess){const c=e.postProcess(o,t,e);return n.jsonSchema=o,c}return n.jsonSchema=o,o}var Ps=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Ms(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,s)=>e.currentPath[s]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Y()):e.$refStrategy==="seen"?Y():void 0}},ks=(t,e,a)=>(t.description&&(a.description=t.description),a),Ds=t=>{const e=Ka(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}},$s=(t,e)=>{var a;const s=Ds(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,m])=>{var h;return{...l,[d]:(h=A(m._def,{...s,currentPath:[...s.basePath,s.definitionPath,d]},!0))!=null?h:Y()}},{}):void 0;const n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=A(t._def,n===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,n]},!1))!=null?a:Y(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(i.title=o);const c=n===void 0?r?{...i,[s.definitionPath]:r}:i:{$ref:[...s.$refStrategy==="relative"?[]:s.basePath,s.definitionPath,n].join("/"),[s.definitionPath]:{...r,[n]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},qe=Symbol.for("vercel.ai.schema");function Zs(t){let e;return()=>(e==null&&(e=t()),e)}function De(t,{validate:e}={}){return{[qe]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Ls(t){return typeof t=="object"&&t!==null&&qe in t&&t[qe]===!0&&"jsonSchema"in t&&"validate"in t}function rt(t){return t==null?De({properties:{},additionalProperties:!1}):Ls(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Qt(t):Us(t):t()}function Us(t){return De(()=>st(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const a=await t["~standard"].validate(e);return"value"in a?{success:!0,value:a.value}:{success:!1,error:new be({value:e,cause:a.issues})}}})}function Bs(t,e){var a;const s=(a=void 0)!=null?a:!1;return De(()=>$s(t,{$refStrategy:s?"root":"none"}),{validate:async r=>{const n=await t.safeParseAsync(r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function zs(t,e){var a;const s=(a=void 0)!=null?a:!1;return De(()=>st(fa(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const n=await ma(t,r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Fs(t){return"_zod"in t}function Qt(t,e){return Fs(t)?zs(t):Bs(t)}async function Nt({value:t,schema:e}){const a=await Ne({value:t,schema:e});if(!a.success)throw be.wrap({value:t,cause:a.error});return a.value}async function Ne({value:t,schema:e}){const a=rt(e);try{if(a.validate==null)return{success:!0,value:t,rawValue:t};const s=await a.validate(t);return s.success?{success:!0,value:s.value,rawValue:t}:{success:!1,error:be.wrap({value:t,cause:s.error}),rawValue:t}}catch(s){return{success:!1,error:be.wrap({value:t,cause:s}),rawValue:t}}}async function me({text:t,schema:e}){try{const a=Qa(t);return e==null?{success:!0,value:a,rawValue:a}:await Ne({value:a,schema:e})}catch(a){return{success:!1,error:vt.isInstance(a)?a:new vt({text:t,cause:a}),rawValue:void 0}}}function Vs({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new pa).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await me({text:a,schema:e}))}}))}async function le(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var qs=Object.defineProperty,Js=(t,e)=>{for(var a in e)qs(t,a,{get:e[a],enumerable:!0})},Xt="AI_NoObjectGeneratedError",Kt=`vercel.ai.error.${Xt}`,Ws=Symbol.for(Kt),ea,ce=class extends ue{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:n}){super({name:Xt,message:t,cause:e}),this[ea]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=n}static isInstance(t){return ue.hasMarker(t,Kt)}};ea=Ws;var St="6.0.33",ta=W([g(),Me(Uint8Array),Me(ArrayBuffer),Pt(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Se=ha(()=>W([ga(),g(),va(),q(),Ee(g(),Se.optional()),Te(Se)])),R=Ee(g(),Ee(g(),Se.optional())),aa=O({type:_("text"),text:g(),providerOptions:R.optional()}),Gs=O({type:_("image"),image:W([ta,Me(URL)]),mediaType:g().optional(),providerOptions:R.optional()}),sa=O({type:_("file"),data:W([ta,Me(URL)]),filename:g().optional(),mediaType:g(),providerOptions:R.optional()}),Ys=O({type:_("reasoning"),text:g(),providerOptions:R.optional()}),Hs=O({type:_("tool-call"),toolCallId:g(),toolName:g(),input:oe(),providerOptions:R.optional(),providerExecuted:q().optional()}),Qs=ya("type",[O({type:_("text"),value:g(),providerOptions:R.optional()}),O({type:_("json"),value:Se,providerOptions:R.optional()}),O({type:_("execution-denied"),reason:g().optional(),providerOptions:R.optional()}),O({type:_("error-text"),value:g(),providerOptions:R.optional()}),O({type:_("error-json"),value:Se,providerOptions:R.optional()}),O({type:_("content"),value:Te(W([O({type:_("text"),text:g(),providerOptions:R.optional()}),O({type:_("media"),data:g(),mediaType:g()}),O({type:_("file-data"),data:g(),mediaType:g(),filename:g().optional(),providerOptions:R.optional()}),O({type:_("file-url"),url:g(),providerOptions:R.optional()}),O({type:_("file-id"),fileId:W([g(),Ee(g(),g())]),providerOptions:R.optional()}),O({type:_("image-data"),data:g(),mediaType:g(),providerOptions:R.optional()}),O({type:_("image-url"),url:g(),providerOptions:R.optional()}),O({type:_("image-file-id"),fileId:W([g(),Ee(g(),g())]),providerOptions:R.optional()}),O({type:_("custom"),providerOptions:R.optional()})]))})]),ra=O({type:_("tool-result"),toolCallId:g(),toolName:g(),output:Qs,providerOptions:R.optional()}),Xs=O({type:_("tool-approval-request"),approvalId:g(),toolCallId:g()}),Ks=O({type:_("tool-approval-response"),approvalId:g(),approved:q(),reason:g().optional()}),er=O({role:_("system"),content:g(),providerOptions:R.optional()}),tr=O({role:_("user"),content:W([g(),Te(W([aa,Gs,sa]))]),providerOptions:R.optional()}),ar=O({role:_("assistant"),content:W([g(),Te(W([aa,sa,Ys,Hs,ra,Xs]))]),providerOptions:R.optional()}),sr=O({role:_("tool"),content:Te(W([ra,Ks])),providerOptions:R.optional()});W([er,tr,ar,sr]);function na(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const a={...t};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const r=e[s];if(r===void 0)continue;const n=s in t?t[s]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),o=n!=null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp);i&&o?a[s]=na(n,r):a[s]=r}return a}var rr={};Js(rr,{array:()=>lr,choice:()=>cr,json:()=>ur,object:()=>ir,text:()=>or});function nr(t){const e=["ROOT"];let a=-1,s=null;function r(c,l,d){switch(c){case'"':{a=l,e.pop(),e.push(d),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=l,s=l,e.pop(),e.push(d),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=l,e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"{":{a=l,e.pop(),e.push(d),e.push("INSIDE_OBJECT_START");break}case"[":{a=l,e.pop(),e.push(d),e.push("INSIDE_ARRAY_START");break}}}function n(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{a=l,e.pop();break}}}function i(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=l,e.pop();break}}}for(let c=0;c<t.length;c++){const l=t[c];switch(e[e.length-1]){case"ROOT":r(l,c,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{a=c,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{r(l,c,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{n(l,c);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),a=c;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:a=c}break}case"INSIDE_ARRAY_START":{l==="]"?(a=c,e.pop()):(a=c,r(l,c,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=c,e.pop();break}default:{a=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),a=c;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=c;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const m=t.substring(s,c+1);!"false".startsWith(m)&&!"true".startsWith(m)&&!"null".startsWith(m)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?n(l,c):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c)):a=c;break}}}let o=t.slice(0,a+1);for(let c=e.length-1;c>=0;c--)switch(e[c]){case"INSIDE_STRING":{o+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{o+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{o+="]";break}case"INSIDE_LITERAL":{const d=t.substring(s,t.length);"true".startsWith(d)?o+="true".slice(d.length):"false".startsWith(d)?o+="false".slice(d.length):"null".startsWith(d)&&(o+="null".slice(d.length))}}return o}async function Re(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await me({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await me({text:nr(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var or=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),ir=({schema:t,name:e,description:a})=>{const s=rt(t);return{name:"object",responseFormat:le(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},n){const i=await me({text:r});if(!i.success)throw new ce({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=await Ne({value:i.value,schema:s});if(!o.success)throw new ce({message:"No object generated: response did not match schema.",cause:o.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return o.value},async parsePartialOutput({text:r}){const n=await Re(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value}}},createElementStreamTransform(){}}},lr=({element:t,name:e,description:a})=>{const s=rt(t);return{name:"array",responseFormat:le(s.jsonSchema).then(r=>{const{$schema:n,...i}=r;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}}),async parseCompleteOutput({text:r},n){const i=await me({text:r});if(!i.success)throw new ce({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=i.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new ce({message:"No object generated: response did not match schema.",cause:new be({value:o,cause:"response must be an object with an elements array"}),text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});for(const c of o.elements){const l=await Ne({value:c,schema:s});if(!l.success)throw new ce({message:"No object generated: response did not match schema.",cause:l.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason})}return o.elements},async parsePartialOutput({text:r}){const n=await Re(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=n.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const o=n.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,c=[];for(const l of o){const d=await Ne({value:l,schema:s});d.success&&c.push(d.value)}return{partial:c}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:n},i){if(n!=null)for(;r<n.length;r++)i.enqueue(n[r])}})}}},cr=({options:t,name:e,description:a})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}),async parseCompleteOutput({text:s},r){const n=await me({text:s});if(!n.success)throw new ce({message:"No object generated: could not parse the response.",cause:n.error,text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});const i=n.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new ce({message:"No object generated: response did not match schema.",cause:new be({value:i,cause:"response must be an object that contains a choice value."}),text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:s}){const r=await Re(s);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const n=r.value;if(n==null||typeof n!="object"||!("result"in n)||typeof n.result!="string")return;const i=t.filter(o=>o.startsWith(n.result));return r.state==="successful-parse"?i.includes(n.result)?{partial:n.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),ur=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:a},s){const r=await me({text:a});if(!r.success)throw new ce({message:"No object generated: could not parse the response.",cause:r.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});return r.value},async parsePartialOutput({text:a}){const s=await Re(a);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return s.value===void 0?void 0:{partial:s.value}}},createElementStreamTransform(){}});Ce({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
|
|
8
|
-
|
|
9
|
-
`)},flush(t){t.enqueue(`data: [DONE]
|
|
10
|
-
|
|
11
|
-
`)}})}});var dr=Zs(()=>Qt(W([M({type:_("text-start"),id:g(),providerMetadata:R.optional()}),M({type:_("text-delta"),id:g(),delta:g(),providerMetadata:R.optional()}),M({type:_("text-end"),id:g(),providerMetadata:R.optional()}),M({type:_("error"),errorText:g()}),M({type:_("tool-input-start"),toolCallId:g(),toolName:g(),providerExecuted:q().optional(),dynamic:q().optional(),title:g().optional()}),M({type:_("tool-input-delta"),toolCallId:g(),inputTextDelta:g()}),M({type:_("tool-input-available"),toolCallId:g(),toolName:g(),input:oe(),providerExecuted:q().optional(),providerMetadata:R.optional(),dynamic:q().optional(),title:g().optional()}),M({type:_("tool-input-error"),toolCallId:g(),toolName:g(),input:oe(),providerExecuted:q().optional(),providerMetadata:R.optional(),dynamic:q().optional(),errorText:g(),title:g().optional()}),M({type:_("tool-approval-request"),approvalId:g(),toolCallId:g()}),M({type:_("tool-output-available"),toolCallId:g(),output:oe(),providerExecuted:q().optional(),dynamic:q().optional(),preliminary:q().optional()}),M({type:_("tool-output-error"),toolCallId:g(),errorText:g(),providerExecuted:q().optional(),dynamic:q().optional()}),M({type:_("tool-output-denied"),toolCallId:g()}),M({type:_("reasoning-start"),id:g(),providerMetadata:R.optional()}),M({type:_("reasoning-delta"),id:g(),delta:g(),providerMetadata:R.optional()}),M({type:_("reasoning-end"),id:g(),providerMetadata:R.optional()}),M({type:_("source-url"),sourceId:g(),url:g(),title:g().optional(),providerMetadata:R.optional()}),M({type:_("source-document"),sourceId:g(),mediaType:g(),title:g(),filename:g().optional(),providerMetadata:R.optional()}),M({type:_("file"),url:g(),mediaType:g(),providerMetadata:R.optional()}),M({type:Pt(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:g().optional(),data:oe(),transient:q().optional()}),M({type:_("start-step")}),M({type:_("finish-step")}),M({type:_("start"),messageId:g().optional(),messageMetadata:oe().optional()}),M({type:_("finish"),finishReason:ba(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:oe().optional()}),M({type:_("abort"),reason:g().optional()}),M({type:_("message-metadata"),messageMetadata:oe()})])));function pr(t){return t.type.startsWith("data-")}function Je(t){return t.type.startsWith("tool-")}function mr(t){return t.type==="dynamic-tool"}function We(t){return Je(t)||mr(t)}function Tt(t){return t.type.split("-").slice(1).join("-")}function fr({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function hr({stream:t,messageMetadataSchema:e,dataPartSchemas:a,runUpdateMessageJob:s,onError:r,onToolCall:n,onData:i}){return t.pipeThrough(new TransformStream({async transform(o,c){await s(async({state:l,write:d})=>{var m,h,f,v;function b(u){const S=l.message.parts.filter(We).find(w=>w.toolCallId===u);if(S==null)throw new Error(`no tool invocation found for tool call ${u}`);return S}function y(u){var T;const S=l.message.parts.find(j=>Je(j)&&j.toolCallId===u.toolCallId),w=u,I=S;S!=null?(S.state=u.state,I.input=w.input,I.output=w.output,I.errorText=w.errorText,I.rawInput=w.rawInput,I.preliminary=w.preliminary,u.title!==void 0&&(I.title=u.title),I.providerExecuted=(T=w.providerExecuted)!=null?T:S.providerExecuted,w.providerMetadata!=null&&S.state==="input-available"&&(S.callProviderMetadata=w.providerMetadata)):l.message.parts.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,state:u.state,title:u.title,input:w.input,output:w.output,rawInput:w.rawInput,errorText:w.errorText,providerExecuted:w.providerExecuted,preliminary:w.preliminary,...w.providerMetadata!=null?{callProviderMetadata:w.providerMetadata}:{}})}function x(u){var T,S;const w=l.message.parts.find($=>$.type==="dynamic-tool"&&$.toolCallId===u.toolCallId),I=u,j=w;w!=null?(w.state=u.state,j.toolName=u.toolName,j.input=I.input,j.output=I.output,j.errorText=I.errorText,j.rawInput=(T=I.rawInput)!=null?T:j.rawInput,j.preliminary=I.preliminary,u.title!==void 0&&(j.title=u.title),j.providerExecuted=(S=I.providerExecuted)!=null?S:w.providerExecuted,I.providerMetadata!=null&&w.state==="input-available"&&(w.callProviderMetadata=I.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:u.toolName,toolCallId:u.toolCallId,state:u.state,input:I.input,output:I.output,errorText:I.errorText,preliminary:I.preliminary,providerExecuted:I.providerExecuted,title:u.title,...I.providerMetadata!=null?{callProviderMetadata:I.providerMetadata}:{}})}async function N(u){if(u!=null){const T=l.message.metadata!=null?na(l.message.metadata,u):u;e!=null&&await Nt({value:T,schema:e}),l.message.metadata=T}}switch(o.type){case"text-start":{const u={type:"text",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeTextParts[o.id]=u,l.message.parts.push(u),d();break}case"text-delta":{const u=l.activeTextParts[o.id];u.text+=o.delta,u.providerMetadata=(m=o.providerMetadata)!=null?m:u.providerMetadata,d();break}case"text-end":{const u=l.activeTextParts[o.id];u.state="done",u.providerMetadata=(h=o.providerMetadata)!=null?h:u.providerMetadata,delete l.activeTextParts[o.id],d();break}case"reasoning-start":{const u={type:"reasoning",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeReasoningParts[o.id]=u,l.message.parts.push(u),d();break}case"reasoning-delta":{const u=l.activeReasoningParts[o.id];u.text+=o.delta,u.providerMetadata=(f=o.providerMetadata)!=null?f:u.providerMetadata,d();break}case"reasoning-end":{const u=l.activeReasoningParts[o.id];u.providerMetadata=(v=o.providerMetadata)!=null?v:u.providerMetadata,u.state="done",delete l.activeReasoningParts[o.id],d();break}case"file":{l.message.parts.push({type:"file",mediaType:o.mediaType,url:o.url}),d();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:o.sourceId,url:o.url,title:o.title,providerMetadata:o.providerMetadata}),d();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:o.sourceId,mediaType:o.mediaType,title:o.title,filename:o.filename,providerMetadata:o.providerMetadata}),d();break}case"tool-input-start":{const u=l.message.parts.filter(Je);l.partialToolCalls[o.toolCallId]={text:"",toolName:o.toolName,index:u.length,dynamic:o.dynamic,title:o.title},o.dynamic?x({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title}):y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title}),d();break}case"tool-input-delta":{const u=l.partialToolCalls[o.toolCallId];u.text+=o.inputTextDelta;const{value:T}=await Re(u.text);u.dynamic?x({toolCallId:o.toolCallId,toolName:u.toolName,state:"input-streaming",input:T,title:u.title}):y({toolCallId:o.toolCallId,toolName:u.toolName,state:"input-streaming",input:T,title:u.title}),d();break}case"tool-input-available":{o.dynamic?x({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}):y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}),d(),n&&!o.providerExecuted&&await n({toolCall:o});break}case"tool-input-error":{o.dynamic?x({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}):y({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:void 0,rawInput:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}),d();break}case"tool-approval-request":{const u=b(o.toolCallId);u.state="approval-requested",u.approval={id:o.approvalId},d();break}case"tool-output-denied":{const u=b(o.toolCallId);u.state="output-denied",d();break}case"tool-output-available":{const u=b(o.toolCallId);u.type==="dynamic-tool"?x({toolCallId:o.toolCallId,toolName:u.toolName,state:"output-available",input:u.input,output:o.output,preliminary:o.preliminary,providerExecuted:o.providerExecuted,title:u.title}):y({toolCallId:o.toolCallId,toolName:Tt(u),state:"output-available",input:u.input,output:o.output,providerExecuted:o.providerExecuted,preliminary:o.preliminary,title:u.title}),d();break}case"tool-output-error":{const u=b(o.toolCallId);u.type==="dynamic-tool"?x({toolCallId:o.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}):y({toolCallId:o.toolCallId,toolName:Tt(u),state:"output-error",input:u.input,rawInput:u.rawInput,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}),d();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{o.messageId!=null&&(l.message.id=o.messageId),await N(o.messageMetadata),(o.messageId!=null||o.messageMetadata!=null)&&d();break}case"finish":{o.finishReason!=null&&(l.finishReason=o.finishReason),await N(o.messageMetadata),o.messageMetadata!=null&&d();break}case"message-metadata":{await N(o.messageMetadata),o.messageMetadata!=null&&d();break}case"error":{r?.(new Error(o.errorText));break}default:if(pr(o)){a?.[o.type]!=null&&await Nt({value:o.data,schema:a[o.type]});const u=o;if(u.transient){i?.(u);break}const T=u.id!=null?l.message.parts.find(S=>u.type===S.type&&u.id===S.id):void 0;T!=null?T.data=u.data:l.message.parts.push(u),i?.(u),d()}}c.enqueue(o)})}}))}async function gr({stream:t,onError:e}){const a=t.getReader();try{for(;;){const{done:s}=await a.read();if(s)break}}catch(s){e?.(s)}finally{a.releaseLock()}}Ce({prefix:"aitxt",size:24});Ce({prefix:"aiobj",size:24});var vr=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(t){return new Promise((e,a)=>{this.queue.push(async()=>{try{await t(),e()}catch(s){a(s)}}),this.processQueue()})}};Ce({prefix:"aiobj",size:24});async function yr(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:a,type:s}=e,r=await new Promise((n,i)=>{const o=new FileReader;o.onload=c=>{var l;n((l=c.target)==null?void 0:l.result)},o.onerror=c=>i(c),o.readAsDataURL(e)});return{type:"file",mediaType:s,filename:a,url:r}}))}var br=class{constructor({api:t="/api/chat",credentials:e,headers:a,body:s,fetch:r,prepareSendMessagesRequest:n,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=a,this.body=s,this.fetch=r,this.prepareSendMessagesRequest=n,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var a,s,r,n,i;const o=await le(this.body),c=await le(this.headers),l=await le(this.credentials),d={...pe(c),...pe(e.headers)},m=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...o,...e.body},headers:d,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),h=(s=m?.api)!=null?s:this.api,f=m?.headers!==void 0?pe(m.headers):d,v=m?.body!==void 0?m.body:{...o,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},b=(r=m?.credentials)!=null?r:l,x=await((n=this.fetch)!=null?n:globalThis.fetch)(h,{method:"POST",headers:_t({"Content-Type":"application/json",...f},`ai-sdk/${St}`,xt()),body:JSON.stringify(v),credentials:b,signal:t});if(!x.ok)throw new Error((i=await x.text())!=null?i:"Failed to fetch the chat response.");if(!x.body)throw new Error("The response body is empty.");return this.processResponseStream(x.body)}async reconnectToStream(t){var e,a,s,r,n;const i=await le(this.body),o=await le(this.headers),c=await le(this.credentials),l={...pe(o),...pe(t.headers)},d=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...i,...t.body},headers:l,credentials:c,requestMetadata:t.metadata})),m=(a=d?.api)!=null?a:`${this.api}/${t.chatId}/stream`,h=d?.headers!==void 0?pe(d.headers):l,f=(s=d?.credentials)!=null?s:c,b=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:_t(h,`ai-sdk/${St}`,xt()),credentials:f});if(b.status===204)return null;if(!b.ok)throw new Error((n=await b.text())!=null?n:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");return this.processResponseStream(b.body)}},oa=class extends br{constructor(t={}){super(t)}processResponseStream(t){return Vs({stream:t,schema:dr}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},xr=class{constructor({generateId:t=Wa,id:e=t(),transport:a=new oa,messageMetadataSchema:s,dataPartSchemas:r,state:n,onError:i,onToolCall:o,onFinish:c,onData:l,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new vr,this.sendMessage=async(m,h)=>{var f,v,b,y;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...h});return}let x;if("text"in m||"files"in m?x={parts:[...Array.isArray(m.files)?m.files:await yr(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:x=m,m.messageId!=null){const N=this.state.messages.findIndex(u=>u.id===m.messageId);if(N===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[N].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,N+1),this.state.replaceMessage(N,{...x,id:m.messageId,role:(v=x.role)!=null?v:"user",metadata:m.metadata})}else this.state.pushMessage({...x,id:(b=x.id)!=null?b:this.generateId(),role:(y=x.role)!=null?y:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...h})},this.regenerate=async({messageId:m,...h}={})=>{const f=m==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===m);if(f===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:m,...h})},this.resumeStream=async(m={})=>{await this.makeRequest({trigger:"resume-stream",...m})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:m,approved:h,reason:f})=>this.jobExecutor.run(async()=>{var v,b;const y=this.state.messages,x=y[y.length-1],N=u=>We(u)&&u.state==="approval-requested"&&u.approval.id===m?{...u,state:"approval-responded",approval:{id:m,approved:h,reason:f}}:u;this.state.replaceMessage(y.length-1,{...x,parts:x.parts.map(N)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(N)),this.status!=="streaming"&&this.status!=="submitted"&&((v=this.sendAutomaticallyWhen)!=null&&v.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(b=this.lastMessage)==null?void 0:b.id})}),this.addToolOutput=async({state:m="output-available",tool:h,toolCallId:f,output:v,errorText:b})=>this.jobExecutor.run(async()=>{var y,x;const N=this.state.messages,u=N[N.length-1],T=S=>We(S)&&S.toolCallId===f?{...S,state:m,output:v,errorText:b}:S;this.state.replaceMessage(N.length-1,{...u,parts:u.parts.map(T)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(T)),this.status!=="streaming"&&this.status!=="submitted"&&((y=this.sendAutomaticallyWhen)!=null&&y.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var m;this.status!=="streaming"&&this.status!=="submitted"||(m=this.activeResponse)!=null&&m.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=a,this.generateId=t,this.messageMetadataSchema=s,this.dataPartSchemas=r,this.state=n,this.onError=i,this.onToolCall=o,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(t){this.state.messages=t}async makeRequest({trigger:t,metadata:e,headers:a,body:s,messageId:r}){var n,i,o,c;this.setStatus({status:"submitted",error:void 0});const l=this.lastMessage;let d=!1,m=!1,h=!1;try{const f={state:fr({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=f;let v;if(t==="resume-stream"){const y=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:s});if(y==null){this.setStatus({status:"ready"});return}v=y}else v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:e,headers:a,body:s,trigger:t,messageId:r});const b=y=>this.jobExecutor.run(()=>y({state:f.state,write:()=>{var x;this.setStatus({status:"streaming"}),f.state.message.id===((x=this.lastMessage)==null?void 0:x.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await gr({stream:hr({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:b,onError:y=>{throw y}}),onError:y=>{throw y}}),this.setStatus({status:"ready"})}catch(f){if(d||f.name==="AbortError")return d=!0,this.setStatus({status:"ready"}),null;h=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(m=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:m,isError:h,finishReason:(n=this.activeResponse)==null?void 0:n.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}(o=this.sendAutomaticallyWhen)!=null&&o.call(this,{messages:this.state.messages})&&!h&&await this.makeRequest({trigger:"submit-message",messageId:(c=this.lastMessage)==null?void 0:c.id,metadata:e,headers:a,body:s})}},Be,Ct;function _r(){if(Ct)return Be;Ct=1;function t(e,a){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let s,r=0;return function(...i){clearTimeout(s);const o=Date.now(),c=o-r,l=a-c;l<=0?(r=o,e.apply(this,i)):s=setTimeout(()=>{r=Date.now(),e.apply(this,i)},l)}}return Be=t,Be}var wr=_r();const Er=xa(wr);var ia=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},P=(t,e,a)=>(ia(t,e,"read from private field"),a?a.call(t):e.get(t)),ne=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},ie=(t,e,a,s)=>(ia(t,e,"write to private field"),e.set(t,a),a);function Ir(t,e){return e!=null?Er(t,e):t}var Q,Ae,Oe,xe,_e,we,ve,Ge,Ye,Nr=class{constructor(t=[]){ne(this,Q,void 0),ne(this,Ae,"ready"),ne(this,Oe,void 0),ne(this,xe,new Set),ne(this,_e,new Set),ne(this,we,new Set),this.pushMessage=e=>{ie(this,Q,P(this,Q).concat(e)),P(this,ve).call(this)},this.popMessage=()=>{ie(this,Q,P(this,Q).slice(0,-1)),P(this,ve).call(this)},this.replaceMessage=(e,a)=>{ie(this,Q,[...P(this,Q).slice(0,e),this.snapshot(a),...P(this,Q).slice(e+1)]),P(this,ve).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?Ir(e,a):e;return P(this,xe).add(s),()=>{P(this,xe).delete(s)}},this["~registerStatusCallback"]=e=>(P(this,_e).add(e),()=>{P(this,_e).delete(e)}),this["~registerErrorCallback"]=e=>(P(this,we).add(e),()=>{P(this,we).delete(e)}),ne(this,ve,()=>{P(this,xe).forEach(e=>e())}),ne(this,Ge,()=>{P(this,_e).forEach(e=>e())}),ne(this,Ye,()=>{P(this,we).forEach(e=>e())}),ie(this,Q,t)}get status(){return P(this,Ae)}set status(t){ie(this,Ae,t),P(this,Ge).call(this)}get error(){return P(this,Oe)}set error(t){ie(this,Oe,t),P(this,Ye).call(this)}get messages(){return P(this,Q)}set messages(t){ie(this,Q,[...t]),P(this,ve).call(this)}};Q=new WeakMap;Ae=new WeakMap;Oe=new WeakMap;xe=new WeakMap;_e=new WeakMap;we=new WeakMap;ve=new WeakMap;Ge=new WeakMap;Ye=new WeakMap;var ye,Rt=class extends xr{constructor({messages:t,...e}){const a=new Nr(t);super({...e,state:a}),ne(this,ye,void 0),this["~registerMessagesCallback"]=(s,r)=>P(this,ye)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>P(this,ye)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>P(this,ye)["~registerErrorCallback"](s),ie(this,ye,a)}};ye=new WeakMap;function Sr({experimental_throttle:t,resume:e=!1,...a}={}){const s=B.useRef("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(s.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});const r={...a,onToolCall:h=>{var f,v;return(v=(f=s.current).onToolCall)==null?void 0:v.call(f,h)},onData:h=>{var f,v;return(v=(f=s.current).onData)==null?void 0:v.call(f,h)},onFinish:h=>{var f,v;return(v=(f=s.current).onFinish)==null?void 0:v.call(f,h)},onError:h=>{var f,v;return(v=(f=s.current).onError)==null?void 0:v.call(f,h)},sendAutomaticallyWhen:h=>{var f,v,b;return(b=(v=(f=s.current).sendAutomaticallyWhen)==null?void 0:v.call(f,h))!=null?b:!1}},n=B.useRef("chat"in a?a.chat:new Rt(r));("chat"in a&&a.chat!==n.current||"id"in a&&n.current.id!==a.id)&&(n.current="chat"in a?a.chat:new Rt(r));const o=B.useCallback(h=>n.current["~registerMessagesCallback"](h,t),[t,n.current.id]),c=B.useSyncExternalStore(o,()=>n.current.messages,()=>n.current.messages),l=B.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),d=B.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),m=B.useCallback(h=>{typeof h=="function"&&(h=h(n.current.messages)),n.current.messages=h},[n]);return B.useEffect(()=>{e&&n.current.resumeStream()},[e,n]),{id:n.current.id,messages:c,setMessages:m,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:d,resumeStream:n.current.resumeStream,status:l,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}const Tr="You are a helpful assistant.",Cr=t=>new oa({api:`/api/${t}/models/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:a})=>({body:{messages:e,stream:!0,...a}})});function dn(t){const e=z.c(37),{threadId:a,systemPrompt:s,gatewayId:r,onError:n,onToolCall:i}=t,{org:o,locator:c}=He(),{slug:l}=o,d=wa(),m=Ea(),[h,f]=B.useState(null),v=Ia(a),b=s||Tr;let y;e[0]!==b?(y={id:"system",role:"system",parts:[{type:"text",text:b}]},e[0]=b,e[1]=y):y=e[1];const N=y;let u;e[2]!==v||e[3]!==N?(u=[N,...v],e[2]=v,e[3]=N,e[4]=u):u=e[4];const T=u,S=`${a}:${b}`;let w;e[5]!==l?(w=Cr(l),e[5]=l,e[6]=w):w=e[6];const I=w;let j;e[7]!==r||e[8]!==c||e[9]!==m||e[10]!==d||e[11]!==a?(j=async L=>{const{finishReason:H,messages:$e,isAbort:fe,isDisconnect:he,isError:ge}=L;if(f(H??null),H!=="stop"||fe||he||ge)return;const re=$e.slice(-2).filter(Boolean);if(re.length!==2){console.warn("[chat] Expected 2 messages, got",re.length);return}m.insertMany.mutate(re);const nt=re.find(jr)?.parts?.find(Rr)?.text.slice(0,100)||"",Ze=await Na(c,a);if(!Ze){const ot=new Date().toISOString(),ua={id:a,title:nt,created_at:ot,updated_at:ot,hidden:!1,gatewayId:r};d.insert.mutate(ua);return}d.update.mutate({id:a,updates:{title:Ze.title||nt,gatewayId:Ze.gatewayId||r,updated_at:new Date().toISOString()}})},e[7]=r,e[8]=c,e[9]=m,e[10]=d,e[11]=a,e[12]=j):j=e[12];const $=j;let D;e[13]!==n?(D=L=>{console.error("[chat] Chat error:",L),n?.(L)},e[13]=n,e[14]=D):D=e[14];let U;e[15]!==T||e[16]!==S||e[17]!==$||e[18]!==i||e[19]!==D||e[20]!==I?(U={id:S,messages:T,transport:I,onFinish:$,onToolCall:i,onError:D},e[15]=T,e[16]=S,e[17]=$,e[18]=i,e[19]=D,e[20]=I,e[21]=U):U=e[21];const C=Sr(U);let te;e[22]!==C?(te=async(L,H)=>{!L?.trim()||C.status==="submitted"||C.status==="streaming"||(f(null),await C.sendMessage({id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:L}],metadata:H},{metadata:H}))},e[22]=C,e[23]=te):te=e[23];const F=te,ae=C.messages[0]?.role==="system"?C.messages.length===1:C.messages.length===0,G=C.messages,se=C.status;let k;e[24]!==C?(k=C.stop.bind(C),e[24]=C,e[25]=k):k=e[25];let X;e[26]===Symbol.for("react.memo_cache_sentinel")?(X=()=>f(null),e[26]=X):X=e[26];let Z;return e[27]!==C.clearError||e[28]!==C.error||e[29]!==C.messages||e[30]!==C.setMessages||e[31]!==C.status||e[32]!==h||e[33]!==ae||e[34]!==F||e[35]!==k?(Z={messages:G,status:se,sendMessage:F,stop:k,setMessages:C.setMessages,isEmpty:ae,error:C.error,clearError:C.clearError,finishReason:h,clearFinishReason:X},e[27]=C.clearError,e[28]=C.error,e[29]=C.messages,e[30]=C.setMessages,e[31]=C.status,e[32]=h,e[33]=ae,e[34]=F,e[35]=k,e[36]=Z):Z=e[36],Z}function Rr(t){return t.type==="text"}function jr(t){return t.parts?.find(Ar)}function Ar(t){return t.type==="text"}function Or(t,e){return t.find(e)??t[0]}function pn(t,e,a,s){const r=z.c(9),n=null,[i,o]=Ca(t,n);let c;r[0]!==a||r[1]!==i?(c=h=>i!==null?a(h,i):!1,r[0]=a,r[1]=i,r[2]=c):c=r[2];let l;r[3]!==e||r[4]!==c?(l=Or(e,c),r[3]=e,r[4]=c,r[5]=l):l=r[5];const d=l;let m;return r[6]!==d||r[7]!==o?(m=[d,o],r[6]=d,r[7]=o,r[8]=m):m=r[8],m}function mn(t){const e=z.c(11);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const s=Ot(a),[r]=Ra(t??void 0);let n;if(e[1]!==t||e[2]!==r||e[3]!==s.collectionName||e[4]!==s.connectionId||e[5]!==s.itemId){n=[],t&&(n.push(`### Selected Agent/Gateway
|
|
12
|
-
- ID: ${t}`),r?.trim()&&n.push(`### Agent Instructions
|
|
13
|
-
${r}`));let i;e[7]!==s.collectionName||e[8]!==s.connectionId||e[9]!==s.itemId?(i=[],s.connectionId&&i.push(`- Connection ID: ${s.connectionId}`),s.collectionName&&i.push(`- Collection: ${s.collectionName}`),s.itemId&&i.push(`- Item ID: ${s.itemId}`),e[7]=s.collectionName,e[8]=s.connectionId,e[9]=s.itemId,e[10]=i):i=e[10],i.length>0&&n.push(`### Current Resource
|
|
14
|
-
The user is viewing the following resource:
|
|
15
|
-
${i.join(`
|
|
16
|
-
`)}
|
|
17
|
-
|
|
18
|
-
Help the user understand and work with this resource.`),e[1]=t,e[2]=r,e[3]=s.collectionName,e[4]=s.connectionId,e[5]=s.itemId,e[6]=n}else n=e[6];return n.join(`
|
|
19
|
-
|
|
20
|
-
`)}const jt=[{border:"border-purple-400",bg:"bg-purple-400",text:"text-white",bgLight:"bg-purple-400/10"},{border:"border-blue-400",bg:"bg-blue-400",text:"text-white",bgLight:"bg-blue-400/10"},{border:"border-indigo-400",bg:"bg-indigo-400",text:"text-white",bgLight:"bg-indigo-400/10"},{border:"border-violet-400",bg:"bg-violet-400",text:"text-white",bgLight:"bg-violet-400/10"},{border:"border-pink-400",bg:"bg-pink-400",text:"text-white",bgLight:"bg-pink-400/10"},{border:"border-fuchsia-400",bg:"bg-fuchsia-400",text:"text-white",bgLight:"bg-fuchsia-400/10"},{border:"border-emerald-400",bg:"bg-emerald-400",text:"text-white",bgLight:"bg-emerald-400/10"},{border:"border-teal-400",bg:"bg-teal-400",text:"text-white",bgLight:"bg-teal-400/10"},{border:"border-cyan-400",bg:"bg-cyan-400",text:"text-white",bgLight:"bg-cyan-400/10"},{border:"border-sky-400",bg:"bg-sky-400",text:"text-white",bgLight:"bg-sky-400/10"},{border:"border-orange-400",bg:"bg-orange-400",text:"text-white",bgLight:"bg-orange-400/10"},{border:"border-amber-400",bg:"bg-amber-400",text:"text-white",bgLight:"bg-amber-400/10"},{border:"border-rose-400",bg:"bg-rose-400",text:"text-white",bgLight:"bg-rose-400/10"},{border:"border-lime-400",bg:"bg-lime-400",text:"text-white",bgLight:"bg-lime-400/10"}];function Mr(t){let e=0;for(let a=0;a<t.length;a++)e=t.charCodeAt(a)+((e<<5)-e);return Math.abs(e)}function la(t){if(t==null)return null;const a=Mr(t)%jt.length;return jt[a]}function Pr(t){const e=z.c(66),{gateway:a,onGatewayChange:s,onReset:r,className:n,disabled:i}=t,o=i===void 0?!1:i,[c,l]=B.useState(!1),d=B.useRef(null),m=Sa(),h=kt(),{org:f}=He();let v,b;if(e[0]!==c?(v=()=>{c&&setTimeout(()=>{d.current?.focus()},0)},b=[c],e[0]=c,e[1]=v,e[2]=b):(v=e[1],b=e[2]),B.useEffect(v,b),!a?.id)return null;let y,x,N,u;if(e[3]!==n||e[4]!==a.id||e[5]!==h||e[6]!==s||e[7]!==r||e[8]!==f.slug){const $e=la(a.id);let fe;e[13]!==r?(fe=re=>{re.stopPropagation(),r()},e[13]=r,e[14]=fe):fe=e[14],N=fe;let he;e[15]!==a.id||e[16]!==h||e[17]!==f.slug?(he=re=>{re.stopPropagation(),h({to:"/$org/gateways/$gatewayId",params:{org:f.slug,gatewayId:a.id}})},e[15]=a.id,e[16]=h,e[17]=f.slug,e[18]=he):he=e[18],y=he;let ge;e[19]!==s?(ge=re=>{s(re),l(!1)},e[19]=s,e[20]=ge):ge=e[20],x=ge,u=J("flex items-center justify-between px-3 py-1.5 rounded-t-xl",$e?.bg,n),e[3]=n,e[4]=a.id,e[5]=h,e[6]=s,e[7]=r,e[8]=f.slug,e[9]=y,e[10]=x,e[11]=N,e[12]=u}else y=e[9],x=e[10],N=e[11],u=e[12];const T=o?"cursor-not-allowed opacity-50":"cursor-pointer";let S;e[21]!==T?(S=J("flex items-center gap-1.5 hover:opacity-80 transition-opacity",T),e[21]=T,e[22]=S):S=e[22];let w;e[23]!==a.fallbackIcon?(w=a.fallbackIcon??p.jsx(Ma,{size:10}),e[23]=a.fallbackIcon,e[24]=w):w=e[24];let I;e[25]!==a.icon||e[26]!==a.title||e[27]!==w?(I=p.jsx(ja,{icon:a.icon,name:a.title,size:"2xs",fallbackIcon:w}),e[25]=a.icon,e[26]=a.title,e[27]=w,e[28]=I):I=e[28];let j;e[29]!==a.title?(j=p.jsx("span",{className:"text-xs text-white font-normal",children:a.title}),e[29]=a.title,e[30]=j):j=e[30];let $;e[31]===Symbol.for("react.memo_cache_sentinel")?($=p.jsx(Oa,{size:14,className:"text-white/50"}),e[31]=$):$=e[31];let D;e[32]!==o||e[33]!==S||e[34]!==I||e[35]!==j?(D=p.jsx(Xe,{asChild:!0,children:p.jsxs("button",{type:"button",disabled:o,className:S,children:[I,j,$]})}),e[32]=o,e[33]=S,e[34]=I,e[35]=j,e[36]=D):D=e[36];let U;e[37]!==a.id||e[38]!==m||e[39]!==x?(U=p.jsx(Qe,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:p.jsx(Ta,{gateways:m,selectedGatewayId:a.id,onGatewayChange:x,searchInputRef:d})}),e[37]=a.id,e[38]=m,e[39]=x,e[40]=U):U=e[40];let C;e[41]!==c||e[42]!==D||e[43]!==U?(C=p.jsxs(Ke,{open:c,onOpenChange:l,children:[D,U]}),e[41]=c,e[42]=D,e[43]=U,e[44]=C):C=e[44];const te=o?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-white/10";let F;e[45]!==te?(F=J("flex items-center justify-center p-1 rounded-full transition-colors",te),e[45]=te,e[46]=F):F=e[46];let ae;e[47]===Symbol.for("react.memo_cache_sentinel")?(ae=p.jsx(Pa,{size:14,className:"text-white"}),e[47]=ae):ae=e[47];let G;e[48]!==o||e[49]!==y||e[50]!==F?(G=p.jsx("button",{type:"button",onClick:y,disabled:o,className:F,"aria-label":"Edit gateway",children:ae}),e[48]=o,e[49]=y,e[50]=F,e[51]=G):G=e[51];const se=o?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-white/10";let k;e[52]!==se?(k=J("flex items-center justify-center p-1 rounded-full transition-colors",se),e[52]=se,e[53]=k):k=e[53];let X;e[54]===Symbol.for("react.memo_cache_sentinel")?(X=p.jsx($t,{size:14,className:"text-white"}),e[54]=X):X=e[54];let Z;e[55]!==o||e[56]!==N||e[57]!==k?(Z=p.jsx("button",{type:"button",onClick:N,disabled:o,className:k,"aria-label":"Reset to default",children:X}),e[55]=o,e[56]=N,e[57]=k,e[58]=Z):Z=e[58];let L;e[59]!==G||e[60]!==Z?(L=p.jsxs("div",{className:"flex items-center gap-1",children:[G,Z]}),e[59]=G,e[60]=Z,e[61]=L):L=e[61];let H;return e[62]!==C||e[63]!==L||e[64]!==u?(H=p.jsxs("div",{className:u,children:[C,L]}),e[62]=C,e[63]=L,e[64]=u,e[65]=H):H=e[65],H}function kr(t){t(null)}function fn(t){const e=z.c(18),{gateway:a,onGatewayChange:s,children:r,className:n,disabled:i}=t,o=i===void 0?!1:i;let c;if(e[0]!==n||e[1]!==a){const b=a?la(a.id):null;c=J("relative rounded-xl w-full flex flex-col p-0.5",a&&"shadow-sm rounded-xl",b?.bg,n),e[0]=n,e[1]=a,e[2]=c}else c=e[2];let l;e[3]!==o||e[4]!==a||e[5]!==s?(l=a&&p.jsx(Pr,{gateway:a,onGatewayChange:s,onReset:()=>kr(s),disabled:o}),e[3]=o,e[4]=a,e[5]=s,e[6]=l):l=e[6];let d;e[7]!==l?(d=p.jsx("div",{className:"min-h-[32px]",children:l}),e[7]=l,e[8]=d):d=e[8];const m=!a&&"shadow-sm rounded-xl";let h;e[9]!==m?(h=J("bg-background rounded-xl",m),e[9]=m,e[10]=h):h=e[10];let f;e[11]!==r||e[12]!==h?(f=p.jsx("div",{className:h,children:r}),e[11]=r,e[12]=h,e[13]=f):f=e[13];let v;return e[14]!==c||e[15]!==d||e[16]!==f?(v=p.jsxs("div",{className:c,children:[d,f]}),e[14]=c,e[15]=d,e[16]=f,e[17]=v):v=e[17],v}async function Dr(t){const e=`/mcp/gateway/${t}`,a={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const s=await fetch(e,{method:"POST",headers:a,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-chat",version:"1.0.0"}}})});if(!s.ok)return[];if((await s.json()).error)return[];const n=await fetch(e,{method:"POST",headers:a,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!n.ok)return[];const i=await n.json();return i.error?[]:i.result?.prompts||[]}catch{return[]}}function $r(t){const e=z.c(7);let a;e[0]!==t?(a=Mt.gatewayPrompts(t),e[0]=t,e[1]=a):a=e[1];let s;e[2]!==t?(s=()=>Dr(t),e[2]=t,e[3]=s):s=e[3];let r;return e[4]!==a||e[5]!==s?(r={queryKey:a,queryFn:s,staleTime:6e4,retry:!1},e[4]=a,e[5]=s,e[6]=r):r=e[6],_a(r)}const At=3;function Zr(t){const e=z.c(6),{children:a,className:s}=t;let r;e[0]!==s?(r=J("flex flex-wrap items-center justify-center gap-2",s),e[0]=s,e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n={minHeight:"32px"},e[2]=n):n=e[2];let i;return e[3]!==a||e[4]!==r?(i=p.jsx("div",{className:r,style:n,children:a}),e[3]=a,e[4]=r,e[5]=i):i=e[5],i}function Lr(t){const e=z.c(14),{prompt:a,onSelect:s}=t,r=a.description??a.name;let n;e[0]!==s||e[1]!==a?(n=()=>s(a),e[0]=s,e[1]=a,e[2]=n):n=e[2];const i=a.title??a.name;let o;if(e[3]!==i){let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=/_/g,e[5]=m):m=e[5],o=i.replace(m," "),e[3]=i,e[4]=o}else o=e[4];let c;e[6]!==n||e[7]!==o?(c=p.jsx(tt,{asChild:!0,children:p.jsx("button",{type:"button",onClick:n,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer",children:o})}),e[6]=n,e[7]=o,e[8]=c):c=e[8];let l;e[9]!==r?(l=p.jsx(at,{side:"bottom",className:"max-w-xs",children:p.jsx("p",{className:"text-xs",children:r})}),e[9]=r,e[10]=l):l=e[10];let d;return e[11]!==c||e[12]!==l?(d=p.jsxs(et,{children:[c,l]}),e[11]=c,e[12]=l,e[13]=d):d=e[13],d}function Ur(t){const e=z.c(20),{prompts:a,onSelect:s,className:r}=t;if(a.length===0)return null;let n,i,o,c,l;if(e[0]!==r||e[1]!==s||e[2]!==a){const h=a.slice(0,At),f=a.slice(At),v=f.length>0;n=Dt,l=300,e[8]!==r?(i=J("flex flex-wrap items-center justify-center gap-2",r),e[8]=r,e[9]=i):i=e[9];let b;e[10]!==s?(b=y=>p.jsx(Lr,{prompt:y,onSelect:s},y.name),e[10]=s,e[11]=b):b=e[11],o=h.map(b),c=v&&p.jsxs(Ke,{children:[p.jsx(Xe,{asChild:!0,children:p.jsxs("button",{type:"button",className:"size-7 flex items-center justify-center text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer",children:["+",f.length]})}),p.jsx(Qe,{side:"bottom",align:"center",className:"w-auto p-2",children:p.jsx("div",{className:"flex flex-col gap-1",children:f.map(y=>{const x=y.description??y.name;return p.jsxs(et,{children:[p.jsx(tt,{asChild:!0,children:p.jsx("button",{type:"button",onClick:()=>s(y),className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent/50 rounded-md transition-colors cursor-pointer text-left",children:(y.title??y.name).replace(/_/g," ")})}),p.jsx(at,{side:"right",className:"max-w-xs",children:p.jsx("p",{className:"text-xs",children:x})})]},y.name)})})})]}),e[0]=r,e[1]=s,e[2]=a,e[3]=n,e[4]=i,e[5]=o,e[6]=c,e[7]=l}else n=e[3],i=e[4],o=e[5],c=e[6],l=e[7];let d;e[12]!==i||e[13]!==o||e[14]!==c?(d=p.jsxs("div",{className:i,children:[o,c]}),e[12]=i,e[13]=o,e[14]=c,e[15]=d):d=e[15];let m;return e[16]!==n||e[17]!==l||e[18]!==d?(m=p.jsx(n,{delayDuration:l,children:d}),e[16]=n,e[17]=l,e[18]=d,e[19]=m):m=e[19],m}function Br(t){const e=z.c(6),{className:a}=t;let s;e[0]!==a?(s=J("flex flex-wrap items-center justify-center gap-2",a),e[0]=a,e[1]=s):s=e[1];let r,n;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(ut,{className:"h-6 w-20 rounded-full border border-border"}),n=p.jsx(ut,{className:"h-6 w-24 rounded-full border border-border"}),e[2]=r,e[3]=n):(r=e[2],n=e[3]);let i;return e[4]!==s?(i=p.jsxs("div",{className:s,children:[r,n]}),e[4]=s,e[5]=i):i=e[5],i}function ca(t){const e=z.c(4),{gatewayId:a,onSelect:s,className:r}=t,{data:n}=$r(a);if(n.length===0)return null;let i;return e[0]!==r||e[1]!==s||e[2]!==n?(i=p.jsx(Ur,{prompts:n,onSelect:s,className:r}),e[0]=r,e[1]=s,e[2]=n,e[3]=i):i=e[3],i}ca.Fallback=Br;ca.Container=Zr;function hn({title:t="No model provider connected",description:e="Connect to a model provider to unlock AI-powered features.",orgSlug:a,orgId:s,userId:r,allConnections:n,onInstallMcpServer:i}){const[o,c]=B.useState(!1),l=ka(),d=kt(),m=async()=>{if(!s||!r){ze.error("Not authenticated");return}c(!0);try{const h=n?.find(b=>b.connection_url===$a);if(h){d({to:"/$org/mcps/$connectionId",params:{org:a,connectionId:h.id}});return}const f=Za({id:La("conn")}),v=await l.create.mutateAsync(f);d({to:"/$org/mcps/$connectionId",params:{org:a,connectionId:v.id}})}catch(h){ze.error(`Failed to connect OpenRouter: ${h instanceof Error?h.message:String(h)}`)}finally{c(!1)}};return p.jsx(Aa,{image:p.jsx("img",{src:"/empty-state-openrouter.svg",alt:"",width:336,height:320,"aria-hidden":"true",className:"w-xs h-auto mask-radial-[100%_100%] mask-radial-from-20% mask-radial-to-50% mask-radial-at-center"}),title:t,description:e,actions:p.jsxs(p.Fragment,{children:[p.jsxs(Pe,{variant:"outline",onClick:m,disabled:o,children:[p.jsx("img",{src:Da,alt:"OpenRouter",className:"size-4"}),o?"Installing...":"Install OpenRouter"]}),p.jsx(Pe,{variant:"outline",onClick:i,children:"Install Connection"})]})})}function zr(t){const e=new Date(t),s=new Date().getTime()-e.getTime(),r=Math.floor(s/6e4),n=Math.floor(s/36e5);return r<1?"now":r<60?`${r}m`:`${n}h`}function Fr(t){const e=new Date,a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),s=new Date(a.getTime()-864e5),r=new Date(a.getTime()-7*864e5),n=new Date(a.getTime()-30*864e5),i=[],o=[],c=[],l=[],d=[];for(const h of t){const f=new Date(h.updated_at);f>=a?i.push(h):f>=s?o.push(h):f>=r?c.push(h):f>=n?l.push(h):d.push(h)}const m=[];return i.length>0&&m.push({label:"Today",threads:i,showRelativeTime:!0}),o.length>0&&m.push({label:"Yesterday",threads:o,showRelativeTime:!1}),c.length>0&&m.push({label:"7 days ago",threads:c,showRelativeTime:!1}),l.length>0&&m.push({label:"30 days ago",threads:l,showRelativeTime:!1}),d.length>0&&m.push({label:"Older",threads:d,showRelativeTime:!1}),m}function gn(t){const e=z.c(49),{threads:a,activeThreadId:s,onSelectThread:r,onRemoveThread:n,onOpen:i,variant:o}=t,c=o===void 0?"icon":o,[l,d]=B.useState("");let m,h,f,v,b,y,x,N,u,T,S,w;if(e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==a||e[6]!==c){const C=l.trim()?a.filter(k=>(k.title||"New chat").toLowerCase().includes(l.toLowerCase())):a,te=Fr(C);let F;e[19]!==i?(F=k=>{k?i?.():d("")},e[19]=i,e[20]=F):F=e[20];const ae=F;v=Dt,f=et,h=Ke,T=ae,e[21]!==c?(S=p.jsx(tt,{asChild:!0,children:p.jsx(Xe,{asChild:!0,children:c==="outline"?p.jsx(Pe,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input","aria-label":"Chat history",children:p.jsx(it,{size:16})}):p.jsx(Pe,{type:"button",variant:"ghost",size:"icon",className:"size-6 p-1 hover:bg-transparent","aria-label":"Chat history",children:p.jsx(it,{size:16,className:"text-muted-foreground hover:text-foreground transition-colors"})})})}),e[21]=c,e[22]=S):S=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(at,{children:"Chat history"}),e[23]=w):w=e[23],m=Qe,x="end",N="w-80 p-0";let G;e[24]===Symbol.for("react.memo_cache_sentinel")?(G=p.jsx(Ua,{size:16,className:"text-muted-foreground shrink-0"}),e[24]=G):G=e[24];let se;e[25]===Symbol.for("react.memo_cache_sentinel")?(se=k=>d(k.target.value),e[25]=se):se=e[25],e[26]!==l?(u=p.jsx("div",{className:"border-b",children:p.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[G,p.jsx("input",{type:"text",placeholder:"Search chats...",value:l,onChange:se,className:"flex-1 border-0 shadow-none focus:outline-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[26]=l,e[27]=u):u=e[27],b="max-h-[300px] overflow-y-auto",y=C.length===0?p.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:l.trim()?"No chats found":"No chats yet"}):te.map((k,X)=>p.jsxs("div",{children:[X>0&&p.jsx("div",{className:"border-t mx-3"}),p.jsx("div",{className:"px-3 py-1",children:p.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:k.label})}),k.threads.map(Z=>{const L=Z.id===s;return p.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group ${L?"bg-accent/50":""}`,onClick:()=>r(Z.id),children:[p.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[p.jsx("span",{className:"text-sm truncate",children:Z.title||"New chat"}),p.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:L?"current":k.showRelativeTime?zr(Z.updated_at):null})]}),p.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),n(Z.id)},className:"opacity-0 cursor-pointer group/trash group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded transition-opacity",title:"Remove chat",children:p.jsx(Ba,{size:14,className:"text-muted-foreground group-hover/trash:text-destructive"})})]},Z.id)})]},k.label)),e[0]=s,e[1]=i,e[2]=n,e[3]=r,e[4]=l,e[5]=a,e[6]=c,e[7]=m,e[8]=h,e[9]=f,e[10]=v,e[11]=b,e[12]=y,e[13]=x,e[14]=N,e[15]=u,e[16]=T,e[17]=S,e[18]=w}else m=e[7],h=e[8],f=e[9],v=e[10],b=e[11],y=e[12],x=e[13],N=e[14],u=e[15],T=e[16],S=e[17],w=e[18];let I;e[28]!==b||e[29]!==y?(I=p.jsx("div",{className:b,children:y}),e[28]=b,e[29]=y,e[30]=I):I=e[30];let j;e[31]!==m||e[32]!==I||e[33]!==x||e[34]!==N||e[35]!==u?(j=p.jsxs(m,{align:x,className:N,children:[u,I]}),e[31]=m,e[32]=I,e[33]=x,e[34]=N,e[35]=u,e[36]=j):j=e[36];let $;e[37]!==h||e[38]!==j||e[39]!==T||e[40]!==S||e[41]!==w?($=p.jsxs(h,{onOpenChange:T,children:[S,w,j]}),e[37]=h,e[38]=j,e[39]=T,e[40]=S,e[41]=w,e[42]=$):$=e[42];let D;e[43]!==f||e[44]!==$?(D=p.jsx(f,{children:$}),e[43]=f,e[44]=$,e[45]=D):D=e[45];let U;return e[46]!==v||e[47]!==D?(U=p.jsx(v,{children:D}),e[46]=v,e[47]=D,e[48]=U):U=e[48],U}export{cn as D,ca as G,hn as N,ut as S,gn as T,mn as a,un as b,dn as c,fn as d,pn as u};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{c as v}from"./binder-Bcr51BHa.js";import{bn as T,bm as O,w as t,x as e,W as p,X as c,bo as l,bp as P,a1 as x,bq as U,U as i,J as u,V as g,Y as n,M as L,Z as b,Q as B,br as C}from"./index-Dk3lubBQ.js";const W=O.extend({avatar:e().describe("URL or data URI to the assistant's avatar image"),system_prompt:e().describe("System prompt that defines the assistant's behavior"),gateway_id:e().describe("Gateway ID to use for this assistant"),model:t({id:e().describe("Model ID"),connectionId:e().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),F=T("assistant",W),G=[...F],w=L(()=>u([B(),e(),i(),g(),p(e(),w),c(w)])),f=p(e(),p(e(),w)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),E=t({type:n("text"),text:e().describe("The text content"),providerOptions:f}),q=t({type:n("text"),text:e().describe("The text content"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),j=e().describe("File data as URL string"),k=t({type:n("file"),filename:e().optional().describe("Optional filename of the file"),data:j,mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:f}),J=t({type:n("file"),mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:e().describe("Generated file data as base64 encoded string")}),$=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerOptions:f}),K=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),V=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call, used to match with tool result"),toolName:e().describe("Name of the tool being called"),input:e().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:f}),z=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call"),toolName:e().describe("Name of the tool being called"),input:e().describe("Stringified JSON object with the tool call arguments"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),H=u([t({type:n("text"),value:e()}),t({type:n("json"),value:w}),t({type:n("error-text"),value:e()}),t({type:n("error-json"),value:w}),t({type:n("content"),value:c(u([t({type:n("text"),text:e().describe("Text content")}),t({type:n("media"),data:e().describe("Base-64 encoded media data"),mediaType:e().describe("IANA media type")})]))})]),A=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),output:H.describe("Result of the tool call"),result:b().describe("Unknown result of the tool call"),providerOptions:f}),X=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),result:l().describe("Result of the tool call (JSON-serializable)"),isError:g().optional().describe("Whether the result is an error or error message"),providerExecuted:g().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),Y=u([t({type:n("source"),sourceType:n("url"),id:e().describe("The ID of the source"),url:e().describe("The URL of the source"),title:e().optional().describe("The title of the source"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),t({type:n("source"),sourceType:n("document"),id:e().describe("The ID of the source"),mediaType:e().describe("IANA media type of the document (e.g., application/pdf)"),title:e().describe("The title of the document"),filename:e().optional().describe("Optional filename of the document"),providerMetadata:l().optional().describe("Additional provider-specific metadata")})]),Z=t({role:n("system"),content:e().describe("System message content"),providerOptions:f}),Q=t({role:n("user"),content:c(u([E,k])).describe("User message content parts (text or file)"),providerOptions:f}),ee=t({role:n("assistant"),content:c(u([E,k,$,V,A])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:f}),te=t({role:n("tool"),content:c(A).describe("Tool message content (tool results)"),providerOptions:f}),oe=u([Z,Q,ee,te]),ae=c(oe).describe("A list of messages forming the prompt"),ie=t({prompt:ae.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:i().optional().describe("Maximum number of tokens to generate"),temperature:i().optional().describe("Temperature setting. The range depends on the provider and model"),topP:i().optional().describe("Nucleus sampling parameter"),topK:i().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:i().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:i().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:i().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:c(e()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:u([t({type:n("text")}),t({type:n("json"),schema:l().optional().describe("JSON schema that the generated output should conform to"),name:e().optional().describe("Name of output that should be generated"),description:e().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:c(l()).optional().describe("The tools that are available for the model"),toolChoice:l().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:g().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:l().optional().describe("Abort signal for cancelling the operation"),providerOptions:l().optional().describe("Additional provider-specific options")}),ne=t({content:c(u([q,J,K,z,X,Y])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:x(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:P({inputTokens:i().optional(),outputTokens:i().optional(),totalTokens:i().optional(),reasoningTokens:i().optional()}).describe("Usage information for the language model call"),providerMetadata:l().optional().describe("Additional provider-specific metadata"),request:t({body:l().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({id:e().optional().describe("ID for the generated response"),timestamp:U().optional().describe("Timestamp for the start of the generated response"),modelId:e().optional().describe("The ID of the response model that was used"),headers:p(e(),e()).optional().describe("Response headers"),body:l().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:c(l()).describe("Warnings for the call, e.g. unsupported settings")});t({stream:l().describe("ReadableStream of LanguageModelV2StreamPart"),request:t({body:l().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({headers:p(e(),e()).optional().describe("Response headers")}).optional().describe("Optional response data")});const se=t({supportedUrls:p(e(),c(e())).describe("Supported URL patterns by media type for the provider")});t({modelId:e().describe("The ID of the model"),logo:e().nullable(),description:e().nullable(),capabilities:c(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const N=t({modelId:e().describe("The ID of the model"),callOptions:ie}),re=O.extend({logo:e().nullable(),description:e().nullable(),capabilities:c(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),le=T("llm",re,{readOnly:!0}),ce=[{name:"LLM_METADATA",inputSchema:t({modelId:e().describe("The ID of the model")}),outputSchema:se},{name:"LLM_DO_STREAM",inputSchema:N,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:N,outputSchema:ne},...le],de=t({scopes:c(e()).describe("List of scopes available"),stateSchema:p(e(),b()).describe("JSON Schema (draft-07) defining the state structure")}),pe=[{name:"MCP_CONFIGURATION",inputSchema:t({}),outputSchema:de}],ue=t({toolName:e().describe("Name of the tool to invoke on that connection"),transformCode:e().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(input): Output { ... }`\n The input will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output. \n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),me=t({code:e().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(input): Output { ... }\`
|
|
2
|
-
The input is the resolved value of the references in the input field. Example:
|
|
3
|
-
{
|
|
4
|
-
"input": {
|
|
5
|
-
"name": "@Step_1.name",
|
|
6
|
-
"age": "@Step_2.age"
|
|
7
|
-
},
|
|
8
|
-
"code": "export default function(input): Output { return { result: \`\${input.name} is \${input.age} years old.\` } }"
|
|
9
|
-
}
|
|
10
|
-
`)});t({signalName:e().describe("Signal name to wait for (e.g., 'approval'). Execution pauses until SEND_SIGNAL is called with this name.")});const he=u([ue.describe("Call an external tool via MCP connection. "),me.describe("Run pure TypeScript code for data transformation. Useful to merge data from multiple steps and transform it.")]),fe=t({maxAttempts:i().optional().describe("Max retry attempts on failure (default: 1, no retries)"),backoffMs:i().optional().describe("Initial delay between retries in ms (doubles each attempt)"),timeoutMs:i().optional().describe("Max execution time in ms before step fails (default: 30000)")}),D=L(()=>t({type:e().optional(),properties:p(e(),b()).optional(),required:c(e()).optional(),description:e().optional(),additionalProperties:g().optional(),additionalItems:g().optional(),items:D.optional()}).passthrough()),be=t({name:e().min(1).describe("Unique identifier for this step. Other steps reference its output as @name.field"),description:e().optional().describe("What this step does"),action:he,input:p(e(),b()).optional().describe("Data passed to the action. Use @ref for dynamic values: @input.field (workflow input), @stepName.field (previous step output), @item/@index (loop context). Example: { 'userId': '@input.user_id', 'data': '@fetch.result' }"),outputSchema:D.optional().describe("Optional JSON Schema describing the expected output of the step."),config:fe.optional().describe("Retry and timeout settings")}),ge=x(["enqueued","running","success","error","failed","cancelled"]).default("enqueued"),M=O.extend({gateway_id:e().describe("ID of the gateway that will be used to execute the workflow"),status:ge.describe("Current status of the workflow execution"),input:p(e(),b()).optional().describe("Input data for the workflow execution"),output:b().optional().describe("Output data for the workflow execution"),completed_at_epoch_ms:i().nullish().describe("Timestamp of when the workflow execution completed"),start_at_epoch_ms:i().nullish().describe("Timestamp of when the workflow execution started or will start"),timeout_ms:i().nullish().describe("Timeout in milliseconds for the workflow execution"),deadline_at_epoch_ms:i().nullish().describe("Deadline for the workflow execution - when the workflow execution will be cancelled if it is not completed. This is read-only and is set by the workflow engine when an execution is created."),error:b().nullish().describe("Error that occurred during the workflow execution"),completed_steps:t({success:c(e()).describe("Names of the steps that were completed successfully"),error:c(e()).describe("Names of the steps that errored")}).optional().describe("Names of the steps that were completed and their status")}),Se=x(["signal","timer","message","output","step_started","step_completed","workflow_started","workflow_completed"]);O.extend({execution_id:e(),type:Se,name:e().nullish(),payload:b().optional(),visible_at:i().nullish(),consumed_at:i().nullish(),source_execution_id:e().nullish()});const ye=O.extend({description:e().optional().describe("Human-readable summary of what this workflow does"),steps:c(be).describe("Ordered list of steps. Execution order is auto-determined by @ref dependencies: steps with no @ref dependencies run in parallel; steps referencing @stepName wait for that step to complete.")}),Te=T("workflow",ye),Oe={maxAttempts:1,timeoutMs:3e4},Me={name:"Initial Step",action:{code:`
|
|
11
|
-
interface Input {
|
|
12
|
-
example: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface Output {
|
|
16
|
-
result: unknown;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default async function(input: Input): Promise<Output> {
|
|
20
|
-
return {
|
|
21
|
-
result: input.example
|
|
22
|
-
}
|
|
23
|
-
}`},config:Oe,outputSchema:{type:"object",properties:{result:{type:"string",description:"The result of the step"}},required:["result"],description:"The output of the step. This is a JSON Schema describing the expected output of the step."}},Ie=T("workflow_execution",M),we=[...Te,...Ie],xe=[...we],Ce=T("workflow_execution",M),_={LLMS:ce,WORKFLOW:xe,WORKFLOW_EXECUTION:Ce,ASSISTANTS:G,MCP:pe};function Ne(o){return o.map(a=>({name:a.name,inputSchema:a.inputSchema?(()=>{try{return C(a.inputSchema)}catch(r){return console.error(`Failed to convert input schema for ${a.name}:`,r),t({})}})():t({}),outputSchema:a.outputSchema?(()=>{try{return C(a.outputSchema)}catch(r){return console.error(`Failed to convert output schema for ${a.name}:`,r),t({})}})():t({})}))}function _e(o,a){const r=o.tools;if(!r||r.length===0)return!1;const s=r.map(m=>({name:m.name,inputSchema:m.inputSchema})),d=a.map(m=>({name:m.name,inputSchema:m.inputSchema,opt:m.opt}));return v(d).isImplementedBy(s)}function Re({connections:o,binding:a}){const r=(()=>{if(a){if(typeof a=="string"){const s=a.toUpperCase(),d=_[s];if(!d){console.warn(`[useBindingConnections] Unknown binding "${a}". Available bindings: ${Object.keys(_).join(", ")}. Returning all connections without filtering.`);return}return d}if(a.length===0){console.warn("[useBindingConnections] Empty binding array provided. Returning all connections without filtering.");return}return Ne(a)}})();return o?r?o.filter(s=>_e(s,r)):o:[]}function ve(o){return o.toLowerCase().split("_").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function R(o){if(!o||o.length===0)return[];const a=/^COLLECTION_(.+)_LIST$/,r=[];for(const s of o){const d=s.name.match(a);d?.[1]&&r.push(d[1])}return r}function Le(o,a){const s=o.find(h=>h.name===`COLLECTION_${a}_CREATE`)?.inputSchema?.properties;if(s&&typeof s=="object"&&"data"in s)return s.data;const S=o.find(h=>h.name===`COLLECTION_${a}_UPDATE`)?.inputSchema?.properties;if(S&&typeof S=="object"&&"data"in S)return S.data;const I=o.find(h=>h.name===`COLLECTION_${a}_LIST`)?.outputSchema?.properties;if(I&&typeof I=="object"&&"items"in I){const h=I.items;if(h.items)return h.items}}function Ee(o,a){const r=a.toUpperCase();return{hasCreateTool:o.some(s=>s.name===`COLLECTION_${r}_CREATE`),hasUpdateTool:o.some(s=>s.name===`COLLECTION_${r}_UPDATE`),hasDeleteTool:o.some(s=>s.name===`COLLECTION_${r}_DELETE`)}}function ke(o){if(!o||o.length===0)return[];const a=R(o);if(a.length===0)return[];const r=[];for(const s of a)try{const d=T(s.toLowerCase(),O,{readOnly:!0}),S=o.map(y=>({name:y.name,inputSchema:y.inputSchema})),m=d.map(y=>({name:y.name,inputSchema:y.inputSchema}));if(v(m).isImplementedBy(S)){const y=Ee(o,s);r.push({name:s,displayName:ve(s),schema:Le(o,s),...y})}}catch{}return r}function Pe(o){return ke(o?.tools??null)}function Ue(o){return o?o.filter(a=>R(a.tools).find(r=>r==="REGISTRY_APP")):[]}export{Me as D,Ue as a,Pe as b,Re as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as u}from"./infiniteQueryObserver-CUXkVkPG.js";import{a5 as i}from"./index-Dk3lubBQ.js";function t(e,r){return i(e,u,r)}export{t as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a5 as u,b4 as s}from"./index-Dk3lubBQ.js";function o(e,r){return u(e,s,r)}export{o as u};
|