1import{_ as lt}from"./index-CCIHbGn_.js";var Xt=Object.create,wt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,xt=Object.getOwnPropertyNames,er=Object.getPrototypeOf,tr=Object.prototype.hasOwnProperty,st=(t,e)=>function(){return e||(0,t[xt(t)[0]])((e={exports:{}}).exports,e),e.exports},rr=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xt(e))!tr.call(t,n)&&n!==r&&wt(t,n,{get:()=>e[n],enumerable:!(a=Qt(e,n))||a.enumerable});return t},Ue=(t,e,r)=>(r=t!=null?Xt(er(t)):{},rr(!t||!t.__esModule?wt(r,"default",{value:t,enumerable:!0}):r,t)),ar=st({"../../node_modules/.pnpm/[email protected]/node_modules/iota-array/iota.js"(t,e){function r(a){for(var n=new Array(a),s=0;s<a;++s)n[s]=s;return n}e.exports=r}}),nr=st({"../../node_modules/.pnpm/[email protected]/node_modules/is-buffer/index.js"(t,e){e.exports=function(n){return n!=null&&(r(n)||a(n)||!!n._isBuffer)};function r(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function a(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&r(n.slice(0,0))}}}),Ve=st({"../../node_modules/.pnpm/[email protected]/node_modules/ndarray/ndarray.js"(t,e){var r=ar(),a=nr(),n=typeof Float64Array<"u";function s(v,_){return v[0]-_[0]}function i(){var v=this.stride,_=new Array(v.length),p;for(p=0;p<_.length;++p)_[p]=[Math.abs(v[p]),p];_.sort(s);var O=new Array(_.length);for(p=0;p<O.length;++p)O[p]=_[p][1];return O}function o(v,_){var p=["View",_,"d",v].join("");_<0&&(p="View_Nil"+v);var O=v==="generic";if(_===-1){var b="function "+p+"(a){this.data=a;};var proto="+p+".prototype;proto.dtype='"+v+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+p+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+p+"(a){return new "+p+"(a);}",ne=new Function(b);return ne()}else if(_===0){var b="function "+p+"(a,d) {this.data = a;this.offset = d};var proto="+p+".prototype;proto.dtype='"+v+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+p+"_copy() {return new "+p+"(this.data,this.offset)};proto.pick=function "+p+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+p+"_get(){return "+(O?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+p+"_set(v){return "+(O?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+p+"(a,b,c,d){return new "+p+"(a,d)}",ne=new Function("TrivialArray",b);return ne(c[v][0])}var b=["'use strict'"],j=r(_),S=j.map(function(w){return"i"+w}),R="this.offset+"+j.map(function(w){return"this.stride["+w+"]*i"+w}).join("+"),N=j.map(function(w){return"b"+w}).join(","),E=j.map(function(w){return"c"+w}).join(",");b.push("function "+p+"(a,"+N+","+E+",d){this.data=a","this.shape=["+N+"]","this.stride=["+E+"]","this.offset=d|0}","var proto="+p+".prototype","proto.dtype='"+v+"'","proto.dimension="+_),b.push("Object.defineProperty(proto,'size',{get:function "+p+"_size(){return "+j.map(function(w){return"this.shape["+w+"]"}).join("*"),"}})"),_===1?b.push("proto.order=[0]"):(b.push("Object.defineProperty(proto,'order',{get:"),_<4?(b.push("function "+p+"_order(){"),_===2?b.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):_===3&&b.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):b.push("ORDER})")),b.push("proto.set=function "+p+"_set("+S.join(",")+",v){"),O?b.push("return this.data.set("+R+",v)}"):b.push("return this.data["+R+"]=v}"),b.push("proto.get=function "+p+"_get("+S.join(",")+"){"),O?b.push("return this.data.get("+R+")}"):b.push("return this.data["+R+"]}"),b.push("proto.index=function "+p+"_index(",S.join(),"){return "+R+"}"),b.push("proto.hi=function "+p+"_hi("+S.join(",")+"){return new "+p+"(this.data,"+j.map(function(w){return["(typeof i",w,"!=='number'||i",w,"<0)?this.shape[",w,"]:i",w,"|0"].join("")}).join(",")+","+j.map(function(w){return"this.stride["+w+"]"}).join(",")+",this.offset)}");var Be=j.map(function(w){return"a"+w+"=this.shape["+w+"]"}),We=j.map(function(w){return"c"+w+"=this.stride["+w+"]"});b.push("proto.lo=function "+p+"_lo("+S.join(",")+"){var b=this.offset,d=0,"+Be.join(",")+","+We.join(","));for(var T=0;T<_;++T)b.push("if(typeof i"+T+"==='number'&&i"+T+">=0){d=i"+T+"|0;b+=c"+T+"*d;a"+T+"-=d}");b.push("return new "+p+"(this.data,"+j.map(function(w){return"a"+w}).join(",")+","+j.map(function(w){return"c"+w}).join(",")+",b)}"),b.push("proto.step=function "+p+"_step("+S.join(",")+"){var "+j.map(function(w){return"a"+w+"=this.shape["+w+"]"}).join(",")+","+j.map(function(w){return"b"+w+"=this.stride["+w+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var T=0;T<_;
1++T)b.push("if(typeof i"+T+"==='number'){d=i"+T+"|0;if(d<0){c+=b"+T+"*(a"+T+"-1);a"+T+"=ceil(-a"+T+"/d)}else{a"+T+"=ceil(a"+T+"/d)}b"+T+"*=d}");b.push("return new "+p+"(this.data,"+j.map(function(w){return"a"+w}).join(",")+","+j.map(function(w){return"b"+w}).join(",")+",c)}");for(var Oe=new Array(_),Ae=new Array(_),T=0;T<_;++T)Oe[T]="a[i"+T+"]",Ae[T]="b[i"+T+"]";b.push("proto.transpose=function "+p+"_transpose("+S+"){"+S.map(function(w,Kt){return w+"=("+w+"===undefined?"+Kt+":"+w+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+p+"(this.data,"+Oe.join(",")+","+Ae.join(",")+",this.offset)}"),b.push("proto.pick=function "+p+"_pick("+S+"){var a=[],b=[],c=this.offset");for(var T=0;T<_;++T)b.push("if(typeof i"+T+"==='number'&&i"+T+">=0){c=(c+this.stride["+T+"]*i"+T+")|0}else{a.push(this.shape["+T+"]);b.push(this.stride["+T+"])}");b.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),b.push("return function construct_"+p+"(data,shape,stride,offset){return new "+p+"(data,"+j.map(function(w){return"shape["+w+"]"}).join(",")+","+j.map(function(w){return"stride["+w+"]"}).join(",")+",offset)}");var ne=new Function("CTOR_LIST","ORDER",b.join(` 2`));return ne(c[v],i)}function u(v){if(a(v))return"buffer";if(n)switch(Object.prototype.toString.call(v)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(v)?"array":"generic"}var c={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function h(v,_,p,O){if(v===void 0){var E=c.array[0];return E([])}else typeof v=="number"&&(v=[v]);_===void 0&&(_=[v.length]);var b=_.length;if(p===void 0){p=new Array(b);for(var j=b-1,S=1;j>=0;--j)p[j]=S,S*=_[j]}if(O===void 0){O=0;for(var j=0;j<b;++j)p[j]<0&&(O-=(_[j]-1)*p[j])}for(var R=u(v),N=c[R];N.length<=b+1;)N.push(o(R,N.length-1));var E=N[b+1];return E(v,_,p,O)}e.exports=h}}),sr=typeof global=="object"&&global&&global.Object===Object&&global,ir=sr,or=typeof self=="object"&&self&&self.Object===Object&&self,cr=ir||or||Function("return this")(),it=cr,ur=it.Symbol,Ee=ur,kt=Object.prototype,dr=kt.hasOwnProperty,lr=kt.toString,se=Ee?Ee.toStringTag:void 0;function fr(t){var e=dr.call(t,se),r=t[se];try{t[se]=void 0;var a=!0}catch{}var n=lr.call(t);return a&&(e?t[se]=r:delete t[se]),n}var hr=fr,pr=Object.prototype,mr=pr.toString;function vr(t){return mr.call(t)}var _r=vr,yr="[object Null]",gr="[object Undefined]",ft=Ee?Ee.toStringTag:void 0;function br(t){return t==null?t===void 0?gr:yr:ft&&ft in Object(t)?hr(t):_r(t)}var wr=br;function xr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Tt=xr,kr="[object AsyncFunction]",Tr="[object Function]",Cr="[object GeneratorFunction]",jr="[object Proxy]";function Or(t){if(!Tt(t))return!1;var e=wr(t);return e==Tr||e==Cr||e==kr||e==jr}var Ar=Or,Sr=it["__core-js_shared__"],qe=Sr,ht=(function(){var t=/[^.]+$/.exec(qe&&qe.keys&&qe.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Zr(t){return!!ht&&ht in t}var Er=Zr,Ir=Function.prototype,Rr=Ir.toString;function Nr(t){if(t!=null){try{return Rr.call(t)}catch{}try{return t+""}catch{}}return""}var Pr=Nr,Mr=/[\\^$.*+?()[\]{}|]/g,$r=/^\[object .+?Constructor\]$/,zr=Function.prototype,Dr=Object.prototype,Ur=zr.toString,Vr=Dr.hasOwnProperty,Lr=RegExp("^"+Ur.call(Vr).replace(Mr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Fr(t){if(!Tt(t)||Er(t))return!1;var e=Ar(t)?Lr:$r;return e.test(Pr(t))}var Br=Fr;function Wr(t,e){return t?.[e]}var qr=Wr;function Gr(t,e){var r=qr(t,e);return Br(r)?r:void 0}var Ct=Gr,Hr=Ct(Object,"create"),de=Hr;function Jr(){this.__data__=de?de(null):{},this.size=0}var Yr=Jr;function Kr(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Xr=Kr,Qr="__lodash_hash_undefined__",ea=Object.prototype,ta=ea.hasOwnProperty;function ra(t){var e=this.__data__;if(de){var r=e[t];return r===Qr?void 0:r}return ta.call(e,t)?e[t]:void 0}var aa=ra,na=Object.prototype,sa=na.hasOwnProperty;function ia(t){var e=this.__data__;return de?e[t]!==void 0:sa.call(e,t)}var oa=ia,ca="__lodash_hash_undefined__";function ua(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=de&&e===void 0?ca:e,this}var da=ua;function te(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}te.prototype.clear=Yr;te.prototype.delete=Xr;te.prototype.get=aa;te.prototype.has=oa;te.prototype.set=da;var pt=te;function la(){this.__data__=[],this.size=0}var fa=la;function ha(t,e){return t===e||t!==t&&e!==e}var pa=ha;function ma(t,e){for(var r=t.length;r--;)if(pa(t[r][0],e))return r;return-1}var Le=ma,va=Array.prototype,_a=va.splice;function ya(t){var e=this.__data__,r=Le(e,t);if(r<0)return!1;var a=e.length-1;return r==a?e.pop():_a.call(e,r,1),--this.size,!0}var ga=ya;function ba(t){var e=this.__data__,r=Le(e,t);return r<0?void 0:e[r][1]}var wa=ba;function xa(t){return Le(this.__data__,t)>-1}
2var ka=xa;function Ta(t,e){var r=this.__data__,a=Le(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var Ca=Ta;function re(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}re.prototype.clear=fa;re.prototype.delete=ga;re.prototype.get=wa;re.prototype.has=ka;re.prototype.set=Ca;var ja=re,Oa=Ct(it,"Map"),Aa=Oa;function Sa(){this.size=0,this.__data__={hash:new pt,map:new(Aa||ja),string:new pt}}var Za=Sa;function Ea(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ia=Ea;function Ra(t,e){var r=t.__data__;return Ia(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Fe=Ra;function Na(t){var e=Fe(this,t).delete(t);return this.size-=e?1:0,e}var Pa=Na;function Ma(t){return Fe(this,t).get(t)}var $a=Ma;function za(t){return Fe(this,t).has(t)}var Da=za;function Ua(t,e){var r=Fe(this,t),a=r.size;return r.set(t,e),this.size+=r.size==a?0:1,this}var Va=Ua;function ae(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}ae.prototype.clear=Za;ae.prototype.delete=Pa;ae.prototype.get=$a;ae.prototype.has=Da;ae.prototype.set=Va;var jt=ae,La="Expected a function";function ot(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(La);var r=function(){var a=arguments,n=e?e.apply(this,a):a[0],s=r.cache;if(s.has(n))return s.get(n);var i=t.apply(this,a);return r.cache=s.set(n,i)||s,i};return r.cache=new(ot.Cache||jt),r}ot.Cache=jt;var Fa=ot,ct=Ue(Ve()),Ot=class Je{constructor(e,r){this.type="application/octet-stream",this.params={},this.type=e,this.params=r}toString(){const e=[];for(const r in this.params){const a=this.params[r];e.push(`${r}=${a}`)}return[this.type,...e].join(";")}static create(e,r){return new Je(e,r)}isIdentical(e){return this.type===e.type&&this.params===e.params}isEqual(e){return this.type===e.type}static fromString(e){const[r,...a]=e.split(";"),n={};for(const s of a){const[i,o]=s.split("=");n[i.trim()]=o.trim()}return new Je(r,n)}},Ge=Ue(Ve());async function Ba(t){const e=Ot.fromString(t.type);switch(e.type){case"image/x-alpha8":{const r=parseInt(e.params.width),a=parseInt(e.params.height);return(0,Ge.default)(new Uint8Array(await t.arrayBuffer()),[a,r,1])}case"image/x-rgba8":{const r=parseInt(e.params.width),a=parseInt(e.params.height);return(0,Ge.default)(new Uint8Array(await t.arrayBuffer()),[a,r,4])}case"application/octet-stream":case"image/png":case"image/jpeg":case"image/jpg":case"image/webp":{const r=await createImageBitmap(t),a=Ha(r);return(0,Ge.default)(new Uint8Array(a.data),[a.height,a.width,4])}default:throw new Error(`Invalid format: ${e.type} with params: ${e.params}`)}}async function Wa(t,e=.8,r="image/png"){const[a,n,s]=t.shape;switch(r){case"image/x-alpha8":case"image/x-rgba8":{const u=Ot.create(r,{width:n.toString(),height:a.toString()});return new Blob([t.data],{type:u.toString()})}case"image/png":case"image/jpeg":case"image/webp":{const u=new ImageData(new Uint8ClampedArray(t.data),n,a);var i=At(u.width,u.height),o=i.getContext("2d");return o.putImageData(u,0,0),i.convertToBlob({quality:e,type:r})}default:throw new Error(`Invalid format: ${r}`)}}function qa(t){return new RegExp("^(?:[a-z+]+:)?//","i").test(t)}function Ga(t,e){return qa(t)?t:new URL(t,e).href}function Ha(t){var e=At(t.width,t.height),r=e.getContext("2d");return r.drawImage(t,0,0),r.getImageData(0,0,e.width,e.height)}function Ja(t){if(typeof Uint8Array<"u")return new Uint8Array(t);if(typeof Uint8ClampedArray<"u")return new Uint8ClampedArray(t);if(typeof Uint16Array<"u")return new Uint16Array(t);if(typeof Uint32Array<"u")return new Uint32Array(t);if(typeof Float32Array<"u")return new Float32Array(t);if(typeof Float64Array<"u")return new Float64Array(t);throw new Error("TypedArray not supported")}function mt(t,e,r,a=!1){const[n,s,i]=t.shape;let o=s/e,u=n/r;a&&(o=u=Math.max(o,u)>1?Math.max(o,u):Math.min(o,u));const c=(0,ct.default)(Ja(i*e*r),[r,e,i]);for(let h=0;h<r;h++)for(let v=0;v<e;v++){const _=v*o,p=h*u,O=Math.max(Math.floor(_),0),b=Math.min(Math.ceil(_),s-1),j=Math.max(Math.floor(p),0),S=Math.min(Math.ceil(p),n-1),R=_-O,N=p-j;for(let E=0;E<i;E++){const Be=t.get(j,O,E),We=t.get(j,b,E),T=t.get(S,O,E),Oe=t.get(S,b,E),Ae=(1-R)*(1-N)*Be+R*(1-N)*We+(1-R)*N*T+R*N*Oe;c.set(h,v,E,Ae)}}return c}function Ya(t,e=[128,128,128],r=[256,256,256]){var a=t.data;const[n,s,i]=t.shape,o=n*s,u=new Float32Array(3*o);for(let c=0,h=0;c<a.length;c+=4,h+=1)u[h]=(a[c]-e[0])/r[0],u[h+o]=(a[c+1]-e[1])/r[1],u[h+o+o]=(a[c+2]-e[2])/r[2];return(0,ct.default)(u,[1,3,n,s])}async function Ka(t,e){return typeof t=="string"&&(t=Ga(t,e.publicPath),t=new URL(t)),t instanceof URL&&(t=await(await fetch(t,{})).blob()),(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t=new Blob([t])),t instanceof Blob&&(t=await Ba(t)),t}function Xa(t){const e=new Uint8Array(t.data.length);for(let r=0;r<t.data.length;r++)e[r]=t.data[r]*255;return(0,ct.default)(e,t.shape)}function At(t,e){let r;if(typeof OffscreenCanvas<"u"?r=new OffscreenCanvas(t,e):r=document.createElement("canvas"),!r)throw new Error("Canvas nor OffscreenCanvas are available in the current context.");return r}var Qa=Ue(Ve()),St=async()=>navigator.gpu===void 0?!1:await navigator.gpu.requestAdapter()!==null,en=()=>navigator.hardwareConcurrency??4;async function vt(t,e){return URL.createObjectURL(await Zt(t,e))}
2async function Zt(t,e){const r=new URL("resources.json",e.publicPath),a=await fetch(r);if(!a.ok)throw new Error("Resource metadata not found. Ensure that the config.publicPath is configured correctly.");const s=(await a.json())[t];if(!s)throw new Error(`Resource ${t} not found. Ensure that the config.publicPath is configured correctly.`);const i=s.chunks;let o=0;const u=i.map(async v=>{const _=v.offsets[1]-v.offsets[0],p=e.publicPath?new URL(v.name,e.publicPath).toString():v.name,b=await(await fetch(p,e.fetchArgs)).blob();if(_!==b.size)throw new Error(`Failed to fetch ${t} with size ${_} but got ${b.size}`);return e.progress&&(o+=_,e.progress(`fetch:${t}`,o,s.size)),b}),c=await Promise.all(u),h=new Blob(c,{type:s.mime});if(h.size!==s.size)throw new Error(`Failed to fetch ${t} with size ${s.size} but got ${h.size}`);return h}var ie=null,Et=async t=>(ie!==null||(t?ie=(await lt(async()=>{const{default:e}=await import("./ort.webgpu.bundle.min-CElWvg4j.js");return{default:e}},[])).default:ie=(await lt(async()=>{const{default:e}=await import("./ort.bundle.min-DAXuwjBG.js");return{default:e}},[])).default),ie);async function tn(t,e){const r=e.device==="gpu"&&await St(),a=r&&e.proxyToWorker,n=[r?"webgpu":"wasm"],s=await Et(r);e.debug&&(console.debug(" Using WebGPU:",r),console.debug(" Proxy to Worker:",a),s.env.debug=!0,s.env.logLevel="verbose"),s.env.wasm.numThreads=en(),s.env.wasm.proxy=a;const i=r?"/onnxruntime-web/ort-wasm-simd-threaded.jsep":"/onnxruntime-web/ort-wasm-simd-threaded",o=await vt(`${i}.wasm`,e),u=await vt(`${i}.mjs`,e);s.env.wasm.wasmPaths={mjs:u,wasm:o},e.debug&&console.debug("ort.env.wasm:",s.env.wasm);const c={executionProviders:n,graphOptimizationLevel:"all",executionMode:"parallel",enableCpuMemArena:!0};return await s.InferenceSession.create(t,c).catch(v=>{throw new Error(`Failed to create session: "${v}". Please check if the publicPath is set correctly.`)})}async function rn(t,e,r,a){const n=a.device==="gpu"&&await St(),s=await Et(n),i={};for(const[c,h]of e)i[c]=new s.Tensor("float32",new Float32Array(h.data),h.shape);const o=await t.run(i,{}),u=[];for(const c of r){const h=o[c],v=h.dims,_=h.data,p=(0,Qa.default)(_,v);u.push(p)}return u}var C;(function(t){t.assertEqual=n=>n;function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{const s={};for(const i of n)s[i]=i;return s},t.getValidEnumValues=n=>{const s=t.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of s)i[o]=n[o];return t.objectValues(i)},t.objectValues=n=>t.objectKeys(n).map(function(s){return n[s]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const s=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&s.push(i);return s},t.find=(n,s)=>{for(const i of n)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function a(n,s=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=a,t.jsonStringifyReplacer=(n,s)=>typeof s=="bigint"?s.toString():s})(C||(C={}));var Ye;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ye||(Ye={}));var f=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=t=>{switch(typeof t){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(t)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.unknown}}
vendor: 22,537 bytes, line 2
2,d=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),an=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),$=class It extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(s){return s.message},a={_errors:[]},n=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)a._errors.push(r(i));else{let o=a,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(r(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return n(this),a}static assert(e){if(!(e instanceof It))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},a=[];for(const n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};$.create=t=>new $(t);var K=(t,e)=>{let r;switch(t.code){case d.invalid_type:t.received===f.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case d.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:r=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case d.invalid_union:r="Invalid input";break;case d.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case d.invalid_enum_value:r=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case d.invalid_arguments:r="Invalid function arguments";break;case d.invalid_return_type:r="Invalid function return type";break;case d.invalid_date:r="Invalid date";break;case d.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case d.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case d.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case d.custom:r="Invalid input";break;case d.invalid_intersection_types:r="Intersection results could not be merged";break;case d.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case d.not_finite:r="Number must be finite";break;default:r=e.defaultError,C.assertNever(t)}return{message:r}},Rt=K;function nn(t){Rt=t}function Ie(){return Rt}var Re=t=>{const{data:e,path:r,errorMaps:a,issueData:n}=t,s=[...r,...n.path||[]],i={...n,path:s};if(n.message!==void 0)return{...n,path:s,message:n.message};let o="";const u=a.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return{...n,path:s,message:o}},sn=[];function l(t,e){const r=Ie(),a=Re({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===K?void 0:K].filter(n=>!!n)});t.common.issues.push(a)}var I=class Nt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const a=[];for(const n of r){if(n.status==="aborted")return g;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){const a=[];for(const n of r){const s=await n.key,i=await n.value;a.push({key:s,value:i})}return Nt.mergeObjectSync(e,a)}static mergeObjectSync(e,r){const a={};for(const n of r){const{key:s,value:i}=n;if(s.status==="aborted"||i.status==="aborted")return g;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(a[s.value]=i.value)}return{status:e.value,value:a}}},g=Object.freeze({status:"aborted"}),Y=t=>({status:"dirty",value:t}),Z=t=>({status:"valid",value:t}),Ke=t=>t.status==="aborted",Xe=t=>t.status==="dirty",G=t=>t.status==="valid",le=t=>typeof Promise<"u"&&t instanceof Promise;function Ne(t,e,r,a){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Pt(t,e,r,a,n){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}var m;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));var oe,ce,U=class{constructor(t,e,r,a){this._cachedPath=[],this.parent=t,this.data=e,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},_t=(t,e)=>{if(G(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new $(t.common.issues);return this._error=r,this._error}}};function x(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:a,description:n}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{var u,c;const{message:h}=t;return i.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:(u=h??a)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(c=h??r)!==null&&c!==void 0?c:o.defaultError}},description:n}}var k=class{get description(){return this._def.description}_getType(t){return L(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:L(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new I,ctx:{common:t.parent.common,data:t.data,parsedType:L(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const e=this._parse(t);if(le(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(t){const e=this._parse(t);return Promise.resolve(e)}parse(t,e){const r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){var r;const a={common:{issues:[],async:(r=e?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:L(t)},n=this._parseSync({data:t,path:a.path,parent:a});return _t(a,n)}"~validate"(t){var e,r;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:L(t)};if(!this["~standard"].async)try{const n=this._parseSync({data:t,path:[],parent:a});return G(n)?{value:n.value}:{issues:a.common.issues}}catch(n){!((r=(e=n?.message)===null||e===void 0?void 0:e.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:a}).then(n=>G(n)?{value:n.value}:{issues:a.common.issues})}async parseAsync(t,e){const r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){const r={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:L(t)},a=this._parse({data:t,path:r.path,parent:r}),n=await(le(a)?a:Promise.resolve(a));return _t(r,n)}refine(t,e){const r=a=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(a):e;return this._refinement((a,n)=>{const s=t(a),i=()=>n.addIssue({code:d.custom,...r(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(o=>o?!0:(i(),!1)):s?!0:(i(),!1)})}refinement(t,e){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof e=="function"?e(r,a):e),!1))}_refinement(t){return new z({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return D.create(this,this._def)}nullable(){return W.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return H.create(this)}promise(){return ee.create(this,this._def)}or(t){return ye.create([this,t],this._def)}and(t){return ge.create(this,t,this._def)}transform(t){return new z({...x(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const e=typeof t=="function"?t:()=>t;return new ke({...x(this._def),innerType:this,defaultValue:e,typeName:y.ZodDefault})}brand(){return new ut({typeName:y.ZodBranded,type:this,...x(this._def)})}catch(t){const e=typeof t=="function"?t:()=>t;return new Te({...x(this._def),innerType:this,catchValue:e,typeName:y.ZodCatch})}describe(t){const e=this.constructor;return new e({...this._def,description:t})}pipe(t){return dt.create(this,t)}readonly(){return Ce.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},on=/^c[^\s-]{8,}$/i,cn=/^[0-9a-z]+$/,un=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dn=/^[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,ln=/^[a-z0-9_-]{21}$/i,fn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hn=/^[-+]?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)?)??$/,pn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",He,vn=/^(?:(?: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])$/,_n=/^(?:(?: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])$/,yn=/^(([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]))$/,gn=/^(([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])$/,bn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Mt="((\\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])))",xn=new RegExp(`^${Mt}$`);function $t(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function kn(t){return new RegExp(`^${$t(t)}$`)}function zt(t){let e=`${Mt}T${$t(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Tn(t,e){return!!((e==="v4"||!e)&&vn.test(t)||(e==="v6"||!e)&&yn.test(t))}function Cn(t,e){if(!fn.test(t))return!1;try{const[r]=t.split("."),a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function jn(t,e){return!!((e==="v4"||!e)&&_n.test(t)||(e==="v6"||!e)&&gn.test(t))}var X=class ue extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const s=this._getOrReturnCtx(e);return l(s,{code:d.invalid_type,expected:f.string,received:s.parsedType}),g}const a=new I;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if(s.kind==="length"){const i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:d.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&l(n,{code:d.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if(s.kind==="email")pn.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:d.invalid_string,message:s.message}),a.dirty());else if(s.kind==="emoji")He||(He=new RegExp(mn,"u")),He.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:d.invalid_string,message:s.message}),a.dirty());else if(s.kind==="uuid")dn.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:d.invalid_string,message:s.message}),a.dirty());else if(s.kind==="nanoid")ln.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:d.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid")on.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:d.invalid_string,message:s.message}),a.dirty());else if(s.kind==="cuid2")cn.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:d.invalid_string,message:s.message}),a.dirty());else if(s.kind==="ulid")un.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:d.invalid_string,message:s.message}),a.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:d.invalid_string,message:s.message}),a.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:d.invalid_string,message:s.message}),a.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty()):s.kind==="datetime"?zt(s).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_string,validation:"datetime",message:s.message}),a.dirty()):s.kind==="date"?xn.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_string,validation:"date",message:s.message}),a.dirty()):s.kind==="time"?kn(s).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_string,validation:"time",message:s.message}),a.dirty()):s.kind==="duration"?hn.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:d.invalid_string,message:s.message}),a.dirty()):s.kind==="ip"?Tn(e.data,s.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:d.invalid_string,message:s.message}),a.dirty()):s.kind==="jwt"?Cn(e.data,s.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:d.invalid_string,message:s.message}),a.dirty()):s.kind==="cidr"?jn(e.data,s.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:d.invalid_string,message:s.message}),a.dirty()):s.kind==="base64"?bn.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:d.invalid_string,message:s.message}),a.dirty()):s.kind==="base64url"?wn.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:d.invalid_string,message:s.message}),a.dirty()):C.assertNever(s);return{status:a.value,value:e.data}}_regex(e,r,a){return this.refinement(n=>e.test(n),{validation:r,code:d.invalid_string,...m.errToObj(a)})}_addCheck(e){return new ue({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){var r,a;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:(r=e?.offset)!==null&&r!==void 0?r:!1,local:(a=e?.local)!==null&&a!==void 0?a:!1,...m.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,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...m.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...m.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...m.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...m.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...m.errToObj(r)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new ue({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ue({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ue({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}
vendor: 36,314 bytes, line 2
2get 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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};X.create=t=>{var e;return new X({checks:[],typeName:y.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...x(t)})};function On(t,e){const r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=r>a?r:a,s=parseInt(t.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return s%i/Math.pow(10,n)}var fe=class Qe extends k{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)!==f.number){const s=this._getOrReturnCtx(e);return l(s,{code:d.invalid_type,expected:f.number,received:s.parsedType}),g}let a;const n=new I;for(const s of this._def.checks)s.kind==="int"?C.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:d.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:d.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:d.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?On(e.data,s.value)!==0&&(a=this._getOrReturnCtx(e,a),l(a,{code:d.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:d.not_finite,message:s.message}),n.dirty()):C.assertNever(s);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,m.toString(r))}gt(e,r){return this.setLimit("min",e,!1,m.toString(r))}lte(e,r){return this.setLimit("max",e,!0,m.toString(r))}lt(e,r){return this.setLimit("max",e,!1,m.toString(r))}setLimit(e,r,a,n){return new Qe({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:m.toString(n)}]})}_addCheck(e){return new Qe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(r)&&Number.isFinite(e)}};fe.create=t=>new fe({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,...x(t)});var he=class et extends k{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)!==f.bigint)return this._getInvalidInput(e);let a;const n=new I;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:d.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(a=this._getOrReturnCtx(e,a),l(a,{code:d.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),l(a,{code:d.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):C.assertNever(s);return{status:n.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:f.bigint,received:r.parsedType}),g}gte(e,r){return this.setLimit("min",e,!0,m.toString(r))}gt(e,r){return this.setLimit("min",e,!1,m.toString(r))}lte(e,r){return this.setLimit("max",e,!0,m.toString(r))}lt(e,r){return this.setLimit("max",e,!1,m.toString(r))}setLimit(e,r,a,n){return new et({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:m.toString(n)}]})}_addCheck(e){return new et({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};he.create=t=>{var e;return new he({checks:[],typeName:y.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...x(t)})};var pe=class extends k{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==f.boolean){const r=this._getOrReturnCtx(t);return l(r,{code:d.invalid_type,expected:f.boolean,received:r.parsedType}),g}return Z(t.data)}};pe.create=t=>new pe({typeName:y.ZodBoolean,coerce:t?.coerce||!1,...x(t)});var me=class Dt extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const s=this._getOrReturnCtx(e);return l(s,{code:d.invalid_type,expected:f.date,received:s.parsedType}),g}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return l(s,{code:d.invalid_date}),g}const a=new I;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):C.assertNever(s);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Dt({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};me.create=t=>new me({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,...x(t)});var Pe=class extends k{_parse(t){if(this._getType(t)!==f.symbol){const r=this._getOrReturnCtx(t);return l(r,{code:d.invalid_type,expected:f.symbol,received:r.parsedType}),g}return Z(t.data)}};Pe.create=t=>new Pe({typeName:y.ZodSymbol,...x(t)});var ve=class extends k{_parse(t){if(this._getType(t)!==f.undefined){const r=this._getOrReturnCtx(t);return l(r,{code:d.invalid_type,expected:f.undefined,received:r.parsedType}),g}return Z(t.data)}};ve.create=t=>new ve({typeName:y.ZodUndefined,...x(t)});var _e=class extends k{_parse(t){if(this._getType(t)!==f.null){const r=this._getOrReturnCtx(t);return l(r,{code:d.invalid_type,expected:f.null,received:r.parsedType}),g}return Z(t.data)}};_e.create=t=>new _e({typeName:y.ZodNull,...x(t)});var Q=class extends k{constructor(){super(...arguments),this._any=!0}_parse(t){return Z(t.data)}};Q.create=t=>new Q({typeName:y.ZodAny,...x(t)});var q=class extends k{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Z(t.data)}};q.create=t=>new q({typeName:y.ZodUnknown,...x(t)});var F=class extends k{_parse(t){const e=this._getOrReturnCtx(t);return l(e,{code:d.invalid_type,expected:f.never,received:e.parsedType}),g}};F.create=t=>new F({typeName:y.ZodNever,...x(t)});var Me=class extends k{_parse(t){if(this._getType(t)!==f.undefined){const r=this._getOrReturnCtx(t);return l(r,{code:d.invalid_type,expected:f.void,received:r.parsedType}),g}return Z(t.data)}};Me.create=t=>new Me({typeName:y.ZodVoid,...x(t)});var H=class Se extends k{_parse(e){const{ctx:r,status:a}=this._processInputParams(e),n=this._def;if(r.parsedType!==f.array)return l(r,{code:d.invalid_type,expected:f.array,received:r.parsedType}),g;if(n.exactLength!==null){const i=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(i||o)&&(l(r,{code:i?d.too_big:d.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(l(r,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(l(r,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>n.type._parseAsync(new U(r,i,r.path,o)))).then(i=>I.mergeArray(a,i));const s=[...r.data].map((i,o)=>n.type._parseSync(new U(r,i,r.path,o)));return I.mergeArray(a,s)}get element(){return this._def.type}min(e,r){return new Se({...this._def,minLength:{value:e,message:m.toString(r)}})}max(e,r){return new Se({...this._def,maxLength:{value:e,message:m.toString(r)}})}length(e,r){return new Se({...this._def,exactLength:{value:e,message:m.toString(r)}})}nonempty(e){return this.min(1,e)}};H.create=(t,e)=>new H({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...x(e)});function J(t){if(t instanceof P){const e={};for(const r in t.shape){const a=t.shape[r];e[r]=D.create(J(a))}return new P({...t._def,shape:()=>e})}else return t instanceof H?new H({...t._def,type:J(t.element)}):t instanceof D?D.create(J(t.unwrap())):t instanceof W?W.create(J(t.unwrap())):t instanceof B?B.create(t.items.map(e=>J(e))):t}var P=class M extends k{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(),r=C.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==f.object){const c=this._getOrReturnCtx(e);return l(c,{code:d.invalid_type,expected:f.object,received:c.parsedType}),g}const{status:a,ctx:n}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof F&&this._def.unknownKeys==="strip"))for(const c in n.data)i.includes(c)||o.push(c);const u=[];for(const c of i){const h=s[c],v=n.data[c];u.push({key:{status:"valid",value:c},value:h._parse(new U(n,v,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof F){const c=this._def.unknownKeys;if(c==="passthrough")for(const h of o)u.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(c==="strict")o.length>0&&(l(n,{code:d.unrecognized_keys,keys:o}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const h of o){const v=n.data[h];u.push({key:{status:"valid",value:h},value:c._parse(new U(n,v,n.path,h)),alwaysSet:h in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const c=[];for(const h of u){const v=await h.key,_=await h.value;c.push({key:v,value:_,alwaysSet:h.alwaysSet})}return c}).then(c=>I.mergeObjectSync(a,c)):I.mergeObjectSync(a,u)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new M({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{var n,s,i,o;const u=(i=(s=(n=this._def).errorMap)===null||s===void 0?void 0:s.call(n,r,a).message)!==null&&i!==void 0?i:a.defaultError;return r.code==="unrecognized_keys"?{message:(o=m.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new M({...this._def,unknownKeys:"strip"})}passthrough(){return new M({...this._def,unknownKeys:"passthrough"})}extend(e){return new M({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new M({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new M({...this._def,catchall:e})}pick(e){const r={};return C.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(r[a]=this.shape[a])}),new M({...this._def,shape:()=>r})}omit(e){const r={};return C.objectKeys(this.shape).forEach(a=>{e[a]||(r[a]=this.shape[a])}),new M({...this._def,shape:()=>r})}deepPartial(){return J(this)}partial(e){const r={};return C.objectKeys(this.shape).forEach(a=>{const n=this.shape[a];e&&!e[a]?r[a]=n:r[a]=n.optional()}),new M({...this._def,shape:()=>r})}required(e){const r={};return C.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])r[a]=this.shape[a];else{let s=this.shape[a];for(;s instanceof D;)s=s._def.innerType;r[a]=s}}),new M({...this._def,shape:()=>r})}keyof(){return Wt(C.objectKeys(this.shape))}};P.create=(t,e)=>new P({shape:()=>t,unknownKeys:"strip",catchall:F.create(),typeName:y.ZodObject,...x(e)});P.strictCreate=(t,e)=>new P({shape:()=>t,unknownKeys:"strict",catchall:F.create(),typeName:y.ZodObject,...x(e)});P.lazycreate=(t,e)=>new P({shape:t,unknownKeys:"strip",catchall:F.create(),typeName:y.ZodObject,...x(e)});var ye=class extends k{_parse(t){const{ctx:e}=this._processInputParams(t),r=this._def.options;function a(n){for(const i of n)if(i.result.status==="valid")return i.result;for(const i of n)if(i.result.status==="dirty")return e.common.issues.push(...i.ctx.common.issues),i.result;const s=n.map(i=>new $(i.ctx.common.issues));return l(e,{code:d.invalid_union,unionErrors:s}),g}if(e.common.async)return Promise.all(r.map(async n=>{const s={...e,common:{...e.common,issues:[]},parent:null};return{result:await n._parseAsync({data:e.data,path:e.path,parent:s}),ctx:s}})).then(a);{let n;const s=[];for(const o of r){const u={...e,common:{...e.common,issues:[]},parent:null},c=o._parseSync({data:e.data,path:e.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!n&&(n={result:c,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(n)return e.common.issues.push(...n.ctx.common.issues),n.result;const i=s.map(o=>new $(o));return l(e,{code:d.invalid_union,unionErrors:i}),g}}get options(){return this._def.options}};ye.create=(t,e)=>new ye({options:t,typeName:y.ZodUnion,...x(e)});var V=t=>t instanceof be?V(t.schema):t instanceof z?V(t.innerType()):t instanceof we?[t.value]:t instanceof je?t.options:t instanceof xe?C.objectValues(t.enum):t instanceof ke?V(t._def.innerType):t instanceof ve?[void 0]:t instanceof _e?[null]:t instanceof D?[void 0,...V(t.unwrap())]:t instanceof W?[null,...V(t.unwrap())]:t instanceof ut||t instanceof Ce?V(t.unwrap()):t instanceof Te?V(t._def.innerType):[],Ut=class Vt extends k{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return l(r,{code:d.invalid_type,expected:f.object,received:r.parsedType}),g;const a=this.discriminator,n=r.data[a],s=this.optionsMap.get(n);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(l(r,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),g)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){const n=new Map;for(const s of r){const i=V(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,s)}}return new Vt({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...x(a)})}};function tt(t,e){const r=L(t),a=L(e);if(t===e)return{valid:!0,data:t};if(r===f.object&&a===f.object){const n=C.objectKeys(e),s=C.objectKeys(t).filter(o=>n.indexOf(o)!==-1),i={...t,...e};for(const o of s){const u=tt(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(r===f.array&&a===f.array){if(t.length!==e.length)return{valid:!1};const n=[];for(let s=0;s<t.length;s++){const i=t[s],o=e[s],u=tt(i,o);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===f.date&&a===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ge=class extends k{_parse(t){const{status:e,ctx:r}=this._processInputParams(t),a=(n,s)=>{if(Ke(n)||Ke(s))return g;const i=tt(n.value,s.value);return i.valid?((Xe(n)||Xe(s))&&e.dirty(),{status:e.value,value:i.data}):(l(r,{code:d.invalid_intersection_types}),g)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,s])=>a(n,s)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ge.create=(t,e,r)=>new ge({left:t,right:e,typeName:y.ZodIntersection,...x(r)});var B=class Lt extends k{_parse(e){const{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==f.array)return l(a,{code:d.invalid_type,expected:f.array,received:a.parsedType}),g;if(a.data.length<this._def.items.length)return l(a,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&a.data.length>this._def.items.length&&(l(a,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const s=[...a.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new U(a,i,a.path,o)):null}).filter(i=>!!i);return a.common.async?Promise.all(s).then(i=>I.mergeArray(r,i)):I.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Lt({...this._def,rest:e})}};B.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new B({items:t,typeName:y.ZodTuple,rest:null,...x(e)})};var Ft=class rt extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==f.object)return l(a,{code:d.invalid_type,expected:f.object,received:a.parsedType}),g;const n=[],s=this._def.keyType,i=this._def.valueType;for(const o in a.data)n.push({key:s._parse(new U(a,o,a.path,o)),value:i._parse(new U(a,a.data[o],a.path,o)),alwaysSet:o in a.data});return a.common.async?I.mergeObjectAsync(r,n):I.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof k?new rt({keyType:e,valueType:r,typeName:y.ZodRecord,...x(a)}):new rt({keyType:X.create(),valueType:e,typeName:y.ZodRecord,...x(r)})}},$e=class extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==f.map)return l(r,{code:d.invalid_type,expected:f.map,received:r.parsedType}),g;const a=this._def.keyType,n=this._def.valueType,s=[...r.data.entries()].map(([i,o],u)=>({key:a._parse(new U(r,i,r.path,[u,"key"])),value:n._parse(new U(r,o,r.path,[u,"value"]))}));if(r.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const o of s){const u=await o.key,c=await o.value;if(u.status==="aborted"||c.status==="aborted")return g;(u.status==="dirty"||c.status==="dirty")&&e.dirty(),i.set(u.value,c.value)}return{status:e.value,value:i}})}else{const i=new Map;for(const o of s){const u=o.key,c=o.value;if(u.status==="aborted"||c.status==="aborted")return g;(u.status==="dirty"||c.status==="dirty")&&e.dirty(),i.set(u.value,c.value)}return{status:e.value,value:i}}}};$e.create=(t,e,r)=>new $e({valueType:e,keyType:t,typeName:y.ZodMap,...x(r)});var ze=class at extends k{_parse(e){const{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==f.set)return l(a,{code:d.invalid_type,expected:f.set,received:a.parsedType}),g;const n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(l(a,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(l(a,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());const s=this._def.valueType;function i(u){const c=new Set;for(const h of u){if(h.status==="aborted")return g;h.status==="dirty"&&r.dirty(),c.add(h.value)}return{status:r.value,value:c}}const o=[...a.data.values()].map((u,c)=>s._parse(new U(a,u,a.path,c)));return a.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,r){return new at({...this._def,minSize:{value:e,message:m.toString(r)}})}max(e,r){return new at({...this._def,maxSize:{value:e,message:m.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};ze.create=(t,e)=>new ze({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,...x(e)});var Bt=class Ze extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.function)return l(r,{code:d.invalid_type,expected:f.function,received:r.parsedType}),g;function a(o,u){return Re({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ie(),K].filter(c=>!!c),issueData:{code:d.invalid_arguments,argumentsError:u}})}function n(o,u){return Re({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ie(),K].filter(c=>!!c),issueData:{code:d.invalid_return_type,returnTypeError:u}})}const s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof ee){const o=this;return Z(async function(...u){const c=new $([]),h=await o._def.args.parseAsync(u,s).catch(p=>{throw c.addIssue(a(u,p)),c}),v=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(v,s).catch(p=>{throw c.addIssue(n(v,p)),c})})}else{const o=this;return Z(function(...u){const c=o._def.args.safeParse(u,s);if(!c.success)throw new $([a(u,c.error)]);const h=Reflect.apply(i,this,c.data),v=o._def.returns.safeParse(h,s);if(!v.success)throw new $([n(h,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ze({...this._def,args:B.create(e).rest(q.create())})}returns(e){return new Ze({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new Ze({args:e||B.create([]).rest(q.create()),returns:r||q.create(),typeName:y.ZodFunction,...x(a)})}},be=class extends k{get schema(){return this._def.getter()}_parse(t){const{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};be.create=(t,e)=>new be({getter:t,typeName:y.ZodLazy,...x(e)});var we=class extends k{_parse(t){if(t.data!==this._def.value){const e=this._getOrReturnCtx(t);return l(e,{received:e.data,code:d.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:t.data}}get value(){return this._def.value}};we.create=(t,e)=>new we({value:t,typeName:y.ZodLiteral,...x(e)});function Wt(t,e){return new je({values:t,typeName:y.ZodEnum,...x(e)})}var je=class nt extends k{constructor(){super(...arguments),oe.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),a=this._def.values;return l(r,{expected:C.joinValues(a),received:r.parsedType,code:d.invalid_type}),g}if(Ne(this,oe)||Pt(this,oe,new Set(this._def.values)),!Ne(this,oe).has(e.data)){const r=this._getOrReturnCtx(e),a=this._def.values;return l(r,{received:r.data,code:d.invalid_enum_value,options:a}),g}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return nt.create(e,{...this._def,...r})}exclude(e,r=this._def){return nt.create(this.options.filter(a=>!e.includes(a)),{...this._def,...r})}};oe=new WeakMap;je.create=Wt;var xe=class extends k{constructor(){super(...arguments),ce.set(this,void 0)}_parse(t){const e=C.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==f.string&&r.parsedType!==f.number){const a=C.objectValues(e);return l(r,{expected:C.joinValues(a),received:r.parsedType,code:d.invalid_type}),g}if(Ne(this,ce)||Pt(this,ce,new Set(C.getValidEnumValues(this._def.values))),!Ne(this,ce).has(t.data)){const a=C.objectValues(e);return l(r,{received:r.data,code:d.invalid_enum_value,options:a}),g}return Z(t.data)}get enum(){return this._def.values}};ce=new WeakMap;xe.create=(t,e)=>new xe({values:t,typeName:y.ZodNativeEnum,...x(e)});var ee=class extends k{unwrap(){return this._def.type}_parse(t){const{ctx:e}=this._processInputParams(t);if(e.parsedType!==f.promise&&e.common.async===!1)return l(e,{code:d.invalid_type,expected:f.promise,received:e.parsedType}),g;const r=e.parsedType===f.promise?e.data:Promise.resolve(e.data);return Z(r.then(a=>this._def.type.parseAsync(a,{path:e.path,errorMap:e.common.contextualErrorMap})))}};ee.create=(t,e)=>new ee({type:t,typeName:y.ZodPromise,...x(e)});var z=class extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:e,ctx:r}=this._processInputParams(t),a=this._def.effect||null,n={addIssue:s=>{l(r,s),s.fatal?e.abort():e.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const s=a.transform(r.data,n);if(r.common.async)return Promise.resolve(s).then(async i=>{if(e.value==="aborted")return g;const o=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});return o.status==="aborted"?g:o.status==="dirty"||e.value==="dirty"?Y(o.value):o});{if(e.value==="aborted")return g;const i=this._def.schema._parseSync({data:s,path:r.path,parent:r});return i.status==="aborted"?g:i.status==="dirty"||e.value==="dirty"?Y(i.value):i}}if(a.type==="refinement"){const s=i=>{const o=a.refinement(i,n);if(r.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?g:(i.status==="dirty"&&e.dirty(),s(i.value),{status:e.value,value:i.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>i.status==="aborted"?g:(i.status==="dirty"&&e.dirty(),s(i.value).then(()=>({status:e.value,value:i.value}))))}if(a.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!G(s))return s;const i=a.transform(s.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>G(s)?Promise.resolve(a.transform(s.value,n)).then(i=>({status:e.value,value:i})):s);C.assertNever(a)}};z.create=(t,e,r)=>new z({schema:t,typeName:y.ZodEffects,effect:e,...x(r)});z.createWithPreprocess=(t,e,r)=>new z({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,...x(r)});var D=class extends k{_parse(t){return this._getType(t)===f.undefined?Z(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};D.create=(t,e)=>new D({innerType:t,typeName:y.ZodOptional,...x(e)});var W=class extends k{_parse(t){return this._getType(t)===f.null?Z(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};W.create=(t,e)=>new W({innerType:t,typeName:y.ZodNullable,...x(e)});var ke=class extends k{_parse(t){const{ctx:e}=this._processInputParams(t);let r=e.data;return e.parsedType===f.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};ke.create=(t,e)=>new ke({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});var Te=class extends k{_parse(t){const{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return le(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new $(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new $(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Te.create=(t,e)=>new Te({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});var De=class extends k{_parse(t){if(this._getType(t)!==f.nan){const r=this._getOrReturnCtx(t);return l(r,{code:d.invalid_type,expected:f.nan,received:r.parsedType}),g}return{status:"valid",value:t.data}}};De.create=t=>new De({typeName:y.ZodNaN,...x(t)});var An=Symbol("zod_brand"),ut=class extends k{_parse(t){const{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}},dt=class qt extends k{_parse(e){const{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?g:s.status==="dirty"?(r.dirty(),Y(s.value)):this._def.out._parseAsync({data:s.value,path:a.path,parent:a})})();{const n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?g:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,r){return new qt({in:e,out:r,typeName:y.ZodPipeline})}},Ce=class extends k{_parse(t){const e=this._def.innerType._parse(t),r=a=>(G(a)&&(a.value=Object.freeze(a.value)),a);return le(e)?e.then(a=>r(a)):r(e)}unwrap(){return this._def.innerType}};Ce.create=(t,e)=>new Ce({innerType:t,typeName:y.ZodReadonly,...x(e)});function yt(t,e){const r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Gt(t,e={},r){return t?Q.create().superRefine((a,n)=>{var s,i;const o=t(a);if(o instanceof Promise)return o.then(u=>{var c,h;if(!u){const v=yt(e,a),_=(h=(c=v.fatal)!==null&&c!==void 0?c:r)!==null&&h!==void 0?h:!0;n.addIssue({code:"custom",...v,fatal:_})}});if(!o){const u=yt(e,a),c=(i=(s=u.fatal)!==null&&s!==void 0?s:r)!==null&&i!==void 0?i:!0;n.addIssue({code:"custom",...u,fatal:c})}}):Q.create()}var Sn={object:P.lazycreate},y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(y||(y={}));var Zn=(t,e={message:`Input not instance of ${t.name}`})=>Gt(r=>r instanceof t,e),Ht=X.create,Jt=fe.create,En=De.create,In=he.create,Yt=pe.create,Rn=me.create,Nn=Pe.create,Pn=ve.create,Mn=_e.create,$n=Q.create,zn=q.create,Dn=F.create,Un=Me.create,Vn=H.create,Ln=P.create,Fn=P.strictCreate,Bn=ye.create,Wn=Ut.create,qn=ge.create,Gn=B.create,Hn=Ft.create,Jn=$e.create,Yn=ze.create,Kn=Bt.create,Xn=be.create,Qn=we.create,es=je.create,ts=xe.create,rs=ee.create,gt=z.create,as=D.create,ns=W.create,ss=z.createWithPreprocess,is=dt.create,os=()=>Ht().optional(),cs=()=>Jt().optional(),us=()=>Yt().optional(),ds={string:t=>X.create({...t,coerce:!0}),number:t=>fe.create({...t,coerce:!0}),boolean:t=>pe.create({...t,coerce:!0}),bigint:t=>he.create({...t,coerce:!0}),date:t=>me.create({...t,coerce:!0})},ls=g,A=Object.freeze({__proto__:null,defaultErrorMap:K,setErrorMap:nn,getErrorMap:Ie,makeIssue:Re,EMPTY_PATH:sn,addIssueToContext:l,ParseStatus:I,INVALID:g,DIRTY:Y,OK:Z,isAborted:Ke,isDirty:Xe,isValid:G,isAsync:le,get util(){return C},get objectUtil(){return Ye},ZodParsedType:f,getParsedType:L,ZodType:k,datetimeRegex:zt,ZodString:X,ZodNumber:fe,ZodBigInt:he,ZodBoolean:pe,ZodDate:me,ZodSymbol:Pe,ZodUndefined:ve,ZodNull:_e,ZodAny:Q,ZodUnknown:q,ZodNever:F,ZodVoid:Me,ZodArray:H,ZodObject:P,ZodUnion:ye,ZodDiscriminatedUnion:Ut,ZodIntersection:ge,ZodTuple:B,ZodRecord:Ft,ZodMap:$e,ZodSet:ze,ZodFunction:Bt,ZodLazy:be,ZodLiteral:we,ZodEnum:je,ZodNativeEnum:xe,ZodPromise:ee,ZodEffects:z,ZodTransformer:z,ZodOptional:D,ZodNullable:W,ZodDefault:ke,ZodCatch:Te,ZodNaN:De,BRAND:An,ZodBranded:ut,ZodPipeline:dt,ZodReadonly:Ce,custom:Gt,Schema:k,ZodSchema:k,late:Sn,get ZodFirstPartyTypeKind(){return y},coerce:ds,any:$n,array:Vn,bigint:In,boolean:Yt,date:Rn,discriminatedUnion:Wn,effect:gt,enum:es,function:Kn,instanceof:Zn,intersection:qn,lazy:Xn,literal:Qn,map:Jn,nan:En,nativeEnum:ts,never:Dn,null:Mn,nullable:ns,number:Jt,object:Ln,oboolean:us,onumber:cs,optional:as,ostring:os,pipeline:is,preprocess:ss,promise:rs,record:Hn,set:Yn,strictObject:Fn,string:Ht,symbol:Nn,transformer:gt,tuple:Gn,undefined:Pn,union:Bn,unknown:zn,void:Un,NEVER:ls,ZodIssueCode:d,quotelessJson:an,ZodError:$}),bt={name:"@imgly/background-removal",version:"1.7.0"},fs=A.object({publicPath:A.string().optional().describe("The public path to the wasm files and the onnx model.").default("https://staticimgly.com/@imgly/background-removal-data/${PACKAGE_VERSION}/dist/").transform(t=>
2t.replace("${PACKAGE_NAME}",bt.name).replace("${PACKAGE_VERSION}",bt.version)),debug:A.boolean().default(!1).describe("Whether to enable debug logging."),rescale:A.boolean().default(!0).describe("Whether to rescale the image."),device:A.enum(["cpu","gpu"]).default("cpu").describe("The device to run the model on."),proxyToWorker:A.boolean().default(!1).describe("Whether to proxy inference to a web worker."),fetchArgs:A.any().default({}).describe("Arguments to pass to fetch when loading the model."),progress:A.function().args(A.string(),A.number(),A.number()).returns(A.void()).describe("Progress callback.").optional(),model:A.preprocess(t=>{switch(t){case"large":return"isnet";case"small":return"isnet_quint8";case"medium":return"isnet_fp16";default:return t}},A.enum(["isnet","isnet_fp16","isnet_quint8"])).default("medium"),output:A.object({format:A.enum(["image/png","image/jpeg","image/webp","image/x-rgba8","image/x-alpha8"]).default("image/png"),quality:A.number().default(.8)}).default({})}).default({}).transform(t=>(t.debug&&console.log("Config:",t),t.debug&&!t.progress&&(t.progress=t.progress??((e,r,a)=>{console.debug(`Downloading ${e}: ${r} of ${a}`)}),crossOriginIsolated||t.debug&&console.debug("Cross-Origin-Isolated is not enabled. Performance will be degraded. Please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer.")),t));function hs(t){return fs.parse(t??{})}var ps=Ue(Ve());async function ms(t){t.debug&&console.debug("Loading model...",t.model);const e=t.model,a=await(await Zt(`/models/${e}`,t)).arrayBuffer();return await tn(a,t)}async function vs(t){t=hs(t);const e=await ms(t);return{config:t,session:{base:e}}}async function _s(t,e,r){const[n,s,i]=t.shape,o=!1;let u=mt(t,1024,1024,o);const c=Ya(u);let h=await rn(r.base,[["input",c]],["output"],e),v=(0,ps.default)(h[0].data,[1024,1024,1]),_=Xa(v);return e.rescale?(_=mt(_,s,n,o),[_,t]):[_,u]}var ys=Fa(vs,t=>JSON.stringify(t));async function bs(t,e){const{config:r,session:a}=await ys(e);r.progress&&r.progress("compute:decode",0,4);const n=await Ka(t,r);r.progress?.("compute:inference",1,4);const[s,i]=await _s(n,r,a);r.progress?.("compute:mask",2,4);const o=i,[u,c]=o.shape,h=u*c;for(let _=0;_<h;_+=1)o.data[4*_+3]=s.data[_];r.progress?.("compute:encode",3,4);const v=await Wa(o,r.output.quality,r.output.format);return r.progress?.("compute:encode",4,4),v}export{bs as removeBackground};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.