murmur-rag 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +27 -23
  2. package/dist/cdn/anthropic-ynz7717b.js +2 -0
  3. package/dist/cdn/chunk-hpx6rpea.js +1 -0
  4. package/dist/cdn/{embed-59r4jck6.js → embed-0m8xctqy.js} +3 -3
  5. package/dist/cdn/{embed-pnm9593k.js → embed-7pk91zq8.js} +2 -2
  6. package/dist/cdn/embed-dbkjhg16.js +83 -0
  7. package/dist/cdn/{embed-q6y6vgv1.js → embed-krrjjyf5.js} +4 -4
  8. package/dist/cdn/embed-n5nzhrf2.js +9 -0
  9. package/dist/cdn/{embed-hn0r8fmg.js → embed-rp9gb1qq.js} +2 -2
  10. package/dist/cdn/embed-xtkxyrpe.js +44 -0
  11. package/dist/cdn/google-k5kwa54v.js +14 -0
  12. package/dist/cdn/index-db4ne93m.js +1 -0
  13. package/dist/cdn/index-gyd02jvt.js +9 -0
  14. package/dist/cdn/index-qc8kgsdt.js +1 -0
  15. package/dist/cdn/index-t0qn2m4r.js +1 -0
  16. package/dist/cdn/index-y0faj89r.js +1 -0
  17. package/dist/cdn/mistral-p2qcnn42.js +3 -0
  18. package/dist/cdn/murmur-d6t6cjc7.js +5 -0
  19. package/dist/cdn/murmur.js +24 -5
  20. package/dist/cdn/openai-compatible-psnkrpxy.js +11 -0
  21. package/dist/cdn/openai-d3q1d6cz.js +18 -0
  22. package/dist/cdn/retriever-6qvn2maq.js +1 -0
  23. package/dist/cdn/transformers.web-xn16v7pz.js +46 -0
  24. package/dist/cli.js +2 -0
  25. package/dist/lib/chunks/{index-ynjdey8j.js → index-8h9c8ekq.js} +4 -2
  26. package/dist/lib/chunks/{index-6re28wc1.js → index-b77xqap3.js} +13 -1
  27. package/dist/lib/chunks/{index-10g918kt.js → index-p86sy3y4.js} +1 -1
  28. package/dist/lib/chunks/{index-4at214g0.js → index-y3v46yjp.js} +314 -27
  29. package/dist/lib/chunks/{murmur-c1c79eh8.js → murmur-t36hd4vt.js} +2 -2
  30. package/dist/lib/chunks/{retriever-h8nz6jsc.js → retriever-wxshtnm0.js} +1 -1
  31. package/dist/lib/embed.js +4 -2
  32. package/dist/lib/index.js +5 -3
  33. package/dist/lib/indexer/index.js +2 -0
  34. package/dist/lib/local/index.js +163 -0
  35. package/dist/lib/rag/index.js +13 -11
  36. package/dist/lib/widget/index.js +2 -2
  37. package/dist/types/local/index.d.ts +56 -0
  38. package/dist/types/rag/ground.d.ts +7 -0
  39. package/dist/types/rag/index.d.ts +1 -1
  40. package/dist/types/widget/element.d.ts +3 -0
  41. package/dist/types/widget/i18n.d.ts +14 -0
  42. package/dist/types/widget/session.d.ts +32 -1
  43. package/dist/types/widget/styles.d.ts +1 -1
  44. package/package.json +17 -3
  45. package/dist/cdn/anthropic-w7nkjk5e.js +0 -2
  46. package/dist/cdn/chunk-e0j28zmb.js +0 -1
  47. package/dist/cdn/embed-2xm309sb.js +0 -7
  48. package/dist/cdn/embed-n7jskdxd.js +0 -44
  49. package/dist/cdn/embed-sgjh2kg2.js +0 -83
  50. package/dist/cdn/google-qha5xyx4.js +0 -14
  51. package/dist/cdn/index-11c9cspb.js +0 -1
  52. package/dist/cdn/index-e5entetm.js +0 -1
  53. package/dist/cdn/index-hv290nbv.js +0 -9
  54. package/dist/cdn/index-kk9hgxdc.js +0 -1
  55. package/dist/cdn/mistral-16bekg8b.js +0 -3
  56. package/dist/cdn/murmur-bnm335nb.js +0 -5
  57. package/dist/cdn/openai-compatible-za7hc1fv.js +0 -11
  58. package/dist/cdn/openai-dhy4fp4c.js +0 -18
  59. package/dist/cdn/retriever-m8peqj5t.js +0 -1
@@ -1,83 +0,0 @@
1
- var Cf=Symbol.for("vercel.ai.error"),m=class G extends Error{constructor({name:oe,message:$e,cause:Pe}){super($e);this[Cf]=!0,this.name=oe,this.cause=Pe}static isInstance(oe){return G.hasMarker(oe,"vercel.ai.error")}static hasMarker(oe,$e){let Pe=Symbol.for($e);return oe!=null&&typeof oe==="object"&&Pe in oe&&typeof oe[Pe]==="boolean"&&oe[Pe]===!0}},rs="AI_DecisionUnsupportedQuestionTypeError",ns=`vercel.ai.error.${rs}`,Nf=Symbol.for(ns),zt=class extends m{constructor({questionId:G,questionType:oe,provider:$e,modelId:Pe,message:Ee=`Question "${G}" has type "${oe}", which is not supported by provider "${$e}" and model "${Pe}".`}){super({name:rs,message:Ee});this[Nf]=!0,this.questionId=G,this.questionType=oe,this.provider=$e,this.modelId=Pe}static isInstance(G){return m.hasMarker(G,ns)}},os="AI_APICallError",is=`vercel.ai.error.${os}`,Rf=Symbol.for(is),v=class extends m{constructor({message:G,url:oe,requestBodyValues:$e,statusCode:Pe,responseHeaders:Ee,responseBody:Fe,cause:Ue,isRetryable:Be=Pe!=null&&(Pe===408||Pe===409||Pe===429||Pe>=500),data:Xe}){super({name:os,message:G,cause:Ue});this[Rf]=!0,this.url=oe,this.requestBodyValues=$e,this.statusCode=Pe,this.responseHeaders=Ee,this.responseBody=Fe,this.isRetryable=Be,this.data=Xe}static isInstance(G){return m.hasMarker(G,is)}},ss="AI_EmptyResponseBodyError",cs=`vercel.ai.error.${ss}`,Df=Symbol.for(cs),Dn=class extends m{constructor({message:G="Empty response body"}={}){super({name:ss,message:G});this[Df]=!0}static isInstance(G){return m.hasMarker(G,cs)}},Mf="AI_DecisionRefusalError",Xh=`vercel.ai.error.${Mf}`;function R(G){if(G==null)return"unknown error";if(typeof G==="string")return G;if(G instanceof Error)return G.toString();return JSON.stringify(G)}var as="AI_InvalidArgumentError",us=`vercel.ai.error.${as}`,Lf=Symbol.for(us),b=class extends m{constructor({message:G,cause:oe,argument:$e}){super({name:as,message:G,cause:oe});this[Lf]=!0,this.argument=$e}static isInstance(G){return m.hasMarker(G,us)}},ls="AI_InvalidPromptError",fs=`vercel.ai.error.${ls}`,jf=Symbol.for(fs),ye=class extends m{constructor({prompt:G,message:oe,cause:$e}){super({name:ls,message:`Invalid prompt: ${oe}`,cause:$e});this[jf]=!0,this.prompt=G}static isInstance(G){return m.hasMarker(G,fs)}},ps="AI_InvalidResponseDataError",ds=`vercel.ai.error.${ps}`,Ff=Symbol.for(ds),A=class extends m{constructor({data:G,message:oe=`Invalid response data: ${JSON.stringify(G)}.`}){super({name:ps,message:oe});this[Ff]=!0,this.data=G}static isInstance(G){return m.hasMarker(G,ds)}},ms="AI_JSONParseError",hs=`vercel.ai.error.${ms}`,Uf=Symbol.for(hs),Me=class extends m{constructor({text:G,cause:oe}){super({name:ms,message:`JSON parsing failed: Text: ${G}.
2
- Error message: ${R(oe)}`,cause:oe});this[Uf]=!0,this.text=G}static isInstance(G){return m.hasMarker(G,hs)}},gs="AI_LoadAPIKeyError",ys=`vercel.ai.error.${gs}`,Bf=Symbol.for(ys),fn=class extends m{constructor({message:G}){super({name:gs,message:G});this[Bf]=!0}static isInstance(G){return m.hasMarker(G,ys)}},Jf="AI_LoadSettingError",Yh=`vercel.ai.error.${Jf}`;var Vf="AI_NoContentGeneratedError",Qh=`vercel.ai.error.${Vf}`;var _s="AI_NoSuchModelError",vs=`vercel.ai.error.${_s}`,Wf=Symbol.for(vs),Ze=class extends m{constructor({errorName:G=_s,modelId:oe,modelType:$e,message:Pe=`No such ${$e}: ${oe}`}){super({name:G,message:Pe});this[Wf]=!0,this.modelId=oe,this.modelType=$e}static isInstance(G){return m.hasMarker(G,vs)}},bs="AI_NoSuchProviderReferenceError",xs=`vercel.ai.error.${bs}`,Kf=Symbol.for(xs),ws=class extends m{constructor({provider:G,reference:oe,message:$e=`No provider reference found for provider '${G}'. Available providers: ${Object.keys(oe).join(", ")}`}){super({name:bs,message:$e});this[Kf]=!0,this.provider=G,this.reference=oe}static isInstance(G){return m.hasMarker(G,xs)}},$s="AI_TooManyEmbeddingValuesForCallError",zs=`vercel.ai.error.${$s}`,Hf=Symbol.for(zs),me=class extends m{constructor(G){super({name:$s,message:`Too many values for a single embedding call. The ${G.provider} model "${G.modelId}" can only embed up to ${G.maxEmbeddingsPerCall} values per call, but ${G.values.length} values were provided.`});this[Hf]=!0,this.provider=G.provider,this.modelId=G.modelId,this.maxEmbeddingsPerCall=G.maxEmbeddingsPerCall,this.values=G.values}static isInstance(G){return m.hasMarker(G,zs)}},Ss="AI_TypeValidationError",ks=`vercel.ai.error.${Ss}`,qf=Symbol.for(ks),be=class G extends m{constructor({value:oe,cause:$e,context:Pe}){let Ee="Type validation failed";if(Pe?.field)Ee+=` for ${Pe.field}`;if(Pe?.entityName||Pe?.entityId){Ee+=" (";let Fe=[];if(Pe.entityName)Fe.push(Pe.entityName);if(Pe.entityId)Fe.push(`id: "${Pe.entityId}"`);Ee+=Fe.join(", "),Ee+=")"}super({name:Ss,message:`${Ee}: Value: ${JSON.stringify(oe)}.
3
- Error message: ${R($e)}`,cause:$e});this[qf]=!0,this.value=oe,this.context=Pe}static isInstance(oe){return m.hasMarker(oe,ks)}static wrap({value:oe,cause:$e,context:Pe}){if(G.isInstance($e)&&$e.value===oe&&$e.context?.field===Pe?.field&&$e.context?.entityName===Pe?.entityName&&$e.context?.entityId===Pe?.entityId)return $e;return new G({value:oe,cause:$e,context:Pe})}},Ps="AI_UnsupportedFunctionalityError",Es=`vercel.ai.error.${Ps}`,Gf=Symbol.for(Es),u=class extends m{constructor({functionality:G,message:oe=`'${G}' functionality not supported.`}){super({name:Ps,message:oe});this[Gf]=!0,this.functionality=G}static isInstance(G){return m.hasMarker(G,Es)}};function xo(G){if(G===null||typeof G==="string"||typeof G==="number"||typeof G==="boolean")return!0;if(Array.isArray(G))return G.every(xo);if(typeof G==="object")return Object.entries(G).every(([oe,$e])=>typeof oe==="string"&&($e===void 0||xo($e)));return!1}function et(G){return G!=null&&typeof G==="object"&&Object.entries(G).every(([oe,$e])=>typeof oe==="string"&&($e===void 0||xo($e)))}function hn(G){let oe=Object.values(G).filter((Pe)=>typeof Pe==="number");return Object.entries(G).filter(([Pe,Ee])=>oe.indexOf(+Pe)===-1).map(([Pe,Ee])=>Ee)}function $o(G,oe="|"){return G.map(($e)=>ko($e)).join(oe)}function gn(G,oe){if(typeof oe==="bigint")return oe.toString();return oe}class Ts{constructor(G){this._getter=G,this._value=void 0}get value(){let G=this._getter;if(G!==void 0)this._value=G(),this._getter=void 0;return this._value}}function yn(G){return new Ts(G)}function Zs(G){return G===null||G===void 0}function Mn(G){let oe=G.startsWith("^")?1:0,$e=G.endsWith("$")?G.length-1:G.length;return G.slice(oe,$e)}function As(G,oe){let $e=G/oe,Pe=Math.round($e),Ee=4*Number.EPSILON*Math.max(Math.abs($e),1);if(Math.abs($e-Pe)<Ee)return 0;return $e-Pe}var Os=Symbol("evaluating");function Is(G,oe,$e){let Pe=void 0;Object.defineProperty(G,oe,{get(){if(Pe===Os)return;if(Pe===void 0)Pe=Os,Pe=$e();return Pe},set(Ee){Object.defineProperty(G,oe,{value:Ee})},configurable:!0})}function dr(G,oe,$e){Object.defineProperty(G,oe,{value:$e,writable:!0,enumerable:!0,configurable:!0})}function vn(G){let oe=Object.getOwnPropertyDescriptor(G,"shape");return oe?.get?oe.get.raw:oe?.value}function Zr(G){return vn(G._zod.def)??G._zod.def.shape}function Cs(G,oe,$e){Object.defineProperty(G,oe,{get(){let Pe=$e();return dr(this,oe,Pe),Pe},enumerable:!0,configurable:!0})}function Ns(G,oe,$e){if(oe in G)dr(G,oe,$e);else G[oe]=$e}function Ur(G,oe,$e,Pe){let Ee=Zr(oe);for(let Fe of $e){let Ue=Object.getOwnPropertyDescriptor(Ee,Fe);if(!Ue.enumerable)continue;if(Ue.get)Cs(G,Fe,()=>{let Be=oe._zod.def.shape[Fe];return Pe?Pe(Be,Fe):Be});else Ns(G,Fe,Pe?Pe(Ue.value,Fe):Ue.value)}}function Xf(G,oe){for(let $e of Reflect.ownKeys(oe)){let Pe=Object.getOwnPropertyDescriptor(oe,$e);if(!Pe.enumerable)continue;if(Pe.get)Cs(G,$e,()=>oe[$e]);else Ns(G,$e,Pe.value)}}function mr(...G){let oe={};for(let $e of G){let Pe=Object.getOwnPropertyDescriptors($e);Object.assign(oe,Pe)}return Object.defineProperties({},oe)}function Rs(G){return JSON.stringify(G)}function Ds(G){return G.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var zo="captureStackTrace"in Error?Error.captureStackTrace:(...G)=>{};function Hr(G){return typeof G==="object"&&G!==null&&!Array.isArray(G)}var Ms=yn(()=>{if(lr.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(G){return!1}});function Br(G){if(Hr(G)===!1)return!1;let oe=G.constructor;if(oe===void 0)return!0;if(typeof oe!=="function")return!0;let $e=oe.prototype;if(Hr($e)===!1)return!1;if(Object.prototype.hasOwnProperty.call($e,"isPrototypeOf")===!1)return!1;return!0}function So(G){if(Br(G))return{...G};if(Array.isArray(G))return[...G];if(G instanceof Map)return new Map(G);if(G instanceof Set)return new Set(G);return G}var Ls=new Set(["string","number","symbol"]);function Mr(G){return G.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kr(G,oe,$e){let Pe=new G._zod.constr(oe??G._zod.def);if(!oe||$e?.parent)Pe._zod.parent=G;return Pe}function kt(G){let oe=G;if(!oe)return{};if(typeof oe==="string")return{error:()=>oe};if(oe?.message!==void 0){if(oe?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");oe.error=oe.message}if(delete oe.message,typeof oe.error==="string")return{...oe,error:()=>oe.error};return oe}function ko(G){if(typeof G==="bigint")return G.toString()+"n";if(typeof G==="string")return`"${G}"`;return`${G}`}function js(G){return Object.keys(G).filter((oe)=>G[oe]._zod.optin!==void 0&&G[oe]._zod.optout==="optional")}var Ln=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Po={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Yf(G,oe){let $e=G._zod.def,Pe=$e.checks;if(Pe&&Pe.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let Fe={};return Ur(Fe,G,jn(G,oe)),kr(G,mr($e,{shape:Fe,checks:[]}))}function jn(G,oe){let $e=Zr(G),Pe=[];for(let Ee of Reflect.ownKeys(oe)){if(!Object.getOwnPropertyDescriptor($e,Ee)?.enumerable)throw Error(`Unrecognized key: "${String(Ee)}"`);if(oe[Ee])Pe.push(Ee)}return Pe}function Qf(G,oe){let $e=G._zod.def,Pe=$e.checks;if(Pe&&Pe.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let Fe=new Set(jn(G,oe)),Ue={};return Ur(Ue,G,Reflect.ownKeys(Zr(G)).filter((Be)=>!Fe.has(Be))),kr(G,mr($e,{shape:Ue,checks:[]}))}function ep(G,oe){if(!Br(oe))throw Error("Invalid input to extend: expected a plain object");let $e=G._zod.def.checks;if($e&&$e.length>0){let Ee=Zr(G);for(let Fe of Reflect.ownKeys(oe))if(Object.getOwnPropertyDescriptor(Ee,Fe)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return kr(G,mr(G._zod.def,{shape:Fs(G,oe)}))}function Fs(G,oe){let $e={};return Ur($e,G,Reflect.ownKeys(Zr(G))),Xf($e,oe),$e}function tp(G,oe){if(!Br(oe))throw Error("Invalid input to safeExtend: expected a plain object");return kr(G,mr(G._zod.def,{shape:Fs(G,oe)}))}function rp(G,oe){if(!oe?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(G._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let $e={};Ur($e,G,Reflect.ownKeys(Zr(G))),Ur($e,oe,Reflect.ownKeys(Zr(oe)));let Pe=mr(G._zod.def,{shape:$e,get catchall(){return oe._zod.def.catchall},checks:oe._zod.def.checks??[]});return kr(G,Pe)}function Us(G,oe,$e,Pe="partial"){let Fe=oe._zod.def.checks;if(Fe&&Fe.length>0)throw Error(`.${Pe}() cannot be used on object schemas containing refinements`);let Be=$e?new Set(jn(oe,$e)):void 0,Xe={};return Ur(Xe,oe,Reflect.ownKeys(Zr(oe)),G&&((Ye,Qe)=>Be&&!Be.has(Qe)?Ye:new G({type:"optional",innerType:Ye}))),kr(oe,mr(oe._zod.def,{shape:Xe,checks:[]}))}function np(G,oe,$e){let Pe=$e?new Set(jn(oe,$e)):void 0,Ee={};return Ur(Ee,oe,Reflect.ownKeys(Zr(oe)),(Fe,Ue)=>Pe&&!Pe.has(Ue)?Fe:new G({type:"nonoptional",innerType:Fe})),kr(oe,mr(oe._zod.def,{shape:Ee}))}function vr(G,oe=0){if(G.aborted===!0)return!0;for(let $e=oe;$e<G.issues.length;$e++)if(G.issues[$e]?.continue!==!0)return!0;return!1}function Bs(G,oe=0){if(G.aborted===!0)return!0;for(let $e=oe;$e<G.issues.length;$e++)if(G.issues[$e]?.continue===!1)return!0;return!1}function br(G,oe){return oe.map(($e)=>{var Pe;return(Pe=$e).path??(Pe.path=[]),$e.path.unshift(G),$e})}function mn(G){return typeof G==="string"?G:G?.message}function Eo(G){let oe=[];for(let $e of G??[]){let Pe=$e._zod.def;if(!/_(length|size)$|_equals$/.test(Pe.check))break;let Ee=Pe.maximum??Pe.length??Pe.size;if(Ee>=0)oe.push([Ee,$e])}return oe}function Fn(G,oe,$e){var Pe;for(let Ee=oe;Ee<G.length;Ee++)(Pe=G[Ee]).schema??(Pe.schema=$e)}function Pr(G,oe,$e){var Pe;let Ee=G.inst?._zod?.traits;if(Ee?.has("$ZodType"))if(Ee.has("$ZodCheck"))(Pe=G).schema??(Pe.schema=G.inst);else G.schema=G.inst;let Fe=G.schema!==G.inst?G.schema?._zod.def?.error:void 0,Ue=G.message?G.message:mn(G.inst?._zod.def?.error?.(G))??mn(Fe?.(G))??mn(oe?.error?.(G))??mn($e.customError?.(G))??mn($e.localeError?.(G))??"Invalid input",Be={};for(let Xe of Object.keys(G)){if(Xe==="inst"||Xe==="schema"||Xe==="continue"||Xe==="input"||Xe==="__proto__")continue;Be[Xe]=G[Xe]}if(Be.path??(Be.path=[]),Be.message=Ue,oe?.reportInput)Be.input=G.input;return Be}var op=/[\uD800-\uDBFF]/;function Un(G){let oe=G.length;if(!op.test(G))return oe;let $e=oe;for(let Pe=0;Pe<oe-1;Pe++)if((G.charCodeAt(Pe)&64512)===55296&&(G.charCodeAt(Pe+1)&64512)===56320)$e--,Pe++;return $e}function Bn(G){if(Array.isArray(G))return"array";if(typeof G==="string")return"string";return"unknown"}function Js(G){let oe=typeof G;switch(oe){case"number":return Number.isNaN(G)?"nan":"number";case"object":{if(G===null)return"null";if(Array.isArray(G))return"array";let $e=G;if($e&&Object.getPrototypeOf($e)!==Object.prototype&&"constructor"in $e&&$e.constructor)return $e.constructor.name}}return oe}function Jr(...G){let[oe,$e,Pe]=G;if(typeof oe==="string")return{message:oe,code:"custom",input:$e,inst:Pe};return{...oe}}function Vs(G,oe){for(let $e in oe){let Pe=Object.getOwnPropertyDescriptor(oe,$e);if(Pe.get)Object.defineProperty(G,$e,{...Pe,enumerable:!1});else ip(G,$e,Pe.value)}}function Ar(G,oe,$e,Pe=!0){return Object.defineProperty(G,oe,{configurable:!0,writable:!0,enumerable:Pe,value:$e}),$e}function bn(G,oe,$e){return Ar(G,oe,$e,!1)}function Jn(G,oe){for(let $e in G){let Pe=G[$e];Object.defineProperty(oe,$e,{configurable:!0,enumerable:!0,get(){return Ar(this,$e,Pe(this))},set(Ee){Ar(this,$e,Ee)}})}return oe}function ip(G,oe,$e){Object.defineProperty(G,oe,{configurable:!0,get(){return this==null?$e:Ar(this,oe,$e.bind(this))},set(Pe){Ar(this,oe,Pe)}})}function sp(G,oe){let $e=Object.getPrototypeOf(G);return oe in $e?void 0:$e}var wo,Dr=!1,cp={configurable:!0,get(){Dr=!0;return}};function Nt(G,oe,$e){let Pe=Object.getPrototypeOf(G._zod);if(oe in Pe&&wo!==G._zod){wo=void 0;return}wo=G._zod,Object.defineProperty(Pe,oe,{configurable:!0,get(){Object.defineProperty(this,oe,cp);let Ee=Dr;Dr=!1;try{let Fe=$e(this);if(Dr)delete this[oe];else Object.defineProperty(this,oe,{configurable:!0,writable:!0,value:Fe});return Dr=Dr||Ee,Fe}catch(Fe){throw delete this[oe],Dr=Dr||Ee,Fe}},set(Ee){Object.defineProperty(this,oe,{configurable:!0,writable:!0,value:Ee})}})}function ap(G,oe,$e,Pe){let Ee=sp(G,oe);if(!Ee)return;Object.defineProperty(Ee,oe,{configurable:!0,get(){let Fe={configurable:!0,writable:!0,enumerable:Pe,value:void 0};return Object.defineProperty(this,oe,Fe),Fe.value=$e(this),Object.defineProperty(this,oe,Fe),Fe.value},set(Fe){Object.defineProperty(this,oe,{configurable:!0,writable:!0,enumerable:Pe,value:Fe})}})}var up="~constantCatch";function Ws(G){let oe=()=>G;return oe[up]=!0,oe}var Ks;var Oo={value:void 0,enumerable:!1},Hs="captureStackTrace"in Error?Error:null;function lp(G){let oe=Hs;if(oe){let $e=oe.stackTraceLimit;if(typeof $e==="number"){try{oe.stackTraceLimit=0}catch{return Hs=null,new G}try{return new G}finally{oe.stackTraceLimit=$e}}}return new G}function ht(G,oe,$e,Pe){let Ee={};function Fe(pt){this.def=pt,this.constr=ft,this.traits=new Set}Fe.prototype=Ee;let Ue=$e,Be=Ue&&new WeakSet;function Xe(pt,mt){if(!pt._zod){Oo.value=new Fe(mt);try{Object.defineProperty(pt,"_zod",Oo)}finally{Oo.value=void 0}}else if(pt._zod.traits.has(G))return;if(pt._zod.traits.add(G),oe(pt,mt),Be){let St=Object.getPrototypeOf(pt),Tt=pt._zod.constr.prototype,It=St;while(It&&It!==Tt)It=Object.getPrototypeOf(It);let ir=It??St;if(!Be.has(ir))Be.add(ir),Vs(ir,Ue)}let gt=ft.prototype;for(let St in gt){if(!Object.prototype.hasOwnProperty.call(gt,St))continue;if(!(St in pt))pt[St]=gt[St].bind(pt)}}let Ye=Pe?.Parent??Object;class Qe extends Ye{}Object.defineProperty(Qe,"name",{value:G});function ft(pt){let mt=Pe?.Parent?lp(Qe):this;Xe(mt,pt);let gt=mt._zod.deferred;if(gt){for(let Tt of gt)Tt();mt._zod.deferred=void 0}let St=globalThis.__zod_globalConfig?.postProcessor;if(St)St(mt);return mt}return Object.defineProperty(ft,"init",{value:Xe}),Object.defineProperty(ft,Symbol.hasInstance,{value:(pt)=>{if(Pe?.Parent&&pt instanceof Pe.Parent)return!0;return pt?._zod?.traits?.has(G)}}),Object.defineProperty(ft,"name",{value:G}),ft}class Er extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xn extends Error{constructor(G){super(`Encountered unidirectional transform during encode: ${G}`);this.name="ZodEncodeError"}}(Ks=globalThis).__zod_globalConfig??(Ks.__zod_globalConfig={});var lr=globalThis.__zod_globalConfig;function hr(G){if(G)Object.assign(lr,G);return lr}function fp(){let G=this._zod;return G.message??(G.message=JSON.stringify(G.def,gn,2)),G.message}function pp(G){this._zod.message=G}var dp={get:fp,set:pp,enumerable:!0,configurable:!0},Zo={value:void 0,enumerable:!1},qs=new WeakSet([Object.prototype,Error.prototype]),Gs=(G,oe)=>{G.name="$ZodError",Zo.value=oe,Object.defineProperty(G,"issues",Zo),Zo.value=void 0,Object.defineProperty(G,"message",dp);let $e=Object.getPrototypeOf(G);if(!qs.has($e))qs.add($e),Object.defineProperty($e,"toString",{configurable:!0,enumerable:!1,get(){let Pe=()=>this.message;return Object.defineProperty(this,"toString",{value:Pe,configurable:!0,writable:!0}),Pe},set(Pe){Object.defineProperty(this,"toString",{value:Pe,configurable:!0,writable:!0})}})},Xs=ht("$ZodError",Gs),gg=ht("$ZodError",Gs,void 0,{Parent:Error});function mp(G,oe,$e){if(!Object.prototype.hasOwnProperty.call(G,oe))if(oe==="__proto__")Object.defineProperty(G,oe,{value:$e(),writable:!0,enumerable:!0,configurable:!0});else G[oe]=$e();return G[oe]}function Ys(G,oe=($e)=>$e.message){let $e={},Pe=[];for(let Ee of G.issues)if(Ee.path.length>0)mp($e,Ee.path[0],()=>[]).push(oe(Ee));else Pe.push(oe(Ee));return{formErrors:Pe,fieldErrors:$e}}function Qs(G,oe=($e)=>$e.message){let $e={_errors:[]},Pe=(Ee,Fe=[])=>{for(let Ue of Ee.issues)if(Ue.code==="invalid_union"&&Ue.errors.length)Ue.errors.map((Be)=>Pe({issues:Be},[...Fe,...Ue.path]));else if(Ue.code==="invalid_key")Pe({issues:Ue.issues},[...Fe,...Ue.path]);else if(Ue.code==="invalid_element")Pe({issues:Ue.issues},[...Fe,...Ue.path]);else{let Be=[...Fe,...Ue.path];if(Be.length===0)$e._errors.push(oe(Ue));else{let Xe=$e,Ye=0;while(Ye<Be.length){let Qe=Be[Ye],ft=Ye===Be.length-1;if(Qe==="_errors"){if(ft)Xe._errors.push(oe(Ue));Ye++;continue}if(!Object.prototype.hasOwnProperty.call(Xe,Qe))Object.defineProperty(Xe,Qe,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let pt=Xe[Qe];if(ft)pt._errors.push(oe(Ue));Xe=pt,Ye++}}}};return Pe(G),$e}function Vn(G,oe){return{callee:oe?.callee??G,Err:oe?.Err}}var Wn=(G)=>{let oe=($e,Pe,Ee,Fe)=>{let Ue=Ee?{...Ee,async:!1}:{async:!1},Be=$e._zod.run({value:Pe,issues:[]},Ue);if(Be instanceof Promise)throw new Er;if(Be.issues.length){let Xe=new(Fe?.Err??G)(Be.issues.map((Ye)=>Pr(Ye,Ue,hr())));throw zo(Xe,Fe?.callee??oe),Xe}return Be.value};return oe};var Kn=(G)=>{let oe=async($e,Pe,Ee,Fe)=>{let Ue=Ee?{...Ee,async:!0}:{async:!0},Be=$e._zod.run({value:Pe,issues:[]},Ue);if(Be instanceof Promise)Be=await Be;if(Be.issues.length){let Xe=new(Fe?.Err??G)(Be.issues.map((Ye)=>Pr(Ye,Ue,hr())));throw zo(Xe,Fe?.callee??oe),Xe}return Be.value};return oe};var Hn=(G)=>(oe,$e,Pe)=>{let Ee=Pe?{...Pe,async:!1}:{async:!1},Fe=oe._zod.run({value:$e,issues:[]},Ee);if(Fe instanceof Promise)throw new Er;return Fe.issues.length?ec(G,Fe.issues,Ee):{success:!0,data:Fe.value}};function ec(G,oe,$e){let Pe;return{success:!1,get error(){if(!Pe)Pe=new G(oe.map((Ee)=>Pr(Ee,$e,hr()))),oe=void 0,$e=void 0;return Pe},set error(Ee){Pe=Ee,oe=void 0,$e=void 0}}}var qn=(G)=>async(oe,$e,Pe)=>{let Ee=Pe?{...Pe,async:!0}:{async:!0},Fe=oe._zod.run({value:$e,issues:[]},Ee);if(Fe instanceof Promise)Fe=await Fe;return Fe.issues.length?ec(G,Fe.issues,Ee):{success:!0,data:Fe.value}};var hp=Symbol.for("zod.compile.invalid"),gp=Symbol.for("zod.compile.fallback"),Ao=(G,oe,$e)=>{let Pe=G._zod.bag.validator;if(Pe!==void 0){if(Pe(oe)!==hp)return!0;if(Pe.definite===!0&&$e===void 0)return!1}return yp(G,oe,$e)};function yp(G,oe,$e){let Pe=$e?{...$e,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},Ee=G._zod.bag.fallbackRun,Fe;if(Ee)Pe[gp]=!0,Fe=Ee({value:oe,issues:[]},Pe);else Fe=G._zod.run({value:oe,issues:[]},Pe);if(Fe instanceof Promise)throw new Er;return Fe.issues.length===0}var Io=async(G,oe,$e)=>{let Pe=$e?{...$e,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},Ee=G._zod.run({value:oe,issues:[]},Pe);if(Ee instanceof Promise)Ee=await Ee;return Ee.issues.length===0},tc=(G)=>{let oe=Wn(G),$e=(Pe,Ee,Fe,Ue)=>{let Be=Fe?{...Fe,direction:"backward"}:{direction:"backward"};return oe(Pe,Ee,Be,Vn($e,Ue))};return $e};var rc=(G)=>{let oe=Wn(G),$e=(Pe,Ee,Fe,Ue)=>oe(Pe,Ee,Fe,Vn($e,Ue));return $e};var nc=(G)=>{let oe=Kn(G),$e=async(Pe,Ee,Fe,Ue)=>{let Be=Fe?{...Fe,direction:"backward"}:{direction:"backward"};return await oe(Pe,Ee,Be,Vn($e,Ue))};return $e};var oc=(G)=>{let oe=Kn(G),$e=async(Pe,Ee,Fe,Ue)=>await oe(Pe,Ee,Fe,Vn($e,Ue));return $e};var ic=(G)=>(oe,$e,Pe)=>{let Ee=Pe?{...Pe,direction:"backward"}:{direction:"backward"};return Hn(G)(oe,$e,Ee)};var sc=(G)=>(oe,$e,Pe)=>Hn(G)(oe,$e,Pe);var cc=(G)=>async(oe,$e,Pe)=>{let Ee=Pe?{...Pe,direction:"backward"}:{direction:"backward"};return qn(G)(oe,$e,Ee)};var ac=(G)=>async(oe,$e,Pe)=>qn(G)(oe,$e,Pe);var uc=/^[cC][0-9a-z]{6,}$/,lc=/^[0-9a-z]+$/,fc=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,pc=/^[0-9a-vA-V]{20}$/,dc=/^[A-Za-z0-9]{27}$/,mc=/^[a-zA-Z0-9_-]{21}$/;function hc(G){return new RegExp(`^[a-zA-Z0-9_-]{${G}}$`)}var gc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var yc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,No=(G)=>{if(!G)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${G}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var _c=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var _p="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function vc(){return new RegExp(_p,"u")}var bc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var wc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$c=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sc=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var kc=/^https?$/,Pc=/^\+[1-9]\d{6,14}$/;var Ec="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function vp(G){return new RegExp(`^${G}$`)}var Oc=vp(Ec);function Co(G){return typeof G.precision==="number"?G.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":G.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${G.precision}}`:G.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Tc(G){return new RegExp(`^${Co(G)}$`)}function Zc(G){let oe=["Z"];if(G.offset)oe.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let $e=`${Co({precision:G.precision,seconds:!0})}(?:${oe.join("|")})`,Pe=G.local?`${$e}|${Co({precision:G.precision})}`:$e;return new RegExp(`^${Ec}T(?:${Pe})$`)}var Ac=/^[\s\S]{0,}$/;var Ic=/^-?\d+n?$/,Ro=/^-?\d+$/,wn=/^-?\d+(?:\.\d+)?$/,Cc=/^(?:true|false)$/i,Nc=/^null$/i;var Rc=/^[^A-Z]*$/,Dc=/^[^a-z]*$/;var cr=ht("$ZodCheck",(G,oe)=>{var $e;G._zod??(G._zod={}),G._zod.def=oe,($e=G._zod).onattach??($e.onattach=[])});var Do=(G)=>{let oe=G.value;return!Zs(oe)&&oe.length!==void 0},Gn={number:"number",bigint:"bigint",object:"date"},Mo=ht("$ZodCheckLessThan",(G,oe)=>{cr.init(G,oe);let $e=Gn[typeof oe.value];G._zod.check=(Pe)=>{if(oe.inclusive?Pe.value<=oe.value:Pe.value<oe.value)return;Pe.issues.push({origin:Gn[typeof Pe.value]??$e,code:"too_big",maximum:typeof oe.value==="object"?oe.value.getTime():oe.value,input:Pe.value,inclusive:oe.inclusive,inst:G,continue:!oe.abort})}}),Lo=ht("$ZodCheckGreaterThan",(G,oe)=>{cr.init(G,oe);let $e=Gn[typeof oe.value];G._zod.check=(Pe)=>{if(oe.inclusive?Pe.value>=oe.value:Pe.value>oe.value)return;Pe.issues.push({origin:Gn[typeof Pe.value]??$e,code:"too_small",minimum:typeof oe.value==="object"?oe.value.getTime():oe.value,input:Pe.value,inclusive:oe.inclusive,inst:G,continue:!oe.abort})}}),Lc=ht("$ZodCheckMultipleOf",(G,oe)=>{cr.init(G,oe),G._zod.check=($e)=>{if(typeof $e.value!==typeof oe.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof $e.value==="bigint"?oe.value!==BigInt(0)&&$e.value%oe.value===BigInt(0):As($e.value,oe.value)===0)return;$e.issues.push({origin:typeof $e.value,code:"not_multiple_of",divisor:oe.value,input:$e.value,inst:G,continue:!oe.abort})}}),jc=ht("$ZodCheckNumberFormat",(G,oe)=>{cr.init(G,oe),oe.format=oe.format||"float64";let $e=oe.format?.includes("int"),Pe=$e?"int":"number",[Ee,Fe]=Ln[oe.format];G._zod.check=(Ue)=>{let Be=Ue.value;if($e){if(!Number.isInteger(Be)){Ue.issues.push({expected:Pe,format:oe.format,code:"invalid_type",continue:!1,input:Be,inst:G});return}if(!Number.isSafeInteger(Be)){if(Be>0)Ue.issues.push({input:Be,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:G,origin:Pe,inclusive:!0,continue:!oe.abort});else Ue.issues.push({input:Be,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:G,origin:Pe,inclusive:!0,continue:!oe.abort});return}}if(Be<Ee)Ue.issues.push({origin:"number",input:Be,code:"too_small",minimum:Ee,inclusive:!0,inst:G,continue:!oe.abort});if(Be>Fe)Ue.issues.push({origin:"number",input:Be,code:"too_big",maximum:Fe,inclusive:!0,inst:G,continue:!oe.abort})}});var Fc=ht("$ZodCheckMaxLength",(G,oe)=>{var $e;cr.init(G,oe),($e=G._zod.def).when??($e.when=Do),G._zod.check=(Pe)=>{let Ee=Pe.value,Fe=Ee.length;if((typeof Ee==="string"&&Fe>oe.maximum?Un(Ee):Fe)<=oe.maximum)return;let Be=Bn(Ee);Pe.issues.push({origin:Be,code:"too_big",maximum:oe.maximum,inclusive:!0,input:Ee,inst:G,continue:!oe.abort})}}),Uc=ht("$ZodCheckMinLength",(G,oe)=>{var $e;cr.init(G,oe),($e=G._zod.def).when??($e.when=Do),G._zod.check=(Pe)=>{let Ee=Pe.value,Fe=Ee.length;if((typeof Ee==="string"&&Fe>=oe.minimum&&Fe<oe.minimum*2?Un(Ee):Fe)>=oe.minimum)return;let Be=Bn(Ee);Pe.issues.push({origin:Be,code:"too_small",minimum:oe.minimum,inclusive:!0,input:Ee,inst:G,continue:!oe.abort})}}),Bc=ht("$ZodCheckLengthEquals",(G,oe)=>{var $e;cr.init(G,oe),($e=G._zod.def).when??($e.when=Do),G._zod.check=(Pe)=>{let Ee=Pe.value,Fe=Ee.length,Ue=typeof Ee==="string"&&Fe>=oe.length&&Fe<=oe.length*2?Un(Ee):Fe;if(Ue===oe.length)return;let Be=Bn(Ee),Xe=Ue>oe.length;Pe.issues.push({origin:Be,...Xe?{code:"too_big",maximum:oe.length}:{code:"too_small",minimum:oe.length},inclusive:!0,exact:!0,input:Pe.value,inst:G,continue:!oe.abort})}}),zn=ht("$ZodCheckStringFormat",(G,oe)=>{var $e,Pe;if(cr.init(G,oe),oe.pattern)($e=G._zod).check??($e.check=(Ee)=>{if(oe.pattern.lastIndex=0,oe.pattern.test(Ee.value))return;Ee.issues.push({origin:"string",code:"invalid_format",format:oe.format,input:Ee.value,...oe.pattern?{pattern:oe.pattern.toString()}:{},inst:G,continue:!oe.abort})});else(Pe=G._zod).check??(Pe.check=()=>{})}),Jc=ht("$ZodCheckRegex",(G,oe)=>{zn.init(G,oe),G._zod.check=($e)=>{if(oe.pattern.lastIndex=0,oe.pattern.test($e.value))return;$e.issues.push({origin:"string",code:"invalid_format",format:"regex",input:$e.value,pattern:oe.pattern.toString(),inst:G,continue:!oe.abort})}}),Vc=ht("$ZodCheckLowerCase",(G,oe)=>{oe.pattern??(oe.pattern=Rc),zn.init(G,oe)}),Wc=ht("$ZodCheckUpperCase",(G,oe)=>{oe.pattern??(oe.pattern=Dc),zn.init(G,oe)}),Kc=ht("$ZodCheckIncludes",(G,oe)=>{cr.init(G,oe);let $e=Mr(oe.includes),Pe=new RegExp(typeof oe.position==="number"?`^.{${oe.position},}${$e}`:$e);oe.pattern=Pe,G._zod.check=(Ee)=>{if(Ee.value.includes(oe.includes,oe.position))return;Ee.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:oe.includes,input:Ee.value,inst:G,continue:!oe.abort})}}),Hc=ht("$ZodCheckStartsWith",(G,oe)=>{cr.init(G,oe);let $e=new RegExp(`^${Mr(oe.prefix)}.*`);oe.pattern??(oe.pattern=$e),G._zod.check=(Pe)=>{if(Pe.value.startsWith(oe.prefix))return;Pe.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:oe.prefix,input:Pe.value,inst:G,continue:!oe.abort})}}),qc=ht("$ZodCheckEndsWith",(G,oe)=>{cr.init(G,oe);let $e=new RegExp(`.*${Mr(oe.suffix)}$`);oe.pattern??(oe.pattern=$e),G._zod.check=(Pe)=>{if(Pe.value.endsWith(oe.suffix))return;Pe.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:oe.suffix,input:Pe.value,inst:G,continue:!oe.abort})}});function Mc(G,oe,$e){if(G.issues.length)oe.issues.push(...br($e,G.issues))}var Gc=ht("$ZodCheckProperties",(G,oe)=>{cr.init(G,oe),bn(G,Symbol.iterator,function*(){yield G});let $e;G._zod.check=(Pe)=>{if(Pe.value==null){Pe.issues.push({expected:"object",code:"invalid_type",input:Pe.value,inst:G});return}$e??($e=Reflect.ownKeys(oe.shape).map((Ue)=>[Ue,oe.shape[Ue]]));let Ee=Pe.value,Fe;for(let[Ue,Be]of $e){let Xe=Be._zod.run({value:Ee[Ue],issues:[]},{});if(Xe instanceof Promise)Fe??(Fe=[]),Fe.push(Xe.then((Ye)=>Mc(Ye,Pe,Ue)));else Mc(Xe,Pe,Ue)}if(Fe)return Promise.all(Fe).then(()=>{return});return}});var Xc=ht("$ZodCheckOverwrite",(G,oe)=>{cr.init(G,oe),G._zod.check=($e)=>{$e.value=oe.tx($e.value)}});class jo{constructor(G=[],oe={}){this.content=[],this.indent=0,this.args=G,this.closed=oe}indented(G){this.indent+=1;try{G(this)}finally{this.indent-=1}}write(G){if(typeof G==="function"){G(this,{execution:"sync"}),G(this,{execution:"async"});return}let $e=G.split(`
4
- `).filter((Fe)=>Fe),Pe=Math.min(...$e.map((Fe)=>Fe.length-Fe.trimStart().length)),Ee=$e.map((Fe)=>Fe.slice(Pe)).map((Fe)=>" ".repeat(this.indent*2)+Fe);for(let Fe of Ee)this.content.push(Fe)}compile(){let G=Function,oe=this?.content??[""];return new G(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
5
- ${oe.join(`
6
- `)}
7
- };`)(...Object.values(this.closed))}}var Qc={major:4,minor:6,patch:7};var Lt=ht("$ZodType",(G,oe)=>{var $e;G??(G={}),G._zod.def=oe,G._zod.bag=G._zod.bag||{},G._zod.version=Qc;let Pe=G._zod.def.checks,Ee=G._zod.traits.has("$ZodCheck")?[G,...Pe??[]]:Pe?.length?[...Pe]:[];for(let Fe of Ee)for(let Ue of Fe._zod.onattach)Ue(G);if(Ee.length===0)($e=G._zod).deferred??($e.deferred=[]),G._zod.deferred?.push(()=>{G._zod.run=G._zod.parse});else{let Fe=(Be,Xe,Ye)=>{if(Be.memo)return Be;let Qe=vr(Be),ft;for(let pt of Xe){if(pt._zod.def.when){if(Bs(Be))continue;if(!pt._zod.def.when(Be))continue}else if(Qe)continue;let mt=Be.issues.length,gt=pt._zod.check(Be);if(gt instanceof Promise&&Ye?.async===!1)throw new Er;if(ft||gt instanceof Promise)ft=(ft??Promise.resolve()).then(async()=>{if(await gt,Be.issues.length===mt)return;if(Fn(Be.issues,mt,G),!Qe)Qe=vr(Be,mt)});else{if(Be.issues.length===mt)continue;if(Fn(Be.issues,mt,G),!Qe)Qe=vr(Be,mt)}}if(ft)return ft.then(()=>Be);return Be},Ue=(Be,Xe,Ye)=>{if(vr(Be))return Be.aborted=!0,Be;let Qe=Fe(Xe,Ee,Ye);if(Qe instanceof Promise){if(Ye.async===!1)throw new Er;return Qe.then((ft)=>G._zod.parse(ft,Ye))}return G._zod.parse(Qe,Ye)};G._zod.run=(Be,Xe)=>{if(Xe.skipChecks)return G._zod.parse(Be,Xe);if(Xe.direction==="backward"){let Qe=G._zod.parse({value:Be.value,issues:[]},{...Xe,skipChecks:!0});if(Qe instanceof Promise)return Qe.then((ft)=>Ue(ft,Be,Xe));return Ue(Qe,Be,Xe)}let Ye=G._zod.parse(Be,Xe);if(Ye instanceof Promise){if(Xe.async===!1)throw new Er;return Ye.then((Qe)=>Fe(Qe,Ee,Xe))}return Fe(Ye,Ee,Xe)}}},{get "~standard"(){return bn(this,"~standard",Uo(this))},set "~standard"(G){Ar(this,"~standard",G)}}),da=(G,oe)=>G.issues.length?{issues:G.issues.map(($e)=>Pr($e,oe,hr()))}:{value:G.value};async function bp(G,oe){let $e={async:!0};return da(await G._zod.run({value:oe,issues:[]},$e),$e)}function Uo(G){return{validate:(oe)=>{let $e={async:!1};try{let Pe=G._zod.run({value:oe,issues:[]},$e);if(!(Pe instanceof Promise))return da(Pe,$e)}catch(Pe){}return bp(G,oe)},vendor:"zod",version:1}}var eo=ht("$ZodString",(G,oe)=>{Lt.init(G,oe),G._zod.pattern=oe.pattern??Ac,G._zod.parse=($e,Pe)=>{if(oe.coerce)try{$e.value=String($e.value)}catch(Ee){}if(typeof $e.value==="string")return $e;return $e.issues.push({expected:"string",code:"invalid_type",input:$e.value,inst:G}),$e}}),tr=ht("$ZodStringFormat",(G,oe)=>{zn.init(G,oe),eo.init(G,oe)}),ma=ht("$ZodGUID",(G,oe)=>{oe.pattern??(oe.pattern=yc),tr.init(G,oe)}),ha=ht("$ZodUUID",(G,oe)=>{if(oe.version){let Pe={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[oe.version];if(Pe===void 0)throw Error(`Invalid UUID version: "${oe.version}"`);oe.pattern??(oe.pattern=No(Pe))}else oe.pattern??(oe.pattern=No());tr.init(G,oe)}),ga=ht("$ZodEmail",(G,oe)=>{oe.pattern??(oe.pattern=_c),tr.init(G,oe)}),ya=1,Yn=2;function _a(G){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(G);return new URL(G),!0}catch{return!1}}function xp(G,oe){if(!("normalize"in oe)&&!("hostname"in oe)&&!("protocol"in oe))return _a(G)||Yn;return wp(G,oe)}function wp(G,oe){if(!oe.normalize&&oe.protocol?.source===kc.source&&!/^https?:\/\//i.test(G))return ya;try{if(typeof URL<"u"){let $e=URL;if(typeof $e.parse==="function")return $e.parse(G)??Yn}return new URL(G)}catch{return Yn}}var $p=/[\t\n\r]/g;function ea(G){return G.replace($p,"")}function zp(G,oe){return oe.lastIndex=0,oe.test(G.hostname)}function Sp(G,oe){return oe.lastIndex=0,oe.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol)}var va=ht("$ZodURL",(G,oe)=>{tr.init(G,oe),G._zod.check=($e)=>{try{let Pe=$e.value.trim(),Ee=xp(Pe,oe);if(Ee===ya){$e.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:$e.value,inst:G,continue:!oe.abort});return}if(Ee===Yn){$e.issues.push({code:"invalid_format",format:"url",input:$e.value,inst:G,continue:!oe.abort});return}if(Ee===!0){$e.value=ea(Pe);return}if(oe.hostname&&!zp(Ee,oe.hostname))$e.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:oe.hostname.source,input:$e.value,inst:G,continue:!oe.abort});if(oe.protocol&&!Sp(Ee,oe.protocol))$e.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:oe.protocol.source,input:$e.value,inst:G,continue:!oe.abort});$e.value=oe.normalize?Ee.href:ea(Pe);return}catch(Pe){$e.issues.push({code:"invalid_format",format:"url",input:$e.value,inst:G,continue:!oe.abort})}}}),ba=ht("$ZodEmoji",(G,oe)=>{oe.pattern??(oe.pattern=vc()),tr.init(G,oe)}),xa=ht("$ZodNanoID",(G,oe)=>{if(oe.length!==void 0&&(!Number.isInteger(oe.length)||oe.length<1))throw Error(`Invalid nanoid length: ${oe.length}`);oe.pattern??(oe.pattern=oe.length===void 0?mc:hc(oe.length)),tr.init(G,oe)}),wa=ht("$ZodCUID",(G,oe)=>{oe.pattern??(oe.pattern=uc),tr.init(G,oe)}),$a=ht("$ZodCUID2",(G,oe)=>{oe.pattern??(oe.pattern=lc),tr.init(G,oe)}),za=ht("$ZodULID",(G,oe)=>{oe.pattern??(oe.pattern=fc),tr.init(G,oe)}),Sa=ht("$ZodXID",(G,oe)=>{oe.pattern??(oe.pattern=pc),tr.init(G,oe)}),ka=ht("$ZodKSUID",(G,oe)=>{oe.pattern??(oe.pattern=dc),tr.init(G,oe)}),Pa=ht("$ZodISODateTime",(G,oe)=>{oe.pattern??(oe.pattern=Zc(oe)),tr.init(G,oe)}),Ea=ht("$ZodISODate",(G,oe)=>{oe.pattern??(oe.pattern=Oc),tr.init(G,oe)}),Oa=ht("$ZodISOTime",(G,oe)=>{oe.pattern??(oe.pattern=Tc(oe)),tr.init(G,oe)}),Ta=ht("$ZodISODuration",(G,oe)=>{oe.pattern??(oe.pattern=gc),tr.init(G,oe)}),Za=ht("$ZodIPv4",(G,oe)=>{oe.pattern??(oe.pattern=bc),tr.init(G,oe)}),kp=/^[0-9a-fA-F:.]+$/;function Aa(G){if(!kp.test(G))return!1;return _a(`http://[${G}]`)}var Ia=ht("$ZodIPv6",(G,oe)=>{oe.pattern??(oe.pattern=xc),tr.init(G,oe),G._zod.check=($e)=>{if(!Aa($e.value))$e.issues.push({code:"invalid_format",format:"ipv6",input:$e.value,inst:G,continue:!oe.abort})}});var Ca=ht("$ZodCIDRv4",(G,oe)=>{oe.pattern??(oe.pattern=wc),tr.init(G,oe)});function Pp(G){let oe=G.split("/");if(oe.length!==2)return!1;let[$e,Pe]=oe;if(!Pe)return!1;let Ee=Number(Pe);if(`${Ee}`!==Pe)return!1;if(Ee<0||Ee>128)return!1;return Aa($e)}var Na=ht("$ZodCIDRv6",(G,oe)=>{oe.pattern??(oe.pattern=$c),tr.init(G,oe),G._zod.check=($e)=>{if(!Pp($e.value))$e.issues.push({code:"invalid_format",format:"cidrv6",input:$e.value,inst:G,continue:!oe.abort})}});function Ra(G){if(G==="")return!0;if(/\s/.test(G))return!1;if(G.length%4!==0)return!1;try{return atob(G),!0}catch{return!1}}var Bo=/^[0-9a-zA-Z+/]*={0,2}$/,Da=ht("$ZodBase64",(G,oe)=>{oe.pattern??(oe.pattern=Bo),tr.init(G,oe),G._zod.check=($e)=>{if(Ra($e.value))return;$e.issues.push({code:"invalid_format",format:"base64",input:$e.value,inst:G,continue:!oe.abort})}}),to=/^[A-Za-z0-9_-]*$/;function Ep(G){if(!to.test(G))return!1;let oe=G.replace(/[-_]/g,(Pe)=>Pe==="-"?"+":"/"),$e=oe.padEnd(Math.ceil(oe.length/4)*4,"=");return Ra($e)}var Ma=ht("$ZodBase64URL",(G,oe)=>{oe.pattern??(oe.pattern=to),tr.init(G,oe),G._zod.check=($e)=>{if(Ep($e.value))return;$e.issues.push({code:"invalid_format",format:"base64url",input:$e.value,inst:G,continue:!oe.abort})}}),La=ht("$ZodE164",(G,oe)=>{oe.pattern??(oe.pattern=Pc),tr.init(G,oe)});function Op(G,oe=null){try{let $e=G.split(".");if($e.length!==3)return!1;let[Pe]=$e;if(!Pe)return!1;let Ee=JSON.parse(atob(Pe));if("typ"in Ee&&Ee?.typ!=="JWT")return!1;if(!Ee.alg)return!1;if(oe&&(!("alg"in Ee)||Ee.alg!==oe))return!1;return!0}catch{return!1}}var ja=ht("$ZodJWT",(G,oe)=>{tr.init(G,oe),G._zod.check=($e)=>{if(Op($e.value,oe.alg))return;$e.issues.push({code:"invalid_format",format:"jwt",input:$e.value,inst:G,continue:!oe.abort})}});var Jo=ht("$ZodNumber",(G,oe)=>{Lt.init(G,oe),G._zod.pattern=wn,G._zod.parse=($e,Pe)=>{if(oe.coerce)try{$e.value=Number($e.value)}catch(Ue){}let Ee=$e.value;if(typeof Ee==="number"&&!Number.isNaN(Ee)&&Number.isFinite(Ee))return $e;let Fe=typeof Ee==="number"?Number.isNaN(Ee)?"NaN":!Number.isFinite(Ee)?String(Ee):void 0:void 0;return $e.issues.push({expected:"number",code:"invalid_type",input:Ee,inst:G,...Fe?{received:Fe}:{}}),$e}}),Fa=ht("$ZodNumberFormat",(G,oe)=>{jc.init(G,oe),Jo.init(G,oe)}),Ua=ht("$ZodBoolean",(G,oe)=>{Lt.init(G,oe),G._zod.pattern=Cc,G._zod.parse=($e,Pe)=>{if(oe.coerce)try{$e.value=Boolean($e.value)}catch(Fe){}let Ee=$e.value;if(typeof Ee==="boolean")return $e;return $e.issues.push({expected:"boolean",code:"invalid_type",input:Ee,inst:G}),$e}}),Ba=ht("$ZodBigInt",(G,oe)=>{Lt.init(G,oe),G._zod.pattern=Ic,G._zod.parse=($e,Pe)=>{if(oe.coerce)try{$e.value=BigInt($e.value)}catch(Ee){}if(typeof $e.value==="bigint")return $e;return $e.issues.push({expected:"bigint",code:"invalid_type",input:$e.value,inst:G}),$e}});var Ja=ht("$ZodNull",(G,oe)=>{Lt.init(G,oe),G._zod.pattern=Nc,G._zod.values=new Set([null]),G._zod.parse=($e,Pe)=>{let Ee=$e.value;if(Ee===null)return $e;return $e.issues.push({expected:"null",code:"invalid_type",input:Ee,inst:G}),$e}}),Va=ht("$ZodAny",(G,oe)=>{Lt.init(G,oe),G._zod.parse=($e)=>$e}),Wa=ht("$ZodUnknown",(G,oe)=>{Lt.init(G,oe),G._zod.parse=($e)=>$e}),Ka=ht("$ZodNever",(G,oe)=>{Lt.init(G,oe),G._zod.parse=($e,Pe)=>($e.issues.push({expected:"never",code:"invalid_type",input:$e.value,inst:G}),$e)});var Ha=ht("$ZodDate",(G,oe)=>{Lt.init(G,oe),G._zod.parse=($e,Pe)=>{if(oe.coerce)try{$e.value=new Date($e.value)}catch(Be){}let Ee=$e.value,Fe=Ee instanceof Date;if(Fe&&!Number.isNaN(Ee.getTime()))return $e;return $e.issues.push({expected:"date",code:"invalid_type",input:Ee,...Fe?{received:"Invalid Date"}:{},inst:G}),$e}});function Tp(G,oe){let $e=Eo(G._zod.def.checks);if(!$e.length)return;let Pe=Math.min(...$e.map((Fe)=>Fe[0])),Ee=G._zod.parse;G._zod.parse=(Fe,Ue)=>{let Be=oe(Fe.value);if(Be>Pe&&!Ue?.skipChecks&&Ue?.direction!=="backward"){for(let[Xe,Ye]of Eo(G._zod.def.checks))if(Be>Xe&&Ye._zod.def.when(Fe)){let Qe=Fe.issues.length;return Ye._zod.check(Fe),Fe.issues[Qe].continue=!1,Fn(Fe.issues,Qe,G),Fe}}return Ee(Fe,Ue)}}var Zp=(G)=>Array.isArray(G)?G.length:-1;function ta(G,oe,$e){if(G.issues.length)oe.issues.push(...br($e,G.issues));oe.value[$e]=G.value}var qa=ht("$ZodArray",(G,oe)=>{Lt.init(G,oe);let $e=lr.memoizer;$e?.attach(G),G._zod.parse=(Pe,Ee)=>{let Fe=Pe.value;if(!Array.isArray(Fe))return Pe.issues.push({expected:"array",code:"invalid_type",input:Fe,inst:G}),Pe;Pe.value=$e?$e.alloc(G,Pe,Array(Fe.length),Ee):Array(Fe.length);let Ue=[],Be=Ee?.abortEarly;for(let Xe=0;Xe<Fe.length;Xe++){let Ye=Fe[Xe],Qe=oe.element._zod.run({value:Ye,issues:[]},Ee);if(Qe instanceof Promise)Ue.push(Qe.then((ft)=>ta(ft,Pe,Xe)));else if(ta(Qe,Pe,Xe),Be&&Qe.issues.length!==0&&vr(Qe))break}if(Ue.length)return Promise.all(Ue).then(()=>Pe);return Pe},Tp(G,Zp)});function Qn(G,oe,$e,Pe,Ee,Fe){let Ue=$e in Pe,Be=Fe==="optional";if(!Ue&&Be&&Ee==="optional")return;if(G.issues.length){if(Ee!==void 0&&Be&&!Ue)return;oe.issues.push(...br($e,G.issues))}if(!Ue&&Ee===void 0){if(!G.issues.length)oe.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[$e]});return}if(G.value===void 0){if(Ue||Ee==="defaulted"&&!Be)oe.value[$e]=void 0}else oe.value[$e]=G.value}var Ap=[];function Ga(G){let oe=Object.keys(G.shape),$e=Object.getOwnPropertySymbols(G.shape),Pe=$e.length?$e:Ap,Ee=Pe.length?[...oe,...Pe]:oe;for(let Ue of Ee)if(!G.shape?.[Ue]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(Ue)}": expected a Zod schema`);let Fe=js(G.shape);return{...G,allKeys:Ee,symbolKeys:Pe,keySet:new Set(oe),numKeys:oe.length,optionalKeys:new Set(Fe)}}function Xa(G,oe,$e,Pe,Ee,Fe,Ue){let Be=[],Xe=Ee.keySet,Ye=Ee.catchall._zod,Qe=Ye.def.type,{optin:ft,optout:pt}=Ye,mt=0;for(let gt in oe){if(Ue&&$e.issues.length!==mt){if(vr($e,mt))break;mt=$e.issues.length}if(Xe.has(gt))continue;if(gt==="__proto__"){if(Qe==="never")Be.push(gt);continue}if(Qe==="never"){Be.push(gt);continue}let St=Ye.run({value:oe[gt],issues:[]},Pe);if(St instanceof Promise)G.push(St.then((Tt)=>Qn(Tt,$e,gt,oe,ft,pt)));else Qn(St,$e,gt,oe,ft,pt)}if(Be.length)$e.issues.push({code:"unrecognized_keys",keys:Be,input:oe,inst:Fe,continue:!0});if(!G.length)return $e;return Promise.all(G).then(()=>$e)}var Ip=ht("$ZodObject",(G,oe)=>{Lt.init(G,oe);let $e=Object.getOwnPropertyDescriptor(oe,"shape"),Pe=$e?.get?$e.get.raw:oe.shape??{};if(Pe){let Ye=()=>{let Qe={...Pe};return Object.defineProperty(oe,"shape",{value:Qe}),Ye.raw=Qe,Qe};Ye.raw=Pe,Object.defineProperty(oe,"shape",{get:Ye})}let Ee=yn(()=>Ga(oe));Nt(G,"propValues",(Ye)=>{let Qe=Ye.def.shape,ft={};for(let pt in Qe){let mt=Qe[pt]._zod;if(mt.values){if(!Object.prototype.hasOwnProperty.call(ft,pt))dr(ft,pt,new Set);for(let gt of mt.values)ft[pt].add(gt);if(mt.optin!==void 0)ft[pt].add(void 0)}}return ft});let Fe=Hr,Ue=oe.catchall,Be,Xe=lr.memoizer;Xe?.attach(G),G._zod.parse=(Ye,Qe)=>{Be??(Be=Ee.value);let ft=Ye.value;if(!Fe(ft))return Ye.issues.push({expected:"object",code:"invalid_type",input:ft,inst:G}),Ye;Ye.value=Xe?Xe.alloc(G,Ye,{},Qe):{};let pt=[],mt=Be.shape,gt=Qe?.abortEarly,St=Ye.issues.length;for(let Tt of Be.allKeys){if(gt&&Ye.issues.length!==St){if(vr(Ye,St))break;St=Ye.issues.length}if(Tt==="__proto__")continue;let It=mt[Tt],ir=It._zod.optin,Tr=It._zod.optout,Fr=It._zod.run({value:ft[Tt],issues:[]},Qe);if(Fr instanceof Promise)pt.push(Fr.then((xt)=>Qn(xt,Ye,Tt,ft,ir,Tr)));else Qn(Fr,Ye,Tt,ft,ir,Tr)}if(!Ue)return pt.length?Promise.all(pt).then(()=>Ye):Ye;return Xa(pt,ft,Ye,Qe,Ee.value,G,gt===!0)}}),Ya=ht("$ZodObjectJIT",(G,oe)=>{Ip.init(G,oe);let $e=G._zod.parse,Pe=yn(()=>Ga(oe)),Ee=lr.memoizer,Fe=(mt)=>{let gt=Pe.value,St=gt.symbolKeys,Tt=new jo(["payload","ctx"],{shape:mt,inst:G,memo:Ee,syms:St}),It=(xt)=>`shape[${xt}]._zod.run({ value: input[${xt}], issues: [] }, ctx)`,ir=(xt,_t)=>`
8
- let ${xt}_ab = false;
9
- for (let i = 0; i < ${xt}.issues.length; i++) {
10
- const iss = ${xt}.issues[i];
11
- iss.path = iss.path ? [${_t}, ...iss.path] : [${_t}];
12
- payload.issues.push(iss);
13
- if (iss.continue !== true) ${xt}_ab = true;
14
- }
15
- if (${xt}_ab && ctx && ctx.abortEarly) {
16
- payload.value = newResult;
17
- return payload;
18
- }`;Tt.write("const input = payload.value;");let Tr=Object.create(null),Fr=0;for(let xt of gt.allKeys)Tr[xt]=`key_${Fr++}`;Tt.write(Ee?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let xt of gt.allKeys){if(xt==="__proto__")continue;let _t=Tr[xt],Ct=typeof xt==="symbol"?`syms[${St.indexOf(xt)}]`:Rs(xt),nr=`${Ct} in input`,or=mt[xt],_r=or?._zod?.optin,Rn=_r!==void 0,vo=or?._zod?.optout==="optional";if(Tt.write(`const ${_t} = ${It(Ct)};`),Rn&&vo){let bo=_r==="optional"?`${_t}_present`:`${_t}.value !== undefined || ${_t}_present`;Tt.write(`
19
- const ${_t}_present = ${nr};
20
- if (!${_t}.issues.length || ${_t}_present) {
21
- if (${_t}.issues.length) {${ir(_t,Ct)}
22
- }
23
-
24
- if (${bo}) {
25
- newResult[${Ct}] = ${_t}.value;
26
- }
27
- }
28
-
29
- `)}else if(!Rn)Tt.write(`
30
- const ${_t}_present = ${nr};
31
- if (${_t}.issues.length) {${ir(_t,Ct)}
32
- }
33
- if (!${_t}_present && !${_t}.issues.length) {
34
- payload.issues.push({
35
- code: "invalid_type",
36
- expected: "nonoptional",
37
- input: undefined,
38
- path: [${Ct}]
39
- });
40
- if (ctx && ctx.abortEarly) {
41
- payload.value = newResult;
42
- return payload;
43
- }
44
- }
45
-
46
- if (${_t}_present) {
47
- newResult[${Ct}] = ${_t}.value;
48
- }
49
-
50
- `);else if(Tt.write(`
51
- if (${_t}.issues.length) {${ir(_t,Ct)}
52
- }
53
- `),_r==="defaulted")Tt.write(`newResult[${Ct}] = ${_t}.value;`);else Tt.write(`
54
- if (${_t}.value !== undefined || ${nr}) {
55
- newResult[${Ct}] = ${_t}.value;
56
- }
57
- `)}return Tt.write("payload.value = newResult;"),Tt.write("return payload;"),Tt.compile()},Ue,Be=Hr,Xe=!lr.jitless,Qe=Xe&&Ms.value,ft=oe.catchall,pt;G._zod.parse=(mt,gt)=>{pt??(pt=Pe.value);let St=mt.value;if(!Be(St))return mt.issues.push({expected:"object",code:"invalid_type",input:St,inst:G}),mt;if(Xe&&Qe&&gt?.async===!1&&gt.jitless!==!0){if(!Ue)Ue=Fe(oe.shape);if(mt=Ue(mt,gt),!ft)return mt;return Xa([],St,mt,gt,pt,G,gt?.abortEarly===!0)}return $e(mt,gt)}});function ra(G,oe,$e,Pe){for(let Fe of G)if(Fe.issues.length===0)return oe.value=Fe.value,oe;let Ee=G.filter((Fe)=>!vr(Fe));if(Ee.length===1)return oe.value=Ee[0].value,Ee[0];return oe.issues.push({code:"invalid_union",input:oe.value,inst:$e,errors:G.map((Fe)=>Fe.issues.map((Ue)=>Pr(Ue,Pe,hr())))}),oe}var Vo=ht("$ZodUnion",(G,oe)=>{Lt.init(G,oe),Nt(G,"optin",(Pe)=>Pe.def.options.some((Ee)=>Ee._zod.optin==="defaulted")?"defaulted":Pe.def.options.some((Ee)=>Ee._zod.optin!==void 0)?"optional":void 0),Nt(G,"optout",(Pe)=>Pe.def.options.some((Ee)=>Ee._zod.optout==="optional")?"optional":void 0),Nt(G,"values",(Pe)=>{if(Pe.def.options.every((Ee)=>Ee._zod.values))return new Set(Pe.def.options.flatMap((Ee)=>Array.from(Ee._zod.values)));return}),Nt(G,"pattern",(Pe)=>{if(Pe.def.options.every((Ee)=>Ee._zod.pattern)){let Ee=Pe.def.options.map((Fe)=>Fe._zod.pattern);return new RegExp(`^(${Ee.map((Fe)=>Mn(Fe.source)).join("|")})$`)}return});let $e=oe.options.length===1?oe.options[0]._zod.run:null;G._zod.parse=(Pe,Ee)=>{if($e)return $e(Pe,Ee);let Fe=!1,Ue=[];for(let Be of oe.options){let Xe=Be._zod.run({value:Pe.value,issues:[]},Ee);if(Xe instanceof Promise)Ue.push(Xe),Fe=!0;else{if(Xe.issues.length===0)return Xe;Ue.push(Xe)}}if(!Fe)return ra(Ue,Pe,G,Ee);return Promise.all(Ue).then((Be)=>ra(Be,Pe,G,Ee))}});function Cp(G){let oe=new Map;for(let $e of G.options){let Pe=$e._zod.propValues?.[G.discriminator];if(!Pe||Pe.size===0)throw Error(`Invalid discriminated union option at index "${G.options.indexOf($e)}"`);for(let Ee of Pe)if(oe.has(Ee)){if(Ee!==void 0)throw Error(`Duplicate discriminator value "${String(Ee)}"`);oe.set(Ee,null)}else oe.set(Ee,$e)}return oe}var Qa=ht("$ZodDiscriminatedUnion",(G,oe)=>{oe.inclusive=!1,Vo.init(G,oe);let $e=G._zod.parse;Nt(G,"propValues",(Ee)=>{let Fe={},Ue=0;for(let Be of Ee.def.options){let Xe=Be._zod.propValues;if(!Xe||Object.keys(Xe).length===0)throw Error(`Invalid discriminated union option at index "${Ee.def.options.indexOf(Be)}"`);if(Xe[Ee.def.discriminator]?.has(void 0))Ue++;for(let[Ye,Qe]of Object.entries(Xe)){if(!Object.prototype.hasOwnProperty.call(Fe,Ye))dr(Fe,Ye,new Set);for(let ft of Qe)Fe[Ye].add(ft)}}if(!Ee.def.unionFallback&&Ue>1)Fe[Ee.def.discriminator]?.delete(void 0);return Fe}),oe.options.forEach((Ee,Fe)=>{let Ue=vn(Ee._zod.def);if(Ue&&!Object.prototype.hasOwnProperty.call(Ue,oe.discriminator))throw Error(`Invalid discriminated union option at index "${Fe}"`)});let Pe=yn(()=>Cp(oe));G._zod.parse=(Ee,Fe)=>{let Ue=Ee.value;if(!Hr(Ue))return Ee.issues.push({code:"invalid_type",expected:"object",input:Ue,inst:G}),Ee;let Be=Ue?.[oe.discriminator],Xe=Pe.value.get(Be);if(Xe&&(Be!==void 0||Fe.direction!=="backward"))return Xe._zod.run(Ee,Fe);if(oe.unionFallback||Fe.direction==="backward")return $e(Ee,Fe);return Ee.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:oe.discriminator,options:Array.from(Pe.value.keys()).filter((Ye)=>Pe.value.get(Ye)!==null),input:Ue,path:[oe.discriminator],inst:G}),Ee}}),eu=ht("$ZodIntersection",(G,oe)=>{Lt.init(G,oe),G._zod.parse=($e,Pe)=>{let Ee=$e.value,Fe=oe.left._zod.run({value:Ee,issues:[]},Pe),Ue=oe.right._zod.run({value:Ee,issues:[]},Pe);if(Fe instanceof Promise||Ue instanceof Promise)return Promise.all([Fe,Ue]).then(([Xe,Ye])=>na($e,Xe,Ye));return na($e,Fe,Ue)}});function Fo(G,oe){if(G===oe)return{valid:!0,data:G};if(G instanceof Date&&oe instanceof Date&&+G===+oe)return{valid:!0,data:G};if(Br(G)&&Br(oe)){let $e=Object.keys(oe),Pe=Object.keys(G).filter((Fe)=>$e.indexOf(Fe)!==-1),Ee={...G,...oe};if(Object.prototype.hasOwnProperty.call(Ee,"__proto__"))delete Ee.__proto__;for(let Fe of Pe){if(Fe==="__proto__")continue;let Ue=Fo(G[Fe],oe[Fe]);if(!Ue.valid)return{valid:!1,mergeErrorPath:[Fe,...Ue.mergeErrorPath]};Ee[Fe]=Ue.data}return{valid:!0,data:Ee}}if(Array.isArray(G)&&Array.isArray(oe)){if(G.length!==oe.length)return{valid:!1,mergeErrorPath:[]};let $e=[];for(let Pe=0;Pe<G.length;Pe++){let Ee=G[Pe],Fe=oe[Pe],Ue=Fo(Ee,Fe);if(!Ue.valid)return{valid:!1,mergeErrorPath:[Pe,...Ue.mergeErrorPath]};$e.push(Ue.data)}return{valid:!0,data:$e}}return{valid:!1,mergeErrorPath:[]}}function na(G,oe,$e){let Pe=new Map,Ee,Fe=new Map,Ue=(Ye,Qe)=>{let ft;if(Ye.code==="unrecognized_keys"&&!Ye.path?.length)Ee??(Ee=Ye),ft=Ye.keys;else if(Ye.code==="invalid_key"&&Ye.origin==="record"&&Ye.path?.length===1){let pt=String(Ye.path[0]);if(!Fe.has(pt))Fe.set(pt,Ye);ft=[pt]}else return!1;for(let pt of ft){if(!Pe.has(pt))Pe.set(pt,{});Pe.get(pt)[Qe]=!0}return!0};for(let Ye of oe.issues)if(!Ue(Ye,"l"))G.issues.push(Ye);for(let Ye of $e.issues)if(!Ue(Ye,"r"))G.issues.push(Ye);let Be=[...Pe].filter(([,Ye])=>Ye.l&&Ye.r).map(([Ye])=>Ye);if(Be.length){let Ye=Ee?Be.filter((Qe)=>Ee.keys.includes(Qe)):[];if(Ye.length)G.issues.push({...Ee,keys:Ye});for(let Qe of Be)if(!Ye.includes(Qe)&&Fe.has(Qe))G.issues.push(Fe.get(Qe))}let Xe=Fo(oe.value,$e.value);if(!Xe.valid){if(vr(G))return G;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Xe.mergeErrorPath)}`)}return G.value=Xe.data,G}var tu=ht("$ZodTuple",(G,oe)=>{Lt.init(G,oe);let $e=oe.items,Pe=lr.memoizer;Pe?.attach(G),G._zod.parse=(Ee,Fe)=>{let Ue=Ee.value;if(!Array.isArray(Ue))return Ee.issues.push({input:Ue,inst:G,expected:"tuple",code:"invalid_type"}),Ee;Ee.value=Pe?Pe.alloc(G,Ee,[],Fe):[];let Be=[],Xe=oa($e,"optin"),Ye=oa($e,"optout");if(!oe.rest){if(Ue.length<Xe)return Ee.issues.push({code:"too_small",minimum:Xe,inclusive:!0,input:Ue,inst:G,origin:"array"}),Ee;if(Ue.length>$e.length)Ee.issues.push({code:"too_big",maximum:$e.length,inclusive:!0,input:Ue,inst:G,origin:"array"})}let Qe=Array($e.length),ft=oe.rest?Fe?.abortEarly:void 0,pt=!1;for(let mt=0;mt<$e.length;mt++){let gt=$e[mt]._zod.run({value:Ue[mt],issues:[]},Fe);if(gt instanceof Promise)Be.push(gt.then((St)=>{Qe[mt]=St}));else if(Qe[mt]=gt,ft&&!pt&&gt.issues.length)pt=vr(gt)}if(oe.rest&&!pt){let mt=$e.length-1,gt=Ue.slice($e.length),St=Ee.issues.length;for(let Tt of gt){if(ft&&Ee.issues.length!==St){if(vr(Ee,St))break;St=Ee.issues.length}mt++;let It=oe.rest._zod.run({value:Tt,issues:[]},Fe);if(It instanceof Promise)Be.push(It.then((ir)=>ia(ir,Ee,mt)));else ia(It,Ee,mt)}}if(Be.length)return Promise.all(Be).then(()=>sa(Qe,Ee,$e,Ue,Ye));return sa(Qe,Ee,$e,Ue,Ye)}});function oa(G,oe){for(let $e=G.length-1;$e>=0;$e--)if(!(oe==="optin"?G[$e]._zod.optin!==void 0:G[$e]._zod.optout==="optional"))return $e+1;return 0}function ia(G,oe,$e){if(G.issues.length)oe.issues.push(...br($e,G.issues));oe.value[$e]=G.value}function sa(G,oe,$e,Pe,Ee){for(let Fe=0;Fe<$e.length;Fe++){let Ue=G[Fe],Be=Fe<Pe.length;if(!Be&&Fe>=Ee&&$e[Fe]._zod.optin==="optional"){oe.value.length=Fe;break}if(Ue.issues.length){if(!Be&&Fe>=Ee){oe.value.length=Fe;break}oe.issues.push(...br(Fe,Ue.issues))}oe.value[Fe]=Ue.value}for(let Fe=oe.value.length-1;Fe>=Pe.length;Fe--)if($e[Fe]._zod.optout==="optional"&&oe.value[Fe]===void 0)oe.value.length=Fe;else break;return oe}var ru=ht("$ZodRecord",(G,oe)=>{Lt.init(G,oe);let $e=lr.memoizer;$e?.attach(G),G._zod.parse=(Pe,Ee)=>{let Fe=Pe.value;if(!Br(Fe))return Pe.issues.push({expected:"record",code:"invalid_type",input:Fe,inst:G}),Pe;let Ue=[],Be=oe.keyType._zod.values;if(Be&&!oe.partial){Pe.value=$e?$e.alloc(G,Pe,{},Ee):{};let Xe=new Set;for(let Qe of Be)if(typeof Qe==="string"||typeof Qe==="number"||typeof Qe==="symbol"){if(Xe.add(typeof Qe==="number"?Qe.toString():Qe),Qe==="__proto__")continue;let ft=oe.keyType._zod.run({value:Qe,issues:[]},Ee);if(ft instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(ft.issues.length){Pe.issues.push({code:"invalid_key",origin:"record",issues:ft.issues.map((gt)=>Pr(gt,Ee,hr())),input:Qe,path:[Qe],inst:G});continue}let pt=ft.value;if(pt==="__proto__")continue;let mt=oe.valueType._zod.run({value:Fe[Qe],issues:[]},Ee);if(mt instanceof Promise)Ue.push(mt.then((gt)=>{if(gt.issues.length)Pe.issues.push(...br(Qe,gt.issues));Pe.value[pt]=gt.value}));else{if(mt.issues.length)Pe.issues.push(...br(Qe,mt.issues));Pe.value[pt]=mt.value}}let Ye;for(let Qe in Fe)if(!Xe.has(Qe))if(oe.mode==="loose"){if(Qe==="__proto__")continue;Pe.value[Qe]=Fe[Qe]}else Ye=Ye??[],Ye.push(Qe);if(Ye&&Ye.length>0)Pe.issues.push({code:"unrecognized_keys",input:Fe,inst:G,keys:Ye,continue:!0})}else{Pe.value=$e?$e.alloc(G,Pe,{},Ee):{};let Xe;for(let Ye of Reflect.ownKeys(Fe)){if(Ye==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(Fe,Ye))continue;let Qe=oe.keyType._zod.run({value:Ye,issues:[]},Ee);if(Qe instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof Ye==="string"&&wn.test(Ye)&&Qe.issues.length){let gt=oe.keyType._zod.run({value:Number(Ye),issues:[]},Ee);if(gt instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(gt.issues.length===0)Qe=gt}if(Qe.issues.length){if(oe.mode==="loose")Pe.value[Ye]=Fe[Ye];else if(Be)Xe=Xe??[],Xe.push(Ye);else Pe.issues.push({code:"invalid_key",origin:"record",issues:Qe.issues.map((gt)=>Pr(gt,Ee,hr())),input:Ye,path:[Ye],inst:G});continue}let pt=Qe.value;if(pt==="__proto__")continue;let mt=oe.valueType._zod.run({value:Fe[Ye],issues:[]},Ee);if(mt instanceof Promise)Ue.push(mt.then((gt)=>{if(gt.issues.length)Pe.issues.push(...br(Ye,gt.issues));Pe.value[pt]=gt.value}));else{if(mt.issues.length)Pe.issues.push(...br(Ye,mt.issues));Pe.value[pt]=mt.value}}if(Xe&&Xe.length>0)Pe.issues.push({code:"unrecognized_keys",input:Fe,inst:G,keys:Xe,continue:!0})}if(Ue.length)return Promise.all(Ue).then(()=>Pe);return Pe}});var nu=ht("$ZodEnum",(G,oe)=>{Lt.init(G,oe);let $e=hn(oe.entries),Pe=new Set($e);G._zod.values=Pe,Nt(G,"pattern",(Ee)=>{let Fe=hn(Ee.def.entries).filter((Ue)=>Ls.has(typeof Ue));return new RegExp(Fe.length?`^(${Fe.map((Ue)=>Mr(Ue.toString())).join("|")})$`:"^[^\\s\\S]$")}),G._zod.parse=(Ee,Fe)=>{let Ue=Ee.value;if(Pe.has(Ue))return Ee;return Ee.issues.push({code:"invalid_value",values:$e,input:Ue,inst:G}),Ee}}),ou=ht("$ZodLiteral",(G,oe)=>{Lt.init(G,oe);let $e=new Set(oe.values);G._zod.values=$e,Nt(G,"pattern",(Pe)=>{let Ee=Pe.def.values;return new RegExp(Ee.length?`^(${Ee.map((Fe)=>typeof Fe==="string"?Mr(Fe):Fe?Mr(Fe.toString()):String(Fe)).join("|")})$`:"^[^\\s\\S]$")}),G._zod.parse=(Pe,Ee)=>{let Fe=Pe.value;if($e.has(Fe))return Pe;return Pe.issues.push({code:"invalid_value",values:oe.values,input:Fe,inst:G}),Pe}});var iu=ht("$ZodTransform",(G,oe)=>{Lt.init(G,oe),G._zod.optin="optional",lr.memoizer?.guard(G),G._zod.parse=($e,Pe)=>{if(Pe.direction==="backward")throw new xn(G.constructor.name);let Ee=oe.transform($e.value,$e);if(Pe.async)return(Ee instanceof Promise?Ee:Promise.resolve(Ee)).then((Ue)=>($e.value=Ue,$e));if(Ee instanceof Promise)throw new Er;return $e.value=Ee,$e}});function ca(G,oe){return G.value=oe.issues.length?void 0:oe.value,G}var Wo=ht("$ZodOptional",(G,oe)=>{Lt.init(G,oe),Nt(G,"optin",($e)=>$e.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),G._zod.optout="optional",Nt(G,"values",($e)=>{let Pe=$e.def.innerType._zod.values;return Pe?new Set([...Pe,void 0]):void 0}),Nt(G,"pattern",($e)=>{let Pe=$e.def.innerType._zod.pattern;return Pe?new RegExp(`^(${Mn(Pe.source)})?$`):void 0}),G._zod.parse=($e,Pe)=>{if($e.value===void 0){if(oe.innerType._zod.optin!=="defaulted")return $e;let Ee=oe.innerType._zod.run({value:$e.value,issues:[]},Pe);if(Ee instanceof Promise)return Ee.then((Fe)=>ca($e,Fe));return ca($e,Ee)}return oe.innerType._zod.run($e,Pe)}}),su=ht("$ZodExactOptional",(G,oe)=>{Wo.init(G,oe),Nt(G,"values",($e)=>$e.def.innerType._zod.values),Nt(G,"pattern",($e)=>$e.def.innerType._zod.pattern),G._zod.parse=($e,Pe)=>oe.innerType._zod.run($e,Pe)}),cu=ht("$ZodNullable",(G,oe)=>{Lt.init(G,oe),Nt(G,"optin",($e)=>$e.def.innerType._zod.optin),Nt(G,"optout",($e)=>$e.def.innerType._zod.optout),Nt(G,"pattern",($e)=>{let Pe=$e.def.innerType._zod.pattern;return Pe?new RegExp(`^(${Mn(Pe.source)}|null)$`):void 0}),Nt(G,"values",($e)=>$e.def.innerType._zod.values?new Set([...$e.def.innerType._zod.values,null]):void 0),G._zod.parse=($e,Pe)=>{if($e.value===null)return $e;return oe.innerType._zod.run($e,Pe)}}),au=ht("$ZodDefault",(G,oe)=>{Lt.init(G,oe),G._zod.optin="defaulted",Nt(G,"values",($e)=>$e.def.innerType._zod.values),G._zod.parse=($e,Pe)=>{if(Pe.direction==="backward")return oe.innerType._zod.run($e,Pe);if($e.value===void 0)return $e.value=oe.defaultValue,$e;let Ee=oe.innerType._zod.run($e,Pe);if(Ee instanceof Promise)return Ee.then((Fe)=>aa(Fe,oe));return aa(Ee,oe)}});function aa(G,oe){if(G.value===void 0)G.value=oe.defaultValue;return G}var uu=ht("$ZodPrefault",(G,oe)=>{Lt.init(G,oe),G._zod.optin="defaulted",Nt(G,"values",($e)=>$e.def.innerType._zod.values),G._zod.parse=($e,Pe)=>{if(Pe.direction==="backward")return oe.innerType._zod.run($e,Pe);if($e.value===void 0)$e.value=oe.defaultValue;return oe.innerType._zod.run($e,Pe)}}),lu=ht("$ZodNonOptional",(G,oe)=>{Lt.init(G,oe),Nt(G,"values",($e)=>{let Pe=$e.def.innerType._zod.values;return Pe?new Set([...Pe].filter((Ee)=>Ee!==void 0)):void 0}),G._zod.parse=($e,Pe)=>{let Ee=oe.innerType._zod.run($e,Pe);if(Ee instanceof Promise)return Ee.then((Fe)=>ua(Fe,G));return ua(Ee,G)}});function ua(G,oe){if(!G.issues.length&&G.value===void 0)G.issues.push({code:"invalid_type",expected:"nonoptional",input:G.value,inst:oe});return G}function la(G,oe,$e,Pe){if(!oe.issues.length){if(G.value=oe.value,oe.memo)G.memo=!0;return G}return G.value=$e.catchValue({...oe,value:G.value,error:{issues:oe.issues.map((Ee)=>Pr(Ee,Pe,hr()))},input:G.value}),G}var fu=ht("$ZodCatch",(G,oe)=>{Lt.init(G,oe),Nt(G,"optin",($e)=>$e.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Nt(G,"optout",($e)=>$e.def.innerType._zod.optout),Nt(G,"values",($e)=>$e.def.innerType._zod.values),G._zod.parse=($e,Pe)=>{if(Pe.direction==="backward")return oe.innerType._zod.run($e,Pe);let Ee=oe.innerType._zod.run({value:$e.value,issues:[]},Pe);if(Ee instanceof Promise)return Ee.then((Fe)=>la($e,Fe,oe,Pe));return la($e,Ee,oe,Pe)}});var pu=ht("$ZodPipe",(G,oe)=>{Lt.init(G,oe),Nt(G,"values",($e)=>$e.def.in._zod.values),Nt(G,"optin",($e)=>$e.def.in._zod.optin),Nt(G,"optout",($e)=>$e.def.out._zod.optout),Nt(G,"propValues",($e)=>$e.def.in._zod.propValues),G._zod.parse=($e,Pe)=>{if(Pe.direction==="backward"){let Fe=oe.out._zod.run($e,Pe);if(Fe instanceof Promise)return Fe.then((Ue)=>Xn(Ue,oe.in,Pe));return Xn(Fe,oe.in,Pe)}let Ee=oe.in._zod.run($e,Pe);if(Ee instanceof Promise)return Ee.then((Fe)=>Xn(Fe,oe.out,Pe));return Xn(Ee,oe.out,Pe)}});function Xn(G,oe,$e){if(G.issues.some((Pe)=>Pe.code!=="unrecognized_keys"))return G.aborted=!0,G;return oe._zod.run({value:G.value,issues:G.issues},$e)}var du=ht("$ZodReadonly",(G,oe)=>{Lt.init(G,oe),Nt(G,"propValues",($e)=>$e.def.innerType._zod.propValues),Nt(G,"values",($e)=>$e.def.innerType._zod.values),Nt(G,"optin",($e)=>$e.def.innerType?._zod?.optin),Nt(G,"optout",($e)=>$e.def.innerType?._zod?.optout),G._zod.parse=($e,Pe)=>{if(Pe.direction==="backward")return oe.innerType._zod.run($e,Pe);let Ee=oe.innerType._zod.run($e,Pe);if(Ee instanceof Promise)return Ee.then(fa);return fa(Ee)}});function fa(G){if(!G.memo)G.value=Object.freeze(G.value);return G}var mu=ht("$ZodLazy",(G,oe)=>{Lt.init(G,oe),Is(G._zod,"innerType",()=>{let $e=oe;if(!$e._cachedInner)$e._cachedInner=oe.getter();return $e._cachedInner}),Nt(G,"pattern",($e)=>$e.innerType?._zod?.pattern),Nt(G,"propValues",($e)=>$e.innerType?._zod?.propValues),Nt(G,"optin",($e)=>$e.innerType?._zod?.optin??void 0),Nt(G,"optout",($e)=>$e.innerType?._zod?.optout??void 0),G._zod.parse=($e,Pe)=>G._zod.innerType._zod.run($e,Pe)}),hu=ht("$ZodCustom",(G,oe)=>{cr.init(G,oe),Lt.init(G,oe),G._zod.parse=($e,Pe)=>$e,G._zod.check=($e)=>{let Pe=$e.value,Ee=oe.fn(Pe);if(Ee instanceof Promise)return Ee.then((Fe)=>pa(Fe,$e,Pe,G));pa(Ee,$e,Pe,G);return}});function pa(G,oe,$e,Pe){if(!G){let Ee={code:"custom",input:$e,inst:Pe,path:[...Pe._zod.def.path??[]],continue:!Pe._zod.def.abort};if(Pe._zod.def.params)Ee.params=Pe._zod.def.params;oe.issues.push(Jr(Ee))}}class yu extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Ho="~memo",gu=[];function _u(G){return G!==null&&typeof G==="object"}function Ko(G){return G.map((oe)=>oe.path?{...oe,path:oe.path.slice()}:{...oe})}var vu=new WeakMap,Sn=0,oo=1,kn=2;function io(G,oe,$e){let Pe=vu.get(G);if(Pe!==void 0)return Pe?kn:Sn;if(oe.has(G))return kn;oe.add(G);let Ee=Sn,Fe=(Qe)=>{if(Ee!==kn&&Qe?._zod){let ft=io(Qe,oe,$e);if(ft>Ee)Ee=ft}},Ue=(Qe,ft)=>{let pt=Sn;for(let mt of Reflect.ownKeys(Qe)){let gt=Object.getOwnPropertyDescriptor(Qe,mt);if(ft&&!gt.enumerable)continue;let St=gt.get?oo:gt.value?._zod?io(gt.value,oe,$e):Sn;if(St>pt)pt=St}return pt},Be=(Qe)=>{if(Qe>Ee)Ee=Qe},Xe=G._zod.def,Ye=Xe.type;switch(Ye){case"object":{let Qe=vn(Xe);Be(Qe?Ue(Qe,!0):oo),Fe(Xe.catchall);break}case"array":Fe(Xe.element);break;case"tuple":for(let Qe of Xe.items)Fe(Qe);Fe(Xe.rest);break;case"record":case"map":Fe(Xe.keyType),Fe(Xe.valueType);break;case"set":Fe(Xe.valueType);break;case"union":for(let Qe of Xe.options)Fe(Qe);break;case"intersection":Fe(Xe.left),Fe(Xe.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":Fe(Xe.innerType);break;case"pipe":Fe(Xe.in),Fe(Xe.out);break;case"function":Fe(Xe.input),Fe(Xe.output);break;case"lazy":{let Qe=Xe._cachedInner??($e?G._zod.innerType:void 0);Be(Qe?io(Qe,oe,!1):oo);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let Qe in Xe){let ft=Object.getOwnPropertyDescriptor(Xe,Qe);if(!ft||ft.get)continue;let pt=ft.value;if(!pt||typeof pt!=="object")continue;if(pt._zod)Fe(pt);else if(Array.isArray(pt))for(let mt of pt)Fe(mt)}}return oe.delete(G),Np(G,Ee)}function Np(G,oe){if(oe!==oo)vu.set(G,oe===kn);return oe}function Rp(G,oe){let $e=G.buckets.get(oe);if(!$e)$e=new WeakMap,G.buckets.set(oe,$e);return $e}var ro,no=[],Dp={alloc(G,oe,$e){let Pe=ro;if(!Pe)return $e;ro=void 0;let Ee={value:$e,issues:null};return Pe.set(oe.value,Ee),no.push(Ee),$e},guard(G){var oe;(oe=G._zod).deferred??(oe.deferred=[]),G._zod.deferred.push(()=>{let $e=G._zod.parse,Pe=(Ee,Fe)=>{if(Fe.direction!=="backward"&&Mp(Fe,Ee.value))throw new yu;return $e(Ee,Fe)};if(G._zod.parse=Pe,G._zod.run===$e)G._zod.run=Pe})},attach(G){var oe;let $e,Pe=!1,Ee,Fe;(oe=G._zod).deferred??(oe.deferred=[]),G._zod.deferred.push(()=>{let Ue=G._zod.parse,Be=(Xe,Ye)=>{if($e===void 0){let It=io(G,new Set,!1);if(It===Sn){if(G._zod.parse=Ue,G._zod.run===Be)G._zod.run=Ue;return Ue(Xe,Ye)}if(It===kn||Pe)$e=!0;else Pe=!0}let Qe=Xe.value;if(!_u(Qe))return Ue(Xe,Ye);let ft=Ye[Ho];if(!ft)ft={buckets:new WeakMap,backEdges:void 0},Ye[Ho]=ft;let pt;if(Ee===Ye)pt=Fe;else pt=Rp(ft,G),Ee=Ye,Fe=pt;let mt=pt.get(Qe);if(mt){if(Xe.value=mt.value,mt.issues){if(mt.issues.length)Xe.issues.push(...Ko(mt.issues))}else Xe.memo=!0,ft.backEdges??(ft.backEdges=new WeakSet),ft.backEdges.add(mt.value);return Xe}ro=pt;let gt=no.length,St=Ue(Xe,Ye);ro=void 0;let Tt=no.length>gt?no.pop():void 0;if(St instanceof Promise)return St.then((It)=>{if(Tt)Tt.issues=It.issues.length?Ko(It.issues):gu;return It});if(Tt)Tt.issues=St.issues.length?Ko(St.issues):gu;return St};if(G._zod.parse=Be,G._zod.run===Ue)G._zod.run=Be})}};function bu(){return Dp}function Mp(G,oe){let $e=G[Ho]?.backEdges;return $e!==void 0&&_u(oe)&&$e.has(oe)}var Lp=()=>{let G={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function oe(Fe){return G[Fe]??null}let $e={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},Pe={nan:"NaN"};function Ee(Fe,Ue){if(Fe==="number"&&typeof Ue==="number"&&!Number.isFinite(Ue))return String(Ue);return Pe[Fe]??Fe}return(Fe)=>{switch(Fe.code){case"invalid_type":{let Ue=Ee(Fe.expected),Be=Js(Fe.input),Xe=Ee(Be,Fe.input);return`Invalid input: expected ${Ue}, received ${Xe}`}case"invalid_value":if(Fe.values.length===1)return`Invalid input: expected ${ko(Fe.values[0])}`;return`Invalid option: expected one of ${$o(Fe.values,"|")}`;case"too_big":{let Ue=Fe.exact?"exactly ":Fe.inclusive?"<=":"<",Be=oe(Fe.origin);if(Be)return`Too big: expected ${Fe.origin??"value"} to have ${Ue}${Fe.maximum.toString()} ${Be.unit??"elements"}`;return`Too big: expected ${Fe.origin??"value"} to be ${Ue}${Fe.maximum.toString()}`}case"too_small":{let Ue=Fe.exact?"exactly ":Fe.inclusive?">=":">",Be=oe(Fe.origin);if(Be)return`Too small: expected ${Fe.origin} to have ${Ue}${Fe.minimum.toString()} ${Be.unit}`;return`Too small: expected ${Fe.origin} to be ${Ue}${Fe.minimum.toString()}`}case"invalid_format":{let Ue=Fe;if(Ue.format==="starts_with")return`Invalid string: must start with "${Ue.prefix}"`;if(Ue.format==="ends_with")return`Invalid string: must end with "${Ue.suffix}"`;if(Ue.format==="includes")return`Invalid string: must include "${Ue.includes}"`;if(Ue.format==="regex")return`Invalid string: must match pattern ${Ue.pattern}`;return`Invalid ${$e[Ue.format]??Fe.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${Fe.divisor}`;case"unrecognized_keys":return`Unrecognized key${Fe.keys.length>1?"s":""}: ${$o(Fe.keys,", ")}`;case"invalid_key":return`Invalid key in ${Fe.origin}`;case"invalid_union":if(Fe.options&&Array.isArray(Fe.options)&&Fe.options.length>0)return`Invalid discriminator value. Expected ${Fe.options.map((Be)=>`'${Be}'`).join(" | ")}`;if(Fe.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${Fe.origin}`;default:return"Invalid input"}}};function qo(){return{localeError:Lp()}}var xu;class wu{constructor(){this._map=new WeakMap,this._idmap=new Map}add(G,...oe){let $e=oe[0];if(this._map.set(G,$e),$e&&typeof $e==="object"&&"id"in $e)this._idmap.set($e.id,G);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(G){let oe=this._map.get(G);if(oe&&typeof oe==="object"&&"id"in oe)this._idmap.delete(oe.id);return this._map.delete(G),this}get(G){let oe=G._zod.parent;if(oe){let $e={...this.get(oe)??{}};delete $e.id;let Pe={...$e,...this._map.get(G)};return Object.keys(Pe).length?Pe:void 0}return this._map.get(G)}has(G){return this._map.has(G)}}function jp(){return new wu}(xu=globalThis).__zod_globalRegistry??(xu.__zod_globalRegistry=jp());var Vr=globalThis.__zod_globalRegistry;function so(G){if(G.checks)G.checks=[...G.checks];return G}function $u(G,oe){return new G(so({type:"string",...kt(oe)}))}function Dt(G,oe){return new G(so({type:"string",coerce:!0,...kt(oe)}))}function zu(G,oe){return new G({type:"string",format:"email",check:"string_format",abort:!1,...kt(oe)})}function Su(G,oe){return new G({type:"string",format:"guid",check:"string_format",abort:!1,...kt(oe)})}function ku(G,oe){return new G({type:"string",format:"uuid",check:"string_format",abort:!1,...kt(oe)})}function Pu(G,oe){return new G({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...kt(oe)})}function Eu(G,oe){return new G({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...kt(oe)})}function Ou(G,oe){return new G({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...kt(oe)})}function Tu(G,oe){return new G({type:"string",format:"url",check:"string_format",abort:!1,...kt(oe)})}function Zu(G,oe){return new G({type:"string",format:"emoji",check:"string_format",abort:!1,...kt(oe)})}function Au(G,oe){return new G({type:"string",format:"nanoid",check:"string_format",abort:!1,...kt(oe)})}function Iu(G,oe){return new G({type:"string",format:"cuid",check:"string_format",abort:!1,...kt(oe)})}function Cu(G,oe){return new G({type:"string",format:"cuid2",check:"string_format",abort:!1,...kt(oe)})}function Nu(G,oe){return new G({type:"string",format:"ulid",check:"string_format",abort:!1,...kt(oe)})}function Ru(G,oe){return new G({type:"string",format:"xid",check:"string_format",abort:!1,...kt(oe)})}function Du(G,oe){return new G({type:"string",format:"ksuid",check:"string_format",abort:!1,...kt(oe)})}function Mu(G,oe){return new G({type:"string",format:"ipv4",check:"string_format",abort:!1,...kt(oe)})}function Lu(G,oe){return new G({type:"string",format:"ipv6",check:"string_format",abort:!1,...kt(oe)})}function ju(G,oe){return new G({type:"string",format:"cidrv4",check:"string_format",abort:!1,...kt(oe)})}function Fu(G,oe){return new G({type:"string",format:"cidrv6",check:"string_format",abort:!1,...kt(oe)})}function Uu(G,oe){return new G({type:"string",format:"base64",check:"string_format",abort:!1,...kt(oe)})}function Bu(G,oe){return new G({type:"string",format:"base64url",check:"string_format",abort:!1,...kt(oe)})}function Ju(G,oe){return new G({type:"string",format:"e164",check:"string_format",abort:!1,...kt(oe)})}function Vu(G,oe){return new G({type:"string",format:"jwt",check:"string_format",abort:!1,...kt(oe)})}function Wu(G,oe){return new G({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...kt(oe)})}function Ku(G,oe){return new G({type:"string",format:"date",check:"string_format",...kt(oe)})}function Hu(G,oe){return new G({type:"string",format:"time",check:"string_format",precision:null,...kt(oe)})}function qu(G,oe){return new G({type:"string",format:"duration",check:"string_format",...kt(oe)})}function Gu(G,oe){return new G(so({type:"number",checks:[],...kt(oe)}))}function Ut(G,oe){return new G(so({type:"number",coerce:!0,checks:[],...kt(oe)}))}function Xu(G,oe){return new G({type:"number",check:"number_format",abort:!1,format:"safeint",...kt(oe)})}function Yu(G,oe){return new G({type:"boolean",...kt(oe)})}function Bt(G,oe){return new G({type:"boolean",coerce:!0,...kt(oe)})}function Ft(G,oe){return new G({type:"bigint",coerce:!0,...kt(oe)})}function Qu(G,oe){return new G({type:"null",...kt(oe)})}function el(G){return new G({type:"any"})}function tl(G){return new G({type:"unknown"})}function rl(G,oe){return new G({type:"never",...kt(oe)})}function Zt(G,oe){return new G({type:"date",coerce:!0,...kt(oe)})}function qr(G,oe){return new Mo({check:"less_than",...kt(oe),value:G,inclusive:!1})}function Ir(G,oe){return new Mo({check:"less_than",...kt(oe),value:G,inclusive:!0})}function Gr(G,oe){return new Lo({check:"greater_than",...kt(oe),value:G,inclusive:!1})}function Cr(G,oe){return new Lo({check:"greater_than",...kt(oe),value:G,inclusive:!0})}function Pn(G,oe){return new Lc({check:"multiple_of",...kt(oe),value:G})}function co(G,oe){return new Fc({check:"max_length",...kt(oe),maximum:G})}function Xr(G,oe){return new Uc({check:"min_length",...kt(oe),minimum:G})}function ao(G,oe){return new Bc({check:"length_equals",...kt(oe),length:G})}function Go(G,oe){return new Jc({check:"string_format",format:"regex",...kt(oe),pattern:G})}function Xo(G){return new Vc({check:"string_format",format:"lowercase",...kt(G)})}function Yo(G){return new Wc({check:"string_format",format:"uppercase",...kt(G)})}function Qo(G,oe){return new Kc({check:"string_format",format:"includes",...kt(oe),includes:G})}function ei(G,oe){return new Hc({check:"string_format",format:"starts_with",...kt(oe),prefix:G})}function ti(G,oe){return new qc({check:"string_format",format:"ends_with",...kt(oe),suffix:G})}function ri(G,oe){return new Gc({check:"properties",shape:G,...kt(oe)})}function Lr(G){return new Xc({check:"overwrite",tx:G})}function ni(G){return Lr((oe)=>oe.normalize(G))}function oi(){return Lr((G)=>G.trim())}function ii(){return Lr((G)=>G.toLowerCase())}function si(){return Lr((G)=>G.toUpperCase())}function ci(){return Lr((G)=>Ds(G))}function nl(G,oe,$e){return new G({type:"array",element:oe,...kt($e)})}function ol(G,oe,$e){let Pe=kt($e);return Pe.abort??(Pe.abort=!0),new G({type:"custom",check:"custom",fn:oe,...Pe})}function il(G,oe,$e){return new G({type:"custom",check:"custom",fn:oe,...kt($e)})}function sl(G,oe){let $e=Fp((Pe)=>(Pe.addIssue=(Ee)=>{if(typeof Ee==="string")Pe.issues.push(Jr(Ee,Pe.value,$e._zod.def));else{let Fe=Ee;if(Fe.fatal)Fe.continue=!1;if(Fe.code??(Fe.code="custom"),!("input"in Fe))Fe.input=Pe.value;Fe.inst??(Fe.inst=$e),Fe.continue??(Fe.continue=!$e._zod.def.abort),Pe.issues.push(Jr(Fe))}},G(Pe.value,Pe)),oe);return $e}function Fp(G,oe){let $e=new cr({check:"custom",...kt(oe)});return $e._zod.check=G,$e}function En(G,...oe){for(let $e of oe)for(let Pe of Reflect.ownKeys($e))if(Object.prototype.propertyIsEnumerable.call($e,Pe))dr(G,Pe,$e[Pe]);return G}function Tn(G){let oe=G?.target??"draft-2020-12";if(oe==="draft-4")oe="draft-04";if(oe==="draft-7")oe="draft-07";return{processors:G.processors??{},metadataRegistry:G?.metadata??Vr,target:oe,unrepresentable:G?.unrepresentable??"throw",override:G?.override??(()=>{}),io:G?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:G?.cycles??"ref",reused:G?.reused??"inline",intersections:[],deferred:[],external:G?.external??void 0}}function ar(G,oe,$e,Pe,Ee){let Fe=typeof oe.unrepresentable==="function"?oe.unrepresentable({zodSchema:G,path:Pe.path,message:Ee}):oe.unrepresentable;if(Fe==="any")return!1;if(Fe===void 0||Fe==="throw")throw Error(Ee);return Object.assign($e,Fe),!0}function er(G,oe,$e={path:[],schemaPath:[]}){var Pe;let Ee=G._zod.def,Fe=oe.seen.get(G);if(Fe){if(Fe.count++,$e.schemaPath.includes(G))Fe.cycle=$e.path;return Fe.schema}let Ue={schema:{},count:1,cycle:void 0,path:$e.path};oe.seen.set(G,Ue),oe.sharedDefsExtractedFor=void 0,oe.sharedEmitDoneFor=void 0;let Be=G._zod.toJSONSchema?.();if(Be)Ue.schema=Be;else{let Qe={...$e,schemaPath:[...$e.schemaPath,G],path:$e.path};if(G._zod.processJSONSchema)G._zod.processJSONSchema(oe,Ue.schema,Qe);else{let pt=Ue.schema,mt=oe.processors[Ee.type];if(!mt)throw Error(`[toJSONSchema]: Non-representable type encountered: ${Ee.type}`);mt(G,oe,pt,Qe)}let ft=G._zod.parent;if(ft){if(!Ue.ref)Ue.ref=ft;er(ft,oe,Qe),oe.seen.get(ft).isParent=!0}}let Xe=oe.metadataRegistry.get(G);if(Xe)En(Ue.schema,Xe);if(oe.io==="input"&&fr(G))delete Ue.schema.examples,delete Ue.schema.default;if(oe.io==="input"&&"_prefault"in Ue.schema)(Pe=Ue.schema).default??(Pe.default=Ue.schema._prefault);return delete Ue.schema._prefault,oe.seen.get(G).schema}function cl(G){return G.replace(/~/g,"~0").replace(/\//g,"~1")}function Zn(G,oe){let $e=G.seen.get(oe);if(!$e)throw Error("Unprocessed schema. This is a bug in Zod.");if(G.external&&G.sharedDefsExtractedFor===G.external)return;let Pe=new Map;for(let Ue of G.seen.entries()){let Be=G.metadataRegistry.get(Ue[0])?.id;if(Be){let Xe=Pe.get(Be);if(Xe&&Xe!==Ue[0])throw Error(`Duplicate schema id "${Be}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);Pe.set(Be,Ue[0])}}let Ee=(Ue)=>{let Be=G.target==="draft-2020-12"?"$defs":"definitions";if(G.external){let ft=G.external.registry.get(Ue[0])?.id,pt=G.external.uri??((gt)=>gt);if(ft)return{ref:pt(ft)};let mt=Ue[1].defId??Ue[1].schema.id??`schema${G.counter++}`;return Ue[1].defId=mt,{defId:mt,ref:`${pt("__shared")}#/${Be}/${cl(mt)}`}}let Xe="#",Ye=`${Xe}/${Be}/`;if(Ue[1]===$e&&!Ue[1].schema.id)return{ref:Xe};let Qe=Ue[1].schema.id??`__schema${G.counter++}`;return{defId:Qe,ref:Ye+cl(Qe)}},Fe=(Ue)=>{if(Ue[1].schema.$ref)return;let Be=Ue[1],{ref:Xe,defId:Ye}=Ee(Ue);if(Be.def={...Be.schema},Ye)Be.defId=Ye;let Qe=Be.schema;for(let ft in Qe)delete Qe[ft];Qe.$ref=Xe};if(G.cycles==="throw")for(let Ue of G.seen.entries()){let Be=Ue[1];if(Be.cycle)throw Error(`Cycle detected: #/${Be.cycle?.join("/")}/<root>
58
-
59
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Ue of G.seen.entries()){let Be=Ue[1];if(oe===Ue[0]){Fe(Ue);continue}if(G.external){let Ye=G.external.registry.get(Ue[0])?.id;if(oe!==Ue[0]&&Ye){Fe(Ue);continue}}if(G.metadataRegistry.get(Ue[0])?.id){Fe(Ue);continue}if(Be.cycle){Fe(Ue);continue}if(Be.count>1){if(G.reused==="ref")Fe(Ue)}}if(G.external)G.sharedDefsExtractedFor=G.external}function ll(G){let oe=G.anyOf;if(!Array.isArray(oe)||oe.length===0||G.type!==void 0)return;let $e=[];for(let Pe of oe){if(!Pe||typeof Pe!=="object")return;ll(Pe);let Ee=Object.keys(Pe);if(Ee.length!==1||Ee[0]!=="type")return;let Fe=Pe.type;for(let Ue of Array.isArray(Fe)?Fe:[Fe]){if(typeof Ue!=="string")return;if(!$e.includes(Ue))$e.push(Ue)}}delete G.anyOf,G.type=$e.length===1?$e[0]:$e}var fl=new Set(["type","properties","required","additionalProperties"]),al=["oneOf","anyOf"];function ul(G){let oe=G.additionalProperties;if(oe===void 0||oe===!1||typeof oe!=="object"||oe===null)return null;return Object.keys(oe).length?oe:null}function ai(G){let oe=[];for(let Fe of G){if(typeof Fe!=="object"||Fe.type!=="object")return null;for(let Ue in Fe)if(!fl.has(Ue))return null;oe.push(Fe)}let $e={},Pe=new Set;for(let Fe of oe){for(let Ue in Fe.properties){if(Object.prototype.hasOwnProperty.call($e,Ue))continue;let Be=[];for(let Ye of oe){let Qe=Ye.properties?.[Ue]??ul(Ye);if(Qe===null||Qe===void 0)continue;if(!Be.some((ft)=>JSON.stringify(ft)===JSON.stringify(Qe)))Be.push(Qe)}let Xe=Be.length===1?Be[0]:ai(Be)??{allOf:Be};dr($e,Ue,Xe)}for(let Ue of Fe.required??[])Pe.add(Ue)}let Ee={type:"object",properties:$e};if(Pe.size)Ee.required=[...Pe];if(oe.every((Fe)=>Fe.additionalProperties===!1))Ee.additionalProperties=!1;else{let Fe=[];for(let Ue of oe){let Be=ul(Ue);if(Be&&!Fe.some((Xe)=>JSON.stringify(Xe)===JSON.stringify(Be)))Fe.push(Be)}if(Fe.length===1)Ee.additionalProperties=Fe[0];else if(Fe.length>1)Ee.additionalProperties={allOf:Fe}}return Ee}function Up(G){let oe=G.allOf;if(!Array.isArray(oe)||oe.length<2)return;for(let Ee of fl)if(Ee in G)return;let $e=oe.filter((Ee)=>al.some((Fe)=>Array.isArray(Ee[Fe]))),Pe=null;if(!$e.length)Pe=ai(oe);else{let Ee=$e[0],Fe=al.find((Xe)=>Array.isArray(Ee[Xe]));if(Object.keys(Ee).length!==1)return;let Ue=oe.filter((Xe)=>Xe!==Ee),Be=Ee[Fe].map((Xe)=>ai([...Ue,Xe]));if(Be.some((Xe)=>!Xe))return;Pe={[Fe]:Be}}if(!Pe)return;delete G.allOf,En(G,Pe)}function An(G,oe){let $e=G.seen.get(oe);if(!$e)throw Error("Unprocessed schema. This is a bug in Zod.");let Pe=(Be)=>{let Xe=G.seen.get(Be);if(Xe.ref===null)return;let Ye=Xe.def??Xe.schema,Qe={...Ye},ft=Xe.ref;if(Xe.ref=null,ft){Pe(ft);let mt=G.seen.get(ft),gt=mt.schema;if(gt.$ref&&(G.target==="draft-07"||G.target==="draft-04"||G.target==="openapi-3.0"))Ye.allOf=Ye.allOf??[],Ye.allOf.push(gt);else En(Ye,gt);if(En(Ye,Qe),Be._zod.parent===ft)for(let Tt in Ye){if(Tt==="$ref"||Tt==="allOf")continue;if(!(Tt in Qe))delete Ye[Tt]}if(gt.$ref&&mt.def)for(let Tt in Ye){if(Tt==="$ref"||Tt==="allOf")continue;if(Tt in mt.def&&JSON.stringify(Ye[Tt])===JSON.stringify(mt.def[Tt]))delete Ye[Tt]}}let pt=Be._zod.parent;if(pt&&pt!==ft){Pe(pt);let mt=G.seen.get(pt);if(mt?.schema.$ref){if(Ye.$ref=mt.schema.$ref,mt.def)for(let gt in Ye){if(gt==="$ref"||gt==="allOf")continue;if(gt in mt.def&&JSON.stringify(Ye[gt])===JSON.stringify(mt.def[gt]))delete Ye[gt]}}}G.override({zodSchema:Be,jsonSchema:Ye,path:Xe.path??[]})};if(!G.external||G.sharedEmitDoneFor!==G.external){for(let Be of[...G.seen.entries()].reverse())Pe(Be[0]);if(G.target!=="openapi-3.0")for(let Be of G.seen.entries())ll(Be[1].def??Be[1].schema);for(let Be of G.deferred)Be();if(G.intersections.length){let Be=new Map;for(let Xe of G.seen.values())for(let Ye of[Xe.schema,Xe.def]){let Qe=Ye?.allOf;if(!Array.isArray(Qe))continue;let ft=Be.get(Qe);if(ft)ft.push(Ye);else Be.set(Qe,[Ye])}for(let Xe of G.intersections)for(let Ye of Be.get(Xe)??[])Up(Ye)}}let Ee={};if(G.target==="draft-2020-12")Ee.$schema="https://json-schema.org/draft/2020-12/schema";else if(G.target==="draft-07")Ee.$schema="http://json-schema.org/draft-07/schema#";else if(G.target==="draft-04")Ee.$schema="http://json-schema.org/draft-04/schema#";else if(G.target==="openapi-3.0");if(G.external?.uri){let Be=G.external.registry.get(oe)?.id;if(!Be)throw Error("Schema is missing an `id` property");Ee.$id=G.external.uri(Be)}En(Ee,$e.defId?$e.schema:$e.def??$e.schema);let Fe=G.metadataRegistry.get(oe)?.id;if(Fe!==void 0&&Ee.id===Fe)delete Ee.id;let Ue=G.external?.defs??{};if(!G.external||G.sharedEmitDoneFor!==G.external)for(let Be of G.seen.entries()){let Xe=Be[1];if(Xe.def&&Xe.defId){if(Xe.def.id===Xe.defId)delete Xe.def.id;dr(Ue,Xe.defId,Xe.def)}}if(G.external)G.sharedEmitDoneFor=G.external;if(G.external);else if(Object.keys(Ue).length>0)if(G.target==="draft-2020-12")Ee.$defs=Ue;else Ee.definitions=Ue;try{let Be=JSON.parse(JSON.stringify(Ee));return Object.defineProperty(Be,"~standard",{value:{...oe["~standard"],jsonSchema:{input:On(oe,"input",G.processors),output:On(oe,"output",G.processors)}},enumerable:!1,writable:!1}),Be}catch(Be){throw Error("Error converting schema to JSON.")}}function fr(G,oe){let $e=oe??{seen:new Set};if($e.seen.has(G))return!1;$e.seen.add(G);let Pe=G._zod.def;if(Pe.type==="transform")return!0;if(Pe.type==="array")return fr(Pe.element,$e);if(Pe.type==="set")return fr(Pe.valueType,$e);if(Pe.type==="lazy")return fr(Pe.getter(),$e);if(Pe.type==="promise"||Pe.type==="optional"||Pe.type==="nonoptional"||Pe.type==="nullable"||Pe.type==="readonly"||Pe.type==="default"||Pe.type==="prefault"||Pe.type==="catch")return fr(Pe.innerType,$e);if(Pe.type==="intersection")return fr(Pe.left,$e)||fr(Pe.right,$e);if(Pe.type==="record"||Pe.type==="map")return fr(Pe.keyType,$e)||fr(Pe.valueType,$e);if(Pe.type==="pipe"){if(G._zod.traits.has("$ZodCodec"))return!0;return fr(Pe.in,$e)||fr(Pe.out,$e)}if(Pe.type==="object"){for(let Ee in Pe.shape)if(fr(Pe.shape[Ee],$e))return!0;return!1}if(Pe.type==="union"){for(let Ee of Pe.options)if(fr(Ee,$e))return!0;return!1}if(Pe.type==="tuple"){for(let Ee of Pe.items)if(fr(Ee,$e))return!0;if(Pe.rest&&fr(Pe.rest,$e))return!0;return!1}return!1}var pl=(G,oe={})=>($e)=>{let Pe=Tn({...$e,processors:oe});return er(G,Pe),Zn(Pe,G),An(Pe,G)},On=(G,oe,$e={})=>(Pe)=>{let{libraryOptions:Ee,target:Fe}=Pe??{},Ue=Tn({...Ee??{},target:Fe,io:oe,processors:$e});return er(G,Ue),Zn(Ue,G),An(Ue,G)};var Yr=(G,oe,$e)=>{if(G[oe]===void 0||$e>G[oe])G[oe]=$e},Qr=(G,oe,$e)=>{if(G[oe]===void 0||$e<G[oe])G[oe]=$e},dl=(G,oe)=>{Yr(G,"minimum",oe),Qr(G,"maximum",oe)},_l=(G,oe)=>{if(G.multipleOf??(G.multipleOf=[]),!G.multipleOf.includes(oe))G.multipleOf.push(oe)},vl=(G,oe)=>{G.patterns??(G.patterns=new Set),G.patterns.add(oe)},bl=(G,oe)=>{G.mime=G.mime?G.mime.filter(($e)=>oe.includes($e)):[...oe]},xl=(G,oe)=>{if(G.format=oe,oe.includes("int"))G.isInt=!0},ml=(G,oe)=>Yr(G,"minimum",oe.minimum),hl=(G,oe)=>Qr(G,"maximum",oe.maximum),gl=(G)=>(oe,$e)=>{xl(oe,$e.format);let[Pe,Ee]=G[$e.format];Yr(oe,"minimum",Pe),Qr(oe,"maximum",Ee)},Bp={greater_than:(G,oe)=>Yr(G,oe.inclusive?"minimum":"exclusiveMinimum",oe.value),less_than:(G,oe)=>Qr(G,oe.inclusive?"maximum":"exclusiveMaximum",oe.value),multiple_of:(G,oe)=>_l(G,oe.value),number_format:gl(Ln),bigint_format:gl(Po),min_length:ml,max_length:hl,length_equals:(G,oe)=>dl(G,oe.length),min_size:ml,max_size:hl,size_equals:(G,oe)=>dl(G,oe.size),string_format:(G,oe)=>{if(xl(G,oe.format),oe.pattern)vl(G,oe.pattern);if(oe.format==="base64"||oe.format==="base64url")G.contentEncoding=oe.format;if(oe.local||oe.precision===-1)G.laxFormat=!0},mime_type:(G,oe)=>bl(G,oe.mime)};function sr(G){let oe={},$e=G._zod.def,Pe=G._zod.traits.has("$ZodCheck")?[G,...$e.checks??[]]:$e.checks??[];for(let Fe of Pe)Bp[Fe._zod.def.check]?.(oe,Fe._zod.def);let Ee=G._zod.bag;if(Ee.minimum!==void 0)Yr(oe,"minimum",Ee.minimum);if(Ee.exclusiveMinimum!==void 0)Yr(oe,"exclusiveMinimum",Ee.exclusiveMinimum);if(Ee.maximum!==void 0)Qr(oe,"maximum",Ee.maximum);if(Ee.exclusiveMaximum!==void 0)Qr(oe,"exclusiveMaximum",Ee.exclusiveMaximum);if(Ee.multipleOf!==void 0)_l(oe,Ee.multipleOf);if(Ee.format!==void 0){if(oe.format??(oe.format=Ee.format),Ee.format.includes("int"))oe.isInt=!0}if(Ee.mime)bl(oe,Ee.mime);for(let Fe of Ee.patterns??[])vl(oe,Fe);return oe}var Jp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Vp=new Map([[Bo,zc],[to,Sc]]),wl=(G)=>Vp.get(G)??G,fi=(G,oe,$e,Pe)=>{let Ee=$e;Ee.type="string";let{minimum:Fe,maximum:Ue,format:Be,patterns:Xe,contentEncoding:Ye,laxFormat:Qe}=sr(G);if(typeof Fe==="number")Ee.minLength=Fe;if(typeof Ue==="number")Ee.maxLength=Ue;if(Be){if(Ee.format=Jp[Be]??Be,Ee.format==="")delete Ee.format;if(Be==="time"||Qe)delete Ee.format}if(Ye)Ee.contentEncoding=Ye;if(Xe&&Xe.size>0){let ft=[...Xe].map(wl);if(ft.length===1)Ee.pattern=ft[0].source;else if(ft.length>1)Ee.allOf=[...ft.map((pt)=>({...oe.target==="draft-07"||oe.target==="draft-04"||oe.target==="openapi-3.0"?{type:"string"}:{},pattern:pt.source}))]}},pi=(G,oe,$e,Pe)=>{let Ee=$e,{minimum:Fe,maximum:Ue,multipleOf:Be,exclusiveMaximum:Xe,exclusiveMinimum:Ye,isInt:Qe}=sr(G);Ee.type=Qe?"integer":"number";let ft=typeof Ye==="number"&&Ye>=(Fe??Number.NEGATIVE_INFINITY),pt=typeof Xe==="number"&&Xe<=(Ue??Number.POSITIVE_INFINITY),mt=oe.target==="draft-04"||oe.target==="openapi-3.0";if(ft)if(mt)Ee.minimum=Ye,Ee.exclusiveMinimum=!0;else Ee.exclusiveMinimum=Ye;else if(typeof Fe==="number")Ee.minimum=Fe;if(pt)if(mt)Ee.maximum=Xe,Ee.exclusiveMaximum=!0;else Ee.exclusiveMaximum=Xe;else if(typeof Ue==="number")Ee.maximum=Ue;if(Be){let gt=new Set;for(let It of Be)if(Number.isFinite(It)&&It!==0)gt.add(Math.abs(It));else ar(G,oe,Ee,Pe,`A multipleOf divisor of ${It} cannot be represented in JSON Schema`);let[St,...Tt]=gt;if(St!==void 0)Ee.multipleOf=St;if(Tt.length)Ee.allOf=[...Ee.allOf??[],...Tt.map((It)=>({multipleOf:It}))]}},di=(G,oe,$e,Pe)=>{$e.type="boolean"},mi=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"BigInt cannot be represented in JSON Schema")},$l=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Symbols cannot be represented in JSON Schema")},hi=(G,oe,$e,Pe)=>{if(oe.target==="openapi-3.0")$e.type="string",$e.nullable=!0,$e.enum=[null];else $e.type="null"},zl=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Undefined cannot be represented in JSON Schema")},Sl=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Void cannot be represented in JSON Schema")},gi=(G,oe,$e,Pe)=>{$e.not={}},yi=(G,oe,$e,Pe)=>{},_i=(G,oe,$e,Pe)=>{},vi=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Date cannot be represented in JSON Schema")},bi=(G,oe,$e,Pe)=>{let Ee=G._zod.def,Fe=hn(Ee.entries);if(Fe.length===0){$e.not={};return}if(Fe.every((Ue)=>typeof Ue==="number"))$e.type="number";if(Fe.every((Ue)=>typeof Ue==="string"))$e.type="string";$e.enum=Fe},xi=(G,oe,$e,Pe)=>{let Ee=G._zod.def;if(Ee.values.length===0){$e.not={};return}let Fe=[];for(let Ue of Ee.values)if(Ue===void 0){if(ar(G,oe,$e,Pe,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof Ue==="bigint"){if(ar(G,oe,$e,Pe,"BigInt literals cannot be represented in JSON Schema"))return;Fe.push(Number(Ue))}else Fe.push(Ue);if(Fe.length===0);else if(Fe.length===1){let Ue=Fe[0];if($e.type=Ue===null?"null":typeof Ue,oe.target==="draft-04"||oe.target==="openapi-3.0")$e.enum=[Ue];else $e.const=Ue}else{if(Fe.every((Ue)=>typeof Ue==="number"))$e.type="number";if(Fe.every((Ue)=>typeof Ue==="string"))$e.type="string";if(Fe.every((Ue)=>typeof Ue==="boolean"))$e.type="boolean";if(Fe.every((Ue)=>Ue===null))$e.type="null";$e.enum=Fe}},kl=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"NaN cannot be represented in JSON Schema")},Pl=(G,oe,$e,Pe)=>{let Ee=$e,Fe=G._zod.pattern;if(!Fe)throw Error("Pattern not found in template literal");Ee.type="string",Ee.pattern=Fe.source},El=(G,oe,$e,Pe)=>{let Ee=$e;Ee.type="string",Ee.format="binary",Ee.contentEncoding="binary";let{minimum:Fe,maximum:Ue,mime:Be}=sr(G);if(Fe!==void 0)Ee.minLength=Fe;if(Ue!==void 0)Ee.maxLength=Ue;if(!Be)return;if(Be.length===0)Ee.not={};else if(Be.length===1)Ee.contentMediaType=Be[0];else Ee.anyOf=Be.map((Xe)=>({contentMediaType:Xe}))},Ol=(G,oe,$e,Pe)=>{$e.type="boolean"},wi=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Custom types cannot be represented in JSON Schema")},Tl=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Function types cannot be represented in JSON Schema")},$i=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Transforms cannot be represented in JSON Schema")},Zl=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Map cannot be represented in JSON Schema")},Al=(G,oe,$e,Pe)=>{ar(G,oe,$e,Pe,"Set cannot be represented in JSON Schema")},zi=(G,oe,$e,Pe)=>{let Ee=$e,Fe=G._zod.def,{minimum:Ue,maximum:Be}=sr(G);if(typeof Ue==="number")Ee.minItems=Ue;if(typeof Be==="number")Ee.maxItems=Be;Ee.type="array",Ee.items=er(Fe.element,oe,{...Pe,path:[...Pe.path,"items"]})};function In(G){let oe=G._zod.def;if(oe.type==="pipe"&&oe.in._zod.traits.has("$ZodTransform"))return In(oe.out);if(oe.type==="catch")return In(oe.innerType);return G._zod.optin}var Si=(G,oe,$e,Pe)=>{let Ee=$e,Fe=G._zod.def,Ue=Fe.shape;if(Object.getOwnPropertySymbols(Ue).length&&ar(G,oe,Ee,Pe,"Symbol keys cannot be represented in JSON Schema"))return;Ee.type="object",Ee.properties={};for(let Ye in Ue)dr(Ee.properties,Ye,er(Ue[Ye],oe,{...Pe,path:[...Pe.path,"properties",Ye]}));let Xe=[];for(let Ye of Object.keys(Ue)){let Qe=Fe.shape[Ye];if(oe.io==="input"?In(Qe)===void 0:Qe._zod.optout===void 0)Xe.push(Ye)}if(Xe.length>0)Ee.required=Xe;if(Fe.catchall?._zod.def.type==="never")Ee.additionalProperties=!1;else if(!Fe.catchall){if(oe.io==="output")Ee.additionalProperties=!1}else if(Fe.catchall)Ee.additionalProperties=er(Fe.catchall,oe,{...Pe,path:[...Pe.path,"additionalProperties"]})},ki=(G,oe,$e,Pe)=>{let Ee=G._zod.def,Fe=Ee.inclusive===!1,Ue=Ee.options.map((Be,Xe)=>er(Be,oe,{...Pe,path:[...Pe.path,Fe?"oneOf":"anyOf",Xe]}));if(Fe)$e.oneOf=Ue;else $e.anyOf=Ue},Pi=(G,oe,$e,Pe)=>{let Ee=G._zod.def,Fe=er(Ee.left,oe,{...Pe,path:[...Pe.path,"allOf",0]}),Ue=er(Ee.right,oe,{...Pe,path:[...Pe.path,"allOf",1]}),Be=(Ye)=>("allOf"in Ye)&&Object.keys(Ye).length===1,Xe=[...Be(Fe)?Fe.allOf:[Fe],...Be(Ue)?Ue.allOf:[Ue]];$e.allOf=Xe,oe.intersections.push(Xe)},Ei=(G,oe,$e,Pe)=>{let Ee=$e,Fe=G._zod.def;Ee.type="array";let Ue=oe.target==="draft-2020-12"?"prefixItems":"items",Be=oe.target==="draft-2020-12"?"items":oe.target==="openapi-3.0"?"items":"additionalItems",Xe=Fe.items.map((St,Tt)=>er(St,oe,{...Pe,path:[...Pe.path,Ue,Tt]})),Ye=Fe.rest?er(Fe.rest,oe,{...Pe,path:[...Pe.path,Be,...oe.target==="openapi-3.0"?[Fe.items.length]:[]]}):null,Qe=Fe.items.length;while(Qe>0){let St=Fe.items[Qe-1];if(!(oe.io==="input"?In(St)!==void 0:St._zod.optout==="optional"))break;Qe--}let ft=Fe.items.length,pt=!Fe.rest;if(oe.target==="draft-2020-12"){if(Ee.prefixItems=Xe,pt)Ee.items=!1;else if(Ye)Ee.items=Ye;if(Qe>0)Ee.minItems=Qe;if(pt)Ee.maxItems=ft}else if(oe.target==="openapi-3.0"){if(Ee.items={anyOf:Xe},Ye)Ee.items.anyOf.push(Ye);if(Qe>0)Ee.minItems=Qe;if(pt)Ee.maxItems=ft}else{if(Ee.items=Xe,pt)Ee.additionalItems=!1;else if(Ye)Ee.additionalItems=Ye;if(Qe>0)Ee.minItems=Qe;if(pt)Ee.maxItems=ft}let{minimum:mt,maximum:gt}=sr(G);if(typeof mt==="number")Ee.minItems=mt;if(typeof gt==="number")Ee.maxItems=gt};function ui(G,oe,$e){if(oe.$ref){if($e.has(oe))return oe;$e.add(oe);let gt=G.get(oe)?.def;if(!gt)return oe;let St=ui(G,gt,$e);return St===gt?oe:St}for(let gt of["anyOf","oneOf"]){let St=oe[gt];if(!Array.isArray(St))continue;let Tt=St.map((It)=>ui(G,It,$e));if(Tt.some((It,ir)=>It!==St[ir]))oe={...oe,[gt]:Tt}}let Pe=Array.isArray(oe.type)?oe.type:[oe.type],Ee=!Pe.includes("string")&&Pe.some((gt)=>gt==="number"||gt==="integer"),Fe=oe.enum??(oe.const!==void 0?[oe.const]:void 0);if(!Ee&&!Fe?.some((gt)=>typeof gt==="number"))return oe;let{minimum:Ue,maximum:Be,exclusiveMinimum:Xe,exclusiveMaximum:Ye,multipleOf:Qe,format:ft,id:pt,...mt}=oe;if(mt.enum)mt.enum=mt.enum.map((gt)=>typeof gt==="number"?String(gt):gt);else if(typeof mt.const==="number")mt.const=String(mt.const);if(!Ee)return mt;if(mt.type="string",!Fe)mt.pattern=(Pe.includes("number")?wn:Ro).source;return mt}var li=new WeakMap;function Wp(G){let oe=new Map;for(let Pe of G.seen.values())if(Pe.def&&!oe.has(Pe.schema))oe.set(Pe.schema,Pe);let $e=new Map;for(let Pe of li.get(G)??[]){let Ee=G.seen.get(Pe),Fe=(Ee?.def??Ee?.schema)?.propertyNames;if(!Fe||Fe===!0||$e.has(Fe))continue;let Ue=ui(oe,Fe,new Set);if(Ue!==Fe)$e.set(Fe,Ue)}if(!$e.size)return;for(let Pe of G.seen.values())for(let Ee of[Pe.schema,Pe.def]){let Fe=Ee&&$e.get(Ee.propertyNames);if(Fe)Ee.propertyNames=Fe}}var Oi=(G,oe,$e,Pe)=>{let Ee=$e,Fe=G._zod.def;Ee.type="object";let Ue=Fe.keyType,Be=sr(Ue).patterns;if(Fe.mode==="loose"&&Be&&Be.size>0){let Qe=er(Fe.valueType,oe,{...Pe,path:[...Pe.path,"patternProperties","*"]});Ee.patternProperties={};for(let ft of Be)dr(Ee.patternProperties,wl(ft).source,Qe)}else{if(oe.target==="draft-07"||oe.target==="draft-2020-12"){Ee.propertyNames=er(Fe.keyType,oe,{...Pe,path:[...Pe.path,"propertyNames"]});let Qe=li.get(oe);if(!Qe)Qe=[],li.set(oe,Qe),oe.deferred.push(()=>Wp(oe));Qe.push(G)}Ee.additionalProperties=er(Fe.valueType,oe,{...Pe,path:[...Pe.path,"additionalProperties"]})}let Xe=Ue._zod.values,Ye=oe.io==="input"&&In(Fe.valueType)!==void 0;if(Xe&&!Fe.partial&&!Ye){let Qe=[...Xe].filter((ft)=>typeof ft==="string"||typeof ft==="number");if(Qe.length>0)Ee.required=Qe.map(String)}},Ti=(G,oe,$e,Pe)=>{let Ee=G._zod.def,Fe=er(Ee.innerType,oe,Pe),Ue=oe.seen.get(G);if(oe.target==="openapi-3.0")Ue.ref=Ee.innerType,$e.nullable=!0;else $e.anyOf=[Fe,{type:"null"}]},Zi=(G,oe,$e,Pe)=>{let Ee=G._zod.def;er(Ee.innerType,oe,Pe);let Fe=oe.seen.get(G);Fe.ref=Ee.innerType},Ai=Symbol();function Il(G,oe,$e,Pe,Ee){let Fe=!1,Ue=JSON.stringify(G,(Be,Xe)=>{if(typeof Xe!=="bigint")return Xe;return Fe=!0,null});if(!Fe)return JSON.parse(Ue);return ar(oe,$e,Pe,Ee,"BigInt defaults cannot be represented in JSON Schema"),Ai}var Ii=(G,oe,$e,Pe)=>{let Ee=G._zod.def;er(Ee.innerType,oe,Pe);let Fe=oe.seen.get(G);Fe.ref=Ee.innerType;let Ue=Il(Ee.defaultValue,G,oe,$e,Pe);if(Ue!==Ai)$e.default=Ue},Ci=(G,oe,$e,Pe)=>{let Ee=G._zod.def;er(Ee.innerType,oe,Pe);let Fe=oe.seen.get(G);if(Fe.ref=Ee.innerType,oe.io!=="input")return;let Ue=Il(Ee.defaultValue,G,oe,$e,Pe);if(Ue!==Ai)$e._prefault=Ue},Ni=(G,oe,$e,Pe)=>{let Ee=G._zod.def;er(Ee.innerType,oe,Pe);let Fe=oe.seen.get(G);Fe.ref=Ee.innerType;let Ue;try{Ue=Ee.catchValue(void 0)}catch{ar(G,oe,$e,Pe,"Dynamic catch values are not supported in JSON Schema");return}$e.default=Ue},Ri=(G,oe,$e,Pe)=>{let Ee=G._zod.def,Fe=Ee.in._zod.traits.has("$ZodTransform"),Ue=oe.io==="input"?Fe?Ee.out:Ee.in:Ee.out;er(Ue,oe,Pe);let Be=oe.seen.get(G);Be.ref=Ue},Di=(G,oe,$e,Pe)=>{let Ee=G._zod.def;er(Ee.innerType,oe,Pe);let Fe=oe.seen.get(G);Fe.ref=Ee.innerType,$e.readOnly=!0},Cl=(G,oe,$e,Pe)=>{let Ee=G._zod.def;er(Ee.innerType,oe,Pe);let Fe=oe.seen.get(G);Fe.ref=Ee.innerType},uo=(G,oe,$e,Pe)=>{let Ee=G._zod.def;er(Ee.innerType,oe,Pe);let Fe=oe.seen.get(G);Fe.ref=Ee.innerType},Mi=(G,oe,$e,Pe)=>{let Ee=G._zod.innerType;er(Ee,oe,Pe);let Fe=oe.seen.get(G);Fe.ref=Ee},yl={string:fi,number:pi,boolean:di,bigint:mi,symbol:$l,null:hi,undefined:zl,void:Sl,never:gi,any:yi,unknown:_i,date:vi,enum:bi,literal:xi,nan:kl,template_literal:Pl,file:El,success:Ol,custom:wi,function:Tl,transform:$i,map:Zl,set:Al,array:zi,object:Si,union:ki,intersection:Pi,tuple:Ei,record:Oi,nullable:Ti,nonoptional:Zi,default:Ii,prefault:Ci,catch:Ni,pipe:Ri,readonly:Di,promise:Cl,optional:uo,lazy:Mi};function tt(G,oe){if("_idmap"in G){let Pe=G,Ee=Tn({...oe,processors:yl}),Fe={};for(let Xe of Pe._idmap.entries()){let[Ye,Qe]=Xe;er(Qe,Ee)}let Ue={},Be={registry:Pe,uri:oe?.uri,defs:Fe};Ee.external=Be;for(let Xe of Pe._idmap.entries()){let[Ye,Qe]=Xe;Zn(Ee,Qe),dr(Ue,Ye,An(Ee,Qe))}if(Object.keys(Fe).length>0){let Xe=Ee.target==="draft-2020-12"?"$defs":"definitions";Ue.__shared={[Xe]:Fe}}return{schemas:Ue}}let $e=Tn({...oe,processors:yl});return er(G,$e),Zn($e,G),An($e,G)}var Nl=new WeakSet([Object.prototype,Error.prototype]);function lo(G,oe,$e){Object.defineProperty(G,oe,{configurable:!0,enumerable:!1,get(){let Pe=$e(this);return Object.defineProperty(this,oe,{value:Pe,configurable:!0,writable:!0}),Pe},set(Pe){Object.defineProperty(this,oe,{value:Pe,configurable:!0,writable:!0})}})}var Qp=(G,oe)=>{Xs.init(G,oe),G.name="ZodError";let $e=Object.getPrototypeOf(G);if(Nl.has($e))return;Nl.add($e),lo($e,"format",(Pe)=>(Ee)=>Qs(Pe,Ee)),lo($e,"flatten",(Pe)=>(Ee)=>Ys(Pe,Ee)),lo($e,"addIssue",(Pe)=>(Ee)=>{Pe.issues.push(Ee),Pe.message=JSON.stringify(Pe.issues,gn,2)}),lo($e,"addIssues",(Pe)=>(Ee)=>{Pe.issues.push(...Ee),Pe.message=JSON.stringify(Pe.issues,gn,2)}),Object.defineProperty($e,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var gr=ht("ZodError",Qp,void 0,{Parent:Error});var Rl=Wn(gr),Dl=Kn(gr),Ml=Hn(gr),He=qn(gr),Ll=tc(gr),jl=rc(gr),Fl=nc(gr),Ul=oc(gr),Bl=ic(gr),Jl=sc(gr),Vl=cc(gr),Wl=ac(gr);function td(){if(!lr.localeError)hr(qo())}function Cn(){if(!lr.memoizer)hr({memoizer:bu()})}var jt=ht("ZodType",(G,oe)=>(td(),Lt.init(G,oe),G.def=oe,G.type=oe.type,G),{check(...G){let oe=this.def;return this.clone(mr(oe,{checks:[...oe.checks??[],...G.map(($e)=>typeof $e==="function"?{_zod:{check:$e,def:{check:"custom"},onattach:[]}}:$e)]}),{parent:!0})},with(...G){return this.check(...G)},clone(G,oe){return kr(this,G,oe)},brand(){return this},register(G,oe){return G.add(this,oe),this},refine(G,oe){return this.check(qd(G,oe))},superRefine(G,oe){return this.check(Gd(G,oe))},overwrite(G){return this.check(Lr(G))},optional(){return Hl(this)},exactOptional(){return Rd(this)},nullable(){return ql(this)},nullish(){return Hl(ql(this))},nonoptional(G){return Ud(this,G)},array(){return o(this)},or(G){return l([this,G])},and(G){return nt(this,G)},transform(G){return Gl(this,Nd(G))},default(G){return Ld(this,G)},prefault(G){return Fd(this,G)},catch(G){return Jd(this,G)},pipe(G){return Gl(this,G)},readonly(){return Kd(this)},describe(G){let oe=this.clone();return Vr.add(oe,{description:G}),oe},meta(...G){if(G.length===0)return Vr.get(this);let oe=this.clone();return Vr.add(oe,G[0]),oe},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(G,...oe){return oe.length===0?G(this):G(this,...oe)},get "~standard"(){return bn(this,"~standard",{...Uo(this),jsonSchema:{input:On(this,"input"),output:On(this,"output")}})},set "~standard"(G){Ar(this,"~standard",G)},parse:function G(oe,$e){return Rl(this,oe,$e,{callee:G})},parseAsync:async function G(oe,$e){return await Dl(this,oe,$e,{callee:G})},safeParse(G,oe){return Ml(this,G,oe)},async safeParseAsync(G,oe){return He(this,G,oe)},get spa(){return this?.safeParseAsync},set spa(G){Ar(this,"spa",G)},validate(G,oe){return Ao(this,G,oe)},validateAsync(G,oe){return Io(this,G,oe)},encode:function G(oe,$e){return Ll(this,oe,$e,{callee:G})},decode:function G(oe,$e){return jl(this,oe,$e,{callee:G})},encodeAsync:async function G(oe,$e){return await Fl(this,oe,$e,{callee:G})},decodeAsync:async function G(oe,$e){return await Ul(this,oe,$e,{callee:G})},safeEncode(G,oe){return Bl(this,G,oe)},safeDecode(G,oe){return Jl(this,G,oe)},async safeEncodeAsync(G,oe){return Vl(this,G,oe)},async safeDecodeAsync(G,oe){return Wl(this,G,oe)},toJSONSchema(G){return pl(this,{})(G)},get description(){return Vr.get(this)?.description},get _def(){return this._zod.def}}),Xl=ht("_ZodString",(G,oe)=>{eo.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>fi(G,$e,Pe,Ee)},Jn({format:(G)=>sr(G).format??null,minLength:(G)=>sr(G).minimum??null,maxLength:(G)=>sr(G).maximum??null},{regex(...G){return this.check(Go(...G))},includes(...G){return this.check(Qo(...G))},startsWith(...G){return this.check(ei(...G))},endsWith(...G){return this.check(ti(...G))},min(...G){return this.check(Xr(...G))},max(...G){return this.check(co(...G))},length(...G){return this.check(ao(...G))},nonempty(...G){return this.check(Xr(1,...G))},lowercase(G){return this.check(Xo(G))},uppercase(G){return this.check(Yo(G))},trim(){return this.check(oi())},normalize(...G){return this.check(ni(...G))},toLowerCase(){return this.check(ii())},toUpperCase(){return this.check(si())},slugify(){return this.check(ci())}})),Et=ht("ZodString",(G,oe)=>{eo.init(G,oe),Xl.init(G,oe)},{email(G){return this.check(zu(sd,G))},url(G){return this.check(Tu(ad,G))},jwt(G){return this.check(Vu($d,G))},emoji(G){return this.check(Zu(ud,G))},guid(G){return this.check(Su(cd,G))},uuid(G){return this.check(ku(fo,G))},uuidv4(G){return this.check(Pu(fo,G))},uuidv6(G){return this.check(Eu(fo,G))},uuidv7(G){return this.check(Ou(fo,G))},nanoid(G){return this.check(Au(ld,G))},cuid(G){return this.check(Iu(fd,G))},cuid2(G){return this.check(Cu(pd,G))},ulid(G){return this.check(Nu(dd,G))},base64(G){return this.check(Uu(bd,G))},base64url(G){return this.check(Bu(xd,G))},xid(G){return this.check(Ru(md,G))},ksuid(G){return this.check(Du(hd,G))},ipv4(G){return this.check(Mu(gd,G))},ipv6(G){return this.check(Lu(yd,G))},cidrv4(G){return this.check(ju(_d,G))},cidrv6(G){return this.check(Fu(vd,G))},e164(G){return this.check(Ju(wd,G))},datetime(G){return this.check(Wu(rd,G))},date(G){return this.check(Ku(nd,G))},time(G){return this.check(Hu(od,G))},duration(G){return this.check(qu(id,G))}});function e(G){return $u(Et,G)}var rr=ht("ZodStringFormat",(G,oe)=>{tr.init(G,oe),Xl.init(G,oe)}),rd=ht("ZodISODateTime",(G,oe)=>{Pa.init(G,oe),rr.init(G,oe)}),nd=ht("ZodISODate",(G,oe)=>{Ea.init(G,oe),rr.init(G,oe)}),od=ht("ZodISOTime",(G,oe)=>{Oa.init(G,oe),rr.init(G,oe)}),id=ht("ZodISODuration",(G,oe)=>{Ta.init(G,oe),rr.init(G,oe)}),sd=ht("ZodEmail",(G,oe)=>{ga.init(G,oe),rr.init(G,oe)});var cd=ht("ZodGUID",(G,oe)=>{ma.init(G,oe),rr.init(G,oe)});var fo=ht("ZodUUID",(G,oe)=>{ha.init(G,oe),rr.init(G,oe)});var ad=ht("ZodURL",(G,oe)=>{va.init(G,oe),rr.init(G,oe)});var ud=ht("ZodEmoji",(G,oe)=>{ba.init(G,oe),rr.init(G,oe)});var ld=ht("ZodNanoID",(G,oe)=>{xa.init(G,oe),rr.init(G,oe)});var fd=ht("ZodCUID",(G,oe)=>{wa.init(G,oe),rr.init(G,oe)});var pd=ht("ZodCUID2",(G,oe)=>{$a.init(G,oe),rr.init(G,oe)});var dd=ht("ZodULID",(G,oe)=>{za.init(G,oe),rr.init(G,oe)});var md=ht("ZodXID",(G,oe)=>{Sa.init(G,oe),rr.init(G,oe)});var hd=ht("ZodKSUID",(G,oe)=>{ka.init(G,oe),rr.init(G,oe)});var gd=ht("ZodIPv4",(G,oe)=>{Za.init(G,oe),rr.init(G,oe)});var yd=ht("ZodIPv6",(G,oe)=>{Ia.init(G,oe),rr.init(G,oe)});var _d=ht("ZodCIDRv4",(G,oe)=>{Ca.init(G,oe),rr.init(G,oe)});var vd=ht("ZodCIDRv6",(G,oe)=>{Na.init(G,oe),rr.init(G,oe)});var bd=ht("ZodBase64",(G,oe)=>{Da.init(G,oe),rr.init(G,oe)});var xd=ht("ZodBase64URL",(G,oe)=>{Ma.init(G,oe),rr.init(G,oe)});var wd=ht("ZodE164",(G,oe)=>{La.init(G,oe),rr.init(G,oe)});var $d=ht("ZodJWT",(G,oe)=>{ja.init(G,oe),rr.init(G,oe)});var yt=ht("ZodNumber",(G,oe)=>{Jo.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>pi(G,$e,Pe,Ee),G.isFinite=!0},Jn({minValue:(G)=>{let{minimum:oe,exclusiveMinimum:$e}=sr(G);return Math.max(oe??Number.NEGATIVE_INFINITY,$e??Number.NEGATIVE_INFINITY)},maxValue:(G)=>{let{maximum:oe,exclusiveMaximum:$e}=sr(G);return Math.min(oe??Number.POSITIVE_INFINITY,$e??Number.POSITIVE_INFINITY)},isInt:(G)=>{let{isInt:oe,multipleOf:$e}=sr(G);return!!oe||!!$e?.some(Number.isSafeInteger)},format:(G)=>sr(G).format??null},{gt(G,oe){return this.check(Gr(G,oe))},gte(G,oe){return this.check(Cr(G,oe))},min(G,oe){return this.check(Cr(G,oe))},lt(G,oe){return this.check(qr(G,oe))},lte(G,oe){return this.check(Ir(G,oe))},max(G,oe){return this.check(Ir(G,oe))},int(G){return this.check(Kl(G))},safe(G){return this.check(Kl(G))},positive(G){return this.check(Gr(0,G))},nonnegative(G){return this.check(Cr(0,G))},negative(G){return this.check(qr(0,G))},nonpositive(G){return this.check(Ir(0,G))},multipleOf(G,oe){return this.check(Pn(G,oe))},step(G,oe){return this.check(Pn(G,oe))},finite(){return this}}));function r(G){return Gu(yt,G)}var zd=ht("ZodNumberFormat",(G,oe)=>{Fa.init(G,oe),yt.init(G,oe)});function Kl(G){return Xu(zd,G)}var Mt=ht("ZodBoolean",(G,oe)=>{Ua.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>di(G,$e,Pe,Ee)});function c(G){return Yu(Mt,G)}var Ht=ht("ZodBigInt",(G,oe)=>{Ba.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>mi(G,$e,Pe,Ee)},Jn({minValue:(G)=>sr(G).minimum??null,maxValue:(G)=>sr(G).maximum??null,format:(G)=>sr(G).format??null},{gte(G,oe){return this.check(Cr(G,oe))},min(G,oe){return this.check(Cr(G,oe))},gt(G,oe){return this.check(Gr(G,oe))},lt(G,oe){return this.check(qr(G,oe))},lte(G,oe){return this.check(Ir(G,oe))},max(G,oe){return this.check(Ir(G,oe))},positive(G){return this.check(Gr(BigInt(0),G))},negative(G){return this.check(qr(BigInt(0),G))},nonpositive(G){return this.check(Ir(BigInt(0),G))},nonnegative(G){return this.check(Cr(BigInt(0),G))},multipleOf(G,oe){return this.check(Pn(G,oe))}}));var Sd=ht("ZodNull",(G,oe)=>{Ja.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>hi(G,$e,Pe,Ee)});function Ve(G){return Qu(Sd,G)}var kd=ht("ZodAny",(G,oe)=>{Va.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>yi(G,$e,Pe,Ee)});function ae(){return el(kd)}var Pd=ht("ZodUnknown",(G,oe)=>{Wa.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>_i(G,$e,Pe,Ee)});function w(){return tl(Pd)}var Ed=ht("ZodNever",(G,oe)=>{Ka.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>gi(G,$e,Pe,Ee)});function Re(G){return rl(Ed,G)}var Vt=ht("ZodDate",(G,oe)=>{Ha.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>vi(G,$e,Pe,Ee),G.min=($e,Pe)=>G.check(Cr($e,Pe)),G.max=($e,Pe)=>G.check(Ir($e,Pe))},Jn({minDate:(G)=>{let{minimum:oe}=sr(G);return oe?new Date(oe):null},maxDate:(G)=>{let{maximum:oe}=sr(G);return oe?new Date(oe):null}},{}));var Od=ht("ZodArray",(G,oe)=>{Cn(),qa.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>zi(G,$e,Pe,Ee),G.element=oe.element},{min(G,oe){return this.check(Xr(G,oe))},nonempty(G){return this.check(Xr(1,G))},max(G,oe){return this.check(co(G,oe))},length(G,oe){return this.check(ao(G,oe))},unwrap(){return this.element}});function o(G,oe){return nl(Od,G,oe)}var Ui=ht("ZodObject",(G,oe)=>{Cn(),Ya.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Si(G,$e,Pe,Ee),ap(G,"shape",($e)=>$e._zod.def.shape,!1)},{keyof(){return a(Object.keys(this._zod.def.shape))},catchall(G){return this.clone(mr(this._zod.def,{catchall:G}))},passthrough(){return this.clone(mr(this._zod.def,{catchall:w()}))},loose(){return this.clone(mr(this._zod.def,{catchall:w()}))},strict(){return this.clone(mr(this._zod.def,{catchall:Re()}))},strip(){return this.clone(mr(this._zod.def,{catchall:void 0}))},extend(G){return ep(this,G)},safeExtend(G){return tp(this,G)},merge(G){return rp(this,G)},pick(G){return Yf(this,G)},omit(G){return Qf(this,G)},partial(...G){return Us(Bi,this,G[0])},exactPartial(...G){return Us(Ql,this,G[0],"exactPartial")},required(...G){return np(ef,this,G[0])}});function t(G,oe){let $e={type:"object",shape:G??{},...kt(oe)};return new Ui($e)}function se(G,oe){return new Ui({type:"object",shape:G,catchall:Re(),...kt(oe)})}function B(G,oe){return new Ui({type:"object",shape:G,catchall:w(),...kt(oe)})}var Yl=ht("ZodUnion",(G,oe)=>{Vo.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>ki(G,$e,Pe,Ee),G.options=oe.options});function l(G,oe){return new Yl({type:"union",options:G,...kt(oe)})}var Td=ht("ZodDiscriminatedUnion",(G,oe)=>{Yl.init(G,oe),Qa.init(G,oe)});function f(G,oe,$e){return new Td({type:"union",options:oe,discriminator:G,...kt($e)})}var Zd=ht("ZodIntersection",(G,oe)=>{eu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Pi(G,$e,Pe,Ee)});function nt(G,oe){return new Zd({type:"intersection",left:G,right:oe})}var Ad=ht("ZodTuple",(G,oe)=>{Cn(),tu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Ei(G,$e,Pe,Ee)},{rest(G){return this.clone({...this._zod.def,rest:G})},partial(){let G=this._zod.def;if(G.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...G,items:G.items.map((oe)=>new Bi({type:"optional",innerType:oe}))})}});function ce(G,oe,$e){let Pe=oe instanceof Lt,Ee=Pe?$e:oe;return new Ad({type:"tuple",items:G,rest:Pe?oe:null,...kt(Ee)})}var ji=ht("ZodRecord",(G,oe)=>{Cn(),ru.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Oi(G,$e,Pe,Ee),G.keyType=oe.keyType,G.valueType=oe.valueType});function y(G,oe,$e){if(!oe||!oe._zod)return new ji({type:"record",keyType:e(),valueType:G,...kt(oe)});return new ji({type:"record",keyType:G,valueType:oe,...kt($e)})}function _n(G,oe,$e){return new ji({type:"record",keyType:G,valueType:oe,...kt($e),partial:!0})}var Fi=ht("ZodEnum",(G,oe)=>{nu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=(Pe,Ee,Fe)=>bi(G,Pe,Ee,Fe),G.enum=oe.entries,G.options=[...G._zod.values];let $e=new Set(Object.keys(oe.entries));G.extract=(Pe,Ee)=>{let Fe={};for(let Ue of Pe)if($e.has(Ue))Fe[Ue]=oe.entries[Ue];else throw Error(`Key ${Ue} not found in enum`);return new Fi({...oe,checks:[],...kt(Ee),entries:Fe})},G.exclude=(Pe,Ee)=>{let Fe={...oe.entries};for(let Ue of Pe)if($e.has(Ue))delete Fe[Ue];else throw Error(`Key ${Ue} not found in enum`);return new Fi({...oe,checks:[],...kt(Ee),entries:Fe})}});function a(G,oe){let $e=Array.isArray(G)?Object.fromEntries(G.map((Pe)=>[Pe,Pe])):G;return new Fi({type:"enum",entries:$e,...kt(oe)})}var Id=ht("ZodLiteral",(G,oe)=>{ou.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>xi(G,$e,Pe,Ee),G.values=new Set(oe.values),Object.defineProperty(G,"value",{get(){if(oe.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return oe.values[0]}})});function n(G,oe){return new Id({type:"literal",values:Array.isArray(G)?G:[G],...kt(oe)})}var Cd=ht("ZodTransform",(G,oe)=>{Cn(),iu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>$i(G,$e,Pe,Ee),G._zod.parse=($e,Pe)=>{if(Pe.direction==="backward")throw new xn(G.constructor.name);$e.addIssue=(Fe)=>{if(typeof Fe==="string")$e.issues.push(Jr(Fe,$e.value,oe));else{let Ue=Fe;if(Ue.fatal)Ue.continue=!1;if(Ue.code??(Ue.code="custom"),!("input"in Ue))Ue.input=$e.value;Ue.inst??(Ue.inst=G),$e.issues.push(Jr(Ue))}};let Ee=oe.transform($e.value,$e);if(Ee instanceof Promise)return Ee.then((Fe)=>($e.value=Fe,$e));return $e.value=Ee,$e}});function Nd(G){return new Cd({type:"transform",transform:G})}var Bi=ht("ZodOptional",(G,oe)=>{Wo.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>uo(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.innerType});function Hl(G){return new Bi({type:"optional",innerType:G})}var Ql=ht("ZodExactOptional",(G,oe)=>{su.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>uo(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.innerType});function Rd(G){return new Ql({type:"optional",innerType:G})}var Dd=ht("ZodNullable",(G,oe)=>{cu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Ti(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.innerType});function ql(G){return new Dd({type:"nullable",innerType:G})}var Md=ht("ZodDefault",(G,oe)=>{au.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Ii(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.innerType,G.removeDefault=G.unwrap});function Ld(G,oe){return new Md({type:"default",innerType:G,get defaultValue(){return typeof oe==="function"?oe():So(oe)}})}var jd=ht("ZodPrefault",(G,oe)=>{uu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Ci(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.innerType});function Fd(G,oe){return new jd({type:"prefault",innerType:G,get defaultValue(){return typeof oe==="function"?oe():So(oe)}})}var ef=ht("ZodNonOptional",(G,oe)=>{lu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Zi(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.innerType});function Ud(G,oe){return new ef({type:"nonoptional",innerType:G,...kt(oe)})}var Bd=ht("ZodCatch",(G,oe)=>{fu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Ni(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.innerType,G.removeCatch=G.unwrap});function Jd(G,oe){return new Bd({type:"catch",innerType:G,catchValue:typeof oe==="function"?oe:Ws(oe)})}var Vd=ht("ZodPipe",(G,oe)=>{pu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Ri(G,$e,Pe,Ee),G.in=oe.in,G.out=oe.out});function Gl(G,oe){return new Vd({type:"pipe",in:G,out:oe})}var Wd=ht("ZodReadonly",(G,oe)=>{du.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Di(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.innerType});function Kd(G){return new Wd({type:"readonly",innerType:G})}var Hd=ht("ZodLazy",(G,oe)=>{mu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>Mi(G,$e,Pe,Ee),G.unwrap=()=>G._zod.def.getter()});function je(G){return new Hd({type:"lazy",getter:G})}var Ji=ht("ZodCustom",(G,oe)=>{hu.init(G,oe),jt.init(G,oe),G._zod.processJSONSchema=($e,Pe,Ee)=>wi(G,$e,Pe,Ee)});function Gt(G,oe){return ol(Ji,G??(()=>!0),oe)}function qd(G,oe={}){return il(Ji,G,oe)}function Gd(G,oe){return sl(G,oe)}var Xd=ht("ZodInstanceOf",(G,oe)=>{Ji.init(G,oe)},{properties(G,oe){return this.check(ri(G,oe))}});function Wt(G,oe={}){let $e=new Xd({type:"custom",check:"custom",fn:(Pe)=>Pe instanceof G,abort:!0,...kt(oe)});return $e._zod.bag.Class=G,$e._zod.check=(Pe)=>{if(!(Pe.value instanceof G))Pe.issues.push({code:"invalid_type",expected:G.name,input:Pe.value,inst:$e,path:[...$e._zod.def.path??[]]})},$e}function F(G){let oe=je(()=>l([e(G),r(),c(),Ve(),o(oe),y(e(),oe)]));return oe}class po extends Error{constructor(G,oe){super(G),this.name="ParseError",this.type=oe.type,this.field=oe.field,this.value=oe.value,this.line=oe.line}}var tf=10,Yd=13,Wr=32;function Vi(G){}function of(G){if(typeof G=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:oe=Vi,onError:$e=Vi,onRetry:Pe=Vi,onComment:Ee,maxBufferSize:Fe}=G,Ue=[],Be=0,Xe=!0,Ye,Qe="",ft=0,pt,mt=!1;function gt(xt){if(mt)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(Xe&&(Xe=!1,xt.charCodeAt(0)===239&&xt.charCodeAt(1)===187&&xt.charCodeAt(2)===191&&(xt=xt.slice(3))),Ue.length===0){let nr=Tt(xt);nr!==""&&(Ue.push(nr),Be=nr.length),St();return}if(xt.indexOf(`
60
- `)===-1&&xt.indexOf("\r")===-1){Ue.push(xt),Be+=xt.length,St();return}Ue.push(xt);let _t=Ue.join("");Ue.length=0,Be=0;let Ct=Tt(_t);Ct!==""&&(Ue.push(Ct),Be=Ct.length),St()}function St(){Fe!==void 0&&(Be+Qe.length<=Fe||(mt=!0,Ue.length=0,Be=0,Ye=void 0,Qe="",ft=0,pt=void 0,$e(new po(`Buffered data exceeded max buffer size of ${Fe} characters`,{type:"max-buffer-size-exceeded"}))))}function Tt(xt){let _t=0;if(xt.indexOf("\r")===-1){let Ct=xt.indexOf(`
61
- `,_t);for(;Ct!==-1;){if(_t===Ct){ft>0&&oe({id:Ye,event:pt,data:Qe}),Ye=void 0,Qe="",ft=0,pt=void 0,_t=Ct+1,Ct=xt.indexOf(`
62
- `,_t);continue}let nr=xt.charCodeAt(_t);if(rf(xt,_t,nr)){let or=xt.charCodeAt(_t+5)===Wr?_t+6:_t+5,_r=xt.slice(or,Ct);if(ft===0&&xt.charCodeAt(Ct+1)===tf){oe({id:Ye,event:pt,data:_r}),Ye=void 0,Qe="",pt=void 0,_t=Ct+2,Ct=xt.indexOf(`
63
- `,_t);continue}Qe=ft===0?_r:`${Qe}
64
- ${_r}`,ft++}else nf(xt,_t,nr)?pt=xt.slice(xt.charCodeAt(_t+6)===Wr?_t+7:_t+6,Ct)||void 0:It(xt,_t,Ct);_t=Ct+1,Ct=xt.indexOf(`
65
- `,_t)}return xt.slice(_t)}for(;_t<xt.length;){let Ct=xt.indexOf("\r",_t),nr=xt.indexOf(`
66
- `,_t),or=-1;if(Ct!==-1&&nr!==-1?or=Ct<nr?Ct:nr:Ct!==-1?Ct===xt.length-1?or=-1:or=Ct:nr!==-1&&(or=nr),or===-1)break;It(xt,_t,or),_t=or+1,xt.charCodeAt(_t-1)===Yd&&xt.charCodeAt(_t)===tf&&_t++}return xt.slice(_t)}function It(xt,_t,Ct){if(_t===Ct){Tr();return}let nr=xt.charCodeAt(_t);if(rf(xt,_t,nr)){let Kr=xt.charCodeAt(_t+5)===Wr?_t+6:_t+5,ts=xt.slice(Kr,Ct);Qe=ft===0?ts:`${Qe}
67
- ${ts}`,ft++;return}if(nf(xt,_t,nr)){pt=xt.slice(xt.charCodeAt(_t+6)===Wr?_t+7:_t+6,Ct)||void 0;return}if(nr===105&&xt.charCodeAt(_t+1)===100&&xt.charCodeAt(_t+2)===58){let Kr=xt.slice(xt.charCodeAt(_t+3)===Wr?_t+4:_t+3,Ct);Kr.includes("\x00")||(Ye=Kr);return}if(nr===58){if(Ee){let Kr=xt.slice(_t,Ct);Ee(Kr.slice(xt.charCodeAt(_t+1)===Wr?2:1))}return}let or=xt.slice(_t,Ct),_r=or.indexOf(":");if(_r===-1){ir(or,"",or);return}let Rn=or.slice(0,_r),vo=or.charCodeAt(_r+1)===Wr?2:1,bo=or.slice(_r+vo);ir(Rn,bo,or)}function ir(xt,_t,Ct){switch(xt){case"event":pt=_t||void 0;break;case"data":Qe=ft===0?_t:`${Qe}
68
- ${_t}`,ft++;break;case"id":_t.includes("\x00")||(Ye=_t);break;case"retry":/^\d+$/.test(_t)?Pe(parseInt(_t,10)):$e(new po(`Invalid \`retry\` value: "${_t}"`,{type:"invalid-retry",value:_t,line:Ct}));break;default:$e(new po(`Unknown field "${xt.length>20?`${xt.slice(0,20)}…`:xt}"`,{type:"unknown-field",field:xt,value:_t,line:Ct}));break}}function Tr(){ft>0&&oe({id:Ye,event:pt,data:Qe}),Ye=void 0,Qe="",ft=0,pt=void 0}function Fr(xt={}){if(xt.consume&&Ue.length>0){let _t=Ue.join("");It(_t,0,_t.length)}Xe=!0,Ye=void 0,Qe="",ft=0,pt=void 0,Ue.length=0,Be=0,mt=!1}return{feed:gt,reset:Fr}}function rf(G,oe,$e){return $e===100&&G.charCodeAt(oe+1)===97&&G.charCodeAt(oe+2)===116&&G.charCodeAt(oe+3)===97&&G.charCodeAt(oe+4)===58}function nf(G,oe,$e){return $e===101&&G.charCodeAt(oe+1)===118&&G.charCodeAt(oe+2)===101&&G.charCodeAt(oe+3)===110&&G.charCodeAt(oe+4)===116&&G.charCodeAt(oe+5)===58}class mo extends TransformStream{constructor({onError:G,onRetry:oe,onComment:$e,maxBufferSize:Pe}={}){let Ee;super({start(Fe){Ee=of({onEvent:(Ue)=>{Fe.enqueue(Ue)},onError(Ue){typeof G=="function"&&G(Ue),(G==="terminate"||Ue.type==="max-buffer-size-exceeded")&&Fe.error(Ue)},onRetry:oe,onComment:$e,maxBufferSize:Pe})},transform(Fe){Ee.feed(Fe)}})}}var S=Symbol.for("workflow-serialize"),I=Symbol.for("workflow-deserialize");function qe(G){return G===void 0?[]:Array.isArray(G)?G:[G]}function d(...G){return G.reduce((oe,$e)=>({...oe,...$e}),{})}function Qd(G){return Object.fromEntries(Object.entries(G).filter(([oe,$e])=>$e!=null))}async function Oe(G,oe){if(G==null)return;let $e=oe?.abortSignal;return new Promise((Pe,Ee)=>{if($e?.aborted){Ee(sf());return}let Fe=setTimeout(()=>{Ue(),Pe()},G),Ue=()=>{clearTimeout(Fe),$e?.removeEventListener("abort",Be)},Be=()=>{Ue(),Ee(sf())};$e?.addEventListener("abort",Be)})}function sf(){return new DOMException("Delay was aborted","AbortError")}function em(G){let oe=G??globalThis.WebSocket;if(oe==null)throw Error("No WebSocket implementation available.");return oe}function Rt(G){let oe=new URL(G);if(oe.protocol==="http:")oe.protocol="ws:";else if(oe.protocol==="https:")oe.protocol="wss:";return oe}var cf=new TextDecoder;async function tm(G){if(typeof G==="string")return G;if(G instanceof ArrayBuffer)return cf.decode(G);if(ArrayBuffer.isView(G))return cf.decode(G);if(typeof Blob<"u"&&G instanceof Blob)return G.text();return String(G)}var rm=1;async function ue(G,{highWaterMark:oe=1048576,pollIntervalMs:$e=20,abortSignal:Pe}={}){while(G.readyState===rm&&(G.bufferedAmount??0)>oe){if(Pe?.aborted===!0)return;await Oe($e)}}function fe({url:G,protocols:oe,headers:$e,webSocket:Pe,abortSignal:Ee,onOpen:Fe,onMessageText:Ue,onProcessingError:Be,onSocketError:Xe,onClose:Ye,onAbort:Qe}){let ft,pt,mt=(Tt)=>{if(pt!=null)Ee?.removeEventListener("abort",pt),pt=void 0;try{ft?.close(Tt)}catch{}};if(Ee?.aborted)return Qe?.(Ee.reason??Error("Aborted")),{socket:void 0,close:mt};try{ft=new(em(Pe))(G,oe,{headers:Qd($e??{})})}catch(Tt){return Be(Tt),{socket:void 0,close:mt}}if(Ee!=null&&Qe!=null)pt=()=>Qe(Ee.reason??Error("Aborted")),Ee.addEventListener("abort",pt,{once:!0});let gt=ft;ft.onopen=()=>{try{Fe?.(gt)}catch(Tt){Be(Tt)}};let St=Promise.resolve();return ft.onmessage=(Tt)=>{St=St.then(()=>tm(Tt.data)).then((It)=>Ue(It)).catch(Be)},ft.onerror=()=>{St=St.then(()=>Xe?.()).catch(Be)},ft.onclose=(Tt)=>{let It=Tt,ir=typeof It?.code==="number"?It.code:void 0,Tr=typeof It?.reason==="string"?It.reason:void 0;St=St.then(()=>Ye?.({code:ir,reason:Tr})).catch(Be)},{socket:ft,close:mt}}function ie(G){let oe=!1;return new ReadableStream({async pull($e){if(oe)return;try{let{value:Pe,done:Ee}=await G.next();if(Ee)$e.close();else $e.enqueue(Pe)}catch(Pe){$e.error(Pe)}},async cancel($e){if(oe=!0,G.return)try{await G.return($e)}catch{}}})}var{btoa:nm,atob:om}=globalThis;function q(G){let oe=G.replace(/-/g,"+").replace(/_/g,"/"),$e=om(oe);return Uint8Array.from($e,(Pe)=>Pe.codePointAt(0))}function X(G){if(typeof globalThis.Buffer?.from==="function")return globalThis.Buffer.from(G.buffer,G.byteOffset,G.byteLength).toString("base64");let oe=[],$e=4096;for(let Pe=0;Pe<G.length;Pe+=$e)oe.push(String.fromCodePoint(...G.subarray(Pe,Pe+$e)));return nm(oe.join(""))}function T(G){return G instanceof Uint8Array?X(G):G}function ve(G){if(G.type==="stream"){let oe=new u({functionality:"streaming file upload"});throw G.stream.cancel(oe).catch(()=>{}),oe}if(G.type==="text")return new TextEncoder().encode(G.text);if(G.data instanceof Uint8Array)return G.data;if(G.data instanceof ArrayBuffer)return new Uint8Array(G.data);return q(G.data)}function Jt(G){let oe=new Set,$e=new Set,Pe=!1,Ee=!1;return new TransformStream({transform(Fe,Ue){switch(Fe.type){case"text-start":case"text-delta":case"text-end":return;case"tool-input-start":if(Fe.toolName===G){oe.add(Fe.id),Ue.enqueue({type:"text-start",id:Fe.id,...Fe.providerMetadata&&{providerMetadata:Fe.providerMetadata}});return}break;case"tool-input-delta":if(oe.has(Fe.id)){if(Fe.delta.length>0)$e.add(Fe.id);Ue.enqueue({type:"text-delta",id:Fe.id,delta:Fe.delta,...Fe.providerMetadata&&{providerMetadata:Fe.providerMetadata}});return}break;case"tool-input-end":if(oe.has(Fe.id))return;break;case"tool-call":if(Fe.toolName===G){if(!$e.has(Fe.toolCallId))Ue.enqueue({type:"text-delta",id:Fe.toolCallId,delta:Fe.input,...Fe.providerMetadata&&{providerMetadata:Fe.providerMetadata}});Ue.enqueue({type:"text-end",id:Fe.toolCallId,...Fe.providerMetadata&&{providerMetadata:Fe.providerMetadata}}),Pe=!0;return}if(!Fe.providerExecuted)Ee=!0;break;case"finish":if(Pe&&!Ee&&Fe.finishReason.unified==="tool-calls"){Ue.enqueue({...Fe,finishReason:{...Fe.finishReason,unified:"stop"}});return}}Ue.enqueue(Fe)}})}function rt(G,oe={}){let{useArrayBrackets:$e=!0}=oe,Pe=new FormData;for(let[Ee,Fe]of Object.entries(G)){if(Fe==null)continue;if(Array.isArray(Fe)){if(Fe.length===1){Pe.append(Ee,Fe[0]);continue}let Ue=$e?`${Ee}[]`:Ee;for(let Be of Fe)Pe.append(Ue,Be);continue}Pe.append(Ee,Fe)}return Pe}function ee({id:G,model:oe,created:$e}){return{id:G??void 0,modelId:oe??void 0,timestamp:$e!=null?new Date($e*1000):void 0}}function te(){return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0}}function le({tools:G=[],providerToolNames:oe}){let $e={},Pe={};for(let Ee of G)if(Ee.type==="provider"&&Ee.id in oe){let Fe=oe[Ee.id];$e[Ee.name]=Fe,Pe[Fe]=Ee.name}return{toProviderToolName:(Ee)=>$e[Ee]??Ee,toCustomToolName:(Ee)=>Pe[Ee]??Ee}}var hf=Symbol.for("vercel.ai.providerStreamError");function xe({message:G,type:oe,code:$e,statusCode:Pe,isRetryable:Ee,data:Fe}){let Ue={message:G,type:oe,code:$e,statusCode:Pe,isRetryable:Ee,data:Fe};return Object.defineProperty(Ue,hf,{value:!0}),Ue}function ot(G){return typeof G==="object"&&G!=null&&G[hf]===!0}var Ne=class{constructor(){this.status={type:"pending"},this._resolve=void 0,this._reject=void 0}get promise(){if(this._promise)return this._promise;return this._promise=new Promise((G,oe)=>{if(this.status.type==="resolved")G(this.status.value);else if(this.status.type==="rejected")oe(this.status.error);this._resolve=G,this._reject=oe}),this._promise}resolve(G){if(this.status={type:"resolved",value:G},this._promise)this._resolve?.(G)}reject(G){if(this.status={type:"rejected",error:G},this._promise)this._reject?.(G)}isResolved(){return this.status.type==="resolved"}isRejected(){return this.status.type==="rejected"}isPending(){return this.status.type==="pending"}};function Sr(G){return Object.fromEntries([...G.headers])}function Se(G=globalThis){if(G.navigator?.userAgent)return G.navigator.userAgent.toLowerCase();if(G.process?.versions?.node)return`node.js/${G.process.version}`;if(G.EdgeRuntime)return"vercel-edge";return""}function W(G){return(G instanceof Error||typeof DOMException==="function"&&G instanceof DOMException)&&(G.name==="AbortError"||G.name==="ResponseAborted"||G.name==="TimeoutError")}var im=["fetch failed","failed to fetch"],sm=new Set(["ConnectionRefused","ConnectionClosed","FailedToOpenSocket","ECONNRESET","ECONNREFUSED","ETIMEDOUT","EPIPE","UND_ERR_SOCKET","UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT"]);function cm(G){let oe=new Set,$e=G;while($e instanceof Error&&!oe.has($e)){oe.add($e);let Pe=$e;if(typeof Pe.code==="string"&&sm.has(Pe.code))return Pe;$e=$e.cause}}function Nn({error:G,url:oe,requestBodyValues:$e}){if(W(G))return G;if(G instanceof TypeError&&im.includes(G.message.toLowerCase())){let Ee=G.cause;if(Ee!=null)return new v({message:`Cannot connect to API: ${Ee.message}`,cause:Ee,url:oe,requestBodyValues:$e,isRetryable:!0})}let Pe=cm(G);if(Pe!=null){if(v.isInstance(G))return new v({message:G.message,cause:G.cause,url:G.url,requestBodyValues:G.requestBodyValues,statusCode:G.statusCode,responseHeaders:G.responseHeaders,responseBody:G.responseBody,data:G.data,isRetryable:!0});return new v({message:`Cannot connect to API: ${G instanceof Error?G.message:Pe.message}`,cause:G,url:oe,requestBodyValues:$e,isRetryable:!0})}return G}var yo="5.0.70";function Le(G){if(G==null)return{};let oe={};if(G instanceof Headers)G.forEach(($e,Pe)=>{oe[Pe.toLowerCase()]=$e});else{if(!Array.isArray(G))G=Object.entries(G);for(let[$e,Pe]of G)if(Pe!=null)oe[$e.toLowerCase()]=Pe}return oe}function L(G,...oe){let $e=new Headers(Le(G)),Pe=$e.get("user-agent")||"";return $e.set("user-agent",[Pe,...oe].filter(Boolean).join(" ")),Object.fromEntries($e.entries())}var am=()=>globalThis.fetch,Kt=async({url:G,headers:oe={},failedResponseHandler:$e,successfulResponseHandler:Pe,abortSignal:Ee,fetch:Fe=am()})=>{try{let Ue=await Fe(G,{method:"DELETE",headers:L(oe,`ai-sdk-provider-utils/${yo}`,Se()),signal:Ee}),Be=Sr(Ue);if(!Ue.ok){let Xe;try{Xe=await $e({response:Ue,url:G,requestBodyValues:{}})}catch(Ye){if(W(Ye)||v.isInstance(Ye))throw Ye;throw new v({message:"Failed to process error response",cause:Ye,statusCode:Ue.status,url:G,responseHeaders:Be,requestBodyValues:{}})}throw Xe.value}try{return await Pe({response:Ue,url:G,requestBodyValues:{}})}catch(Xe){if(Xe instanceof Error){if(W(Xe)||v.isInstance(Xe))throw Xe}throw new v({message:"Failed to process successful response",cause:Xe,statusCode:Ue.status,url:G,responseHeaders:Be,requestBodyValues:{}})}}catch(Ue){throw Nn({error:Ue,url:G,requestBodyValues:{}})}},gf=[{mediaType:"image/gif",bytesPrefix:[71,73,70,56,55,97]},{mediaType:"image/gif",bytesPrefix:[71,73,70,56,57,97]},{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,null,null,null,null,0,0,0,0]},{mediaType:"image/tiff",bytesPrefix:[73,73,42,0]},{mediaType:"image/tiff",bytesPrefix:[77,77,0,42]},{mediaType:"image/avif",bytesPrefix:[0,0,0,null,102,116,121,112,97,118,105,102]},{mediaType:"image/heic",bytesPrefix:[0,0,0,null,102,116,121,112,104,101,105,99]}],yf=[{mediaType:"application/pdf",bytesPrefix:[37,80,68,70]}],_f=[{mediaType:"audio/aac",bytesPrefix:[255,240]},{mediaType:"audio/aac",bytesPrefix:[255,241]},{mediaType:"audio/aac",bytesPrefix:[255,248]},{mediaType:"audio/aac",bytesPrefix:[255,249]},{mediaType:"audio/mpeg",bytesPrefix:[255,251]},{mediaType:"audio/mpeg",bytesPrefix:[255,250]},{mediaType:"audio/mpeg",bytesPrefix:[255,243]},{mediaType:"audio/mpeg",bytesPrefix:[255,242]},{mediaType:"audio/mpeg",bytesPrefix:[255,227]},{mediaType:"audio/mpeg",bytesPrefix:[255,226]},{mediaType:"audio/wav",bytesPrefix:[82,73,70,70,null,null,null,null,87,65,86,69]},{mediaType:"audio/ogg",bytesPrefix:[79,103,103,83]},{mediaType:"audio/flac",bytesPrefix:[102,76,97,67]},{mediaType:"audio/aac",bytesPrefix:[64,21,0,0]},{mediaType:"audio/webm",bytesPrefix:[26,69,223,163]}],um=[..._f,{mediaType:"audio/mp4",bytesPrefix:[0,0,0,null,102,116,121,112]}],vf=[{mediaType:"video/mp4",bytesPrefix:[0,0,0,null,102,116,121,112]},{mediaType:"video/webm",bytesPrefix:[26,69,223,163]},{mediaType:"video/quicktime",bytesPrefix:[0,0,0,20,102,116,121,112,113,116]},{mediaType:"video/x-msvideo",bytesPrefix:[82,73,70,70]}],lm=18,fm=131084;function af(G,oe){if(typeof G!=="string")return G.length>oe?G.subarray(0,oe):G;let $e=Math.ceil(oe/3)*4,Pe=q(G.substring(0,Math.min(G.length,$e)));return Pe.length>oe?Pe.subarray(0,oe):Pe}function pm(G){return G.length>10&&G[0]===73&&G[1]===68&&G[2]===51}var dm=(G)=>{let oe=(G[6]&127)<<21|(G[7]&127)<<14|(G[8]&127)<<7|G[9]&127;return G.subarray(oe+10)};function uf({data:G,signatures:oe}){let $e=af(G,lm);if(pm($e))$e=dm(af(G,fm));for(let Pe of oe)if($e.length>=Pe.bytesPrefix.length&&Pe.bytesPrefix.every((Ee,Fe)=>Ee===null||$e[Fe]===Ee))return Pe.mediaType}var mm={image:gf,audio:um,video:vf,application:yf};function Ie({data:G,topLevelType:oe}){if(oe===void 0)return uf({data:G,signatures:[...gf,...yf,..._f,...vf]});let $e=mm[oe];if($e===void 0)return;return uf({data:G,signatures:$e})}function z(G){let oe=G.indexOf("/");return oe===-1?G:G.substring(0,oe)}function K(G){let oe=G.indexOf("/");if(oe===-1)return!1;let $e=G.substring(oe+1);return $e.length>0&&$e!=="*"}async function st(G){try{await G.body?.cancel()}catch{}}var bf="AI_DownloadError",xf=`vercel.ai.error.${bf}`,hm=Symbol.for(xf),U=class extends m{constructor({url:G,statusCode:oe,statusText:$e,cause:Pe,message:Ee=Pe==null?`Failed to download ${G}: ${oe} ${$e}`:`Failed to download ${G}: ${Pe}`}){super({name:bf,message:Ee,cause:Pe});this[hm]=!0,this.url=G,this.statusCode=oe,this.statusText=$e}static isInstance(G){return m.hasMarker(G,xf)}};function gm(G=globalThis){return G.window!=null}function Ge(G,oe){try{return new URL(G).origin===new URL(oe).origin}catch{return!1}}function ym(G){let oe;try{oe=new URL(G)}catch{throw new U({url:G,message:`Invalid URL: ${G}`})}if(oe.protocol==="data:")return;if(oe.protocol!=="http:"&&oe.protocol!=="https:")throw new U({url:G,message:`URL scheme must be http, https, or data, got ${oe.protocol}`});let $e=oe.hostname.toLowerCase().replace(/\.+$/,"");if(!$e)throw new U({url:G,message:"URL must have a hostname"});if($e==="localhost"||$e.endsWith(".local")||$e.endsWith(".localhost")||$e.endsWith(".internal"))throw new U({url:G,message:`URL with hostname ${$e} is not allowed`});if($e.startsWith("[")&&$e.endsWith("]")){if(wf($e.slice(1,-1)))throw new U({url:G,message:`URL with IPv6 address ${$e} is not allowed`});return}if(Gi($e)){if(Xi($e))throw new U({url:G,message:`URL with IP address ${$e} is not allowed`})}}function _m({address:G,family:oe,hostname:$e}){if(oe===4?!Gi(G)||Xi(G):oe===6?wf(G):!0)throw new U({url:$e,message:`Hostname ${$e} resolved to disallowed IP address ${G}`})}function Gi(G){let oe=G.split(".");if(oe.length!==4)return!1;return oe.every(($e)=>{let Pe=Number($e);return Number.isInteger(Pe)&&Pe>=0&&Pe<=255&&String(Pe)===$e})}function Xi(G){let[oe,$e,Pe]=G.split(".").map(Number);if(oe===0)return!0;if(oe===10)return!0;if(oe===100&&$e>=64&&$e<=127)return!0;if(oe===127)return!0;if(oe===169&&$e===254)return!0;if(oe===172&&$e>=16&&$e<=31)return!0;if(oe===192&&$e===0&&Pe===0)return!0;if(oe===192&&$e===0&&Pe===2)return!0;if(oe===192&&$e===168)return!0;if(oe===198&&($e===18||$e===19))return!0;if(oe===198&&$e===51&&Pe===100)return!0;if(oe===203&&$e===0&&Pe===113)return!0;if(oe>=224)return!0;return!1}function vm(G){let oe=G.toLowerCase(),$e=oe.indexOf("%");if($e!==-1)oe=oe.slice(0,$e);let Pe=oe.split("::");if(Pe.length>2)return null;let Ee=(Ue)=>{if(Ue==="")return[];let Be=[],Xe=Ue.split(":");for(let Ye=0;Ye<Xe.length;Ye++){let Qe=Xe[Ye];if(Qe.includes(".")){if(Ye!==Xe.length-1||!Gi(Qe))return null;let[ft,pt,mt,gt]=Qe.split(".").map(Number);Be.push(ft<<8|pt,mt<<8|gt);continue}if(!/^[0-9a-f]{1,4}$/.test(Qe))return null;Be.push(parseInt(Qe,16))}return Be},Fe=Ee(Pe[0]);if(Fe===null)return null;if(Pe.length===2){let Ue=Ee(Pe[1]);if(Ue===null)return null;let Be=8-Fe.length-Ue.length;if(Be<0)return null;return[...Fe,...Array(Be).fill(0),...Ue]}return Fe.length===8?Fe:null}function wf(G){let oe=vm(G);if(oe===null)return!0;let $e=(Pe)=>oe.slice(0,Pe).every((Ee)=>Ee===0);if($e(7)&&(oe[7]===0||oe[7]===1))return!0;if((oe[0]&65024)===64512)return!0;if((oe[0]&65472)===65152)return!0;if((oe[0]&65472)===65216)return!0;if((oe[0]&65280)===65280)return!0;if(oe[0]===8193&&oe[1]===3512)return!0;if(oe[0]===16383&&(oe[1]&61440)===0)return!0;if($e(6)||$e(5)&&oe[5]===65535||$e(4)&&oe[4]===65535&&oe[5]===0||oe[0]===100&&oe[1]===65435&&oe[2]===0&&oe[3]===0&&oe[4]===0&&oe[5]===0||oe[0]===100&&oe[1]===65435&&oe[2]===1)return Xi(`${oe[6]>>8&255}.${oe[6]&255}.${oe[7]>>8&255}.${oe[7]&255}`);return!1}function bm(G){return(oe,$e,Pe)=>{G(oe,{...$e,all:!0},(Ee,Fe)=>{if(Ee){Pe(Ee);return}try{let[Ue]=Fe;if(Ue==null)throw Error(`Hostname ${oe} did not resolve to an address`);for(let{address:Be,family:Xe}of Fe)_m({address:Be,family:Xe,hostname:oe});if($e.all===!0)Pe(null,Fe);else Pe(null,Ue.address,Ue.family)}catch(Ue){Pe(Ue instanceof Error?Ue:Error(String(Ue)))}})}}var xm;function wm(){let G=globalThis.process;return G?.release?.name==="node"&&G.versions?.bun==null&&G.versions?.deno==null&&G.title!=="workerd"&&globalThis.EdgeRuntime==null}async function $m(){if(!wm())return globalThis.fetch;return xm??=Promise.resolve().then(zm)}function zm(){let G=lf("node:module"),{lookup:oe}=lf("node:dns"),{Agent:$e,fetch:Pe}=G.createRequire($f())("undici"),Ee=new $e({connect:{lookup:bm(oe)}});return(Fe,Ue)=>Pe(Fe,{...Ue,dispatcher:Ee})}function lf(G){let oe=globalThis.process?.getBuiltinModule?.(G);if(oe==null)throw Error(`Node.js built-in module ${G} is unavailable`);return oe}function $f(){let G=Error.prepareStackTrace;try{Error.prepareStackTrace=(Ee,Fe)=>Fe;let oe=Error("Capture current module path");Error.captureStackTrace(oe,$f);let[$e]=oe.stack,Pe=$e?.getFileName();if(Pe==null)throw Error("Unable to determine the current module path");return Pe}finally{Error.prepareStackTrace=G}}var Sm=["connection","keep-alive","te","trailer","transfer-encoding","upgrade","host","forwarded","proxy-authorization","via","x-forwarded-for","x-forwarded-host","x-forwarded-proto","x-real-ip","metadata","metadata-flavor","x-aws-ec2-metadata-token","x-metadata-token","cookie","set-cookie"];function zf(G){let oe=new Headers(G);for(let $e of Sm)oe.delete($e);return oe}var km=10,Pm=new Set([301,302,303,307,308]);async function Em(G){return G==null||G===globalThis.fetch?await $m():G}async function Sf({url:G,headers:oe,abortSignal:$e,maxRedirects:Pe=km,fetch:Ee,trustedOrigin:Fe}){let Ue=oe===void 0?void 0:zf(oe),Be=(Ye)=>{let Qe={signal:$e,redirect:Ye};if(Ue!==void 0)Qe.headers=new Headers(Ue);return Qe},Xe=G;for(let Ye=0;Ye<=Pe;Ye++){let Qe=Fe!==void 0&&Ge(Xe,Fe);if(!Qe)ym(Xe);let ft=Qe&&Ee!=null?Ee:Qe?globalThis.fetch:await Em(Ee),pt=await ft(Xe,Be("manual"));if(pt.type==="opaqueredirect"){if(!gm())throw new U({url:G,message:`Redirect from ${Xe} could not be validated and was blocked`});return await ft(Xe,Be("follow"))}let mt=pt.headers?.get("location");if(Pm.has(pt.status)&&mt){st(pt);let gt=new URL(mt,Xe).toString();if(Ue!==void 0&&!Ge(gt,Xe)){let St=Ue.get("user-agent");Ue=new Headers(St==null?void 0:{"user-agent":St})}Xe=gt;continue}return pt}throw new U({url:G,message:`Too many redirects (max ${Pe})`})}var Om=new Set(["accept","accept-language","baggage","cache-control","idempotency-key","if-match","if-modified-since","if-none-match","if-range","if-unmodified-since","pragma","range","traceparent","tracestate","user-agent","x-correlation-id","x-request-id"]);async function Ot({headers:G,credentialedOrigin:oe,untrustedFirstHopHeaders:$e,...Pe}){let Ee;if(G!==void 0){Ee=zf(G);let Fe=oe??Pe.trustedOrigin;if(Fe===void 0||!Ge(Pe.url,Fe)){let Ue=new Set([...Om,...($e??[]).map((Be)=>Be.toLowerCase())]);Ee=new Headers([...Ee].filter(([Be])=>Ue.has(Be)))}}return Sf({...Pe,headers:Ee})}var At=2147483648;async function bt({response:G,url:oe,maxBytes:$e=At}){let Pe=G.headers.get("content-length");if(Pe!=null){let Qe=parseInt(Pe,10);if(!isNaN(Qe)&&Qe>$e)throw await st(G),new U({url:oe,message:`Download of ${oe} exceeded maximum size of ${$e} bytes (Content-Length: ${Qe}).`})}let Ee=G.body;if(Ee==null)return new Uint8Array(0);let Fe=Ee.getReader(),Ue=[],Be=0;try{while(!0){let{done:Qe,value:ft}=await Fe.read();if(Qe)break;if(Be+=ft.length,Be>$e)throw new U({url:oe,message:`Download of ${oe} exceeded maximum size of ${$e} bytes.`});Ue.push(ft.byteLength<ft.buffer.byteLength?new Uint8Array(ft):ft)}}finally{try{await Fe.cancel()}catch{}finally{Fe.releaseLock()}}let Xe=new Uint8Array(Be),Ye=0;for(let Qe of Ue)Xe.set(Qe,Ye),Ye+=Qe.length;return Xe}async function Te(G,oe){try{let $e=await Ot({url:G,abortSignal:oe?.abortSignal});if(!$e.ok)throw await st($e),new U({url:G,statusCode:$e.status,statusText:$e.statusText});let Pe=await bt({response:$e,url:G,maxBytes:oe?.maxBytes??2147483648}),Ee=$e.headers.get("content-type")??void 0;return new Blob([Pe],Ee?{type:Ee}:void 0)}catch($e){if(U.isInstance($e))throw $e;throw new U({url:G,cause:$e})}}var Qt=Symbol.for("vercel.ai.embeddingModel.maxInputBytesPerCall"),Yt=Symbol.for("vercel.ai.embeddingModel.providerOptionsTransformer");function de(G){let oe=encodeURIComponent(G);return oe==="."?"%252E":oe===".."?"%252E%252E":oe}function Ae(...G){return G.filter((oe)=>oe!=null)}var Z=({prefix:G,size:oe=16,alphabet:$e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:Pe="-"}={})=>{let Ee=()=>{let Fe=$e.length,Ue=Array(oe);for(let Be=0;Be<oe;Be++)Ue[Be]=$e[Math.random()*Fe|0];return Ue.join("")};if(G==null)return Ee;if($e.includes(Pe))throw new b({argument:"separator",message:`The separator "${Pe}" must not be part of the alphabet "${$e}".`});return()=>`${G}${Pe}${Ee()}`},C=Z(),Tm=()=>globalThis.fetch,P=async({url:G,headers:oe={},successfulResponseHandler:$e,failedResponseHandler:Pe,abortSignal:Ee,fetch:Fe,validateUrl:Ue,credentialedOrigin:Be,trustedOrigin:Xe})=>{try{let Ye=Fe??Tm(),Qe=L(Be!==void 0&&!Ge(G,Be)?{}:oe,`ai-sdk-provider-utils/${yo}`,Se()),ft=Ue?await Sf({url:G,headers:Qe,abortSignal:Ee,fetch:Fe,trustedOrigin:Xe}):await Ye(G,{method:"GET",headers:Qe,signal:Ee}),pt=Sr(ft);if(!ft.ok){let mt;try{mt=await Pe({response:ft,url:G,requestBodyValues:{}})}catch(gt){if(W(gt)||v.isInstance(gt))throw gt;throw new v({message:"Failed to process error response",cause:gt,statusCode:ft.status,url:G,responseHeaders:pt,requestBodyValues:{}})}throw mt.value}try{return await $e({response:ft,url:G,requestBodyValues:{}})}catch(mt){if(mt instanceof Error){if(W(mt)||v.isInstance(mt))throw mt}throw new v({message:"Failed to process successful response",cause:mt,statusCode:ft.status,url:G,responseHeaders:pt,requestBodyValues:{}})}}catch(Ye){throw Nn({error:Ye,url:G,requestBodyValues:{}})}},Zm="JSON schema:",Am="You MUST answer with a JSON object that matches the JSON schema above.",Im="You MUST answer with JSON.";function Cm({prompt:G,schema:oe,schemaPrefix:$e=oe!=null?Zm:void 0,schemaSuffix:Pe=oe!=null?Am:Im}){return[G!=null&&G.length>0?G:void 0,G!=null&&G.length>0?"":void 0,$e,oe!=null?JSON.stringify(oe):void 0,Pe].filter((Ee)=>Ee!=null).join(`
69
- `)}function Pt({messages:G,schema:oe,schemaPrefix:$e,schemaSuffix:Pe}){let Ee=G[0]?.role==="system"?{...G[0]}:{role:"system",content:""};return Ee.content=Cm({prompt:Ee.content,schema:oe,schemaPrefix:$e,schemaSuffix:Pe}),[Ee,...G[0]?.role==="system"?G.slice(1):G]}function vt(G){return globalThis.Buffer?.isBuffer(G)??!1}function ze(G){return G!=null}function Xt(G){return typeof G==="object"&&G!==null&&!(G instanceof Uint8Array)&&!(G instanceof URL)&&!(G instanceof ArrayBuffer)&&!vt(G)&&!("type"in G)}function j(G){return G!=null&&typeof G==="object"&&!Array.isArray(G)}function We({mediaType:G,url:oe,supportedUrls:$e}){G=G.toLowerCase();let Pe=!G.includes("/");return Object.entries($e).map(([Ee,Fe])=>{let Ue=Ee.toLowerCase();return Ue==="*"||Ue==="*/*"?{mediaTypePrefix:"",regexes:Fe}:{mediaTypePrefix:Ue.replace(/\*/,""),regexes:Fe}}).filter(({mediaTypePrefix:Ee})=>{if(Ee==="")return!0;if(Pe)return`${G}/`===Ee;return Ee.endsWith("/")?G.startsWith(Ee):G===Ee}).flatMap(({regexes:Ee})=>Ee).some((Ee)=>Nm(Ee,oe))}function Nm(G,oe){if(!G.global&&!G.sticky)return G.test(oe);let $e=G.lastIndex;G.lastIndex=0;try{return G.test(oe)}finally{G.lastIndex=$e}}function he({apiKey:G,environmentVariableName:oe,apiKeyParameterName:$e="apiKey",description:Pe}){if(typeof G==="string")return G;if(G!=null)throw new fn({message:`${Pe} API key must be a string.`});if(typeof process>"u")throw new fn({message:`${Pe} API key is missing. Pass it using the '${$e}' parameter. Environment variables are not supported in this environment.`});if(G=process.env[oe],G==null)throw new fn({message:`${Pe} API key is missing. Pass it using the '${$e}' parameter or the ${oe} environment variable.`});if(typeof G!=="string")throw new fn({message:`${Pe} API key must be a string. The value of the ${oe} environment variable is not a string.`});return G}function pe({settingValue:G,environmentVariableName:oe}){if(typeof G==="string")return G;if(G!=null||typeof process>"u")return;if(G=process.env[oe],G==null||typeof G!=="string")return;return G}function H(G){return G!==void 0&&G!=="provider-default"}function ke({reasoning:G,effortMap:oe,warnings:$e}){let Pe=oe[G];if(Pe==null){$e.push({type:"unsupported",feature:"reasoning",details:`reasoning "${G}" is not supported by this model.`});return}if(Pe!==G)$e.push({type:"compatibility",feature:"reasoning",details:`reasoning "${G}" is not directly supported by this model. mapped to effort "${Pe}".`});return Pe}var Rm={minimal:0.02,low:0.1,medium:0.3,high:0.6,xhigh:0.9,max:0.95};function it({reasoning:G,maxOutputTokens:oe,maxReasoningBudget:$e,minReasoningBudget:Pe=1024,budgetPercentages:Ee=Rm,warnings:Fe}){let Ue=Ee[G];if(Ue==null){Fe.push({type:"unsupported",feature:"reasoning",details:`reasoning "${G}" is not supported by this model.`});return}return Math.min($e,Math.max(Pe,Math.round(oe*Ue)))}function at(G){let[oe,$e=""]=G.toLowerCase().split("/");return{mpeg:"mp3","x-wav":"wav",opus:"ogg",mp4:"m4a","x-m4a":"m4a"}[$e]??$e}function ge({total:G,pending:oe,completed:$e,failed:Pe}){if(ho(G)&&ho(oe)&&ho($e)&&ho(Pe)&&oe+$e+Pe===G)return{total:G,pending:oe,completed:$e,failed:Pe}}function ho(G){return G!=null&&Number.isSafeInteger(G)&&G>=0}var Dm=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Mm=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function ff(G){let oe=JSON.parse(G);if(oe===null||typeof oe!=="object")return oe;if(Dm.test(G)===!1&&Mm.test(G)===!1)return oe;return Lm(oe)}function Lm(G){let oe=[G];while(oe.length){let $e=oe;oe=[];for(let Pe of $e){if(Object.prototype.hasOwnProperty.call(Pe,"__proto__"))throw SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(Pe,"constructor")&&Pe.constructor!==null&&typeof Pe.constructor==="object"&&Object.prototype.hasOwnProperty.call(Pe.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let Ee in Pe){let Fe=Pe[Ee];if(Fe&&typeof Fe==="object")oe.push(Fe)}}}return G}function Q(G){let{stackTraceLimit:oe}=Error;try{Error.stackTraceLimit=0}catch{return ff(G)}try{return ff(G)}finally{Error.stackTraceLimit=oe}}function Yi(G){if(G.type==="object"||Array.isArray(G.type)&&G.type.includes("object")){let{additionalProperties:$e}=G;G.additionalProperties=$e!=null&&typeof $e!=="boolean"?jr($e):!1;let{properties:Pe}=G;if(Pe!=null)for(let Ee of Object.keys(Pe))Pe[Ee]=jr(Pe[Ee])}if(G.items!=null)G.items=Array.isArray(G.items)?G.items.map(jr):jr(G.items);if(G.anyOf!=null)G.anyOf=G.anyOf.map(jr);if(G.allOf!=null)G.allOf=G.allOf.map(jr);if(G.oneOf!=null)G.oneOf=G.oneOf.map(jr);let{definitions:oe}=G;if(oe!=null)for(let $e of Object.keys(oe))oe[$e]=jr(oe[$e]);return G}function jr(G){if(typeof G==="boolean")return G;return Yi(G)}var jm=Symbol("Let zodToJsonSchema decide on which parser to use"),pf={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Fm=(G)=>typeof G==="string"?{...pf,name:G}:{...pf,...G};function yr(){return{}}function Um(G,oe){let $e={type:"array"};if(G.type?._def&&G.type?._def?.typeName!=="ZodAny")$e.items=qt(G.type._def,{...oe,currentPath:[...oe.currentPath,"items"]});if(G.minLength)$e.minItems=G.minLength.value;if(G.maxLength)$e.maxItems=G.maxLength.value;if(G.exactLength)$e.minItems=G.exactLength.value,$e.maxItems=G.exactLength.value;return $e}function Bm(G){let oe={type:"integer",format:"int64"};if(!G.checks)return oe;for(let $e of G.checks)switch($e.kind){case"min":if($e.inclusive)oe.minimum=$e.value;else oe.exclusiveMinimum=$e.value;break;case"max":if($e.inclusive)oe.maximum=$e.value;else oe.exclusiveMaximum=$e.value;break;case"multipleOf":oe.multipleOf=$e.value}return oe}function Jm(){return{type:"boolean"}}function kf(G,oe){return qt(G.type._def,oe)}var Vm=(G,oe)=>qt(G.innerType._def,oe);function Pf(G,oe,$e){let Pe=$e??oe.dateStrategy;if(Array.isArray(Pe))return{anyOf:Pe.map((Ee)=>Pf(G,oe,Ee))};switch(Pe){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Wm(G)}}var Wm=(G)=>{let oe={type:"integer",format:"unix-time"};for(let $e of G.checks)switch($e.kind){case"min":oe.minimum=$e.value;break;case"max":oe.maximum=$e.value}return oe};function Km(G,oe){return{...qt(G.innerType._def,oe),default:G.defaultValue()}}function Hm(G,oe){return oe.effectStrategy==="input"?qt(G.schema._def,oe):yr()}function qm(G){return{type:"string",enum:Array.from(G.values)}}var Gm=(G)=>{if("type"in G&&G.type==="string")return!1;return"allOf"in G};function Xm(G,oe){let $e=[qt(G.left._def,{...oe,currentPath:[...oe.currentPath,"allOf","0"]}),qt(G.right._def,{...oe,currentPath:[...oe.currentPath,"allOf","1"]})].filter((Ee)=>!!Ee),Pe=[];return $e.forEach((Ee)=>{if(Gm(Ee))Pe.push(...Ee.allOf);else{let Fe=Ee;if("additionalProperties"in Ee&&Ee.additionalProperties===!1){let{additionalProperties:Ue,...Be}=Ee;Fe=Be}Pe.push(Fe)}}),Pe.length?{allOf:Pe}:void 0}function Ym(G){let oe=typeof G.value;if(oe!=="bigint"&&oe!=="number"&&oe!=="boolean"&&oe!=="string")return{type:Array.isArray(G.value)?"array":"object"};return{type:oe==="bigint"?"integer":oe,const:G.value}}var Wi=void 0,wr={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(Wi===void 0)Wi=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return Wi},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ef(G,oe){let $e={type:"string"};if(G.checks)for(let Pe of G.checks)switch(Pe.kind){case"min":$e.minLength=typeof $e.minLength==="number"?Math.max($e.minLength,Pe.value):Pe.value;break;case"max":$e.maxLength=typeof $e.maxLength==="number"?Math.min($e.maxLength,Pe.value):Pe.value;break;case"email":switch(oe.emailStrategy){case"format:email":$r($e,"email",Pe.message,oe);break;case"format:idn-email":$r($e,"idn-email",Pe.message,oe);break;case"pattern:zod":pr($e,wr.email,Pe.message,oe)}break;case"url":$r($e,"uri",Pe.message,oe);break;case"uuid":$r($e,"uuid",Pe.message,oe);break;case"regex":pr($e,Pe.regex,Pe.message,oe);break;case"cuid":pr($e,wr.cuid,Pe.message,oe);break;case"cuid2":pr($e,wr.cuid2,Pe.message,oe);break;case"startsWith":pr($e,RegExp(`^${Ki(Pe.value,oe)}`),Pe.message,oe);break;case"endsWith":pr($e,RegExp(`${Ki(Pe.value,oe)}$`),Pe.message,oe);break;case"datetime":$r($e,"date-time",Pe.message,oe);break;case"date":$r($e,"date",Pe.message,oe);break;case"time":$r($e,"time",Pe.message,oe);break;case"duration":$r($e,"duration",Pe.message,oe);break;case"length":$e.minLength=typeof $e.minLength==="number"?Math.max($e.minLength,Pe.value):Pe.value,$e.maxLength=typeof $e.maxLength==="number"?Math.min($e.maxLength,Pe.value):Pe.value;break;case"includes":pr($e,RegExp(Ki(Pe.value,oe)),Pe.message,oe);break;case"ip":if(Pe.version!=="v6")$r($e,"ipv4",Pe.message,oe);if(Pe.version!=="v4")$r($e,"ipv6",Pe.message,oe);break;case"base64url":pr($e,wr.base64url,Pe.message,oe);break;case"jwt":pr($e,wr.jwt,Pe.message,oe);break;case"cidr":if(Pe.version!=="v6")pr($e,wr.ipv4Cidr,Pe.message,oe);if(Pe.version!=="v4")pr($e,wr.ipv6Cidr,Pe.message,oe);break;case"emoji":pr($e,wr.emoji(),Pe.message,oe);break;case"ulid":pr($e,wr.ulid,Pe.message,oe);break;case"base64":switch(oe.base64Strategy){case"format:binary":$r($e,"binary",Pe.message,oe);break;case"contentEncoding:base64":$e.contentEncoding="base64";break;case"pattern:zod":pr($e,wr.base64,Pe.message,oe)}break;case"nanoid":pr($e,wr.nanoid,Pe.message,oe)}return $e}function Ki(G,oe){return oe.patternStrategy==="escape"?eh(G):G}var Qm=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function eh(G){let oe="";for(let $e=0;$e<G.length;$e++){if(!Qm.has(G[$e]))oe+="\\";oe+=G[$e]}return oe}function $r(G,oe,$e,Pe){if(G.format||G.anyOf?.some((Ee)=>Ee.format)){if(!G.anyOf)G.anyOf=[];if(G.format)G.anyOf.push({format:G.format}),delete G.format;G.anyOf.push({format:oe,...$e&&Pe.errorMessages&&{errorMessage:{format:$e}}})}else G.format=oe}function pr(G,oe,$e,Pe){if(G.pattern||G.allOf?.some((Ee)=>Ee.pattern)){if(!G.allOf)G.allOf=[];if(G.pattern)G.allOf.push({pattern:G.pattern}),delete G.pattern;G.allOf.push({pattern:df(oe,Pe),...$e&&Pe.errorMessages&&{errorMessage:{pattern:$e}}})}else G.pattern=df(oe,Pe)}function df(G,oe){if(!oe.applyRegexFlags||!G.flags)return G.source;let $e={i:G.flags.includes("i"),m:G.flags.includes("m"),s:G.flags.includes("s")},Pe=$e.i?G.source.toLowerCase():G.source,Ee="",Fe=!1,Ue=!1,Be=!1;for(let Xe=0;Xe<Pe.length;Xe++){if(Fe){Ee+=Pe[Xe],Fe=!1;continue}if($e.i){if(Ue){if(Pe[Xe].match(/[a-z]/)){if(Be)Ee+=Pe[Xe],Ee+=`${Pe[Xe-2]}-${Pe[Xe]}`.toUpperCase(),Be=!1;else if(Pe[Xe+1]==="-"&&Pe[Xe+2]?.match(/[a-z]/))Ee+=Pe[Xe],Be=!0;else Ee+=`${Pe[Xe]}${Pe[Xe].toUpperCase()}`;continue}}else if(Pe[Xe].match(/[a-z]/)){Ee+=`[${Pe[Xe]}${Pe[Xe].toUpperCase()}]`;continue}}if($e.m){if(Pe[Xe]==="^"){Ee+=`(^|(?<=[\r
70
- ]))`;continue}else if(Pe[Xe]==="$"){Ee+=`($|(?=[\r
71
- ]))`;continue}}if($e.s&&Pe[Xe]==="."){Ee+=Ue?`${Pe[Xe]}\r
72
- `:`[${Pe[Xe]}\r
73
- ]`;continue}if(Ee+=Pe[Xe],Pe[Xe]==="\\")Fe=!0;else if(Ue&&Pe[Xe]==="]")Ue=!1;else if(!Ue&&Pe[Xe]==="[")Ue=!0}try{new RegExp(Ee)}catch{return console.warn(`Could not convert regex pattern at ${oe.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),G.source}return Ee}function Of(G,oe){let $e={type:"object",additionalProperties:qt(G.valueType._def,{...oe,currentPath:[...oe.currentPath,"additionalProperties"]})??oe.allowedAdditionalProperties};if(G.keyType?._def.typeName==="ZodString"&&G.keyType._def.checks?.length){let{type:Pe,...Ee}=Ef(G.keyType._def,oe);return{...$e,propertyNames:Ee}}else if(G.keyType?._def.typeName==="ZodEnum")return{...$e,propertyNames:{enum:G.keyType._def.values}};else if(G.keyType?._def.typeName==="ZodBranded"&&G.keyType._def.type._def.typeName==="ZodString"&&G.keyType._def.type._def.checks?.length){let{type:Pe,...Ee}=kf(G.keyType._def,oe);return{...$e,propertyNames:Ee}}return $e}function th(G,oe){if(oe.mapStrategy==="record")return Of(G,oe);return{type:"array",maxItems:125,items:{type:"array",items:[qt(G.keyType._def,{...oe,currentPath:[...oe.currentPath,"items","items","0"]})||yr(),qt(G.valueType._def,{...oe,currentPath:[...oe.currentPath,"items","items","1"]})||yr()],minItems:2,maxItems:2}}}function rh(G){let oe=G.values,$e=Object.keys(G.values).filter((Ee)=>typeof oe[oe[Ee]]!=="number").map((Ee)=>oe[Ee]),Pe=Array.from(new Set($e.map((Ee)=>typeof Ee)));return{type:Pe.length===1?Pe[0]==="string"?"string":"number":["string","number"],enum:$e}}function nh(){return{not:yr()}}function oh(){return{type:"null"}}var Hi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ih(G,oe){let $e=G.options instanceof Map?Array.from(G.options.values()):G.options;if($e.every((Pe)=>(Pe._def.typeName in Hi)&&(!Pe._def.checks||!Pe._def.checks.length))){let Pe=$e.reduce((Ee,Fe)=>{let Ue=Hi[Fe._def.typeName];return Ue&&!Ee.includes(Ue)?[...Ee,Ue]:Ee},[]);return{type:Pe.length>1?Pe:Pe[0]}}else if($e.every((Pe)=>Pe._def.typeName==="ZodLiteral"&&!Pe.description)){let Pe=$e.reduce((Ee,Fe)=>{let Ue=typeof Fe._def.value;switch(Ue){case"string":case"number":case"boolean":return[...Ee,Ue];case"bigint":return[...Ee,"integer"];case"object":if(Fe._def.value===null)return[...Ee,"null"];default:return Ee}},[]);if(Pe.length===$e.length){let Ee=Pe.filter((Fe,Ue,Be)=>Be.indexOf(Fe)===Ue);return{type:Ee.length>1?Ee:Ee[0],enum:$e.reduce((Fe,Ue)=>Fe.includes(Ue._def.value)?Fe:[...Fe,Ue._def.value],[])}}}else if($e.every((Pe)=>Pe._def.typeName==="ZodEnum"))return{type:"string",enum:$e.reduce((Pe,Ee)=>[...Pe,...Ee._def.values.filter((Fe)=>!Pe.includes(Fe))],[])};return sh(G,oe)}var sh=(G,oe)=>{let $e=(G.options instanceof Map?Array.from(G.options.values()):G.options).map((Pe,Ee)=>qt(Pe._def,{...oe,currentPath:[...oe.currentPath,"anyOf",`${Ee}`]})).filter((Pe)=>!!Pe&&(!oe.strictUnions||typeof Pe==="object"&&Object.keys(Pe).length>0));return $e.length?{anyOf:$e}:void 0};function ch(G,oe){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(G.innerType._def.typeName)&&(!G.innerType._def.checks||!G.innerType._def.checks.length))return{type:[Hi[G.innerType._def.typeName],"null"]};let $e=qt(G.innerType._def,{...oe,currentPath:[...oe.currentPath,"anyOf","0"]});return $e&&{anyOf:[$e,{type:"null"}]}}function ah(G){let oe={type:"number"};if(!G.checks)return oe;for(let $e of G.checks)switch($e.kind){case"int":oe.type="integer";break;case"min":if($e.inclusive)oe.minimum=$e.value;else oe.exclusiveMinimum=$e.value;break;case"max":if($e.inclusive)oe.maximum=$e.value;else oe.exclusiveMaximum=$e.value;break;case"multipleOf":oe.multipleOf=$e.value}return oe}function uh(G,oe){let $e={type:"object",properties:{}},Pe=[],Ee=G.shape();for(let Ue in Ee){let Be=Ee[Ue];if(Be===void 0||Be._def===void 0)continue;let Xe=fh(Be),Ye=qt(Be._def,{...oe,currentPath:[...oe.currentPath,"properties",Ue],propertyPath:[...oe.currentPath,"properties",Ue]});if(Ye===void 0)continue;if($e.properties[Ue]=Ye,!Xe)Pe.push(Ue)}if(Pe.length)$e.required=Pe;let Fe=lh(G,oe);if(Fe!==void 0)$e.additionalProperties=Fe;return $e}function lh(G,oe){if(G.catchall._def.typeName!=="ZodNever")return qt(G.catchall._def,{...oe,currentPath:[...oe.currentPath,"additionalProperties"]});switch(G.unknownKeys){case"passthrough":return oe.allowedAdditionalProperties;case"strict":return oe.rejectedAdditionalProperties;case"strip":return oe.removeAdditionalStrategy==="strict"?oe.allowedAdditionalProperties:oe.rejectedAdditionalProperties}}function fh(G){try{return G.isOptional()}catch{return!0}}var ph=(G,oe)=>{if(oe.currentPath.toString()===oe.propertyPath?.toString())return qt(G.innerType._def,oe);let $e=qt(G.innerType._def,{...oe,currentPath:[...oe.currentPath,"anyOf","1"]});return $e?{anyOf:[{not:yr()},$e]}:yr()},dh=(G,oe)=>{if(oe.pipeStrategy==="input")return qt(G.in._def,oe);else if(oe.pipeStrategy==="output")return qt(G.out._def,oe);let $e=qt(G.in._def,{...oe,currentPath:[...oe.currentPath,"allOf","0"]});return{allOf:[$e,qt(G.out._def,{...oe,currentPath:[...oe.currentPath,"allOf",$e?"1":"0"]})].filter((Pe)=>Pe!==void 0)}};function mh(G,oe){return qt(G.type._def,oe)}function hh(G,oe){let $e={type:"array",uniqueItems:!0,items:qt(G.valueType._def,{...oe,currentPath:[...oe.currentPath,"items"]})};if(G.minSize)$e.minItems=G.minSize.value;if(G.maxSize)$e.maxItems=G.maxSize.value;return $e}function gh(G,oe){if(G.rest)return{type:"array",minItems:G.items.length,items:G.items.map(($e,Pe)=>qt($e._def,{...oe,currentPath:[...oe.currentPath,"items",`${Pe}`]})).reduce(($e,Pe)=>Pe===void 0?$e:[...$e,Pe],[]),additionalItems:qt(G.rest._def,{...oe,currentPath:[...oe.currentPath,"additionalItems"]})};else return{type:"array",minItems:G.items.length,maxItems:G.items.length,items:G.items.map(($e,Pe)=>qt($e._def,{...oe,currentPath:[...oe.currentPath,"items",`${Pe}`]})).reduce(($e,Pe)=>Pe===void 0?$e:[...$e,Pe],[])}}function yh(){return{not:yr()}}function _h(){return yr()}var vh=(G,oe)=>qt(G.innerType._def,oe),bh=(G,oe,$e)=>{switch(oe){case"ZodString":return Ef(G,$e);case"ZodNumber":return ah(G);case"ZodObject":return uh(G,$e);case"ZodBigInt":return Bm(G);case"ZodBoolean":return Jm();case"ZodDate":return Pf(G,$e);case"ZodUndefined":return yh();case"ZodNull":return oh();case"ZodArray":return Um(G,$e);case"ZodUnion":case"ZodDiscriminatedUnion":return ih(G,$e);case"ZodIntersection":return Xm(G,$e);case"ZodTuple":return gh(G,$e);case"ZodRecord":return Of(G,$e);case"ZodLiteral":return Ym(G);case"ZodEnum":return qm(G);case"ZodNativeEnum":return rh(G);case"ZodNullable":return ch(G,$e);case"ZodOptional":return ph(G,$e);case"ZodMap":return th(G,$e);case"ZodSet":return hh(G,$e);case"ZodLazy":return()=>G.getter()._def;case"ZodPromise":return mh(G,$e);case"ZodNaN":case"ZodNever":return nh();case"ZodEffects":return Hm(G,$e);case"ZodAny":return yr();case"ZodUnknown":return _h();case"ZodDefault":return Km(G,$e);case"ZodBranded":return kf(G,$e);case"ZodReadonly":return vh(G,$e);case"ZodCatch":return Vm(G,$e);case"ZodPipeline":return dh(G,$e);case"ZodFunction":case"ZodVoid":case"ZodSymbol":return;default:return((Pe)=>{return})(oe)}},xh=(G,oe)=>{let $e=0;for(;$e<G.length&&$e<oe.length;$e++)if(G[$e]!==oe[$e])break;return[(G.length-$e).toString(),...oe.slice($e)].join("/")};function qt(G,oe,$e=!1){let Pe=oe.seen.get(G);if(oe.override){let Be=oe.override?.(G,oe,Pe,$e);if(Be!==jm)return Be}if(Pe&&!$e){let Be=wh(Pe,oe);if(Be!==void 0)return Be}let Ee={def:G,path:oe.currentPath,jsonSchema:void 0};oe.seen.set(G,Ee);let Fe=bh(G,G.typeName,oe),Ue=typeof Fe==="function"?qt(Fe(),oe):Fe;if(Ue)$h(G,oe,Ue);if(oe.postProcess){let Be=oe.postProcess(Ue,G,oe);return Ee.jsonSchema=Ue,Be}return Ee.jsonSchema=Ue,Ue}var wh=(G,oe)=>{switch(oe.$refStrategy){case"root":return{$ref:G.path.join("/")};case"relative":return{$ref:xh(oe.currentPath,G.path)};case"none":case"seen":if(G.path.length<oe.currentPath.length&&G.path.every(($e,Pe)=>oe.currentPath[Pe]===$e))return console.warn(`Recursive reference detected at ${oe.currentPath.join("/")}! Defaulting to any`),yr();return oe.$refStrategy==="seen"?yr():void 0}},$h=(G,oe,$e)=>{if(G.description)$e.description=G.description;return $e},zh=(G)=>{let oe=Fm(G),$e=oe.name!==void 0?[...oe.basePath,oe.definitionPath,oe.name]:oe.basePath;return{...oe,currentPath:$e,propertyPath:void 0,seen:new Map(Object.entries(oe.definitions).map(([Pe,Ee])=>[Ee._def,{def:Ee._def,path:[...oe.basePath,oe.definitionPath,Pe],jsonSchema:void 0}]))}},Sh=(G,oe)=>{let $e=zh(oe),Pe=typeof oe==="object"&&oe.definitions?Object.entries(oe.definitions).reduce((Xe,[Ye,Qe])=>({...Xe,[Ye]:qt(Qe._def,{...$e,currentPath:[...$e.basePath,$e.definitionPath,Ye]},!0)??yr()}),{}):void 0,Ee=typeof oe==="string"?oe:oe?.nameStrategy==="title"?void 0:oe?.name,Fe=qt(G._def,Ee===void 0?$e:{...$e,currentPath:[...$e.basePath,$e.definitionPath,Ee]},!1)??yr(),Ue=typeof oe==="object"&&oe.name!==void 0&&oe.nameStrategy==="title"?oe.name:void 0;if(Ue!==void 0)Fe.title=Ue;let Be=Ee===void 0?Pe?{...Fe,[$e.definitionPath]:Pe}:Fe:{$ref:[...$e.$refStrategy==="relative"?[]:$e.basePath,$e.definitionPath,Ee].join("/"),[$e.definitionPath]:{...Pe,[Ee]:Fe}};return Be.$schema="http://json-schema.org/draft-07/schema#",Be},qi=Symbol.for("vercel.ai.schema");function i(G){let oe;return()=>{if(oe==null)oe=G();return oe}}function _o(G,{validate:oe}={}){return{[qi]:!0,_type:void 0,get jsonSchema(){if(typeof G==="function")G=G();return G},validate:oe}}function kh(G){return typeof G==="object"&&G!==null&&qi in G&&G[qi]===!0&&"jsonSchema"in G&&"validate"in G}function De(G){return G==null?_o({type:"object",properties:{},additionalProperties:!1}):kh(G)?G:("~standard"in G)?G["~standard"].vendor==="zod"?s(G):Ph(G):G()}function Ph(G){return _o(()=>{if(!Eh(G))throw Error(`Standard schema vendor '${G["~standard"].vendor}' does not support JSON Schema conversion.`);return Yi(G["~standard"].jsonSchema.input({target:"draft-07"}))},{validate:async(oe)=>{let $e=await G["~standard"].validate(oe);return"value"in $e?{success:!0,value:$e.value}:{success:!1,error:new be({value:oe,cause:$e.issues})}}})}function Eh(G){return G["~standard"].jsonSchema!=null}function Oh(G,oe){let $e=oe?.useReferences??!1;return _o(()=>Sh(G,{$refStrategy:$e?"root":"none"}),{validate:async(Pe)=>{let Ee=await G.safeParseAsync(Pe);return Ee.success?{success:!0,value:Ee.data}:{success:!1,error:Ee.error}}})}function Th(G,oe){let $e=oe?.useReferences??!1;return _o(()=>Yi(tt(G,{target:"draft-7",io:"input",reused:$e?"ref":"inline"})),{validate:async(Pe)=>{let Ee=await He(G,Pe);return Ee.success?{success:!0,value:Ee.data}:{success:!1,error:Ee.error}}})}function Zh(G){return"_zod"in G}function s(G,oe){if(Zh(G))return Th(G,oe);else return Oh(G,oe)}async function x({value:G,schema:oe,context:$e}){let Pe=await N({value:G,schema:oe,context:$e});if(!Pe.success)throw be.wrap({value:G,cause:Pe.error,context:$e});return Pe.value}async function N({value:G,schema:oe,context:$e}){let Pe=De(oe);try{if(Pe.validate==null)return{success:!0,value:G,rawValue:G};let Ee=await Pe.validate(G);if(Ee.success)return{success:!0,value:Ee.value,rawValue:G};return{success:!1,error:be.wrap({value:G,cause:Ee.error,context:$e}),rawValue:G}}catch(Ee){return{success:!1,error:be.wrap({value:G,cause:Ee,context:$e}),rawValue:G}}}async function lt({text:G,schema:oe}){try{let $e=Q(G);if(oe==null)return $e;return await x({value:$e,schema:oe})}catch($e){if(Me.isInstance($e)||be.isInstance($e))throw $e;throw new Me({text:G,cause:$e})}}async function J({text:G,schema:oe}){try{let $e=Q(G);if(oe==null)return{success:!0,value:$e,rawValue:$e};return await N({value:$e,schema:oe})}catch($e){return{success:!1,error:Me.isInstance($e)?$e:new Me({text:G,cause:$e}),rawValue:void 0}}}function ct({stream:G,schema:oe}){return G.pipeThrough(new TextDecoderStream).pipeThrough(new mo).pipeThrough(new TransformStream({async transform({data:$e},Pe){if($e==="[DONE]")return;Pe.enqueue(await J({text:$e,schema:oe}))}}))}async function h({provider:G,providerOptions:oe,schema:$e}){if(oe?.[G]==null)return;let Pe=await N({value:oe[G],schema:$e});if(!Pe.success)throw new b({argument:"providerOptions",message:`invalid ${G} provider options`,cause:Pe.error});return Pe.value}var Ah=()=>globalThis.fetch;function mf(G){return G.replace(/[\r\n]/g,"").replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}function Ih(G,oe){let $e=new TextEncoder,Pe=!1,Ee,Fe=new Set;async function*Ue(){for(let Be of G){if(Pe)return;let Xe=`--${oe}\r
74
- Content-Disposition: form-data; name="${mf(Be.name)}"`;if(Be.type==="field"){yield $e.encode(`${Xe}\r
75
- \r
76
- ${Be.value}\r
77
- `);continue}let Ye=`; filename="${mf(Be.filename??"blob")}"`,Qe=(Be.mediaType??"application/octet-stream").replace(/[\r\n]/g,"");if(yield $e.encode(`${Xe}${Ye}\r
78
- Content-Type: ${Qe}\r
79
- \r
80
- `),Be.content instanceof Uint8Array)yield Be.content;else{let ft=Be.content.getReader();Ee=ft,Fe.add(Be.content);let pt=!1;try{while(!0){let{done:mt,value:gt}=await ft.read();if(mt||Pe){pt=mt;break}yield gt}}finally{if(Ee=void 0,!pt)await ft.cancel().catch(()=>{});ft.releaseLock()}if(Pe)return}yield $e.encode(`\r
81
- `)}yield $e.encode(`--${oe}--\r
82
- `)}return{stream:ie(Ue()),async dispose(Be){if(Pe)return;Pe=!0;let Xe=Ee;if(Xe!=null)await Xe.cancel(Be).catch(()=>{});for(let Ye of G)if(Ye.type==="file"&&!(Ye.content instanceof Uint8Array)&&!Fe.has(Ye.content))await Ye.content.cancel(Be).catch(()=>{})}}}var en=async({url:G,headers:oe={},parts:$e,failedResponseHandler:Pe,successfulResponseHandler:Ee,abortSignal:Fe,fetch:Ue=Ah()})=>{let Be=`ai-sdk-multipart-${C()}`,Xe=Object.fromEntries($e.map((Qe)=>[Qe.name,Qe.type==="field"?Qe.value:`<file:${Qe.filename??Qe.name}>`])),Ye=Ih($e,Be);try{let Qe=await Ue(G,{method:"POST",headers:L({...oe,"Content-Type":`multipart/form-data; boundary=${Be}`},`ai-sdk-provider-utils/${yo}`,Se()),body:Ye.stream,duplex:"half",signal:Fe}),ft=Sr(Qe);if(!Qe.ok){let pt;try{pt=await Pe({response:Qe,url:G,requestBodyValues:Xe})}catch(mt){if(W(mt)||v.isInstance(mt))throw mt;throw new v({message:"Failed to process error response",cause:mt,statusCode:Qe.status,url:G,responseHeaders:ft,requestBodyValues:Xe})}throw pt.value}try{return await Ee({response:Qe,url:G,requestBodyValues:Xe})}catch(pt){if(pt instanceof Error){if(W(pt)||v.isInstance(pt))throw pt}throw new v({message:"Failed to process successful response",cause:pt,statusCode:Qe.status,url:G,responseHeaders:ft,requestBodyValues:Xe})}}catch(Qe){throw await Ye.dispose(Qe),Nn({error:Qe,url:G,requestBodyValues:Xe})}},Ch=()=>globalThis.fetch,g=async({url:G,headers:oe,body:$e,failedResponseHandler:Pe,successfulResponseHandler:Ee,abortSignal:Fe,fetch:Ue})=>await we({url:G,headers:{"Content-Type":"application/json",...oe},body:{content:JSON.stringify($e),values:$e},failedResponseHandler:Pe,successfulResponseHandler:Ee,abortSignal:Fe,fetch:Ue}),ne=async({url:G,headers:oe,formData:$e,failedResponseHandler:Pe,successfulResponseHandler:Ee,abortSignal:Fe,fetch:Ue})=>await we({url:G,headers:oe,body:{content:$e,values:Object.fromEntries($e.entries())},failedResponseHandler:Pe,successfulResponseHandler:Ee,abortSignal:Fe,fetch:Ue}),we=async({url:G,headers:oe={},body:$e,successfulResponseHandler:Pe,failedResponseHandler:Ee,abortSignal:Fe,fetch:Ue=Ch()})=>{try{let Be=await Ue(G,{method:"POST",headers:L(oe,`ai-sdk-provider-utils/${yo}`,Se()),body:$e.content,signal:Fe}),Xe=Sr(Be);if(!Be.ok){let Ye;try{Ye=await Ee({response:Be,url:G,requestBodyValues:$e.values})}catch(Qe){if(W(Qe)||v.isInstance(Qe))throw Qe;throw new v({message:"Failed to process error response",cause:Qe,statusCode:Be.status,url:G,responseHeaders:Xe,requestBodyValues:$e.values})}throw Ye.value}try{return await Pe({response:Be,url:G,requestBodyValues:$e.values})}catch(Ye){if(Ye instanceof Error){if(W(Ye)||v.isInstance(Ye))throw Ye}throw new v({message:"Failed to process successful response",cause:Ye,statusCode:Be.status,url:G,responseHeaders:Xe,requestBodyValues:$e.values})}}catch(Be){throw Nn({error:Be,url:G,requestBodyValues:$e.values})}};function Qi(G){return G}function re({id:G,inputSchema:oe}){return({execute:$e,outputSchema:Pe,needsApproval:Ee,toModelOutput:Fe,onInputStart:Ue,onInputDelta:Be,onInputAvailable:Xe,...Ye})=>Qi({type:"provider",isProviderExecuted:!1,id:G,args:Ye,inputSchema:oe,outputSchema:Pe,execute:$e,needsApproval:Ee,toModelOutput:Fe,onInputStart:Ue,onInputDelta:Be,onInputAvailable:Xe})}function Je({id:G,inputSchema:oe,outputSchema:$e}){return({execute:Pe,needsApproval:Ee,toModelOutput:Fe,onInputStart:Ue,onInputDelta:Be,onInputAvailable:Xe,...Ye})=>Qi({type:"provider",isProviderExecuted:!1,id:G,args:Ye,inputSchema:oe,outputSchema:$e,execute:Pe,needsApproval:Ee,toModelOutput:Fe,onInputStart:Ue,onInputDelta:Be,onInputAvailable:Xe})}function k({id:G,inputSchema:oe,outputSchema:$e,supportsDeferredResults:Pe}){return({onInputStart:Ee,onInputDelta:Fe,onInputAvailable:Ue,...Be})=>Qi({type:"provider",isProviderExecuted:!0,id:G,args:Be,inputSchema:oe,outputSchema:$e,onInputStart:Ee,onInputDelta:Fe,onInputAvailable:Ue,supportsDeferredResults:Pe})}async function _(G){if(typeof G==="function")G=G();return G}function O({part:G}){if(K(G.mediaType))return G.mediaType;if(G.data.type==="data"){let oe=Ie({data:G.data.data,topLevelType:z(G.mediaType)});if(oe)return oe;throw new u({functionality:`file of media type "${G.mediaType}" must specify subtype since it could not be auto-detected`})}throw new u({functionality:`file of media type "${G.mediaType}" must specify subtype since it is not passed as inline bytes`})}function V({reference:G,provider:oe}){let $e=G[oe];if($e!=null)return $e;throw new ws({provider:oe,reference:G})}var tn=({maxRetries:G=2,initialDelayInMs:oe=2000,backoffFactor:$e=2,abortSignal:Pe,shouldRetry:Ee,getDelayInMs:Fe=({exponentialBackoffDelay:Be})=>Be,createRetryError:Ue=({message:Be})=>Error(Be)})=>async(Be)=>Tf(Be,{maxRetries:G,delayInMs:oe,backoffFactor:$e,abortSignal:Pe,shouldRetry:Ee,getDelayInMs:Fe,createRetryError:Ue});async function Tf(G,{maxRetries:oe,delayInMs:$e,backoffFactor:Pe,abortSignal:Ee,shouldRetry:Fe,getDelayInMs:Ue,createRetryError:Be},Xe=[]){try{return await G()}catch(Ye){if(W(Ye))throw Ye;if(oe===0)throw Ye;let Qe=R(Ye),ft=[...Xe,Ye],pt=ft.length;if(pt>oe)throw Be({message:`Failed after ${pt} attempts. Last error: ${Qe}`,reason:"maxRetriesExceeded",errors:ft});if(await Fe(Ye)&&pt<=oe)return await Oe(Ue({error:Ye,exponentialBackoffDelay:$e}),{abortSignal:Ee}),Tf(G,{maxRetries:oe,delayInMs:Pe*$e,backoffFactor:Pe,abortSignal:Ee,shouldRetry:Fe,getDelayInMs:Ue,createRetryError:Be},ft);if(pt===1)throw Ye;throw Be({message:`Failed after ${pt} attempts with non-retryable error: '${Qe}'`,reason:"errorNotRetryable",errors:ft})}}var Nh=new TextDecoder,Rh=67108864;function Zf({stream:G,url:oe,requestBodyValues:$e,statusCode:Pe,responseHeaders:Ee}){let Fe=G.getReader(),Ue=!1,Be=()=>{if(!Ue)Fe.releaseLock(),Ue=!0};return new ReadableStream({async pull(Xe){try{let{done:Ye,value:Qe}=await Fe.read();if(Ye)Be(),Xe.close();else Xe.enqueue(Qe)}catch(Ye){if(Be(),W(Ye)){Xe.error(Ye);return}Xe.error(Nn({error:new v({message:"Failed to process successful response",cause:Ye,statusCode:Pe,url:oe,responseHeaders:Ee,requestBodyValues:$e}),url:oe,requestBodyValues:$e}))}},async cancel(Xe){try{await Fe.cancel(Xe)}finally{Be()}}})}async function es({response:G,url:oe}){return Nh.decode(await bt({response:G,url:oe}))}var E=({errorSchema:G,errorToMessage:oe,isRetryable:$e})=>async({response:Pe,url:Ee,requestBodyValues:Fe})=>{let Ue=await es({response:Pe,url:Ee}),Be=Sr(Pe);if(Ue.trim()==="")return{responseHeaders:Be,value:new v({message:Pe.statusText,url:Ee,requestBodyValues:Fe,statusCode:Pe.status,responseHeaders:Be,responseBody:Ue,isRetryable:$e?.(Pe)})};try{let Xe=await lt({text:Ue,schema:G});return{responseHeaders:Be,value:new v({message:oe(Xe),url:Ee,requestBodyValues:Fe,statusCode:Pe.status,responseHeaders:Be,responseBody:Ue,data:Xe,isRetryable:$e?.(Pe,Xe)})}}catch{return{responseHeaders:Be,value:new v({message:Pe.statusText,url:Ee,requestBodyValues:Fe,statusCode:Pe.status,responseHeaders:Be,responseBody:Ue,isRetryable:$e?.(Pe)})}}},D=(G)=>async({response:oe,url:$e,requestBodyValues:Pe})=>{let Ee=Sr(oe);if(oe.body==null)throw new Dn({});return{responseHeaders:Ee,value:ct({stream:Zf({stream:oe.body,url:$e,requestBodyValues:Pe,statusCode:oe.status,responseHeaders:Ee}),schema:G})}},p=(G)=>async({response:oe,url:$e,requestBodyValues:Pe})=>{let Ee=await es({response:oe,url:$e}),Fe=await J({text:Ee,schema:G}),Ue=Sr(oe);if(!Fe.success)throw new v({message:"Invalid JSON response",cause:Fe.error,statusCode:oe.status,responseHeaders:Ue,responseBody:Ee,url:$e,requestBodyValues:Pe});return{responseHeaders:Ue,value:Fe.value,rawValue:Fe.rawValue}},_e=(G,{maxLineBytes:oe=Rh}={})=>{if(!Number.isSafeInteger(oe)||oe<=0)throw new b({argument:"maxLineBytes",message:"maxLineBytes must be a positive safe integer."});return async({response:$e,url:Pe})=>{let Ee=Sr($e);if($e.body==null)throw new Dn({});return{responseHeaders:Ee,value:Dh({stream:$e.body,schema:G,url:Pe,maxLineBytes:oe})}}};async function*Dh({stream:G,schema:oe,url:$e,maxLineBytes:Pe}){let Ee=G.getReader(),Fe=new TextDecoder,Ue="",Be=0,Xe=!1;try{while(!0){let{done:Qe,value:ft}=await Ee.read();if(Qe){Xe=!0,Ue+=Fe.decode();break}let pt=0;while(pt<ft.length){let mt=ft.indexOf(10,pt),gt=mt===-1?ft.length:mt;if(Be+=gt-pt,Be>Pe)throw new U({message:`JSON Lines response exceeded maximum line size of ${Pe} bytes.`,url:$e});let St=mt===-1?gt:mt+1;if(Ue+=Fe.decode(ft.subarray(pt,St),{stream:!0}),mt===-1)break;let Tt=Ue.slice(0,-1).replace(/\r$/,"");if(Ue="",Be=0,pt=St,Tt.trim().length>0)yield await lt({text:Tt,schema:oe})}}let Ye=Ue.replace(/\r$/,"");if(Ye.trim().length>0)yield await lt({text:Ye,schema:oe})}finally{if(!Xe)await Ee.cancel().catch(()=>{});Ee.releaseLock()}}var ut=()=>async({response:G,url:oe,requestBodyValues:$e})=>{let Pe=Sr(G);if(!G.body)throw new v({message:"Response body is empty",url:oe,requestBodyValues:$e,statusCode:G.status,responseHeaders:Pe,responseBody:void 0});try{let Ee=await G.arrayBuffer();return{responseHeaders:Pe,value:new Uint8Array(Ee)}}catch(Ee){throw new v({message:"Failed to read response as array buffer",url:oe,requestBodyValues:$e,statusCode:G.status,responseHeaders:Pe,responseBody:void 0,cause:Ee})}},nn=()=>async({response:G,url:oe,requestBodyValues:$e})=>{let Pe=Sr(G);if(G.body==null)throw new Dn({});return{responseHeaders:Pe,value:Zf({stream:G.body,url:oe,requestBodyValues:$e,statusCode:G.status,responseHeaders:Pe})}},rn=()=>async({response:G,url:oe,requestBodyValues:$e})=>{let Pe=Sr(G),Ee=await es({response:G,url:oe});return{responseHeaders:Pe,value:new v({message:G.statusText,url:oe,requestBodyValues:$e,statusCode:G.status,responseHeaders:Pe,responseBody:Ee})}};function go(G){if(G===null||G===void 0)return!0;let oe=typeof G;if(oe==="string"||oe==="number"||oe==="boolean")return!0;if(oe==="function"||oe==="symbol"||oe==="bigint")return!1;if(Array.isArray(G))return G.every(go);if(Object.getPrototypeOf(G)===Object.prototype)return Object.values(G).every(go);return!1}var Af="AI_SerializationError",If=`vercel.ai.error.${Af}`,Mh=Symbol.for(If),Lh=class extends m{constructor({message:G="Failed to serialize value.",cause:oe}={}){super({name:Af,message:G,cause:oe});this[Mh]=!0}static isInstance(G){return m.hasMarker(G,If)}};function M(G){let oe={};for(let[$e,Pe]of Object.entries(G.config))if($e==="headers"){let Ee=jh(Pe);if(go(Ee))oe[$e]=Ee}else if(go(Pe))oe[$e]=Pe;return{modelId:G.modelId,config:oe}}function jh(G){let oe=G;if(typeof G==="function")oe=G();if(oe instanceof Promise)throw new Lh({message:"Cannot serialize asynchronous model options."});return oe}var on="speech-stream.start",sn="speech-stream.text-delta",an="speech-stream.text-done";function ln(G){let oe;try{oe=Q(G)}catch{return}if(!j(oe))return;let $e=oe;switch($e.type){case"stream-start":{if(!Array.isArray($e.warnings))return;let Pe=$e.warnings.filter((Ee)=>!Uh(Ee));return Pe.every(Bh)?{...$e,warnings:Pe}:void 0}case"audio":return Or($e.audio)&&Jh($e.audioFormat)&&Rr($e.id,Or)&&Rr($e.providerMetadata,j)?$e:void 0;case"finish":return Rr($e.usage,Vh)&&Rr($e.providerMetadata,j)?$e:void 0;case"response-metadata":{if(!(Rr($e.modelId,Or)&&Rr($e.headers,j)))return;let Pe=$e.timestamp;if(Pe==null)return{...$e,timestamp:void 0};if(typeof Pe!=="string")return;let Ee=new Date(Pe);return Number.isNaN(Ee.getTime())?void 0:{...$e,timestamp:Ee}}case"raw":return"rawValue"in $e?$e:void 0;case"error":return"error"in $e?$e:void 0;default:return}}function Or(G){return typeof G==="string"}function Rr(G,oe){return G===void 0||oe(G)}var Fh=new Set(["compatibility","deprecated","other","unsupported"]);function Uh(G){return j(G)&&Or(G.type)&&!Fh.has(G.type)}function Bh(G){if(!j(G))return!1;switch(G.type){case"compatibility":case"unsupported":return Or(G.feature)&&Rr(G.details,Or);case"deprecated":return Or(G.setting)&&Or(G.message);case"other":return Or(G.message);default:return!1}}function Jh(G){return j(G)&&Or(G.type)&&G.type.length>0&&Rr(G.rate,(oe)=>typeof oe==="number"&&Number.isFinite(oe)&&oe>0)}function Vh(G){return j(G)&&["inputCharacters","inputTokens","outputTokens"].every((oe)=>Rr(G[oe],($e)=>typeof $e==="number"))}function Wh(G){if(typeof G!=="string")return!1;let oe=G.trimStart()[0];return oe==="{"||oe==="["}var Kh=class{constructor(G=""){this.structure={kind:"undetermined"},this.append(G)}get hasCompleteStructuredValue(){return this.structure.kind==="structured"&&this.structure.complete===!0}append(G){let oe=this.structure;for(let $e of G){if(oe.kind==="undetermined"){if(/\s/.test($e))continue;if($e!=="{"&&$e!=="["){oe={kind:"other"};continue}oe={kind:"structured",stack:[$e],inString:!1,escaped:!1,complete:!1};continue}if(oe.kind!=="structured"||oe.complete)continue;if(oe.inString){if(oe.escaped)oe.escaped=!1;else if($e==="\\")oe.escaped=!0;else if($e==='"')oe.inString=!1;continue}if($e==='"')oe.inString=!0;else if($e==="{"||$e==="[")oe.stack.push($e);else if($e==="}"||$e==="]"){let Pe=$e==="}"?"{":"[";if(oe.stack.at(-1)!==Pe){oe={kind:"other"};continue}if(oe.stack.pop(),oe.stack.length===0)oe.complete=!0}}this.structure=oe}},Ce=class{constructor(G,oe={}){this.toolCalls=[],this.toolCallsById=new Map,this.toolCallsByIndex=new Map,this.usedToolCallIds=new Set,this.nextGeneratedIdSuffixes=new Map,this.controller=G,this._generateId=oe.generateId??C,this.typeValidation=oe.typeValidation??"none",this.extractMetadata=oe.extractMetadata,this.buildToolCallProviderMetadata=oe.buildToolCallProviderMetadata}processDelta(G){let oe=G.function?.name,$e=typeof oe==="string"&&oe.trim().length===0,Pe=this.getNonBlankString(G.id),Ee=this.getNonBlankString(oe),Fe=G.function?.arguments,{index:Ue}=G,Be=this.resolveToolCall({wireId:Pe,index:Ue,name:Ee,hasExplicitCallStart:Ee!=null&&Wh(Fe),hasEmptyArguments:Fe==null||Fe.trim().length===0});if(Be.kind==="ambiguous")return;let Xe;if(Be.kind==="new"){if($e)return;Xe=this.processNewToolCall(G,{wireId:Pe,index:Ue,name:Ee})}else{if(Xe=Be.toolCall,Pe!=null)this.associateWireId(Xe,Pe);this.processExistingToolCall(Xe,G)}if(Ue!=null)this.associateIndex(Xe,Ue)}flush(){let G=this.toolCalls.every((oe)=>oe.index!=null)?[...this.toolCalls].sort((oe,$e)=>oe.index-$e.index||oe.sequence-$e.sequence):this.toolCalls;for(let oe of G)if(!oe.hasFinished)this.finishToolCall(oe)}resolveToolCall({wireId:G,index:oe,name:$e,hasExplicitCallStart:Pe,hasEmptyArguments:Ee}){let Fe=oe!=null?this.toolCallsByIndex.get(oe):void 0,Ue=this.filterToolCallsByName(Fe,$e);if(G!=null){let Xe=this.toolCallsById.get(G);if(Xe!=null){if(oe!=null){let Ye=Ue.filter((ft)=>Xe.has(ft)),Qe=this.resolveMatchingToolCall(Ye,Pe);if(Qe.kind!=="new")return Qe;if($e!=null)return{kind:"new"};if(Fe!=null)return{kind:"ambiguous"};return this.resolveMatchingToolCall([...Xe],!1)}if($e!=null){let Ye=[...Xe].filter((Qe)=>Qe.function.name===$e);return this.resolveMatchingToolCall(Ye,Pe)}return this.resolveMatchingToolCall([...Xe],!1)}if(Ue.length>0)return Pe?{kind:"new"}:this.resolveMatchingToolCall(Ue,$e!=null&&Ee);return{kind:"new"}}if(Fe!=null)return this.resolveMatchingToolCall(Ue,Pe);if($e!=null)return{kind:"new"};let Be=this.toolCalls.filter((Xe)=>!Xe.hasFinished);return this.resolveMatchingToolCall(Be,!1)}filterToolCallsByName(G,oe){if(G==null)return[];return[...G].filter(($e)=>oe==null||$e.function.name===oe)}resolveMatchingToolCall(G,oe){if(G.length===0)return{kind:"new"};let $e=G.filter((Pe)=>!Pe.argumentState.hasCompleteStructuredValue);if(!oe&&G.length===1)return{kind:"existing",toolCall:G[0]};if($e.length===1)return{kind:"existing",toolCall:$e[0]};if($e.length>1||!oe)return{kind:"ambiguous"};return{kind:"new"}}processNewToolCall(G,{wireId:oe,index:$e,name:Pe}){if(this.typeValidation==="required"){if(G.type!=="function")throw new A({data:G,message:"Expected 'function' type."})}else if(this.typeValidation==="if-present"){if(G.type!=null&&G.type!=="function")throw new A({data:G,message:"Expected 'function' type."})}if(Pe==null)throw new A({data:G,message:"Expected 'function.name' to be a string."});let Ee=this.createToolCallId(oe);this.controller.enqueue({type:"tool-input-start",id:Ee,toolName:Pe});let Fe=this.extractMetadata?.(G),Ue=G.function?.arguments??"",Be={id:Ee,index:$e??void 0,sequence:this.toolCalls.length,type:"function",function:{name:Pe,arguments:Ue},argumentState:new Kh(Ue),hasFinished:!1,metadata:Fe};if(this.toolCalls.push(Be),oe!=null)this.associateWireId(Be,oe);if(Be.function.arguments.length>0)this.controller.enqueue({type:"tool-input-delta",id:Be.id,delta:Be.function.arguments});return Be}associateWireId(G,oe){let $e=this.toolCallsById.get(oe);if($e==null)$e=new Set,this.toolCallsById.set(oe,$e);$e.add(G)}associateIndex(G,oe){let $e=this.toolCallsByIndex.get(oe);if($e==null)$e=new Set,this.toolCallsByIndex.set(oe,$e);$e.add(G)}createToolCallId(G){if(G!=null&&!this.usedToolCallIds.has(G))return this.usedToolCallIds.add(G),G;let oe=this.getNonBlankString(this._generateId())??"tool-call";if(!this.usedToolCallIds.has(oe))return this.usedToolCallIds.add(oe),oe;let $e=this.nextGeneratedIdSuffixes.get(oe)??1,Pe=$e+this.usedToolCallIds.size;for(let Ee=$e;Ee<=Pe;Ee++){let Fe=`${oe}-${Ee}`;if(!this.usedToolCallIds.has(Fe))return this.usedToolCallIds.add(Fe),this.nextGeneratedIdSuffixes.set(oe,Ee+1),Fe}throw Error("Failed to create a unique tool call ID.")}getNonBlankString(G){return G!=null&&G.trim().length>0?G:void 0}processExistingToolCall(G,oe){if(G.hasFinished)return;if(oe.function?.arguments!=null)G.argumentState.append(oe.function.arguments),G.function.arguments+=oe.function.arguments,this.controller.enqueue({type:"tool-input-delta",id:G.id,delta:oe.function.arguments})}finishToolCall(G){this.controller.enqueue({type:"tool-input-end",id:G.id});let oe=this.buildToolCallProviderMetadata?.(G.metadata);this.controller.enqueue({type:"tool-call",toolCallId:G.id,toolName:G.function.name,input:G.function.arguments,...oe?{providerMetadata:oe}:{}}),G.hasFinished=!0}};var cn="transcription-stream.start",un="transcription-stream.audio-done";function dn(G){let oe;try{oe=Q(G)}catch{return}if(oe==null||typeof oe!=="object"||Array.isArray(oe))return;let $e=oe;switch($e.type){case"stream-start":return Array.isArray($e.warnings)&&$e.warnings.every(Hh)?$e:void 0;case"transcript-delta":return zr($e.delta)&&ur($e.id,zr)&&ur($e.providerMetadata,j)?$e:void 0;case"transcript-partial":return zr($e.text)&&ur($e.id,zr)&&ur($e.startSecond,Nr)&&ur($e.durationInSeconds,Nr)&&ur($e.channelIndex,Nr)&&ur($e.providerMetadata,j)?$e:void 0;case"transcript-final":return zr($e.text)&&ur($e.id,zr)&&ur($e.startSecond,Nr)&&ur($e.endSecond,Nr)&&ur($e.channelIndex,Nr)&&ur($e.providerMetadata,j)?$e:void 0;case"finish":return zr($e.text)&&Array.isArray($e.segments)&&$e.segments.every(qh)&&ur($e.language,zr)&&ur($e.durationInSeconds,Nr)&&ur($e.usage,j)&&ur($e.providerMetadata,j)?$e:void 0;case"response-metadata":{if(!(ur($e.modelId,zr)&&ur($e.headers,j)))return;let Pe=$e.timestamp;if(Pe==null)return{...$e,timestamp:void 0};if(typeof Pe!=="string")return;let Ee=new Date(Pe);return Number.isNaN(Ee.getTime())?void 0:{...$e,timestamp:Ee}}case"raw":return"rawValue"in $e?$e:void 0;case"error":return"error"in $e?$e:void 0;default:return}}function zr(G){return typeof G==="string"}function Nr(G){return typeof G==="number"}function ur(G,oe){return G===void 0||oe(G)}function Hh(G){return j(G)&&zr(G.type)}function qh(G){return j(G)&&zr(G.text)&&Nr(G.startSecond)&&Nr(G.endSecond)}function dt(G){if(G?.trim()==="")throw new b({argument:"baseURL",message:"baseURL must be a non-empty string."});return G}function Y(G){return G?.replace(/\/$/,"")}function $t(G){return G!=null&&typeof G.execute==="function"}function Gh(G){return G!=null&&typeof G[Symbol.asyncIterator]==="function"}async function*pn({tool:G,input:oe,options:$e}){let Pe=G.execute(oe,$e);if(Gh(Pe)){let Ee;for await(let Fe of Pe)Ee=Fe,yield{type:"preliminary",output:Fe};yield{type:"final",output:Ee}}else yield{type:"final",output:await Pe}}function Ke(G,oe){return Object.defineProperty({...G},"experimental_toolCaller",{value:oe})}function wt(G){return G?.experimental_toolCaller}
83
- export{m,zt,v,R,b,ye,A,Me,Ze,me,be,u,et,Dt,Ut,Bt,Ft,Zt,tt,He,Et,e,yt,r,Mt,c,Ht,Ve,ae,w,Re,Vt,o,t,se,B,l,f,nt,ce,y,_n,a,n,je,Gt,Wt,F,S,I,qe,d,Oe,Rt,ue,fe,ie,q,X,T,ve,Jt,rt,ee,te,le,xe,ot,Ne,Se,W,Le,L,Kt,Ie,z,K,st,U,Ge,Ot,At,bt,Te,Qt,Yt,de,Ae,Z,C,P,Pt,vt,ze,Xt,j,We,he,pe,H,ke,it,at,ge,Q,i,De,s,x,N,lt,J,ct,h,en,g,ne,we,re,Je,k,_,O,V,tn,E,D,p,_e,ut,nn,rn,M,on,sn,an,ln,Ce,cn,un,dn,dt,Y,$t,pn,Ke,wt};