@feathery/react 2.22.0 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Form/components/ActionToast/index.d.ts +2 -1
- package/cjs/Form/components/ActionToast/index.d.ts.map +1 -1
- package/cjs/Form/components/Assistant/MarkdownText.d.ts +7 -0
- package/cjs/Form/components/Assistant/MarkdownText.d.ts.map +1 -0
- package/cjs/Form/components/Assistant/ToolStatus.d.ts +12 -0
- package/cjs/Form/components/Assistant/ToolStatus.d.ts.map +1 -0
- package/cjs/Form/components/Assistant/colors.d.ts +17 -0
- package/cjs/Form/components/Assistant/colors.d.ts.map +1 -0
- package/cjs/Form/components/Assistant/icons.d.ts +9 -0
- package/cjs/Form/components/Assistant/icons.d.ts.map +1 -0
- package/cjs/Form/components/Assistant/index.d.ts +8 -0
- package/cjs/Form/components/Assistant/index.d.ts.map +1 -0
- package/cjs/Form/index.d.ts.map +1 -1
- package/cjs/Form/tests/testMocks.d.ts.map +1 -1
- package/cjs/{fthry_FormControl.C6RfrG4j.js → fthry_FormControl.CTwLDqQX.js} +1 -1
- package/cjs/{fthry_InlineTooltip.DXjYqPtD.js → fthry_InlineTooltip.R7o5S9Hi.js} +2 -2
- package/cjs/{fthry_Overlay.C4w6Cb6j.js → fthry_Overlay.aL6ya79H.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.D05feokK.js → fthry_PaymentMethodField.DLFdpNBi.js} +4 -4
- package/cjs/{fthry_Placeholder.D7Yh7mU2.js → fthry_Placeholder.BZtsn8fz.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.CiLTfgAK.js → fthry_ShowEyeIcon.DNr8tAO2.js} +1 -1
- package/cjs/{fthry_index.BJT2EG9q.js → fthry_index.4VrFlleU.js} +3 -3
- package/cjs/{fthry_index.D3t9MrC8.js → fthry_index.B4FRRpgr.js} +1 -1
- package/cjs/{fthry_index.CofrHdeg.js → fthry_index.B6VC3yvc.js} +2 -2
- package/cjs/{fthry_index.Cy80QFQZ.js → fthry_index.BBe95Bfl.js} +2 -2
- package/cjs/{fthry_index.CIxKm2W7.js → fthry_index.BKITOPaK.js} +6 -6
- package/cjs/{fthry_index.B7fwm2Qq.js → fthry_index.BdO-WOSW.js} +1 -1
- package/cjs/{fthry_index.C7ja1s3P.js → fthry_index.BeZPHYEW.js} +1 -1
- package/cjs/fthry_index.BnFW3Myv.js +10154 -0
- package/cjs/{fthry_index.BqZlc7T3.js → fthry_index.BxtiIxtR.js} +5 -5
- package/cjs/{fthry_index.6gJGxnEh.js → fthry_index.C9ZNNKBl.js} +1 -1
- package/cjs/{fthry_index.avrbgACA.js → fthry_index.CJ4fQh0Q.js} +1 -1
- package/cjs/{fthry_index.Dl8zGsAp.js → fthry_index.CKclXUEz.js} +1 -1
- package/cjs/{fthry_index.dpVLfqGZ.js → fthry_index.CuALcFA0.js} +4 -4
- package/cjs/{fthry_index.BNdR1Zvy.js → fthry_index.D4TokwJO.js} +3 -3
- package/cjs/{fthry_index.C-ANSPxY.js → fthry_index.D7WPMS-e.js} +8 -8
- package/cjs/{fthry_index.BO3AY9qR.js → fthry_index.DG9GFt5B.js} +6 -6
- package/cjs/{fthry_index.DiSY7Ac7.js → fthry_index.DLgrd3kv.js} +1 -1
- package/cjs/{fthry_index.lrVIrRLc.js → fthry_index.DUmDjh10.js} +178 -104
- package/cjs/{fthry_index.BoacvsbM.js → fthry_index.DUsXh3p4.js} +6 -6
- package/cjs/{fthry_index.2sunYeoj.js → fthry_index.DrOR5X_e.js} +1 -1
- package/cjs/{fthry_index.CvLykMCw.js → fthry_index.NnlX5lQm.js} +5 -5
- package/cjs/{fthry_index.DBJtTx9s.js → fthry_index.Pgo2Mu9x.js} +5 -5
- package/cjs/{fthry_index.DjWVnEr6.js → fthry_index._QY6Jk0r.js} +4 -4
- package/cjs/{fthry_index.D9UgyAK0.js → fthry_index.jT0ywpWI.js} +5 -5
- package/cjs/{fthry_index.CRdtsgYY.js → fthry_index.vkA9iK7B.js} +4 -4
- package/cjs/{fthry_input.CHp_Jap5.js → fthry_input.Lj-vEccg.js} +1 -1
- package/cjs/{fthry_script.C2pt_bUm.js → fthry_script.KoeCqMxj.js} +1 -1
- package/cjs/{fthry_styles.DFm8HxDr.js → fthry_styles.Cy6qRjM_.js} +1 -1
- package/cjs/{fthry_useElementSize.BroSkGyG.js → fthry_useElementSize.CPxkbWYF.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.DiWBOGl_.js → fthry_useSalesforceSync.vKBJt6Ec.js} +1 -1
- package/cjs/{fthry_webfontloader.Du37duiu.js → fthry_webfontloader.CFS5EJ_U.js} +1 -1
- package/cjs/index.js +1 -1
- package/cjs/utils/featheryClient/index.d.ts.map +1 -1
- package/cjs/utils/formHelperFunctions.d.ts +3 -0
- package/cjs/utils/formHelperFunctions.d.ts.map +1 -1
- package/dist/Form/components/ActionToast/index.d.ts +2 -1
- package/dist/Form/components/ActionToast/index.d.ts.map +1 -1
- package/dist/Form/components/Assistant/MarkdownText.d.ts +7 -0
- package/dist/Form/components/Assistant/MarkdownText.d.ts.map +1 -0
- package/dist/Form/components/Assistant/ToolStatus.d.ts +12 -0
- package/dist/Form/components/Assistant/ToolStatus.d.ts.map +1 -0
- package/dist/Form/components/Assistant/colors.d.ts +17 -0
- package/dist/Form/components/Assistant/colors.d.ts.map +1 -0
- package/dist/Form/components/Assistant/icons.d.ts +9 -0
- package/dist/Form/components/Assistant/icons.d.ts.map +1 -0
- package/dist/Form/components/Assistant/index.d.ts +8 -0
- package/dist/Form/components/Assistant/index.d.ts.map +1 -0
- package/dist/Form/index.d.ts.map +1 -1
- package/dist/Form/tests/testMocks.d.ts.map +1 -1
- package/dist/{fthry_FormControl.BR7z833q.js → fthry_FormControl.CZJ1jn_X.js} +1 -1
- package/dist/{fthry_InlineTooltip.D5rXgJxn.js → fthry_InlineTooltip.BI9A2ISt.js} +2 -2
- package/dist/{fthry_Overlay.C0T4Ihiz.js → fthry_Overlay.CR5UzcJA.js} +1 -1
- package/dist/{fthry_PaymentMethodField.BnHykb0-.js → fthry_PaymentMethodField.CjqJ8yIr.js} +4 -4
- package/dist/{fthry_Placeholder.OebdDszh.js → fthry_Placeholder.CVztEMPo.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.5ZGg8TFI.js → fthry_ShowEyeIcon.Ou0z80Bk.js} +1 -1
- package/dist/{fthry_index.CAO_boB_.js → fthry_index.B3yyXgjw.js} +6 -6
- package/dist/{fthry_index.CbxKTwce.js → fthry_index.BBmBREM8.js} +3 -3
- package/dist/{fthry_index.BVBupEyX.js → fthry_index.BHOEgj_J.js} +4 -4
- package/dist/{fthry_index.DgH--mO0.js → fthry_index.BNYfMPtP.js} +1 -1
- package/dist/{fthry_index.BkvB1fWy.js → fthry_index.BOZNibb0.js} +1 -1
- package/dist/{fthry_index.CZr2zxPE.js → fthry_index.BPrCG1DF.js} +1 -1
- package/dist/{fthry_index.D33p0Cu9.js → fthry_index.BcuiRv7L.js} +5 -5
- package/dist/{fthry_index.DSpMogdQ.js → fthry_index.BlTczd9f.js} +6 -6
- package/dist/{fthry_index.DSXLISe1.js → fthry_index.BnuKisSC.js} +1 -1
- package/dist/{fthry_index.CQIPge2V.js → fthry_index.Bpe9va3I.js} +2 -2
- package/dist/{fthry_index.CbNESu0U.js → fthry_index.BzvJX38E.js} +5 -5
- package/dist/{fthry_index.CenbmeTZ.js → fthry_index.C1G-XNqF.js} +4 -4
- package/dist/{fthry_index.VasUvj87.js → fthry_index.CDrJFqsv.js} +6 -6
- package/dist/{fthry_index.CLjO1Hq8.js → fthry_index.CSglnt5z.js} +1 -1
- package/dist/{fthry_index.Cog2BDNb.js → fthry_index.CTKMi2rG.js} +1 -1
- package/dist/{fthry_index.Cjz0TFbJ.js → fthry_index.CkJMRFNl.js} +8 -8
- package/dist/{fthry_index.NZiAUoKR.js → fthry_index.CoZvVNqs.js} +5 -5
- package/dist/{fthry_index.Ca6YzvQ4.js → fthry_index.CtYFxOlM.js} +3 -3
- package/dist/{fthry_index.CDRQrd84.js → fthry_index.D3lSuyak.js} +134 -61
- package/dist/fthry_index.D7y9hs7B.js +10152 -0
- package/dist/{fthry_index.Bg6jDqRN.js → fthry_index.DAS7h09M.js} +1 -1
- package/dist/{fthry_index.DomytyFl.js → fthry_index.DE3fEAl4.js} +4 -4
- package/dist/{fthry_index.B-HK4FAf.js → fthry_index.DQw3p27A.js} +5 -5
- package/dist/{fthry_index.D91kaNEu.js → fthry_index.FXwX6-R-.js} +1 -1
- package/dist/{fthry_index.Bsx6VyJi.js → fthry_index.pLuBEDzM.js} +2 -2
- package/dist/{fthry_input.mf5Eisx1.js → fthry_input.DRka84YM.js} +1 -1
- package/dist/{fthry_script.DYkmIi0j.js → fthry_script.CwI252bu.js} +1 -1
- package/dist/{fthry_styles.DctHU6BX.js → fthry_styles.PyyCyYCJ.js} +1 -1
- package/dist/{fthry_useElementSize.B_En_KWY.js → fthry_useElementSize.zEQ3--PI.js} +1 -1
- package/dist/{fthry_useSalesforceSync.wfhYAUgy.js → fthry_useSalesforceSync.BaADT2cu.js} +1 -1
- package/dist/{fthry_webfontloader.sudLWRnv.js → fthry_webfontloader.DY9HYBTa.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/featheryClient/index.d.ts.map +1 -1
- package/dist/utils/formHelperFunctions.d.ts +3 -0
- package/dist/utils/formHelperFunctions.d.ts.map +1 -1
- package/package.json +5 -2
- package/umd/790.4e933b431624db11eeec.js +1 -0
- package/umd/AssistantChat.ffb5ce7ab5b0350a9159.js +1 -0
- package/umd/index.js +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[790],{9623:e=>{e.exports=function(e,t){if("function"!=typeof e)throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...a){clearTimeout(n);const s=Date.now(),i=t-(s-r);i<=0?(r=s,e.apply(this,a)):n=setTimeout((()=>{r=Date.now(),e.apply(this,a)}),i)}}},4790:(e,t,n)=>{"use strict";n.d(t,{RJ:()=>w});var r,a,s,i,o,u,c,d,l,p,h=n(7294),m=n(4438),f=n(9623),v=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},y=(e,t,n)=>(v(e,t,"read from private field"),n?n.call(e):t.get(e)),g=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},_=(e,t,n,r)=>(v(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);r=new WeakMap,a=new WeakMap,s=new WeakMap,i=new WeakMap,o=new WeakMap,u=new WeakMap,c=new WeakMap,d=new WeakMap,l=new WeakMap;var b=class extends m.Pu{constructor({messages:e,...t}){const n=new class{constructor(e=[]){g(this,r,void 0),g(this,a,"ready"),g(this,s,void 0),g(this,i,new Set),g(this,o,new Set),g(this,u,new Set),this.pushMessage=e=>{_(this,r,y(this,r).concat(e)),y(this,c).call(this)},this.popMessage=()=>{_(this,r,y(this,r).slice(0,-1)),y(this,c).call(this)},this.replaceMessage=(e,t)=>{_(this,r,[...y(this,r).slice(0,e),this.snapshot(t),...y(this,r).slice(e+1)]),y(this,c).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,t)=>{const n=t?(r=e,null!=(a=t)?f(r,a):r):e;var r,a;return y(this,i).add(n),()=>{y(this,i).delete(n)}},this["~registerStatusCallback"]=e=>(y(this,o).add(e),()=>{y(this,o).delete(e)}),this["~registerErrorCallback"]=e=>(y(this,u).add(e),()=>{y(this,u).delete(e)}),g(this,c,(()=>{y(this,i).forEach((e=>e()))})),g(this,d,(()=>{y(this,o).forEach((e=>e()))})),g(this,l,(()=>{y(this,u).forEach((e=>e()))})),_(this,r,e)}get status(){return y(this,a)}set status(e){_(this,a,e),y(this,d).call(this)}get error(){return y(this,s)}set error(e){_(this,s,e),y(this,l).call(this)}get messages(){return y(this,r)}set messages(e){_(this,r,[...e]),y(this,c).call(this)}}(e);super({...t,state:n}),g(this,p,void 0),this["~registerMessagesCallback"]=(e,t)=>y(this,p)["~registerMessagesCallback"](e,t),this["~registerStatusCallback"]=e=>y(this,p)["~registerStatusCallback"](e),this["~registerErrorCallback"]=e=>y(this,p)["~registerErrorCallback"](e),_(this,p,n)}};function w({experimental_throttle:e,resume:t=!1,...n}={}){const r=(0,h.useRef)("chat"in n?{}:{onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});"chat"in n||(r.current={onToolCall:n.onToolCall,onData:n.onData,onFinish:n.onFinish,onError:n.onError,sendAutomaticallyWhen:n.sendAutomaticallyWhen});const a={...n,onToolCall:e=>{var t,n;return null==(n=(t=r.current).onToolCall)?void 0:n.call(t,e)},onData:e=>{var t,n;return null==(n=(t=r.current).onData)?void 0:n.call(t,e)},onFinish:e=>{var t,n;return null==(n=(t=r.current).onFinish)?void 0:n.call(t,e)},onError:e=>{var t,n;return null==(n=(t=r.current).onError)?void 0:n.call(t,e)},sendAutomaticallyWhen:e=>{var t,n,a;return null!=(a=null==(n=(t=r.current).sendAutomaticallyWhen)?void 0:n.call(t,e))&&a}},s=(0,h.useRef)("chat"in n?n.chat:new b(a));("chat"in n&&n.chat!==s.current||"id"in n&&s.current.id!==n.id)&&(s.current="chat"in n?n.chat:new b(a));const i=(0,h.useCallback)((t=>s.current["~registerMessagesCallback"](t,e)),[e,s.current.id]),o=(0,h.useSyncExternalStore)(i,(()=>s.current.messages),(()=>s.current.messages)),u=(0,h.useSyncExternalStore)(s.current["~registerStatusCallback"],(()=>s.current.status),(()=>s.current.status)),c=(0,h.useSyncExternalStore)(s.current["~registerErrorCallback"],(()=>s.current.error),(()=>s.current.error)),d=(0,h.useCallback)((e=>{"function"==typeof e&&(e=e(s.current.messages)),s.current.messages=e}),[s]);return(0,h.useEffect)((()=>{t&&s.current.resumeStream()}),[t,s]),{id:s.current.id,messages:o,setMessages:d,sendMessage:s.current.sendMessage,regenerate:s.current.regenerate,clearError:s.current.clearError,stop:s.current.stop,error:c,resumeStream:s.current.resumeStream,status:u,addToolResult:s.current.addToolOutput,addToolOutput:s.current.addToolOutput,addToolApprovalResponse:s.current.addToolApprovalResponse}}p=new WeakMap},4438:(e,t,n)=>{"use strict";n.d(t,{Pu:()=>Kp,PD:()=>qp});var r={};n.r(r),n.d(r,{base64:()=>_t,base64url:()=>bt,bigint:()=>Zt,boolean:()=>Nt,browserEmail:()=>pt,cidrv4:()=>yt,cidrv6:()=>gt,cuid:()=>Ke,cuid2:()=>Ye,date:()=>It,datetime:()=>Tt,domain:()=>kt,duration:()=>et,e164:()=>xt,email:()=>ot,emoji:()=>ht,extendedDuration:()=>tt,guid:()=>nt,hex:()=>Mt,hostname:()=>wt,html5Email:()=>ut,idnEmail:()=>lt,integer:()=>At,ipv4:()=>mt,ipv6:()=>ft,ksuid:()=>He,lowercase:()=>jt,mac:()=>vt,md5_base64:()=>Ut,md5_base64url:()=>Jt,md5_hex:()=>Lt,nanoid:()=>Qe,null:()=>Pt,number:()=>$t,rfc5322Email:()=>ct,sha1_base64:()=>Bt,sha1_base64url:()=>Wt,sha1_hex:()=>Vt,sha256_base64:()=>Kt,sha256_base64url:()=>Yt,sha256_hex:()=>qt,sha384_base64:()=>Xt,sha384_base64url:()=>Ht,sha384_hex:()=>Gt,sha512_base64:()=>en,sha512_base64url:()=>tn,sha512_hex:()=>Qt,string:()=>Ot,time:()=>Et,ulid:()=>Ge,undefined:()=>Ct,unicodeEmail:()=>dt,uppercase:()=>Rt,uuid:()=>rt,uuid4:()=>at,uuid6:()=>st,uuid7:()=>it,xid:()=>Xe});var a={};n.r(a),n.d(a,{endsWith:()=>as,gt:()=>Da,gte:()=>La,includes:()=>ns,length:()=>Ha,lowercase:()=>es,lt:()=>Ma,lte:()=>Fa,maxLength:()=>Ga,maxSize:()=>qa,mime:()=>is,minLength:()=>Xa,minSize:()=>Ka,multipleOf:()=>Wa,negative:()=>Ja,nonnegative:()=>Ba,nonpositive:()=>Va,normalize:()=>us,overwrite:()=>os,positive:()=>Ua,property:()=>ss,regex:()=>Qa,size:()=>Ya,slugify:()=>ps,startsWith:()=>rs,toLowerCase:()=>ds,toUpperCase:()=>ls,trim:()=>cs,uppercase:()=>ts});var s={};n.r(s),n.d(s,{ZodISODate:()=>oi,ZodISODateTime:()=>si,ZodISODuration:()=>li,ZodISOTime:()=>ci,date:()=>ui,datetime:()=>ii,duration:()=>pi,time:()=>di});var i={};n.r(i),n.d(i,{ZodAny:()=>Yo,ZodArray:()=>su,ZodBase64:()=>fo,ZodBase64URL:()=>yo,ZodBigInt:()=>Mo,ZodBigIntFormat:()=>Do,ZodBoolean:()=>jo,ZodCIDRv4:()=>lo,ZodCIDRv6:()=>ho,ZodCUID:()=>Ki,ZodCUID2:()=>Gi,ZodCatch:()=>ec,ZodCodec:()=>ic,ZodCustom:()=>gc,ZodCustomStringFormat:()=>xo,ZodDate:()=>ru,ZodDefault:()=>Wu,ZodDiscriminatedUnion:()=>vu,ZodE164:()=>_o,ZodEmail:()=>$i,ZodEmoji:()=>Vi,ZodEnum:()=>Zu,ZodExactOptional:()=>Lu,ZodFile:()=>Cu,ZodFunction:()=>vc,ZodGUID:()=>Pi,ZodIPv4:()=>ao,ZodIPv6:()=>uo,ZodIntersection:()=>gu,ZodJWT:()=>wo,ZodKSUID:()=>no,ZodLazy:()=>pc,ZodLiteral:()=>Nu,ZodMAC:()=>io,ZodMap:()=>Su,ZodNaN:()=>nc,ZodNanoID:()=>Wi,ZodNever:()=>Qo,ZodNonOptional:()=>Gu,ZodNull:()=>qo,ZodNullable:()=>Ju,ZodNumber:()=>To,ZodNumberFormat:()=>Zo,ZodObject:()=>uu,ZodOptional:()=>Fu,ZodPipe:()=>ac,ZodPrefault:()=>Ku,ZodPromise:()=>mc,ZodReadonly:()=>uc,ZodRecord:()=>ku,ZodSet:()=>Tu,ZodString:()=>Oi,ZodStringFormat:()=>Ai,ZodSuccess:()=>Hu,ZodSymbol:()=>Jo,ZodTemplateLiteral:()=>dc,ZodTransform:()=>Ru,ZodTuple:()=>bu,ZodType:()=>Ei,ZodULID:()=>Hi,ZodURL:()=>Li,ZodUUID:()=>ji,ZodUndefined:()=>Bo,ZodUnion:()=>pu,ZodUnknown:()=>Xo,ZodVoid:()=>tu,ZodXID:()=>eo,ZodXor:()=>mu,_ZodString:()=>Ti,_default:()=>qu,_function:()=>yc,any:()=>Go,array:()=>iu,base64:()=>vo,base64url:()=>go,bigint:()=>Fo,boolean:()=>Ro,catch:()=>tc,check:()=>_c,cidrv4:()=>po,cidrv6:()=>mo,codec:()=>oc,cuid:()=>Yi,cuid2:()=>Xi,custom:()=>bc,date:()=>au,describe:()=>xc,discriminatedUnion:()=>yu,e164:()=>bo,email:()=>Ni,emoji:()=>Bi,enum:()=>Au,exactOptional:()=>Uu,file:()=>ju,float32:()=>$o,float64:()=>No,function:()=>yc,guid:()=>Ci,hash:()=>Eo,hex:()=>So,hostname:()=>Io,httpUrl:()=>Ji,instanceof:()=>Ic,int:()=>Ao,int32:()=>Po,int64:()=>Lo,intersection:()=>_u,ipv4:()=>so,ipv6:()=>co,json:()=>Ec,jwt:()=>ko,keyof:()=>ou,ksuid:()=>ro,lazy:()=>hc,literal:()=>Pu,looseObject:()=>lu,looseRecord:()=>Iu,mac:()=>oo,map:()=>Eu,meta:()=>zc,nan:()=>rc,nanoid:()=>qi,nativeEnum:()=>$u,never:()=>eu,nonoptional:()=>Xu,null:()=>Ko,nullable:()=>Vu,nullish:()=>Bu,number:()=>Oo,object:()=>cu,optional:()=>Du,partialRecord:()=>zu,pipe:()=>sc,prefault:()=>Yu,preprocess:()=>Tc,promise:()=>fc,readonly:()=>cc,record:()=>xu,refine:()=>wc,set:()=>Ou,strictObject:()=>du,string:()=>Zi,stringFormat:()=>zo,stringbool:()=>Sc,success:()=>Qu,superRefine:()=>kc,symbol:()=>Vo,templateLiteral:()=>lc,transform:()=>Mu,tuple:()=>wu,uint32:()=>Co,uint64:()=>Uo,ulid:()=>Qi,undefined:()=>Wo,union:()=>hu,unknown:()=>Ho,url:()=>Ui,uuid:()=>Ri,uuidv4:()=>Mi,uuidv6:()=>Fi,uuidv7:()=>Di,void:()=>nu,xid:()=>to,xor:()=>fu});var o,u,c="vercel.ai.error",d=Symbol.for(c),l=class e extends(u=Error,o=d,u){constructor({name:e,message:t,cause:n}){super(t),this[o]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,c)}static hasMarker(e,t){const n=Symbol.for(t);return null!=e&&"object"==typeof e&&n in e&&"boolean"==typeof e[n]&&!0===e[n]}},p=Symbol.for("vercel.ai.error.AI_APICallError"),h=`vercel.ai.error.${l,p,"AI_EmptyResponseBodyError"}`,m=Symbol.for(h);function f(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}var v,y,g,_,b,w,k="AI_InvalidArgumentError",x=`vercel.ai.error.${k}`,z=Symbol.for(x),I=class extends(y=l,v=z,y){constructor({message:e,cause:t,argument:n}){super({name:k,message:e,cause:t}),this[v]=!0,this.argument=n}static isInstance(e){return l.hasMarker(e,x)}},S=Symbol.for("vercel.ai.error.AI_InvalidPromptError"),E=`vercel.ai.error.${l,S,"AI_InvalidResponseDataError"}`,T=Symbol.for(E),O=(l,T,"AI_JSONParseError"),Z=`vercel.ai.error.${O}`,A=Symbol.for(Z),$=class extends(_=l,g=A,_){constructor({text:e,cause:t}){super({name:O,message:`JSON parsing failed: Text: ${e}.\nError message: ${f(t)}`,cause:t}),this[g]=!0,this.text=e}static isInstance(e){return l.hasMarker(e,Z)}},N=Symbol.for("vercel.ai.error.AI_LoadAPIKeyError"),P=`vercel.ai.error.${l,N,"AI_LoadSettingError"}`,C=Symbol.for(P),j=`vercel.ai.error.${l,C,"AI_NoContentGeneratedError"}`,R=Symbol.for(j),M=`vercel.ai.error.${l,R,"AI_NoSuchModelError"}`,F=Symbol.for(M),D=`vercel.ai.error.${l,F,"AI_TooManyEmbeddingValuesForCallError"}`,L=Symbol.for(D),U=(l,L,"AI_TypeValidationError"),J=`vercel.ai.error.${U}`,V=Symbol.for(J),B=class e extends(w=l,b=V,w){constructor({value:e,cause:t,context:n}){let r="Type validation failed";if((null==n?void 0:n.field)&&(r+=` for ${n.field}`),(null==n?void 0:n.entityName)||(null==n?void 0:n.entityId)){r+=" (";const e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(", "),r+=")"}super({name:U,message:`${r}: Value: ${JSON.stringify(e)}.\nError message: ${f(t)}`,cause:t}),this[b]=!0,this.value=e,this.context=n}static isInstance(e){return l.hasMarker(e,J)}static wrap({value:t,cause:n,context:r}){var a,s,i;return e.isInstance(n)&&n.value===t&&(null==(a=n.context)?void 0:a.field)===(null==r?void 0:r.field)&&(null==(s=n.context)?void 0:s.entityName)===(null==r?void 0:r.entityName)&&(null==(i=n.context)?void 0:i.entityId)===(null==r?void 0:r.entityId)?n:new e({value:t,cause:n,context:r})}},W=Symbol.for("vercel.ai.error.AI_UnsupportedFunctionalityError");function q(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:i,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);const a=i.prototype,s=Object.keys(a);for(let e=0;e<s.length;e++){const t=s[e];t in n||(n[t]=a[t].bind(n))}}const a=n?.Parent??Object;class s extends a{}function i(e){var t;const a=n?.Parent?new s:this;r(a,e),(t=a._zod).deferred??(t.deferred=[]);for(const e of a._zod.deferred)e();return a}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}Object.freeze({status:"aborted"}),Symbol("zod_brand");class K extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Y extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const G={};function X(e){return e&&Object.assign(G,e),G}function H(e){const t=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,n])=>-1===t.indexOf(+e))).map((([e,t])=>t))}function Q(e,t="|"){return e.map((e=>_e(e))).join(t)}function ee(e,t){return"bigint"==typeof t?t.toString():t}function te(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ne(e){return null==e}function re(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const ae=Symbol("evaluating");function se(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ae)return void 0===r&&(r=ae,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ie(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function oe(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ue(e){return JSON.stringify(e)}const ce="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function de(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const le=te((()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}}));function pe(e){if(!1===de(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==de(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function he(e){return pe(e)?{...e}:Array.isArray(e)?[...e]:e}const me=new Set(["string","number","symbol"]),fe=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ve(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ye(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function ge(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function _e(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}const be={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},we={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ke(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function xe(e,t){return t.map((t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t}))}function ze(e){return"string"==typeof e?e:e?.message}function Ie(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=ze(e.inst?._zod.def?.error?.(e))??ze(t?.error?.(e))??ze(n.customError?.(e))??ze(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Se(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ee(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Te(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}const Oe=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ee,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ze=q("$ZodError",Oe),Ae=q("$ZodError",Oe,{Parent:Error}),$e=e=>(t,n,r,a)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new K;if(i.issues.length){const t=new(a?.Err??e)(i.issues.map((e=>Ie(e,s,X()))));throw ce(t,a?.callee),t}return i.value},Ne=$e(Ae),Pe=e=>async(t,n,r,a)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const t=new(a?.Err??e)(i.issues.map((e=>Ie(e,s,X()))));throw ce(t,a?.callee),t}return i.value},Ce=Pe(Ae),je=e=>(t,n,r)=>{const a=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new K;return s.issues.length?{success:!1,error:new(e??Ze)(s.issues.map((e=>Ie(e,a,X()))))}:{success:!0,data:s.value}},Re=je(Ae),Me=e=>async(t,n,r)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map((e=>Ie(e,a,X()))))}:{success:!0,data:s.value}},Fe=Me(Ae),De=e=>(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return $e(e)(t,n,a)},Le=e=>(t,n,r)=>$e(e)(t,n,r),Ue=e=>async(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Pe(e)(t,n,a)},Je=e=>async(t,n,r)=>Pe(e)(t,n,r),Ve=e=>(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return je(e)(t,n,a)},Be=e=>(t,n,r)=>je(e)(t,n,r),We=e=>async(t,n,r)=>{const a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Me(e)(t,n,a)},qe=e=>async(t,n,r)=>Me(e)(t,n,r),Ke=/^[cC][^\s-]{8,}$/,Ye=/^[0-9a-z]+$/,Ge=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Xe=/^[0-9a-vA-V]{20}$/,He=/^[A-Za-z0-9]{27}$/,Qe=/^[a-zA-Z0-9_-]{21}$/,et=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,nt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,rt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,at=rt(4),st=rt(6),it=rt(7),ot=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ut=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ct=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,dt=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,lt=dt,pt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function ht(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}const mt=/^(?:(?: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])$/,ft=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,vt=e=>{const t=ve(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},yt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,gt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_t=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bt=/^[A-Za-z0-9_-]*$/,wt=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,kt=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,xt=/^\+[1-9]\d{6,14}$/,zt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",It=new RegExp(`^${zt}$`);function St(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Et(e){return new RegExp(`^${St(e)}$`)}function Tt(e){const t=St({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${zt}T(?:${r})$`)}const Ot=e=>new RegExp(`^${e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*"}$`),Zt=/^-?\d+n?$/,At=/^-?\d+$/,$t=/^-?\d+(?:\.\d+)?$/,Nt=/^(?:true|false)$/i,Pt=/^null$/i,Ct=/^undefined$/i,jt=/^[^A-Z]*$/,Rt=/^[^a-z]*$/,Mt=/^[0-9a-fA-F]*$/;function Ft(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Dt(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const Lt=/^[0-9a-fA-F]{32}$/,Ut=Ft(22,"=="),Jt=Dt(22),Vt=/^[0-9a-fA-F]{40}$/,Bt=Ft(27,"="),Wt=Dt(27),qt=/^[0-9a-fA-F]{64}$/,Kt=Ft(43,"="),Yt=Dt(43),Gt=/^[0-9a-fA-F]{96}$/,Xt=Ft(64,""),Ht=Dt(64),Qt=/^[0-9a-fA-F]{128}$/,en=Ft(86,"=="),tn=Dt(86),nn=q("$ZodCheck",((e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])})),rn={number:"number",bigint:"bigint",object:"date"},an=q("$ZodCheckLessThan",((e,t)=>{nn.init(e,t);const n=rn[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)})),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),sn=q("$ZodCheckGreaterThan",((e,t)=>{nn.init(e,t);const n=rn[typeof t.value];e._zod.onattach.push((e=>{const n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)})),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}})),on=q("$ZodCheckMultipleOf",((e,t)=>{nn.init(e,t),e._zod.onattach.push((e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)})),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let a=(r.split(".")[1]||"").length;if(0===a&&/\d?e-\d?/.test(r)){const e=r.match(/\d?e-(\d?)/);e?.[1]&&(a=Number.parseInt(e[1]))}const s=n>a?n:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}})),un=q("$ZodCheckNumberFormat",((e,t)=>{nn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[a,s]=be[t.format];e._zod.onattach.push((e=>{const r=e._zod.bag;r.format=t.format,r.minimum=a,r.maximum=s,n&&(r.pattern=At)})),e._zod.check=i=>{const o=i.value;if(n){if(!Number.isInteger(o))return void i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?i.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}))}o<a&&i.issues.push({origin:"number",input:o,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),o>s&&i.issues.push({origin:"number",input:o,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}})),cn=q("$ZodCheckBigIntFormat",((e,t)=>{nn.init(e,t);const[n,r]=we[t.format];e._zod.onattach.push((e=>{const a=e._zod.bag;a.format=t.format,a.minimum=n,a.maximum=r})),e._zod.check=a=>{const s=a.value;s<n&&a.issues.push({origin:"bigint",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>r&&a.issues.push({origin:"bigint",input:s,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}})),dn=q("$ZodCheckMaxSize",((e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ne(t)&&void 0!==t.size}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const r=n.value;r.size<=t.maximum||n.issues.push({origin:Se(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}})),ln=q("$ZodCheckMinSize",((e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ne(t)&&void 0!==t.size}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const r=n.value;r.size>=t.minimum||n.issues.push({origin:Se(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}})),pn=q("$ZodCheckSizeEquals",((e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ne(t)&&void 0!==t.size}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size})),e._zod.check=n=>{const r=n.value,a=r.size;if(a===t.size)return;const s=a>t.size;n.issues.push({origin:Se(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),hn=q("$ZodCheckMaxLength",((e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ne(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)})),e._zod.check=n=>{const r=n.value;if(r.length<=t.maximum)return;const a=Ee(r);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}})),mn=q("$ZodCheckMinLength",((e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ne(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)})),e._zod.check=n=>{const r=n.value;if(r.length>=t.minimum)return;const a=Ee(r);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}})),fn=q("$ZodCheckLengthEquals",((e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!ne(t)&&void 0!==t.length}),e._zod.onattach.push((e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length})),e._zod.check=n=>{const r=n.value,a=r.length;if(a===t.length)return;const s=Ee(r),i=a>t.length;n.issues.push({origin:s,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}})),vn=q("$ZodCheckStringFormat",((e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))})),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})})),yn=q("$ZodCheckRegex",((e,t)=>{vn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}})),gn=q("$ZodCheckLowerCase",((e,t)=>{t.pattern??(t.pattern=jt),vn.init(e,t)})),_n=q("$ZodCheckUpperCase",((e,t)=>{t.pattern??(t.pattern=Rt),vn.init(e,t)})),bn=q("$ZodCheckIncludes",((e,t)=>{nn.init(e,t);const n=ve(t.includes),r=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)})),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}})),wn=q("$ZodCheckStartsWith",((e,t)=>{nn.init(e,t);const n=new RegExp(`^${ve(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}})),kn=q("$ZodCheckEndsWith",((e,t)=>{nn.init(e,t);const n=new RegExp(`.*${ve(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)})),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}));function xn(e,t,n){e.issues.length&&t.issues.push(...xe(n,e.issues))}const zn=q("$ZodCheckProperty",((e,t)=>{nn.init(e,t),e._zod.check=e=>{const n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then((n=>xn(n,e,t.property)));xn(n,e,t.property)}})),In=q("$ZodCheckMimeType",((e,t)=>{nn.init(e,t);const n=new Set(t.mime);e._zod.onattach.push((e=>{e._zod.bag.mime=t.mime})),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}})),Sn=q("$ZodCheckOverwrite",((e,t)=>{nn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}));class En{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter((e=>e)),n=Math.min(...t.map((e=>e.length-e.trimStart().length))),r=t.map((e=>e.slice(n))).map((e=>" ".repeat(2*this.indent)+e));for(const e of r)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map((e=>` ${e}`))].join("\n"))}}const Tn={major:4,minor:3,patch:6},On=q("$ZodType",((e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const t of r)for(const n of t._zod.onattach)n(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push((()=>{e._zod.run=e._zod.parse}));else{const t=(e,t,n)=>{let r,a=ke(e);for(const s of t){if(s._zod.def.when){if(!s._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,i=s._zod.check(e);if(i instanceof Promise&&!1===n?.async)throw new K;if(r||i instanceof Promise)r=(r??Promise.resolve()).then((async()=>{await i,e.issues.length!==t&&(a||(a=ke(e,t)))}));else{if(e.issues.length===t)continue;a||(a=ke(e,t))}}return r?r.then((()=>e)):e},n=(n,a,s)=>{if(ke(n))return n.aborted=!0,n;const i=t(a,r,s);if(i instanceof Promise){if(!1===s.async)throw new K;return i.then((t=>e._zod.parse(t,s)))}return e._zod.parse(i,s)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if("backward"===s.direction){const t=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then((e=>n(e,a,s))):n(t,a,s)}const i=e._zod.parse(a,s);if(i instanceof Promise){if(!1===s.async)throw new K;return i.then((e=>t(e,r,s)))}return t(i,r,s)}}se(e,"~standard",(()=>({validate:t=>{try{const n=Re(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Fe(e,t).then((e=>e.success?{value:e.data}:{issues:e.error?.issues}))}},vendor:"zod",version:1})))})),Zn=q("$ZodString",((e,t)=>{On.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ot(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(r){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}})),An=q("$ZodStringFormat",((e,t)=>{vn.init(e,t),Zn.init(e,t)})),$n=q("$ZodGUID",((e,t)=>{t.pattern??(t.pattern=nt),An.init(e,t)})),Nn=q("$ZodUUID",((e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=rt(e))}else t.pattern??(t.pattern=rt());An.init(e,t)})),Pn=q("$ZodEmail",((e,t)=>{t.pattern??(t.pattern=ot),An.init(e,t)})),Cn=q("$ZodURL",((e,t)=>{An.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),a=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=a.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}})),jn=q("$ZodEmoji",((e,t)=>{t.pattern??(t.pattern=ht()),An.init(e,t)})),Rn=q("$ZodNanoID",((e,t)=>{t.pattern??(t.pattern=Qe),An.init(e,t)})),Mn=q("$ZodCUID",((e,t)=>{t.pattern??(t.pattern=Ke),An.init(e,t)})),Fn=q("$ZodCUID2",((e,t)=>{t.pattern??(t.pattern=Ye),An.init(e,t)})),Dn=q("$ZodULID",((e,t)=>{t.pattern??(t.pattern=Ge),An.init(e,t)})),Ln=q("$ZodXID",((e,t)=>{t.pattern??(t.pattern=Xe),An.init(e,t)})),Un=q("$ZodKSUID",((e,t)=>{t.pattern??(t.pattern=He),An.init(e,t)})),Jn=q("$ZodISODateTime",((e,t)=>{t.pattern??(t.pattern=Tt(t)),An.init(e,t)})),Vn=q("$ZodISODate",((e,t)=>{t.pattern??(t.pattern=It),An.init(e,t)})),Bn=q("$ZodISOTime",((e,t)=>{t.pattern??(t.pattern=Et(t)),An.init(e,t)})),Wn=q("$ZodISODuration",((e,t)=>{t.pattern??(t.pattern=et),An.init(e,t)})),qn=q("$ZodIPv4",((e,t)=>{t.pattern??(t.pattern=mt),An.init(e,t),e._zod.bag.format="ipv4"})),Kn=q("$ZodIPv6",((e,t)=>{t.pattern??(t.pattern=ft),An.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}})),Yn=q("$ZodMAC",((e,t)=>{t.pattern??(t.pattern=vt(t.delimiter)),An.init(e,t),e._zod.bag.format="mac"})),Gn=q("$ZodCIDRv4",((e,t)=>{t.pattern??(t.pattern=yt),An.init(e,t)})),Xn=q("$ZodCIDRv6",((e,t)=>{t.pattern??(t.pattern=gt),An.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(2!==r.length)throw new Error;const[e,t]=r;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}}));function Hn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Qn=q("$ZodBase64",((e,t)=>{t.pattern??(t.pattern=_t),An.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Hn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}})),er=q("$ZodBase64URL",((e,t)=>{t.pattern??(t.pattern=bt),An.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!bt.test(e))return!1;const t=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Hn(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}})),tr=q("$ZodE164",((e,t)=>{t.pattern??(t.pattern=xt),An.init(e,t)})),nr=q("$ZodJWT",((e,t)=>{An.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[r]=n;if(!r)return!1;const a=JSON.parse(atob(r));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}})),rr=q("$ZodCustomStringFormat",((e,t)=>{An.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}})),ar=q("$ZodNumber",((e,t)=>{On.init(e,t),e._zod.pattern=e._zod.bag.pattern??$t,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(e){}const a=n.value;if("number"==typeof a&&!Number.isNaN(a)&&Number.isFinite(a))return n;const s="number"==typeof a?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...s?{received:s}:{}}),n}})),sr=q("$ZodNumberFormat",((e,t)=>{un.init(e,t),ar.init(e,t)})),ir=q("$ZodBoolean",((e,t)=>{On.init(e,t),e._zod.pattern=Nt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const a=n.value;return"boolean"==typeof a||n.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),n}})),or=q("$ZodBigInt",((e,t)=>{On.init(e,t),e._zod.pattern=Zt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(e){}return"bigint"==typeof n.value||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}})),ur=q("$ZodBigIntFormat",((e,t)=>{cn.init(e,t),or.init(e,t)})),cr=q("$ZodSymbol",((e,t)=>{On.init(e,t),e._zod.parse=(t,n)=>{const r=t.value;return"symbol"==typeof r||t.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),t}})),dr=q("$ZodUndefined",((e,t)=>{On.init(e,t),e._zod.pattern=Ct,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(t,n)=>{const r=t.value;return void 0===r||t.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),t}})),lr=q("$ZodNull",((e,t)=>{On.init(e,t),e._zod.pattern=Pt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{const r=t.value;return null===r||t.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),t}})),pr=q("$ZodAny",((e,t)=>{On.init(e,t),e._zod.parse=e=>e})),hr=q("$ZodUnknown",((e,t)=>{On.init(e,t),e._zod.parse=e=>e})),mr=q("$ZodNever",((e,t)=>{On.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)})),fr=q("$ZodVoid",((e,t)=>{On.init(e,t),e._zod.parse=(t,n)=>{const r=t.value;return void 0===r||t.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),t}})),vr=q("$ZodDate",((e,t)=>{On.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(e){}const a=n.value,s=a instanceof Date;return s&&!Number.isNaN(a.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:a,...s?{received:"Invalid Date"}:{},inst:e}),n}}));function yr(e,t,n){e.issues.length&&t.issues.push(...xe(n,e.issues)),t.value[n]=e.value}const gr=q("$ZodArray",((e,t)=>{On.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),n;n.value=Array(a.length);const s=[];for(let e=0;e<a.length;e++){const i=a[e],o=t.element._zod.run({value:i,issues:[]},r);o instanceof Promise?s.push(o.then((t=>yr(t,n,e)))):yr(o,n,e)}return s.length?Promise.all(s).then((()=>n)):n}}));function _r(e,t,n,r,a){if(e.issues.length){if(a&&!(n in r))return;t.issues.push(...xe(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function br(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(r=e.shape,Object.keys(r).filter((e=>"optional"===r[e]._zod.optin&&"optional"===r[e]._zod.optout)));var r;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wr(e,t,n,r,a,s){const i=[],o=a.keySet,u=a.catchall._zod,c=u.def.type,d="optional"===u.optout;for(const a in t){if(o.has(a))continue;if("never"===c){i.push(a);continue}const s=u.run({value:t[a],issues:[]},r);s instanceof Promise?e.push(s.then((e=>_r(e,n,a,t,d)))):_r(s,n,a,t,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then((()=>n)):n}const kr=q("$ZodObject",((e,t)=>{if(On.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const n=te((()=>br(t)));se(e._zod,"propValues",(()=>{const e=t.shape,n={};for(const t in e){const r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(const e of r.values)n[t].add(e)}}return n}));const r=de,a=t.catchall;let s;e._zod.parse=(t,i)=>{s??(s=n.value);const o=t.value;if(!r(o))return t.issues.push({expected:"object",code:"invalid_type",input:o,inst:e}),t;t.value={};const u=[],c=s.shape;for(const e of s.keys){const n=c[e],r="optional"===n._zod.optout,a=n._zod.run({value:o[e],issues:[]},i);a instanceof Promise?u.push(a.then((n=>_r(n,t,e,o,r)))):_r(a,t,e,o,r)}return a?wr(u,o,t,i,n.value,e):u.length?Promise.all(u).then((()=>t)):t}})),xr=q("$ZodObjectJIT",((e,t)=>{kr.init(e,t);const n=e._zod.parse,r=te((()=>br(t)));let a;const s=de,i=!G.jitless,o=i&&le.value,u=t.catchall;let c;e._zod.parse=(d,l)=>{c??(c=r.value);const p=d.value;return s(p)?i&&o&&!1===l?.async&&!0!==l.jitless?(a||(a=(e=>{const t=new En(["shape","payload","ctx"]),n=r.value,a=e=>{const t=ue(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let i=0;for(const e of n.keys)s[e]="key_"+i++;t.write("const newResult = {};");for(const r of n.keys){const n=s[r],i=ue(r),o="optional"===e[r]?._zod?.optout;t.write(`const ${n} = ${a(r)};`),o?t.write(`\n if (${n}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const o=t.compile();return(t,n)=>o(e,t,n)})(t.shape)),d=a(d,l),u?wr([],p,d,l,c,e):d):n(d,l):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}}));function zr(e,t,n,r){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const a=e.filter((e=>!ke(e)));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>Ie(e,r,X())))))}),t)}const Ir=q("$ZodUnion",((e,t)=>{On.init(e,t),se(e._zod,"optin",(()=>t.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),se(e._zod,"optout",(()=>t.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),se(e._zod,"values",(()=>{if(t.options.every((e=>e._zod.values)))return new Set(t.options.flatMap((e=>Array.from(e._zod.values))))})),se(e._zod,"pattern",(()=>{if(t.options.every((e=>e._zod.pattern))){const e=t.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>re(e.source))).join("|")})$`)}}));const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(n)return r(a,s);let i=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},s);if(t instanceof Promise)o.push(t),i=!0;else{if(0===t.issues.length)return t;o.push(t)}}return i?Promise.all(o).then((t=>zr(t,a,e,s))):zr(o,a,e,s)}}));function Sr(e,t,n,r){const a=e.filter((e=>0===e.issues.length));return 1===a.length?(t.value=a[0].value,t):(0===a.length?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((e=>e.issues.map((e=>Ie(e,r,X())))))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}const Er=q("$ZodXor",((e,t)=>{Ir.init(e,t),t.inclusive=!1;const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(a,s)=>{if(n)return r(a,s);let i=!1;const o=[];for(const e of t.options){const t=e._zod.run({value:a.value,issues:[]},s);t instanceof Promise?(o.push(t),i=!0):o.push(t)}return i?Promise.all(o).then((t=>Sr(t,a,e,s))):Sr(o,a,e,s)}})),Tr=q("$ZodDiscriminatedUnion",((e,t)=>{t.inclusive=!1,Ir.init(e,t);const n=e._zod.parse;se(e._zod,"propValues",(()=>{const e={};for(const n of t.options){const r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(const r of n)e[t].add(r)}}return e}));const r=te((()=>{const e=t.options,n=new Map;for(const r of e){const e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n}));e._zod.parse=(a,s)=>{const i=a.value;if(!de(i))return a.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),a;const o=r.value.get(i?.[t.discriminator]);return o?o._zod.run(a,s):t.unionFallback?n(a,s):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),a)}})),Or=q("$ZodIntersection",((e,t)=>{On.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,a=t.left._zod.run({value:r,issues:[]},n),s=t.right._zod.run({value:r,issues:[]},n);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then((([t,n])=>Ar(e,t,n))):Ar(e,a,s)}}));function Zr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(pe(e)&&pe(t)){const n=Object.keys(t),r=Object.keys(e).filter((e=>-1!==n.indexOf(e))),a={...e,...t};for(const n of r){const r=Zr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};a[n]=r.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const a=Zr(e[r],t[r]);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ar(e,t,n){const r=new Map;let a;for(const n of t.issues)if("unrecognized_keys"===n.code){a??(a=n);for(const e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);const s=[...r].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(s.length&&a&&e.issues.push({...a,keys:s}),ke(e))return e;const i=Zr(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const $r=q("$ZodTuple",((e,t)=>{On.init(e,t);const n=t.items;e._zod.parse=(r,a)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];const i=[],o=[...n].reverse().findIndex((e=>"optional"!==e._zod.optin)),u=-1===o?0:n.length-o;if(!t.rest){const t=s.length>n.length,a=s.length<u-1;if(t||a)return r.issues.push({...t?{code:"too_big",maximum:n.length,inclusive:!0}:{code:"too_small",minimum:n.length},input:s,inst:e,origin:"array"}),r}let c=-1;for(const e of n){if(c++,c>=s.length&&c>=u)continue;const t=e._zod.run({value:s[c],issues:[]},a);t instanceof Promise?i.push(t.then((e=>Nr(e,r,c)))):Nr(t,r,c)}if(t.rest){const e=s.slice(n.length);for(const n of e){c++;const e=t.rest._zod.run({value:n,issues:[]},a);e instanceof Promise?i.push(e.then((e=>Nr(e,r,c)))):Nr(e,r,c)}}return i.length?Promise.all(i).then((()=>r)):r}}));function Nr(e,t,n){e.issues.length&&t.issues.push(...xe(n,e.issues)),t.value[n]=e.value}const Pr=q("$ZodRecord",((e,t)=>{On.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!pe(a))return n.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const o=new Set;for(const e of i)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){o.add("number"==typeof e?e.toString():e);const i=t.valueType._zod.run({value:a[e],issues:[]},r);i instanceof Promise?s.push(i.then((t=>{t.issues.length&&n.issues.push(...xe(e,t.issues)),n.value[e]=t.value}))):(i.issues.length&&n.issues.push(...xe(e,i.issues)),n.value[e]=i.value)}let u;for(const e in a)o.has(e)||(u=u??[],u.push(e));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:u})}else{n.value={};for(const i of Reflect.ownKeys(a)){if("__proto__"===i)continue;let o=t.keyType._zod.run({value:i,issues:[]},r);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof i&&$t.test(i)&&o.issues.length){const e=t.keyType._zod.run({value:Number(i),issues:[]},r);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(o=e)}if(o.issues.length){"loose"===t.mode?n.value[i]=a[i]:n.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map((e=>Ie(e,r,X()))),input:i,path:[i],inst:e});continue}const u=t.valueType._zod.run({value:a[i],issues:[]},r);u instanceof Promise?s.push(u.then((e=>{e.issues.length&&n.issues.push(...xe(i,e.issues)),n.value[o.value]=e.value}))):(u.issues.length&&n.issues.push(...xe(i,u.issues)),n.value[o.value]=u.value)}}return s.length?Promise.all(s).then((()=>n)):n}})),Cr=q("$ZodMap",((e,t)=>{On.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!(a instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:a,inst:e}),n;const s=[];n.value=new Map;for(const[i,o]of a){const u=t.keyType._zod.run({value:i,issues:[]},r),c=t.valueType._zod.run({value:o,issues:[]},r);u instanceof Promise||c instanceof Promise?s.push(Promise.all([u,c]).then((([t,s])=>{jr(t,s,n,i,a,e,r)}))):jr(u,c,n,i,a,e,r)}return s.length?Promise.all(s).then((()=>n)):n}}));function jr(e,t,n,r,a,s,i){e.issues.length&&(me.has(typeof r)?n.issues.push(...xe(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:a,inst:s,issues:e.issues.map((e=>Ie(e,i,X())))})),t.issues.length&&(me.has(typeof r)?n.issues.push(...xe(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:a,inst:s,key:r,issues:t.issues.map((e=>Ie(e,i,X())))})),n.value.set(e.value,t.value)}const Rr=q("$ZodSet",((e,t)=>{On.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!(a instanceof Set))return n.issues.push({input:a,inst:e,expected:"set",code:"invalid_type"}),n;const s=[];n.value=new Set;for(const e of a){const a=t.valueType._zod.run({value:e,issues:[]},r);a instanceof Promise?s.push(a.then((e=>Mr(e,n)))):Mr(a,n)}return s.length?Promise.all(s).then((()=>n)):n}}));function Mr(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const Fr=q("$ZodEnum",((e,t)=>{On.init(e,t);const n=H(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter((e=>me.has(typeof e))).map((e=>"string"==typeof e?ve(e):e.toString())).join("|")})$`),e._zod.parse=(t,a)=>{const s=t.value;return r.has(s)||t.issues.push({code:"invalid_value",values:n,input:s,inst:e}),t}})),Dr=q("$ZodLiteral",((e,t)=>{if(On.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map((e=>"string"==typeof e?ve(e):e?ve(e.toString()):String(e))).join("|")})$`),e._zod.parse=(r,a)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}})),Lr=q("$ZodFile",((e,t)=>{On.init(e,t),e._zod.parse=(t,n)=>{const r=t.value;return r instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),t}})),Ur=q("$ZodTransform",((e,t)=>{On.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Y(e.constructor.name);const a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then((e=>(n.value=e,n)));if(a instanceof Promise)throw new K;return n.value=a,n}}));function Jr(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Vr=q("$ZodOptional",((e,t)=>{On.init(e,t),e._zod.optin="optional",e._zod.optout="optional",se(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0)),se(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${re(e.source)})?$`):void 0})),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((t=>Jr(t,e.value))):Jr(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}})),Br=q("$ZodExactOptional",((e,t)=>{Vr.init(e,t),se(e._zod,"values",(()=>t.innerType._zod.values)),se(e._zod,"pattern",(()=>t.innerType._zod.pattern)),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)})),Wr=q("$ZodNullable",((e,t)=>{On.init(e,t),se(e._zod,"optin",(()=>t.innerType._zod.optin)),se(e._zod,"optout",(()=>t.innerType._zod.optout)),se(e._zod,"pattern",(()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${re(e.source)}|null)$`):void 0})),se(e._zod,"values",(()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0)),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)})),qr=q("$ZodDefault",((e,t)=>{On.init(e,t),e._zod.optin="optional",se(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((e=>Kr(e,t))):Kr(r,t)}}));function Kr(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Yr=q("$ZodPrefault",((e,t)=>{On.init(e,t),e._zod.optin="optional",se(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))})),Gr=q("$ZodNonOptional",((e,t)=>{On.init(e,t),se(e._zod,"values",(()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then((t=>Xr(t,e))):Xr(a,e)}}));function Xr(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Hr=q("$ZodSuccess",((e,t)=>{On.init(e,t),e._zod.parse=(e,n)=>{if("backward"===n.direction)throw new Y("ZodSuccess");const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((t=>(e.value=0===t.issues.length,e))):(e.value=0===r.issues.length,e)}})),Qr=q("$ZodCatch",((e,t)=>{On.init(e,t),se(e._zod,"optin",(()=>t.innerType._zod.optin)),se(e._zod,"optout",(()=>t.innerType._zod.optout)),se(e._zod,"values",(()=>t.innerType._zod.values)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then((r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map((e=>Ie(e,n,X())))},input:e.value}),e.issues=[]),e))):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map((e=>Ie(e,n,X())))},input:e.value}),e.issues=[]),e)}})),ea=q("$ZodNaN",((e,t)=>{On.init(e,t),e._zod.parse=(t,n)=>("number"==typeof t.value&&Number.isNaN(t.value)||t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t)})),ta=q("$ZodPipe",((e,t)=>{On.init(e,t),se(e._zod,"values",(()=>t.in._zod.values)),se(e._zod,"optin",(()=>t.in._zod.optin)),se(e._zod,"optout",(()=>t.out._zod.optout)),se(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("backward"===n.direction){const r=t.out._zod.run(e,n);return r instanceof Promise?r.then((e=>na(e,t.in,n))):na(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then((e=>na(e,t.out,n))):na(r,t.out,n)}}));function na(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ra=q("$ZodCodec",((e,t)=>{On.init(e,t),se(e._zod,"values",(()=>t.in._zod.values)),se(e._zod,"optin",(()=>t.in._zod.optin)),se(e._zod,"optout",(()=>t.out._zod.optout)),se(e._zod,"propValues",(()=>t.in._zod.propValues)),e._zod.parse=(e,n)=>{if("forward"===(n.direction||"forward")){const r=t.in._zod.run(e,n);return r instanceof Promise?r.then((e=>aa(e,t,n))):aa(r,t,n)}{const r=t.out._zod.run(e,n);return r instanceof Promise?r.then((e=>aa(e,t,n))):aa(r,t,n)}}}));function aa(e,t,n){if(e.issues.length)return e.aborted=!0,e;if("forward"===(n.direction||"forward")){const r=t.transform(e.value,e);return r instanceof Promise?r.then((r=>sa(e,r,t.out,n))):sa(e,r,t.out,n)}{const r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then((r=>sa(e,r,t.in,n))):sa(e,r,t.in,n)}}function sa(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const ia=q("$ZodReadonly",((e,t)=>{On.init(e,t),se(e._zod,"propValues",(()=>t.innerType._zod.propValues)),se(e._zod,"values",(()=>t.innerType._zod.values)),se(e._zod,"optin",(()=>t.innerType?._zod?.optin)),se(e._zod,"optout",(()=>t.innerType?._zod?.optout)),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(oa):oa(r)}}));function oa(e){return e.value=Object.freeze(e.value),e}const ua=q("$ZodTemplateLiteral",((e,t)=>{On.init(e,t);const n=[];for(const e of t.parts)if("object"==typeof e&&null!==e){if(!e._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);const t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw new Error(`Invalid template literal part: ${e._zod.traits}`);const r=t.startsWith("^")?1:0,a=t.endsWith("$")?t.length-1:t.length;n.push(t.slice(r,a))}else{if(null!==e&&!fe.has(typeof e))throw new Error(`Invalid template literal part: ${e}`);n.push(ve(`${e}`))}e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(n,r)=>"string"!=typeof n.value?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)})),ca=q("$ZodFunction",((e,t)=>(On.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if("function"!=typeof t)throw new Error("implement() must be called with a function");return function(...n){const r=e._def.input?Ne(e._def.input,n):n,a=Reflect.apply(t,this,r);return e._def.output?Ne(e._def.output,a):a}},e.implementAsync=t=>{if("function"!=typeof t)throw new Error("implementAsync() must be called with a function");return async function(...n){const r=e._def.input?await Ce(e._def.input,n):n,a=await Reflect.apply(t,this,r);return e._def.output?await Ce(e._def.output,a):a}},e._zod.parse=(t,n)=>{if("function"!=typeof t.value)return t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t;const r=e._def.output&&"promise"===e._def.output._zod.def.type;return t.value=r?e.implementAsync(t.value):e.implement(t.value),t},e.input=(...t)=>{const n=e.constructor;return Array.isArray(t[0])?new n({type:"function",input:new $r({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output}):new n({type:"function",input:t[0],output:e._def.output})},e.output=t=>new(0,e.constructor)({type:"function",input:e._def.input,output:t}),e))),da=q("$ZodPromise",((e,t)=>{On.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then((e=>t.innerType._zod.run({value:e,issues:[]},n)))})),la=q("$ZodLazy",((e,t)=>{On.init(e,t),se(e._zod,"innerType",(()=>t.getter())),se(e._zod,"pattern",(()=>e._zod.innerType?._zod?.pattern)),se(e._zod,"propValues",(()=>e._zod.innerType?._zod?.propValues)),se(e._zod,"optin",(()=>e._zod.innerType?._zod?.optin??void 0)),se(e._zod,"optout",(()=>e._zod.innerType?._zod?.optout??void 0)),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)})),pa=q("$ZodCustom",((e,t)=>{nn.init(e,t),On.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then((t=>ha(t,n,r,e)));ha(a,n,r,e)}}));function ha(e,t,n,r){if(!e){const e={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Te(e))}}var ma;Symbol("ZodOutput"),Symbol("ZodInput");(ma=globalThis).__zod_globalRegistry??(ma.__zod_globalRegistry=new class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}});const fa=globalThis.__zod_globalRegistry;function va(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ge(t)})}function ya(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ge(t)})}function ga(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ge(t)})}function _a(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ge(t)})}function ba(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ge(t)})}function wa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ge(t)})}function ka(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ge(t)})}function xa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ge(t)})}function za(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ge(t)})}function Ia(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ge(t)})}function Sa(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ge(t)})}function Ea(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ge(t)})}function Ta(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ge(t)})}function Oa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ge(t)})}function Za(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ge(t)})}function Aa(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ge(t)})}function $a(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ge(t)})}function Na(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ge(t)})}function Pa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ge(t)})}function Ca(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ge(t)})}function ja(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ge(t)})}function Ra(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ge(t)})}function Ma(e,t){return new an({check:"less_than",...ge(t),value:e,inclusive:!1})}function Fa(e,t){return new an({check:"less_than",...ge(t),value:e,inclusive:!0})}function Da(e,t){return new sn({check:"greater_than",...ge(t),value:e,inclusive:!1})}function La(e,t){return new sn({check:"greater_than",...ge(t),value:e,inclusive:!0})}function Ua(e){return Da(0,e)}function Ja(e){return Ma(0,e)}function Va(e){return Fa(0,e)}function Ba(e){return La(0,e)}function Wa(e,t){return new on({check:"multiple_of",...ge(t),value:e})}function qa(e,t){return new dn({check:"max_size",...ge(t),maximum:e})}function Ka(e,t){return new ln({check:"min_size",...ge(t),minimum:e})}function Ya(e,t){return new pn({check:"size_equals",...ge(t),size:e})}function Ga(e,t){return new hn({check:"max_length",...ge(t),maximum:e})}function Xa(e,t){return new mn({check:"min_length",...ge(t),minimum:e})}function Ha(e,t){return new fn({check:"length_equals",...ge(t),length:e})}function Qa(e,t){return new yn({check:"string_format",format:"regex",...ge(t),pattern:e})}function es(e){return new gn({check:"string_format",format:"lowercase",...ge(e)})}function ts(e){return new _n({check:"string_format",format:"uppercase",...ge(e)})}function ns(e,t){return new bn({check:"string_format",format:"includes",...ge(t),includes:e})}function rs(e,t){return new wn({check:"string_format",format:"starts_with",...ge(t),prefix:e})}function as(e,t){return new kn({check:"string_format",format:"ends_with",...ge(t),suffix:e})}function ss(e,t,n){return new zn({check:"property",property:e,schema:t,...ge(n)})}function is(e,t){return new In({check:"mime_type",mime:e,...ge(t)})}function os(e){return new Sn({check:"overwrite",tx:e})}function us(e){return os((t=>t.normalize(e)))}function cs(){return os((e=>e.trim()))}function ds(){return os((e=>e.toLowerCase()))}function ls(){return os((e=>e.toUpperCase()))}function ps(){return os((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}function hs(e,t,n,r={}){const a=ge(r),s={...ge(r),check:"string_format",type:"string",format:t,fn:"function"==typeof n?n:e=>n.test(e),...a};return n instanceof RegExp&&(s.pattern=n),new e(s)}function ms(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??fa,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fs(e,t,n={path:[],schemaPath:[]}){var r;const a=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const o=e._zod.toJSONSchema?.();if(o)i.schema=o;else{const r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,r);else{const n=i.schema,s=t.processors[a.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);s(e,t,n,r)}const s=e._zod.parent;s&&(i.ref||(i.ref=s),fs(s,t,r),t.seen.get(s).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(i.schema,u),"input"===t.io&&gs(e)&&(delete i.schema.examples,delete i.schema.default),"input"===t.io&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function vs(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=r.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}const a=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:a,defId:s}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(n)return{ref:a(n)};const s=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=s,{defId:s,ref:`${a("__shared")}#/${r}/${s}`}}if(t[1]===n)return{ref:"#"};const a=`#/${r}/`,s=t[1].schema.id??"__schema"+e.counter++;return{defId:s,ref:a+s}})(t);r.def={...r.schema},s&&(r.defId=s);const i=r.schema;for(const e in i)delete i[e];i.$ref=a};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const r=n[1];if(t===n[0]){a(n);continue}if(e.external){const r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}const s=e.metadataRegistry.get(n[0])?.id;(s||r.cycle||r.count>1&&"ref"===e.reused)&&a(n)}}function ys(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=t=>{const n=e.seen.get(t);if(null===n.ref)return;const a=n.def??n.schema,s={...a},i=n.ref;if(n.ref=null,i){r(i);const n=e.seen.get(i),o=n.schema;if(!o.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(a,o):(a.allOf=a.allOf??[],a.allOf.push(o)),Object.assign(a,s),t._zod.parent===i)for(const e in a)"$ref"!==e&&"allOf"!==e&&(e in s||delete a[e]);if(o.$ref&&n.def)for(const e in a)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(a[e])===JSON.stringify(n.def[e])&&delete a[e]}const o=t._zod.parent;if(o&&o!==i){r(o);const t=e.seen.get(o);if(t?.schema.$ref&&(a.$ref=t.schema.$ref,t.def))for(const e in a)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(a[e])===JSON.stringify(t.def[e])&&delete a[e]}e.override({zodSchema:t,jsonSchema:a,path:n.path??[]})};for(const t of[...e.seen.entries()].reverse())r(t[0]);const a={};if("draft-2020-12"===e.target?a.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?a.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(n)}Object.assign(a,n.def??n.schema);const s=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(s[e.defId]=e.def)}e.external||Object.keys(s).length>0&&("draft-2020-12"===e.target?a.$defs=s:a.definitions=s);try{const n=JSON.parse(JSON.stringify(a));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:_s(t,"input",e.processors),output:_s(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function gs(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if("transform"===r.type)return!0;if("array"===r.type)return gs(r.element,n);if("set"===r.type)return gs(r.valueType,n);if("lazy"===r.type)return gs(r.getter(),n);if("promise"===r.type||"optional"===r.type||"nonoptional"===r.type||"nullable"===r.type||"readonly"===r.type||"default"===r.type||"prefault"===r.type)return gs(r.innerType,n);if("intersection"===r.type)return gs(r.left,n)||gs(r.right,n);if("record"===r.type||"map"===r.type)return gs(r.keyType,n)||gs(r.valueType,n);if("pipe"===r.type)return gs(r.in,n)||gs(r.out,n);if("object"===r.type){for(const e in r.shape)if(gs(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(gs(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(gs(e,n))return!0;return!(!r.rest||!gs(r.rest,n))}return!1}const _s=(e,t,n={})=>r=>{const{libraryOptions:a,target:s}=r??{},i=ms({...a??{},target:s,io:t,processors:n});return fs(e,i),vs(i,e),ys(i,e)},bs={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ws=(e,t,n,r)=>{const a=n;a.type="string";const{minimum:s,maximum:i,format:o,patterns:u,contentEncoding:c}=e._zod.bag;if("number"==typeof s&&(a.minLength=s),"number"==typeof i&&(a.maxLength=i),o&&(a.format=bs[o]??o,""===a.format&&delete a.format,"time"===o&&delete a.format),c&&(a.contentEncoding=c),u&&u.size>0){const e=[...u];1===e.length?a.pattern=e[0].source:e.length>1&&(a.allOf=[...e.map((e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source})))])}},ks=(e,t,n,r)=>{const a=n,{minimum:s,maximum:i,format:o,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof o&&o.includes("int")?a.type="integer":a.type="number","number"==typeof d&&("draft-04"===t.target||"openapi-3.0"===t.target?(a.minimum=d,a.exclusiveMinimum=!0):a.exclusiveMinimum=d),"number"==typeof s&&(a.minimum=s,"number"==typeof d&&"draft-04"!==t.target&&(d>=s?delete a.minimum:delete a.exclusiveMinimum)),"number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(a.maximum=c,a.exclusiveMaximum=!0):a.exclusiveMaximum=c),"number"==typeof i&&(a.maximum=i,"number"==typeof c&&"draft-04"!==t.target&&(c<=i?delete a.maximum:delete a.exclusiveMaximum)),"number"==typeof u&&(a.multipleOf=u)},xs=(e,t,n,r)=>{n.type="boolean"},zs=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema")},Is=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Symbols cannot be represented in JSON Schema")},Ss=(e,t,n,r)=>{"openapi-3.0"===t.target?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Es=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema")},Ts=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Void cannot be represented in JSON Schema")},Os=(e,t,n,r)=>{n.not={}},Zs=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Date cannot be represented in JSON Schema")},As=(e,t,n,r)=>{const a=H(e._zod.def.entries);a.every((e=>"number"==typeof e))&&(n.type="number"),a.every((e=>"string"==typeof e))&&(n.type="string"),n.enum=a},$s=(e,t,n,r)=>{const a=e._zod.def,s=[];for(const e of a.values)if(void 0===e){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof e){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(e))}else s.push(e);if(0===s.length);else if(1===s.length){const e=s[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else s.every((e=>"number"==typeof e))&&(n.type="number"),s.every((e=>"string"==typeof e))&&(n.type="string"),s.every((e=>"boolean"==typeof e))&&(n.type="boolean"),s.every((e=>null===e))&&(n.type="null"),n.enum=s},Ns=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("NaN cannot be represented in JSON Schema")},Ps=(e,t,n,r)=>{const a=n,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");a.type="string",a.pattern=s.source},Cs=(e,t,n,r)=>{const a=n,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:o,mime:u}=e._zod.bag;void 0!==i&&(s.minLength=i),void 0!==o&&(s.maxLength=o),u?1===u.length?(s.contentMediaType=u[0],Object.assign(a,s)):(Object.assign(a,s),a.anyOf=u.map((e=>({contentMediaType:e})))):Object.assign(a,s)},js=(e,t,n,r)=>{n.type="boolean"},Rs=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")},Ms=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Function types cannot be represented in JSON Schema")},Fs=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")},Ds=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Map cannot be represented in JSON Schema")},Ls=(e,t,n,r)=>{if("throw"===t.unrepresentable)throw new Error("Set cannot be represented in JSON Schema")},Us=(e,t,n,r)=>{const a=n,s=e._zod.def,{minimum:i,maximum:o}=e._zod.bag;"number"==typeof i&&(a.minItems=i),"number"==typeof o&&(a.maxItems=o),a.type="array",a.items=fs(s.element,t,{...r,path:[...r.path,"items"]})},Js=(e,t,n,r)=>{const a=n,s=e._zod.def;a.type="object",a.properties={};const i=s.shape;for(const e in i)a.properties[e]=fs(i[e],t,{...r,path:[...r.path,"properties",e]});const o=new Set(Object.keys(i)),u=new Set([...o].filter((e=>{const n=s.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout})));u.size>0&&(a.required=Array.from(u)),"never"===s.catchall?._zod.def.type?a.additionalProperties=!1:s.catchall?s.catchall&&(a.additionalProperties=fs(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)},Vs=(e,t,n,r)=>{const a=e._zod.def,s=!1===a.inclusive,i=a.options.map(((e,n)=>fs(e,t,{...r,path:[...r.path,s?"oneOf":"anyOf",n]})));s?n.oneOf=i:n.anyOf=i},Bs=(e,t,n,r)=>{const a=e._zod.def,s=fs(a.left,t,{...r,path:[...r.path,"allOf",0]}),i=fs(a.right,t,{...r,path:[...r.path,"allOf",1]}),o=e=>"allOf"in e&&1===Object.keys(e).length,u=[...o(s)?s.allOf:[s],...o(i)?i.allOf:[i]];n.allOf=u},Ws=(e,t,n,r)=>{const a=n,s=e._zod.def;a.type="array";const i="draft-2020-12"===t.target?"prefixItems":"items",o="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",u=s.items.map(((e,n)=>fs(e,t,{...r,path:[...r.path,i,n]}))),c=s.rest?fs(s.rest,t,{...r,path:[...r.path,o,..."openapi-3.0"===t.target?[s.items.length]:[]]}):null;"draft-2020-12"===t.target?(a.prefixItems=u,c&&(a.items=c)):"openapi-3.0"===t.target?(a.items={anyOf:u},c&&a.items.anyOf.push(c),a.minItems=u.length,c||(a.maxItems=u.length)):(a.items=u,c&&(a.additionalItems=c));const{minimum:d,maximum:l}=e._zod.bag;"number"==typeof d&&(a.minItems=d),"number"==typeof l&&(a.maxItems=l)},qs=(e,t,n,r)=>{const a=n,s=e._zod.def;a.type="object";const i=s.keyType,o=i._zod.bag?.patterns;if("loose"===s.mode&&o&&o.size>0){const e=fs(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});a.patternProperties={};for(const t of o)a.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(a.propertyNames=fs(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),a.additionalProperties=fs(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const e=[...u].filter((e=>"string"==typeof e||"number"==typeof e));e.length>0&&(a.required=e)}},Ks=(e,t,n,r)=>{const a=e._zod.def,s=fs(a.innerType,t,r),i=t.seen.get(e);"openapi-3.0"===t.target?(i.ref=a.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Ys=(e,t,n,r)=>{const a=e._zod.def;fs(a.innerType,t,r),t.seen.get(e).ref=a.innerType},Gs=(e,t,n,r)=>{const a=e._zod.def;fs(a.innerType,t,r),t.seen.get(e).ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},Xs=(e,t,n,r)=>{const a=e._zod.def;fs(a.innerType,t,r),t.seen.get(e).ref=a.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},Hs=(e,t,n,r)=>{const a=e._zod.def;let s;fs(a.innerType,t,r),t.seen.get(e).ref=a.innerType;try{s=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},Qs=(e,t,n,r)=>{const a=e._zod.def,s="input"===t.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;fs(s,t,r),t.seen.get(e).ref=s},ei=(e,t,n,r)=>{const a=e._zod.def;fs(a.innerType,t,r),t.seen.get(e).ref=a.innerType,n.readOnly=!0},ti=(e,t,n,r)=>{const a=e._zod.def;fs(a.innerType,t,r),t.seen.get(e).ref=a.innerType},ni=(e,t,n,r)=>{const a=e._zod.def;fs(a.innerType,t,r),t.seen.get(e).ref=a.innerType},ri=(e,t,n,r)=>{const a=e._zod.innerType;fs(a,t,r),t.seen.get(e).ref=a},ai={string:ws,number:ks,boolean:xs,bigint:zs,symbol:Is,null:Ss,undefined:Es,void:Ts,never:Os,any:(e,t,n,r)=>{},unknown:(e,t,n,r)=>{},date:Zs,enum:As,literal:$s,nan:Ns,template_literal:Ps,file:Cs,success:js,custom:Rs,function:Ms,transform:Fs,map:Ds,set:Ls,array:Us,object:Js,union:Vs,intersection:Bs,tuple:Ws,record:qs,nullable:Ks,nonoptional:Ys,default:Gs,prefault:Xs,catch:Hs,pipe:Qs,readonly:ei,promise:ti,optional:ni,lazy:ri},si=q("ZodISODateTime",((e,t)=>{Jn.init(e,t),Ai.init(e,t)}));function ii(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ge(t)})}(si,e)}const oi=q("ZodISODate",((e,t)=>{Vn.init(e,t),Ai.init(e,t)}));function ui(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...ge(t)})}(oi,e)}const ci=q("ZodISOTime",((e,t)=>{Bn.init(e,t),Ai.init(e,t)}));function di(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ge(t)})}(ci,e)}const li=q("ZodISODuration",((e,t)=>{Wn.init(e,t),Ai.init(e,t)}));function pi(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...ge(t)})}(li,e)}const hi=(e,t)=>{Ze.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=(e=>e.message)){const n={_errors:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map((e=>r({issues:e})));else if("invalid_key"===a.code)r({issues:a.issues});else if("invalid_element"===a.code)r({issues:a.issues});else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=(e=>e.message)){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ee,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ee,2)}},isEmpty:{get:()=>0===e.issues.length}})},mi=(q("ZodError",hi),q("ZodError",hi,{Parent:Error})),fi=$e(mi),vi=Pe(mi),yi=je(mi),gi=Me(mi),_i=De(mi),bi=Le(mi),wi=Ue(mi),ki=Je(mi),xi=Ve(mi),zi=Be(mi),Ii=We(mi),Si=qe(mi),Ei=q("ZodType",((e,t)=>(On.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:_s(e,"input"),output:_s(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=ms({...n,processors:t});return fs(e,r),vs(r,e),ys(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(oe(t,{checks:[...t.checks??[],...n.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>ye(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>fi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>yi(e,t,n),e.parseAsync=async(t,n)=>vi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>gi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>_i(e,t,n),e.decode=(t,n)=>bi(e,t,n),e.encodeAsync=async(t,n)=>wi(e,t,n),e.decodeAsync=async(t,n)=>ki(e,t,n),e.safeEncode=(t,n)=>xi(e,t,n),e.safeDecode=(t,n)=>zi(e,t,n),e.safeEncodeAsync=async(t,n)=>Ii(e,t,n),e.safeDecodeAsync=async(t,n)=>Si(e,t,n),e.refine=(t,n)=>e.check(wc(t,n)),e.superRefine=t=>e.check(kc(t)),e.overwrite=t=>e.check(os(t)),e.optional=()=>Du(e),e.exactOptional=()=>Uu(e),e.nullable=()=>Vu(e),e.nullish=()=>Du(Vu(e)),e.nonoptional=t=>Xu(e,t),e.array=()=>iu(e),e.or=t=>hu([e,t]),e.and=t=>_u(e,t),e.transform=t=>sc(e,Mu(t)),e.default=t=>qu(e,t),e.prefault=t=>Yu(e,t),e.catch=t=>tc(e,t),e.pipe=t=>sc(e,t),e.readonly=()=>cc(e),e.describe=t=>{const n=e.clone();return fa.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>fa.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return fa.get(e);const n=e.clone();return fa.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e))),Ti=q("_ZodString",((e,t)=>{Zn.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ws(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Qa(...t)),e.includes=(...t)=>e.check(ns(...t)),e.startsWith=(...t)=>e.check(rs(...t)),e.endsWith=(...t)=>e.check(as(...t)),e.min=(...t)=>e.check(Xa(...t)),e.max=(...t)=>e.check(Ga(...t)),e.length=(...t)=>e.check(Ha(...t)),e.nonempty=(...t)=>e.check(Xa(1,...t)),e.lowercase=t=>e.check(es(t)),e.uppercase=t=>e.check(ts(t)),e.trim=()=>e.check(cs()),e.normalize=(...t)=>e.check(us(...t)),e.toLowerCase=()=>e.check(ds()),e.toUpperCase=()=>e.check(ls()),e.slugify=()=>e.check(ps())})),Oi=q("ZodString",((e,t)=>{Zn.init(e,t),Ti.init(e,t),e.email=t=>e.check(va($i,t)),e.url=t=>e.check(ka(Li,t)),e.jwt=t=>e.check(Ra(wo,t)),e.emoji=t=>e.check(xa(Vi,t)),e.guid=t=>e.check(ya(Pi,t)),e.uuid=t=>e.check(ga(ji,t)),e.uuidv4=t=>e.check(_a(ji,t)),e.uuidv6=t=>e.check(ba(ji,t)),e.uuidv7=t=>e.check(wa(ji,t)),e.nanoid=t=>e.check(za(Wi,t)),e.guid=t=>e.check(ya(Pi,t)),e.cuid=t=>e.check(Ia(Ki,t)),e.cuid2=t=>e.check(Sa(Gi,t)),e.ulid=t=>e.check(Ea(Hi,t)),e.base64=t=>e.check(Pa(fo,t)),e.base64url=t=>e.check(Ca(yo,t)),e.xid=t=>e.check(Ta(eo,t)),e.ksuid=t=>e.check(Oa(no,t)),e.ipv4=t=>e.check(Za(ao,t)),e.ipv6=t=>e.check(Aa(uo,t)),e.cidrv4=t=>e.check($a(lo,t)),e.cidrv6=t=>e.check(Na(ho,t)),e.e164=t=>e.check(ja(_o,t)),e.datetime=t=>e.check(ii(t)),e.date=t=>e.check(ui(t)),e.time=t=>e.check(di(t)),e.duration=t=>e.check(pi(t))}));function Zi(e){return function(e,t){return new e({type:"string",...ge(t)})}(Oi,e)}const Ai=q("ZodStringFormat",((e,t)=>{An.init(e,t),Ti.init(e,t)})),$i=q("ZodEmail",((e,t)=>{Pn.init(e,t),Ai.init(e,t)}));function Ni(e){return va($i,e)}const Pi=q("ZodGUID",((e,t)=>{$n.init(e,t),Ai.init(e,t)}));function Ci(e){return ya(Pi,e)}const ji=q("ZodUUID",((e,t)=>{Nn.init(e,t),Ai.init(e,t)}));function Ri(e){return ga(ji,e)}function Mi(e){return _a(ji,e)}function Fi(e){return ba(ji,e)}function Di(e){return wa(ji,e)}const Li=q("ZodURL",((e,t)=>{Cn.init(e,t),Ai.init(e,t)}));function Ui(e){return ka(Li,e)}function Ji(e){return ka(Li,{protocol:/^https?$/,hostname:kt,...ge(e)})}const Vi=q("ZodEmoji",((e,t)=>{jn.init(e,t),Ai.init(e,t)}));function Bi(e){return xa(Vi,e)}const Wi=q("ZodNanoID",((e,t)=>{Rn.init(e,t),Ai.init(e,t)}));function qi(e){return za(Wi,e)}const Ki=q("ZodCUID",((e,t)=>{Mn.init(e,t),Ai.init(e,t)}));function Yi(e){return Ia(Ki,e)}const Gi=q("ZodCUID2",((e,t)=>{Fn.init(e,t),Ai.init(e,t)}));function Xi(e){return Sa(Gi,e)}const Hi=q("ZodULID",((e,t)=>{Dn.init(e,t),Ai.init(e,t)}));function Qi(e){return Ea(Hi,e)}const eo=q("ZodXID",((e,t)=>{Ln.init(e,t),Ai.init(e,t)}));function to(e){return Ta(eo,e)}const no=q("ZodKSUID",((e,t)=>{Un.init(e,t),Ai.init(e,t)}));function ro(e){return Oa(no,e)}const ao=q("ZodIPv4",((e,t)=>{qn.init(e,t),Ai.init(e,t)}));function so(e){return Za(ao,e)}const io=q("ZodMAC",((e,t)=>{Yn.init(e,t),Ai.init(e,t)}));function oo(e){return function(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...ge(t)})}(io,e)}const uo=q("ZodIPv6",((e,t)=>{Kn.init(e,t),Ai.init(e,t)}));function co(e){return Aa(uo,e)}const lo=q("ZodCIDRv4",((e,t)=>{Gn.init(e,t),Ai.init(e,t)}));function po(e){return $a(lo,e)}const ho=q("ZodCIDRv6",((e,t)=>{Xn.init(e,t),Ai.init(e,t)}));function mo(e){return Na(ho,e)}const fo=q("ZodBase64",((e,t)=>{Qn.init(e,t),Ai.init(e,t)}));function vo(e){return Pa(fo,e)}const yo=q("ZodBase64URL",((e,t)=>{er.init(e,t),Ai.init(e,t)}));function go(e){return Ca(yo,e)}const _o=q("ZodE164",((e,t)=>{tr.init(e,t),Ai.init(e,t)}));function bo(e){return ja(_o,e)}const wo=q("ZodJWT",((e,t)=>{nr.init(e,t),Ai.init(e,t)}));function ko(e){return Ra(wo,e)}const xo=q("ZodCustomStringFormat",((e,t)=>{rr.init(e,t),Ai.init(e,t)}));function zo(e,t,n={}){return hs(xo,e,t,n)}function Io(e){return hs(xo,"hostname",wt,e)}function So(e){return hs(xo,"hex",Mt,e)}function Eo(e,t){const n=`${e}_${t?.enc??"hex"}`,a=r[n];if(!a)throw new Error(`Unrecognized hash format: ${n}`);return hs(xo,n,a,t)}const To=q("ZodNumber",((e,t)=>{ar.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n),e.gt=(t,n)=>e.check(Da(t,n)),e.gte=(t,n)=>e.check(La(t,n)),e.min=(t,n)=>e.check(La(t,n)),e.lt=(t,n)=>e.check(Ma(t,n)),e.lte=(t,n)=>e.check(Fa(t,n)),e.max=(t,n)=>e.check(Fa(t,n)),e.int=t=>e.check(Ao(t)),e.safe=t=>e.check(Ao(t)),e.positive=t=>e.check(Da(0,t)),e.nonnegative=t=>e.check(La(0,t)),e.negative=t=>e.check(Ma(0,t)),e.nonpositive=t=>e.check(Fa(0,t)),e.multipleOf=(t,n)=>e.check(Wa(t,n)),e.step=(t,n)=>e.check(Wa(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}));function Oo(e){return function(e,t){return new e({type:"number",checks:[],...ge(t)})}(To,e)}const Zo=q("ZodNumberFormat",((e,t)=>{sr.init(e,t),To.init(e,t)}));function Ao(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ge(t)})}(Zo,e)}function $o(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...ge(t)})}(Zo,e)}function No(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...ge(t)})}(Zo,e)}function Po(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...ge(t)})}(Zo,e)}function Co(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...ge(t)})}(Zo,e)}const jo=q("ZodBoolean",((e,t)=>{ir.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>xs(0,0,t)}));function Ro(e){return function(e,t){return new e({type:"boolean",...ge(t)})}(jo,e)}const Mo=q("ZodBigInt",((e,t)=>{or.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>zs(0,e),e.gte=(t,n)=>e.check(La(t,n)),e.min=(t,n)=>e.check(La(t,n)),e.gt=(t,n)=>e.check(Da(t,n)),e.gte=(t,n)=>e.check(La(t,n)),e.min=(t,n)=>e.check(La(t,n)),e.lt=(t,n)=>e.check(Ma(t,n)),e.lte=(t,n)=>e.check(Fa(t,n)),e.max=(t,n)=>e.check(Fa(t,n)),e.positive=t=>e.check(Da(BigInt(0),t)),e.negative=t=>e.check(Ma(BigInt(0),t)),e.nonpositive=t=>e.check(Fa(BigInt(0),t)),e.nonnegative=t=>e.check(La(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(Wa(t,n));const n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null}));function Fo(e){return function(e,t){return new e({type:"bigint",...ge(t)})}(Mo,e)}const Do=q("ZodBigIntFormat",((e,t)=>{ur.init(e,t),Mo.init(e,t)}));function Lo(e){return function(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...ge(t)})}(Do,e)}function Uo(e){return function(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...ge(t)})}(Do,e)}const Jo=q("ZodSymbol",((e,t)=>{cr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Is(0,e)}));function Vo(e){return function(e,t){return new e({type:"symbol",...ge(t)})}(Jo,e)}const Bo=q("ZodUndefined",((e,t)=>{dr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Es(0,e)}));function Wo(e){return function(e,t){return new e({type:"undefined",...ge(t)})}(Bo,e)}const qo=q("ZodNull",((e,t)=>{lr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Ss(0,e,t)}));function Ko(e){return function(e,t){return new e({type:"null",...ge(t)})}(qo,e)}const Yo=q("ZodAny",((e,t)=>{pr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function Go(){return new Yo({type:"any"})}const Xo=q("ZodUnknown",((e,t)=>{hr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}}));function Ho(){return new Xo({type:"unknown"})}const Qo=q("ZodNever",((e,t)=>{mr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Os(0,0,t)}));function eu(e){return function(e,t){return new e({type:"never",...ge(t)})}(Qo,e)}const tu=q("ZodVoid",((e,t)=>{fr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Ts(0,e)}));function nu(e){return function(e,t){return new e({type:"void",...ge(t)})}(tu,e)}const ru=q("ZodDate",((e,t)=>{vr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Zs(0,e),e.min=(t,n)=>e.check(La(t,n)),e.max=(t,n)=>e.check(Fa(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null}));function au(e){return function(e,t){return new e({type:"date",...ge(t)})}(ru,e)}const su=q("ZodArray",((e,t)=>{gr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Us(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Xa(t,n)),e.nonempty=t=>e.check(Xa(1,t)),e.max=(t,n)=>e.check(Ga(t,n)),e.length=(t,n)=>e.check(Ha(t,n)),e.unwrap=()=>e.element}));function iu(e,t){return function(e,t,n){return new e({type:"array",element:t,...ge(n)})}(su,e,t)}function ou(e){const t=e._zod.def.shape;return Au(Object.keys(t))}const uu=q("ZodObject",((e,t)=>{xr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Js(e,t,n,r),se(e,"shape",(()=>t.shape)),e.keyof=()=>Au(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ho()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ho()}),e.strict=()=>e.clone({...e._zod.def,catchall:eu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!pe(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const r=oe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return ie(this,"shape",n),n}});return ye(e,r)}(e,t),e.safeExtend=t=>function(e,t){if(!pe(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=oe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return ie(this,"shape",n),n}});return ye(e,n)}(e,t),e.merge=t=>function(e,t){const n=oe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return ie(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ye(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return ye(e,oe(e._zod.def,{get shape(){const e={};for(const r in t){if(!(r in n.shape))throw new Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ie(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=oe(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ie(this,"shape",r),r},checks:[]});return ye(e,a)}(e,t),e.partial=(...t)=>function(e,t,n){const r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=oe(t._zod.def,{get shape(){const r=t._zod.def.shape,a={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(a[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)a[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return ie(this,"shape",a),a},checks:[]});return ye(t,a)}(Fu,e,t[0]),e.required=(...t)=>function(e,t,n){const r=oe(t._zod.def,{get shape(){const r=t._zod.def.shape,a={...r};if(n)for(const t in n){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(a[t]=new e({type:"nonoptional",innerType:r[t]}))}else for(const t in r)a[t]=new e({type:"nonoptional",innerType:r[t]});return ie(this,"shape",a),a}});return ye(t,r)}(Gu,e,t[0])}));function cu(e,t){const n={type:"object",shape:e??{},...ge(t)};return new uu(n)}function du(e,t){return new uu({type:"object",shape:e,catchall:eu(),...ge(t)})}function lu(e,t){return new uu({type:"object",shape:e,catchall:Ho(),...ge(t)})}const pu=q("ZodUnion",((e,t)=>{Ir.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vs(e,t,n,r),e.options=t.options}));function hu(e,t){return new pu({type:"union",options:e,...ge(t)})}const mu=q("ZodXor",((e,t)=>{pu.init(e,t),Er.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vs(e,t,n,r),e.options=t.options}));function fu(e,t){return new mu({type:"union",options:e,inclusive:!1,...ge(t)})}const vu=q("ZodDiscriminatedUnion",((e,t)=>{pu.init(e,t),Tr.init(e,t)}));function yu(e,t,n){return new vu({type:"union",options:t,discriminator:e,...ge(n)})}const gu=q("ZodIntersection",((e,t)=>{Or.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bs(e,t,n,r)}));function _u(e,t){return new gu({type:"intersection",left:e,right:t})}const bu=q("ZodTuple",((e,t)=>{$r.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ws(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})}));function wu(e,t,n){const r=t instanceof On;return new bu({type:"tuple",items:e,rest:r?t:null,...ge(r?n:t)})}const ku=q("ZodRecord",((e,t)=>{Pr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qs(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType}));function xu(e,t,n){return new ku({type:"record",keyType:e,valueType:t,...ge(n)})}function zu(e,t,n){const r=ye(e);return r._zod.values=void 0,new ku({type:"record",keyType:r,valueType:t,...ge(n)})}function Iu(e,t,n){return new ku({type:"record",keyType:e,valueType:t,mode:"loose",...ge(n)})}const Su=q("ZodMap",((e,t)=>{Cr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Ds(0,e),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(Ka(...t)),e.nonempty=t=>e.check(Ka(1,t)),e.max=(...t)=>e.check(qa(...t)),e.size=(...t)=>e.check(Ya(...t))}));function Eu(e,t,n){return new Su({type:"map",keyType:e,valueType:t,...ge(n)})}const Tu=q("ZodSet",((e,t)=>{Rr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Ls(0,e),e.min=(...t)=>e.check(Ka(...t)),e.nonempty=t=>e.check(Ka(1,t)),e.max=(...t)=>e.check(qa(...t)),e.size=(...t)=>e.check(Ya(...t))}));function Ou(e,t){return new Tu({type:"set",valueType:e,...ge(t)})}const Zu=q("ZodEnum",((e,t)=>{Fr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{const a={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);a[r]=t.entries[r]}return new Zu({...t,checks:[],...ge(r),entries:a})},e.exclude=(e,r)=>{const a={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete a[t]}return new Zu({...t,checks:[],...ge(r),entries:a})}}));function Au(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Zu({type:"enum",entries:n,...ge(t)})}function $u(e,t){return new Zu({type:"enum",entries:e,...ge(t)})}const Nu=q("ZodLiteral",((e,t)=>{Dr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}));function Pu(e,t){return new Nu({type:"literal",values:Array.isArray(e)?e:[e],...ge(t)})}const Cu=q("ZodFile",((e,t)=>{Lr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cs(e,0,n),e.min=(t,n)=>e.check(Ka(t,n)),e.max=(t,n)=>e.check(qa(t,n)),e.mime=(t,n)=>e.check(is(Array.isArray(t)?t:[t],n))}));function ju(e){return function(e,t){return new e({type:"file",...ge(t)})}(Cu,e)}const Ru=q("ZodTransform",((e,t)=>{Ur.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Fs(0,e),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Y(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(Te(r,n.value,t));else{const t=r;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(Te(t))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then((e=>(n.value=e,n))):(n.value=a,n)}}));function Mu(e){return new Ru({type:"transform",transform:e})}const Fu=q("ZodOptional",((e,t)=>{Vr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ni(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));function Du(e){return new Fu({type:"optional",innerType:e})}const Lu=q("ZodExactOptional",((e,t)=>{Br.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ni(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));function Uu(e){return new Lu({type:"optional",innerType:e})}const Ju=q("ZodNullable",((e,t)=>{Wr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ks(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));function Vu(e){return new Ju({type:"nullable",innerType:e})}function Bu(e){return Du(Vu(e))}const Wu=q("ZodDefault",((e,t)=>{qr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));function qu(e,t){return new Wu({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():he(t)}})}const Ku=q("ZodPrefault",((e,t)=>{Yr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));function Yu(e,t){return new Ku({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():he(t)}})}const Gu=q("ZodNonOptional",((e,t)=>{Gr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ys(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));function Xu(e,t){return new Gu({type:"nonoptional",innerType:e,...ge(t)})}const Hu=q("ZodSuccess",((e,t)=>{Hr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>js(0,0,t),e.unwrap=()=>e._zod.def.innerType}));function Qu(e){return new Hu({type:"success",innerType:e})}const ec=q("ZodCatch",((e,t)=>{Qr.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));function tc(e,t){return new ec({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})}const nc=q("ZodNaN",((e,t)=>{ea.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Ns(0,e)}));function rc(e){return function(e,t){return new e({type:"nan",...ge(t)})}(nc,e)}const ac=q("ZodPipe",((e,t)=>{ta.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qs(e,t,0,r),e.in=t.in,e.out=t.out}));function sc(e,t){return new ac({type:"pipe",in:e,out:t})}const ic=q("ZodCodec",((e,t)=>{ac.init(e,t),ra.init(e,t)}));function oc(e,t,n){return new ic({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}const uc=q("ZodReadonly",((e,t)=>{ia.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ei(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}));function cc(e){return new uc({type:"readonly",innerType:e})}const dc=q("ZodTemplateLiteral",((e,t)=>{ua.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ps(e,0,n)}));function lc(e,t){return new dc({type:"template_literal",parts:e,...ge(t)})}const pc=q("ZodLazy",((e,t)=>{la.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ri(e,t,0,r),e.unwrap=()=>e._zod.def.getter()}));function hc(e){return new pc({type:"lazy",getter:e})}const mc=q("ZodPromise",((e,t)=>{da.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ti(e,t,0,r),e.unwrap=()=>e._zod.def.innerType}));function fc(e){return new mc({type:"promise",innerType:e})}const vc=q("ZodFunction",((e,t)=>{ca.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Ms(0,e)}));function yc(e){return new vc({type:"function",input:Array.isArray(e?.input)?wu(e?.input):e?.input??iu(Ho()),output:e?.output??Ho()})}const gc=q("ZodCustom",((e,t)=>{pa.init(e,t),Ei.init(e,t),e._zod.processJSONSchema=(e,t,n)=>Rs(0,e)}));function _c(e){const t=new nn({check:"custom"});return t._zod.check=e,t}function bc(e,t){return function(e,t,n){const r=ge(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}(gc,e??(()=>!0),t)}function wc(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ge(n)})}(gc,e,t)}function kc(e){return function(e){const t=function(e,t){const n=new nn({check:"custom",...ge(void 0)});return n._zod.check=e,n}((n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(Te(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(Te(r))}},e(n.value,n))));return t}(e)}const xc=function(e){const t=new nn({check:"describe"});return t._zod.onattach=[t=>{const n=fa.get(t)??{};fa.add(t,{...n,description:e})}],t._zod.check=()=>{},t},zc=function(e){const t=new nn({check:"meta"});return t._zod.onattach=[t=>{const n=fa.get(t)??{};fa.add(t,{...n,...e})}],t._zod.check=()=>{},t};function Ic(e,t={}){const n=new gc({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...ge(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}const Sc=(...e)=>function(e,t){const n=ge(t);let r=n.truthy??["true","1","yes","on","y","enabled"],a=n.falsy??["false","0","no","off","n","disabled"];"sensitive"!==n.case&&(r=r.map((e=>"string"==typeof e?e.toLowerCase():e)),a=a.map((e=>"string"==typeof e?e.toLowerCase():e)));const s=new Set(r),i=new Set(a),o=e.Codec??ra,u=e.Boolean??ir,c=new o({type:"pipe",in:new(e.String??Zn)({type:"string",error:n.error}),out:new u({type:"boolean",error:n.error}),transform:(e,t)=>{let r=e;return"sensitive"!==n.case&&(r=r.toLowerCase()),!!s.has(r)||!i.has(r)&&(t.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...i],input:t.value,inst:c,continue:!1}),{})},reverseTransform:(e,t)=>!0===e?r[0]||"true":a[0]||"false",error:n.error});return c}({Codec:ic,Boolean:jo,String:Oi},...e);function Ec(e){const t=hc((()=>hu([Zi(e),Oo(),Ro(),Ko(),iu(t),xu(Zi(),t)])));return t}function Tc(e,t){return sc(Mu(e),t)}var Oc,Zc,Ac;Oc||(Oc={}),new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]),X({localeError:(()=>{const e={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 t(t){return e[t]??null}const n={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",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return e=>{switch(e.code){case"invalid_type":{const t=r[e.expected]??e.expected,n=function(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(null===e)return"null";if(Array.isArray(e))return"array";const t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return t}(e.input);return`Invalid input: expected ${t}, received ${r[n]??n}`}case"invalid_value":return 1===e.values.length?`Invalid input: expected ${_e(e.values[0])}`:`Invalid option: expected one of ${Q(e.values,"|")}`;case"too_big":{const n=e.inclusive?"<=":"<",r=t(e.origin);return r?`Too big: expected ${e.origin??"value"} to have ${n}${e.maximum.toString()} ${r.unit??"elements"}`:`Too big: expected ${e.origin??"value"} to be ${n}${e.maximum.toString()}`}case"too_small":{const n=e.inclusive?">=":">",r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case"invalid_format":{const t=e;return"starts_with"===t.format?`Invalid string: must start with "${t.prefix}"`:"ends_with"===t.format?`Invalid string: must end with "${t.suffix}"`:"includes"===t.format?`Invalid string: must include "${t.includes}"`:"regex"===t.format?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${e.divisor}`;case"unrecognized_keys":return`Unrecognized key${e.keys.length>1?"s":""}: ${Q(e.keys,", ")}`;case"invalid_key":return`Invalid key in ${e.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${e.origin}`}}})()}),function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Zc||(Zc={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Ac||(Ac={}));const $c=Zc.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nc=e=>{switch(typeof e){case"undefined":return $c.undefined;case"string":return $c.string;case"number":return Number.isNaN(e)?$c.nan:$c.number;case"boolean":return $c.boolean;case"function":return $c.function;case"bigint":return $c.bigint;case"symbol":return $c.symbol;case"object":return Array.isArray(e)?$c.array:null===e?$c.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?$c.promise:"undefined"!=typeof Map&&e instanceof Map?$c.map:"undefined"!=typeof Set&&e instanceof Set?$c.set:"undefined"!=typeof Date&&e instanceof Date?$c.date:$c.object;default:return $c.unknown}},Pc=Zc.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Cc extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Cc))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Zc.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t=Object.create(null),n=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Cc.create=e=>new Cc(e);const jc=(e,t)=>{let n;switch(e.code){case Pc.invalid_type:n=e.received===$c.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Pc.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Zc.jsonStringifyReplacer)}`;break;case Pc.unrecognized_keys:n=`Unrecognized key(s) in object: ${Zc.joinValues(e.keys,", ")}`;break;case Pc.invalid_union:n="Invalid input";break;case Pc.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Zc.joinValues(e.options)}`;break;case Pc.invalid_enum_value:n=`Invalid enum value. Expected ${Zc.joinValues(e.options)}, received '${e.received}'`;break;case Pc.invalid_arguments:n="Invalid function arguments";break;case Pc.invalid_return_type:n="Invalid function return type";break;case Pc.invalid_date:n="Invalid date";break;case Pc.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Zc.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Pc.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Pc.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Pc.custom:n="Invalid input";break;case Pc.invalid_intersection_types:n="Intersection results could not be merged";break;case Pc.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Pc.not_finite:n="Number must be finite";break;default:n=t.defaultError,Zc.assertNever(e)}return{message:n}};let Rc=jc;function Mc(e,t){const n=Rc,r=(e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)o=e(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===jc?void 0:jc].filter((e=>!!e))});e.common.issues.push(r)}class Fc{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return Dc;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,r=await e.value;n.push({key:t,value:r})}return Fc.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:a}=r;if("aborted"===t.status)return Dc;if("aborted"===a.status)return Dc;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!r.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}}const Dc=Object.freeze({status:"aborted"}),Lc=e=>({status:"dirty",value:e}),Uc=e=>({status:"valid",value:e}),Jc=e=>"aborted"===e.status,Vc=e=>"dirty"===e.status,Bc=e=>"valid"===e.status,Wc=e=>"undefined"!=typeof Promise&&e instanceof Promise;var qc;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(qc||(qc={}));class Kc{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Yc=(e,t)=>{if(Bc(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Cc(e.common.issues);return this._error=t,this._error}}};function Gc(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??a.defaultError}:void 0===a.data?{message:s??r??a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:s??n??a.defaultError}},description:a}}class Xc{get description(){return this._def.description}_getType(e){return Nc(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Nc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Fc,ctx:{common:e.parent.common,data:e.data,parsedType:Nc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Wc(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nc(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Yc(n,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nc(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return Bc(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>Bc(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nc(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(Wc(r)?r:Promise.resolve(r));return Yc(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const a=e(t),s=()=>r.addIssue({code:Pc.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((e=>!!e||(s(),!1))):!!a||(s(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new Kd({schema:this,typeName:rl.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Yd.create(this,this._def)}nullable(){return Gd.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nd.create(this)}promise(){return qd.create(this,this._def)}or(e){return jd.create([this,e],this._def)}and(e){return Md.create(this,e,this._def)}transform(e){return new Kd({...Gc(this._def),schema:this,typeName:rl.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Xd({...Gc(this._def),innerType:this,defaultValue:t,typeName:rl.ZodDefault})}brand(){return new el({typeName:rl.ZodBranded,type:this,...Gc(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Hd({...Gc(this._def),innerType:this,catchValue:t,typeName:rl.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return tl.create(this,e)}readonly(){return nl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hc=/^c[^\s-]{8,}$/i,Qc=/^[0-9a-z]+$/,ed=/^[0-9A-HJKMNP-TV-Z]{26}$/i,td=/^[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}$/i,nd=/^[a-z0-9_-]{21}$/i,rd=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ad=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,sd=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let id;const od=/^(?:(?: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])$/,ud=/^(?:(?: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])$/,cd=/^(([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]))$/,dd=/^(([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])$/,ld=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hd="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",md=new RegExp(`^${hd}$`);function fd(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function vd(e){let t=`${hd}T${fd(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function yd(e,t){return!("v4"!==t&&t||!od.test(e))||!("v6"!==t&&t||!cd.test(e))}function gd(e,t){if(!rd.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!("object"!=typeof a||null===a||"typ"in a&&"JWT"!==a?.typ||!a.alg||t&&a.alg!==t)}catch{return!1}}function _d(e,t){return!("v4"!==t&&t||!ud.test(e))||!("v6"!==t&&t||!dd.test(e))}class bd extends Xc{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$c.string){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.string,received:t.parsedType}),Dc}const t=new Fc;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const a=e.data.length>r.value,s=e.data.length<r.value;(a||s)&&(n=this._getOrReturnCtx(e,n),a?Mc(n,{code:Pc.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&Mc(n,{code:Pc.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)sd.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"email",code:Pc.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)id||(id=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),id.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"emoji",code:Pc.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)td.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"uuid",code:Pc.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)nd.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"nanoid",code:Pc.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)Hc.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"cuid",code:Pc.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)Qc.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"cuid2",code:Pc.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)ed.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"ulid",code:Pc.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Mc(n,{validation:"url",code:Pc.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"regex",code:Pc.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?vd(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?md.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?new RegExp(`^${fd(r)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?ad.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"duration",code:Pc.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?yd(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"ip",code:Pc.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?gd(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"jwt",code:Pc.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?_d(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"cidr",code:Pc.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?ld.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"base64",code:Pc.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?pd.test(e.data)||(n=this._getOrReturnCtx(e,n),Mc(n,{validation:"base64url",code:Pc.invalid_string,message:r.message}),t.dirty()):Zc.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:Pc.invalid_string,...qc.errToObj(n)})}_addCheck(e){return new bd({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...qc.errToObj(e)})}url(e){return this._addCheck({kind:"url",...qc.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...qc.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...qc.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...qc.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...qc.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...qc.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...qc.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...qc.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...qc.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...qc.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...qc.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...qc.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...qc.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...qc.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...qc.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...qc.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...qc.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...qc.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...qc.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...qc.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...qc.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...qc.errToObj(t)})}nonempty(e){return this.min(1,qc.errToObj(e))}trim(){return new bd({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bd({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bd({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function wd(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/10**a}bd.create=e=>new bd({checks:[],typeName:rl.ZodString,coerce:e?.coerce??!1,...Gc(e)});class kd extends Xc{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==$c.number){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.number,received:t.parsedType}),Dc}let t;const n=new Fc;for(const r of this._def.checks)"int"===r.kind?Zc.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Mc(t,{code:Pc.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Mc(t,{code:Pc.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Mc(t,{code:Pc.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==wd(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Mc(t,{code:Pc.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Mc(t,{code:Pc.not_finite,message:r.message}),n.dirty()):Zc.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,qc.toString(t))}gt(e,t){return this.setLimit("min",e,!1,qc.toString(t))}lte(e,t){return this.setLimit("max",e,!0,qc.toString(t))}lt(e,t){return this.setLimit("max",e,!1,qc.toString(t))}setLimit(e,t,n,r){return new kd({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:qc.toString(r)}]})}_addCheck(e){return new kd({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:qc.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:qc.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:qc.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:qc.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:qc.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:qc.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:qc.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:qc.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:qc.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Zc.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}kd.create=e=>new kd({checks:[],typeName:rl.ZodNumber,coerce:e?.coerce||!1,...Gc(e)});class xd extends Xc{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==$c.bigint)return this._getInvalidInput(e);let t;const n=new Fc;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Mc(t,{code:Pc.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Mc(t,{code:Pc.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Mc(t,{code:Pc.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Zc.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.bigint,received:t.parsedType}),Dc}gte(e,t){return this.setLimit("min",e,!0,qc.toString(t))}gt(e,t){return this.setLimit("min",e,!1,qc.toString(t))}lte(e,t){return this.setLimit("max",e,!0,qc.toString(t))}lt(e,t){return this.setLimit("max",e,!1,qc.toString(t))}setLimit(e,t,n,r){return new xd({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:qc.toString(r)}]})}_addCheck(e){return new xd({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:qc.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:qc.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:qc.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:qc.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:qc.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}xd.create=e=>new xd({checks:[],typeName:rl.ZodBigInt,coerce:e?.coerce??!1,...Gc(e)});class zd extends Xc{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==$c.boolean){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.boolean,received:t.parsedType}),Dc}return Uc(e.data)}}zd.create=e=>new zd({typeName:rl.ZodBoolean,coerce:e?.coerce||!1,...Gc(e)});class Id extends Xc{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$c.date){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.date,received:t.parsedType}),Dc}if(Number.isNaN(e.data.getTime()))return Mc(this._getOrReturnCtx(e),{code:Pc.invalid_date}),Dc;const t=new Fc;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Mc(n,{code:Pc.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Zc.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Id({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:qc.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:qc.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Id.create=e=>new Id({checks:[],coerce:e?.coerce||!1,typeName:rl.ZodDate,...Gc(e)});class Sd extends Xc{_parse(e){if(this._getType(e)!==$c.symbol){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.symbol,received:t.parsedType}),Dc}return Uc(e.data)}}Sd.create=e=>new Sd({typeName:rl.ZodSymbol,...Gc(e)});class Ed extends Xc{_parse(e){if(this._getType(e)!==$c.undefined){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.undefined,received:t.parsedType}),Dc}return Uc(e.data)}}Ed.create=e=>new Ed({typeName:rl.ZodUndefined,...Gc(e)});class Td extends Xc{_parse(e){if(this._getType(e)!==$c.null){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.null,received:t.parsedType}),Dc}return Uc(e.data)}}Td.create=e=>new Td({typeName:rl.ZodNull,...Gc(e)});class Od extends Xc{constructor(){super(...arguments),this._any=!0}_parse(e){return Uc(e.data)}}Od.create=e=>new Od({typeName:rl.ZodAny,...Gc(e)});class Zd extends Xc{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Uc(e.data)}}Zd.create=e=>new Zd({typeName:rl.ZodUnknown,...Gc(e)});class Ad extends Xc{_parse(e){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.never,received:t.parsedType}),Dc}}Ad.create=e=>new Ad({typeName:rl.ZodNever,...Gc(e)});class $d extends Xc{_parse(e){if(this._getType(e)!==$c.undefined){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.void,received:t.parsedType}),Dc}return Uc(e.data)}}$d.create=e=>new $d({typeName:rl.ZodVoid,...Gc(e)});class Nd extends Xc{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==$c.array)return Mc(t,{code:Pc.invalid_type,expected:$c.array,received:t.parsedType}),Dc;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(Mc(t,{code:e?Pc.too_big:Pc.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Mc(t,{code:Pc.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Mc(t,{code:Pc.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new Kc(t,e,t.path,n))))).then((e=>Fc.mergeArray(n,e)));const a=[...t.data].map(((e,n)=>r.type._parseSync(new Kc(t,e,t.path,n))));return Fc.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Nd({...this._def,minLength:{value:e,message:qc.toString(t)}})}max(e,t){return new Nd({...this._def,maxLength:{value:e,message:qc.toString(t)}})}length(e,t){return new Nd({...this._def,exactLength:{value:e,message:qc.toString(t)}})}nonempty(e){return this.min(1,e)}}function Pd(e){if(e instanceof Cd){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Yd.create(Pd(r))}return new Cd({...e._def,shape:()=>t})}return e instanceof Nd?new Nd({...e._def,type:Pd(e.element)}):e instanceof Yd?Yd.create(Pd(e.unwrap())):e instanceof Gd?Gd.create(Pd(e.unwrap())):e instanceof Fd?Fd.create(e.items.map((e=>Pd(e)))):e}Nd.create=(e,t)=>new Nd({type:e,minLength:null,maxLength:null,exactLength:null,typeName:rl.ZodArray,...Gc(t)});class Cd extends Xc{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Zc.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==$c.object){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.object,received:t.parsedType}),Dc}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ad&&"strip"===this._def.unknownKeys))for(const e in n.data)a.includes(e)||s.push(e);const i=[];for(const e of a){const t=r[e],a=n.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new Kc(n,a,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ad){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(Mc(n,{code:Pc.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new Kc(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>Fc.mergeObjectSync(t,e))):Fc.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return qc.errToObj,new Cd({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const r=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:qc.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Cd({...this._def,unknownKeys:"strip"})}passthrough(){return new Cd({...this._def,unknownKeys:"passthrough"})}extend(e){return new Cd({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Cd({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:rl.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Cd({...this._def,catchall:e})}pick(e){const t={};for(const n of Zc.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new Cd({...this._def,shape:()=>t})}omit(e){const t={};for(const n of Zc.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new Cd({...this._def,shape:()=>t})}deepPartial(){return Pd(this)}partial(e){const t={};for(const n of Zc.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new Cd({...this._def,shape:()=>t})}required(e){const t={};for(const n of Zc.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Yd;)e=e._def.innerType;t[n]=e}return new Cd({...this._def,shape:()=>t})}keyof(){return Vd(Zc.objectKeys(this.shape))}}Cd.create=(e,t)=>new Cd({shape:()=>e,unknownKeys:"strip",catchall:Ad.create(),typeName:rl.ZodObject,...Gc(t)}),Cd.strictCreate=(e,t)=>new Cd({shape:()=>e,unknownKeys:"strict",catchall:Ad.create(),typeName:rl.ZodObject,...Gc(t)}),Cd.lazycreate=(e,t)=>new Cd({shape:e,unknownKeys:"strip",catchall:Ad.create(),typeName:rl.ZodObject,...Gc(t)});class jd extends Xc{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Cc(e.ctx.common.issues)));return Mc(t,{code:Pc.invalid_union,unionErrors:n}),Dc}));{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=r.map((e=>new Cc(e)));return Mc(t,{code:Pc.invalid_union,unionErrors:a}),Dc}}get options(){return this._def.options}}function Rd(e,t){const n=Nc(e),r=Nc(t);if(e===t)return{valid:!0,data:e};if(n===$c.object&&r===$c.object){const n=Zc.objectKeys(t),r=Zc.objectKeys(e).filter((e=>-1!==n.indexOf(e))),a={...e,...t};for(const n of r){const r=Rd(e[n],t[n]);if(!r.valid)return{valid:!1};a[n]=r.data}return{valid:!0,data:a}}if(n===$c.array&&r===$c.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const a=Rd(e[r],t[r]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}return n===$c.date&&r===$c.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}jd.create=(e,t)=>new jd({options:e,typeName:rl.ZodUnion,...Gc(t)});class Md extends Xc{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Jc(e)||Jc(r))return Dc;const a=Rd(e.value,r.value);return a.valid?((Vc(e)||Vc(r))&&t.dirty(),{status:t.value,value:a.data}):(Mc(n,{code:Pc.invalid_intersection_types}),Dc)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Md.create=(e,t,n)=>new Md({left:e,right:t,typeName:rl.ZodIntersection,...Gc(n)});class Fd extends Xc{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$c.array)return Mc(n,{code:Pc.invalid_type,expected:$c.array,received:n.parsedType}),Dc;if(n.data.length<this._def.items.length)return Mc(n,{code:Pc.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dc;!this._def.rest&&n.data.length>this._def.items.length&&(Mc(n,{code:Pc.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Kc(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>Fc.mergeArray(t,e))):Fc.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Fd({...this._def,rest:e})}}Fd.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Fd({items:e,typeName:rl.ZodTuple,rest:null,...Gc(t)})};class Dd extends Xc{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$c.map)return Mc(n,{code:Pc.invalid_type,expected:$c.map,received:n.parsedType}),Dc;const r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new Kc(n,e,n.path,[s,"key"])),value:a._parse(new Kc(n,t,n.path,[s,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return Dc;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return Dc;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}}Dd.create=(e,t,n)=>new Dd({valueType:t,keyType:e,typeName:rl.ZodMap,...Gc(n)});class Ld extends Xc{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==$c.set)return Mc(n,{code:Pc.invalid_type,expected:$c.set,received:n.parsedType}),Dc;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Mc(n,{code:Pc.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(Mc(n,{code:Pc.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return Dc;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map(((e,t)=>a._parse(new Kc(n,e,n.path,t))));return n.common.async?Promise.all(i).then((e=>s(e))):s(i)}min(e,t){return new Ld({...this._def,minSize:{value:e,message:qc.toString(t)}})}max(e,t){return new Ld({...this._def,maxSize:{value:e,message:qc.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ld.create=(e,t)=>new Ld({valueType:e,minSize:null,maxSize:null,typeName:rl.ZodSet,...Gc(t)});class Ud extends Xc{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ud.create=(e,t)=>new Ud({getter:e,typeName:rl.ZodLazy,...Gc(t)});class Jd extends Xc{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Mc(t,{received:t.data,code:Pc.invalid_literal,expected:this._def.value}),Dc}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Vd(e,t){return new Bd({values:e,typeName:rl.ZodEnum,...Gc(t)})}Jd.create=(e,t)=>new Jd({value:e,typeName:rl.ZodLiteral,...Gc(t)});class Bd extends Xc{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Mc(t,{expected:Zc.joinValues(n),received:t.parsedType,code:Pc.invalid_type}),Dc}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Mc(t,{received:t.data,code:Pc.invalid_enum_value,options:n}),Dc}return Uc(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Bd.create(e,{...this._def,...t})}exclude(e,t=this._def){return Bd.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Bd.create=Vd;class Wd extends Xc{_parse(e){const t=Zc.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==$c.string&&n.parsedType!==$c.number){const e=Zc.objectValues(t);return Mc(n,{expected:Zc.joinValues(e),received:n.parsedType,code:Pc.invalid_type}),Dc}if(this._cache||(this._cache=new Set(Zc.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=Zc.objectValues(t);return Mc(n,{received:n.data,code:Pc.invalid_enum_value,options:e}),Dc}return Uc(e.data)}get enum(){return this._def.values}}Wd.create=(e,t)=>new Wd({values:e,typeName:rl.ZodNativeEnum,...Gc(t)});class qd extends Xc{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$c.promise&&!1===t.common.async)return Mc(t,{code:Pc.invalid_type,expected:$c.promise,received:t.parsedType}),Dc;const n=t.parsedType===$c.promise?t.data:Promise.resolve(t.data);return Uc(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}qd.create=(e,t)=>new qd({type:e,typeName:rl.ZodPromise,...Gc(t)});class Kd extends Xc{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===rl.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:e=>{Mc(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===r.type){const e=r.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Dc;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?Dc:"dirty"===r.status||"dirty"===t.value?Lc(r.value):r}));{if("aborted"===t.value)return Dc;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?Dc:"dirty"===r.status||"dirty"===t.value?Lc(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?Dc:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?Dc:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Bc(e))return Dc;const s=r.transform(e.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Bc(e)?Promise.resolve(r.transform(e.value,a)).then((e=>({status:t.value,value:e}))):Dc))}Zc.assertNever(r)}}Kd.create=(e,t,n)=>new Kd({schema:e,typeName:rl.ZodEffects,effect:t,...Gc(n)}),Kd.createWithPreprocess=(e,t,n)=>new Kd({schema:t,effect:{type:"preprocess",transform:e},typeName:rl.ZodEffects,...Gc(n)});class Yd extends Xc{_parse(e){return this._getType(e)===$c.undefined?Uc(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Yd.create=(e,t)=>new Yd({innerType:e,typeName:rl.ZodOptional,...Gc(t)});class Gd extends Xc{_parse(e){return this._getType(e)===$c.null?Uc(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Gd.create=(e,t)=>new Gd({innerType:e,typeName:rl.ZodNullable,...Gc(t)});class Xd extends Xc{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===$c.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Xd.create=(e,t)=>new Xd({innerType:e,typeName:rl.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Gc(t)});class Hd extends Xc{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Wc(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Cc(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Cc(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Hd.create=(e,t)=>new Hd({innerType:e,typeName:rl.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Gc(t)});class Qd extends Xc{_parse(e){if(this._getType(e)!==$c.nan){const t=this._getOrReturnCtx(e);return Mc(t,{code:Pc.invalid_type,expected:$c.nan,received:t.parsedType}),Dc}return{status:"valid",value:e.data}}}Qd.create=e=>new Qd({typeName:rl.ZodNaN,...Gc(e)}),Symbol("zod_brand");class el extends Xc{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class tl extends Xc{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Dc:"dirty"===e.status?(t.dirty(),Lc(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Dc:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new tl({in:e,out:t,typeName:rl.ZodPipeline})}}class nl extends Xc{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Bc(e)&&(e.value=Object.freeze(e.value)),e);return Wc(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}var rl;nl.create=(e,t)=>new nl({innerType:e,typeName:rl.ZodReadonly,...Gc(t)}),Cd.lazycreate,function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(rl||(rl={})),bd.create,kd.create,Qd.create,xd.create,zd.create,Id.create,Sd.create,Ed.create,Td.create,Od.create,Zd.create,Ad.create,$d.create,Nd.create,Cd.create,Cd.strictCreate,jd.create,Md.create,Fd.create,Dd.create,Ld.create,Ud.create,Jd.create,Bd.create,Wd.create,qd.create,Kd.create,Yd.create,Gd.create,Kd.createWithPreprocess,tl.create;class al extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}function sl(e){}class il extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(a){r=function(e){if("function"==typeof e)throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=sl,onError:n=sl,onRetry:r=sl,onComment:a}=e;let s,i="",o=!0,u="",c="";function d(e){if(""===e)return u.length>0&&t({id:s,event:c||void 0,data:u.endsWith("\n")?u.slice(0,-1):u}),s=void 0,u="",void(c="");if(e.startsWith(":"))return void(a&&a(e.slice(e.startsWith(": ")?2:1)));const n=e.indexOf(":");if(-1===n)l(e,"",e);else{const t=e.slice(0,n),r=" "===e[n+1]?2:1;l(t,e.slice(n+r),e)}}function l(e,t,a){switch(e){case"event":c=t;break;case"data":u=`${u}${t}\n`;break;case"id":s=t.includes("\0")?void 0:t;break;case"retry":/^\d+$/.test(t)?r(parseInt(t,10)):n(new al(`Invalid \`retry\` value: "${t}"`,{type:"invalid-retry",value:t,line:a}));break;default:n(new al(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:"unknown-field",field:e,value:t,line:a}))}}return{feed:function(e){const t=o?e.replace(/^\xEF\xBB\xBF/,""):e,[n,r]=function(e){const t=[];let n="",r=0;for(;r<e.length;){const a=e.indexOf("\r",r),s=e.indexOf("\n",r);let i=-1;if(-1!==a&&-1!==s?i=Math.min(a,s):-1!==a?i=a===e.length-1?-1:a:-1!==s&&(i=s),-1===i){n=e.slice(r);break}{const n=e.slice(r,i);t.push(n),r=i+1,"\r"===e[r-1]&&"\n"===e[r]&&r++}}return[t,n]}(`${i}${t}`);for(const e of n)d(e);i=r,o=!1},reset:function(e={}){i&&e.consume&&d(i),o=!0,s=void 0,u="",c="",i=""}}}({onEvent:e=>{a.enqueue(e)},onError(t){"terminate"===e?a.error(t):"function"==typeof e&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}}var{btoa:ol,atob:ul}=globalThis,cl=Symbol.for("vercel.ai.error.AI_DownloadError");var dl=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const a=()=>{const e=n.length,r=new Array(t);for(let a=0;a<t;a++)r[a]=n[Math.random()*e|0];return r.join("")};if(null==e)return a;if(n.includes(r))throw new I({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${a()}`},ll=dl();function pl(e=globalThis){var t,n,r;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(r=null==(n=e.process)?void 0:n.versions)?void 0:r.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function hl(e){if(null==e)return{};const t={};if(e instanceof Headers)e.forEach(((e,n)=>{t[n.toLowerCase()]=e}));else{Array.isArray(e)||(e=Object.entries(e));for(const[n,r]of e)null!=r&&(t[n.toLowerCase()]=r)}return t}function ml(e,...t){const n=new Headers(hl(e)),r=n.get("user-agent")||"";return n.set("user-agent",[r,...t].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var fl=/"__proto__"\s*:/,vl=/"constructor"\s*:/;function yl(e){const t=JSON.parse(e);return null===t||"object"!=typeof t||!1===fl.test(e)&&!1===vl.test(e)?t:function(e){let t=[e];for(;t.length;){const e=t;t=[];for(const n of e){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const e in n){const r=n[e];r&&"object"==typeof r&&t.push(r)}}}return e}(t)}function gl(e){if("object"===e.type||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=_l(t[e])}null!=e.items&&(e.items=Array.isArray(e.items)?e.items.map(_l):_l(e.items)),null!=e.anyOf&&(e.anyOf=e.anyOf.map(_l)),null!=e.allOf&&(e.allOf=e.allOf.map(_l)),null!=e.oneOf&&(e.oneOf=e.oneOf.map(_l));const{definitions:t}=e;if(null!=t)for(const e of Object.keys(t))t[e]=_l(t[e]);return e}function _l(e){return"boolean"==typeof e?e:gl(e)}var bl=Symbol("Let zodToJsonSchema decide on which parser to use"),wl={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"};function kl(e,t){return ql(e.type._def,t)}function xl(e,t,n){const r=null!=n?n:t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(((n,r)=>xl(e,t,n)))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return zl(e)}}var zl=e=>{const t={type:"integer",format:"unix-time"};for(const n of e.checks)switch(n.kind){case"min":t.minimum=n.value;break;case"max":t.maximum=n.value}return t},Il=void 0,Sl=/^[cC][^\s-]{8,}$/,El=/^[0-9a-z]+$/,Tl=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ol=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Zl=/^(?:(?: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])$/,Al=/^(([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])$/,$l=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Nl=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pl=/^[a-zA-Z0-9_-]{21}$/,Cl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function jl(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":n.minLength="number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength="number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(t.emailStrategy){case"format:email":Fl(n,"email",r.message,t);break;case"format:idn-email":Fl(n,"idn-email",r.message,t);break;case"pattern:zod":Dl(n,Ol,r.message,t)}break;case"url":Fl(n,"uri",r.message,t);break;case"uuid":Fl(n,"uuid",r.message,t);break;case"regex":Dl(n,r.regex,r.message,t);break;case"cuid":Dl(n,Sl,r.message,t);break;case"cuid2":Dl(n,El,r.message,t);break;case"startsWith":Dl(n,RegExp(`^${Rl(r.value,t)}`),r.message,t);break;case"endsWith":Dl(n,RegExp(`${Rl(r.value,t)}$`),r.message,t);break;case"datetime":Fl(n,"date-time",r.message,t);break;case"date":Fl(n,"date",r.message,t);break;case"time":Fl(n,"time",r.message,t);break;case"duration":Fl(n,"duration",r.message,t);break;case"length":n.minLength="number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,n.maxLength="number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value;break;case"includes":Dl(n,RegExp(Rl(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&Fl(n,"ipv4",r.message,t),"v4"!==r.version&&Fl(n,"ipv6",r.message,t);break;case"base64url":Dl(n,Nl,r.message,t);break;case"jwt":Dl(n,Cl,r.message,t);break;case"cidr":"v6"!==r.version&&Dl(n,Zl,r.message,t),"v4"!==r.version&&Dl(n,Al,r.message,t);break;case"emoji":Dl(n,(void 0===Il&&(Il=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Il),r.message,t);break;case"ulid":Dl(n,Tl,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Fl(n,"binary",r.message,t);break;case"contentEncoding:base64":n.contentEncoding="base64";break;case"pattern:zod":Dl(n,$l,r.message,t)}break;case"nanoid":Dl(n,Pl,r.message,t)}return n}function Rl(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)Ml.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var Ml=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Fl(e,t,n,r){var a;e.format||(null==(a=e.anyOf)?void 0:a.some((e=>e.format)))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function Dl(e,t,n,r){var a;e.pattern||(null==(a=e.allOf)?void 0:a.some((e=>e.pattern)))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Ll(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Ll(t,r)}function Ll(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const r=e.flags.includes("i"),a=e.flags.includes("m"),s=e.flags.includes("s"),i=r?e.source.toLowerCase():e.source;let o="",u=!1,c=!1,d=!1;for(let e=0;e<i.length;e++)if(u)o+=i[e],u=!1;else{if(r)if(c){if(i[e].match(/[a-z]/)){d?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),d=!1):"-"===i[e+1]&&(null==(n=i[e+2])?void 0:n.match(/[a-z]/))?(o+=i[e],d=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(a){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=c?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?u=!0:c&&"]"===i[e]?c=!1:c||"["!==i[e]||(c=!0))}try{new RegExp(o)}catch(n){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function Ul(e,t){var n,r,a,s,i,o;const u={type:"object",additionalProperties:null!=(n=ql(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?n:t.allowedAdditionalProperties};if((null==(r=e.keyType)?void 0:r._def.typeName)===rl.ZodString&&(null==(a=e.keyType._def.checks)?void 0:a.length)){const{type:n,...r}=jl(e.keyType._def,t);return{...u,propertyNames:r}}if((null==(s=e.keyType)?void 0:s._def.typeName)===rl.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(i=e.keyType)?void 0:i._def.typeName)===rl.ZodBranded&&e.keyType._def.type._def.typeName===rl.ZodString&&(null==(o=e.keyType._def.type._def.checks)?void 0:o.length)){const{type:n,...r}=kl(e.keyType._def,t);return{...u,propertyNames:r}}return u}var Jl={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Vl(e){try{return e.isOptional()}catch(e){return!0}}var Bl=(e,t,n)=>{switch(t){case rl.ZodString:return jl(e,n);case rl.ZodNumber:return function(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value}return t}(e);case rl.ZodObject:return function(e,t){const n={type:"object",properties:{}},r=[],a=e.shape();for(const e in a){let s=a[e];if(void 0===s||void 0===s._def)continue;const i=Vl(s),o=ql(s._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==o&&(n.properties[e]=o,i||r.push(e))}r.length&&(n.required=r);const s=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return ql(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==s&&(n.additionalProperties=s),n}(e,n);case rl.ZodBigInt:return function(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value}return t}(e);case rl.ZodBoolean:return{type:"boolean"};case rl.ZodDate:return xl(e,n);case rl.ZodUndefined:return{not:{}};case rl.ZodNull:return{type:"null"};case rl.ZodArray:return function(e,t){var n,r,a;const s={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(a=null==(r=e.type)?void 0:r._def)?void 0:a.typeName)!==rl.ZodAny&&(s.items=ql(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(s.minItems=e.minLength.value),e.maxLength&&(s.maxItems=e.maxLength.value),e.exactLength&&(s.minItems=e.exactLength.value,s.maxItems=e.exactLength.value),s}(e,n);case rl.ZodUnion:case rl.ZodDiscriminatedUnion:return function(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every((e=>e._def.typeName in Jl&&(!e._def.checks||!e._def.checks.length)))){const e=n.reduce(((e,t)=>{const n=Jl[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e}),[]);return{type:e.length>1?e:e[0]}}if(n.every((e=>"ZodLiteral"===e._def.typeName&&!e.description))){const e=n.reduce(((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}}),[]);if(e.length===n.length){const t=e.filter(((e,t,n)=>n.indexOf(e)===t));return{type:t.length>1?t:t[0],enum:n.reduce(((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value]),[])}}}else if(n.every((e=>"ZodEnum"===e._def.typeName)))return{type:"string",enum:n.reduce(((e,t)=>[...e,...t._def.values.filter((t=>!e.includes(t)))]),[])};return((e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map(((e,n)=>ql(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]}))).filter((e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0)));return n.length?{anyOf:n}:void 0})(e,t)}(e,n);case rl.ZodIntersection:return function(e,t){const n=[ql(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ql(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((e=>!!e)),r=[];return n.forEach((e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...r}=e;t=r}r.push(t)}else r.push(...e.allOf);var t})),r.length?{allOf:r}:void 0}(e,n);case rl.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map(((e,n)=>ql(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[]),additionalItems:ql(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map(((e,n)=>ql(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]}))).reduce(((e,t)=>void 0===t?e:[...e,t]),[])}}(e,n);case rl.ZodRecord:return Ul(e,n);case rl.ZodLiteral:return function(e){const t=typeof e.value;return"bigint"!==t&&"number"!==t&&"boolean"!==t&&"string"!==t?{type:Array.isArray(e.value)?"array":"object"}:{type:"bigint"===t?"integer":t,const:e.value}}(e);case rl.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case rl.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter((e=>"number"!=typeof t[t[e]])).map((e=>t[e])),r=Array.from(new Set(n.map((e=>typeof e))));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:n}}(e);case rl.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Jl[e.innerType._def.typeName],"null"]};const n=ql(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case rl.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return ql(e.innerType._def,t);const r=ql(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}})(e,n);case rl.ZodMap:return function(e,t){return"record"===t.mapStrategy?Ul(e,t):{type:"array",maxItems:125,items:{type:"array",items:[ql(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},ql(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}}}(e,n);case rl.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:ql(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}(e,n);case rl.ZodLazy:return()=>e.getter()._def;case rl.ZodPromise:return function(e,t){return ql(e.type._def,t)}(e,n);case rl.ZodNaN:case rl.ZodNever:return{not:{}};case rl.ZodEffects:return function(e,t){return"input"===t.effectStrategy?ql(e.schema._def,t):{}}(e,n);case rl.ZodAny:case rl.ZodUnknown:return{};case rl.ZodDefault:return function(e,t){return{...ql(e.innerType._def,t),default:e.defaultValue()}}(e,n);case rl.ZodBranded:return kl(e,n);case rl.ZodReadonly:case rl.ZodCatch:return((e,t)=>ql(e.innerType._def,t))(e,n);case rl.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return ql(e.in._def,t);if("output"===t.pipeStrategy)return ql(e.out._def,t);const n=ql(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,ql(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter((e=>void 0!==e))}})(e,n);case rl.ZodFunction:case rl.ZodVoid:case rl.ZodSymbol:default:return}},Wl=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function ql(e,t,n=!1){var r;const a=t.seen.get(e);if(t.override){const s=null==(r=t.override)?void 0:r.call(t,e,t,a,n);if(s!==bl)return s}if(a&&!n){const e=Kl(a,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=Bl(e,e.typeName,t),o="function"==typeof i?ql(i(),t):i;if(o&&Yl(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var Kl=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Wl(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every(((e,n)=>t.currentPath[n]===e))?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):"seen"===t.$refStrategy?{}:void 0}},Yl=(e,t,n)=>(e.description&&(n.description=e.description),n),Gl=Symbol.for("vercel.ai.schema");function Xl(e){let t;return()=>(null==t&&(t=e()),t)}function Hl(e,{validate:t}={}){return{[Gl]:!0,_type:void 0,get jsonSchema(){return"function"==typeof e&&(e=e()),e},validate:t}}function Ql(e){return null==e?Hl({properties:{},additionalProperties:!1}):"object"==typeof(n=e)&&null!==n&&Gl in n&&!0===n[Gl]&&"jsonSchema"in n&&"validate"in n?e:"~standard"in e?"zod"===e["~standard"].vendor?tp(e):(t=e,Hl((()=>gl(t["~standard"].jsonSchema.input({target:"draft-07"}))),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new B({value:e,cause:n.issues})}}})):e();var t,n}function ep(e,t){var n;const r=null!=(n=null==t?void 0:t.useReferences)&&n;return Hl((()=>((e,t)=>{var n;const r=(e=>{const t=(e=>"string"==typeof e?{...wl,name:e}:{...wl,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map((([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}])))}})(t);let a="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce(((e,[t,n])=>{var a;return{...e,[t]:null!=(a=ql(n._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0))?a:{}}}),{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(n=ql(e._def,void 0===s?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))?n:{},o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o);const u=void 0===s?a?{...i,[r.definitionPath]:a}:i:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:i}};return u.$schema="http://json-schema.org/draft-07/schema#",u})(e,{$refStrategy:r?"root":"none"})),{validate:async t=>{const n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function tp(e,t){return function(e){return"_zod"in e}(e)?function(e,t){var n;const r=null!=(n=null==t?void 0:t.useReferences)&&n;return Hl((()=>gl(function(e,t){if("_idmap"in e){const n=e,r=ms({...t,processors:ai}),a={};for(const e of n._idmap.entries()){const[t,n]=e;fs(n,r)}const s={},i={registry:n,uri:t?.uri,defs:a};r.external=i;for(const e of n._idmap.entries()){const[t,n]=e;vs(r,n),s[t]=ys(r,n)}if(Object.keys(a).length>0){const e="draft-2020-12"===r.target?"$defs":"definitions";s.__shared={[e]:a}}return{schemas:s}}const n=ms({...t,processors:ai});return fs(e,n),vs(n,e),ys(n,e)}(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"}))),{validate:async t=>{const n=await gi(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}(e,t):ep(e,t)}async function np({value:e,schema:t,context:n}){const r=await rp({value:e,schema:t,context:n});if(!r.success)throw B.wrap({value:e,cause:r.error,context:n});return r.value}async function rp({value:e,schema:t,context:n}){const r=Ql(t);try{if(null==r.validate)return{success:!0,value:e,rawValue:e};const t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:B.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:B.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function ap({text:e,schema:t}){try{const n=function(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch(t){return yl(e)}try{return yl(e)}finally{Error.stackTraceLimit=t}}(e);return null==t?{success:!0,value:n,rawValue:n}:await rp({value:n,schema:t})}catch(t){return{success:!1,error:$.isInstance(t)?t:new $({text:e,cause:t}),rawValue:void 0}}}async function sp(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var ip,op=Object.defineProperty,up=(Symbol.for("vercel.ai.error.AI_InvalidArgumentError"),Symbol.for("vercel.ai.error.AI_InvalidStreamPartError"),Symbol.for("vercel.ai.error.AI_InvalidToolApprovalError"),Symbol.for("vercel.ai.error.AI_InvalidToolInputError"),Symbol.for("vercel.ai.error.AI_ToolCallNotFoundForApprovalError"),Symbol.for("vercel.ai.error.AI_MissingToolResultsError"),Symbol.for("vercel.ai.error.AI_NoImageGeneratedError"),"AI_NoObjectGeneratedError"),cp=`vercel.ai.error.${up}`,dp=Symbol.for(cp),lp=class extends l{constructor({message:e="No object generated.",cause:t,text:n,response:r,usage:a,finishReason:s}){super({name:up,message:e,cause:t}),this[ip]=!0,this.text=n,this.response=r,this.usage=a,this.finishReason=s}static isInstance(e){return l.hasMarker(e,cp)}};ip=dp;Symbol.for("vercel.ai.error.AI_NoOutputGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSpeechGeneratedError"),Symbol.for("vercel.ai.error.AI_NoTranscriptGeneratedError"),Symbol.for("vercel.ai.error.AI_NoVideoGeneratedError"),Symbol.for("vercel.ai.error.AI_NoSuchToolError"),Symbol.for("vercel.ai.error.AI_ToolCallRepairError");var pp,hp="AI_UIMessageStreamError",mp=`vercel.ai.error.${hp}`,fp=Symbol.for(mp),vp=class extends l{constructor({chunkType:e,chunkId:t,message:n}){super({name:hp,message:n}),this[pp]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return l.hasMarker(e,mp)}};pp=fp;Symbol.for("vercel.ai.error.AI_InvalidDataContentError"),Symbol.for("vercel.ai.error.AI_InvalidMessageRoleError"),Symbol.for("vercel.ai.error.AI_MessageConversionError"),Symbol.for("vercel.ai.error.AI_RetryError");var yp=hu([Zi(),Ic(Uint8Array),Ic(ArrayBuffer),bc((e=>{var t,n;return null!=(n=null==(t=globalThis.Buffer)?void 0:t.isBuffer(e))&&n}),{message:"Must be a Buffer"})]),gp=hc((()=>hu([Ko(),Zi(),Oo(),Ro(),xu(Zi(),gp.optional()),iu(gp)]))),_p=xu(Zi(),xu(Zi(),gp.optional())),bp=cu({type:Pu("text"),text:Zi(),providerOptions:_p.optional()}),wp=cu({type:Pu("image"),image:hu([yp,Ic(URL)]),mediaType:Zi().optional(),providerOptions:_p.optional()}),kp=cu({type:Pu("file"),data:hu([yp,Ic(URL)]),filename:Zi().optional(),mediaType:Zi(),providerOptions:_p.optional()}),xp=cu({type:Pu("reasoning"),text:Zi(),providerOptions:_p.optional()}),zp=cu({type:Pu("tool-call"),toolCallId:Zi(),toolName:Zi(),input:Ho(),providerOptions:_p.optional(),providerExecuted:Ro().optional()}),Ip=yu("type",[cu({type:Pu("text"),value:Zi(),providerOptions:_p.optional()}),cu({type:Pu("json"),value:gp,providerOptions:_p.optional()}),cu({type:Pu("execution-denied"),reason:Zi().optional(),providerOptions:_p.optional()}),cu({type:Pu("error-text"),value:Zi(),providerOptions:_p.optional()}),cu({type:Pu("error-json"),value:gp,providerOptions:_p.optional()}),cu({type:Pu("content"),value:iu(hu([cu({type:Pu("text"),text:Zi(),providerOptions:_p.optional()}),cu({type:Pu("media"),data:Zi(),mediaType:Zi()}),cu({type:Pu("file-data"),data:Zi(),mediaType:Zi(),filename:Zi().optional(),providerOptions:_p.optional()}),cu({type:Pu("file-url"),url:Zi(),providerOptions:_p.optional()}),cu({type:Pu("file-id"),fileId:hu([Zi(),xu(Zi(),Zi())]),providerOptions:_p.optional()}),cu({type:Pu("image-data"),data:Zi(),mediaType:Zi(),providerOptions:_p.optional()}),cu({type:Pu("image-url"),url:Zi(),providerOptions:_p.optional()}),cu({type:Pu("image-file-id"),fileId:hu([Zi(),xu(Zi(),Zi())]),providerOptions:_p.optional()}),cu({type:Pu("custom"),providerOptions:_p.optional()})]))})]),Sp=cu({type:Pu("tool-result"),toolCallId:Zi(),toolName:Zi(),output:Ip,providerOptions:_p.optional()}),Ep=cu({type:Pu("tool-approval-request"),approvalId:Zi(),toolCallId:Zi()}),Tp=cu({type:Pu("tool-approval-response"),approvalId:Zi(),approved:Ro(),reason:Zi().optional()}),Op=cu({role:Pu("system"),content:Zi(),providerOptions:_p.optional()}),Zp=cu({role:Pu("user"),content:hu([Zi(),iu(hu([bp,wp,kp]))]),providerOptions:_p.optional()}),Ap=cu({role:Pu("assistant"),content:hu([Zi(),iu(hu([bp,kp,xp,zp,Sp,Ep]))]),providerOptions:_p.optional()}),$p=cu({role:Pu("tool"),content:iu(hu([Sp,Tp])),providerOptions:_p.optional()});function Np(e,t){if(void 0===e&&void 0===t)return;if(void 0===e)return t;if(void 0===t)return e;const n={...e};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const a=t[r];if(void 0===a)continue;const s=r in e?e[r]:void 0,i=!(null===a||"object"!=typeof a||Array.isArray(a)||a instanceof Date||a instanceof RegExp),o=!(null==s||"object"!=typeof s||Array.isArray(s)||s instanceof Date||s instanceof RegExp);n[r]=i&&o?Np(s,a):a}return n}function Pp(e){const t=["ROOT"];let n=-1,r=null;function a(e,a,s){switch(e){case'"':n=a,t.pop(),t.push(s),t.push("INSIDE_STRING");break;case"f":case"t":case"n":n=a,r=a,t.pop(),t.push(s),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(s),t.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=a,t.pop(),t.push(s),t.push("INSIDE_NUMBER");break;case"{":n=a,t.pop(),t.push(s),t.push("INSIDE_OBJECT_START");break;case"[":n=a,t.pop(),t.push(s),t.push("INSIDE_ARRAY_START")}}function s(e,r){switch(e){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=r,t.pop()}}function i(e,r){switch(e){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=r,t.pop()}}for(let o=0;o<e.length;o++){const u=e[o];switch(t[t.length-1]){case"ROOT":a(u,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(u){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":n=o,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===u&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===u&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===u&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":a(u,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":s(u,o);break;case"INSIDE_STRING":switch(u){case'"':t.pop(),n=o;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=o}break;case"INSIDE_ARRAY_START":"]"===u?(n=o,t.pop()):(n=o,a(u,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(u){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=o,t.pop();break;default:n=o}break;case"INSIDE_ARRAY_AFTER_COMMA":a(u,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),n=o;break;case"INSIDE_NUMBER":switch(u){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=o;break;case"e":case"E":case"-":case".":break;case",":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&i(u,o),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&s(u,o);break;case"}":t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]&&s(u,o);break;case"]":t.pop(),"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&i(u,o);break;default:t.pop()}break;case"INSIDE_LITERAL":{const a=e.substring(r,o+1);"false".startsWith(a)||"true".startsWith(a)||"null".startsWith(a)?n=o:(t.pop(),"INSIDE_OBJECT_AFTER_VALUE"===t[t.length-1]?s(u,o):"INSIDE_ARRAY_AFTER_VALUE"===t[t.length-1]&&i(u,o));break}}}let o=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case"INSIDE_STRING":o+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":o+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":o+="]";break;case"INSIDE_LITERAL":{const t=e.substring(r,e.length);"true".startsWith(t)?o+="true".slice(t.length):"false".startsWith(t)?o+="false".slice(t.length):"null".startsWith(t)&&(o+="null".slice(t.length))}}return o}async function Cp(e){if(void 0===e)return{value:void 0,state:"undefined-input"};let t=await ap({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await ap({text:Pp(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}hu([Op,Zp,Ap,$p]),((e,t)=>{for(var n in t)op(e,n,{get:t[n],enumerable:!0})})({},{array:()=>Mp,choice:()=>Fp,json:()=>Dp,object:()=>Rp,text:()=>jp});var jp=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),parseCompleteOutput:async({text:e})=>e,parsePartialOutput:async({text:e})=>({partial:e}),createElementStreamTransform(){}}),Rp=({schema:e,name:t,description:n})=>{const r=Ql(e);return{name:"object",responseFormat:sp(r.jsonSchema).then((e=>({type:"json",schema:e,...null!=t&&{name:t},...null!=n&&{description:n}}))),async parseCompleteOutput({text:e},t){const n=await ap({text:e});if(!n.success)throw new lp({message:"No object generated: could not parse the response.",cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});const a=await rp({value:n.value,schema:r});if(!a.success)throw new lp({message:"No object generated: response did not match schema.",cause:a.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return a.value},async parsePartialOutput({text:e}){const t=await Cp(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:t.value}}},createElementStreamTransform(){}}},Mp=({element:e,name:t,description:n})=>{const r=Ql(e);return{name:"array",responseFormat:sp(r.jsonSchema).then((e=>{const{$schema:r,...a}=e;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:a}},required:["elements"],additionalProperties:!1},...null!=t&&{name:t},...null!=n&&{description:n}}})),async parseCompleteOutput({text:e},t){const n=await ap({text:e});if(!n.success)throw new lp({message:"No object generated: could not parse the response.",cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});const a=n.value;if(null==a||"object"!=typeof a||!("elements"in a)||!Array.isArray(a.elements))throw new lp({message:"No object generated: response did not match schema.",cause:new B({value:a,cause:"response must be an object with an elements array"}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});for(const n of a.elements){const a=await rp({value:n,schema:r});if(!a.success)throw new lp({message:"No object generated: response did not match schema.",cause:a.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason})}return a.elements},async parsePartialOutput({text:e}){const t=await Cp(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const e=t.value;if(null==e||"object"!=typeof e||!("elements"in e)||!Array.isArray(e.elements))return;const n="repaired-parse"===t.state&&e.elements.length>0?e.elements.slice(0,-1):e.elements,a=[];for(const e of n){const t=await rp({value:e,schema:r});t.success&&a.push(t.value)}return{partial:a}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(null!=t)for(;e<t.length;e++)n.enqueue(t[e])}})}}},Fp=({options:e,name:t,description:n})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...null!=t&&{name:t},...null!=n&&{description:n}}),async parseCompleteOutput({text:t},n){const r=await ap({text:t});if(!r.success)throw new lp({message:"No object generated: could not parse the response.",cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});const a=r.value;if(null==a||"object"!=typeof a||!("result"in a)||"string"!=typeof a.result||!e.includes(a.result))throw new lp({message:"No object generated: response did not match schema.",cause:new B({value:a,cause:"response must be an object that contains a choice value."}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return a.result},async parsePartialOutput({text:t}){const n=await Cp(t);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const t=n.value;if(null==t||"object"!=typeof t||!("result"in t)||"string"!=typeof t.result)return;const r=e.filter((e=>e.startsWith(t.result)));return"successful-parse"===n.state?r.includes(t.result)?{partial:t.result}:void 0:1===r.length?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),Dp=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...null!=e&&{name:e},...null!=t&&{description:t}}),async parseCompleteOutput({text:e},t){const n=await ap({text:e});if(!n.success)throw new lp({message:"No object generated: could not parse the response.",cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){const t=await Cp(e);switch(t.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return void 0===t.value?void 0:{partial:t.value}}},createElementStreamTransform(){}});dl({prefix:"aitxt",size:24}),TransformStream;var Lp=Xl((()=>tp(hu([du({type:Pu("text-start"),id:Zi(),providerMetadata:_p.optional()}),du({type:Pu("text-delta"),id:Zi(),delta:Zi(),providerMetadata:_p.optional()}),du({type:Pu("text-end"),id:Zi(),providerMetadata:_p.optional()}),du({type:Pu("error"),errorText:Zi()}),du({type:Pu("tool-input-start"),toolCallId:Zi(),toolName:Zi(),providerExecuted:Ro().optional(),providerMetadata:_p.optional(),dynamic:Ro().optional(),title:Zi().optional()}),du({type:Pu("tool-input-delta"),toolCallId:Zi(),inputTextDelta:Zi()}),du({type:Pu("tool-input-available"),toolCallId:Zi(),toolName:Zi(),input:Ho(),providerExecuted:Ro().optional(),providerMetadata:_p.optional(),dynamic:Ro().optional(),title:Zi().optional()}),du({type:Pu("tool-input-error"),toolCallId:Zi(),toolName:Zi(),input:Ho(),providerExecuted:Ro().optional(),providerMetadata:_p.optional(),dynamic:Ro().optional(),errorText:Zi(),title:Zi().optional()}),du({type:Pu("tool-approval-request"),approvalId:Zi(),toolCallId:Zi()}),du({type:Pu("tool-output-available"),toolCallId:Zi(),output:Ho(),providerExecuted:Ro().optional(),dynamic:Ro().optional(),preliminary:Ro().optional()}),du({type:Pu("tool-output-error"),toolCallId:Zi(),errorText:Zi(),providerExecuted:Ro().optional(),dynamic:Ro().optional()}),du({type:Pu("tool-output-denied"),toolCallId:Zi()}),du({type:Pu("reasoning-start"),id:Zi(),providerMetadata:_p.optional()}),du({type:Pu("reasoning-delta"),id:Zi(),delta:Zi(),providerMetadata:_p.optional()}),du({type:Pu("reasoning-end"),id:Zi(),providerMetadata:_p.optional()}),du({type:Pu("source-url"),sourceId:Zi(),url:Zi(),title:Zi().optional(),providerMetadata:_p.optional()}),du({type:Pu("source-document"),sourceId:Zi(),mediaType:Zi(),title:Zi(),filename:Zi().optional(),providerMetadata:_p.optional()}),du({type:Pu("file"),url:Zi(),mediaType:Zi(),providerMetadata:_p.optional()}),du({type:bc((e=>"string"==typeof e&&e.startsWith("data-")),{message:'Type must start with "data-"'}),id:Zi().optional(),data:Ho(),transient:Ro().optional()}),du({type:Pu("start-step")}),du({type:Pu("finish-step")}),du({type:Pu("start"),messageId:Zi().optional(),messageMetadata:Ho().optional()}),du({type:Pu("finish"),finishReason:Au(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:Ho().optional()}),du({type:Pu("abort"),reason:Zi().optional()}),du({type:Pu("message-metadata"),messageMetadata:Ho()})]))));function Up(e){return e.type.startsWith("tool-")}function Jp(e){return Up(e)||function(e){return"dynamic-tool"===e.type}(e)}function Vp(e){return e.type.split("-").slice(1).join("-")}function Bp({lastMessage:e,messageId:t}){return{message:"assistant"===(null==e?void 0:e.role)?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Wp({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:a,onToolCall:s,onData:i}){return e.pipeThrough(new TransformStream({async transform(e,o){await r((async({state:r,write:u})=>{var c,d,l,p;function h(e){const t=r.message.parts.filter(Jp).find((t=>t.toolCallId===e));if(null==t)throw new vp({chunkType:"tool-invocation",chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function m(e){var t;const n=r.message.parts.find((t=>Up(t)&&t.toolCallId===e.toolCallId)),a=e,s=n;null!=n?(n.state=e.state,s.input=a.input,s.output=a.output,s.errorText=a.errorText,s.rawInput=a.rawInput,s.preliminary=a.preliminary,void 0!==e.title&&(s.title=e.title),s.providerExecuted=null!=(t=a.providerExecuted)?t:n.providerExecuted,null!=a.providerMetadata&&(n.callProviderMetadata=a.providerMetadata)):r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,input:a.input,output:a.output,rawInput:a.rawInput,errorText:a.errorText,providerExecuted:a.providerExecuted,preliminary:a.preliminary,...null!=a.providerMetadata?{callProviderMetadata:a.providerMetadata}:{}})}function f(e){var t,n;const a=r.message.parts.find((t=>"dynamic-tool"===t.type&&t.toolCallId===e.toolCallId)),s=e,i=a;null!=a?(a.state=e.state,i.toolName=e.toolName,i.input=s.input,i.output=s.output,i.errorText=s.errorText,i.rawInput=null!=(t=s.rawInput)?t:i.rawInput,i.preliminary=s.preliminary,void 0!==e.title&&(i.title=e.title),i.providerExecuted=null!=(n=s.providerExecuted)?n:a.providerExecuted,null!=s.providerMetadata&&(a.callProviderMetadata=s.providerMetadata)):r.message.parts.push({type:"dynamic-tool",toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:s.input,output:s.output,errorText:s.errorText,preliminary:s.preliminary,providerExecuted:s.providerExecuted,title:e.title,...null!=s.providerMetadata?{callProviderMetadata:s.providerMetadata}:{}})}async function v(e){if(null!=e){const n=null!=r.message.metadata?Np(r.message.metadata,e):e;null!=t&&await np({value:n,schema:t,context:{field:"message.metadata",entityId:r.message.id}}),r.message.metadata=n}}switch(e.type){case"text-start":{const t={type:"text",text:"",providerMetadata:e.providerMetadata,state:"streaming"};r.activeTextParts[e.id]=t,r.message.parts.push(t),u();break}case"text-delta":{const t=r.activeTextParts[e.id];if(null==t)throw new vp({chunkType:"text-delta",chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=null!=(c=e.providerMetadata)?c:t.providerMetadata,u();break}case"text-end":{const t=r.activeTextParts[e.id];if(null==t)throw new vp({chunkType:"text-end",chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state="done",t.providerMetadata=null!=(d=e.providerMetadata)?d:t.providerMetadata,delete r.activeTextParts[e.id],u();break}case"reasoning-start":{const t={type:"reasoning",text:"",providerMetadata:e.providerMetadata,state:"streaming"};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),u();break}case"reasoning-delta":{const t=r.activeReasoningParts[e.id];if(null==t)throw new vp({chunkType:"reasoning-delta",chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=null!=(l=e.providerMetadata)?l:t.providerMetadata,u();break}case"reasoning-end":{const t=r.activeReasoningParts[e.id];if(null==t)throw new vp({chunkType:"reasoning-end",chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=null!=(p=e.providerMetadata)?p:t.providerMetadata,t.state="done",delete r.activeReasoningParts[e.id],u();break}case"file":r.message.parts.push({type:"file",mediaType:e.mediaType,url:e.url}),u();break;case"source-url":r.message.parts.push({type:"source-url",sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),u();break;case"source-document":r.message.parts.push({type:"source-document",sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),u();break;case"tool-input-start":{const t=r.message.parts.filter(Up);r.partialToolCalls[e.toolCallId]={text:"",toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title},e.dynamic?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}):m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-streaming",input:void 0,providerExecuted:e.providerExecuted,title:e.title,providerMetadata:e.providerMetadata}),u();break}case"tool-input-delta":{const t=r.partialToolCalls[e.toolCallId];if(null==t)throw new vp({chunkType:"tool-input-delta",chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;const{value:n}=await Cp(t.text);t.dynamic?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:n,title:t.title}):m({toolCallId:e.toolCallId,toolName:t.toolName,state:"input-streaming",input:n,title:t.title}),u();break}case"tool-input-available":e.dynamic?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}):m({toolCallId:e.toolCallId,toolName:e.toolName,state:"input-available",input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title}),u(),s&&!e.providerExecuted&&await s({toolCall:e});break;case"tool-input-error":e.dynamic?f({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}):m({toolCallId:e.toolCallId,toolName:e.toolName,state:"output-error",input:void 0,rawInput:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}),u();break;case"tool-approval-request":{const t=h(e.toolCallId);t.state="approval-requested",t.approval={id:e.approvalId},u();break}case"tool-output-denied":h(e.toolCallId).state="output-denied",u();break;case"tool-output-available":{const t=h(e.toolCallId);"dynamic-tool"===t.type?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-available",input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,title:t.title}):m({toolCallId:e.toolCallId,toolName:Vp(t),state:"output-available",input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,title:t.title}),u();break}case"tool-output-error":{const t=h(e.toolCallId);"dynamic-tool"===t.type?f({toolCallId:e.toolCallId,toolName:t.toolName,state:"output-error",input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,title:t.title}):m({toolCallId:e.toolCallId,toolName:Vp(t),state:"output-error",input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,title:t.title}),u();break}case"start-step":r.message.parts.push({type:"step-start"});break;case"finish-step":r.activeTextParts={},r.activeReasoningParts={};break;case"start":null!=e.messageId&&(r.message.id=e.messageId),await v(e.messageMetadata),null==e.messageId&&null==e.messageMetadata||u();break;case"finish":null!=e.finishReason&&(r.finishReason=e.finishReason),await v(e.messageMetadata),null!=e.messageMetadata&&u();break;case"message-metadata":await v(e.messageMetadata),null!=e.messageMetadata&&u();break;case"error":null==a||a(new Error(e.errorText));break;default:if(function(e){return e.type.startsWith("data-")}(e)){if(null!=(null==n?void 0:n[e.type])){const t=r.message.parts.findIndex((t=>"id"in t&&"data"in t&&t.id===e.id&&t.type===e.type)),a=t>=0?t:r.message.parts.length;await np({value:e.data,schema:n[e.type],context:{field:`message.parts[${a}].data`,entityName:e.type,entityId:e.id}})}const t=e;if(t.transient){null==i||i(t);break}const a=null!=t.id?r.message.parts.find((e=>t.type===e.type&&t.id===e.id)):void 0;null!=a?a.data=t.data:r.message.parts.push(t),null==i||i(t),u()}}o.enqueue(e)}))}}))}dl({prefix:"aitxt",size:24}),Xl((()=>tp(iu(cu({id:Zi(),role:Au(["system","user","assistant"]),metadata:Ho().optional(),parts:iu(hu([cu({type:Pu("text"),text:Zi(),state:Au(["streaming","done"]).optional(),providerMetadata:_p.optional()}),cu({type:Pu("reasoning"),text:Zi(),state:Au(["streaming","done"]).optional(),providerMetadata:_p.optional()}),cu({type:Pu("source-url"),sourceId:Zi(),url:Zi(),title:Zi().optional(),providerMetadata:_p.optional()}),cu({type:Pu("source-document"),sourceId:Zi(),mediaType:Zi(),title:Zi(),filename:Zi().optional(),providerMetadata:_p.optional()}),cu({type:Pu("file"),mediaType:Zi(),filename:Zi().optional(),url:Zi(),providerMetadata:_p.optional()}),cu({type:Pu("step-start")}),cu({type:Zi().startsWith("data-"),id:Zi().optional(),data:Ho()}),cu({type:Pu("dynamic-tool"),toolName:Zi(),toolCallId:Zi(),state:Pu("input-streaming"),input:Ho().optional(),providerExecuted:Ro().optional(),callProviderMetadata:_p.optional(),output:eu().optional(),errorText:eu().optional(),approval:eu().optional()}),cu({type:Pu("dynamic-tool"),toolName:Zi(),toolCallId:Zi(),state:Pu("input-available"),input:Ho(),providerExecuted:Ro().optional(),output:eu().optional(),errorText:eu().optional(),callProviderMetadata:_p.optional(),approval:eu().optional()}),cu({type:Pu("dynamic-tool"),toolName:Zi(),toolCallId:Zi(),state:Pu("approval-requested"),input:Ho(),providerExecuted:Ro().optional(),output:eu().optional(),errorText:eu().optional(),callProviderMetadata:_p.optional(),approval:cu({id:Zi(),approved:eu().optional(),reason:eu().optional()})}),cu({type:Pu("dynamic-tool"),toolName:Zi(),toolCallId:Zi(),state:Pu("approval-responded"),input:Ho(),providerExecuted:Ro().optional(),output:eu().optional(),errorText:eu().optional(),callProviderMetadata:_p.optional(),approval:cu({id:Zi(),approved:Ro(),reason:Zi().optional()})}),cu({type:Pu("dynamic-tool"),toolName:Zi(),toolCallId:Zi(),state:Pu("output-available"),input:Ho(),providerExecuted:Ro().optional(),output:Ho(),errorText:eu().optional(),callProviderMetadata:_p.optional(),preliminary:Ro().optional(),approval:cu({id:Zi(),approved:Pu(!0),reason:Zi().optional()}).optional()}),cu({type:Pu("dynamic-tool"),toolName:Zi(),toolCallId:Zi(),state:Pu("output-error"),input:Ho(),rawInput:Ho().optional(),providerExecuted:Ro().optional(),output:eu().optional(),errorText:Zi(),callProviderMetadata:_p.optional(),approval:cu({id:Zi(),approved:Pu(!0),reason:Zi().optional()}).optional()}),cu({type:Pu("dynamic-tool"),toolName:Zi(),toolCallId:Zi(),state:Pu("output-denied"),input:Ho(),providerExecuted:Ro().optional(),output:eu().optional(),errorText:eu().optional(),callProviderMetadata:_p.optional(),approval:cu({id:Zi(),approved:Pu(!1),reason:Zi().optional()})}),cu({type:Zi().startsWith("tool-"),toolCallId:Zi(),state:Pu("input-streaming"),providerExecuted:Ro().optional(),callProviderMetadata:_p.optional(),input:Ho().optional(),output:eu().optional(),errorText:eu().optional(),approval:eu().optional()}),cu({type:Zi().startsWith("tool-"),toolCallId:Zi(),state:Pu("input-available"),providerExecuted:Ro().optional(),input:Ho(),output:eu().optional(),errorText:eu().optional(),callProviderMetadata:_p.optional(),approval:eu().optional()}),cu({type:Zi().startsWith("tool-"),toolCallId:Zi(),state:Pu("approval-requested"),input:Ho(),providerExecuted:Ro().optional(),output:eu().optional(),errorText:eu().optional(),callProviderMetadata:_p.optional(),approval:cu({id:Zi(),approved:eu().optional(),reason:eu().optional()})}),cu({type:Zi().startsWith("tool-"),toolCallId:Zi(),state:Pu("approval-responded"),input:Ho(),providerExecuted:Ro().optional(),output:eu().optional(),errorText:eu().optional(),callProviderMetadata:_p.optional(),approval:cu({id:Zi(),approved:Ro(),reason:Zi().optional()})}),cu({type:Zi().startsWith("tool-"),toolCallId:Zi(),state:Pu("output-available"),providerExecuted:Ro().optional(),input:Ho(),output:Ho(),errorText:eu().optional(),callProviderMetadata:_p.optional(),preliminary:Ro().optional(),approval:cu({id:Zi(),approved:Pu(!0),reason:Zi().optional()}).optional()}),cu({type:Zi().startsWith("tool-"),toolCallId:Zi(),state:Pu("output-error"),providerExecuted:Ro().optional(),input:Ho(),rawInput:Ho().optional(),output:eu().optional(),errorText:Zi(),callProviderMetadata:_p.optional(),approval:cu({id:Zi(),approved:Pu(!0),reason:Zi().optional()}).optional()}),cu({type:Zi().startsWith("tool-"),toolCallId:Zi(),state:Pu("output-denied"),providerExecuted:Ro().optional(),input:Ho(),output:eu().optional(),errorText:eu().optional(),callProviderMetadata:_p.optional(),approval:cu({id:Zi(),approved:Pu(!1),reason:Zi().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")))),dl({prefix:"aiobj",size:24}),dl({prefix:"aiobj",size:24});Symbol.for("vercel.ai.error.AI_NoSuchProviderError");var qp=class extends class{constructor({api:e="/api/chat",credentials:t,headers:n,body:r,fetch:a,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=a,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var n,r,a,s,i;const o=await sp(this.body),u=await sp(this.headers),c=await sp(this.credentials),d={...hl(u),...hl(t.headers)},l=await(null==(n=this.prepareSendMessagesRequest)?void 0:n.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...o,...t.body},headers:d,credentials:c,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=null!=(r=null==l?void 0:l.api)?r:this.api,h=void 0!==(null==l?void 0:l.headers)?hl(l.headers):d,m=void 0!==(null==l?void 0:l.body)?l.body:{...o,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},f=null!=(a=null==l?void 0:l.credentials)?a:c,v=null!=(s=this.fetch)?s:globalThis.fetch,y=await v(p,{method:"POST",headers:ml({"Content-Type":"application/json",...h},"ai-sdk/6.0.72",pl()),body:JSON.stringify(m),credentials:f,signal:e});if(!y.ok)throw new Error(null!=(i=await y.text())?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(e){var t,n,r,a,s;const i=await sp(this.body),o=await sp(this.headers),u=await sp(this.credentials),c={...hl(o),...hl(e.headers)},d=await(null==(t=this.prepareReconnectToStreamRequest)?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:c,credentials:u,requestMetadata:e.metadata})),l=null!=(n=null==d?void 0:d.api)?n:`${this.api}/${e.chatId}/stream`,p=void 0!==(null==d?void 0:d.headers)?hl(d.headers):c,h=null!=(r=null==d?void 0:d.credentials)?r:u,m=null!=(a=this.fetch)?a:globalThis.fetch,f=await m(l,{method:"GET",headers:ml(p,"ai-sdk/6.0.72",pl()),credentials:h});if(204===f.status)return null;if(!f.ok)throw new Error(null!=(s=await f.text())?s:"Failed to fetch the chat response.");if(!f.body)throw new Error("The response body is empty.");return this.processResponseStream(f.body)}}{constructor(e={}){super(e)}processResponseStream(e){return function({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new il).pipeThrough(new TransformStream({async transform({data:e},n){"[DONE]"!==e&&n.enqueue(await ap({text:e,schema:t}))}}))}({stream:e,schema:Lp}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},Kp=class{constructor({generateId:e=ll,id:t=e(),transport:n=new qp,messageMetadataSchema:r,dataPartSchemas:a,state:s,onError:i,onToolCall:o,onFinish:u,onData:c,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise(((t,n)=>{this.queue.push((async()=>{try{await e(),t()}catch(e){n(e)}})),this.processQueue()}))}},this.sendMessage=async(e,t)=>{var n,r,a,s;if(null==e)return void await this.makeRequest({trigger:"submit-message",messageId:null==(n=this.lastMessage)?void 0:n.id,...t});let i;if("text"in e||"files"in e){const t=Array.isArray(e.files)?e.files:await async function(e){if(null==e)return[];if(!(globalThis.FileList&&e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map((async e=>{const{name:t,type:n}=e,r=await new Promise(((t,n)=>{const r=new FileReader;r.onload=e=>{var n;t(null==(n=e.target)?void 0:n.result)},r.onerror=e=>n(e),r.readAsDataURL(e)}));return{type:"file",mediaType:n,filename:t,url:r}})))}(e.files);i={parts:[...t,..."text"in e&&null!=e.text?[{type:"text",text:e.text}]:[]]}}else i=e;if(null!=e.messageId){const t=this.state.messages.findIndex((t=>t.id===e.messageId));if(-1===t)throw new Error(`message with id ${e.messageId} not found`);if("user"!==this.state.messages[t].role)throw new Error(`message with id ${e.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{...i,id:e.messageId,role:null!=(r=i.role)?r:"user",metadata:e.metadata})}else this.state.pushMessage({...i,id:null!=(a=i.id)?a:this.generateId(),role:null!=(s=i.role)?s:"user",metadata:e.metadata});await this.makeRequest({trigger:"submit-message",messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{const n=null==e?this.state.messages.length-1:this.state.messages.findIndex((t=>t.id===e));if(-1===n)throw new Error(`message ${e} not found`);this.state.messages=this.state.messages.slice(0,"assistant"===this.messages[n].role?n:n+1),await this.makeRequest({trigger:"regenerate-message",messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:"resume-stream",...e})},this.clearError=()=>{"error"===this.status&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n})=>this.jobExecutor.run((async()=>{const r=this.state.messages,a=r[r.length-1],s=r=>Jp(r)&&"approval-requested"===r.state&&r.approval.id===e?{...r,state:"approval-responded",approval:{id:e,approved:t,reason:n}}:r;this.state.replaceMessage(r.length-1,{...a,parts:a.parts.map(s)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(s)),"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then((e=>{var t;e&&this.makeRequest({trigger:"submit-message",messageId:null==(t=this.lastMessage)?void 0:t.id})}))})),this.addToolOutput=async({state:e="output-available",tool:t,toolCallId:n,output:r,errorText:a})=>this.jobExecutor.run((async()=>{const t=this.state.messages,s=t[t.length-1],i=t=>Jp(t)&&t.toolCallId===n?{...t,state:e,output:r,errorText:a}:t;this.state.replaceMessage(t.length-1,{...s,parts:s.parts.map(i)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(i)),"streaming"!==this.status&&"submitted"!==this.status&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then((e=>{var t;e&&this.makeRequest({trigger:"submit-message",messageId:null==(t=this.lastMessage)?void 0:t.id})}))})),this.addToolResult=this.addToolOutput,this.stop=async()=>{var e;"streaming"!==this.status&&"submitted"!==this.status||(null==(e=this.activeResponse)?void 0:e.abortController)&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=a,this.state=s,this.onError=i,this.onToolCall=o,this.onFinish=u,this.onData=c,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&"object"==typeof e&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:a}){var s,i,o;this.setStatus({status:"submitted",error:void 0});const u=this.lastMessage;let c=!1,d=!1,l=!1;try{const o={state:Bp({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};let p;if(o.abortController.signal.addEventListener("abort",(()=>{c=!0})),this.activeResponse=o,"resume-stream"===e){const e=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(null==e)return void this.setStatus({status:"ready"});p=e}else p=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:o.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:a});const h=e=>this.jobExecutor.run((()=>e({state:o.state,write:()=>{var e;this.setStatus({status:"streaming"}),o.state.message.id===(null==(e=this.lastMessage)?void 0:e.id)?this.state.replaceMessage(this.state.messages.length-1,o.state.message):this.state.pushMessage(o.state.message)}})));await async function({stream:e,onError:t}){const n=e.getReader();try{for(;;){const{done:e}=await n.read();if(e)break}}catch(e){null==t||t(e)}finally{n.releaseLock()}}({stream:Wp({stream:p,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:h,onError:e=>{throw e}}),onError:e=>{throw e}}),this.setStatus({status:"ready"})}catch(e){if(c||"AbortError"===e.name)return c=!0,this.setStatus({status:"ready"}),null;l=!0,e instanceof TypeError&&(e.message.toLowerCase().includes("fetch")||e.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:"error",error:e})}finally{try{null==(i=this.onFinish)||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:d,isError:l,finishReason:null==(s=this.activeResponse)?void 0:s.state.finishReason})}catch(e){console.error(e)}this.activeResponse=void 0}!l&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:null==(o=this.lastMessage)?void 0:o.id,metadata:t,headers:n,body:r})}}}}]);
|