@decocms/mesh 2.29.0 → 2.29.2
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-3Pxg2P_i.js → AlertCircle-BjDAjYli.js} +1 -1
- package/dist/client/assets/{ArrowLeft-UBssGQ3_.js → ArrowLeft-C3b0kZkv.js} +1 -1
- package/dist/client/assets/{ArrowUp-MnVdQxWX.js → ArrowUp-UuyzMrp7.js} +1 -1
- package/dist/client/assets/{Check-yoiyrqoL.js → Check-BBlt8nj4.js} +1 -1
- package/dist/client/assets/{ChevronDown-BlKqZ66z.js → ChevronDown-C2nnNiko.js} +1 -1
- package/dist/client/assets/{Code01-RmXixa6y.js → Code01-BkX8PbNA.js} +1 -1
- package/dist/client/assets/{Copy01-BLLmXBc5.js → Copy01-eVnag3mk.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-BMMtv2wO.js → DotsHorizontal-D8Oa-FB4.js} +1 -1
- package/dist/client/assets/{DotsVertical-PBjWbzwJ.js → DotsVertical-Cl1hRwhg.js} +1 -1
- package/dist/client/assets/{Download01-DF_DLE8P.js → Download01-BW7f1rv9.js} +1 -1
- package/dist/client/assets/{Edit01-DjKKkpJx.js → Edit01-C2f_e3xp.js} +1 -1
- package/dist/client/assets/{File06-BvoVIa2F.js → File06-D5XMLdKt.js} +1 -1
- package/dist/client/assets/{FilterLines-ysuOZUy8.js → FilterLines-ZY2ZET-V.js} +1 -1
- package/dist/client/assets/{FlipBackward-DwAzBzjC.js → FlipBackward-BX_e7PV2.js} +1 -1
- package/dist/client/assets/{GitBranch01-RTsu2Pt_.js → GitBranch01-BBkuZ0g6.js} +1 -1
- package/dist/client/assets/{Grid01-CNEf3UoL.js → Grid01-uChhmLMS.js} +1 -1
- package/dist/client/assets/{Home02-DsDxDk7R.js → Home02-C3AGNyGt.js} +1 -1
- package/dist/client/assets/{Image01-B3DlQYAI.js → Image01-Ca9fCk1g.js} +1 -1
- package/dist/client/assets/{Inbox01-CuXfbhAN.js → Inbox01-7yaEdhih.js} +1 -1
- package/dist/client/assets/{InfoCircle-BCsSecsp.js → InfoCircle-ZFVXEe-o.js} +1 -1
- package/dist/client/assets/{Key01-B3Ctc8kf.js → Key01-BVzZzDXG.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BNdqcBWP.js → LinkExternal01-DYbIdjWG.js} +1 -1
- package/dist/client/assets/{List-DFdv7PYp.js → List-DTNJ5e_Z.js} +1 -1
- package/dist/client/assets/{Loading01-BkVbIYYs.js → Loading01-CVbOjnPi.js} +1 -1
- package/dist/client/assets/{Lock01-Cza9iYC8.js → Lock01-Irv7dEl1.js} +1 -1
- package/dist/client/assets/{Play-DzPpZmgI.js → Play-el8E8avm.js} +1 -1
- package/dist/client/assets/{Plus-qNfisIQV.js → Plus-jsBXu2Jm.js} +1 -1
- package/dist/client/assets/{SearchMd-DEod-sVt.js → SearchMd-CDx95UHX.js} +1 -1
- package/dist/client/assets/{Terminal-DX8xM5mx.js → Terminal-C4vz1dQ0.js} +1 -1
- package/dist/client/assets/{Trash01-C_UVJByK.js → Trash01-hrLLpuYX.js} +1 -1
- package/dist/client/assets/{Upload01-BNJScnq4.js → Upload01-CdFUIAAb.js} +1 -1
- package/dist/client/assets/{X-DRPZjxg9.js → X-Bp6jT_CT.js} +1 -1
- package/dist/client/assets/{XClose-C6hd5X95.js → XClose-ChfIwjbU.js} +1 -1
- package/dist/client/assets/{agent-detail-DNkb-49S.js → agent-detail-BvL0RN-C.js} +1 -1
- package/dist/client/assets/{agents-BTk5hI-B.js → agents-CDU0paf2.js} +1 -1
- package/dist/client/assets/{alert-dialog-z1mADwEG.js → alert-dialog-5F29h7ch.js} +1 -1
- package/dist/client/assets/{auth-catchall-CMnpQH0c.js → auth-catchall-BnUTAkiU.js} +1 -1
- package/dist/client/assets/{avatar-CyD4y-Hs.js → avatar-_fJCi1jf.js} +1 -1
- package/dist/client/assets/{badge-BI_bD2v6.js → badge-DIpSEo79.js} +1 -1
- package/dist/client/assets/{binder-Cl6WsAkI.js → binder-QE3BUq_4.js} +1 -1
- package/dist/client/assets/{button-BjyFV51s.js → button-BID2CMhP.js} +1 -1
- package/dist/client/assets/{card-Bqtkl7sF.js → card-6juGo41K.js} +1 -1
- package/dist/client/assets/{checkbox-i6HycpjB.js → checkbox-BR6ZWQcp.js} +1 -1
- package/dist/client/assets/{collection-detail-BN9YxuXP.js → collection-detail-DdU0S4bC.js} +1 -1
- package/dist/client/assets/{collection-display-button-DbY33BY1.js → collection-display-button-CES97i9G.js} +1 -1
- package/dist/client/assets/{collection-header-Bqiij5-y.js → collection-header-C2jCnQ0V.js} +1 -1
- package/dist/client/assets/{collection-page-CK2pCBvw.js → collection-page-DQBRHwuf.js} +1 -1
- package/dist/client/assets/{collection-search-CDy1ALDw.js → collection-search-CYQ70Hoa.js} +1 -1
- package/dist/client/assets/{collection-tab-BldVah7T.js → collection-tab-5E9Q1B_9.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-m7An0eu5.js → collection-table-wrapper-CVkp-9hJ.js} +1 -1
- package/dist/client/assets/{connection-BsqnB2FJ.js → connection-CzagOXhI.js} +1 -1
- package/dist/client/assets/{connection-card-D5p4qN7C.js → connection-card-De1P7KUX.js} +1 -1
- package/dist/client/assets/{connection-detail-KMMxIPtX.js → connection-detail-C6yPmWnc.js} +1 -1
- package/dist/client/assets/{connections-BplBxopq.js → connections-JU4CGCz5.js} +1 -1
- package/dist/client/assets/constants-VQyKSexs.js +1 -0
- package/dist/client/assets/{create-organization-dialog-De9L3SMV.js → create-organization-dialog-DjIYezTr.js} +1 -1
- package/dist/client/assets/{dialog-BNsW_zrz.js → dialog-N6lD2G23.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CHWSOD8_.js → dropdown-menu-CZuHPcK3.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-BdNV8xr5.js → dynamic-plugin-layout-D2QU16mz.js} +1 -1
- package/dist/client/assets/{empty-state-DyuI9nxj.js → empty-state-B2MmEXSc.js} +1 -1
- package/dist/client/assets/{empty-state-C5i2xL9Y.js → empty-state-aph8hymo.js} +1 -1
- package/dist/client/assets/{env-vars-editor-CV9yJnb-.js → env-vars-editor-Bw5ArpUL.js} +1 -1
- package/dist/client/assets/{error-boundary-DAH5w09n.js → error-boundary-BSc3aikh.js} +1 -1
- package/dist/client/assets/extract-connection-data-DsBhcJbM.js +1 -0
- package/dist/client/assets/{file-browser-DahftWvE.js → file-browser-C7oCWAQD.js} +2 -2
- package/dist/client/assets/{form-CpXA-_lk.js → form-R15NVDAL.js} +1 -1
- package/dist/client/assets/{grid-view-wdDD9CmD.js → grid-view-CW_NhGu9.js} +1 -1
- package/dist/client/assets/{home-CBA6ueFs.js → home-QfrULyzV.js} +1 -1
- package/dist/client/assets/{index-Acn1-Gvl.js → index-BfX1PMhV.js} +2 -2
- package/dist/client/assets/{index-RkAiu7dw.js → index-C0cxXUhv.js} +2 -2
- package/dist/client/assets/{index-Bi6yHeuG.js → index-DJuj6s5W.js} +2 -2
- package/dist/client/assets/{index-mkoS7UEj.js → index-kNWs-Kaj.js} +1 -1
- package/dist/client/assets/{index-ipYvuB0t.js → index-wl-vFw7b.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-DH6m7Sll.js → infiniteQueryObserver-CzQcKMvF.js} +1 -1
- package/dist/client/assets/{input-DRcixE8Y.js → input-DHdPZHvh.js} +1 -1
- package/dist/client/assets/{layout-BiNRh0l3.js → layout-DVqtFrGe.js} +1 -1
- package/dist/client/assets/{localstorage-keys-dTkn_1-n.js → localstorage-keys-CySryjw_.js} +1 -1
- package/dist/client/assets/{login-QUKgRhwS.js → login-DK-wLmSi.js} +1 -1
- package/dist/client/assets/{mcp-oauth-B-g9ojPu.js → mcp-oauth-C_uVzdje.js} +1 -1
- package/dist/client/assets/{mcp-server-card-XwnUNNr9.js → mcp-server-card-utdZ5S32.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-cPnmRiqN.js → mcp-server-detail-MhY6fdyG.js} +1 -1
- package/dist/client/assets/{members-Cei1ckuA.js → members-BM4vbqXY.js} +1 -1
- package/dist/client/assets/{monaco-editor-8ajNlMw5.js → monaco-editor-Bvv8L85C.js} +1 -1
- package/dist/client/assets/{monitoring-BK7JN-tH.js → monitoring-CaEhdIcr.js} +1 -1
- package/dist/client/assets/{oauth-callback-DljX8KLG.js → oauth-callback-HFODG9C4.js} +1 -1
- package/dist/client/assets/{page-C0J8_JPM.js → page-0IgoQPj0.js} +1 -1
- package/dist/client/assets/{page-5AfD8I9m.js → page-BbtKYCEh.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-KizaOWag.js → pin-to-sidebar-button-BTWnJIgz.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-IozJJ6yY.js → plugin-empty-state-LAcvmaUO.js} +1 -1
- package/dist/client/assets/{plugin-header-Cjl2nXLB.js → plugin-header-CIa7SNC1.js} +1 -1
- package/dist/client/assets/{plugins-BC6u2kHV.js → plugins-Zgv-qqyu.js} +1 -1
- package/dist/client/assets/{popover-CRsqCTCD.js → popover-ffhxj7L9.js} +1 -1
- package/dist/client/assets/{project-context-provider-CMPckjDL.js → project-context-provider-CG5Jt9jX.js} +1 -1
- package/dist/client/assets/{registry-utils-4u_OxIPh.js → registry-utils-Cqqa8TSE.js} +1 -1
- package/dist/client/assets/{resizable-CwB-UcIk.js → resizable-e7LRtN-0.js} +1 -1
- package/dist/client/assets/{resource-tabs-Bok-aIug.js → resource-tabs-B6SPH4Q6.js} +1 -1
- package/dist/client/assets/schema-BesiDnBO.js +1 -0
- package/dist/client/assets/{select-De66oXlo.js → select-Cd19OBy8.js} +1 -1
- package/dist/client/assets/{settings-Dg0_jjfj.js → settings-DgjJ7rwy.js} +1 -1
- package/dist/client/assets/shell-layout-C4m50Amb.js +3 -0
- package/dist/client/assets/{spinner-B5BpFruc.js → spinner-B3XPkxOB.js} +1 -1
- package/dist/client/assets/{switch-Dptn4iU8.js → switch-rXNPyRWr.js} +1 -1
- package/dist/client/assets/{textarea-Cp2Q3idX.js → textarea-B0dfI4Xu.js} +1 -1
- package/dist/client/assets/{tool-set-selector-BmmXkAMq.js → tool-set-selector-DCV0H2hh.js} +1 -1
- package/dist/client/assets/{tools-list-CWezcmVT.js → tools-list-DcCgeTm7.js} +1 -1
- package/dist/client/assets/{tooltip-D_6S8XJj.js → tooltip-BpIeWmG3.js} +1 -1
- package/dist/client/assets/{typewriter-title-CJ3wXYvb.js → typewriter-title-vmu3HKS1.js} +1 -1
- package/dist/client/assets/{use-binding-CtNasu81.js → use-binding-CmWOKG-X.js} +1 -1
- package/dist/client/assets/{use-collections-B3q4szKJ.js → use-collections-BRVu5nwP.js} +1 -1
- package/dist/client/assets/{use-connection-B4LwqzAy.js → use-connection-D__nfNf6.js} +1 -1
- package/dist/client/assets/{use-connection-resources-DhxK4nxY.js → use-connection-resources-CaArMBqO.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BHiCN5B5.js → use-create-virtual-mcp-CULFY9tZ.js} +1 -1
- package/dist/client/assets/{use-list-state-v0o-iQLf.js → use-list-state-D7wpG1Rh.js} +1 -1
- package/dist/client/assets/{use-mcp-Zshi-uBD.js → use-mcp-DsR0-4yM.js} +1 -1
- package/dist/client/assets/{use-members-Ck3lla8J.js → use-members-BTTcGaAb.js} +1 -1
- package/dist/client/assets/{use-mobile-JMRj2bzL.js → use-mobile-Bw0zGvKx.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CbfCpvPO.js → use-organization-settings-DYYG9Qqm.js} +1 -1
- package/dist/client/assets/{use-tool-call-uKJah0MZ.js → use-tool-call-DdCnWg9K.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-zI75jpyP.js → use-virtual-mcp-aCxo16E3.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-system-prompt-BL6VfgiI.js → use-virtual-mcp-system-prompt-Be4EZZHh.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-Dee7xpCM.js +1 -0
- package/dist/client/assets/{useMutation-DiXSqFla.js → useMutation-DujnxbMG.js} +1 -1
- package/dist/client/assets/useQuery-CENoGrPp.js +1 -0
- package/dist/client/assets/{value-BYci-qfm.js → value-BpSoQ0Q3.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-C9TxrmrJ.js → view-mode-toggle--WEYRZgf.js} +1 -1
- package/dist/client/assets/{workflow-8HIYz4H7.js → workflow-DtxWy1GI.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +138 -138
- package/dist/server/migrate.js +52 -52
- package/dist/server/server.js +128 -128
- package/package.json +1 -1
- package/dist/client/assets/constants-Cy3ipE35.js +0 -1
- package/dist/client/assets/extract-connection-data-BwfQHbRv.js +0 -1
- package/dist/client/assets/schema-BG_5nil3.js +0 -1
- package/dist/client/assets/shell-layout-Cendnsq1.js +0 -3
- package/dist/client/assets/useInfiniteQuery-Bwi00IeS.js +0 -1
- package/dist/client/assets/useQuery-o2THkaxs.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,c as M,b_ as D,j as s,x as Z,t as w,bZ as q}from"./index-RkAiu7dw.js";import{K as L,u as H,g as R,s as Q,a as W,i as I,f as U}from"./file-browser-DahftWvE.js";import{c as $,B as E}from"./button-BjyFV51s.js";import{i as S}from"./AlertCircle-3Pxg2P_i.js";import{n as A}from"./Download01-DF_DLE8P.js";import{i as J}from"./File06-BvoVIa2F.js";import{a as P}from"./Image01-B3DlQYAI.js";import{i as T}from"./Loading01-BkVbIYYs.js";import{s as V}from"./Trash01-C_UVJByK.js";import{i as Y}from"./Upload01-BNJScnq4.js";import{u as _}from"./useMutation-DiXSqFla.js";import{u as X}from"./useQuery-o2THkaxs.js";import"./useInfiniteQuery-Bwi00IeS.js";import"./infiniteQueryObserver-DH6m7Sll.js";import"./checkbox-i6HycpjB.js";import"./Check-yoiyrqoL.js";import"./Grid01-CNEf3UoL.js";import"./Home02-DsDxDk7R.js";import"./List-DFdv7PYp.js";const B=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 8 15.04 8 15.6 8h4.13M20 9.988V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));B.displayName="File04";const G=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M8 15v3m8-5v5m-4-7.5V18m8-8.012V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));G.displayName="File07";const K=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M14 17.5l2.5-2.5-2.5-2.5m-4 0L7.5 15l2.5 2.5m10-7.512V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));K.displayName="FileCode01";const O=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M22 8.931c0-.605 0-.908-.12-1.049a.5.5 0 0 0-.42-.173c-.183.014-.397.228-.826.657L17 12l3.634 3.634c.429.429.643.643.827.657a.5.5 0 0 0 .42-.173c.119-.14.119-.444.119-1.05V8.932ZM2 9.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 5 5.12 5 6.8 5h5.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C17 7.28 17 8.12 17 9.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C14.72 19 13.88 19 12.2 19H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 16.72 2 15.88 2 14.2V9.8Z"}));O.displayName="VideoRecorder";function ee(i){const e=M.c(5),[t,g]=v.useState(!1),a=v.useRef(null),d=v.useRef(!1);let n;e[0]!==i?(n=u=>{a.current&&(a.current.disconnect(),a.current=null),u&&!d.current&&(a.current=new IntersectionObserver(y=>{const[c]=y;c?.isIntersecting&&!d.current&&(d.current=!0,g(!0),a.current?.disconnect(),a.current=null)},i),a.current.observe(u))},e[0]=i,e[1]=n):n=e[1];const l=n;let h;return e[2]!==t||e[3]!==l?(h=[t,l],e[2]=t,e[3]=l,e[4]=h):h=e[4],h}function te(i){const e=M.c(24),{objectKey:t,alt:g,className:a}=i,d=a===void 0?"":a,{connectionId:n,toolCaller:l}=D();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={rootMargin:"100px",threshold:0},e[0]=h):h=e[0];const[u,y]=ee(h);let c;e[1]!==n||e[2]!==t?(c=L.imagePreview(n,t),e[1]=n,e[2]=t,e[3]=c):c=e[3];let f;e[4]!==t||e[5]!==l?(f=async()=>{const{url:m}=await l("GET_PRESIGNED_URL",{key:t});return m},e[4]=t,e[5]=l,e[6]=f):f=e[6];let b;e[7]!==u||e[8]!==c||e[9]!==f?(b={queryKey:c,queryFn:f,enabled:u,staleTime:3e5,gcTime:6e5},e[7]=u,e[8]=c,e[9]=f,e[10]=b):b=e[10];const{data:k,isLoading:x,error:j}=X(b);let p;e[11]!==d?(p=$("relative w-full h-full flex items-center justify-center overflow-hidden",d),e[11]=d,e[12]=p):p=e[12];let r;e[13]!==g||e[14]!==j||e[15]!==k||e[16]!==x||e[17]!==u||e[18]!==t?(r=!u||x?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:x?s.jsx(T,{size:24,className:"animate-spin"}):s.jsx(P,{size:48})}):j?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:s.jsx(S,{size:24})}):k?s.jsx("img",{src:k,alt:g||t,className:"w-full h-full object-cover",loading:"lazy"}):null,e[13]=g,e[14]=j,e[15]=k,e[16]=x,e[17]=u,e[18]=t,e[19]=r):r=e[19];let o;return e[20]!==y||e[21]!==p||e[22]!==r?(o=s.jsx("div",{ref:y,className:p,children:r}),e[20]=y,e[21]=p,e[22]=r,e[23]=o):o=e[23],o}const z=12,se={Image01:P,VideoRecorder:O,Music01:I,File02:I,File04:B,File06:J,File07:G,FileCode01:K,Folder:q};function re(i){const e=i.split(".").pop()?.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp","ico"].includes(e||"")}function oe(i){const e=M.c(41),{item:t,onNavigate:g,onDownload:a,onDelete:d}=i;let n;e[0]!==t.key?(n=R(t.key),e[0]=t.key,e[1]=n):n=e[1];const l=n,h=t.isFolder?"Folder":W(t.key),u=se[h]||I;let y;e[2]!==t.isFolder||e[3]!==t.key?(y=!t.isFolder&&re(t.key),e[2]=t.isFolder,e[3]=t.key,e[4]=y):y=e[4];const c=y;let f;e[5]!==t.isFolder||e[6]!==t.key||e[7]!==g?(f=()=>t.isFolder?g(t.key):void 0,e[5]=t.isFolder,e[6]=t.key,e[7]=g,e[8]=f):f=e[8];const b=!c&&"p-4",k=t.isFolder?"cursor-pointer":"cursor-default";let x;e[9]!==b||e[10]!==k?(x=$("flex flex-col items-center justify-center w-full h-full",b,k),e[9]=b,e[10]=k,e[11]=x):x=e[11];let j;e[12]!==u||e[13]!==c||e[14]!==t.isFolder||e[15]!==t.key||e[16]!==l?(j=c?s.jsx("div",{className:"absolute inset-0",children:s.jsx(te,{objectKey:t.key,alt:l})}):s.jsx(u,{size:48,className:$(t.isFolder?"text-amber-500":"text-muted-foreground")}),e[12]=u,e[13]=c,e[14]=t.isFolder,e[15]=t.key,e[16]=l,e[17]=j):j=e[17];let p;e[18]!==c||e[19]!==t.isFolder||e[20]!==t.size||e[21]!==l?(p=c?s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2 pt-6",children:[s.jsx("span",{className:"text-sm text-white text-center line-clamp-1 block",children:l}),s.jsx("span",{className:"text-xs text-white/70 text-center block",children:U(t.size)})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mt-3 text-sm text-center line-clamp-2 px-2",children:l}),!t.isFolder&&s.jsx("span",{className:"mt-1 text-xs text-muted-foreground",children:U(t.size)})]}),e[18]=c,e[19]=t.isFolder,e[20]=t.size,e[21]=l,e[22]=p):p=e[22];let r;e[23]!==f||e[24]!==x||e[25]!==j||e[26]!==p?(r=s.jsxs("button",{type:"button",onClick:f,className:x,children:[j,p]}),e[23]=f,e[24]=x,e[25]=j,e[26]=p,e[27]=r):r=e[27];let o;e[28]!==t.isFolder||e[29]!==t.key||e[30]!==d||e[31]!==a?(o=!t.isFolder&&s.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0",onClick:F=>{F.stopPropagation(),a(t.key)},children:s.jsx(A,{size:14})}),s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})]}),e[28]=t.isFolder,e[29]=t.key,e[30]=d,e[31]=a,e[32]=o):o=e[32];let m;e[33]!==t.isFolder||e[34]!==t.key||e[35]!==d?(m=t.isFolder&&s.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})}),e[33]=t.isFolder,e[34]=t.key,e[35]=d,e[36]=m):m=e[36];let N;return e[37]!==o||e[38]!==m||e[39]!==r?(N=s.jsxs("div",{className:"group relative aspect-square bg-muted/30 rounded-lg border border-border hover:border-primary/50 hover:bg-muted/50 transition-colors overflow-hidden",children:[r,o,m]}),e[37]=o,e[38]=m,e[39]=r,e[40]=N):N=e[40],N}function Fe({prefix:i,flat:e,onNavigate:t}){const g=v.useRef(null),a=Z(),{connectionId:d,toolCaller:n}=D(),{objects:l,isLoading:h,isFetchingMore:u,hasMore:y,loadMore:c,error:f}=H({prefix:i,flat:e,pageSize:z}),b=_({mutationFn:async r=>{const o=i+r.name,{url:m}=await n("PUT_PRESIGNED_URL",{key:o,contentType:r.type||"application/octet-stream"}),N=await fetch(m,{method:"PUT",body:r,headers:{"Content-Type":r.type||"application/octet-stream"}});if(!N.ok)throw new Error(`Upload failed: ${N.statusText}`);return o},onSuccess:r=>{w.success(`Uploaded ${R(r)}`),a.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Upload failed: ${r.message}`)}}),k=_({mutationFn:async r=>r.length===1&&r[0]?n("DELETE_OBJECT",{key:r[0]}):n("DELETE_OBJECTS",{keys:r}),onSuccess:()=>{w.success("Deleted successfully"),a.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Delete failed: ${r.message}`)}}),x=async r=>{try{const{url:o}=await n("GET_PRESIGNED_URL",{key:r}),m=await fetch(o);if(!m.ok)throw new Error(`Failed to fetch file: ${m.statusText}`);const N=await m.blob(),F=URL.createObjectURL(N),C=document.createElement("a");C.href=F,C.download=R(r),document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(F)}catch(o){w.error(`Download failed: ${o instanceof Error?o.message:"Unknown error"}`)}},j=r=>{const o=r.target.files;if(o){for(const m of Array.from(o))b.mutate(m);r.target.value=""}},p=r=>{if(!y||u)return;const o=r.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<200&&c()};return f?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(S,{size:48,className:"text-destructive mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading files"}),s.jsx("p",{className:"text-muted-foreground text-center",children:f.message})]}):s.jsx("div",{className:"flex-1 overflow-y-auto p-4",onScroll:p,children:h?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[s.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading files..."})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Q,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"This folder is empty"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload files to get started"}),s.jsx("input",{ref:g,type:"file",multiple:!0,className:"hidden",onChange:j}),s.jsxs(E,{variant:"outline",onClick:()=>g.current?.click(),children:[s.jsx(Y,{size:14,className:"mr-1"}),"Upload files"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:l.map(r=>s.jsx(oe,{item:r,onNavigate:t,onDownload:x,onDelete:o=>k.mutate([o])},r.key))}),u&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(T,{size:24,className:"animate-spin text-muted-foreground"})})]})})}export{Fe as default};
|
|
1
|
+
import{r as v,c as M,b_ as D,j as s,x as Z,t as w,bZ as q}from"./index-C0cxXUhv.js";import{K as L,u as H,g as R,s as Q,a as W,i as I,f as U}from"./file-browser-C7oCWAQD.js";import{c as $,B as E}from"./button-BID2CMhP.js";import{i as S}from"./AlertCircle-BjDAjYli.js";import{n as A}from"./Download01-BW7f1rv9.js";import{i as J}from"./File06-D5XMLdKt.js";import{a as P}from"./Image01-Ca9fCk1g.js";import{i as T}from"./Loading01-CVbOjnPi.js";import{s as V}from"./Trash01-hrLLpuYX.js";import{i as Y}from"./Upload01-CdFUIAAb.js";import{u as _}from"./useMutation-DujnxbMG.js";import{u as X}from"./useQuery-CENoGrPp.js";import"./useInfiniteQuery-Dee7xpCM.js";import"./infiniteQueryObserver-CzQcKMvF.js";import"./checkbox-BR6ZWQcp.js";import"./Check-BBlt8nj4.js";import"./Grid01-uChhmLMS.js";import"./Home02-C3AGNyGt.js";import"./List-DTNJ5e_Z.js";const B=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 8 15.04 8 15.6 8h4.13M20 9.988V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));B.displayName="File04";const G=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M8 15v3m8-5v5m-4-7.5V18m8-8.012V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));G.displayName="File07";const K=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M14 17.5l2.5-2.5-2.5-2.5m-4 0L7.5 15l2.5 2.5m10-7.512V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));K.displayName="FileCode01";const O=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M22 8.931c0-.605 0-.908-.12-1.049a.5.5 0 0 0-.42-.173c-.183.014-.397.228-.826.657L17 12l3.634 3.634c.429.429.643.643.827.657a.5.5 0 0 0 .42-.173c.119-.14.119-.444.119-1.05V8.932ZM2 9.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 5 5.12 5 6.8 5h5.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C17 7.28 17 8.12 17 9.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C14.72 19 13.88 19 12.2 19H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 16.72 2 15.88 2 14.2V9.8Z"}));O.displayName="VideoRecorder";function ee(i){const e=M.c(5),[t,g]=v.useState(!1),a=v.useRef(null),d=v.useRef(!1);let n;e[0]!==i?(n=u=>{a.current&&(a.current.disconnect(),a.current=null),u&&!d.current&&(a.current=new IntersectionObserver(y=>{const[c]=y;c?.isIntersecting&&!d.current&&(d.current=!0,g(!0),a.current?.disconnect(),a.current=null)},i),a.current.observe(u))},e[0]=i,e[1]=n):n=e[1];const l=n;let h;return e[2]!==t||e[3]!==l?(h=[t,l],e[2]=t,e[3]=l,e[4]=h):h=e[4],h}function te(i){const e=M.c(24),{objectKey:t,alt:g,className:a}=i,d=a===void 0?"":a,{connectionId:n,toolCaller:l}=D();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={rootMargin:"100px",threshold:0},e[0]=h):h=e[0];const[u,y]=ee(h);let c;e[1]!==n||e[2]!==t?(c=L.imagePreview(n,t),e[1]=n,e[2]=t,e[3]=c):c=e[3];let f;e[4]!==t||e[5]!==l?(f=async()=>{const{url:m}=await l("GET_PRESIGNED_URL",{key:t});return m},e[4]=t,e[5]=l,e[6]=f):f=e[6];let b;e[7]!==u||e[8]!==c||e[9]!==f?(b={queryKey:c,queryFn:f,enabled:u,staleTime:3e5,gcTime:6e5},e[7]=u,e[8]=c,e[9]=f,e[10]=b):b=e[10];const{data:k,isLoading:x,error:j}=X(b);let p;e[11]!==d?(p=$("relative w-full h-full flex items-center justify-center overflow-hidden",d),e[11]=d,e[12]=p):p=e[12];let r;e[13]!==g||e[14]!==j||e[15]!==k||e[16]!==x||e[17]!==u||e[18]!==t?(r=!u||x?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:x?s.jsx(T,{size:24,className:"animate-spin"}):s.jsx(P,{size:48})}):j?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:s.jsx(S,{size:24})}):k?s.jsx("img",{src:k,alt:g||t,className:"w-full h-full object-cover",loading:"lazy"}):null,e[13]=g,e[14]=j,e[15]=k,e[16]=x,e[17]=u,e[18]=t,e[19]=r):r=e[19];let o;return e[20]!==y||e[21]!==p||e[22]!==r?(o=s.jsx("div",{ref:y,className:p,children:r}),e[20]=y,e[21]=p,e[22]=r,e[23]=o):o=e[23],o}const z=12,se={Image01:P,VideoRecorder:O,Music01:I,File02:I,File04:B,File06:J,File07:G,FileCode01:K,Folder:q};function re(i){const e=i.split(".").pop()?.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp","ico"].includes(e||"")}function oe(i){const e=M.c(41),{item:t,onNavigate:g,onDownload:a,onDelete:d}=i;let n;e[0]!==t.key?(n=R(t.key),e[0]=t.key,e[1]=n):n=e[1];const l=n,h=t.isFolder?"Folder":W(t.key),u=se[h]||I;let y;e[2]!==t.isFolder||e[3]!==t.key?(y=!t.isFolder&&re(t.key),e[2]=t.isFolder,e[3]=t.key,e[4]=y):y=e[4];const c=y;let f;e[5]!==t.isFolder||e[6]!==t.key||e[7]!==g?(f=()=>t.isFolder?g(t.key):void 0,e[5]=t.isFolder,e[6]=t.key,e[7]=g,e[8]=f):f=e[8];const b=!c&&"p-4",k=t.isFolder?"cursor-pointer":"cursor-default";let x;e[9]!==b||e[10]!==k?(x=$("flex flex-col items-center justify-center w-full h-full",b,k),e[9]=b,e[10]=k,e[11]=x):x=e[11];let j;e[12]!==u||e[13]!==c||e[14]!==t.isFolder||e[15]!==t.key||e[16]!==l?(j=c?s.jsx("div",{className:"absolute inset-0",children:s.jsx(te,{objectKey:t.key,alt:l})}):s.jsx(u,{size:48,className:$(t.isFolder?"text-amber-500":"text-muted-foreground")}),e[12]=u,e[13]=c,e[14]=t.isFolder,e[15]=t.key,e[16]=l,e[17]=j):j=e[17];let p;e[18]!==c||e[19]!==t.isFolder||e[20]!==t.size||e[21]!==l?(p=c?s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2 pt-6",children:[s.jsx("span",{className:"text-sm text-white text-center line-clamp-1 block",children:l}),s.jsx("span",{className:"text-xs text-white/70 text-center block",children:U(t.size)})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mt-3 text-sm text-center line-clamp-2 px-2",children:l}),!t.isFolder&&s.jsx("span",{className:"mt-1 text-xs text-muted-foreground",children:U(t.size)})]}),e[18]=c,e[19]=t.isFolder,e[20]=t.size,e[21]=l,e[22]=p):p=e[22];let r;e[23]!==f||e[24]!==x||e[25]!==j||e[26]!==p?(r=s.jsxs("button",{type:"button",onClick:f,className:x,children:[j,p]}),e[23]=f,e[24]=x,e[25]=j,e[26]=p,e[27]=r):r=e[27];let o;e[28]!==t.isFolder||e[29]!==t.key||e[30]!==d||e[31]!==a?(o=!t.isFolder&&s.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0",onClick:F=>{F.stopPropagation(),a(t.key)},children:s.jsx(A,{size:14})}),s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})]}),e[28]=t.isFolder,e[29]=t.key,e[30]=d,e[31]=a,e[32]=o):o=e[32];let m;e[33]!==t.isFolder||e[34]!==t.key||e[35]!==d?(m=t.isFolder&&s.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})}),e[33]=t.isFolder,e[34]=t.key,e[35]=d,e[36]=m):m=e[36];let N;return e[37]!==o||e[38]!==m||e[39]!==r?(N=s.jsxs("div",{className:"group relative aspect-square bg-muted/30 rounded-lg border border-border hover:border-primary/50 hover:bg-muted/50 transition-colors overflow-hidden",children:[r,o,m]}),e[37]=o,e[38]=m,e[39]=r,e[40]=N):N=e[40],N}function Fe({prefix:i,flat:e,onNavigate:t}){const g=v.useRef(null),a=Z(),{connectionId:d,toolCaller:n}=D(),{objects:l,isLoading:h,isFetchingMore:u,hasMore:y,loadMore:c,error:f}=H({prefix:i,flat:e,pageSize:z}),b=_({mutationFn:async r=>{const o=i+r.name,{url:m}=await n("PUT_PRESIGNED_URL",{key:o,contentType:r.type||"application/octet-stream"}),N=await fetch(m,{method:"PUT",body:r,headers:{"Content-Type":r.type||"application/octet-stream"}});if(!N.ok)throw new Error(`Upload failed: ${N.statusText}`);return o},onSuccess:r=>{w.success(`Uploaded ${R(r)}`),a.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Upload failed: ${r.message}`)}}),k=_({mutationFn:async r=>r.length===1&&r[0]?n("DELETE_OBJECT",{key:r[0]}):n("DELETE_OBJECTS",{keys:r}),onSuccess:()=>{w.success("Deleted successfully"),a.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Delete failed: ${r.message}`)}}),x=async r=>{try{const{url:o}=await n("GET_PRESIGNED_URL",{key:r}),m=await fetch(o);if(!m.ok)throw new Error(`Failed to fetch file: ${m.statusText}`);const N=await m.blob(),F=URL.createObjectURL(N),C=document.createElement("a");C.href=F,C.download=R(r),document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(F)}catch(o){w.error(`Download failed: ${o instanceof Error?o.message:"Unknown error"}`)}},j=r=>{const o=r.target.files;if(o){for(const m of Array.from(o))b.mutate(m);r.target.value=""}},p=r=>{if(!y||u)return;const o=r.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<200&&c()};return f?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(S,{size:48,className:"text-destructive mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading files"}),s.jsx("p",{className:"text-muted-foreground text-center",children:f.message})]}):s.jsx("div",{className:"flex-1 overflow-y-auto p-4",onScroll:p,children:h?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[s.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading files..."})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Q,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"This folder is empty"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload files to get started"}),s.jsx("input",{ref:g,type:"file",multiple:!0,className:"hidden",onChange:j}),s.jsxs(E,{variant:"outline",onClick:()=>g.current?.click(),children:[s.jsx(Y,{size:14,className:"mr-1"}),"Upload files"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:l.map(r=>s.jsx(oe,{item:r,onNavigate:t,onDownload:x,onDelete:o=>k.mutate([o])},r.key))}),u&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(T,{size:24,className:"animate-spin text-muted-foreground"})})]})})}export{Fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as f,j as s,a as I,r as C,e as F,f as E,x as O,t as w}from"./index-RkAiu7dw.js";import{C as k}from"./card-Bqtkl7sF.js";import{c as y,B as $}from"./button-BjyFV51s.js";import{A as R}from"./avatar-CyD4y-Hs.js";import{i as D}from"./AlertCircle-3Pxg2P_i.js";import{i as H}from"./Check-yoiyrqoL.js";import{s as G}from"./Plus-qNfisIQV.js";import{i as Q}from"./SearchMd-DEod-sVt.js";import{s as q}from"./XClose-C6hd5X95.js";import{I as B}from"./input-DRcixE8Y.js";import{C as T}from"./create-organization-dialog-De9L3SMV.js";import"./alert-dialog-z1mADwEG.js";import"./form-CpXA-_lk.js";import"./spinner-B5BpFruc.js";import"./useMutation-DiXSqFla.js";function U(t){const e=f.c(10),{children:n,className:l,onNavigate:i,showHoverRing:r}=t,d=r===void 0?!1:r;let o;e[0]!==i?(o=p=>{i&&i(p)},e[0]=i,e[1]=o):o=e[1];const m=o,x=i&&"cursor-pointer",a=d&&"hover:ring-2 hover:ring-primary";let c;e[2]!==l||e[3]!==x||e[4]!==a?(c=y("group transition-all flex flex-col gap-0",x,a,l),e[2]=l,e[3]=x,e[4]=a,e[5]=c):c=e[5];let g;return e[6]!==n||e[7]!==m||e[8]!==c?(g=s.jsx(k,{className:c,onClick:m,children:n}),e[6]=n,e[7]=m,e[8]=c,e[9]=g):g=e[9],g}function M(t){const e=f.c(7),{url:n,fallback:l,shape:i,size:r,objectFit:d,className:o}=t,m=i===void 0?"square":i,x=r===void 0?"lg":r,a=d===void 0?"contain":d;let c;return e[0]!==o||e[1]!==l||e[2]!==a||e[3]!==m||e[4]!==x||e[5]!==n?(c=s.jsx(R,{url:n,fallback:l,shape:m,size:x,objectFit:a,className:o}),e[0]=o,e[1]=l,e[2]=a,e[3]=m,e[4]=x,e[5]=n,e[6]=c):c=e[6],c}function P(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("p-4 flex flex-col gap-4",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function V(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("font-medium truncate",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("p",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function X(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("text-sm text-muted-foreground truncate",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("h3",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function Y(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex flex-col gap-[2px]",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function J(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex justify-between items-start",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function K(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("p-4 border-t border-border flex justify-between items-center",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function W(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex items-center text-xs text-muted-foreground",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function Z(){const t=f.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex justify-between items-start",children:s.jsx("div",{className:"h-12 w-12 bg-muted rounded-lg animate-pulse"})}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[e,s.jsxs("div",{className:"flex flex-col gap-[2px]",children:[s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg animate-pulse"}),s.jsx("div",{className:"h-4 w-40 bg-muted rounded-lg animate-pulse"})]})]}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs(k,{className:"group transition-colors flex flex-col",children:[n,s.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"})]})]}),t[2]=l):l=t[2],l}const u=Object.assign(U,{Avatar:M,AvatarSection:J,Header:P,Title:V,Subtitle:X,Content:Y,Footer:K,Badge:W,Skeleton:Z}),ee={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6",8:"gap-8"},te={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8"},se={1:"@min-3xl:grid-cols-1",2:"@min-3xl:grid-cols-2",3:"@min-3xl:grid-cols-3",4:"@min-3xl:grid-cols-4",5:"@min-3xl:grid-cols-5",6:"@min-3xl:grid-cols-6",7:"@min-3xl:grid-cols-7",8:"@min-3xl:grid-cols-8"},ie={1:"@min-6xl:grid-cols-1",2:"@min-6xl:grid-cols-2",3:"@min-6xl:grid-cols-3",4:"@min-6xl:grid-cols-4",5:"@min-6xl:grid-cols-5",6:"@min-6xl:grid-cols-6",7:"@min-6xl:grid-cols-7",8:"@min-6xl:grid-cols-8"},le={1:"@min-7xl:grid-cols-1",2:"@min-7xl:grid-cols-2",3:"@min-7xl:grid-cols-3",4:"@min-7xl:grid-cols-4",5:"@min-7xl:grid-cols-5",6:"@min-7xl:grid-cols-6",7:"@min-7xl:grid-cols-7",8:"@min-7xl:grid-cols-8"},ne={1:"@min-8xl:grid-cols-1",2:"@min-8xl:grid-cols-2",3:"@min-8xl:grid-cols-3",4:"@min-8xl:grid-cols-4",5:"@min-8xl:grid-cols-5",6:"@min-8xl:grid-cols-6",7:"@min-8xl:grid-cols-7",8:"@min-8xl:grid-cols-8"};function L(t){const e=f.c(13),{children:n,columns:l,gap:i,className:r}=t;let d;e[0]!==l?(d=l===void 0?{sm:2,md:3,lg:4}:l,e[0]=l,e[1]=d):d=e[1];const o=d,x=ee[i===void 0?4:i],a=o.sm&&te[o.sm],c=o.md&&se[o.md],g=o.lg&&ie[o.lg],p=o.xl&&le[o.xl],v=o["2xl"]&&ne[o["2xl"]];let N;e[2]!==r||e[3]!==x||e[4]!==a||e[5]!==c||e[6]!==g||e[7]!==p||e[8]!==v?(N=y("w-full grid",x,a,c,g,p,v,r),e[2]=r,e[3]=x,e[4]=a,e[5]=c,e[6]=g,e[7]=p,e[8]=v,e[9]=N):N=e[9];const b=N;let h;return e[10]!==n||e[11]!==b?(h=s.jsx("div",{className:b,children:n}),e[10]=n,e[11]=b,e[12]=h):h=e[12],h}function re(t){const e=f.c(9),{count:n,columns:l,gap:i,className:r}=t,d=n===void 0?8:n;let o;e[0]!==l?(o=l===void 0?{sm:2,md:3,lg:4}:l,e[0]=l,e[1]=o):o=e[1];const m=o,x=i===void 0?4:i;let a;e[2]!==d?(a=Array.from({length:d}).map(ae),e[2]=d,e[3]=a):a=e[3];let c;return e[4]!==r||e[5]!==m||e[6]!==x||e[7]!==a?(c=s.jsx(L,{columns:m,gap:x,className:r,children:a}),e[4]=r,e[5]=m,e[6]=x,e[7]=a,e[8]=c):c=e[8],c}function ae(t,e){return s.jsxs("div",{className:"bg-card hover:bg-accent transition-colors flex flex-col rounded-lg animate-pulse",children:[s.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[s.jsx("div",{className:"h-12 w-12 bg-muted rounded-lg"}),s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg"}),s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg"})]}),s.jsxs("div",{className:"p-4 border-t border-border flex items-center",children:[s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"})]})]},e)}const A=Object.assign(L,{Skeleton:re});function oe({invitation:t}){const[e,n]=C.useState(!1),[l,i]=C.useState(!1),r=O(),d=E(),o=async()=>{n(!0);try{const a=await I.organization.acceptInvitation({invitationId:t.id});if(a.error)w.error(a.error.message),n(!1);else{const c=await I.organization.setActive({organizationId:t.organizationId});c?.data?.slug?(w.success("Invitation accepted!"),d({to:"/$org",params:{org:c.data.slug}})):(w.success("Invitation accepted! Redirecting..."),d({to:"/"}))}}catch{w.error("Failed to accept invitation"),n(!1)}},m=async()=>{i(!0);try{const a=await I.organization.rejectInvitation({invitationId:t.id});a.error?(w.error(a.error.message),i(!1)):(w.success("Invitation rejected"),await r.invalidateQueries(),i(!1))}catch{w.error("Failed to reject invitation"),i(!1)}},x=t.organizationName||t.organizationId;return s.jsxs(u,{className:"border-dashed",children:[s.jsxs(u.Header,{children:[s.jsx(u.AvatarSection,{children:s.jsx(u.Avatar,{url:"",fallback:x,size:"lg",objectFit:"contain"})}),s.jsxs(u.Content,{children:[s.jsx(u.Subtitle,{children:"You've been invited to join"}),s.jsx(u.Title,{children:x})]})]}),s.jsx(u.Footer,{className:"border-t border-dashed",children:s.jsxs("div",{className:"flex h-3.5 items-center gap-2 w-full",children:[s.jsx($,{onClick:o,disabled:e||l,className:"flex-1",size:"sm",children:e?"Accepting...":s.jsxs(s.Fragment,{children:[s.jsx(H,{size:16}),"Accept"]})}),s.jsx($,{variant:"outline",onClick:m,disabled:e||l,className:"flex-1",size:"sm",children:l?"Declining...":s.jsxs(s.Fragment,{children:[s.jsx(q,{size:16}),"Decline"]})})]})})]})}function ce({query:t}){const e=C.useContext(F),{data:n}=e.hooks.useListUserInvitations(),i=(n??[]).filter(d=>d.status==="pending"),r=t?(()=>{const d=t.toLowerCase();return i.filter(o=>o.organizationName?.toLowerCase().includes(d)||o.organizationId.toLowerCase().includes(d))})():i;return r.length===0?null:s.jsxs("div",{className:"mb-16",children:[s.jsx("h2",{className:"text-lg font-medium pb-2 border-b border-border/50 mb-6 px-2",children:"Invitations"}),s.jsx(A,{columns:{sm:2,md:3,lg:4},children:r.map(d=>s.jsx(oe,{invitation:d},d.id))})]})}function de(t){const e=f.c(14),{query:n}=t,{data:l}=I.useListOrganizations(),i=E();let r;e[0]!==l||e[1]!==n?(r=l?n?(()=>{const a=n.toLowerCase();return l.filter(c=>c.name.toLowerCase().includes(a)||c.slug.toLowerCase().includes(a))})():l:[],e[0]=l,e[1]=n,e[2]=r):r=e[2];const d=r;if(!l||l.length===0){let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"No organizations yet. Create your first organization to get started."})}),e[3]=a):a=e[3],a}if(d.length===0){let a;return e[4]!==n?(a=s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:s.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:['No organizations found matching "',n,'".']})}),e[4]=n,e[5]=a):a=e[5],a}let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o={sm:2,md:3,lg:4},e[6]=o):o=e[6];let m;if(e[7]!==d||e[8]!==i){let a;e[10]!==i?(a=c=>s.jsxs(u,{onNavigate:()=>i({to:"/$org",params:{org:c.slug}}),children:[s.jsxs(u.Header,{children:[s.jsx(u.AvatarSection,{children:s.jsx(u.Avatar,{url:c.logo||"",fallback:c.name,size:"lg",objectFit:"contain"})}),s.jsxs(u.Content,{children:[s.jsxs(u.Subtitle,{children:["@",c.slug]}),s.jsx(u.Title,{children:c.name})]})]}),s.jsx(u.Footer,{children:s.jsxs("div",{className:"flex h-3.5 items-center text-xs text-muted-foreground",children:["Created:"," ",new Date(c.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})]})})]},c.id),e[10]=i,e[11]=a):a=e[11],m=d.map(a),e[7]=d,e[8]=i,e[9]=m}else m=e[9];let x;return e[12]!==m?(x=s.jsx(A,{columns:o,children:m}),e[12]=m,e[13]=x):x=e[13],x}function me(t){const e=f.c(3),{error:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(D,{size:24,className:"text-destructive"}),e[0]=l):l=e[0];let i;return e[1]!==n.message?(i=s.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[l,s.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:["Error loading organizations: ",n.message]})]}),e[1]=n.message,e[2]=i):i=e[2],i}function xe(){const t=f.c(27),{error:e,isPending:n}=I.useListOrganizations(),[l,i]=C.useState(""),[r,d]=C.useState(!1),o=C.useDeferredValue(l);if(n){let j;return t[0]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"max-w-6xl mx-auto p-8",children:s.jsx("div",{className:"@container",children:s.jsx(A.Skeleton,{count:8,columns:{sm:2,md:3,lg:4}})})}),t[0]=j):j=t[0],j}if(e){let j;return t[1]!==e?(j=s.jsx("div",{className:"max-w-6xl mx-auto p-8",children:s.jsx(me,{error:e})}),t[1]=e,t[2]=j):j=t[2],j}let m;t[3]!==o?(m=s.jsx(C.Suspense,{fallback:null,children:s.jsx(ce,{query:o})}),t[3]=o,t[4]=m):m=t[4];let x;t[5]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("h2",{className:"text-lg font-medium",children:"My organizations"}),t[5]=x):x=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Q,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=j=>i(j.target.value),t[7]=c):c=t[7];let g;t[8]!==l?(g=s.jsxs("div",{className:"relative",children:[a,s.jsx(B,{className:"pl-8 h-8 w-52 border-none shadow-none focus-visible:ring-0",placeholder:"Search organizations...",value:l,onChange:c})]}),t[8]=l,t[9]=g):g=t[9];let p;t[10]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs($,{size:"sm",onClick:()=>d(!0),children:[s.jsx(G,{size:16}),s.jsx("span",{children:"New organization"})]}),t[10]=p):p=t[10];let v;t[11]!==g?(v=s.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-border/50 mb-6 px-2",children:[x,s.jsxs("div",{className:"flex items-center gap-3",children:[g,p]})]}),t[11]=g,t[12]=v):v=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(A.Skeleton,{count:8,columns:{sm:2,md:3,lg:4}}),t[13]=N):N=t[13];let b;t[14]!==o?(b=s.jsx(C.Suspense,{fallback:N,children:s.jsx(de,{query:o})}),t[14]=o,t[15]=b):b=t[15];let h;t[16]!==v||t[17]!==b?(h=s.jsxs("div",{children:[v,b]}),t[16]=v,t[17]=b,t[18]=h):h=t[18];let S;t[19]!==m||t[20]!==h?(S=s.jsxs("div",{className:"@container",children:[m,h]}),t[19]=m,t[20]=h,t[21]=S):S=t[21];let z;t[22]!==r?(z=s.jsx(T,{open:r,onOpenChange:d}),t[22]=r,t[23]=z):z=t[23];let _;return t[24]!==S||t[25]!==z?(_=s.jsxs("div",{className:"max-w-6xl mx-auto p-8",children:[S,z]}),t[24]=S,t[25]=z,t[26]=_):_=t[26],_}function _e(){const t=f.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"min-h-full",children:s.jsx(xe,{})}),t[0]=e):e=t[0],e}export{_e as default};
|
|
1
|
+
import{c as f,j as s,a as I,r as C,e as F,f as E,x as O,t as w}from"./index-C0cxXUhv.js";import{C as k}from"./card-6juGo41K.js";import{c as y,B as $}from"./button-BID2CMhP.js";import{A as R}from"./avatar-_fJCi1jf.js";import{i as D}from"./AlertCircle-BjDAjYli.js";import{i as H}from"./Check-BBlt8nj4.js";import{s as G}from"./Plus-jsBXu2Jm.js";import{i as Q}from"./SearchMd-CDx95UHX.js";import{s as q}from"./XClose-ChfIwjbU.js";import{I as B}from"./input-DHdPZHvh.js";import{C as T}from"./create-organization-dialog-DjIYezTr.js";import"./alert-dialog-5F29h7ch.js";import"./form-R15NVDAL.js";import"./spinner-B3XPkxOB.js";import"./useMutation-DujnxbMG.js";function U(t){const e=f.c(10),{children:n,className:l,onNavigate:i,showHoverRing:r}=t,d=r===void 0?!1:r;let o;e[0]!==i?(o=p=>{i&&i(p)},e[0]=i,e[1]=o):o=e[1];const m=o,x=i&&"cursor-pointer",a=d&&"hover:ring-2 hover:ring-primary";let c;e[2]!==l||e[3]!==x||e[4]!==a?(c=y("group transition-all flex flex-col gap-0",x,a,l),e[2]=l,e[3]=x,e[4]=a,e[5]=c):c=e[5];let g;return e[6]!==n||e[7]!==m||e[8]!==c?(g=s.jsx(k,{className:c,onClick:m,children:n}),e[6]=n,e[7]=m,e[8]=c,e[9]=g):g=e[9],g}function M(t){const e=f.c(7),{url:n,fallback:l,shape:i,size:r,objectFit:d,className:o}=t,m=i===void 0?"square":i,x=r===void 0?"lg":r,a=d===void 0?"contain":d;let c;return e[0]!==o||e[1]!==l||e[2]!==a||e[3]!==m||e[4]!==x||e[5]!==n?(c=s.jsx(R,{url:n,fallback:l,shape:m,size:x,objectFit:a,className:o}),e[0]=o,e[1]=l,e[2]=a,e[3]=m,e[4]=x,e[5]=n,e[6]=c):c=e[6],c}function P(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("p-4 flex flex-col gap-4",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function V(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("font-medium truncate",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("p",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function X(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("text-sm text-muted-foreground truncate",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("h3",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function Y(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex flex-col gap-[2px]",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function J(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex justify-between items-start",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function K(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("p-4 border-t border-border flex justify-between items-center",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function W(t){const e=f.c(5),{children:n,className:l}=t;let i;e[0]!==l?(i=y("flex items-center text-xs text-muted-foreground",l),e[0]=l,e[1]=i):i=e[1];let r;return e[2]!==n||e[3]!==i?(r=s.jsx("div",{className:i,children:n}),e[2]=n,e[3]=i,e[4]=r):r=e[4],r}function Z(){const t=f.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex justify-between items-start",children:s.jsx("div",{className:"h-12 w-12 bg-muted rounded-lg animate-pulse"})}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[e,s.jsxs("div",{className:"flex flex-col gap-[2px]",children:[s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg animate-pulse"}),s.jsx("div",{className:"h-4 w-40 bg-muted rounded-lg animate-pulse"})]})]}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs(k,{className:"group transition-colors flex flex-col",children:[n,s.jsxs("div",{className:"p-4 border-t border-border flex justify-between items-center",children:[s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"})]})]}),t[2]=l):l=t[2],l}const u=Object.assign(U,{Avatar:M,AvatarSection:J,Header:P,Title:V,Subtitle:X,Content:Y,Footer:K,Badge:W,Skeleton:Z}),ee={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6",8:"gap-8"},te={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8"},se={1:"@min-3xl:grid-cols-1",2:"@min-3xl:grid-cols-2",3:"@min-3xl:grid-cols-3",4:"@min-3xl:grid-cols-4",5:"@min-3xl:grid-cols-5",6:"@min-3xl:grid-cols-6",7:"@min-3xl:grid-cols-7",8:"@min-3xl:grid-cols-8"},ie={1:"@min-6xl:grid-cols-1",2:"@min-6xl:grid-cols-2",3:"@min-6xl:grid-cols-3",4:"@min-6xl:grid-cols-4",5:"@min-6xl:grid-cols-5",6:"@min-6xl:grid-cols-6",7:"@min-6xl:grid-cols-7",8:"@min-6xl:grid-cols-8"},le={1:"@min-7xl:grid-cols-1",2:"@min-7xl:grid-cols-2",3:"@min-7xl:grid-cols-3",4:"@min-7xl:grid-cols-4",5:"@min-7xl:grid-cols-5",6:"@min-7xl:grid-cols-6",7:"@min-7xl:grid-cols-7",8:"@min-7xl:grid-cols-8"},ne={1:"@min-8xl:grid-cols-1",2:"@min-8xl:grid-cols-2",3:"@min-8xl:grid-cols-3",4:"@min-8xl:grid-cols-4",5:"@min-8xl:grid-cols-5",6:"@min-8xl:grid-cols-6",7:"@min-8xl:grid-cols-7",8:"@min-8xl:grid-cols-8"};function L(t){const e=f.c(13),{children:n,columns:l,gap:i,className:r}=t;let d;e[0]!==l?(d=l===void 0?{sm:2,md:3,lg:4}:l,e[0]=l,e[1]=d):d=e[1];const o=d,x=ee[i===void 0?4:i],a=o.sm&&te[o.sm],c=o.md&&se[o.md],g=o.lg&&ie[o.lg],p=o.xl&&le[o.xl],v=o["2xl"]&&ne[o["2xl"]];let N;e[2]!==r||e[3]!==x||e[4]!==a||e[5]!==c||e[6]!==g||e[7]!==p||e[8]!==v?(N=y("w-full grid",x,a,c,g,p,v,r),e[2]=r,e[3]=x,e[4]=a,e[5]=c,e[6]=g,e[7]=p,e[8]=v,e[9]=N):N=e[9];const b=N;let h;return e[10]!==n||e[11]!==b?(h=s.jsx("div",{className:b,children:n}),e[10]=n,e[11]=b,e[12]=h):h=e[12],h}function re(t){const e=f.c(9),{count:n,columns:l,gap:i,className:r}=t,d=n===void 0?8:n;let o;e[0]!==l?(o=l===void 0?{sm:2,md:3,lg:4}:l,e[0]=l,e[1]=o):o=e[1];const m=o,x=i===void 0?4:i;let a;e[2]!==d?(a=Array.from({length:d}).map(ae),e[2]=d,e[3]=a):a=e[3];let c;return e[4]!==r||e[5]!==m||e[6]!==x||e[7]!==a?(c=s.jsx(L,{columns:m,gap:x,className:r,children:a}),e[4]=r,e[5]=m,e[6]=x,e[7]=a,e[8]=c):c=e[8],c}function ae(t,e){return s.jsxs("div",{className:"bg-card hover:bg-accent transition-colors flex flex-col rounded-lg animate-pulse",children:[s.jsxs("div",{className:"p-4 flex flex-col gap-4",children:[s.jsx("div",{className:"h-12 w-12 bg-muted rounded-lg"}),s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg"}),s.jsx("div",{className:"h-4 w-32 bg-muted rounded-lg"})]}),s.jsxs("div",{className:"p-4 border-t border-border flex items-center",children:[s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"}),s.jsx("div",{className:"h-6 w-6 bg-muted rounded-full animate-pulse -ml-2"})]})]},e)}const A=Object.assign(L,{Skeleton:re});function oe({invitation:t}){const[e,n]=C.useState(!1),[l,i]=C.useState(!1),r=O(),d=E(),o=async()=>{n(!0);try{const a=await I.organization.acceptInvitation({invitationId:t.id});if(a.error)w.error(a.error.message),n(!1);else{const c=await I.organization.setActive({organizationId:t.organizationId});c?.data?.slug?(w.success("Invitation accepted!"),d({to:"/$org",params:{org:c.data.slug}})):(w.success("Invitation accepted! Redirecting..."),d({to:"/"}))}}catch{w.error("Failed to accept invitation"),n(!1)}},m=async()=>{i(!0);try{const a=await I.organization.rejectInvitation({invitationId:t.id});a.error?(w.error(a.error.message),i(!1)):(w.success("Invitation rejected"),await r.invalidateQueries(),i(!1))}catch{w.error("Failed to reject invitation"),i(!1)}},x=t.organizationName||t.organizationId;return s.jsxs(u,{className:"border-dashed",children:[s.jsxs(u.Header,{children:[s.jsx(u.AvatarSection,{children:s.jsx(u.Avatar,{url:"",fallback:x,size:"lg",objectFit:"contain"})}),s.jsxs(u.Content,{children:[s.jsx(u.Subtitle,{children:"You've been invited to join"}),s.jsx(u.Title,{children:x})]})]}),s.jsx(u.Footer,{className:"border-t border-dashed",children:s.jsxs("div",{className:"flex h-3.5 items-center gap-2 w-full",children:[s.jsx($,{onClick:o,disabled:e||l,className:"flex-1",size:"sm",children:e?"Accepting...":s.jsxs(s.Fragment,{children:[s.jsx(H,{size:16}),"Accept"]})}),s.jsx($,{variant:"outline",onClick:m,disabled:e||l,className:"flex-1",size:"sm",children:l?"Declining...":s.jsxs(s.Fragment,{children:[s.jsx(q,{size:16}),"Decline"]})})]})})]})}function ce({query:t}){const e=C.useContext(F),{data:n}=e.hooks.useListUserInvitations(),i=(n??[]).filter(d=>d.status==="pending"&&new Date(d.expiresAt)>new Date),r=t?(()=>{const d=t.toLowerCase();return i.filter(o=>o.organizationName?.toLowerCase().includes(d)||o.organizationId.toLowerCase().includes(d))})():i;return r.length===0?null:s.jsxs("div",{className:"mb-16",children:[s.jsx("h2",{className:"text-lg font-medium pb-2 border-b border-border/50 mb-6 px-2",children:"Invitations"}),s.jsx(A,{columns:{sm:2,md:3,lg:4},children:r.map(d=>s.jsx(oe,{invitation:d},d.id))})]})}function de(t){const e=f.c(14),{query:n}=t,{data:l}=I.useListOrganizations(),i=E();let r;e[0]!==l||e[1]!==n?(r=l?n?(()=>{const a=n.toLowerCase();return l.filter(c=>c.name.toLowerCase().includes(a)||c.slug.toLowerCase().includes(a))})():l:[],e[0]=l,e[1]=n,e[2]=r):r=e[2];const d=r;if(!l||l.length===0){let a;return e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:s.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"No organizations yet. Create your first organization to get started."})}),e[3]=a):a=e[3],a}if(d.length===0){let a;return e[4]!==n?(a=s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:s.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:['No organizations found matching "',n,'".']})}),e[4]=n,e[5]=a):a=e[5],a}let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o={sm:2,md:3,lg:4},e[6]=o):o=e[6];let m;if(e[7]!==d||e[8]!==i){let a;e[10]!==i?(a=c=>s.jsxs(u,{onNavigate:()=>i({to:"/$org",params:{org:c.slug}}),children:[s.jsxs(u.Header,{children:[s.jsx(u.AvatarSection,{children:s.jsx(u.Avatar,{url:c.logo||"",fallback:c.name,size:"lg",objectFit:"contain"})}),s.jsxs(u.Content,{children:[s.jsxs(u.Subtitle,{children:["@",c.slug]}),s.jsx(u.Title,{children:c.name})]})]}),s.jsx(u.Footer,{children:s.jsxs("div",{className:"flex h-3.5 items-center text-xs text-muted-foreground",children:["Created:"," ",new Date(c.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})]})})]},c.id),e[10]=i,e[11]=a):a=e[11],m=d.map(a),e[7]=d,e[8]=i,e[9]=m}else m=e[9];let x;return e[12]!==m?(x=s.jsx(A,{columns:o,children:m}),e[12]=m,e[13]=x):x=e[13],x}function me(t){const e=f.c(3),{error:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(D,{size:24,className:"text-destructive"}),e[0]=l):l=e[0];let i;return e[1]!==n.message?(i=s.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-4",children:[l,s.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:["Error loading organizations: ",n.message]})]}),e[1]=n.message,e[2]=i):i=e[2],i}function xe(){const t=f.c(27),{error:e,isPending:n}=I.useListOrganizations(),[l,i]=C.useState(""),[r,d]=C.useState(!1),o=C.useDeferredValue(l);if(n){let j;return t[0]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"max-w-6xl mx-auto p-8",children:s.jsx("div",{className:"@container",children:s.jsx(A.Skeleton,{count:8,columns:{sm:2,md:3,lg:4}})})}),t[0]=j):j=t[0],j}if(e){let j;return t[1]!==e?(j=s.jsx("div",{className:"max-w-6xl mx-auto p-8",children:s.jsx(me,{error:e})}),t[1]=e,t[2]=j):j=t[2],j}let m;t[3]!==o?(m=s.jsx(C.Suspense,{fallback:null,children:s.jsx(ce,{query:o})}),t[3]=o,t[4]=m):m=t[4];let x;t[5]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("h2",{className:"text-lg font-medium",children:"My organizations"}),t[5]=x):x=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Q,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=j=>i(j.target.value),t[7]=c):c=t[7];let g;t[8]!==l?(g=s.jsxs("div",{className:"relative",children:[a,s.jsx(B,{className:"pl-8 h-8 w-52 border-none shadow-none focus-visible:ring-0",placeholder:"Search organizations...",value:l,onChange:c})]}),t[8]=l,t[9]=g):g=t[9];let p;t[10]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsxs($,{size:"sm",onClick:()=>d(!0),children:[s.jsx(G,{size:16}),s.jsx("span",{children:"New organization"})]}),t[10]=p):p=t[10];let v;t[11]!==g?(v=s.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-border/50 mb-6 px-2",children:[x,s.jsxs("div",{className:"flex items-center gap-3",children:[g,p]})]}),t[11]=g,t[12]=v):v=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(A.Skeleton,{count:8,columns:{sm:2,md:3,lg:4}}),t[13]=N):N=t[13];let b;t[14]!==o?(b=s.jsx(C.Suspense,{fallback:N,children:s.jsx(de,{query:o})}),t[14]=o,t[15]=b):b=t[15];let h;t[16]!==v||t[17]!==b?(h=s.jsxs("div",{children:[v,b]}),t[16]=v,t[17]=b,t[18]=h):h=t[18];let S;t[19]!==m||t[20]!==h?(S=s.jsxs("div",{className:"@container",children:[m,h]}),t[19]=m,t[20]=h,t[21]=S):S=t[21];let z;t[22]!==r?(z=s.jsx(T,{open:r,onOpenChange:d}),t[22]=r,t[23]=z):z=t[23];let _;return t[24]!==S||t[25]!==z?(_=s.jsxs("div",{className:"max-w-6xl mx-auto p-8",children:[S,z]}),t[24]=S,t[25]=z,t[26]=_):_=t[26],_}function _e(){const t=f.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"min-h-full",children:s.jsx(xe,{})}),t[0]=e):e=t[0],e}export{_e as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{r as M,c as te,j as S,aE as zO,aF as jO,aG as qO,aH as jt,z as ee,aI as ro,aJ as a_,aK as GO,aL as VO,aM as WO,L as Ot,J as Da,I as ns,y as De,aN as pe,aD as Zn,aO as YO,aP as ze,_ as KO,V as ll,v as Vg,K as Qr,d as s_,x as Wg,t as mn,a as o_,aQ as XO,aR as ZO,B as QO,E as JO,Y as l_,aS as u_,X as eL,H as Lt,aT as tL,aU as nL,Z as c_,aV as rL,aW as xn,aX as Zl,aY as iL,aZ as Ql,a_ as aL,a$ as sL,b0 as oL,b1 as lL,b2 as uL,b3 as cL,b4 as dL,b5 as pL,f as d_,U as io,a3 as Yg,a6 as fL,a5 as hL,a8 as mL,ao as gL,a1 as bL,a7 as EL,a4 as yL}from"./index-RkAiu7dw.js";import{c as me,B as gt}from"./button-BjyFV51s.js";import{i as TL}from"./X-DRPZjxg9.js";import{U as SL,c as ul}from"./connection-BsqnB2FJ.js";import{b as AL}from"./use-collections-B3q4szKJ.js";import{u as p_,a as kL}from"./use-connection-B4LwqzAy.js";import{b as vL}from"./use-binding-CtNasu81.js";import{u as xL,M as f_,s as $E}from"./monaco-editor-8ajNlMw5.js";import{u as Gn}from"./project-context-provider-CMPckjDL.js";import{u as _L}from"./use-virtual-mcp-system-prompt-BL6VfgiI.js";import{u as ha,L as ao}from"./localstorage-keys-dTkn_1-n.js";import{I as Kg}from"./input-DRcixE8Y.js";import{a as rs,b as is,P as as}from"./popover-CRsqCTCD.js";import{S as CL,a as NL,b as IL,c as wL,d as RL}from"./select-De66oXlo.js";import{i as OL}from"./File06-BvoVIa2F.js";import{c as LL,i as h_}from"./Grid01-CNEf3UoL.js";import{a as DL}from"./Image01-B3DlQYAI.js";import{i as cl}from"./SearchMd-DEod-sVt.js";import{I as Xg,E as ML}from"./empty-state-C5i2xL9Y.js";import{T as Jr,b as ei,a as Zg,c as ti}from"./tooltip-D_6S8XJj.js";import{i as dl}from"./Check-yoiyrqoL.js";import{u as PL,i as Qg}from"./use-virtual-mcp-zI75jpyP.js";import{u as FL}from"./use-create-virtual-mcp-BHiCN5B5.js";import{S as pl}from"./spinner-B5BpFruc.js";import{E as BL,i as UL}from"./error-boundary-DAH5w09n.js";import{D as HL,a as $L,f as zL,c as jL,d as qL}from"./dialog-BNsW_zrz.js";import{a as GL,F as VL,b as WL,c as YL,d as KL,f as XL}from"./form-CpXA-_lk.js";import{i as m_}from"./AlertCircle-3Pxg2P_i.js";import{i as ZL}from"./ArrowUp-MnVdQxWX.js";import{t as QL}from"./ChevronDown-BlKqZ66z.js";import{i as JL}from"./Edit01-DjKKkpJx.js";import{a as Jg}from"./Copy01-BLLmXBc5.js";import{i as e2}from"./Terminal-DX8xM5mx.js";import{O as t2,b as n2,c as r2}from"./well-known-mcp-DOEdYmKO.js";import{g as i2}from"./generate-id-Dyweu44Y.js";import{s as a2}from"./Trash01-C_UVJByK.js";import{s as s2}from"./Plus-qNfisIQV.js";var Ma;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(const o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ma||(Ma={}));var zE;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(zE||(zE={}));Ma.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ma.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 so extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){const u=s.path[l];l===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return i(this),r}static assert(e){if(!(e instanceof so))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ma.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}so.create=t=>new so(t);var jE;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(jE||(jE={}));var ge;(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"})(ge||(ge={}));const g_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));g_.displayName="Atom02";const b_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));b_.displayName="ChevronSelectorVertical";const E_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));E_.displayName="Coins01";const y_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));y_.displayName="CurrencyDollar";const T_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));T_.displayName="Lightbulb01";const S_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));S_.displayName="LogOut04";const fl=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));fl.displayName="Stars01";const A_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.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.8Z"}));A_.displayName="Stop";const k_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));k_.displayName="Target04";const v_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));v_.displayName="XCircle";function yt(t){const e=te.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=me("bg-accent animate-pulse rounded-md",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=S.jsx("div",{"data-slot":"skeleton",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function o2(){const t=te.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=ao.developerMode(),t[0]=e):e=t[0],ha(e,!1)}var x_="vercel.ai.error",l2=Symbol.for(x_),qE,GE,Cn=class __ extends(GE=Error,qE=l2,GE){constructor({name:e,message:n,cause:r}){super(n),this[qE]=!0,this.name=e,this.cause=r}static isInstance(e){return __.hasMarker(e,x_)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function C_(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var N_="AI_InvalidArgumentError",I_=`vercel.ai.error.${N_}`,u2=Symbol.for(I_),VE,WE,c2=class extends(WE=Cn,VE=u2,WE){constructor({message:t,cause:e,argument:n}){super({name:N_,message:t,cause:e}),this[VE]=!0,this.argument=n}static isInstance(t){return Cn.hasMarker(t,I_)}},w_="AI_JSONParseError",R_=`vercel.ai.error.${w_}`,d2=Symbol.for(R_),YE,KE,XE=class extends(KE=Cn,YE=d2,KE){constructor({text:t,cause:e}){super({name:w_,message:`JSON parsing failed: Text: ${t}.
|
|
1
|
+
import{r as M,c as te,j as S,aE as zO,aF as jO,aG as qO,aH as jt,z as ee,aI as ro,aJ as a_,aK as GO,aL as VO,aM as WO,L as Ot,J as Da,I as ns,y as De,aN as pe,aD as Zn,aO as YO,aP as ze,_ as KO,V as ll,v as Vg,K as Qr,d as s_,x as Wg,t as mn,a as o_,aQ as XO,aR as ZO,B as QO,E as JO,Y as l_,aS as u_,X as eL,H as Lt,aT as tL,aU as nL,Z as c_,aV as rL,aW as xn,aX as Zl,aY as iL,aZ as Ql,a_ as aL,a$ as sL,b0 as oL,b1 as lL,b2 as uL,b3 as cL,b4 as dL,b5 as pL,f as d_,U as io,a3 as Yg,a6 as fL,a5 as hL,a8 as mL,ao as gL,a1 as bL,a7 as EL,a4 as yL}from"./index-C0cxXUhv.js";import{c as me,B as gt}from"./button-BID2CMhP.js";import{i as TL}from"./X-Bp6jT_CT.js";import{U as SL,c as ul}from"./connection-CzagOXhI.js";import{b as AL}from"./use-collections-BRVu5nwP.js";import{u as p_,a as kL}from"./use-connection-D__nfNf6.js";import{b as vL}from"./use-binding-CmWOKG-X.js";import{u as xL,M as f_,s as $E}from"./monaco-editor-Bvv8L85C.js";import{u as Gn}from"./project-context-provider-CG5Jt9jX.js";import{u as _L}from"./use-virtual-mcp-system-prompt-Be4EZZHh.js";import{u as ha,L as ao}from"./localstorage-keys-CySryjw_.js";import{I as Kg}from"./input-DHdPZHvh.js";import{a as rs,b as is,P as as}from"./popover-ffhxj7L9.js";import{S as CL,a as NL,b as IL,c as wL,d as RL}from"./select-Cd19OBy8.js";import{i as OL}from"./File06-D5XMLdKt.js";import{c as LL,i as h_}from"./Grid01-uChhmLMS.js";import{a as DL}from"./Image01-Ca9fCk1g.js";import{i as cl}from"./SearchMd-CDx95UHX.js";import{I as Xg,E as ML}from"./empty-state-aph8hymo.js";import{T as Jr,b as ei,a as Zg,c as ti}from"./tooltip-BpIeWmG3.js";import{i as dl}from"./Check-BBlt8nj4.js";import{u as PL,i as Qg}from"./use-virtual-mcp-aCxo16E3.js";import{u as FL}from"./use-create-virtual-mcp-CULFY9tZ.js";import{S as pl}from"./spinner-B3XPkxOB.js";import{E as BL,i as UL}from"./error-boundary-BSc3aikh.js";import{D as HL,a as $L,f as zL,c as jL,d as qL}from"./dialog-N6lD2G23.js";import{a as GL,F as VL,b as WL,c as YL,d as KL,f as XL}from"./form-R15NVDAL.js";import{i as m_}from"./AlertCircle-BjDAjYli.js";import{i as ZL}from"./ArrowUp-UuyzMrp7.js";import{t as QL}from"./ChevronDown-C2nnNiko.js";import{i as JL}from"./Edit01-C2f_e3xp.js";import{a as Jg}from"./Copy01-eVnag3mk.js";import{i as e2}from"./Terminal-C4vz1dQ0.js";import{O as t2,b as n2,c as r2}from"./well-known-mcp-DOEdYmKO.js";import{g as i2}from"./generate-id-Dyweu44Y.js";import{s as a2}from"./Trash01-hrLLpuYX.js";import{s as s2}from"./Plus-jsBXu2Jm.js";var Ma;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),s={};for(const o of a)s[o]=i[o];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ma||(Ma={}));var zE;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(zE||(zE={}));Ma.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ma.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 so extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,l=0;for(;l<s.path.length;){const u=s.path[l];l===s.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(s))):o[u]=o[u]||{_errors:[]},o=o[u],l++}}};return i(this),r}static assert(e){if(!(e instanceof so))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ma.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}so.create=t=>new so(t);var jE;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(jE||(jE={}));var ge;(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"})(ge||(ge={}));const g_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M17.115 15.358c-.27.306-.554.608-.851.905-4.296 4.296-9.678 5.88-12.021 3.536-1.607-1.606-1.368-4.641.325-7.775M6.89 8.725c.281-.32.578-.636.888-.947C12.074 3.482 17.456 1.9 19.8 4.243c1.608 1.607 1.367 4.645-.33 7.781m-3.206-4.246c4.296 4.296 5.88 9.678 3.536 12.021-2.343 2.343-7.725.76-12.02-3.535C3.483 11.968 1.9 6.586 4.244 4.243c2.343-2.343 7.725-.76 12.02 3.535ZM13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));g_.displayName="Atom02";const b_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));b_.displayName="ChevronSelectorVertical";const E_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));E_.displayName="Coins01";const y_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));y_.displayName="CurrencyDollar";const T_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));T_.displayName="Lightbulb01";const S_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));S_.displayName="LogOut04";const fl=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));fl.displayName="Stars01";const A_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.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.8Z"}));A_.displayName="Stop";const k_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));k_.displayName="Target04";const v_=({size:t=24,color:e="currentColor",...n})=>M.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},M.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));v_.displayName="XCircle";function yt(t){const e=te.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=me("bg-accent animate-pulse rounded-md",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=S.jsx("div",{"data-slot":"skeleton",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function o2(){const t=te.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=ao.developerMode(),t[0]=e):e=t[0],ha(e,!1)}var x_="vercel.ai.error",l2=Symbol.for(x_),qE,GE,Cn=class __ extends(GE=Error,qE=l2,GE){constructor({name:e,message:n,cause:r}){super(n),this[qE]=!0,this.name=e,this.cause=r}static isInstance(e){return __.hasMarker(e,x_)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function C_(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var N_="AI_InvalidArgumentError",I_=`vercel.ai.error.${N_}`,u2=Symbol.for(I_),VE,WE,c2=class extends(WE=Cn,VE=u2,WE){constructor({message:t,cause:e,argument:n}){super({name:N_,message:t,cause:e}),this[VE]=!0,this.argument=n}static isInstance(t){return Cn.hasMarker(t,I_)}},w_="AI_JSONParseError",R_=`vercel.ai.error.${w_}`,d2=Symbol.for(R_),YE,KE,XE=class extends(KE=Cn,YE=d2,KE){constructor({text:t,cause:e}){super({name:w_,message:`JSON parsing failed: Text: ${t}.
|
|
2
2
|
Error message: ${C_(e)}`,cause:e}),this[YE]=!0,this.text=t}static isInstance(t){return Cn.hasMarker(t,R_)}},O_="AI_TypeValidationError",L_=`vercel.ai.error.${O_}`,p2=Symbol.for(L_),ZE,QE,Ni=class Mm extends(QE=Cn,ZE=p2,QE){constructor({value:e,cause:n}){super({name:O_,message:`Type validation failed: Value: ${JSON.stringify(e)}.
|
|
3
3
|
Error message: ${C_(n)}`,cause:n}),this[ZE]=!0,this.value=e}static isInstance(e){return Cn.hasMarker(e,L_)}static wrap({value:e,cause:n}){return Mm.isInstance(n)&&n.value===e?n:new Mm({value:e,cause:n})}},ss=({prefix:t,size:e=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=()=>{const a=n.length,s=new Array(e);for(let o=0;o<e;o++)s[o]=n[Math.random()*a|0];return s.join("")};if(t==null)return i;if(n.includes(r))throw new c2({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${t}${r}${i()}`},f2=ss();function JE(t=globalThis){var e,n,r;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(r=(n=t.process)==null?void 0:n.versions)!=null&&r.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function wr(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((n,r)=>{e[r.toLowerCase()]=n});else{Array.isArray(t)||(t=Object.entries(t));for(const[n,r]of t)r!=null&&(e[n.toLowerCase()]=r)}return e}function e0(t,...e){const n=new Headers(wr(t)),r=n.get("user-agent")||"";return n.set("user-agent",[r,...e].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var h2=/"__proto__"\s*:/,m2=/"constructor"\s*:/;function t0(t){const e=JSON.parse(t);return e===null||typeof e!="object"||h2.test(t)===!1&&m2.test(t)===!1?e:g2(e)}function g2(t){let e=[t];for(;e.length;){const n=e;e=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in r){const a=r[i];a&&typeof a=="object"&&e.push(a)}}}return t}function b2(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return t0(t)}try{return t0(t)}finally{Error.stackTraceLimit=e}}function eb(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:n}=t;if(n!=null)for(const r of Object.keys(n))n[r]=Cr(n[r])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(Cr):Cr(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(Cr)),t.allOf!=null&&(t.allOf=t.allOf.map(Cr)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(Cr));const{definitions:e}=t;if(e!=null)for(const n of Object.keys(e))e[n]=Cr(e[n]);return t}function Cr(t){return typeof t=="boolean"?t:eb(t)}var E2=Symbol("Let zodToJsonSchema decide on which parser to use"),n0={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"},y2=t=>typeof t=="string"?{...n0,name:t}:{...n0,...t};function Jt(){return{}}function T2(t,e){var n,r,i;const a={type:"array"};return(n=t.type)!=null&&n._def&&((i=(r=t.type)==null?void 0:r._def)==null?void 0:i.typeName)!==ge.ZodAny&&(a.items=Pe(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(a.minItems=t.minLength.value),t.maxLength&&(a.maxItems=t.maxLength.value),t.exactLength&&(a.minItems=t.exactLength.value,a.maxItems=t.exactLength.value),a}function S2(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function A2(){return{type:"boolean"}}function D_(t,e){return Pe(t.type._def,e)}var k2=(t,e)=>Pe(t.innerType._def,e);function M_(t,e,n){const r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,a)=>M_(t,e,i))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return v2(t)}}var v2=t=>{const e={type:"integer",format:"unix-time"};for(const n of t.checks)switch(n.kind){case"min":e.minimum=n.value;break;case"max":e.maximum=n.value;break}return e};function x2(t,e){return{...Pe(t.innerType._def,e),default:t.defaultValue()}}function _2(t,e){return e.effectStrategy==="input"?Pe(t.schema._def,e):Jt()}function C2(t){return{type:"string",enum:Array.from(t.values)}}var N2=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function I2(t,e){const n=[Pe(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Pe(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return n.forEach(i=>{if(N2(i))r.push(...i.allOf);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:s,...o}=i;a=o}r.push(a)}}),r.length?{allOf:r}:void 0}function w2(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 Jl=void 0,dn={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:()=>(Jl===void 0&&(Jl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Jl),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 P_(t,e){const n={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":pn(n,"email",r.message,e);break;case"format:idn-email":pn(n,"idn-email",r.message,e);break;case"pattern:zod":Rt(n,dn.email,r.message,e);break}break;case"url":pn(n,"uri",r.message,e);break;case"uuid":pn(n,"uuid",r.message,e);break;case"regex":Rt(n,r.regex,r.message,e);break;case"cuid":Rt(n,dn.cuid,r.message,e);break;case"cuid2":Rt(n,dn.cuid2,r.message,e);break;case"startsWith":Rt(n,RegExp(`^${eu(r.value,e)}`),r.message,e);break;case"endsWith":Rt(n,RegExp(`${eu(r.value,e)}$`),r.message,e);break;case"datetime":pn(n,"date-time",r.message,e);break;case"date":pn(n,"date",r.message,e);break;case"time":pn(n,"time",r.message,e);break;case"duration":pn(n,"duration",r.message,e);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{Rt(n,RegExp(eu(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&pn(n,"ipv4",r.message,e),r.version!=="v4"&&pn(n,"ipv6",r.message,e);break}case"base64url":Rt(n,dn.base64url,r.message,e);break;case"jwt":Rt(n,dn.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&Rt(n,dn.ipv4Cidr,r.message,e),r.version!=="v4"&&Rt(n,dn.ipv6Cidr,r.message,e);break}case"emoji":Rt(n,dn.emoji(),r.message,e);break;case"ulid":{Rt(n,dn.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{pn(n,"binary",r.message,e);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{Rt(n,dn.base64,r.message,e);break}}break}case"nanoid":Rt(n,dn.nanoid,r.message,e)}return n}function eu(t,e){return e.patternStrategy==="escape"?O2(t):t}var R2=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function O2(t){let e="";for(let n=0;n<t.length;n++)R2.has(t[n])||(e+="\\"),e+=t[n];return e}function pn(t,e,n,r){var i;t.format||(i=t.anyOf)!=null&&i.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...n&&r.errorMessages&&{errorMessage:{format:n}}})):t.format=e}function Rt(t,e,n,r){var i;t.pattern||(i=t.allOf)!=null&&i.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:r0(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):t.pattern=r0(e,r)}function r0(t,e){var n;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=r.i?t.source.toLowerCase():t.source;let a="",s=!1,o=!1,l=!1;for(let u=0;u<i.length;u++){if(s){a+=i[u],s=!1;continue}if(r.i){if(o){if(i[u].match(/[a-z]/)){l?(a+=i[u],a+=`${i[u-2]}-${i[u]}`.toUpperCase(),l=!1):i[u+1]==="-"&&((n=i[u+2])!=null&&n.match(/[a-z]/))?(a+=i[u],l=!0):a+=`${i[u]}${i[u].toUpperCase()}`;continue}}else if(i[u].match(/[a-z]/)){a+=`[${i[u]}${i[u].toUpperCase()}]`;continue}}if(r.m){if(i[u]==="^"){a+=`(^|(?<=[\r
|
|
4
4
|
]))`;continue}else if(i[u]==="$"){a+=`($|(?=[\r
|
|
5
5
|
]))`;continue}}if(r.s&&i[u]==="."){a+=o?`${i[u]}\r
|
|
6
6
|
`:`[${i[u]}\r
|
|
7
|
-
]`;continue}a+=i[u],i[u]==="\\"?s=!0:o&&i[u]==="]"?o=!1:!o&&i[u]==="["&&(o=!0)}try{new RegExp(a)}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 a}function F_(t,e){var n,r,i,a,s,o;const l={type:"object",additionalProperties:(n=Pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ge.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:u,...c}=P_(t.keyType._def,e);return{...l,propertyNames:c}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ge.ZodEnum)return{...l,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ge.ZodBranded&&t.keyType._def.type._def.typeName===ge.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:u,...c}=D_(t.keyType._def,e);return{...l,propertyNames:c}}}return l}function L2(t,e){if(e.mapStrategy==="record")return F_(t,e);const n=Pe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Jt(),r=Pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Jt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function D2(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function M2(){return{not:Jt()}}function P2(){return{type:"null"}}var Pm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function F2(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Pm&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=Pm[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,o)=>o.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return B2(t,e)}var B2=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>Pe(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function U2(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[Pm[t.innerType._def.typeName],"null"]};const n=Pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function H2(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function $2(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let o=i[s];if(o===void 0||o._def===void 0)continue;const l=j2(o),u=Pe(o._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});u!==void 0&&(n.properties[s]=u,l||r.push(s))}r.length&&(n.required=r);const a=z2(t,e);return a!==void 0&&(n.additionalProperties=a),n}function z2(t,e){if(t.catchall._def.typeName!=="ZodNever")return Pe(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 j2(t){try{return t.isOptional()}catch{return!0}}var q2=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return Pe(t.innerType._def,e);const r=Pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Jt()},r]}:Jt()},G2=(t,e)=>{if(e.pipeStrategy==="input")return Pe(t.in._def,e);if(e.pipeStrategy==="output")return Pe(t.out._def,e);const n=Pe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=Pe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function V2(t,e){return Pe(t.type._def,e)}function W2(t,e){const r={type:"array",uniqueItems:!0,items:Pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function Y2(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Pe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function K2(){return{not:Jt()}}function X2(){return Jt()}var Z2=(t,e)=>Pe(t.innerType._def,e),Q2=(t,e,n)=>{switch(e){case ge.ZodString:return P_(t,n);case ge.ZodNumber:return H2(t);case ge.ZodObject:return $2(t,n);case ge.ZodBigInt:return S2(t);case ge.ZodBoolean:return A2();case ge.ZodDate:return M_(t,n);case ge.ZodUndefined:return K2();case ge.ZodNull:return P2();case ge.ZodArray:return T2(t,n);case ge.ZodUnion:case ge.ZodDiscriminatedUnion:return F2(t,n);case ge.ZodIntersection:return I2(t,n);case ge.ZodTuple:return Y2(t,n);case ge.ZodRecord:return F_(t,n);case ge.ZodLiteral:return w2(t);case ge.ZodEnum:return C2(t);case ge.ZodNativeEnum:return D2(t);case ge.ZodNullable:return U2(t,n);case ge.ZodOptional:return q2(t,n);case ge.ZodMap:return L2(t,n);case ge.ZodSet:return W2(t,n);case ge.ZodLazy:return()=>t.getter()._def;case ge.ZodPromise:return V2(t,n);case ge.ZodNaN:case ge.ZodNever:return M2();case ge.ZodEffects:return _2(t,n);case ge.ZodAny:return Jt();case ge.ZodUnknown:return X2();case ge.ZodDefault:return x2(t,n);case ge.ZodBranded:return D_(t,n);case ge.ZodReadonly:return Z2(t,n);case ge.ZodCatch:return k2(t,n);case ge.ZodPipeline:return G2(t,n);case ge.ZodFunction:case ge.ZodVoid:case ge.ZodSymbol:return;default:return(r=>{})()}},J2=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function Pe(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const l=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(l!==E2)return l}if(i&&!n){const l=eD(i,e);if(l!==void 0)return l}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=Q2(t,t.typeName,e),o=typeof s=="function"?Pe(s(),e):s;if(o&&tD(t,e,o),e.postProcess){const l=e.postProcess(o,t,e);return a.jsonSchema=o,l}return a.jsonSchema=o,o}var eD=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:J2(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Jt()):e.$refStrategy==="seen"?Jt():void 0}},tD=(t,e,n)=>(t.description&&(n.description=t.description),n),nD=t=>{const e=y2(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},rD=(t,e)=>{var n;const r=nD(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[c,d])=>{var p;return{...u,[c]:(p=Pe(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,c]},!0))!=null?p:Jt()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=Pe(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:Jt(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(s.title=o);const l=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return l.$schema="http://json-schema.org/draft-07/schema#",l},Fm=Symbol.for("vercel.ai.schema");function iD(t){let e;return()=>(e==null&&(e=t()),e)}function hl(t,{validate:e}={}){return{[Fm]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function aD(t){return typeof t=="object"&&t!==null&&Fm in t&&t[Fm]===!0&&"jsonSchema"in t&&"validate"in t}function tb(t){return t==null?hl({properties:{},additionalProperties:!1}):aD(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?B_(t):sD(t):t()}function sD(t){return hl(()=>eb(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Ni({value:e,cause:n.issues})}}})}function oD(t,e){var n;const r=(n=void 0)!=null?n:!1;return hl(()=>rD(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function lD(t,e){var n;const r=(n=void 0)!=null?n:!1;return hl(()=>eb(qO(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await jO(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function uD(t){return"_zod"in t}function B_(t,e){return uD(t)?lD(t):oD(t)}async function i0({value:t,schema:e}){const n=await Pa({value:t,schema:e});if(!n.success)throw Ni.wrap({value:t,cause:n.error});return n.value}async function Pa({value:t,schema:e}){const n=tb(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Ni.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:Ni.wrap({value:t,cause:r}),rawValue:t}}}async function qr({text:t,schema:e}){try{const n=b2(t);return e==null?{success:!0,value:n,rawValue:n}:await Pa({value:n,schema:e})}catch(n){return{success:!1,error:XE.isInstance(n)?n:new XE({text:t,cause:n}),rawValue:void 0}}}function cD({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new zO).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await qr({text:n,schema:e}))}}))}async function nr(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var dD=Object.defineProperty,pD=(t,e)=>{for(var n in e)dD(t,n,{get:e[n],enumerable:!0})},U_="AI_NoObjectGeneratedError",H_=`vercel.ai.error.${U_}`,fD=Symbol.for(H_),$_,fr=class extends Cn{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:U_,message:t,cause:e}),this[$_]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return Cn.hasMarker(t,H_)}};$_=fD;var z_="AI_UIMessageStreamError",j_=`vercel.ai.error.${z_}`,hD=Symbol.for(j_),q_,ui=class extends Cn{constructor({chunkType:t,chunkId:e,message:n}){super({name:z_,message:n}),this[q_]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return Cn.hasMarker(t,j_)}};q_=hD;var a0="6.0.45",G_=jt([ee(),ro(Uint8Array),ro(ArrayBuffer),a_(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),Fa=GO(()=>jt([VO(),ee(),WO(),Ot(),Da(ee(),Fa.optional()),ns(Fa)])),ve=Da(ee(),Da(ee(),Fa.optional())),V_=De({type:pe("text"),text:ee(),providerOptions:ve.optional()}),mD=De({type:pe("image"),image:jt([G_,ro(URL)]),mediaType:ee().optional(),providerOptions:ve.optional()}),W_=De({type:pe("file"),data:jt([G_,ro(URL)]),filename:ee().optional(),mediaType:ee(),providerOptions:ve.optional()}),gD=De({type:pe("reasoning"),text:ee(),providerOptions:ve.optional()}),bD=De({type:pe("tool-call"),toolCallId:ee(),toolName:ee(),input:Zn(),providerOptions:ve.optional(),providerExecuted:Ot().optional()}),ED=YO("type",[De({type:pe("text"),value:ee(),providerOptions:ve.optional()}),De({type:pe("json"),value:Fa,providerOptions:ve.optional()}),De({type:pe("execution-denied"),reason:ee().optional(),providerOptions:ve.optional()}),De({type:pe("error-text"),value:ee(),providerOptions:ve.optional()}),De({type:pe("error-json"),value:Fa,providerOptions:ve.optional()}),De({type:pe("content"),value:ns(jt([De({type:pe("text"),text:ee(),providerOptions:ve.optional()}),De({type:pe("media"),data:ee(),mediaType:ee()}),De({type:pe("file-data"),data:ee(),mediaType:ee(),filename:ee().optional(),providerOptions:ve.optional()}),De({type:pe("file-url"),url:ee(),providerOptions:ve.optional()}),De({type:pe("file-id"),fileId:jt([ee(),Da(ee(),ee())]),providerOptions:ve.optional()}),De({type:pe("image-data"),data:ee(),mediaType:ee(),providerOptions:ve.optional()}),De({type:pe("image-url"),url:ee(),providerOptions:ve.optional()}),De({type:pe("image-file-id"),fileId:jt([ee(),Da(ee(),ee())]),providerOptions:ve.optional()}),De({type:pe("custom"),providerOptions:ve.optional()})]))})]),Y_=De({type:pe("tool-result"),toolCallId:ee(),toolName:ee(),output:ED,providerOptions:ve.optional()}),yD=De({type:pe("tool-approval-request"),approvalId:ee(),toolCallId:ee()}),TD=De({type:pe("tool-approval-response"),approvalId:ee(),approved:Ot(),reason:ee().optional()}),SD=De({role:pe("system"),content:ee(),providerOptions:ve.optional()}),AD=De({role:pe("user"),content:jt([ee(),ns(jt([V_,mD,W_]))]),providerOptions:ve.optional()}),kD=De({role:pe("assistant"),content:jt([ee(),ns(jt([V_,W_,gD,bD,Y_,yD]))]),providerOptions:ve.optional()}),vD=De({role:pe("tool"),content:ns(jt([Y_,TD])),providerOptions:ve.optional()});jt([SD,AD,kD,vD]);function K_(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),o=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&o?n[r]=K_(a,i):n[r]=i}return n}var xD={};pD(xD,{array:()=>ID,choice:()=>wD,json:()=>RD,object:()=>ND,text:()=>CD});function _D(t){const e=["ROOT"];let n=-1,r=null;function i(l,u,c){switch(l){case'"':{n=u,e.pop(),e.push(c),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=u,r=u,e.pop(),e.push(c),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(c),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":{n=u,e.pop(),e.push(c),e.push("INSIDE_NUMBER");break}case"{":{n=u,e.pop(),e.push(c),e.push("INSIDE_OBJECT_START");break}case"[":{n=u,e.pop(),e.push(c),e.push("INSIDE_ARRAY_START");break}}}function a(l,u){switch(l){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=u,e.pop();break}}}function s(l,u){switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=u,e.pop();break}}}for(let l=0;l<t.length;l++){const u=t[l];switch(e[e.length-1]){case"ROOT":i(u,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(u){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{u==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{u==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{u===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(u,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(u,l);break}case"INSIDE_STRING":{switch(u){case'"':{e.pop(),n=l;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{u==="]"?(n=l,e.pop()):(n=l,i(u,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(u){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(u,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=l;break}case"INSIDE_NUMBER":{switch(u){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,l);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,l);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const d=t.substring(r,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(u,l):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l)):n=l;break}}}let o=t.slice(0,n+1);for(let l=e.length-1;l>=0;l--)switch(e[l]){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 c=t.substring(r,t.length);"true".startsWith(c)?o+="true".slice(c.length):"false".startsWith(c)?o+="false".slice(c.length):"null".startsWith(c)&&(o+="null".slice(c.length))}}return o}async function ls(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await qr({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await qr({text:_D(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var CD=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),ND=({schema:t,name:e,description:n})=>{const r=tb(t);return{name:"object",responseFormat:nr(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await qr({text:i});if(!s.success)throw new fr({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=await Pa({value:s.value,schema:r});if(!o.success)throw new fr({message:"No object generated: response did not match schema.",cause:o.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return o.value},async parsePartialOutput({text:i}){const a=await ls(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}},createElementStreamTransform(){}}},ID=({element:t,name:e,description:n})=>{const r=tb(t);return{name:"array",responseFormat:nr(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await qr({text:i});if(!s.success)throw new fr({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=s.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new fr({message:"No object generated: response did not match schema.",cause:new Ni({value:o,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const l of o.elements){const u=await Pa({value:l,schema:r});if(!u.success)throw new fr({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return o.elements},async parsePartialOutput({text:i}){const a=await ls(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const o=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,l=[];for(const u of o){const c=await Pa({value:u,schema:r});c.success&&l.push(c.value)}return{partial:l}}}},createElementStreamTransform(){let i=0;return new TransformStream({transform({partialOutput:a},s){if(a!=null)for(;i<a.length;i++)s.enqueue(a[i])}})}}},wD=({options:t,name:e,description:n})=>({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},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await qr({text:r});if(!a.success)throw new fr({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new fr({message:"No object generated: response did not match schema.",cause:new Ni({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await ls(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(o=>o.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}},createElementStreamTransform(){}}),RD=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await qr({text:n});if(!i.success)throw new fr({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await ls(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});ss({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
|
|
7
|
+
]`;continue}a+=i[u],i[u]==="\\"?s=!0:o&&i[u]==="]"?o=!1:!o&&i[u]==="["&&(o=!0)}try{new RegExp(a)}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 a}function F_(t,e){var n,r,i,a,s,o;const l={type:"object",additionalProperties:(n=Pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ge.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:u,...c}=P_(t.keyType._def,e);return{...l,propertyNames:c}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ge.ZodEnum)return{...l,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ge.ZodBranded&&t.keyType._def.type._def.typeName===ge.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:u,...c}=D_(t.keyType._def,e);return{...l,propertyNames:c}}}return l}function L2(t,e){if(e.mapStrategy==="record")return F_(t,e);const n=Pe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Jt(),r=Pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Jt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function D2(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function M2(){return{not:Jt()}}function P2(){return{type:"null"}}var Pm={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function F2(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Pm&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=Pm[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,o)=>o.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return B2(t,e)}var B2=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>Pe(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function U2(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[Pm[t.innerType._def.typeName],"null"]};const n=Pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function H2(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function $2(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let o=i[s];if(o===void 0||o._def===void 0)continue;const l=j2(o),u=Pe(o._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});u!==void 0&&(n.properties[s]=u,l||r.push(s))}r.length&&(n.required=r);const a=z2(t,e);return a!==void 0&&(n.additionalProperties=a),n}function z2(t,e){if(t.catchall._def.typeName!=="ZodNever")return Pe(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 j2(t){try{return t.isOptional()}catch{return!0}}var q2=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return Pe(t.innerType._def,e);const r=Pe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Jt()},r]}:Jt()},G2=(t,e)=>{if(e.pipeStrategy==="input")return Pe(t.in._def,e);if(e.pipeStrategy==="output")return Pe(t.out._def,e);const n=Pe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=Pe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function V2(t,e){return Pe(t.type._def,e)}function W2(t,e){const r={type:"array",uniqueItems:!0,items:Pe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function Y2(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>Pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Pe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>Pe(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function K2(){return{not:Jt()}}function X2(){return Jt()}var Z2=(t,e)=>Pe(t.innerType._def,e),Q2=(t,e,n)=>{switch(e){case ge.ZodString:return P_(t,n);case ge.ZodNumber:return H2(t);case ge.ZodObject:return $2(t,n);case ge.ZodBigInt:return S2(t);case ge.ZodBoolean:return A2();case ge.ZodDate:return M_(t,n);case ge.ZodUndefined:return K2();case ge.ZodNull:return P2();case ge.ZodArray:return T2(t,n);case ge.ZodUnion:case ge.ZodDiscriminatedUnion:return F2(t,n);case ge.ZodIntersection:return I2(t,n);case ge.ZodTuple:return Y2(t,n);case ge.ZodRecord:return F_(t,n);case ge.ZodLiteral:return w2(t);case ge.ZodEnum:return C2(t);case ge.ZodNativeEnum:return D2(t);case ge.ZodNullable:return U2(t,n);case ge.ZodOptional:return q2(t,n);case ge.ZodMap:return L2(t,n);case ge.ZodSet:return W2(t,n);case ge.ZodLazy:return()=>t.getter()._def;case ge.ZodPromise:return V2(t,n);case ge.ZodNaN:case ge.ZodNever:return M2();case ge.ZodEffects:return _2(t,n);case ge.ZodAny:return Jt();case ge.ZodUnknown:return X2();case ge.ZodDefault:return x2(t,n);case ge.ZodBranded:return D_(t,n);case ge.ZodReadonly:return Z2(t,n);case ge.ZodCatch:return k2(t,n);case ge.ZodPipeline:return G2(t,n);case ge.ZodFunction:case ge.ZodVoid:case ge.ZodSymbol:return;default:return(r=>{})()}},J2=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function Pe(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const l=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(l!==E2)return l}if(i&&!n){const l=eD(i,e);if(l!==void 0)return l}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=Q2(t,t.typeName,e),o=typeof s=="function"?Pe(s(),e):s;if(o&&tD(t,e,o),e.postProcess){const l=e.postProcess(o,t,e);return a.jsonSchema=o,l}return a.jsonSchema=o,o}var eD=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:J2(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Jt()):e.$refStrategy==="seen"?Jt():void 0}},tD=(t,e,n)=>(t.description&&(n.description=t.description),n),nD=t=>{const e=y2(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},rD=(t,e)=>{var n;const r=nD(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[c,d])=>{var p;return{...u,[c]:(p=Pe(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,c]},!0))!=null?p:Jt()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=Pe(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:Jt(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(s.title=o);const l=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return l.$schema="http://json-schema.org/draft-07/schema#",l},Fm=Symbol.for("vercel.ai.schema");function iD(t){let e;return()=>(e==null&&(e=t()),e)}function hl(t,{validate:e}={}){return{[Fm]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function aD(t){return typeof t=="object"&&t!==null&&Fm in t&&t[Fm]===!0&&"jsonSchema"in t&&"validate"in t}function tb(t){return t==null?hl({properties:{},additionalProperties:!1}):aD(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?B_(t):sD(t):t()}function sD(t){return hl(()=>eb(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Ni({value:e,cause:n.issues})}}})}function oD(t,e){var n;const r=(n=void 0)!=null?n:!1;return hl(()=>rD(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function lD(t,e){var n;const r=(n=void 0)!=null?n:!1;return hl(()=>eb(qO(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await jO(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function uD(t){return"_zod"in t}function B_(t,e){return uD(t)?lD(t):oD(t)}async function i0({value:t,schema:e}){const n=await Pa({value:t,schema:e});if(!n.success)throw Ni.wrap({value:t,cause:n.error});return n.value}async function Pa({value:t,schema:e}){const n=tb(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Ni.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:Ni.wrap({value:t,cause:r}),rawValue:t}}}async function qr({text:t,schema:e}){try{const n=b2(t);return e==null?{success:!0,value:n,rawValue:n}:await Pa({value:n,schema:e})}catch(n){return{success:!1,error:XE.isInstance(n)?n:new XE({text:t,cause:n}),rawValue:void 0}}}function cD({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new zO).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await qr({text:n,schema:e}))}}))}async function nr(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var dD=Object.defineProperty,pD=(t,e)=>{for(var n in e)dD(t,n,{get:e[n],enumerable:!0})},U_="AI_NoObjectGeneratedError",H_=`vercel.ai.error.${U_}`,fD=Symbol.for(H_),$_,fr=class extends Cn{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:U_,message:t,cause:e}),this[$_]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return Cn.hasMarker(t,H_)}};$_=fD;var z_="AI_UIMessageStreamError",j_=`vercel.ai.error.${z_}`,hD=Symbol.for(j_),q_,ui=class extends Cn{constructor({chunkType:t,chunkId:e,message:n}){super({name:z_,message:n}),this[q_]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return Cn.hasMarker(t,j_)}};q_=hD;var a0="6.0.48",G_=jt([ee(),ro(Uint8Array),ro(ArrayBuffer),a_(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),Fa=GO(()=>jt([VO(),ee(),WO(),Ot(),Da(ee(),Fa.optional()),ns(Fa)])),ve=Da(ee(),Da(ee(),Fa.optional())),V_=De({type:pe("text"),text:ee(),providerOptions:ve.optional()}),mD=De({type:pe("image"),image:jt([G_,ro(URL)]),mediaType:ee().optional(),providerOptions:ve.optional()}),W_=De({type:pe("file"),data:jt([G_,ro(URL)]),filename:ee().optional(),mediaType:ee(),providerOptions:ve.optional()}),gD=De({type:pe("reasoning"),text:ee(),providerOptions:ve.optional()}),bD=De({type:pe("tool-call"),toolCallId:ee(),toolName:ee(),input:Zn(),providerOptions:ve.optional(),providerExecuted:Ot().optional()}),ED=YO("type",[De({type:pe("text"),value:ee(),providerOptions:ve.optional()}),De({type:pe("json"),value:Fa,providerOptions:ve.optional()}),De({type:pe("execution-denied"),reason:ee().optional(),providerOptions:ve.optional()}),De({type:pe("error-text"),value:ee(),providerOptions:ve.optional()}),De({type:pe("error-json"),value:Fa,providerOptions:ve.optional()}),De({type:pe("content"),value:ns(jt([De({type:pe("text"),text:ee(),providerOptions:ve.optional()}),De({type:pe("media"),data:ee(),mediaType:ee()}),De({type:pe("file-data"),data:ee(),mediaType:ee(),filename:ee().optional(),providerOptions:ve.optional()}),De({type:pe("file-url"),url:ee(),providerOptions:ve.optional()}),De({type:pe("file-id"),fileId:jt([ee(),Da(ee(),ee())]),providerOptions:ve.optional()}),De({type:pe("image-data"),data:ee(),mediaType:ee(),providerOptions:ve.optional()}),De({type:pe("image-url"),url:ee(),providerOptions:ve.optional()}),De({type:pe("image-file-id"),fileId:jt([ee(),Da(ee(),ee())]),providerOptions:ve.optional()}),De({type:pe("custom"),providerOptions:ve.optional()})]))})]),Y_=De({type:pe("tool-result"),toolCallId:ee(),toolName:ee(),output:ED,providerOptions:ve.optional()}),yD=De({type:pe("tool-approval-request"),approvalId:ee(),toolCallId:ee()}),TD=De({type:pe("tool-approval-response"),approvalId:ee(),approved:Ot(),reason:ee().optional()}),SD=De({role:pe("system"),content:ee(),providerOptions:ve.optional()}),AD=De({role:pe("user"),content:jt([ee(),ns(jt([V_,mD,W_]))]),providerOptions:ve.optional()}),kD=De({role:pe("assistant"),content:jt([ee(),ns(jt([V_,W_,gD,bD,Y_,yD]))]),providerOptions:ve.optional()}),vD=De({role:pe("tool"),content:ns(jt([Y_,TD])),providerOptions:ve.optional()});jt([SD,AD,kD,vD]);function K_(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),o=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&o?n[r]=K_(a,i):n[r]=i}return n}var xD={};pD(xD,{array:()=>ID,choice:()=>wD,json:()=>RD,object:()=>ND,text:()=>CD});function _D(t){const e=["ROOT"];let n=-1,r=null;function i(l,u,c){switch(l){case'"':{n=u,e.pop(),e.push(c),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=u,r=u,e.pop(),e.push(c),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(c),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":{n=u,e.pop(),e.push(c),e.push("INSIDE_NUMBER");break}case"{":{n=u,e.pop(),e.push(c),e.push("INSIDE_OBJECT_START");break}case"[":{n=u,e.pop(),e.push(c),e.push("INSIDE_ARRAY_START");break}}}function a(l,u){switch(l){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=u,e.pop();break}}}function s(l,u){switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=u,e.pop();break}}}for(let l=0;l<t.length;l++){const u=t[l];switch(e[e.length-1]){case"ROOT":i(u,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(u){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{u==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{u==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{u===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(u,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(u,l);break}case"INSIDE_STRING":{switch(u){case'"':{e.pop(),n=l;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{u==="]"?(n=l,e.pop()):(n=l,i(u,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(u){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(u,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=l;break}case"INSIDE_NUMBER":{switch(u){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,l);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(u,l);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const d=t.substring(r,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(u,l):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(u,l)):n=l;break}}}let o=t.slice(0,n+1);for(let l=e.length-1;l>=0;l--)switch(e[l]){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 c=t.substring(r,t.length);"true".startsWith(c)?o+="true".slice(c.length):"false".startsWith(c)?o+="false".slice(c.length):"null".startsWith(c)&&(o+="null".slice(c.length))}}return o}async function ls(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await qr({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await qr({text:_D(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var CD=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),ND=({schema:t,name:e,description:n})=>{const r=tb(t);return{name:"object",responseFormat:nr(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await qr({text:i});if(!s.success)throw new fr({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=await Pa({value:s.value,schema:r});if(!o.success)throw new fr({message:"No object generated: response did not match schema.",cause:o.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return o.value},async parsePartialOutput({text:i}){const a=await ls(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}},createElementStreamTransform(){}}},ID=({element:t,name:e,description:n})=>{const r=tb(t);return{name:"array",responseFormat:nr(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await qr({text:i});if(!s.success)throw new fr({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const o=s.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new fr({message:"No object generated: response did not match schema.",cause:new Ni({value:o,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const l of o.elements){const u=await Pa({value:l,schema:r});if(!u.success)throw new fr({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return o.elements},async parsePartialOutput({text:i}){const a=await ls(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const o=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,l=[];for(const u of o){const c=await Pa({value:u,schema:r});c.success&&l.push(c.value)}return{partial:l}}}},createElementStreamTransform(){let i=0;return new TransformStream({transform({partialOutput:a},s){if(a!=null)for(;i<a.length;i++)s.enqueue(a[i])}})}}},wD=({options:t,name:e,description:n})=>({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},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await qr({text:r});if(!a.success)throw new fr({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new fr({message:"No object generated: response did not match schema.",cause:new Ni({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await ls(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(o=>o.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}},createElementStreamTransform(){}}),RD=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await qr({text:n});if(!i.success)throw new fr({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await ls(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});ss({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
|
|
8
8
|
|
|
9
9
|
`)},flush(t){t.enqueue(`data: [DONE]
|
|
10
10
|
|