@bylqwjc/media-editor-server 1.0.18 → 1.0.19

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.
@@ -1 +1 @@
1
- import{findFilterPreset as Z,normalizeDeg as X,outputSize as Y}from"./chunk-USY6UDGL.js";import{DEG2RAD as gt,FILTER_PRESETS as St,buildFilterCss as bt,centeredMaxRect as xt,clampRect as Et,evenize as Mt,findFilterPreset as At,fitRects as Tt,normalizeDeg as yt,outputSize as Pt,rotatedSize as Rt}from"./chunk-USY6UDGL.js";import{AudioClip as _t,Clip as wt,MIN_CLIP as It,Overlay as Ft,VideoEditState as Nt,canRedo as Ot,canUndo as Lt,clampAudioClip as Dt,clipDuration as Ct,clipStartsAt as jt,contentDuration as zt,createHistory as Vt,defaultVideoEditState as kt,duplicateClip as Gt,locateOutput as qt,pushHistory as Ht,redo as Ut,remapSrcIndices as Bt,removeClip as Kt,reorderClips as Wt,replacePresent as Zt,splitAtOutput as Xt,totalDuration as Yt,trimClipEdge as Jt,undo as Qt,usedVideoSrcIndices as te}from"./chunk-MGKYVYOH.js";import{DEFAULT_PLATFORM_TARGETS as ee,EDITOR_MESSAGES as se,IMAGE_PLATFORM_PRESETS as ne,IMAGE_RATIO_PRESETS as ae,VIDEO_PLATFORM_RATIO_PRESETS as re,VIDEO_RATIO_PRESETS as ie,VIDEO_SIZE_PRESETS as oe,buildImagePlatformPresets as ue,buildVideoPlatformRatioPresets as ce,buildVideoSizePresets as le,compensateAnnotationRotation as pe,parseRatio as he,tEditor as fe,toHant as $e}from"./chunk-XCBM7P7N.js";function de(t){const e=X(t);if(e===0)return[];if(e===90)return["transpose=1"];if(e===180)return["transpose=1","transpose=1"];if(e===270)return["transpose=2"];const s=`${e}*PI/180`;return[`rotate=${s}:ow=rotw(${s}):oh=roth(${s}):c=black`]}function v(t){return Math.max(-1,Math.min(1,Number(t)||0))}function F(t){return Math.max(0,Math.min(1,Number(t)||0))}function J(t,e,s,n){const a=Math.round(Number(t));return Number.isFinite(a)?Math.min(s,Math.max(e,a)):n}function Q(t){return Math.min(Math.max(Number(t)||1,.5),2)}function me(t){const e=[];let s=Q(t);for(;s<.5-1e-6||s>2+1e-6;)s<.5?(e.push("atempo=0.5"),s/=.5):(e.push("atempo=2"),s/=2);return Math.abs(s-1)>1e-4&&e.push(`atempo=${s.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}`),e}function _(t,e){const s=J(t,2,8192,e);return s%2===0?s:s-1}function w(t){return t?.exportSettings??null}function ve(t){const e=String(w(t)?.format??"mp4").toLowerCase();return e==="mov"||e==="mxf"?e:"mp4"}function tt(t){return J(w(t)?.frameRate,12,120,30)}function ge(t){const e=Y(t.canvas,t),s=w(t);if(!s)return e;const n=Number.isFinite(Number(s.width))&&Number(s.width)>0,a=Number.isFinite(Number(s.height))&&Number(s.height)>0;if(!n&&!a)return e;const r=e.w>0&&e.h>0?e.w/e.h:1;if(n&&a)return{w:_(s.width,e.w),h:_(s.height,e.h)};if(n){const o=_(s.width,e.w);return{w:o,h:_(o/r,e.h)}}const u=_(s.height,e.h);return{w:_(u*r,e.w),h:u}}function Se(t){const e=Number(w(t)?.videoBitrateKbps);return Number.isFinite(e)&&e>=100?Math.round(e):0}function be(t){const e=Number(w(t)?.audioBitrateKbps);return Number.isFinite(e)&&e>=32?Math.round(e):0}function xe(t){return w(t)?.audioCodec==="mp3"?"libmp3lame":"aac"}function k(t){return Y(t.canvas,t)}function G(t){const e=k(t),s=ge(t);return s.w===e.w&&s.h===e.h?[]:[`scale=${s.w}:${s.h}`]}function et(t){const e=v(t?.brightness),s=v(t?.contrast),n=v(t?.saturation),a=v(t?.gamma);if(e===0&&s===0&&n===0&&a===0)return null;const r=[];if(e!==0||s!==0){const o=M(Math.max(0,1+e)),i=M(Math.max(0,1+s)),l=`clip(((val*${o})-128)*${i}+128,0,255)`;r.push(`lutrgb=r='${l}':g='${l}':b='${l}'`)}const u=[];return n!==0&&u.push(`saturation=${1+n}`),a!==0&&u.push(`gamma=${(1+a*(a>0?1:.5)).toFixed(3)}`),u.length&&r.push(`eq=${u.join(":")}`),r.join(",")}function M(t){return`${Math.round(t*1e3)/1e3}`}function st(t){const e=v(t?.temperature),s=v(t?.tint);if(e===0&&s===0)return null;const n=v(e*.18+s*.08),a=v(e*.02-s*.12),r=v(-e*.18+s*.08);return`colorbalance=rs=${M(n)}:gs=${M(a)}:bs=${M(r)}`}function nt(t){const e=v(t?.vibrance);return e===0?null:`vibrance=intensity=${M(e)}`}function I(t,e,s){if(t===e)return s<t?0:1;const n=Math.max(0,Math.min(1,(s-t)/(e-t)));return n*n*(3-2*n)}function Ee(t){const e=I(.08,.4,t),s=1-I(.6,.92,t);return Math.max(0,Math.min(1,e*s*2.2))}function Me(t,e){const s=1-I(.18,.62,t),n=1-I(.04,.32,t),a=I(.38,.84,t),r=I(.7,.98,t),u=Ee(t),o=e.shadows*s*.28+e.highlights*a*.24+e.blacks*n*.2+e.whites*r*.2+e.lightSense*u*.18+e.fade*(.12+s*.06);return Math.max(0,Math.min(1,t+o))}function at(t){const e={highlights:v(t?.highlights),shadows:v(t?.shadows),whites:v(t?.whites),blacks:v(t?.blacks),lightSense:v(t?.lightSense),fade:F(t?.fade)};return Object.values(e).some(s=>Math.abs(s)>1e-4)?`curves=master='${[0,.18,.36,.5,.68,.84,1].map(s=>`${M(s)}/${M(Me(s,e))}`).join(" ")}'`:null}function rt(t){const e=[],s=F(t?.clarity),n=F(t?.sharpen);return s>1e-4&&e.push(`unsharp=lx=7:ly=7:la=${M(s*1.8)}:cx=7:cy=7:ca=0`),n>1e-4&&e.push(`unsharp=lx=3:ly=3:la=${M(.35+n*2.1)}:cx=3:cy=3:ca=${M(n*.55)}`),e}function it(t){const e=F(t?.grain);return e<=1e-4?null:`noise=alls=${Math.round(6+e*26)}:allf=t`}function ot(t){const e=F(t?.vignette);if(e<=1e-4)return null;const s=Math.max(.12,.42-e*.22);return`vignette=angle=${M(s)}*PI`}function q(t,e={}){const s=[];if(t.flipX&&s.push("hflip"),t.flipY&&s.push("vflip"),s.push(...de(t.rotation)),t.crop){const{x:p,y:f,width:d,height:x}=t.crop;s.push(`crop=${d}:${x}:${p}:${f}`)}if(t.scale){const{width:p,height:f,fit:d}=t.scale;d==="force"?s.push(`scale=${p}:${f}`):d==="cover"?s.push(`scale=${p}:${f}:force_original_aspect_ratio=increase`,`crop=${p}:${f}`):s.push(`scale=${p}:${f}:force_original_aspect_ratio=decrease`,`pad=${p}:${f}:(ow-iw)/2:(oh-ih)/2`)}const n=et(t.filters);n&&s.push(n);const a=st(t.filters);a&&s.push(a);const r=nt(t.filters);r&&s.push(r);const u=at(t.filters);u&&s.push(u),s.push(...rt(t.filters));const o=it(t.filters);o&&s.push(o);const i=ot(t.filters);i&&s.push(i);const l=Z(t.filterPreset);return l&&s.push(l.vf),e.includeExportScale!==!1&&s.push(...G(t)),s.push(`fps=${tt(t)}`),X(t.rotation)%90!==0&&!t.scale&&s.push("scale=trunc(iw/2)*2:trunc(ih/2)*2"),s}var ut={fade:"fade",slide:"slideleft",wipe:"wipeleft",flip:"horzopen",clockWipe:"radial",star:"pixelize",circle:"circleopen",rectangle:"rectcrop"},Ae={fade:"qsin",slide:"tri",wipe:"tri",flip:"exp",clockWipe:"qsin",star:"tri",circle:"qsin",rectangle:"qsin"};function N(t){return t.out-t.in}function ct(t,e,s){const n=t&&typeof t.type=="string"?t.type:"none",a=ut[n]?n:"none",r=Math.max(0,Math.min(1.2,e-.05,s-.05));if(a==="none"||r<=.05)return{type:"none",duration:0,effect:"fade",curve:"tri"};const u=Number(t?.duration),o=Math.min(Math.max(Number.isFinite(u)?u:.4,.1),r);return{type:a,duration:o,effect:ut[a],curve:Ae[a]??"tri"}}function Te(t,e){if(!Array.isArray(e)||e.length<2)return!1;for(let s=0;s<e.length-1;s++){const n=ct(t?.[s],N(e[s]),N(e[s+1]));if(n.type!=="none"&&n.duration>0)return!0}return!1}function ye(t,e){const s=[];let n=0;for(let a=0;a<t.length-1;a++){const r=ct(e?.[a],N(t[a]),N(t[a+1]));r.type!=="none"&&r.duration>0&&(s.push({start:n,end:a,transition:r}),n=a+1)}return s.push({start:n,end:t.length-1,transition:null}),s}function Pe(t,e,s){let n=0;for(let a=e;a<=s;a++)n+=N(t[a]);return n}function Re(t,e,s,n){const a=ye(e,s).map((i,l)=>{const p=Pe(e,i.start,i.end);if(i.start===i.end)return{vLabel:`[v${i.start}]`,aLabel:n?`[a${i.start}]`:"",duration:p,transition:i.transition};const f=[];for(let g=i.start;g<=i.end;g++)f.push(n?`[v${g}][a${g}]`:`[v${g}]`);const d=`[sgv${l}]`,x=n?`[sga${l}]`:"";return t.push(`${f.join("")}concat=n=${i.end-i.start+1}:v=1:a=${n?1:0}${n?`${d}${x}`:d}`),{vLabel:d,aLabel:x,duration:p,transition:i.transition}});let r=a[0].vLabel,u=n?a[0].aLabel:"",o=a[0].duration;for(let i=1;i<a.length;i++){const l=a[i-1].transition,p=a[i],f=`[vx${i}]`,d=Math.max(0,o-l.duration);if(t.push(`${r}${p.vLabel}xfade=transition=${l.effect}:duration=${l.duration}:offset=${d}${f}`),r=f,n){const x=`[ax${i}]`;t.push(`${u}${p.aLabel}acrossfade=d=${l.duration}:c1=${l.curve}:c2=${l.curve}${x}`),u=x}o=o+p.duration-l.duration}return{vLabel:r,aLabel:u,duration:o}}function H(t,e){const s=ve(e),n=s==="mxf"?["-c:v","mpeg2video","-pix_fmt","yuv422p"]:["-c:v","libx264","-preset","veryfast","-pix_fmt","yuv420p","-movflags","+faststart"],a=Se(e);if(a>0?n.push("-b:v",`${a}k`,"-maxrate",`${a}k`,"-bufsize",`${Math.max(a*2,512)}k`):s==="mxf"&&n.push("-q:v","2"),t)if(s==="mxf")n.push("-c:a","pcm_s16le");else{n.push("-c:a",xe(e));const r=be(e);r>0&&n.push("-b:a",`${r}k`)}return s==="mxf"&&n.push("-f","mxf"),n}var D="aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo",lt="anullsrc=r=44100:cl=stereo";function pt(t){return t>.02?`,afade=t=in:st=0:d=0.01,afade=t=out:st=${Math.round((t-.01)*1e3)/1e3}:d=0.01`:""}var _e="alimiter=limit=0.95:level=disabled:latency=1",we=3,Ie=.5;function ht(t,e=0){const s=Math.max(e,Math.floor(Number(t)||0));return s%2===0?s:s-1}function Fe(t){const e=Number.isFinite(t?.startAt)?Math.max(0,Number(t.startAt)):0,s=Number(t?.endAt);return Number.isFinite(s)?{startAt:e,endAt:Math.max(e+Ie,s)}:{startAt:e,endAt:e+we}}function Ne(t,e){const s=Math.max(2,ht(e.w,2)),n=Math.max(2,ht(e.h,2));return!(s>1)||!(n>1)?null:{x:0,y:0,w:s,h:n}}function Oe(t){if(t?.type==="filter"){const i=Z(t.filterPreset);return i?[i.vf]:[]}if(t?.type!=="adjust")return[];const e=[],s=et(t);s&&e.push(s);const n=st(t);n&&e.push(n);const a=nt(t);a&&e.push(a);const r=at(t);r&&e.push(r),e.push(...rt(t));const u=it(t);u&&e.push(u);const o=ot(t);return o&&e.push(o),e}function ft(t,e){const s=[];for(const n of t??[]){if(n?.type!=="filter"&&n?.type!=="adjust")continue;const a=Ne(n,e);if(!a)continue;const r=Oe(n);r.length&&s.push({rect:a,filters:r,...Fe(n)})}return s}function $t(t,e=1/0){const s=[];for(const n of t??[]){if(n?.type!=="pen"&&n?.type!=="line"&&n?.type!=="arrow"&&n?.type!=="rect"&&n?.type!=="ellipse"&&n?.type!=="text"&&n?.type!=="sticker")continue;const a=Number(n.startAt),r=Number(n.endAt);if(!(!Number.isFinite(a)||!Number.isFinite(r)||r<=a)&&(s.push({startAt:Math.max(0,a),endAt:Math.max(a+.01,r)}),s.length>=e))break}return s}function dt(t,e,s,n){let a=e;return n.forEach((r,u)=>{const o=`[vtxt${s+u}]`;t.push(`${a}[${s+u}:v]overlay=0:0:enable='between(t,${r.startAt.toFixed(3)},${r.endAt.toFixed(3)})'${o}`),a=o}),a}function mt(t,e,s){let n=e;return s.forEach((a,r)=>{const u=`[vfxsrc${r}]`,o=`[vfxbase${r}]`,i=`[vfxcrop${r}]`,l=`[vfx${r}]`,{rect:p}=a;t.push(`${n}split=2${u}${o}`),t.push(`${u}crop=${p.w}:${p.h}:${p.x}:${p.y},${a.filters.join(",")}${i}`),t.push(`${o}${i}overlay=${p.x}:${p.y}:enable='between(t,${a.startAt.toFixed(3)},${a.endAt.toFixed(3)})'${l}`),n=l}),n}function Le(t,e,s,n,a,r=[]){const u=q(t,{includeExportScale:!1}),o=t.clips,i=t.keepAudio&&a,l=o.length>=2,p=ft(t.overlays,k(t)),f=$t(t.overlays,r.length),d=r.slice(0,f.length);if(l||n||d.length||p.length){const E=[];let h;if(l){o.forEach((b,P)=>{E.push(`[0:v]trim=start=${b.in}:end=${b.out},setpts=PTS-STARTPTS[v${P}]`),i&&E.push(`[0:a]atrim=start=${b.in}:end=${b.out},asetpts=PTS-STARTPTS${pt(b.out-b.in)}[a${P}]`)});const $=o.map((b,P)=>i?`[v${P}][a${P}]`:`[v${P}]`).join(""),S=i?"[vcat][acat]":"[vcat]";E.push(`${$}concat=n=${o.length}:v=1:a=${i?1:0}${S}`),h="[vcat]"}else h="[0:v]";if(u.length&&(E.push(`${h}${u.join(",")}[vflt]`),h="[vflt]"),p.length&&(h=mt(E,h,p)),n?(E.push(`${h}[1:v]overlay=0:0[vout]`),h="[vout]"):h==="[0:v]"&&(E.push("[0:v]null[vout]"),h="[vout]"),d.length){const $=1+(n?1:0);h=dt(E,h,$,f)}const A=G(t);A.length&&(E.push(`${h}${A.join(",")}[vscaled]`),h="[vscaled]");const O=[];!l&&o.length===1&&O.push("-ss",String(o[0].in),"-t",String(o[0].out-o[0].in));const y=["-y",...O,"-i",e];n&&y.push("-i",n);for(const $ of d)y.push("-i",$);return y.push("-filter_complex",E.join(";"),"-map",h),i&&y.push("-map",l?"[acat]":"0:a?"),y.push(...H(i,t)),y.push(s),y}const x=q(t),g=["-y","-ss",String(o[0].in),"-t",String(o[0].out-o[0].in),"-i",e];return x.length&&g.push("-vf",x.join(",")),i||g.push("-an"),g.push(...H(i,t)),g.push(s),g}function De(t,e,s){const{videoPaths:n,videoHasAudio:a,audioPaths:r,overlayPath:u,textOverlayPaths:o=[]}=e,i=t.audioClips??[],l=Te(t.transitions,t.clips),p=$t(t.overlays,o.length),f=o.slice(0,p.length);if(n.length===1&&i.length===0&&!l)return Le(t,n[0],s,u,a[0]??!1,f);const d=n.length,x=r.length,g=t.canvas.w,E=t.canvas.h,h=t.clips,A=t.keepAudio&&h.some(c=>a[c.srcIdx]),O=tt(t),y=h.reduce((c,m)=>c+(m.out-m.in),0),$=[];h.forEach((c,m)=>{$.push(`[${c.srcIdx}:v]trim=start=${c.in}:end=${c.out},setpts=PTS-STARTPTS,scale=${g}:${E}:force_original_aspect_ratio=increase,crop=${g}:${E},setsar=1,fps=${O},format=yuv420p[v${m}]`),A&&(a[c.srcIdx]?$.push(`[${c.srcIdx}:a]atrim=start=${c.in}:end=${c.out},asetpts=PTS-STARTPTS${pt(c.out-c.in)},${D}[a${m}]`):$.push(`${lt},atrim=start=0:end=${c.out-c.in},asetpts=PTS-STARTPTS,${D}[a${m}]`))});let S="[vcat]",b=A?"[acat]":"",P=y;if(l){const c=Re($,h,t.transitions??[],A);S=c.vLabel,b=A?c.aLabel:"",P=c.duration}else{const c=h.map((m,R)=>A?`[v${R}][a${R}]`:`[v${R}]`).join("");$.push(`${c}concat=n=${h.length}:v=1:a=${A?1:0}${A?"[vcat][acat]":"[vcat]"}`)}if(!A&&i.length&&($.push(`${lt},atrim=start=0:end=${P},asetpts=PTS-STARTPTS,${D}[acat]`),b="[acat]"),i.length){i.forEach((m,R)=>{const W=Math.max(0,Math.round(m.startAt*1e3)),j=Math.max(0,m.out-m.in),vt=Q(m.speed),z=Math.min(Math.max(Number(m.fadeIn)||0,0),j),V=Math.min(Math.max(Number(m.fadeOut)||0,0),Math.max(0,j-z)),L=[`atrim=start=${m.in}:end=${m.out}`,"asetpts=PTS-STARTPTS",...me(vt),`volume=${m.volume}`];z>1e-4&&L.push(`afade=t=in:st=0:d=${z}`),V>1e-4&&L.push(`afade=t=out:st=${Math.max(0,j-V)}:d=${V}`),L.push(D,`adelay=${W}|${W}`),$.push(`[${d+R}:a]${L.join(",")}[mu${R}]`)});const c=`${b}${i.map((m,R)=>`[mu${R}]`).join("")}`;$.push(`${c}amix=inputs=${1+i.length}:duration=first:dropout_transition=0:normalize=0,${_e}[aout]`),b="[aout]"}const U=q(t,{includeExportScale:!1}),B=ft(t.overlays,k(t));if(U.length&&($.push(`${S}${U.join(",")}[vflt]`),S="[vflt]"),B.length&&(S=mt($,S,B)),u&&($.push(`${S}[${d+x}:v]overlay=0:0[vout]`),S="[vout]"),f.length){const c=d+x+(u?1:0);S=dt($,S,c,p)}const K=G(t);K.length&&($.push(`${S}${K.join(",")}[vscaled]`),S="[vscaled]");const T=["-y"];for(const c of n)T.push("-i",c);for(const c of r)T.push("-i",c);u&&T.push("-i",u);for(const c of f)T.push("-i",c);T.push("-filter_complex",$.join(";"),"-map",S);const C=!!b;return C&&T.push("-map",b),T.push(...H(C,t)),C&&T.push("-ar","44100","-ac","2"),T.push(s),T}function Ce(t,e,s){return["-y","-ss",String(e),"-i",t,"-frames:v","1","-q:v","2",s]}export{_t as AudioClip,wt as Clip,ee as DEFAULT_PLATFORM_TARGETS,gt as DEG2RAD,se as EDITOR_MESSAGES,St as FILTER_PRESETS,ne as IMAGE_PLATFORM_PRESETS,ae as IMAGE_RATIO_PRESETS,It as MIN_CLIP,Ft as Overlay,re as VIDEO_PLATFORM_RATIO_PRESETS,ie as VIDEO_RATIO_PRESETS,oe as VIDEO_SIZE_PRESETS,Nt as VideoEditState,De as buildFfmpegArgs,bt as buildFilterCss,ue as buildImagePlatformPresets,Ce as buildPosterArgs,ce as buildVideoPlatformRatioPresets,le as buildVideoSizePresets,Ot as canRedo,Lt as canUndo,xt as centeredMaxRect,Dt as clampAudioClip,Et as clampRect,Ct as clipDuration,jt as clipStartsAt,pe as compensateAnnotationRotation,zt as contentDuration,Vt as createHistory,kt as defaultVideoEditState,Gt as duplicateClip,Mt as evenize,At as findFilterPreset,Tt as fitRects,qt as locateOutput,yt as normalizeDeg,Pt as outputSize,he as parseRatio,Ht as pushHistory,Ut as redo,Bt as remapSrcIndices,Kt as removeClip,Wt as reorderClips,Zt as replacePresent,Rt as rotatedSize,Xt as splitAtOutput,fe as tEditor,$e as toHant,Yt as totalDuration,Jt as trimClipEdge,Qt as undo,te as usedVideoSrcIndices};
1
+ import{findFilterPreset as Z,normalizeDeg as X,outputSize as Y}from"./chunk-USY6UDGL.js";import{DEG2RAD as gt,FILTER_PRESETS as St,buildFilterCss as xt,centeredMaxRect as bt,clampRect as Et,evenize as At,findFilterPreset as Mt,fitRects as Tt,normalizeDeg as yt,outputSize as Pt,rotatedSize as Rt}from"./chunk-USY6UDGL.js";import{AudioClip as _t,Clip as wt,MIN_CLIP as It,Overlay as Ft,VideoEditState as Nt,canRedo as Ot,canUndo as Lt,clampAudioClip as Dt,clipDuration as Ct,clipStartsAt as jt,contentDuration as zt,createHistory as Vt,defaultVideoEditState as kt,duplicateClip as Gt,locateOutput as qt,pushHistory as Ht,redo as Ut,remapSrcIndices as Bt,removeClip as Kt,reorderClips as Wt,replacePresent as Zt,splitAtOutput as Xt,totalDuration as Yt,trimClipEdge as Jt,undo as Qt,usedVideoSrcIndices as te}from"./chunk-MGKYVYOH.js";import{DEFAULT_PLATFORM_TARGETS as ee,EDITOR_MESSAGES as se,IMAGE_PLATFORM_PRESETS as ae,IMAGE_RATIO_PRESETS as ne,VIDEO_PLATFORM_RATIO_PRESETS as re,VIDEO_RATIO_PRESETS as ie,VIDEO_SIZE_PRESETS as oe,buildImagePlatformPresets as ue,buildVideoPlatformRatioPresets as ce,buildVideoSizePresets as le,compensateAnnotationRotation as pe,parseRatio as he,tEditor as fe,toHant as de}from"./chunk-XCBM7P7N.js";function $e(t){const e=X(t);if(e===0)return[];if(e===90)return["transpose=1"];if(e===180)return["transpose=1","transpose=1"];if(e===270)return["transpose=2"];const s=`${e}*PI/180`;return[`rotate=${s}:ow=rotw(${s}):oh=roth(${s}):c=black`]}function v(t){return Math.max(-1,Math.min(1,Number(t)||0))}function F(t){return Math.max(0,Math.min(1,Number(t)||0))}function J(t,e,s,a){const n=Math.round(Number(t));return Number.isFinite(n)?Math.min(s,Math.max(e,n)):a}function Q(t){return Math.min(Math.max(Number(t)||1,.5),2)}function me(t){const e=[];let s=Q(t);for(;s<.5-1e-6||s>2+1e-6;)s<.5?(e.push("atempo=0.5"),s/=.5):(e.push("atempo=2"),s/=2);return Math.abs(s-1)>1e-4&&e.push(`atempo=${s.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}`),e}function _(t,e){const s=J(t,2,8192,e);return s%2===0?s:s-1}function w(t){return t?.exportSettings??null}function ve(t){const e=String(w(t)?.format??"mp4").toLowerCase();return e==="mov"||e==="mxf"?e:"mp4"}function tt(t){return J(w(t)?.frameRate,12,120,30)}function ge(t){const e=Y(t.canvas,t),s=w(t);if(!s)return e;const a=Number.isFinite(Number(s.width))&&Number(s.width)>0,n=Number.isFinite(Number(s.height))&&Number(s.height)>0;if(!a&&!n)return e;const r=e.w>0&&e.h>0?e.w/e.h:1;if(a&&n)return{w:_(s.width,e.w),h:_(s.height,e.h)};if(a){const o=_(s.width,e.w);return{w:o,h:_(o/r,e.h)}}const u=_(s.height,e.h);return{w:_(u*r,e.w),h:u}}function Se(t){const e=Number(w(t)?.videoBitrateKbps);return Number.isFinite(e)&&e>=100?Math.round(e):0}function xe(t){const e=Number(w(t)?.audioBitrateKbps);return Number.isFinite(e)&&e>=32?Math.round(e):0}function be(t){return w(t)?.audioCodec==="mp3"?"libmp3lame":"aac"}function k(t){return Y(t.canvas,t)}function G(t){const e=k(t),s=ge(t);return s.w===e.w&&s.h===e.h?[]:[`scale=${s.w}:${s.h}`]}function et(t){const e=v(t?.brightness),s=v(t?.contrast),a=v(t?.saturation),n=v(t?.gamma);if(e===0&&s===0&&a===0&&n===0)return null;const r=[];if(e!==0||s!==0){const o=A(Math.max(0,1+e)),i=A(Math.max(0,1+s)),l=`clip(((val*${o})-128)*${i}+128,0,255)`;r.push(`lutrgb=r='${l}':g='${l}':b='${l}'`)}const u=[];return a!==0&&u.push(`saturation=${1+a}`),n!==0&&u.push(`gamma=${(1+n*(n>0?1:.5)).toFixed(3)}`),u.length&&r.push(`eq=${u.join(":")}`),r.join(",")}function A(t){return`${Math.round(t*1e3)/1e3}`}function st(t){const e=v(t?.temperature),s=v(t?.tint);if(e===0&&s===0)return null;const a=v(e*.18+s*.08),n=v(e*.02-s*.12),r=v(-e*.18+s*.08);return`colorbalance=rs=${A(a)}:gs=${A(n)}:bs=${A(r)}`}function at(t){const e=v(t?.vibrance);return e===0?null:`vibrance=intensity=${A(e)}`}function I(t,e,s){if(t===e)return s<t?0:1;const a=Math.max(0,Math.min(1,(s-t)/(e-t)));return a*a*(3-2*a)}function Ee(t){const e=I(.08,.4,t),s=1-I(.6,.92,t);return Math.max(0,Math.min(1,e*s*2.2))}function Ae(t,e){const s=1-I(.18,.62,t),a=1-I(.04,.32,t),n=I(.38,.84,t),r=I(.7,.98,t),u=Ee(t),o=e.shadows*s*.28+e.highlights*n*.24+e.blacks*a*.2+e.whites*r*.2+e.lightSense*u*.18+e.fade*(.12+s*.06);return Math.max(0,Math.min(1,t+o))}function nt(t){const e={highlights:v(t?.highlights),shadows:v(t?.shadows),whites:v(t?.whites),blacks:v(t?.blacks),lightSense:v(t?.lightSense),fade:F(t?.fade)};return Object.values(e).some(s=>Math.abs(s)>1e-4)?`curves=master='${[0,.18,.36,.5,.68,.84,1].map(s=>`${A(s)}/${A(Ae(s,e))}`).join(" ")}'`:null}function rt(t){const e=[],s=F(t?.clarity),a=F(t?.sharpen);return s>1e-4&&e.push(`unsharp=lx=7:ly=7:la=${A(s*1.8)}:cx=7:cy=7:ca=0`),a>1e-4&&e.push(`unsharp=lx=3:ly=3:la=${A(.35+a*2.1)}:cx=3:cy=3:ca=${A(a*.55)}`),e}function it(t){const e=F(t?.grain);return e<=1e-4?null:`noise=alls=${Math.round(6+e*26)}:allf=t`}function ot(t){const e=F(t?.vignette);if(e<=1e-4)return null;const s=Math.max(.12,.42-e*.22);return`vignette=angle=${A(s)}*PI`}function q(t,e={}){const s=[];if(t.flipX&&s.push("hflip"),t.flipY&&s.push("vflip"),s.push(...$e(t.rotation)),t.crop){const{x:p,y:f,width:$,height:b}=t.crop;s.push(`crop=${$}:${b}:${p}:${f}`)}if(t.scale){const{width:p,height:f,fit:$}=t.scale;$==="force"?s.push(`scale=${p}:${f}`):$==="cover"?s.push(`scale=${p}:${f}:force_original_aspect_ratio=increase`,`crop=${p}:${f}`):s.push(`scale=${p}:${f}:force_original_aspect_ratio=decrease`,`pad=${p}:${f}:(ow-iw)/2:(oh-ih)/2`)}const a=et(t.filters);a&&s.push(a);const n=st(t.filters);n&&s.push(n);const r=at(t.filters);r&&s.push(r);const u=nt(t.filters);u&&s.push(u),s.push(...rt(t.filters));const o=it(t.filters);o&&s.push(o);const i=ot(t.filters);i&&s.push(i);const l=Z(t.filterPreset);return l&&s.push(l.vf),e.includeExportScale!==!1&&s.push(...G(t)),s.push(`fps=${tt(t)}`),X(t.rotation)%90!==0&&!t.scale&&s.push("scale=trunc(iw/2)*2:trunc(ih/2)*2"),s}var ut={fade:"fade",slide:"slideleft",wipe:"wipeleft",flip:"horzopen",clockWipe:"radial",star:"pixelize",circle:"circleopen",rectangle:"rectcrop"},Me={fade:"qsin",slide:"tri",wipe:"tri",flip:"exp",clockWipe:"qsin",star:"tri",circle:"qsin",rectangle:"qsin"};function N(t){return t.out-t.in}function ct(t,e,s){const a=t&&typeof t.type=="string"?t.type:"none",n=ut[a]?a:"none",r=Math.max(0,Math.min(1.2,e-.05,s-.05));if(n==="none"||r<=.05)return{type:"none",duration:0,effect:"fade",curve:"tri"};const u=Number(t?.duration),o=Math.min(Math.max(Number.isFinite(u)?u:.4,.1),r);return{type:n,duration:o,effect:ut[n],curve:Me[n]??"tri"}}function Te(t,e){if(!Array.isArray(e)||e.length<2)return!1;for(let s=0;s<e.length-1;s++){const a=ct(t?.[s],N(e[s]),N(e[s+1]));if(a.type!=="none"&&a.duration>0)return!0}return!1}function ye(t,e){const s=[];let a=0;for(let n=0;n<t.length-1;n++){const r=ct(e?.[n],N(t[n]),N(t[n+1]));r.type!=="none"&&r.duration>0&&(s.push({start:a,end:n,transition:r}),a=n+1)}return s.push({start:a,end:t.length-1,transition:null}),s}function Pe(t,e,s){let a=0;for(let n=e;n<=s;n++)a+=N(t[n]);return a}function Re(t,e,s,a){const n=ye(e,s).map((i,l)=>{const p=Pe(e,i.start,i.end);if(i.start===i.end)return{vLabel:`[v${i.start}]`,aLabel:a?`[a${i.start}]`:"",duration:p,transition:i.transition};const f=[];for(let g=i.start;g<=i.end;g++)f.push(a?`[v${g}][a${g}]`:`[v${g}]`);const $=`[sgv${l}]`,b=a?`[sga${l}]`:"";return t.push(`${f.join("")}concat=n=${i.end-i.start+1}:v=1:a=${a?1:0}${a?`${$}${b}`:$}`),{vLabel:$,aLabel:b,duration:p,transition:i.transition}});let r=n[0].vLabel,u=a?n[0].aLabel:"",o=n[0].duration;for(let i=1;i<n.length;i++){const l=n[i-1].transition,p=n[i],f=`[vx${i}]`,$=Math.max(0,o-l.duration);if(t.push(`${r}${p.vLabel}xfade=transition=${l.effect}:duration=${l.duration}:offset=${$}${f}`),r=f,a){const b=`[ax${i}]`;t.push(`${u}${p.aLabel}acrossfade=d=${l.duration}:c1=${l.curve}:c2=${l.curve}${b}`),u=b}o=o+p.duration-l.duration}return{vLabel:r,aLabel:u,duration:o}}function H(t,e){const s=ve(e),a=s==="mxf"?["-c:v","mpeg2video","-pix_fmt","yuv422p"]:["-c:v","libx264","-preset","veryfast","-pix_fmt","yuv420p","-movflags","+faststart"],n=Se(e);if(n>0?a.push("-b:v",`${n}k`,"-maxrate",`${n}k`,"-bufsize",`${Math.max(n*2,512)}k`):s==="mxf"&&a.push("-q:v","2"),t)if(s==="mxf")a.push("-c:a","pcm_s16le");else{a.push("-c:a",be(e));const r=xe(e);r>0&&a.push("-b:a",`${r}k`)}return s==="mxf"&&a.push("-f","mxf"),a}var D="aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo",lt="anullsrc=r=44100:cl=stereo";function pt(t){return t>.02?`,afade=t=in:st=0:d=0.01,afade=t=out:st=${Math.round((t-.01)*1e3)/1e3}:d=0.01`:""}var _e="alimiter=limit=0.95:level=disabled:latency=1",we=3,Ie=.5;function ht(t,e=0){const s=Math.max(e,Math.floor(Number(t)||0));return s%2===0?s:s-1}function Fe(t){const e=Number.isFinite(t?.startAt)?Math.max(0,Number(t.startAt)):0,s=Number(t?.endAt);return Number.isFinite(s)?{startAt:e,endAt:Math.max(e+Ie,s)}:{startAt:e,endAt:e+we}}function Ne(t,e){const s=Math.max(2,ht(e.w,2)),a=Math.max(2,ht(e.h,2));return!(s>1)||!(a>1)?null:{x:0,y:0,w:s,h:a}}function Oe(t){if(t?.type==="filter"){const i=Z(t.filterPreset);return i?[i.vf]:[]}if(t?.type!=="adjust")return[];const e=[],s=et(t);s&&e.push(s);const a=st(t);a&&e.push(a);const n=at(t);n&&e.push(n);const r=nt(t);r&&e.push(r),e.push(...rt(t));const u=it(t);u&&e.push(u);const o=ot(t);return o&&e.push(o),e}function ft(t,e){const s=[];for(const a of t??[]){if(a?.type!=="filter"&&a?.type!=="adjust")continue;const n=Ne(a,e);if(!n)continue;const r=Oe(a);r.length&&s.push({rect:n,filters:r,...Fe(a)})}return s}function dt(t,e=1/0){const s=[];for(const a of t??[]){if(a?.type!=="pen"&&a?.type!=="line"&&a?.type!=="arrow"&&a?.type!=="rect"&&a?.type!=="ellipse"&&a?.type!=="text"&&a?.type!=="sticker")continue;const n=Number(a.startAt),r=Number(a.endAt);if(!(!Number.isFinite(n)||!Number.isFinite(r)||r<=n)&&(s.push({startAt:Math.max(0,n),endAt:Math.max(n+.01,r)}),s.length>=e))break}return s}function $t(t,e,s,a){let n=e;return a.forEach((r,u)=>{const o=`[vtxt${s+u}]`;t.push(`${n}[${s+u}:v]overlay=0:0:enable='between(t,${r.startAt.toFixed(3)},${r.endAt.toFixed(3)})'${o}`),n=o}),n}function mt(t,e,s){let a=e;return s.forEach((n,r)=>{const u=`[vfxsrc${r}]`,o=`[vfxbase${r}]`,i=`[vfxcrop${r}]`,l=`[vfx${r}]`,{rect:p}=n;t.push(`${a}split=2${u}${o}`),t.push(`${u}crop=${p.w}:${p.h}:${p.x}:${p.y},${n.filters.join(",")}${i}`),t.push(`${o}${i}overlay=${p.x}:${p.y}:enable='between(t,${n.startAt.toFixed(3)},${n.endAt.toFixed(3)})'${l}`),a=l}),a}function Le(t,e,s,a,n,r=[]){const u=q(t,{includeExportScale:!1}),o=t.clips,i=t.keepAudio&&n,l=o.length>=2,p=ft(t.overlays,k(t)),f=dt(t.overlays,r.length),$=r.slice(0,f.length);if(l||a||$.length||p.length){const E=[];let h;if(l){o.forEach((x,P)=>{E.push(`[0:v]trim=start=${x.in}:end=${x.out},setpts=PTS-STARTPTS[v${P}]`),i&&E.push(`[0:a]atrim=start=${x.in}:end=${x.out},asetpts=PTS-STARTPTS${pt(x.out-x.in)}[a${P}]`)});const d=o.map((x,P)=>i?`[v${P}][a${P}]`:`[v${P}]`).join(""),S=i?"[vcat][acat]":"[vcat]";E.push(`${d}concat=n=${o.length}:v=1:a=${i?1:0}${S}`),h="[vcat]"}else h="[0:v]";if(u.length&&(E.push(`${h}${u.join(",")}[vflt]`),h="[vflt]"),p.length&&(h=mt(E,h,p)),a?(E.push(`${h}[1:v]overlay=0:0[vout]`),h="[vout]"):h==="[0:v]"&&(E.push("[0:v]null[vout]"),h="[vout]"),$.length){const d=1+(a?1:0);h=$t(E,h,d,f)}const M=G(t);M.length&&(E.push(`${h}${M.join(",")}[vscaled]`),h="[vscaled]");const O=[];!l&&o.length===1&&O.push("-ss",String(o[0].in),"-t",String(o[0].out-o[0].in));const y=["-y",...O,"-i",e];a&&y.push("-i",a);for(const d of $)y.push("-i",d);return y.push("-filter_complex",E.join(";"),"-map",h),i&&y.push("-map",l?"[acat]":"0:a?"),y.push(...H(i,t)),y.push(s),y}const b=q(t),g=["-y","-ss",String(o[0].in),"-t",String(o[0].out-o[0].in),"-i",e];return b.length&&g.push("-vf",b.join(",")),i||g.push("-an"),g.push(...H(i,t)),g.push(s),g}function De(t,e,s){const{videoPaths:a,videoHasAudio:n,audioPaths:r,overlayPath:u,textOverlayPaths:o=[]}=e,i=t.audioClips??[],l=Te(t.transitions,t.clips),p=dt(t.overlays,o.length),f=o.slice(0,p.length);if(a.length===1&&i.length===0&&!l)return Le(t,a[0],s,u,n[0]??!1,f);const $=a.length,b=r.length,g=t.canvas.w,E=t.canvas.h,h=t.clips,M=t.keepAudio&&h.some(c=>n[c.srcIdx]),O=tt(t),y=h.reduce((c,m)=>c+(m.out-m.in),0),d=[];h.forEach((c,m)=>{d.push(`[${c.srcIdx}:v]trim=start=${c.in}:end=${c.out},setpts=PTS-STARTPTS,scale=${g}:${E}:force_original_aspect_ratio=increase,crop=${g}:${E},setsar=1,fps=${O},format=yuv420p[v${m}]`),M&&(n[c.srcIdx]?d.push(`[${c.srcIdx}:a]atrim=start=${c.in}:end=${c.out},asetpts=PTS-STARTPTS${pt(c.out-c.in)},${D}[a${m}]`):d.push(`${lt},atrim=start=0:end=${c.out-c.in},asetpts=PTS-STARTPTS,${D}[a${m}]`))});let S="[vcat]",x=M?"[acat]":"",P=y;if(l){const c=Re(d,h,t.transitions??[],M);S=c.vLabel,x=M?c.aLabel:"",P=c.duration}else{const c=h.map((m,R)=>M?`[v${R}][a${R}]`:`[v${R}]`).join("");d.push(`${c}concat=n=${h.length}:v=1:a=${M?1:0}${M?"[vcat][acat]":"[vcat]"}`)}if(!M&&i.length&&(d.push(`${lt},atrim=start=0:end=${P},asetpts=PTS-STARTPTS,${D}[acat]`),x="[acat]"),i.length){i.forEach((m,R)=>{const W=Math.max(0,Math.round(m.startAt*1e3)),j=Math.max(0,m.out-m.in),vt=Q(m.speed),z=Math.min(Math.max(Number(m.fadeIn)||0,0),j),V=Math.min(Math.max(Number(m.fadeOut)||0,0),Math.max(0,j-z)),L=[`atrim=start=${m.in}:end=${m.out}`,"asetpts=PTS-STARTPTS",...me(vt),`volume=${m.volume}`];z>1e-4&&L.push(`afade=t=in:st=0:d=${z}`),V>1e-4&&L.push(`afade=t=out:st=${Math.max(0,j-V)}:d=${V}`),L.push(D,`adelay=${W}|${W}`),d.push(`[${$+R}:a]${L.join(",")}[mu${R}]`)});const c=`${x}${i.map((m,R)=>`[mu${R}]`).join("")}`;d.push(`${c}amix=inputs=${1+i.length}:duration=first:dropout_transition=0:normalize=0,${_e}[aout]`),x="[aout]"}const U=q(t,{includeExportScale:!1}),B=ft(t.overlays,k(t));if(U.length&&(d.push(`${S}${U.join(",")}[vflt]`),S="[vflt]"),B.length&&(S=mt(d,S,B)),u&&(d.push(`${S}[${$+b}:v]overlay=0:0[vout]`),S="[vout]"),f.length){const c=$+b+(u?1:0);S=$t(d,S,c,p)}const K=G(t);K.length&&(d.push(`${S}${K.join(",")}[vscaled]`),S="[vscaled]");const T=["-y"];for(const c of a)T.push("-i",c);for(const c of r)T.push("-i",c);u&&T.push("-i",u);for(const c of f)T.push("-i",c);T.push("-filter_complex",d.join(";"),"-map",S);const C=!!x;return C&&T.push("-map",x),T.push(...H(C,t)),C&&T.push("-ar","44100","-ac","2"),T.push(s),T}function Ce(t,e,s){return["-y","-ss",String(e),"-i",t,"-frames:v","1","-q:v","2",s]}export{_t as AudioClip,wt as Clip,ee as DEFAULT_PLATFORM_TARGETS,gt as DEG2RAD,se as EDITOR_MESSAGES,St as FILTER_PRESETS,ae as IMAGE_PLATFORM_PRESETS,ne as IMAGE_RATIO_PRESETS,It as MIN_CLIP,Ft as Overlay,re as VIDEO_PLATFORM_RATIO_PRESETS,ie as VIDEO_RATIO_PRESETS,oe as VIDEO_SIZE_PRESETS,Nt as VideoEditState,De as buildFfmpegArgs,xt as buildFilterCss,ue as buildImagePlatformPresets,Ce as buildPosterArgs,ce as buildVideoPlatformRatioPresets,le as buildVideoSizePresets,Ot as canRedo,Lt as canUndo,bt as centeredMaxRect,Dt as clampAudioClip,Et as clampRect,Ct as clipDuration,jt as clipStartsAt,pe as compensateAnnotationRotation,zt as contentDuration,Vt as createHistory,kt as defaultVideoEditState,Gt as duplicateClip,At as evenize,Mt as findFilterPreset,Tt as fitRects,qt as locateOutput,yt as normalizeDeg,Pt as outputSize,he as parseRatio,Ht as pushHistory,Ut as redo,Bt as remapSrcIndices,Kt as removeClip,Wt as reorderClips,Zt as replacePresent,Rt as rotatedSize,Xt as splitAtOutput,fe as tEditor,de as toHant,Yt as totalDuration,Jt as trimClipEdge,Qt as undo,te as usedVideoSrcIndices};
package/core/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@media-editor/core",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "媒体编辑器框架无关内核:状态/时间轴/ffmpeg 参数/几何/标注渲染/VideoEditorEngine/图片编辑器纯配置工厂(零 React)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1 +1 @@
1
- "use strict";var i=exports&&exports.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),o=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),c=exports&&exports.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return o(t,e),t},l=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&i(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.z=void 0;const a=c(require("./v3/external.cjs"));exports.z=a,l(require("./v3/external.cjs"),exports),exports.default=a;
1
+ "use strict";var n=exports&&exports.__createBinding||(Object.create?(function(e,t,r,o){o===void 0&&(o=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,u)}):(function(e,t,r,o){o===void 0&&(o=r),e[o]=t[r]})),a=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),c=exports&&exports.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return a(t,e),t},l=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.z=void 0;const i=c(require("./v3/external.cjs"));exports.z=i,l(require("./v3/external.cjs"),exports),exports.default=i;
@@ -1 +1 @@
1
- "use strict";var u=exports&&exports.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultErrorMap=void 0,exports.setErrorMap=o,exports.getErrorMap=a;const t=u(require("./locales/en.cjs"));exports.defaultErrorMap=t.default;let r=t.default;function o(e){r=e}function a(){return r}
1
+ "use strict";var u=exports&&exports.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultErrorMap=void 0,exports.setErrorMap=o,exports.getErrorMap=a;const t=u(require("./locales/en.cjs"));exports.defaultErrorMap=t.default;let e=t.default;function o(r){e=r}function a(){return e}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.errorUtil=void 0;var r;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(r||(exports.errorUtil=r={}));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.errorUtil=void 0;var t;(function(e){e.errToObj=r=>typeof r=="string"?{message:r}:r||{},e.toString=r=>typeof r=="string"?r:r?.message})(t||(exports.errorUtil=t={}));
@@ -1 +1 @@
1
- var e;(function(o){o.errToObj=t=>typeof t=="string"?{message:t}:t||{},o.toString=t=>typeof t=="string"?t:t?.message})(e||(e={}));export{e as errorUtil};
1
+ var r;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(r||(r={}));export{r as errorUtil};
@@ -1 +1 @@
1
- import{getErrorMap as f}from"../errors.js";import l from"../locales/en.js";const v=t=>{const{data:s,path:r,errorMaps:e,issueData:a}=t,o=[...r,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="";const y=e.filter(c=>!!c).slice().reverse();for(const c of y)i=c(u,{data:s,defaultError:i}).message;return{...a,path:o,message:i}},m=[];function p(t,s){const r=f(),e=v({issueData:s,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===l?void 0:l].filter(a=>!!a)});t.common.issues.push(e)}class d{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(s,r){const e=[];for(const a of r){if(a.status==="aborted")return n;a.status==="dirty"&&s.dirty(),e.push(a.value)}return{status:s.value,value:e}}static async mergeObjectAsync(s,r){const e=[];for(const a of r){const o=await a.key,u=await a.value;e.push({key:o,value:u})}return d.mergeObjectSync(s,e)}static mergeObjectSync(s,r){const e={};for(const a of r){const{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return n;o.status==="dirty"&&s.dirty(),u.status==="dirty"&&s.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(e[o.value]=u.value)}return{status:s.value,value:e}}}const n=Object.freeze({status:"aborted"}),h=t=>({status:"dirty",value:t}),b=t=>({status:"valid",value:t}),g=t=>t.status==="aborted",A=t=>t.status==="dirty",M=t=>t.status==="valid",E=t=>typeof Promise<"u"&&t instanceof Promise;export{h as DIRTY,m as EMPTY_PATH,n as INVALID,b as OK,d as ParseStatus,p as addIssueToContext,g as isAborted,E as isAsync,A as isDirty,M as isValid,v as makeIssue};
1
+ import{getErrorMap as f}from"../errors.js";import d from"../locales/en.js";const v=t=>{const{data:s,path:r,errorMaps:e,issueData:a}=t,o=[...r,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="";const y=e.filter(c=>!!c).slice().reverse();for(const c of y)i=c(u,{data:s,defaultError:i}).message;return{...a,path:o,message:i}},m=[];function p(t,s){const r=f(),e=v({issueData:s,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===d?void 0:d].filter(a=>!!a)});t.common.issues.push(e)}class l{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(s,r){const e=[];for(const a of r){if(a.status==="aborted")return n;a.status==="dirty"&&s.dirty(),e.push(a.value)}return{status:s.value,value:e}}static async mergeObjectAsync(s,r){const e=[];for(const a of r){const o=await a.key,u=await a.value;e.push({key:o,value:u})}return l.mergeObjectSync(s,e)}static mergeObjectSync(s,r){const e={};for(const a of r){const{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return n;o.status==="dirty"&&s.dirty(),u.status==="dirty"&&s.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(e[o.value]=u.value)}return{status:s.value,value:e}}}const n=Object.freeze({status:"aborted"}),h=t=>({status:"dirty",value:t}),b=t=>({status:"valid",value:t}),g=t=>t.status==="aborted",A=t=>t.status==="dirty",M=t=>t.status==="valid",E=t=>typeof Promise<"u"&&t instanceof Promise;export{h as DIRTY,m as EMPTY_PATH,n as INVALID,b as OK,l as ParseStatus,p as addIssueToContext,g as isAborted,E as isAsync,A as isDirty,M as isValid,v as makeIssue};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getParsedType=exports.ZodParsedType=exports.objectUtil=exports.util=void 0;var u;(function(t){t.assertEqual=e=>{};function s(e){}t.assertIs=s;function a(e){throw new Error}t.assertNever=a,t.arrayToEnum=e=>{const r={};for(const o of e)r[o]=o;return r},t.getValidEnumValues=e=>{const r=t.objectKeys(e).filter(n=>typeof e[e[n]]!="number"),o={};for(const n of r)o[n]=e[n];return t.objectValues(o)},t.objectValues=e=>t.objectKeys(e).map(function(r){return e[r]}),t.objectKeys=typeof Object.keys=="function"?e=>Object.keys(e):e=>{const r=[];for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.push(o);return r},t.find=(e,r)=>{for(const o of e)if(r(o))return o},t.isInteger=typeof Number.isInteger=="function"?e=>Number.isInteger(e):e=>typeof e=="number"&&Number.isFinite(e)&&Math.floor(e)===e;function c(e,r=" | "){return e.map(o=>typeof o=="string"?`'${o}'`:o).join(r)}t.joinValues=c,t.jsonStringifyReplacer=(e,r)=>typeof r=="bigint"?r.toString():r})(u||(exports.util=u={}));var i;(function(t){t.mergeShapes=(s,a)=>({...s,...a})})(i||(exports.objectUtil=i={})),exports.ZodParsedType=u.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const d=t=>{switch(typeof t){case"undefined":return exports.ZodParsedType.undefined;case"string":return exports.ZodParsedType.string;case"number":return Number.isNaN(t)?exports.ZodParsedType.nan:exports.ZodParsedType.number;case"boolean":return exports.ZodParsedType.boolean;case"function":return exports.ZodParsedType.function;case"bigint":return exports.ZodParsedType.bigint;case"symbol":return exports.ZodParsedType.symbol;case"object":return Array.isArray(t)?exports.ZodParsedType.array:t===null?exports.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?exports.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?exports.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?exports.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?exports.ZodParsedType.date:exports.ZodParsedType.object;default:return exports.ZodParsedType.unknown}};exports.getParsedType=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getParsedType=exports.ZodParsedType=exports.objectUtil=exports.util=void 0;var u;(function(n){n.assertEqual=e=>{};function s(e){}n.assertIs=s;function a(e){throw new Error}n.assertNever=a,n.arrayToEnum=e=>{const r={};for(const o of e)r[o]=o;return r},n.getValidEnumValues=e=>{const r=n.objectKeys(e).filter(t=>typeof e[e[t]]!="number"),o={};for(const t of r)o[t]=e[t];return n.objectValues(o)},n.objectValues=e=>n.objectKeys(e).map(function(r){return e[r]}),n.objectKeys=typeof Object.keys=="function"?e=>Object.keys(e):e=>{const r=[];for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.push(o);return r},n.find=(e,r)=>{for(const o of e)if(r(o))return o},n.isInteger=typeof Number.isInteger=="function"?e=>Number.isInteger(e):e=>typeof e=="number"&&Number.isFinite(e)&&Math.floor(e)===e;function c(e,r=" | "){return e.map(o=>typeof o=="string"?`'${o}'`:o).join(r)}n.joinValues=c,n.jsonStringifyReplacer=(e,r)=>typeof r=="bigint"?r.toString():r})(u||(exports.util=u={}));var i;(function(n){n.mergeShapes=(s,a)=>({...s,...a})})(i||(exports.objectUtil=i={})),exports.ZodParsedType=u.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const d=n=>{switch(typeof n){case"undefined":return exports.ZodParsedType.undefined;case"string":return exports.ZodParsedType.string;case"number":return Number.isNaN(n)?exports.ZodParsedType.nan:exports.ZodParsedType.number;case"boolean":return exports.ZodParsedType.boolean;case"function":return exports.ZodParsedType.function;case"bigint":return exports.ZodParsedType.bigint;case"symbol":return exports.ZodParsedType.symbol;case"object":return Array.isArray(n)?exports.ZodParsedType.array:n===null?exports.ZodParsedType.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?exports.ZodParsedType.promise:typeof Map<"u"&&n instanceof Map?exports.ZodParsedType.map:typeof Set<"u"&&n instanceof Set?exports.ZodParsedType.set:typeof Date<"u"&&n instanceof Date?exports.ZodParsedType.date:exports.ZodParsedType.object;default:return exports.ZodParsedType.unknown}};exports.getParsedType=d;
@@ -1 +1 @@
1
- var s;(function(t){t.assertEqual=e=>{};function u(e){}t.assertIs=u;function i(e){throw new Error}t.assertNever=i,t.arrayToEnum=e=>{const r={};for(const o of e)r[o]=o;return r},t.getValidEnumValues=e=>{const r=t.objectKeys(e).filter(a=>typeof e[e[a]]!="number"),o={};for(const a of r)o[a]=e[a];return t.objectValues(o)},t.objectValues=e=>t.objectKeys(e).map(function(r){return e[r]}),t.objectKeys=typeof Object.keys=="function"?e=>Object.keys(e):e=>{const r=[];for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.push(o);return r},t.find=(e,r)=>{for(const o of e)if(r(o))return o},t.isInteger=typeof Number.isInteger=="function"?e=>Number.isInteger(e):e=>typeof e=="number"&&Number.isFinite(e)&&Math.floor(e)===e;function f(e,r=" | "){return e.map(o=>typeof o=="string"?`'${o}'`:o).join(r)}t.joinValues=f,t.jsonStringifyReplacer=(e,r)=>typeof r=="bigint"?r.toString():r})(s||(s={}));var c;(function(t){t.mergeShapes=(u,i)=>({...u,...i})})(c||(c={}));const n=s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),y=t=>{switch(typeof t){case"undefined":return n.undefined;case"string":return n.string;case"number":return Number.isNaN(t)?n.nan:n.number;case"boolean":return n.boolean;case"function":return n.function;case"bigint":return n.bigint;case"symbol":return n.symbol;case"object":return Array.isArray(t)?n.array:t===null?n.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?n.promise:typeof Map<"u"&&t instanceof Map?n.map:typeof Set<"u"&&t instanceof Set?n.set:typeof Date<"u"&&t instanceof Date?n.date:n.object;default:return n.unknown}};export{n as ZodParsedType,y as getParsedType,c as objectUtil,s as util};
1
+ var s;(function(n){n.assertEqual=e=>{};function u(e){}n.assertIs=u;function i(e){throw new Error}n.assertNever=i,n.arrayToEnum=e=>{const r={};for(const o of e)r[o]=o;return r},n.getValidEnumValues=e=>{const r=n.objectKeys(e).filter(a=>typeof e[e[a]]!="number"),o={};for(const a of r)o[a]=e[a];return n.objectValues(o)},n.objectValues=e=>n.objectKeys(e).map(function(r){return e[r]}),n.objectKeys=typeof Object.keys=="function"?e=>Object.keys(e):e=>{const r=[];for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.push(o);return r},n.find=(e,r)=>{for(const o of e)if(r(o))return o},n.isInteger=typeof Number.isInteger=="function"?e=>Number.isInteger(e):e=>typeof e=="number"&&Number.isFinite(e)&&Math.floor(e)===e;function f(e,r=" | "){return e.map(o=>typeof o=="string"?`'${o}'`:o).join(r)}n.joinValues=f,n.jsonStringifyReplacer=(e,r)=>typeof r=="bigint"?r.toString():r})(s||(s={}));var c;(function(n){n.mergeShapes=(u,i)=>({...u,...i})})(c||(c={}));const t=s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),y=n=>{switch(typeof n){case"undefined":return t.undefined;case"string":return t.string;case"number":return Number.isNaN(n)?t.nan:t.number;case"boolean":return t.boolean;case"function":return t.function;case"bigint":return t.bigint;case"symbol":return t.symbol;case"object":return Array.isArray(n)?t.array:n===null?t.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?t.promise:typeof Map<"u"&&n instanceof Map?t.map:typeof Set<"u"&&n instanceof Set?t.set:typeof Date<"u"&&n instanceof Date?t.date:t.object;default:return t.unknown}};export{t as ZodParsedType,y as getParsedType,c as objectUtil,s as util};
@@ -1 +1 @@
1
- "use strict";var i=exports&&exports.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,u)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),o=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),c=exports&&exports.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&i(t,e,r);return o(t,e),t},l=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&i(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.z=void 0;const a=c(require("./external.cjs"));exports.z=a,l(require("./external.cjs"),exports),exports.default=a;
1
+ "use strict";var n=exports&&exports.__createBinding||(Object.create?(function(e,t,r,o){o===void 0&&(o=r);var u=Object.getOwnPropertyDescriptor(t,r);(!u||("get"in u?!t.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,u)}):(function(e,t,r,o){o===void 0&&(o=r),e[o]=t[r]})),a=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),c=exports&&exports.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return a(t,e),t},l=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.z=void 0;const i=c(require("./external.cjs"));exports.z=i,l(require("./external.cjs"),exports),exports.default=i;
@@ -1 +1 @@
1
- import{ZodIssueCode as e}from"../ZodError.js";import{util as i,ZodParsedType as r}from"../helpers/util.js";const s=(a,n)=>{let t;switch(a.code){case e.invalid_type:a.received===r.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case e.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,i.jsonStringifyReplacer)}`;break;case e.unrecognized_keys:t=`Unrecognized key(s) in object: ${i.joinValues(a.keys,", ")}`;break;case e.invalid_union:t="Invalid input";break;case e.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${i.joinValues(a.options)}`;break;case e.invalid_enum_value:t=`Invalid enum value. Expected ${i.joinValues(a.options)}, received '${a.received}'`;break;case e.invalid_arguments:t="Invalid function arguments";break;case e.invalid_return_type:t="Invalid function return type";break;case e.invalid_date:t="Invalid date";break;case e.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:i.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case e.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case e.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case e.custom:t="Invalid input";break;case e.invalid_intersection_types:t="Intersection results could not be merged";break;case e.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case e.not_finite:t="Number must be finite";break;default:t=n.defaultError,i.assertNever(a)}return{message:t}};var l=s;export{l as default};
1
+ import{ZodIssueCode as i}from"../ZodError.js";import{util as n,ZodParsedType as r}from"../helpers/util.js";const s=(e,a)=>{let t;switch(e.code){case i.invalid_type:e.received===r.undefined?t="Required":t=`Expected ${e.expected}, received ${e.received}`;break;case i.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(e.expected,n.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:t=`Unrecognized key(s) in object: ${n.joinValues(e.keys,", ")}`;break;case i.invalid_union:t="Invalid input";break;case i.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${n.joinValues(e.options)}`;break;case i.invalid_enum_value:t=`Invalid enum value. Expected ${n.joinValues(e.options)}, received '${e.received}'`;break;case i.invalid_arguments:t="Invalid function arguments";break;case i.invalid_return_type:t="Invalid function return type";break;case i.invalid_date:t="Invalid date";break;case i.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(t=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?t=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?t=`Invalid input: must end with "${e.validation.endsWith}"`:n.assertNever(e.validation):e.validation!=="regex"?t=`Invalid ${e.validation}`:t="Invalid";break;case i.too_small:e.type==="array"?t=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?t=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?t=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?t=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?t=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:t="Invalid input";break;case i.too_big:e.type==="array"?t=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?t=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?t=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?t=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?t=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:t="Invalid input";break;case i.custom:t="Invalid input";break;case i.invalid_intersection_types:t="Intersection results could not be merged";break;case i.not_multiple_of:t=`Number must be a multiple of ${e.multipleOf}`;break;case i.not_finite:t="Number must be finite";break;default:t=a.defaultError,n.assertNever(e)}return{message:t}};var l=s;export{l as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.discriminatedUnion=exports.date=exports.boolean=exports.bigint=exports.array=exports.any=exports.coerce=exports.ZodFirstPartyTypeKind=exports.late=exports.ZodSchema=exports.Schema=exports.ZodReadonly=exports.ZodPipeline=exports.ZodBranded=exports.BRAND=exports.ZodNaN=exports.ZodCatch=exports.ZodDefault=exports.ZodNullable=exports.ZodOptional=exports.ZodTransformer=exports.ZodEffects=exports.ZodPromise=exports.ZodNativeEnum=exports.ZodEnum=exports.ZodLiteral=exports.ZodLazy=exports.ZodFunction=exports.ZodSet=exports.ZodMap=exports.ZodRecord=exports.ZodTuple=exports.ZodIntersection=exports.ZodDiscriminatedUnion=exports.ZodUnion=exports.ZodObject=exports.ZodArray=exports.ZodVoid=exports.ZodNever=exports.ZodUnknown=exports.ZodAny=exports.ZodNull=exports.ZodUndefined=exports.ZodSymbol=exports.ZodDate=exports.ZodBoolean=exports.ZodBigInt=exports.ZodNumber=exports.ZodString=exports.ZodType=void 0,exports.NEVER=exports.void=exports.unknown=exports.union=exports.undefined=exports.tuple=exports.transformer=exports.symbol=exports.string=exports.strictObject=exports.set=exports.record=exports.promise=exports.preprocess=exports.pipeline=exports.ostring=exports.optional=exports.onumber=exports.oboolean=exports.object=exports.number=exports.nullable=exports.null=exports.never=exports.nativeEnum=exports.nan=exports.map=exports.literal=exports.lazy=exports.intersection=exports.instanceof=exports.function=exports.enum=exports.effect=void 0,exports.datetimeRegex=le,exports.custom=me;const o=require("./ZodError.cjs"),X=require("./errors.cjs"),h=require("./helpers/errorUtil.cjs"),n=require("./helpers/parseUtil.cjs"),u=require("./helpers/util.cjs");class x{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}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 oe=(r,e)=>{if((0,n.isValid)(e))return{success:!0,data:e.value};if(!r.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 o.ZodError(r.common.issues);return this._error=t,this._error}}};function f(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(c,d)=>{const{message:i}=r;return c.code==="invalid_enum_value"?{message:i??d.defaultError}:typeof d.data>"u"?{message:i??s??d.defaultError}:c.code!=="invalid_type"?{message:d.defaultError}:{message:i??t??d.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return(0,u.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,u.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new n.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,u.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,n.isAsync)(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)},a=this._parseSync({data:e,path:s.path,parent:s});return oe(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return(0,n.isValid)(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>(0,n.isValid)(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)},a=this._parse({data:e,path:s.path,parent:s}),c=await((0,n.isAsync)(a)?a:Promise.resolve(a));return oe(s,c)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,c)=>{const d=e(a),i=()=>c.addIssue({code:o.ZodIssueCode.custom,...s(a)});return typeof Promise<"u"&&d instanceof Promise?d.then(l=>l?!0:(i(),!1)):d?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new v({schema:this,typeName:p.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:t=>this["~validate"](t)}}optional(){return T.create(this,this._def)}nullable(){return A.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return R.create(this,this._def)}or(e){return z.create([this,e],this._def)}and(e){return $.create(this,e,this._def)}transform(e){return new v({...f(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new q({...f(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new de({typeName:p.ZodBranded,type:this,...f(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Y({...f(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return G.create(this,e)}readonly(){return J.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}exports.ZodType=y,exports.Schema=y,exports.ZodSchema=y;const ve=/^c[^\s-]{8,}$/i,Ze=/^[0-9a-z]+$/,Ie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xe=/^[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,Te=/^[a-z0-9_-]{21}$/i,Ce=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ke=/^[-+]?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)?)??$/,be=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,we="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ne;const Ae=/^(?:(?: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])$/,Ne=/^(?:(?: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])$/,Pe=/^(([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]))$/,Oe=/^(([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])$/,Se=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Le=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ue="((\\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])))",Ue=new RegExp(`^${ue}$`);function ce(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function De(r){return new RegExp(`^${ce(r)}$`)}function le(r){let e=`${ue}T${ce(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ee(r,e){return!!((e==="v4"||!e)&&Ae.test(r)||(e==="v6"||!e)&&Pe.test(r))}function Re(r,e){if(!Ce.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function je(r,e){return!!((e==="v4"||!e)&&Ne.test(r)||(e==="v6"||!e)&&Oe.test(r))}class I extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.ZodParsedType.string){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.string,received:a.parsedType}),n.INVALID}const t=new n.ParseStatus;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if(a.kind==="length"){const c=e.data.length>a.value,d=e.data.length<a.value;(c||d)&&(s=this._getOrReturnCtx(e,s),c?(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if(a.kind==="email")be.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"email",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="emoji")ne||(ne=new RegExp(we,"u")),ne.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"emoji",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="uuid")xe.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"uuid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="nanoid")Te.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"nanoid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="cuid")ve.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cuid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="cuid2")Ze.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cuid2",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="ulid")Ie.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"ulid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"url",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"regex",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):a.kind==="datetime"?le(a).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"datetime",message:a.message}),t.dirty()):a.kind==="date"?Ue.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"date",message:a.message}),t.dirty()):a.kind==="time"?De(a).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"time",message:a.message}),t.dirty()):a.kind==="duration"?ke.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"duration",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="ip"?Ee(e.data,a.version)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"ip",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="jwt"?Re(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"jwt",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="cidr"?je(e.data,a.version)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cidr",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="base64"?Se.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"base64",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="base64url"?Le.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"base64url",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):u.util.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:o.ZodIssueCode.invalid_string,...h.errorUtil.errToObj(s)})}_addCheck(e){return new I({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,h.errorUtil.errToObj(e))}trim(){return new I({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}exports.ZodString=I,I.create=r=>new I({checks:[],typeName:p.ZodString,coerce:r?.coerce??!1,...f(r)});function Ve(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,c=Number.parseInt(r.toFixed(a).replace(".","")),d=Number.parseInt(e.toFixed(a).replace(".",""));return c%d/10**a}class N extends y{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)!==u.ZodParsedType.number){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.number,received:a.parsedType}),n.INVALID}let t;const s=new n.ParseStatus;for(const a of this._def.checks)a.kind==="int"?u.util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Ve(e.data,a.value)!==0&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_finite,message:a.message}),s.dirty()):u.util.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.errorUtil.toString(t))}setLimit(e,t,s,a){return new N({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.errorUtil.toString(a)}]})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&u.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}exports.ZodNumber=N,N.create=r=>new N({checks:[],typeName:p.ZodNumber,coerce:r?.coerce||!1,...f(r)});class P extends y{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)!==u.ZodParsedType.bigint)return this._getInvalidInput(e);let t;const s=new n.ParseStatus;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):u.util.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.bigint,received:t.parsedType}),n.INVALID}gte(e,t){return this.setLimit("min",e,!0,h.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.errorUtil.toString(t))}setLimit(e,t,s,a){return new P({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.errorUtil.toString(a)}]})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}exports.ZodBigInt=P,P.create=r=>new P({checks:[],typeName:p.ZodBigInt,coerce:r?.coerce??!1,...f(r)});class V extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.boolean,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodBoolean=V,V.create=r=>new V({typeName:p.ZodBoolean,coerce:r?.coerce||!1,...f(r)});class L extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.ZodParsedType.date){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.date,received:a.parsedType}),n.INVALID}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_date}),n.INVALID}const t=new n.ParseStatus;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):u.util.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}exports.ZodDate=L,L.create=r=>new L({checks:[],coerce:r?.coerce||!1,typeName:p.ZodDate,...f(r)});class Q extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.symbol,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodSymbol=Q,Q.create=r=>new Q({typeName:p.ZodSymbol,...f(r)});class F extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.undefined,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodUndefined=F,F.create=r=>new F({typeName:p.ZodUndefined,...f(r)});class M extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.null){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.null,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodNull=M,M.create=r=>new M({typeName:p.ZodNull,...f(r)});class D extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,n.OK)(e.data)}}exports.ZodAny=D,D.create=r=>new D({typeName:p.ZodAny,...f(r)});class S extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,n.OK)(e.data)}}exports.ZodUnknown=S,S.create=r=>new S({typeName:p.ZodUnknown,...f(r)});class k extends y{_parse(e){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.never,received:t.parsedType}),n.INVALID}}exports.ZodNever=k,k.create=r=>new k({typeName:p.ZodNever,...f(r)});class ee extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.void,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodVoid=ee,ee.create=r=>new ee({typeName:p.ZodVoid,...f(r)});class Z extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.ZodParsedType.array)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.array,received:t.parsedType}),n.INVALID;if(a.exactLength!==null){const d=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(d||i)&&((0,n.addIssueToContext)(t,{code:d?o.ZodIssueCode.too_big:o.ZodIssueCode.too_small,minimum:i?a.exactLength.value:void 0,maximum:d?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((d,i)=>a.type._parseAsync(new x(t,d,t.path,i)))).then(d=>n.ParseStatus.mergeArray(s,d));const c=[...t.data].map((d,i)=>a.type._parseSync(new x(t,d,t.path,i)));return n.ParseStatus.mergeArray(s,c)}get element(){return this._def.type}min(e,t){return new Z({...this._def,minLength:{value:e,message:h.errorUtil.toString(t)}})}max(e,t){return new Z({...this._def,maxLength:{value:e,message:h.errorUtil.toString(t)}})}length(e,t){return new Z({...this._def,exactLength:{value:e,message:h.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}exports.ZodArray=Z,Z.create=(r,e)=>new Z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...f(e)});function E(r){if(r instanceof g){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=T.create(E(s))}return new g({...r._def,shape:()=>e})}else return r instanceof Z?new Z({...r._def,type:E(r.element)}):r instanceof T?T.create(E(r.unwrap())):r instanceof A?A.create(E(r.unwrap())):r instanceof C?C.create(r.items.map(e=>E(e))):r}class g extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=u.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.ZodParsedType.object){const l=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(l,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:l.parsedType}),n.INVALID}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:c}=this._getCached(),d=[];if(!(this._def.catchall instanceof k&&this._def.unknownKeys==="strip"))for(const l in s.data)c.includes(l)||d.push(l);const i=[];for(const l of c){const m=a[l],_=s.data[l];i.push({key:{status:"valid",value:l},value:m._parse(new x(s,_,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof k){const l=this._def.unknownKeys;if(l==="passthrough")for(const m of d)i.push({key:{status:"valid",value:m},value:{status:"valid",value:s.data[m]}});else if(l==="strict")d.length>0&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.unrecognized_keys,keys:d}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const m of d){const _=s.data[m];i.push({key:{status:"valid",value:m},value:l._parse(new x(s,_,s.path,m)),alwaysSet:m in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const m of i){const _=await m.key,b=await m.value;l.push({key:_,value:b,alwaysSet:m.alwaysSet})}return l}).then(l=>n.ParseStatus.mergeObjectSync(t,l)):n.ParseStatus.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return h.errorUtil.errToObj,new g({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errorUtil.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend(e){return new g({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new g({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new g({...this._def,catchall:e})}pick(e){const t={};for(const s of u.util.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new g({...this._def,shape:()=>t})}omit(e){const t={};for(const s of u.util.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new g({...this._def,shape:()=>t})}deepPartial(){return E(this)}partial(e){const t={};for(const s of u.util.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new g({...this._def,shape:()=>t})}required(e){const t={};for(const s of u.util.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof T;)a=a._def.innerType;t[s]=a}return new g({...this._def,shape:()=>t})}keyof(){return he(u.util.objectKeys(this.shape))}}exports.ZodObject=g,g.create=(r,e)=>new g({shape:()=>r,unknownKeys:"strip",catchall:k.create(),typeName:p.ZodObject,...f(e)}),g.strictCreate=(r,e)=>new g({shape:()=>r,unknownKeys:"strict",catchall:k.create(),typeName:p.ZodObject,...f(e)}),g.lazycreate=(r,e)=>new g({shape:r,unknownKeys:"strip",catchall:k.create(),typeName:p.ZodObject,...f(e)});class z extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(c){for(const i of c)if(i.result.status==="valid")return i.result;for(const i of c)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;const d=c.map(i=>new o.ZodError(i.ctx.common.issues));return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union,unionErrors:d}),n.INVALID}if(t.common.async)return Promise.all(s.map(async c=>{const d={...t,common:{...t.common,issues:[]},parent:null};return{result:await c._parseAsync({data:t.data,path:t.path,parent:d}),ctx:d}})).then(a);{let c;const d=[];for(const l of s){const m={...t,common:{...t.common,issues:[]},parent:null},_=l._parseSync({data:t.data,path:t.path,parent:m});if(_.status==="valid")return _;_.status==="dirty"&&!c&&(c={result:_,ctx:m}),m.common.issues.length&&d.push(m.common.issues)}if(c)return t.common.issues.push(...c.ctx.common.issues),c.result;const i=d.map(l=>new o.ZodError(l));return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union,unionErrors:i}),n.INVALID}}get options(){return this._def.options}}exports.ZodUnion=z,z.create=(r,e)=>new z({options:r,typeName:p.ZodUnion,...f(e)});const w=r=>r instanceof K?w(r.schema):r instanceof v?w(r.innerType()):r instanceof B?[r.value]:r instanceof O?r.options:r instanceof W?u.util.objectValues(r.enum):r instanceof q?w(r._def.innerType):r instanceof F?[void 0]:r instanceof M?[null]:r instanceof T?[void 0,...w(r.unwrap())]:r instanceof A?[null,...w(r.unwrap())]:r instanceof de||r instanceof J?w(r.unwrap()):r instanceof Y?w(r._def.innerType):[];class ae extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.object)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:t.parsedType}),n.INVALID;const s=this.discriminator,a=t.data[s],c=this.optionsMap.get(a);return c?t.common.async?c._parseAsync({data:t.data,path:t.path,parent:t}):c._parseSync({data:t.data,path:t.path,parent:t}):((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),n.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const c of t){const d=w(c.shape[e]);if(!d.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of d){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,c)}}return new ae({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...f(s)})}}exports.ZodDiscriminatedUnion=ae;function ie(r,e){const t=(0,u.getParsedType)(r),s=(0,u.getParsedType)(e);if(r===e)return{valid:!0,data:r};if(t===u.ZodParsedType.object&&s===u.ZodParsedType.object){const a=u.util.objectKeys(e),c=u.util.objectKeys(r).filter(i=>a.indexOf(i)!==-1),d={...r,...e};for(const i of c){const l=ie(r[i],e[i]);if(!l.valid)return{valid:!1};d[i]=l.data}return{valid:!0,data:d}}else if(t===u.ZodParsedType.array&&s===u.ZodParsedType.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let c=0;c<r.length;c++){const d=r[c],i=e[c],l=ie(d,i);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return t===u.ZodParsedType.date&&s===u.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class $ extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(c,d)=>{if((0,n.isAborted)(c)||(0,n.isAborted)(d))return n.INVALID;const i=ie(c.value,d.value);return i.valid?(((0,n.isDirty)(c)||(0,n.isDirty)(d))&&t.dirty(),{status:t.value,value:i.data}):((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_intersection_types}),n.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([c,d])=>a(c,d)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}exports.ZodIntersection=$,$.create=(r,e,t)=>new $({left:r,right:e,typeName:p.ZodIntersection,...f(t)});class C extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.array)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.array,received:s.parsedType}),n.INVALID;if(s.data.length<this._def.items.length)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((c,d)=>{const i=this._def.items[d]||this._def.rest;return i?i._parse(new x(s,c,s.path,d)):null}).filter(c=>!!c);return s.common.async?Promise.all(a).then(c=>n.ParseStatus.mergeArray(t,c)):n.ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new C({...this._def,rest:e})}}exports.ZodTuple=C,C.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new C({items:r,typeName:p.ZodTuple,rest:null,...f(e)})};class H extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.object)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:s.parsedType}),n.INVALID;const a=[],c=this._def.keyType,d=this._def.valueType;for(const i in s.data)a.push({key:c._parse(new x(s,i,s.path,i)),value:d._parse(new x(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?n.ParseStatus.mergeObjectAsync(t,a):n.ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new H({keyType:e,valueType:t,typeName:p.ZodRecord,...f(s)}):new H({keyType:I.create(),valueType:e,typeName:p.ZodRecord,...f(t)})}}exports.ZodRecord=H;class te extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.map)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.map,received:s.parsedType}),n.INVALID;const a=this._def.keyType,c=this._def.valueType,d=[...s.data.entries()].map(([i,l],m)=>({key:a._parse(new x(s,i,s.path,[m,"key"])),value:c._parse(new x(s,l,s.path,[m,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const l of d){const m=await l.key,_=await l.value;if(m.status==="aborted"||_.status==="aborted")return n.INVALID;(m.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(m.value,_.value)}return{status:t.value,value:i}})}else{const i=new Map;for(const l of d){const m=l.key,_=l.value;if(m.status==="aborted"||_.status==="aborted")return n.INVALID;(m.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(m.value,_.value)}return{status:t.value,value:i}}}}exports.ZodMap=te,te.create=(r,e,t)=>new te({valueType:e,keyType:r,typeName:p.ZodMap,...f(t)});class U extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.set)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.set,received:s.parsedType}),n.INVALID;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const c=this._def.valueType;function d(l){const m=new Set;for(const _ of l){if(_.status==="aborted")return n.INVALID;_.status==="dirty"&&t.dirty(),m.add(_.value)}return{status:t.value,value:m}}const i=[...s.data.values()].map((l,m)=>c._parse(new x(s,l,s.path,m)));return s.common.async?Promise.all(i).then(l=>d(l)):d(i)}min(e,t){return new U({...this._def,minSize:{value:e,message:h.errorUtil.toString(t)}})}max(e,t){return new U({...this._def,maxSize:{value:e,message:h.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}exports.ZodSet=U,U.create=(r,e)=>new U({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,...f(e)});class j extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.function)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.function,received:t.parsedType}),n.INVALID;function s(i,l){return(0,n.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,X.getErrorMap)(),X.defaultErrorMap].filter(m=>!!m),issueData:{code:o.ZodIssueCode.invalid_arguments,argumentsError:l}})}function a(i,l){return(0,n.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,X.getErrorMap)(),X.defaultErrorMap].filter(m=>!!m),issueData:{code:o.ZodIssueCode.invalid_return_type,returnTypeError:l}})}const c={errorMap:t.common.contextualErrorMap},d=t.data;if(this._def.returns instanceof R){const i=this;return(0,n.OK)(async function(...l){const m=new o.ZodError([]),_=await i._def.args.parseAsync(l,c).catch(re=>{throw m.addIssue(s(l,re)),m}),b=await Reflect.apply(d,this,_);return await i._def.returns._def.type.parseAsync(b,c).catch(re=>{throw m.addIssue(a(b,re)),m})})}else{const i=this;return(0,n.OK)(function(...l){const m=i._def.args.safeParse(l,c);if(!m.success)throw new o.ZodError([s(l,m.error)]);const _=Reflect.apply(d,this,m.data),b=i._def.returns.safeParse(_,c);if(!b.success)throw new o.ZodError([a(_,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new j({...this._def,args:C.create(e).rest(S.create())})}returns(e){return new j({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new j({args:e||C.create([]).rest(S.create()),returns:t||S.create(),typeName:p.ZodFunction,...f(s)})}}exports.ZodFunction=j;class K extends y{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})}}exports.ZodLazy=K,K.create=(r,e)=>new K({getter:r,typeName:p.ZodLazy,...f(e)});class B extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{received:t.data,code:o.ZodIssueCode.invalid_literal,expected:this._def.value}),n.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}exports.ZodLiteral=B,B.create=(r,e)=>new B({value:r,typeName:p.ZodLiteral,...f(e)});function he(r,e){return new O({values:r,typeName:p.ZodEnum,...f(e)})}class O extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,n.addIssueToContext)(t,{expected:u.util.joinValues(s),received:t.parsedType,code:o.ZodIssueCode.invalid_type}),n.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,n.addIssueToContext)(t,{received:t.data,code:o.ZodIssueCode.invalid_enum_value,options:s}),n.INVALID}return(0,n.OK)(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 O.create(e,{...this._def,...t})}exclude(e,t=this._def){return O.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}exports.ZodEnum=O,O.create=he;class W extends y{_parse(e){const t=u.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==u.ZodParsedType.string&&s.parsedType!==u.ZodParsedType.number){const a=u.util.objectValues(t);return(0,n.addIssueToContext)(s,{expected:u.util.joinValues(a),received:s.parsedType,code:o.ZodIssueCode.invalid_type}),n.INVALID}if(this._cache||(this._cache=new Set(u.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=u.util.objectValues(t);return(0,n.addIssueToContext)(s,{received:s.data,code:o.ZodIssueCode.invalid_enum_value,options:a}),n.INVALID}return(0,n.OK)(e.data)}get enum(){return this._def.values}}exports.ZodNativeEnum=W,W.create=(r,e)=>new W({values:r,typeName:p.ZodNativeEnum,...f(e)});class R extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.promise&&t.common.async===!1)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.promise,received:t.parsedType}),n.INVALID;const s=t.parsedType===u.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,n.OK)(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}exports.ZodPromise=R,R.create=(r,e)=>new R({type:r,typeName:p.ZodPromise,...f(e)});class v extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,c={addIssue:d=>{(0,n.addIssueToContext)(s,d),d.fatal?t.abort():t.dirty()},get path(){return s.path}};if(c.addIssue=c.addIssue.bind(c),a.type==="preprocess"){const d=a.transform(s.data,c);if(s.common.async)return Promise.resolve(d).then(async i=>{if(t.value==="aborted")return n.INVALID;const l=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return l.status==="aborted"?n.INVALID:l.status==="dirty"||t.value==="dirty"?(0,n.DIRTY)(l.value):l});{if(t.value==="aborted")return n.INVALID;const i=this._def.schema._parseSync({data:d,path:s.path,parent:s});return i.status==="aborted"?n.INVALID:i.status==="dirty"||t.value==="dirty"?(0,n.DIRTY)(i.value):i}}if(a.type==="refinement"){const d=i=>{const l=a.refinement(i,c);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?n.INVALID:(i.status==="dirty"&&t.dirty(),d(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?n.INVALID:(i.status==="dirty"&&t.dirty(),d(i.value).then(()=>({status:t.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){const d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0,n.isValid)(d))return n.INVALID;const i=a.transform(d.value,c);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>(0,n.isValid)(d)?Promise.resolve(a.transform(d.value,c)).then(i=>({status:t.value,value:i})):n.INVALID);u.util.assertNever(a)}}exports.ZodEffects=v,exports.ZodTransformer=v,v.create=(r,e,t)=>new v({schema:r,typeName:p.ZodEffects,effect:e,...f(t)}),v.createWithPreprocess=(r,e,t)=>new v({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,...f(t)});class T extends y{_parse(e){return this._getType(e)===u.ZodParsedType.undefined?(0,n.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}exports.ZodOptional=T,T.create=(r,e)=>new T({innerType:r,typeName:p.ZodOptional,...f(e)});class A extends y{_parse(e){return this._getType(e)===u.ZodParsedType.null?(0,n.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}exports.ZodNullable=A,A.create=(r,e)=>new A({innerType:r,typeName:p.ZodNullable,...f(e)});class q extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===u.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}exports.ZodDefault=q,q.create=(r,e)=>new q({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...f(e)});class Y extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return(0,n.isAsync)(a)?a.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new o.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new o.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}exports.ZodCatch=Y,Y.create=(r,e)=>new Y({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...f(e)});class se extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.nan){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.nan,received:t.parsedType}),n.INVALID}return{status:"valid",value:e.data}}}exports.ZodNaN=se,se.create=r=>new se({typeName:p.ZodNaN,...f(r)}),exports.BRAND=Symbol("zod_brand");class de extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}exports.ZodBranded=de;class G extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?n.INVALID:a.status==="dirty"?(t.dirty(),(0,n.DIRTY)(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?n.INVALID:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new G({in:e,out:t,typeName:p.ZodPipeline})}}exports.ZodPipeline=G;class J extends y{_parse(e){const t=this._def.innerType._parse(e),s=a=>((0,n.isValid)(a)&&(a.value=Object.freeze(a.value)),a);return(0,n.isAsync)(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}exports.ZodReadonly=J,J.create=(r,e)=>new J({innerType:r,typeName:p.ZodReadonly,...f(e)});function pe(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function me(r,e={},t){return r?D.create().superRefine((s,a)=>{const c=r(s);if(c instanceof Promise)return c.then(d=>{if(!d){const i=pe(e,s),l=i.fatal??t??!0;a.addIssue({code:"custom",...i,fatal:l})}});if(!c){const d=pe(e,s),i=d.fatal??t??!0;a.addIssue({code:"custom",...d,fatal:i})}}):D.create()}exports.late={object:g.lazycreate};var p;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(p||(exports.ZodFirstPartyTypeKind=p={}));class Zt{constructor(...e){}}const Fe=(r,e={message:`Input not instance of ${r.name}`})=>me(t=>t instanceof r,e);exports.instanceof=Fe;const fe=I.create;exports.string=fe;const ye=N.create;exports.number=ye;const Me=se.create;exports.nan=Me;const ze=P.create;exports.bigint=ze;const _e=V.create;exports.boolean=_e;const $e=L.create;exports.date=$e;const Ke=Q.create;exports.symbol=Ke;const Be=F.create;exports.undefined=Be;const We=M.create;exports.null=We;const qe=D.create;exports.any=qe;const Ye=S.create;exports.unknown=Ye;const Je=k.create;exports.never=Je;const Ge=ee.create;exports.void=Ge;const He=Z.create;exports.array=He;const Xe=g.create;exports.object=Xe;const Qe=g.strictCreate;exports.strictObject=Qe;const et=z.create;exports.union=et;const tt=ae.create;exports.discriminatedUnion=tt;const st=$.create;exports.intersection=st;const at=C.create;exports.tuple=at;const rt=H.create;exports.record=rt;const nt=te.create;exports.map=nt;const it=U.create;exports.set=it;const dt=j.create;exports.function=dt;const ot=K.create;exports.lazy=ot;const ut=B.create;exports.literal=ut;const ct=O.create;exports.enum=ct;const lt=W.create;exports.nativeEnum=lt;const ht=R.create;exports.promise=ht;const ge=v.create;exports.effect=ge,exports.transformer=ge;const pt=T.create;exports.optional=pt;const mt=A.create;exports.nullable=mt;const ft=v.createWithPreprocess;exports.preprocess=ft;const yt=G.create;exports.pipeline=yt;const _t=()=>fe().optional();exports.ostring=_t;const gt=()=>ye().optional();exports.onumber=gt;const vt=()=>_e().optional();exports.oboolean=vt,exports.coerce={string:(r=>I.create({...r,coerce:!0})),number:(r=>N.create({...r,coerce:!0})),boolean:(r=>V.create({...r,coerce:!0})),bigint:(r=>P.create({...r,coerce:!0})),date:(r=>L.create({...r,coerce:!0}))},exports.NEVER=n.INVALID;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.discriminatedUnion=exports.date=exports.boolean=exports.bigint=exports.array=exports.any=exports.coerce=exports.ZodFirstPartyTypeKind=exports.late=exports.ZodSchema=exports.Schema=exports.ZodReadonly=exports.ZodPipeline=exports.ZodBranded=exports.BRAND=exports.ZodNaN=exports.ZodCatch=exports.ZodDefault=exports.ZodNullable=exports.ZodOptional=exports.ZodTransformer=exports.ZodEffects=exports.ZodPromise=exports.ZodNativeEnum=exports.ZodEnum=exports.ZodLiteral=exports.ZodLazy=exports.ZodFunction=exports.ZodSet=exports.ZodMap=exports.ZodRecord=exports.ZodTuple=exports.ZodIntersection=exports.ZodDiscriminatedUnion=exports.ZodUnion=exports.ZodObject=exports.ZodArray=exports.ZodVoid=exports.ZodNever=exports.ZodUnknown=exports.ZodAny=exports.ZodNull=exports.ZodUndefined=exports.ZodSymbol=exports.ZodDate=exports.ZodBoolean=exports.ZodBigInt=exports.ZodNumber=exports.ZodString=exports.ZodType=void 0,exports.NEVER=exports.void=exports.unknown=exports.union=exports.undefined=exports.tuple=exports.transformer=exports.symbol=exports.string=exports.strictObject=exports.set=exports.record=exports.promise=exports.preprocess=exports.pipeline=exports.ostring=exports.optional=exports.onumber=exports.oboolean=exports.object=exports.number=exports.nullable=exports.null=exports.never=exports.nativeEnum=exports.nan=exports.map=exports.literal=exports.lazy=exports.intersection=exports.instanceof=exports.function=exports.enum=exports.effect=void 0,exports.datetimeRegex=le,exports.custom=me;const o=require("./ZodError.cjs"),X=require("./errors.cjs"),h=require("./helpers/errorUtil.cjs"),n=require("./helpers/parseUtil.cjs"),u=require("./helpers/util.cjs");class I{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}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 oe=(r,e)=>{if((0,n.isValid)(e))return{success:!0,data:e.value};if(!r.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 o.ZodError(r.common.issues);return this._error=t,this._error}}};function f(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:a}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(c,d)=>{const{message:i}=r;return c.code==="invalid_enum_value"?{message:i??d.defaultError}:typeof d.data>"u"?{message:i??s??d.defaultError}:c.code!=="invalid_type"?{message:d.defaultError}:{message:i??t??d.defaultError}},description:a}}class y{get description(){return this._def.description}_getType(e){return(0,u.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,u.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new n.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,u.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,n.isAsync)(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)},a=this._parseSync({data:e,path:s.path,parent:s});return oe(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return(0,n.isValid)(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>(0,n.isValid)(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,u.getParsedType)(e)},a=this._parse({data:e,path:s.path,parent:s}),c=await((0,n.isAsync)(a)?a:Promise.resolve(a));return oe(s,c)}refine(e,t){const s=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,c)=>{const d=e(a),i=()=>c.addIssue({code:o.ZodIssueCode.custom,...s(a)});return typeof Promise<"u"&&d instanceof Promise?d.then(l=>l?!0:(i(),!1)):d?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof t=="function"?t(s,a):t),!1))}_refinement(e){return new v({schema:this,typeName:p.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:t=>this["~validate"](t)}}optional(){return T.create(this,this._def)}nullable(){return A.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this)}promise(){return R.create(this,this._def)}or(e){return z.create([this,e],this._def)}and(e){return $.create(this,e,this._def)}transform(e){return new v({...f(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new q({...f(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new de({typeName:p.ZodBranded,type:this,...f(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Y({...f(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return G.create(this,e)}readonly(){return J.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}exports.ZodType=y,exports.Schema=y,exports.ZodSchema=y;const ve=/^c[^\s-]{8,}$/i,Ze=/^[0-9a-z]+$/,xe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ie=/^[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,Te=/^[a-z0-9_-]{21}$/i,Ce=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ke=/^[-+]?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)?)??$/,be=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,we="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ne;const Ae=/^(?:(?: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])$/,Ne=/^(?:(?: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])$/,Pe=/^(([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]))$/,Oe=/^(([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])$/,Se=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Le=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ue="((\\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])))",Ue=new RegExp(`^${ue}$`);function ce(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function De(r){return new RegExp(`^${ce(r)}$`)}function le(r){let e=`${ue}T${ce(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ee(r,e){return!!((e==="v4"||!e)&&Ae.test(r)||(e==="v6"||!e)&&Pe.test(r))}function Re(r,e){if(!Ce.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Ve(r,e){return!!((e==="v4"||!e)&&Ne.test(r)||(e==="v6"||!e)&&Oe.test(r))}class x extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.ZodParsedType.string){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.string,received:a.parsedType}),n.INVALID}const t=new n.ParseStatus;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if(a.kind==="length"){const c=e.data.length>a.value,d=e.data.length<a.value;(c||d)&&(s=this._getOrReturnCtx(e,s),c?(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):d&&(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if(a.kind==="email")be.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"email",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="emoji")ne||(ne=new RegExp(we,"u")),ne.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"emoji",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="uuid")Ie.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"uuid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="nanoid")Te.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"nanoid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="cuid")ve.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cuid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="cuid2")Ze.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cuid2",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="ulid")xe.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"ulid",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"url",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"regex",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):a.kind==="datetime"?le(a).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"datetime",message:a.message}),t.dirty()):a.kind==="date"?Ue.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"date",message:a.message}),t.dirty()):a.kind==="time"?De(a).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_string,validation:"time",message:a.message}),t.dirty()):a.kind==="duration"?ke.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"duration",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="ip"?Ee(e.data,a.version)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"ip",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="jwt"?Re(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"jwt",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="cidr"?Ve(e.data,a.version)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"cidr",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="base64"?Se.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"base64",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):a.kind==="base64url"?Le.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{validation:"base64url",code:o.ZodIssueCode.invalid_string,message:a.message}),t.dirty()):u.util.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(a=>e.test(a),{validation:t,code:o.ZodIssueCode.invalid_string,...h.errorUtil.errToObj(s)})}_addCheck(e){return new x({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,h.errorUtil.errToObj(e))}trim(){return new x({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new x({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new x({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}exports.ZodString=x,x.create=r=>new x({checks:[],typeName:p.ZodString,coerce:r?.coerce??!1,...f(r)});function je(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,a=t>s?t:s,c=Number.parseInt(r.toFixed(a).replace(".","")),d=Number.parseInt(e.toFixed(a).replace(".",""));return c%d/10**a}class N extends y{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)!==u.ZodParsedType.number){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.number,received:a.parsedType}),n.INVALID}let t;const s=new n.ParseStatus;for(const a of this._def.checks)a.kind==="int"?u.util.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?je(e.data,a.value)!==0&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_finite,message:a.message}),s.dirty()):u.util.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.errorUtil.toString(t))}setLimit(e,t,s,a){return new N({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.errorUtil.toString(a)}]})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&u.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}exports.ZodNumber=N,N.create=r=>new N({checks:[],typeName:p.ZodNumber,coerce:r?.coerce||!1,...f(r)});class P extends y{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)!==u.ZodParsedType.bigint)return this._getInvalidInput(e);let t;const s=new n.ParseStatus;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):u.util.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.bigint,received:t.parsedType}),n.INVALID}gte(e,t){return this.setLimit("min",e,!0,h.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.errorUtil.toString(t))}setLimit(e,t,s,a){return new P({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.errorUtil.toString(a)}]})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}exports.ZodBigInt=P,P.create=r=>new P({checks:[],typeName:p.ZodBigInt,coerce:r?.coerce??!1,...f(r)});class j extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.boolean,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodBoolean=j,j.create=r=>new j({typeName:p.ZodBoolean,coerce:r?.coerce||!1,...f(r)});class L extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.ZodParsedType.date){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.date,received:a.parsedType}),n.INVALID}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(a,{code:o.ZodIssueCode.invalid_date}),n.INVALID}const t=new n.ParseStatus;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):u.util.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}exports.ZodDate=L,L.create=r=>new L({checks:[],coerce:r?.coerce||!1,typeName:p.ZodDate,...f(r)});class Q extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.symbol,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodSymbol=Q,Q.create=r=>new Q({typeName:p.ZodSymbol,...f(r)});class F extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.undefined,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodUndefined=F,F.create=r=>new F({typeName:p.ZodUndefined,...f(r)});class M extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.null){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.null,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodNull=M,M.create=r=>new M({typeName:p.ZodNull,...f(r)});class D extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,n.OK)(e.data)}}exports.ZodAny=D,D.create=r=>new D({typeName:p.ZodAny,...f(r)});class S extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,n.OK)(e.data)}}exports.ZodUnknown=S,S.create=r=>new S({typeName:p.ZodUnknown,...f(r)});class k extends y{_parse(e){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.never,received:t.parsedType}),n.INVALID}}exports.ZodNever=k,k.create=r=>new k({typeName:p.ZodNever,...f(r)});class ee extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.void,received:t.parsedType}),n.INVALID}return(0,n.OK)(e.data)}}exports.ZodVoid=ee,ee.create=r=>new ee({typeName:p.ZodVoid,...f(r)});class Z extends y{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.ZodParsedType.array)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.array,received:t.parsedType}),n.INVALID;if(a.exactLength!==null){const d=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(d||i)&&((0,n.addIssueToContext)(t,{code:d?o.ZodIssueCode.too_big:o.ZodIssueCode.too_small,minimum:i?a.exactLength.value:void 0,maximum:d?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((d,i)=>a.type._parseAsync(new I(t,d,t.path,i)))).then(d=>n.ParseStatus.mergeArray(s,d));const c=[...t.data].map((d,i)=>a.type._parseSync(new I(t,d,t.path,i)));return n.ParseStatus.mergeArray(s,c)}get element(){return this._def.type}min(e,t){return new Z({...this._def,minLength:{value:e,message:h.errorUtil.toString(t)}})}max(e,t){return new Z({...this._def,maxLength:{value:e,message:h.errorUtil.toString(t)}})}length(e,t){return new Z({...this._def,exactLength:{value:e,message:h.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}exports.ZodArray=Z,Z.create=(r,e)=>new Z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...f(e)});function E(r){if(r instanceof g){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=T.create(E(s))}return new g({...r._def,shape:()=>e})}else return r instanceof Z?new Z({...r._def,type:E(r.element)}):r instanceof T?T.create(E(r.unwrap())):r instanceof A?A.create(E(r.unwrap())):r instanceof C?C.create(r.items.map(e=>E(e))):r}class g extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=u.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.ZodParsedType.object){const l=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(l,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:l.parsedType}),n.INVALID}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:c}=this._getCached(),d=[];if(!(this._def.catchall instanceof k&&this._def.unknownKeys==="strip"))for(const l in s.data)c.includes(l)||d.push(l);const i=[];for(const l of c){const m=a[l],_=s.data[l];i.push({key:{status:"valid",value:l},value:m._parse(new I(s,_,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof k){const l=this._def.unknownKeys;if(l==="passthrough")for(const m of d)i.push({key:{status:"valid",value:m},value:{status:"valid",value:s.data[m]}});else if(l==="strict")d.length>0&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.unrecognized_keys,keys:d}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const m of d){const _=s.data[m];i.push({key:{status:"valid",value:m},value:l._parse(new I(s,_,s.path,m)),alwaysSet:m in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const m of i){const _=await m.key,b=await m.value;l.push({key:_,value:b,alwaysSet:m.alwaysSet})}return l}).then(l=>n.ParseStatus.mergeObjectSync(t,l)):n.ParseStatus.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return h.errorUtil.errToObj,new g({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errorUtil.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new g({...this._def,unknownKeys:"strip"})}passthrough(){return new g({...this._def,unknownKeys:"passthrough"})}extend(e){return new g({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new g({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new g({...this._def,catchall:e})}pick(e){const t={};for(const s of u.util.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new g({...this._def,shape:()=>t})}omit(e){const t={};for(const s of u.util.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new g({...this._def,shape:()=>t})}deepPartial(){return E(this)}partial(e){const t={};for(const s of u.util.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new g({...this._def,shape:()=>t})}required(e){const t={};for(const s of u.util.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof T;)a=a._def.innerType;t[s]=a}return new g({...this._def,shape:()=>t})}keyof(){return he(u.util.objectKeys(this.shape))}}exports.ZodObject=g,g.create=(r,e)=>new g({shape:()=>r,unknownKeys:"strip",catchall:k.create(),typeName:p.ZodObject,...f(e)}),g.strictCreate=(r,e)=>new g({shape:()=>r,unknownKeys:"strict",catchall:k.create(),typeName:p.ZodObject,...f(e)}),g.lazycreate=(r,e)=>new g({shape:r,unknownKeys:"strip",catchall:k.create(),typeName:p.ZodObject,...f(e)});class z extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function a(c){for(const i of c)if(i.result.status==="valid")return i.result;for(const i of c)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;const d=c.map(i=>new o.ZodError(i.ctx.common.issues));return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union,unionErrors:d}),n.INVALID}if(t.common.async)return Promise.all(s.map(async c=>{const d={...t,common:{...t.common,issues:[]},parent:null};return{result:await c._parseAsync({data:t.data,path:t.path,parent:d}),ctx:d}})).then(a);{let c;const d=[];for(const l of s){const m={...t,common:{...t.common,issues:[]},parent:null},_=l._parseSync({data:t.data,path:t.path,parent:m});if(_.status==="valid")return _;_.status==="dirty"&&!c&&(c={result:_,ctx:m}),m.common.issues.length&&d.push(m.common.issues)}if(c)return t.common.issues.push(...c.ctx.common.issues),c.result;const i=d.map(l=>new o.ZodError(l));return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union,unionErrors:i}),n.INVALID}}get options(){return this._def.options}}exports.ZodUnion=z,z.create=(r,e)=>new z({options:r,typeName:p.ZodUnion,...f(e)});const w=r=>r instanceof K?w(r.schema):r instanceof v?w(r.innerType()):r instanceof B?[r.value]:r instanceof O?r.options:r instanceof W?u.util.objectValues(r.enum):r instanceof q?w(r._def.innerType):r instanceof F?[void 0]:r instanceof M?[null]:r instanceof T?[void 0,...w(r.unwrap())]:r instanceof A?[null,...w(r.unwrap())]:r instanceof de||r instanceof J?w(r.unwrap()):r instanceof Y?w(r._def.innerType):[];class ae extends y{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.object)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:t.parsedType}),n.INVALID;const s=this.discriminator,a=t.data[s],c=this.optionsMap.get(a);return c?t.common.async?c._parseAsync({data:t.data,path:t.path,parent:t}):c._parseSync({data:t.data,path:t.path,parent:t}):((0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),n.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const c of t){const d=w(c.shape[e]);if(!d.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of d){if(a.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,c)}}return new ae({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...f(s)})}}exports.ZodDiscriminatedUnion=ae;function ie(r,e){const t=(0,u.getParsedType)(r),s=(0,u.getParsedType)(e);if(r===e)return{valid:!0,data:r};if(t===u.ZodParsedType.object&&s===u.ZodParsedType.object){const a=u.util.objectKeys(e),c=u.util.objectKeys(r).filter(i=>a.indexOf(i)!==-1),d={...r,...e};for(const i of c){const l=ie(r[i],e[i]);if(!l.valid)return{valid:!1};d[i]=l.data}return{valid:!0,data:d}}else if(t===u.ZodParsedType.array&&s===u.ZodParsedType.array){if(r.length!==e.length)return{valid:!1};const a=[];for(let c=0;c<r.length;c++){const d=r[c],i=e[c],l=ie(d,i);if(!l.valid)return{valid:!1};a.push(l.data)}return{valid:!0,data:a}}else return t===u.ZodParsedType.date&&s===u.ZodParsedType.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class $ extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(c,d)=>{if((0,n.isAborted)(c)||(0,n.isAborted)(d))return n.INVALID;const i=ie(c.value,d.value);return i.valid?(((0,n.isDirty)(c)||(0,n.isDirty)(d))&&t.dirty(),{status:t.value,value:i.data}):((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_intersection_types}),n.INVALID)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([c,d])=>a(c,d)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}exports.ZodIntersection=$,$.create=(r,e,t)=>new $({left:r,right:e,typeName:p.ZodIntersection,...f(t)});class C extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.array)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.array,received:s.parsedType}),n.INVALID;if(s.data.length<this._def.items.length)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.INVALID;!this._def.rest&&s.data.length>this._def.items.length&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((c,d)=>{const i=this._def.items[d]||this._def.rest;return i?i._parse(new I(s,c,s.path,d)):null}).filter(c=>!!c);return s.common.async?Promise.all(a).then(c=>n.ParseStatus.mergeArray(t,c)):n.ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new C({...this._def,rest:e})}}exports.ZodTuple=C,C.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new C({items:r,typeName:p.ZodTuple,rest:null,...f(e)})};class H extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.object)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.object,received:s.parsedType}),n.INVALID;const a=[],c=this._def.keyType,d=this._def.valueType;for(const i in s.data)a.push({key:c._parse(new I(s,i,s.path,i)),value:d._parse(new I(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?n.ParseStatus.mergeObjectAsync(t,a):n.ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof y?new H({keyType:e,valueType:t,typeName:p.ZodRecord,...f(s)}):new H({keyType:x.create(),valueType:e,typeName:p.ZodRecord,...f(t)})}}exports.ZodRecord=H;class te extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.map)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.map,received:s.parsedType}),n.INVALID;const a=this._def.keyType,c=this._def.valueType,d=[...s.data.entries()].map(([i,l],m)=>({key:a._parse(new I(s,i,s.path,[m,"key"])),value:c._parse(new I(s,l,s.path,[m,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const l of d){const m=await l.key,_=await l.value;if(m.status==="aborted"||_.status==="aborted")return n.INVALID;(m.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(m.value,_.value)}return{status:t.value,value:i}})}else{const i=new Map;for(const l of d){const m=l.key,_=l.value;if(m.status==="aborted"||_.status==="aborted")return n.INVALID;(m.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(m.value,_.value)}return{status:t.value,value:i}}}}exports.ZodMap=te,te.create=(r,e,t)=>new te({valueType:e,keyType:r,typeName:p.ZodMap,...f(t)});class U extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==u.ZodParsedType.set)return(0,n.addIssueToContext)(s,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.set,received:s.parsedType}),n.INVALID;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&((0,n.addIssueToContext)(s,{code:o.ZodIssueCode.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const c=this._def.valueType;function d(l){const m=new Set;for(const _ of l){if(_.status==="aborted")return n.INVALID;_.status==="dirty"&&t.dirty(),m.add(_.value)}return{status:t.value,value:m}}const i=[...s.data.values()].map((l,m)=>c._parse(new I(s,l,s.path,m)));return s.common.async?Promise.all(i).then(l=>d(l)):d(i)}min(e,t){return new U({...this._def,minSize:{value:e,message:h.errorUtil.toString(t)}})}max(e,t){return new U({...this._def,maxSize:{value:e,message:h.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}exports.ZodSet=U,U.create=(r,e)=>new U({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,...f(e)});class V extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.function)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.function,received:t.parsedType}),n.INVALID;function s(i,l){return(0,n.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,X.getErrorMap)(),X.defaultErrorMap].filter(m=>!!m),issueData:{code:o.ZodIssueCode.invalid_arguments,argumentsError:l}})}function a(i,l){return(0,n.makeIssue)({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,X.getErrorMap)(),X.defaultErrorMap].filter(m=>!!m),issueData:{code:o.ZodIssueCode.invalid_return_type,returnTypeError:l}})}const c={errorMap:t.common.contextualErrorMap},d=t.data;if(this._def.returns instanceof R){const i=this;return(0,n.OK)(async function(...l){const m=new o.ZodError([]),_=await i._def.args.parseAsync(l,c).catch(re=>{throw m.addIssue(s(l,re)),m}),b=await Reflect.apply(d,this,_);return await i._def.returns._def.type.parseAsync(b,c).catch(re=>{throw m.addIssue(a(b,re)),m})})}else{const i=this;return(0,n.OK)(function(...l){const m=i._def.args.safeParse(l,c);if(!m.success)throw new o.ZodError([s(l,m.error)]);const _=Reflect.apply(d,this,m.data),b=i._def.returns.safeParse(_,c);if(!b.success)throw new o.ZodError([a(_,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new V({...this._def,args:C.create(e).rest(S.create())})}returns(e){return new V({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new V({args:e||C.create([]).rest(S.create()),returns:t||S.create(),typeName:p.ZodFunction,...f(s)})}}exports.ZodFunction=V;class K extends y{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})}}exports.ZodLazy=K,K.create=(r,e)=>new K({getter:r,typeName:p.ZodLazy,...f(e)});class B extends y{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{received:t.data,code:o.ZodIssueCode.invalid_literal,expected:this._def.value}),n.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}exports.ZodLiteral=B,B.create=(r,e)=>new B({value:r,typeName:p.ZodLiteral,...f(e)});function he(r,e){return new O({values:r,typeName:p.ZodEnum,...f(e)})}class O extends y{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,n.addIssueToContext)(t,{expected:u.util.joinValues(s),received:t.parsedType,code:o.ZodIssueCode.invalid_type}),n.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return(0,n.addIssueToContext)(t,{received:t.data,code:o.ZodIssueCode.invalid_enum_value,options:s}),n.INVALID}return(0,n.OK)(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 O.create(e,{...this._def,...t})}exclude(e,t=this._def){return O.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}exports.ZodEnum=O,O.create=he;class W extends y{_parse(e){const t=u.util.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==u.ZodParsedType.string&&s.parsedType!==u.ZodParsedType.number){const a=u.util.objectValues(t);return(0,n.addIssueToContext)(s,{expected:u.util.joinValues(a),received:s.parsedType,code:o.ZodIssueCode.invalid_type}),n.INVALID}if(this._cache||(this._cache=new Set(u.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=u.util.objectValues(t);return(0,n.addIssueToContext)(s,{received:s.data,code:o.ZodIssueCode.invalid_enum_value,options:a}),n.INVALID}return(0,n.OK)(e.data)}get enum(){return this._def.values}}exports.ZodNativeEnum=W,W.create=(r,e)=>new W({values:r,typeName:p.ZodNativeEnum,...f(e)});class R extends y{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.ZodParsedType.promise&&t.common.async===!1)return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.promise,received:t.parsedType}),n.INVALID;const s=t.parsedType===u.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,n.OK)(s.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}exports.ZodPromise=R,R.create=(r,e)=>new R({type:r,typeName:p.ZodPromise,...f(e)});class v extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,c={addIssue:d=>{(0,n.addIssueToContext)(s,d),d.fatal?t.abort():t.dirty()},get path(){return s.path}};if(c.addIssue=c.addIssue.bind(c),a.type==="preprocess"){const d=a.transform(s.data,c);if(s.common.async)return Promise.resolve(d).then(async i=>{if(t.value==="aborted")return n.INVALID;const l=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return l.status==="aborted"?n.INVALID:l.status==="dirty"||t.value==="dirty"?(0,n.DIRTY)(l.value):l});{if(t.value==="aborted")return n.INVALID;const i=this._def.schema._parseSync({data:d,path:s.path,parent:s});return i.status==="aborted"?n.INVALID:i.status==="dirty"||t.value==="dirty"?(0,n.DIRTY)(i.value):i}}if(a.type==="refinement"){const d=i=>{const l=a.refinement(i,c);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?n.INVALID:(i.status==="dirty"&&t.dirty(),d(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?n.INVALID:(i.status==="dirty"&&t.dirty(),d(i.value).then(()=>({status:t.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){const d=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!(0,n.isValid)(d))return n.INVALID;const i=a.transform(d.value,c);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(d=>(0,n.isValid)(d)?Promise.resolve(a.transform(d.value,c)).then(i=>({status:t.value,value:i})):n.INVALID);u.util.assertNever(a)}}exports.ZodEffects=v,exports.ZodTransformer=v,v.create=(r,e,t)=>new v({schema:r,typeName:p.ZodEffects,effect:e,...f(t)}),v.createWithPreprocess=(r,e,t)=>new v({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,...f(t)});class T extends y{_parse(e){return this._getType(e)===u.ZodParsedType.undefined?(0,n.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}exports.ZodOptional=T,T.create=(r,e)=>new T({innerType:r,typeName:p.ZodOptional,...f(e)});class A extends y{_parse(e){return this._getType(e)===u.ZodParsedType.null?(0,n.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}exports.ZodNullable=A,A.create=(r,e)=>new A({innerType:r,typeName:p.ZodNullable,...f(e)});class q extends y{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===u.ZodParsedType.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}exports.ZodDefault=q,q.create=(r,e)=>new q({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...f(e)});class Y extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return(0,n.isAsync)(a)?a.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new o.ZodError(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new o.ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}exports.ZodCatch=Y,Y.create=(r,e)=>new Y({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...f(e)});class se extends y{_parse(e){if(this._getType(e)!==u.ZodParsedType.nan){const t=this._getOrReturnCtx(e);return(0,n.addIssueToContext)(t,{code:o.ZodIssueCode.invalid_type,expected:u.ZodParsedType.nan,received:t.parsedType}),n.INVALID}return{status:"valid",value:e.data}}}exports.ZodNaN=se,se.create=r=>new se({typeName:p.ZodNaN,...f(r)}),exports.BRAND=Symbol("zod_brand");class de extends y{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}exports.ZodBranded=de;class G extends y{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?n.INVALID:a.status==="dirty"?(t.dirty(),(0,n.DIRTY)(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?n.INVALID:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,t){return new G({in:e,out:t,typeName:p.ZodPipeline})}}exports.ZodPipeline=G;class J extends y{_parse(e){const t=this._def.innerType._parse(e),s=a=>((0,n.isValid)(a)&&(a.value=Object.freeze(a.value)),a);return(0,n.isAsync)(t)?t.then(a=>s(a)):s(t)}unwrap(){return this._def.innerType}}exports.ZodReadonly=J,J.create=(r,e)=>new J({innerType:r,typeName:p.ZodReadonly,...f(e)});function pe(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function me(r,e={},t){return r?D.create().superRefine((s,a)=>{const c=r(s);if(c instanceof Promise)return c.then(d=>{if(!d){const i=pe(e,s),l=i.fatal??t??!0;a.addIssue({code:"custom",...i,fatal:l})}});if(!c){const d=pe(e,s),i=d.fatal??t??!0;a.addIssue({code:"custom",...d,fatal:i})}}):D.create()}exports.late={object:g.lazycreate};var p;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(p||(exports.ZodFirstPartyTypeKind=p={}));class Zt{constructor(...e){}}const Fe=(r,e={message:`Input not instance of ${r.name}`})=>me(t=>t instanceof r,e);exports.instanceof=Fe;const fe=x.create;exports.string=fe;const ye=N.create;exports.number=ye;const Me=se.create;exports.nan=Me;const ze=P.create;exports.bigint=ze;const _e=j.create;exports.boolean=_e;const $e=L.create;exports.date=$e;const Ke=Q.create;exports.symbol=Ke;const Be=F.create;exports.undefined=Be;const We=M.create;exports.null=We;const qe=D.create;exports.any=qe;const Ye=S.create;exports.unknown=Ye;const Je=k.create;exports.never=Je;const Ge=ee.create;exports.void=Ge;const He=Z.create;exports.array=He;const Xe=g.create;exports.object=Xe;const Qe=g.strictCreate;exports.strictObject=Qe;const et=z.create;exports.union=et;const tt=ae.create;exports.discriminatedUnion=tt;const st=$.create;exports.intersection=st;const at=C.create;exports.tuple=at;const rt=H.create;exports.record=rt;const nt=te.create;exports.map=nt;const it=U.create;exports.set=it;const dt=V.create;exports.function=dt;const ot=K.create;exports.lazy=ot;const ut=B.create;exports.literal=ut;const ct=O.create;exports.enum=ct;const lt=W.create;exports.nativeEnum=lt;const ht=R.create;exports.promise=ht;const ge=v.create;exports.effect=ge,exports.transformer=ge;const pt=T.create;exports.optional=pt;const mt=A.create;exports.nullable=mt;const ft=v.createWithPreprocess;exports.preprocess=ft;const yt=G.create;exports.pipeline=yt;const _t=()=>fe().optional();exports.ostring=_t;const gt=()=>ye().optional();exports.onumber=gt;const vt=()=>_e().optional();exports.oboolean=vt,exports.coerce={string:(r=>x.create({...r,coerce:!0})),number:(r=>N.create({...r,coerce:!0})),boolean:(r=>j.create({...r,coerce:!0})),bigint:(r=>P.create({...r,coerce:!0})),date:(r=>L.create({...r,coerce:!0}))},exports.NEVER=n.INVALID;