@decocms/mesh 2.8.2 → 2.10.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-CEZnzBK4.js → AlertCircle-BI-lv-P2.js} +1 -1
- package/dist/client/assets/{ArrowLeft-YNVHoaqm.js → ArrowLeft-WX776rGw.js} +1 -1
- package/dist/client/assets/Check-Dh23dmDM.js +1 -0
- package/dist/client/assets/{ChevronDown-CmCEYd2s.js → ChevronDown-CQl6wdMq.js} +1 -1
- package/dist/client/assets/{Clock-85E4NFdS.js → Clock-C2L66fjj.js} +1 -1
- package/dist/client/assets/Code01-BvYrq72o.js +1 -0
- package/dist/client/assets/{Copy01-BBFg9jKB.js → Copy01-BX4_oHqx.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-DJyv3R-C.js → DotsHorizontal-9lU8MC-X.js} +1 -1
- package/dist/client/assets/{DotsVertical-B2qEmOww.js → DotsVertical-BBtotCm7.js} +1 -1
- package/dist/client/assets/{File06-DO-M7k7I.js → File06-lv7rH_v1.js} +1 -1
- package/dist/client/assets/{FilterLines-9cG6s1wL.js → FilterLines-WZSp93Oe.js} +1 -1
- package/dist/client/assets/{FlipBackward-BE61TB2y.js → FlipBackward-CqqvNJYu.js} +1 -1
- package/dist/client/assets/{GitBranch01-C1dZmKCI.js → GitBranch01-DN-LFsG4.js} +1 -1
- package/dist/client/assets/{Grid01-B2ejilI6.js → Grid01-bigl9l-5.js} +1 -1
- package/dist/client/assets/{Inbox01-B__BrgQP.js → Inbox01-BIZdM9VF.js} +1 -1
- package/dist/client/assets/{InfoCircle-Bb6yXfW4.js → InfoCircle-FggQ2WMl.js} +1 -1
- package/dist/client/assets/{Key01-HK8q2f9G.js → Key01-BHIpjeh2.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CjgaR4cl.js → LinkExternal01-YcVnQhq1.js} +1 -1
- package/dist/client/assets/{Loading01-cH23qZPY.js → Loading01-nz4zkIiQ.js} +1 -1
- package/dist/client/assets/{Lock01-CV7o5W_u.js → Lock01-DJbaRRVq.js} +1 -1
- package/dist/client/assets/Play-Dy3YBriV.js +1 -0
- package/dist/client/assets/{Plus-C3sMzSb2.js → Plus-DRzcJPy4.js} +1 -1
- package/dist/client/assets/SearchMd-CGgWiIHk.js +1 -0
- package/dist/client/assets/{Terminal-B_oPipdw.js → Terminal-DDxodu0O.js} +1 -1
- package/dist/client/assets/{Trash01-BOhK9CaY.js → Trash01-Nn4emH5w.js} +1 -1
- package/dist/client/assets/{X-Di2SR_nX.js → X-CSDtf13Z.js} +1 -1
- package/dist/client/assets/{XClose-D4FDIiiz.js → XClose-Da4Q_9Br.js} +1 -1
- package/dist/client/assets/{alert-dialog-BCer35jC.js → alert-dialog-BrdP9Xiy.js} +2 -2
- package/dist/client/assets/auth-BkX07Kdp.js +1 -0
- package/dist/client/assets/{auth-catchall-CNdj2VJz.js → auth-catchall-CgZMKj4U.js} +1 -1
- package/dist/client/assets/{avatar-D_QIlSd5.js → avatar-DVkpHhcq.js} +1 -1
- package/dist/client/assets/{badge-DCqUYVs1.js → badge-DZOpuutl.js} +1 -1
- package/dist/client/assets/{card-DDmjO8CR.js → card-VaGCmdRN.js} +1 -1
- package/dist/client/assets/checkbox-B6_pb64c.js +1 -0
- package/dist/client/assets/{collection-detail-DRasnD9L.js → collection-detail-BZTq36Jq.js} +39 -39
- package/dist/client/assets/collection-display-button-0kCgwjcX.js +1 -0
- package/dist/client/assets/{collection-header-Cuit0QLN.js → collection-header-C5jLEW4T.js} +1 -1
- package/dist/client/assets/{collection-page-DxiA3ghM.js → collection-page-BxN-pfZ4.js} +1 -1
- package/dist/client/assets/collection-search-DCk3URyd.js +1 -0
- package/dist/client/assets/{collection-tab-6VzVkwAS.js → collection-tab-BK4lXf-5.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-DPx6-uyv.js → collection-table-wrapper-DbtYisXO.js} +1 -1
- package/dist/client/assets/{connection-card-Bg0hUMHn.js → connection-card-CtcQXchE.js} +1 -1
- package/dist/client/assets/connection-detail-Dtnc6jAX.js +1 -0
- package/dist/client/assets/connections-BkTTX2-6.js +1 -0
- package/dist/client/assets/constants-D7HtiX2k.js +1 -0
- package/dist/client/assets/{create-organization-dialog-CC0rYuMf.js → create-organization-dialog-BcohdvN6.js} +1 -1
- package/dist/client/assets/dialog-rGW8NOdv.js +1 -0
- package/dist/client/assets/{dropdown-menu-C3Qw1eKg.js → dropdown-menu-DEdU2p2E.js} +1 -1
- package/dist/client/assets/{empty-state-BD1JzJGu.js → empty-state-C6fFQCSt.js} +1 -1
- package/dist/client/assets/env-vars-editor-DtIOMaFz.js +1 -0
- package/dist/client/assets/{error-boundary-BGesyhaJ.js → error-boundary-B28JvE1I.js} +1 -1
- package/dist/client/assets/{extract-connection-data-D2APHbQ5.js → extract-connection-data-fJTZE6Hc.js} +1 -1
- package/dist/client/assets/{form-DbjhNzLy.js → form-CE1tfcze.js} +1 -1
- package/dist/client/assets/gateway-detail-DpvUxeca.js +1 -0
- package/dist/client/assets/gateways-DPTsKKk2.js +1 -0
- package/dist/client/assets/home-lONkAboE.js +1 -0
- package/dist/client/assets/index-B-_GLG4a.js +25 -0
- package/dist/client/assets/{index-6LdznHai.js → index-CGbuv4sL.js} +1 -1
- package/dist/client/assets/index-CJEYCkTv.js +1 -0
- package/dist/client/assets/index-Dc4mPG7D.js +163 -0
- package/dist/client/assets/index-DjBifmxL.js +88 -0
- package/dist/client/assets/index-KJvlasGf.css +1 -0
- package/dist/client/assets/{input-DotiBI6p.js → input-CLQFaB_P.js} +1 -1
- package/dist/client/assets/{layout-DsjrzSQc.js → layout-D-qTqL0P.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-Dw4_yzWC.js → lazy-highlighter-CM_r6Qg6.js} +1 -1
- package/dist/client/assets/localstorage-keys-Csxol0-8.js +1 -0
- package/dist/client/assets/{login-BsMqTksB.js → login-CY0fBMtA.js} +1 -1
- package/dist/client/assets/{mcp-oauth-B88skAsS.js → mcp-oauth-DwoWo555.js} +1 -1
- package/dist/client/assets/mcp-server-detail-BfkMNCXA.js +1 -0
- package/dist/client/assets/members-DlfrW4qm.js +3 -0
- package/dist/client/assets/{monaco-editor-CvpUgIrR.js → monaco-editor-CGmVJ7Sz.js} +4 -4
- package/dist/client/assets/{monitoring-BbF_WXiI.js → monitoring-8m7n1ABH.js} +7 -7
- package/dist/client/assets/{oauth-callback-PquX-RwH.js → oauth-callback-C3UTt1IM.js} +1 -1
- package/dist/client/assets/page-CjTfwiJs.js +1 -0
- package/dist/client/assets/page-Cm8i9onu.js +35 -0
- package/dist/client/assets/{pin-to-sidebar-button-BSWGT8FU.js → pin-to-sidebar-button-DmlmCu_p.js} +1 -1
- package/dist/client/assets/{popover-CaWduoVd.js → popover-Bt6Irkfs.js} +1 -1
- package/dist/client/assets/project-context-provider-jIErvTKU.js +1 -0
- package/dist/client/assets/{resizable-BAI48t1E.js → resizable-BDACILOB.js} +1 -1
- package/dist/client/assets/{resource-tabs-BRFCSYqq.js → resource-tabs-B9UXtdu9.js} +1 -1
- package/dist/client/assets/select-CXOQrDyU.js +1 -0
- package/dist/client/assets/settings-Cml1v0xs.js +1 -0
- package/dist/client/assets/shell-layout-BC-hIRVP.js +3 -0
- package/dist/client/assets/{spinner-uWjdkCaT.js → spinner-C-rDsJGC.js} +1 -1
- package/dist/client/assets/switch-C2oVrx7C.js +1 -0
- package/dist/client/assets/{textarea-D4LPxHHZ.js → textarea-DxDFaLzd.js} +1 -1
- package/dist/client/assets/thread-history-popover-D_x2TXEl.js +72 -0
- package/dist/client/assets/tool-set-selector-B03cDU_f.js +1 -0
- package/dist/client/assets/{tools-list-D2G7Q2Ei.js → tools-list-CCvCpz3e.js} +1 -1
- package/dist/client/assets/{use-binding-BEnmwZa_.js → use-binding-C_WCv3Kw.js} +7 -7
- package/dist/client/assets/use-connection-D1oWmd80.js +2 -0
- package/dist/client/assets/use-connection-resources-DAy5w-Ms.js +1 -0
- package/dist/client/assets/use-gateway-DEBoqh3W.js +1 -0
- package/dist/client/assets/{use-gateway-system-prompt-CCBqlzxU.js → use-gateway-system-prompt-B0FWJC8i.js} +1 -1
- package/dist/client/assets/{use-list-state-CB2CSejS.js → use-list-state-D9IMsf4Z.js} +1 -1
- package/dist/client/assets/{use-mcp-CNznMUGm.js → use-mcp-BSK2ddKq.js} +1 -1
- package/dist/client/assets/{use-members-D--4LRKi.js → use-members-BrVgN1Nv.js} +1 -1
- package/dist/client/assets/{use-mobile-CjWnbjwQ.js → use-mobile-BmTi-FB3.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BchwsUUI.js → use-organization-settings-DPGpmRIO.js} +1 -1
- package/dist/client/assets/{use-tool-call-DKS5g1oj.js → use-tool-call-B5UsmKnA.js} +1 -1
- package/dist/client/assets/useQuery-CjN7yze9.js +1 -0
- package/dist/client/assets/{value-DFK3h8tC.js → value-Duay7dd7.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-BWDHvHnZ.js → view-mode-toggle-Q_4Hio7O.js} +1 -1
- package/dist/client/assets/well-known-mcp-7PcWXInp.js +1 -0
- package/dist/client/assets/workflow-C6xPZGlX.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +146 -146
- package/dist/server/migrate.js +130 -130
- package/dist/server/server.js +140 -140
- package/package.json +1 -1
- package/dist/client/assets/Play-DOmYDSaf.js +0 -1
- package/dist/client/assets/auth-DNL1eAzM.js +0 -1
- package/dist/client/assets/checkbox-BS_G5ImZ.js +0 -1
- package/dist/client/assets/collection-display-button-CBDNG6XS.js +0 -1
- package/dist/client/assets/collection-search-BxG7OTzn.js +0 -1
- package/dist/client/assets/connection-detail-DRj9DRTu.js +0 -1
- package/dist/client/assets/connections-CT-Nb4fc.js +0 -1
- package/dist/client/assets/constants-oNAwRDlk.js +0 -1
- package/dist/client/assets/dialog-zdGaBxwi.js +0 -1
- package/dist/client/assets/env-vars-editor-3MawTyRU.js +0 -1
- package/dist/client/assets/gateway-detail-DURa2jZI.js +0 -1
- package/dist/client/assets/gateways-BTBrtb0Q.js +0 -1
- package/dist/client/assets/home-Bs5Ig8ua.js +0 -1
- package/dist/client/assets/index-BV_tzcZC.css +0 -1
- package/dist/client/assets/index-Bfp4h1_X.js +0 -25
- package/dist/client/assets/index-C4Akli_y.js +0 -163
- package/dist/client/assets/index-ISUndXQ9.js +0 -88
- package/dist/client/assets/localstorage-keys-Cbw-i0xB.js +0 -1
- package/dist/client/assets/mcp-server-detail-B5xXFQ9d.js +0 -1
- package/dist/client/assets/members-7V6nzBom.js +0 -3
- package/dist/client/assets/page-BhtFLe7G.js +0 -1
- package/dist/client/assets/page-DUKQV4B-.js +0 -35
- package/dist/client/assets/project-context-provider-CjwpGeXi.js +0 -1
- package/dist/client/assets/select-Ddz2YDMz.js +0 -1
- package/dist/client/assets/settings-KKz6f4k7.js +0 -1
- package/dist/client/assets/shell-layout-DPg95Lcz.js +0 -1
- package/dist/client/assets/switch-CHifjljt.js +0 -1
- package/dist/client/assets/thread-history-popover-N7ee3Fom.js +0 -48
- package/dist/client/assets/use-connection-DRGfApkr.js +0 -2
- package/dist/client/assets/use-connection-resources-DaAINPef.js +0 -1
- package/dist/client/assets/use-gateway-BLvEfmJw.js +0 -1
- package/dist/client/assets/useQueries-BTessZmq.js +0 -1
- package/dist/client/assets/useQuery-B-W0X26_.js +0 -1
- package/dist/client/assets/well-known-mcp-D13f-8h2.js +0 -1
- package/dist/client/assets/workflow-DCCuzPym.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,as as Pe,ac as rt,aj as _e,j as d,at as st,ad as lt,au as be,aL as at,ab as k,av as it,ae as j,ag as N,ai as $,aw as ct,a7 as Ee,aT as dt,ah as ut,ax as pt,aA as ft,ay as mt,az as ht,aB as vt,aC as gt,aD as xt,aE as St,c as ee}from"./index-C4Akli_y.js";import{V as wt,i as yt}from"./project-context-provider-CjwpGeXi.js";import{t as Re}from"./ChevronDown-CmCEYd2s.js";import{c as oe}from"./input-DotiBI6p.js";function Ne(n,[e,t]){return Math.min(t,Math.max(e,n))}var Ct=[" ","Enter","ArrowUp","ArrowDown"],It=[" ","Enter"],J="Select",[de,ue,bt]=at(J),[ne]=lt(J,[bt,Pe]),pe=Pe(),[Tt,G]=ne(J),[_t,Nt]=ne(J),je=n=>{const{__scopeSelect:e,children:t,open:o,defaultOpen:r,onOpenChange:i,value:s,defaultValue:l,onValueChange:a,dir:u,name:h,autoComplete:g,disabled:w,required:y,form:S}=n,p=pe(e),[v,C]=c.useState(null),[m,x]=c.useState(null),[U,M]=c.useState(!1),re=rt(u),[P,O]=_e({prop:o,defaultProp:r??!1,onChange:i,caller:J}),[F,q]=_e({prop:s,defaultProp:l,onChange:a,caller:J}),L=c.useRef(null),B=v?S||!!v.closest("form"):!0,[W,V]=c.useState(new Set),H=Array.from(W).map(E=>E.props.value).join(";");return d.jsx(st,{...p,children:d.jsxs(Tt,{required:y,scope:e,trigger:v,onTriggerChange:C,valueNode:m,onValueNodeChange:x,valueNodeHasChildren:U,onValueNodeHasChildrenChange:M,contentId:be(),value:F,onValueChange:q,open:P,onOpenChange:O,dir:re,triggerPointerDownPosRef:L,disabled:w,children:[d.jsx(de.Provider,{scope:e,children:d.jsx(_t,{scope:n.__scopeSelect,onNativeOptionAdd:c.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:c.useCallback(E=>{V(D=>{const z=new Set(D);return z.delete(E),z})},[]),children:t})}),B?d.jsxs(Qe,{"aria-hidden":!0,required:y,tabIndex:-1,name:h,autoComplete:g,value:F,onChange:E=>q(E.target.value),disabled:w,form:S,children:[F===void 0?d.jsx("option",{value:""}):null,Array.from(W)]},H):null]})})};je.displayName=J;var Me="SelectTrigger",Ae=c.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:o=!1,...r}=n,i=pe(t),s=G(Me,t),l=s.disabled||o,a=k(e,s.onTriggerChange),u=ue(t),h=c.useRef("touch"),[g,w,y]=tt(p=>{const v=u().filter(x=>!x.disabled),C=v.find(x=>x.value===s.value),m=ot(v,p,C);m!==void 0&&s.onValueChange(m.value)}),S=p=>{l||(s.onOpenChange(!0),y()),p&&(s.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d.jsx(it,{asChild:!0,...i,children:d.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":et(s.value)?"":void 0,...r,ref:a,onClick:N(r.onClick,p=>{p.currentTarget.focus(),h.current!=="mouse"&&S(p)}),onPointerDown:N(r.onPointerDown,p=>{h.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(S(p),p.preventDefault())}),onKeyDown:N(r.onKeyDown,p=>{const v=g.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&w(p.key),!(v&&p.key===" ")&&Ct.includes(p.key)&&(S(),p.preventDefault())})})})});Ae.displayName=Me;var Oe="SelectValue",De=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,children:i,placeholder:s="",...l}=n,a=G(Oe,t),{onValueNodeHasChildrenChange:u}=a,h=i!==void 0,g=k(e,a.onValueNodeChange);return $(()=>{u(h)},[u,h]),d.jsx(j.span,{...l,ref:g,style:{pointerEvents:"none"},children:et(a.value)?d.jsx(d.Fragment,{children:s}):i})});De.displayName=Oe;var Pt="SelectIcon",ke=c.forwardRef((n,e)=>{const{__scopeSelect:t,children:o,...r}=n;return d.jsx(j.span,{"aria-hidden":!0,...r,ref:e,children:o||"▼"})});ke.displayName=Pt;var Et="SelectPortal",Le=n=>d.jsx(ct,{asChild:!0,...n});Le.displayName=Et;var Q="SelectContent",Be=c.forwardRef((n,e)=>{const t=G(Q,n.__scopeSelect),[o,r]=c.useState();if($(()=>{r(new DocumentFragment)},[]),!t.open){const i=o;return i?Ee.createPortal(d.jsx(Ve,{scope:n.__scopeSelect,children:d.jsx(de.Slot,{scope:n.__scopeSelect,children:d.jsx("div",{children:n.children})})}),i):null}return d.jsx(He,{...n,ref:e})});Be.displayName=Q;var A=10,[Ve,Y]=ne(Q),Rt="SelectContentImpl",jt=ht("SelectContent.RemoveScroll"),He=c.forwardRef((n,e)=>{const{__scopeSelect:t,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:s,side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:S,hideWhenDetached:p,avoidCollisions:v,...C}=n,m=G(Q,t),[x,U]=c.useState(null),[M,re]=c.useState(null),P=k(e,f=>U(f)),[O,F]=c.useState(null),[q,L]=c.useState(null),B=ue(t),[W,V]=c.useState(!1),H=c.useRef(!1);c.useEffect(()=>{if(x)return pt(x)},[x]),ft();const E=c.useCallback(f=>{const[T,...R]=B().map(_=>_.ref.current),[I]=R.slice(-1),b=document.activeElement;for(const _ of f)if(_===b||(_?.scrollIntoView({block:"nearest"}),_===T&&M&&(M.scrollTop=0),_===I&&M&&(M.scrollTop=M.scrollHeight),_?.focus(),document.activeElement!==b))return},[B,M]),D=c.useCallback(()=>E([O,x]),[E,O,x]);c.useEffect(()=>{W&&D()},[W,D]);const{onOpenChange:z,triggerPointerDownPosRef:K}=m;c.useEffect(()=>{if(x){let f={x:0,y:0};const T=I=>{f={x:Math.abs(Math.round(I.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(I.pageY)-(K.current?.y??0))}},R=I=>{f.x<=10&&f.y<=10?I.preventDefault():x.contains(I.target)||z(!1),document.removeEventListener("pointermove",T),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",R,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",R,{capture:!0})}}},[x,z,K]),c.useEffect(()=>{const f=()=>z(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[z]);const[fe,ae]=tt(f=>{const T=B().filter(b=>!b.disabled),R=T.find(b=>b.ref.current===document.activeElement),I=ot(T,f,R);I&&setTimeout(()=>I.ref.current.focus())}),me=c.useCallback((f,T,R)=>{const I=!H.current&&!R;(m.value!==void 0&&m.value===T||I)&&(F(f),I&&(H.current=!0))},[m.value]),he=c.useCallback(()=>x?.focus(),[x]),te=c.useCallback((f,T,R)=>{const I=!H.current&&!R;(m.value!==void 0&&m.value===T||I)&&L(f)},[m.value]),ie=o==="popper"?Se:ze,se=ie===Se?{side:l,sideOffset:a,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:S,hideWhenDetached:p,avoidCollisions:v}:{};return d.jsx(Ve,{scope:t,content:x,viewport:M,onViewportChange:re,itemRefCallback:me,selectedItem:O,onItemLeave:he,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:q,position:o,isPositioned:W,searchRef:fe,children:d.jsx(mt,{as:jt,allowPinchZoom:!0,children:d.jsx(vt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:N(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:d.jsx(gt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:d.jsx(ie,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...C,...se,onPlaced:()=>V(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:N(C.onKeyDown,f=>{const T=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!T&&f.key.length===1&&ae(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let I=B().filter(b=>!b.disabled).map(b=>b.ref.current);if(["ArrowUp","End"].includes(f.key)&&(I=I.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const b=f.target,_=I.indexOf(b);I=I.slice(_+1)}setTimeout(()=>E(I)),f.preventDefault()}})})})})})})});He.displayName=Rt;var Mt="SelectItemAlignedPosition",ze=c.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:o,...r}=n,i=G(Q,t),s=Y(Q,t),[l,a]=c.useState(null),[u,h]=c.useState(null),g=k(e,P=>h(P)),w=ue(t),y=c.useRef(!1),S=c.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:C,focusSelectedItem:m}=s,x=c.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&v&&C){const P=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),F=i.valueNode.getBoundingClientRect(),q=C.getBoundingClientRect();if(i.dir!=="rtl"){const b=q.left-O.left,_=F.left-b,X=P.left-_,Z=P.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Ne(_,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.left=xe+"px"}else{const b=O.right-q.right,_=window.innerWidth-F.right-b,X=window.innerWidth-P.right-_,Z=P.width+X,ve=Math.max(Z,O.width),ge=window.innerWidth-A,xe=Ne(_,[A,Math.max(A,ge-ve)]);l.style.minWidth=Z+"px",l.style.right=xe+"px"}const L=w(),B=window.innerHeight-A*2,W=p.scrollHeight,V=window.getComputedStyle(u),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),z=parseInt(V.paddingBottom,10),K=H+E+W+z+D,fe=Math.min(v.offsetHeight*5,K),ae=window.getComputedStyle(p),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),te=P.top+P.height/2-A,ie=B-te,se=v.offsetHeight/2,f=v.offsetTop+se,T=H+E+f,R=K-T;if(T<=te){const b=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const _=u.clientHeight-p.offsetTop-p.offsetHeight,X=Math.max(ie,se+(b?he:0)+_+D),Z=T+X;l.style.height=Z+"px"}else{const b=L.length>0&&v===L[0].ref.current;l.style.top="0px";const X=Math.max(te,H+p.offsetTop+(b?me:0)+se)+R;l.style.height=X+"px",p.scrollTop=T-te+p.offsetTop}l.style.margin=`${A}px 0`,l.style.minHeight=fe+"px",l.style.maxHeight=B+"px",o?.(),requestAnimationFrame(()=>y.current=!0)}},[w,i.trigger,i.valueNode,l,u,p,v,C,i.dir,o]);$(()=>x(),[x]);const[U,M]=c.useState();$(()=>{u&&M(window.getComputedStyle(u).zIndex)},[u]);const re=c.useCallback(P=>{P&&S.current===!0&&(x(),m?.(),S.current=!1)},[x,m]);return d.jsx(Ot,{scope:t,contentWrapper:l,shouldExpandOnScrollRef:y,onScrollButtonChange:re,children:d.jsx("div",{ref:a,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:U},children:d.jsx(j.div,{...r,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});ze.displayName=Mt;var At="SelectPopperPosition",Se=c.forwardRef((n,e)=>{const{__scopeSelect:t,align:o="start",collisionPadding:r=A,...i}=n,s=pe(t);return d.jsx(xt,{...s,...i,ref:e,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Se.displayName=At;var[Ot,Te]=ne(Q,{}),we="SelectViewport",Ue=c.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:o,...r}=n,i=Y(we,t),s=Te(we,t),l=k(e,i.onViewportChange),a=c.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(de.Slot,{scope:t,children:d.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:N(r.onScroll,u=>{const h=u.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=s;if(w?.current&&g){const y=Math.abs(a.current-h.scrollTop);if(y>0){const S=window.innerHeight-A*2,p=parseFloat(g.style.minHeight),v=parseFloat(g.style.height),C=Math.max(p,v);if(C<S){const m=C+y,x=Math.min(S,m),U=m-x;g.style.height=x+"px",g.style.bottom==="0px"&&(h.scrollTop=U>0?U:0,g.style.justifyContent="flex-end")}}}a.current=h.scrollTop})})})]})});Ue.displayName=we;var Fe="SelectGroup",[Dt,kt]=ne(Fe),Lt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=be();return d.jsx(Dt,{scope:t,id:r,children:d.jsx(j.div,{role:"group","aria-labelledby":r,...o,ref:e})})});Lt.displayName=Fe;var We="SelectLabel",Bt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=kt(We,t);return d.jsx(j.div,{id:r.id,...o,ref:e})});Bt.displayName=We;var ce="SelectItem",[Vt,Ke]=ne(ce),$e=c.forwardRef((n,e)=>{const{__scopeSelect:t,value:o,disabled:r=!1,textValue:i,...s}=n,l=G(ce,t),a=Y(ce,t),u=l.value===o,[h,g]=c.useState(i??""),[w,y]=c.useState(!1),S=k(e,m=>a.itemRefCallback?.(m,o,r)),p=be(),v=c.useRef("touch"),C=()=>{r||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Vt,{scope:t,value:o,disabled:r,textId:p,isSelected:u,onItemTextChange:c.useCallback(m=>{g(x=>x||(m?.textContent??"").trim())},[]),children:d.jsx(de.ItemSlot,{scope:t,value:o,disabled:r,textValue:h,children:d.jsx(j.div,{role:"option","aria-labelledby":p,"data-highlighted":w?"":void 0,"aria-selected":u&&w,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...s,ref:S,onFocus:N(s.onFocus,()=>y(!0)),onBlur:N(s.onBlur,()=>y(!1)),onClick:N(s.onClick,()=>{v.current!=="mouse"&&C()}),onPointerUp:N(s.onPointerUp,()=>{v.current==="mouse"&&C()}),onPointerDown:N(s.onPointerDown,m=>{v.current=m.pointerType}),onPointerMove:N(s.onPointerMove,m=>{v.current=m.pointerType,r?a.onItemLeave?.():v.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&a.onItemLeave?.()}),onKeyDown:N(s.onKeyDown,m=>{a.searchRef?.current!==""&&m.key===" "||(It.includes(m.key)&&C(),m.key===" "&&m.preventDefault())})})})})});$e.displayName=ce;var le="SelectItemText",Ge=c.forwardRef((n,e)=>{const{__scopeSelect:t,className:o,style:r,...i}=n,s=G(le,t),l=Y(le,t),a=Ke(le,t),u=Nt(le,t),[h,g]=c.useState(null),w=k(e,C=>g(C),a.onItemTextChange,C=>l.itemTextRefCallback?.(C,a.value,a.disabled)),y=h?.textContent,S=c.useMemo(()=>d.jsx("option",{value:a.value,disabled:a.disabled,children:y},a.value),[a.disabled,a.value,y]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=u;return $(()=>(p(S),()=>v(S)),[p,v,S]),d.jsxs(d.Fragment,{children:[d.jsx(j.span,{id:a.textId,...i,ref:w}),a.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ee.createPortal(i.children,s.valueNode):null]})});Ge.displayName=le;var Ye="SelectItemIndicator",qe=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return Ke(Ye,t).isSelected?d.jsx(j.span,{"aria-hidden":!0,...o,ref:e}):null});qe.displayName=Ye;var ye="SelectScrollUpButton",Xe=c.forwardRef((n,e)=>{const t=Y(ye,n.__scopeSelect),o=Te(ye,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollTop>0;i(u)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop-a.offsetHeight)}}):null});Xe.displayName=ye;var Ce="SelectScrollDownButton",Ze=c.forwardRef((n,e)=>{const t=Y(Ce,n.__scopeSelect),o=Te(Ce,n.__scopeSelect),[r,i]=c.useState(!1),s=k(e,o.onScrollButtonChange);return $(()=>{if(t.viewport&&t.isPositioned){let l=function(){const u=a.scrollHeight-a.clientHeight,h=Math.ceil(a.scrollTop)<u;i(h)};const a=t.viewport;return l(),a.addEventListener("scroll",l),()=>a.removeEventListener("scroll",l)}},[t.viewport,t.isPositioned]),r?d.jsx(Je,{...n,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:a}=t;l&&a&&(l.scrollTop=l.scrollTop+a.offsetHeight)}}):null});Ze.displayName=Ce;var Je=c.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:o,...r}=n,i=Y("SelectScrollButton",t),s=c.useRef(null),l=ue(t),a=c.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return c.useEffect(()=>()=>a(),[a]),$(()=>{l().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),d.jsx(j.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:N(r.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(o,50))}),onPointerMove:N(r.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(o,50))}),onPointerLeave:N(r.onPointerLeave,()=>{a()})})}),Ht="SelectSeparator",zt=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n;return d.jsx(j.div,{"aria-hidden":!0,...o,ref:e})});zt.displayName=Ht;var Ie="SelectArrow",Ut=c.forwardRef((n,e)=>{const{__scopeSelect:t,...o}=n,r=pe(t),i=G(Ie,t),s=Y(Ie,t);return i.open&&s.position==="popper"?d.jsx(St,{...r,...o,ref:e}):null});Ut.displayName=Ie;var Ft="SelectBubbleInput",Qe=c.forwardRef(({__scopeSelect:n,value:e,...t},o)=>{const r=c.useRef(null),i=k(o,r),s=dt(e);return c.useEffect(()=>{const l=r.current;if(!l)return;const a=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(a,"value").set;if(s!==e&&h){const g=new Event("change",{bubbles:!0});h.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(j.select,{...t,style:{...wt,...t.style},ref:i,defaultValue:e})});Qe.displayName=Ft;function et(n){return n===""||n===void 0}function tt(n){const e=ut(n),t=c.useRef(""),o=c.useRef(0),r=c.useCallback(s=>{const l=t.current+s;e(l),(function a(u){t.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>a(""),1e3))})(l)},[e]),i=c.useCallback(()=>{t.current="",window.clearTimeout(o.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(o.current),[]),[t,r,i]}function ot(n,e,t){const r=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let s=Wt(n,Math.max(i,0));r.length===1&&(s=s.filter(u=>u!==t));const a=s.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return a!==t?a:void 0}function Wt(n,e){return n.map((t,o)=>n[(e+o)%n.length])}var Kt=je,$t=Ae,Gt=De,Yt=ke,qt=Le,Xt=Be,Zt=Ue,Jt=$e,Qt=Ge,eo=qe,to=Xe,oo=Ze;const nt=({size:n=24,color:e="currentColor",...t})=>c.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},c.createElement("path",{d:"m18 15-6-6-6 6"}));nt.displayName="ChevronUp";function co(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Kt,{"data-slot":"select",...t}),e[2]=t,e[3]=o):o=e[3],o}function uo(n){const e=ee.c(4);let t;e[0]!==n?({...t}=n,e[0]=n,e[1]=t):t=e[1];let o;return e[2]!==t?(o=d.jsx(Gt,{"data-slot":"select-value",...t}),e[2]=t,e[3]=o):o=e[3],o}function po(n){const e=ee.c(13);let t,o,r,i;e[0]!==n?({className:o,size:i,children:t,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"default":i;let l;e[5]!==o?(l=oe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 hover:bg-accent hover:text-accent-foreground dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-lg border bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-10 data-[size=sm]:h-7 data-[size=xs]:h-7 data-[size=xs]:px-2.5 data-[size=xs]:py-1.5 data-[size=xs]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=d.jsx(Yt,{asChild:!0,children:d.jsx(Re,{className:"size-4 opacity-50"})}),e[7]=a):a=e[7];let u;return e[8]!==t||e[9]!==r||e[10]!==s||e[11]!==l?(u=d.jsxs($t,{"data-slot":"select-trigger","data-size":s,className:l,...r,children:[t,a]}),e[8]=t,e[9]=r,e[10]=s,e[11]=l,e[12]=u):u=e[12],u}function fo(n){const e=ee.c(20);let t,o,r,i;e[0]!==n?({className:o,children:t,position:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?"popper":i,l=s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let a;e[5]!==o||e[6]!==l?(a=oe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border shadow-md",l,o),e[5]=o,e[6]=l,e[7]=a):a=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=d.jsx(no,{}),e[8]=u):u=e[8];const h=s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let g;e[9]!==h?(g=oe("p-1",h),e[9]=h,e[10]=g):g=e[10];let w;e[11]!==t||e[12]!==g?(w=d.jsx(Zt,{className:g,children:t}),e[11]=t,e[12]=g,e[13]=w):w=e[13];let y;e[14]===Symbol.for("react.memo_cache_sentinel")?(y=d.jsx(ro,{}),e[14]=y):y=e[14];let S;return e[15]!==s||e[16]!==r||e[17]!==a||e[18]!==w?(S=d.jsx(qt,{children:d.jsxs(Xt,{"data-slot":"select-content",className:a,position:s,...r,children:[u,w,y]})}),e[15]=s,e[16]=r,e[17]=a,e[18]=w,e[19]=S):S=e[19],S}function mo(n){const e=ee.c(16);let t,o,r,i;e[0]!==n?({className:o,children:t,hideCheck:i,...r}=n,e[0]=n,e[1]=t,e[2]=o,e[3]=r,e[4]=i):(t=e[1],o=e[2],r=e[3],i=e[4]);const s=i===void 0?!1:i;let l;e[5]!==o?(l=oe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-lg py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),e[5]=o,e[6]=l):l=e[6];let a;e[7]!==s?(a=!s&&d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(eo,{children:d.jsx(yt,{className:"size-4"})})}),e[7]=s,e[8]=a):a=e[8];let u;e[9]!==t?(u=d.jsx(Qt,{children:t}),e[9]=t,e[10]=u):u=e[10];let h;return e[11]!==r||e[12]!==l||e[13]!==a||e[14]!==u?(h=d.jsxs(Jt,{"data-slot":"select-item",className:l,...r,children:[a,u]}),e[11]=r,e[12]=l,e[13]=a,e[14]=u,e[15]=h):h=e[15],h}function no(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(nt,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(to,{"data-slot":"select-scroll-up-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}function ro(n){const e=ee.c(9);let t,o;e[0]!==n?({className:t,...o}=n,e[0]=n,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let r;e[3]!==t?(r=oe("flex cursor-default items-center justify-center py-1",t),e[3]=t,e[4]=r):r=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=d.jsx(Re,{className:"size-4"}),e[5]=i):i=e[5];let s;return e[6]!==o||e[7]!==r?(s=d.jsx(oo,{"data-slot":"select-scroll-down-button",className:r,...o,children:i}),e[6]=o,e[7]=r,e[8]=s):s=e[8],s}export{co as S,po as a,uo as b,fo as c,mo as d,Ne as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as C,h as B,B as D,x as K,w as P,j as s,s as $,c as Q,t as N,K as U,a as H,v as R}from"./index-C4Akli_y.js";import{C as A}from"./collection-header-Cuit0QLN.js";import{C as V}from"./collection-page-DxiA3ghM.js";import{u as W}from"./project-context-provider-CjwpGeXi.js";import{u as Y,I,B as S}from"./input-DotiBI6p.js";import{a as G,F as k,b as L,c as O,d as E,f as M,e as J}from"./form-DbjhNzLy.js";import{i as T}from"./X-Di2SR_nX.js";import"./collection-display-button-CBDNG6XS.js";import"./dropdown-menu-C3Qw1eKg.js";import"./Grid01-B2ejilI6.js";import"./view-mode-toggle-BWDHvHnZ.js";const q=({size:d=24,color:e="currentColor",...a})=>C.createElement("svg",{viewBox:"0 0 24 24",width:d,height:d,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},C.createElement("path",{d:"M21 15v1.2c0 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.2V15m14-7-5-5m0 0L7 8m5-5v12"}));q.displayName="Upload01";const X=$({name:R().min(1,"Name is required").max(255,"Name is too long"),slug:R().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:R().optional()});function Z(d){const e=Q.c(24),{value:a,onChange:r,name:m}=d,o=C.useRef(null);let u;e[0]!==r?(u=z=>{const F=z.target.files?.[0];if(F){if(F.size>2097152){N.error("Image must be smaller than 2MB");return}const c=new FileReader;c.onerror=()=>{const y=c.error;console.error("FileReader error:",y),N.error(y?.message||"Failed to read image file. Please try again."),o.current&&(o.current.value="")},c.onloadend=()=>{if(c.readyState===FileReader.DONE&&c.result){const y=c.result;r(y)}},c.readAsDataURL(F)}},e[0]=r,e[1]=u):u=e[1];const j=u;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{o.current?.click()},e[2]=i):i=e[2];const t=i;let l;e[3]!==r?(l=z=>{z.stopPropagation(),r("")},e[3]=r,e[4]=l):l=e[4];const n=l;let g;e[5]!==j?(g=s.jsx("input",{type:"file",ref:o,className:"hidden",accept:"image/*",onChange:j}),e[5]=j,e[6]=g):g=e[6];let h;e[7]!==n||e[8]!==m||e[9]!==a?(h=a?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:a,alt:m||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:n,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(T,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:t,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(q,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[7]=n,e[8]=m,e[9]=a,e[10]=h):h=e[10];const w=a?"Change Logo":"Upload Logo";let x;e[11]!==w?(x=s.jsx(S,{type:"button",variant:"outline",size:"sm",onClick:t,className:"mb-2",children:w}),e[11]=w,e[12]=x):x=e[12];let f;e[13]!==n||e[14]!==a?(f=a&&s.jsx(S,{type:"button",variant:"ghost",size:"sm",onClick:n,className:"ml-2",children:"Remove"}),e[13]=n,e[14]=a,e[15]=f):f=e[15];let v;e[16]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=v):v=e[16];let p;e[17]!==x||e[18]!==f?(p=s.jsxs("div",{className:"flex-1",children:[x,f,v]}),e[17]=x,e[18]=f,e[19]=p):p=e[19];let b;return e[20]!==p||e[21]!==g||e[22]!==h?(b=s.jsxs("div",{className:"flex items-start gap-4",children:[g,h,p]}),e[20]=p,e[21]=g,e[22]=h,e[23]=b):b=e[23],b}function de(){const d=B(),{org:e}=W(),a=D(),[r,m]=C.useState(!1),o=K({resolver:P(X),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),u=Y({mutationFn:async t=>{const l={name:t.name,slug:t.slug};t.logo&&(l.logo=t.logo);const n=await H.organization.update({organizationId:e.id,data:l});if(n?.error)throw new Error(n.error.message||"Failed to update organization");return n},onSuccess:t=>{a.invalidateQueries({queryKey:U.organizations()}),a.invalidateQueries({queryKey:U.activeOrganization(e.slug)}),N.success("Organization settings updated successfully"),t?.data?.slug&&t.data.slug!==e.slug&&d({to:"/$org/settings",params:{org:t.data.slug}})},onError:t=>{N.error(t instanceof Error?t.message:"Failed to update organization")},onSettled:()=>{m(!1)}}),j=t=>{m(!0),u.mutate(t)},i=o.formState.isDirty;return s.jsxs(V,{children:[s.jsx(A,{title:"Settings"}),s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsx("div",{className:"p-5 max-w-2xl",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Organization"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Update your organization's name, slug, and logo."})]}),s.jsx(G,{...o,children:s.jsxs("form",{onSubmit:o.handleSubmit(j),className:"space-y-6",children:[s.jsx(k,{control:o.control,name:"name",render:({field:t})=>s.jsxs(L,{children:[s.jsx(O,{children:"Organization Name"}),s.jsx(E,{children:s.jsx(I,{placeholder:"My Organization",...t,disabled:r})}),s.jsx(M,{})]})}),s.jsx(k,{control:o.control,name:"slug",render:({field:t})=>s.jsxs(L,{children:[s.jsx(O,{children:"Organization Slug"}),s.jsx(E,{children:s.jsx(I,{placeholder:"my-organization",...t,disabled:r,onChange:l=>{const n=l.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");t.onChange(n)}})}),s.jsx(J,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(M,{})]})}),s.jsx(k,{control:o.control,name:"logo",render:({field:t})=>s.jsxs(L,{children:[s.jsx(O,{children:"Logo"}),s.jsx(E,{children:s.jsx(Z,{value:t.value,onChange:t.onChange,name:o.watch("name")})}),s.jsx(M,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(S,{type:"submit",disabled:!i||r,className:"min-w-24",children:r?"Saving...":"Save Changes"}),i&&s.jsx(S,{type:"button",variant:"outline",onClick:()=>o.reset(),disabled:r,children:"Cancel"})]})]})})]})})})})})]})}export{de as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as v,c as h,j as o,R as Ft,T as Kt,D as Zt,C as Yt,P as qt,e as Xt,O as Jt,f as Qt,g as es,h as Pe,i as ut,k as ts,d as ht,a as Ne,l as ss,G as ns,U as as,m as os,S as pt,n as ls,o as is,N as rs,t as at,p as cs,K as ds,q as xt}from"./index-C4Akli_y.js";import{E as tt}from"./error-boundary-BGesyhaJ.js";import{i as ms}from"./File06-DO-M7k7I.js";import{i as Le}from"./X-Di2SR_nX.js";import{u as ye}from"./use-mobile-CjWnbjwQ.js";import{c as z,B as Y,I as fs}from"./input-DotiBI6p.js";import{T as us,a as hs,b as ps,c as xs,u as De,L as ot,i as gs,P as bs,O as js}from"./project-context-provider-CjwpGeXi.js";import{u as gt,a as vs}from"./use-organization-settings-BchwsUUI.js";import{n as Ss,u as ws,E as Cs,I as lt}from"./use-connection-DRGfApkr.js";import{i as Qe}from"./use-gateway-BLvEfmJw.js";import{C as Ns}from"./create-organization-dialog-CC0rYuMf.js";import{P as ys,a as _s,b as ks}from"./popover-CaWduoVd.js";import{A as Ce}from"./avatar-D_QIlSd5.js";import{c as Is}from"./Grid01-B2ejilI6.js";import{D as $s,a as Ms,b as zs,c as Ts,u as Os,d as As,C as E,e as it,f as Es,g as Rs,h as Ls,U as Ps,G as Ds,M as Bs}from"./index-ISUndXQ9.js";import{D as Hs,a as Us,b as Gs,c as Ws,d as rt}from"./dropdown-menu-C3Qw1eKg.js";import{a as Vs}from"./Copy01-BBFg9jKB.js";import{n as ct}from"./LinkExternal01-CjgaR4cl.js";import{D as bt,a as jt,b as vt,c as St,d as wt}from"./dialog-zdGaBxwi.js";import{u as Be,L as He}from"./localstorage-keys-Cbw-i0xB.js";import{u as Fs,a as Ks,b as Zs,N as Ys,G as qs,T as Xs,D as Js}from"./thread-history-popover-N7ee3Fom.js";import{R as Ct,a as Qs,b as en}from"./resizable-BAI48t1E.js";import{i as tn}from"./Loading01-cH23qZPY.js";import{s as sn}from"./Plus-C3sMzSb2.js";import{u as nn}from"./use-binding-BEnmwZa_.js";import"./alert-dialog-BCer35jC.js";import"./form-DbjhNzLy.js";import"./spinner-uWjdkCaT.js";import"./AlertCircle-CEZnzBK4.js";import"./textarea-D4LPxHHZ.js";import"./Terminal-B_oPipdw.js";import"./monaco-editor-CvpUgIrR.js";import"./select-Ddz2YDMz.js";import"./ChevronDown-CmCEYd2s.js";import"./InfoCircle-Bb6yXfW4.js";import"./useQuery-B-W0X26_.js";import"./use-gateway-system-prompt-CCBqlzxU.js";import"./well-known-mcp-D13f-8h2.js";import"./generate-id-Dyweu44Y.js";import"./Clock-85E4NFdS.js";import"./Trash01-BOhK9CaY.js";import"./auth-DNL1eAzM.js";const Nt=({size:t=24,color:e="currentColor",...s})=>v.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},v.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"}));Nt.displayName="BarChart10";const yt=({size:t=24,color:e="currentColor",...s})=>v.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},v.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"}));yt.displayName="Building02";const _t=({size:t=24,color:e="currentColor",...s})=>v.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},v.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));_t.displayName="ChevronSelectorVertical";const kt=({size:t=24,color:e="currentColor",...s})=>v.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},v.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"}));kt.displayName="Globe01";const It=({size:t=24,color:e="currentColor",...s})=>v.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},v.createElement("path",{d:"M9 21v-7.4c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 12 10.04 12 10.6 12h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 12.76 15 13.04 15 13.6V21M11.018 2.764 4.235 8.039c-.453.353-.68.53-.843.75a2 2 0 0 0-.318.65C3 9.704 3 9.991 3 10.565V17.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8v-7.235c0-.574 0-.861-.074-1.126a2.002 2.002 0 0 0-.318-.65c-.163-.22-.39-.397-.843-.75l-6.783-5.275c-.351-.273-.527-.41-.72-.462a1 1 0 0 0-.523 0c-.194.052-.37.189-.721.462Z"}));It.displayName="Home02";const $t=({size:t=24,color:e="currentColor",...s})=>v.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},v.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"}));$t.displayName="LayoutRight";const Mt=({size:t=24,color:e="currentColor",...s})=>v.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},v.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"}));Mt.displayName="LogOut01";const zt=({size:t=24,color:e="currentColor",...s})=>v.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},v.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"}));zt.displayName="Mail01";const Tt=({size:t=24,color:e="currentColor",...s})=>v.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},v.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),v.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"}));Tt.displayName="Settings01";const Ot=({size:t=24,color:e="currentColor",...s})=>v.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},v.createElement("path",{d:"M5.316 19.438A4.001 4.001 0 0 1 9 17h6a4.001 4.001 0 0 1 3.684 2.438M16 9.5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm6 2.5c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Ot.displayName="UserCircle";const At=({size:t=24,color:e="currentColor",...s})=>v.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},v.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"}));At.displayName="Users01";const Et=({size:t=24,color:e="currentColor",...s})=>v.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},v.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"}));Et.displayName="Zap";function an(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=o.jsx(Ft,{"data-slot":"sheet",...s}),e[2]=s,e[3]=a):a=e[3],a}function on(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=o.jsx(qt,{"data-slot":"sheet-portal",...s}),e[2]=s,e[3]=a):a=e[3],a}function ln(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 n;e[3]!==s?(n=z("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]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx(Jt,{"data-slot":"sheet-overlay",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function rn(t){const e=h.c(17);let s,a,n,l;e[0]!==t?({className:a,children:s,side:l,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=l):(s=e[1],a=e[2],n=e[3],l=e[4]);const i=l===void 0?"right":l;let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(ln,{}),e[5]=c):c=e[5];const r=i==="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=i==="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=i==="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=i==="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 u;e[6]!==a||e[7]!==r||e[8]!==d||e[9]!==m||e[10]!==f?(u=z("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",r,d,m,f,a),e[6]=a,e[7]=r,e[8]=d,e[9]=m,e[10]=f,e[11]=u):u=e[11];let x;e[12]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsxs(Xt,{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:[o.jsx(Le,{className:"size-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]}),e[12]=x):x=e[12];let p;return e[13]!==s||e[14]!==n||e[15]!==u?(p=o.jsxs(on,{children:[c,o.jsxs(Yt,{"data-slot":"sheet-content",className:u,...n,children:[s,x]})]}),e[13]=s,e[14]=n,e[15]=u,e[16]=p):p=e[16],p}function cn(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 n;e[3]!==s?(n=z("flex flex-col gap-1.5 p-4",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("div",{"data-slot":"sheet-header",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}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 n;e[3]!==s?(n=z("text-foreground font-semibold",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx(Kt,{"data-slot":"sheet-title",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function mn(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 n;e[3]!==s?(n=z("text-muted-foreground text-sm",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx(Zt,{"data-slot":"sheet-description",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function Rt(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 n;e[3]!==s?(n=z("bg-accent animate-pulse rounded-md",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("div",{"data-slot":"skeleton",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}const fn="sidebar_state",un=3600*24*7,hn="16rem",pn="18rem",xn="3rem",gn="b",Lt=v.createContext(null);function st(){const t=v.useContext(Lt);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function bn(t){const e=h.c(21),{defaultOpen:s,open:a,onOpenChange:n,children:l}=t,i=s===void 0?!0:s,c=ye(),[r,d]=v.useState(!1),[m,f]=v.useState(i),u=a??m;let x;e[0]!==u||e[1]!==n?(x=M=>{const $=typeof M=="function"?M(u):M;n?n($):f($),document.cookie=`${fn}=${$}; path=/; max-age=${un}`},e[0]=u,e[1]=n,e[2]=x):x=e[2];const p=x;let S;e[3]!==c||e[4]!==p?(S=()=>c?d(vn):p(jn),e[3]=c,e[4]=p,e[5]=S):S=e[5];const g=S;let b,j;e[6]!==g?(b=()=>{const M=$=>{if($.key===gn&&($.metaKey||$.ctrlKey)){const N=$.target;if(N.tagName==="INPUT"||N.tagName==="TEXTAREA"||N.isContentEditable)return;$.preventDefault(),g()}};return globalThis.addEventListener("keydown",M),()=>globalThis.removeEventListener("keydown",M)},j=[g],e[6]=g,e[7]=b,e[8]=j):(b=e[7],j=e[8]),v.useEffect(b,j);const _=u?"expanded":"collapsed";let C;e[9]!==c||e[10]!==u||e[11]!==r||e[12]!==p||e[13]!==_||e[14]!==g?(C={state:_,open:u,setOpen:p,isMobile:c,openMobile:r,setOpenMobile:d,toggleSidebar:g},e[9]=c,e[10]=u,e[11]=r,e[12]=p,e[13]=_,e[14]=g,e[15]=C):C=e[15];const y=C;let w;e[16]!==l?(w=o.jsx(hs,{delayDuration:0,children:l}),e[16]=l,e[17]=w):w=e[17];let k;return e[18]!==y||e[19]!==w?(k=o.jsx(Lt.Provider,{value:y,children:w}),e[18]=y,e[19]=w,e[20]=k):k=e[20],k}function jn(t){return!t}function vn(t){return!t}function Sn(t){const e=h.c(14);let s,a,n,l;e[0]!==t?({className:a,style:l,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=l):(s=e[1],a=e[2],n=e[3],l=e[4]);let i;e[5]!==l?(i={"--sidebar-width":hn,"--sidebar-width-icon":xn,...l},e[5]=l,e[6]=i):i=e[6];const c=i;let r;e[7]!==a?(r=z("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",a),e[7]=a,e[8]=r):r=e[8];let d;return e[9]!==s||e[10]!==n||e[11]!==c||e[12]!==r?(d=o.jsx("div",{"data-slot":"sidebar-wrapper",style:c,className:r,...n,children:s}),e[9]=s,e[10]=n,e[11]=c,e[12]=r,e[13]=d):d=e[13],d}function wn(t){const e=h.c(46);let s,a,n,l,i,c;e[0]!==t?({side:l,variant:i,collapsible:c,className:a,children:s,...n}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=l,e[5]=i,e[6]=c):(s=e[1],a=e[2],n=e[3],l=e[4],i=e[5],c=e[6]);const r=l===void 0?"left":l,d=i===void 0?"sidebar":i,m=c===void 0?"offcanvas":c,{isMobile:f,state:u,openMobile:x,setOpenMobile:p}=st();if(m==="none"){let $;e[7]!==a?($=z("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",a),e[7]=a,e[8]=$):$=e[8];let N;return e[9]!==s||e[10]!==n||e[11]!==$?(N=o.jsx("div",{"data-slot":"sidebar",className:$,...n,children:s}),e[9]=s,e[10]=n,e[11]=$,e[12]=N):N=e[12],N}if(f){let $;e[13]===Symbol.for("react.memo_cache_sentinel")?($={"--sidebar-width":pn},e[13]=$):$=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=o.jsxs(cn,{className:"sr-only",children:[o.jsx(dn,{children:"Sidebar"}),o.jsx(mn,{children:"Displays the mobile sidebar."})]}),e[14]=N):N=e[14];let T;e[15]!==s?(T=o.jsx("div",{className:"flex h-full w-full flex-col",children:s}),e[15]=s,e[16]=T):T=e[16];let R;e[17]!==r||e[18]!==T?(R=o.jsxs(rn,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:$,side:r,children:[N,T]}),e[17]=r,e[18]=T,e[19]=R):R=e[19];let B;return e[20]!==x||e[21]!==n||e[22]!==p||e[23]!==R?(B=o.jsx(an,{open:x,onOpenChange:p,...n,children:R}),e[20]=x,e[21]=n,e[22]=p,e[23]=R,e[24]=B):B=e[24],B}const S=u==="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 b;e[25]!==g?(b=z("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]=b):b=e[26];let j;e[27]!==b?(j=o.jsx("div",{"data-slot":"sidebar-gap",className:b}),e[27]=b,e[28]=j):j=e[28];const _=r==="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)]",C=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]!==_||e[31]!==C?(y=z("fixed top-12 bottom-0 z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",_,C,a),e[29]=a,e[30]=_,e[31]=C,e[32]=y):y=e[32];let w;e[33]!==s?(w=o.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]=w):w=e[34];let k;e[35]!==n||e[36]!==y||e[37]!==w?(k=o.jsx("div",{"data-slot":"sidebar-container",className:y,...n,children:w}),e[35]=n,e[36]=y,e[37]=w,e[38]=k):k=e[38];let M;return e[39]!==r||e[40]!==u||e[41]!==k||e[42]!==S||e[43]!==j||e[44]!==d?(M=o.jsxs("div",{className:"group peer text-foreground hidden md:block border-r","data-state":u,"data-collapsible":S,"data-variant":d,"data-side":r,"data-slot":"sidebar",children:[j,k]}),e[39]=r,e[40]=u,e[41]=k,e[42]=S,e[43]=j,e[44]=d,e[45]=M):M=e[45],M}function Cn(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 n;e[3]!==s?(n=z("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]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("main",{"data-slot":"sidebar-inset",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function Nn(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 n;e[3]!==s?(n=z("h-4 m-0! w-full",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("div",{"data-sidebar":"separator",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function yn(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 n;e[3]!==s?(n=z("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function _n(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 n;e[3]!==s?(n=z("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function kn(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 n;e[3]!==s?(n=z("w-full text-sm",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function In(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 n;e[3]!==s?(n=z("flex w-full min-w-0 flex-col gap-1",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}function Ue(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 n;e[3]!==s?(n=z("group/menu-item relative",s),e[3]=s,e[4]=n):n=e[4];let l;return e[5]!==a||e[6]!==n?(l=o.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:n,...a}),e[5]=a,e[6]=n,e[7]=l):l=e[7],l}const $n=Qt("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 Pt(t){const e=h.c(28);let s,a,n,l,i,c,r;e[0]!==t?({asChild:n,isActive:l,variant:i,size:c,tooltip:r,className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=l,e[5]=i,e[6]=c,e[7]=r):(s=e[1],a=e[2],n=e[3],l=e[4],i=e[5],c=e[6],r=e[7]);const d=n===void 0?!1:n,m=l===void 0?!1:l,f=i===void 0?"default":i,u=c===void 0?"default":c,x=d?es:"button",{isMobile:p,state:S}=st();let g;e[8]!==s||e[9]!==u||e[10]!==f?(g=z($n({variant:f,size:u}),s),e[8]=s,e[9]=u,e[10]=f,e[11]=g):g=e[11];let b;e[12]!==x||e[13]!==m||e[14]!==a||e[15]!==u||e[16]!==g?(b=o.jsx(x,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":u,"data-active":m,className:g,...a}),e[12]=x,e[13]=m,e[14]=a,e[15]=u,e[16]=g,e[17]=b):b=e[17];const j=b;if(!r)return j;if(typeof r=="string"){let k;e[18]!==r?(k={children:r},e[18]=r,e[19]=k):k=e[19],r=k}let _;e[20]!==j?(_=o.jsx(ps,{asChild:!0,children:j}),e[20]=j,e[21]=_):_=e[21];const C=S!=="collapsed"||p;let y;e[22]!==C||e[23]!==r?(y=o.jsx(us,{side:"right",align:"center",hidden:C,...r}),e[22]=C,e[23]=r,e[24]=y):y=e[24];let w;return e[25]!==_||e[26]!==y?(w=o.jsxs(xs,{children:[_,y]}),e[25]=_,e[26]=y,e[27]=w):w=e[27],w}function Mn(t){const e=h.c(26),{item:s}=t,a=Pe(),{org:n}=De(),l=gt(n.id),i=vs(n.id);let c;e[0]!==i.update||e[1]!==s.url||e[2]!==l?.sidebar_items?(c=async()=>{const C=(l?.sidebar_items||[]).filter(y=>y.url!==s.url);await i.update.mutateAsync({sidebar_items:C})},e[0]=i.update,e[1]=s.url,e[2]=l?.sidebar_items,e[3]=c):c=e[3];const r=c;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 u;e[7]!==s.url||e[8]!==a?(u=()=>{a({to:s.url})},e[7]=s.url,e[8]=a,e[9]=u):u=e[9];const x=s.title;let p;e[10]!==f||e[11]!==s.icon||e[12]!==s.title?(p=o.jsx("div",{className:"flex items-center justify-center shrink-0",children:f?o.jsx("img",{src:s.icon,alt:s.title,className:"h-4 w-4 rounded object-cover"}):o.jsx(ms,{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]=p):p=e[13];let S;e[14]!==s.title?(S=s.title.toLocaleLowerCase(),e[14]=s.title,e[15]=S):S=e[15];let g;e[16]!==S?(g=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col items-start",children:o.jsx("span",{className:"truncate text-sm w-full capitalize",children:S})}),e[16]=S,e[17]=g):g=e[17];let b;e[18]!==r?(b=o.jsx(Le,{size:16,className:"text-muted-foreground opacity-0 group-hover/item:opacity-50 hover:opacity-100 cursor-pointer",onClick:_=>{_.preventDefault(),_.stopPropagation(),r()}}),e[18]=r,e[19]=b):b=e[19];let j;return e[20]!==s.title||e[21]!==u||e[22]!==p||e[23]!==g||e[24]!==b?(j=o.jsx(Ue,{children:o.jsxs(Pt,{className:"w-full pr-2 group/item relative cursor-pointer text-foreground/90 hover:text-foreground",onClick:u,tooltip:x,children:[p,g,b]})}),e[20]=s.title,e[21]=u,e[22]=p,e[23]=g,e[24]=b,e[25]=j):j=e[25],j}function zn(){const t=h.c(4),{org:e}=De(),a=gt(e.id)?.sidebar_items;if(!a?.length)return null;let n;t[0]!==a?(n=a.map(Tn),t[0]=a,t[1]=n):n=t[1];let l;return t[2]!==n?(l=o.jsx(Dt,{children:n}),t[2]=n,t[3]=l):l=t[3],l}function Tn(t){return o.jsx(Mn,{item:t},t.url)}function dt(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ue,{children:o.jsx("div",{className:"flex items-center gap-2 px-4 py-2",children:o.jsx(Rt,{className:"h-4 flex-1"})})}),t[0]=e):e=t[0],e}function Dt(t){const e=h.c(4),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(Nn,{className:"my-2 -ml-1"}),e[0]=a):a=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Ue,{children:o.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:o.jsx("span",{className:"whitespace-nowrap",children:"Pinned Views"})})}),e[1]=n):n=e[1];let l;return e[2]!==s?(l=o.jsxs(o.Fragment,{children:[a,n,s]}),e[2]=s,e[3]=l):l=e[3],l}function On(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(v.Suspense,{fallback:o.jsxs(Dt,{children:[o.jsx(dt,{}),o.jsx(dt,{})]}),children:o.jsx(zn,{})}),t[0]=e):e=t[0],e}function An(){const t=h.c(49),{locator:e}=De(),s=Pe(),a=ut();let n;t[0]!==e?(n=ot.parse(e),t[0]=e,t[1]=n):n=t[1];const{org:l}=n;let i;t[2]!==e?(i=ot.isOrgAdminProject(e),t[2]=e,t[3]=i):i=t[3];const c=i,r=a.location.pathname===`/${l}`||a.location.pathname===`/${l}/`;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(It,{}),t[4]=d):d=t[4];let m;t[5]!==r||t[6]!==s||t[7]!==l?(m={key:"home",label:"Home",icon:d,onClick:()=>{r?window.dispatchEvent(new CustomEvent("reset-home-view")):s({to:"/$org",params:{org:l}})}},t[5]=r,t[6]=s,t[7]=l,t[8]=m):m=t[8];let f;t[9]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(yt,{}),t[9]=f):f=t[9];let u;t[10]!==s||t[11]!==l?(u={key:"store",label:"Store",icon:f,onClick:()=>s({to:"/$org/store",params:{org:l}})},t[10]=s,t[11]=l,t[12]=u):u=t[12];let x;t[13]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ss,{}),t[13]=x):x=t[13];let p;t[14]!==s||t[15]!==l?(p={key:"mcps",label:"Connections",icon:x,onClick:()=>s({to:"/$org/mcps",params:{org:l}})},t[14]=s,t[15]=l,t[16]=p):p=t[16];let S;t[17]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Qe,{}),t[17]=S):S=t[17];let g;t[18]!==s||t[19]!==l?(g={key:"gateways",label:"Agents",icon:S,onClick:()=>s({to:"/$org/gateways",params:{org:l}})},t[18]=s,t[19]=l,t[20]=g):g=t[20];let b;t[21]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Et,{}),t[21]=b):b=t[21];let j;t[22]!==s||t[23]!==l?(j={key:"workflow",label:"Workflows",icon:b,onClick:()=>s({to:"/$org/workflows",params:{org:l}})},t[22]=s,t[23]=l,t[24]=j):j=t[24];let _;t[25]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Nt,{}),t[25]=_):_=t[25];let C;t[26]!==s||t[27]!==l?(C={key:"monitoring",label:"Monitoring",icon:_,onClick:()=>s({to:"/$org/monitoring",params:{org:l}})},t[26]=s,t[27]=l,t[28]=C):C=t[28];let y;t[29]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(At,{}),t[29]=y):y=t[29];let w;t[30]!==s||t[31]!==l?(w={key:"members",label:"Members",icon:y,onClick:()=>s({to:"/$org/members",params:{org:l}})},t[30]=s,t[31]=l,t[32]=w):w=t[32];let k;t[33]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(Tt,{}),t[33]=k):k=t[33];let M;t[34]!==s||t[35]!==l?(M={key:"settings",label:"Settings",icon:k,onClick:()=>s({to:"/$org/settings",params:{org:l}})},t[34]=s,t[35]=l,t[36]=M):M=t[36];let $;t[37]!==j||t[38]!==C||t[39]!==w||t[40]!==M||t[41]!==m||t[42]!==u||t[43]!==p||t[44]!==g?($=[m,u,p,g,j,C,w,M],t[37]=j,t[38]=C,t[39]=w,t[40]=M,t[41]=m,t[42]=u,t[43]=p,t[44]=g,t[45]=$):$=t[45];const N=$;let T;return t[46]!==N||t[47]!==c?(T=c?N:[],t[46]=N,t[47]=c,t[48]=T):T=t[48],T}function Bt(t){const e=h.c(10),{navigationItems:s,footer:a,additionalContent:n,variant:l,collapsible:i}=t,c=l===void 0?"sidebar":l,r=i===void 0?"icon":i;let d;e[0]!==s?(d=s.map(En),e[0]=s,e[1]=d):d=e[1];let m;e[2]!==n||e[3]!==d?(m=o.jsx(yn,{className:"flex-1 overflow-x-hidden",children:o.jsx(_n,{className:"font-medium",children:o.jsx(kn,{children:o.jsxs(In,{className:"gap-0.5",children:[d,n]})})})}),e[2]=n,e[3]=d,e[4]=m):m=e[4];let f;return e[5]!==r||e[6]!==a||e[7]!==m||e[8]!==c?(f=o.jsxs(wn,{variant:c,collapsible:r,children:[m,a]}),e[5]=r,e[6]=a,e[7]=m,e[8]=c,e[9]=f):f=e[9],f}function En(t){return o.jsx(Ue,{children:o.jsxs(Pt,{className:"group/nav-item cursor-pointer text-foreground/90 hover:text-foreground",onClick:t.onClick,isActive:t.isActive,tooltip:t.label,children:[o.jsx("span",{className:"text-muted-foreground group-hover/nav-item:text-foreground transition-colors [&>svg]:size-4",children:t.icon}),o.jsx("span",{className:"truncate",children:t.label})]})},t.key)}Bt.Skeleton=function(){return o.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>o.jsx("div",{className:"w-full h-8",children:o.jsx(Rt,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function Rn(){const t=h.c(3),e=An();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(o.Fragment,{children:o.jsx(tt,{children:o.jsx(v.Suspense,{fallback:null,children:o.jsx(On,{})})})}),t[0]=s):s=t[0];let a;return t[1]!==e?(a=o.jsx(Bt,{navigationItems:e,additionalContent:s}),t[1]=e,t[2]=a):a=t[2],a}function Ln(t){const e=h.c(12);let s,a,n,l;e[0]!==t?({className:s,orientation:n,decorative:l,...a}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=l):(s=e[1],a=e[2],n=e[3],l=e[4]);const i=n===void 0?"horizontal":n,c=l===void 0?!0:l;let r;e[5]!==s?(r=z("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]=r):r=e[6];let d;return e[7]!==c||e[8]!==i||e[9]!==a||e[10]!==r?(d=o.jsx(ts,{"data-slot":"separator-root",decorative:c,orientation:i,className:r,...a}),e[7]=c,e[8]=i,e[9]=a,e[10]=r,e[11]=d):d=e[11],d}const Ht=v.createContext(null);function Pn(){const t=v.useContext(Ht);if(!t)throw new Error("TopbarSwitcher compound components must be used within TopbarSwitcher.Root");return t}function Dn(t){const e=h.c(10),{children:s,onItemHover:a}=t,[n,l]=v.useState(null);let i;e[0]!==a?(i=f=>{l(f),a?.(f)},e[0]=a,e[1]=i):i=e[1];const c=i;let r;e[2]!==n||e[3]!==c?(r={hoveredItem:n,setHoveredItem:c},e[2]=n,e[3]=c,e[4]=r):r=e[4];let d;e[5]!==s?(d=o.jsx(ys,{children:s}),e[5]=s,e[6]=d):d=e[6];let m;return e[7]!==r||e[8]!==d?(m=o.jsx(Ht.Provider,{value:r,children:d}),e[7]=r,e[8]=d,e[9]=m):m=e[9],m}function Bn(t){const e=h.c(6),{children:s,onClick:a}=t;let n;e[0]!==s||e[1]!==a?(n=o.jsx(Y,{variant:"link",className:"p-0.5 h-auto",onClick:a,type:"button",children:s}),e[0]=s,e[1]=a,e[2]=n):n=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(_s,{asChild:!0,children:o.jsx(Y,{size:"icon",variant:"ghost",className:"w-6 h-6 p-0",children:o.jsx(_t,{size:16,className:"opacity-50"})})}),e[3]=l):l=e[3];let i;return e[4]!==n?(i=o.jsxs("div",{className:"flex items-center gap-1",children:[n,l]}),e[4]=n,e[5]=i):i=e[5],i}function Hn(t){const e=h.c(8),{item:s,fallback:a}=t,n=a===void 0?"":a,l=s?.avatarUrl??"",i=s?.name??n;let c;e[0]!==l||e[1]!==i?(c=o.jsx(Ce,{url:l,fallback:i,size:"xs",objectFit:"contain"}),e[0]=l,e[1]=i,e[2]=c):c=e[2];const r=s?.name??n;let d;e[3]!==r?(d=o.jsx("span",{children:r}),e[3]=r,e[4]=d):d=e[4];let m;return e[5]!==c||e[6]!==d?(m=o.jsxs("div",{className:"flex items-center gap-2",children:[c,d]}),e[5]=c,e[6]=d,e[7]=m):m=e[7],m}function Un(t){const e=h.c(6),{children:s,align:a}=t,n=a===void 0?"start":a,i=v.Children.toArray(s).filter(Gn).length===1?"280px":"480px";let c;e[0]!==i?(c={width:i},e[0]=i,e[1]=c):c=e[1];let r;return e[2]!==n||e[3]!==s||e[4]!==c?(r=o.jsx(ks,{align:n,className:"p-0 flex items-start",style:c,children:s}),e[2]=n,e[3]=s,e[4]=c,e[5]=r):r=e[5],r}function Gn(t){return v.isValidElement(t)&&(t.type===Gt||t.type===Ut)}function Ut(t){const e=h.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=z("flex flex-col border-border w-[240px] border-r last:border-r-0 last:w-full",a),e[0]=a,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}const Gt=Ut;function Wn(t){const e=h.c(6),{placeholder:s,value:a,onChange:n}=t,l=s===void 0?"Search...":s;let i;e[0]!==n?(i=r=>n(r.target.value),e[0]=n,e[1]=i):i=e[1];let c;return e[2]!==l||e[3]!==i||e[4]!==a?(c=o.jsx(fs,{placeholder:l,value:a,onChange:i,className:"rounded-none border-t-0 border-x-0 focus-visible:border-border focus-visible:ring-0"}),e[2]=l,e[3]=i,e[4]=a,e[5]=c):c=e[5],c}function Vn(t){const e=h.c(6),{children:s,emptyMessage:a}=t,n=a===void 0?"No items found.":a,l=v.Children.count(s)>0;let i;e[0]!==n||e[1]!==l?(i=!l&&o.jsx("div",{className:"text-muted-foreground text-sm px-1 py-8 text-center",children:n}),e[0]=n,e[1]=l,e[2]=i):i=e[2];let c;return e[3]!==s||e[4]!==i?(c=o.jsxs("div",{className:"flex flex-col gap-0.5 p-1 max-h-44 overflow-y-auto",children:[i,s]}),e[3]=s,e[4]=i,e[5]=c):c=e[5],c}function Fn(t){const e=h.c(15),{item:s,onClick:a,onHover:n,children:l}=t,i=Pn();let c;e[0]!==i||e[1]!==s||e[2]!==n?(c=()=>{i.setHoveredItem(s.slug),n?.(s)},e[0]=i,e[1]=s,e[2]=n,e[3]=c):c=e[3];const r=c;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]!==l||e[8]!==s.avatarUrl||e[9]!==s.name?(m=l||o.jsxs(o.Fragment,{children:[o.jsx(Ce,{url:s.avatarUrl??"",fallback:s.name,size:"xs",className:"w-[22px]! h-[22px]!",objectFit:"contain"}),o.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.name})]}),e[7]=l,e[8]=s.avatarUrl,e[9]=s.name,e[10]=m):m=e[10];let f;return e[11]!==r||e[12]!==d||e[13]!==m?(f=o.jsx(Y,{onClick:d,onMouseEnter:r,variant:"ghost",size:"sm",className:"w-full justify-start font-normal",children:m}),e[11]=r,e[12]=d,e[13]=m,e[14]=f):f=e[14],f}function Kn(t){const e=h.c(2),{children:s}=t;let a;return e[0]!==s?(a=o.jsx("div",{className:"px-1 pb-1 pt-0.5",children:s}),e[0]=s,e[1]=a):a=e[1],a}function Zn(t){const e=h.c(11),{onClick:s,icon:a,children:n,variant:l}=t,c=(l===void 0?"default":l)==="muted"&&"text-muted-foreground";let r;e[0]!==c?(r=z("w-full justify-start font-normal",c),e[0]=c,e[1]=r):r=e[1];let d;e[2]!==a?(d=a&&o.jsx("span",{className:"[&>svg]:size-4",children:a}),e[2]=a,e[3]=d):d=e[3];let m;e[4]!==n?(m=o.jsx("span",{children:n}),e[4]=n,e[5]=m):m=e[5];let f;return e[6]!==s||e[7]!==r||e[8]!==d||e[9]!==m?(f=o.jsxs(Y,{variant:"ghost",size:"sm",className:r,onClick:s,children:[d,m]}),e[6]=s,e[7]=r,e[8]=d,e[9]=m,e[10]=f):f=e[10],f}function Yn(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ln,{}),t[0]=e):e=t[0],e}function qn(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"h-4 w-16 bg-accent rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const D=Object.assign(Dn,{Trigger:Bn,CurrentItem:Hn,Content:Un,Panel:Gt,Search:Wn,Items:Vn,Item:Fn,Actions:Kn,Action:Zn,Separator:Yn,Skeleton:qn});function et(){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}=ht(e),{data:a}=Ne.useListOrganizations(),n=Pe();let l;t[1]!==s||t[2]!==a?(l=a?.find(V=>V.slug===s),t[1]=s,t[2]=a,t[3]=l):l=t[3];const i=l,[c,r]=v.useState(""),[d,m]=v.useState(!1);let f,u,x,p,S,g,b,j;if(t[4]!==i||t[5]!==n||t[6]!==s||t[7]!==c||t[8]!==a){const q=(a?(()=>{const H=a.filter(U=>U.name.toLowerCase().includes(c.toLowerCase()));if(s){const U=H.findIndex(K=>K.slug===s);if(U>0){const K=H[U];K&&(H.splice(U,1),H.unshift(K))}}return H})():[]).map(Xn);let I;t[17]!==i?(I=i?{slug:i.slug,name:i.name,avatarUrl:i.logo}:void 0,t[17]=i,t[18]=I):I=t[18];const W=I;p=D;let O;t[19]!==n||t[20]!==s?(O=()=>n({to:"/$org",params:{org:s??""}}),t[19]=n,t[20]=s,t[21]=O):O=t[21];let L;t[22]!==W?(L=o.jsx(D.CurrentItem,{item:W}),t[22]=W,t[23]=L):L=t[23],t[24]!==O||t[25]!==L?(j=o.jsx(D.Trigger,{onClick:O,children:L}),t[24]=O,t[25]=L,t[26]=j):j=t[26],x=D.Content,u=D.Panel,t[27]!==c?(b=o.jsx(D.Search,{placeholder:"Search organizations...",value:c,onChange:r}),t[27]=c,t[28]=b):b=t[28],f=D.Items,S="No organizations found.";let P;t[29]!==n?(P=H=>o.jsx(D.Item,{item:H,onClick:U=>n({to:"/$org",params:{org:U.slug}})},H.slug),t[29]=n,t[30]=P):P=t[30],g=q.map(P),t[4]=i,t[5]=n,t[6]=s,t[7]=c,t[8]=a,t[9]=f,t[10]=u,t[11]=x,t[12]=p,t[13]=S,t[14]=g,t[15]=b,t[16]=j}else f=t[9],u=t[10],x=t[11],p=t[12],S=t[13],g=t[14],b=t[15],j=t[16];let _;t[31]!==f||t[32]!==S||t[33]!==g?(_=o.jsx(f,{emptyMessage:S,children:g}),t[31]=f,t[32]=S,t[33]=g,t[34]=_):_=t[34];let C,y;t[35]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(D.Actions,{children:o.jsx(D.Action,{onClick:()=>m(!0),variant:"muted",children:"+ Create organization"})}),y=o.jsx(D.Separator,{}),t[35]=C,t[36]=y):(C=t[35],y=t[36]);let w;t[37]!==n?(w=()=>n({to:"/"}),t[37]=n,t[38]=w):w=t[38];let k;t[39]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(Is,{}),t[39]=k):k=t[39];let M;t[40]!==w?(M=o.jsx(D.Actions,{children:o.jsx(D.Action,{onClick:w,icon:k,children:"See all organizations"})}),t[40]=w,t[41]=M):M=t[41];let $;t[42]!==u||t[43]!==M||t[44]!==b||t[45]!==_?($=o.jsxs(u,{children:[b,_,C,y,M]}),t[42]=u,t[43]=M,t[44]=b,t[45]=_,t[46]=$):$=t[46];let N;t[47]!==x||t[48]!==$?(N=o.jsx(x,{children:$}),t[47]=x,t[48]=$,t[49]=N):N=t[49];let T;t[50]!==p||t[51]!==N||t[52]!==j?(T=o.jsxs(p,{children:[j,N]}),t[50]=p,t[51]=N,t[52]=j,t[53]=T):T=t[53];let R;t[54]!==d?(R=o.jsx(Ns,{open:d,onOpenChange:m}),t[54]=d,t[55]=R):R=t[55];let B;return t[56]!==T||t[57]!==R?(B=o.jsxs(o.Fragment,{children:[T,R]}),t[56]=T,t[57]=R,t[58]=B):B=t[58],B}function Xn(t){return{slug:t.slug,name:t.name,avatarUrl:t.logo}}et.Skeleton=D.Skeleton;const Wt=v.createContext({setOpen:()=>{}}),Jn=()=>v.useContext(Wt),Qn=t=>{const e=h.c(25);let s,a,n,l,i;e[0]!==t?({children:s,defaultOpen:a,open:l,onOpenChange:n,...i}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=n,e[4]=l,e[5]=i):(s=e[1],a=e[2],n=e[3],l=e[4],i=e[5]);const c=a??!1;let r;e[6]!==n||e[7]!==l||e[8]!==c?(r={prop:l,defaultProp:c,onChange:n},e[6]=n,e[7]=l,e[8]=c,e[9]=r):r=e[9];const[d,m]=Os(r);let f;e[10]!==m?(f={setOpen:m},e[10]=m,e[11]=f):f=e[11];let u;e[12]!==s||e[13]!==d||e[14]!==i||e[15]!==m?(u=o.jsx(As,{open:d,onOpenChange:m,...i,children:s}),e[12]=s,e[13]=d,e[14]=i,e[15]=m,e[16]=u):u=e[16];let x;e[17]!==d||e[18]!==i||e[19]!==m||e[20]!==u?(x=o.jsx(Gs,{open:d,onOpenChange:m,...i,children:u}),e[17]=d,e[18]=i,e[19]=m,e[20]=u,e[21]=x):x=e[21];let p;return e[22]!==f||e[23]!==x?(p=o.jsx(Wt.Provider,{value:f,children:x}),e[22]=f,e[23]=x,e[24]=p):p=e[24],p},ea=t=>{const{children:e,title:s,...a}=t,n=ye(),{className:l,...i}=a;return n?o.jsxs(Ms,{...i,children:[o.jsx(zs,{className:"hidden",children:o.jsx(Ts,{children:s})}),o.jsx("div",{className:z("flex flex-col gap-2 p-2 py-4",l),children:e})]}):o.jsx(Us,{...a,children:e})},ta=t=>{const{children:e,...s}=t,{setOpen:a}=Jn(),n=ye(),{className:l,...i}=s;return n?o.jsx("div",{...i,onClick:c=>{a(!1);const{onClick:r}=i;r?.(c)},className:z("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",l),children:e}):o.jsx(Ws,{...s,children:e})},sa=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 n=ye();let l;return e[3]!==s||e[4]!==n||e[5]!==a?(l=n?o.jsx($s,{asChild:!0,children:s}):o.jsx(Hs,{...a,children:s}),e[3]=s,e[4]=n,e[5]=a,e[6]=l):l=e[6],l},na=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 n=ye();let l;return e[3]!==s||e[4]!==n||e[5]!==a?(l=n?o.jsx(rt,{className:z(s),...a}):o.jsx(rt,{className:z(s),...a}),e[3]=s,e[4]=n,e[5]=a,e[6]=l):l=e[6],l};function aa(t){const e=h.c(11),{user:s,trigger:a,align:n,children:l}=t,i=n===void 0?"start":n;let c;e[0]!==a||e[1]!==s?(c=a(s),e[0]=a,e[1]=s,e[2]=c):c=e[2];let r;e[3]!==c?(r=o.jsx(sa,{asChild:!0,children:o.jsx("div",{children:c})}),e[3]=c,e[4]=r):r=e[4];let d;e[5]!==i||e[6]!==l?(d=o.jsx(ea,{side:"top",align:i,className:"md:w-[240px]",children:l}),e[5]=i,e[6]=l,e[7]=d):d=e[7];let m;return e[8]!==r||e[9]!==d?(m=o.jsxs(Qn,{children:[r,d]}),e[8]=r,e[9]=d,e[10]=m):m=e[10],m}function oa(t){const e=h.c(8),{children:s,onClick:a,className:n,asChild:l}=t;let i;e[0]!==l||e[1]!==s||e[2]!==a?(i=l?s:o.jsx("button",{type:"button",className:"flex items-center gap-2 text-sm w-full cursor-pointer",onClick:a,children:s}),e[0]=l,e[1]=s,e[2]=a,e[3]=i):i=e[3];let c;return e[4]!==l||e[5]!==n||e[6]!==i?(c=o.jsx(ta,{asChild:l,className:n,children:i}),e[4]=l,e[5]=n,e[6]=i,e[7]=c):c=e[7],c}function la(t){const e=h.c(2),{className:s}=t;let a;return e[0]!==s?(a=o.jsx(na,{className:s}),e[0]=s,e[1]=a):a=e[1],a}function ia(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const Z=Object.assign(aa,{Item:oa,Separator:la,Skeleton:ia});function ra(t){const e=h.c(32),{open:s,onOpenChange:a,user:n,userImage:l}=t,[i,c]=v.useState(!1);let r;e[0]!==n.id?(r=()=>{navigator.clipboard.writeText(n.id),c(!0),setTimeout(()=>c(!1),2e3)},e[0]=n.id,e[1]=r):r=e[1];const d=r;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs(bt,{children:[o.jsx(jt,{children:"Profile"}),o.jsx(vt,{children:"Your account information"})]}),e[2]=m):m=e[2];const f=n.name||n.email||"U";let u;e[3]!==f||e[4]!==l?(u=o.jsx(Ce,{url:l,fallback:f,shape:"circle",size:"2xl"}),e[3]=f,e[4]=l,e[5]=u):u=e[5];const x=n.name||n.email;let p;e[6]!==x?(p=o.jsx("div",{className:"text-lg font-semibold text-center",children:x}),e[6]=x,e[7]=p):p=e[7];let S;e[8]!==n.email?(S=o.jsx("div",{className:"text-sm text-muted-foreground text-center",children:n.email}),e[8]=n.email,e[9]=S):S=e[9];let g;e[10]!==p||e[11]!==S?(g=o.jsxs("div",{className:"flex flex-col items-center gap-2 w-full",children:[p,S]}),e[10]=p,e[11]=S,e[12]=g):g=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"User ID"}),e[13]=b):b=e[13];let j;e[14]!==n.id?(j=o.jsxs("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[b,o.jsx("span",{className:"text-sm font-mono truncate",children:n.id})]}),e[14]=n.id,e[15]=j):j=e[15];let _;e[16]!==i?(_=i?o.jsx(gs,{size:16,className:"text-green-600"}):o.jsx(Vs,{size:16,className:"text-muted-foreground"}),e[16]=i,e[17]=_):_=e[17];let C;e[18]!==d||e[19]!==_?(C=o.jsx("button",{type:"button",onClick:d,className:"flex-shrink-0 p-2 hover:bg-background rounded-md transition-colors","aria-label":"Copy user ID",children:_}),e[18]=d,e[19]=_,e[20]=C):C=e[20];let y;e[21]!==j||e[22]!==C?(y=o.jsxs("div",{className:"flex items-center justify-between gap-3 w-full px-4 py-3 rounded-lg bg-muted/50 border border-border",children:[j,C]}),e[21]=j,e[22]=C,e[23]=y):y=e[23];let w;e[24]!==y||e[25]!==u||e[26]!==g?(w=o.jsxs(St,{className:"sm:max-w-md",children:[m,o.jsxs("div",{className:"flex flex-col items-center gap-6 py-4",children:[u,g,y]})]}),e[24]=y,e[25]=u,e[26]=g,e[27]=w):w=e[27];let k;return e[28]!==a||e[29]!==s||e[30]!==w?(k=o.jsx(wt,{open:s,onOpenChange:a,children:w}),e[28]=a,e[29]=s,e[30]=w,e[31]=k):k=e[31],k}function ca(t){const e=h.c(5),{open:s,onOpenChange:a}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsxs(bt,{children:[o.jsx(jt,{children:"Invitations"}),o.jsx(vt,{children:"Your pending organization invitations"})]}),e[0]=n):n=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsxs(St,{className:"sm:max-w-lg",children:[n,o.jsx("div",{className:"max-h-[420px] overflow-auto pr-1",children:o.jsx(as,{})})]}),e[1]=l):l=e[1];let i;return e[2]!==a||e[3]!==s?(i=o.jsx(wt,{open:s,onOpenChange:a,children:l}),e[2]=a,e[3]=s,e[4]=i):i=e[4],i}function da(t){const e=h.c(31),{user:s,userImage:a,hasInvites:n,showInvitesItem:l}=t,[i,c]=v.useState(!1),[r,d]=v.useState(!1);let m;e[0]!==n||e[1]!==s.email||e[2]!==s.name||e[3]!==a?(m=()=>o.jsxs("div",{className:"relative",children:[o.jsx(Ce,{url:a,fallback:s.name||s.email||"U",shape:"circle",size:"sm",className:"cursor-pointer hover:ring-2 ring-muted-foreground transition-all"}),n&&o.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full bg-destructive ring-2 ring-background"})]}),e[0]=n,e[1]=s.email,e[2]=s.name,e[3]=a,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsxs(Z.Item,{onClick:()=>c(!0),children:[o.jsx(Ot,{className:"text-muted-foreground",size:18}),"Profile"]}),e[5]=f):f=e[5];let u;e[6]!==n||e[7]!==l?(u=l&&o.jsxs(Z.Item,{onClick:()=>d(!0),children:[o.jsx(zt,{className:"text-muted-foreground",size:18}),"Invitations",n&&o.jsx("span",{className:"ml-auto h-2 w-2 rounded-full bg-destructive"})]}),e[6]=n,e[7]=l,e[8]=u):u=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Z.Separator,{}),e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(ns,{className:"w-4 h-4 text-muted-foreground"}),e[10]=p):p=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Z.Item,{asChild:!0,children:o.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:[p,"decocms/admin",o.jsx(ct,{size:18,className:"text-muted-foreground ml-auto"})]})}),e[11]=S):S=e[11];let g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(kt,{className:"text-muted-foreground",size:18}),e[12]=g):g=e[12];let b,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(Z.Item,{asChild:!0,children:o.jsxs("a",{href:"https://decocms.com",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[g,"Homepage",o.jsx(ct,{size:18,className:"ml-auto text-muted-foreground"})]})}),j=o.jsx(Z.Separator,{}),e[13]=b,e[14]=j):(b=e[13],j=e[14]);let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsxs(Z.Item,{onClick:ma,children:[o.jsx(Mt,{size:18,className:"text-muted-foreground"}),"Log out"]}),e[15]=_):_=e[15];let C;e[16]!==m||e[17]!==u||e[18]!==s?(C=o.jsxs(Z,{user:s,trigger:m,align:"end",children:[f,u,x,S,b,j,_]}),e[16]=m,e[17]=u,e[18]=s,e[19]=C):C=e[19];let y;e[20]!==i||e[21]!==s||e[22]!==a?(y=i&&o.jsx(ra,{open:i,onOpenChange:c,user:s,userImage:a}),e[20]=i,e[21]=s,e[22]=a,e[23]=y):y=e[23];let w;e[24]!==r||e[25]!==l?(w=l&&r&&o.jsx(ca,{open:r,onOpenChange:d}),e[24]=r,e[25]=l,e[26]=w):w=e[26];let k;return e[27]!==C||e[28]!==y||e[29]!==w?(k=o.jsxs(o.Fragment,{children:[C,y,w]}),e[27]=C,e[28]=y,e[29]=w,e[30]=k):k=e[30],k}function ma(){return Ne.signOut()}function fa(){const{data:t}=Ne.useSession(),e=v.useContext(ss),{data:s}=e.hooks.useListUserInvitations(),n=(s??[]).length>0;if(!t?.user)return o.jsx(Ce,{url:void 0,fallback:"U",shape:"circle",size:"sm",className:"cursor-pointer",muted:!0});const l=t.user,i={...l,name:l.name??void 0},c=l.image;return o.jsx(da,{user:i,userImage:c,hasInvites:n,showInvitesItem:!0})}function nt(){const t=h.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=He.decoChatOpen(),t[0]=e):e=t[0];const[s,a]=Be(e,ua);let n;return t[1]!==s||t[2]!==a?(n=[s,a],t[1]=s,t[2]=a,t[3]=n):n=t[3],n}function ua(t){return!!(t??!1)}function ha(t){const e=h.c(6),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx(os,{children:o.jsx(pt,{})}),e[0]=a):a=e[0];let n;e[1]!==s?(n=o.jsx(ls,{children:s}),e[1]=s,e[2]=n):n=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(is,{children:o.jsx(rs,{to:"/login",replace:!0})}),e[3]=l):l=e[3];let i;return e[4]!==n?(i=o.jsxs(o.Fragment,{children:[a,n,l]}),e[4]=n,e[5]=i):i=e[5],i}function pa(t){const e=h.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=z("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]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function xa(t){const e=h.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=z("flex items-center justify-center px-2 h-full border-r border-border",a),e[0]=a,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function ga(t){const e=h.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=z("flex items-center gap-2 px-2 h-full",a),e[0]=a,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function ba(t){const e=h.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=z("flex items-center gap-2 px-2 h-full flex-1",a),e[0]=a,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function ja(t){const e=h.c(5),{children:s,className:a}=t;let n;e[0]!==a?(n=z("flex items-center gap-2 px-2 h-full ml-auto",a),e[0]=a,e[1]=n):n=e[1];let l;return e[2]!==s||e[3]!==n?(l=o.jsx("div",{className:n,children:s}),e[2]=s,e[3]=n,e[4]=l):l=e[4],l}function va(){const t=h.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center px-2 h-full border-r border-border",children:o.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=o.jsx("div",{className:"flex items-center gap-2 px-2 h-full",children:o.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=o.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,o.jsx("div",{className:"flex items-center gap-2 px-2 h-full ml-auto",children:o.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"})})]}),t[2]=a):a=t[2],a}const Re=Object.assign(pa,{Sidebar:xa,Left:ga,Center:ba,Right:ja,Skeleton:va});function Vt(){const t=h.c(3),{toggleSidebar:e}=st();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx($t,{className:"text-muted-foreground/85 group-hover:text-foreground transition-colors",size:20}),t[0]=s):s=t[0];let a;return t[1]!==e?(a=o.jsx(o.Fragment,{children:o.jsx(Y,{onClick:e,size:"icon",variant:"ghost",className:"w-8 h-8 rounded-md",children:s})}),t[1]=e,t[2]=a):a=t[2],a}Vt.Skeleton=function(){return o.jsx("div",{className:"w-8 h-8 bg-muted rounded-md animate-pulse"})};function Sa(t,e){return t.find(e)??t[0]}function mt(t,e,s,a){const n=h.c(9),l=null,[i,c]=Be(t,l);let r;n[0]!==s||n[1]!==i?(r=u=>i!==null?s(u,i):!1,n[0]=s,n[1]=i,n[2]=r):r=n[2];let d;n[3]!==e||n[4]!==r?(d=Sa(e,r),n[3]=e,n[4]=r,n[5]=d):d=n[5];const m=d;let f;return n[6]!==m||n[7]!==c?(f=[m,c],n[6]=m,n[7]=c,n[8]=f):f=n[8],f}const wa="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function Ca(){const t=h.c(137),{org:e,locator:s}=De(),{slug:a,id:n}=e,[,l]=nt(),i=Pe(),{data:c}=Ne.useSession(),r=c?.user,{createThread:d,activeThreadId:m,setActiveThreadId:f,hideThread:u}=it(),{threads:x,refetch:p}=Es(),S=Rs(),g=Ls(),b=ws();let j;t[0]!==b?(j={connections:b,binding:"LLMS"},t[0]=b,t[1]=j):j=t[1];const[_]=nn(j),C=!!_,y=S.length>0,w=C&&y;let k;t[2]!==s?(k=He.chatSelectedModel(s),t[2]=s,t[3]=k):k=t[3];const[M,$]=mt(k,g,ya),[N,T]=mt(`${s}:selected-gateway`,S,Na),R=Fs(N?.id),B=Ks();let V;t[4]!==d||t[5]!==N?.id?(V=A=>d({id:A.id,title:A.title,gatewayId:N?.id}),t[4]=d,t[5]=N?.id,t[6]=V):V=t[6];let q;t[7]!==m||t[8]!==B||t[9]!==R||t[10]!==V?(q={threadId:m,systemPrompt:R,onToolCall:B,onCreateThread:V},t[7]=m,t[8]=B,t[9]=R,t[10]=V,t[11]=q):q=t[11];const I=Zs(q),{inputValue:W,setInputValue:O,branchContext:L,clearBranch:P}=it(),{isEmpty:H}=I;let U;t[12]!==L||t[13]!==P||t[14]!==f||t[15]!==O?(U=()=>{L&&(f(L.originalThreadId),P(),O(""))},t[12]=L,t[13]=P,t[14]=f,t[15]=O,t[16]=U):U=t[16];const K=U;let _e;t[17]!==m||t[18]!==I||t[19]!==P||t[20]!==N||t[21]!==M||t[22]!==O||t[23]!==r?.image||t[24]!==r?.name?(_e=async A=>{if(!M){at.error("No model configured");return}if(!N?.id){at.error("No Agent configured");return}O(""),P();const F={created_at:new Date().toISOString(),thread_id:m,model:{id:M.id,connectionId:M.connectionId,provider:M.provider??void 0,limits:M.limits??void 0},gateway:{id:N.id},user:{avatar:r?.image??void 0,name:r?.name??"you"}};await I.sendMessage(A,F)},t[17]=m,t[18]=I,t[19]=P,t[20]=N,t[21]=M,t[22]=O,t[23]=r?.image,t[24]=r?.name,t[25]=_e):_e=t[25];const G=_e;let ke;t[26]!==$?(ke=A=>{$(A)},t[26]=$,t[27]=ke):ke=t[27];const Ge=ke;let Ie;t[28]!==T?(Ie=A=>{T({gatewayId:A})},t[28]=T,t[29]=Ie):Ie=t[29];const We=Ie;if(!w){let A,F;!C&&!y?(A="Connect your providers",F="Connect an LLM provider and create an Agent to unlock AI-powered features."):C?(A="No Agents configured",F="Create an Agent to expose your MCP tools to the chat."):(A="No model provider connected",F="Connect to a model provider to unlock AI-powered features.");let Oe;t[30]===Symbol.for("react.memo_cache_sentinel")?(Oe=o.jsxs(E.Header.Left,{children:[o.jsx("img",{src:wa,alt:"deco chat",className:"size-5 rounded"}),o.jsx("span",{className:"text-sm font-medium",children:"deco chat"})]}),t[30]=Oe):Oe=t[30];let ve;t[31]!==l?(ve=()=>l(!1),t[31]=l,t[32]=ve):ve=t[32];let Ae;t[33]===Symbol.for("react.memo_cache_sentinel")?(Ae=o.jsx(Le,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[33]=Ae):Ae=t[33];let Se;t[34]!==ve?(Se=o.jsxs(E.Header,{children:[Oe,o.jsx(E.Header.Right,{children:o.jsx("button",{type:"button",onClick:ve,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:Ae})})]}),t[34]=ve,t[35]=Se):Se=t[35];let we;t[36]!==b||t[37]!==F||t[38]!==C||t[39]!==i||t[40]!==n||t[41]!==a||t[42]!==A||t[43]!==r?.id?(we=o.jsx(E.Main,{className:"flex flex-col items-center",children:o.jsx(E.EmptyState,{children:C?o.jsx(Cs,{title:A,description:F,actions:o.jsx(Y,{variant:"outline",onClick:()=>i({to:"/$org/mcps",params:{org:a},search:{action:"create"}}),children:"Custom Connection"})}):o.jsx(Ys,{title:A,description:F,orgSlug:a,orgId:n,userId:r?.id??"",allConnections:b,onInstallMcpServer:()=>i({to:"/$org/mcps",params:{org:a},search:{action:"create"}})})})}),t[36]=b,t[37]=F,t[38]=C,t[39]=i,t[40]=n,t[41]=a,t[42]=A,t[43]=r?.id,t[44]=we):we=t[44];let Ee;return t[45]!==Se||t[46]!==we?(Ee=o.jsxs(E,{children:[Se,we]}),t[45]=Se,t[46]=we,t[47]=Ee):Ee=t[47],Ee}const Ve=N?.icon,Fe=N?.title||"deco chat";let $e;t[48]===Symbol.for("react.memo_cache_sentinel")?($e=o.jsx(Qe,{size:12}),t[48]=$e):$e=t[48];let X;t[49]!==Fe||t[50]!==Ve?(X=o.jsx(lt,{icon:Ve,name:Fe,size:"xs",fallbackIcon:$e}),t[49]=Fe,t[50]=Ve,t[51]=X):X=t[51];const Ke=N?.title||"deco chat";let J;t[52]!==Ke?(J=o.jsx("span",{className:"text-sm font-medium",children:Ke}),t[52]=Ke,t[53]=J):J=t[53];let Q;t[54]!==X||t[55]!==J?(Q=o.jsxs(E.Header.Left,{children:[X,J]}),t[54]=X,t[55]=J,t[56]=Q):Q=t[56];let ee;t[57]!==d?(ee=()=>d(),t[57]=d,t[58]=ee):ee=t[58];let Me;t[59]===Symbol.for("react.memo_cache_sentinel")?(Me=o.jsx(sn,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[59]=Me):Me=t[59];let te;t[60]!==ee?(te=o.jsx("button",{type:"button",onClick:ee,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"New chat",children:Me}),t[60]=ee,t[61]=te):te=t[61];let se;t[62]!==p?(se=()=>p(),t[62]=p,t[63]=se):se=t[63];let ne;t[64]!==m||t[65]!==u||t[66]!==f||t[67]!==se||t[68]!==x?(ne=o.jsx(Xs,{threads:x,activeThreadId:m,onSelectThread:f,onRemoveThread:u,onOpen:se}),t[64]=m,t[65]=u,t[66]=f,t[67]=se,t[68]=x,t[69]=ne):ne=t[69];let ae;t[70]!==l?(ae=()=>l(!1),t[70]=l,t[71]=ae):ae=t[71];let ze;t[72]===Symbol.for("react.memo_cache_sentinel")?(ze=o.jsx(Le,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[72]=ze):ze=t[72];let oe;t[73]!==ae?(oe=o.jsx("button",{type:"button",onClick:ae,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:ze}),t[73]=ae,t[74]=oe):oe=t[74];let le;t[75]!==te||t[76]!==ne||t[77]!==oe?(le=o.jsxs(E.Header.Right,{children:[te,ne,oe]}),t[75]=te,t[76]=ne,t[77]=oe,t[78]=le):le=t[78];let ie;t[79]!==Q||t[80]!==le?(ie=o.jsxs(E.Header,{children:[Q,le]}),t[79]=Q,t[80]=le,t[81]=ie):ie=t[81];let re;t[82]!==I.messages||t[83]!==I.status||t[84]!==G||t[85]!==H||t[86]!==N?(re=o.jsx(E.Main,{children:H?o.jsx(E.EmptyState,{children:o.jsxs("div",{className:"flex flex-col items-center gap-6 w-full px-4",children:[o.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-0 text-center",children:[o.jsx(lt,{icon:N?.icon,name:N?.title||"deco chat",size:"lg",fallbackIcon:o.jsx(Qe,{size:32}),className:"size-[60px]! rounded-[18px]!"}),o.jsx("h3",{className:"text-xl font-medium text-foreground",children:N?.title||"Ask deco chat"}),o.jsx("div",{className:"text-muted-foreground text-center text-sm max-w-md",children:N?.description??"Ask anything about configuring model providers or using MCP Mesh."})]}),N?.id&&o.jsx(tt,{fallback:null,children:o.jsx(v.Suspense,{fallback:o.jsx("div",{className:"flex justify-center",children:o.jsx(tn,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(qs,{gatewayId:N.id,onSelect:A=>{G(A.description??A.name)}})})},N.id)]})}):o.jsx(E.Messages,{messages:I.messages,status:I.status,minHeightOffset:240})}),t[82]=I.messages,t[83]=I.status,t[84]=G,t[85]=H,t[86]=N,t[87]=re):re=t[87];let ce;t[88]!==I.error||t[89]!==G?(ce=()=>{I.error&&G(`I encountered this error: ${I.error.message}. Can you help me fix it?`)},t[88]=I.error,t[89]=G,t[90]=ce):ce=t[90];let de;t[91]!==I.clearError||t[92]!==I.error||t[93]!==ce?(de=o.jsx(E.ErrorBanner,{error:I.error,onFixInChat:ce,onDismiss:I.clearError}),t[91]=I.clearError,t[92]=I.error,t[93]=ce,t[94]=de):de=t[94];let me;t[95]!==G?(me=()=>{G("Please continue.")},t[95]=G,t[96]=me):me=t[96];let fe;t[97]!==I.clearFinishReason||t[98]!==I.finishReason||t[99]!==me?(fe=o.jsx(E.FinishReasonWarning,{finishReason:I.finishReason,onContinue:me,onDismiss:I.clearFinishReason}),t[97]=I.clearFinishReason,t[98]=I.finishReason,t[99]=me,t[100]=fe):fe=t[100];let ue;t[101]!==L||t[102]!==P||t[103]!==K||t[104]!==O?(ue=o.jsx(E.BranchPreview,{branchContext:L,clearBranchContext:P,onGoToOriginalMessage:K,setInputValue:O}),t[101]=L,t[102]=P,t[103]=K,t[104]=O,t[105]=ue):ue=t[105];let he;t[106]!==G||t[107]!==W?(he=async()=>{W.trim()&&await G(W.trim())},t[106]=G,t[107]=W,t[108]=he):he=t[108];const Ze=!M||!N?.id,Ye=I.status==="submitted"||I.status==="streaming",qe=M?"Ask anything or @ for context":"Select a model to start chatting",Xe=N?.id;let pe;t[109]!==We||t[110]!==Xe?(pe=o.jsx(Ds,{selectedGatewayId:Xe,onGatewayChange:We,placeholder:"Agent",variant:"borderless"}),t[109]=We,t[110]=Xe,t[111]=pe):pe=t[111];const Je=M??void 0;let xe;t[112]!==Ge||t[113]!==Je?(xe=o.jsx(Bs,{selectedModel:Je,onModelChange:Ge,placeholder:"Model",variant:"borderless"}),t[112]=Ge,t[113]=Je,t[114]=xe):xe=t[114];let ge;t[115]!==I.messages?(ge=o.jsx(Ps,{messages:I.messages}),t[115]=I.messages,t[116]=ge):ge=t[116];let be;t[117]!==I.stop||t[118]!==W||t[119]!==O||t[120]!==he||t[121]!==Ze||t[122]!==Ye||t[123]!==qe||t[124]!==pe||t[125]!==xe||t[126]!==ge?(be=o.jsxs(E.Input,{value:W,onChange:O,onSubmit:he,onStop:I.stop,disabled:Ze,isStreaming:Ye,placeholder:qe,children:[pe,xe,ge]}),t[117]=I.stop,t[118]=W,t[119]=O,t[120]=he,t[121]=Ze,t[122]=Ye,t[123]=qe,t[124]=pe,t[125]=xe,t[126]=ge,t[127]=be):be=t[127];let je;t[128]!==de||t[129]!==fe||t[130]!==ue||t[131]!==be?(je=o.jsx(E.Footer,{children:o.jsxs("div",{className:"flex flex-col gap-2",children:[de,fe,ue,be]})}),t[128]=de,t[129]=fe,t[130]=ue,t[131]=be,t[132]=je):je=t[132];let Te;return t[133]!==ie||t[134]!==re||t[135]!==je?(Te=o.jsxs(E,{children:[ie,re,je]}),t[133]=ie,t[134]=re,t[135]=je,t[136]=Te):Te=t[136],Te}function Na(t,e){return t.id===e.gatewayId}function ya(t,e){return t.id===e.id&&t.connectionId===e.connectionId}function _a(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(E.Provider,{children:o.jsx(Ca,{})}),t[0]=e):e=t[0],e}const ka="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function ft({showSidebarToggle:t=!1,showOrgSwitcher:e=!1,showDecoChat:s=!1,disableDecoChat:a=!1}){const[n,l]=nt(),i=v.useRef(a);a&&n&&i.current!==a&&l(!1),i.current=a;const c=()=>{a||l(r=>!r)};return o.jsxs(Re,{children:[t&&o.jsx(Re.Sidebar,{children:o.jsx(Vt,{})}),o.jsx(Re.Left,{children:e&&o.jsx(v.Suspense,{fallback:o.jsx(et.Skeleton,{}),children:o.jsx(et,{})})}),o.jsxs(Re.Right,{className:"gap-2",children:[s&&!a&&o.jsxs(Y,{size:"sm",variant:"default",onClick:c,children:[o.jsx(Ce,{url:ka,fallback:"DC",size:"2xs",className:"rounded-sm"}),"deco chat"]}),o.jsx(fa,{})]})]})}function Ia(t){const e=h.c(10),{children:s,className:a}=t,[,n]=v.useTransition();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=He.decoChatPanelWidth(),e[0]=l):l=e[0];const[i,c]=Be(l,30);let r;e[1]!==c?(r=u=>n(()=>c(u)),e[1]=c,e[2]=r):r=e[2];const d=r;let m;e[3]!==a?(m=z("min-w-0",a),e[3]=a,e[4]=m):m=e[4];let f;return e[5]!==i||e[6]!==s||e[7]!==d||e[8]!==m?(f=o.jsx(Ct,{defaultSize:i,minSize:20,className:m,onResize:d,children:s}),e[5]=i,e[6]=s,e[7]=d,e[8]=m,e[9]=f):f=e[9],f}function $a(t){const e=h.c(5),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=He.sidebarOpen(),e[0]=a):a=e[0];const[n,l]=Be(a,!0);let i;return e[1]!==s||e[2]!==l||e[3]!==n?(i=o.jsx(bn,{open:n,onOpenChange:l,children:s}),e[1]=s,e[2]=l,e[3]=n,e[4]=i):i=e[4],i}function Ma(t){const e=h.c(10),{disableChat:s}=t,a=s===void 0?!1:s,[n]=nt(),l=n&&!a;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Ct,{className:"bg-background",children:o.jsx(xt,{})}),e[0]=i):i=e[0];let c;e[1]!==a||e[2]!==l?(c=!a&&o.jsx(Qs,{withHandle:l}),e[1]=a,e[2]=l,e[3]=c):c=e[3];const r=l?"max-w-none":"max-w-0";let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(tt,{children:o.jsx(v.Suspense,{fallback:o.jsx(Js,{}),children:o.jsx(_a,{})})}),e[4]=d):d=e[4];let m;e[5]!==r?(m=o.jsx(Ia,{className:r,children:d}),e[5]=r,e[6]=m):m=e[6];let f;return e[7]!==c||e[8]!==m?(f=o.jsxs(en,{direction:"horizontal",children:[i,c,m]}),e[7]=c,e[8]=m,e[9]=f):f=e[9],f}function za(){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}=ht(e),a=ut(),n=a.location.pathname===`/${s}`||a.location.pathname===`/${s}/`;let l;t[1]!==s?(l=ds.activeOrganization(s),t[1]=s,t[2]=l):l=t[2];let i;t[3]!==s?(i=async()=>{if(!s)return null;const{data:S}=await Ne.organization.setActive({organizationSlug:s});return{org:S,project:{slug:js}}},t[3]=s,t[4]=i):i=t[4];let c;t[5]!==l||t[6]!==i?(c={queryKey:l,queryFn:i,gcTime:1/0,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1},t[5]=l,t[6]=i,t[7]=c):c=t[7];const{data:r}=cs(c);if(!r){let S;t[8]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(ft,{}),t[8]=S):S=t[8];let g;return t[9]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsxs("div",{className:"min-h-screen bg-background",children:[S,o.jsx("div",{className:"pt-12",children:o.jsx(xt,{})})]}),t[9]=g):g=t[9],g}let d;t[10]!==n?(d=o.jsx(ft,{showSidebarToggle:!0,showOrgSwitcher:!0,showDecoChat:!0,disableDecoChat:n}),t[10]=n,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=o.jsx(Rn,{}),t[13]=f):f=t[13];let u;t[14]!==n?(u=o.jsxs(Sn,{className:"flex-1 bg-sidebar",style:m,children:[f,o.jsx(Cn,{className:"pt-12",children:o.jsx(Ma,{disableChat:n})})]}),t[14]=n,t[15]=u):u=t[15];let x;t[16]!==d||t[17]!==u?(x=o.jsx($a,{children:o.jsxs("div",{className:"flex flex-col h-screen",children:[d,u]})}),t[16]=d,t[17]=u,t[18]=x):x=t[18];let p;return t[19]!==r||t[20]!==x?(p=o.jsx(bs,{...r,children:x}),t[19]=r,t[20]=x,t[21]=p):p=t[21],p}function So(){const t=h.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(ha,{children:o.jsx(v.Suspense,{fallback:o.jsx(pt,{}),children:o.jsx(za,{})})}),t[0]=e):e=t[0],e}export{So as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as j,c as B,j as t,ad as X,ae as I,ab as $,aj as _,ag as G,aT as J,aU as K}from"./index-C4Akli_y.js";import{I as z,u as Y}from"./use-connection-DRGfApkr.js";import{C as F}from"./checkbox-BS_G5ImZ.js";import{c as S,B as Z}from"./input-DotiBI6p.js";import{i as ee}from"./ArrowLeft-YNVHoaqm.js";import{C as te}from"./collection-search-BxG7OTzn.js";const se=j.memo(function(o){const e=B.c(21),{connection:n,isSelected:r,hasToolsEnabled:c,activeToolsCount:i,totalToolsCount:x,onSelect:b,onToggle:g}=o,d=r?"bg-accent/50":"hover:bg-muted/50";let u;e[0]!==d?(u=S("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",d),e[0]=d,e[1]=u):u=e[1];let m;e[2]!==n.icon||e[3]!==n.title?(m=t.jsx(z,{icon:n.icon,name:n.title,size:"xs"}),e[2]=n.icon,e[3]=n.title,e[4]=m):m=e[4];let p;e[5]!==n.title?(p=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title})}),e[5]=n.title,e[6]=p):p=e[6];let a;e[7]!==b||e[8]!==m||e[9]!==p?(a=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:b,children:[m,p]}),e[7]=b,e[8]=m,e[9]=p,e[10]=a):a=e[10];let f;e[11]!==i||e[12]!==n.tools||e[13]!==c||e[14]!==g||e[15]!==x?(f=n.tools&&n.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[i,"/",x]}),t.jsx(F,{checked:c,onCheckedChange:g,onClick:ne})]}),e[11]=i,e[12]=n.tools,e[13]=c,e[14]=g,e[15]=x,e[16]=f):f=e[16];let C;return e[17]!==u||e[18]!==a||e[19]!==f?(C=t.jsxs("div",{className:u,children:[a,f]}),e[17]=u,e[18]=a,e[19]=f,e[20]=C):C=e[20],C}),oe=j.memo(function(o){const e=B.c(18),{connectionId:n,tool:r,isSelected:c,onToggle:i}=o,x=`tool-${n}-${r.name}`,b=c?"text-foreground":"text-muted-foreground";let g;e[0]!==b?(g=S("text-sm font-medium",b),e[0]=b,e[1]=g):g=e[1];let d;e[2]!==g||e[3]!==r.name?(d=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:g,children:r.name})}),e[2]=g,e[3]=r.name,e[4]=d):d=e[4];let u;e[5]!==r.description?(u=r.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:r.description}),e[5]=r.description,e[6]=u):u=e[6];let m;e[7]!==d||e[8]!==u?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),e[7]=d,e[8]=u,e[9]=m):m=e[9];const p=`tool-${n}-${r.name}`;let a;e[10]!==c||e[11]!==i||e[12]!==p?(a=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(F,{id:p,checked:c,onCheckedChange:i,onClick:re})}),e[10]=c,e[11]=i,e[12]=p,e[13]=a):a=e[13];let f;return e[14]!==x||e[15]!==m||e[16]!==a?(f=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:x,children:[m,a]}),e[14]=x,e[15]=m,e[16]=a,e[17]=f):f=e[17],f});function ge({toolSet:l,onToolSetChange:o}){const[e,n]=j.useState(""),r=j.useDeferredValue(e),[c,i]=j.useState("all"),[x,b]=j.useState(!1),g=j.useRef(new Set(Object.keys(l))),d=Y({searchTerm:r.trim()||void 0}),u=g.current,m=[...u.values()].map(s=>d.find(h=>h.id===s)).filter(s=>s!==void 0),p=d.filter(s=>!u.has(s.id)),a=[...m,...p],f=s=>{const h=l[s];return h!==void 0&&h.length>0},C=a.filter(s=>{if(c==="all")return!0;const h=f(s.id);return c==="selected"?h:c==="unselected"?!h:!0}),[w,P]=j.useState(a[0]?.id??null),v=w?a.find(s=>s.id===w)??null:null,E=v?.tools??[],Q=(s,h)=>l[s]?.includes(h)??!1,q=(s,h)=>{const N=l[s]??[],R=N.includes(h),T={...l};if(R){const y=N.filter(k=>k!==h);y.length===0?delete T[s]:T[s]=y}else T[s]=[...N,h];o(T)},L=s=>{const h=a.find(k=>k.id===s);if(!h?.tools)return;const N=l[s]??[],R=h.tools.map(k=>k.name),T=N.length>0&&R.every(k=>N.includes(k)),y={...l};T?delete y[s]:(y[s]=R,P(s)),o(y)},V=s=>{P(s),b(!0)},W=()=>{b(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:S("w-full md:w-80 border-r border-border flex flex-col",x&&"hidden md:flex"),children:[t.jsx(te,{value:e,onChange:n,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>i("all"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>i("selected"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>i("unselected"),className:S("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",c==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:C.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:e?"No connections found":c==="selected"?"No servers selected":c==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:C.map(s=>{const h=s.tools?.length??0,N=l[s.id]?.length??0;return t.jsx(se,{connection:s,isSelected:w===s.id,hasToolsEnabled:f(s.id),activeToolsCount:N,totalToolsCount:h,onSelect:()=>V(s.id),onToggle:()=>L(s.id)},s.id)})})})]}),t.jsx("div",{className:S("flex-1 flex-col",x?"flex":"hidden md:flex"),children:v?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(Z,{variant:"ghost",size:"sm",onClick:W,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(ee,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(z,{icon:v.icon,name:v.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:v.title}),v.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:v.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:E.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:E.map(s=>t.jsx(oe,{connectionId:v.id,tool:s,isSelected:Q(v.id,s.name),onToggle:()=>q(v.id,s.name)},s.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function ne(l){return l.stopPropagation()}function re(l){return l.stopPropagation()}var M="Switch",[le]=X(M),[ce,ie]=le(M),O=j.forwardRef((l,o)=>{const{__scopeSwitch:e,name:n,checked:r,defaultChecked:c,required:i,disabled:x,value:b="on",onCheckedChange:g,form:d,...u}=l,[m,p]=j.useState(null),a=$(o,v=>p(v)),f=j.useRef(!1),C=m?d||!!m.closest("form"):!0,[w,P]=_({prop:r,defaultProp:c??!1,onChange:g,caller:M});return t.jsxs(ce,{scope:e,checked:w,disabled:x,children:[t.jsx(I.button,{type:"button",role:"switch","aria-checked":w,"aria-required":i,"data-state":H(w),"data-disabled":x?"":void 0,disabled:x,value:b,...u,ref:a,onClick:G(l.onClick,v=>{P(E=>!E),C&&(f.current=v.isPropagationStopped(),f.current||v.stopPropagation())})}),C&&t.jsx(D,{control:m,bubbles:!f.current,name:n,value:b,checked:w,required:i,disabled:x,form:d,style:{transform:"translateX(-100%)"}})]})});O.displayName=M;var U="SwitchThumb",A=j.forwardRef((l,o)=>{const{__scopeSwitch:e,...n}=l,r=ie(U,e);return t.jsx(I.span,{"data-state":H(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:o})});A.displayName=U;var ae="SwitchBubbleInput",D=j.forwardRef(({__scopeSwitch:l,control:o,checked:e,bubbles:n=!0,...r},c)=>{const i=j.useRef(null),x=$(i,c),b=J(e),g=K(o);return j.useEffect(()=>{const d=i.current;if(!d)return;const u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(b!==e&&p){const a=new Event("click",{bubbles:n});p.call(d,e),d.dispatchEvent(a)}},[b,e,n]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...r,tabIndex:-1,ref:x,style:{...r.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});D.displayName=ae;function H(l){return l?"checked":"unchecked"}var de=O,ue=A;function ve(l){const o=B.c(9);let e,n;o[0]!==l?({className:e,...n}=l,o[0]=l,o[1]=e,o[2]=n):(e=o[1],n=o[2]);let r;o[3]!==e?(r=S("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),o[3]=e,o[4]=r):r=o[4];let c;o[5]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(ue,{"data-slot":"switch-thumb",className:S("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}),o[5]=c):c=o[5];let i;return o[6]!==n||o[7]!==r?(i=t.jsx(de,{"data-slot":"switch",className:r,...n,children:c}),o[6]=n,o[7]=r,o[8]=i):i=o[8],i}export{ve as S,ge as T};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import{c as G,j as m,B as sa,d as ra,K as xt,t as Ze,E as na,F as oa,H as $,v as h,_ as Re,I as _t,J as ia,L as la,M as ca,Q as Z,V as be,W as we,s as M,X as x,Y as X,Z as ua,$ as O,a0 as da,a1 as pa,r as J,i as ma,p as fa,h as ha}from"./index-C4Akli_y.js";import{c as he,B as Me}from"./input-DotiBI6p.js";import{u as Et,c as qe,b as Je,T as We,a as wt}from"./project-context-provider-CjwpGeXi.js";import{E as ga}from"./use-binding-BEnmwZa_.js";import{k as va,l as ya,m as ba,n as xa}from"./index-ISUndXQ9.js";import{u as _a}from"./use-gateway-BLvEfmJw.js";import{u as Ea}from"./use-gateway-system-prompt-CCBqlzxU.js";import{P as It,a as St,b as Nt}from"./popover-CaWduoVd.js";import{a as wa,E as Ia,i as Sa}from"./use-connection-DRGfApkr.js";import{O as Na,a as Ta,g as Aa}from"./well-known-mcp-D13f-8h2.js";import{g as Ca}from"./generate-id-Dyweu44Y.js";import{s as Qe}from"./Clock-85E4NFdS.js";import{s as Ra}from"./Trash01-BOhK9CaY.js";function Fr(){const t=G.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=m.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=m.jsxs("div",{className:"flex items-center gap-3",children:[e,m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),m.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=m.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:m.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,m.jsxs("div",{className:"flex items-end gap-2",children:[m.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),m.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=m.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:m.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[m.jsx(Te,{align:"right",width:"w-3/4"}),m.jsx(Te,{align:"left",width:"w-full",lines:3}),m.jsx(Te,{align:"right",width:"w-2/3"}),m.jsx(Te,{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=m.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:m.jsx("div",{className:"relative flex-1",children:m.jsxs("div",{className:"space-y-2 p-2",children:[m.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),m.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=m.jsx("div",{className:"flex items-center gap-1",children:m.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=m.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[s,r,m.jsx("div",{className:"px-4 py-4",children:m.jsx("div",{className:"mx-auto w-full max-w-2xl",children:m.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[n,m.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[i,m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),m.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=o):o=t[6],o}function Te(t){const e=G.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=he("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 p;e[2]!==l?(p=he("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=p):p=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=m.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=d):d=e[4];const g=a==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==g||e[6]!==n?(f=he("min-w-0 rounded-2xl p-4",g,n),e[5]=g,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=m.jsx("div",{className:"space-y-2",children:v.map((u,T)=>m.jsx("div",{className:he("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=m.jsx("div",{className:f,children:b}),e[13]=b,e[14]=f,e[15]=y):y=e[15];let _;e[16]!==y||e[17]!==p?(_=m.jsxs("div",{className:p,children:[d,y]}),e[16]=y,e[17]=p,e[18]=_):_=e[18];let N;return e[19]!==_||e[20]!==c?(N=m.jsx("div",{className:c,children:_}),e[19]=_,e[20]=c,e[21]=N):N=e[21],N}var xe;(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})(xe||(xe={}));var Xe;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Xe||(Xe={}));xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);xe.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 Oe 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 Oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xe.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()}}Oe.create=t=>new Oe(t);var Ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ke||(Ke={}));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={}));function zr(){const t=G.c(5),e=sa(),{org:a}=Et();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=ra(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],p=r.connectionId;if(!p)return;e.invalidateQueries({queryKey:xt.collection(a.slug,p,l)});const d=l.toLowerCase().replace(/_/g," ");Ze.success(`${d} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=n):n=t[4],n}var Tt="vercel.ai.error",Ma=Symbol.for(Tt),et,tt,ae=class At extends(tt=Error,et=Ma,tt){constructor({name:e,message:a,cause:s}){super(a),this[et]=!0,this.name=e,this.cause=s}static isInstance(e){return At.hasMarker(e,Tt)}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 Ct(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Rt="AI_InvalidArgumentError",Mt=`vercel.ai.error.${Rt}`,Oa=Symbol.for(Mt),at,st,ja=class extends(st=ae,at=Oa,st){constructor({message:t,cause:e,argument:a}){super({name:Rt,message:t,cause:e}),this[at]=!0,this.argument=a}static isInstance(t){return ae.hasMarker(t,Mt)}},Ot="AI_JSONParseError",jt=`vercel.ai.error.${Ot}`,Pa=Symbol.for(jt),rt,nt,ot=class extends(nt=ae,rt=Pa,nt){constructor({text:t,cause:e}){super({name:Ot,message:`JSON parsing failed: Text: ${t}.
|
|
2
|
-
Error message: ${Ct(e)}`,cause:e}),this[rt]=!0,this.text=t}static isInstance(t){return ae.hasMarker(t,jt)}},Pt="AI_TypeValidationError",kt=`vercel.ai.error.${Pt}`,ka=Symbol.for(kt),it,lt,me=class $e extends(lt=ae,it=ka,lt){constructor({value:e,cause:a}){super({name:Pt,message:`Type validation failed: Value: ${JSON.stringify(e)}.
|
|
3
|
-
Error message: ${Ct(a)}`,cause:a}),this[it]=!0,this.value=e}static isInstance(e){return ae.hasMarker(e,kt)}static wrap({value:e,cause:a}){return $e.isInstance(a)&&a.value===e?a:new $e({value:e,cause:a})}},Ie=({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 ja({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Da=Ie();function ct(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 ne(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 ut(t,...e){const a=new Headers(ne(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var Za=/"__proto__"\s*:/,$a=/"constructor"\s*:/;function dt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Za.test(t)===!1&&$a.test(t)===!1?e:La(e)}function La(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 Ua(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return dt(t)}try{return dt(t)}finally{Error.stackTraceLimit=e}}function Dt(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]=re(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(re):re(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(re)),t.allOf!=null&&(t.allOf=t.allOf.map(re)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(re));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=re(e[a]);return t}function re(t){return typeof t=="boolean"?t:Dt(t)}var Ba=Symbol("Let zodToJsonSchema decide on which parser to use"),pt={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"},Fa=t=>typeof t=="string"?{...pt,name:t}:{...pt,...t};function B(){return{}}function za(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=R(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 Va(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 qa(){return{type:"boolean"}}function Zt(t,e){return R(t.type._def,e)}var Ja=(t,e)=>R(t.innerType._def,e);function $t(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>$t(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 Wa(t)}}var Wa=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 Ya(t,e){return{...R(t.innerType._def,e),default:t.defaultValue()}}function Ga(t,e){return e.effectStrategy==="input"?R(t.schema._def,e):B()}function Ha(t){return{type:"string",enum:Array.from(t.values)}}var Qa=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Xa(t,e){const a=[R(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),R(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(Qa(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 Ka(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 Pe=void 0,V={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:()=>(Pe===void 0&&(Pe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Pe),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 Lt(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":q(a,"email",s.message,e);break;case"format:idn-email":q(a,"idn-email",s.message,e);break;case"pattern:zod":D(a,V.email,s.message,e);break}break;case"url":q(a,"uri",s.message,e);break;case"uuid":q(a,"uuid",s.message,e);break;case"regex":D(a,s.regex,s.message,e);break;case"cuid":D(a,V.cuid,s.message,e);break;case"cuid2":D(a,V.cuid2,s.message,e);break;case"startsWith":D(a,RegExp(`^${ke(s.value,e)}`),s.message,e);break;case"endsWith":D(a,RegExp(`${ke(s.value,e)}$`),s.message,e);break;case"datetime":q(a,"date-time",s.message,e);break;case"date":q(a,"date",s.message,e);break;case"time":q(a,"time",s.message,e);break;case"duration":q(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":{D(a,RegExp(ke(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&q(a,"ipv4",s.message,e),s.version!=="v4"&&q(a,"ipv6",s.message,e);break}case"base64url":D(a,V.base64url,s.message,e);break;case"jwt":D(a,V.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&D(a,V.ipv4Cidr,s.message,e),s.version!=="v4"&&D(a,V.ipv6Cidr,s.message,e);break}case"emoji":D(a,V.emoji(),s.message,e);break;case"ulid":{D(a,V.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{q(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{D(a,V.base64,s.message,e);break}}break}case"nanoid":D(a,V.nanoid,s.message,e)}return a}function ke(t,e){return e.patternStrategy==="escape"?ts(t):t}var es=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ts(t){let e="";for(let a=0;a<t.length;a++)es.has(t[a])||(e+="\\"),e+=t[a];return e}function q(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 D(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:mt(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=mt(e,s)}function mt(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 Ut(t,e){var a,s,r,n,i,o;const c={type:"object",additionalProperties:(a=R(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,...p}=Lt(t.keyType._def,e);return{...c,propertyNames:p}}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,...p}=Zt(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function as(t,e){if(e.mapStrategy==="record")return Ut(t,e);const a=R(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||B(),s=R(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||B();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function ss(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 rs(){return{not:B()}}function ns(){return{type:"null"}}var Le={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function os(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in Le&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=Le[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 is(t,e)}var is=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>R(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 ls(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[Le[t.innerType._def.typeName],"null"]};const a=R(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function cs(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 us(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=ps(o),l=R(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=ds(t,e);return n!==void 0&&(a.additionalProperties=n),a}function ds(t,e){if(t.catchall._def.typeName!=="ZodNever")return R(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 ps(t){try{return t.isOptional()}catch{return!0}}var ms=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return R(t.innerType._def,e);const s=R(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:B()},s]}:B()},fs=(t,e)=>{if(e.pipeStrategy==="input")return R(t.in._def,e);if(e.pipeStrategy==="output")return R(t.out._def,e);const a=R(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=R(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function hs(t,e){return R(t.type._def,e)}function gs(t,e){const s={type:"array",uniqueItems:!0,items:R(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 vs(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>R(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:R(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>R(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function ys(){return{not:B()}}function bs(){return B()}var xs=(t,e)=>R(t.innerType._def,e),_s=(t,e,a)=>{switch(e){case E.ZodString:return Lt(t,a);case E.ZodNumber:return cs(t);case E.ZodObject:return us(t,a);case E.ZodBigInt:return Va(t);case E.ZodBoolean:return qa();case E.ZodDate:return $t(t,a);case E.ZodUndefined:return ys();case E.ZodNull:return ns();case E.ZodArray:return za(t,a);case E.ZodUnion:case E.ZodDiscriminatedUnion:return os(t,a);case E.ZodIntersection:return Xa(t,a);case E.ZodTuple:return vs(t,a);case E.ZodRecord:return Ut(t,a);case E.ZodLiteral:return Ka(t);case E.ZodEnum:return Ha(t);case E.ZodNativeEnum:return ss(t);case E.ZodNullable:return ls(t,a);case E.ZodOptional:return ms(t,a);case E.ZodMap:return as(t,a);case E.ZodSet:return gs(t,a);case E.ZodLazy:return()=>t.getter()._def;case E.ZodPromise:return hs(t,a);case E.ZodNaN:case E.ZodNever:return rs();case E.ZodEffects:return Ga(t,a);case E.ZodAny:return B();case E.ZodUnknown:return bs();case E.ZodDefault:return Ya(t,a);case E.ZodBranded:return Zt(t,a);case E.ZodReadonly:return xs(t,a);case E.ZodCatch:return Ja(t,a);case E.ZodPipeline:return fs(t,a);case E.ZodFunction:case E.ZodVoid:case E.ZodSymbol:return;default:return(s=>{})()}},Es=(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 R(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!==Ba)return c}if(r&&!a){const c=ws(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=_s(t,t.typeName,e),o=typeof i=="function"?R(i(),e):i;if(o&&Is(t,e,o),e.postProcess){const c=e.postProcess(o,t,e);return n.jsonSchema=o,c}return n.jsonSchema=o,o}var ws=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Es(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`),B()):e.$refStrategy==="seen"?B():void 0}},Is=(t,e,a)=>(t.description&&(a.description=t.description),a),Ss=t=>{const e=Fa(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}]))}},Ns=(t,e)=>{var a;const s=Ss(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,d])=>{var g;return{...l,[p]:(g=R(d._def,{...s,currentPath:[...s.basePath,s.definitionPath,p]},!0))!=null?g:B()}},{}):void 0;const n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=R(t._def,n===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,n]},!1))!=null?a:B(),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},Ue=Symbol.for("vercel.ai.schema");function Ts(t){let e;return()=>(e==null&&(e=t()),e)}function je(t,{validate:e}={}){return{[Ue]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function As(t){return typeof t=="object"&&t!==null&&Ue in t&&t[Ue]===!0&&"jsonSchema"in t&&"validate"in t}function Ye(t){return t==null?je({properties:{},additionalProperties:!1}):As(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Bt(t):Cs(t):t()}function Cs(t){return je(()=>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 me({value:e,cause:a.issues})}}})}function Rs(t,e){var a;const s=(a=void 0)!=null?a:!1;return je(()=>Ns(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 Ms(t,e){var a;const s=(a=void 0)!=null?a:!1;return je(()=>Dt(oa(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const n=await na(t,r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Os(t){return"_zod"in t}function Bt(t,e){return Os(t)?Ms(t):Rs(t)}async function ft({value:t,schema:e}){const a=await _e({value:t,schema:e});if(!a.success)throw me.wrap({value:t,cause:a.error});return a.value}async function _e({value:t,schema:e}){const a=Ye(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:me.wrap({value:t,cause:s.error}),rawValue:t}}catch(s){return{success:!1,error:me.wrap({value:t,cause:s}),rawValue:t}}}async function oe({text:t,schema:e}){try{const a=Ua(t);return e==null?{success:!0,value:a,rawValue:a}:await _e({value:a,schema:e})}catch(a){return{success:!1,error:ot.isInstance(a)?a:new ot({text:t,cause:a}),rawValue:void 0}}}function js({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new ga).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await oe({text:a,schema:e}))}}))}async function ee(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var Ps=Object.defineProperty,ks=(t,e)=>{for(var a in e)Ps(t,a,{get:e[a],enumerable:!0})},Ft="AI_NoObjectGeneratedError",zt=`vercel.ai.error.${Ft}`,Ds=Symbol.for(zt),Vt,te=class extends ae{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:n}){super({name:Ft,message:t,cause:e}),this[Vt]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=n}static isInstance(t){return ae.hasMarker(t,zt)}};Vt=Ds;var ht="6.0.29",qt=$([h(),Re(Uint8Array),Re(ArrayBuffer),_t(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Ee=ia(()=>$([la(),h(),ca(),Z(),be(h(),Ee.optional()),we(Ee)])),S=be(h(),be(h(),Ee.optional())),Jt=M({type:x("text"),text:h(),providerOptions:S.optional()}),Zs=M({type:x("image"),image:$([qt,Re(URL)]),mediaType:h().optional(),providerOptions:S.optional()}),Wt=M({type:x("file"),data:$([qt,Re(URL)]),filename:h().optional(),mediaType:h(),providerOptions:S.optional()}),$s=M({type:x("reasoning"),text:h(),providerOptions:S.optional()}),Ls=M({type:x("tool-call"),toolCallId:h(),toolName:h(),input:X(),providerOptions:S.optional(),providerExecuted:Z().optional()}),Us=ua("type",[M({type:x("text"),value:h(),providerOptions:S.optional()}),M({type:x("json"),value:Ee,providerOptions:S.optional()}),M({type:x("execution-denied"),reason:h().optional(),providerOptions:S.optional()}),M({type:x("error-text"),value:h(),providerOptions:S.optional()}),M({type:x("error-json"),value:Ee,providerOptions:S.optional()}),M({type:x("content"),value:we($([M({type:x("text"),text:h(),providerOptions:S.optional()}),M({type:x("media"),data:h(),mediaType:h()}),M({type:x("file-data"),data:h(),mediaType:h(),filename:h().optional(),providerOptions:S.optional()}),M({type:x("file-url"),url:h(),providerOptions:S.optional()}),M({type:x("file-id"),fileId:$([h(),be(h(),h())]),providerOptions:S.optional()}),M({type:x("image-data"),data:h(),mediaType:h(),providerOptions:S.optional()}),M({type:x("image-url"),url:h(),providerOptions:S.optional()}),M({type:x("image-file-id"),fileId:$([h(),be(h(),h())]),providerOptions:S.optional()}),M({type:x("custom"),providerOptions:S.optional()})]))})]),Yt=M({type:x("tool-result"),toolCallId:h(),toolName:h(),output:Us,providerOptions:S.optional()}),Bs=M({type:x("tool-approval-request"),approvalId:h(),toolCallId:h()}),Fs=M({type:x("tool-approval-response"),approvalId:h(),approved:Z(),reason:h().optional()}),zs=M({role:x("system"),content:h(),providerOptions:S.optional()}),Vs=M({role:x("user"),content:$([h(),we($([Jt,Zs,Wt]))]),providerOptions:S.optional()}),qs=M({role:x("assistant"),content:$([h(),we($([Jt,Wt,$s,Ls,Yt,Bs]))]),providerOptions:S.optional()}),Js=M({role:x("tool"),content:we($([Yt,Fs])),providerOptions:S.optional()});$([zs,Vs,qs,Js]);function Gt(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]=Gt(n,r):a[s]=r}return a}var Ws={};ks(Ws,{array:()=>Qs,choice:()=>Xs,json:()=>Ks,object:()=>Hs,text:()=>Gs});function Ys(t){const e=["ROOT"];let a=-1,s=null;function r(c,l,p){switch(c){case'"':{a=l,e.pop(),e.push(p),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=l,s=l,e.pop(),e.push(p),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(p),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(p),e.push("INSIDE_NUMBER");break}case"{":{a=l,e.pop(),e.push(p),e.push("INSIDE_OBJECT_START");break}case"[":{a=l,e.pop(),e.push(p),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 d=t.substring(s,c+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(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 p=t.substring(s,t.length);"true".startsWith(p)?o+="true".slice(p.length):"false".startsWith(p)?o+="false".slice(p.length):"null".startsWith(p)&&(o+="null".slice(p.length))}}return o}async function Se(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await oe({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await oe({text:Ys(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Gs=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),Hs=({schema:t,name:e,description:a})=>{const s=Ye(t);return{name:"object",responseFormat:ee(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},n){const i=await oe({text:r});if(!i.success)throw new te({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 _e({value:i.value,schema:s});if(!o.success)throw new te({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 Se(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value}}},createElementStreamTransform(){}}},Qs=({element:t,name:e,description:a})=>{const s=Ye(t);return{name:"array",responseFormat:ee(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 oe({text:r});if(!i.success)throw new te({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 te({message:"No object generated: response did not match schema.",cause:new me({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 _e({value:c,schema:s});if(!l.success)throw new te({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 Se(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 p=await _e({value:l,schema:s});p.success&&c.push(p.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])}})}}},Xs=({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 oe({text:s});if(!n.success)throw new te({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 te({message:"No object generated: response did not match schema.",cause:new me({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 Se(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(){}}),Ks=({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 oe({text:a});if(!r.success)throw new te({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 Se(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(){}});Ie({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 er=Ts(()=>Bt($([O({type:x("text-start"),id:h(),providerMetadata:S.optional()}),O({type:x("text-delta"),id:h(),delta:h(),providerMetadata:S.optional()}),O({type:x("text-end"),id:h(),providerMetadata:S.optional()}),O({type:x("error"),errorText:h()}),O({type:x("tool-input-start"),toolCallId:h(),toolName:h(),providerExecuted:Z().optional(),dynamic:Z().optional(),title:h().optional()}),O({type:x("tool-input-delta"),toolCallId:h(),inputTextDelta:h()}),O({type:x("tool-input-available"),toolCallId:h(),toolName:h(),input:X(),providerExecuted:Z().optional(),providerMetadata:S.optional(),dynamic:Z().optional(),title:h().optional()}),O({type:x("tool-input-error"),toolCallId:h(),toolName:h(),input:X(),providerExecuted:Z().optional(),providerMetadata:S.optional(),dynamic:Z().optional(),errorText:h(),title:h().optional()}),O({type:x("tool-approval-request"),approvalId:h(),toolCallId:h()}),O({type:x("tool-output-available"),toolCallId:h(),output:X(),providerExecuted:Z().optional(),dynamic:Z().optional(),preliminary:Z().optional()}),O({type:x("tool-output-error"),toolCallId:h(),errorText:h(),providerExecuted:Z().optional(),dynamic:Z().optional()}),O({type:x("tool-output-denied"),toolCallId:h()}),O({type:x("reasoning-start"),id:h(),providerMetadata:S.optional()}),O({type:x("reasoning-delta"),id:h(),delta:h(),providerMetadata:S.optional()}),O({type:x("reasoning-end"),id:h(),providerMetadata:S.optional()}),O({type:x("source-url"),sourceId:h(),url:h(),title:h().optional(),providerMetadata:S.optional()}),O({type:x("source-document"),sourceId:h(),mediaType:h(),title:h(),filename:h().optional(),providerMetadata:S.optional()}),O({type:x("file"),url:h(),mediaType:h(),providerMetadata:S.optional()}),O({type:_t(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:h().optional(),data:X(),transient:Z().optional()}),O({type:x("start-step")}),O({type:x("finish-step")}),O({type:x("start"),messageId:h().optional(),messageMetadata:X().optional()}),O({type:x("finish"),finishReason:da(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:X().optional()}),O({type:x("abort"),reason:h().optional()}),O({type:x("message-metadata"),messageMetadata:X()})])));function tr(t){return t.type.startsWith("data-")}function Be(t){return t.type.startsWith("tool-")}function ar(t){return t.type==="dynamic-tool"}function Fe(t){return Be(t)||ar(t)}function gt(t){return t.type.split("-").slice(1).join("-")}function sr({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function rr({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:p})=>{var d,g,f,v;function b(u){const A=l.message.parts.filter(Fe).find(w=>w.toolCallId===u);if(A==null)throw new Error(`no tool invocation found for tool call ${u}`);return A}function y(u){var T;const A=l.message.parts.find(P=>Be(P)&&P.toolCallId===u.toolCallId),w=u,I=A;A!=null?(A.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:A.providerExecuted,w.providerMetadata!=null&&A.state==="input-available"&&(A.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 _(u){var T,A;const w=l.message.parts.find(L=>L.type==="dynamic-tool"&&L.toolCallId===u.toolCallId),I=u,P=w;w!=null?(w.state=u.state,P.toolName=u.toolName,P.input=I.input,P.output=I.output,P.errorText=I.errorText,P.rawInput=(T=I.rawInput)!=null?T:P.rawInput,P.preliminary=I.preliminary,u.title!==void 0&&(P.title=u.title),P.providerExecuted=(A=I.providerExecuted)!=null?A: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?Gt(l.message.metadata,u):u;e!=null&&await ft({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),p();break}case"text-delta":{const u=l.activeTextParts[o.id];u.text+=o.delta,u.providerMetadata=(d=o.providerMetadata)!=null?d:u.providerMetadata,p();break}case"text-end":{const u=l.activeTextParts[o.id];u.state="done",u.providerMetadata=(g=o.providerMetadata)!=null?g:u.providerMetadata,delete l.activeTextParts[o.id],p();break}case"reasoning-start":{const u={type:"reasoning",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeReasoningParts[o.id]=u,l.message.parts.push(u),p();break}case"reasoning-delta":{const u=l.activeReasoningParts[o.id];u.text+=o.delta,u.providerMetadata=(f=o.providerMetadata)!=null?f:u.providerMetadata,p();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],p();break}case"file":{l.message.parts.push({type:"file",mediaType:o.mediaType,url:o.url}),p();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:o.sourceId,url:o.url,title:o.title,providerMetadata:o.providerMetadata}),p();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}),p();break}case"tool-input-start":{const u=l.message.parts.filter(Be);l.partialToolCalls[o.toolCallId]={text:"",toolName:o.toolName,index:u.length,dynamic:o.dynamic,title:o.title},o.dynamic?_({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}),p();break}case"tool-input-delta":{const u=l.partialToolCalls[o.toolCallId];u.text+=o.inputTextDelta;const{value:T}=await Se(u.text);u.dynamic?_({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}),p();break}case"tool-input-available":{o.dynamic?_({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}),p(),n&&!o.providerExecuted&&await n({toolCall:o});break}case"tool-input-error":{o.dynamic?_({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}),p();break}case"tool-approval-request":{const u=b(o.toolCallId);u.state="approval-requested",u.approval={id:o.approvalId},p();break}case"tool-output-denied":{const u=b(o.toolCallId);u.state="output-denied",p();break}case"tool-output-available":{const u=b(o.toolCallId);u.type==="dynamic-tool"?_({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:gt(u),state:"output-available",input:u.input,output:o.output,providerExecuted:o.providerExecuted,preliminary:o.preliminary,title:u.title}),p();break}case"tool-output-error":{const u=b(o.toolCallId);u.type==="dynamic-tool"?_({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:gt(u),state:"output-error",input:u.input,rawInput:u.rawInput,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}),p();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)&&p();break}case"finish":{o.finishReason!=null&&(l.finishReason=o.finishReason),await N(o.messageMetadata),o.messageMetadata!=null&&p();break}case"message-metadata":{await N(o.messageMetadata),o.messageMetadata!=null&&p();break}case"error":{r?.(new Error(o.errorText));break}default:if(tr(o)){a?.[o.type]!=null&&await ft({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(A=>u.type===A.type&&u.id===A.id):void 0;T!=null?T.data=u.data:l.message.parts.push(u),i?.(u),p()}}c.enqueue(o)})}}))}async function nr({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()}}Ie({prefix:"aitxt",size:24});Ie({prefix:"aiobj",size:24});var or=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()})}};Ie({prefix:"aiobj",size:24});async function ir(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 lr=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 ee(this.body),c=await ee(this.headers),l=await ee(this.credentials),p={...ne(c),...ne(e.headers)},d=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...o,...e.body},headers:p,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),g=(s=d?.api)!=null?s:this.api,f=d?.headers!==void 0?ne(d.headers):p,v=d?.body!==void 0?d.body:{...o,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},b=(r=d?.credentials)!=null?r:l,_=await((n=this.fetch)!=null?n:globalThis.fetch)(g,{method:"POST",headers:ut({"Content-Type":"application/json",...f},`ai-sdk/${ht}`,ct()),body:JSON.stringify(v),credentials:b,signal:t});if(!_.ok)throw new Error((i=await _.text())!=null?i:"Failed to fetch the chat response.");if(!_.body)throw new Error("The response body is empty.");return this.processResponseStream(_.body)}async reconnectToStream(t){var e,a,s,r,n;const i=await ee(this.body),o=await ee(this.headers),c=await ee(this.credentials),l={...ne(o),...ne(t.headers)},p=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})),d=(a=p?.api)!=null?a:`${this.api}/${t.chatId}/stream`,g=p?.headers!==void 0?ne(p.headers):l,f=(s=p?.credentials)!=null?s:c,b=await((r=this.fetch)!=null?r:globalThis.fetch)(d,{method:"GET",headers:ut(g,`ai-sdk/${ht}`,ct()),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)}},Ht=class extends lr{constructor(t={}){super(t)}processResponseStream(t){return js({stream:t,schema:er}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},cr=class{constructor({generateId:t=Da,id:e=t(),transport:a=new Ht,messageMetadataSchema:s,dataPartSchemas:r,state:n,onError:i,onToolCall:o,onFinish:c,onData:l,sendAutomaticallyWhen:p}){this.activeResponse=void 0,this.jobExecutor=new or,this.sendMessage=async(d,g)=>{var f,v,b,y;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...g});return}let _;if("text"in d||"files"in d?_={parts:[...Array.isArray(d.files)?d.files:await ir(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:_=d,d.messageId!=null){const N=this.state.messages.findIndex(u=>u.id===d.messageId);if(N===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[N].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,N+1),this.state.replaceMessage(N,{..._,id:d.messageId,role:(v=_.role)!=null?v:"user",metadata:d.metadata})}else this.state.pushMessage({..._,id:(b=_.id)!=null?b:this.generateId(),role:(y=_.role)!=null?y:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...g})},this.regenerate=async({messageId:d,...g}={})=>{const f=d==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===d);if(f===-1)throw new Error(`message ${d} 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:d,...g})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:g,reason:f})=>this.jobExecutor.run(async()=>{var v,b;const y=this.state.messages,_=y[y.length-1],N=u=>Fe(u)&&u.state==="approval-requested"&&u.approval.id===d?{...u,state:"approval-responded",approval:{id:d,approved:g,reason:f}}:u;this.state.replaceMessage(y.length-1,{..._,parts:_.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:d="output-available",tool:g,toolCallId:f,output:v,errorText:b})=>this.jobExecutor.run(async()=>{var y,_;const N=this.state.messages,u=N[N.length-1],T=A=>Fe(A)&&A.toolCallId===f?{...A,state:d,output:v,errorText:b}:A;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:(_=this.lastMessage)==null?void 0:_.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.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=p}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 p=!1,d=!1,g=!1;try{const f={state:sr({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{p=!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 _;this.setStatus({status:"streaming"}),f.state.message.id===((_=this.lastMessage)==null?void 0:_.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await nr({stream:rr({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(p||f.name==="AbortError")return p=!0,this.setStatus({status:"ready"}),null;g=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(d=!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:p,isDisconnect:d,isError:g,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})&&!g&&await this.makeRequest({trigger:"submit-message",messageId:(c=this.lastMessage)==null?void 0:c.id,metadata:e,headers:a,body:s})}},De,vt;function ur(){if(vt)return De;vt=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 De=t,De}var dr=ur();const pr=pa(dr);var Qt=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},j=(t,e,a)=>(Qt(t,e,"read from private field"),a?a.call(t):e.get(t)),Y=(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)},K=(t,e,a,s)=>(Qt(t,e,"write to private field"),e.set(t,a),a);function mr(t,e){return e!=null?pr(t,e):t}var F,Ae,Ce,ge,ve,ye,de,ze,Ve,fr=class{constructor(t=[]){Y(this,F,void 0),Y(this,Ae,"ready"),Y(this,Ce,void 0),Y(this,ge,new Set),Y(this,ve,new Set),Y(this,ye,new Set),this.pushMessage=e=>{K(this,F,j(this,F).concat(e)),j(this,de).call(this)},this.popMessage=()=>{K(this,F,j(this,F).slice(0,-1)),j(this,de).call(this)},this.replaceMessage=(e,a)=>{K(this,F,[...j(this,F).slice(0,e),this.snapshot(a),...j(this,F).slice(e+1)]),j(this,de).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?mr(e,a):e;return j(this,ge).add(s),()=>{j(this,ge).delete(s)}},this["~registerStatusCallback"]=e=>(j(this,ve).add(e),()=>{j(this,ve).delete(e)}),this["~registerErrorCallback"]=e=>(j(this,ye).add(e),()=>{j(this,ye).delete(e)}),Y(this,de,()=>{j(this,ge).forEach(e=>e())}),Y(this,ze,()=>{j(this,ve).forEach(e=>e())}),Y(this,Ve,()=>{j(this,ye).forEach(e=>e())}),K(this,F,t)}get status(){return j(this,Ae)}set status(t){K(this,Ae,t),j(this,ze).call(this)}get error(){return j(this,Ce)}set error(t){K(this,Ce,t),j(this,Ve).call(this)}get messages(){return j(this,F)}set messages(t){K(this,F,[...t]),j(this,de).call(this)}};F=new WeakMap;Ae=new WeakMap;Ce=new WeakMap;ge=new WeakMap;ve=new WeakMap;ye=new WeakMap;de=new WeakMap;ze=new WeakMap;Ve=new WeakMap;var pe,yt=class extends cr{constructor({messages:t,...e}){const a=new fr(t);super({...e,state:a}),Y(this,pe,void 0),this["~registerMessagesCallback"]=(s,r)=>j(this,pe)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>j(this,pe)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>j(this,pe)["~registerErrorCallback"](s),K(this,pe,a)}};pe=new WeakMap;function hr({experimental_throttle:t,resume:e=!1,...a}={}){const s=J.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:g=>{var f,v;return(v=(f=s.current).onToolCall)==null?void 0:v.call(f,g)},onData:g=>{var f,v;return(v=(f=s.current).onData)==null?void 0:v.call(f,g)},onFinish:g=>{var f,v;return(v=(f=s.current).onFinish)==null?void 0:v.call(f,g)},onError:g=>{var f,v;return(v=(f=s.current).onError)==null?void 0:v.call(f,g)},sendAutomaticallyWhen:g=>{var f,v,b;return(b=(v=(f=s.current).sendAutomaticallyWhen)==null?void 0:v.call(f,g))!=null?b:!1}},n=J.useRef("chat"in a?a.chat:new yt(r));("chat"in a&&a.chat!==n.current||"id"in a&&n.current.id!==a.id)&&(n.current="chat"in a?a.chat:new yt(r));const o=J.useCallback(g=>n.current["~registerMessagesCallback"](g,t),[t,n.current.id]),c=J.useSyncExternalStore(o,()=>n.current.messages,()=>n.current.messages),l=J.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),p=J.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),d=J.useCallback(g=>{typeof g=="function"&&(g=g(n.current.messages)),n.current.messages=g},[n]);return J.useEffect(()=>{e&&n.current.resumeStream()},[e,n]),{id:n.current.id,messages:c,setMessages:d,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:p,resumeStream:n.current.resumeStream,status:l,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}const gr="You are a helpful assistant.",vr=t=>new Ht({api:`/api/${t}/models/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:a})=>({body:{messages:e,stream:!0,...a}})});function Vr(t){const e=G.c(37),{threadId:a,systemPrompt:s,onCreateThread:r,onError:n,onToolCall:i}=t,{org:o,locator:c}=Et(),{slug:l}=o,p=va(),d=ya(),[g,f]=J.useState(null),v=ba(a),b=s||gr;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,A=`${a}:${b}`;let w;e[5]!==l?(w=vr(l),e[5]=l,e[6]=w):w=e[6];const I=w;let P;e[7]!==c||e[8]!==d||e[9]!==r||e[10]!==p||e[11]!==a?(P=async W=>{const{finishReason:se,messages:Xt,isAbort:Kt,isDisconnect:ea,isError:ta}=W;if(f(se??null),se!=="stop"||Kt||ea||ta)return;const Ne=Xt.slice(-2).filter(Boolean);if(Ne.length!==2){console.warn("[chat] Expected 2 messages, got",Ne.length);return}d.insertMany.mutate(Ne);const Ge=Ne.find(br)?.parts?.find(yr)?.text.slice(0,100)||"";if(!await xa(c,a)){if(r)r({id:a,title:Ge});else{const He=new Date().toISOString(),aa={id:a,title:Ge,created_at:He,updated_at:He,hidden:!1};p.insert.mutate(aa)}return}p.update.mutate({id:a,updates:{updated_at:new Date().toISOString()}})},e[7]=c,e[8]=d,e[9]=r,e[10]=p,e[11]=a,e[12]=P):P=e[12];const L=P;let U;e[13]!==n?(U=W=>{console.error("[chat] Chat error:",W),n?.(W)},e[13]=n,e[14]=U):U=e[14];let H;e[15]!==T||e[16]!==A||e[17]!==L||e[18]!==i||e[19]!==U||e[20]!==I?(H={id:A,messages:T,transport:I,onFinish:L,onToolCall:i,onError:U},e[15]=T,e[16]=A,e[17]=L,e[18]=i,e[19]=U,e[20]=I,e[21]=H):H=e[21];const C=hr(H);let ie;e[22]!==C?(ie=async(W,se)=>{!W?.trim()||C.status==="submitted"||C.status==="streaming"||(f(null),await C.sendMessage({id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:W}],metadata:se},{metadata:se}))},e[22]=C,e[23]=ie):ie=e[23];const Q=ie,fe=C.messages[0]?.role==="system"?C.messages.length===1:C.messages.length===0,le=C.messages,ce=C.status;let k;e[24]!==C?(k=C.stop.bind(C),e[24]=C,e[25]=k):k=e[25];let ue;e[26]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>f(null),e[26]=ue):ue=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]!==g||e[33]!==fe||e[34]!==Q||e[35]!==k?(z={messages:le,status:ce,sendMessage:Q,stop:k,setMessages:C.setMessages,isEmpty:fe,error:C.error,clearError:C.clearError,finishReason:g,clearFinishReason:ue},e[27]=C.clearError,e[28]=C.error,e[29]=C.messages,e[30]=C.setMessages,e[31]=C.status,e[32]=g,e[33]=fe,e[34]=Q,e[35]=k,e[36]=z):z=e[36],z}function yr(t){return t.type==="text"}function br(t){return t.parts?.find(xr)}function xr(t){return t.type==="text"}function _r(t){const e=/\/[^/]+\/mcps\/([^/]+)\/([^/]+)\/([^/]+)/,a=t.match(e);return a&&a[1]&&a[2]&&a[3]?{connectionId:decodeURIComponent(a[1]),collectionName:decodeURIComponent(a[2]),itemId:decodeURIComponent(a[3])}:{connectionId:null,collectionName:null,itemId:null}}function qr(t){const e=G.c(5),a=ma();let s;e[0]!==a.location.pathname?(s=_r(a.location.pathname),e[0]=a.location.pathname,e[1]=s):s=e[1];const{connectionId:r,collectionName:n,itemId:i}=s,o=_a();let c;e[2]!==t||e[3]!==o?(c=t?o.find(g=>g.id===t):null,e[2]=t,e[3]=o,e[4]=c):c=e[4];const l=c,[p]=Ea(t);let d=`You are an AI assistant running in an MCP Mesh environment.
|
|
12
|
-
|
|
13
|
-
## About MCP Mesh
|
|
14
|
-
The Model Context Protocol (MCP) Mesh allows users to connect external Connections and expose their capabilities through Agents (also called Gateways). Each Agent provides access to a curated set of tools from connected Connections.
|
|
15
|
-
|
|
16
|
-
## Important Notes
|
|
17
|
-
- All tool calls are logged and audited for security and compliance
|
|
18
|
-
- You have access to the tools exposed through the selected agent
|
|
19
|
-
- MCPs may expose resources that users can browse and edit
|
|
20
|
-
- You have context to the current agent and its tools, resources, and prompts
|
|
21
|
-
- When users mention "agents", they are referring to gateways and the tools available through them`;return t&&(d=`You are an AI assistant running in an MCP Mesh environment.
|
|
22
|
-
|
|
23
|
-
## About MCP Mesh
|
|
24
|
-
The Model Context Protocol (MCP) Mesh allows users to connect external Connections and expose their capabilities through Agents (also called Gateways). Each Agent provides access to a curated set of tools from connected Connections.
|
|
25
|
-
|
|
26
|
-
## Important Notes
|
|
27
|
-
- All tool calls are logged and audited for security and compliance
|
|
28
|
-
- You have access to the tools exposed through the selected agent
|
|
29
|
-
- MCPs may expose resources that users can browse and edit
|
|
30
|
-
- You have context to the current agent and its tools, resources, and prompts
|
|
31
|
-
- When users mention "agents", they are referring to gateways and the tools available through them
|
|
32
|
-
|
|
33
|
-
## Current Agent/Gateway
|
|
34
|
-
You are talking to the user through the following Agent/Gateway:
|
|
35
|
-
- Name: ${l?.title||"Unknown Agent"}
|
|
36
|
-
- ID: ${t}`,p?.trim()&&(d=d+`
|
|
37
|
-
|
|
38
|
-
## Agent Instructions
|
|
39
|
-
The following are specific instructions for this agent:
|
|
40
|
-
|
|
41
|
-
${p}`)),(r||n||i)&&(d=d+`
|
|
42
|
-
|
|
43
|
-
## Current Editing Context`,r&&(d=d+`
|
|
44
|
-
- Connection ID: ${r}`),n&&(d=d+`
|
|
45
|
-
- Collection Name: ${n}`),i&&(d=d+`
|
|
46
|
-
- Item ID: ${i}`),d=d+`
|
|
47
|
-
|
|
48
|
-
Help the user understand and work with this resource.`),d}const bt=3;function Er(t){const e=G.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 d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=/_/g,e[5]=d):d=e[5],o=i.replace(d," "),e[3]=i,e[4]=o}else o=e[4];let c;e[6]!==n||e[7]!==o?(c=m.jsx(Je,{asChild:!0,children:m.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=m.jsx(We,{side:"bottom",className:"max-w-xs",children:m.jsx("p",{className:"text-xs",children:r})}),e[9]=r,e[10]=l):l=e[10];let p;return e[11]!==c||e[12]!==l?(p=m.jsxs(qe,{children:[c,l]}),e[11]=c,e[12]=l,e[13]=p):p=e[13],p}function wr(t){const e=G.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 g=a.slice(0,bt),f=a.slice(bt),v=f.length>0;n=wt,l=300,e[8]!==r?(i=he("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=>m.jsx(Er,{prompt:y,onSelect:s},y.name),e[10]=s,e[11]=b):b=e[11],o=g.map(b),c=v&&m.jsxs(It,{children:[m.jsx(St,{asChild:!0,children:m.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]})}),m.jsx(Nt,{side:"bottom",align:"center",className:"w-auto p-2",children:m.jsx("div",{className:"flex flex-col gap-1",children:f.map(y=>{const _=y.description??y.name;return m.jsxs(qe,{children:[m.jsx(Je,{asChild:!0,children:m.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," ")})}),m.jsx(We,{side:"right",className:"max-w-xs",children:m.jsx("p",{className:"text-xs",children:_})})]},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 p;e[12]!==i||e[13]!==o||e[14]!==c?(p=m.jsxs("div",{className:i,children:[o,c]}),e[12]=i,e[13]=o,e[14]=c,e[15]=p):p=e[15];let d;return e[16]!==n||e[17]!==l||e[18]!==p?(d=m.jsx(n,{delayDuration:l,children:p}),e[16]=n,e[17]=l,e[18]=p,e[19]=d):d=e[19],d}async function Ir(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 Sr(t){const e=G.c(7);let a;e[0]!==t?(a=xt.gatewayPrompts(t),e[0]=t,e[1]=a):a=e[1];let s;e[2]!==t?(s=()=>Ir(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],fa(r)}function Jr(t){const e=G.c(4),{gatewayId:a,onSelect:s,className:r}=t,n=r===void 0?"mt-6":r,{data:i}=Sr(a);if(i.length===0)return null;let o;return e[0]!==n||e[1]!==s||e[2]!==i?(o=m.jsx(wr,{prompts:i,onSelect:s,className:n}),e[0]=n,e[1]=s,e[2]=i,e[3]=o):o=e[3],o}function Wr({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]=J.useState(!1),l=wa(),p=ha(),d=async()=>{if(!s||!r){Ze.error("Not authenticated");return}c(!0);try{const g=n?.find(b=>b.connection_url===Ta);if(g){p({to:"/$org/mcps/$connectionId",params:{org:a,connectionId:g.id}});return}const f=Aa({id:Ca("conn")}),v=await l.create.mutateAsync(f);p({to:"/$org/mcps/$connectionId",params:{org:a,connectionId:v.id}})}catch(g){Ze.error(`Failed to connect OpenRouter: ${g instanceof Error?g.message:String(g)}`)}finally{c(!1)}};return m.jsx(Ia,{image:m.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:m.jsxs(m.Fragment,{children:[m.jsxs(Me,{variant:"outline",onClick:d,disabled:o,children:[m.jsx("img",{src:Na,alt:"OpenRouter",className:"size-4"}),o?"Installing...":"Install OpenRouter"]}),m.jsx(Me,{variant:"outline",onClick:i,children:"Install Connection"})]})})}function Nr(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 Tr(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=[],p=[];for(const g of t){const f=new Date(g.updated_at);f>=a?i.push(g):f>=s?o.push(g):f>=r?c.push(g):f>=n?l.push(g):p.push(g)}const d=[];return i.length>0&&d.push({label:"Today",threads:i,showRelativeTime:!0}),o.length>0&&d.push({label:"Yesterday",threads:o,showRelativeTime:!1}),c.length>0&&d.push({label:"7 days ago",threads:c,showRelativeTime:!1}),l.length>0&&d.push({label:"30 days ago",threads:l,showRelativeTime:!1}),p.length>0&&d.push({label:"Older",threads:p,showRelativeTime:!1}),d}function Yr(t){const e=G.c(49),{threads:a,activeThreadId:s,onSelectThread:r,onRemoveThread:n,onOpen:i,variant:o}=t,c=o===void 0?"icon":o,[l,p]=J.useState("");let d,g,f,v,b,y,_,N,u,T,A,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,ie=Tr(C);let Q;e[19]!==i?(Q=k=>{k?i?.():p("")},e[19]=i,e[20]=Q):Q=e[20];const fe=Q;v=wt,f=qe,g=It,T=fe,e[21]!==c?(A=m.jsx(Je,{asChild:!0,children:m.jsx(St,{asChild:!0,children:c==="outline"?m.jsx(Me,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input","aria-label":"Chat history",children:m.jsx(Qe,{size:16})}):m.jsx(Me,{type:"button",variant:"ghost",size:"icon",className:"size-6 p-1 hover:bg-transparent","aria-label":"Chat history",children:m.jsx(Qe,{size:16,className:"text-muted-foreground hover:text-foreground transition-colors"})})})}),e[21]=c,e[22]=A):A=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(w=m.jsx(We,{children:"Chat history"}),e[23]=w):w=e[23],d=Nt,_="end",N="w-80 p-0";let le;e[24]===Symbol.for("react.memo_cache_sentinel")?(le=m.jsx(Sa,{size:16,className:"text-muted-foreground shrink-0"}),e[24]=le):le=e[24];let ce;e[25]===Symbol.for("react.memo_cache_sentinel")?(ce=k=>p(k.target.value),e[25]=ce):ce=e[25],e[26]!==l?(u=m.jsx("div",{className:"border-b",children:m.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[le,m.jsx("input",{type:"text",placeholder:"Search chats...",value:l,onChange:ce,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?m.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:l.trim()?"No chats found":"No chats yet"}):ie.map((k,ue)=>m.jsxs("div",{children:[ue>0&&m.jsx("div",{className:"border-t mx-3"}),m.jsx("div",{className:"px-3 py-1",children:m.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:k.label})}),k.threads.map(z=>{const W=z.id===s;return m.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group ${W?"bg-accent/50":""}`,onClick:()=>r(z.id),children:[m.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[m.jsx("span",{className:"text-sm truncate",children:z.title||"New chat"}),m.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:W?"current":k.showRelativeTime?Nr(z.updated_at):null})]}),m.jsx("button",{type:"button",onClick:se=>{se.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:m.jsx(Ra,{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]=d,e[8]=g,e[9]=f,e[10]=v,e[11]=b,e[12]=y,e[13]=_,e[14]=N,e[15]=u,e[16]=T,e[17]=A,e[18]=w}else d=e[7],g=e[8],f=e[9],v=e[10],b=e[11],y=e[12],_=e[13],N=e[14],u=e[15],T=e[16],A=e[17],w=e[18];let I;e[28]!==b||e[29]!==y?(I=m.jsx("div",{className:b,children:y}),e[28]=b,e[29]=y,e[30]=I):I=e[30];let P;e[31]!==d||e[32]!==I||e[33]!==_||e[34]!==N||e[35]!==u?(P=m.jsxs(d,{align:_,className:N,children:[u,I]}),e[31]=d,e[32]=I,e[33]=_,e[34]=N,e[35]=u,e[36]=P):P=e[36];let L;e[37]!==g||e[38]!==P||e[39]!==T||e[40]!==A||e[41]!==w?(L=m.jsxs(g,{onOpenChange:T,children:[A,w,P]}),e[37]=g,e[38]=P,e[39]=T,e[40]=A,e[41]=w,e[42]=L):L=e[42];let U;e[43]!==f||e[44]!==L?(U=m.jsx(f,{children:L}),e[43]=f,e[44]=L,e[45]=U):U=e[45];let H;return e[46]!==v||e[47]!==U?(H=m.jsx(v,{children:U}),e[46]=v,e[47]=U,e[48]=H):H=e[48],H}export{Fr as D,Jr as G,Wr as N,Yr as T,zr as a,Vr as b,qr as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as b,c as v,j as w,K as $,p as A,B as W,t as O}from"./index-C4Akli_y.js";import{c as I,u as F}from"./input-DotiBI6p.js";import{u as L}from"./project-context-provider-CjwpGeXi.js";const U=({size:n=24,color:e="currentColor",...r})=>b.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},b.createElement("path",{d:"M20.5 7.278 12 12m0 0L3.5 7.278M12 12v9.5m9-5.441V7.942c0-.343 0-.514-.05-.667a1 1 0 0 0-.215-.364c-.109-.119-.258-.202-.558-.368l-7.4-4.111c-.284-.158-.425-.237-.575-.267a1 1 0 0 0-.403 0c-.15.03-.292.11-.576.267l-7.4 4.11c-.3.167-.45.25-.558.369a1 1 0 0 0-.215.364C3 7.428 3 7.599 3 7.942v8.117c0 .342 0 .514.05.666a1 1 0 0 0 .215.364c.109.119.258.202.558.368l7.4 4.111c.284.158.425.237.576.268.133.027.27.027.402 0 .15-.031.292-.11.576-.268l7.4-4.11c.3-.167.45-.25.558-.369a.999.999 0 0 0 .215-.364c.05-.152.05-.324.05-.666Z"}));U.displayName="Container";const B=({size:n=24,color:e="currentColor",...r})=>b.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},b.createElement("path",{d:"m21 21-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"}));B.displayName="SearchMd";const D="UNKNOWN_CONNECTION_ID",M=async n=>{const r=(await n.text()).split(`
|
|
2
|
-
`).find(s=>s.startsWith("data: "));if(!r)throw new Error("No data received from the server");return JSON.parse(r.replace("data: ",""))};function q(n){if(n===D)return(async()=>{});const e=n?`/mcp/${n}`:"/mcp";return async(r,t)=>{const s=await fetch(e,{method:"POST",body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:r,arguments:t}}),headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},credentials:"include"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const o=s.headers.get("Content-Type")==="application/json"?await s.json():await M(s);if(o.result?.isError)throw new Error(o.result.content?.[0]?.text||"Tool call failed");return o.result?.structuredContent||o.result}}function Q(){const n=v.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=w.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),n[0]=e):e=n[0],e}function ie(n){const e=v.c(24),{image:r,title:t,description:s,actions:o,className:i,descriptionClassName:m,actionsClassName:p}=n;let c;e[0]!==i?(c=I("flex flex-1 flex-col items-center justify-center gap-8 p-4",i),e[0]=i,e[1]=c):c=e[1];let u;e[2]!==r?(u=r!==null&&w.jsx("div",{className:"flex items-center justify-center",children:r??w.jsx(Q,{})}),e[2]=r,e[3]=u):u=e[3];let a;e[4]!==t?(a=w.jsx("h3",{className:"text-lg font-medium text-foreground",children:t}),e[4]=t,e[5]=a):a=e[5];let d;e[6]!==m?(d=I("text-sm text-muted-foreground text-center max-w-[300px]",m),e[6]=m,e[7]=d):d=e[7];let f;e[8]!==s||e[9]!==d?(f=w.jsx("div",{className:d,children:s}),e[8]=s,e[9]=d,e[10]=f):f=e[10];let N;e[11]!==a||e[12]!==f?(N=w.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a,f]}),e[11]=a,e[12]=f,e[13]=N):N=e[13];let h;e[14]!==o||e[15]!==p?(h=o&&w.jsx("div",{className:I("flex items-center gap-2",p),children:o}),e[14]=o,e[15]=p,e[16]=h):h=e[16];let l;e[17]!==N||e[18]!==h?(l=w.jsxs("div",{className:"flex flex-col items-center gap-4",children:[N,h]}),e[17]=N,e[18]=h,e[19]=l):l=e[19];let g;return e[20]!==c||e[21]!==u||e[22]!==l?(g=w.jsxs("div",{className:c,children:[u,l]}),e[20]=c,e[21]=u,e[22]=l,e[23]=g):g=e[23],g}const J={xs:"h-6 w-6",sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"},P={xs:"min-w-6",sm:"min-w-8",md:"min-w-12",lg:"min-w-16"},R={xs:12,sm:16,md:24,lg:32};function ce(n){const e=v.c(7),{icon:r,name:t,size:s,className:o,fallbackIcon:i}=n,m=s===void 0?"md":s,p=r??"no-icon";let c;return e[0]!==o||e[1]!==i||e[2]!==r||e[3]!==t||e[4]!==m||e[5]!==p?(c=w.jsx(Z,{icon:r,name:t,size:m,className:o,fallbackIcon:i},p),e[0]=o,e[1]=i,e[2]=r,e[3]=t,e[4]=m,e[5]=p,e[6]=c):c=e[6],c}function Z(n){const e=v.c(24),{icon:r,name:t,size:s,className:o,fallbackIcon:i}=n,m=s===void 0?"md":s,[p,c]=b.useState(!1),u=!!r&&p,a=J[m],d=P[m];let f;e[0]!==o||e[1]!==a||e[2]!==d?(f=I("rounded-lg border border-border shrink-0 overflow-hidden",a,d,o),e[0]=o,e[1]=a,e[2]=d,e[3]=f):f=e[3];const N=r||void 0,h=!u&&"hidden";let l;e[4]!==h?(l=I("h-full w-full object-cover",h),e[4]=h,e[5]=l):l=e[5];let g,j;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>c(!1),j=()=>c(!0),e[6]=g,e[7]=j):(g=e[6],j=e[7]);let x;e[8]!==t||e[9]!==N||e[10]!==l?(x=w.jsx("img",{src:N,alt:t,className:l,onError:g,onLoad:j}),e[8]=t,e[9]=N,e[10]=l,e[11]=x):x=e[11];const y=u&&"hidden";let E;e[12]!==y?(E=I("h-full w-full flex items-center justify-center bg-muted/20",y),e[12]=y,e[13]=E):E=e[13];let _;e[14]!==i||e[15]!==m?(_=i??w.jsx(U,{size:R[m],className:"text-muted-foreground"}),e[14]=i,e[15]=m,e[16]=_):_=e[16];let C;e[17]!==E||e[18]!==_?(C=w.jsx("div",{className:E,children:_}),e[17]=E,e[18]=_,e[19]=C):C=e[19];let S;return e[20]!==x||e[21]!==C||e[22]!==f?(S=w.jsxs("div",{className:f,children:[x,C]}),e[20]=x,e[21]=C,e[22]=f,e[23]=S):S=e[23],S}function K(n,e,r){const t=[];if(n?.trim()){const s=n.trim(),o=r.map(i=>({field:[String(i)],operator:"contains",value:s}));o.length===1&&o[0]?t.push(o[0]):o.length>1&&t.push({operator:"or",conditions:o})}if(e&&e.length>0)for(const s of e)t.push({field:[s.column],operator:"eq",value:s.value});if(t.length!==0)return t.length===1?t[0]:{operator:"and",conditions:t}}function H(n,e,r){const t=n??r,s=e??"asc";return[{field:[String(t)],direction:s}]}function G(n,e,r,t){const s=v.c(14),{org:o}=L();let i;s[0]!==e?(i=e.toUpperCase(),s[0]=e,s[1]=i):i=s[1];const p=`COLLECTION_${i}_GET`;let c;s[2]!==e||s[3]!==r||s[4]!==o.slug||s[5]!==n?(c=$.collectionItem(o.slug,n,e,r??""),s[2]=e,s[3]=r,s[4]=o.slug,s[5]=n,s[6]=c):c=s[6];let u;s[7]!==p||s[8]!==r||s[9]!==t?(u=async()=>r?await t(p,{id:r}):{item:null},s[7]=p,s[8]=r,s[9]=t,s[10]=u):u=s[10];let a;s[11]!==c||s[12]!==u?(a={queryKey:c,queryFn:u,staleTime:6e4},s[11]=c,s[12]=u,s[13]=a):a=s[13];const{data:d}=A(a);return d.item}function V(n,e,r,t){const s=v.c(11),o=t===void 0?{}:t,{org:i}=L(),{searchTerm:m,filters:p,sortKey:c,sortDirection:u,searchFields:a,defaultSortKey:d,pageSize:f}=o,N=a===void 0?["title","description"]:a,h=d===void 0?"updated_at":d,l=f===void 0?100:f;let g;s[0]!==e?(g=e.toUpperCase(),s[0]=e,s[1]=g):g=s[1];const x=`COLLECTION_${g}_LIST`,y=K(m,p,N),E=H(c,u,h),_=JSON.stringify({where:y,orderBy:E,limit:l}),C=$.collectionList(i.slug,n,e,_);let S;s[2]!==x||s[3]!==E||s[4]!==l||s[5]!==r||s[6]!==y?(S=async()=>{const z={...y&&{where:y},...E&&{orderBy:E},limit:l,offset:0};return(await r(x,z))?.items??[]},s[2]=x,s[3]=E,s[4]=l,s[5]=r,s[6]=y,s[7]=S):S=s[7];let T;s[8]!==C||s[9]!==S?(T={queryKey:C,queryFn:S},s[8]=C,s[9]=S,s[10]=T):T=s[10];const{data:k}=A(T);return k}function Y(n,e,r){const t=v.c(39),{org:s}=L(),o=W();let i;t[0]!==e?(i=e.toUpperCase(),t[0]=e,t[1]=i):i=t[1];const m=i,p=`COLLECTION_${m}_CREATE`,c=`COLLECTION_${m}_UPDATE`,u=`COLLECTION_${m}_DELETE`;let a;t[2]!==p||t[3]!==r?(a=async S=>(await r(p,{data:S})).item,t[2]=p,t[3]=r,t[4]=a):a=t[4];let d;t[5]!==e||t[6]!==s||t[7]!==o||t[8]!==n?(d=()=>{o.invalidateQueries({queryKey:$.collection(s.slug,n,e)}),O.success("Item created successfully")},t[5]=e,t[6]=s,t[7]=o,t[8]=n,t[9]=d):d=t[9];let f;t[10]!==a||t[11]!==d?(f={mutationFn:a,onSuccess:d,onError:te},t[10]=a,t[11]=d,t[12]=f):f=t[12];const N=F(f);let h;t[13]!==r||t[14]!==c?(h=async S=>{const{id:T,data:k}=S;return(await r(c,{id:T,data:k})).item},t[13]=r,t[14]=c,t[15]=h):h=t[15];let l;t[16]!==e||t[17]!==s||t[18]!==o||t[19]!==n?(l=()=>{o.invalidateQueries({queryKey:$.collection(s.slug,n,e)}),O.success("Item updated successfully")},t[16]=e,t[17]=s,t[18]=o,t[19]=n,t[20]=l):l=t[20];let g;t[21]!==h||t[22]!==l?(g={mutationFn:h,onSuccess:l,onError:ee},t[21]=h,t[22]=l,t[23]=g):g=t[23];const j=F(g);let x;t[24]!==u||t[25]!==r?(x=async S=>(await r(u,{id:S})).item.id,t[24]=u,t[25]=r,t[26]=x):x=t[26];let y;t[27]!==e||t[28]!==s||t[29]!==o||t[30]!==n?(y=()=>{o.invalidateQueries({queryKey:$.collection(s.slug,n,e)}),O.success("Item deleted successfully")},t[27]=e,t[28]=s,t[29]=o,t[30]=n,t[31]=y):y=t[31];let E;t[32]!==x||t[33]!==y?(E={mutationFn:x,onSuccess:y,onError:X},t[32]=x,t[33]=y,t[34]=E):E=t[34];const _=F(E);let C;return t[35]!==N||t[36]!==_||t[37]!==j?(C={create:N,update:j,delete:_},t[35]=N,t[36]=_,t[37]=j,t[38]=C):C=t[38],C}function X(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to delete item: ${e}`)}function ee(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to update item: ${e}`)}function te(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to create item: ${e}`)}function ae(n){const e=v.c(3);let r;e[0]!==n?(r=n===void 0?{}:n,e[0]=n,e[1]=r):r=e[1];const t=r,{org:s}=L();let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=q(),e[2]=o):o=e[2];const i=o;return V(s.slug,"CONNECTIONS",i,t)}function le(n){const e=v.c(1),{org:r}=L();let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=q(),e[0]=t):t=e[0];const s=t;return G(r.slug,"CONNECTIONS",n,s)}function ue(){const n=v.c(1),{org:e}=L();let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=q(),n[0]=r):r=n[0];const t=r;return Y(e.slug,"CONNECTIONS",t)}export{ie as E,ce as I,D as U,ue as a,le as b,q as c,G as d,Y as e,V as f,B as i,U as n,ae as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as f,K as l}from"./index-C4Akli_y.js";import{u as y}from"./useQueries-BTessZmq.js";async function h(t){const e=`/mcp/${t}`,s={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const o=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-prompts",version:"1.0.0"}}})});if(!o.ok)return[];if((await o.json()).error)return[];const i=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!i.ok)return[];const r=await i.json();return r.error?[]:r.result?.prompts||[]}catch{return[]}}function P(t){const e=f.c(13);let s;e[0]!==t?(s=t.map(q),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s?(o={queries:s},e[2]=s,e[3]=o):o=e[3];const n=y(o);let i,r;if(e[4]!==t||e[5]!==n){r=new Map;let p;e[8]!==n?(p=n.some(j),e[8]=n,e[9]=p):p=e[9],i=p,t.forEach((u,m)=>{const c=n[m];c?.data?r.set(u,c.data.map(d)):r.set(u,[])}),e[4]=t,e[5]=n,e[6]=i,e[7]=r}else i=e[6],r=e[7];let a;return e[10]!==i||e[11]!==r?(a={promptsMap:r,isLoading:i},e[10]=i,e[11]=r,e[12]=a):a=e[12],a}function d(t){return{name:t.name,description:t.description}}function j(t){return t.isLoading}function q(t){return{queryKey:l.connectionPrompts(t),queryFn:()=>h(t),staleTime:6e4,retry:!1}}async function w(t){const e=`/mcp/${t}`,s={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const o=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-resources",version:"1.0.0"}}})});if(!o.ok)return[];if((await o.json()).error)return[];const i=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"resources/list",params:{}})});if(!i.ok)return[];const r=await i.json();return r.error?[]:r.result?.resources||[]}catch{return[]}}function $(t){const e=f.c(13);let s;e[0]!==t?(s=t.map(O),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s?(o={queries:s},e[2]=s,e[3]=o):o=e[3];const n=y(o);let i,r;if(e[4]!==t||e[5]!==n){r=new Map;let p;e[8]!==n?(p=n.some(g),e[8]=n,e[9]=p):p=e[9],i=p,t.forEach((u,m)=>{const c=n[m];c?.data?r.set(u,c.data.map(S)):r.set(u,[])}),e[4]=t,e[5]=n,e[6]=i,e[7]=r}else i=e[6],r=e[7];let a;return e[10]!==i||e[11]!==r?(a={resourcesMap:r,isLoading:i},e[10]=i,e[11]=r,e[12]=a):a=e[12],a}function S(t){return{uri:t.uri,name:t.name,description:t.description}}function g(t){return t.isLoading}function O(t){return{queryKey:l.connectionResources(t),queryFn:()=>w(t),staleTime:6e4,retry:!1}}export{$ as a,P as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,c as n}from"./index-C4Akli_y.js";import{f as u,e as f,d as h,c as l}from"./use-connection-DRGfApkr.js";import{u as a}from"./project-context-provider-CjwpGeXi.js";const C=({size:o=24,color:e="currentColor",...t})=>i.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},i.createElement("path",{d:"M9 2v3m6-3v3M9 19v3m6-3v3m4-13h3m-3 5h3M2 9h3m-3 5h3m4.8 5h4.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C19 16.72 19 15.88 19 14.2V9.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C16.72 5 15.88 5 14.2 5H9.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C5 7.28 5 8.12 5 9.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C7.28 19 8.12 19 9.8 19Z"}));C.displayName="CpuChip02";function v(o){const e=n.c(3);let t;e[0]!==o?(t=o===void 0?{}:o,e[0]=o,e[1]=t):t=e[1];const s=t,{org:r}=a();let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=l(),e[2]=c):c=e[2];const m=c;return u(r.slug,"GATEWAY",m,s)}function A(o){const e=n.c(1),{org:t}=a();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=l(),e[0]=s):s=e[0];const r=s;return h(t.slug,"GATEWAY",o,r)}function y(){const o=n.c(1),{org:e}=a();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=l(),o[0]=t):t=o[0];const s=t;return f(e.slug,"GATEWAY",s)}export{y as a,A as b,C as i,v as u};
|