murmur-rag 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,7 +56,7 @@ ${oe.join(`
56
56
  }
57
57
  `)}return St.write("payload.value = newResult;"),St.write("return payload;"),St.compile()},Ue,Be=Vr,Xe=!cr.jitless,Qe=Xe&&Ms.value,et=oe.catchall,tt;N._zod.parse=(ft,gt)=>{tt??(tt=Re.value);let bt=ft.value;if(!Be(bt))return ft.issues.push({expected:"object",code:"invalid_type",input:bt,inst:N}),ft;if(Xe&&Qe&&gt?.async===!1&&gt.jitless!==!0){if(!Ue)Ue=Le(oe.shape);if(ft=Ue(ft,gt),!et)return ft;return Xa([],bt,ft,gt,tt,N,gt?.abortEarly===!0)}return Ie(ft,gt)}});function ra(N,oe,Ie,Re){for(let Le of N)if(Le.issues.length===0)return oe.value=Le.value,oe;let De=N.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:N.map((Le)=>Le.issues.map((Ue)=>zr(Ue,Re,pr())))}),oe}var Vo=ht("$ZodUnion",(N,oe)=>{At.init(N,oe),Tt(N,"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),Tt(N,"optout",(Re)=>Re.def.options.some((De)=>De._zod.optout==="optional")?"optional":void 0),Tt(N,"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}),Tt(N,"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;N._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,N,De);return Promise.all(Ue).then((Be)=>ra(Be,Re,N,De))}});function Cp(N){let oe=new Map;for(let Ie of N.options){let Re=Ie._zod.propValues?.[N.discriminator];if(!Re||Re.size===0)throw Error(`Invalid discriminated union option at index "${N.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",(N,oe)=>{oe.inclusive=!1,Vo.init(N,oe);let Ie=N._zod.parse;Tt(N,"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));N._zod.parse=(De,Le)=>{let Ue=De.value;if(!Vr(Ue))return De.issues.push({code:"invalid_type",expected:"object",input:Ue,inst:N}),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:N}),De}}),eu=ht("$ZodIntersection",(N,oe)=>{At.init(N,oe),N._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(N,oe){if(N===oe)return{valid:!0,data:N};if(N instanceof Date&&oe instanceof Date&&+N===+oe)return{valid:!0,data:N};if(jr(N)&&jr(oe)){let Ie=Object.keys(oe),Re=Object.keys(N).filter((Le)=>Ie.indexOf(Le)!==-1),De={...N,...oe};if(Object.prototype.hasOwnProperty.call(De,"__proto__"))delete De.__proto__;for(let Le of Re){if(Le==="__proto__")continue;let Ue=Fo(N[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(N)&&Array.isArray(oe)){if(N.length!==oe.length)return{valid:!1,mergeErrorPath:[]};let Ie=[];for(let Re=0;Re<N.length;Re++){let De=N[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(N,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 tt=String(Ye.path[0]);if(!Le.has(tt))Le.set(tt,Ye);et=[tt]}else return!1;for(let tt of et){if(!Re.has(tt))Re.set(tt,{});Re.get(tt)[Qe]=!0}return!0};for(let Ye of oe.issues)if(!Ue(Ye,"l"))N.issues.push(Ye);for(let Ye of Ie.issues)if(!Ue(Ye,"r"))N.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)N.issues.push({...De,keys:Ye});for(let Qe of Be)if(!Ye.includes(Qe)&&Le.has(Qe))N.issues.push(Le.get(Qe))}let Xe=Fo(oe.value,Ie.value);if(!Xe.valid){if(gr(N))return N;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Xe.mergeErrorPath)}`)}return N.value=Xe.data,N}var tu=ht("$ZodTuple",(N,oe)=>{At.init(N,oe);let Ie=oe.items,Re=cr.memoizer;Re?.attach(N),N._zod.parse=(De,Le)=>{let Ue=De.value;if(!Array.isArray(Ue))return De.issues.push({input:Ue,inst:N,expected:"tuple",code:"invalid_type"}),De;De.value=Re?Re.alloc(N,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:N,origin:"array"}),De;if(Ue.length>Ie.length)De.issues.push({code:"too_big",maximum:Ie.length,inclusive:!0,input:Ue,inst:N,origin:"array"})}let Qe=Array(Ie.length),et=oe.rest?Le?.abortEarly:void 0,tt=!1;for(let ft=0;ft<Ie.length;ft++){let gt=Ie[ft]._zod.run({value:Ue[ft],issues:[]},Le);if(gt instanceof Promise)Be.push(gt.then((bt)=>{Qe[ft]=bt}));else if(Qe[ft]=gt,et&&!tt&&gt.issues.length)tt=gr(gt)}if(oe.rest&&!tt){let ft=Ie.length-1,gt=Ue.slice(Ie.length),bt=De.issues.length;for(let St of gt){if(et&&De.issues.length!==bt){if(gr(De,bt))break;bt=De.issues.length}ft++;let Et=oe.rest._zod.run({value:St,issues:[]},Le);if(Et instanceof Promise)Be.push(Et.then((rr)=>ia(rr,De,ft)));else ia(Et,De,ft)}}if(Be.length)return Promise.all(Be).then(()=>sa(Qe,De,Ie,Ue,Ye));return sa(Qe,De,Ie,Ue,Ye)}});function oa(N,oe){for(let Ie=N.length-1;Ie>=0;Ie--)if(!(oe==="optin"?N[Ie]._zod.optin!==void 0:N[Ie]._zod.optout==="optional"))return Ie+1;return 0}function ia(N,oe,Ie){if(N.issues.length)oe.issues.push(...yr(Ie,N.issues));oe.value[Ie]=N.value}function sa(N,oe,Ie,Re,De){for(let Le=0;Le<Ie.length;Le++){let Ue=N[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",(N,oe)=>{At.init(N,oe);let Ie=cr.memoizer;Ie?.attach(N),N._zod.parse=(Re,De)=>{let Le=Re.value;if(!jr(Le))return Re.issues.push({expected:"record",code:"invalid_type",input:Le,inst:N}),Re;let Ue=[],Be=oe.keyType._zod.values;if(Be&&!oe.partial){Re.value=Ie?Ie.alloc(N,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:N});continue}let tt=et.value;if(tt==="__proto__")continue;let ft=oe.valueType._zod.run({value:Le[Qe],issues:[]},De);if(ft instanceof Promise)Ue.push(ft.then((gt)=>{if(gt.issues.length)Re.issues.push(...yr(Qe,gt.issues));Re.value[tt]=gt.value}));else{if(ft.issues.length)Re.issues.push(...yr(Qe,ft.issues));Re.value[tt]=ft.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:N,keys:Ye,continue:!0})}else{Re.value=Ie?Ie.alloc(N,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:N});continue}let tt=Qe.value;if(tt==="__proto__")continue;let ft=oe.valueType._zod.run({value:Le[Ye],issues:[]},De);if(ft instanceof Promise)Ue.push(ft.then((gt)=>{if(gt.issues.length)Re.issues.push(...yr(Ye,gt.issues));Re.value[tt]=gt.value}));else{if(ft.issues.length)Re.issues.push(...yr(Ye,ft.issues));Re.value[tt]=ft.value}}if(Xe&&Xe.length>0)Re.issues.push({code:"unrecognized_keys",input:Le,inst:N,keys:Xe,continue:!0})}if(Ue.length)return Promise.all(Ue).then(()=>Re);return Re}});var nu=ht("$ZodEnum",(N,oe)=>{At.init(N,oe);let Ie=Qr(oe.entries),Re=new Set(Ie);N._zod.values=Re,Tt(N,"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]$")}),N._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:N}),De}}),ou=ht("$ZodLiteral",(N,oe)=>{At.init(N,oe);let Ie=new Set(oe.values);N._zod.values=Ie,Tt(N,"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]$")}),N._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:N}),Re}});var iu=ht("$ZodTransform",(N,oe)=>{At.init(N,oe),N._zod.optin="optional",cr.memoizer?.guard(N),N._zod.parse=(Ie,Re)=>{if(Re.direction==="backward")throw new xn(N.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(N,oe){return N.value=oe.issues.length?void 0:oe.value,N}var Wo=ht("$ZodOptional",(N,oe)=>{At.init(N,oe),Tt(N,"optin",(Ie)=>Ie.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),N._zod.optout="optional",Tt(N,"values",(Ie)=>{let Re=Ie.def.innerType._zod.values;return Re?new Set([...Re,void 0]):void 0}),Tt(N,"pattern",(Ie)=>{let Re=Ie.def.innerType._zod.pattern;return Re?new RegExp(`^(${Mn(Re.source)})?$`):void 0}),N._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",(N,oe)=>{Wo.init(N,oe),Tt(N,"values",(Ie)=>Ie.def.innerType._zod.values),Tt(N,"pattern",(Ie)=>Ie.def.innerType._zod.pattern),N._zod.parse=(Ie,Re)=>oe.innerType._zod.run(Ie,Re)}),cu=ht("$ZodNullable",(N,oe)=>{At.init(N,oe),Tt(N,"optin",(Ie)=>Ie.def.innerType._zod.optin),Tt(N,"optout",(Ie)=>Ie.def.innerType._zod.optout),Tt(N,"pattern",(Ie)=>{let Re=Ie.def.innerType._zod.pattern;return Re?new RegExp(`^(${Mn(Re.source)}|null)$`):void 0}),Tt(N,"values",(Ie)=>Ie.def.innerType._zod.values?new Set([...Ie.def.innerType._zod.values,null]):void 0),N._zod.parse=(Ie,Re)=>{if(Ie.value===null)return Ie;return oe.innerType._zod.run(Ie,Re)}}),au=ht("$ZodDefault",(N,oe)=>{At.init(N,oe),N._zod.optin="defaulted",Tt(N,"values",(Ie)=>Ie.def.innerType._zod.values),N._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(N,oe){if(N.value===void 0)N.value=oe.defaultValue;return N}var uu=ht("$ZodPrefault",(N,oe)=>{At.init(N,oe),N._zod.optin="defaulted",Tt(N,"values",(Ie)=>Ie.def.innerType._zod.values),N._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",(N,oe)=>{At.init(N,oe),Tt(N,"values",(Ie)=>{let Re=Ie.def.innerType._zod.values;return Re?new Set([...Re].filter((De)=>De!==void 0)):void 0}),N._zod.parse=(Ie,Re)=>{let De=oe.innerType._zod.run(Ie,Re);if(De instanceof Promise)return De.then((Le)=>ua(Le,N));return ua(De,N)}});function ua(N,oe){if(!N.issues.length&&N.value===void 0)N.issues.push({code:"invalid_type",expected:"nonoptional",input:N.value,inst:oe});return N}function la(N,oe,Ie,Re){if(!oe.issues.length){if(N.value=oe.value,oe.memo)N.memo=!0;return N}return N.value=Ie.catchValue({...oe,value:N.value,error:{issues:oe.issues.map((De)=>zr(De,Re,pr()))},input:N.value}),N}var fu=ht("$ZodCatch",(N,oe)=>{At.init(N,oe),Tt(N,"optin",(Ie)=>Ie.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Tt(N,"optout",(Ie)=>Ie.def.innerType._zod.optout),Tt(N,"values",(Ie)=>Ie.def.innerType._zod.values),N._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",(N,oe)=>{At.init(N,oe),Tt(N,"values",(Ie)=>Ie.def.in._zod.values),Tt(N,"optin",(Ie)=>Ie.def.in._zod.optin),Tt(N,"optout",(Ie)=>Ie.def.out._zod.optout),Tt(N,"propValues",(Ie)=>Ie.def.in._zod.propValues),N._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(N,oe,Ie){if(N.issues.some((Re)=>Re.code!=="unrecognized_keys"))return N.aborted=!0,N;return oe._zod.run({value:N.value,issues:N.issues},Ie)}var du=ht("$ZodReadonly",(N,oe)=>{At.init(N,oe),Tt(N,"propValues",(Ie)=>Ie.def.innerType._zod.propValues),Tt(N,"values",(Ie)=>Ie.def.innerType._zod.values),Tt(N,"optin",(Ie)=>Ie.def.innerType?._zod?.optin),Tt(N,"optout",(Ie)=>Ie.def.innerType?._zod?.optout),N._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(N){if(!N.memo)N.value=Object.freeze(N.value);return N}var mu=ht("$ZodLazy",(N,oe)=>{At.init(N,oe),Is(N._zod,"innerType",()=>{let Ie=oe;if(!Ie._cachedInner)Ie._cachedInner=oe.getter();return Ie._cachedInner}),Tt(N,"pattern",(Ie)=>Ie.innerType?._zod?.pattern),Tt(N,"propValues",(Ie)=>Ie.innerType?._zod?.propValues),Tt(N,"optin",(Ie)=>Ie.innerType?._zod?.optin??void 0),Tt(N,"optout",(Ie)=>Ie.innerType?._zod?.optout??void 0),N._zod.parse=(Ie,Re)=>N._zod.innerType._zod.run(Ie,Re)}),hu=ht("$ZodCustom",(N,oe)=>{or.init(N,oe),At.init(N,oe),N._zod.parse=(Ie,Re)=>Ie,N._zod.check=(Ie)=>{let Re=Ie.value,De=oe.fn(Re);if(De instanceof Promise)return De.then((Le)=>pa(Le,Ie,Re,N));pa(De,Ie,Re,N);return}});function pa(N,oe,Ie,Re){if(!N){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(N){return N!==null&&typeof N==="object"}function Ko(N){return N.map((oe)=>oe.path?{...oe,path:oe.path.slice()}:{...oe})}var vu=new WeakMap,Sn=0,oo=1,kn=2;function io(N,oe,Ie){let Re=vu.get(N);if(Re!==void 0)return Re?kn:Sn;if(oe.has(N))return kn;oe.add(N);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 tt=Sn;for(let ft of Reflect.ownKeys(Qe)){let gt=Object.getOwnPropertyDescriptor(Qe,ft);if(et&&!gt.enumerable)continue;let bt=gt.get?oo:gt.value?._zod?io(gt.value,oe,Ie):Sn;if(bt>tt)tt=bt}return tt},Be=(Qe)=>{if(Qe>De)De=Qe},Xe=N._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?N._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 tt=et.value;if(!tt||typeof tt!=="object")continue;if(tt._zod)Le(tt);else if(Array.isArray(tt))for(let ft of tt)Le(ft)}}return oe.delete(N),Np(N,De)}function Np(N,oe){if(oe!==oo)vu.set(N,oe===kn);return oe}function Rp(N,oe){let Ie=N.buckets.get(oe);if(!Ie)Ie=new WeakMap,N.buckets.set(oe,Ie);return Ie}var ro,no=[],Dp={alloc(N,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(N){var oe;(oe=N._zod).deferred??(oe.deferred=[]),N._zod.deferred.push(()=>{let Ie=N._zod.parse,Re=(De,Le)=>{if(Le.direction!=="backward"&&Mp(Le,De.value))throw new yu;return Ie(De,Le)};if(N._zod.parse=Re,N._zod.run===Ie)N._zod.run=Re})},attach(N){var oe;let Ie,Re=!1,De,Le;(oe=N._zod).deferred??(oe.deferred=[]),N._zod.deferred.push(()=>{let Ue=N._zod.parse,Be=(Xe,Ye)=>{if(Ie===void 0){let Et=io(N,new Set,!1);if(Et===Sn){if(N._zod.parse=Ue,N._zod.run===Be)N._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 tt;if(De===Ye)tt=Le;else tt=Rp(et,N),De=Ye,Le=tt;let ft=tt.get(Qe);if(ft){if(Xe.value=ft.value,ft.issues){if(ft.issues.length)Xe.issues.push(...Ko(ft.issues))}else Xe.memo=!0,et.backEdges??(et.backEdges=new WeakSet),et.backEdges.add(ft.value);return Xe}ro=tt;let gt=no.length,bt=Ue(Xe,Ye);ro=void 0;let St=no.length>gt?no.pop():void 0;if(bt instanceof Promise)return bt.then((Et)=>{if(St)St.issues=Et.issues.length?Ko(Et.issues):gu;return Et});if(St)St.issues=bt.issues.length?Ko(bt.issues):gu;return bt};if(N._zod.parse=Be,N._zod.run===Ue)N._zod.run=Be})}};function bu(){return Dp}function Mp(N,oe){let Ie=N[Ho]?.backEdges;return Ie!==void 0&&_u(oe)&&Ie.has(oe)}var Lp=()=>{let N={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 N[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(N,...oe){let Ie=oe[0];if(this._map.set(N,Ie),Ie&&typeof Ie==="object"&&"id"in Ie)this._idmap.set(Ie.id,N);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(N){let oe=this._map.get(N);if(oe&&typeof oe==="object"&&"id"in oe)this._idmap.delete(oe.id);return this._map.delete(N),this}get(N){let oe=N._zod.parent;if(oe){let Ie={...this.get(oe)??{}};delete Ie.id;let Re={...Ie,...this._map.get(N)};return Object.keys(Re).length?Re:void 0}return this._map.get(N)}has(N){return this._map.has(N)}}function jp(){return new wu}(xu=globalThis).__zod_globalRegistry??(xu.__zod_globalRegistry=jp());var Ur=globalThis.__zod_globalRegistry;function so(N){if(N.checks)N.checks=[...N.checks];return N}function $u(N,oe){return new N(so({type:"string",...zt(oe)}))}function Ut(N,oe){return new N(so({type:"string",coerce:!0,...zt(oe)}))}function zu(N,oe){return new N({type:"string",format:"email",check:"string_format",abort:!1,...zt(oe)})}function Su(N,oe){return new N({type:"string",format:"guid",check:"string_format",abort:!1,...zt(oe)})}function ku(N,oe){return new N({type:"string",format:"uuid",check:"string_format",abort:!1,...zt(oe)})}function Pu(N,oe){return new N({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...zt(oe)})}function Eu(N,oe){return new N({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...zt(oe)})}function Ou(N,oe){return new N({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...zt(oe)})}function Tu(N,oe){return new N({type:"string",format:"url",check:"string_format",abort:!1,...zt(oe)})}function Zu(N,oe){return new N({type:"string",format:"emoji",check:"string_format",abort:!1,...zt(oe)})}function Au(N,oe){return new N({type:"string",format:"nanoid",check:"string_format",abort:!1,...zt(oe)})}function Iu(N,oe){return new N({type:"string",format:"cuid",check:"string_format",abort:!1,...zt(oe)})}function Cu(N,oe){return new N({type:"string",format:"cuid2",check:"string_format",abort:!1,...zt(oe)})}function Nu(N,oe){return new N({type:"string",format:"ulid",check:"string_format",abort:!1,...zt(oe)})}function Ru(N,oe){return new N({type:"string",format:"xid",check:"string_format",abort:!1,...zt(oe)})}function Du(N,oe){return new N({type:"string",format:"ksuid",check:"string_format",abort:!1,...zt(oe)})}function Mu(N,oe){return new N({type:"string",format:"ipv4",check:"string_format",abort:!1,...zt(oe)})}function Lu(N,oe){return new N({type:"string",format:"ipv6",check:"string_format",abort:!1,...zt(oe)})}function ju(N,oe){return new N({type:"string",format:"cidrv4",check:"string_format",abort:!1,...zt(oe)})}function Fu(N,oe){return new N({type:"string",format:"cidrv6",check:"string_format",abort:!1,...zt(oe)})}function Uu(N,oe){return new N({type:"string",format:"base64",check:"string_format",abort:!1,...zt(oe)})}function Bu(N,oe){return new N({type:"string",format:"base64url",check:"string_format",abort:!1,...zt(oe)})}function Ju(N,oe){return new N({type:"string",format:"e164",check:"string_format",abort:!1,...zt(oe)})}function Vu(N,oe){return new N({type:"string",format:"jwt",check:"string_format",abort:!1,...zt(oe)})}function Wu(N,oe){return new N({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...zt(oe)})}function Ku(N,oe){return new N({type:"string",format:"date",check:"string_format",...zt(oe)})}function Hu(N,oe){return new N({type:"string",format:"time",check:"string_format",precision:null,...zt(oe)})}function qu(N,oe){return new N({type:"string",format:"duration",check:"string_format",...zt(oe)})}function Gu(N,oe){return new N(so({type:"number",checks:[],...zt(oe)}))}function Gt(N,oe){return new N(so({type:"number",coerce:!0,checks:[],...zt(oe)}))}function Xu(N,oe){return new N({type:"number",check:"number_format",abort:!1,format:"safeint",...zt(oe)})}function Yu(N,oe){return new N({type:"boolean",...zt(oe)})}function Vt(N,oe){return new N({type:"boolean",coerce:!0,...zt(oe)})}function Wt(N,oe){return new N({type:"bigint",coerce:!0,...zt(oe)})}function Qu(N,oe){return new N({type:"null",...zt(oe)})}function el(N){return new N({type:"any"})}function tl(N){return new N({type:"unknown"})}function rl(N,oe){return new N({type:"never",...zt(oe)})}function Ht(N,oe){return new N({type:"date",coerce:!0,...zt(oe)})}function Wr(N,oe){return new Mo({check:"less_than",...zt(oe),value:N,inclusive:!1})}function Tr(N,oe){return new Mo({check:"less_than",...zt(oe),value:N,inclusive:!0})}function Kr(N,oe){return new Lo({check:"greater_than",...zt(oe),value:N,inclusive:!1})}function Zr(N,oe){return new Lo({check:"greater_than",...zt(oe),value:N,inclusive:!0})}function Pn(N,oe){return new Lc({check:"multiple_of",...zt(oe),value:N})}function co(N,oe){return new Fc({check:"max_length",...zt(oe),maximum:N})}function Hr(N,oe){return new Uc({check:"min_length",...zt(oe),minimum:N})}function ao(N,oe){return new Bc({check:"length_equals",...zt(oe),length:N})}function Go(N,oe){return new Jc({check:"string_format",format:"regex",...zt(oe),pattern:N})}function Xo(N){return new Vc({check:"string_format",format:"lowercase",...zt(N)})}function Yo(N){return new Wc({check:"string_format",format:"uppercase",...zt(N)})}function Qo(N,oe){return new Kc({check:"string_format",format:"includes",...zt(oe),includes:N})}function ei(N,oe){return new Hc({check:"string_format",format:"starts_with",...zt(oe),prefix:N})}function ti(N,oe){return new qc({check:"string_format",format:"ends_with",...zt(oe),suffix:N})}function ri(N,oe){return new Gc({check:"properties",shape:N,...zt(oe)})}function Rr(N){return new Xc({check:"overwrite",tx:N})}function ni(N){return Rr((oe)=>oe.normalize(N))}function oi(){return Rr((N)=>N.trim())}function ii(){return Rr((N)=>N.toLowerCase())}function si(){return Rr((N)=>N.toUpperCase())}function ci(){return Rr((N)=>Ds(N))}function nl(N,oe,Ie){return new N({type:"array",element:oe,...zt(Ie)})}function ol(N,oe,Ie){let Re=zt(Ie);return Re.abort??(Re.abort=!0),new N({type:"custom",check:"custom",fn:oe,...Re})}function il(N,oe,Ie){return new N({type:"custom",check:"custom",fn:oe,...zt(Ie)})}function sl(N,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))}},N(Re.value,Re)),oe);return Ie}function Fp(N,oe){let Ie=new or({check:"custom",...zt(oe)});return Ie._zod.check=N,Ie}function En(N,...oe){for(let Ie of oe)for(let Re of Reflect.ownKeys(Ie))if(Object.prototype.propertyIsEnumerable.call(Ie,Re))lr(N,Re,Ie[Re]);return N}function Tn(N){let oe=N?.target??"draft-2020-12";if(oe==="draft-4")oe="draft-04";if(oe==="draft-7")oe="draft-07";return{processors:N.processors??{},metadataRegistry:N?.metadata??Ur,target:oe,unrepresentable:N?.unrepresentable??"throw",override:N?.override??(()=>{}),io:N?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:N?.cycles??"ref",reused:N?.reused??"inline",intersections:[],deferred:[],external:N?.external??void 0}}function ir(N,oe,Ie,Re,De){let Le=typeof oe.unrepresentable==="function"?oe.unrepresentable({zodSchema:N,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 Dt(N,oe,Ie={path:[],schemaPath:[]}){var Re;let De=N._zod.def,Le=oe.seen.get(N);if(Le){if(Le.count++,Ie.schemaPath.includes(N))Le.cycle=Ie.path;return Le.schema}let Ue={schema:{},count:1,cycle:void 0,path:Ie.path};oe.seen.set(N,Ue),oe.sharedDefsExtractedFor=void 0,oe.sharedEmitDoneFor=void 0;let Be=N._zod.toJSONSchema?.();if(Be)Ue.schema=Be;else{let Qe={...Ie,schemaPath:[...Ie.schemaPath,N],path:Ie.path};if(N._zod.processJSONSchema)N._zod.processJSONSchema(oe,Ue.schema,Qe);else{let tt=Ue.schema,ft=oe.processors[De.type];if(!ft)throw Error(`[toJSONSchema]: Non-representable type encountered: ${De.type}`);ft(N,oe,tt,Qe)}let et=N._zod.parent;if(et){if(!Ue.ref)Ue.ref=et;Dt(et,oe,Qe),oe.seen.get(et).isParent=!0}}let Xe=oe.metadataRegistry.get(N);if(Xe)En(Ue.schema,Xe);if(oe.io==="input"&&ar(N))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(N).schema}function cl(N){return N.replace(/~/g,"~0").replace(/\//g,"~1")}function Zn(N,oe){let Ie=N.seen.get(oe);if(!Ie)throw Error("Unprocessed schema. This is a bug in Zod.");if(N.external&&N.sharedDefsExtractedFor===N.external)return;let Re=new Map;for(let Ue of N.seen.entries()){let Be=N.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=N.target==="draft-2020-12"?"$defs":"definitions";if(N.external){let et=N.external.registry.get(Ue[0])?.id,tt=N.external.uri??((gt)=>gt);if(et)return{ref:tt(et)};let ft=Ue[1].defId??Ue[1].schema.id??`schema${N.counter++}`;return Ue[1].defId=ft,{defId:ft,ref:`${tt("__shared")}#/${Be}/${cl(ft)}`}}let Xe="#",Ye=`${Xe}/${Be}/`;if(Ue[1]===Ie&&!Ue[1].schema.id)return{ref:Xe};let Qe=Ue[1].schema.id??`__schema${N.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(N.cycles==="throw")for(let Ue of N.seen.entries()){let Be=Ue[1];if(Be.cycle)throw Error(`Cycle detected: #/${Be.cycle?.join("/")}/<root>
58
58
 
59
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Ue of N.seen.entries()){let Be=Ue[1];if(oe===Ue[0]){Le(Ue);continue}if(N.external){let Ye=N.external.registry.get(Ue[0])?.id;if(oe!==Ue[0]&&Ye){Le(Ue);continue}}if(N.metadataRegistry.get(Ue[0])?.id){Le(Ue);continue}if(Be.cycle){Le(Ue);continue}if(Be.count>1){if(N.reused==="ref")Le(Ue)}}if(N.external)N.sharedDefsExtractedFor=N.external}function ll(N){let oe=N.anyOf;if(!Array.isArray(oe)||oe.length===0||N.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 N.anyOf,N.type=Ie.length===1?Ie[0]:Ie}var fl=new Set(["type","properties","required","additionalProperties"]),al=["oneOf","anyOf"];function ul(N){let oe=N.additionalProperties;if(oe===void 0||oe===!1||typeof oe!=="object"||oe===null)return null;return Object.keys(oe).length?oe:null}function ai(N){let oe=[];for(let Le of N){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(N){let oe=N.allOf;if(!Array.isArray(oe)||oe.length<2)return;for(let De of fl)if(De in N)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 N.allOf,En(N,Re)}function An(N,oe){let Ie=N.seen.get(oe);if(!Ie)throw Error("Unprocessed schema. This is a bug in Zod.");let Re=(Be)=>{let Xe=N.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 ft=N.seen.get(et),gt=ft.schema;if(gt.$ref&&(N.target==="draft-07"||N.target==="draft-04"||N.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 St in Ye){if(St==="$ref"||St==="allOf")continue;if(!(St in Qe))delete Ye[St]}if(gt.$ref&&ft.def)for(let St in Ye){if(St==="$ref"||St==="allOf")continue;if(St in ft.def&&JSON.stringify(Ye[St])===JSON.stringify(ft.def[St]))delete Ye[St]}}let tt=Be._zod.parent;if(tt&&tt!==et){Re(tt);let ft=N.seen.get(tt);if(ft?.schema.$ref){if(Ye.$ref=ft.schema.$ref,ft.def)for(let gt in Ye){if(gt==="$ref"||gt==="allOf")continue;if(gt in ft.def&&JSON.stringify(Ye[gt])===JSON.stringify(ft.def[gt]))delete Ye[gt]}}}N.override({zodSchema:Be,jsonSchema:Ye,path:Xe.path??[]})};if(!N.external||N.sharedEmitDoneFor!==N.external){for(let Be of[...N.seen.entries()].reverse())Re(Be[0]);if(N.target!=="openapi-3.0")for(let Be of N.seen.entries())ll(Be[1].def??Be[1].schema);for(let Be of N.deferred)Be();if(N.intersections.length){let Be=new Map;for(let Xe of N.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 N.intersections)for(let Ye of Be.get(Xe)??[])Up(Ye)}}let De={};if(N.target==="draft-2020-12")De.$schema="https://json-schema.org/draft/2020-12/schema";else if(N.target==="draft-07")De.$schema="http://json-schema.org/draft-07/schema#";else if(N.target==="draft-04")De.$schema="http://json-schema.org/draft-04/schema#";else if(N.target==="openapi-3.0");if(N.external?.uri){let Be=N.external.registry.get(oe)?.id;if(!Be)throw Error("Schema is missing an `id` property");De.$id=N.external.uri(Be)}En(De,Ie.defId?Ie.schema:Ie.def??Ie.schema);let Le=N.metadataRegistry.get(oe)?.id;if(Le!==void 0&&De.id===Le)delete De.id;let Ue=N.external?.defs??{};if(!N.external||N.sharedEmitDoneFor!==N.external)for(let Be of N.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(N.external)N.sharedEmitDoneFor=N.external;if(N.external);else if(Object.keys(Ue).length>0)if(N.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",N.processors),output:On(oe,"output",N.processors)}},enumerable:!1,writable:!1}),Be}catch(Be){throw Error("Error converting schema to JSON.")}}function ar(N,oe){let Ie=oe??{seen:new Set};if(Ie.seen.has(N))return!1;Ie.seen.add(N);let Re=N._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(N._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=(N,oe={})=>(Ie)=>{let Re=Tn({...Ie,processors:oe});return Dt(N,Re),Zn(Re,N),An(Re,N)},On=(N,oe,Ie={})=>(Re)=>{let{libraryOptions:De,target:Le}=Re??{},Ue=Tn({...De??{},target:Le,io:oe,processors:Ie});return Dt(N,Ue),Zn(Ue,N),An(Ue,N)};var qr=(N,oe,Ie)=>{if(N[oe]===void 0||Ie>N[oe])N[oe]=Ie},Gr=(N,oe,Ie)=>{if(N[oe]===void 0||Ie<N[oe])N[oe]=Ie},dl=(N,oe)=>{qr(N,"minimum",oe),Gr(N,"maximum",oe)},_l=(N,oe)=>{if(N.multipleOf??(N.multipleOf=[]),!N.multipleOf.includes(oe))N.multipleOf.push(oe)},vl=(N,oe)=>{N.patterns??(N.patterns=new Set),N.patterns.add(oe)},bl=(N,oe)=>{N.mime=N.mime?N.mime.filter((Ie)=>oe.includes(Ie)):[...oe]},xl=(N,oe)=>{if(N.format=oe,oe.includes("int"))N.isInt=!0},ml=(N,oe)=>qr(N,"minimum",oe.minimum),hl=(N,oe)=>Gr(N,"maximum",oe.maximum),gl=(N)=>(oe,Ie)=>{xl(oe,Ie.format);let[Re,De]=N[Ie.format];qr(oe,"minimum",Re),Gr(oe,"maximum",De)},Bp={greater_than:(N,oe)=>qr(N,oe.inclusive?"minimum":"exclusiveMinimum",oe.value),less_than:(N,oe)=>Gr(N,oe.inclusive?"maximum":"exclusiveMaximum",oe.value),multiple_of:(N,oe)=>_l(N,oe.value),number_format:gl(Ln),bigint_format:gl(Po),min_length:ml,max_length:hl,length_equals:(N,oe)=>dl(N,oe.length),min_size:ml,max_size:hl,size_equals:(N,oe)=>dl(N,oe.size),string_format:(N,oe)=>{if(xl(N,oe.format),oe.pattern)vl(N,oe.pattern);if(oe.format==="base64"||oe.format==="base64url")N.contentEncoding=oe.format;if(oe.local||oe.precision===-1)N.laxFormat=!0},mime_type:(N,oe)=>bl(N,oe.mime)};function nr(N){let oe={},Ie=N._zod.def,Re=N._zod.traits.has("$ZodCheck")?[N,...Ie.checks??[]]:Ie.checks??[];for(let Le of Re)Bp[Le._zod.def.check]?.(oe,Le._zod.def);let De=N._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=(N)=>Vp.get(N)??N,fi=(N,oe,Ie,Re)=>{let De=Ie;De.type="string";let{minimum:Le,maximum:Ue,format:Be,patterns:Xe,contentEncoding:Ye,laxFormat:Qe}=nr(N);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((tt)=>({...oe.target==="draft-07"||oe.target==="draft-04"||oe.target==="openapi-3.0"?{type:"string"}:{},pattern:tt.source}))]}},pi=(N,oe,Ie,Re)=>{let De=Ie,{minimum:Le,maximum:Ue,multipleOf:Be,exclusiveMaximum:Xe,exclusiveMinimum:Ye,isInt:Qe}=nr(N);De.type=Qe?"integer":"number";let et=typeof Ye==="number"&&Ye>=(Le??Number.NEGATIVE_INFINITY),tt=typeof Xe==="number"&&Xe<=(Ue??Number.POSITIVE_INFINITY),ft=oe.target==="draft-04"||oe.target==="openapi-3.0";if(et)if(ft)De.minimum=Ye,De.exclusiveMinimum=!0;else De.exclusiveMinimum=Ye;else if(typeof Le==="number")De.minimum=Le;if(tt)if(ft)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(N,oe,De,Re,`A multipleOf divisor of ${Et} cannot be represented in JSON Schema`);let[bt,...St]=gt;if(bt!==void 0)De.multipleOf=bt;if(St.length)De.allOf=[...De.allOf??[],...St.map((Et)=>({multipleOf:Et}))]}},di=(N,oe,Ie,Re)=>{Ie.type="boolean"},mi=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"BigInt cannot be represented in JSON Schema")},$l=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Symbols cannot be represented in JSON Schema")},hi=(N,oe,Ie,Re)=>{if(oe.target==="openapi-3.0")Ie.type="string",Ie.nullable=!0,Ie.enum=[null];else Ie.type="null"},zl=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Undefined cannot be represented in JSON Schema")},Sl=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Void cannot be represented in JSON Schema")},gi=(N,oe,Ie,Re)=>{Ie.not={}},yi=(N,oe,Ie,Re)=>{},_i=(N,oe,Ie,Re)=>{},vi=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Date cannot be represented in JSON Schema")},bi=(N,oe,Ie,Re)=>{let De=N._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=(N,oe,Ie,Re)=>{let De=N._zod.def;if(De.values.length===0){Ie.not={};return}let Le=[];for(let Ue of De.values)if(Ue===void 0){if(ir(N,oe,Ie,Re,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof Ue==="bigint"){if(ir(N,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=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"NaN cannot be represented in JSON Schema")},Pl=(N,oe,Ie,Re)=>{let De=Ie,Le=N._zod.pattern;if(!Le)throw Error("Pattern not found in template literal");De.type="string",De.pattern=Le.source},El=(N,oe,Ie,Re)=>{let De=Ie;De.type="string",De.format="binary",De.contentEncoding="binary";let{minimum:Le,maximum:Ue,mime:Be}=nr(N);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=(N,oe,Ie,Re)=>{Ie.type="boolean"},wi=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Custom types cannot be represented in JSON Schema")},Tl=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Function types cannot be represented in JSON Schema")},$i=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Transforms cannot be represented in JSON Schema")},Zl=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Map cannot be represented in JSON Schema")},Al=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Set cannot be represented in JSON Schema")},zi=(N,oe,Ie,Re)=>{let De=Ie,Le=N._zod.def,{minimum:Ue,maximum:Be}=nr(N);if(typeof Ue==="number")De.minItems=Ue;if(typeof Be==="number")De.maxItems=Be;De.type="array",De.items=Dt(Le.element,oe,{...Re,path:[...Re.path,"items"]})};function In(N){let oe=N._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 N._zod.optin}var Si=(N,oe,Ie,Re)=>{let De=Ie,Le=N._zod.def,Ue=Le.shape;if(Object.getOwnPropertySymbols(Ue).length&&ir(N,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,Dt(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=Dt(Le.catchall,oe,{...Re,path:[...Re.path,"additionalProperties"]})},ki=(N,oe,Ie,Re)=>{let De=N._zod.def,Le=De.inclusive===!1,Ue=De.options.map((Be,Xe)=>Dt(Be,oe,{...Re,path:[...Re.path,Le?"oneOf":"anyOf",Xe]}));if(Le)Ie.oneOf=Ue;else Ie.anyOf=Ue},Pi=(N,oe,Ie,Re)=>{let De=N._zod.def,Le=Dt(De.left,oe,{...Re,path:[...Re.path,"allOf",0]}),Ue=Dt(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=(N,oe,Ie,Re)=>{let De=Ie,Le=N._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((bt,St)=>Dt(bt,oe,{...Re,path:[...Re.path,Ue,St]})),Ye=Le.rest?Dt(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 bt=Le.items[Qe-1];if(!(oe.io==="input"?In(bt)!==void 0:bt._zod.optout==="optional"))break;Qe--}let et=Le.items.length,tt=!Le.rest;if(oe.target==="draft-2020-12"){if(De.prefixItems=Xe,tt)De.items=!1;else if(Ye)De.items=Ye;if(Qe>0)De.minItems=Qe;if(tt)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(tt)De.maxItems=et}else{if(De.items=Xe,tt)De.additionalItems=!1;else if(Ye)De.additionalItems=Ye;if(Qe>0)De.minItems=Qe;if(tt)De.maxItems=et}let{minimum:ft,maximum:gt}=nr(N);if(typeof ft==="number")De.minItems=ft;if(typeof gt==="number")De.maxItems=gt};function ui(N,oe,Ie){if(oe.$ref){if(Ie.has(oe))return oe;Ie.add(oe);let gt=N.get(oe)?.def;if(!gt)return oe;let bt=ui(N,gt,Ie);return bt===gt?oe:bt}for(let gt of["anyOf","oneOf"]){let bt=oe[gt];if(!Array.isArray(bt))continue;let St=bt.map((Et)=>ui(N,Et,Ie));if(St.some((Et,rr)=>Et!==bt[rr]))oe={...oe,[gt]:St}}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:tt,...ft}=oe;if(ft.enum)ft.enum=ft.enum.map((gt)=>typeof gt==="number"?String(gt):gt);else if(typeof ft.const==="number")ft.const=String(ft.const);if(!De)return ft;if(ft.type="string",!Le)ft.pattern=(Re.includes("number")?wn:Ro).source;return ft}var li=new WeakMap;function Wp(N){let oe=new Map;for(let Re of N.seen.values())if(Re.def&&!oe.has(Re.schema))oe.set(Re.schema,Re);let Ie=new Map;for(let Re of li.get(N)??[]){let De=N.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 N.seen.values())for(let De of[Re.schema,Re.def]){let Le=De&&Ie.get(De.propertyNames);if(Le)De.propertyNames=Le}}var Oi=(N,oe,Ie,Re)=>{let De=Ie,Le=N._zod.def;De.type="object";let Ue=Le.keyType,Be=nr(Ue).patterns;if(Le.mode==="loose"&&Be&&Be.size>0){let Qe=Dt(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=Dt(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(N)}De.additionalProperties=Dt(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=(N,oe,Ie,Re)=>{let De=N._zod.def,Le=Dt(De.innerType,oe,Re),Ue=oe.seen.get(N);if(oe.target==="openapi-3.0")Ue.ref=De.innerType,Ie.nullable=!0;else Ie.anyOf=[Le,{type:"null"}]},Zi=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType},Ai=Symbol();function Il(N,oe,Ie,Re,De){let Le=!1,Ue=JSON.stringify(N,(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=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType;let Ue=Il(De.defaultValue,N,oe,Ie,Re);if(Ue!==Ai)Ie.default=Ue},Ci=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);if(Le.ref=De.innerType,oe.io!=="input")return;let Ue=Il(De.defaultValue,N,oe,Ie,Re);if(Ue!==Ai)Ie._prefault=Ue},Ni=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType;let Ue;try{Ue=De.catchValue(void 0)}catch{ir(N,oe,Ie,Re,"Dynamic catch values are not supported in JSON Schema");return}Ie.default=Ue},Ri=(N,oe,Ie,Re)=>{let De=N._zod.def,Le=De.in._zod.traits.has("$ZodTransform"),Ue=oe.io==="input"?Le?De.out:De.in:De.out;Dt(Ue,oe,Re);let Be=oe.seen.get(N);Be.ref=Ue},Di=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType,Ie.readOnly=!0},Cl=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType},uo=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType},Mi=(N,oe,Ie,Re)=>{let De=N._zod.innerType;Dt(De,oe,Re);let Le=oe.seen.get(N);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 rt(N,oe){if("_idmap"in N){let Re=N,De=Tn({...oe,processors:yl}),Le={};for(let Xe of Re._idmap.entries()){let[Ye,Qe]=Xe;Dt(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 Dt(N,Ie),Zn(Ie,N),An(Ie,N)}var Nl=new WeakSet([Object.prototype,Error.prototype]);function lo(N,oe,Ie){Object.defineProperty(N,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=(N,oe)=>{Xs.init(N,oe),N.name="ZodError";let Ie=Object.getPrototypeOf(N);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 It=ht("ZodType",(N,oe)=>(td(),At.init(N,oe),N.def=oe,N.type=oe.type,N),{check(...N){let oe=this.def;return this.clone(fr(oe,{checks:[...oe.checks??[],...N.map((Ie)=>typeof Ie==="function"?{_zod:{check:Ie,def:{check:"custom"},onattach:[]}}:Ie)]}),{parent:!0})},with(...N){return this.check(...N)},clone(N,oe){return $r(this,N,oe)},brand(){return this},register(N,oe){return N.add(this,oe),this},refine(N,oe){return this.check(qd(N,oe))},superRefine(N,oe){return this.check(Gd(N,oe))},overwrite(N){return this.check(Rr(N))},optional(){return Hl(this)},exactOptional(){return Rd(this)},nullable(){return ql(this)},nullish(){return Hl(ql(this))},nonoptional(N){return Ud(this,N)},array(){return o(this)},or(N){return l([this,N])},and(N){return ot(this,N)},transform(N){return Gl(this,Nd(N))},default(N){return Ld(this,N)},prefault(N){return Fd(this,N)},catch(N){return Jd(this,N)},pipe(N){return Gl(this,N)},readonly(){return Kd(this)},describe(N){let oe=this.clone();return Ur.add(oe,{description:N}),oe},meta(...N){if(N.length===0)return Ur.get(this);let oe=this.clone();return Ur.add(oe,N[0]),oe},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(N,...oe){return oe.length===0?N(this):N(this,...oe)},get "~standard"(){return vn(this,"~standard",{...Uo(this),jsonSchema:{input:On(this,"input"),output:On(this,"output")}})},set "~standard"(N){Or(this,"~standard",N)},parse:function N(oe,Ie){return Rl(this,oe,Ie,{callee:N})},parseAsync:async function N(oe,Ie){return await Dl(this,oe,Ie,{callee:N})},safeParse(N,oe){return Ml(this,N,oe)},async safeParseAsync(N,oe){return Ve(this,N,oe)},get spa(){return this?.safeParseAsync},set spa(N){Or(this,"spa",N)},validate(N,oe){return Ao(this,N,oe)},validateAsync(N,oe){return Io(this,N,oe)},encode:function N(oe,Ie){return Ll(this,oe,Ie,{callee:N})},decode:function N(oe,Ie){return jl(this,oe,Ie,{callee:N})},encodeAsync:async function N(oe,Ie){return await Fl(this,oe,Ie,{callee:N})},decodeAsync:async function N(oe,Ie){return await Ul(this,oe,Ie,{callee:N})},safeEncode(N,oe){return Bl(this,N,oe)},safeDecode(N,oe){return Jl(this,N,oe)},async safeEncodeAsync(N,oe){return Vl(this,N,oe)},async safeDecodeAsync(N,oe){return Wl(this,N,oe)},toJSONSchema(N){return pl(this,{})(N)},get description(){return Ur.get(this)?.description},get _def(){return this._zod.def}}),Xl=ht("_ZodString",(N,oe)=>{eo.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>fi(N,Ie,Re,De)},Jn({format:(N)=>nr(N).format??null,minLength:(N)=>nr(N).minimum??null,maxLength:(N)=>nr(N).maximum??null},{regex(...N){return this.check(Go(...N))},includes(...N){return this.check(Qo(...N))},startsWith(...N){return this.check(ei(...N))},endsWith(...N){return this.check(ti(...N))},min(...N){return this.check(Hr(...N))},max(...N){return this.check(co(...N))},length(...N){return this.check(ao(...N))},nonempty(...N){return this.check(Hr(1,...N))},lowercase(N){return this.check(Xo(N))},uppercase(N){return this.check(Yo(N))},trim(){return this.check(oi())},normalize(...N){return this.check(ni(...N))},toLowerCase(){return this.check(ii())},toUpperCase(){return this.check(si())},slugify(){return this.check(ci())}})),Pt=ht("ZodString",(N,oe)=>{eo.init(N,oe),Xl.init(N,oe)},{email(N){return this.check(zu(sd,N))},url(N){return this.check(Tu(ad,N))},jwt(N){return this.check(Vu($d,N))},emoji(N){return this.check(Zu(ud,N))},guid(N){return this.check(Su(cd,N))},uuid(N){return this.check(ku(fo,N))},uuidv4(N){return this.check(Pu(fo,N))},uuidv6(N){return this.check(Eu(fo,N))},uuidv7(N){return this.check(Ou(fo,N))},nanoid(N){return this.check(Au(ld,N))},cuid(N){return this.check(Iu(fd,N))},cuid2(N){return this.check(Cu(pd,N))},ulid(N){return this.check(Nu(dd,N))},base64(N){return this.check(Uu(bd,N))},base64url(N){return this.check(Bu(xd,N))},xid(N){return this.check(Ru(md,N))},ksuid(N){return this.check(Du(hd,N))},ipv4(N){return this.check(Mu(gd,N))},ipv6(N){return this.check(Lu(yd,N))},cidrv4(N){return this.check(ju(_d,N))},cidrv6(N){return this.check(Fu(vd,N))},e164(N){return this.check(Ju(wd,N))},datetime(N){return this.check(Wu(rd,N))},date(N){return this.check(Ku(nd,N))},time(N){return this.check(Hu(od,N))},duration(N){return this.check(qu(id,N))}});function e(N){return $u(Pt,N)}var Ft=ht("ZodStringFormat",(N,oe)=>{Mt.init(N,oe),Xl.init(N,oe)}),rd=ht("ZodISODateTime",(N,oe)=>{Pa.init(N,oe),Ft.init(N,oe)}),nd=ht("ZodISODate",(N,oe)=>{Ea.init(N,oe),Ft.init(N,oe)}),od=ht("ZodISOTime",(N,oe)=>{Oa.init(N,oe),Ft.init(N,oe)}),id=ht("ZodISODuration",(N,oe)=>{Ta.init(N,oe),Ft.init(N,oe)}),sd=ht("ZodEmail",(N,oe)=>{ga.init(N,oe),Ft.init(N,oe)});var cd=ht("ZodGUID",(N,oe)=>{ma.init(N,oe),Ft.init(N,oe)});var fo=ht("ZodUUID",(N,oe)=>{ha.init(N,oe),Ft.init(N,oe)});var ad=ht("ZodURL",(N,oe)=>{va.init(N,oe),Ft.init(N,oe)});var ud=ht("ZodEmoji",(N,oe)=>{ba.init(N,oe),Ft.init(N,oe)});var ld=ht("ZodNanoID",(N,oe)=>{xa.init(N,oe),Ft.init(N,oe)});var fd=ht("ZodCUID",(N,oe)=>{wa.init(N,oe),Ft.init(N,oe)});var pd=ht("ZodCUID2",(N,oe)=>{$a.init(N,oe),Ft.init(N,oe)});var dd=ht("ZodULID",(N,oe)=>{za.init(N,oe),Ft.init(N,oe)});var md=ht("ZodXID",(N,oe)=>{Sa.init(N,oe),Ft.init(N,oe)});var hd=ht("ZodKSUID",(N,oe)=>{ka.init(N,oe),Ft.init(N,oe)});var gd=ht("ZodIPv4",(N,oe)=>{Za.init(N,oe),Ft.init(N,oe)});var yd=ht("ZodIPv6",(N,oe)=>{Ia.init(N,oe),Ft.init(N,oe)});var _d=ht("ZodCIDRv4",(N,oe)=>{Ca.init(N,oe),Ft.init(N,oe)});var vd=ht("ZodCIDRv6",(N,oe)=>{Na.init(N,oe),Ft.init(N,oe)});var bd=ht("ZodBase64",(N,oe)=>{Da.init(N,oe),Ft.init(N,oe)});var xd=ht("ZodBase64URL",(N,oe)=>{Ma.init(N,oe),Ft.init(N,oe)});var wd=ht("ZodE164",(N,oe)=>{La.init(N,oe),Ft.init(N,oe)});var $d=ht("ZodJWT",(N,oe)=>{ja.init(N,oe),Ft.init(N,oe)});var wt=ht("ZodNumber",(N,oe)=>{Jo.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>pi(N,Ie,Re,De),N.isFinite=!0},Jn({minValue:(N)=>{let{minimum:oe,exclusiveMinimum:Ie}=nr(N);return Math.max(oe??Number.NEGATIVE_INFINITY,Ie??Number.NEGATIVE_INFINITY)},maxValue:(N)=>{let{maximum:oe,exclusiveMaximum:Ie}=nr(N);return Math.min(oe??Number.POSITIVE_INFINITY,Ie??Number.POSITIVE_INFINITY)},isInt:(N)=>{let{isInt:oe,multipleOf:Ie}=nr(N);return!!oe||!!Ie?.some(Number.isSafeInteger)},format:(N)=>nr(N).format??null},{gt(N,oe){return this.check(Kr(N,oe))},gte(N,oe){return this.check(Zr(N,oe))},min(N,oe){return this.check(Zr(N,oe))},lt(N,oe){return this.check(Wr(N,oe))},lte(N,oe){return this.check(Tr(N,oe))},max(N,oe){return this.check(Tr(N,oe))},int(N){return this.check(Kl(N))},safe(N){return this.check(Kl(N))},positive(N){return this.check(Kr(0,N))},nonnegative(N){return this.check(Zr(0,N))},negative(N){return this.check(Wr(0,N))},nonpositive(N){return this.check(Tr(0,N))},multipleOf(N,oe){return this.check(Pn(N,oe))},step(N,oe){return this.check(Pn(N,oe))},finite(){return this}}));function r(N){return Gu(wt,N)}var zd=ht("ZodNumberFormat",(N,oe)=>{Fa.init(N,oe),wt.init(N,oe)});function Kl(N){return Xu(zd,N)}var Rt=ht("ZodBoolean",(N,oe)=>{Ua.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>di(N,Ie,Re,De)});function c(N){return Yu(Rt,N)}var Zt=ht("ZodBigInt",(N,oe)=>{Ba.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>mi(N,Ie,Re,De)},Jn({minValue:(N)=>nr(N).minimum??null,maxValue:(N)=>nr(N).maximum??null,format:(N)=>nr(N).format??null},{gte(N,oe){return this.check(Zr(N,oe))},min(N,oe){return this.check(Zr(N,oe))},gt(N,oe){return this.check(Kr(N,oe))},lt(N,oe){return this.check(Wr(N,oe))},lte(N,oe){return this.check(Tr(N,oe))},max(N,oe){return this.check(Tr(N,oe))},positive(N){return this.check(Kr(BigInt(0),N))},negative(N){return this.check(Wr(BigInt(0),N))},nonpositive(N){return this.check(Tr(BigInt(0),N))},nonnegative(N){return this.check(Zr(BigInt(0),N))},multipleOf(N,oe){return this.check(Pn(N,oe))}}));var Sd=ht("ZodNull",(N,oe)=>{Ja.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>hi(N,Ie,Re,De)});function We(N){return Qu(Sd,N)}var kd=ht("ZodAny",(N,oe)=>{Va.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>yi(N,Ie,Re,De)});function ie(){return el(kd)}var Pd=ht("ZodUnknown",(N,oe)=>{Wa.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>_i(N,Ie,Re,De)});function v(){return tl(Pd)}var Ed=ht("ZodNever",(N,oe)=>{Ka.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>gi(N,Ie,Re,De)});function Ae(N){return rl(Ed,N)}var Jt=ht("ZodDate",(N,oe)=>{Ha.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>vi(N,Ie,Re,De),N.min=(Ie,Re)=>N.check(Zr(Ie,Re)),N.max=(Ie,Re)=>N.check(Tr(Ie,Re))},Jn({minDate:(N)=>{let{minimum:oe}=nr(N);return oe?new Date(oe):null},maxDate:(N)=>{let{maximum:oe}=nr(N);return oe?new Date(oe):null}},{}));var Od=ht("ZodArray",(N,oe)=>{Cn(),qa.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>zi(N,Ie,Re,De),N.element=oe.element},{min(N,oe){return this.check(Hr(N,oe))},nonempty(N){return this.check(Hr(1,N))},max(N,oe){return this.check(co(N,oe))},length(N,oe){return this.check(ao(N,oe))},unwrap(){return this.element}});function o(N,oe){return nl(Od,N,oe)}var Ui=ht("ZodObject",(N,oe)=>{Cn(),Ya.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Si(N,Ie,Re,De),ap(N,"shape",(Ie)=>Ie._zod.def.shape,!1)},{keyof(){return i(Object.keys(this._zod.def.shape))},catchall(N){return this.clone(fr(this._zod.def,{catchall:N}))},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(N){return ep(this,N)},safeExtend(N){return tp(this,N)},merge(N){return rp(this,N)},pick(N){return Yf(this,N)},omit(N){return Qf(this,N)},partial(...N){return Us(Bi,this,N[0])},exactPartial(...N){return Us(Ql,this,N[0],"exactPartial")},required(...N){return np(ef,this,N[0])}});function t(N,oe){let Ie={type:"object",shape:N??{},...zt(oe)};return new Ui(Ie)}function se(N,oe){return new Ui({type:"object",shape:N,catchall:Ae(),...zt(oe)})}function U(N,oe){return new Ui({type:"object",shape:N,catchall:v(),...zt(oe)})}var Yl=ht("ZodUnion",(N,oe)=>{Vo.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>ki(N,Ie,Re,De),N.options=oe.options});function l(N,oe){return new Yl({type:"union",options:N,...zt(oe)})}var Td=ht("ZodDiscriminatedUnion",(N,oe)=>{Yl.init(N,oe),Qa.init(N,oe)});function f(N,oe,Ie){return new Td({type:"union",options:oe,discriminator:N,...zt(Ie)})}var Zd=ht("ZodIntersection",(N,oe)=>{eu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Pi(N,Ie,Re,De)});function ot(N,oe){return new Zd({type:"intersection",left:N,right:oe})}var Ad=ht("ZodTuple",(N,oe)=>{Cn(),tu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ei(N,Ie,Re,De)},{rest(N){return this.clone({...this._zod.def,rest:N})},partial(){let N=this._zod.def;if(N.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...N,items:N.items.map((oe)=>new Bi({type:"optional",innerType:oe}))})}});function ce(N,oe,Ie){let Re=oe instanceof At,De=Re?Ie:oe;return new Ad({type:"tuple",items:N,rest:Re?oe:null,...zt(De)})}var ji=ht("ZodRecord",(N,oe)=>{Cn(),ru.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Oi(N,Ie,Re,De),N.keyType=oe.keyType,N.valueType=oe.valueType});function y(N,oe,Ie){if(!oe||!oe._zod)return new ji({type:"record",keyType:e(),valueType:N,...zt(oe)});return new ji({type:"record",keyType:N,valueType:oe,...zt(Ie)})}function bn(N,oe,Ie){return new ji({type:"record",keyType:N,valueType:oe,...zt(Ie),partial:!0})}var Fi=ht("ZodEnum",(N,oe)=>{nu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Re,De,Le)=>bi(N,Re,De,Le),N.enum=oe.entries,N.options=[...N._zod.values];let Ie=new Set(Object.keys(oe.entries));N.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:[],...zt(De),entries:Le})},N.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:[],...zt(De),entries:Le})}});function i(N,oe){let Ie=Array.isArray(N)?Object.fromEntries(N.map((Re)=>[Re,Re])):N;return new Fi({type:"enum",entries:Ie,...zt(oe)})}var Id=ht("ZodLiteral",(N,oe)=>{ou.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>xi(N,Ie,Re,De),N.values=new Set(oe.values),Object.defineProperty(N,"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(N,oe){return new Id({type:"literal",values:Array.isArray(N)?N:[N],...zt(oe)})}var Cd=ht("ZodTransform",(N,oe)=>{Cn(),iu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>$i(N,Ie,Re,De),N._zod.parse=(Ie,Re)=>{if(Re.direction==="backward")throw new xn(N.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=N),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(N){return new Cd({type:"transform",transform:N})}var Bi=ht("ZodOptional",(N,oe)=>{Wo.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>uo(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Hl(N){return new Bi({type:"optional",innerType:N})}var Ql=ht("ZodExactOptional",(N,oe)=>{su.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>uo(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Rd(N){return new Ql({type:"optional",innerType:N})}var Dd=ht("ZodNullable",(N,oe)=>{cu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ti(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function ql(N){return new Dd({type:"nullable",innerType:N})}var Md=ht("ZodDefault",(N,oe)=>{au.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ii(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType,N.removeDefault=N.unwrap});function Ld(N,oe){return new Md({type:"default",innerType:N,get defaultValue(){return typeof oe==="function"?oe():So(oe)}})}var jd=ht("ZodPrefault",(N,oe)=>{uu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ci(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Fd(N,oe){return new jd({type:"prefault",innerType:N,get defaultValue(){return typeof oe==="function"?oe():So(oe)}})}var ef=ht("ZodNonOptional",(N,oe)=>{lu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Zi(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Ud(N,oe){return new ef({type:"nonoptional",innerType:N,...zt(oe)})}var Bd=ht("ZodCatch",(N,oe)=>{fu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ni(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType,N.removeCatch=N.unwrap});function Jd(N,oe){return new Bd({type:"catch",innerType:N,catchValue:typeof oe==="function"?oe:Ws(oe)})}var Vd=ht("ZodPipe",(N,oe)=>{pu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ri(N,Ie,Re,De),N.in=oe.in,N.out=oe.out});function Gl(N,oe){return new Vd({type:"pipe",in:N,out:oe})}var Wd=ht("ZodReadonly",(N,oe)=>{du.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Di(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Kd(N){return new Wd({type:"readonly",innerType:N})}var Hd=ht("ZodLazy",(N,oe)=>{mu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Mi(N,Ie,Re,De),N.unwrap=()=>N._zod.def.getter()});function $e(N){return new Hd({type:"lazy",getter:N})}var Ji=ht("ZodCustom",(N,oe)=>{hu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>wi(N,Ie,Re,De)});function Kt(N,oe){return ol(Ji,N??(()=>!0),oe)}function qd(N,oe={}){return il(Ji,N,oe)}function Gd(N,oe){return sl(N,oe)}var Xd=ht("ZodInstanceOf",(N,oe)=>{Ji.init(N,oe)},{properties(N,oe){return this.check(ri(N,oe))}});function Qt(N,oe={}){let Ie=new Xd({type:"custom",check:"custom",fn:(Re)=>Re instanceof N,abort:!0,...zt(oe)});return Ie._zod.bag.Class=N,Ie._zod.check=(Re)=>{if(!(Re.value instanceof N))Re.issues.push({code:"invalid_type",expected:N.name,input:Re.value,inst:Ie,path:[...Ie._zod.def.path??[]]})},Ie}function G(N){let oe=$e(()=>l([e(N),r(),c(),We(),o(oe),y(e(),oe)]));return oe}class po extends Error{constructor(N,oe){super(N),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(N){}function of(N){if(typeof N=="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}=N,Ue=[],Be=0,Xe=!0,Ye,Qe="",et=0,tt,ft=!1;function gt(_t){if(ft)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=St(_t);er!==""&&(Ue.push(er),Be=er.length),bt();return}if(_t.indexOf(`
59
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Ue of N.seen.entries()){let Be=Ue[1];if(oe===Ue[0]){Le(Ue);continue}if(N.external){let Ye=N.external.registry.get(Ue[0])?.id;if(oe!==Ue[0]&&Ye){Le(Ue);continue}}if(N.metadataRegistry.get(Ue[0])?.id){Le(Ue);continue}if(Be.cycle){Le(Ue);continue}if(Be.count>1){if(N.reused==="ref")Le(Ue)}}if(N.external)N.sharedDefsExtractedFor=N.external}function ll(N){let oe=N.anyOf;if(!Array.isArray(oe)||oe.length===0||N.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 N.anyOf,N.type=Ie.length===1?Ie[0]:Ie}var fl=new Set(["type","properties","required","additionalProperties"]),al=["oneOf","anyOf"];function ul(N){let oe=N.additionalProperties;if(oe===void 0||oe===!1||typeof oe!=="object"||oe===null)return null;return Object.keys(oe).length?oe:null}function ai(N){let oe=[];for(let Le of N){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(N){let oe=N.allOf;if(!Array.isArray(oe)||oe.length<2)return;for(let De of fl)if(De in N)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 N.allOf,En(N,Re)}function An(N,oe){let Ie=N.seen.get(oe);if(!Ie)throw Error("Unprocessed schema. This is a bug in Zod.");let Re=(Be)=>{let Xe=N.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 ft=N.seen.get(et),gt=ft.schema;if(gt.$ref&&(N.target==="draft-07"||N.target==="draft-04"||N.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 St in Ye){if(St==="$ref"||St==="allOf")continue;if(!(St in Qe))delete Ye[St]}if(gt.$ref&&ft.def)for(let St in Ye){if(St==="$ref"||St==="allOf")continue;if(St in ft.def&&JSON.stringify(Ye[St])===JSON.stringify(ft.def[St]))delete Ye[St]}}let tt=Be._zod.parent;if(tt&&tt!==et){Re(tt);let ft=N.seen.get(tt);if(ft?.schema.$ref){if(Ye.$ref=ft.schema.$ref,ft.def)for(let gt in Ye){if(gt==="$ref"||gt==="allOf")continue;if(gt in ft.def&&JSON.stringify(Ye[gt])===JSON.stringify(ft.def[gt]))delete Ye[gt]}}}N.override({zodSchema:Be,jsonSchema:Ye,path:Xe.path??[]})};if(!N.external||N.sharedEmitDoneFor!==N.external){for(let Be of[...N.seen.entries()].reverse())Re(Be[0]);if(N.target!=="openapi-3.0")for(let Be of N.seen.entries())ll(Be[1].def??Be[1].schema);for(let Be of N.deferred)Be();if(N.intersections.length){let Be=new Map;for(let Xe of N.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 N.intersections)for(let Ye of Be.get(Xe)??[])Up(Ye)}}let De={};if(N.target==="draft-2020-12")De.$schema="https://json-schema.org/draft/2020-12/schema";else if(N.target==="draft-07")De.$schema="http://json-schema.org/draft-07/schema#";else if(N.target==="draft-04")De.$schema="http://json-schema.org/draft-04/schema#";else if(N.target==="openapi-3.0");if(N.external?.uri){let Be=N.external.registry.get(oe)?.id;if(!Be)throw Error("Schema is missing an `id` property");De.$id=N.external.uri(Be)}En(De,Ie.defId?Ie.schema:Ie.def??Ie.schema);let Le=N.metadataRegistry.get(oe)?.id;if(Le!==void 0&&De.id===Le)delete De.id;let Ue=N.external?.defs??{};if(!N.external||N.sharedEmitDoneFor!==N.external)for(let Be of N.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(N.external)N.sharedEmitDoneFor=N.external;if(N.external);else if(Object.keys(Ue).length>0)if(N.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",N.processors),output:On(oe,"output",N.processors)}},enumerable:!1,writable:!1}),Be}catch(Be){throw Error("Error converting schema to JSON.")}}function ar(N,oe){let Ie=oe??{seen:new Set};if(Ie.seen.has(N))return!1;Ie.seen.add(N);let Re=N._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(N._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=(N,oe={})=>(Ie)=>{let Re=Tn({...Ie,processors:oe});return Dt(N,Re),Zn(Re,N),An(Re,N)},On=(N,oe,Ie={})=>(Re)=>{let{libraryOptions:De,target:Le}=Re??{},Ue=Tn({...De??{},target:Le,io:oe,processors:Ie});return Dt(N,Ue),Zn(Ue,N),An(Ue,N)};var qr=(N,oe,Ie)=>{if(N[oe]===void 0||Ie>N[oe])N[oe]=Ie},Gr=(N,oe,Ie)=>{if(N[oe]===void 0||Ie<N[oe])N[oe]=Ie},dl=(N,oe)=>{qr(N,"minimum",oe),Gr(N,"maximum",oe)},_l=(N,oe)=>{if(N.multipleOf??(N.multipleOf=[]),!N.multipleOf.includes(oe))N.multipleOf.push(oe)},vl=(N,oe)=>{N.patterns??(N.patterns=new Set),N.patterns.add(oe)},bl=(N,oe)=>{N.mime=N.mime?N.mime.filter((Ie)=>oe.includes(Ie)):[...oe]},xl=(N,oe)=>{if(N.format=oe,oe.includes("int"))N.isInt=!0},ml=(N,oe)=>qr(N,"minimum",oe.minimum),hl=(N,oe)=>Gr(N,"maximum",oe.maximum),gl=(N)=>(oe,Ie)=>{xl(oe,Ie.format);let[Re,De]=N[Ie.format];qr(oe,"minimum",Re),Gr(oe,"maximum",De)},Bp={greater_than:(N,oe)=>qr(N,oe.inclusive?"minimum":"exclusiveMinimum",oe.value),less_than:(N,oe)=>Gr(N,oe.inclusive?"maximum":"exclusiveMaximum",oe.value),multiple_of:(N,oe)=>_l(N,oe.value),number_format:gl(Ln),bigint_format:gl(Po),min_length:ml,max_length:hl,length_equals:(N,oe)=>dl(N,oe.length),min_size:ml,max_size:hl,size_equals:(N,oe)=>dl(N,oe.size),string_format:(N,oe)=>{if(xl(N,oe.format),oe.pattern)vl(N,oe.pattern);if(oe.format==="base64"||oe.format==="base64url")N.contentEncoding=oe.format;if(oe.local||oe.precision===-1)N.laxFormat=!0},mime_type:(N,oe)=>bl(N,oe.mime)};function nr(N){let oe={},Ie=N._zod.def,Re=N._zod.traits.has("$ZodCheck")?[N,...Ie.checks??[]]:Ie.checks??[];for(let Le of Re)Bp[Le._zod.def.check]?.(oe,Le._zod.def);let De=N._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=(N)=>Vp.get(N)??N,fi=(N,oe,Ie,Re)=>{let De=Ie;De.type="string";let{minimum:Le,maximum:Ue,format:Be,patterns:Xe,contentEncoding:Ye,laxFormat:Qe}=nr(N);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((tt)=>({...oe.target==="draft-07"||oe.target==="draft-04"||oe.target==="openapi-3.0"?{type:"string"}:{},pattern:tt.source}))]}},pi=(N,oe,Ie,Re)=>{let De=Ie,{minimum:Le,maximum:Ue,multipleOf:Be,exclusiveMaximum:Xe,exclusiveMinimum:Ye,isInt:Qe}=nr(N);De.type=Qe?"integer":"number";let et=typeof Ye==="number"&&Ye>=(Le??Number.NEGATIVE_INFINITY),tt=typeof Xe==="number"&&Xe<=(Ue??Number.POSITIVE_INFINITY),ft=oe.target==="draft-04"||oe.target==="openapi-3.0";if(et)if(ft)De.minimum=Ye,De.exclusiveMinimum=!0;else De.exclusiveMinimum=Ye;else if(typeof Le==="number")De.minimum=Le;if(tt)if(ft)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(N,oe,De,Re,`A multipleOf divisor of ${Et} cannot be represented in JSON Schema`);let[bt,...St]=gt;if(bt!==void 0)De.multipleOf=bt;if(St.length)De.allOf=[...De.allOf??[],...St.map((Et)=>({multipleOf:Et}))]}},di=(N,oe,Ie,Re)=>{Ie.type="boolean"},mi=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"BigInt cannot be represented in JSON Schema")},$l=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Symbols cannot be represented in JSON Schema")},hi=(N,oe,Ie,Re)=>{if(oe.target==="openapi-3.0")Ie.type="string",Ie.nullable=!0,Ie.enum=[null];else Ie.type="null"},zl=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Undefined cannot be represented in JSON Schema")},Sl=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Void cannot be represented in JSON Schema")},gi=(N,oe,Ie,Re)=>{Ie.not={}},yi=(N,oe,Ie,Re)=>{},_i=(N,oe,Ie,Re)=>{},vi=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Date cannot be represented in JSON Schema")},bi=(N,oe,Ie,Re)=>{let De=N._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=(N,oe,Ie,Re)=>{let De=N._zod.def;if(De.values.length===0){Ie.not={};return}let Le=[];for(let Ue of De.values)if(Ue===void 0){if(ir(N,oe,Ie,Re,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof Ue==="bigint"){if(ir(N,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=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"NaN cannot be represented in JSON Schema")},Pl=(N,oe,Ie,Re)=>{let De=Ie,Le=N._zod.pattern;if(!Le)throw Error("Pattern not found in template literal");De.type="string",De.pattern=Le.source},El=(N,oe,Ie,Re)=>{let De=Ie;De.type="string",De.format="binary",De.contentEncoding="binary";let{minimum:Le,maximum:Ue,mime:Be}=nr(N);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=(N,oe,Ie,Re)=>{Ie.type="boolean"},wi=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Custom types cannot be represented in JSON Schema")},Tl=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Function types cannot be represented in JSON Schema")},$i=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Transforms cannot be represented in JSON Schema")},Zl=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Map cannot be represented in JSON Schema")},Al=(N,oe,Ie,Re)=>{ir(N,oe,Ie,Re,"Set cannot be represented in JSON Schema")},zi=(N,oe,Ie,Re)=>{let De=Ie,Le=N._zod.def,{minimum:Ue,maximum:Be}=nr(N);if(typeof Ue==="number")De.minItems=Ue;if(typeof Be==="number")De.maxItems=Be;De.type="array",De.items=Dt(Le.element,oe,{...Re,path:[...Re.path,"items"]})};function In(N){let oe=N._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 N._zod.optin}var Si=(N,oe,Ie,Re)=>{let De=Ie,Le=N._zod.def,Ue=Le.shape;if(Object.getOwnPropertySymbols(Ue).length&&ir(N,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,Dt(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=Dt(Le.catchall,oe,{...Re,path:[...Re.path,"additionalProperties"]})},ki=(N,oe,Ie,Re)=>{let De=N._zod.def,Le=De.inclusive===!1,Ue=De.options.map((Be,Xe)=>Dt(Be,oe,{...Re,path:[...Re.path,Le?"oneOf":"anyOf",Xe]}));if(Le)Ie.oneOf=Ue;else Ie.anyOf=Ue},Pi=(N,oe,Ie,Re)=>{let De=N._zod.def,Le=Dt(De.left,oe,{...Re,path:[...Re.path,"allOf",0]}),Ue=Dt(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=(N,oe,Ie,Re)=>{let De=Ie,Le=N._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((bt,St)=>Dt(bt,oe,{...Re,path:[...Re.path,Ue,St]})),Ye=Le.rest?Dt(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 bt=Le.items[Qe-1];if(!(oe.io==="input"?In(bt)!==void 0:bt._zod.optout==="optional"))break;Qe--}let et=Le.items.length,tt=!Le.rest;if(oe.target==="draft-2020-12"){if(De.prefixItems=Xe,tt)De.items=!1;else if(Ye)De.items=Ye;if(Qe>0)De.minItems=Qe;if(tt)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(tt)De.maxItems=et}else{if(De.items=Xe,tt)De.additionalItems=!1;else if(Ye)De.additionalItems=Ye;if(Qe>0)De.minItems=Qe;if(tt)De.maxItems=et}let{minimum:ft,maximum:gt}=nr(N);if(typeof ft==="number")De.minItems=ft;if(typeof gt==="number")De.maxItems=gt};function ui(N,oe,Ie){if(oe.$ref){if(Ie.has(oe))return oe;Ie.add(oe);let gt=N.get(oe)?.def;if(!gt)return oe;let bt=ui(N,gt,Ie);return bt===gt?oe:bt}for(let gt of["anyOf","oneOf"]){let bt=oe[gt];if(!Array.isArray(bt))continue;let St=bt.map((Et)=>ui(N,Et,Ie));if(St.some((Et,rr)=>Et!==bt[rr]))oe={...oe,[gt]:St}}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:tt,...ft}=oe;if(ft.enum)ft.enum=ft.enum.map((gt)=>typeof gt==="number"?String(gt):gt);else if(typeof ft.const==="number")ft.const=String(ft.const);if(!De)return ft;if(ft.type="string",!Le)ft.pattern=(Re.includes("number")?wn:Ro).source;return ft}var li=new WeakMap;function Wp(N){let oe=new Map;for(let Re of N.seen.values())if(Re.def&&!oe.has(Re.schema))oe.set(Re.schema,Re);let Ie=new Map;for(let Re of li.get(N)??[]){let De=N.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 N.seen.values())for(let De of[Re.schema,Re.def]){let Le=De&&Ie.get(De.propertyNames);if(Le)De.propertyNames=Le}}var Oi=(N,oe,Ie,Re)=>{let De=Ie,Le=N._zod.def;De.type="object";let Ue=Le.keyType,Be=nr(Ue).patterns;if(Le.mode==="loose"&&Be&&Be.size>0){let Qe=Dt(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=Dt(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(N)}De.additionalProperties=Dt(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=(N,oe,Ie,Re)=>{let De=N._zod.def,Le=Dt(De.innerType,oe,Re),Ue=oe.seen.get(N);if(oe.target==="openapi-3.0")Ue.ref=De.innerType,Ie.nullable=!0;else Ie.anyOf=[Le,{type:"null"}]},Zi=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType},Ai=Symbol();function Il(N,oe,Ie,Re,De){let Le=!1,Ue=JSON.stringify(N,(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=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType;let Ue=Il(De.defaultValue,N,oe,Ie,Re);if(Ue!==Ai)Ie.default=Ue},Ci=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);if(Le.ref=De.innerType,oe.io!=="input")return;let Ue=Il(De.defaultValue,N,oe,Ie,Re);if(Ue!==Ai)Ie._prefault=Ue},Ni=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType;let Ue;try{Ue=De.catchValue(void 0)}catch{ir(N,oe,Ie,Re,"Dynamic catch values are not supported in JSON Schema");return}Ie.default=Ue},Ri=(N,oe,Ie,Re)=>{let De=N._zod.def,Le=De.in._zod.traits.has("$ZodTransform"),Ue=oe.io==="input"?Le?De.out:De.in:De.out;Dt(Ue,oe,Re);let Be=oe.seen.get(N);Be.ref=Ue},Di=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType,Ie.readOnly=!0},Cl=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType},uo=(N,oe,Ie,Re)=>{let De=N._zod.def;Dt(De.innerType,oe,Re);let Le=oe.seen.get(N);Le.ref=De.innerType},Mi=(N,oe,Ie,Re)=>{let De=N._zod.innerType;Dt(De,oe,Re);let Le=oe.seen.get(N);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 rt(N,oe){if("_idmap"in N){let Re=N,De=Tn({...oe,processors:yl}),Le={};for(let Xe of Re._idmap.entries()){let[Ye,Qe]=Xe;Dt(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 Dt(N,Ie),Zn(Ie,N),An(Ie,N)}var Nl=new WeakSet([Object.prototype,Error.prototype]);function lo(N,oe,Ie){Object.defineProperty(N,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=(N,oe)=>{Xs.init(N,oe),N.name="ZodError";let Ie=Object.getPrototypeOf(N);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 It=ht("ZodType",(N,oe)=>(td(),At.init(N,oe),N.def=oe,N.type=oe.type,N),{check(...N){let oe=this.def;return this.clone(fr(oe,{checks:[...oe.checks??[],...N.map((Ie)=>typeof Ie==="function"?{_zod:{check:Ie,def:{check:"custom"},onattach:[]}}:Ie)]}),{parent:!0})},with(...N){return this.check(...N)},clone(N,oe){return $r(this,N,oe)},brand(){return this},register(N,oe){return N.add(this,oe),this},refine(N,oe){return this.check(qd(N,oe))},superRefine(N,oe){return this.check(Gd(N,oe))},overwrite(N){return this.check(Rr(N))},optional(){return Hl(this)},exactOptional(){return Rd(this)},nullable(){return ql(this)},nullish(){return Hl(ql(this))},nonoptional(N){return Ud(this,N)},array(){return o(this)},or(N){return l([this,N])},and(N){return ot(this,N)},transform(N){return Gl(this,Nd(N))},default(N){return Ld(this,N)},prefault(N){return Fd(this,N)},catch(N){return Jd(this,N)},pipe(N){return Gl(this,N)},readonly(){return Kd(this)},describe(N){let oe=this.clone();return Ur.add(oe,{description:N}),oe},meta(...N){if(N.length===0)return Ur.get(this);let oe=this.clone();return Ur.add(oe,N[0]),oe},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(N,...oe){return oe.length===0?N(this):N(this,...oe)},get "~standard"(){return vn(this,"~standard",{...Uo(this),jsonSchema:{input:On(this,"input"),output:On(this,"output")}})},set "~standard"(N){Or(this,"~standard",N)},parse:function N(oe,Ie){return Rl(this,oe,Ie,{callee:N})},parseAsync:async function N(oe,Ie){return await Dl(this,oe,Ie,{callee:N})},safeParse(N,oe){return Ml(this,N,oe)},async safeParseAsync(N,oe){return Ve(this,N,oe)},get spa(){return this?.safeParseAsync},set spa(N){Or(this,"spa",N)},validate(N,oe){return Ao(this,N,oe)},validateAsync(N,oe){return Io(this,N,oe)},encode:function N(oe,Ie){return Ll(this,oe,Ie,{callee:N})},decode:function N(oe,Ie){return jl(this,oe,Ie,{callee:N})},encodeAsync:async function N(oe,Ie){return await Fl(this,oe,Ie,{callee:N})},decodeAsync:async function N(oe,Ie){return await Ul(this,oe,Ie,{callee:N})},safeEncode(N,oe){return Bl(this,N,oe)},safeDecode(N,oe){return Jl(this,N,oe)},async safeEncodeAsync(N,oe){return Vl(this,N,oe)},async safeDecodeAsync(N,oe){return Wl(this,N,oe)},toJSONSchema(N){return pl(this,{})(N)},get description(){return Ur.get(this)?.description},get _def(){return this._zod.def}}),Xl=ht("_ZodString",(N,oe)=>{eo.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>fi(N,Ie,Re,De)},Jn({format:(N)=>nr(N).format??null,minLength:(N)=>nr(N).minimum??null,maxLength:(N)=>nr(N).maximum??null},{regex(...N){return this.check(Go(...N))},includes(...N){return this.check(Qo(...N))},startsWith(...N){return this.check(ei(...N))},endsWith(...N){return this.check(ti(...N))},min(...N){return this.check(Hr(...N))},max(...N){return this.check(co(...N))},length(...N){return this.check(ao(...N))},nonempty(...N){return this.check(Hr(1,...N))},lowercase(N){return this.check(Xo(N))},uppercase(N){return this.check(Yo(N))},trim(){return this.check(oi())},normalize(...N){return this.check(ni(...N))},toLowerCase(){return this.check(ii())},toUpperCase(){return this.check(si())},slugify(){return this.check(ci())}})),Pt=ht("ZodString",(N,oe)=>{eo.init(N,oe),Xl.init(N,oe)},{email(N){return this.check(zu(sd,N))},url(N){return this.check(Tu(ad,N))},jwt(N){return this.check(Vu($d,N))},emoji(N){return this.check(Zu(ud,N))},guid(N){return this.check(Su(cd,N))},uuid(N){return this.check(ku(fo,N))},uuidv4(N){return this.check(Pu(fo,N))},uuidv6(N){return this.check(Eu(fo,N))},uuidv7(N){return this.check(Ou(fo,N))},nanoid(N){return this.check(Au(ld,N))},cuid(N){return this.check(Iu(fd,N))},cuid2(N){return this.check(Cu(pd,N))},ulid(N){return this.check(Nu(dd,N))},base64(N){return this.check(Uu(bd,N))},base64url(N){return this.check(Bu(xd,N))},xid(N){return this.check(Ru(md,N))},ksuid(N){return this.check(Du(hd,N))},ipv4(N){return this.check(Mu(gd,N))},ipv6(N){return this.check(Lu(yd,N))},cidrv4(N){return this.check(ju(_d,N))},cidrv6(N){return this.check(Fu(vd,N))},e164(N){return this.check(Ju(wd,N))},datetime(N){return this.check(Wu(rd,N))},date(N){return this.check(Ku(nd,N))},time(N){return this.check(Hu(od,N))},duration(N){return this.check(qu(id,N))}});function e(N){return $u(Pt,N)}var Ft=ht("ZodStringFormat",(N,oe)=>{Mt.init(N,oe),Xl.init(N,oe)}),rd=ht("ZodISODateTime",(N,oe)=>{Pa.init(N,oe),Ft.init(N,oe)}),nd=ht("ZodISODate",(N,oe)=>{Ea.init(N,oe),Ft.init(N,oe)}),od=ht("ZodISOTime",(N,oe)=>{Oa.init(N,oe),Ft.init(N,oe)}),id=ht("ZodISODuration",(N,oe)=>{Ta.init(N,oe),Ft.init(N,oe)}),sd=ht("ZodEmail",(N,oe)=>{ga.init(N,oe),Ft.init(N,oe)});var cd=ht("ZodGUID",(N,oe)=>{ma.init(N,oe),Ft.init(N,oe)});var fo=ht("ZodUUID",(N,oe)=>{ha.init(N,oe),Ft.init(N,oe)});var ad=ht("ZodURL",(N,oe)=>{va.init(N,oe),Ft.init(N,oe)});var ud=ht("ZodEmoji",(N,oe)=>{ba.init(N,oe),Ft.init(N,oe)});var ld=ht("ZodNanoID",(N,oe)=>{xa.init(N,oe),Ft.init(N,oe)});var fd=ht("ZodCUID",(N,oe)=>{wa.init(N,oe),Ft.init(N,oe)});var pd=ht("ZodCUID2",(N,oe)=>{$a.init(N,oe),Ft.init(N,oe)});var dd=ht("ZodULID",(N,oe)=>{za.init(N,oe),Ft.init(N,oe)});var md=ht("ZodXID",(N,oe)=>{Sa.init(N,oe),Ft.init(N,oe)});var hd=ht("ZodKSUID",(N,oe)=>{ka.init(N,oe),Ft.init(N,oe)});var gd=ht("ZodIPv4",(N,oe)=>{Za.init(N,oe),Ft.init(N,oe)});var yd=ht("ZodIPv6",(N,oe)=>{Ia.init(N,oe),Ft.init(N,oe)});var _d=ht("ZodCIDRv4",(N,oe)=>{Ca.init(N,oe),Ft.init(N,oe)});var vd=ht("ZodCIDRv6",(N,oe)=>{Na.init(N,oe),Ft.init(N,oe)});var bd=ht("ZodBase64",(N,oe)=>{Da.init(N,oe),Ft.init(N,oe)});var xd=ht("ZodBase64URL",(N,oe)=>{Ma.init(N,oe),Ft.init(N,oe)});var wd=ht("ZodE164",(N,oe)=>{La.init(N,oe),Ft.init(N,oe)});var $d=ht("ZodJWT",(N,oe)=>{ja.init(N,oe),Ft.init(N,oe)});var wt=ht("ZodNumber",(N,oe)=>{Jo.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>pi(N,Ie,Re,De),N.isFinite=!0},Jn({minValue:(N)=>{let{minimum:oe,exclusiveMinimum:Ie}=nr(N);return Math.max(oe??Number.NEGATIVE_INFINITY,Ie??Number.NEGATIVE_INFINITY)},maxValue:(N)=>{let{maximum:oe,exclusiveMaximum:Ie}=nr(N);return Math.min(oe??Number.POSITIVE_INFINITY,Ie??Number.POSITIVE_INFINITY)},isInt:(N)=>{let{isInt:oe,multipleOf:Ie}=nr(N);return!!oe||!!Ie?.some(Number.isSafeInteger)},format:(N)=>nr(N).format??null},{gt(N,oe){return this.check(Kr(N,oe))},gte(N,oe){return this.check(Zr(N,oe))},min(N,oe){return this.check(Zr(N,oe))},lt(N,oe){return this.check(Wr(N,oe))},lte(N,oe){return this.check(Tr(N,oe))},max(N,oe){return this.check(Tr(N,oe))},int(N){return this.check(Kl(N))},safe(N){return this.check(Kl(N))},positive(N){return this.check(Kr(0,N))},nonnegative(N){return this.check(Zr(0,N))},negative(N){return this.check(Wr(0,N))},nonpositive(N){return this.check(Tr(0,N))},multipleOf(N,oe){return this.check(Pn(N,oe))},step(N,oe){return this.check(Pn(N,oe))},finite(){return this}}));function r(N){return Gu(wt,N)}var zd=ht("ZodNumberFormat",(N,oe)=>{Fa.init(N,oe),wt.init(N,oe)});function Kl(N){return Xu(zd,N)}var Rt=ht("ZodBoolean",(N,oe)=>{Ua.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>di(N,Ie,Re,De)});function c(N){return Yu(Rt,N)}var Zt=ht("ZodBigInt",(N,oe)=>{Ba.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>mi(N,Ie,Re,De)},Jn({minValue:(N)=>nr(N).minimum??null,maxValue:(N)=>nr(N).maximum??null,format:(N)=>nr(N).format??null},{gte(N,oe){return this.check(Zr(N,oe))},min(N,oe){return this.check(Zr(N,oe))},gt(N,oe){return this.check(Kr(N,oe))},lt(N,oe){return this.check(Wr(N,oe))},lte(N,oe){return this.check(Tr(N,oe))},max(N,oe){return this.check(Tr(N,oe))},positive(N){return this.check(Kr(BigInt(0),N))},negative(N){return this.check(Wr(BigInt(0),N))},nonpositive(N){return this.check(Tr(BigInt(0),N))},nonnegative(N){return this.check(Zr(BigInt(0),N))},multipleOf(N,oe){return this.check(Pn(N,oe))}}));var Sd=ht("ZodNull",(N,oe)=>{Ja.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>hi(N,Ie,Re,De)});function We(N){return Qu(Sd,N)}var kd=ht("ZodAny",(N,oe)=>{Va.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>yi(N,Ie,Re,De)});function ie(){return el(kd)}var Pd=ht("ZodUnknown",(N,oe)=>{Wa.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>_i(N,Ie,Re,De)});function v(){return tl(Pd)}var Ed=ht("ZodNever",(N,oe)=>{Ka.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>gi(N,Ie,Re,De)});function Ae(N){return rl(Ed,N)}var Jt=ht("ZodDate",(N,oe)=>{Ha.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>vi(N,Ie,Re,De),N.min=(Ie,Re)=>N.check(Zr(Ie,Re)),N.max=(Ie,Re)=>N.check(Tr(Ie,Re))},Jn({minDate:(N)=>{let{minimum:oe}=nr(N);return oe?new Date(oe):null},maxDate:(N)=>{let{maximum:oe}=nr(N);return oe?new Date(oe):null}},{}));var Od=ht("ZodArray",(N,oe)=>{Cn(),qa.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>zi(N,Ie,Re,De),N.element=oe.element},{min(N,oe){return this.check(Hr(N,oe))},nonempty(N){return this.check(Hr(1,N))},max(N,oe){return this.check(co(N,oe))},length(N,oe){return this.check(ao(N,oe))},unwrap(){return this.element}});function o(N,oe){return nl(Od,N,oe)}var Ui=ht("ZodObject",(N,oe)=>{Cn(),Ya.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Si(N,Ie,Re,De),ap(N,"shape",(Ie)=>Ie._zod.def.shape,!1)},{keyof(){return i(Object.keys(this._zod.def.shape))},catchall(N){return this.clone(fr(this._zod.def,{catchall:N}))},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(N){return ep(this,N)},safeExtend(N){return tp(this,N)},merge(N){return rp(this,N)},pick(N){return Yf(this,N)},omit(N){return Qf(this,N)},partial(...N){return Us(Bi,this,N[0])},exactPartial(...N){return Us(Ql,this,N[0],"exactPartial")},required(...N){return np(ef,this,N[0])}});function t(N,oe){let Ie={type:"object",shape:N??{},...zt(oe)};return new Ui(Ie)}function se(N,oe){return new Ui({type:"object",shape:N,catchall:Ae(),...zt(oe)})}function U(N,oe){return new Ui({type:"object",shape:N,catchall:v(),...zt(oe)})}var Yl=ht("ZodUnion",(N,oe)=>{Vo.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>ki(N,Ie,Re,De),N.options=oe.options});function l(N,oe){return new Yl({type:"union",options:N,...zt(oe)})}var Td=ht("ZodDiscriminatedUnion",(N,oe)=>{Yl.init(N,oe),Qa.init(N,oe)});function f(N,oe,Ie){return new Td({type:"union",options:oe,discriminator:N,...zt(Ie)})}var Zd=ht("ZodIntersection",(N,oe)=>{eu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Pi(N,Ie,Re,De)});function ot(N,oe){return new Zd({type:"intersection",left:N,right:oe})}var Ad=ht("ZodTuple",(N,oe)=>{Cn(),tu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ei(N,Ie,Re,De)},{rest(N){return this.clone({...this._zod.def,rest:N})},partial(){let N=this._zod.def;if(N.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...N,items:N.items.map((oe)=>new Bi({type:"optional",innerType:oe}))})}});function ce(N,oe,Ie){let Re=oe instanceof At,De=Re?Ie:oe;return new Ad({type:"tuple",items:N,rest:Re?oe:null,...zt(De)})}var ji=ht("ZodRecord",(N,oe)=>{Cn(),ru.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Oi(N,Ie,Re,De),N.keyType=oe.keyType,N.valueType=oe.valueType});function y(N,oe,Ie){if(!oe||!oe._zod)return new ji({type:"record",keyType:e(),valueType:N,...zt(oe)});return new ji({type:"record",keyType:N,valueType:oe,...zt(Ie)})}function bn(N,oe,Ie){return new ji({type:"record",keyType:N,valueType:oe,...zt(Ie),partial:!0})}var Fi=ht("ZodEnum",(N,oe)=>{nu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Re,De,Le)=>bi(N,Re,De,Le),N.enum=oe.entries,N.options=[...N._zod.values];let Ie=new Set(Object.keys(oe.entries));N.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:[],...zt(De),entries:Le})},N.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:[],...zt(De),entries:Le})}});function i(N,oe){let Ie=Array.isArray(N)?Object.fromEntries(N.map((Re)=>[Re,Re])):N;return new Fi({type:"enum",entries:Ie,...zt(oe)})}var Id=ht("ZodLiteral",(N,oe)=>{ou.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>xi(N,Ie,Re,De),N.values=new Set(oe.values),Object.defineProperty(N,"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(N,oe){return new Id({type:"literal",values:Array.isArray(N)?N:[N],...zt(oe)})}var Cd=ht("ZodTransform",(N,oe)=>{Cn(),iu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>$i(N,Ie,Re,De),N._zod.parse=(Ie,Re)=>{if(Re.direction==="backward")throw new xn(N.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=N),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(N){return new Cd({type:"transform",transform:N})}var Bi=ht("ZodOptional",(N,oe)=>{Wo.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>uo(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Hl(N){return new Bi({type:"optional",innerType:N})}var Ql=ht("ZodExactOptional",(N,oe)=>{su.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>uo(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Rd(N){return new Ql({type:"optional",innerType:N})}var Dd=ht("ZodNullable",(N,oe)=>{cu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ti(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function ql(N){return new Dd({type:"nullable",innerType:N})}var Md=ht("ZodDefault",(N,oe)=>{au.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ii(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType,N.removeDefault=N.unwrap});function Ld(N,oe){return new Md({type:"default",innerType:N,get defaultValue(){return typeof oe==="function"?oe():So(oe)}})}var jd=ht("ZodPrefault",(N,oe)=>{uu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ci(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Fd(N,oe){return new jd({type:"prefault",innerType:N,get defaultValue(){return typeof oe==="function"?oe():So(oe)}})}var ef=ht("ZodNonOptional",(N,oe)=>{lu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Zi(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Ud(N,oe){return new ef({type:"nonoptional",innerType:N,...zt(oe)})}var Bd=ht("ZodCatch",(N,oe)=>{fu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ni(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType,N.removeCatch=N.unwrap});function Jd(N,oe){return new Bd({type:"catch",innerType:N,catchValue:typeof oe==="function"?oe:Ws(oe)})}var Vd=ht("ZodPipe",(N,oe)=>{pu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Ri(N,Ie,Re,De),N.in=oe.in,N.out=oe.out});function Gl(N,oe){return new Vd({type:"pipe",in:N,out:oe})}var Wd=ht("ZodReadonly",(N,oe)=>{du.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Di(N,Ie,Re,De),N.unwrap=()=>N._zod.def.innerType});function Kd(N){return new Wd({type:"readonly",innerType:N})}var Hd=ht("ZodLazy",(N,oe)=>{mu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>Mi(N,Ie,Re,De),N.unwrap=()=>N._zod.def.getter()});function Ne(N){return new Hd({type:"lazy",getter:N})}var Ji=ht("ZodCustom",(N,oe)=>{hu.init(N,oe),It.init(N,oe),N._zod.processJSONSchema=(Ie,Re,De)=>wi(N,Ie,Re,De)});function Kt(N,oe){return ol(Ji,N??(()=>!0),oe)}function qd(N,oe={}){return il(Ji,N,oe)}function Gd(N,oe){return sl(N,oe)}var Xd=ht("ZodInstanceOf",(N,oe)=>{Ji.init(N,oe)},{properties(N,oe){return this.check(ri(N,oe))}});function Qt(N,oe={}){let Ie=new Xd({type:"custom",check:"custom",fn:(Re)=>Re instanceof N,abort:!0,...zt(oe)});return Ie._zod.bag.Class=N,Ie._zod.check=(Re)=>{if(!(Re.value instanceof N))Re.issues.push({code:"invalid_type",expected:N.name,input:Re.value,inst:Ie,path:[...Ie._zod.def.path??[]]})},Ie}function G(N){let oe=Ne(()=>l([e(N),r(),c(),We(),o(oe),y(e(),oe)]));return oe}class po extends Error{constructor(N,oe){super(N),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(N){}function of(N){if(typeof N=="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}=N,Ue=[],Be=0,Xe=!0,Ye,Qe="",et=0,tt,ft=!1;function gt(_t){if(ft)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=St(_t);er!==""&&(Ue.push(er),Be=er.length),bt();return}if(_t.indexOf(`
60
60
  `)===-1&&_t.indexOf("\r")===-1){Ue.push(_t),Be+=_t.length,bt();return}Ue.push(_t);let yt=Ue.join("");Ue.length=0,Be=0;let Ot=St(yt);Ot!==""&&(Ue.push(Ot),Be=Ot.length),bt()}function bt(){Le!==void 0&&(Be+Qe.length<=Le||(ft=!0,Ue.length=0,Be=0,Ye=void 0,Qe="",et=0,tt=void 0,Ie(new po(`Buffered data exceeded max buffer size of ${Le} characters`,{type:"max-buffer-size-exceeded"}))))}function St(_t){let yt=0;if(_t.indexOf("\r")===-1){let Ot=_t.indexOf(`
61
61
  `,yt);for(;Ot!==-1;){if(yt===Ot){et>0&&oe({id:Ye,event:tt,data:Qe}),Ye=void 0,Qe="",et=0,tt=void 0,yt=Ot+1,Ot=_t.indexOf(`
62
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,Ot);if(et===0&&_t.charCodeAt(Ot+1)===tf){oe({id:Ye,event:tt,data:hr}),Ye=void 0,Qe="",tt=void 0,yt=Ot+2,Ot=_t.indexOf(`
@@ -65,7 +65,7 @@ ${hr}`,et++}else nf(_t,yt,er)?tt=_t.slice(_t.charCodeAt(yt+6)===Br?yt+7:yt+6,Ot)
65
65
  `,yt)}return _t.slice(yt)}for(;yt<_t.length;){let Ot=_t.indexOf("\r",yt),er=_t.indexOf(`
66
66
  `,yt),tr=-1;if(Ot!==-1&&er!==-1?tr=Ot<er?Ot:er:Ot!==-1?Ot===_t.length-1?tr=-1:tr=Ot: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,Ot){if(yt===Ot){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,Ot);Qe=et===0?ts:`${Qe}
67
67
  ${ts}`,et++;return}if(nf(_t,yt,er)){tt=_t.slice(_t.charCodeAt(yt+6)===Br?yt+7:yt+6,Ot)||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,Ot);Jr.includes("\x00")||(Ye=Jr);return}if(er===58){if(De){let Jr=_t.slice(yt,Ot);De(Jr.slice(_t.charCodeAt(yt+1)===Br?2:1))}return}let tr=_t.slice(yt,Ot),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,Ot){switch(_t){case"event":tt=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:Ot}));break;default:Ie(new po(`Unknown field "${_t.length>20?`${_t.slice(0,20)}…`:_t}"`,{type:"unknown-field",field:_t,value:yt,line:Ot}));break}}function Pr(){et>0&&oe({id:Ye,event:tt,data:Qe}),Ye=void 0,Qe="",et=0,tt=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,tt=void 0,Ue.length=0,Be=0,ft=!1}return{feed:gt,reset:Mr}}function rf(N,oe,Ie){return Ie===100&&N.charCodeAt(oe+1)===97&&N.charCodeAt(oe+2)===116&&N.charCodeAt(oe+3)===97&&N.charCodeAt(oe+4)===58}function nf(N,oe,Ie){return Ie===101&&N.charCodeAt(oe+1)===118&&N.charCodeAt(oe+2)===101&&N.charCodeAt(oe+3)===110&&N.charCodeAt(oe+4)===116&&N.charCodeAt(oe+5)===58}class mo extends TransformStream{constructor({onError:N,onRetry:oe,onComment:Ie,maxBufferSize:Re}={}){let De;super({start(Le){De=of({onEvent:(Ue)=>{Le.enqueue(Ue)},onError(Ue){typeof N=="function"&&N(Ue),(N==="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(N){return N===void 0?[]:Array.isArray(N)?N:[N]}function d(...N){return N.reduce((oe,Ie)=>({...oe,...Ie}),{})}function Qd(N){return Object.fromEntries(Object.entries(N).filter(([oe,Ie])=>Ie!=null))}async function Oe(N,oe){if(N==null)return;let Ie=oe?.abortSignal;return new Promise((Re,De)=>{if(Ie?.aborted){De(sf());return}let Le=setTimeout(()=>{Ue(),Re()},N),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(N){let oe=N??globalThis.WebSocket;if(oe==null)throw Error("No WebSocket implementation available.");return oe}function Lt(N){let oe=new URL(N);if(oe.protocol==="http:")oe.protocol="ws:";else if(oe.protocol==="https:")oe.protocol="wss:";return oe}var cf=new TextDecoder;async function tm(N){if(typeof N==="string")return N;if(N instanceof ArrayBuffer)return cf.decode(N);if(ArrayBuffer.isView(N))return cf.decode(N);if(typeof Blob<"u"&&N instanceof Blob)return N.text();return String(N)}var rm=1;async function ue(N,{highWaterMark:oe=1048576,pollIntervalMs:Ie=20,abortSignal:Re}={}){while(N.readyState===rm&&(N.bufferedAmount??0)>oe){if(Re?.aborted===!0)return;await Oe(Ie)}}function fe({url:N,protocols:oe,headers:Ie,webSocket:Re,abortSignal:De,onOpen:Le,onMessageText:Ue,onProcessingError:Be,onSocketError:Xe,onClose:Ye,onAbort:Qe}){let et,tt,ft=(St)=>{if(tt!=null)De?.removeEventListener("abort",tt),tt=void 0;try{et?.close(St)}catch{}};if(De?.aborted)return Qe?.(De.reason??Error("Aborted")),{socket:void 0,close:ft};try{et=new(em(Re))(N,oe,{headers:Qd(Ie??{})})}catch(St){return Be(St),{socket:void 0,close:ft}}if(De!=null&&Qe!=null)tt=()=>Qe(De.reason??Error("Aborted")),De.addEventListener("abort",tt,{once:!0});let gt=et;et.onopen=()=>{try{Le?.(gt)}catch(St){Be(St)}};let bt=Promise.resolve();return et.onmessage=(St)=>{bt=bt.then(()=>tm(St.data)).then((Et)=>Ue(Et)).catch(Be)},et.onerror=()=>{bt=bt.then(()=>Xe?.()).catch(Be)},et.onclose=(St)=>{let Et=St,rr=typeof Et?.code==="number"?Et.code:void 0,Pr=typeof Et?.reason==="string"?Et.reason:void 0;bt=bt.then(()=>Ye?.({code:rr,reason:Pr})).catch(Be)},{socket:et,close:ft}}function ae(N){let oe=!1;return new ReadableStream({async pull(Ie){if(oe)return;try{let{value:Re,done:De}=await N.next();if(De)Ie.close();else Ie.enqueue(Re)}catch(Re){Ie.error(Re)}},async cancel(Ie){if(oe=!0,N.return)try{await N.return(Ie)}catch{}}})}var{btoa:nm,atob:om}=globalThis;function j(N){let oe=N.replace(/-/g,"+").replace(/_/g,"/"),Ie=om(oe);return Uint8Array.from(Ie,(Re)=>Re.codePointAt(0))}function X(N){if(typeof globalThis.Buffer?.from==="function")return globalThis.Buffer.from(N.buffer,N.byteOffset,N.byteLength).toString("base64");let oe=[],Ie=4096;for(let Re=0;Re<N.length;Re+=Ie)oe.push(String.fromCodePoint(...N.subarray(Re,Re+Ie)));return nm(oe.join(""))}function M(N){return N instanceof Uint8Array?X(N):N}function we(N){if(N.type==="stream"){let oe=new u({functionality:"streaming file upload"});throw N.stream.cancel(oe).catch(()=>{}),oe}if(N.type==="text")return new TextEncoder().encode(N.text);if(N.data instanceof Uint8Array)return N.data;if(N.data instanceof ArrayBuffer)return new Uint8Array(N.data);return j(N.data)}function Yt(N){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===N){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===N){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 st(N,oe={}){let{useArrayBrackets:Ie=!0}=oe,Re=new FormData;for(let[De,Le]of Object.entries(N)){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:N,model:oe,created:Ie}){return{id:N??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:N=[],providerToolNames:oe}){let Ie={},Re={};for(let De of N)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:N,type:oe,code:Ie,statusCode:Re,isRetryable:De,data:Le}){let Ue={message:N,type:oe,code:Ie,statusCode:Re,isRetryable:De,data:Le};return Object.defineProperty(Ue,hf,{value:!0}),Ue}function at(N){return typeof N==="object"&&N!=null&&N[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((N,oe)=>{if(this.status.type==="resolved")N(this.status.value);else if(this.status.type==="rejected")oe(this.status.error);this._resolve=N,this._reject=oe}),this._promise}resolve(N){if(this.status={type:"resolved",value:N},this._promise)this._resolve?.(N)}reject(N){if(this.status={type:"rejected",error:N},this._promise)this._reject?.(N)}isResolved(){return this.status.type==="resolved"}isRejected(){return this.status.type==="rejected"}isPending(){return this.status.type==="pending"}};function wr(N){return Object.fromEntries([...N.headers])}function ke(N=globalThis){if(N.navigator?.userAgent)return N.navigator.userAgent.toLowerCase();if(N.process?.versions?.node)return`node.js/${N.process.version}`;if(N.EdgeRuntime)return"vercel-edge";return""}function Z(N){return(N instanceof Error||typeof DOMException==="function"&&N instanceof DOMException)&&(N.name==="AbortError"||N.name==="ResponseAborted"||N.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(N){let oe=new Set,Ie=N;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:N,url:oe,requestBodyValues:Ie}){if(Z(N))return N;if(N instanceof TypeError&&im.includes(N.message.toLowerCase())){let De=N.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(N);if(Re!=null){if(w.isInstance(N))return new w({message:N.message,cause:N.cause,url:N.url,requestBodyValues:N.requestBodyValues,statusCode:N.statusCode,responseHeaders:N.responseHeaders,responseBody:N.responseBody,data:N.data,isRetryable:!0});return new w({message:`Cannot connect to API: ${N instanceof Error?N.message:Re.message}`,cause:N,url:oe,requestBodyValues:Ie,isRetryable:!0})}return N}var yo="5.0.70";function qe(N){if(N==null)return{};let oe={};if(N instanceof Headers)N.forEach((Ie,Re)=>{oe[Re.toLowerCase()]=Ie});else{if(!Array.isArray(N))N=Object.entries(N);for(let[Ie,Re]of N)if(Re!=null)oe[Ie.toLowerCase()]=Re}return oe}function F(N,...oe){let Ie=new Headers(qe(N)),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:N,headers:oe={},failedResponseHandler:Ie,successfulResponseHandler:Re,abortSignal:De,fetch:Le=am()})=>{try{let Ue=await Le(N,{method:"DELETE",headers:F(oe,`ai-sdk-provider-utils/${yo}`,ke()),signal:De}),Be=wr(Ue);if(!Ue.ok){let Xe;try{Xe=await Ie({response:Ue,url:N,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:N,responseHeaders:Be,requestBodyValues:{}})}throw Xe.value}try{return await Re({response:Ue,url:N,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:N,responseHeaders:Be,requestBodyValues:{}})}}catch(Ue){throw Nn({error:Ue,url:N,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(N,oe){if(typeof N!=="string")return N.length>oe?N.subarray(0,oe):N;let Ie=Math.ceil(oe/3)*4,Re=j(N.substring(0,Math.min(N.length,Ie)));return Re.length>oe?Re.subarray(0,oe):Re}function pm(N){return N.length>10&&N[0]===73&&N[1]===68&&N[2]===51}var dm=(N)=>{let oe=(N[6]&127)<<21|(N[7]&127)<<14|(N[8]&127)<<7|N[9]&127;return N.subarray(oe+10)};function uf({data:N,signatures:oe}){let Ie=af(N,lm);if(pm(Ie))Ie=dm(af(N,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:N,topLevelType:oe}){if(oe===void 0)return uf({data:N,signatures:[...gf,...yf,..._f,...vf]});let Ie=mm[oe];if(Ie===void 0)return;return uf({data:N,signatures:Ie})}function z(N){let oe=N.indexOf("/");return oe===-1?N:N.substring(0,oe)}function K(N){let oe=N.indexOf("/");if(oe===-1)return!1;let Ie=N.substring(oe+1);return Ie.length>0&&Ie!=="*"}async function it(N){try{await N.body?.cancel()}catch{}}var bf="AI_DownloadError",xf=`vercel.ai.error.${bf}`,hm=Symbol.for(xf),B=class extends m{constructor({url:N,statusCode:oe,statusText:Ie,cause:Re,message:De=Re==null?`Failed to download ${N}: ${oe} ${Ie}`:`Failed to download ${N}: ${Re}`}){super({name:bf,message:De,cause:Re});this[hm]=!0,this.url=N,this.statusCode=oe,this.statusText=Ie}static isInstance(N){return m.hasMarker(N,xf)}};function gm(N=globalThis){return N.window!=null}function He(N,oe){try{return new URL(N).origin===new URL(oe).origin}catch{return!1}}function ym(N){let oe;try{oe=new URL(N)}catch{throw new B({url:N,message:`Invalid URL: ${N}`})}if(oe.protocol==="data:")return;if(oe.protocol!=="http:"&&oe.protocol!=="https:")throw new B({url:N,message:`URL scheme must be http, https, or data, got ${oe.protocol}`});let Ie=oe.hostname.toLowerCase().replace(/\.+$/,"");if(!Ie)throw new B({url:N,message:"URL must have a hostname"});if(Ie==="localhost"||Ie.endsWith(".local")||Ie.endsWith(".localhost")||Ie.endsWith(".internal"))throw new B({url:N,message:`URL with hostname ${Ie} is not allowed`});if(Ie.startsWith("[")&&Ie.endsWith("]")){if(wf(Ie.slice(1,-1)))throw new B({url:N,message:`URL with IPv6 address ${Ie} is not allowed`});return}if(Gi(Ie)){if(Xi(Ie))throw new B({url:N,message:`URL with IP address ${Ie} is not allowed`})}}function _m({address:N,family:oe,hostname:Ie}){if(oe===4?!Gi(N)||Xi(N):oe===6?wf(N):!0)throw new B({url:Ie,message:`Hostname ${Ie} resolved to disallowed IP address ${N}`})}function Gi(N){let oe=N.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(N){let[oe,Ie,Re]=N.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(N){let oe=N.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,tt,ft,gt]=Qe.split(".").map(Number);Be.push(et<<8|tt,ft<<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(N){let oe=vm(N);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(N){return(oe,Ie,Re)=>{N(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 N=globalThis.process;return N?.release?.name==="node"&&N.versions?.bun==null&&N.versions?.deno==null&&N.title!=="workerd"&&globalThis.EdgeRuntime==null}async function $m(){if(!wm())return globalThis.fetch;return xm??=Promise.resolve().then(zm)}function zm(){let N=lf("node:module"),{lookup:oe}=lf("node:dns"),{Agent:Ie,fetch:Re}=N.createRequire($f())("undici"),De=new Ie({connect:{lookup:bm(oe)}});return(Le,Ue)=>Re(Le,{...Ue,dispatcher:De})}function lf(N){let oe=globalThis.process?.getBuiltinModule?.(N);if(oe==null)throw Error(`Node.js built-in module ${N} is unavailable`);return oe}function $f(){let N=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=N}}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(N){let oe=new Headers(N);for(let Ie of Sm)oe.delete(Ie);return oe}var km=10,Pm=new Set([301,302,303,307,308]);async function Em(N){return N==null||N===globalThis.fetch?await $m():N}async function Sf({url:N,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=N;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),tt=await et(Xe,Be("manual"));if(tt.type==="opaqueredirect"){if(!gm())throw new B({url:N,message:`Redirect from ${Xe} could not be validated and was blocked`});return await et(Xe,Be("follow"))}let ft=tt.headers?.get("location");if(Pm.has(tt.status)&&ft){it(tt);let gt=new URL(ft,Xe).toString();if(Ue!==void 0&&!He(gt,Xe)){let bt=Ue.get("user-agent");Ue=new Headers(bt==null?void 0:{"user-agent":bt})}Xe=gt;continue}return tt}throw new B({url:N,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 $t({headers:N,credentialedOrigin:oe,untrustedFirstHopHeaders:Ie,...Re}){let De;if(N!==void 0){De=zf(N);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 Nt=2147483648;async function vt({response:N,url:oe,maxBytes:Ie=Nt}){let Re=N.headers.get("content-length");if(Re!=null){let Qe=parseInt(Re,10);if(!isNaN(Qe)&&Qe>Ie)throw await it(N),new B({url:oe,message:`Download of ${oe} exceeded maximum size of ${Ie} bytes (Content-Length: ${Qe}).`})}let De=N.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(N,oe){try{let Ie=await $t({url:N,abortSignal:oe?.abortSignal});if(!Ie.ok)throw await it(Ie),new B({url:N,statusCode:Ie.status,statusText:Ie.statusText});let Re=await vt({response:Ie,url:N,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:N,cause:Ie})}}var en=Symbol.for("vercel.ai.embeddingModel.maxInputBytesPerCall"),tn=Symbol.for("vercel.ai.embeddingModel.providerOptionsTransformer");function de(N){let oe=encodeURIComponent(N);return oe==="."?"%252E":oe===".."?"%252E%252E":oe}function Pe(...N){return N.filter((oe)=>oe!=null)}var V=({prefix:N,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(N==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()=>`${N}${Re}${De()}`},C=V(),Tm=()=>globalThis.fetch,R=async({url:N,headers:oe={},successfulResponseHandler:Ie,failedResponseHandler:Re,abortSignal:De,fetch:Le,validateUrl:Ue,credentialedOrigin:Be,trustedOrigin:Xe})=>{try{let Ye=Le??Tm(),Qe=F(Be!==void 0&&!He(N,Be)?{}:oe,`ai-sdk-provider-utils/${yo}`,ke()),et=Ue?await Sf({url:N,headers:Qe,abortSignal:De,fetch:Le,trustedOrigin:Xe}):await Ye(N,{method:"GET",headers:Qe,signal:De}),tt=wr(et);if(!et.ok){let ft;try{ft=await Re({response:et,url:N,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:N,responseHeaders:tt,requestBodyValues:{}})}throw ft.value}try{return await Ie({response:et,url:N,requestBodyValues:{}})}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:et.status,url:N,responseHeaders:tt,requestBodyValues:{}})}}catch(Ye){throw Nn({error:Ye,url:N,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:N,schema:oe,schemaPrefix:Ie=oe!=null?Zm:void 0,schemaSuffix:Re=oe!=null?Am:Im}){return[N!=null&&N.length>0?N:void 0,N!=null&&N.length>0?"":void 0,Ie,oe!=null?JSON.stringify(oe):void 0,Re].filter((De)=>De!=null).join(`
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:Ot}));break;default:Ie(new po(`Unknown field "${_t.length>20?`${_t.slice(0,20)}…`:_t}"`,{type:"unknown-field",field:_t,value:yt,line:Ot}));break}}function Pr(){et>0&&oe({id:Ye,event:tt,data:Qe}),Ye=void 0,Qe="",et=0,tt=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,tt=void 0,Ue.length=0,Be=0,ft=!1}return{feed:gt,reset:Mr}}function rf(N,oe,Ie){return Ie===100&&N.charCodeAt(oe+1)===97&&N.charCodeAt(oe+2)===116&&N.charCodeAt(oe+3)===97&&N.charCodeAt(oe+4)===58}function nf(N,oe,Ie){return Ie===101&&N.charCodeAt(oe+1)===118&&N.charCodeAt(oe+2)===101&&N.charCodeAt(oe+3)===110&&N.charCodeAt(oe+4)===116&&N.charCodeAt(oe+5)===58}class mo extends TransformStream{constructor({onError:N,onRetry:oe,onComment:Ie,maxBufferSize:Re}={}){let De;super({start(Le){De=of({onEvent:(Ue)=>{Le.enqueue(Ue)},onError(Ue){typeof N=="function"&&N(Ue),(N==="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 $e(N){return N===void 0?[]:Array.isArray(N)?N:[N]}function d(...N){return N.reduce((oe,Ie)=>({...oe,...Ie}),{})}function Qd(N){return Object.fromEntries(Object.entries(N).filter(([oe,Ie])=>Ie!=null))}async function Oe(N,oe){if(N==null)return;let Ie=oe?.abortSignal;return new Promise((Re,De)=>{if(Ie?.aborted){De(sf());return}let Le=setTimeout(()=>{Ue(),Re()},N),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(N){let oe=N??globalThis.WebSocket;if(oe==null)throw Error("No WebSocket implementation available.");return oe}function Lt(N){let oe=new URL(N);if(oe.protocol==="http:")oe.protocol="ws:";else if(oe.protocol==="https:")oe.protocol="wss:";return oe}var cf=new TextDecoder;async function tm(N){if(typeof N==="string")return N;if(N instanceof ArrayBuffer)return cf.decode(N);if(ArrayBuffer.isView(N))return cf.decode(N);if(typeof Blob<"u"&&N instanceof Blob)return N.text();return String(N)}var rm=1;async function ue(N,{highWaterMark:oe=1048576,pollIntervalMs:Ie=20,abortSignal:Re}={}){while(N.readyState===rm&&(N.bufferedAmount??0)>oe){if(Re?.aborted===!0)return;await Oe(Ie)}}function fe({url:N,protocols:oe,headers:Ie,webSocket:Re,abortSignal:De,onOpen:Le,onMessageText:Ue,onProcessingError:Be,onSocketError:Xe,onClose:Ye,onAbort:Qe}){let et,tt,ft=(St)=>{if(tt!=null)De?.removeEventListener("abort",tt),tt=void 0;try{et?.close(St)}catch{}};if(De?.aborted)return Qe?.(De.reason??Error("Aborted")),{socket:void 0,close:ft};try{et=new(em(Re))(N,oe,{headers:Qd(Ie??{})})}catch(St){return Be(St),{socket:void 0,close:ft}}if(De!=null&&Qe!=null)tt=()=>Qe(De.reason??Error("Aborted")),De.addEventListener("abort",tt,{once:!0});let gt=et;et.onopen=()=>{try{Le?.(gt)}catch(St){Be(St)}};let bt=Promise.resolve();return et.onmessage=(St)=>{bt=bt.then(()=>tm(St.data)).then((Et)=>Ue(Et)).catch(Be)},et.onerror=()=>{bt=bt.then(()=>Xe?.()).catch(Be)},et.onclose=(St)=>{let Et=St,rr=typeof Et?.code==="number"?Et.code:void 0,Pr=typeof Et?.reason==="string"?Et.reason:void 0;bt=bt.then(()=>Ye?.({code:rr,reason:Pr})).catch(Be)},{socket:et,close:ft}}function ae(N){let oe=!1;return new ReadableStream({async pull(Ie){if(oe)return;try{let{value:Re,done:De}=await N.next();if(De)Ie.close();else Ie.enqueue(Re)}catch(Re){Ie.error(Re)}},async cancel(Ie){if(oe=!0,N.return)try{await N.return(Ie)}catch{}}})}var{btoa:nm,atob:om}=globalThis;function j(N){let oe=N.replace(/-/g,"+").replace(/_/g,"/"),Ie=om(oe);return Uint8Array.from(Ie,(Re)=>Re.codePointAt(0))}function X(N){if(typeof globalThis.Buffer?.from==="function")return globalThis.Buffer.from(N.buffer,N.byteOffset,N.byteLength).toString("base64");let oe=[],Ie=4096;for(let Re=0;Re<N.length;Re+=Ie)oe.push(String.fromCodePoint(...N.subarray(Re,Re+Ie)));return nm(oe.join(""))}function M(N){return N instanceof Uint8Array?X(N):N}function we(N){if(N.type==="stream"){let oe=new u({functionality:"streaming file upload"});throw N.stream.cancel(oe).catch(()=>{}),oe}if(N.type==="text")return new TextEncoder().encode(N.text);if(N.data instanceof Uint8Array)return N.data;if(N.data instanceof ArrayBuffer)return new Uint8Array(N.data);return j(N.data)}function Yt(N){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===N){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===N){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 st(N,oe={}){let{useArrayBrackets:Ie=!0}=oe,Re=new FormData;for(let[De,Le]of Object.entries(N)){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:N,model:oe,created:Ie}){return{id:N??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:N=[],providerToolNames:oe}){let Ie={},Re={};for(let De of N)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:N,type:oe,code:Ie,statusCode:Re,isRetryable:De,data:Le}){let Ue={message:N,type:oe,code:Ie,statusCode:Re,isRetryable:De,data:Le};return Object.defineProperty(Ue,hf,{value:!0}),Ue}function at(N){return typeof N==="object"&&N!=null&&N[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((N,oe)=>{if(this.status.type==="resolved")N(this.status.value);else if(this.status.type==="rejected")oe(this.status.error);this._resolve=N,this._reject=oe}),this._promise}resolve(N){if(this.status={type:"resolved",value:N},this._promise)this._resolve?.(N)}reject(N){if(this.status={type:"rejected",error:N},this._promise)this._reject?.(N)}isResolved(){return this.status.type==="resolved"}isRejected(){return this.status.type==="rejected"}isPending(){return this.status.type==="pending"}};function wr(N){return Object.fromEntries([...N.headers])}function ke(N=globalThis){if(N.navigator?.userAgent)return N.navigator.userAgent.toLowerCase();if(N.process?.versions?.node)return`node.js/${N.process.version}`;if(N.EdgeRuntime)return"vercel-edge";return""}function Z(N){return(N instanceof Error||typeof DOMException==="function"&&N instanceof DOMException)&&(N.name==="AbortError"||N.name==="ResponseAborted"||N.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(N){let oe=new Set,Ie=N;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:N,url:oe,requestBodyValues:Ie}){if(Z(N))return N;if(N instanceof TypeError&&im.includes(N.message.toLowerCase())){let De=N.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(N);if(Re!=null){if(w.isInstance(N))return new w({message:N.message,cause:N.cause,url:N.url,requestBodyValues:N.requestBodyValues,statusCode:N.statusCode,responseHeaders:N.responseHeaders,responseBody:N.responseBody,data:N.data,isRetryable:!0});return new w({message:`Cannot connect to API: ${N instanceof Error?N.message:Re.message}`,cause:N,url:oe,requestBodyValues:Ie,isRetryable:!0})}return N}var yo="5.0.70";function qe(N){if(N==null)return{};let oe={};if(N instanceof Headers)N.forEach((Ie,Re)=>{oe[Re.toLowerCase()]=Ie});else{if(!Array.isArray(N))N=Object.entries(N);for(let[Ie,Re]of N)if(Re!=null)oe[Ie.toLowerCase()]=Re}return oe}function F(N,...oe){let Ie=new Headers(qe(N)),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:N,headers:oe={},failedResponseHandler:Ie,successfulResponseHandler:Re,abortSignal:De,fetch:Le=am()})=>{try{let Ue=await Le(N,{method:"DELETE",headers:F(oe,`ai-sdk-provider-utils/${yo}`,ke()),signal:De}),Be=wr(Ue);if(!Ue.ok){let Xe;try{Xe=await Ie({response:Ue,url:N,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:N,responseHeaders:Be,requestBodyValues:{}})}throw Xe.value}try{return await Re({response:Ue,url:N,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:N,responseHeaders:Be,requestBodyValues:{}})}}catch(Ue){throw Nn({error:Ue,url:N,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(N,oe){if(typeof N!=="string")return N.length>oe?N.subarray(0,oe):N;let Ie=Math.ceil(oe/3)*4,Re=j(N.substring(0,Math.min(N.length,Ie)));return Re.length>oe?Re.subarray(0,oe):Re}function pm(N){return N.length>10&&N[0]===73&&N[1]===68&&N[2]===51}var dm=(N)=>{let oe=(N[6]&127)<<21|(N[7]&127)<<14|(N[8]&127)<<7|N[9]&127;return N.subarray(oe+10)};function uf({data:N,signatures:oe}){let Ie=af(N,lm);if(pm(Ie))Ie=dm(af(N,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:N,topLevelType:oe}){if(oe===void 0)return uf({data:N,signatures:[...gf,...yf,..._f,...vf]});let Ie=mm[oe];if(Ie===void 0)return;return uf({data:N,signatures:Ie})}function z(N){let oe=N.indexOf("/");return oe===-1?N:N.substring(0,oe)}function K(N){let oe=N.indexOf("/");if(oe===-1)return!1;let Ie=N.substring(oe+1);return Ie.length>0&&Ie!=="*"}async function it(N){try{await N.body?.cancel()}catch{}}var bf="AI_DownloadError",xf=`vercel.ai.error.${bf}`,hm=Symbol.for(xf),B=class extends m{constructor({url:N,statusCode:oe,statusText:Ie,cause:Re,message:De=Re==null?`Failed to download ${N}: ${oe} ${Ie}`:`Failed to download ${N}: ${Re}`}){super({name:bf,message:De,cause:Re});this[hm]=!0,this.url=N,this.statusCode=oe,this.statusText=Ie}static isInstance(N){return m.hasMarker(N,xf)}};function gm(N=globalThis){return N.window!=null}function He(N,oe){try{return new URL(N).origin===new URL(oe).origin}catch{return!1}}function ym(N){let oe;try{oe=new URL(N)}catch{throw new B({url:N,message:`Invalid URL: ${N}`})}if(oe.protocol==="data:")return;if(oe.protocol!=="http:"&&oe.protocol!=="https:")throw new B({url:N,message:`URL scheme must be http, https, or data, got ${oe.protocol}`});let Ie=oe.hostname.toLowerCase().replace(/\.+$/,"");if(!Ie)throw new B({url:N,message:"URL must have a hostname"});if(Ie==="localhost"||Ie.endsWith(".local")||Ie.endsWith(".localhost")||Ie.endsWith(".internal"))throw new B({url:N,message:`URL with hostname ${Ie} is not allowed`});if(Ie.startsWith("[")&&Ie.endsWith("]")){if(wf(Ie.slice(1,-1)))throw new B({url:N,message:`URL with IPv6 address ${Ie} is not allowed`});return}if(Gi(Ie)){if(Xi(Ie))throw new B({url:N,message:`URL with IP address ${Ie} is not allowed`})}}function _m({address:N,family:oe,hostname:Ie}){if(oe===4?!Gi(N)||Xi(N):oe===6?wf(N):!0)throw new B({url:Ie,message:`Hostname ${Ie} resolved to disallowed IP address ${N}`})}function Gi(N){let oe=N.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(N){let[oe,Ie,Re]=N.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(N){let oe=N.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,tt,ft,gt]=Qe.split(".").map(Number);Be.push(et<<8|tt,ft<<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(N){let oe=vm(N);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(N){return(oe,Ie,Re)=>{N(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 N=globalThis.process;return N?.release?.name==="node"&&N.versions?.bun==null&&N.versions?.deno==null&&N.title!=="workerd"&&globalThis.EdgeRuntime==null}async function $m(){if(!wm())return globalThis.fetch;return xm??=Promise.resolve().then(zm)}function zm(){let N=lf("node:module"),{lookup:oe}=lf("node:dns"),{Agent:Ie,fetch:Re}=N.createRequire($f())("undici"),De=new Ie({connect:{lookup:bm(oe)}});return(Le,Ue)=>Re(Le,{...Ue,dispatcher:De})}function lf(N){let oe=globalThis.process?.getBuiltinModule?.(N);if(oe==null)throw Error(`Node.js built-in module ${N} is unavailable`);return oe}function $f(){let N=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=N}}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(N){let oe=new Headers(N);for(let Ie of Sm)oe.delete(Ie);return oe}var km=10,Pm=new Set([301,302,303,307,308]);async function Em(N){return N==null||N===globalThis.fetch?await $m():N}async function Sf({url:N,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=N;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),tt=await et(Xe,Be("manual"));if(tt.type==="opaqueredirect"){if(!gm())throw new B({url:N,message:`Redirect from ${Xe} could not be validated and was blocked`});return await et(Xe,Be("follow"))}let ft=tt.headers?.get("location");if(Pm.has(tt.status)&&ft){it(tt);let gt=new URL(ft,Xe).toString();if(Ue!==void 0&&!He(gt,Xe)){let bt=Ue.get("user-agent");Ue=new Headers(bt==null?void 0:{"user-agent":bt})}Xe=gt;continue}return tt}throw new B({url:N,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 Nt({headers:N,credentialedOrigin:oe,untrustedFirstHopHeaders:Ie,...Re}){let De;if(N!==void 0){De=zf(N);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 vt({response:N,url:oe,maxBytes:Ie=$t}){let Re=N.headers.get("content-length");if(Re!=null){let Qe=parseInt(Re,10);if(!isNaN(Qe)&&Qe>Ie)throw await it(N),new B({url:oe,message:`Download of ${oe} exceeded maximum size of ${Ie} bytes (Content-Length: ${Qe}).`})}let De=N.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(N,oe){try{let Ie=await Nt({url:N,abortSignal:oe?.abortSignal});if(!Ie.ok)throw await it(Ie),new B({url:N,statusCode:Ie.status,statusText:Ie.statusText});let Re=await vt({response:Ie,url:N,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:N,cause:Ie})}}var en=Symbol.for("vercel.ai.embeddingModel.maxInputBytesPerCall"),tn=Symbol.for("vercel.ai.embeddingModel.providerOptionsTransformer");function de(N){let oe=encodeURIComponent(N);return oe==="."?"%252E":oe===".."?"%252E%252E":oe}function Pe(...N){return N.filter((oe)=>oe!=null)}var V=({prefix:N,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(N==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()=>`${N}${Re}${De()}`},C=V(),Tm=()=>globalThis.fetch,R=async({url:N,headers:oe={},successfulResponseHandler:Ie,failedResponseHandler:Re,abortSignal:De,fetch:Le,validateUrl:Ue,credentialedOrigin:Be,trustedOrigin:Xe})=>{try{let Ye=Le??Tm(),Qe=F(Be!==void 0&&!He(N,Be)?{}:oe,`ai-sdk-provider-utils/${yo}`,ke()),et=Ue?await Sf({url:N,headers:Qe,abortSignal:De,fetch:Le,trustedOrigin:Xe}):await Ye(N,{method:"GET",headers:Qe,signal:De}),tt=wr(et);if(!et.ok){let ft;try{ft=await Re({response:et,url:N,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:N,responseHeaders:tt,requestBodyValues:{}})}throw ft.value}try{return await Ie({response:et,url:N,requestBodyValues:{}})}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:et.status,url:N,responseHeaders:tt,requestBodyValues:{}})}}catch(Ye){throw Nn({error:Ye,url:N,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:N,schema:oe,schemaPrefix:Ie=oe!=null?Zm:void 0,schemaSuffix:Re=oe!=null?Am:Im}){return[N!=null&&N.length>0?N:void 0,N!=null&&N.length>0?"":void 0,Ie,oe!=null?JSON.stringify(oe):void 0,Re].filter((De)=>De!=null).join(`
69
69
  `)}function jt({messages:N,schema:oe,schemaPrefix:Ie,schemaSuffix:Re}){let De=N[0]?.role==="system"?{...N[0]}:{role:"system",content:""};return De.content=Cm({prompt:De.content,schema:oe,schemaPrefix:Ie,schemaSuffix:Re}),[De,...N[0]?.role==="system"?N.slice(1):N]}function xt(N){return globalThis.Buffer?.isBuffer(N)??!1}function Fe(N){return N!=null}function nn(N){return typeof N==="object"&&N!==null&&!(N instanceof Uint8Array)&&!(N instanceof URL)&&!(N instanceof ArrayBuffer)&&!xt(N)&&!("type"in N)}function L(N){return N!=null&&typeof N==="object"&&!Array.isArray(N)}function Ze({mediaType:N,url:oe,supportedUrls:Ie}){N=N.toLowerCase();let Re=!N.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`${N}/`===De;return De.endsWith("/")?N.startsWith(De):N===De}).flatMap(({regexes:De})=>De).some((De)=>Nm(De,oe))}function Nm(N,oe){if(!N.global&&!N.sticky)return N.test(oe);let Ie=N.lastIndex;N.lastIndex=0;try{return N.test(oe)}finally{N.lastIndex=Ie}}function he({apiKey:N,environmentVariableName:oe,apiKeyParameterName:Ie="apiKey",description:Re}){if(typeof N==="string")return N;if(N!=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(N=process.env[oe],N==null)throw new Xr({message:`${Re} API key is missing. Pass it using the '${Ie}' parameter or the ${oe} environment variable.`});if(typeof N!=="string")throw new Xr({message:`${Re} API key must be a string. The value of the ${oe} environment variable is not a string.`});return N}function pe({settingValue:N,environmentVariableName:oe}){if(typeof N==="string")return N;if(N!=null||typeof process>"u")return;if(N=process.env[oe],N==null||typeof N!=="string")return;return N}function W(N){return N!==void 0&&N!=="provider-default"}function Se({reasoning:N,effortMap:oe,warnings:Ie}){let Re=oe[N];if(Re==null){Ie.push({type:"unsupported",feature:"reasoning",details:`reasoning "${N}" is not supported by this model.`});return}if(Re!==N)Ie.push({type:"compatibility",feature:"reasoning",details:`reasoning "${N}" 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 lt({reasoning:N,maxOutputTokens:oe,maxReasoningBudget:Ie,minReasoningBudget:Re=1024,budgetPercentages:De=Rm,warnings:Le}){let Ue=De[N];if(Ue==null){Le.push({type:"unsupported",feature:"reasoning",details:`reasoning "${N}" is not supported by this model.`});return}return Math.min(Ie,Math.max(Re,Math.round(oe*Ue)))}function ct(N){let[oe,Ie=""]=N.toLowerCase().split("/");return{mpeg:"mp3","x-wav":"wav",opus:"ogg",mp4:"m4a","x-m4a":"m4a"}[Ie]??Ie}function ge({total:N,pending:oe,completed:Ie,failed:Re}){if(ho(N)&&ho(oe)&&ho(Ie)&&ho(Re)&&oe+Ie+Re===N)return{total:N,pending:oe,completed:Ie,failed:Re}}function ho(N){return N!=null&&Number.isSafeInteger(N)&&N>=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(N){let oe=JSON.parse(N);if(oe===null||typeof oe!=="object")return oe;if(Dm.test(N)===!1&&Mm.test(N)===!1)return oe;return Lm(oe)}function Lm(N){let oe=[N];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 N}function Q(N){let{stackTraceLimit:oe}=Error;try{Error.stackTraceLimit=0}catch{return ff(N)}try{return ff(N)}finally{Error.stackTraceLimit=oe}}function Yi(N){if(N.type==="object"||Array.isArray(N.type)&&N.type.includes("object")){let{additionalProperties:Ie}=N;N.additionalProperties=Ie!=null&&typeof Ie!=="boolean"?Dr(Ie):!1;let{properties:Re}=N;if(Re!=null)for(let De of Object.keys(Re))Re[De]=Dr(Re[De])}if(N.items!=null)N.items=Array.isArray(N.items)?N.items.map(Dr):Dr(N.items);if(N.anyOf!=null)N.anyOf=N.anyOf.map(Dr);if(N.allOf!=null)N.allOf=N.allOf.map(Dr);if(N.oneOf!=null)N.oneOf=N.oneOf.map(Dr);let{definitions:oe}=N;if(oe!=null)for(let Ie of Object.keys(oe))oe[Ie]=Dr(oe[Ie]);return N}function Dr(N){if(typeof N==="boolean")return N;return Yi(N)}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=(N)=>typeof N==="string"?{...pf,name:N}:{...pf,...N};function mr(){return{}}function Um(N,oe){let Ie={type:"array"};if(N.type?._def&&N.type?._def?.typeName!=="ZodAny")Ie.items=Ct(N.type._def,{...oe,currentPath:[...oe.currentPath,"items"]});if(N.minLength)Ie.minItems=N.minLength.value;if(N.maxLength)Ie.maxItems=N.maxLength.value;if(N.exactLength)Ie.minItems=N.exactLength.value,Ie.maxItems=N.exactLength.value;return Ie}function Bm(N){let oe={type:"integer",format:"int64"};if(!N.checks)return oe;for(let Ie of N.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(N,oe){return Ct(N.type._def,oe)}var Vm=(N,oe)=>Ct(N.innerType._def,oe);function Pf(N,oe,Ie){let Re=Ie??oe.dateStrategy;if(Array.isArray(Re))return{anyOf:Re.map((De)=>Pf(N,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(N)}}var Wm=(N)=>{let oe={type:"integer",format:"unix-time"};for(let Ie of N.checks)switch(Ie.kind){case"min":oe.minimum=Ie.value;break;case"max":oe.maximum=Ie.value}return oe};function Km(N,oe){return{...Ct(N.innerType._def,oe),default:N.defaultValue()}}function Hm(N,oe){return oe.effectStrategy==="input"?Ct(N.schema._def,oe):mr()}function qm(N){return{type:"string",enum:Array.from(N.values)}}var Gm=(N)=>{if("type"in N&&N.type==="string")return!1;return"allOf"in N};function Xm(N,oe){let Ie=[Ct(N.left._def,{...oe,currentPath:[...oe.currentPath,"allOf","0"]}),Ct(N.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(N){let oe=typeof N.value;if(oe!=="bigint"&&oe!=="number"&&oe!=="boolean"&&oe!=="string")return{type:Array.isArray(N.value)?"array":"object"};return{type:oe==="bigint"?"integer":oe,const:N.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(N,oe){let Ie={type:"string"};if(N.checks)for(let Re of N.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(N,oe){return oe.patternStrategy==="escape"?eh(N):N}var Qm=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function eh(N){let oe="";for(let Ie=0;Ie<N.length;Ie++){if(!Qm.has(N[Ie]))oe+="\\";oe+=N[Ie]}return oe}function br(N,oe,Ie,Re){if(N.format||N.anyOf?.some((De)=>De.format)){if(!N.anyOf)N.anyOf=[];if(N.format)N.anyOf.push({format:N.format}),delete N.format;N.anyOf.push({format:oe,...Ie&&Re.errorMessages&&{errorMessage:{format:Ie}}})}else N.format=oe}function ur(N,oe,Ie,Re){if(N.pattern||N.allOf?.some((De)=>De.pattern)){if(!N.allOf)N.allOf=[];if(N.pattern)N.allOf.push({pattern:N.pattern}),delete N.pattern;N.allOf.push({pattern:df(oe,Re),...Ie&&Re.errorMessages&&{errorMessage:{pattern:Ie}}})}else N.pattern=df(oe,Re)}function df(N,oe){if(!oe.applyRegexFlags||!N.flags)return N.source;let Ie={i:N.flags.includes("i"),m:N.flags.includes("m"),s:N.flags.includes("s")},Re=Ie.i?N.source.toLowerCase():N.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
70
  ]))`;continue}else if(Re[Xe]==="$"){De+=`($|(?=[\r
71
71
  ]))`;continue}}if(Ie.s&&Re[Xe]==="."){De+=Ue?`${Re[Xe]}\r
@@ -80,4 +80,4 @@ Content-Type: ${Qe}\r
80
80
  `),Be.content instanceof Uint8Array)yield Be.content;else{let et=Be.content.getReader();De=et,Le.add(Be.content);let tt=!1;try{while(!0){let{done:ft,value:gt}=await et.read();if(ft||Re){tt=ft;break}yield gt}}finally{if(De=void 0,!tt)await et.cancel().catch(()=>{});et.releaseLock()}if(Re)return}yield Ie.encode(`\r
81
81
  `)}yield Ie.encode(`--${oe}--\r
82
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 N)if(Ye.type==="file"&&!(Ye.content instanceof Uint8Array)&&!Le.has(Ye.content))await Ye.content.cancel(Be).catch(()=>{})}}}var rn=async({url:N,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(N,{method:"POST",headers:F({...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 tt;try{tt=await Re({response:Qe,url:N,requestBodyValues:Xe})}catch(ft){if(Z(ft)||w.isInstance(ft))throw ft;throw new w({message:"Failed to process error response",cause:ft,statusCode:Qe.status,url:N,responseHeaders:et,requestBodyValues:Xe})}throw tt.value}try{return await De({response:Qe,url:N,requestBodyValues:Xe})}catch(tt){if(tt instanceof Error){if(Z(tt)||w.isInstance(tt))throw tt}throw new w({message:"Failed to process successful response",cause:tt,statusCode:Qe.status,url:N,responseHeaders:et,requestBodyValues:Xe})}}catch(Qe){throw await Ye.dispose(Qe),Nn({error:Qe,url:N,requestBodyValues:Xe})}},Ch=()=>globalThis.fetch,g=async({url:N,headers:oe,body:Ie,failedResponseHandler:Re,successfulResponseHandler:De,abortSignal:Le,fetch:Ue})=>await ve({url:N,headers:{"Content-Type":"application/json",...oe},body:{content:JSON.stringify(Ie),values:Ie},failedResponseHandler:Re,successfulResponseHandler:De,abortSignal:Le,fetch:Ue}),ne=async({url:N,headers:oe,formData:Ie,failedResponseHandler:Re,successfulResponseHandler:De,abortSignal:Le,fetch:Ue})=>await ve({url:N,headers:oe,body:{content:Ie,values:Object.fromEntries(Ie.entries())},failedResponseHandler:Re,successfulResponseHandler:De,abortSignal:Le,fetch:Ue}),ve=async({url:N,headers:oe={},body:Ie,successfulResponseHandler:Re,failedResponseHandler:De,abortSignal:Le,fetch:Ue=Ch()})=>{try{let Be=await Ue(N,{method:"POST",headers:F(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:N,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:N,responseHeaders:Xe,requestBodyValues:Ie.values})}throw Ye.value}try{return await Re({response:Be,url:N,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:N,responseHeaders:Xe,requestBodyValues:Ie.values})}}catch(Be){throw Nn({error:Be,url:N,requestBodyValues:Ie.values})}};function Qi(N){return N}function re({id:N,inputSchema:oe}){return({execute:Ie,outputSchema:Re,needsApproval:De,toModelOutput:Le,onInputStart:Ue,onInputDelta:Be,onInputAvailable:Xe,...Ye})=>Qi({type:"provider",isProviderExecuted:!1,id:N,args:Ye,inputSchema:oe,outputSchema:Re,execute:Ie,needsApproval:De,toModelOutput:Le,onInputStart:Ue,onInputDelta:Be,onInputAvailable:Xe})}function Je({id:N,inputSchema:oe,outputSchema:Ie}){return({execute:Re,needsApproval:De,toModelOutput:Le,onInputStart:Ue,onInputDelta:Be,onInputAvailable:Xe,...Ye})=>Qi({type:"provider",isProviderExecuted:!1,id:N,args:Ye,inputSchema:oe,outputSchema:Ie,execute:Re,needsApproval:De,toModelOutput:Le,onInputStart:Ue,onInputDelta:Be,onInputAvailable:Xe})}function S({id:N,inputSchema:oe,outputSchema:Ie,supportsDeferredResults:Re}){return({onInputStart:De,onInputDelta:Le,onInputAvailable:Ue,...Be})=>Qi({type:"provider",isProviderExecuted:!0,id:N,args:Be,inputSchema:oe,outputSchema:Ie,onInputStart:De,onInputDelta:Le,onInputAvailable:Ue,supportsDeferredResults:Re})}async function _(N){if(typeof N==="function")N=N();return N}function O({part:N}){if(K(N.mediaType))return N.mediaType;if(N.data.type==="data"){let oe=Te({data:N.data.data,topLevelType:z(N.mediaType)});if(oe)return oe;throw new u({functionality:`file of media type "${N.mediaType}" must specify subtype since it could not be auto-detected`})}throw new u({functionality:`file of media type "${N.mediaType}" must specify subtype since it is not passed as inline bytes`})}function H({reference:N,provider:oe}){let Ie=N[oe];if(Ie!=null)return Ie;throw new ws({provider:oe,reference:N})}var on=({maxRetries:N=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:N,delayInMs:oe,backoffFactor:Ie,abortSignal:Re,shouldRetry:De,getDelayInMs:Le,createRetryError:Ue});async function Tf(N,{maxRetries:oe,delayInMs:Ie,backoffFactor:Re,abortSignal:De,shouldRetry:Le,getDelayInMs:Ue,createRetryError:Be},Xe=[]){try{return await N()}catch(Ye){if(Z(Ye))throw Ye;if(oe===0)throw Ye;let Qe=A(Ye),et=[...Xe,Ye],tt=et.length;if(tt>oe)throw Be({message:`Failed after ${tt} attempts. Last error: ${Qe}`,reason:"maxRetriesExceeded",errors:et});if(await Le(Ye)&&tt<=oe)return await Oe(Ue({error:Ye,exponentialBackoffDelay:Ie}),{abortSignal:De}),Tf(N,{maxRetries:oe,delayInMs:Re*Ie,backoffFactor:Re,abortSignal:De,shouldRetry:Le,getDelayInMs:Ue,createRetryError:Be},et);if(tt===1)throw Ye;throw Be({message:`Failed after ${tt} attempts with non-retryable error: '${Qe}'`,reason:"errorNotRetryable",errors:et})}}var Nh=new TextDecoder,Rh=67108864;function Zf({stream:N,url:oe,requestBodyValues:Ie,statusCode:Re,responseHeaders:De}){let Le=N.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:N,url:oe}){return Nh.decode(await vt({response:N,url:oe}))}var I=({errorSchema:N,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 ut({text:Ue,schema:N});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=(N)=>async({response:oe,url:Ie,requestBodyValues:Re})=>{let De=wr(oe);if(oe.body==null)throw new Dn({});return{responseHeaders:De,value:dt({stream:Zf({stream:oe.body,url:Ie,requestBodyValues:Re,statusCode:oe.status,responseHeaders:De}),schema:N})}},p=(N)=>async({response:oe,url:Ie,requestBodyValues:Re})=>{let De=await es({response:oe,url:Ie}),Le=await J({text:De,schema:N}),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=(N,{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:N,url:Re,maxLineBytes:oe})}}};async function*Dh({stream:N,schema:oe,url:Ie,maxLineBytes:Re}){let De=N.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 tt=0;while(tt<et.length){let ft=et.indexOf(10,tt),gt=ft===-1?et.length:ft;if(Be+=gt-tt,Be>Re)throw new B({message:`JSON Lines response exceeded maximum line size of ${Re} bytes.`,url:Ie});let bt=ft===-1?gt:ft+1;if(Ue+=Le.decode(et.subarray(tt,bt),{stream:!0}),ft===-1)break;let St=Ue.slice(0,-1).replace(/\r$/,"");if(Ue="",Be=0,tt=bt,St.trim().length>0)yield await ut({text:St,schema:oe})}}let Ye=Ue.replace(/\r$/,"");if(Ye.trim().length>0)yield await ut({text:Ye,schema:oe})}finally{if(!Xe)await De.cancel().catch(()=>{});De.releaseLock()}}var pt=()=>async({response:N,url:oe,requestBodyValues:Ie})=>{let Re=wr(N);if(!N.body)throw new w({message:"Response body is empty",url:oe,requestBodyValues:Ie,statusCode:N.status,responseHeaders:Re,responseBody:void 0});try{let De=await N.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:N.status,responseHeaders:Re,responseBody:void 0,cause:De})}},sn=()=>async({response:N,url:oe,requestBodyValues:Ie})=>{let Re=wr(N);if(N.body==null)throw new Dn({});return{responseHeaders:Re,value:Zf({stream:N.body,url:oe,requestBodyValues:Ie,statusCode:N.status,responseHeaders:Re})}},an=()=>async({response:N,url:oe,requestBodyValues:Ie})=>{let Re=wr(N),De=await es({response:N,url:oe});return{responseHeaders:Re,value:new w({message:N.statusText,url:oe,requestBodyValues:Ie,statusCode:N.status,responseHeaders:Re,responseBody:De})}};function go(N){if(N===null||N===void 0)return!0;let oe=typeof N;if(oe==="string"||oe==="number"||oe==="boolean")return!0;if(oe==="function"||oe==="symbol"||oe==="bigint")return!1;if(Array.isArray(N))return N.every(go);if(Object.getPrototypeOf(N)===Object.prototype)return Object.values(N).every(go);return!1}var Af="AI_SerializationError",If=`vercel.ai.error.${Af}`,Mh=Symbol.for(If),Lh=class extends m{constructor({message:N="Failed to serialize value.",cause:oe}={}){super({name:Af,message:N,cause:oe});this[Mh]=!0}static isInstance(N){return m.hasMarker(N,If)}};function E(N){let oe={};for(let[Ie,Re]of Object.entries(N.config))if(Ie==="headers"){let De=jh(Re);if(go(De))oe[Ie]=De}else if(go(Re))oe[Ie]=Re;return{modelId:N.modelId,config:oe}}function jh(N){let oe=N;if(typeof N==="function")oe=N();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(N){let oe;try{oe=Q(N)}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(N){return typeof N==="string"}function Ir(N,oe){return N===void 0||oe(N)}var Fh=new Set(["compatibility","deprecated","other","unsupported"]);function Uh(N){return L(N)&&kr(N.type)&&!Fh.has(N.type)}function Bh(N){if(!L(N))return!1;switch(N.type){case"compatibility":case"unsupported":return kr(N.feature)&&Ir(N.details,kr);case"deprecated":return kr(N.setting)&&kr(N.message);case"other":return kr(N.message);default:return!1}}function Jh(N){return L(N)&&kr(N.type)&&N.type.length>0&&Ir(N.rate,(oe)=>typeof oe==="number"&&Number.isFinite(oe)&&oe>0)}function Vh(N){return L(N)&&["inputCharacters","inputTokens","outputTokens"].every((oe)=>Ir(N[oe],(Ie)=>typeof Ie==="number"))}function Wh(N){if(typeof N!=="string")return!1;let oe=N.trimStart()[0];return oe==="{"||oe==="["}var Kh=class{constructor(N=""){this.structure={kind:"undetermined"},this.append(N)}get hasCompleteStructuredValue(){return this.structure.kind==="structured"&&this.structure.complete===!0}append(N){let oe=this.structure;for(let Ie of N){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(N,oe={}){this.toolCalls=[],this.toolCallsById=new Map,this.toolCallsByIndex=new Map,this.usedToolCallIds=new Set,this.nextGeneratedIdSuffixes=new Map,this.controller=N,this._generateId=oe.generateId??C,this.typeValidation=oe.typeValidation??"none",this.extractMetadata=oe.extractMetadata,this.buildToolCallProviderMetadata=oe.buildToolCallProviderMetadata}processDelta(N){let oe=N.function?.name,Ie=typeof oe==="string"&&oe.trim().length===0,Re=this.getNonBlankString(N.id),De=this.getNonBlankString(oe),Le=N.function?.arguments,{index:Ue}=N,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(N,{wireId:Re,index:Ue,name:De})}else{if(Xe=Be.toolCall,Re!=null)this.associateWireId(Xe,Re);this.processExistingToolCall(Xe,N)}if(Ue!=null)this.associateIndex(Xe,Ue)}flush(){let N=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 N)if(!oe.hasFinished)this.finishToolCall(oe)}resolveToolCall({wireId:N,index:oe,name:Ie,hasExplicitCallStart:Re,hasEmptyArguments:De}){let Le=oe!=null?this.toolCallsByIndex.get(oe):void 0,Ue=this.filterToolCallsByName(Le,Ie);if(N!=null){let Xe=this.toolCallsById.get(N);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(N,oe){if(N==null)return[];return[...N].filter((Ie)=>oe==null||Ie.function.name===oe)}resolveMatchingToolCall(N,oe){if(N.length===0)return{kind:"new"};let Ie=N.filter((Re)=>!Re.argumentState.hasCompleteStructuredValue);if(!oe&&N.length===1)return{kind:"existing",toolCall:N[0]};if(Ie.length===1)return{kind:"existing",toolCall:Ie[0]};if(Ie.length>1||!oe)return{kind:"ambiguous"};return{kind:"new"}}processNewToolCall(N,{wireId:oe,index:Ie,name:Re}){if(this.typeValidation==="required"){if(N.type!=="function")throw new P({data:N,message:"Expected 'function' type."})}else if(this.typeValidation==="if-present"){if(N.type!=null&&N.type!=="function")throw new P({data:N,message:"Expected 'function' type."})}if(Re==null)throw new P({data:N,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?.(N),Ue=N.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(N,oe){let Ie=this.toolCallsById.get(oe);if(Ie==null)Ie=new Set,this.toolCallsById.set(oe,Ie);Ie.add(N)}associateIndex(N,oe){let Ie=this.toolCallsByIndex.get(oe);if(Ie==null)Ie=new Set,this.toolCallsByIndex.set(oe,Ie);Ie.add(N)}createToolCallId(N){if(N!=null&&!this.usedToolCallIds.has(N))return this.usedToolCallIds.add(N),N;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(N){return N!=null&&N.trim().length>0?N:void 0}processExistingToolCall(N,oe){if(N.hasFinished)return;if(oe.function?.arguments!=null)N.argumentState.append(oe.function.arguments),N.function.arguments+=oe.function.arguments,this.controller.enqueue({type:"tool-input-delta",id:N.id,delta:oe.function.arguments})}finishToolCall(N){this.controller.enqueue({type:"tool-input-end",id:N.id});let oe=this.buildToolCallProviderMetadata?.(N.metadata);this.controller.enqueue({type:"tool-call",toolCallId:N.id,toolName:N.function.name,input:N.function.arguments,...oe?{providerMetadata:oe}:{}}),N.hasFinished=!0}};var pn="transcription-stream.start",mn="transcription-stream.audio-done";function fn(N){let oe;try{oe=Q(N)}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(N){return typeof N==="string"}function Ar(N){return typeof N==="number"}function sr(N,oe){return N===void 0||oe(N)}function Hh(N){return L(N)&&xr(N.type)}function qh(N){return L(N)&&xr(N.text)&&Ar(N.startSecond)&&Ar(N.endSecond)}function mt(N){if(N?.trim()==="")throw new b({argument:"baseURL",message:"baseURL must be a non-empty string."});return N}function Y(N){return N?.replace(/\/$/,"")}function qt(N){return N!=null&&typeof N.execute==="function"}function Gh(N){return N!=null&&typeof N[Symbol.asyncIterator]==="function"}async function*hn({tool:N,input:oe,options:Ie}){let Re=N.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(N,oe){return Object.defineProperty({...N},"experimental_toolCaller",{value:oe})}function kt(N){return N?.experimental_toolCaller}
83
- export{m,Bt,w,A,b,ye,P,Ee,Ge,me,be,u,nt,Ut,Gt,Vt,Wt,Ht,rt,Ve,Pt,e,wt,r,Rt,c,Zt,We,ie,v,Ae,Jt,o,t,se,U,l,f,ot,ce,y,bn,i,n,$e,Kt,Qt,G,k,T,Ne,d,Oe,Lt,ue,fe,ae,j,X,M,we,Yt,st,ee,te,le,xe,at,je,ke,Z,qe,F,Xt,Te,z,K,it,B,He,$t,Nt,vt,Me,en,tn,de,Pe,V,C,R,jt,xt,Fe,nn,L,Ze,he,pe,W,Se,lt,ct,ge,Q,a,ze,s,x,q,ut,J,dt,h,rn,g,ne,ve,re,Je,S,_,O,H,on,I,D,p,_e,pt,sn,an,E,ln,cn,un,dn,Ce,pn,mn,fn,mt,Y,qt,hn,Ke,kt};
83
+ export{m,Bt,w,A,b,ye,P,Ee,Ge,me,be,u,nt,Ut,Gt,Vt,Wt,Ht,rt,Ve,Pt,e,wt,r,Rt,c,Zt,We,ie,v,Ae,Jt,o,t,se,U,l,f,ot,ce,y,bn,i,n,Ne,Kt,Qt,G,k,T,$e,d,Oe,Lt,ue,fe,ae,j,X,M,we,Yt,st,ee,te,le,xe,at,je,ke,Z,qe,F,Xt,Te,z,K,it,B,He,Nt,$t,vt,Me,en,tn,de,Pe,V,C,R,jt,xt,Fe,nn,L,Ze,he,pe,W,Se,lt,ct,ge,Q,a,ze,s,x,q,ut,J,dt,h,rn,g,ne,ve,re,Je,S,_,O,H,on,I,D,p,_e,pt,sn,an,E,ln,cn,un,dn,Ce,pn,mn,fn,mt,Y,qt,hn,Ke,kt};
@@ -1,4 +1,4 @@
1
- import{Bt,b,P,Ee,be,u,rt,Ve,k,T}from"./embed-3swpcbya.js";function Q(e){let t=e.indexOf("/");return t===-1?e:e.substring(0,t)}var W=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,K=/"(?: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 R(e){let t=JSON.parse(e);if(t===null||typeof t!=="object")return t;if(W.test(e)===!1&&K.test(e)===!1)return t;return G(t)}function G(e){let t=[e];while(t.length){let r=t;t=[];for(let n of r){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&n.constructor!==null&&typeof n.constructor==="object"&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let a in n){let i=n[a];if(i&&typeof i==="object")t.push(i)}}}return e}function H(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return R(e)}try{return R(e)}finally{Error.stackTraceLimit=t}}function I(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){let{additionalProperties:r}=e;e.additionalProperties=r!=null&&typeof r!=="boolean"?_(r):!1;let{properties:n}=e;if(n!=null)for(let a of Object.keys(n))n[a]=_(n[a])}if(e.items!=null)e.items=Array.isArray(e.items)?e.items.map(_):_(e.items);if(e.anyOf!=null)e.anyOf=e.anyOf.map(_);if(e.allOf!=null)e.allOf=e.allOf.map(_);if(e.oneOf!=null)e.oneOf=e.oneOf.map(_);let{definitions:t}=e;if(t!=null)for(let r of Object.keys(t))t[r]=_(t[r]);return e}function _(e){if(typeof e==="boolean")return e;return I(e)}var X=Symbol("Let zodToJsonSchema decide on which parser to use"),M={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"},Y=(e)=>typeof e==="string"?{...M,name:e}:{...M,...e};function y(){return{}}function ee(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!=="ZodAny")r.items=l(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)r.minItems=e.minLength.value;if(e.maxLength)r.maxItems=e.maxLength.value;if(e.exactLength)r.minItems=e.exactLength.value,r.maxItems=e.exactLength.value;return r}function te(e){let t={type:"integer",format:"int64"};if(!e.checks)return t;for(let r of e.checks)switch(r.kind){case"min":if(r.inclusive)t.minimum=r.value;else t.exclusiveMinimum=r.value;break;case"max":if(r.inclusive)t.maximum=r.value;else t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}function re(){return{type:"boolean"}}function J(e,t){return l(e.type._def,t)}var ne=(e,t)=>l(e.innerType._def,t);function V(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a)=>V(e,t,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ae(e)}}var ae=(e)=>{let t={type:"integer",format:"unix-time"};for(let r of e.checks)switch(r.kind){case"min":t.minimum=r.value;break;case"max":t.maximum=r.value}return t};function ie(e,t){return{...l(e.innerType._def,t),default:e.defaultValue()}}function oe(e,t){return t.effectStrategy==="input"?l(e.schema._def,t):y()}function se(e){return{type:"string",enum:Array.from(e.values)}}var ce=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function ue(e,t){let r=[l(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),l(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((a)=>!!a),n=[];return r.forEach((a)=>{if(ce(a))n.push(...a.allOf);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:o,...p}=a;i=p}n.push(i)}}),n.length?{allOf:n}:void 0}function le(e){let t=typeof e.value;if(t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string")return{type:Array.isArray(e.value)?"array":"object"};return{type:t==="bigint"?"integer":t,const:e.value}}var j=void 0,h={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(j===void 0)j=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return j},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 U(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":r.minLength=typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength=typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":g(r,"email",n.message,t);break;case"format:idn-email":g(r,"idn-email",n.message,t);break;case"pattern:zod":m(r,h.email,n.message,t)}break;case"url":g(r,"uri",n.message,t);break;case"uuid":g(r,"uuid",n.message,t);break;case"regex":m(r,n.regex,n.message,t);break;case"cuid":m(r,h.cuid,n.message,t);break;case"cuid2":m(r,h.cuid2,n.message,t);break;case"startsWith":m(r,RegExp(`^${E(n.value,t)}`),n.message,t);break;case"endsWith":m(r,RegExp(`${E(n.value,t)}$`),n.message,t);break;case"datetime":g(r,"date-time",n.message,t);break;case"date":g(r,"date",n.message,t);break;case"time":g(r,"time",n.message,t);break;case"duration":g(r,"duration",n.message,t);break;case"length":r.minLength=typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,r.maxLength=typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value;break;case"includes":m(r,RegExp(E(n.value,t)),n.message,t);break;case"ip":if(n.version!=="v6")g(r,"ipv4",n.message,t);if(n.version!=="v4")g(r,"ipv6",n.message,t);break;case"base64url":m(r,h.base64url,n.message,t);break;case"jwt":m(r,h.jwt,n.message,t);break;case"cidr":if(n.version!=="v6")m(r,h.ipv4Cidr,n.message,t);if(n.version!=="v4")m(r,h.ipv6Cidr,n.message,t);break;case"emoji":m(r,h.emoji(),n.message,t);break;case"ulid":m(r,h.ulid,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":g(r,"binary",n.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":m(r,h.base64,n.message,t)}break;case"nanoid":m(r,h.nanoid,n.message,t)}return r}function E(e,t){return t.patternStrategy==="escape"?de(e):e}var pe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function de(e){let t="";for(let r=0;r<e.length;r++){if(!pe.has(e[r]))t+="\\";t+=e[r]}return t}function g(e,t,r,n){if(e.format||e.anyOf?.some((a)=>a.format)){if(!e.anyOf)e.anyOf=[];if(e.format)e.anyOf.push({format:e.format}),delete e.format;e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})}else e.format=t}function m(e,t,r,n){if(e.pattern||e.allOf?.some((a)=>a.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern)e.allOf.push({pattern:e.pattern}),delete e.pattern;e.allOf.push({pattern:C(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})}else e.pattern=C(t,n)}function C(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,a="",i=!1,o=!1,p=!1;for(let s=0;s<n.length;s++){if(i){a+=n[s],i=!1;continue}if(r.i){if(o){if(n[s].match(/[a-z]/)){if(p)a+=n[s],a+=`${n[s-2]}-${n[s]}`.toUpperCase(),p=!1;else if(n[s+1]==="-"&&n[s+2]?.match(/[a-z]/))a+=n[s],p=!0;else a+=`${n[s]}${n[s].toUpperCase()}`;continue}}else if(n[s].match(/[a-z]/)){a+=`[${n[s]}${n[s].toUpperCase()}]`;continue}}if(r.m){if(n[s]==="^"){a+=`(^|(?<=[\r
1
+ import{Bt,b,P,Ee,be,u,rt,Ve,k,T}from"./embed-52n5pm9t.js";function Q(e){let t=e.indexOf("/");return t===-1?e:e.substring(0,t)}var W=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,K=/"(?: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 R(e){let t=JSON.parse(e);if(t===null||typeof t!=="object")return t;if(W.test(e)===!1&&K.test(e)===!1)return t;return G(t)}function G(e){let t=[e];while(t.length){let r=t;t=[];for(let n of r){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&n.constructor!==null&&typeof n.constructor==="object"&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw SyntaxError("Object contains forbidden prototype property");for(let a in n){let i=n[a];if(i&&typeof i==="object")t.push(i)}}}return e}function H(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return R(e)}try{return R(e)}finally{Error.stackTraceLimit=t}}function I(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){let{additionalProperties:r}=e;e.additionalProperties=r!=null&&typeof r!=="boolean"?_(r):!1;let{properties:n}=e;if(n!=null)for(let a of Object.keys(n))n[a]=_(n[a])}if(e.items!=null)e.items=Array.isArray(e.items)?e.items.map(_):_(e.items);if(e.anyOf!=null)e.anyOf=e.anyOf.map(_);if(e.allOf!=null)e.allOf=e.allOf.map(_);if(e.oneOf!=null)e.oneOf=e.oneOf.map(_);let{definitions:t}=e;if(t!=null)for(let r of Object.keys(t))t[r]=_(t[r]);return e}function _(e){if(typeof e==="boolean")return e;return I(e)}var X=Symbol("Let zodToJsonSchema decide on which parser to use"),M={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"},Y=(e)=>typeof e==="string"?{...M,name:e}:{...M,...e};function y(){return{}}function ee(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!=="ZodAny")r.items=l(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)r.minItems=e.minLength.value;if(e.maxLength)r.maxItems=e.maxLength.value;if(e.exactLength)r.minItems=e.exactLength.value,r.maxItems=e.exactLength.value;return r}function te(e){let t={type:"integer",format:"int64"};if(!e.checks)return t;for(let r of e.checks)switch(r.kind){case"min":if(r.inclusive)t.minimum=r.value;else t.exclusiveMinimum=r.value;break;case"max":if(r.inclusive)t.maximum=r.value;else t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}function re(){return{type:"boolean"}}function J(e,t){return l(e.type._def,t)}var ne=(e,t)=>l(e.innerType._def,t);function V(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a)=>V(e,t,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ae(e)}}var ae=(e)=>{let t={type:"integer",format:"unix-time"};for(let r of e.checks)switch(r.kind){case"min":t.minimum=r.value;break;case"max":t.maximum=r.value}return t};function ie(e,t){return{...l(e.innerType._def,t),default:e.defaultValue()}}function oe(e,t){return t.effectStrategy==="input"?l(e.schema._def,t):y()}function se(e){return{type:"string",enum:Array.from(e.values)}}var ce=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function ue(e,t){let r=[l(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),l(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((a)=>!!a),n=[];return r.forEach((a)=>{if(ce(a))n.push(...a.allOf);else{let i=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:o,...p}=a;i=p}n.push(i)}}),n.length?{allOf:n}:void 0}function le(e){let t=typeof e.value;if(t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string")return{type:Array.isArray(e.value)?"array":"object"};return{type:t==="bigint"?"integer":t,const:e.value}}var j=void 0,h={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(j===void 0)j=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return j},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 U(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":r.minLength=typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength=typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":g(r,"email",n.message,t);break;case"format:idn-email":g(r,"idn-email",n.message,t);break;case"pattern:zod":m(r,h.email,n.message,t)}break;case"url":g(r,"uri",n.message,t);break;case"uuid":g(r,"uuid",n.message,t);break;case"regex":m(r,n.regex,n.message,t);break;case"cuid":m(r,h.cuid,n.message,t);break;case"cuid2":m(r,h.cuid2,n.message,t);break;case"startsWith":m(r,RegExp(`^${E(n.value,t)}`),n.message,t);break;case"endsWith":m(r,RegExp(`${E(n.value,t)}$`),n.message,t);break;case"datetime":g(r,"date-time",n.message,t);break;case"date":g(r,"date",n.message,t);break;case"time":g(r,"time",n.message,t);break;case"duration":g(r,"duration",n.message,t);break;case"length":r.minLength=typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,r.maxLength=typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value;break;case"includes":m(r,RegExp(E(n.value,t)),n.message,t);break;case"ip":if(n.version!=="v6")g(r,"ipv4",n.message,t);if(n.version!=="v4")g(r,"ipv6",n.message,t);break;case"base64url":m(r,h.base64url,n.message,t);break;case"jwt":m(r,h.jwt,n.message,t);break;case"cidr":if(n.version!=="v6")m(r,h.ipv4Cidr,n.message,t);if(n.version!=="v4")m(r,h.ipv6Cidr,n.message,t);break;case"emoji":m(r,h.emoji(),n.message,t);break;case"ulid":m(r,h.ulid,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":g(r,"binary",n.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":m(r,h.base64,n.message,t)}break;case"nanoid":m(r,h.nanoid,n.message,t)}return r}function E(e,t){return t.patternStrategy==="escape"?de(e):e}var pe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function de(e){let t="";for(let r=0;r<e.length;r++){if(!pe.has(e[r]))t+="\\";t+=e[r]}return t}function g(e,t,r,n){if(e.format||e.anyOf?.some((a)=>a.format)){if(!e.anyOf)e.anyOf=[];if(e.format)e.anyOf.push({format:e.format}),delete e.format;e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})}else e.format=t}function m(e,t,r,n){if(e.pattern||e.allOf?.some((a)=>a.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern)e.allOf.push({pattern:e.pattern}),delete e.pattern;e.allOf.push({pattern:C(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})}else e.pattern=C(t,n)}function C(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,a="",i=!1,o=!1,p=!1;for(let s=0;s<n.length;s++){if(i){a+=n[s],i=!1;continue}if(r.i){if(o){if(n[s].match(/[a-z]/)){if(p)a+=n[s],a+=`${n[s-2]}-${n[s]}`.toUpperCase(),p=!1;else if(n[s+1]==="-"&&n[s+2]?.match(/[a-z]/))a+=n[s],p=!0;else a+=`${n[s]}${n[s].toUpperCase()}`;continue}}else if(n[s].match(/[a-z]/)){a+=`[${n[s]}${n[s].toUpperCase()}]`;continue}}if(r.m){if(n[s]==="^"){a+=`(^|(?<=[\r
2
2
  ]))`;continue}else if(n[s]==="$"){a+=`($|(?=[\r
3
3
  ]))`;continue}}if(r.s&&n[s]==="."){a+=o?`${n[s]}\r
4
4
  `:`[${n[s]}\r