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