@decocms/mesh 2.20.0 → 2.20.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-CkNvGXW2.js → AlertCircle-CI2U-jkN.js} +1 -1
- package/dist/client/assets/{ArrowLeft-BsUDOBX0.js → ArrowLeft-B3km7toT.js} +1 -1
- package/dist/client/assets/{ArrowUp-Xq_0RBx_.js → ArrowUp-BF7mM4C2.js} +1 -1
- package/dist/client/assets/{Check-DijrPXQx.js → Check-BQkm1TiP.js} +1 -1
- package/dist/client/assets/{ChevronDown-DASi-DMo.js → ChevronDown-DP6jvip7.js} +1 -1
- package/dist/client/assets/{Code01-C0ZFF6Hl.js → Code01-qXTn9GK9.js} +1 -1
- package/dist/client/assets/{Copy01-BQZg7H8u.js → Copy01-CEYn2daS.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-CjU9uXdh.js → DotsHorizontal-C2Nr-D-f.js} +1 -1
- package/dist/client/assets/{DotsVertical-D6TZm5RT.js → DotsVertical-BPP4U4GQ.js} +1 -1
- package/dist/client/assets/{Download01-BTR8eSV6.js → Download01-BkDXja2z.js} +1 -1
- package/dist/client/assets/{Edit01-BsdLQ-QO.js → Edit01-Cq0mQDLh.js} +1 -1
- package/dist/client/assets/{File06-Bm9rDm48.js → File06-KMD38I-q.js} +1 -1
- package/dist/client/assets/{FilterLines-Dg_ubOas.js → FilterLines-Bojt6HPl.js} +1 -1
- package/dist/client/assets/{FlipBackward-BZkXBjUF.js → FlipBackward-C-K9FamE.js} +1 -1
- package/dist/client/assets/{GitBranch01-DYs19mSG.js → GitBranch01-DGTCzEh5.js} +1 -1
- package/dist/client/assets/{Grid01-CTb93Z2I.js → Grid01-D4lXvveX.js} +1 -1
- package/dist/client/assets/{Home02-CAgSUdC-.js → Home02-DPdZvu8L.js} +1 -1
- package/dist/client/assets/{Image01-CUinB3ac.js → Image01-C0R6SF_P.js} +1 -1
- package/dist/client/assets/{Inbox01-tMW4EgP4.js → Inbox01-BsOUYwQZ.js} +1 -1
- package/dist/client/assets/{InfoCircle-DqeM4n2r.js → InfoCircle-BgIkbjJr.js} +1 -1
- package/dist/client/assets/{Key01-BDVEoltU.js → Key01-DTwk4FpG.js} +1 -1
- package/dist/client/assets/{LinkExternal01-C2ZOZHgx.js → LinkExternal01-DmruqAb9.js} +1 -1
- package/dist/client/assets/{List-jMJevXfS.js → List-BsSZz32j.js} +1 -1
- package/dist/client/assets/{Loading01-6JGza9Vp.js → Loading01-Ae5ezbtD.js} +1 -1
- package/dist/client/assets/{Lock01-DAc7yIAH.js → Lock01-BuQSktMF.js} +1 -1
- package/dist/client/assets/{Play-BWxFDrEk.js → Play-DKlNHVjf.js} +1 -1
- package/dist/client/assets/{Plus-Dcgso5EP.js → Plus-CdG75X26.js} +1 -1
- package/dist/client/assets/{SearchMd-CbnCIalV.js → SearchMd-GFaonOaJ.js} +1 -1
- package/dist/client/assets/{Terminal-DNtUg1U7.js → Terminal-C6mZx-5A.js} +1 -1
- package/dist/client/assets/{Trash01-CzA8mxf_.js → Trash01-BWIN9RL_.js} +1 -1
- package/dist/client/assets/{Upload01-BPJ4Vq2H.js → Upload01-CaBE4VYK.js} +1 -1
- package/dist/client/assets/{X-C7-BOCtk.js → X-C18ho617.js} +1 -1
- package/dist/client/assets/{XClose-COetRF8H.js → XClose-CfwoKknl.js} +1 -1
- package/dist/client/assets/{alert-dialog-Mcf5ObRp.js → alert-dialog-CCJCsKzK.js} +1 -1
- package/dist/client/assets/{auth-catchall-JCvomRO1.js → auth-catchall-C33VWmDE.js} +1 -1
- package/dist/client/assets/{avatar-D0pQKePK.js → avatar-B7xnPXuk.js} +1 -1
- package/dist/client/assets/{badge-9bzwrgbk.js → badge-BVO6I0sW.js} +1 -1
- package/dist/client/assets/{binder-B4r3FJOG.js → binder-By0LBK9Y.js} +1 -1
- package/dist/client/assets/{button-C_Xg9B1B.js → button-CGmrzkpY.js} +1 -1
- package/dist/client/assets/{card-BXLd4InC.js → card-DIjMh1NO.js} +1 -1
- package/dist/client/assets/{checkbox-z9w2qryt.js → checkbox-DYViXeUc.js} +1 -1
- package/dist/client/assets/{collection-detail-zSSQWfP2.js → collection-detail-DtlOJm8P.js} +1 -1
- package/dist/client/assets/{collection-display-button-DNzo_eaI.js → collection-display-button-CtkxsCB_.js} +1 -1
- package/dist/client/assets/{collection-header-DMI-enxo.js → collection-header-B4qcjEt5.js} +1 -1
- package/dist/client/assets/{collection-page-CPVm36im.js → collection-page-s-RR5fU6.js} +1 -1
- package/dist/client/assets/{collection-search-NPXhv3P8.js → collection-search-BVb42O45.js} +1 -1
- package/dist/client/assets/{collection-tab-DoDfK_be.js → collection-tab-CvrhLJCU.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CH0cDKjW.js → collection-table-wrapper-BohFZqii.js} +1 -1
- package/dist/client/assets/{connection-DoXpv3Ov.js → connection-ChwHK0-S.js} +1 -1
- package/dist/client/assets/{connection-card-zeRxy9uc.js → connection-card-DMMfNQUo.js} +1 -1
- package/dist/client/assets/{connection-detail-vV4L4jYp.js → connection-detail-D9bORT-_.js} +1 -1
- package/dist/client/assets/{connections-DNpwgzUU.js → connections-CRhyn7eO.js} +1 -1
- package/dist/client/assets/constants-J0aH6mLs.js +1 -0
- package/dist/client/assets/{create-organization-dialog-Ro3igzlR.js → create-organization-dialog-CtbMd6S_.js} +1 -1
- package/dist/client/assets/{dialog-C9Agm5JE.js → dialog-DJJ2cvEE.js} +1 -1
- package/dist/client/assets/{dropdown-menu-fQ8f1M5d.js → dropdown-menu-CAeD2aIb.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-B3cv12GM.js → dynamic-plugin-layout-BeSg8wRq.js} +1 -1
- package/dist/client/assets/{empty-state-DdUozeuW.js → empty-state-BkAB-hls.js} +1 -1
- package/dist/client/assets/{empty-state-DBRX3hef.js → empty-state-wP9uukGJ.js} +1 -1
- package/dist/client/assets/{env-vars-editor-BXw6d8cC.js → env-vars-editor-DuH6BBdA.js} +1 -1
- package/dist/client/assets/{error-boundary-yHT4ni_0.js → error-boundary-BUvK8Sry.js} +1 -1
- package/dist/client/assets/{extract-connection-data-PVjaut0P.js → extract-connection-data-BLs0SRok.js} +1 -1
- package/dist/client/assets/{file-browser-Bh7hl3h8.js → file-browser-DuR45yyf.js} +2 -2
- package/dist/client/assets/{form-D_wQlmgT.js → form-DiGzBnRK.js} +1 -1
- package/dist/client/assets/gateway-detail-BCBmyW-G.js +1 -0
- package/dist/client/assets/{gateways-B0QSXg4v.js → gateways-BgSVXbfx.js} +1 -1
- package/dist/client/assets/{grid-view-BsHjiotE.js → grid-view-Db741zGU.js} +1 -1
- package/dist/client/assets/{home-m3uBo7L5.js → home-BtJc_wcZ.js} +1 -1
- package/dist/client/assets/{index-QjJpaT60.js → index-CL_rL7XJ.js} +4 -4
- package/dist/client/assets/{index-Cg8UjPnN.js → index-D4QCsSzb.js} +1 -1
- package/dist/client/assets/index-DUA-vRuy.js +1 -0
- package/dist/client/assets/{index-DZBCLPmz.js → index-Diww4UW3.js} +2 -2
- package/dist/client/assets/{index-3IJwc3nu.js → index-DjRWdLI4.js} +1 -1
- package/dist/client/assets/index-H07QDM93.css +1 -0
- package/dist/client/assets/{infiniteQueryObserver-CB9iuYaY.js → infiniteQueryObserver-BmbQcWdI.js} +1 -1
- package/dist/client/assets/{input-DrOaW48H.js → input-CrURMEZe.js} +1 -1
- package/dist/client/assets/{layout-B4oQiZN6.js → layout-kp8TTJc9.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-CSmD3B45.js → lazy-highlighter-dN3WcL6s.js} +1 -1
- package/dist/client/assets/{localstorage-keys-ColTY5EO.js → localstorage-keys-BVANkONM.js} +1 -1
- package/dist/client/assets/{login-BdRlUNll.js → login-CnuJ6k4x.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CcVuDlog.js → mcp-oauth-CdcIczUJ.js} +1 -1
- package/dist/client/assets/{mcp-server-card-BnclXini.js → mcp-server-card-VZUBDTRj.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-DTSTQPDK.js → mcp-server-detail-CIR0FKMd.js} +1 -1
- package/dist/client/assets/{members-BAse2YpR.js → members-bQTH1spX.js} +1 -1
- package/dist/client/assets/{monaco-editor-BtLswDg1.js → monaco-editor-CDRbE4GY.js} +1 -1
- package/dist/client/assets/{monitoring-FELvrXqN.js → monitoring-Cb41cf-X.js} +1 -1
- package/dist/client/assets/{oauth-callback-sXSk4y6N.js → oauth-callback-z6t0OToi.js} +1 -1
- package/dist/client/assets/{page-IVcVoGr6.js → page-CcKdSzCp.js} +1 -1
- package/dist/client/assets/{page-c25MW39x.js → page-SWPgLEpC.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-D7zfHxC-.js → pin-to-sidebar-button-DIwkO0Tx.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-DINK0udh.js → plugin-empty-state-B-glkOMH.js} +1 -1
- package/dist/client/assets/{plugin-header-BaOkI6uW.js → plugin-header-BA0z5mBU.js} +1 -1
- package/dist/client/assets/{plugins-DU28fvG7.js → plugins-Cq62fkYj.js} +1 -1
- package/dist/client/assets/{popover-DDq46px5.js → popover-Bx7diZ86.js} +1 -1
- package/dist/client/assets/{project-context-provider-CwtkfEWe.js → project-context-provider-DulCVL2k.js} +1 -1
- package/dist/client/assets/{registry-utils-nz3H3-qh.js → registry-utils-8Lvx2XTy.js} +1 -1
- package/dist/client/assets/{resizable-ZYLqRZrr.js → resizable-Gk1RjNnW.js} +1 -1
- package/dist/client/assets/{resource-tabs-Dv00g9SH.js → resource-tabs-ACbF96qo.js} +1 -1
- package/dist/client/assets/{select-Cgab7LNB.js → select-C8LOz7vA.js} +1 -1
- package/dist/client/assets/{settings-CUngx_cw.js → settings-BXJ6BGel.js} +1 -1
- package/dist/client/assets/shell-layout-CFRw9Ru3.js +3 -0
- package/dist/client/assets/{spinner-ISlo4YZH.js → spinner-BF56RAKQ.js} +1 -1
- package/dist/client/assets/{switch-BDCe2nGJ.js → switch-DJBd8Fzb.js} +1 -1
- package/dist/client/assets/{textarea-BL4bZEBo.js → textarea-C_zgj3Sp.js} +1 -1
- package/dist/client/assets/{tool-set-selector-CWxawPKU.js → tool-set-selector-B9rTBahU.js} +1 -1
- package/dist/client/assets/{tools-list-BAdvjUaK.js → tools-list-mr-l2d8l.js} +1 -1
- package/dist/client/assets/{tooltip-CpJ7mUzE.js → tooltip-Suu_Gpqh.js} +1 -1
- package/dist/client/assets/{typewriter-title-vVGiDyZ3.js → typewriter-title-DM-oRxie.js} +1 -1
- package/dist/client/assets/{use-binding-DGnotkAI.js → use-binding-D6wv_5fO.js} +1 -1
- package/dist/client/assets/{use-collections-BmF5uRR6.js → use-collections-CXETocKO.js} +1 -1
- package/dist/client/assets/{use-connection-CD3KQhdl.js → use-connection-CCXutWLD.js} +1 -1
- package/dist/client/assets/{use-connection-resources-Bk8Paqb0.js → use-connection-resources-D0st76bP.js} +1 -1
- package/dist/client/assets/{use-create-gateway-Buvj1BPg.js → use-create-gateway-BlLsktgc.js} +1 -1
- package/dist/client/assets/{use-gateway-HT97xIYl.js → use-gateway-DD-xEZju.js} +1 -1
- package/dist/client/assets/{use-gateway-system-prompt-DPiQIOlu.js → use-gateway-system-prompt-zGJSEzce.js} +1 -1
- package/dist/client/assets/{use-list-state-DceT21J-.js → use-list-state-AndcW8aD.js} +1 -1
- package/dist/client/assets/{use-mcp-C2xjgZVM.js → use-mcp-D9llr83X.js} +1 -1
- package/dist/client/assets/{use-members-D-h9QOxK.js → use-members-CB2ebBfn.js} +1 -1
- package/dist/client/assets/{use-mobile-BH2x5CB1.js → use-mobile-DssCtDl6.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BMsrsPvw.js → use-organization-settings-CQXtXtZs.js} +1 -1
- package/dist/client/assets/{use-tool-call-BmQnCqef.js → use-tool-call-BmvKn7jp.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BttwTOfK.js +1 -0
- package/dist/client/assets/{useMutation-DV6K6Nze.js → useMutation-Dl1MMkEC.js} +1 -1
- package/dist/client/assets/useQuery-Bvk0U2ed.js +1 -0
- package/dist/client/assets/{value-BiYWDF0x.js → value-DaPOjTmC.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DPk8_aIn.js → view-mode-toggle-BLClM-0g.js} +1 -1
- package/dist/client/assets/{workflow-B_8Qc7GH.js → workflow-CQ7PQ7Dg.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/node_modules/kysely/README.md +3 -1
- package/dist/server/node_modules/kysely/dist/cjs/index.d.ts +3 -1
- package/dist/server/node_modules/kysely/dist/cjs/migration/migrator.d.ts +1 -1
- package/dist/server/node_modules/kysely/dist/cjs/migration/migrator.js +75 -68
- package/dist/server/node_modules/kysely/dist/esm/index.d.ts +3 -1
- package/dist/server/node_modules/kysely/dist/esm/migration/migrator.d.ts +1 -1
- package/dist/server/node_modules/kysely/dist/esm/migration/migrator.js +75 -68
- package/dist/server/node_modules/kysely/package.json +13 -13
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/constants-CBp9PjFO.js +0 -1
- package/dist/client/assets/gateway-detail-B6I6y-jz.js +0 -1
- package/dist/client/assets/index-Dh9ePU0t.css +0 -1
- package/dist/client/assets/index-DiisCGqz.js +0 -1
- package/dist/client/assets/shell-layout-IdYGAQZJ.js +0 -3
- package/dist/client/assets/useInfiniteQuery-hrzJXDha.js +0 -1
- package/dist/client/assets/useQuery-mZS4-X0F.js +0 -1
package/dist/server/server.js
CHANGED
|
@@ -1069,7 +1069,7 @@ Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
|
1069
1069
|
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
1070
1070
|
|
|
1071
1071
|
Option 2 - OIDC token:
|
|
1072
|
-
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`;return new X({message:Z,statusCode:G,cause:W})}},d71="GatewayInvalidRequestError",Ob6=`vercel.ai.gateway.error.${d71}`,T71=Symbol.for(Ob6),A71,E71,Lb6=class extends(E71=hQ,A71=T71,E71){constructor({message:X="Invalid request",statusCode:Y=400,cause:Q}={}){super({message:X,statusCode:Y,cause:Q});this[A71]=!0,this.name=d71,this.type="invalid_request_error"}static isInstance(X){return hQ.hasMarker(X)&&T71 in X}},p71="GatewayRateLimitError",wb6=`vercel.ai.gateway.error.${p71}`,j71=Symbol.for(wb6),C71,I71,Mb6=class extends(I71=hQ,C71=j71,I71){constructor({message:X="Rate limit exceeded",statusCode:Y=429,cause:Q}={}){super({message:X,statusCode:Y,cause:Q});this[C71]=!0,this.name=p71,this.type="rate_limit_exceeded"}static isInstance(X){return hQ.hasMarker(X)&&j71 in X}},c71="GatewayModelNotFoundError",Pb6=`vercel.ai.gateway.error.${c71}`,R71=Symbol.for(Pb6),Tb6=d9(()=>Y9(B.object({modelId:B.string()}))),S71,v71,Ab6=class extends(v71=hQ,S71=R71,v71){constructor({message:X="Model not found",statusCode:Y=404,modelId:Q,cause:J}={}){super({message:X,statusCode:Y,cause:J});this[S71]=!0,this.name=c71,this.type="model_not_found",this.modelId=Q}static isInstance(X){return hQ.hasMarker(X)&&R71 in X}},n71="GatewayInternalServerError",Eb6=`vercel.ai.gateway.error.${n71}`,k71=Symbol.for(Eb6),_71,y71,b71=class extends(y71=hQ,_71=k71,y71){constructor({message:X="Internal server error",statusCode:Y=500,cause:Q}={}){super({message:X,statusCode:Y,cause:Q});this[_71]=!0,this.name=n71,this.type="internal_server_error"}static isInstance(X){return hQ.hasMarker(X)&&k71 in X}},i71="GatewayResponseError",jb6=`vercel.ai.gateway.error.${i71}`,f71=Symbol.for(jb6),h71,x71,Cb6=class extends(x71=hQ,h71=f71,x71){constructor({message:X="Invalid response from Gateway",statusCode:Y=502,response:Q,validationError:J,cause:G}={}){super({message:X,statusCode:Y,cause:G});this[h71]=!0,this.name=i71,this.type="response_error",this.response=Q,this.validationError=J}static isInstance(X){return hQ.hasMarker(X)&&f71 in X}};async function g71({response:X,statusCode:Y,defaultMessage:Q="Gateway request failed",cause:J,authMethod:G}){let W=await wY({value:X,schema:Ib6});if(!W.success)return new Cb6({message:`Invalid error response format: ${Q}`,statusCode:Y,response:X,validationError:W.error,cause:J});let Z=W.value,$=Z.error.type,K=Z.error.message;switch($){case"authentication_error":return Vb.createContextualError({apiKeyProvided:G==="api-key",oidcTokenProvided:G==="oidc",statusCode:Y,cause:J});case"invalid_request_error":return new Lb6({message:K,statusCode:Y,cause:J});case"rate_limit_exceeded":return new Mb6({message:K,statusCode:Y,cause:J});case"model_not_found":{let H=await wY({value:Z.error.param,schema:Tb6});return new Ab6({message:K,statusCode:Y,modelId:H.success?H.value.modelId:void 0,cause:J})}case"internal_server_error":return new b71({message:K,statusCode:Y,cause:J});default:return new b71({message:K,statusCode:Y,cause:J})}}var Ib6=d9(()=>Y9(B.object({error:B.object({message:B.string(),type:B.string().nullish(),param:B.unknown().nullish(),code:B.union([B.string(),B.number()]).nullish()})})));function JK(X,Y){var Q;if(hQ.isInstance(X))return X;if(i8.isInstance(X))return g71({response:Rb6(X),statusCode:(Q=X.statusCode)!=null?Q:500,defaultMessage:"Gateway request failed",cause:X,authMethod:Y});return g71({response:{},statusCode:500,defaultMessage:X instanceof Error?`Gateway request failed: ${X.message}`:"Unknown Gateway error",cause:X,authMethod:Y})}function Rb6(X){if(X.data!==void 0)return X.data;if(X.responseBody!=null)try{return JSON.parse(X.responseBody)}catch(Y){return X.responseBody}return{}}var a71="ai-gateway-auth-method";async function iU(X){let Y=await wY({value:X[a71],schema:Sb6});return Y.success?Y.value:void 0}var Sb6=d9(()=>Y9(B.union([B.literal("api-key"),B.literal("oidc")]))),u71=class{constructor(X){this.config=X}async getAvailableModels(){try{let{value:X}=await s80({url:`${this.config.baseURL}/config`,headers:await NX(this.config.headers()),successfulResponseHandler:lW(vb6),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(Y)=>Y}),fetch:this.config.fetch});return X}catch(X){throw await JK(X)}}async getCredits(){try{let X=new URL(this.config.baseURL),{value:Y}=await s80({url:`${X.origin}/v1/credits`,headers:await NX(this.config.headers()),successfulResponseHandler:lW(kb6),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(Q)=>Q}),fetch:this.config.fetch});return Y}catch(X){throw await JK(X)}}},vb6=d9(()=>Y9(B.object({models:B.array(B.object({id:B.string(),name:B.string(),description:B.string().nullish(),pricing:B.object({input:B.string(),output:B.string(),input_cache_read:B.string().nullish(),input_cache_write:B.string().nullish()}).transform(({input:X,output:Y,input_cache_read:Q,input_cache_write:J})=>({input:X,output:Y,...Q?{cachedInputTokens:Q}:{},...J?{cacheCreationInputTokens:J}:{}})).nullish(),specification:B.object({specificationVersion:B.literal("v3"),provider:B.string(),modelId:B.string()}),modelType:B.enum(["language","embedding","image"]).nullish()}))}))),kb6=d9(()=>Y9(B.object({balance:B.string(),total_used:B.string()}).transform(({balance:X,total_used:Y})=>({balance:X,totalUsed:Y})))),_b6=class{constructor(X,Y){this.modelId=X,this.config=Y,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(X){let{abortSignal:Y,...Q}=X;return{args:this.maybeEncodeFileParts(Q),warnings:[]}}async doGenerate(X){let{args:Y,warnings:Q}=await this.getArgs(X),{abortSignal:J}=X,G=await NX(this.config.headers());try{let{responseHeaders:W,value:Z,rawValue:$}=await qF({url:this.getUrl(),headers:HF(G,X.headers,this.getModelConfigHeaders(this.modelId,!1),await NX(this.config.o11yHeaders)),body:Y,successfulResponseHandler:lW(B.any()),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(K)=>K}),...J&&{abortSignal:J},fetch:this.config.fetch});return{...Z,request:{body:Y},response:{headers:W,body:$},warnings:Q}}catch(W){throw await JK(W,await iU(G))}}async doStream(X){let{args:Y,warnings:Q}=await this.getArgs(X),{abortSignal:J}=X,G=await NX(this.config.headers());try{let{value:W,responseHeaders:Z}=await qF({url:this.getUrl(),headers:HF(G,X.headers,this.getModelConfigHeaders(this.modelId,!0),await NX(this.config.o11yHeaders)),body:Y,successfulResponseHandler:yG1(B.any()),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:($)=>$}),...J&&{abortSignal:J},fetch:this.config.fetch});return{stream:W.pipeThrough(new TransformStream({start($){if(Q.length>0)$.enqueue({type:"stream-start",warnings:Q})},transform($,K){if($.success){let H=$.value;if(H.type==="raw"&&!X.includeRawChunks)return;if(H.type==="response-metadata"&&H.timestamp&&typeof H.timestamp==="string")H.timestamp=new Date(H.timestamp);K.enqueue(H)}else K.error($.error)}})),request:{body:Y},response:{headers:Z}}}catch(W){throw await JK(W,await iU(G))}}isFilePart(X){return X&&typeof X==="object"&&"type"in X&&X.type==="file"}maybeEncodeFileParts(X){for(let Y of X.prompt)for(let Q of Y.content)if(this.isFilePart(Q)){let J=Q;if(J.data instanceof Uint8Array){let G=Uint8Array.from(J.data),W=Buffer.from(G).toString("base64");J.data=new URL(`data:${J.mediaType||"application/octet-stream"};base64,${W}`)}}return X}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(X,Y){return{"ai-language-model-specification-version":"3","ai-language-model-id":X,"ai-language-model-streaming":String(Y)}}},yb6=class{constructor(X,Y){this.modelId=X,this.config=Y,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:X,headers:Y,abortSignal:Q,providerOptions:J}){var G;let W=await NX(this.config.headers());try{let{responseHeaders:Z,value:$,rawValue:K}=await qF({url:this.getUrl(),headers:HF(W,Y!=null?Y:{},this.getModelConfigHeaders(),await NX(this.config.o11yHeaders)),body:{values:X,...J?{providerOptions:J}:{}},successfulResponseHandler:lW(bb6),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(H)=>H}),...Q&&{abortSignal:Q},fetch:this.config.fetch});return{embeddings:$.embeddings,usage:(G=$.usage)!=null?G:void 0,providerMetadata:$.providerMetadata,response:{headers:Z,body:K},warnings:[]}}catch(Z){throw await JK(Z,await iU(W))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},bb6=d9(()=>Y9(B.object({embeddings:B.array(B.array(B.number())),usage:B.object({tokens:B.number()}).nullish(),providerMetadata:B.record(B.string(),B.record(B.string(),B.unknown())).optional()}))),fb6=class{constructor(X,Y){this.modelId=X,this.config=Y,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:X,n:Y,size:Q,aspectRatio:J,seed:G,files:W,mask:Z,providerOptions:$,headers:K,abortSignal:H}){var F;let V=await NX(this.config.headers());try{let{responseHeaders:q,value:z,rawValue:D}=await qF({url:this.getUrl(),headers:HF(V,K!=null?K:{},this.getModelConfigHeaders(),await NX(this.config.o11yHeaders)),body:{prompt:X,n:Y,...Q&&{size:Q},...J&&{aspectRatio:J},...G&&{seed:G},...$&&{providerOptions:$},...W&&{files:W.map((N)=>m71(N))},...Z&&{mask:m71(Z)}},successfulResponseHandler:lW(xb6),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(N)=>N}),...H&&{abortSignal:H},fetch:this.config.fetch});return{images:z.images,warnings:(F=z.warnings)!=null?F:[],providerMetadata:z.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:q}}}catch(q){throw JK(q,await iU(V))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function m71(X){if(X.type==="file"&&X.data instanceof Uint8Array)return{...X,data:VF(X.data)};return X}var hb6=B.object({images:B.array(B.unknown()).optional()}).catchall(B.unknown()),xb6=B.object({images:B.array(B.string()),warnings:B.array(B.object({type:B.literal("other"),message:B.string()})).optional(),providerMetadata:B.record(B.string(),hb6).optional()}),gb6=d9(()=>Y9(B.object({query:B.union([B.string(),B.array(B.string())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:B.number().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:B.number().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:B.number().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:B.string().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:B.array(B.string()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:B.array(B.string()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:B.string().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:B.string().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:B.string().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:B.string().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:B.enum(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")}))),ub6=d9(()=>Y9(B.union([B.object({results:B.array(B.object({title:B.string(),url:B.string(),snippet:B.string(),date:B.string().optional(),lastUpdated:B.string().optional()})),id:B.string()}),B.object({error:B.enum(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:B.number().optional(),message:B.string()})]))),mb6=_G1({id:"gateway.perplexity_search",inputSchema:gb6,outputSchema:ub6}),lb6=(X={})=>mb6(X),db6={perplexitySearch:lb6};async function pb6(){var X;return(X=r71.getContext().headers)==null?void 0:X["x-vercel-id"]}var cb6="3.0.16",nb6="0.0.1";function ib6(X={}){var Y,Q;let J=null,G=null,W=(Y=X.metadataCacheRefreshMillis)!=null?Y:300000,Z=0,$=(Q=bG1(X.baseURL))!=null?Q:"https://ai-gateway.vercel.sh/v3/ai",K=async()=>{try{let N=await ab6(X);return YK({Authorization:`Bearer ${N.token}`,"ai-gateway-protocol-version":nb6,[a71]:N.authMethod,...X.headers},`ai-sdk/gateway/${cb6}`)}catch(N){throw Vb.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:N})}},H=()=>{let N=vP({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),L=vP({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),w=vP({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{let C=await pb6();return{...N&&{"ai-o11y-deployment-id":N},...L&&{"ai-o11y-environment":L},...w&&{"ai-o11y-region":w},...C&&{"ai-o11y-request-id":C}}}},F=(N)=>{return new _b6(N,{provider:"gateway",baseURL:$,headers:K,fetch:X.fetch,o11yHeaders:H()})},V=async()=>{var N,L,w;let C=(w=(L=(N=X._internal)==null?void 0:N.currentDate)==null?void 0:L.call(N).getTime())!=null?w:Date.now();if(!J||C-Z>W)Z=C,J=new u71({baseURL:$,headers:K,fetch:X.fetch}).getAvailableModels().then((T)=>{return G=T,T}).catch(async(T)=>{throw await JK(T,await iU(await K()))});return G?Promise.resolve(G):J},q=async()=>{return new u71({baseURL:$,headers:K,fetch:X.fetch}).getCredits().catch(async(N)=>{throw await JK(N,await iU(await K()))})},z=function(N){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return F(N)};z.specificationVersion="v3",z.getAvailableModels=V,z.getCredits=q,z.imageModel=(N)=>{return new fb6(N,{provider:"gateway",baseURL:$,headers:K,fetch:X.fetch,o11yHeaders:H()})},z.languageModel=F;let D=(N)=>{return new yb6(N,{provider:"gateway",baseURL:$,headers:K,fetch:X.fetch,o11yHeaders:H()})};return z.embeddingModel=D,z.textEmbeddingModel=D,z.tools=db6,z}var s71=ib6();async function ab6(X){let Y=vP({settingValue:X.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(Y)return{token:Y,authMethod:"api-key"};return{token:await o71.getVercelOidcToken(),authMethod:"oidc"}}a6();a6();a6();a6();a6();a6();var eW1=t6(Z1(),1),sU=t6(Z1(),1);a6();a6();var rb6=Object.defineProperty,ob6=(X,Y)=>{for(var Q in Y)rb6(X,Q,{get:Y[Q],enumerable:!0})},ZW1="AI_InvalidArgumentError",$W1=`vercel.ai.error.${ZW1}`,sb6=Symbol.for($W1),KW1,H7=class extends B1{constructor({parameter:X,value:Y,message:Q}){super({name:ZW1,message:`Invalid argument for parameter ${X}: ${Q}`});this[KW1]=!0,this.parameter=X,this.value=Y}static isInstance(X){return B1.hasMarker(X,$W1)}};KW1=sb6;var tb6="AI_InvalidStreamPartError",eb6=`vercel.ai.error.${tb6}`,Xf6=Symbol.for(eb6),Yf6;Yf6=Xf6;var HW1="AI_InvalidToolApprovalError",FW1=`vercel.ai.error.${HW1}`,Qf6=Symbol.for(FW1),VW1,Jf6=class extends B1{constructor({approvalId:X}){super({name:HW1,message:`Tool approval response references unknown approvalId: "${X}". No matching tool-approval-request found in message history.`});this[VW1]=!0,this.approvalId=X}static isInstance(X){return B1.hasMarker(X,FW1)}};VW1=Qf6;var qW1="AI_InvalidToolInputError",zW1=`vercel.ai.error.${qW1}`,Gf6=Symbol.for(zW1),UW1,j90=class extends B1{constructor({toolInput:X,toolName:Y,cause:Q,message:J=`Invalid input for tool ${Y}: ${k5(Q)}`}){super({name:qW1,message:J,cause:Q});this[UW1]=!0,this.toolInput=X,this.toolName=Y}static isInstance(X){return B1.hasMarker(X,zW1)}};UW1=Gf6;var BW1="AI_ToolCallNotFoundForApprovalError",DW1=`vercel.ai.error.${BW1}`,Wf6=Symbol.for(DW1),NW1,OW1=class extends B1{constructor({toolCallId:X,approvalId:Y}){super({name:BW1,message:`Tool call "${X}" not found for approval request "${Y}".`});this[NW1]=!0,this.toolCallId=X,this.approvalId=Y}static isInstance(X){return B1.hasMarker(X,DW1)}};NW1=Wf6;var Zf6="AI_NoImageGeneratedError",$f6=`vercel.ai.error.${Zf6}`,Kf6=Symbol.for($f6),Hf6;Hf6=Kf6;var LW1="AI_NoObjectGeneratedError",wW1=`vercel.ai.error.${LW1}`,Ff6=Symbol.for(wW1),MW1,GK=class extends B1{constructor({message:X="No object generated.",cause:Y,text:Q,response:J,usage:G,finishReason:W}){super({name:LW1,message:X,cause:Y});this[MW1]=!0,this.text=Q,this.response=J,this.usage=G,this.finishReason=W}static isInstance(X){return B1.hasMarker(X,wW1)}};MW1=Ff6;var PW1="AI_NoOutputGeneratedError",TW1=`vercel.ai.error.${PW1}`,Vf6=Symbol.for(TW1),AW1,qf6=class extends B1{constructor({message:X="No output generated.",cause:Y}={}){super({name:PW1,message:X,cause:Y});this[AW1]=!0}static isInstance(X){return B1.hasMarker(X,TW1)}};AW1=Vf6;var EW1="AI_NoSuchToolError",jW1=`vercel.ai.error.${EW1}`,zf6=Symbol.for(jW1),CW1,w90=class extends B1{constructor({toolName:X,availableTools:Y=void 0,message:Q=`Model tried to call unavailable tool '${X}'. ${Y===void 0?"No tools are available.":`Available tools: ${Y.join(", ")}.`}`}){super({name:EW1,message:Q});this[CW1]=!0,this.toolName=X,this.availableTools=Y}static isInstance(X){return B1.hasMarker(X,jW1)}};CW1=zf6;var IW1="AI_ToolCallRepairError",RW1=`vercel.ai.error.${IW1}`,Uf6=Symbol.for(RW1),SW1,Bf6=class extends B1{constructor({cause:X,originalError:Y,message:Q=`Error repairing tool call: ${k5(X)}`}){super({name:IW1,message:Q,cause:X});this[SW1]=!0,this.originalError=Y}static isInstance(X){return B1.hasMarker(X,RW1)}};SW1=Uf6;var Df6=class extends B1{constructor(X){super({name:"AI_UnsupportedModelVersionError",message:`Unsupported model version ${X.version} for provider "${X.provider}" and model "${X.modelId}". AI SDK 5 only supports models that implement specification version "v2".`});this.version=X.version,this.provider=X.provider,this.modelId=X.modelId}},vW1="AI_UIMessageStreamError",kW1=`vercel.ai.error.${vW1}`,Nf6=Symbol.for(kW1),_W1,aU=class extends B1{constructor({chunkType:X,chunkId:Y,message:Q}){super({name:vW1,message:Q});this[_W1]=!0,this.chunkType=X,this.chunkId=Y}static isInstance(X){return B1.hasMarker(X,kW1)}};_W1=Nf6;var Of6="AI_InvalidDataContentError",Lf6=`vercel.ai.error.${Of6}`,wf6=Symbol.for(Lf6),Mf6;Mf6=wf6;var yW1="AI_InvalidMessageRoleError",bW1=`vercel.ai.error.${yW1}`,Pf6=Symbol.for(bW1),fW1,Tf6=class extends B1{constructor({role:X,message:Y=`Invalid message role: '${X}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:yW1,message:Y});this[fW1]=!0,this.role=X}static isInstance(X){return B1.hasMarker(X,bW1)}};fW1=Pf6;var hW1="AI_MessageConversionError",xW1=`vercel.ai.error.${hW1}`,Af6=Symbol.for(xW1),gW1,Ef6=class extends B1{constructor({originalMessage:X,message:Y}){super({name:hW1,message:Y});this[gW1]=!0,this.originalMessage=X}static isInstance(X){return B1.hasMarker(X,xW1)}};gW1=Af6;var uW1="AI_RetryError",mW1=`vercel.ai.error.${uW1}`,jf6=Symbol.for(mW1),lW1,t71=class extends B1{constructor({message:X,reason:Y,errors:Q}){super({name:uW1,message:X});this[lW1]=!0,this.reason=Y,this.errors=Q,this.lastError=Q[Q.length-1]}static isInstance(X){return B1.hasMarker(X,mW1)}};lW1=jf6;function Cf6({warning:X,provider:Y,model:Q}){let J=`AI SDK Warning (${Y} / ${Q}):`;switch(X.type){case"unsupported":{let G=`${J} The feature "${X.feature}" is not supported.`;if(X.details)G+=` ${X.details}`;return G}case"compatibility":{let G=`${J} The feature "${X.feature}" is used in a compatibility mode.`;if(X.details)G+=` ${X.details}`;return G}case"other":return`${J} ${X.message}`;default:return`${J} ${JSON.stringify(X,null,2)}`}}var If6="AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.",e71=!1,dW1=(X)=>{if(X.warnings.length===0)return;let Y=globalThis.AI_SDK_LOG_WARNINGS;if(Y===!1)return;if(typeof Y==="function"){Y(X);return}if(!e71)e71=!0,console.info(If6);for(let Q of X.warnings)console.warn(Cf6({warning:Q,provider:X.provider,model:X.model}))};function Rf6({provider:X,modelId:Y}){dW1({warnings:[{type:"compatibility",feature:"specificationVersion",details:"Using v2 specification compatibility mode. Some features may not be available."}],provider:X,model:Y})}function Sf6(X){if(X.specificationVersion==="v3")return X;return Rf6({provider:X.provider,modelId:X.modelId}),new Proxy(X,{get(Y,Q){switch(Q){case"specificationVersion":return"v3";case"doGenerate":return async(...J)=>{let G=await Y.doGenerate(...J);return{...G,finishReason:pW1(G.finishReason),usage:cW1(G.usage)}};case"doStream":return async(...J)=>{let G=await Y.doStream(...J);return{...G,stream:vf6(G.stream)}};default:return Y[Q]}}})}function vf6(X){return X.pipeThrough(new TransformStream({transform(Y,Q){switch(Y.type){case"finish":Q.enqueue({...Y,finishReason:pW1(Y.finishReason),usage:cW1(Y.usage)});break;default:Q.enqueue(Y);break}}}))}function pW1(X){return{unified:X==="unknown"?"other":X,raw:void 0}}function cW1(X){return{inputTokens:{total:X.inputTokens,noCache:void 0,cacheRead:X.cachedInputTokens,cacheWrite:void 0},outputTokens:{total:X.outputTokens,text:void 0,reasoning:X.reasoningTokens}}}function nW1(X){if(typeof X!=="string"){if(X.specificationVersion!=="v3"&&X.specificationVersion!=="v2"){let Y=X;throw new Df6({version:Y.specificationVersion,provider:Y.provider,modelId:Y.modelId})}return Sf6(X)}return kf6().languageModel(X)}function kf6(){var X;return(X=globalThis.AI_SDK_DEFAULT_PROVIDER)!=null?X:s71}function iW1(X){if(X==null)return;if(typeof X==="number")return X;return X.totalMs}function _f6(X){if(X==null||typeof X==="number")return;return X.stepMs}function yf6(X){if(X==null||typeof X==="number")return;return X.chunkMs}var bf6=[{mediaType:"image/gif",bytesPrefix:[71,73,70]},{mediaType:"image/png",bytesPrefix:[137,80,78,71]},{mediaType:"image/jpeg",bytesPrefix:[255,216]},{mediaType:"image/webp",bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:"image/bmp",bytesPrefix:[66,77]},{mediaType:"image/tiff",bytesPrefix:[73,73,42,0]},{mediaType:"image/tiff",bytesPrefix:[77,77,0,42]},{mediaType:"image/avif",bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:"image/heic",bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}];var ff6=(X)=>{let Y=typeof X==="string"?pU(X):X,Q=(Y[6]&127)<<21|(Y[7]&127)<<14|(Y[8]&127)<<7|Y[9]&127;return Y.slice(Q+10)};function hf6(X){return typeof X==="string"&&X.startsWith("SUQz")||typeof X!=="string"&&X.length>10&&X[0]===73&&X[1]===68&&X[2]===51?ff6(X):X}function xf6({data:X,signatures:Y}){let Q=hf6(X),J=typeof Q==="string"?pU(Q.substring(0,Math.min(Q.length,24))):Q;for(let G of Y)if(J.length>=G.bytesPrefix.length&&G.bytesPrefix.every((W,Z)=>W===null||J[Z]===W))return G.mediaType;return}var gf6="6.0.39",uf6=async({url:X})=>{var Y;let Q=X.toString();try{let J=await fetch(Q,{headers:YK({},`ai-sdk/${gf6}`,Gb())});if(!J.ok)throw new Jb({url:Q,statusCode:J.status,statusText:J.statusText});return{data:new Uint8Array(await J.arrayBuffer()),mediaType:(Y=J.headers.get("content-type"))!=null?Y:void 0}}catch(J){if(Jb.isInstance(J))throw J;throw new Jb({url:Q,cause:J})}},mf6=(X=uf6)=>(Y)=>Promise.all(Y.map(async(Q)=>Q.isUrlSupportedByModel?null:X(Q)));function lf6(X){try{let[Y,Q]=X.split(",");return{mediaType:Y.split(";")[0].split(":")[1],base64Content:Q}}catch(Y){return{mediaType:void 0,base64Content:void 0}}}var aW1=B.union([B.string(),B.instanceof(Uint8Array),B.instanceof(ArrayBuffer),B.custom((X)=>{var Y,Q;return(Q=(Y=globalThis.Buffer)==null?void 0:Y.isBuffer(X))!=null?Q:!1},{message:"Must be a Buffer"})]);function rW1(X){if(X instanceof Uint8Array)return{data:X,mediaType:void 0};if(X instanceof ArrayBuffer)return{data:new Uint8Array(X),mediaType:void 0};if(typeof X==="string")try{X=new URL(X)}catch(Y){}if(X instanceof URL&&X.protocol==="data:"){let{mediaType:Y,base64Content:Q}=lf6(X.toString());if(Y==null||Q==null)throw new B1({name:"InvalidDataContentError",message:`Invalid data URL format in content ${X.toString()}`});return{data:Q,mediaType:Y}}return{data:X,mediaType:void 0}}function df6(X){if(typeof X==="string")return X;if(X instanceof ArrayBuffer)return VF(new Uint8Array(X));return VF(X)}function zb(X){return X===void 0?[]:Array.isArray(X)?X:[X]}async function pf6({prompt:X,supportedUrls:Y,download:Q=mf6()}){let J=await nf6(X.messages,Q,Y),G=[...X.system!=null?typeof X.system==="string"?[{role:"system",content:X.system}]:zb(X.system).map((Z)=>({role:"system",content:Z.content,providerOptions:Z.providerOptions})):[],...X.messages.map((Z)=>cf6({message:Z,downloadedAssets:J}))],W=[];for(let Z of G){if(Z.role!=="tool"){W.push(Z);continue}let $=W.at(-1);if(($==null?void 0:$.role)==="tool")$.content.push(...Z.content);else W.push(Z)}return W}function cf6({message:X,downloadedAssets:Y}){let Q=X.role;switch(Q){case"system":return{role:"system",content:X.content,providerOptions:X.providerOptions};case"user":{if(typeof X.content==="string")return{role:"user",content:[{type:"text",text:X.content}],providerOptions:X.providerOptions};return{role:"user",content:X.content.map((J)=>if6(J,Y)).filter((J)=>J.type!=="text"||J.text!==""),providerOptions:X.providerOptions}}case"assistant":{if(typeof X.content==="string")return{role:"assistant",content:[{type:"text",text:X.content}],providerOptions:X.providerOptions};return{role:"assistant",content:X.content.filter((J)=>J.type!=="text"||J.text!==""||J.providerOptions!=null).filter((J)=>J.type!=="tool-approval-request").map((J)=>{let G=J.providerOptions;switch(J.type){case"file":{let{data:W,mediaType:Z}=rW1(J.data);return{type:"file",data:W,filename:J.filename,mediaType:Z!=null?Z:J.mediaType,providerOptions:G}}case"reasoning":return{type:"reasoning",text:J.text,providerOptions:G};case"text":return{type:"text",text:J.text,providerOptions:G};case"tool-call":return{type:"tool-call",toolCallId:J.toolCallId,toolName:J.toolName,input:J.input,providerExecuted:J.providerExecuted,providerOptions:G};case"tool-result":return{type:"tool-result",toolCallId:J.toolCallId,toolName:J.toolName,output:XW1(J.output),providerOptions:G}}}),providerOptions:X.providerOptions}}case"tool":return{role:"tool",content:X.content.filter((J)=>J.type!=="tool-approval-response"||J.providerExecuted).map((J)=>{switch(J.type){case"tool-result":return{type:"tool-result",toolCallId:J.toolCallId,toolName:J.toolName,output:XW1(J.output),providerOptions:J.providerOptions};case"tool-approval-response":return{type:"tool-approval-response",approvalId:J.approvalId,approved:J.approved,reason:J.reason}}}),providerOptions:X.providerOptions};default:throw new Tf6({role:Q})}}async function nf6(X,Y,Q){let J=X.filter((W)=>W.role==="user").map((W)=>W.content).filter((W)=>Array.isArray(W)).flat().filter((W)=>W.type==="image"||W.type==="file").map((W)=>{var Z;let $=(Z=W.mediaType)!=null?Z:W.type==="image"?"image/*":void 0,K=W.type==="image"?W.image:W.data;if(typeof K==="string")try{K=new URL(K)}catch(H){}return{mediaType:$,data:K}}).filter((W)=>W.data instanceof URL).map((W)=>({url:W.data,isUrlSupportedByModel:W.mediaType!=null&&jG1({url:W.data.toString(),mediaType:W.mediaType,supportedUrls:Q})})),G=await Y(J);return Object.fromEntries(G.map((W,Z)=>W==null?null:[J[Z].url.toString(),{data:W.data,mediaType:W.mediaType}]).filter((W)=>W!=null))}function if6(X,Y){var Q;if(X.type==="text")return{type:"text",text:X.text,providerOptions:X.providerOptions};let J,G=X.type;switch(G){case"image":J=X.image;break;case"file":J=X.data;break;default:throw Error(`Unsupported part type: ${G}`)}let{data:W,mediaType:Z}=rW1(J),$=Z!=null?Z:X.mediaType,K=W;if(K instanceof URL){let H=Y[K.toString()];if(H)K=H.data,$!=null||($=H.mediaType)}switch(G){case"image":{if(K instanceof Uint8Array||typeof K==="string")$=(Q=xf6({data:K,signatures:bf6}))!=null?Q:$;return{type:"file",mediaType:$!=null?$:"image/*",filename:void 0,data:K,providerOptions:X.providerOptions}}case"file":{if($==null)throw Error("Media type is missing for file part");return{type:"file",mediaType:$,filename:X.filename,data:K,providerOptions:X.providerOptions}}}}function XW1(X){if(X.type!=="content")return X;return{type:"content",value:X.value.map((Y)=>{if(Y.type!=="media")return Y;if(Y.mediaType.startsWith("image/"))return{type:"image-data",data:Y.data,mediaType:Y.mediaType};return{type:"file-data",data:Y.data,mediaType:Y.mediaType}})}}async function oU({toolCallId:X,input:Y,output:Q,tool:J,errorMode:G}){if(G==="text")return{type:"error-text",value:k5(Q)};else if(G==="json")return{type:"error-json",value:YW1(Q)};if(J==null?void 0:J.toModelOutput)return await J.toModelOutput({toolCallId:X,input:Y,output:Q});return typeof Q==="string"?{type:"text",value:Q}:{type:"json",value:YW1(Q)}}function YW1(X){return X===void 0?null:X}function af6({maxOutputTokens:X,temperature:Y,topP:Q,topK:J,presencePenalty:G,frequencyPenalty:W,seed:Z,stopSequences:$}){if(X!=null){if(!Number.isInteger(X))throw new H7({parameter:"maxOutputTokens",value:X,message:"maxOutputTokens must be an integer"});if(X<1)throw new H7({parameter:"maxOutputTokens",value:X,message:"maxOutputTokens must be >= 1"})}if(Y!=null){if(typeof Y!=="number")throw new H7({parameter:"temperature",value:Y,message:"temperature must be a number"})}if(Q!=null){if(typeof Q!=="number")throw new H7({parameter:"topP",value:Q,message:"topP must be a number"})}if(J!=null){if(typeof J!=="number")throw new H7({parameter:"topK",value:J,message:"topK must be a number"})}if(G!=null){if(typeof G!=="number")throw new H7({parameter:"presencePenalty",value:G,message:"presencePenalty must be a number"})}if(W!=null){if(typeof W!=="number")throw new H7({parameter:"frequencyPenalty",value:W,message:"frequencyPenalty must be a number"})}if(Z!=null){if(!Number.isInteger(Z))throw new H7({parameter:"seed",value:Z,message:"seed must be an integer"})}return{maxOutputTokens:X,temperature:Y,topP:Q,topK:J,presencePenalty:G,frequencyPenalty:W,stopSequences:$,seed:Z}}function rf6(X){return X!=null&&Object.keys(X).length>0}async function of6({tools:X,toolChoice:Y,activeTools:Q}){if(!rf6(X))return{tools:void 0,toolChoice:void 0};let J=Q!=null?Object.entries(X).filter(([W])=>Q.includes(W)):Object.entries(X),G=[];for(let[W,Z]of J){let $=Z.type;switch($){case void 0:case"dynamic":case"function":G.push({type:"function",name:W,description:Z.description,inputSchema:await $7(Z.inputSchema).jsonSchema,...Z.inputExamples!=null?{inputExamples:Z.inputExamples}:{},providerOptions:Z.providerOptions,...Z.strict!=null?{strict:Z.strict}:{}});break;case"provider":G.push({type:"provider",name:W,id:Z.id,args:Z.args});break;default:throw Error(`Unsupported tool type: ${$}`)}}return{tools:G,toolChoice:Y==null?{type:"auto"}:typeof Y==="string"?{type:Y}:{type:"tool",toolName:Y.toolName}}}var gP=B.lazy(()=>B.union([B.null(),B.string(),B.number(),B.boolean(),B.record(B.string(),gP.optional()),B.array(gP)])),l1=B.record(B.string(),B.record(B.string(),gP.optional())),oW1=B.object({type:B.literal("text"),text:B.string(),providerOptions:l1.optional()}),sf6=B.object({type:B.literal("image"),image:B.union([aW1,B.instanceof(URL)]),mediaType:B.string().optional(),providerOptions:l1.optional()}),sW1=B.object({type:B.literal("file"),data:B.union([aW1,B.instanceof(URL)]),filename:B.string().optional(),mediaType:B.string(),providerOptions:l1.optional()}),tf6=B.object({type:B.literal("reasoning"),text:B.string(),providerOptions:l1.optional()}),ef6=B.object({type:B.literal("tool-call"),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerOptions:l1.optional(),providerExecuted:B.boolean().optional()}),Xh6=B.discriminatedUnion("type",[B.object({type:B.literal("text"),value:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("json"),value:gP,providerOptions:l1.optional()}),B.object({type:B.literal("execution-denied"),reason:B.string().optional(),providerOptions:l1.optional()}),B.object({type:B.literal("error-text"),value:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("error-json"),value:gP,providerOptions:l1.optional()}),B.object({type:B.literal("content"),value:B.array(B.union([B.object({type:B.literal("text"),text:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("media"),data:B.string(),mediaType:B.string()}),B.object({type:B.literal("file-data"),data:B.string(),mediaType:B.string(),filename:B.string().optional(),providerOptions:l1.optional()}),B.object({type:B.literal("file-url"),url:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("file-id"),fileId:B.union([B.string(),B.record(B.string(),B.string())]),providerOptions:l1.optional()}),B.object({type:B.literal("image-data"),data:B.string(),mediaType:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("image-url"),url:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("image-file-id"),fileId:B.union([B.string(),B.record(B.string(),B.string())]),providerOptions:l1.optional()}),B.object({type:B.literal("custom"),providerOptions:l1.optional()})]))})]),tW1=B.object({type:B.literal("tool-result"),toolCallId:B.string(),toolName:B.string(),output:Xh6,providerOptions:l1.optional()}),Yh6=B.object({type:B.literal("tool-approval-request"),approvalId:B.string(),toolCallId:B.string()}),Qh6=B.object({type:B.literal("tool-approval-response"),approvalId:B.string(),approved:B.boolean(),reason:B.string().optional()}),Jh6=B.object({role:B.literal("system"),content:B.string(),providerOptions:l1.optional()}),Gh6=B.object({role:B.literal("user"),content:B.union([B.string(),B.array(B.union([oW1,sf6,sW1]))]),providerOptions:l1.optional()}),Wh6=B.object({role:B.literal("assistant"),content:B.union([B.string(),B.array(B.union([oW1,sW1,tf6,ef6,tW1,Yh6]))]),providerOptions:l1.optional()}),Zh6=B.object({role:B.literal("tool"),content:B.array(B.union([tW1,Qh6])),providerOptions:l1.optional()}),$h6=B.union([Jh6,Gh6,Wh6,Zh6]);async function Kh6(X){if(X.prompt==null&&X.messages==null)throw new $F({prompt:X,message:"prompt or messages must be defined"});if(X.prompt!=null&&X.messages!=null)throw new $F({prompt:X,message:"prompt and messages cannot be defined at the same time"});if(X.system!=null&&typeof X.system!=="string"&&!zb(X.system).every((J)=>typeof J==="object"&&J!==null&&("role"in J)&&J.role==="system"))throw new $F({prompt:X,message:"system must be a string, SystemModelMessage, or array of SystemModelMessage"});let Y;if(X.prompt!=null&&typeof X.prompt==="string")Y=[{role:"user",content:X.prompt}];else if(X.prompt!=null&&Array.isArray(X.prompt))Y=X.prompt;else if(X.messages!=null)Y=X.messages;else throw new $F({prompt:X,message:"prompt or messages must be defined"});if(Y.length===0)throw new $F({prompt:X,message:"messages must not be empty"});let Q=await wY({value:Y,schema:B.array($h6)});if(!Q.success)throw new $F({prompt:X,message:"The messages do not match the ModelMessage[] schema.",cause:Q.error});return{messages:Y,system:X.system}}function Hh6(X){if(!Vb.isInstance(X))return X;let Y=(process==null?void 0:"production")==="production",Q="https://ai-sdk.dev/unauthenticated-ai-gateway";if(Y)return new B1({name:"GatewayError",message:`Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${Q}`});return Object.assign(Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m
|
|
1072
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`;return new X({message:Z,statusCode:G,cause:W})}},d71="GatewayInvalidRequestError",Ob6=`vercel.ai.gateway.error.${d71}`,T71=Symbol.for(Ob6),A71,E71,Lb6=class extends(E71=hQ,A71=T71,E71){constructor({message:X="Invalid request",statusCode:Y=400,cause:Q}={}){super({message:X,statusCode:Y,cause:Q});this[A71]=!0,this.name=d71,this.type="invalid_request_error"}static isInstance(X){return hQ.hasMarker(X)&&T71 in X}},p71="GatewayRateLimitError",wb6=`vercel.ai.gateway.error.${p71}`,j71=Symbol.for(wb6),C71,I71,Mb6=class extends(I71=hQ,C71=j71,I71){constructor({message:X="Rate limit exceeded",statusCode:Y=429,cause:Q}={}){super({message:X,statusCode:Y,cause:Q});this[C71]=!0,this.name=p71,this.type="rate_limit_exceeded"}static isInstance(X){return hQ.hasMarker(X)&&j71 in X}},c71="GatewayModelNotFoundError",Pb6=`vercel.ai.gateway.error.${c71}`,R71=Symbol.for(Pb6),Tb6=d9(()=>Y9(B.object({modelId:B.string()}))),S71,v71,Ab6=class extends(v71=hQ,S71=R71,v71){constructor({message:X="Model not found",statusCode:Y=404,modelId:Q,cause:J}={}){super({message:X,statusCode:Y,cause:J});this[S71]=!0,this.name=c71,this.type="model_not_found",this.modelId=Q}static isInstance(X){return hQ.hasMarker(X)&&R71 in X}},n71="GatewayInternalServerError",Eb6=`vercel.ai.gateway.error.${n71}`,k71=Symbol.for(Eb6),_71,y71,b71=class extends(y71=hQ,_71=k71,y71){constructor({message:X="Internal server error",statusCode:Y=500,cause:Q}={}){super({message:X,statusCode:Y,cause:Q});this[_71]=!0,this.name=n71,this.type="internal_server_error"}static isInstance(X){return hQ.hasMarker(X)&&k71 in X}},i71="GatewayResponseError",jb6=`vercel.ai.gateway.error.${i71}`,f71=Symbol.for(jb6),h71,x71,Cb6=class extends(x71=hQ,h71=f71,x71){constructor({message:X="Invalid response from Gateway",statusCode:Y=502,response:Q,validationError:J,cause:G}={}){super({message:X,statusCode:Y,cause:G});this[h71]=!0,this.name=i71,this.type="response_error",this.response=Q,this.validationError=J}static isInstance(X){return hQ.hasMarker(X)&&f71 in X}};async function g71({response:X,statusCode:Y,defaultMessage:Q="Gateway request failed",cause:J,authMethod:G}){let W=await wY({value:X,schema:Ib6});if(!W.success)return new Cb6({message:`Invalid error response format: ${Q}`,statusCode:Y,response:X,validationError:W.error,cause:J});let Z=W.value,$=Z.error.type,K=Z.error.message;switch($){case"authentication_error":return Vb.createContextualError({apiKeyProvided:G==="api-key",oidcTokenProvided:G==="oidc",statusCode:Y,cause:J});case"invalid_request_error":return new Lb6({message:K,statusCode:Y,cause:J});case"rate_limit_exceeded":return new Mb6({message:K,statusCode:Y,cause:J});case"model_not_found":{let H=await wY({value:Z.error.param,schema:Tb6});return new Ab6({message:K,statusCode:Y,modelId:H.success?H.value.modelId:void 0,cause:J})}case"internal_server_error":return new b71({message:K,statusCode:Y,cause:J});default:return new b71({message:K,statusCode:Y,cause:J})}}var Ib6=d9(()=>Y9(B.object({error:B.object({message:B.string(),type:B.string().nullish(),param:B.unknown().nullish(),code:B.union([B.string(),B.number()]).nullish()})})));function JK(X,Y){var Q;if(hQ.isInstance(X))return X;if(i8.isInstance(X))return g71({response:Rb6(X),statusCode:(Q=X.statusCode)!=null?Q:500,defaultMessage:"Gateway request failed",cause:X,authMethod:Y});return g71({response:{},statusCode:500,defaultMessage:X instanceof Error?`Gateway request failed: ${X.message}`:"Unknown Gateway error",cause:X,authMethod:Y})}function Rb6(X){if(X.data!==void 0)return X.data;if(X.responseBody!=null)try{return JSON.parse(X.responseBody)}catch(Y){return X.responseBody}return{}}var a71="ai-gateway-auth-method";async function iU(X){let Y=await wY({value:X[a71],schema:Sb6});return Y.success?Y.value:void 0}var Sb6=d9(()=>Y9(B.union([B.literal("api-key"),B.literal("oidc")]))),u71=class{constructor(X){this.config=X}async getAvailableModels(){try{let{value:X}=await s80({url:`${this.config.baseURL}/config`,headers:await NX(this.config.headers()),successfulResponseHandler:lW(vb6),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(Y)=>Y}),fetch:this.config.fetch});return X}catch(X){throw await JK(X)}}async getCredits(){try{let X=new URL(this.config.baseURL),{value:Y}=await s80({url:`${X.origin}/v1/credits`,headers:await NX(this.config.headers()),successfulResponseHandler:lW(kb6),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(Q)=>Q}),fetch:this.config.fetch});return Y}catch(X){throw await JK(X)}}},vb6=d9(()=>Y9(B.object({models:B.array(B.object({id:B.string(),name:B.string(),description:B.string().nullish(),pricing:B.object({input:B.string(),output:B.string(),input_cache_read:B.string().nullish(),input_cache_write:B.string().nullish()}).transform(({input:X,output:Y,input_cache_read:Q,input_cache_write:J})=>({input:X,output:Y,...Q?{cachedInputTokens:Q}:{},...J?{cacheCreationInputTokens:J}:{}})).nullish(),specification:B.object({specificationVersion:B.literal("v3"),provider:B.string(),modelId:B.string()}),modelType:B.enum(["language","embedding","image"]).nullish()}))}))),kb6=d9(()=>Y9(B.object({balance:B.string(),total_used:B.string()}).transform(({balance:X,total_used:Y})=>({balance:X,totalUsed:Y})))),_b6=class{constructor(X,Y){this.modelId=X,this.config=Y,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(X){let{abortSignal:Y,...Q}=X;return{args:this.maybeEncodeFileParts(Q),warnings:[]}}async doGenerate(X){let{args:Y,warnings:Q}=await this.getArgs(X),{abortSignal:J}=X,G=await NX(this.config.headers());try{let{responseHeaders:W,value:Z,rawValue:$}=await qF({url:this.getUrl(),headers:HF(G,X.headers,this.getModelConfigHeaders(this.modelId,!1),await NX(this.config.o11yHeaders)),body:Y,successfulResponseHandler:lW(B.any()),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(K)=>K}),...J&&{abortSignal:J},fetch:this.config.fetch});return{...Z,request:{body:Y},response:{headers:W,body:$},warnings:Q}}catch(W){throw await JK(W,await iU(G))}}async doStream(X){let{args:Y,warnings:Q}=await this.getArgs(X),{abortSignal:J}=X,G=await NX(this.config.headers());try{let{value:W,responseHeaders:Z}=await qF({url:this.getUrl(),headers:HF(G,X.headers,this.getModelConfigHeaders(this.modelId,!0),await NX(this.config.o11yHeaders)),body:Y,successfulResponseHandler:yG1(B.any()),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:($)=>$}),...J&&{abortSignal:J},fetch:this.config.fetch});return{stream:W.pipeThrough(new TransformStream({start($){if(Q.length>0)$.enqueue({type:"stream-start",warnings:Q})},transform($,K){if($.success){let H=$.value;if(H.type==="raw"&&!X.includeRawChunks)return;if(H.type==="response-metadata"&&H.timestamp&&typeof H.timestamp==="string")H.timestamp=new Date(H.timestamp);K.enqueue(H)}else K.error($.error)}})),request:{body:Y},response:{headers:Z}}}catch(W){throw await JK(W,await iU(G))}}isFilePart(X){return X&&typeof X==="object"&&"type"in X&&X.type==="file"}maybeEncodeFileParts(X){for(let Y of X.prompt)for(let Q of Y.content)if(this.isFilePart(Q)){let J=Q;if(J.data instanceof Uint8Array){let G=Uint8Array.from(J.data),W=Buffer.from(G).toString("base64");J.data=new URL(`data:${J.mediaType||"application/octet-stream"};base64,${W}`)}}return X}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(X,Y){return{"ai-language-model-specification-version":"3","ai-language-model-id":X,"ai-language-model-streaming":String(Y)}}},yb6=class{constructor(X,Y){this.modelId=X,this.config=Y,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:X,headers:Y,abortSignal:Q,providerOptions:J}){var G;let W=await NX(this.config.headers());try{let{responseHeaders:Z,value:$,rawValue:K}=await qF({url:this.getUrl(),headers:HF(W,Y!=null?Y:{},this.getModelConfigHeaders(),await NX(this.config.o11yHeaders)),body:{values:X,...J?{providerOptions:J}:{}},successfulResponseHandler:lW(bb6),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(H)=>H}),...Q&&{abortSignal:Q},fetch:this.config.fetch});return{embeddings:$.embeddings,usage:(G=$.usage)!=null?G:void 0,providerMetadata:$.providerMetadata,response:{headers:Z,body:K},warnings:[]}}catch(Z){throw await JK(Z,await iU(W))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},bb6=d9(()=>Y9(B.object({embeddings:B.array(B.array(B.number())),usage:B.object({tokens:B.number()}).nullish(),providerMetadata:B.record(B.string(),B.record(B.string(),B.unknown())).optional()}))),fb6=class{constructor(X,Y){this.modelId=X,this.config=Y,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:X,n:Y,size:Q,aspectRatio:J,seed:G,files:W,mask:Z,providerOptions:$,headers:K,abortSignal:H}){var F;let V=await NX(this.config.headers());try{let{responseHeaders:q,value:z,rawValue:D}=await qF({url:this.getUrl(),headers:HF(V,K!=null?K:{},this.getModelConfigHeaders(),await NX(this.config.o11yHeaders)),body:{prompt:X,n:Y,...Q&&{size:Q},...J&&{aspectRatio:J},...G&&{seed:G},...$&&{providerOptions:$},...W&&{files:W.map((N)=>m71(N))},...Z&&{mask:m71(Z)}},successfulResponseHandler:lW(xb6),failedResponseHandler:K7({errorSchema:B.any(),errorToMessage:(N)=>N}),...H&&{abortSignal:H},fetch:this.config.fetch});return{images:z.images,warnings:(F=z.warnings)!=null?F:[],providerMetadata:z.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:q}}}catch(q){throw JK(q,await iU(V))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function m71(X){if(X.type==="file"&&X.data instanceof Uint8Array)return{...X,data:VF(X.data)};return X}var hb6=B.object({images:B.array(B.unknown()).optional()}).catchall(B.unknown()),xb6=B.object({images:B.array(B.string()),warnings:B.array(B.object({type:B.literal("other"),message:B.string()})).optional(),providerMetadata:B.record(B.string(),hb6).optional()}),gb6=d9(()=>Y9(B.object({query:B.union([B.string(),B.array(B.string())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:B.number().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:B.number().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:B.number().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:B.string().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:B.array(B.string()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:B.array(B.string()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:B.string().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:B.string().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:B.string().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:B.string().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:B.enum(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")}))),ub6=d9(()=>Y9(B.union([B.object({results:B.array(B.object({title:B.string(),url:B.string(),snippet:B.string(),date:B.string().optional(),lastUpdated:B.string().optional()})),id:B.string()}),B.object({error:B.enum(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:B.number().optional(),message:B.string()})]))),mb6=_G1({id:"gateway.perplexity_search",inputSchema:gb6,outputSchema:ub6}),lb6=(X={})=>mb6(X),db6={perplexitySearch:lb6};async function pb6(){var X;return(X=r71.getContext().headers)==null?void 0:X["x-vercel-id"]}var cb6="3.0.16",nb6="0.0.1";function ib6(X={}){var Y,Q;let J=null,G=null,W=(Y=X.metadataCacheRefreshMillis)!=null?Y:300000,Z=0,$=(Q=bG1(X.baseURL))!=null?Q:"https://ai-gateway.vercel.sh/v3/ai",K=async()=>{try{let N=await ab6(X);return YK({Authorization:`Bearer ${N.token}`,"ai-gateway-protocol-version":nb6,[a71]:N.authMethod,...X.headers},`ai-sdk/gateway/${cb6}`)}catch(N){throw Vb.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:N})}},H=()=>{let N=vP({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),L=vP({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),w=vP({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{let C=await pb6();return{...N&&{"ai-o11y-deployment-id":N},...L&&{"ai-o11y-environment":L},...w&&{"ai-o11y-region":w},...C&&{"ai-o11y-request-id":C}}}},F=(N)=>{return new _b6(N,{provider:"gateway",baseURL:$,headers:K,fetch:X.fetch,o11yHeaders:H()})},V=async()=>{var N,L,w;let C=(w=(L=(N=X._internal)==null?void 0:N.currentDate)==null?void 0:L.call(N).getTime())!=null?w:Date.now();if(!J||C-Z>W)Z=C,J=new u71({baseURL:$,headers:K,fetch:X.fetch}).getAvailableModels().then((T)=>{return G=T,T}).catch(async(T)=>{throw await JK(T,await iU(await K()))});return G?Promise.resolve(G):J},q=async()=>{return new u71({baseURL:$,headers:K,fetch:X.fetch}).getCredits().catch(async(N)=>{throw await JK(N,await iU(await K()))})},z=function(N){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return F(N)};z.specificationVersion="v3",z.getAvailableModels=V,z.getCredits=q,z.imageModel=(N)=>{return new fb6(N,{provider:"gateway",baseURL:$,headers:K,fetch:X.fetch,o11yHeaders:H()})},z.languageModel=F;let D=(N)=>{return new yb6(N,{provider:"gateway",baseURL:$,headers:K,fetch:X.fetch,o11yHeaders:H()})};return z.embeddingModel=D,z.textEmbeddingModel=D,z.tools=db6,z}var s71=ib6();async function ab6(X){let Y=vP({settingValue:X.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(Y)return{token:Y,authMethod:"api-key"};return{token:await o71.getVercelOidcToken(),authMethod:"oidc"}}a6();a6();a6();a6();a6();a6();var eW1=t6(Z1(),1),sU=t6(Z1(),1);a6();a6();var rb6=Object.defineProperty,ob6=(X,Y)=>{for(var Q in Y)rb6(X,Q,{get:Y[Q],enumerable:!0})},ZW1="AI_InvalidArgumentError",$W1=`vercel.ai.error.${ZW1}`,sb6=Symbol.for($W1),KW1,H7=class extends B1{constructor({parameter:X,value:Y,message:Q}){super({name:ZW1,message:`Invalid argument for parameter ${X}: ${Q}`});this[KW1]=!0,this.parameter=X,this.value=Y}static isInstance(X){return B1.hasMarker(X,$W1)}};KW1=sb6;var tb6="AI_InvalidStreamPartError",eb6=`vercel.ai.error.${tb6}`,Xf6=Symbol.for(eb6),Yf6;Yf6=Xf6;var HW1="AI_InvalidToolApprovalError",FW1=`vercel.ai.error.${HW1}`,Qf6=Symbol.for(FW1),VW1,Jf6=class extends B1{constructor({approvalId:X}){super({name:HW1,message:`Tool approval response references unknown approvalId: "${X}". No matching tool-approval-request found in message history.`});this[VW1]=!0,this.approvalId=X}static isInstance(X){return B1.hasMarker(X,FW1)}};VW1=Qf6;var qW1="AI_InvalidToolInputError",zW1=`vercel.ai.error.${qW1}`,Gf6=Symbol.for(zW1),UW1,j90=class extends B1{constructor({toolInput:X,toolName:Y,cause:Q,message:J=`Invalid input for tool ${Y}: ${k5(Q)}`}){super({name:qW1,message:J,cause:Q});this[UW1]=!0,this.toolInput=X,this.toolName=Y}static isInstance(X){return B1.hasMarker(X,zW1)}};UW1=Gf6;var BW1="AI_ToolCallNotFoundForApprovalError",DW1=`vercel.ai.error.${BW1}`,Wf6=Symbol.for(DW1),NW1,OW1=class extends B1{constructor({toolCallId:X,approvalId:Y}){super({name:BW1,message:`Tool call "${X}" not found for approval request "${Y}".`});this[NW1]=!0,this.toolCallId=X,this.approvalId=Y}static isInstance(X){return B1.hasMarker(X,DW1)}};NW1=Wf6;var Zf6="AI_NoImageGeneratedError",$f6=`vercel.ai.error.${Zf6}`,Kf6=Symbol.for($f6),Hf6;Hf6=Kf6;var LW1="AI_NoObjectGeneratedError",wW1=`vercel.ai.error.${LW1}`,Ff6=Symbol.for(wW1),MW1,GK=class extends B1{constructor({message:X="No object generated.",cause:Y,text:Q,response:J,usage:G,finishReason:W}){super({name:LW1,message:X,cause:Y});this[MW1]=!0,this.text=Q,this.response=J,this.usage=G,this.finishReason=W}static isInstance(X){return B1.hasMarker(X,wW1)}};MW1=Ff6;var PW1="AI_NoOutputGeneratedError",TW1=`vercel.ai.error.${PW1}`,Vf6=Symbol.for(TW1),AW1,qf6=class extends B1{constructor({message:X="No output generated.",cause:Y}={}){super({name:PW1,message:X,cause:Y});this[AW1]=!0}static isInstance(X){return B1.hasMarker(X,TW1)}};AW1=Vf6;var EW1="AI_NoSuchToolError",jW1=`vercel.ai.error.${EW1}`,zf6=Symbol.for(jW1),CW1,w90=class extends B1{constructor({toolName:X,availableTools:Y=void 0,message:Q=`Model tried to call unavailable tool '${X}'. ${Y===void 0?"No tools are available.":`Available tools: ${Y.join(", ")}.`}`}){super({name:EW1,message:Q});this[CW1]=!0,this.toolName=X,this.availableTools=Y}static isInstance(X){return B1.hasMarker(X,jW1)}};CW1=zf6;var IW1="AI_ToolCallRepairError",RW1=`vercel.ai.error.${IW1}`,Uf6=Symbol.for(RW1),SW1,Bf6=class extends B1{constructor({cause:X,originalError:Y,message:Q=`Error repairing tool call: ${k5(X)}`}){super({name:IW1,message:Q,cause:X});this[SW1]=!0,this.originalError=Y}static isInstance(X){return B1.hasMarker(X,RW1)}};SW1=Uf6;var Df6=class extends B1{constructor(X){super({name:"AI_UnsupportedModelVersionError",message:`Unsupported model version ${X.version} for provider "${X.provider}" and model "${X.modelId}". AI SDK 5 only supports models that implement specification version "v2".`});this.version=X.version,this.provider=X.provider,this.modelId=X.modelId}},vW1="AI_UIMessageStreamError",kW1=`vercel.ai.error.${vW1}`,Nf6=Symbol.for(kW1),_W1,aU=class extends B1{constructor({chunkType:X,chunkId:Y,message:Q}){super({name:vW1,message:Q});this[_W1]=!0,this.chunkType=X,this.chunkId=Y}static isInstance(X){return B1.hasMarker(X,kW1)}};_W1=Nf6;var Of6="AI_InvalidDataContentError",Lf6=`vercel.ai.error.${Of6}`,wf6=Symbol.for(Lf6),Mf6;Mf6=wf6;var yW1="AI_InvalidMessageRoleError",bW1=`vercel.ai.error.${yW1}`,Pf6=Symbol.for(bW1),fW1,Tf6=class extends B1{constructor({role:X,message:Y=`Invalid message role: '${X}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:yW1,message:Y});this[fW1]=!0,this.role=X}static isInstance(X){return B1.hasMarker(X,bW1)}};fW1=Pf6;var hW1="AI_MessageConversionError",xW1=`vercel.ai.error.${hW1}`,Af6=Symbol.for(xW1),gW1,Ef6=class extends B1{constructor({originalMessage:X,message:Y}){super({name:hW1,message:Y});this[gW1]=!0,this.originalMessage=X}static isInstance(X){return B1.hasMarker(X,xW1)}};gW1=Af6;var uW1="AI_RetryError",mW1=`vercel.ai.error.${uW1}`,jf6=Symbol.for(mW1),lW1,t71=class extends B1{constructor({message:X,reason:Y,errors:Q}){super({name:uW1,message:X});this[lW1]=!0,this.reason=Y,this.errors=Q,this.lastError=Q[Q.length-1]}static isInstance(X){return B1.hasMarker(X,mW1)}};lW1=jf6;function Cf6({warning:X,provider:Y,model:Q}){let J=`AI SDK Warning (${Y} / ${Q}):`;switch(X.type){case"unsupported":{let G=`${J} The feature "${X.feature}" is not supported.`;if(X.details)G+=` ${X.details}`;return G}case"compatibility":{let G=`${J} The feature "${X.feature}" is used in a compatibility mode.`;if(X.details)G+=` ${X.details}`;return G}case"other":return`${J} ${X.message}`;default:return`${J} ${JSON.stringify(X,null,2)}`}}var If6="AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.",e71=!1,dW1=(X)=>{if(X.warnings.length===0)return;let Y=globalThis.AI_SDK_LOG_WARNINGS;if(Y===!1)return;if(typeof Y==="function"){Y(X);return}if(!e71)e71=!0,console.info(If6);for(let Q of X.warnings)console.warn(Cf6({warning:Q,provider:X.provider,model:X.model}))};function Rf6({provider:X,modelId:Y}){dW1({warnings:[{type:"compatibility",feature:"specificationVersion",details:"Using v2 specification compatibility mode. Some features may not be available."}],provider:X,model:Y})}function Sf6(X){if(X.specificationVersion==="v3")return X;return Rf6({provider:X.provider,modelId:X.modelId}),new Proxy(X,{get(Y,Q){switch(Q){case"specificationVersion":return"v3";case"doGenerate":return async(...J)=>{let G=await Y.doGenerate(...J);return{...G,finishReason:pW1(G.finishReason),usage:cW1(G.usage)}};case"doStream":return async(...J)=>{let G=await Y.doStream(...J);return{...G,stream:vf6(G.stream)}};default:return Y[Q]}}})}function vf6(X){return X.pipeThrough(new TransformStream({transform(Y,Q){switch(Y.type){case"finish":Q.enqueue({...Y,finishReason:pW1(Y.finishReason),usage:cW1(Y.usage)});break;default:Q.enqueue(Y);break}}}))}function pW1(X){return{unified:X==="unknown"?"other":X,raw:void 0}}function cW1(X){return{inputTokens:{total:X.inputTokens,noCache:void 0,cacheRead:X.cachedInputTokens,cacheWrite:void 0},outputTokens:{total:X.outputTokens,text:void 0,reasoning:X.reasoningTokens}}}function nW1(X){if(typeof X!=="string"){if(X.specificationVersion!=="v3"&&X.specificationVersion!=="v2"){let Y=X;throw new Df6({version:Y.specificationVersion,provider:Y.provider,modelId:Y.modelId})}return Sf6(X)}return kf6().languageModel(X)}function kf6(){var X;return(X=globalThis.AI_SDK_DEFAULT_PROVIDER)!=null?X:s71}function iW1(X){if(X==null)return;if(typeof X==="number")return X;return X.totalMs}function _f6(X){if(X==null||typeof X==="number")return;return X.stepMs}function yf6(X){if(X==null||typeof X==="number")return;return X.chunkMs}var bf6=[{mediaType:"image/gif",bytesPrefix:[71,73,70]},{mediaType:"image/png",bytesPrefix:[137,80,78,71]},{mediaType:"image/jpeg",bytesPrefix:[255,216]},{mediaType:"image/webp",bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:"image/bmp",bytesPrefix:[66,77]},{mediaType:"image/tiff",bytesPrefix:[73,73,42,0]},{mediaType:"image/tiff",bytesPrefix:[77,77,0,42]},{mediaType:"image/avif",bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:"image/heic",bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}];var ff6=(X)=>{let Y=typeof X==="string"?pU(X):X,Q=(Y[6]&127)<<21|(Y[7]&127)<<14|(Y[8]&127)<<7|Y[9]&127;return Y.slice(Q+10)};function hf6(X){return typeof X==="string"&&X.startsWith("SUQz")||typeof X!=="string"&&X.length>10&&X[0]===73&&X[1]===68&&X[2]===51?ff6(X):X}function xf6({data:X,signatures:Y}){let Q=hf6(X),J=typeof Q==="string"?pU(Q.substring(0,Math.min(Q.length,24))):Q;for(let G of Y)if(J.length>=G.bytesPrefix.length&&G.bytesPrefix.every((W,Z)=>W===null||J[Z]===W))return G.mediaType;return}var gf6="6.0.41",uf6=async({url:X})=>{var Y;let Q=X.toString();try{let J=await fetch(Q,{headers:YK({},`ai-sdk/${gf6}`,Gb())});if(!J.ok)throw new Jb({url:Q,statusCode:J.status,statusText:J.statusText});return{data:new Uint8Array(await J.arrayBuffer()),mediaType:(Y=J.headers.get("content-type"))!=null?Y:void 0}}catch(J){if(Jb.isInstance(J))throw J;throw new Jb({url:Q,cause:J})}},mf6=(X=uf6)=>(Y)=>Promise.all(Y.map(async(Q)=>Q.isUrlSupportedByModel?null:X(Q)));function lf6(X){try{let[Y,Q]=X.split(",");return{mediaType:Y.split(";")[0].split(":")[1],base64Content:Q}}catch(Y){return{mediaType:void 0,base64Content:void 0}}}var aW1=B.union([B.string(),B.instanceof(Uint8Array),B.instanceof(ArrayBuffer),B.custom((X)=>{var Y,Q;return(Q=(Y=globalThis.Buffer)==null?void 0:Y.isBuffer(X))!=null?Q:!1},{message:"Must be a Buffer"})]);function rW1(X){if(X instanceof Uint8Array)return{data:X,mediaType:void 0};if(X instanceof ArrayBuffer)return{data:new Uint8Array(X),mediaType:void 0};if(typeof X==="string")try{X=new URL(X)}catch(Y){}if(X instanceof URL&&X.protocol==="data:"){let{mediaType:Y,base64Content:Q}=lf6(X.toString());if(Y==null||Q==null)throw new B1({name:"InvalidDataContentError",message:`Invalid data URL format in content ${X.toString()}`});return{data:Q,mediaType:Y}}return{data:X,mediaType:void 0}}function df6(X){if(typeof X==="string")return X;if(X instanceof ArrayBuffer)return VF(new Uint8Array(X));return VF(X)}function zb(X){return X===void 0?[]:Array.isArray(X)?X:[X]}async function pf6({prompt:X,supportedUrls:Y,download:Q=mf6()}){let J=await nf6(X.messages,Q,Y),G=[...X.system!=null?typeof X.system==="string"?[{role:"system",content:X.system}]:zb(X.system).map((Z)=>({role:"system",content:Z.content,providerOptions:Z.providerOptions})):[],...X.messages.map((Z)=>cf6({message:Z,downloadedAssets:J}))],W=[];for(let Z of G){if(Z.role!=="tool"){W.push(Z);continue}let $=W.at(-1);if(($==null?void 0:$.role)==="tool")$.content.push(...Z.content);else W.push(Z)}return W}function cf6({message:X,downloadedAssets:Y}){let Q=X.role;switch(Q){case"system":return{role:"system",content:X.content,providerOptions:X.providerOptions};case"user":{if(typeof X.content==="string")return{role:"user",content:[{type:"text",text:X.content}],providerOptions:X.providerOptions};return{role:"user",content:X.content.map((J)=>if6(J,Y)).filter((J)=>J.type!=="text"||J.text!==""),providerOptions:X.providerOptions}}case"assistant":{if(typeof X.content==="string")return{role:"assistant",content:[{type:"text",text:X.content}],providerOptions:X.providerOptions};return{role:"assistant",content:X.content.filter((J)=>J.type!=="text"||J.text!==""||J.providerOptions!=null).filter((J)=>J.type!=="tool-approval-request").map((J)=>{let G=J.providerOptions;switch(J.type){case"file":{let{data:W,mediaType:Z}=rW1(J.data);return{type:"file",data:W,filename:J.filename,mediaType:Z!=null?Z:J.mediaType,providerOptions:G}}case"reasoning":return{type:"reasoning",text:J.text,providerOptions:G};case"text":return{type:"text",text:J.text,providerOptions:G};case"tool-call":return{type:"tool-call",toolCallId:J.toolCallId,toolName:J.toolName,input:J.input,providerExecuted:J.providerExecuted,providerOptions:G};case"tool-result":return{type:"tool-result",toolCallId:J.toolCallId,toolName:J.toolName,output:XW1(J.output),providerOptions:G}}}),providerOptions:X.providerOptions}}case"tool":return{role:"tool",content:X.content.filter((J)=>J.type!=="tool-approval-response"||J.providerExecuted).map((J)=>{switch(J.type){case"tool-result":return{type:"tool-result",toolCallId:J.toolCallId,toolName:J.toolName,output:XW1(J.output),providerOptions:J.providerOptions};case"tool-approval-response":return{type:"tool-approval-response",approvalId:J.approvalId,approved:J.approved,reason:J.reason}}}),providerOptions:X.providerOptions};default:throw new Tf6({role:Q})}}async function nf6(X,Y,Q){let J=X.filter((W)=>W.role==="user").map((W)=>W.content).filter((W)=>Array.isArray(W)).flat().filter((W)=>W.type==="image"||W.type==="file").map((W)=>{var Z;let $=(Z=W.mediaType)!=null?Z:W.type==="image"?"image/*":void 0,K=W.type==="image"?W.image:W.data;if(typeof K==="string")try{K=new URL(K)}catch(H){}return{mediaType:$,data:K}}).filter((W)=>W.data instanceof URL).map((W)=>({url:W.data,isUrlSupportedByModel:W.mediaType!=null&&jG1({url:W.data.toString(),mediaType:W.mediaType,supportedUrls:Q})})),G=await Y(J);return Object.fromEntries(G.map((W,Z)=>W==null?null:[J[Z].url.toString(),{data:W.data,mediaType:W.mediaType}]).filter((W)=>W!=null))}function if6(X,Y){var Q;if(X.type==="text")return{type:"text",text:X.text,providerOptions:X.providerOptions};let J,G=X.type;switch(G){case"image":J=X.image;break;case"file":J=X.data;break;default:throw Error(`Unsupported part type: ${G}`)}let{data:W,mediaType:Z}=rW1(J),$=Z!=null?Z:X.mediaType,K=W;if(K instanceof URL){let H=Y[K.toString()];if(H)K=H.data,$!=null||($=H.mediaType)}switch(G){case"image":{if(K instanceof Uint8Array||typeof K==="string")$=(Q=xf6({data:K,signatures:bf6}))!=null?Q:$;return{type:"file",mediaType:$!=null?$:"image/*",filename:void 0,data:K,providerOptions:X.providerOptions}}case"file":{if($==null)throw Error("Media type is missing for file part");return{type:"file",mediaType:$,filename:X.filename,data:K,providerOptions:X.providerOptions}}}}function XW1(X){if(X.type!=="content")return X;return{type:"content",value:X.value.map((Y)=>{if(Y.type!=="media")return Y;if(Y.mediaType.startsWith("image/"))return{type:"image-data",data:Y.data,mediaType:Y.mediaType};return{type:"file-data",data:Y.data,mediaType:Y.mediaType}})}}async function oU({toolCallId:X,input:Y,output:Q,tool:J,errorMode:G}){if(G==="text")return{type:"error-text",value:k5(Q)};else if(G==="json")return{type:"error-json",value:YW1(Q)};if(J==null?void 0:J.toModelOutput)return await J.toModelOutput({toolCallId:X,input:Y,output:Q});return typeof Q==="string"?{type:"text",value:Q}:{type:"json",value:YW1(Q)}}function YW1(X){return X===void 0?null:X}function af6({maxOutputTokens:X,temperature:Y,topP:Q,topK:J,presencePenalty:G,frequencyPenalty:W,seed:Z,stopSequences:$}){if(X!=null){if(!Number.isInteger(X))throw new H7({parameter:"maxOutputTokens",value:X,message:"maxOutputTokens must be an integer"});if(X<1)throw new H7({parameter:"maxOutputTokens",value:X,message:"maxOutputTokens must be >= 1"})}if(Y!=null){if(typeof Y!=="number")throw new H7({parameter:"temperature",value:Y,message:"temperature must be a number"})}if(Q!=null){if(typeof Q!=="number")throw new H7({parameter:"topP",value:Q,message:"topP must be a number"})}if(J!=null){if(typeof J!=="number")throw new H7({parameter:"topK",value:J,message:"topK must be a number"})}if(G!=null){if(typeof G!=="number")throw new H7({parameter:"presencePenalty",value:G,message:"presencePenalty must be a number"})}if(W!=null){if(typeof W!=="number")throw new H7({parameter:"frequencyPenalty",value:W,message:"frequencyPenalty must be a number"})}if(Z!=null){if(!Number.isInteger(Z))throw new H7({parameter:"seed",value:Z,message:"seed must be an integer"})}return{maxOutputTokens:X,temperature:Y,topP:Q,topK:J,presencePenalty:G,frequencyPenalty:W,stopSequences:$,seed:Z}}function rf6(X){return X!=null&&Object.keys(X).length>0}async function of6({tools:X,toolChoice:Y,activeTools:Q}){if(!rf6(X))return{tools:void 0,toolChoice:void 0};let J=Q!=null?Object.entries(X).filter(([W])=>Q.includes(W)):Object.entries(X),G=[];for(let[W,Z]of J){let $=Z.type;switch($){case void 0:case"dynamic":case"function":G.push({type:"function",name:W,description:Z.description,inputSchema:await $7(Z.inputSchema).jsonSchema,...Z.inputExamples!=null?{inputExamples:Z.inputExamples}:{},providerOptions:Z.providerOptions,...Z.strict!=null?{strict:Z.strict}:{}});break;case"provider":G.push({type:"provider",name:W,id:Z.id,args:Z.args});break;default:throw Error(`Unsupported tool type: ${$}`)}}return{tools:G,toolChoice:Y==null?{type:"auto"}:typeof Y==="string"?{type:Y}:{type:"tool",toolName:Y.toolName}}}var gP=B.lazy(()=>B.union([B.null(),B.string(),B.number(),B.boolean(),B.record(B.string(),gP.optional()),B.array(gP)])),l1=B.record(B.string(),B.record(B.string(),gP.optional())),oW1=B.object({type:B.literal("text"),text:B.string(),providerOptions:l1.optional()}),sf6=B.object({type:B.literal("image"),image:B.union([aW1,B.instanceof(URL)]),mediaType:B.string().optional(),providerOptions:l1.optional()}),sW1=B.object({type:B.literal("file"),data:B.union([aW1,B.instanceof(URL)]),filename:B.string().optional(),mediaType:B.string(),providerOptions:l1.optional()}),tf6=B.object({type:B.literal("reasoning"),text:B.string(),providerOptions:l1.optional()}),ef6=B.object({type:B.literal("tool-call"),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerOptions:l1.optional(),providerExecuted:B.boolean().optional()}),Xh6=B.discriminatedUnion("type",[B.object({type:B.literal("text"),value:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("json"),value:gP,providerOptions:l1.optional()}),B.object({type:B.literal("execution-denied"),reason:B.string().optional(),providerOptions:l1.optional()}),B.object({type:B.literal("error-text"),value:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("error-json"),value:gP,providerOptions:l1.optional()}),B.object({type:B.literal("content"),value:B.array(B.union([B.object({type:B.literal("text"),text:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("media"),data:B.string(),mediaType:B.string()}),B.object({type:B.literal("file-data"),data:B.string(),mediaType:B.string(),filename:B.string().optional(),providerOptions:l1.optional()}),B.object({type:B.literal("file-url"),url:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("file-id"),fileId:B.union([B.string(),B.record(B.string(),B.string())]),providerOptions:l1.optional()}),B.object({type:B.literal("image-data"),data:B.string(),mediaType:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("image-url"),url:B.string(),providerOptions:l1.optional()}),B.object({type:B.literal("image-file-id"),fileId:B.union([B.string(),B.record(B.string(),B.string())]),providerOptions:l1.optional()}),B.object({type:B.literal("custom"),providerOptions:l1.optional()})]))})]),tW1=B.object({type:B.literal("tool-result"),toolCallId:B.string(),toolName:B.string(),output:Xh6,providerOptions:l1.optional()}),Yh6=B.object({type:B.literal("tool-approval-request"),approvalId:B.string(),toolCallId:B.string()}),Qh6=B.object({type:B.literal("tool-approval-response"),approvalId:B.string(),approved:B.boolean(),reason:B.string().optional()}),Jh6=B.object({role:B.literal("system"),content:B.string(),providerOptions:l1.optional()}),Gh6=B.object({role:B.literal("user"),content:B.union([B.string(),B.array(B.union([oW1,sf6,sW1]))]),providerOptions:l1.optional()}),Wh6=B.object({role:B.literal("assistant"),content:B.union([B.string(),B.array(B.union([oW1,sW1,tf6,ef6,tW1,Yh6]))]),providerOptions:l1.optional()}),Zh6=B.object({role:B.literal("tool"),content:B.array(B.union([tW1,Qh6])),providerOptions:l1.optional()}),$h6=B.union([Jh6,Gh6,Wh6,Zh6]);async function Kh6(X){if(X.prompt==null&&X.messages==null)throw new $F({prompt:X,message:"prompt or messages must be defined"});if(X.prompt!=null&&X.messages!=null)throw new $F({prompt:X,message:"prompt and messages cannot be defined at the same time"});if(X.system!=null&&typeof X.system!=="string"&&!zb(X.system).every((J)=>typeof J==="object"&&J!==null&&("role"in J)&&J.role==="system"))throw new $F({prompt:X,message:"system must be a string, SystemModelMessage, or array of SystemModelMessage"});let Y;if(X.prompt!=null&&typeof X.prompt==="string")Y=[{role:"user",content:X.prompt}];else if(X.prompt!=null&&Array.isArray(X.prompt))Y=X.prompt;else if(X.messages!=null)Y=X.messages;else throw new $F({prompt:X,message:"prompt or messages must be defined"});if(Y.length===0)throw new $F({prompt:X,message:"messages must not be empty"});let Q=await wY({value:Y,schema:B.array($h6)});if(!Q.success)throw new $F({prompt:X,message:"The messages do not match the ModelMessage[] schema.",cause:Q.error});return{messages:Y,system:X.system}}function Hh6(X){if(!Vb.isInstance(X))return X;let Y=(process==null?void 0:"production")==="production",Q="https://ai-sdk.dev/unauthenticated-ai-gateway";if(Y)return new B1({name:"GatewayError",message:`Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${Q}`});return Object.assign(Error(`\x1B[1m\x1B[31mUnauthenticated request to AI Gateway.\x1B[0m
|
|
1073
1073
|
|
|
1074
1074
|
To authenticate, set the \x1B[33mAI_GATEWAY_API_KEY\x1B[0m environment variable with your API key.
|
|
1075
1075
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aJ as a,bo as o}from"./index-DZBCLPmz.js";const e="mcp.mesh",s=a(o,{target:"draft-7"});export{s as B,e as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as S,_ as ye,y as re,I as U,z as w,c as R,j as t,f as Fe,d as tt,b as st,k as ot,af as lt,B as nt,E as it,t as Ae}from"./index-DZBCLPmz.js";import{I as Ee,E as rt}from"./empty-state-DBRX3hef.js";import{E as Ve}from"./error-boundary-yHT4ni_0.js";import{C as Ge}from"./checkbox-z9w2qryt.js";import{c as H,B as V}from"./button-C_Xg9B1B.js";import{i as at}from"./ArrowLeft-BsUDOBX0.js";import{u as We}from"./use-connection-CD3KQhdl.js";import{C as ct}from"./collection-search-NPXhv3P8.js";import{I as Pe}from"./input-DrOaW48H.js";import{s as dt}from"./Plus-Dcgso5EP.js";import{i as mt}from"./X-C7-BOCtk.js";import{P as ut}from"./pin-to-sidebar-button-D7zfHxC-.js";import{T as ft}from"./tool-set-selector-CWxawPKU.js";import{b as ht,a as xt,i as pt}from"./use-gateway-HT97xIYl.js";import{u as gt,a as bt}from"./use-connection-resources-Bk8Paqb0.js";import{u as jt,a as yt}from"./use-gateway-system-prompt-DPiQIOlu.js";import{s as He}from"./slugify-CEUa2lfQ.js";import{B as qe}from"./badge-9bzwrgbk.js";import{a as vt,D as St,c as Nt,d as _t}from"./dialog-C9Agm5JE.js";import{F as be,a as wt,b as ve,d as Se,f as Ne,c as Ct}from"./form-D_wQlmgT.js";import{I as kt,R as It,a as Tt}from"./index-DiisCGqz.js";import{R as $t}from"./resource-tabs-Dv00g9SH.js";import{S as Rt,a as zt,b as At,c as Et,d as Ue}from"./select-Cgab7LNB.js";import{S as Pt}from"./switch-BDCe2nGJ.js";import{T as Mt}from"./textarea-BL4bZEBo.js";import{a as Z,c as Y,b as J,T as Q}from"./tooltip-CpJ7mUzE.js";import{i as Ze}from"./Check-DijrPXQx.js";import{i as Dt}from"./Code01-C0ZFF6Hl.js";import{a as Ut}from"./Copy01-BQZg7H8u.js";import{i as Lt}from"./FlipBackward-BZkXBjUF.js";import{i as je}from"./InfoCircle-DqeM4n2r.js";import{i as ze}from"./Loading01-6JGza9Vp.js";import{a as Ot,V as Bt,b as Ft}from"./layout-B4oQiZN6.js";import"./connection-DoXpv3Ov.js";import"./project-context-provider-CwtkfEWe.js";import"./use-collections-BmF5uRR6.js";import"./useMutation-DV6K6Nze.js";import"./SearchMd-CbnCIalV.js";import"./use-organization-settings-BMsrsPvw.js";import"./localstorage-keys-ColTY5EO.js";import"./useQuery-mZS4-X0F.js";import"./ChevronDown-DASi-DMo.js";const Ye=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M4 7h11m0 0-4 4m4-4-4-4M4 17h16m0 0-4 4m4-4-4-4"}));Ye.displayName="ArrowsRight";const Je=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}));Je.displayName="Circle";const Qe=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M10 17.659V20a2 2 0 1 0 4 0v-2.341M12 2v1m-9 9H2m3.5-6.5-.6-.6m13.6.6.6-.6M22 12h-1m-3 0a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"}));Qe.displayName="Lightbulb02";const Ke=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"M7 3v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C7.76 8 8.04 8 8.6 8h6.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C17 7.24 17 6.96 17 6.4V4m0 17v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Ke.displayName="Save01";const Xe=({size:o=24,color:e="currentColor",...s})=>S.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},S.createElement("path",{d:"m8.59 13.51 6.83 3.98m-.01-10.98-6.82 3.98M21 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM9 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm12 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}));Xe.displayName="Share07";const Me=ye(["inclusion","exclusion"]).describe("Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected"),Vt=re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().describe("Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded"),selected_resources:U(w()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included."),selected_prompts:U(w()).nullable().describe("Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.")}),Gt=re({id:w().describe("Unique identifier for the gateway"),title:w().describe("Human-readable name for the gateway"),description:w().nullable().describe("Description of the gateway"),icon:w().nullable().optional().describe("Icon URL for the gateway"),created_at:w().describe("When the gateway was created"),updated_at:w().describe("When the gateway was last updated"),created_by:w().describe("User ID who created the gateway"),updated_by:w().optional().describe("User ID who last updated the gateway"),organization_id:w().describe("Organization ID this gateway belongs to"),tool_selection_mode:Me.describe("Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected"),status:ye(["active","inactive"]).describe("Current status"),connections:U(Vt).describe("Connections with their selected tools (behavior depends on tool_selection_mode)")});re({title:w().min(1).max(255).describe("Name for the gateway"),description:w().nullable().optional().describe("Optional description"),tool_selection_mode:Me.optional().default("inclusion").describe("Tool selection mode (defaults to 'inclusion')"),icon:w().nullable().optional().describe("Optional icon URL"),status:ye(["active","inactive"]).optional().default("active").describe("Initial status"),connections:U(re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U(w()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U(w()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).describe("Connections to include/exclude (can be empty for exclusion mode)")});re({title:w().min(1).max(255).optional().describe("New name"),description:w().nullable().optional().describe("New description (null to clear)"),tool_selection_mode:Me.optional().describe("New tool selection mode"),icon:w().nullable().optional().describe("New icon URL (null to clear)"),status:ye(["active","inactive"]).optional().describe("New status"),connections:U(re({connection_id:w().describe("Connection ID"),selected_tools:U(w()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:U(w()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:U(w()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).optional().describe("New connections (replaces existing)")});const Wt=S.memo(function(e){const s=R.c(20),{connection:l,isSelected:i,hasItemsEnabled:n,activeItemsCount:a,totalItemsCount:m,onSelect:c,onToggle:r}=e,d=i?"bg-accent/50":"hover:bg-muted/50";let u;s[0]!==d?(u=H("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",d),s[0]=d,s[1]=u):u=s[1];let f;s[2]!==l.icon||s[3]!==l.title?(f=t.jsx(Ee,{icon:l.icon,name:l.title,size:"xs"}),s[2]=l.icon,s[3]=l.title,s[4]=f):f=s[4];let b;s[5]!==l.title?(b=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:l.title})}),s[5]=l.title,s[6]=b):b=s[6];let x;s[7]!==c||s[8]!==f||s[9]!==b?(x=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:c,children:[f,b]}),s[7]=c,s[8]=f,s[9]=b,s[10]=x):x=s[10];let p;s[11]!==a||s[12]!==n||s[13]!==r||s[14]!==m?(p=m>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[a,"/",m]}),t.jsx(Ge,{checked:n,onCheckedChange:r,onClick:qt})]}),s[11]=a,s[12]=n,s[13]=r,s[14]=m,s[15]=p):p=s[15];let y;return s[16]!==u||s[17]!==x||s[18]!==p?(y=t.jsxs("div",{className:u,children:[x,p]}),s[16]=u,s[17]=x,s[18]=p,s[19]=y):y=s[19],y}),Ht=S.memo(function(e){const s=R.c(18),{connectionId:l,item:i,isSelected:n,onToggle:a}=e,m=`item-${l}-${i.id}`,c=n?"text-foreground":"text-muted-foreground";let r;s[0]!==c?(r=H("text-sm font-medium",c),s[0]=c,s[1]=r):r=s[1];let d;s[2]!==i.name||s[3]!==r?(d=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:r,children:i.name})}),s[2]=i.name,s[3]=r,s[4]=d):d=s[4];let u;s[5]!==i.description?(u=i.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:i.description}),s[5]=i.description,s[6]=u):u=s[6];let f;s[7]!==d||s[8]!==u?(f=t.jsxs("div",{className:"flex-1 min-w-0",children:[d,u]}),s[7]=d,s[8]=u,s[9]=f):f=s[9];const b=`item-${l}-${i.id}`;let x;s[10]!==n||s[11]!==a||s[12]!==b?(x=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(Ge,{id:b,checked:n,onCheckedChange:a,onClick:Zt})}),s[10]=n,s[11]=a,s[12]=b,s[13]=x):x=s[13];let p;return s[14]!==m||s[15]!==f||s[16]!==x?(p=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:m,children:[f,x]}),s[14]=m,s[15]=f,s[16]=x,s[17]=p):p=s[17],p});function et({itemSet:o,onItemSetChange:e,getItems:s,itemLabel:l,emptyItemsMessage:i,extraContent:n}){const[a,m]=S.useState(""),c=S.useDeferredValue(a),[r,d]=S.useState("all"),[u,f]=S.useState(!1),b=S.useRef(new Set(Object.keys(o))),x=We({searchTerm:c.trim()||void 0}),p=b.current,y=[...p.values()].map(h=>x.find(N=>N.id===h)).filter(h=>h!==void 0),j=x.filter(h=>!p.has(h.id)),v=[...y,...j],g=h=>{const N=o[h];return N!==void 0&&N.length>0},_=v.filter(h=>{if(r==="all")return!0;const N=g(h.id);return r==="selected"?N:r==="unselected"?!N:!0}),[C,I]=S.useState(v[0]?.id??null),k=C?v.find(h=>h.id===C)??null:null,P=k?s(k):[],E=(h,N)=>o[h]?.includes(N)??!1,L=(h,N)=>{const z=o[h]??[],$=z.includes(N),G={...o};if($){const W=z.filter(q=>q!==N);W.length===0?delete G[h]:G[h]=W}else G[h]=[...z,N];e(G)},B=h=>{const N=v.find(F=>F.id===h);if(!N)return;const z=s(N);if(z.length===0)return;const $=o[h]??[],G=z.map(F=>F.id),W=$.length>0&&G.every(F=>$.includes(F)),q={...o};W?delete q[h]:(q[h]=G,I(h)),e(q)},A=h=>{I(h),f(!0)},M=()=>{f(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:H("w-full md:w-80 border-r border-border flex flex-col",u&&"hidden md:flex"),children:[t.jsx(ct,{value:a,onChange:m,placeholder:"Search Connections..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>d("all"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>d("selected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>d("unselected"),className:H("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:_.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:a?"No connections found":r==="selected"?"No servers selected":r==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:_.map(h=>{const z=s(h).length,$=o[h.id]?.length??0;return t.jsx(Wt,{connection:h,isSelected:C===h.id,hasItemsEnabled:g(h.id),activeItemsCount:$,totalItemsCount:z,onSelect:()=>A(h.id),onToggle:()=>B(h.id)},h.id)})})})]}),t.jsx("div",{className:H("flex-1 flex-col",u?"flex":"hidden md:flex"),children:k?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(V,{variant:"ghost",size:"sm",onClick:M,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(at,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(Ee,{icon:k.icon,name:k.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:k.title}),k.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:k.description})]})]})]}),n,t.jsx("div",{className:"flex-1 overflow-auto p-4",children:P.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:i||`This connection has no ${l} available`}):t.jsx("div",{className:"space-y-2",children:P.map(h=>t.jsx(Ht,{connectionId:k.id,item:h,isSelected:E(k.id,h.id),onToggle:()=>L(k.id,h.id)},h.id))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-sm text-muted-foreground text-center",children:["Select a connection to view its ",l]})})})]})}function qt(o){return o.stopPropagation()}function Zt(o){return o.stopPropagation()}function Yt(o){const e=R.c(6),{promptSet:s,onPromptSetChange:l,connectionPrompts:i}=o;let n;e[0]!==i?(n=c=>(i.get(c.id)??[]).map(Jt),e[0]=i,e[1]=n):n=e[1];const a=n;let m;return e[2]!==a||e[3]!==l||e[4]!==s?(m=t.jsx(et,{itemSet:s,onItemSetChange:l,getItems:a,itemLabel:"prompts",emptyItemsMessage:"This connection has no prompts available"}),e[2]=a,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}function Jt(o){return{id:o.name,name:o.name,description:o.description}}function Qt(o){return o.includes("*")}function Kt(o){const e=R.c(27),{patterns:s,onAddPattern:l,onRemovePattern:i}=o,[n,a]=S.useState("");let m;e[0]!==n||e[1]!==l||e[2]!==s?(m=()=>{const f=n.trim();f&&!s.includes(f)&&(l(f),a(""))},e[0]=n,e[1]=l,e[2]=s,e[3]=m):m=e[3];const c=m;let r;e[4]!==c?(r=f=>{f.key==="Enter"&&(f.preventDefault(),c())},e[4]=c,e[5]=r):r=e[5];const d=r;let u;if(e[6]!==c||e[7]!==d||e[8]!==n||e[9]!==i||e[10]!==s){const f=s.filter(Qt);let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("code",{children:"*"}),e[12]=b):b=e[12];let x;e[13]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsxs("div",{className:"text-xs text-muted-foreground",children:["Add URI patterns to match multiple resources. Use ",b," for single segment and ",t.jsx("code",{children:"**"})," for multiple segments."]}),e[13]=x):x=e[13];let p;e[14]===Symbol.for("react.memo_cache_sentinel")?(p=I=>a(I.target.value),e[14]=p):p=e[14];let y;e[15]!==d||e[16]!==n?(y=t.jsx(Pe,{value:n,onChange:p,onKeyDown:d,placeholder:"e.g., file:///**/*.ts or db://users/*",className:"flex-1 text-sm"}),e[15]=d,e[16]=n,e[17]=y):y=e[17];let j;e[18]!==n?(j=n.trim(),e[18]=n,e[19]=j):j=e[19];const v=!j;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(dt,{size:16}),e[20]=g):g=e[20];let _;e[21]!==c||e[22]!==v?(_=t.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:c,disabled:v,children:g}),e[21]=c,e[22]=v,e[23]=_):_=e[23];let C;e[24]!==_||e[25]!==y?(C=t.jsxs("div",{className:"flex gap-2",children:[y,_]}),e[24]=_,e[25]=y,e[26]=C):C=e[26],u=t.jsxs("div",{className:"border-b border-border p-4 space-y-3",children:[x,C,f.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(I=>t.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-muted rounded-md text-xs",children:[t.jsx("code",{className:"text-foreground",children:I}),t.jsx("button",{type:"button",onClick:()=>i(I),className:"text-muted-foreground hover:text-foreground",children:t.jsx(mt,{size:12})})]},I))})]}),e[6]=c,e[7]=d,e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];return u}function Xt(o){const e=R.c(23),{resourceSet:s,onResourceSetChange:l,connectionResources:i}=o,[n]=S.useState(null);let a;e[0]!==i?(a=g=>(i.get(g.id)??[]).map(es),e[0]=i,e[1]=a):a=e[1];const m=a;let c;e[2]!==l||e[3]!==s?(c=(g,_)=>{const C=s[g]??[];C.includes(_)||l({...s,[g]:[...C,_]})},e[2]=l,e[3]=s,e[4]=c):c=e[4];const r=c;let d;e[5]!==l||e[6]!==s?(d=(g,_)=>{const I=(s[g]??[]).filter(k=>k!==_);if(I.length===0){const k={...s};delete k[g],l(k)}else l({...s,[g]:I})},e[5]=l,e[6]=s,e[7]=d):d=e[7];const u=d;let f;e[8]!==l?(f=g=>{l(g)},e[8]=l,e[9]=f):f=e[9];const b=f;let x;e[10]!==s||e[11]!==n?(x=n?s[n]??[]:[],e[10]=s,e[11]=n,e[12]=x):x=e[12];const p=x;let y;e[13]!==r||e[14]!==u||e[15]!==n||e[16]!==p?(y=n?t.jsx(Kt,{patterns:p,onAddPattern:g=>r(n,g),onRemovePattern:g=>u(n,g)}):null,e[13]=r,e[14]=u,e[15]=n,e[16]=p,e[17]=y):y=e[17];const j=y;let v;return e[18]!==j||e[19]!==m||e[20]!==b||e[21]!==s?(v=t.jsx("div",{className:"h-full",children:t.jsx(et,{itemSet:s,onItemSetChange:b,getItems:m,itemLabel:"resources",emptyItemsMessage:"This connection has no resources available",extraContent:j})}),e[18]=j,e[19]=m,e[20]=b,e[21]=s,e[22]=v):v=e[22],v}function es(o){return{id:o.uri,name:o.name||o.uri,description:o.description||o.uri}}function ts(o){const e=R.c(8);let s,l;e[0]!==o?({className:s,...l}=o,e[0]=o,e[1]=s,e[2]=l):(s=e[1],l=e[2]);let i;e[3]!==s?(i=H("grid gap-3",s),e[3]=s,e[4]=i):i=e[4];let n;return e[5]!==l||e[6]!==i?(n=t.jsx(It,{"data-slot":"radio-group",className:i,...l}),e[5]=l,e[6]=i,e[7]=n):n=e[7],n}function Re(o){const e=R.c(9);let s,l;e[0]!==o?({className:s,...l}=o,e[0]=o,e[1]=s,e[2]=l):(s=e[1],l=e[2]);let i;e[3]!==s?(i=H("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),e[3]=s,e[4]=i):i=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(Tt,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:t.jsx(Je,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=n):n=e[5];let a;return e[6]!==l||e[7]!==i?(a=t.jsx(kt,{"data-slot":"radio-group-item",className:i,...l,children:n}),e[6]=l,e[7]=i,e[8]=a):a=e[8],a}function ss(o){const s=new TextEncoder().encode(o),l=Array.from(s,i=>String.fromCharCode(i)).join("");return btoa(l)}const os=Gt.pick({title:!0,description:!0,status:!0,tool_selection_mode:!0}).extend({title:w().min(1,"Name is required").max(255)});function Le(o,e){const s={};for(const l of o.connections)if(l.selected_tools===null){const i=e.get(l.connection_id)??[];i.length>0&&(s[l.connection_id]=i)}else l.selected_tools.length>0&&(s[l.connection_id]=l.selected_tools);return s}function Oe(o){const e={};for(const s of o.connections)s.selected_resources!==null&&s.selected_resources!==void 0&&s.selected_resources.length>0&&(e[s.connection_id]=s.selected_resources);return e}function Be(o){const e={};for(const s of o.connections)s.selected_prompts!==null&&s.selected_prompts!==void 0&&s.selected_prompts.length>0&&(e[s.connection_id]=s.selected_prompts);return e}function ls(o,e,s,l){const i=new Set([...Object.keys(o),...Object.keys(e),...Object.keys(s)]);return Array.from(i).map(n=>{const a=o[n]??[],m=l.get(n)??[],c=m.length>0&&m.every(r=>a.includes(r));return{connection_id:n,selected_tools:a.length===0||c?null:a,selected_resources:e[n]??null,selected_prompts:s[n]??null}})}function ns(o){const e=R.c(10),{gatewayUrl:s}=o,[l,i]=S.useState(!1);let n;e[0]!==s?(n=async()=>{await navigator.clipboard.writeText(s),i(!0),Ae.success("Agent URL copied to clipboard"),setTimeout(()=>i(!1),2e3)},e[0]=s,e[1]=n):n=e[1];const a=n;let m;e[2]!==l?(m=l?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx(Ut,{size:20}),e[2]=l,e[3]=m):m=e[3];const c=l?"Copied!":"Copy URL";let r;e[4]!==c?(r=t.jsx("span",{className:"text-xs font-medium",children:c}),e[4]=c,e[5]=r):r=e[5];let d;return e[6]!==a||e[7]!==m||e[8]!==r?(d=t.jsxs(V,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[m,r]}),e[6]=a,e[7]=m,e[8]=r,e[9]=d):d=e[9],d}function is(o){const e=R.c(7),{gatewayUrl:s,serverName:l}=o;let i;e[0]!==s||e[1]!==l?(i=()=>{const r=He(l),u=ss(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),f=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(r)}&config=${encodeURIComponent(u)}`;window.open(f,"_blank"),Ae.success("Opening Cursor...")},e[0]=s,e[1]=l,e[2]=i):i=e[2];const n=i;let a,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),m=t.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[3]=a,e[4]=m):(a=e[3],m=e[4]);let c;return e[5]!==n?(c=t.jsxs(V,{type:"button",variant:"outline",onClick:n,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[a,m]}),e[5]=n,e[6]=c):c=e[6],c}function rs(o){const e=R.c(11),{gatewayUrl:s,serverName:l}=o,[i,n]=S.useState(!1);let a;e[0]!==s||e[1]!==l?(a=async()=>{const f=He(l),x=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),p=`claude mcp add "${f}" --config '${x.replace(/'/g,"'\\''")}'`;await navigator.clipboard.writeText(p),n(!0),Ae.success("Claude Code command copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=s,e[1]=l,e[2]=a):a=e[2];const m=a;let c;e[3]!==i?(c=i?t.jsx(Ze,{size:20,className:"text-green-600"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[3]=i,e[4]=c):c=e[4];const r=i?"Copied!":"Install on Claude";let d;e[5]!==r?(d=t.jsx("span",{className:"text-xs font-medium",children:r}),e[5]=r,e[6]=d):d=e[6];let u;return e[7]!==m||e[8]!==c||e[9]!==d?(u=t.jsxs(V,{type:"button",variant:"outline",onClick:m,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[7]=m,e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function as(o){const e=R.c(40),{open:s,onOpenChange:l,gateway:i}=o,[n,a]=S.useState("code_execution");let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=$=>{($==="passthrough"||$==="smart_tool_selection"||$==="code_execution")&&a($)},e[0]=m):m=e[0];const c=m;let r;e[1]!==i.id||e[2]!==n?(r=new URL(`/mcp/gateway/${i.id}`,window.location.origin),r.searchParams.set("mode",n),e[1]=i.id,e[2]=n,e[3]=r):r=e[3];let d;e[4]!==i.id||e[5]!==i.title?(d=i.title||`agent-${i.id.slice(0,8)}`,e[4]=i.id,e[5]=i.title,e[6]=d):d=e[6];const u=d;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(vt,{children:t.jsx(St,{children:"Share Agent"})}),e[7]=f):f=e[7];let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("div",{children:t.jsx("h4",{className:"text-sm font-medium text-foreground mt-1",children:"How should this agent work?"})}),e[8]=b):b=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Ye,{className:"size-5 text-muted-foreground"})}),e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Direct access"}),e[10]=p):p=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[11]=y):y=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("label",{htmlFor:"mode-passthrough",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[x,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[p,t.jsx(Z,{children:t.jsxs(Y,{children:[y,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"All tools are exposed directly via tools/list. Best for small tool surfaces with deterministic behavior."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Best for small teams or when you need predictable behavior"})]}),t.jsx(Re,{id:"mode-passthrough",value:"passthrough"})]}),e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Qe,{className:"size-5 text-muted-foreground"})}),e[13]=v):v=e[13];let g;e[14]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart discovery"}),e[14]=g):g=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[15]=_):_=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsxs("label",{htmlFor:"mode-smart",className:"flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[v,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[g,t.jsx(Z,{children:t.jsxs(Y,{children:[_,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Uses meta-tools (GATEWAY_SEARCH_TOOLS, GATEWAY_DESCRIBE_TOOLS, GATEWAY_CALL_TOOL) to keep the tool list small and request details on demand."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Ideal for large teams with many tools - AI finds what it needs"})]}),t.jsx(Re,{id:"mode-smart",value:"smart_tool_selection"})]}),e[16]=C):C=e[16];let I;e[17]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("div",{className:"p-1.5 shrink-0",children:t.jsx(Dt,{className:"size-5 text-muted-foreground"})}),e[17]=I):I=e[17];let k;e[18]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("span",{className:"text-sm font-medium text-foreground",children:"Smart execution"}),e[18]=k):k=e[18];let P;e[19]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(J,{asChild:!0,children:t.jsx(je,{className:"size-3.5 text-muted-foreground"})}),e[19]=P):P=e[19];let E;e[20]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsxs("label",{htmlFor:"mode-code",className:"relative flex items-center gap-3 px-3 py-5 rounded-lg border border-border hover:border-ring/50 cursor-pointer transition-colors has-checked:border-ring has-checked:bg-accent/5",children:[I,t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[k,t.jsx(Z,{children:t.jsxs(Y,{children:[P,t.jsx(Q,{className:"max-w-xs",children:t.jsx("p",{className:"text-xs",children:"Exposes meta-tools for discovery + sandboxed execution (GATEWAY_RUN_CODE). Reduces overhead on large surfaces by shifting work into a controlled runtime."})})]})})]}),t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Maximum flexibility - AI can write code to orchestrate tools"})]}),t.jsx(Re,{id:"mode-code",value:"code_execution"}),t.jsx(qe,{variant:"outline",className:"absolute -top-2.5 left-1/2 -translate-x-1/2 bg-background z-10",children:"Recommended"})]}),e[20]=E):E=e[20];let L;e[21]!==n?(L=t.jsxs("div",{className:"flex flex-col gap-3",children:[b,t.jsxs(ts,{value:n,onValueChange:c,className:"flex flex-col gap-4.5",children:[j,C,E]})]}),e[21]=n,e[22]=L):L=e[22];let B;e[23]!==r.href?(B=t.jsx(ns,{gatewayUrl:r.href}),e[23]=r.href,e[24]=B):B=e[24];let A,M;e[25]!==r.href||e[26]!==u?(A=t.jsx(is,{gatewayUrl:r.href,serverName:u}),M=t.jsx(rs,{gatewayUrl:r.href,serverName:u}),e[25]=r.href,e[26]=u,e[27]=A,e[28]=M):(A=e[27],M=e[28]);let h;e[29]!==B||e[30]!==A||e[31]!==M?(h=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[B,A,M]})}),e[29]=B,e[30]=A,e[31]=M,e[32]=h):h=e[32];let N;e[33]!==L||e[34]!==h?(N=t.jsxs(Nt,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[f,t.jsxs("div",{className:"flex flex-col gap-6",children:[L,h]})]}),e[33]=L,e[34]=h,e[35]=N):N=e[35];let z;return e[36]!==l||e[37]!==s||e[38]!==N?(z=t.jsx(_t,{open:s,onOpenChange:l,children:N}),e[36]=l,e[37]=s,e[38]=N,e[39]=z):z=e[39],z}function cs(o){const e=R.c(32),{form:s,icon:l,gatewayId:i}=o,[n]=jt(),[a,m]=yt(i);let c;e[0]!==s?(c=s.watch("title")||"Agent",e[0]=s,e[1]=c):c=e[1];let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(pt,{}),e[2]=r):r=e[2];let d;e[3]!==l||e[4]!==c?(d=t.jsx(Ee,{icon:l,name:c,size:"lg",className:"shrink-0 shadow-sm",fallbackIcon:r}),e[3]=l,e[4]=c,e[5]=d):d=e[5];let u;e[6]!==s.control?(u=t.jsx(be,{control:s.control,name:"status",render:fs}),e[6]=s.control,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=t.jsxs("div",{className:"flex items-start justify-between",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let b;e[11]!==s.control?(b=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(be,{control:s.control,name:"title",render:us}),t.jsx(be,{control:s.control,name:"description",render:ms})]}),e[11]=s.control,e[12]=b):b=e[12];let x;e[13]!==f||e[14]!==b?(x=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[f,b]}),e[13]=f,e[14]=b,e[15]=x):x=e[15];let p;e[16]!==n||e[17]!==s.control?(p=n&&t.jsx("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:t.jsx(be,{control:s.control,name:"tool_selection_mode",render:ds})}),e[16]=n,e[17]=s.control,e[18]=p):p=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-foreground mb-1",children:"System Prompt"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Stored locally for now"})]}),e[19]=y):y=e[19];let j;e[20]!==m?(j=C=>m(C.target.value),e[20]=m,e[21]=j):j=e[21];let v;e[22]!==a||e[23]!==j?(v=t.jsxs("div",{className:"flex flex-col gap-3 p-5",children:[y,t.jsx(Mt,{value:a,onChange:j,placeholder:"Enter system prompt instructions...",className:"min-h-[240px] resize-none text-sm leading-relaxed"})]}),e[22]=a,e[23]=j,e[24]=v):v=e[24];let g;e[25]!==v||e[26]!==x||e[27]!==p?(g=t.jsxs("div",{className:"flex flex-col",children:[x,p,v]}),e[25]=v,e[26]=x,e[27]=p,e[28]=g):g=e[28];let _;return e[29]!==s||e[30]!==g?(_=t.jsx("div",{className:"flex flex-col h-full overflow-auto",children:t.jsx(wt,{...s,children:g})}),e[29]=s,e[30]=g,e[31]=_):_=e[31],_}function ds(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(Ct,{className:"mb-0",children:"Selection Mode"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(Z,{children:t.jsxs(Y,{children:[t.jsx(J,{asChild:!0,children:t.jsx(V,{type:"button",variant:"ghost",size:"icon",className:"size-7","aria-label":"Selection mode help",children:t.jsx(je,{size:14,className:"text-muted-foreground"})})}),t.jsx(Q,{side:"left",className:"max-w-sm",children:t.jsxs("div",{className:"text-xs space-y-1",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"Include:"})," Only selected items are exposed."]}),t.jsxs("div",{children:[t.jsx("strong",{children:"Exclude:"})," All items except selected ones are exposed."]})]})})]})}),t.jsxs(Rt,{value:e.value,onValueChange:e.onChange,children:[t.jsx(Se,{children:t.jsx(zt,{className:"w-[180px]",children:t.jsx(At,{})})}),t.jsxs(Et,{children:[t.jsx(Ue,{value:"inclusion",children:"Include Selected"}),t.jsx(Ue,{value:"exclusion",children:"Exclude Selected"})]})]})]})]}),t.jsx(Ne,{})]})}function ms(o){const{field:e}=o;return t.jsxs(ve,{className:"w-full space-y-0",children:[t.jsx(Se,{children:t.jsx(Pe,{...e,value:e.value||"",className:"h-auto text-base text-muted-foreground leading-6 px-0 border-transparent hover:border-input focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Ne,{})]})}function us(o){const{field:e}=o;return t.jsxs(ve,{className:"w-full space-y-0",children:[t.jsx(Se,{children:t.jsx(Pe,{...e,className:"h-auto text-lg! font-medium leading-7 px-0 border-transparent hover:border-input focus:border-input bg-transparent transition-all",placeholder:"Agent Name"})}),t.jsx(Ne,{})]})}function fs(o){const{field:e}=o;return t.jsxs(ve,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qe,{variant:e.value==="active"?"success":"outline",children:e.value==="active"?"Active":"Inactive"}),t.jsx(Se,{children:t.jsx(Pt,{checked:e.value==="active",onCheckedChange:s=>e.onChange(s?"active":"inactive")})})]}),t.jsx(Ne,{})]})}function hs(o){const e=R.c(81),{gateway:s,gatewayId:l,requestedTabId:i}=o,a=ot().location.href,m=lt();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={from:"/$org/gateways/$gatewayId"},e[0]=c):c=e[0];const r=Fe(c),d=xt();let u;e[1]===Symbol.for("react.memo_cache_sentinel")?(u={},e[1]=u):u=e[1];const f=We(u);let b;e[2]!==f?(b=f.map(ps),e[2]=f,e[3]=b):b=e[3];const x=b,{promptsMap:p}=gt(x),{resourcesMap:y}=bt(x);let j;if(e[4]!==f){j=new Map;for(const T of f)T.tools&&T.tools.length>0&&j.set(T.id,T.tools.map(xs));e[4]=f,e[5]=j}else j=e[5];let v;e[6]!==j||e[7]!==s?(v=()=>Le(s,j),e[6]=j,e[7]=s,e[8]=v):v=e[8];const[g,_]=S.useState(v);let C;e[9]!==s?(C=()=>Oe(s),e[9]=s,e[10]=C):C=e[10];const[I,k]=S.useState(C);let P;e[11]!==s?(P=()=>Be(s),e[11]=s,e[12]=P):P=e[12];const[E,L]=S.useState(P),[B,A]=S.useState(!1),[M,h]=S.useState(!1);let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=T=>{_(T),A(!0)},e[13]=N):N=e[13];const z=N;let $;e[14]===Symbol.for("react.memo_cache_sentinel")?($=T=>{k(T),A(!0)},e[14]=$):$=e[14];const G=$;let W;e[15]===Symbol.for("react.memo_cache_sentinel")?(W=T=>{L(T),A(!0)},e[15]=W):W=e[15];const q=W;let F;e[16]===Symbol.for("react.memo_cache_sentinel")?(F=nt(os),e[16]=F):F=e[16];const _e=s.tool_selection_mode??"inclusion";let ce;e[17]!==s.description||e[18]!==s.status||e[19]!==s.title||e[20]!==_e?(ce={resolver:F,defaultValues:{title:s.title,description:s.description,status:s.status,tool_selection_mode:_e}},e[17]=s.description,e[18]=s.status,e[19]=s.title,e[20]=_e,e[21]=ce):ce=e[21];const O=it(ce),we=O.formState.isDirty||B;let de;e[22]!==d.update||e[23]!==j||e[24]!==O||e[25]!==l||e[26]!==E||e[27]!==I||e[28]!==g?(de=async()=>{const T=O.getValues(),$e=ls(g,I,E,j);await d.update.mutateAsync({id:l,data:{title:T.title,description:T.description,status:T.status,tool_selection_mode:T.tool_selection_mode,connections:$e}}),O.reset(T),A(!1)},e[22]=d.update,e[23]=j,e[24]=O,e[25]=l,e[26]=E,e[27]=I,e[28]=g,e[29]=de):de=e[29];const Ce=de;let me;e[30]!==j||e[31]!==O||e[32]!==s?(me=()=>{O.reset({title:s.title,description:s.description,status:s.status,tool_selection_mode:s.tool_selection_mode??"inclusion"}),_(Le(s,j)),k(Oe(s)),L(Be(s)),A(!1)},e[30]=j,e[31]=O,e[32]=s,e[33]=me):me=e[33];const ke=me;let ue;e[34]===Symbol.for("react.memo_cache_sentinel")?(ue=[{id:"settings",label:"Settings"},{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[34]=ue):ue=e[34];const De=ue,D=De.some(T=>T.id===i)?i:"settings";let fe;e[35]!==r?(fe=T=>{r({search:$e=>({...$e,tab:T}),replace:!0})},e[35]=r,e[36]=fe):fe=e[36];const Ie=fe,ae=d.update.isPending;let K;e[37]!==m.history?(K=()=>m.history.back(),e[37]=m.history,e[38]=K):K=e[38];let X;e[39]!==D||e[40]!==Ie?(X=t.jsx(Ot,{children:t.jsx($t,{tabs:De,activeTab:D,onTabChange:Ie})}),e[39]=D,e[40]=Ie,e[41]=X):X=e[41];let ee;e[42]!==ke||e[43]!==Ce||e[44]!==we||e[45]!==ae?(ee=we&&t.jsxs(t.Fragment,{children:[t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:ke,"aria-label":"Cancel",children:t.jsx(Lt,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Cancel"})]})}),t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:ae,onClick:Ce,"aria-label":"Save",children:ae?t.jsx(ze,{size:14,className:"animate-spin"}):t.jsx(Ke,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Save"})]})})]}),e[42]=ke,e[43]=Ce,e[44]=we,e[45]=ae,e[46]=ee):ee=e[46];let he;e[47]===Symbol.for("react.memo_cache_sentinel")?(he=()=>h(!0),e[47]=he):he=e[47];let xe;e[48]===Symbol.for("react.memo_cache_sentinel")?(xe=t.jsx(Z,{children:t.jsxs(Y,{delayDuration:0,children:[t.jsx(J,{asChild:!0,children:t.jsx("span",{className:"inline-block",children:t.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:he,"aria-label":"Share",children:t.jsx(Xe,{size:14})})})}),t.jsx(Q,{side:"bottom",children:"Share"})]})}),e[48]=xe):xe=e[48];const Te=s.icon??"cpu_chip";let te;e[49]!==s.title||e[50]!==Te||e[51]!==a?(te=t.jsx(ut,{title:s.title,url:a,icon:Te}),e[49]=s.title,e[50]=Te,e[51]=a,e[52]=te):te=e[52];let se;e[53]!==ee||e[54]!==te?(se=t.jsxs(Bt,{children:[ee,xe,te]}),e[53]=ee,e[54]=te,e[55]=se):se=e[55];let pe;e[56]===Symbol.for("react.memo_cache_sentinel")?(pe=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),e[56]=pe):pe=e[56];let oe;e[57]!==D||e[58]!==p||e[59]!==y||e[60]!==O||e[61]!==s.icon||e[62]!==l||e[63]!==E||e[64]!==I||e[65]!==g?(oe=D==="settings"?t.jsx(cs,{form:O,icon:s.icon,gatewayId:l}):D==="tools"?t.jsx(ft,{toolSet:g,onToolSetChange:z}):D==="resources"?t.jsx(Xt,{resourceSet:I,onResourceSetChange:G,connectionResources:y}):D==="prompts"?t.jsx(Yt,{promptSet:E,onPromptSetChange:q,connectionPrompts:p}):null,e[57]=D,e[58]=p,e[59]=y,e[60]=O,e[61]=s.icon,e[62]=l,e[63]=E,e[64]=I,e[65]=g,e[66]=oe):oe=e[66];let le;e[67]!==oe?(le=t.jsx(S.Suspense,{fallback:pe,children:oe}),e[67]=oe,e[68]=le):le=e[68];let ne;e[69]!==D||e[70]!==le?(ne=t.jsx("div",{className:"flex h-full w-full bg-background overflow-hidden",children:t.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:t.jsx("div",{className:"h-full overflow-auto",children:t.jsx(Ve,{children:le},D)})})}),e[69]=D,e[70]=le,e[71]=ne):ne=e[71];let ie;e[72]!==s||e[73]!==M?(ie=t.jsx(as,{open:M,onOpenChange:h,gateway:s}),e[72]=s,e[73]=M,e[74]=ie):ie=e[74];let ge;return e[75]!==K||e[76]!==X||e[77]!==se||e[78]!==ne||e[79]!==ie?(ge=t.jsxs(Ft,{onBack:K,children:[X,se,ne,ie]}),e[75]=K,e[76]=X,e[77]=se,e[78]=ne,e[79]=ie,e[80]=ge):ge=e[80],ge}function xs(o){return o.name}function ps(o){return o.id}function gs(){const o=R.c(10);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/gateways/$gatewayId"},o[0]=e):e=o[0];const s=Fe(e);let l;o[1]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org/gateways/$gatewayId"},o[1]=l):l=o[1];const{gatewayId:i,org:n}=tt(l);let a;o[2]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/gateways/$gatewayId"},o[2]=a):a=o[2];const c=st(a).tab||"settings",r=ht(i);if(!r){let u;return o[3]!==s||o[4]!==n?(u=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(rt,{title:"Agent not found",description:"This Agent may have been deleted or you may not have access.",actions:t.jsx(V,{variant:"outline",onClick:()=>s({to:"/$org/gateways",params:{org:n}}),children:"Back to agents"})})}),o[3]=s,o[4]=n,o[5]=u):u=o[5],u}let d;return o[6]!==r||o[7]!==i||o[8]!==c?(d=t.jsx(hs,{gateway:r,gatewayId:i,requestedTabId:c}),o[6]=r,o[7]=i,o[8]=c,o[9]=d):d=o[9],d}function bs(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ve,{children:t.jsx(S.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(gs,{})})}),o[0]=e):e=o[0],e}function ao(){const o=R.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(bs,{}),o[0]=e):e=o[0],e}export{ao as default};
|