@fern-api/java-dynamic-snippets 4.1.0 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- var Dr=Object.defineProperty;var Hi=(n,e,t)=>e in n?Dr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e)=>()=>(n&&(e=n(n=0)),e);var cr=(n,e)=>{for(var t in e)Dr(n,t,{get:e[t],enumerable:!0})};var R=(n,e,t)=>Hi(n,typeof e!="symbol"?e+"":e,t);var m=pt(()=>{"use strict"});var T={};cr(T,{_debugEnd:()=>Sn,_debugProcess:()=>Cn,_events:()=>Gn,_eventsCount:()=>Hn,_exiting:()=>pn,_fatalExceptions:()=>Rn,_getActiveHandles:()=>hn,_getActiveRequests:()=>mn,_kill:()=>gn,_linkedBinding:()=>ln,_maxListeners:()=>Zn,_preload_modules:()=>qn,_rawDebug:()=>on,_startProfilerIdleNotifier:()=>Ln,_stopProfilerIdleNotifier:()=>Bn,_tickCallback:()=>An,abort:()=>Un,addListener:()=>Jn,allowedNodeEnvironmentFlags:()=>_n,arch:()=>Zr,argv:()=>Jr,argv0:()=>Vn,assert:()=>kn,binding:()=>en,browser:()=>sn,chdir:()=>nn,config:()=>dn,cpuUsage:()=>Vt,cwd:()=>rn,debugPort:()=>Dn,default:()=>aa,dlopen:()=>fn,domain:()=>cn,emit:()=>ea,emitWarning:()=>Xr,env:()=>Hr,execArgv:()=>Yr,execPath:()=>$n,exit:()=>bn,features:()=>Nn,hasUncaughtExceptionCaptureCallback:()=>En,hrtime:()=>Dt,kill:()=>wn,listeners:()=>na,memoryUsage:()=>vn,moduleLoadList:()=>un,nextTick:()=>qr,off:()=>Kn,on:()=>Te,once:()=>Yn,openStdin:()=>Tn,pid:()=>jn,platform:()=>Gr,ppid:()=>Mn,prependListener:()=>ta,prependOnceListener:()=>ra,reallyExit:()=>yn,release:()=>an,removeAllListeners:()=>Xn,removeListener:()=>Qn,resourceUsage:()=>xn,setSourceMapsEnabled:()=>Wn,setUncaughtExceptionCaptureCallback:()=>In,stderr:()=>Fn,stdin:()=>On,stdout:()=>Pn,title:()=>zr,umask:()=>tn,uptime:()=>zn,version:()=>Kr,versions:()=>Qr});function fr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function Ji(){!dt||!Fe||(dt=!1,Fe.length?be=Fe.concat(be):$t=-1,be.length&&Vr())}function Vr(){if(!dt){var n=setTimeout(Ji,0);dt=!0;for(var e=be.length;e;){for(Fe=be,be=[];++$t<e;)Fe&&Fe[$t].run();$t=-1,e=be.length}Fe=null,dt=!1,clearTimeout(n)}}function qr(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];be.push(new Wr(n,e)),be.length===1&&!dt&&setTimeout(Vr,0)}function Wr(n,e){this.fun=n,this.array=e}function ee(){}function ln(n){fr("_linkedBinding")}function fn(n){fr("dlopen")}function mn(){return[]}function hn(){return[]}function kn(n,e){if(!n)throw new Error(e||"assertion error")}function En(){return!1}function zn(){return Ae.now()/1e3}function Dt(n){var e=Math.floor((Date.now()-Ae.now())*.001),t=Ae.now()*.001,r=Math.floor(t)+e,a=Math.floor(t%1*1e9);return n&&(r=r-n[0],a=a-n[1],a<0&&(r--,a+=dr)),[r,a]}function Te(){return aa}function na(n){return[]}var be,dt,Fe,$t,zr,Zr,Gr,Hr,Jr,Yr,Kr,Qr,Xr,en,tn,rn,nn,an,sn,on,un,cn,pn,dn,yn,gn,Vt,xn,vn,wn,bn,Tn,_n,Nn,Rn,In,An,Cn,Sn,Ln,Bn,Pn,Fn,On,Un,jn,Mn,$n,Dn,Vn,qn,Wn,Ae,pr,dr,Zn,Gn,Hn,Jn,Yn,Kn,Qn,Xn,ea,ta,ra,aa,ia=pt(()=>{"use strict";m();y();h();be=[],dt=!1,$t=-1;Wr.prototype.run=function(){this.fun.apply(null,this.array)};zr="browser",Zr="x64",Gr="browser",Hr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Jr=["/usr/bin/node"],Yr=[],Kr="v16.8.0",Qr={},Xr=function(n,e){console.warn((e?e+": ":"")+n)},en=function(n){fr("binding")},tn=function(n){return 0},rn=function(){return"/"},nn=function(n){},an={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};sn=!0,on=ee,un=[];cn={},pn=!1,dn={};yn=ee,gn=ee,Vt=function(){return{}},xn=Vt,vn=Vt,wn=ee,bn=ee,Tn=ee,_n={};Nn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Rn=ee,In=ee;An=ee,Cn=ee,Sn=ee,Ln=ee,Bn=ee,Pn=void 0,Fn=void 0,On=void 0,Un=ee,jn=2,Mn=1,$n="/bin/usr/node",Dn=9229,Vn="node",qn=[],Wn=ee,Ae={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ae.now===void 0&&(pr=Date.now(),Ae.timing&&Ae.timing.navigationStart&&(pr=Ae.timing.navigationStart),Ae.now=()=>Date.now()-pr);dr=1e9;Dt.bigint=function(n){var e=Dt(n);return typeof BigInt>"u"?e[0]*dr+e[1]:BigInt(e[0]*dr)+BigInt(e[1])};Zn=10,Gn={},Hn=0;Jn=Te,Yn=Te,Kn=Te,Qn=Te,Xn=Te,ea=ee,ta=Te,ra=Te;aa={version:Kr,versions:Qr,arch:Zr,platform:Gr,browser:sn,release:an,_rawDebug:on,moduleLoadList:un,binding:en,_linkedBinding:ln,_events:Gn,_eventsCount:Hn,_maxListeners:Zn,on:Te,addListener:Jn,once:Yn,off:Kn,removeListener:Qn,removeAllListeners:Xn,emit:ea,prependListener:ta,prependOnceListener:ra,listeners:na,domain:cn,_exiting:pn,config:dn,dlopen:fn,uptime:zn,_getActiveRequests:mn,_getActiveHandles:hn,reallyExit:yn,_kill:gn,cpuUsage:Vt,resourceUsage:xn,memoryUsage:vn,kill:wn,exit:bn,openStdin:Tn,allowedNodeEnvironmentFlags:_n,assert:kn,features:Nn,_fatalExceptions:Rn,setUncaughtExceptionCaptureCallback:In,hasUncaughtExceptionCaptureCallback:En,emitWarning:Xr,nextTick:qr,_tickCallback:An,_debugProcess:Cn,_debugEnd:Sn,_startProfilerIdleNotifier:Ln,_stopProfilerIdleNotifier:Bn,stdout:Pn,stdin:On,stderr:Fn,abort:Un,umask:tn,chdir:nn,cwd:rn,env:Hr,title:zr,argv:Jr,execArgv:Yr,pid:jn,ppid:Mn,execPath:$n,debugPort:Dn,hrtime:Dt,argv0:Vn,_preload_modules:qn,setSourceMapsEnabled:Wn}});var h=pt(()=>{"use strict";ia()});function Yi(){if(sa)return _t;sa=!0,_t.byteLength=p,_t.toByteArray=w,_t.fromByteArray=J;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=r.length;a<o;++a)n[a]=r[a],e[r.charCodeAt(a)]=a;e[45]=62,e[95]=63;function u(C){var S=C.length;if(S%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var q=C.indexOf("=");q===-1&&(q=S);var K=q===S?0:4-q%4;return[q,K]}function p(C){var S=u(C),q=S[0],K=S[1];return(q+K)*3/4-K}function x(C,S,q){return(S+q)*3/4-q}function w(C){var S,q=u(C),K=q[0],ne=q[1],Y=new t(x(C,K,ne)),ae=0,ce=ne>0?K-4:K,re;for(re=0;re<ce;re+=4)S=e[C.charCodeAt(re)]<<18|e[C.charCodeAt(re+1)]<<12|e[C.charCodeAt(re+2)]<<6|e[C.charCodeAt(re+3)],Y[ae++]=S>>16&255,Y[ae++]=S>>8&255,Y[ae++]=S&255;return ne===2&&(S=e[C.charCodeAt(re)]<<2|e[C.charCodeAt(re+1)]>>4,Y[ae++]=S&255),ne===1&&(S=e[C.charCodeAt(re)]<<10|e[C.charCodeAt(re+1)]<<4|e[C.charCodeAt(re+2)]>>2,Y[ae++]=S>>8&255,Y[ae++]=S&255),Y}function _(C){return n[C>>18&63]+n[C>>12&63]+n[C>>6&63]+n[C&63]}function B(C,S,q){for(var K,ne=[],Y=S;Y<q;Y+=3)K=(C[Y]<<16&16711680)+(C[Y+1]<<8&65280)+(C[Y+2]&255),ne.push(_(K));return ne.join("")}function J(C){for(var S,q=C.length,K=q%3,ne=[],Y=16383,ae=0,ce=q-K;ae<ce;ae+=Y)ne.push(B(C,ae,ae+Y>ce?ce:ae+Y));return K===1?(S=C[q-1],ne.push(n[S>>2]+n[S<<4&63]+"==")):K===2&&(S=(C[q-2]<<8)+C[q-1],ne.push(n[S>>10]+n[S>>4&63]+n[S<<2&63]+"=")),ne.join("")}return _t}function Ki(){if(oa)return qt;oa=!0;return qt.read=function(n,e,t,r,a){var o,u,p=a*8-r-1,x=(1<<p)-1,w=x>>1,_=-7,B=t?a-1:0,J=t?-1:1,C=n[e+B];for(B+=J,o=C&(1<<-_)-1,C>>=-_,_+=p;_>0;o=o*256+n[e+B],B+=J,_-=8);for(u=o&(1<<-_)-1,o>>=-_,_+=r;_>0;u=u*256+n[e+B],B+=J,_-=8);if(o===0)o=1-w;else{if(o===x)return u?NaN:(C?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-w}return(C?-1:1)*u*Math.pow(2,o-r)},qt.write=function(n,e,t,r,a,o){var u,p,x,w=o*8-a-1,_=(1<<w)-1,B=_>>1,J=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=r?0:o-1,S=r?1:-1,q=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,u=_):(u=Math.floor(Math.log(e)/Math.LN2),e*(x=Math.pow(2,-u))<1&&(u--,x*=2),u+B>=1?e+=J/x:e+=J*Math.pow(2,1-B),e*x>=2&&(u++,x/=2),u+B>=_?(p=0,u=_):u+B>=1?(p=(e*x-1)*Math.pow(2,a),u=u+B):(p=e*Math.pow(2,B-1)*Math.pow(2,a),u=0));a>=8;n[t+C]=p&255,C+=S,p/=256,a-=8);for(u=u<<a|p,w+=a;w>0;n[t+C]=u&255,C+=S,u/=256,w-=8);n[t+C-S]|=q*128},qt}function la(){if(ua)return Oe;ua=!0;let n=Yi(),e=Ki(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=u,Oe.SlowBuffer=ne,Oe.INSPECT_MAX_BYTES=50;let r=2147483647;Oe.kMaxLength=r,u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let l=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(l,i),l.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function o(l){if(l>r)throw new RangeError('The value "'+l+'" is invalid for option "size"');let i=new Uint8Array(l);return Object.setPrototypeOf(i,u.prototype),i}function u(l,i,s){if(typeof l=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _(l)}return p(l,i,s)}u.poolSize=8192;function p(l,i,s){if(typeof l=="string")return B(l,i);if(ArrayBuffer.isView(l))return C(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(ye(l,ArrayBuffer)||l&&ye(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(l,SharedArrayBuffer)||l&&ye(l.buffer,SharedArrayBuffer)))return S(l,i,s);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=l.valueOf&&l.valueOf();if(c!=null&&c!==l)return u.from(c,i,s);let f=q(l);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return u.from(l[Symbol.toPrimitive]("string"),i,s);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}u.from=function(l,i,s){return p(l,i,s)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function x(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function w(l,i,s){return x(l),l<=0?o(l):i!==void 0?typeof s=="string"?o(l).fill(i,s):o(l).fill(i):o(l)}u.alloc=function(l,i,s){return w(l,i,s)};function _(l){return x(l),o(l<0?0:K(l)|0)}u.allocUnsafe=function(l){return _(l)},u.allocUnsafeSlow=function(l){return _(l)};function B(l,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=Y(l,i)|0,c=o(s),f=c.write(l,i);return f!==s&&(c=c.slice(0,f)),c}function J(l){let i=l.length<0?0:K(l.length)|0,s=o(i);for(let c=0;c<i;c+=1)s[c]=l[c]&255;return s}function C(l){if(ye(l,Uint8Array)){let i=new Uint8Array(l);return S(i.buffer,i.byteOffset,i.byteLength)}return J(l)}function S(l,i,s){if(i<0||l.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<i+(s||0))throw new RangeError('"length" is outside of buffer bounds');let c;return i===void 0&&s===void 0?c=new Uint8Array(l):s===void 0?c=new Uint8Array(l,i):c=new Uint8Array(l,i,s),Object.setPrototypeOf(c,u.prototype),c}function q(l){if(u.isBuffer(l)){let i=K(l.length)|0,s=o(i);return s.length===0||l.copy(s,0,0,i),s}if(l.length!==void 0)return typeof l.length!="number"||lr(l.length)?o(0):J(l);if(l.type==="Buffer"&&Array.isArray(l.data))return J(l.data)}function K(l){if(l>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return l|0}function ne(l){return+l!=l&&(l=0),u.alloc(+l)}u.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==u.prototype},u.compare=function(i,s){if(ye(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),ye(s,Uint8Array)&&(s=u.from(s,s.offset,s.byteLength)),!u.isBuffer(i)||!u.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===s)return 0;let c=i.length,f=s.length;for(let g=0,v=Math.min(c,f);g<v;++g)if(i[g]!==s[g]){c=i[g],f=s[g];break}return c<f?-1:f<c?1:0},u.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return u.alloc(0);let c;if(s===void 0)for(s=0,c=0;c<i.length;++c)s+=i[c].length;let f=u.allocUnsafe(s),g=0;for(c=0;c<i.length;++c){let v=i[c];if(ye(v,Uint8Array))g+v.length>f.length?(u.isBuffer(v)||(v=u.from(v)),v.copy(f,g)):Uint8Array.prototype.set.call(f,v,g);else if(u.isBuffer(v))v.copy(f,g);else throw new TypeError('"list" argument must be an Array of Buffers');g+=v.length}return f};function Y(l,i){if(u.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||ye(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let s=l.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&s===0)return 0;let f=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return ur(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return $r(l).length;default:if(f)return c?-1:ur(l).length;i=(""+i).toLowerCase(),f=!0}}u.byteLength=Y;function ae(l,i,s){let c=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((s===void 0||s>this.length)&&(s=this.length),s<=0)||(s>>>=0,i>>>=0,s<=i))return"";for(l||(l="utf8");;)switch(l){case"hex":return Mi(this,i,s);case"utf8":case"utf-8":return Sr(this,i,s);case"ascii":return Ui(this,i,s);case"latin1":case"binary":return ji(this,i,s);case"base64":return Fi(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $i(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0}}u.prototype._isBuffer=!0;function ce(l,i,s){let c=l[i];l[i]=l[s],l[s]=c}u.prototype.swap16=function(){let i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let s=0;s<i;s+=2)ce(this,s,s+1);return this},u.prototype.swap32=function(){let i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let s=0;s<i;s+=4)ce(this,s,s+3),ce(this,s+1,s+2);return this},u.prototype.swap64=function(){let i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let s=0;s<i;s+=8)ce(this,s,s+7),ce(this,s+1,s+6),ce(this,s+2,s+5),ce(this,s+3,s+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Sr(this,0,i):ae.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(i){if(!u.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:u.compare(this,i)===0},u.prototype.inspect=function(){let i="",s=Oe.INSPECT_MAX_BYTES;return i=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(i+=" ... "),"<Buffer "+i+">"},t&&(u.prototype[t]=u.prototype.inspect),u.prototype.compare=function(i,s,c,f,g){if(ye(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),!u.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(s===void 0&&(s=0),c===void 0&&(c=i?i.length:0),f===void 0&&(f=0),g===void 0&&(g=this.length),s<0||c>i.length||f<0||g>this.length)throw new RangeError("out of range index");if(f>=g&&s>=c)return 0;if(f>=g)return-1;if(s>=c)return 1;if(s>>>=0,c>>>=0,f>>>=0,g>>>=0,this===i)return 0;let v=g-f,j=c-s,G=Math.min(v,j),z=this.slice(f,g),H=i.slice(s,c);for(let W=0;W<G;++W)if(z[W]!==H[W]){v=z[W],j=H[W];break}return v<j?-1:j<v?1:0};function re(l,i,s,c,f){if(l.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,lr(s)&&(s=f?0:l.length-1),s<0&&(s=l.length+s),s>=l.length){if(f)return-1;s=l.length-1}else if(s<0)if(f)s=0;else return-1;if(typeof i=="string"&&(i=u.from(i,c)),u.isBuffer(i))return i.length===0?-1:Cr(l,i,s,c,f);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(l,i,s):Uint8Array.prototype.lastIndexOf.call(l,i,s):Cr(l,[i],s,c,f);throw new TypeError("val must be string, number or Buffer")}function Cr(l,i,s,c,f){let g=1,v=l.length,j=i.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(l.length<2||i.length<2)return-1;g=2,v/=2,j/=2,s/=2}function G(H,W){return g===1?H[W]:H.readUInt16BE(W*g)}let z;if(f){let H=-1;for(z=s;z<v;z++)if(G(l,z)===G(i,H===-1?0:z-H)){if(H===-1&&(H=z),z-H+1===j)return H*g}else H!==-1&&(z-=z-H),H=-1}else for(s+j>v&&(s=v-j),z=s;z>=0;z--){let H=!0;for(let W=0;W<j;W++)if(G(l,z+W)!==G(i,W)){H=!1;break}if(H)return z}return-1}u.prototype.includes=function(i,s,c){return this.indexOf(i,s,c)!==-1},u.prototype.indexOf=function(i,s,c){return re(this,i,s,c,!0)},u.prototype.lastIndexOf=function(i,s,c){return re(this,i,s,c,!1)};function Ci(l,i,s,c){s=Number(s)||0;let f=l.length-s;c?(c=Number(c),c>f&&(c=f)):c=f;let g=i.length;c>g/2&&(c=g/2);let v;for(v=0;v<c;++v){let j=parseInt(i.substr(v*2,2),16);if(lr(j))return v;l[s+v]=j}return v}function Si(l,i,s,c){return Mt(ur(i,l.length-s),l,s,c)}function Li(l,i,s,c){return Mt(Wi(i),l,s,c)}function Bi(l,i,s,c){return Mt($r(i),l,s,c)}function Pi(l,i,s,c){return Mt(zi(i,l.length-s),l,s,c)}u.prototype.write=function(i,s,c,f){if(s===void 0)f="utf8",c=this.length,s=0;else if(c===void 0&&typeof s=="string")f=s,c=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(c)?(c=c>>>0,f===void 0&&(f="utf8")):(f=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let g=this.length-s;if((c===void 0||c>g)&&(c=g),i.length>0&&(c<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let v=!1;for(;;)switch(f){case"hex":return Ci(this,i,s,c);case"utf8":case"utf-8":return Si(this,i,s,c);case"ascii":case"latin1":case"binary":return Li(this,i,s,c);case"base64":return Bi(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pi(this,i,s,c);default:if(v)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),v=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Fi(l,i,s){return i===0&&s===l.length?n.fromByteArray(l):n.fromByteArray(l.slice(i,s))}function Sr(l,i,s){s=Math.min(l.length,s);let c=[],f=i;for(;f<s;){let g=l[f],v=null,j=g>239?4:g>223?3:g>191?2:1;if(f+j<=s){let G,z,H,W;switch(j){case 1:g<128&&(v=g);break;case 2:G=l[f+1],(G&192)===128&&(W=(g&31)<<6|G&63,W>127&&(v=W));break;case 3:G=l[f+1],z=l[f+2],(G&192)===128&&(z&192)===128&&(W=(g&15)<<12|(G&63)<<6|z&63,W>2047&&(W<55296||W>57343)&&(v=W));break;case 4:G=l[f+1],z=l[f+2],H=l[f+3],(G&192)===128&&(z&192)===128&&(H&192)===128&&(W=(g&15)<<18|(G&63)<<12|(z&63)<<6|H&63,W>65535&&W<1114112&&(v=W))}}v===null?(v=65533,j=1):v>65535&&(v-=65536,c.push(v>>>10&1023|55296),v=56320|v&1023),c.push(v),f+=j}return Oi(c)}let Lr=4096;function Oi(l){let i=l.length;if(i<=Lr)return String.fromCharCode.apply(String,l);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,l.slice(c,c+=Lr));return s}function Ui(l,i,s){let c="";s=Math.min(l.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(l[f]&127);return c}function ji(l,i,s){let c="";s=Math.min(l.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(l[f]);return c}function Mi(l,i,s){let c=l.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let f="";for(let g=i;g<s;++g)f+=Zi[l[g]];return f}function $i(l,i,s){let c=l.slice(i,s),f="";for(let g=0;g<c.length-1;g+=2)f+=String.fromCharCode(c[g]+c[g+1]*256);return f}u.prototype.slice=function(i,s){let c=this.length;i=~~i,s=s===void 0?c:~~s,i<0?(i+=c,i<0&&(i=0)):i>c&&(i=c),s<0?(s+=c,s<0&&(s=0)):s>c&&(s=c),s<i&&(s=i);let f=this.subarray(i,s);return Object.setPrototypeOf(f,u.prototype),f};function Q(l,i,s){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+i>s)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i],g=1,v=0;for(;++v<s&&(g*=256);)f+=this[i+v]*g;return f},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i+--s],g=1;for(;s>0&&(g*=256);)f+=this[i+--s]*g;return f},u.prototype.readUint8=u.prototype.readUInt8=function(i,s){return i=i>>>0,s||Q(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||Q(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||Q(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,g=this[++i]+this[++i]*2**8+this[++i]*2**16+c*2**24;return BigInt(f)+(BigInt(g)<<BigInt(32))}),u.prototype.readBigUInt64BE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=s*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],g=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c;return(BigInt(f)<<BigInt(32))+BigInt(g)}),u.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i],g=1,v=0;for(;++v<s&&(g*=256);)f+=this[i+v]*g;return g*=128,f>=g&&(f-=Math.pow(2,8*s)),f},u.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=s,g=1,v=this[i+--f];for(;f>0&&(g*=256);)v+=this[i+--f]*g;return g*=128,v>=g&&(v-=Math.pow(2,8*s)),v},u.prototype.readInt8=function(i,s){return i=i>>>0,s||Q(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,s){i=i>>>0,s||Q(i,2,this.length);let c=this[i]|this[i+1]<<8;return c&32768?c|4294901760:c},u.prototype.readInt16BE=function(i,s){i=i>>>0,s||Q(i,2,this.length);let c=this[i+1]|this[i]<<8;return c&32768?c|4294901760:c},u.prototype.readInt32LE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},u.prototype.readInt32BE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(c<<24);return(BigInt(f)<<BigInt(32))+BigInt(s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=(s<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(f)<<BigInt(32))+BigInt(this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c)}),u.prototype.readFloatLE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),e.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),e.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||Q(i,8,this.length),e.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||Q(i,8,this.length),e.read(this,i,!1,52,8)};function ie(l,i,s,c,f,g){if(!u.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>f||i<g)throw new RangeError('"value" argument is out of bounds');if(s+c>l.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let j=Math.pow(2,8*c)-1;ie(this,i,s,c,j,0)}let g=1,v=0;for(this[s]=i&255;++v<c&&(g*=256);)this[s+v]=i/g&255;return s+c},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let j=Math.pow(2,8*c)-1;ie(this,i,s,c,j,0)}let g=c-1,v=1;for(this[s+g]=i&255;--g>=0&&(v*=256);)this[s+g]=i/v&255;return s+c},u.prototype.writeUint8=u.prototype.writeUInt8=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,1,255,0),this[s]=i&255,s+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,65535,0),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,65535,0),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,4294967295,0),this[s+3]=i>>>24,this[s+2]=i>>>16,this[s+1]=i>>>8,this[s]=i&255,s+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,4294967295,0),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4};function Br(l,i,s,c,f){Mr(i,c,f,l,s,7);let g=Number(i&BigInt(4294967295));l[s++]=g,g=g>>8,l[s++]=g,g=g>>8,l[s++]=g,g=g>>8,l[s++]=g;let v=Number(i>>BigInt(32)&BigInt(4294967295));return l[s++]=v,v=v>>8,l[s++]=v,v=v>>8,l[s++]=v,v=v>>8,l[s++]=v,s}function Pr(l,i,s,c,f){Mr(i,c,f,l,s,7);let g=Number(i&BigInt(4294967295));l[s+7]=g,g=g>>8,l[s+6]=g,g=g>>8,l[s+5]=g,g=g>>8,l[s+4]=g;let v=Number(i>>BigInt(32)&BigInt(4294967295));return l[s+3]=v,v=v>>8,l[s+2]=v,v=v>>8,l[s+1]=v,v=v>>8,l[s]=v,s+8}u.prototype.writeBigUInt64LE=Ee(function(i,s=0){return Br(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Ee(function(i,s=0){return Pr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let G=Math.pow(2,8*c-1);ie(this,i,s,c,G-1,-G)}let g=0,v=1,j=0;for(this[s]=i&255;++g<c&&(v*=256);)i<0&&j===0&&this[s+g-1]!==0&&(j=1),this[s+g]=(i/v>>0)-j&255;return s+c},u.prototype.writeIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let G=Math.pow(2,8*c-1);ie(this,i,s,c,G-1,-G)}let g=c-1,v=1,j=0;for(this[s+g]=i&255;--g>=0&&(v*=256);)i<0&&j===0&&this[s+g+1]!==0&&(j=1),this[s+g]=(i/v>>0)-j&255;return s+c},u.prototype.writeInt8=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,1,127,-128),i<0&&(i=255+i+1),this[s]=i&255,s+1},u.prototype.writeInt16LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,32767,-32768),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeInt16BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,32767,-32768),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeInt32LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,2147483647,-2147483648),this[s]=i&255,this[s+1]=i>>>8,this[s+2]=i>>>16,this[s+3]=i>>>24,s+4},u.prototype.writeInt32BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4},u.prototype.writeBigInt64LE=Ee(function(i,s=0){return Br(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Ee(function(i,s=0){return Pr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Fr(l,i,s,c,f,g){if(s+c>l.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Or(l,i,s,c,f){return i=+i,s=s>>>0,f||Fr(l,i,s,4),e.write(l,i,s,c,23,4),s+4}u.prototype.writeFloatLE=function(i,s,c){return Or(this,i,s,!0,c)},u.prototype.writeFloatBE=function(i,s,c){return Or(this,i,s,!1,c)};function Ur(l,i,s,c,f){return i=+i,s=s>>>0,f||Fr(l,i,s,8),e.write(l,i,s,c,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,c){return Ur(this,i,s,!0,c)},u.prototype.writeDoubleBE=function(i,s,c){return Ur(this,i,s,!1,c)},u.prototype.copy=function(i,s,c,f){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(c||(c=0),!f&&f!==0&&(f=this.length),s>=i.length&&(s=i.length),s||(s=0),f>0&&f<c&&(f=c),f===c||i.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),i.length-s<f-c&&(f=i.length-s+c);let g=f-c;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,c,f):Uint8Array.prototype.set.call(i,this.subarray(c,f),s),g},u.prototype.fill=function(i,s,c,f){if(typeof i=="string"){if(typeof s=="string"?(f=s,s=0,c=this.length):typeof c=="string"&&(f=c,c=this.length),f!==void 0&&typeof f!="string")throw new TypeError("encoding must be a string");if(typeof f=="string"&&!u.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(i.length===1){let v=i.charCodeAt(0);(f==="utf8"&&v<128||f==="latin1")&&(i=v)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(s<0||this.length<s||this.length<c)throw new RangeError("Out of range index");if(c<=s)return this;s=s>>>0,c=c===void 0?this.length:c>>>0,i||(i=0);let g;if(typeof i=="number")for(g=s;g<c;++g)this[g]=i;else{let v=u.isBuffer(i)?i:u.from(i,f),j=v.length;if(j===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(g=0;g<c-s;++g)this[g+s]=v[g%j]}return this};let lt={};function or(l,i,s){lt[l]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name}get code(){return l}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}or("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),or("ERR_INVALID_ARG_TYPE",function(l,i){return`The "${l}" argument must be of type number. Received type ${typeof i}`},TypeError),or("ERR_OUT_OF_RANGE",function(l,i,s){let c=`The value of "${l}" is out of range.`,f=s;return Number.isInteger(s)&&Math.abs(s)>2**32?f=jr(String(s)):typeof s=="bigint"&&(f=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(f=jr(f)),f+="n"),c+=` It must be ${i}. Received ${f}`,c},RangeError);function jr(l){let i="",s=l.length,c=l[0]==="-"?1:0;for(;s>=c+4;s-=3)i=`_${l.slice(s-3,s)}${i}`;return`${l.slice(0,s)}${i}`}function Di(l,i,s){ct(i,"offset"),(l[i]===void 0||l[i+s]===void 0)&&Tt(i,l.length-(s+1))}function Mr(l,i,s,c,f,g){if(l>s||l<i){let v=typeof i=="bigint"?"n":"",j;throw i===0||i===BigInt(0)?j=`>= 0${v} and < 2${v} ** ${(g+1)*8}${v}`:j=`>= -(2${v} ** ${(g+1)*8-1}${v}) and < 2 ** ${(g+1)*8-1}${v}`,new lt.ERR_OUT_OF_RANGE("value",j,l)}Di(c,f,g)}function ct(l,i){if(typeof l!="number")throw new lt.ERR_INVALID_ARG_TYPE(i,"number",l)}function Tt(l,i,s){throw Math.floor(l)!==l?(ct(l,s),new lt.ERR_OUT_OF_RANGE("offset","an integer",l)):i<0?new lt.ERR_BUFFER_OUT_OF_BOUNDS:new lt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,l)}let Vi=/[^+/0-9A-Za-z-_]/g;function qi(l){if(l=l.split("=")[0],l=l.trim().replace(Vi,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function ur(l,i){i=i||1/0;let s,c=l.length,f=null,g=[];for(let v=0;v<c;++v){if(s=l.charCodeAt(v),s>55295&&s<57344){if(!f){if(s>56319){(i-=3)>-1&&g.push(239,191,189);continue}else if(v+1===c){(i-=3)>-1&&g.push(239,191,189);continue}f=s;continue}if(s<56320){(i-=3)>-1&&g.push(239,191,189),f=s;continue}s=(f-55296<<10|s-56320)+65536}else f&&(i-=3)>-1&&g.push(239,191,189);if(f=null,s<128){if((i-=1)<0)break;g.push(s)}else if(s<2048){if((i-=2)<0)break;g.push(s>>6|192,s&63|128)}else if(s<65536){if((i-=3)<0)break;g.push(s>>12|224,s>>6&63|128,s&63|128)}else if(s<1114112){if((i-=4)<0)break;g.push(s>>18|240,s>>12&63|128,s>>6&63|128,s&63|128)}else throw new Error("Invalid code point")}return g}function Wi(l){let i=[];for(let s=0;s<l.length;++s)i.push(l.charCodeAt(s)&255);return i}function zi(l,i){let s,c,f,g=[];for(let v=0;v<l.length&&!((i-=2)<0);++v)s=l.charCodeAt(v),c=s>>8,f=s%256,g.push(f),g.push(c);return g}function $r(l){return n.toByteArray(qi(l))}function Mt(l,i,s,c){let f;for(f=0;f<c&&!(f+s>=i.length||f>=l.length);++f)i[f+s]=l[f];return f}function ye(l,i){return l instanceof i||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===i.name}function lr(l){return l!==l}let Zi=(function(){let l="0123456789abcdef",i=new Array(256);for(let s=0;s<16;++s){let c=s*16;for(let f=0;f<16;++f)i[c+f]=l[s]+l[f]}return i})();function Ee(l){return typeof BigInt>"u"?Gi:l}function Gi(){throw new Error("BigInt not supported")}return Oe}var _t,sa,qt,oa,Oe,ua,ca=pt(()=>{"use strict";m();y();h();_t={},sa=!1;qt={},oa=!1;Oe={},ua=!1});var Ue,k,Vl,ql,pa=pt(()=>{"use strict";m();y();h();ca();Ue=la();Ue.Buffer;Ue.SlowBuffer;Ue.INSPECT_MAX_BYTES;Ue.kMaxLength;k=Ue.Buffer,Vl=Ue.INSPECT_MAX_BYTES,ql=Ue.kMaxLength});var y=pt(()=>{"use strict";pa()});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var Qi=typeof global=="object"&&global&&global.Object===Object&&global,da=Qi;var Xi=typeof self=="object"&&self&&self.Object===Object&&self,es=da||Xi||Function("return this")(),fa=es;var ts=fa.Symbol,_e=ts;m();y();h();var ma=Object.prototype,rs=ma.hasOwnProperty,ns=ma.toString,kt=_e?_e.toStringTag:void 0;function as(n){var e=rs.call(n,kt),t=n[kt];try{n[kt]=void 0;var r=!0}catch{}var a=ns.call(n);return r&&(e?n[kt]=t:delete n[kt]),a}var ha=as;m();y();h();var is=Object.prototype,ss=is.toString;function os(n){return ss.call(n)}var ya=os;var us="[object Null]",ls="[object Undefined]",ga=_e?_e.toStringTag:void 0;function cs(n){return n==null?n===void 0?ls:us:ga&&ga in Object(n)?ha(n):ya(n)}var xa=cs;m();y();h();function ps(n){return n!=null&&typeof n=="object"}var va=ps;var ds="[object Symbol]";function fs(n){return typeof n=="symbol"||va(n)&&xa(n)==ds}var wa=fs;m();y();h();m();y();h();function ms(n,e){for(var t=-1,r=n==null?0:n.length,a=Array(r);++t<r;)a[t]=e(n[t],t,n);return a}var ba=ms;m();y();h();var hs=Array.isArray,Ta=hs;var ys=1/0,_a=_e?_e.prototype:void 0,ka=_a?_a.toString:void 0;function Na(n){if(typeof n=="string")return n;if(Ta(n))return ba(n,Na)+"";if(wa(n))return ka?ka.call(n):"";var e=n+"";return e=="0"&&1/n==-ys?"-0":e}var Ra=Na;m();y();h();function gs(n){return n==null?"":Ra(n)}var Ce=gs;m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();function xs(n,e,t){var r=-1,a=n.length;e<0&&(e=-e>a?0:a+e),t=t>a?a:t,t<0&&(t+=a),a=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(a);++r<a;)o[r]=n[r+e];return o}var Ia=xs;function vs(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ia(n,e,t)}var Ea=vs;m();y();h();var ws="\\ud800-\\udfff",bs="\\u0300-\\u036f",Ts="\\ufe20-\\ufe2f",_s="\\u20d0-\\u20ff",ks=bs+Ts+_s,Ns="\\ufe0e\\ufe0f",Rs="\\u200d",Is=RegExp("["+Rs+ws+ks+Ns+"]");function Es(n){return Is.test(n)}var Wt=Es;m();y();h();m();y();h();function As(n){return n.split("")}var Aa=As;m();y();h();var Ca="\\ud800-\\udfff",Cs="\\u0300-\\u036f",Ss="\\ufe20-\\ufe2f",Ls="\\u20d0-\\u20ff",Bs=Cs+Ss+Ls,Ps="\\ufe0e\\ufe0f",Fs="["+Ca+"]",mr="["+Bs+"]",hr="\\ud83c[\\udffb-\\udfff]",Os="(?:"+mr+"|"+hr+")",Sa="[^"+Ca+"]",La="(?:\\ud83c[\\udde6-\\uddff]){2}",Ba="[\\ud800-\\udbff][\\udc00-\\udfff]",Us="\\u200d",Pa=Os+"?",Fa="["+Ps+"]?",js="(?:"+Us+"(?:"+[Sa,La,Ba].join("|")+")"+Fa+Pa+")*",Ms=Fa+Pa+js,$s="(?:"+[Sa+mr+"?",mr,La,Ba,Fs].join("|")+")",Ds=RegExp(hr+"(?="+hr+")|"+$s+Ms,"g");function Vs(n){return n.match(Ds)||[]}var Oa=Vs;function qs(n){return Wt(n)?Oa(n):Aa(n)}var Ua=qs;function Ws(n){return function(e){e=Ce(e);var t=Wt(e)?Ua(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ea(t,1).join(""):e.slice(1);return r[n]()+a}}var ja=Ws;var zs=ja("toUpperCase"),Ma=zs;function Zs(n){return Ma(Ce(n).toLowerCase())}var $a=Zs;m();y();h();m();y();h();function Gs(n,e,t,r){var a=-1,o=n==null?0:n.length;for(r&&o&&(t=n[++a]);++a<o;)t=e(t,n[a],a,n);return t}var Da=Gs;m();y();h();m();y();h();m();y();h();function Hs(n){return function(e){return n?.[e]}}var Va=Hs;var Js={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ys=Va(Js),qa=Ys;var Ks=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qs="\\u0300-\\u036f",Xs="\\ufe20-\\ufe2f",eo="\\u20d0-\\u20ff",to=Qs+Xs+eo,ro="["+to+"]",no=RegExp(ro,"g");function ao(n){return n=Ce(n),n&&n.replace(Ks,qa).replace(no,"")}var Wa=ao;m();y();h();m();y();h();var io=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function so(n){return n.match(io)||[]}var za=so;m();y();h();var oo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function uo(n){return oo.test(n)}var Za=uo;m();y();h();var Ka="\\ud800-\\udfff",lo="\\u0300-\\u036f",co="\\ufe20-\\ufe2f",po="\\u20d0-\\u20ff",fo=lo+co+po,Qa="\\u2700-\\u27bf",Xa="a-z\\xdf-\\xf6\\xf8-\\xff",mo="\\xac\\xb1\\xd7\\xf7",ho="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",yo="\\u2000-\\u206f",go=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ei="A-Z\\xc0-\\xd6\\xd8-\\xde",xo="\\ufe0e\\ufe0f",ti=mo+ho+yo+go,ri="['\u2019]",Ga="["+ti+"]",vo="["+fo+"]",ni="\\d+",wo="["+Qa+"]",ai="["+Xa+"]",ii="[^"+Ka+ti+ni+Qa+Xa+ei+"]",bo="\\ud83c[\\udffb-\\udfff]",To="(?:"+vo+"|"+bo+")",_o="[^"+Ka+"]",si="(?:\\ud83c[\\udde6-\\uddff]){2}",oi="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="["+ei+"]",ko="\\u200d",Ha="(?:"+ai+"|"+ii+")",No="(?:"+ft+"|"+ii+")",Ja="(?:"+ri+"(?:d|ll|m|re|s|t|ve))?",Ya="(?:"+ri+"(?:D|LL|M|RE|S|T|VE))?",ui=To+"?",li="["+xo+"]?",Ro="(?:"+ko+"(?:"+[_o,si,oi].join("|")+")"+li+ui+")*",Io="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Eo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ao=li+ui+Ro,Co="(?:"+[wo,si,oi].join("|")+")"+Ao,So=RegExp([ft+"?"+ai+"+"+Ja+"(?="+[Ga,ft,"$"].join("|")+")",No+"+"+Ya+"(?="+[Ga,ft+Ha,"$"].join("|")+")",ft+"?"+Ha+"+"+Ja,ft+"+"+Ya,Eo,Io,ni,Co].join("|"),"g");function Lo(n){return n.match(So)||[]}var ci=Lo;function Bo(n,e,t){return n=Ce(n),e=t?void 0:e,e===void 0?Za(n)?ci(n):za(n):n.match(e)||[]}var pi=Bo;var Po="['\u2019]",Fo=RegExp(Po,"g");function Oo(n){return function(e){return Da(pi(Wa(e).replace(Fo,"")),n,"")}}var di=Oo;var Uo=di(function(n,e,t){return e=e.toLowerCase(),n+(t?$a(e):e)}),yr=Uo;m();y();h();function M(n){throw new Error("Unexpected value: "+JSON.stringify(n))}m();y();h();function gr(n){if(typeof n=="string")return n.length>0?n:"Unknown error";if(n instanceof Error||typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string")return n.message.length>0?n.message:"Unknown error";let e=String(n);return e.length>0?e:"Unknown error"}m();y();h();function Nt(n){return Object.keys(n)}m();y();h();m();y();h();m();y();h();var Rt=T.env.FERN_STACK_TRACK?.toLowerCase()??"",ge=Rt!==""&&Rt!=="0"&&Rt!=="false",xr=["single","multiline","box"].includes(Rt)?Rt:"single";ge&&(Error.stackTraceLimit=50);var jo=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Mo=new Set(["stacktrace"]);function Zt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,formatFilename:p=x=>x}={}){if(!ge)return[];r=[...r,...jo],t=[...t,...Mo],a=[...a,"runInteractiveTask"];let x=!1;return(new Error().stack??"").split(`
2
- `).map(w=>{let _=w.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(_&&_.length===5){let[,B,J,C,S]=_;if(!B||!J||!C||!S)return;if(x||a.some(q=>B?.includes(q))){x=!0;return}switch(B){case"Object.<anonymous>":B="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":B=`${B.substring(B.indexOf(".")+1)}()=> { ... }`;break}return{fn:B,path:p(J),position:`${C}:${S}`}}}).filter(w=>w&&!r.some(_=>w.fn.includes(_))&&!(o&&w.path?.startsWith("node:"))&&!(u&&w.path?.endsWith(".js"))&&!t.some(_=>w.path.includes(_))).slice(e,e+n)}var zt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:u=!0,filterJs:p=!0,multiline:x=!1,formatFilename:w=_=>_}={}){R(this,"maxFrames");R(this,"skip");R(this,"filterPaths");R(this,"filterFunctions");R(this,"stopOn");R(this,"filterNode");R(this,"filterJs");R(this,"multiline");R(this,"formatFilename");R(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=o,this.filterNode=u,this.filterJs=p,this.multiline=x,this.formatFilename=w}tag(e){let t=this.tracking.get(e)||new Set;Zt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>t.add(r)),this.tracking.set(e,t)}trace(e){if(!ge)return"";let t=this.tracking.get(e);return t?[...t].map(r=>`${this.multiline?`
3
- `:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},vr;function fi({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,multiline:p=!1,formatFilename:x=w=>w}={}){ge&&(vr??(vr=new zt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:u,multiline:p,formatFilename:x})))}function mi(n){vr?.tag(n)}function wr(n){return vr?.frames(n)??[]}var je=class{constructor(){mi(this)}};m();y();h();var Gt=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}dispose(){}},It=class extends Gt{async format(e){return e}formatSync(e){return e}};m();y();h();m();y();h();m();y();h();var me=class extends je{constructor(t){super();R(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):typeof this.value=="function"?this.value(t):this.value.write(t)}};var $o=4;fi({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Et=class{constructor(){R(this,"lineBuffer",[]);R(this,"indentLevel",0);R(this,"hasWrittenAnything",!1);R(this,"lastCharacterIsSemicolon",!1);R(this,"lastCharacterIsNewline",!1);R(this,"nodeStackFrames",[])}get buffer(){return ge&&this.nodeStackFrames.length>0&&this.writeInternal(`
1
+ var Vr=Object.defineProperty;var Ji=(n,e,t)=>e in n?Vr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e)=>()=>(n&&(e=n(n=0)),e);var cr=(n,e)=>{for(var t in e)Vr(n,t,{get:e[t],enumerable:!0})};var N=(n,e,t)=>Ji(n,typeof e!="symbol"?e+"":e,t);var m=pt(()=>{"use strict"});var T={};cr(T,{_debugEnd:()=>Sn,_debugProcess:()=>Cn,_events:()=>Gn,_eventsCount:()=>Jn,_exiting:()=>pn,_fatalExceptions:()=>Rn,_getActiveHandles:()=>hn,_getActiveRequests:()=>mn,_kill:()=>gn,_linkedBinding:()=>ln,_maxListeners:()=>Zn,_preload_modules:()=>qn,_rawDebug:()=>on,_startProfilerIdleNotifier:()=>Ln,_stopProfilerIdleNotifier:()=>Bn,_tickCallback:()=>An,abort:()=>Un,addListener:()=>Hn,allowedNodeEnvironmentFlags:()=>_n,arch:()=>Zr,argv:()=>Hr,argv0:()=>Dn,assert:()=>kn,binding:()=>en,browser:()=>sn,chdir:()=>nn,config:()=>dn,cpuUsage:()=>Dt,cwd:()=>rn,debugPort:()=>Vn,default:()=>aa,dlopen:()=>fn,domain:()=>cn,emit:()=>ea,emitWarning:()=>Xr,env:()=>Jr,execArgv:()=>Yr,execPath:()=>$n,exit:()=>bn,features:()=>Nn,hasUncaughtExceptionCaptureCallback:()=>En,hrtime:()=>Vt,kill:()=>wn,listeners:()=>na,memoryUsage:()=>vn,moduleLoadList:()=>un,nextTick:()=>qr,off:()=>Kn,on:()=>Te,once:()=>Yn,openStdin:()=>Tn,pid:()=>jn,platform:()=>Gr,ppid:()=>Mn,prependListener:()=>ta,prependOnceListener:()=>ra,reallyExit:()=>yn,release:()=>an,removeAllListeners:()=>Xn,removeListener:()=>Qn,resourceUsage:()=>xn,setSourceMapsEnabled:()=>Wn,setUncaughtExceptionCaptureCallback:()=>In,stderr:()=>Fn,stdin:()=>On,stdout:()=>Pn,title:()=>zr,umask:()=>tn,uptime:()=>zn,version:()=>Kr,versions:()=>Qr});function fr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function Hi(){!dt||!Fe||(dt=!1,Fe.length?be=Fe.concat(be):$t=-1,be.length&&Dr())}function Dr(){if(!dt){var n=setTimeout(Hi,0);dt=!0;for(var e=be.length;e;){for(Fe=be,be=[];++$t<e;)Fe&&Fe[$t].run();$t=-1,e=be.length}Fe=null,dt=!1,clearTimeout(n)}}function qr(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];be.push(new Wr(n,e)),be.length===1&&!dt&&setTimeout(Dr,0)}function Wr(n,e){this.fun=n,this.array=e}function ee(){}function ln(n){fr("_linkedBinding")}function fn(n){fr("dlopen")}function mn(){return[]}function hn(){return[]}function kn(n,e){if(!n)throw new Error(e||"assertion error")}function En(){return!1}function zn(){return Ae.now()/1e3}function Vt(n){var e=Math.floor((Date.now()-Ae.now())*.001),t=Ae.now()*.001,r=Math.floor(t)+e,a=Math.floor(t%1*1e9);return n&&(r=r-n[0],a=a-n[1],a<0&&(r--,a+=dr)),[r,a]}function Te(){return aa}function na(n){return[]}var be,dt,Fe,$t,zr,Zr,Gr,Jr,Hr,Yr,Kr,Qr,Xr,en,tn,rn,nn,an,sn,on,un,cn,pn,dn,yn,gn,Dt,xn,vn,wn,bn,Tn,_n,Nn,Rn,In,An,Cn,Sn,Ln,Bn,Pn,Fn,On,Un,jn,Mn,$n,Vn,Dn,qn,Wn,Ae,pr,dr,Zn,Gn,Jn,Hn,Yn,Kn,Qn,Xn,ea,ta,ra,aa,ia=pt(()=>{"use strict";m();y();h();be=[],dt=!1,$t=-1;Wr.prototype.run=function(){this.fun.apply(null,this.array)};zr="browser",Zr="x64",Gr="browser",Jr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Hr=["/usr/bin/node"],Yr=[],Kr="v16.8.0",Qr={},Xr=function(n,e){console.warn((e?e+": ":"")+n)},en=function(n){fr("binding")},tn=function(n){return 0},rn=function(){return"/"},nn=function(n){},an={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};sn=!0,on=ee,un=[];cn={},pn=!1,dn={};yn=ee,gn=ee,Dt=function(){return{}},xn=Dt,vn=Dt,wn=ee,bn=ee,Tn=ee,_n={};Nn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Rn=ee,In=ee;An=ee,Cn=ee,Sn=ee,Ln=ee,Bn=ee,Pn=void 0,Fn=void 0,On=void 0,Un=ee,jn=2,Mn=1,$n="/bin/usr/node",Vn=9229,Dn="node",qn=[],Wn=ee,Ae={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ae.now===void 0&&(pr=Date.now(),Ae.timing&&Ae.timing.navigationStart&&(pr=Ae.timing.navigationStart),Ae.now=()=>Date.now()-pr);dr=1e9;Vt.bigint=function(n){var e=Vt(n);return typeof BigInt>"u"?e[0]*dr+e[1]:BigInt(e[0]*dr)+BigInt(e[1])};Zn=10,Gn={},Jn=0;Hn=Te,Yn=Te,Kn=Te,Qn=Te,Xn=Te,ea=ee,ta=Te,ra=Te;aa={version:Kr,versions:Qr,arch:Zr,platform:Gr,browser:sn,release:an,_rawDebug:on,moduleLoadList:un,binding:en,_linkedBinding:ln,_events:Gn,_eventsCount:Jn,_maxListeners:Zn,on:Te,addListener:Hn,once:Yn,off:Kn,removeListener:Qn,removeAllListeners:Xn,emit:ea,prependListener:ta,prependOnceListener:ra,listeners:na,domain:cn,_exiting:pn,config:dn,dlopen:fn,uptime:zn,_getActiveRequests:mn,_getActiveHandles:hn,reallyExit:yn,_kill:gn,cpuUsage:Dt,resourceUsage:xn,memoryUsage:vn,kill:wn,exit:bn,openStdin:Tn,allowedNodeEnvironmentFlags:_n,assert:kn,features:Nn,_fatalExceptions:Rn,setUncaughtExceptionCaptureCallback:In,hasUncaughtExceptionCaptureCallback:En,emitWarning:Xr,nextTick:qr,_tickCallback:An,_debugProcess:Cn,_debugEnd:Sn,_startProfilerIdleNotifier:Ln,_stopProfilerIdleNotifier:Bn,stdout:Pn,stdin:On,stderr:Fn,abort:Un,umask:tn,chdir:nn,cwd:rn,env:Jr,title:zr,argv:Hr,execArgv:Yr,pid:jn,ppid:Mn,execPath:$n,debugPort:Vn,hrtime:Vt,argv0:Dn,_preload_modules:qn,setSourceMapsEnabled:Wn}});var h=pt(()=>{"use strict";ia()});function Yi(){if(sa)return _t;sa=!0,_t.byteLength=p,_t.toByteArray=w,_t.fromByteArray=P;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=r.length;a<o;++a)n[a]=r[a],e[r.charCodeAt(a)]=a;e[45]=62,e[95]=63;function u(A){var S=A.length;if(S%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var W=A.indexOf("=");W===-1&&(W=S);var K=W===S?0:4-W%4;return[W,K]}function p(A){var S=u(A),W=S[0],K=S[1];return(W+K)*3/4-K}function g(A,S,W){return(S+W)*3/4-W}function w(A){var S,W=u(A),K=W[0],ne=W[1],Y=new t(g(A,K,ne)),ae=0,ce=ne>0?K-4:K,re;for(re=0;re<ce;re+=4)S=e[A.charCodeAt(re)]<<18|e[A.charCodeAt(re+1)]<<12|e[A.charCodeAt(re+2)]<<6|e[A.charCodeAt(re+3)],Y[ae++]=S>>16&255,Y[ae++]=S>>8&255,Y[ae++]=S&255;return ne===2&&(S=e[A.charCodeAt(re)]<<2|e[A.charCodeAt(re+1)]>>4,Y[ae++]=S&255),ne===1&&(S=e[A.charCodeAt(re)]<<10|e[A.charCodeAt(re+1)]<<4|e[A.charCodeAt(re+2)]>>2,Y[ae++]=S>>8&255,Y[ae++]=S&255),Y}function I(A){return n[A>>18&63]+n[A>>12&63]+n[A>>6&63]+n[A&63]}function F(A,S,W){for(var K,ne=[],Y=S;Y<W;Y+=3)K=(A[Y]<<16&16711680)+(A[Y+1]<<8&65280)+(A[Y+2]&255),ne.push(I(K));return ne.join("")}function P(A){for(var S,W=A.length,K=W%3,ne=[],Y=16383,ae=0,ce=W-K;ae<ce;ae+=Y)ne.push(F(A,ae,ae+Y>ce?ce:ae+Y));return K===1?(S=A[W-1],ne.push(n[S>>2]+n[S<<4&63]+"==")):K===2&&(S=(A[W-2]<<8)+A[W-1],ne.push(n[S>>10]+n[S>>4&63]+n[S<<2&63]+"=")),ne.join("")}return _t}function Ki(){if(oa)return qt;oa=!0;return qt.read=function(n,e,t,r,a){var o,u,p=a*8-r-1,g=(1<<p)-1,w=g>>1,I=-7,F=t?a-1:0,P=t?-1:1,A=n[e+F];for(F+=P,o=A&(1<<-I)-1,A>>=-I,I+=p;I>0;o=o*256+n[e+F],F+=P,I-=8);for(u=o&(1<<-I)-1,o>>=-I,I+=r;I>0;u=u*256+n[e+F],F+=P,I-=8);if(o===0)o=1-w;else{if(o===g)return u?NaN:(A?-1:1)*(1/0);u=u+Math.pow(2,r),o=o-w}return(A?-1:1)*u*Math.pow(2,o-r)},qt.write=function(n,e,t,r,a,o){var u,p,g,w=o*8-a-1,I=(1<<w)-1,F=I>>1,P=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:o-1,S=r?1:-1,W=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,u=I):(u=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-u))<1&&(u--,g*=2),u+F>=1?e+=P/g:e+=P*Math.pow(2,1-F),e*g>=2&&(u++,g/=2),u+F>=I?(p=0,u=I):u+F>=1?(p=(e*g-1)*Math.pow(2,a),u=u+F):(p=e*Math.pow(2,F-1)*Math.pow(2,a),u=0));a>=8;n[t+A]=p&255,A+=S,p/=256,a-=8);for(u=u<<a|p,w+=a;w>0;n[t+A]=u&255,A+=S,u/=256,w-=8);n[t+A-S]|=W*128},qt}function la(){if(ua)return Oe;ua=!0;let n=Yi(),e=Ki(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=u,Oe.SlowBuffer=ne,Oe.INSPECT_MAX_BYTES=50;let r=2147483647;Oe.kMaxLength=r,u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let l=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(l,i),l.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function o(l){if(l>r)throw new RangeError('The value "'+l+'" is invalid for option "size"');let i=new Uint8Array(l);return Object.setPrototypeOf(i,u.prototype),i}function u(l,i,s){if(typeof l=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(l)}return p(l,i,s)}u.poolSize=8192;function p(l,i,s){if(typeof l=="string")return F(l,i);if(ArrayBuffer.isView(l))return A(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(ye(l,ArrayBuffer)||l&&ye(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(l,SharedArrayBuffer)||l&&ye(l.buffer,SharedArrayBuffer)))return S(l,i,s);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=l.valueOf&&l.valueOf();if(c!=null&&c!==l)return u.from(c,i,s);let f=W(l);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return u.from(l[Symbol.toPrimitive]("string"),i,s);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}u.from=function(l,i,s){return p(l,i,s)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function g(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function w(l,i,s){return g(l),l<=0?o(l):i!==void 0?typeof s=="string"?o(l).fill(i,s):o(l).fill(i):o(l)}u.alloc=function(l,i,s){return w(l,i,s)};function I(l){return g(l),o(l<0?0:K(l)|0)}u.allocUnsafe=function(l){return I(l)},u.allocUnsafeSlow=function(l){return I(l)};function F(l,i){if((typeof i!="string"||i==="")&&(i="utf8"),!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=Y(l,i)|0,c=o(s),f=c.write(l,i);return f!==s&&(c=c.slice(0,f)),c}function P(l){let i=l.length<0?0:K(l.length)|0,s=o(i);for(let c=0;c<i;c+=1)s[c]=l[c]&255;return s}function A(l){if(ye(l,Uint8Array)){let i=new Uint8Array(l);return S(i.buffer,i.byteOffset,i.byteLength)}return P(l)}function S(l,i,s){if(i<0||l.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<i+(s||0))throw new RangeError('"length" is outside of buffer bounds');let c;return i===void 0&&s===void 0?c=new Uint8Array(l):s===void 0?c=new Uint8Array(l,i):c=new Uint8Array(l,i,s),Object.setPrototypeOf(c,u.prototype),c}function W(l){if(u.isBuffer(l)){let i=K(l.length)|0,s=o(i);return s.length===0||l.copy(s,0,0,i),s}if(l.length!==void 0)return typeof l.length!="number"||lr(l.length)?o(0):P(l);if(l.type==="Buffer"&&Array.isArray(l.data))return P(l.data)}function K(l){if(l>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return l|0}function ne(l){return+l!=l&&(l=0),u.alloc(+l)}u.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==u.prototype},u.compare=function(i,s){if(ye(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),ye(s,Uint8Array)&&(s=u.from(s,s.offset,s.byteLength)),!u.isBuffer(i)||!u.isBuffer(s))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(i===s)return 0;let c=i.length,f=s.length;for(let x=0,v=Math.min(c,f);x<v;++x)if(i[x]!==s[x]){c=i[x],f=s[x];break}return c<f?-1:f<c?1:0},u.isEncoding=function(i){switch(String(i).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return u.alloc(0);let c;if(s===void 0)for(s=0,c=0;c<i.length;++c)s+=i[c].length;let f=u.allocUnsafe(s),x=0;for(c=0;c<i.length;++c){let v=i[c];if(ye(v,Uint8Array))x+v.length>f.length?(u.isBuffer(v)||(v=u.from(v)),v.copy(f,x)):Uint8Array.prototype.set.call(f,v,x);else if(u.isBuffer(v))v.copy(f,x);else throw new TypeError('"list" argument must be an Array of Buffers');x+=v.length}return f};function Y(l,i){if(u.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||ye(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let s=l.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&s===0)return 0;let f=!1;for(;;)switch(i){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return ur(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return $r(l).length;default:if(f)return c?-1:ur(l).length;i=(""+i).toLowerCase(),f=!0}}u.byteLength=Y;function ae(l,i,s){let c=!1;if((i===void 0||i<0)&&(i=0),i>this.length||((s===void 0||s>this.length)&&(s=this.length),s<=0)||(s>>>=0,i>>>=0,s<=i))return"";for(l||(l="utf8");;)switch(l){case"hex":return Mi(this,i,s);case"utf8":case"utf-8":return Sr(this,i,s);case"ascii":return Ui(this,i,s);case"latin1":case"binary":return ji(this,i,s);case"base64":return Fi(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $i(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0}}u.prototype._isBuffer=!0;function ce(l,i,s){let c=l[i];l[i]=l[s],l[s]=c}u.prototype.swap16=function(){let i=this.length;if(i%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let s=0;s<i;s+=2)ce(this,s,s+1);return this},u.prototype.swap32=function(){let i=this.length;if(i%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let s=0;s<i;s+=4)ce(this,s,s+3),ce(this,s+1,s+2);return this},u.prototype.swap64=function(){let i=this.length;if(i%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let s=0;s<i;s+=8)ce(this,s,s+7),ce(this,s+1,s+6),ce(this,s+2,s+5),ce(this,s+3,s+4);return this},u.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Sr(this,0,i):ae.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(i){if(!u.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:u.compare(this,i)===0},u.prototype.inspect=function(){let i="",s=Oe.INSPECT_MAX_BYTES;return i=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(i+=" ... "),"<Buffer "+i+">"},t&&(u.prototype[t]=u.prototype.inspect),u.prototype.compare=function(i,s,c,f,x){if(ye(i,Uint8Array)&&(i=u.from(i,i.offset,i.byteLength)),!u.isBuffer(i))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof i);if(s===void 0&&(s=0),c===void 0&&(c=i?i.length:0),f===void 0&&(f=0),x===void 0&&(x=this.length),s<0||c>i.length||f<0||x>this.length)throw new RangeError("out of range index");if(f>=x&&s>=c)return 0;if(f>=x)return-1;if(s>=c)return 1;if(s>>>=0,c>>>=0,f>>>=0,x>>>=0,this===i)return 0;let v=x-f,M=c-s,J=Math.min(v,M),Z=this.slice(f,x),H=i.slice(s,c);for(let z=0;z<J;++z)if(Z[z]!==H[z]){v=Z[z],M=H[z];break}return v<M?-1:M<v?1:0};function re(l,i,s,c,f){if(l.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,lr(s)&&(s=f?0:l.length-1),s<0&&(s=l.length+s),s>=l.length){if(f)return-1;s=l.length-1}else if(s<0)if(f)s=0;else return-1;if(typeof i=="string"&&(i=u.from(i,c)),u.isBuffer(i))return i.length===0?-1:Cr(l,i,s,c,f);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(l,i,s):Uint8Array.prototype.lastIndexOf.call(l,i,s):Cr(l,[i],s,c,f);throw new TypeError("val must be string, number or Buffer")}function Cr(l,i,s,c,f){let x=1,v=l.length,M=i.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(l.length<2||i.length<2)return-1;x=2,v/=2,M/=2,s/=2}function J(H,z){return x===1?H[z]:H.readUInt16BE(z*x)}let Z;if(f){let H=-1;for(Z=s;Z<v;Z++)if(J(l,Z)===J(i,H===-1?0:Z-H)){if(H===-1&&(H=Z),Z-H+1===M)return H*x}else H!==-1&&(Z-=Z-H),H=-1}else for(s+M>v&&(s=v-M),Z=s;Z>=0;Z--){let H=!0;for(let z=0;z<M;z++)if(J(l,Z+z)!==J(i,z)){H=!1;break}if(H)return Z}return-1}u.prototype.includes=function(i,s,c){return this.indexOf(i,s,c)!==-1},u.prototype.indexOf=function(i,s,c){return re(this,i,s,c,!0)},u.prototype.lastIndexOf=function(i,s,c){return re(this,i,s,c,!1)};function Ci(l,i,s,c){s=Number(s)||0;let f=l.length-s;c?(c=Number(c),c>f&&(c=f)):c=f;let x=i.length;c>x/2&&(c=x/2);let v;for(v=0;v<c;++v){let M=parseInt(i.substr(v*2,2),16);if(lr(M))return v;l[s+v]=M}return v}function Si(l,i,s,c){return Mt(ur(i,l.length-s),l,s,c)}function Li(l,i,s,c){return Mt(Wi(i),l,s,c)}function Bi(l,i,s,c){return Mt($r(i),l,s,c)}function Pi(l,i,s,c){return Mt(zi(i,l.length-s),l,s,c)}u.prototype.write=function(i,s,c,f){if(s===void 0)f="utf8",c=this.length,s=0;else if(c===void 0&&typeof s=="string")f=s,c=this.length,s=0;else if(isFinite(s))s=s>>>0,isFinite(c)?(c=c>>>0,f===void 0&&(f="utf8")):(f=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let x=this.length-s;if((c===void 0||c>x)&&(c=x),i.length>0&&(c<0||s<0)||s>this.length)throw new RangeError("Attempt to write outside buffer bounds");f||(f="utf8");let v=!1;for(;;)switch(f){case"hex":return Ci(this,i,s,c);case"utf8":case"utf-8":return Si(this,i,s,c);case"ascii":case"latin1":case"binary":return Li(this,i,s,c);case"base64":return Bi(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pi(this,i,s,c);default:if(v)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),v=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Fi(l,i,s){return i===0&&s===l.length?n.fromByteArray(l):n.fromByteArray(l.slice(i,s))}function Sr(l,i,s){s=Math.min(l.length,s);let c=[],f=i;for(;f<s;){let x=l[f],v=null,M=x>239?4:x>223?3:x>191?2:1;if(f+M<=s){let J,Z,H,z;switch(M){case 1:x<128&&(v=x);break;case 2:J=l[f+1],(J&192)===128&&(z=(x&31)<<6|J&63,z>127&&(v=z));break;case 3:J=l[f+1],Z=l[f+2],(J&192)===128&&(Z&192)===128&&(z=(x&15)<<12|(J&63)<<6|Z&63,z>2047&&(z<55296||z>57343)&&(v=z));break;case 4:J=l[f+1],Z=l[f+2],H=l[f+3],(J&192)===128&&(Z&192)===128&&(H&192)===128&&(z=(x&15)<<18|(J&63)<<12|(Z&63)<<6|H&63,z>65535&&z<1114112&&(v=z))}}v===null?(v=65533,M=1):v>65535&&(v-=65536,c.push(v>>>10&1023|55296),v=56320|v&1023),c.push(v),f+=M}return Oi(c)}let Lr=4096;function Oi(l){let i=l.length;if(i<=Lr)return String.fromCharCode.apply(String,l);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,l.slice(c,c+=Lr));return s}function Ui(l,i,s){let c="";s=Math.min(l.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(l[f]&127);return c}function ji(l,i,s){let c="";s=Math.min(l.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(l[f]);return c}function Mi(l,i,s){let c=l.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let f="";for(let x=i;x<s;++x)f+=Zi[l[x]];return f}function $i(l,i,s){let c=l.slice(i,s),f="";for(let x=0;x<c.length-1;x+=2)f+=String.fromCharCode(c[x]+c[x+1]*256);return f}u.prototype.slice=function(i,s){let c=this.length;i=~~i,s=s===void 0?c:~~s,i<0?(i+=c,i<0&&(i=0)):i>c&&(i=c),s<0?(s+=c,s<0&&(s=0)):s>c&&(s=c),s<i&&(s=i);let f=this.subarray(i,s);return Object.setPrototypeOf(f,u.prototype),f};function Q(l,i,s){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+i>s)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i],x=1,v=0;for(;++v<s&&(x*=256);)f+=this[i+v]*x;return f},u.prototype.readUintBE=u.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i+--s],x=1;for(;s>0&&(x*=256);)f+=this[i+--s]*x;return f},u.prototype.readUint8=u.prototype.readUInt8=function(i,s){return i=i>>>0,s||Q(i,1,this.length),this[i]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||Q(i,2,this.length),this[i]|this[i+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||Q(i,2,this.length),this[i]<<8|this[i+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},u.prototype.readBigUInt64LE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24,x=this[++i]+this[++i]*2**8+this[++i]*2**16+c*2**24;return BigInt(f)+(BigInt(x)<<BigInt(32))}),u.prototype.readBigUInt64BE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=s*2**24+this[++i]*2**16+this[++i]*2**8+this[++i],x=this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c;return(BigInt(f)<<BigInt(32))+BigInt(x)}),u.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=this[i],x=1,v=0;for(;++v<s&&(x*=256);)f+=this[i+v]*x;return x*=128,f>=x&&(f-=Math.pow(2,8*s)),f},u.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||Q(i,s,this.length);let f=s,x=1,v=this[i+--f];for(;f>0&&(x*=256);)v+=this[i+--f]*x;return x*=128,v>=x&&(v-=Math.pow(2,8*s)),v},u.prototype.readInt8=function(i,s){return i=i>>>0,s||Q(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},u.prototype.readInt16LE=function(i,s){i=i>>>0,s||Q(i,2,this.length);let c=this[i]|this[i+1]<<8;return c&32768?c|4294901760:c},u.prototype.readInt16BE=function(i,s){i=i>>>0,s||Q(i,2,this.length);let c=this[i+1]|this[i]<<8;return c&32768?c|4294901760:c},u.prototype.readInt32LE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},u.prototype.readInt32BE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},u.prototype.readBigInt64LE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=this[i+4]+this[i+5]*2**8+this[i+6]*2**16+(c<<24);return(BigInt(f)<<BigInt(32))+BigInt(s+this[++i]*2**8+this[++i]*2**16+this[++i]*2**24)}),u.prototype.readBigInt64BE=Ee(function(i){i=i>>>0,ct(i,"offset");let s=this[i],c=this[i+7];(s===void 0||c===void 0)&&Tt(i,this.length-8);let f=(s<<24)+this[++i]*2**16+this[++i]*2**8+this[++i];return(BigInt(f)<<BigInt(32))+BigInt(this[++i]*2**24+this[++i]*2**16+this[++i]*2**8+c)}),u.prototype.readFloatLE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),e.read(this,i,!0,23,4)},u.prototype.readFloatBE=function(i,s){return i=i>>>0,s||Q(i,4,this.length),e.read(this,i,!1,23,4)},u.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||Q(i,8,this.length),e.read(this,i,!0,52,8)},u.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||Q(i,8,this.length),e.read(this,i,!1,52,8)};function ie(l,i,s,c,f,x){if(!u.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>f||i<x)throw new RangeError('"value" argument is out of bounds');if(s+c>l.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let M=Math.pow(2,8*c)-1;ie(this,i,s,c,M,0)}let x=1,v=0;for(this[s]=i&255;++v<c&&(x*=256);)this[s+v]=i/x&255;return s+c},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let M=Math.pow(2,8*c)-1;ie(this,i,s,c,M,0)}let x=c-1,v=1;for(this[s+x]=i&255;--x>=0&&(v*=256);)this[s+x]=i/v&255;return s+c},u.prototype.writeUint8=u.prototype.writeUInt8=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,1,255,0),this[s]=i&255,s+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,65535,0),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,65535,0),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,4294967295,0),this[s+3]=i>>>24,this[s+2]=i>>>16,this[s+1]=i>>>8,this[s]=i&255,s+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,4294967295,0),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4};function Br(l,i,s,c,f){Mr(i,c,f,l,s,7);let x=Number(i&BigInt(4294967295));l[s++]=x,x=x>>8,l[s++]=x,x=x>>8,l[s++]=x,x=x>>8,l[s++]=x;let v=Number(i>>BigInt(32)&BigInt(4294967295));return l[s++]=v,v=v>>8,l[s++]=v,v=v>>8,l[s++]=v,v=v>>8,l[s++]=v,s}function Pr(l,i,s,c,f){Mr(i,c,f,l,s,7);let x=Number(i&BigInt(4294967295));l[s+7]=x,x=x>>8,l[s+6]=x,x=x>>8,l[s+5]=x,x=x>>8,l[s+4]=x;let v=Number(i>>BigInt(32)&BigInt(4294967295));return l[s+3]=v,v=v>>8,l[s+2]=v,v=v>>8,l[s+1]=v,v=v>>8,l[s]=v,s+8}u.prototype.writeBigUInt64LE=Ee(function(i,s=0){return Br(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Ee(function(i,s=0){return Pr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let J=Math.pow(2,8*c-1);ie(this,i,s,c,J-1,-J)}let x=0,v=1,M=0;for(this[s]=i&255;++x<c&&(v*=256);)i<0&&M===0&&this[s+x-1]!==0&&(M=1),this[s+x]=(i/v>>0)-M&255;return s+c},u.prototype.writeIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let J=Math.pow(2,8*c-1);ie(this,i,s,c,J-1,-J)}let x=c-1,v=1,M=0;for(this[s+x]=i&255;--x>=0&&(v*=256);)i<0&&M===0&&this[s+x+1]!==0&&(M=1),this[s+x]=(i/v>>0)-M&255;return s+c},u.prototype.writeInt8=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,1,127,-128),i<0&&(i=255+i+1),this[s]=i&255,s+1},u.prototype.writeInt16LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,32767,-32768),this[s]=i&255,this[s+1]=i>>>8,s+2},u.prototype.writeInt16BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,2,32767,-32768),this[s]=i>>>8,this[s+1]=i&255,s+2},u.prototype.writeInt32LE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,2147483647,-2147483648),this[s]=i&255,this[s+1]=i>>>8,this[s+2]=i>>>16,this[s+3]=i>>>24,s+4},u.prototype.writeInt32BE=function(i,s,c){return i=+i,s=s>>>0,c||ie(this,i,s,4,2147483647,-2147483648),i<0&&(i=4294967295+i+1),this[s]=i>>>24,this[s+1]=i>>>16,this[s+2]=i>>>8,this[s+3]=i&255,s+4},u.prototype.writeBigInt64LE=Ee(function(i,s=0){return Br(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Ee(function(i,s=0){return Pr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Fr(l,i,s,c,f,x){if(s+c>l.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Or(l,i,s,c,f){return i=+i,s=s>>>0,f||Fr(l,i,s,4),e.write(l,i,s,c,23,4),s+4}u.prototype.writeFloatLE=function(i,s,c){return Or(this,i,s,!0,c)},u.prototype.writeFloatBE=function(i,s,c){return Or(this,i,s,!1,c)};function Ur(l,i,s,c,f){return i=+i,s=s>>>0,f||Fr(l,i,s,8),e.write(l,i,s,c,52,8),s+8}u.prototype.writeDoubleLE=function(i,s,c){return Ur(this,i,s,!0,c)},u.prototype.writeDoubleBE=function(i,s,c){return Ur(this,i,s,!1,c)},u.prototype.copy=function(i,s,c,f){if(!u.isBuffer(i))throw new TypeError("argument should be a Buffer");if(c||(c=0),!f&&f!==0&&(f=this.length),s>=i.length&&(s=i.length),s||(s=0),f>0&&f<c&&(f=c),f===c||i.length===0||this.length===0)return 0;if(s<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("sourceEnd out of bounds");f>this.length&&(f=this.length),i.length-s<f-c&&(f=i.length-s+c);let x=f-c;return this===i&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(s,c,f):Uint8Array.prototype.set.call(i,this.subarray(c,f),s),x},u.prototype.fill=function(i,s,c,f){if(typeof i=="string"){if(typeof s=="string"?(f=s,s=0,c=this.length):typeof c=="string"&&(f=c,c=this.length),f!==void 0&&typeof f!="string")throw new TypeError("encoding must be a string");if(typeof f=="string"&&!u.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(i.length===1){let v=i.charCodeAt(0);(f==="utf8"&&v<128||f==="latin1")&&(i=v)}}else typeof i=="number"?i=i&255:typeof i=="boolean"&&(i=Number(i));if(s<0||this.length<s||this.length<c)throw new RangeError("Out of range index");if(c<=s)return this;s=s>>>0,c=c===void 0?this.length:c>>>0,i||(i=0);let x;if(typeof i=="number")for(x=s;x<c;++x)this[x]=i;else{let v=u.isBuffer(i)?i:u.from(i,f),M=v.length;if(M===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(x=0;x<c-s;++x)this[x+s]=v[x%M]}return this};let lt={};function or(l,i,s){lt[l]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name}get code(){return l}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}or("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),or("ERR_INVALID_ARG_TYPE",function(l,i){return`The "${l}" argument must be of type number. Received type ${typeof i}`},TypeError),or("ERR_OUT_OF_RANGE",function(l,i,s){let c=`The value of "${l}" is out of range.`,f=s;return Number.isInteger(s)&&Math.abs(s)>2**32?f=jr(String(s)):typeof s=="bigint"&&(f=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(f=jr(f)),f+="n"),c+=` It must be ${i}. Received ${f}`,c},RangeError);function jr(l){let i="",s=l.length,c=l[0]==="-"?1:0;for(;s>=c+4;s-=3)i=`_${l.slice(s-3,s)}${i}`;return`${l.slice(0,s)}${i}`}function Vi(l,i,s){ct(i,"offset"),(l[i]===void 0||l[i+s]===void 0)&&Tt(i,l.length-(s+1))}function Mr(l,i,s,c,f,x){if(l>s||l<i){let v=typeof i=="bigint"?"n":"",M;throw i===0||i===BigInt(0)?M=`>= 0${v} and < 2${v} ** ${(x+1)*8}${v}`:M=`>= -(2${v} ** ${(x+1)*8-1}${v}) and < 2 ** ${(x+1)*8-1}${v}`,new lt.ERR_OUT_OF_RANGE("value",M,l)}Vi(c,f,x)}function ct(l,i){if(typeof l!="number")throw new lt.ERR_INVALID_ARG_TYPE(i,"number",l)}function Tt(l,i,s){throw Math.floor(l)!==l?(ct(l,s),new lt.ERR_OUT_OF_RANGE("offset","an integer",l)):i<0?new lt.ERR_BUFFER_OUT_OF_BOUNDS:new lt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,l)}let Di=/[^+/0-9A-Za-z-_]/g;function qi(l){if(l=l.split("=")[0],l=l.trim().replace(Di,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function ur(l,i){i=i||1/0;let s,c=l.length,f=null,x=[];for(let v=0;v<c;++v){if(s=l.charCodeAt(v),s>55295&&s<57344){if(!f){if(s>56319){(i-=3)>-1&&x.push(239,191,189);continue}else if(v+1===c){(i-=3)>-1&&x.push(239,191,189);continue}f=s;continue}if(s<56320){(i-=3)>-1&&x.push(239,191,189),f=s;continue}s=(f-55296<<10|s-56320)+65536}else f&&(i-=3)>-1&&x.push(239,191,189);if(f=null,s<128){if((i-=1)<0)break;x.push(s)}else if(s<2048){if((i-=2)<0)break;x.push(s>>6|192,s&63|128)}else if(s<65536){if((i-=3)<0)break;x.push(s>>12|224,s>>6&63|128,s&63|128)}else if(s<1114112){if((i-=4)<0)break;x.push(s>>18|240,s>>12&63|128,s>>6&63|128,s&63|128)}else throw new Error("Invalid code point")}return x}function Wi(l){let i=[];for(let s=0;s<l.length;++s)i.push(l.charCodeAt(s)&255);return i}function zi(l,i){let s,c,f,x=[];for(let v=0;v<l.length&&!((i-=2)<0);++v)s=l.charCodeAt(v),c=s>>8,f=s%256,x.push(f),x.push(c);return x}function $r(l){return n.toByteArray(qi(l))}function Mt(l,i,s,c){let f;for(f=0;f<c&&!(f+s>=i.length||f>=l.length);++f)i[f+s]=l[f];return f}function ye(l,i){return l instanceof i||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===i.name}function lr(l){return l!==l}let Zi=(function(){let l="0123456789abcdef",i=new Array(256);for(let s=0;s<16;++s){let c=s*16;for(let f=0;f<16;++f)i[c+f]=l[s]+l[f]}return i})();function Ee(l){return typeof BigInt>"u"?Gi:l}function Gi(){throw new Error("BigInt not supported")}return Oe}var _t,sa,qt,oa,Oe,ua,ca=pt(()=>{"use strict";m();y();h();_t={},sa=!1;qt={},oa=!1;Oe={},ua=!1});var Ue,_,Dl,ql,pa=pt(()=>{"use strict";m();y();h();ca();Ue=la();Ue.Buffer;Ue.SlowBuffer;Ue.INSPECT_MAX_BYTES;Ue.kMaxLength;_=Ue.Buffer,Dl=Ue.INSPECT_MAX_BYTES,ql=Ue.kMaxLength});var y=pt(()=>{"use strict";pa()});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var Qi=typeof global=="object"&&global&&global.Object===Object&&global,da=Qi;var Xi=typeof self=="object"&&self&&self.Object===Object&&self,es=da||Xi||Function("return this")(),fa=es;var ts=fa.Symbol,_e=ts;m();y();h();var ma=Object.prototype,rs=ma.hasOwnProperty,ns=ma.toString,kt=_e?_e.toStringTag:void 0;function as(n){var e=rs.call(n,kt),t=n[kt];try{n[kt]=void 0;var r=!0}catch{}var a=ns.call(n);return r&&(e?n[kt]=t:delete n[kt]),a}var ha=as;m();y();h();var is=Object.prototype,ss=is.toString;function os(n){return ss.call(n)}var ya=os;var us="[object Null]",ls="[object Undefined]",ga=_e?_e.toStringTag:void 0;function cs(n){return n==null?n===void 0?ls:us:ga&&ga in Object(n)?ha(n):ya(n)}var xa=cs;m();y();h();function ps(n){return n!=null&&typeof n=="object"}var va=ps;var ds="[object Symbol]";function fs(n){return typeof n=="symbol"||va(n)&&xa(n)==ds}var wa=fs;m();y();h();m();y();h();function ms(n,e){for(var t=-1,r=n==null?0:n.length,a=Array(r);++t<r;)a[t]=e(n[t],t,n);return a}var ba=ms;m();y();h();var hs=Array.isArray,Ta=hs;var ys=1/0,_a=_e?_e.prototype:void 0,ka=_a?_a.toString:void 0;function Na(n){if(typeof n=="string")return n;if(Ta(n))return ba(n,Na)+"";if(wa(n))return ka?ka.call(n):"";var e=n+"";return e=="0"&&1/n==-ys?"-0":e}var Ra=Na;m();y();h();function gs(n){return n==null?"":Ra(n)}var Ce=gs;m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();function xs(n,e,t){var r=-1,a=n.length;e<0&&(e=-e>a?0:a+e),t=t>a?a:t,t<0&&(t+=a),a=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(a);++r<a;)o[r]=n[r+e];return o}var Ia=xs;function vs(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ia(n,e,t)}var Ea=vs;m();y();h();var ws="\\ud800-\\udfff",bs="\\u0300-\\u036f",Ts="\\ufe20-\\ufe2f",_s="\\u20d0-\\u20ff",ks=bs+Ts+_s,Ns="\\ufe0e\\ufe0f",Rs="\\u200d",Is=RegExp("["+Rs+ws+ks+Ns+"]");function Es(n){return Is.test(n)}var Wt=Es;m();y();h();m();y();h();function As(n){return n.split("")}var Aa=As;m();y();h();var Ca="\\ud800-\\udfff",Cs="\\u0300-\\u036f",Ss="\\ufe20-\\ufe2f",Ls="\\u20d0-\\u20ff",Bs=Cs+Ss+Ls,Ps="\\ufe0e\\ufe0f",Fs="["+Ca+"]",mr="["+Bs+"]",hr="\\ud83c[\\udffb-\\udfff]",Os="(?:"+mr+"|"+hr+")",Sa="[^"+Ca+"]",La="(?:\\ud83c[\\udde6-\\uddff]){2}",Ba="[\\ud800-\\udbff][\\udc00-\\udfff]",Us="\\u200d",Pa=Os+"?",Fa="["+Ps+"]?",js="(?:"+Us+"(?:"+[Sa,La,Ba].join("|")+")"+Fa+Pa+")*",Ms=Fa+Pa+js,$s="(?:"+[Sa+mr+"?",mr,La,Ba,Fs].join("|")+")",Vs=RegExp(hr+"(?="+hr+")|"+$s+Ms,"g");function Ds(n){return n.match(Vs)||[]}var Oa=Ds;function qs(n){return Wt(n)?Oa(n):Aa(n)}var Ua=qs;function Ws(n){return function(e){e=Ce(e);var t=Wt(e)?Ua(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ea(t,1).join(""):e.slice(1);return r[n]()+a}}var ja=Ws;var zs=ja("toUpperCase"),Ma=zs;function Zs(n){return Ma(Ce(n).toLowerCase())}var $a=Zs;m();y();h();m();y();h();function Gs(n,e,t,r){var a=-1,o=n==null?0:n.length;for(r&&o&&(t=n[++a]);++a<o;)t=e(t,n[a],a,n);return t}var Va=Gs;m();y();h();m();y();h();m();y();h();function Js(n){return function(e){return n?.[e]}}var Da=Js;var Hs={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ys=Da(Hs),qa=Ys;var Ks=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qs="\\u0300-\\u036f",Xs="\\ufe20-\\ufe2f",eo="\\u20d0-\\u20ff",to=Qs+Xs+eo,ro="["+to+"]",no=RegExp(ro,"g");function ao(n){return n=Ce(n),n&&n.replace(Ks,qa).replace(no,"")}var Wa=ao;m();y();h();m();y();h();var io=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function so(n){return n.match(io)||[]}var za=so;m();y();h();var oo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function uo(n){return oo.test(n)}var Za=uo;m();y();h();var Ka="\\ud800-\\udfff",lo="\\u0300-\\u036f",co="\\ufe20-\\ufe2f",po="\\u20d0-\\u20ff",fo=lo+co+po,Qa="\\u2700-\\u27bf",Xa="a-z\\xdf-\\xf6\\xf8-\\xff",mo="\\xac\\xb1\\xd7\\xf7",ho="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",yo="\\u2000-\\u206f",go=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ei="A-Z\\xc0-\\xd6\\xd8-\\xde",xo="\\ufe0e\\ufe0f",ti=mo+ho+yo+go,ri="['\u2019]",Ga="["+ti+"]",vo="["+fo+"]",ni="\\d+",wo="["+Qa+"]",ai="["+Xa+"]",ii="[^"+Ka+ti+ni+Qa+Xa+ei+"]",bo="\\ud83c[\\udffb-\\udfff]",To="(?:"+vo+"|"+bo+")",_o="[^"+Ka+"]",si="(?:\\ud83c[\\udde6-\\uddff]){2}",oi="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="["+ei+"]",ko="\\u200d",Ja="(?:"+ai+"|"+ii+")",No="(?:"+ft+"|"+ii+")",Ha="(?:"+ri+"(?:d|ll|m|re|s|t|ve))?",Ya="(?:"+ri+"(?:D|LL|M|RE|S|T|VE))?",ui=To+"?",li="["+xo+"]?",Ro="(?:"+ko+"(?:"+[_o,si,oi].join("|")+")"+li+ui+")*",Io="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Eo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ao=li+ui+Ro,Co="(?:"+[wo,si,oi].join("|")+")"+Ao,So=RegExp([ft+"?"+ai+"+"+Ha+"(?="+[Ga,ft,"$"].join("|")+")",No+"+"+Ya+"(?="+[Ga,ft+Ja,"$"].join("|")+")",ft+"?"+Ja+"+"+Ha,ft+"+"+Ya,Eo,Io,ni,Co].join("|"),"g");function Lo(n){return n.match(So)||[]}var ci=Lo;function Bo(n,e,t){return n=Ce(n),e=t?void 0:e,e===void 0?Za(n)?ci(n):za(n):n.match(e)||[]}var pi=Bo;var Po="['\u2019]",Fo=RegExp(Po,"g");function Oo(n){return function(e){return Va(pi(Wa(e).replace(Fo,"")),n,"")}}var di=Oo;var Uo=di(function(n,e,t){return e=e.toLowerCase(),n+(t?$a(e):e)}),yr=Uo;m();y();h();function $(n){throw new Error("Unexpected value: "+JSON.stringify(n))}m();y();h();function gr(n){if(typeof n=="string")return n.length>0?n:"Unknown error";if(n instanceof Error||typeof n=="object"&&n!==null&&"message"in n&&typeof n.message=="string")return n.message.length>0?n.message:"Unknown error";let e=String(n);return e.length>0?e:"Unknown error"}m();y();h();function Nt(n){return Object.keys(n)}m();y();h();m();y();h();m();y();h();var Rt=T.env.FERN_STACK_TRACK?.toLowerCase()??"",ge=Rt!==""&&Rt!=="0"&&Rt!=="false",xr=["single","multiline","box"].includes(Rt)?Rt:"single";ge&&(Error.stackTraceLimit=50);var jo=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Mo=new Set(["stacktrace"]);function Zt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,formatFilename:p=g=>g}={}){if(!ge)return[];r=[...r,...jo],t=[...t,...Mo],a=[...a,"runInteractiveTask"];let g=!1;return(new Error().stack??"").split(`
2
+ `).map(w=>{let I=w.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(I&&I.length===5){let[,F,P,A,S]=I;if(!F||!P||!A||!S)return;if(g||a.some(W=>F?.includes(W))){g=!0;return}switch(F){case"Object.<anonymous>":F="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":F=`${F.substring(F.indexOf(".")+1)}()=> { ... }`;break}return{fn:F,path:p(P),position:`${A}:${S}`}}}).filter(w=>w&&!r.some(I=>w.fn.includes(I))&&!(o&&w.path?.startsWith("node:"))&&!(u&&w.path?.endsWith(".js"))&&!t.some(I=>w.path.includes(I))).slice(e,e+n)}var zt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:u=!0,filterJs:p=!0,multiline:g=!1,formatFilename:w=I=>I}={}){N(this,"maxFrames");N(this,"skip");N(this,"filterPaths");N(this,"filterFunctions");N(this,"stopOn");N(this,"filterNode");N(this,"filterJs");N(this,"multiline");N(this,"formatFilename");N(this,"tracking",new WeakMap);this.maxFrames=e,this.skip=t,this.filterPaths=r,this.filterFunctions=a,this.stopOn=o,this.filterNode=u,this.filterJs=p,this.multiline=g,this.formatFilename=w}tag(e){let t=this.tracking.get(e)||new Set;Zt({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(r=>t.add(r)),this.tracking.set(e,t)}trace(e){if(!ge)return"";let t=this.tracking.get(e);return t?[...t].map(r=>`${this.multiline?`
3
+ `:""}${r.fn} - ${r.path}:${r.position}`).join(""):""}frames(e){let t=this.tracking.get(e);return t?[...t]:[]}free(e){this.tracking.delete(e)}clear(){this.tracking=new WeakMap}},vr;function fi({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:u=!0,multiline:p=!1,formatFilename:g=w=>w}={}){ge&&(vr??(vr=new zt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:u,multiline:p,formatFilename:g})))}function mi(n){vr?.tag(n)}function wr(n){return vr?.frames(n)??[]}var je=class{constructor(){mi(this)}};m();y();h();var Gt=class{formatMultiple(e){return Promise.all(e.map(t=>this.format(t)))}formatMultipleSync(e){return e.map(t=>this.formatSync(t))}dispose(){}},It=class extends Gt{async format(e){return e}formatSync(e){return e}};m();y();h();m();y();h();m();y();h();var me=class extends je{constructor(t){super();N(this,"value");this.value=t}write(t){typeof this.value=="string"?t.write(this.value):typeof this.value=="function"?this.value(t):this.value.write(t)}};var $o=4;fi({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Et=class{constructor(){N(this,"lineBuffer",[]);N(this,"indentLevel",0);N(this,"hasWrittenAnything",!1);N(this,"lastCharacterIsSemicolon",!1);N(this,"lastCharacterIsNewline",!1);N(this,"nodeStackFrames",[])}get buffer(){return ge&&this.nodeStackFrames.length>0&&this.writeInternal(`
4
4
  `),this.lineBuffer.join(`
5
5
  `)+(this.lastCharacterIsNewline?`
6
6
  `:"")}write(...e){for(let t of e)if(t!=null)if(typeof t=="string"){let r=t.length>0&&t.endsWith(`
@@ -12,20 +12,20 @@ ${o}`);this.isAtStartOfLine()&&(u=o+u),r&&(u+=`
12
12
  `)}writeSemicolonIfLastCharacterIsNot(){this.lastCharacterIsSemicolon||this.writeInternal(";")}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
13
13
  `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:e,delimiter:t,writeFunction:r}){if(e.length>0){let a=e[0];a!=null&&r(a);for(let o=1;o<e.length;o++){this.write(t);let u=e[o];u!=null&&r(u)}}}toString(){return this.buffer}writeInternal(e){if(e.length===0)return;let t=!this.lastCharacterIsNewline;this.hasWrittenAnything=!0,this.lastCharacterIsNewline=e.endsWith(`
14
14
  `),this.lastCharacterIsSemicolon=e.endsWith(";");let r=e.split(`
15
- `),a=ge&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;t&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),a&&this.appendTrackingComment()}set lastLine(e){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=e:this.lineBuffer.push(e)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(e){return!1}formatStack(e,t=""){return e.map(r=>`${t?`(${t}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(e){return e.filter(t=>!t.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let e=[...this.formatStack(this.filterStack(Zt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,xr){case"single":return this.singleLineTrackingComment(e);case"multiline":return this.multiLineTrackingComment(e);case"box":return this.boxTrackingComment(e)}}singleLineTrackingComment(e){this.lastLine=`${this.lastLine} // ${e.join(" ")}`}multiLineTrackingComment(e){this.lineBuffer.push(...e.map(t=>` // ${t}`))}boxTrackingComment(e){this.lineBuffer.push("/*",...e.map(t=>` ${t}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return $o}};m();y();h();function br(n){return n?.name!=null&&n?.assignment!=null}m();y();h();m();y();h();m();y();h();var At=class{constructor(){R(this,"reporter");R(this,"snippet");R(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:t}){this.shouldUpdate({snippet:t,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=t)}getResponseOrThrow({endpoint:e}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:t}){return this.reporter==null||this.reporter.size()>0&&t.size()===0?!0:e.length>(this.snippet?.length??0)}};var Ct=class{constructor(e){R(this,"context");this.context=e}async generate(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new At;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{let x=await p.generateSnippet({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{return await p.generateSnippetAst({endpoint:o,request:e,options:t})}catch(x){a=x}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new At;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{let x=p.generateSnippetSync({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:x,errors:void 0};a.update({context:u,snippet:x})}catch(x){a.err==null&&(a.err=x)}}return a.getResponseOrThrow({endpoint:e.endpoint})}resolveEndpoints({request:e,options:t}){if(t.endpointId!=null){let r=this.context.resolveEndpointById(t.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${t.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(e.endpoint)}};m();y();h();m();y();h();m();y();h();var St=class{constructor(){R(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};m();y();h();var D={Critical:"CRITICAL",Warning:"WARNING"},Lt=class n{constructor(){R(this,"errors");R(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push({...e,path:[...this.path]})}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(e){this.errors.length=e}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var Bt=class{constructor({ir:e,config:t,options:r={}}){R(this,"config");R(this,"options");R(this,"errors");R(this,"_ir");R(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new Lt,this.httpEndpointReferenceParser=new St}associateQueryParametersByWireValue({parameters:e,values:t}){let r=[];for(let[a,o]of Object.entries(t))if(o!==void 0){this.errors.scope(a);try{let u=e.find(x=>x.name.wireValue===a);if(u==null)throw this.newParameterNotRecognizedError(a);let p=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:u.name,typeReference:u.typeReference,value:p})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:e,values:t}){let r=[];for(let a of e){this.errors.scope(a.name.wireValue);try{let o=t[a.name.wireValue];if(o==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")o=`<${a.name.wireValue}>`;else{this.errors.add({severity:D.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[];for(let[o,u]of Object.entries(t))if(u!==void 0){this.errors.scope(o);try{let p=e.find(x=>x.name.wireValue===o);if(p==null){if(r)continue;this.errors.add({severity:D.Critical,message:this.newParameterNotRecognizedError(o).message});continue}a.push({name:p.name,typeReference:p.typeReference,value:u})}finally{this.errors.unscope()}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let o of e){let u=r[o.name.wireValue];u==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:u})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:D.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:e,record:t}){let r=t[e.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:D.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:D.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}a.push(o)}return a}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:D.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e??{}}resolveNamedType({typeId:e}){let t=this._ir.types[e];if(t==null){this.errors.add({severity:D.Critical,message:`Type identified by "${e}" could not be found`});return}return t}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t}){let r=this.getRecord(t);if(r==null)return;let a=e.discriminant.wireValue,o=r[a];if(o==null){this.errors.add({severity:D.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:D.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let u=e.types[o];if(u==null){this.errors.add({severity:D.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:p,...x}=r;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:x}}resolveEndpointOrThrow(e){let t=this.httpEndpointReferenceParser.tryParse(e);if(t==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(t)}resolveEndpointLocation(e){let t=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:e})&&t.push(r);return t}resolveEndpointLocationOrThrow(e){let t=this.resolveEndpointLocation(e);if(t.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return t}resolveEndpointById(e){return this._ir.endpoints[e]}resolveEndpointByIdOrThrow(e){let t=this.resolveEndpointById(e);if(t==null)throw new Error(`Failed to find endpoint with ID "${e}"`);return t}needsRequestParameter({request:e,inlinePathParameters:t,inlineFileProperties:r}){return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:t})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:r}):!e.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:e,inlinePathParameters:t}){return t&&(e.metadata?.includePathParameters??!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:M(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":{let r=t.environments.find(a=>a.id===e);return r?.name}case"multipleBaseUrls":{let r=t.environments.find(a=>a.id===e);return r?.name}default:M(t)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:D.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":return this.errors.add({severity:D.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=t.environments[0];if(r==null)return this.errors.add({severity:D.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(Nt(r.urls));for(let o of Nt(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:D.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${Nt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:D.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:D.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:D.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:t}){return new Error(`Expected ${e}, got ${typeof t}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:t}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t});default:M(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t}){return this.fileUploadHasBodyProperties({fileUpload:e})||t&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:M(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:M(t)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:t}){return e.location.method===t.method&&e.location.path===t.path}};m();y();h();var Me;(function(n){n.Concise="concise",n.Full="full"})(Me||(Me={}));m();y();h();var se={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};m();y();h();m();y();h();m();y();h();m();y();h();var $e=class extends Et{constructor({packageName:t,customConfig:r,formatter:a}){super();R(this,"packageName");R(this,"customConfig");R(this,"formatter");R(this,"imports",new Set);this.packageName=t,this.customConfig=r,this.formatter=a??new It}addImport(t){this.imports.add(t)}getImports(){return new Set(this.imports)}};var Pt=class extends $e{constructor({packageName:e,customConfig:t,formatter:r}){super({packageName:e,customConfig:t,formatter:r})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format Java file: ${t}
15
+ `),a=ge&&!this.shouldSkipTracking(r)&&this.lastCharacterIsNewline;t&&(this.lastLine=`${this.lastLine}${r.shift()||""}`),this.lastCharacterIsNewline&&r.pop(),this.lineBuffer.push(...r),a&&this.appendTrackingComment()}set lastLine(e){this.lineBuffer.length>0?this.lineBuffer[this.lineBuffer.length-1]=e:this.lineBuffer.push(e)}get lastLine(){return this.lineBuffer[this.lineBuffer.length-1]||""}shouldSkipTracking(e){return!1}formatStack(e,t=""){return e.map(r=>`${t?`(${t}) `:""} ${r.fn} - ${r.path} : ${r.position}`)}filterStack(e){return e.filter(t=>!t.fn.startsWith(`${this.constructor.name}.`))}appendTrackingComment(){let e=[...this.formatStack(this.filterStack(Zt({maxFrames:15,skip:3}))),...this.formatStack(this.filterStack(this.nodeStackFrames),"node")];switch(this.nodeStackFrames.length=0,xr){case"single":return this.singleLineTrackingComment(e);case"multiline":return this.multiLineTrackingComment(e);case"box":return this.boxTrackingComment(e)}}singleLineTrackingComment(e){this.lastLine=`${this.lastLine} // ${e.join(" ")}`}multiLineTrackingComment(e){this.lineBuffer.push(...e.map(t=>` // ${t}`))}boxTrackingComment(e){this.lineBuffer.push("/*",...e.map(t=>` ${t}`),"*/")}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*this.getTabSize())}getTabSize(){return $o}};m();y();h();function br(n){return n?.name!=null&&n?.assignment!=null}m();y();h();m();y();h();m();y();h();var At=class{constructor(){N(this,"reporter");N(this,"snippet");N(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:t}){this.shouldUpdate({snippet:t,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=t)}getResponseOrThrow({endpoint:e}){if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw this.err??new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:t}){return this.reporter==null||this.reporter.size()>0&&t.size()===0?!0:e.length>(this.snippet?.length??0)}};var Ct=class{constructor(e){N(this,"context");this.context=e}async generate(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new At;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{let g=await p.generateSnippet({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:g,errors:void 0};a.update({context:u,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}async generateSnippetAst(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{return await p.generateSnippetAst({endpoint:o,request:e,options:t})}catch(g){a=g}}throw a??new Error(`Failed to generate snippet AST for endpoint: ${e.endpoint.method} ${e.endpoint.path}`)}generateSync(e,t={}){let r=this.resolveEndpoints({request:e,options:t});if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let a=new At;for(let o of r){let u=this.context.clone(),p=this.createSnippetGenerator(u);try{let g=p.generateSnippetSync({endpoint:o,request:e,options:t});if(u.errors.empty())return{snippet:g,errors:void 0};a.update({context:u,snippet:g})}catch(g){a.err==null&&(a.err=g)}}return a.getResponseOrThrow({endpoint:e.endpoint})}resolveEndpoints({request:e,options:t}){if(t.endpointId!=null){let r=this.context.resolveEndpointById(t.endpointId);if(r==null)throw new Error(`No endpoint found with ID "${t.endpointId}"`);return[r]}return this.context.resolveEndpointLocationOrThrow(e.endpoint)}};m();y();h();m();y();h();m();y();h();var St=class{constructor(){N(this,"REFERENCE_REGEX",/^(?:(\w+)::)?(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let r=e.match(this.REFERENCE_REGEX);if(!(r==null||r[2]==null||r[3]==null))return{namespace:r[1],method:r[2],path:r[3]}}};m();y();h();var D={Critical:"CRITICAL",Warning:"WARNING"},Lt=class n{constructor(){N(this,"errors");N(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push({...e,path:[...this.path]})}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(t=>t.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}truncate(e){this.errors.length=e}clone(){let e=new n;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let t=[];for(let r of e){if(typeof r=="string"){t.push(r);continue}t[t.length-1]+=`[${r.index}]`}return t}};var Bt=class{constructor({ir:e,config:t,options:r={}}){N(this,"config");N(this,"options");N(this,"errors");N(this,"_ir");N(this,"httpEndpointReferenceParser");this._ir=e,this.config=t,this.options=r,this.errors=new Lt,this.httpEndpointReferenceParser=new St}associateQueryParametersByWireValue({parameters:e,values:t}){let r=[];for(let[a,o]of Object.entries(t))if(o!==void 0){this.errors.scope(a);try{let u=e.find(g=>g.name.wireValue===a);if(u==null)throw this.newParameterNotRecognizedError(a);let p=this.isListTypeReference(u.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:u.name,typeReference:u.typeReference,value:p})}finally{this.errors.unscope()}}return r}associateByWireValueOrDefault({parameters:e,values:t}){let r=[];for(let a of e){this.errors.scope(a.name.wireValue);try{let o=t[a.name.wireValue];if(o==null)if(a.typeReference.type==="primitive"&&a.typeReference.value==="STRING")o=`<${a.name.wireValue}>`;else{this.errors.add({severity:D.Critical,message:this.newParameterNotRecognizedError(a.name.wireValue).message});continue}r.push({name:a.name,typeReference:a.typeReference,value:o})}finally{this.errors.unscope()}}return r}associateByWireValue({parameters:e,values:t,ignoreMissingParameters:r}){let a=[];for(let[o,u]of Object.entries(t))if(u!==void 0){this.errors.scope(o);try{let p=e.find(g=>g.name.wireValue===o);if(p==null){if(r)continue;this.errors.add({severity:D.Critical,message:this.newParameterNotRecognizedError(o).message});continue}a.push({name:p.name,typeReference:p.typeReference,value:u})}finally{this.errors.unscope()}}return a}getExampleObjectProperties({parameters:e,snippetObject:t}){let r=typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{},a=[];for(let o of e){let u=r[o.name.wireValue];u==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:u})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:D.Critical,message:`Expected file value to be a string, got ${typeof r}`});return}return r}}getFileArrayValues({property:e,record:t}){let r=t[e.wireValue];if(r==null)return;if(!Array.isArray(r)){this.errors.add({severity:D.Critical,message:`Expected file array value to be an array of strings, got ${typeof r}`});return}let a=[];for(let o of r){if(typeof o!="string"){this.errors.add({severity:D.Critical,message:`Expected file array value to be an array of strings, got ${typeof o}`});return}a.push(o)}return a}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:D.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e??{}}resolveNamedType({typeId:e}){let t=this._ir.types[e];if(t==null){this.errors.add({severity:D.Critical,message:`Type identified by "${e}" could not be found`});return}return t}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t}){let r=this.getRecord(t);if(r==null)return;let a=e.discriminant.wireValue,o=r[a];if(o==null){this.errors.add({severity:D.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:D.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let u=e.types[o];if(u==null){this.errors.add({severity:D.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:p,...g}=r;return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:g}}resolveEndpointOrThrow(e){let t=this.httpEndpointReferenceParser.tryParse(e);if(t==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(t)}resolveEndpointLocation(e){let t=[];for(let r of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:r,parsedEndpoint:e})&&t.push(r);return t}resolveEndpointLocationOrThrow(e){let t=this.resolveEndpointLocation(e);if(t.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return t}resolveEndpointById(e){return this._ir.endpoints[e]}resolveEndpointByIdOrThrow(e){let t=this.resolveEndpointById(e);if(t==null)throw new Error(`Failed to find endpoint with ID "${e}"`);return t}needsRequestParameter({request:e,inlinePathParameters:t,inlineFileProperties:r}){return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:t})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:r}):!e.metadata?.onlyPathParameters}includePathParametersInWrappedRequest({request:e,inlinePathParameters:t}){return t&&(e.metadata?.includePathParameters??!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:$(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":{let r=t.environments.find(a=>a.id===e);return r?.name}case"multipleBaseUrls":{let r=t.environments.find(a=>a.id===e);return r?.name}default:$(t)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:D.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let t=this._ir.environments.environments;switch(t.type){case"singleBaseUrl":return this.errors.add({severity:D.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let r=t.environments[0];if(r==null)return this.errors.add({severity:D.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(Nt(r.urls));for(let o of Nt(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:D.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${Nt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:D.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:D.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:D.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let t=this.resolveNamedType({typeId:e.value});return t==null?!1:t.type==="alias"?this.isNullable(t.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:t}){return new Error(`Expected auth type ${e.type}, got ${t.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:t}){return new Error(`Expected ${e}, got ${typeof t}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:t}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t});default:$(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:t}){return this.fileUploadHasBodyProperties({fileUpload:e})||t&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:$(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:$(t)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:t}){return e.location.method===t.method&&e.location.path===t.path}};m();y();h();var Me;(function(n){n.Concise="concise",n.Full="full"})(Me||(Me={}));m();y();h();var se={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};m();y();h();m();y();h();m();y();h();m();y();h();var $e=class extends Et{constructor({packageName:t,customConfig:r,formatter:a}){super();N(this,"packageName");N(this,"customConfig");N(this,"formatter");N(this,"imports",new Set);this.packageName=t,this.customConfig=r,this.formatter=a??new It}addImport(t){this.imports.add(t)}getImports(){return new Set(this.imports)}};var Pt=class extends $e{constructor({packageName:e,customConfig:t,formatter:r}){super({packageName:e,customConfig:t,formatter:r})}async toStringAsync(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.format(e)}catch(t){throw new Error(`Failed to format Java file: ${t}
16
16
  ${e}`)}return e}toString(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(e)}catch(t){throw new Error(`Failed to format Java file: ${t}
17
17
  ${e}`)}return e}getContent(){let e=`package ${this.packageName};
18
18
 
19
19
  `,t=this.stringifyImports();return t.length>0?`${e}${t}
20
20
 
21
21
  ${this.buffer}`:e+this.buffer}stringifyImports(){return Array.from(this.imports).filter(e=>e!==this.packageName).map(e=>`import ${e};`).sort().join(`
22
- `)}};m();y();h();m();y();h();var O={};cr(O,{BRAND:()=>du,DIRTY:()=>De,EMPTY_PATH:()=>Wo,INVALID:()=>L,NEVER:()=>Yu,OK:()=>te,ParseStatus:()=>X,Schema:()=>U,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>qe,ZodBoolean:()=>We,ZodBranded:()=>Ot,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>Yt,ZodEffects:()=>fe,ZodEnum:()=>Qe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>P,ZodFunction:()=>Qt,ZodIntersection:()=>Je,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>Ve,ZodObject:()=>ue,ZodOptional:()=>pe,ZodParsedType:()=>E,ZodPipeline:()=>Ut,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Kt,ZodSchema:()=>U,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>U,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Re,ZodVoid:()=>xt,addIssueToContext:()=>I,any:()=>bu,array:()=>Nu,bigint:()=>yu,boolean:()=>Ni,coerce:()=>Ju,custom:()=>Ti,date:()=>gu,datetimeRegex:()=>wi,defaultErrorMap:()=>ke,discriminatedUnion:()=>Au,effect:()=>Du,enum:()=>ju,function:()=>Fu,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>mu,intersection:()=>Cu,isAborted:()=>Ht,isAsync:()=>ht,isDirty:()=>Jt,isValid:()=>Se,late:()=>fu,lazy:()=>Ou,literal:()=>Uu,makeIssue:()=>Ft,map:()=>Bu,nan:()=>hu,nativeEnum:()=>Mu,never:()=>_u,null:()=>wu,nullable:()=>qu,number:()=>ki,object:()=>Ru,objectUtil:()=>Tr,oboolean:()=>Hu,onumber:()=>Gu,optional:()=>Vu,ostring:()=>Zu,pipeline:()=>zu,preprocess:()=>Wu,promise:()=>$u,quotelessJson:()=>Do,record:()=>Lu,set:()=>Pu,setErrorMap:()=>qo,strictObject:()=>Iu,string:()=>_i,symbol:()=>xu,transformer:()=>Du,tuple:()=>Su,undefined:()=>vu,union:()=>Eu,unknown:()=>Tu,util:()=>$,void:()=>ku});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var $;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let o={};for(let u of a)o[u]=u;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(p=>typeof a[a[p]]!="number"),u={};for(let p of o)u[p]=a[p];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(o){return a[o]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&o.push(u);return o},n.find=(a,o)=>{for(let u of a)if(o(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})($||($={}));var Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));var E=$.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=n=>{switch(typeof n){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(n)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(n)?E.array:n===null?E.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?E.promise:typeof Map<"u"&&n instanceof Map?E.map:typeof Set<"u"&&n instanceof Set?E.set:typeof Date<"u"&&n instanceof Date?E.date:E.object;default:return E.unknown}};var b=$.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"]),Do=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},a=o=>{for(let u of o.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let p=r,x=0;for(;x<u.path.length;){let w=u.path[x];x===u.path.length-1?(p[w]=p[w]||{_errors:[]},p[w]._errors.push(t(u))):p[w]=p[w]||{_errors:[]},p=p[w],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,$.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];t[o]=t[o]||[],t[o].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};oe.create=n=>new oe(n);var Vo=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===E.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,$.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${$.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${$.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${$.joinValues(n.options)}, received '${n.received}'`;break;case b.invalid_arguments:t="Invalid function arguments";break;case b.invalid_return_type:t="Invalid function return type";break;case b.invalid_date:t="Invalid date";break;case b.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:$.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case b.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case b.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case b.custom:t="Invalid input";break;case b.invalid_intersection_types:t="Intersection results could not be merged";break;case b.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case b.not_finite:t="Number must be finite";break;default:t=e.defaultError,$.assertNever(n)}return{message:t}},ke=Vo;var hi=ke;function qo(n){hi=n}function mt(){return hi}m();y();h();var Ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let p="",x=r.filter(w=>!!w).slice().reverse();for(let w of x)p=w(u,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},Wo=[];function I(n,e){let t=mt(),r=Ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ke?void 0:ke].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return L;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let o=await a.key,u=await a.value;r.push({key:o,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return L;o.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[o.value]=u.value)}return{status:e.value,value:r}}},L=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),te=n=>({status:"valid",value:n}),Ht=n=>n.status==="aborted",Jt=n=>n.status==="dirty",Se=n=>n.status==="valid",ht=n=>typeof Promise<"u"&&n instanceof Promise;m();y();h();m();y();h();var A;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(A||(A={}));var de=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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}},yi=(n,e)=>{if(Se(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(n.common.issues);return this._error=t,this._error}}};function F(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))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:(u,p)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??p.defaultError}:typeof p.data>"u"?{message:x??r??p.defaultError}:u.code!=="invalid_type"?{message:p.defaultError}:{message:x??t??p.defaultError}},description:a}}var U=class{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ht(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},a=this._parseSync({data:e,path:r.path,parent:r});return yi(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Se(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Se(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(ht(a)?a:Promise.resolve(a));return yi(r,o)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,o)=>{let u=e(a),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(p(),!1)):u?!0:(p(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new fe({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 pe.create(this,this._def)}nullable(){return we.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Pe.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Je.create(this,e,this._def)}transform(e){return new fe({...F(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...F(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new Ot({typeName:P.ZodBranded,type:this,...F(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...F(this._def),innerType:this,catchValue:t,typeName:P.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ut.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zo=/^c[^\s-]{8,}$/i,Zo=/^[0-9a-z]+$/,Go=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ho=/^[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,Jo=/^[a-z0-9_-]{21}$/i,Yo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ko=/^[-+]?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)?)??$/,Qo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,eu=/^(?:(?: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])$/,tu=/^(?:(?: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])$/,ru=/^(([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]))$/,nu=/^(([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])$/,au=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,iu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xi="((\\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])))",su=new RegExp(`^${xi}$`);function vi(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ou(n){return new RegExp(`^${vi(n)}$`)}function wi(n){let e=`${xi}T${vi(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function uu(n,e){return!!((e==="v4"||!e)&&eu.test(n)||(e==="v6"||!e)&&ru.test(n))}function lu(n,e){if(!Yo.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function cu(n,e){return!!((e==="v4"||!e)&&tu.test(n)||(e==="v6"||!e)&&nu.test(n))}var Le=class n extends U{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==E.string){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:E.string,received:o.parsedType}),L}let r=new X,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),I(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),I(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let u=e.data.length>o.value,p=e.data.length<o.value;(u||p)&&(a=this._getOrReturnCtx(e,a),u?I(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):p&&I(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Qo.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(Xo,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Ho.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")Jo.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")zo.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Zo.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Go.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),I(a,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?wi(o).test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?su.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?ou(o).test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Ko.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?uu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?lu(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?cu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?au.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?iu.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):$.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:b.invalid_string,...A.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.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,...A.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,...A.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...A.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...A.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...A.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...A.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...A.errToObj(t)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Le.create=n=>new Le({checks:[],typeName:P.ZodString,coerce:n?.coerce??!1,...F(n)});function pu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,o=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return o%u/10**a}var Ve=class n extends U{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)!==E.number){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:E.number,received:o.parsedType}),L}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?$.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?pu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),I(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),I(r,{code:b.not_finite,message:o.message}),a.dirty()):$.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:A.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let 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"&&$.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:P.ZodNumber,coerce:n?.coerce||!1,...F(n)});var qe=class n extends U{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)!==E.bigint)return this._getInvalidInput(e);let r,a=new X;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),I(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),I(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):$.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:E.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:A.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};qe.create=n=>new qe({checks:[],typeName:P.ZodBigInt,coerce:n?.coerce??!1,...F(n)});var We=class extends U{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==E.boolean){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:E.boolean,received:r.parsedType}),L}return te(e.data)}};We.create=n=>new We({typeName:P.ZodBoolean,coerce:n?.coerce||!1,...F(n)});var ze=class n extends U{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==E.date){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:E.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_date}),L}let r=new X,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),I(a,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),I(a,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):$.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:A.toString(t)})}get minDate(){let e=null;for(let 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(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:P.ZodDate,...F(n)});var gt=class extends U{_parse(e){if(this._getType(e)!==E.symbol){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:E.symbol,received:r.parsedType}),L}return te(e.data)}};gt.create=n=>new gt({typeName:P.ZodSymbol,...F(n)});var Ze=class extends U{_parse(e){if(this._getType(e)!==E.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:E.undefined,received:r.parsedType}),L}return te(e.data)}};Ze.create=n=>new Ze({typeName:P.ZodUndefined,...F(n)});var Ge=class extends U{_parse(e){if(this._getType(e)!==E.null){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:E.null,received:r.parsedType}),L}return te(e.data)}};Ge.create=n=>new Ge({typeName:P.ZodNull,...F(n)});var Be=class extends U{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}};Be.create=n=>new Be({typeName:P.ZodAny,...F(n)});var Re=class extends U{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}};Re.create=n=>new Re({typeName:P.ZodUnknown,...F(n)});var he=class extends U{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:E.never,received:t.parsedType}),L}};he.create=n=>new he({typeName:P.ZodNever,...F(n)});var xt=class extends U{_parse(e){if(this._getType(e)!==E.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:E.void,received:r.parsedType}),L}return te(e.data)}};xt.create=n=>new xt({typeName:P.ZodVoid,...F(n)});var Ie=class n extends U{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==E.array)return I(t,{code:b.invalid_type,expected:E.array,received:t.parsedType}),L;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(u||p)&&(I(t,{code:u?b.too_big:b.too_small,minimum:p?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(I(t,{code:b.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(I(t,{code:b.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,p)=>a.type._parseAsync(new de(t,u,t.path,p)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,p)=>a.type._parseSync(new de(t,u,t.path,p)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:A.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:A.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:A.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...F(e)});function yt(n){if(n instanceof ue){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new ue({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:yt(n.element)}):n instanceof pe?pe.create(yt(n.unwrap())):n instanceof we?we.create(yt(n.unwrap())):n instanceof ve?ve.create(n.items.map(e=>yt(e))):n}var ue=class n extends U{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=$.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==E.object){let w=this._getOrReturnCtx(e);return I(w,{code:b.invalid_type,expected:E.object,received:w.parsedType}),L}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let w in a.data)u.includes(w)||p.push(w);let x=[];for(let w of u){let _=o[w],B=a.data[w];x.push({key:{status:"valid",value:w},value:_._parse(new de(a,B,a.path,w)),alwaysSet:w in a.data})}if(this._def.catchall instanceof he){let w=this._def.unknownKeys;if(w==="passthrough")for(let _ of p)x.push({key:{status:"valid",value:_},value:{status:"valid",value:a.data[_]}});else if(w==="strict")p.length>0&&(I(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(w!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let _ of p){let B=a.data[_];x.push({key:{status:"valid",value:_},value:w._parse(new de(a,B,a.path,_)),alwaysSet:_ in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let w=[];for(let _ of x){let B=await _.key,J=await _.value;w.push({key:B,value:J,alwaysSet:_.alwaysSet})}return w}).then(w=>X.mergeObjectSync(r,w)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:A.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({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 n({...this._def,catchall:e})}pick(e){let t={};for(let r of $.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of $.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return yt(this)}partial(e){let t={};for(let r of $.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of $.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof pe;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return bi($.objectKeys(this.shape))}};ue.create=(n,e)=>new ue({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:P.ZodObject,...F(e)});ue.strictCreate=(n,e)=>new ue({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:P.ZodObject,...F(e)});ue.lazycreate=(n,e)=>new ue({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:P.ZodObject,...F(e)});var He=class extends U{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let p of o)if(p.result.status==="valid")return p.result;for(let p of o)if(p.result.status==="dirty")return t.common.issues.push(...p.ctx.common.issues),p.result;let u=o.map(p=>new oe(p.ctx.common.issues));return I(t,{code:b.invalid_union,unionErrors:u}),L}if(t.common.async)return Promise.all(r.map(async o=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let o,u=[];for(let x of r){let w={...t,common:{...t.common,issues:[]},parent:null},_=x._parseSync({data:t.data,path:t.path,parent:w});if(_.status==="valid")return _;_.status==="dirty"&&!o&&(o={result:_,ctx:w}),w.common.issues.length&&u.push(w.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=u.map(x=>new oe(x));return I(t,{code:b.invalid_union,unionErrors:p}),L}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:P.ZodUnion,...F(e)});var Ne=n=>n instanceof Ye?Ne(n.schema):n instanceof fe?Ne(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?$.objectValues(n.enum):n instanceof et?Ne(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...Ne(n.unwrap())]:n instanceof we?[null,...Ne(n.unwrap())]:n instanceof Ot||n instanceof rt?Ne(n.unwrap()):n instanceof tt?Ne(n._def.innerType):[],Yt=class n extends U{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.object)return I(t,{code:b.invalid_type,expected:E.object,received:t.parsedType}),L;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(I(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let o of t){let u=Ne(o.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of u){if(a.has(p))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(p)}`);a.set(p,o)}}return new n({typeName:P.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...F(r)})}};function kr(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===E.object&&r===E.object){let a=$.objectKeys(e),o=$.objectKeys(n).filter(p=>a.indexOf(p)!==-1),u={...n,...e};for(let p of o){let x=kr(n[p],e[p]);if(!x.valid)return{valid:!1};u[p]=x.data}return{valid:!0,data:u}}else if(t===E.array&&r===E.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],p=e[o],x=kr(u,p);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===E.date&&r===E.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Je=class extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(Ht(o)||Ht(u))return L;let p=kr(o.value,u.value);return p.valid?((Jt(o)||Jt(u))&&t.dirty(),{status:t.value,value:p.data}):(I(r,{code:b.invalid_intersection_types}),L)};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(([o,u])=>a(o,u)):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}))}};Je.create=(n,e,t)=>new Je({left:n,right:e,typeName:P.ZodIntersection,...F(t)});var ve=class n extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.array)return I(r,{code:b.invalid_type,expected:E.array,received:r.parsedType}),L;if(r.data.length<this._def.items.length)return I(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&r.data.length>this._def.items.length&&(I(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,p)=>{let x=this._def.items[p]||this._def.rest;return x?x._parse(new de(r,u,r.path,p)):null}).filter(u=>!!u);return r.common.async?Promise.all(o).then(u=>X.mergeArray(t,u)):X.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};ve.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ve({items:n,typeName:P.ZodTuple,rest:null,...F(e)})};var Kt=class n extends U{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.object)return I(r,{code:b.invalid_type,expected:E.object,received:r.parsedType}),L;let a=[],o=this._def.keyType,u=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:u._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof U?new n({keyType:e,valueType:t,typeName:P.ZodRecord,...F(r)}):new n({keyType:Le.create(),valueType:e,typeName:P.ZodRecord,...F(t)})}},vt=class extends U{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.map)return I(r,{code:b.invalid_type,expected:E.map,received:r.parsedType}),L;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([p,x],w)=>({key:a._parse(new de(r,p,r.path,[w,"key"])),value:o._parse(new de(r,x,r.path,[w,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let x of u){let w=await x.key,_=await x.value;if(w.status==="aborted"||_.status==="aborted")return L;(w.status==="dirty"||_.status==="dirty")&&t.dirty(),p.set(w.value,_.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let x of u){let w=x.key,_=x.value;if(w.status==="aborted"||_.status==="aborted")return L;(w.status==="dirty"||_.status==="dirty")&&t.dirty(),p.set(w.value,_.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:P.ZodMap,...F(t)});var wt=class n extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.set)return I(r,{code:b.invalid_type,expected:E.set,received:r.parsedType}),L;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(I(r,{code:b.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(I(r,{code:b.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function u(x){let w=new Set;for(let _ of x){if(_.status==="aborted")return L;_.status==="dirty"&&t.dirty(),w.add(_.value)}return{status:t.value,value:w}}let p=[...r.data.values()].map((x,w)=>o._parse(new de(r,x,r.path,w)));return r.common.async?Promise.all(p).then(x=>u(x)):u(p)}min(e,t){return new n({...this._def,minSize:{value:e,message:A.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:A.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};wt.create=(n,e)=>new wt({valueType:n,minSize:null,maxSize:null,typeName:P.ZodSet,...F(e)});var Qt=class n extends U{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.function)return I(t,{code:b.invalid_type,expected:E.function,received:t.parsedType}),L;function r(p,x){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_arguments,argumentsError:x}})}function a(p,x){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_return_type,returnTypeError:x}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Pe){let p=this;return te(async function(...x){let w=new oe([]),_=await p._def.args.parseAsync(x,o).catch(C=>{throw w.addIssue(r(x,C)),w}),B=await Reflect.apply(u,this,_);return await p._def.returns._def.type.parseAsync(B,o).catch(C=>{throw w.addIssue(a(B,C)),w})})}else{let p=this;return te(function(...x){let w=p._def.args.safeParse(x,o);if(!w.success)throw new oe([r(x,w.error)]);let _=Reflect.apply(u,this,w.data),B=p._def.returns.safeParse(_,o);if(!B.success)throw new oe([a(_,B.error)]);return B.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ve.create(e).rest(Re.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||ve.create([]).rest(Re.create()),returns:t||Re.create(),typeName:P.ZodFunction,...F(r)})}},Ye=class extends U{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ye.create=(n,e)=>new Ye({getter:n,typeName:P.ZodLazy,...F(e)});var Ke=class extends U{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return I(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:P.ZodLiteral,...F(e)});function bi(n,e){return new Qe({values:n,typeName:P.ZodEnum,...F(e)})}var Qe=class n extends U{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{expected:$.joinValues(r),received:t.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return te(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Qe.create=bi;var Xe=class extends U{_parse(e){let t=$.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==E.string&&r.parsedType!==E.number){let a=$.objectValues(t);return I(r,{expected:$.joinValues(a),received:r.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set($.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=$.objectValues(t);return I(r,{received:r.data,code:b.invalid_enum_value,options:a}),L}return te(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:P.ZodNativeEnum,...F(e)});var Pe=class extends U{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.promise&&t.common.async===!1)return I(t,{code:b.invalid_type,expected:E.promise,received:t.parsedType}),L;let r=t.parsedType===E.promise?t.data:Promise.resolve(t.data);return te(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Pe.create=(n,e)=>new Pe({type:n,typeName:P.ZodPromise,...F(e)});var fe=class extends U{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:u=>{I(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let u=a.transform(r.data,o);if(r.common.async)return Promise.resolve(u).then(async p=>{if(t.value==="aborted")return L;let x=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return x.status==="aborted"?L:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return L;let p=this._def.schema._parseSync({data:u,path:r.path,parent:r});return p.status==="aborted"?L:p.status==="dirty"?De(p.value):t.value==="dirty"?De(p.value):p}}if(a.type==="refinement"){let u=p=>{let x=a.refinement(p,o);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){let p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value),{status:t.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value).then(()=>({status:t.value,value:p.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Se(u))return L;let p=a.transform(u.value,o);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:p}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Se(u)?Promise.resolve(a.transform(u.value,o)).then(p=>({status:t.value,value:p})):L);$.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:P.ZodEffects,effect:e,...F(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:P.ZodEffects,...F(t)});var pe=class extends U{_parse(e){return this._getType(e)===E.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:P.ZodOptional,...F(e)});var we=class extends U{_parse(e){return this._getType(e)===E.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:P.ZodNullable,...F(e)});var et=class extends U{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===E.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:P.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...F(e)});var tt=class extends U{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ht(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:P.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...F(e)});var bt=class extends U{_parse(e){if(this._getType(e)!==E.nan){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:E.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:P.ZodNaN,...F(n)});var du=Symbol("zod_brand"),Ot=class extends U{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Ut=class n extends U{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?L:o.status==="dirty"?(t.dirty(),De(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?L:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:P.ZodPipeline})}},rt=class extends U{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Se(a)&&(a.value=Object.freeze(a.value)),a);return ht(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:P.ZodReadonly,...F(e)});function gi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ti(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let p=gi(e,r),x=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:x})}});if(!o){let u=gi(e,r),p=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:p})}}):Be.create()}var fu={object:ue.lazycreate},P;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(P||(P={}));var mu=(n,e={message:`Input not instance of ${n.name}`})=>Ti(t=>t instanceof n,e),_i=Le.create,ki=Ve.create,hu=bt.create,yu=qe.create,Ni=We.create,gu=ze.create,xu=gt.create,vu=Ze.create,wu=Ge.create,bu=Be.create,Tu=Re.create,_u=he.create,ku=xt.create,Nu=Ie.create,Ru=ue.create,Iu=ue.strictCreate,Eu=He.create,Au=Yt.create,Cu=Je.create,Su=ve.create,Lu=Kt.create,Bu=vt.create,Pu=wt.create,Fu=Qt.create,Ou=Ye.create,Uu=Ke.create,ju=Qe.create,Mu=Xe.create,$u=Pe.create,Du=fe.create,Vu=pe.create,qu=we.create,Wu=fe.createWithPreprocess,zu=Ut.create,Zu=()=>_i().optional(),Gu=()=>ki().optional(),Hu=()=>Ni().optional(),Ju={string:(n=>Le.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>We.create({...n,coerce:!0})),bigint:(n=>qe.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Yu=L;m();y();h();var Ri=O.strictObject({title:O.string(),content:O.string()});var Nr=O.object({"base-api-exception-class-name":O.string().optional(),"base-exception-class-name":O.string().optional(),"client-class-name":O.string().optional(),"inline-file-properties":O.boolean().optional(),"inline-path-parameters":O.boolean().optional(),"package-layout":O.enum(["flat","nested"]).optional(),"package-prefix":O.string().optional(),"use-local-date-for-dates":O.boolean().optional(),"custom-dependencies":O.array(O.string()).optional(),"custom-plugins":O.array(O.string()).optional(),"disable-required-property-builder-checks":O.boolean().optional(),"enable-forward-compatible-enums":O.boolean().optional(),"enable-inline-types":O.boolean().optional(),"enable-public-constructors":O.boolean().optional(),"generate-unknown-as-json-node":O.boolean().optional(),"json-include":O.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":O.boolean().optional(),"use-default-request-parameter-values":O.boolean().optional(),"enable-wire-tests":O.boolean().default(!1),"collapse-optional-nullable":O.boolean().optional(),"custom-readme-sections":O.array(Ri).optional(),"custom-pager-name":O.string().optional(),"default-timeout-in-seconds":O.number().optional(),"gradle-distribution-url":O.string().optional(),"gradle-plugin-management":O.string().optional(),"gradle-central-dependency-management":O.boolean().optional(),"output-directory":O.enum(["source-root","project-root"]).optional(),"custom-interceptors":O.boolean().optional(),"omit-fern-headers":O.boolean().optional(),"enable-gradle-profiling":O.boolean().optional(),"wrapped-aliases":O.boolean().optional(),maxRetries:O.number().int().min(0).optional()});var d={};cr(d,{Access:()=>Rr,AstNode:()=>Z,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>V,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>ut,Type:()=>jt,TypeLiteral:()=>le,Writer:()=>$e,classReference:()=>xl,class_:()=>gl,codeblock:()=>yl,instantiateClass:()=>vl,invokeMethod:()=>wl,method:()=>bl,parameter:()=>Tl});m();y();h();m();y();h();m();y();h();var Z=class extends je{async toStringAsync({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toString()}};var nt=class extends Z{constructor({name:t,access:r}){super();R(this,"name");R(this,"access");R(this,"methods",[]);this.name=t,this.access=r}write(t){if(t.write(`${this.access} class ${this.name}`),this.isEmpty()){t.writeLine(" {}");return}t.writeLine(" {"),t.indent();for(let r of this.methods)t.writeNode(r),t.newLine();t.dedent(),t.write("}")}addMethod(t){this.methods.push(t)}isEmpty(){return this.methods.length===0}};m();y();h();m();y();h();var Rr={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();m();y();h();m();y();h();var V=class extends Z{constructor({name:t,packageName:r,fullyQualified:a}){super();R(this,"name");R(this,"packageName");R(this,"fullyQualified");this.name=t,this.packageName=r,this.fullyQualified=a??!1}write(t){if(t.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){t.write(`${this.packageName}.${this.name}`);return}t.write(this.name)}};m();y();h();var jt=class extends Z{constructor(t){super();R(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"array":t.writeNode(this.internalType.value),t.write("[]");break;case"bigInteger":t.writeNode(Ku);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(el);break;case"double":t.write("Double");break;case"float":t.write("Float");break;case"generic":t.writeNode(this.internalType.value),t.write("<");for(let[r,a]of this.internalType.parameters.entries())t.writeNode(a),r<this.internalType.parameters.length-1&&t.write(", ");t.write(">");break;case"inputStream":t.writeNode(nl);break;case"integer":t.write("Integer");break;case"iterable":this.writeIterable({writer:t,iterable:this.internalType});break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write("Long");break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"object":{t.write("Object");break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write("String");break;case"uuid":t.writeNode(rl);break;case"void":t.write("Void");break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(t){return new this({type:"array",value:t})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(t){return new this({type:"list",value:t})}static long(){return new this({type:"long"})}static map(t,r){return new this({type:"map",keyType:t,valueType:r})}static object(){return new this({type:"object"})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static reference(t){return new this({type:"reference",value:t})}static generic(t,r){return new this({type:"generic",value:t,parameters:r})}static set(t){return new this({type:"set",value:t})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(t){return new this({type:"iterable",value:t})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:t,list:r}){t.writeNode(Qu),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(Xu),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Ir),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(al),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(tl),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Xt=new V({name:"Arrays",packageName:"java.util"}),Ku=new V({name:"BigInteger",packageName:"java.math"}),mg=new V({name:"HashMap",packageName:"java.util"}),Qu=new V({name:"List",packageName:"java.util"}),Xu=new V({name:"Map",packageName:"java.util"}),el=new V({name:"OffsetDateTime",packageName:"java.time"}),Ir=new V({name:"Optional",packageName:"java.util"}),tl=new V({name:"Set",packageName:"java.util"}),rl=new V({name:"UUID",packageName:"java.util"}),nl=new V({name:"InputStream",packageName:"java.io"}),al=new V({name:"Iterable",packageName:"java.lang"});var le=class n extends Z{constructor(t){super();R(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:t,bigInteger:this.internalType});break;case"boolean":t.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:t,builder:this.internalType});break;case"bytes":t.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:t,class_:this.internalType});break}case"date":this.writeDate({writer:t,date:this.internalType});break;case"dateTime":this.writeDateTime({writer:t,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?t.write(`${r}.0`):t.write(r);break}case"enum":this.writeEnum({writer:t,enum_:this.internalType});break;case"float":t.write(`${this.internalType.value}f`);break;case"integer":t.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"raw":{this.internalType.value instanceof Z?t.writeNode(this.internalType.value):t.write(this.internalType.value);break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:t,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:t,uuid:this.internalType});break;case"nop":break;default:M(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(t){return new this({type:"bigInteger",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static builder({classReference:t,parameters:r}){return new this({type:"builder",classReference:t,parameters:r})}static bytes(t){return new this({type:"bytes",value:t})}static class_({reference:t,parameters:r}){return new this({type:"class",reference:t,parameters:r})}static date(t){return new this({type:"date",value:t})}static dateTime(t){return new this({type:"dateTime",value:t})}static double(t){return new this({type:"double",value:t})}static enum_({classReference:t,value:r}){return new this({type:"enum",classReference:t,value:r})}static float(t){return new this({type:"float",value:t})}static integer(t){return new this({type:"integer",value:t})}static list({valueType:t,values:r,isParameter:a}){return new this({type:"list",valueType:t,values:r,isParameter:a})}static long(t){return new this({type:"long",value:t})}static map({keyType:t,valueType:r,entries:a}){return new this({type:"map",keyType:t,valueType:r,entries:a})}static optional({value:t,useOf:r}){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t,useOf:r})}static raw(t){return new this({type:"raw",value:t})}static reference(t){return new this({type:"reference",value:t})}static set({valueType:t,values:r}){return new this({type:"set",valueType:t,values:r})}static string(t){return new this({type:"string",value:t})}static unknown(t){return new this({type:"unknown",value:t})}static uuid(t){return new this({type:"uuid",value:t})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:M(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:il,arguments_:[n.string(r.value)]}))}writeBuilder({writer:t,builder:r}){t.writeNode(r.classReference),t.writeNewLineIfLastLineNot(),t.indent(),this.writeBuilderParameters({writer:t,parameters:this.orderBuilderParameters(pl({parameters:r.parameters}))}),t.dedent()}writeBuilderParameters({writer:t,parameters:r}){t.writeLine(".builder()");for(let a of r)t.write(`.${a.name}(`),a.value.shouldWriteInLine()||t.newLine(),t.indent(),t.writeNode(a.value),t.dedent(),a.value.shouldWriteInLine()||t.newLine(),t.writeLine(")");t.writeNewLineIfLastLineNot(),t.write(".build()")}orderBuilderParameters(t){return t.some(a=>!a.value.isOptional()&&!this.isCollection(a.value))?t.sort((a,o)=>{let u=this.isNonRequired(a.value),p=this.isNonRequired(o.value);return u&&!p?1:!u&&p?-1:0}):t.sort((a,o)=>{let u=a.value.isOptional(),p=o.value.isOptional();return u&&!p?1:!u&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=cl({parameters:r.parameters});t.writeNode(d.instantiateClass({classReference:r.reference,arguments_:a.map(o=>o.value)}))}writeDate({writer:t,date:r}){t.writeNode(d.invokeMethod({on:ol,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:ul,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:t,enum_:r}){t.writeNode(r.classReference),t.write("."+r.value)}writeList({writer:t,list:r}){this.writeIterable({writer:t,iterable:r})}writeMap({writer:t,map:r}){let a=dl({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(er),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(er),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.writeLine(">() {{"),t.indent();for(let o of a)t.write("put("),t.writeNode(o.key),t.write(", "),t.writeNode(o.value),t.writeLine(");");t.dedent(),t.write("}}")}writeOptional({writer:t,optional:r}){if(!r.useOf){t.writeNode(r.value);return}t.writeNode(d.invokeMethod({on:Ir,method:"of",arguments_:[r.value]}))}writeSet({writer:t,set:r}){this.writeIterable({writer:t,iterable:r})}writeIterable({writer:t,iterable:r}){let a=r.type==="list"?Er:sl,o=fl({values:r.values});if(r.type==="list"&&r.isParameter&&o.length>0){t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:o}));return}if(o.length===0){t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.writeLine(">("),t.indent(),t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:o})),t.writeNewLineIfLastLineNot(),t.dedent(),t.write(")")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(`"${this.escapeString(r)}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownMap({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("new "),t.writeNode(Er),t.write("<Object>()");return}t.write("new "),t.writeNode(Er),t.write("<Object>("),t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:r.map(a=>n.unknown(a))})),t.write(")")}writeUnknownMap({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("new "),t.writeNode(er),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(er),t.write("<String, Object>() {{"),t.indent();for(let[o,u]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(u)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:ll,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Er=new V({name:"ArrayList",packageName:"java.util"}),il=new V({name:"BigInteger",packageName:"java.math"}),er=new V({name:"HashMap",packageName:"java.util"}),sl=new V({name:"HashSet",packageName:"java.util"}),Ng=new V({name:"List",packageName:"java.util"}),ol=new V({name:"LocalDate",packageName:"java.time"}),Rg=new V({name:"Map",packageName:"java.util"}),ul=new V({name:"OffsetDateTime",packageName:"java.time"}),Ig=new V({name:"Set",packageName:"java.util"}),ll=new V({name:"UUID",packageName:"java.util"});function cl({parameters:n}){return n.filter(e=>!le.isNop(e.value))}function pl({parameters:n}){return n.filter(e=>!le.isNop(e.value))}function dl({entries:n}){return n.filter(e=>!le.isNop(e.key)&&!le.isNop(e.value))}function fl({values:n}){return n.filter(e=>!le.isNop(e))}function tr({writer:n,arguments_:e}){let t=hl(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof le&&!a.shouldWriteInLine())){ml({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ii({writer:n,argument:a})}),n.write(")")}function ml({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ii({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ii({writer:n,argument:e}){br(e)?n.writeNodeOrString(e.assignment):e.write(n)}function hl(n){return n.filter(e=>!(e instanceof le&&le.isNop(e)))}var at=class extends Z{constructor({classReference:t,arguments_:r}){super();R(this,"classReference");R(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),tr({writer:t,arguments_:this.arguments_})}};m();y();h();var it=class extends Z{constructor(t){super();R(this,"arg");this.arg=t}write(t){return new me(this.arg).write(t)}};m();y();h();var st=class extends Z{constructor({name:t,access:r,parameters:a,body:o,static_:u,return_:p}){super();R(this,"name");R(this,"access");R(this,"parameters");R(this,"body");R(this,"return_");R(this,"static_");this.name=t,this.access=r,this.parameters=a,this.body=o,this.return_=p,this.static_=u??!1}write(t){if(t.write(`${this.access} `),this.static_&&t.write("static "),this.return_!=null?t.writeNode(this.return_):t.write("void"),t.write(` ${this.name}`),this.parameters.length===0)t.write("()");else if(this.parameters.length===1){if(t.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);t.writeNode(this.parameters[0]),t.write(")")}else t.writeLine("("),t.indent(),this.parameters.forEach((r,a)=>{a>0&&t.writeLine(", "),t.writeNode(r)}),t.dedent(),t.write(")");if(this.body==null){t.write(";");return}t.writeLine(" {"),t.indent(),t.writeNode(this.body),t.writeNewLineIfLastLineNot(),t.dedent(),t.write("}")}};m();y();h();var ot=class extends Z{constructor({method:t,arguments_:r,on:a}){super();R(this,"on");R(this,"method");R(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),tr({writer:t,arguments_:this.arguments_})}};m();y();h();var ut=class extends Z{constructor({name:t,type:r}){super();R(this,"name");R(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function yl(n){return new it(n)}function gl(n){return new nt(n)}function xl(n){return new V(n)}function vl(n){return new at(n)}function wl(n){return new ot(n)}function bl(n){return new st(n)}function Tl(n){return new ut(n)}m();y();h();var rr=class{constructor({context:e}){R(this,"context");this.context=e}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}wrapInOptionalIfNotNop(e,t=!1,r=!1){return d.TypeLiteral.isNop(e)?e:r?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:D.Critical,message:"Expected non-null value, but got null"}),d.TypeLiteral.nop());if(e.value===void 0)return d.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,as:e.as});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,as:e.as});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?d.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion})}case"nullable":case"optional":{if(e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&e.typeReference.value.type==="named")return e.isCollapsedOptionalNullable||this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable")?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(e.typeReference.value.type==="list"){let a=this.convertList({list:e.typeReference.value.value,value:e.value});return this.wrapInOptionalIfNotNop(a,!0,e.isCollapsedOptionalNullable===!0)}if(this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable"))return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,isCollapsedOptionalNullable:!0});let t=this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion}),r=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapInOptionalIfNotNop(t,r,e.isCollapsedOptionalNullable===!0)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:M(e.typeReference)}}convertList({list:e,value:t,as:r}){if(!Array.isArray(t))return this.context.errors.add({severity:D.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let a=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,u)=>{this.context.errors.scope({index:u});try{if(a){let p=this.convert({typeReference:e.value,value:o,as:r});return this.wrapInOptionalIfNotNop(p,!0)}return this.convert({typeReference:e,value:o,as:r})}finally{this.context.errors.unscope()}}),isParameter:!0})}convertLiteral({literal:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.string(r)}default:M(e)}}convertSet({set:e,value:t,as:r}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,as:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:D.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:D.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"mapKey"}),value:this.convert({typeReference:e.value,value:o,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a}){switch(e.type){case"alias":if(e.typeReference.type==="unknown"){let o=this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});return d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[o]}))}return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:M(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return d.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType;switch(o.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:o.typeId});return u==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convertNamed({named:u,value:a.value})]}))}case"singleProperty":{let u=this.context.getRecord(a.value);if(u==null)return d.TypeLiteral.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convert({typeReference:o.typeReference,value:u["value"]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[]}));default:M(o)}}convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a}){let o=this.context.associateByWireValue({parameters:e.properties,values:this.context.getRecord(t)??{}}),u=new Set(o.map(_=>_.name.wireValue));for(let _ of e.properties)if(!u.has(_.name.wireValue)&&!this.context.isOptional(_.typeReference)){if(a===!0)throw new Error(`Required property "${_.name.wireValue}" is missing from value`);let B=this.getDefaultValueForTypeReference(_.typeReference);B!==void 0&&o.push({name:_.name,typeReference:_.typeReference,value:B})}let p=new Map;e.properties.forEach((_,B)=>{p.set(_.name.wireValue,B)}),o.sort((_,B)=>(p.get(_.name.wireValue)??0)-(p.get(B.name.wireValue)??0));let x=r==="request"?o.filter(_=>!this.context.isDirectLiteral(_.typeReference)):o,w=[];for(let _ of x){this.context.errors.scope(_.name.wireValue);try{let B=this.convert({typeReference:_.typeReference,value:_.value,as:r,inUndiscriminatedUnion:a});if(d.TypeLiteral.isNop(B)&&!this.context.isOptional(_.typeReference)){if(a===!0)throw new Error(`Required property "${_.name.wireValue}" could not be converted`);continue}w.push({name:this.context.getMethodName(_.name.name),value:B})}finally{this.context.errors.unscope()}}return d.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:w})}getDefaultValueForTypeReference(e){switch(e.type){case"primitive":return this.getDefaultPrimitiveValue(e.value);case"nullable":return null;case"optional":return;case"list":case"set":return[];case"map":return{};case"named":{let t=this.context.resolveNamedType({typeId:e.value});if(t==null)return{};switch(t.type){case"enum":if(t.values.length>0){let r=t.values[0];return r?.wireValue}return;case"object":case"alias":return{};case"discriminatedUnion":case"undiscriminatedUnion":return;default:return{}}}case"literal":return e.value.value;case"unknown":return{};default:M(e)}}getDefaultPrimitiveValue(e){switch(e){case"STRING":return"string";case"INTEGER":case"UINT":return 1;case"LONG":case"UINT_64":return 1e6;case"FLOAT":case"DOUBLE":return 1.1;case"BOOLEAN":return!0;case"DATE":return"2024-01-15";case"DATE_TIME":return"2024-01-15T09:30:00Z";case"UUID":return"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32";case"BASE_64":return"SGVsbG8gd29ybGQh";case"BIG_INTEGER":return"123456789";default:return e==="DATE_TIME_RFC_2822"?"Tue, 15 Jan 2024 09:30:00 +0000":"string"}}convertEnum({enum_:e,value:t}){let r=this.getEnumValueName({enum_:e,value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:r})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:D.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let r=e.values.find(a=>a.wireValue===t);if(r==null){this.context.errors.add({severity:D.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return r==null?d.TypeLiteral.nop():this.context.isPrimitive(r.valueTypeReference)?d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]})):d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){let r=[],a=[];for(let p of e.types){let x=this.context.errors.size();try{r.push(JSON.stringify(p));let w=this.convert({typeReference:p,value:t,inUndiscriminatedUnion:!0});if(d.TypeLiteral.isNop(w)){this.context.errors.truncate(x);continue}return{valueTypeReference:p,typeInstantiation:w}}catch(w){this.context.errors.truncate(x),a.push(`Type ${JSON.stringify(p)}: ${gr(w)}`);continue}}this.context.errors.add({severity:D.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value. Tried ${r.length} variants. Errors: ${a.join("; ")}`});let o=e.declaration.name??"UnknownUnion",u=a.map((p,x)=>` ${x+1}. ${p}`).join(`
22
+ `)}};m();y();h();m();y();h();var U={};cr(U,{BRAND:()=>du,DIRTY:()=>Ve,EMPTY_PATH:()=>Wo,INVALID:()=>L,NEVER:()=>Yu,OK:()=>te,ParseStatus:()=>X,Schema:()=>j,ZodAny:()=>Be,ZodArray:()=>Ie,ZodBigInt:()=>qe,ZodBoolean:()=>We,ZodBranded:()=>Ot,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>Yt,ZodEffects:()=>fe,ZodEnum:()=>Qe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>Qt,ZodIntersection:()=>He,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>De,ZodObject:()=>ue,ZodOptional:()=>pe,ZodParsedType:()=>E,ZodPipeline:()=>Ut,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Kt,ZodSchema:()=>j,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>j,ZodUndefined:()=>Ze,ZodUnion:()=>Je,ZodUnknown:()=>Re,ZodVoid:()=>xt,addIssueToContext:()=>R,any:()=>bu,array:()=>Nu,bigint:()=>yu,boolean:()=>Ni,coerce:()=>Hu,custom:()=>Ti,date:()=>gu,datetimeRegex:()=>wi,defaultErrorMap:()=>ke,discriminatedUnion:()=>Au,effect:()=>Vu,enum:()=>ju,function:()=>Fu,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>mu,intersection:()=>Cu,isAborted:()=>Jt,isAsync:()=>ht,isDirty:()=>Ht,isValid:()=>Se,late:()=>fu,lazy:()=>Ou,literal:()=>Uu,makeIssue:()=>Ft,map:()=>Bu,nan:()=>hu,nativeEnum:()=>Mu,never:()=>_u,null:()=>wu,nullable:()=>qu,number:()=>ki,object:()=>Ru,objectUtil:()=>Tr,oboolean:()=>Ju,onumber:()=>Gu,optional:()=>Du,ostring:()=>Zu,pipeline:()=>zu,preprocess:()=>Wu,promise:()=>$u,quotelessJson:()=>Vo,record:()=>Lu,set:()=>Pu,setErrorMap:()=>qo,strictObject:()=>Iu,string:()=>_i,symbol:()=>xu,transformer:()=>Vu,tuple:()=>Su,undefined:()=>vu,union:()=>Eu,unknown:()=>Tu,util:()=>V,void:()=>ku});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var V;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let o={};for(let u of a)o[u]=u;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(p=>typeof a[a[p]]!="number"),u={};for(let p of o)u[p]=a[p];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(o){return a[o]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let o=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&o.push(u);return o},n.find=(a,o)=>{for(let u of a)if(o(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(V||(V={}));var Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));var E=V.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=n=>{switch(typeof n){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(n)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(n)?E.array:n===null?E.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?E.promise:typeof Map<"u"&&n instanceof Map?E.map:typeof Set<"u"&&n instanceof Set?E.set:typeof Date<"u"&&n instanceof Date?E.date:E.object;default:return E.unknown}};var b=V.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"]),Vo=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class n extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},a=o=>{for(let u of o.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let p=r,g=0;for(;g<u.path.length;){let w=u.path[g];g===u.path.length-1?(p[w]=p[w]||{_errors:[]},p[w]._errors.push(t(u))):p[w]=p[w]||{_errors:[]},p=p[w],g++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let o=a.path[0];t[o]=t[o]||[],t[o].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};oe.create=n=>new oe(n);var Do=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===E.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,V.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${V.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${V.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${V.joinValues(n.options)}, received '${n.received}'`;break;case b.invalid_arguments:t="Invalid function arguments";break;case b.invalid_return_type:t="Invalid function return type";break;case b.invalid_date:t="Invalid date";break;case b.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:V.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case b.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case b.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case b.custom:t="Invalid input";break;case b.invalid_intersection_types:t="Intersection results could not be merged";break;case b.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case b.not_finite:t="Number must be finite";break;default:t=e.defaultError,V.assertNever(n)}return{message:t}},ke=Do;var hi=ke;function qo(n){hi=n}function mt(){return hi}m();y();h();var Ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],u={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let p="",g=r.filter(w=>!!w).slice().reverse();for(let w of g)p=w(u,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},Wo=[];function R(n,e){let t=mt(),r=Ft({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ke?void 0:ke].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return L;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let o=await a.key,u=await a.value;r.push({key:o,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:u}=a;if(o.status==="aborted"||u.status==="aborted")return L;o.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[o.value]=u.value)}return{status:e.value,value:r}}},L=Object.freeze({status:"aborted"}),Ve=n=>({status:"dirty",value:n}),te=n=>({status:"valid",value:n}),Jt=n=>n.status==="aborted",Ht=n=>n.status==="dirty",Se=n=>n.status==="valid",ht=n=>typeof Promise<"u"&&n instanceof Promise;m();y();h();m();y();h();var C;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(C||(C={}));var de=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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}},yi=(n,e)=>{if(Se(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(n.common.issues);return this._error=t,this._error}}};function O(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))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:(u,p)=>{let{message:g}=n;return u.code==="invalid_enum_value"?{message:g??p.defaultError}:typeof p.data>"u"?{message:g??r??p.defaultError}:u.code!=="invalid_type"?{message:p.defaultError}:{message:g??t??p.defaultError}},description:a}}var j=class{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ht(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},a=this._parseSync({data:e,path:r.path,parent:r});return yi(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Se(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Se(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},a=this._parse({data:e,path:r.path,parent:r}),o=await(ht(a)?a:Promise.resolve(a));return yi(r,o)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,o)=>{let u=e(a),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(g=>g?!0:(p(),!1)):u?!0:(p(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new fe({schema:this,typeName:B.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 pe.create(this,this._def)}nullable(){return we.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Pe.create(this,this._def)}or(e){return Je.create([this,e],this._def)}and(e){return He.create(this,e,this._def)}transform(e){return new fe({...O(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...O(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Ot({typeName:B.ZodBranded,type:this,...O(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...O(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ut.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zo=/^c[^\s-]{8,}$/i,Zo=/^[0-9a-z]+$/,Go=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Jo=/^[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,Ho=/^[a-z0-9_-]{21}$/i,Yo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ko=/^[-+]?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)?)??$/,Qo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_r,eu=/^(?:(?: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])$/,tu=/^(?:(?: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])$/,ru=/^(([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]))$/,nu=/^(([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])$/,au=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,iu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xi="((\\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])))",su=new RegExp(`^${xi}$`);function vi(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ou(n){return new RegExp(`^${vi(n)}$`)}function wi(n){let e=`${xi}T${vi(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function uu(n,e){return!!((e==="v4"||!e)&&eu.test(n)||(e==="v6"||!e)&&ru.test(n))}function lu(n,e){if(!Yo.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function cu(n,e){return!!((e==="v4"||!e)&&tu.test(n)||(e==="v6"||!e)&&nu.test(n))}var Le=class n extends j{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==E.string){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:E.string,received:o.parsedType}),L}let r=new X,a;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let u=e.data.length>o.value,p=e.data.length<o.value;(u||p)&&(a=this._getOrReturnCtx(e,a),u?R(a,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):p&&R(a,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Qo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")_r||(_r=new RegExp(Xo,"u")),_r.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Jo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")Ho.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Zo.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Go.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),R(a,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?wi(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?su.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?ou(o).test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Ko.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?uu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?lu(e.data,o.alg)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?cu(e.data,o.version)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?au.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?iu.test(e.data)||(a=this._getOrReturnCtx(e,a),R(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):V.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:b.invalid_string,...C.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...C.errToObj(e)})}url(e){return this._addCheck({kind:"url",...C.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...C.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...C.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...C.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...C.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...C.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...C.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...C.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...C.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...C.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...C.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...C.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,...C.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,...C.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...C.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...C.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...C.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...C.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...C.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...C.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...C.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...C.errToObj(t)})}nonempty(e){return this.min(1,C.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Le.create=n=>new Le({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...O(n)});function pu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,o=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return o%u/10**a}var De=class n extends j{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)!==E.number){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:E.number,received:o.parsedType}),L}let r,a=new X;for(let o of this._def.checks)o.kind==="int"?V.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?pu(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_finite,message:o.message}),a.dirty()):V.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,C.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:C.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:C.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:C.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let 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"&&V.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};De.create=n=>new De({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...O(n)});var qe=class n extends j{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)!==E.bigint)return this._getInvalidInput(e);let r,a=new X;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),R(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):V.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:E.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,C.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:C.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};qe.create=n=>new qe({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...O(n)});var We=class extends j{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==E.boolean){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:E.boolean,received:r.parsedType}),L}return te(e.data)}};We.create=n=>new We({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...O(n)});var ze=class n extends j{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==E.date){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_type,expected:E.date,received:o.parsedType}),L}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return R(o,{code:b.invalid_date}),L}let r=new X,a;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(a=this._getOrReturnCtx(e,a),R(a,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):V.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:C.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:C.toString(t)})}get minDate(){let e=null;for(let 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(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...O(n)});var gt=class extends j{_parse(e){if(this._getType(e)!==E.symbol){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:E.symbol,received:r.parsedType}),L}return te(e.data)}};gt.create=n=>new gt({typeName:B.ZodSymbol,...O(n)});var Ze=class extends j{_parse(e){if(this._getType(e)!==E.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:E.undefined,received:r.parsedType}),L}return te(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...O(n)});var Ge=class extends j{_parse(e){if(this._getType(e)!==E.null){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:E.null,received:r.parsedType}),L}return te(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...O(n)});var Be=class extends j{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}};Be.create=n=>new Be({typeName:B.ZodAny,...O(n)});var Re=class extends j{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}};Re.create=n=>new Re({typeName:B.ZodUnknown,...O(n)});var he=class extends j{_parse(e){let t=this._getOrReturnCtx(e);return R(t,{code:b.invalid_type,expected:E.never,received:t.parsedType}),L}};he.create=n=>new he({typeName:B.ZodNever,...O(n)});var xt=class extends j{_parse(e){if(this._getType(e)!==E.undefined){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:E.void,received:r.parsedType}),L}return te(e.data)}};xt.create=n=>new xt({typeName:B.ZodVoid,...O(n)});var Ie=class n extends j{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==E.array)return R(t,{code:b.invalid_type,expected:E.array,received:t.parsedType}),L;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(u||p)&&(R(t,{code:u?b.too_big:b.too_small,minimum:p?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(R(t,{code:b.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(R(t,{code:b.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,p)=>a.type._parseAsync(new de(t,u,t.path,p)))).then(u=>X.mergeArray(r,u));let o=[...t.data].map((u,p)=>a.type._parseSync(new de(t,u,t.path,p)));return X.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:C.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:C.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:C.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...O(e)});function yt(n){if(n instanceof ue){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new ue({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:yt(n.element)}):n instanceof pe?pe.create(yt(n.unwrap())):n instanceof we?we.create(yt(n.unwrap())):n instanceof ve?ve.create(n.items.map(e=>yt(e))):n}var ue=class n extends j{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=V.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==E.object){let w=this._getOrReturnCtx(e);return R(w,{code:b.invalid_type,expected:E.object,received:w.parsedType}),L}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:u}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let w in a.data)u.includes(w)||p.push(w);let g=[];for(let w of u){let I=o[w],F=a.data[w];g.push({key:{status:"valid",value:w},value:I._parse(new de(a,F,a.path,w)),alwaysSet:w in a.data})}if(this._def.catchall instanceof he){let w=this._def.unknownKeys;if(w==="passthrough")for(let I of p)g.push({key:{status:"valid",value:I},value:{status:"valid",value:a.data[I]}});else if(w==="strict")p.length>0&&(R(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(w!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let w=this._def.catchall;for(let I of p){let F=a.data[I];g.push({key:{status:"valid",value:I},value:w._parse(new de(a,F,a.path,I)),alwaysSet:I in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let w=[];for(let I of g){let F=await I.key,P=await I.value;w.push({key:F,value:P,alwaysSet:I.alwaysSet})}return w}).then(w=>X.mergeObjectSync(r,w)):X.mergeObjectSync(r,g)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:C.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of V.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of V.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return yt(this)}partial(e){let t={};for(let r of V.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of V.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof pe;)o=o._def.innerType;t[r]=o}return new n({...this._def,shape:()=>t})}keyof(){return bi(V.objectKeys(this.shape))}};ue.create=(n,e)=>new ue({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...O(e)});ue.strictCreate=(n,e)=>new ue({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:B.ZodObject,...O(e)});ue.lazycreate=(n,e)=>new ue({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:B.ZodObject,...O(e)});var Je=class extends j{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(o){for(let p of o)if(p.result.status==="valid")return p.result;for(let p of o)if(p.result.status==="dirty")return t.common.issues.push(...p.ctx.common.issues),p.result;let u=o.map(p=>new oe(p.ctx.common.issues));return R(t,{code:b.invalid_union,unionErrors:u}),L}if(t.common.async)return Promise.all(r.map(async o=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let o,u=[];for(let g of r){let w={...t,common:{...t.common,issues:[]},parent:null},I=g._parseSync({data:t.data,path:t.path,parent:w});if(I.status==="valid")return I;I.status==="dirty"&&!o&&(o={result:I,ctx:w}),w.common.issues.length&&u.push(w.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=u.map(g=>new oe(g));return R(t,{code:b.invalid_union,unionErrors:p}),L}}get options(){return this._def.options}};Je.create=(n,e)=>new Je({options:n,typeName:B.ZodUnion,...O(e)});var Ne=n=>n instanceof Ye?Ne(n.schema):n instanceof fe?Ne(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?V.objectValues(n.enum):n instanceof et?Ne(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...Ne(n.unwrap())]:n instanceof we?[null,...Ne(n.unwrap())]:n instanceof Ot||n instanceof rt?Ne(n.unwrap()):n instanceof tt?Ne(n._def.innerType):[],Yt=class n extends j{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.object)return R(t,{code:b.invalid_type,expected:E.object,received:t.parsedType}),L;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(R(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let o of t){let u=Ne(o.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of u){if(a.has(p))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(p)}`);a.set(p,o)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...O(r)})}};function kr(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===E.object&&r===E.object){let a=V.objectKeys(e),o=V.objectKeys(n).filter(p=>a.indexOf(p)!==-1),u={...n,...e};for(let p of o){let g=kr(n[p],e[p]);if(!g.valid)return{valid:!1};u[p]=g.data}return{valid:!0,data:u}}else if(t===E.array&&r===E.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let u=n[o],p=e[o],g=kr(u,p);if(!g.valid)return{valid:!1};a.push(g.data)}return{valid:!0,data:a}}else return t===E.date&&r===E.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var He=class extends j{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,u)=>{if(Jt(o)||Jt(u))return L;let p=kr(o.value,u.value);return p.valid?((Ht(o)||Ht(u))&&t.dirty(),{status:t.value,value:p.data}):(R(r,{code:b.invalid_intersection_types}),L)};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(([o,u])=>a(o,u)):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}))}};He.create=(n,e,t)=>new He({left:n,right:e,typeName:B.ZodIntersection,...O(t)});var ve=class n extends j{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.array)return R(r,{code:b.invalid_type,expected:E.array,received:r.parsedType}),L;if(r.data.length<this._def.items.length)return R(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&r.data.length>this._def.items.length&&(R(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=[...r.data].map((u,p)=>{let g=this._def.items[p]||this._def.rest;return g?g._parse(new de(r,u,r.path,p)):null}).filter(u=>!!u);return r.common.async?Promise.all(o).then(u=>X.mergeArray(t,u)):X.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};ve.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ve({items:n,typeName:B.ZodTuple,rest:null,...O(e)})};var Kt=class n extends j{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.object)return R(r,{code:b.invalid_type,expected:E.object,received:r.parsedType}),L;let a=[],o=this._def.keyType,u=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:u._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof j?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...O(r)}):new n({keyType:Le.create(),valueType:e,typeName:B.ZodRecord,...O(t)})}},vt=class extends j{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.map)return R(r,{code:b.invalid_type,expected:E.map,received:r.parsedType}),L;let a=this._def.keyType,o=this._def.valueType,u=[...r.data.entries()].map(([p,g],w)=>({key:a._parse(new de(r,p,r.path,[w,"key"])),value:o._parse(new de(r,g,r.path,[w,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let g of u){let w=await g.key,I=await g.value;if(w.status==="aborted"||I.status==="aborted")return L;(w.status==="dirty"||I.status==="dirty")&&t.dirty(),p.set(w.value,I.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let g of u){let w=g.key,I=g.value;if(w.status==="aborted"||I.status==="aborted")return L;(w.status==="dirty"||I.status==="dirty")&&t.dirty(),p.set(w.value,I.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:B.ZodMap,...O(t)});var wt=class n extends j{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==E.set)return R(r,{code:b.invalid_type,expected:E.set,received:r.parsedType}),L;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(R(r,{code:b.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(R(r,{code:b.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function u(g){let w=new Set;for(let I of g){if(I.status==="aborted")return L;I.status==="dirty"&&t.dirty(),w.add(I.value)}return{status:t.value,value:w}}let p=[...r.data.values()].map((g,w)=>o._parse(new de(r,g,r.path,w)));return r.common.async?Promise.all(p).then(g=>u(g)):u(p)}min(e,t){return new n({...this._def,minSize:{value:e,message:C.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:C.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};wt.create=(n,e)=>new wt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...O(e)});var Qt=class n extends j{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.function)return R(t,{code:b.invalid_type,expected:E.function,received:t.parsedType}),L;function r(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_arguments,argumentsError:g}})}function a(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),ke].filter(w=>!!w),issueData:{code:b.invalid_return_type,returnTypeError:g}})}let o={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Pe){let p=this;return te(async function(...g){let w=new oe([]),I=await p._def.args.parseAsync(g,o).catch(A=>{throw w.addIssue(r(g,A)),w}),F=await Reflect.apply(u,this,I);return await p._def.returns._def.type.parseAsync(F,o).catch(A=>{throw w.addIssue(a(F,A)),w})})}else{let p=this;return te(function(...g){let w=p._def.args.safeParse(g,o);if(!w.success)throw new oe([r(g,w.error)]);let I=Reflect.apply(u,this,w.data),F=p._def.returns.safeParse(I,o);if(!F.success)throw new oe([a(I,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:ve.create(e).rest(Re.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||ve.create([]).rest(Re.create()),returns:t||Re.create(),typeName:B.ZodFunction,...O(r)})}},Ye=class extends j{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ye.create=(n,e)=>new Ye({getter:n,typeName:B.ZodLazy,...O(e)});var Ke=class extends j{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return R(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...O(e)});function bi(n,e){return new Qe({values:n,typeName:B.ZodEnum,...O(e)})}var Qe=class n extends j{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{expected:V.joinValues(r),received:t.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return R(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return te(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Qe.create=bi;var Xe=class extends j{_parse(e){let t=V.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==E.string&&r.parsedType!==E.number){let a=V.objectValues(t);return R(r,{expected:V.joinValues(a),received:r.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(V.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=V.objectValues(t);return R(r,{received:r.data,code:b.invalid_enum_value,options:a}),L}return te(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:B.ZodNativeEnum,...O(e)});var Pe=class extends j{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==E.promise&&t.common.async===!1)return R(t,{code:b.invalid_type,expected:E.promise,received:t.parsedType}),L;let r=t.parsedType===E.promise?t.data:Promise.resolve(t.data);return te(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Pe.create=(n,e)=>new Pe({type:n,typeName:B.ZodPromise,...O(e)});var fe=class extends j{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:u=>{R(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let u=a.transform(r.data,o);if(r.common.async)return Promise.resolve(u).then(async p=>{if(t.value==="aborted")return L;let g=await this._def.schema._parseAsync({data:p,path:r.path,parent:r});return g.status==="aborted"?L:g.status==="dirty"?Ve(g.value):t.value==="dirty"?Ve(g.value):g});{if(t.value==="aborted")return L;let p=this._def.schema._parseSync({data:u,path:r.path,parent:r});return p.status==="aborted"?L:p.status==="dirty"?Ve(p.value):t.value==="dirty"?Ve(p.value):p}}if(a.type==="refinement"){let u=p=>{let g=a.refinement(p,o);if(r.common.async)return Promise.resolve(g);if(g instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return p};if(r.common.async===!1){let p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value),{status:t.value,value:p.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>p.status==="aborted"?L:(p.status==="dirty"&&t.dirty(),u(p.value).then(()=>({status:t.value,value:p.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Se(u))return L;let p=a.transform(u.value,o);if(p instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:p}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Se(u)?Promise.resolve(a.transform(u.value,o)).then(p=>({status:t.value,value:p})):L);V.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:B.ZodEffects,effect:e,...O(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...O(t)});var pe=class extends j{_parse(e){return this._getType(e)===E.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:B.ZodOptional,...O(e)});var we=class extends j{_parse(e){return this._getType(e)===E.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:B.ZodNullable,...O(e)});var et=class extends j{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===E.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...O(e)});var tt=class extends j{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ht(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...O(e)});var bt=class extends j{_parse(e){if(this._getType(e)!==E.nan){let r=this._getOrReturnCtx(e);return R(r,{code:b.invalid_type,expected:E.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:B.ZodNaN,...O(n)});var du=Symbol("zod_brand"),Ot=class extends j{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},Ut=class n extends j{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?L:o.status==="dirty"?(t.dirty(),Ve(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?L:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends j{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Se(a)&&(a.value=Object.freeze(a.value)),a);return ht(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...O(e)});function gi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ti(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(u=>{if(!u){let p=gi(e,r),g=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:g})}});if(!o){let u=gi(e,r),p=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:p})}}):Be.create()}var fu={object:ue.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var mu=(n,e={message:`Input not instance of ${n.name}`})=>Ti(t=>t instanceof n,e),_i=Le.create,ki=De.create,hu=bt.create,yu=qe.create,Ni=We.create,gu=ze.create,xu=gt.create,vu=Ze.create,wu=Ge.create,bu=Be.create,Tu=Re.create,_u=he.create,ku=xt.create,Nu=Ie.create,Ru=ue.create,Iu=ue.strictCreate,Eu=Je.create,Au=Yt.create,Cu=He.create,Su=ve.create,Lu=Kt.create,Bu=vt.create,Pu=wt.create,Fu=Qt.create,Ou=Ye.create,Uu=Ke.create,ju=Qe.create,Mu=Xe.create,$u=Pe.create,Vu=fe.create,Du=pe.create,qu=we.create,Wu=fe.createWithPreprocess,zu=Ut.create,Zu=()=>_i().optional(),Gu=()=>ki().optional(),Ju=()=>Ni().optional(),Hu={string:(n=>Le.create({...n,coerce:!0})),number:(n=>De.create({...n,coerce:!0})),boolean:(n=>We.create({...n,coerce:!0})),bigint:(n=>qe.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Yu=L;m();y();h();var Ri=U.strictObject({title:U.string(),content:U.string()});var Nr=U.object({"base-api-exception-class-name":U.string().optional(),"base-exception-class-name":U.string().optional(),"client-class-name":U.string().optional(),"inline-file-properties":U.boolean().optional(),"inline-path-parameters":U.boolean().optional(),"package-layout":U.enum(["flat","nested"]).optional(),"package-prefix":U.string().optional(),"use-local-date-for-dates":U.boolean().optional(),"custom-dependencies":U.array(U.string()).optional(),"custom-plugins":U.array(U.string()).optional(),"disable-required-property-builder-checks":U.boolean().optional(),"enable-forward-compatible-enums":U.boolean().optional(),"enable-inline-types":U.boolean().optional(),"enable-public-constructors":U.boolean().optional(),"generate-unknown-as-json-node":U.boolean().optional(),"json-include":U.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":U.boolean().optional(),"use-default-request-parameter-values":U.boolean().optional(),"enable-wire-tests":U.boolean().default(!1),"collapse-optional-nullable":U.boolean().optional(),"custom-readme-sections":U.array(Ri).optional(),"custom-pager-name":U.string().optional(),"default-timeout-in-seconds":U.number().optional(),"gradle-distribution-url":U.string().optional(),"gradle-plugin-management":U.string().optional(),"gradle-central-dependency-management":U.boolean().optional(),"output-directory":U.enum(["source-root","project-root"]).optional(),"custom-interceptors":U.boolean().optional(),"omit-fern-headers":U.boolean().optional(),"enable-gradle-profiling":U.boolean().optional(),"wrapped-aliases":U.boolean().optional(),maxRetries:U.number().int().min(0).optional()});var d={};cr(d,{Access:()=>Rr,AstNode:()=>G,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>q,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>ut,Type:()=>jt,TypeLiteral:()=>le,Writer:()=>$e,classReference:()=>xl,class_:()=>gl,codeblock:()=>yl,instantiateClass:()=>vl,invokeMethod:()=>wl,method:()=>bl,parameter:()=>Tl});m();y();h();m();y();h();m();y();h();var G=class extends je{async toStringAsync({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toStringAsync()}toString({packageName:e,customConfig:t,formatter:r}){let a=new Pt({packageName:e,customConfig:t,formatter:r});return this.write(a),a.toString()}};var nt=class extends G{constructor({name:t,access:r}){super();N(this,"name");N(this,"access");N(this,"methods",[]);this.name=t,this.access=r}write(t){if(t.write(`${this.access} class ${this.name}`),this.isEmpty()){t.writeLine(" {}");return}t.writeLine(" {"),t.indent();for(let r of this.methods)t.writeNode(r),t.newLine();t.dedent(),t.write("}")}addMethod(t){this.methods.push(t)}isEmpty(){return this.methods.length===0}};m();y();h();m();y();h();var Rr={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();m();y();h();m();y();h();var q=class extends G{constructor({name:t,packageName:r,fullyQualified:a}){super();N(this,"name");N(this,"packageName");N(this,"fullyQualified");this.name=t,this.packageName=r,this.fullyQualified=a??!1}write(t){if(t.addImport(`${this.packageName}.${this.name}`),this.fullyQualified){t.write(`${this.packageName}.${this.name}`);return}t.write(this.name)}};m();y();h();var jt=class extends G{constructor(t){super();N(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"array":t.writeNode(this.internalType.value),t.write("[]");break;case"bigInteger":t.writeNode(Ku);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.write("String");break;case"dateTime":t.writeNode(el);break;case"double":t.write("Double");break;case"float":t.write("Float");break;case"generic":t.writeNode(this.internalType.value),t.write("<");for(let[r,a]of this.internalType.parameters.entries())t.writeNode(a),r<this.internalType.parameters.length-1&&t.write(", ");t.write(">");break;case"inputStream":t.writeNode(nl);break;case"integer":t.write("Integer");break;case"iterable":this.writeIterable({writer:t,iterable:this.internalType});break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write("Long");break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"object":{t.write("Object");break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write("String");break;case"uuid":t.writeNode(rl);break;case"void":t.write("Void");break;default:$(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static array(t){return new this({type:"array",value:t})}static bigInteger(){return new this({type:"bigInteger"})}static boolean(){return new this({type:"boolean"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static double(){return new this({type:"double"})}static float(){return new this({type:"float"})}static integer(){return new this({type:"integer"})}static list(t){return new this({type:"list",value:t})}static long(){return new this({type:"long"})}static map(t,r){return new this({type:"map",keyType:t,valueType:r})}static object(){return new this({type:"object"})}static optional(t){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t})}static reference(t){return new this({type:"reference",value:t})}static generic(t,r){return new this({type:"generic",value:t,parameters:r})}static set(t){return new this({type:"set",value:t})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static void(){return new this({type:"void"})}static iterable(t){return new this({type:"iterable",value:t})}static inputStream(){return new this({type:"inputStream"})}writeList({writer:t,list:r}){t.writeNode(Qu),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(Xu),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Ir),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(al),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(tl),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Xt=new q({name:"Arrays",packageName:"java.util"}),Ku=new q({name:"BigInteger",packageName:"java.math"}),mg=new q({name:"HashMap",packageName:"java.util"}),Qu=new q({name:"List",packageName:"java.util"}),Xu=new q({name:"Map",packageName:"java.util"}),el=new q({name:"OffsetDateTime",packageName:"java.time"}),Ir=new q({name:"Optional",packageName:"java.util"}),tl=new q({name:"Set",packageName:"java.util"}),rl=new q({name:"UUID",packageName:"java.util"}),nl=new q({name:"InputStream",packageName:"java.io"}),al=new q({name:"Iterable",packageName:"java.lang"});var le=class n extends G{constructor(t){super();N(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"bigInteger":this.writeBigInteger({writer:t,bigInteger:this.internalType});break;case"boolean":t.write(this.internalType.value.toString());break;case"builder":this.writeBuilder({writer:t,builder:this.internalType});break;case"bytes":t.write(`"${this.internalType.value}".getBytes()`);break;case"class":{this.writeClass({writer:t,class_:this.internalType});break}case"date":this.writeDate({writer:t,date:this.internalType});break;case"dateTime":this.writeDateTime({writer:t,dateTime:this.internalType});break;case"double":{let r=this.internalType.value.toString();!r.includes(".")&&!r.includes("e")&&!r.includes("E")?t.write(`${r}.0`):t.write(r);break}case"enum":this.writeEnum({writer:t,enum_:this.internalType});break;case"float":t.write(`${this.internalType.value}f`);break;case"integer":t.write(Math.floor(this.internalType.value).toString());break;case"list":{this.writeList({writer:t,list:this.internalType});break}case"long":{t.write(`${Math.floor(this.internalType.value)}L`);break}case"map":{this.writeMap({writer:t,map:this.internalType});break}case"optional":{this.writeOptional({writer:t,optional:this.internalType});break}case"raw":{this.internalType.value instanceof G?t.writeNode(this.internalType.value):t.write(this.internalType.value);break}case"reference":t.writeNode(this.internalType.value);break;case"set":{this.writeSet({writer:t,set:this.internalType});break}case"string":t.write(`"${this.escapeString(this.internalType.value)}"`);break;case"unknown":this.writeUnknown({writer:t,value:this.internalType.value});break;case"uuid":this.writeUUID({writer:t,uuid:this.internalType});break;case"nop":break;default:$(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static bigInteger(t){return new this({type:"bigInteger",value:t})}static boolean(t){return new this({type:"boolean",value:t})}static builder({classReference:t,parameters:r}){return new this({type:"builder",classReference:t,parameters:r})}static bytes(t){return new this({type:"bytes",value:t})}static class_({reference:t,parameters:r}){return new this({type:"class",reference:t,parameters:r})}static date(t){return new this({type:"date",value:t})}static dateTime(t){return new this({type:"dateTime",value:t})}static double(t){return new this({type:"double",value:t})}static enum_({classReference:t,value:r}){return new this({type:"enum",classReference:t,value:r})}static float(t){return new this({type:"float",value:t})}static integer(t){return new this({type:"integer",value:t})}static list({valueType:t,values:r,isParameter:a}){return new this({type:"list",valueType:t,values:r,isParameter:a})}static long(t){return new this({type:"long",value:t})}static map({keyType:t,valueType:r,entries:a}){return new this({type:"map",keyType:t,valueType:r,entries:a})}static optional({value:t,useOf:r}){return this.isAlreadyOptional(t)?t:new this({type:"optional",value:t,useOf:r})}static raw(t){return new this({type:"raw",value:t})}static reference(t){return new this({type:"reference",value:t})}static set({valueType:t,values:r}){return new this({type:"set",valueType:t,values:r})}static string(t){return new this({type:"string",value:t})}static unknown(t){return new this({type:"unknown",value:t})}static uuid(t){return new this({type:"uuid",value:t})}static nop(){return new this({type:"nop"})}static isNop(t){return t.internalType.type==="nop"}shouldWriteInLine(){switch(this.internalType.type){case"bigInteger":case"boolean":case"bytes":case"date":case"dateTime":case"double":case"enum":case"float":case"integer":case"long":case"nop":case"raw":case"string":case"unknown":case"uuid":return!0;case"optional":return this.internalType.value.shouldWriteInLine();case"builder":case"class":case"list":case"map":case"reference":case"set":return!1;default:$(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:il,arguments_:[n.string(r.value)]}))}writeBuilder({writer:t,builder:r}){t.writeNode(r.classReference),t.writeNewLineIfLastLineNot(),t.indent(),this.writeBuilderParameters({writer:t,parameters:this.orderBuilderParameters(pl({parameters:r.parameters}))}),t.dedent()}writeBuilderParameters({writer:t,parameters:r}){t.writeLine(".builder()");for(let a of r)t.write(`.${a.name}(`),a.value.shouldWriteInLine()||t.newLine(),t.indent(),t.writeNode(a.value),t.dedent(),a.value.shouldWriteInLine()||t.newLine(),t.writeLine(")");t.writeNewLineIfLastLineNot(),t.write(".build()")}orderBuilderParameters(t){return t.some(a=>!a.value.isOptional()&&!this.isCollection(a.value))?t.sort((a,o)=>{let u=this.isNonRequired(a.value),p=this.isNonRequired(o.value);return u&&!p?1:!u&&p?-1:0}):t.sort((a,o)=>{let u=a.value.isOptional(),p=o.value.isOptional();return u&&!p?1:!u&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=cl({parameters:r.parameters});t.writeNode(d.instantiateClass({classReference:r.reference,arguments_:a.map(o=>o.value)}))}writeDate({writer:t,date:r}){t.writeNode(d.invokeMethod({on:ol,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:ul,method:"parse",arguments_:[n.string(r.value)]}))}writeEnum({writer:t,enum_:r}){t.writeNode(r.classReference),t.write("."+r.value)}writeList({writer:t,list:r}){this.writeIterable({writer:t,iterable:r})}writeMap({writer:t,map:r}){let a=dl({entries:r.entries});if(a.length===0){t.write("new "),t.writeNode(er),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(er),t.write("<"),t.writeNode(r.keyType),t.write(", "),t.writeNode(r.valueType),t.writeLine(">() {{"),t.indent();for(let o of a)t.write("put("),t.writeNode(o.key),t.write(", "),t.writeNode(o.value),t.writeLine(");");t.dedent(),t.write("}}")}writeOptional({writer:t,optional:r}){if(!r.useOf){t.writeNode(r.value);return}t.writeNode(d.invokeMethod({on:Ir,method:"of",arguments_:[r.value]}))}writeSet({writer:t,set:r}){this.writeIterable({writer:t,iterable:r})}writeIterable({writer:t,iterable:r}){let a=r.type==="list"?Er:sl,o=fl({values:r.values});if(r.type==="list"&&r.isParameter&&o.length>0){t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:o}));return}if(o.length===0){t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.write(">()");return}t.write("new "),t.writeNode(a),t.write("<"),t.writeNode(r.valueType),t.writeLine(">("),t.indent(),t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:o})),t.writeNewLineIfLastLineNot(),t.dedent(),t.write(")")}writeUnknown({writer:t,value:r}){switch(typeof r){case"boolean":t.write(r.toString());return;case"string":t.write(`"${this.escapeString(r)}"`);return;case"number":t.write(r.toString());return;case"object":if(r==null){t.write("null");return}if(Array.isArray(r)){this.writeUnknownArray({writer:t,value:r});return}this.writeUnknownMap({writer:t,value:r});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof r}`)}}writeUnknownArray({writer:t,value:r}){if(r.length===0){t.write("new "),t.writeNode(Er),t.write("<Object>()");return}t.write("new "),t.writeNode(Er),t.write("<Object>("),t.writeNode(d.invokeMethod({on:Xt,method:"asList",arguments_:r.map(a=>n.unknown(a))})),t.write(")")}writeUnknownMap({writer:t,value:r}){let a=Object.entries(r);if(a.length===0){t.write("new "),t.writeNode(er),t.write("<String, Object>()");return}t.writeLine("new "),t.writeNode(er),t.write("<String, Object>() {{"),t.indent();for(let[o,u]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(u)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:ll,method:"fromString",arguments_:[n.string(r.value)]}))}escapeString(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Er=new q({name:"ArrayList",packageName:"java.util"}),il=new q({name:"BigInteger",packageName:"java.math"}),er=new q({name:"HashMap",packageName:"java.util"}),sl=new q({name:"HashSet",packageName:"java.util"}),Ng=new q({name:"List",packageName:"java.util"}),ol=new q({name:"LocalDate",packageName:"java.time"}),Rg=new q({name:"Map",packageName:"java.util"}),ul=new q({name:"OffsetDateTime",packageName:"java.time"}),Ig=new q({name:"Set",packageName:"java.util"}),ll=new q({name:"UUID",packageName:"java.util"});function cl({parameters:n}){return n.filter(e=>!le.isNop(e.value))}function pl({parameters:n}){return n.filter(e=>!le.isNop(e.value))}function dl({entries:n}){return n.filter(e=>!le.isNop(e.key)&&!le.isNop(e.value))}function fl({values:n}){return n.filter(e=>!le.isNop(e))}function tr({writer:n,arguments_:e}){let t=hl(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof le&&!a.shouldWriteInLine())){ml({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ii({writer:n,argument:a})}),n.write(")")}function ml({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ii({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ii({writer:n,argument:e}){br(e)?n.writeNodeOrString(e.assignment):e.write(n)}function hl(n){return n.filter(e=>!(e instanceof le&&le.isNop(e)))}var at=class extends G{constructor({classReference:t,arguments_:r}){super();N(this,"classReference");N(this,"arguments_");this.classReference=t,this.arguments_=r}write(t){t.writeNode(this.classReference),tr({writer:t,arguments_:this.arguments_})}};m();y();h();var it=class extends G{constructor(t){super();N(this,"arg");this.arg=t}write(t){return new me(this.arg).write(t)}};m();y();h();var st=class extends G{constructor({name:t,access:r,parameters:a,body:o,static_:u,return_:p}){super();N(this,"name");N(this,"access");N(this,"parameters");N(this,"body");N(this,"return_");N(this,"static_");this.name=t,this.access=r,this.parameters=a,this.body=o,this.return_=p,this.static_=u??!1}write(t){if(t.write(`${this.access} `),this.static_&&t.write("static "),this.return_!=null?t.writeNode(this.return_):t.write("void"),t.write(` ${this.name}`),this.parameters.length===0)t.write("()");else if(this.parameters.length===1){if(t.write("("),this.parameters[0]==null)throw new Error("Cannot render parameter "+this.parameters[0]);t.writeNode(this.parameters[0]),t.write(")")}else t.writeLine("("),t.indent(),this.parameters.forEach((r,a)=>{a>0&&t.writeLine(", "),t.writeNode(r)}),t.dedent(),t.write(")");if(this.body==null){t.write(";");return}t.writeLine(" {"),t.indent(),t.writeNode(this.body),t.writeNewLineIfLastLineNot(),t.dedent(),t.write("}")}};m();y();h();var ot=class extends G{constructor({method:t,arguments_:r,on:a}){super();N(this,"on");N(this,"method");N(this,"arguments_");this.on=a,this.method=t,this.arguments_=r}write(t){this.on.write(t),t.write("."),t.write(this.method),tr({writer:t,arguments_:this.arguments_})}};m();y();h();var ut=class extends G{constructor({name:t,type:r}){super();N(this,"name");N(this,"type");this.name=t,this.type=r}write(t){t.writeNode(this.type),t.write(` ${this.name}`)}};function yl(n){return new it(n)}function gl(n){return new nt(n)}function xl(n){return new q(n)}function vl(n){return new at(n)}function wl(n){return new ot(n)}function bl(n){return new st(n)}function Tl(n){return new ut(n)}m();y();h();var rr=class{constructor({context:e}){N(this,"context");this.context=e}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}wrapInOptionalIfNotNop(e,t=!1,r=!1){return d.TypeLiteral.isNop(e)?e:r?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:D.Critical,message:"Expected non-null value, but got null"}),d.TypeLiteral.nop());if(e.value===void 0)return d.TypeLiteral.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value,as:e.as});case"literal":return this.convertLiteral({literal:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value,as:e.as});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?d.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion})}case"nullable":case"optional":{if(e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&e.typeReference.value.type==="named")return e.isCollapsedOptionalNullable||this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable")?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(e.typeReference.value.type==="list"){let a=this.convertList({list:e.typeReference.value.value,value:e.value});return this.wrapInOptionalIfNotNop(a,!0,e.isCollapsedOptionalNullable===!0)}if(this.usesOptionalNullable()&&(e.typeReference.value.type==="optional"||e.typeReference.value.type==="nullable"))return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,isCollapsedOptionalNullable:!0});let t=this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion}),r=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapInOptionalIfNotNop(t,r,e.isCollapsedOptionalNullable===!0)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertSet({set:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:$(e.typeReference)}}convertList({list:e,value:t,as:r}){if(!Array.isArray(t))return this.context.errors.add({severity:D.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let a=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,u)=>{this.context.errors.scope({index:u});try{if(a){let p=this.convert({typeReference:e.value,value:o,as:r});return this.wrapInOptionalIfNotNop(p,!0)}return this.convert({typeReference:e,value:o,as:r})}finally{this.context.errors.unscope()}}),isParameter:!0})}convertLiteral({literal:e,value:t}){switch(e.type){case"boolean":{let r=this.context.getValueAsBoolean({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(r)}case"string":{let r=this.context.getValueAsString({value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.string(r)}default:$(e)}}convertSet({set:e,value:t,as:r}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((a,o)=>{this.context.errors.scope({index:o});try{return this.convert({typeReference:e,value:a,as:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:D.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r}){return typeof t!="object"||t==null?(this.context.errors.add({severity:D.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),d.TypeLiteral.nop()):d.TypeLiteral.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(t).map(([a,o])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:e.key,value:a,as:"mapKey"}),value:this.convert({typeReference:e.value,value:o,as:"mapValue"})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a}){switch(e.type){case"alias":if(e.typeReference.type==="unknown"){let o=this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});return d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[o]}))}return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:$(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){let r=this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),a=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(a==null)return d.TypeLiteral.nop();let o=a.singleDiscriminatedUnionType;switch(o.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:o.typeId});return u==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convertNamed({named:u,value:a.value})]}))}case"singleProperty":{let u=this.context.getRecord(a.value);if(u==null)return d.TypeLiteral.nop();try{return this.context.errors.scope(o.discriminantValue.wireValue),d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[this.convert({typeReference:o.typeReference,value:u["value"]})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:r,method:this.context.getPropertyName(o.discriminantValue.name),arguments_:[]}));default:$(o)}}convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a}){let o=this.context.getRecord(t)??{},u=this.context.associateByWireValue({parameters:e.properties,values:o}),p=new Set(u.map(P=>P.name.wireValue));for(let P of e.properties)if(!p.has(P.name.wireValue)&&!this.context.isOptional(P.typeReference)){if(a===!0)throw new Error(`Required property "${P.name.wireValue}" is missing from value`);let A=this.getDefaultValueForTypeReference(P.typeReference);A!==void 0&&u.push({name:P.name,typeReference:P.typeReference,value:A})}let g=new Map,w=new Set;e.properties.forEach((P,A)=>{g.set(P.name.wireValue,A),w.add(P.name.wireValue)}),u.sort((P,A)=>(g.get(P.name.wireValue)??0)-(g.get(A.name.wireValue)??0));let I=r==="request"?u.filter(P=>!this.context.isDirectLiteral(P.typeReference)):u,F=[];for(let P of I){this.context.errors.scope(P.name.wireValue);try{let A=this.convert({typeReference:P.typeReference,value:P.value,as:r,inUndiscriminatedUnion:a});if(d.TypeLiteral.isNop(A)&&!this.context.isOptional(P.typeReference)){if(a===!0)throw new Error(`Required property "${P.name.wireValue}" could not be converted`);continue}F.push({name:this.context.getMethodName(P.name.name),value:A})}finally{this.context.errors.unscope()}}for(let[P,A]of Object.entries(o))if(!w.has(P)&&A!==void 0){let S=this.convertToRawJavaLiteral(A);S!=null&&F.push({name:"additionalProperty",value:d.TypeLiteral.raw(`"${this.escapeJavaString(P)}", ${S}`)})}return d.TypeLiteral.builder({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),parameters:F})}convertToRawJavaLiteral(e){return typeof e=="string"?`"${this.escapeJavaString(e)}"`:typeof e=="number"||typeof e=="boolean"?e.toString():e===null?"null":null}escapeJavaString(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}getDefaultValueForTypeReference(e){switch(e.type){case"primitive":return this.getDefaultPrimitiveValue(e.value);case"nullable":return null;case"optional":return;case"list":case"set":return[];case"map":return{};case"named":{let t=this.context.resolveNamedType({typeId:e.value});if(t==null)return{};switch(t.type){case"enum":if(t.values.length>0){let r=t.values[0];return r?.wireValue}return;case"object":case"alias":return{};case"discriminatedUnion":case"undiscriminatedUnion":return;default:return{}}}case"literal":return e.value.value;case"unknown":return{};default:$(e)}}getDefaultPrimitiveValue(e){switch(e){case"STRING":return"string";case"INTEGER":case"UINT":return 1;case"LONG":case"UINT_64":return 1e6;case"FLOAT":case"DOUBLE":return 1.1;case"BOOLEAN":return!0;case"DATE":return"2024-01-15";case"DATE_TIME":return"2024-01-15T09:30:00Z";case"DATE_TIME_RFC_2822":return"Tue, 15 Jan 2024 09:30:00 +0000";case"UUID":return"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32";case"BASE_64":return"SGVsbG8gd29ybGQh";case"BIG_INTEGER":return"123456789";default:return"string"}}convertEnum({enum_:e,value:t}){let r=this.getEnumValueName({enum_:e,value:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:r})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:D.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let r=e.values.find(a=>a.wireValue===t);if(r==null){this.context.errors.add({severity:D.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getEnumName(r.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return r==null?d.TypeLiteral.nop():this.context.isPrimitive(r.valueTypeReference)?d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]})):d.TypeLiteral.reference(d.invokeMethod({on:this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[r.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){let r=[],a=[];for(let p of e.types){let g=this.context.errors.size();try{r.push(JSON.stringify(p));let w=this.convert({typeReference:p,value:t,inUndiscriminatedUnion:!0});if(d.TypeLiteral.isNop(w)){this.context.errors.truncate(g);continue}return{valueTypeReference:p,typeInstantiation:w}}catch(w){this.context.errors.truncate(g),a.push(`Type ${JSON.stringify(p)}: ${gr(w)}`);continue}}this.context.errors.add({severity:D.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value. Tried ${r.length} variants. Errors: ${a.join("; ")}`});let o=e.declaration.name??"UnknownUnion",u=a.map((p,g)=>` ${g+1}. ${p}`).join(`
23
23
  `);throw new Error(`Failed to match undiscriminated union "${o}" for ${typeof t} value.
24
24
  Value: ${JSON.stringify(t)}
25
25
  Attempted ${r.length} variants:
26
26
  ${u}
27
27
 
28
- This prevents invalid snippet code generation that would cause formatter errors.`)}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t==null?void 0:this.context.getClassName(t.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForNullable({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:M(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`ListOf${t}`}getUndiscriminatedUnionFieldNameForMap({map:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(t==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`MapOf${t}To${r}`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Optional${t}`}getUndiscriminatedUnionFieldNameForNullable({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Nullable${t}`}getUndiscriminatedUnionFieldNameForSet({set:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`SetOf${t}`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":return"Float";case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":return"BigInteger";case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:{if(e==="DATE_TIME_RFC_2822")return"DateTimeRfc2822";M(e)}}}convertUnknown({value:e}){return this.context.customConfig?.["generate-unknown-as-json-node"]===!0?this.convertToJsonNode({value:e}):d.TypeLiteral.unknown(e)}convertToJsonNode({value:e}){let t=d.classReference({name:"ObjectMappers",packageName:this.context.getCorePackageName()});return typeof e=="string"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.string(e)]})):typeof e=="number"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.integer(e)]})):typeof e=="boolean"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.boolean(e)]})):e===null?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.raw(d.codeblock("null"))]})):Array.isArray(e)?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.list({valueType:d.Type.object(),values:e.map(r=>d.TypeLiteral.unknown(r)),isParameter:!0})]})):typeof e=="object"&&e!==null?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.unknown(e)]})):d.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r}){switch(e){case"INTEGER":case"UINT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.integer(a)}case"LONG":case"UINT_64":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.long(a)}case"FLOAT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.float(a)}case"DOUBLE":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.double(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(a)}case"STRING":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.string(a)}case"DATE":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():this.context.customConfig?.["use-local-date-for-dates"]===!0?d.TypeLiteral.date(a):d.TypeLiteral.string(a)}case"DATE_TIME":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.dateTime(a)}case"UUID":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.uuid(a)}case"BASE_64":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.bytes(a)}case"BIG_INTEGER":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.bigInteger(a)}default:{if(e==="DATE_TIME_RFC_2822"){let o=this.context.getValueAsString({value:t});return o==null?d.TypeLiteral.nop():d.TypeLiteral.dateTime(o)}M(e)}}}getValueAsNumber({value:e,as:t}){let r=t==="mapKey"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="mapKey"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};m();y();h();var nr=class{constructor({context:e}){R(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return d.Type.list(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return d.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":return d.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return d.Type.set(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:M(e.typeReference)}}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return d.Type.reference(d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getTypesPackageName(e.declaration.fernFilepath)}));default:M(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return d.Type.boolean();case"string":return d.Type.string()}}convertUnknown(){return this.context.customConfig?.["generate-unknown-as-json-node"]===!0?d.Type.reference(d.classReference({name:"JsonNode",packageName:"com.fasterxml.jackson.databind"})):d.Type.object()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return d.Type.integer();case"UINT":return d.Type.integer();case"LONG":return d.Type.long();case"UINT_64":return d.Type.long();case"FLOAT":return d.Type.float();case"DOUBLE":return d.Type.double();case"BOOLEAN":return d.Type.boolean();case"STRING":return d.Type.string();case"DATE":return d.Type.date();case"DATE_TIME":return d.Type.dateTime();case"UUID":return d.Type.uuid();case"BASE_64":return d.Type.bytes();case"BIG_INTEGER":return d.Type.bigInteger();default:{if(e==="DATE_TIME_RFC_2822")return d.Type.dateTime();M(e)}}}};m();y();h();var ar=class{constructor({context:e}){R(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){let r={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(t)??{};for(let o of e.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getMethodName(o.name.name),value:this.getBodyProperty({property:o,record:a})});break;default:M(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});if(r==null)return d.TypeLiteral.nop();for(let a of r)return d.TypeLiteral.reference(this.context.getFileStreamFromString(a));return d.TypeLiteral.nop()}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?d.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var _l=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch"]),kl=new Set(["getClass","notify","notifyAll","wait"]),ir=class n extends Bt{constructor({ir:t,config:r,options:a,sharedCustomConfig:o}){super({ir:t,config:r,options:a});R(this,"ir");R(this,"customConfig");R(this,"dynamicTypeMapper");R(this,"dynamicTypeLiteralMapper");R(this,"filePropertyMapper");this.ir=t,this.customConfig=o??Nr.parse(r.customConfig??{}),this.dynamicTypeMapper=new nr({context:this}),this.dynamicTypeLiteralMapper=new rr({context:this}),this.filePropertyMapper=new ar({context:this})}clone(){return new n({ir:this.ir,config:this.config,options:this.options,sharedCustomConfig:this.customConfig})}getClassName(t){return this.getName(t.pascalCase.safeName)}getEnumName(t){return this.getName(t.screamingSnakeCase.safeName)}getPropertyName(t){return this.getName(t.camelCase.safeName)}getMethodName(t){let r=t.camelCase.safeName;return this.isReservedMethodName(r)?r+"_":this.getName(r)}getRootClientClassReference(){return d.classReference({name:this.getRootClientClassName(),packageName:this.getRootPackageName()})}getRootClientClassName(){return this.customConfig?.["client-class-name"]??`${this.getBaseNamePrefix()}Client`}getEnvironmentClassName(){return"Environment"}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return d.codeblock(a=>{a.writeNode(this.getEnvironmentClassReference()),a.write("."),a.write(this.getEnumName(r))})}getEnvironmentClassReference(){return d.classReference({name:this.getEnvironmentClassName(),packageName:this.getCorePackageName()})}getJavaClassReferenceFromDeclaration({declaration:t}){return d.classReference({name:t.name.pascalCase.unsafeName,packageName:this.getTypesPackageName(t.fernFilepath)})}getNullableClassReference(){return d.classReference({name:"Nullable",packageName:this.getCorePackageName()})}getNullableOfNull(){return d.TypeLiteral.reference(d.invokeMethod({on:this.getNullableClassReference(),method:"ofNull",arguments_:[]}))}getOptionalNullableClassReference(){return d.classReference({name:"OptionalNullable",packageName:this.getCorePackageName()})}getOptionalNullableAbsent(){return d.TypeLiteral.reference(d.invokeMethod({on:this.getOptionalNullableClassReference(),method:"absent",arguments_:[]}))}getOptionalNullableOf(t){return d.TypeLiteral.reference(d.invokeMethod({on:this.getOptionalNullableClassReference(),method:"of",arguments_:[t]}))}getFileStreamFromString(t){return d.TypeLiteral.reference(d.codeblock(r=>{r.write("new "),r.writeNode(this.getFileStreamClassReference()),r.write("("),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getFileStreamClassReference(){return d.classReference({name:"FileStream",packageName:this.getCorePackageName()})}getByteArrayInputStreamClassReference(){return d.classReference({name:"ByteArrayInputStream",packageName:"java.io"})}getStandardCharsetsClassReference(){return d.classReference({name:"StandardCharsets",packageName:"java.nio.charset"})}isPrimitive(t){switch(t.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(t.value);case"named":{let r=this.resolveNamedType({typeId:t.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:M(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:M(t)}}isDirectLiteral(t){return t.type==="literal"}sortTypeInstancesByRequiredFirst(t,r){let a=new Map;r.forEach((p,x)=>{a.set(p.name.wireValue,x)});let o=[],u=[];for(let p of t)this.isOptional(p.typeReference)?u.push(p):o.push(p);return o.sort((p,x)=>(a.get(p.name.wireValue)??0)-(a.get(x.name.wireValue)??0)),[...o,...u]}associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}){let o=super.associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}),u=new Map;for(let x of o)u.set(x.name.wireValue,x);let p=[];for(let x of t){let w=u.get(x.name.wireValue);w!=null&&p.push(w)}return p}getRootPackageName(){let t=this.getPackagePrefixTokens();return this.joinPackageTokens(t)}getCorePackageName(){let t=this.getPackagePrefixTokens();return t.push("core"),this.joinPackageTokens(t)}getTypesPackageName(t){return this.getResourcesPackage(t,"types")}getRequestsPackageName(t){return this.getPackageLayout()==="flat"?this.getTypesPackageName(t):this.getResourcesPackage(t,"requests")}getResourcesPackage(t,r){let a=this.getPackagePrefixTokens();return this.getPackageLayout()==="flat"?t!=null&&a.push(...t.packagePath.map(o=>this.getPackageNameSegment(o))):(t!=null&&t.allParts.length>0&&a.push("resources"),t!=null&&a.push(...t.allParts.map(o=>this.getPackageNameSegment(o)))),r!=null&&a.push(r),this.joinPackageTokens(a)}getPackageName(t,r){let a=this.getPackageNameSegments(t);return a=r!=null?[...a,r]:a,[...this.getPackagePrefixTokens(),...a].join(".")}getPackageLayout(){return this.customConfig?.["package-layout"]??"nested"}shouldInlinePathParameters(){return this.customConfig?.["inline-path-parameters"]??!1}shouldInlineFileProperties(){return this.customConfig?.["inline-file-properties"]??!1}getPackageNameSegments(t){return t.packagePath.map(r=>this.getPackageNameSegment(r))}getPackageNameSegment(t){return t.camelCase.safeName.toLowerCase()}getPackagePrefixTokens(){if(this.customConfig?.["package-prefix"]!=null)return this.customConfig["package-prefix"].split(".");let t=[];return t.push("com"),t.push(...this.splitOnNonAlphaNumericChar(this.config.organization)),t.push(...this.splitOnNonAlphaNumericChar(this.getApiName())),t}getBaseNamePrefix(){return this.convertKebabCaseToUpperCamelCase(this.config.organization)+this.convertKebabCaseToUpperCamelCase(this.getApiName())}getApiName(){return yr(this.config.workspaceName)}startsWithNumber(t){return/^\d/.test(t)}splitOnNonAlphaNumericChar(t){return t.split(/[^a-zA-Z0-9]/)}convertKebabCaseToUpperCamelCase(t){return t.replace(/-([a-z])/g,(r,a)=>a.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}joinPackageTokens(t){return t.map(a=>this.startsWithNumber(a)?"_"+a:a).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return _l.has(t)}isReservedMethodName(t){return kl.has(t)}};m();y();h();var Ei="com.example.usage",Nl="Example",Rl="main",Il="args",Ai="client",El={type:"primitive",value:"STRING"};function Al(n){if(n.type==="optional"&&n.value.type==="list"){let t=n.value.value;if(t.type==="optional")return{type:"optional",value:{type:"list",value:t.value}}}if(n.type==="list"){let e=n.value;if(e.type==="optional")return{type:"list",value:e.value}}return n}var sr=class{constructor({context:e,formatter:t}){R(this,"context");R(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toStringAsync({packageName:a.fullStylePackageName??Ei,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){let a=this.getConfig(r);return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({packageName:a.fullStylePackageName??Ei,customConfig:this.context.customConfig,formatter:this.formatter})}async generateSnippetAst({endpoint:e,request:t,options:r}){throw new Error("Unsupported")}buildCodeBlock({endpoint:e,snippet:t,options:r}){let a=d.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),u.newLine(),u.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),o=this.getStyle(r);switch(o){case Me.Concise:return a;case Me.Full:return this.buildFullCodeBlock({body:a,options:r});default:M(o)}}constructClient({endpoint:e,snippet:t}){let r=e.auth?.type==="oauth";return d.codeblock(a=>{if(a.writeNode(this.context.getRootClientClassReference()),a.write(` ${Ai} = `),r&&t.auth?.type==="oauth"){let o=t.auth;a.writeNode(this.context.getRootClientClassReference()),a.write(`.withCredentials("${o.clientId}", "${o.clientSecret}")`),a.writeNewLineIfLastLineNot(),a.indent();let u=this.getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t});for(let p of u)a.write(`.${p.name}(`),p.value.shouldWriteInLine()||a.newLine(),a.writeNode(p.value),p.value.shouldWriteInLine()||a.newLine(),a.writeLine(")");a.writeLine(".build()"),a.dedent()}else a.writeNode(d.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:e,snippet:t})}))})}getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t}){let r=[],a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(se.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=new Set;if([...this.context.ir.pathParameters??[],...e.request.pathParameters??[]].forEach(p=>{p.variable!=null&&o.add(p.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let p of this.context.ir.variables)if(o.has(p.id)){let x=p.name.camelCase.unsafeName;r.push({name:x,value:d.TypeLiteral.string(`YOUR_${p.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(se.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let p=this.context.ir.pathParameters.filter(x=>x.variable==null);p.length>0&&r.push(...this.getPathParameters({namedParameters:p,snippet:t}))}return this.context.errors.unscope(),r}buildFullCodeBlock({body:e,options:t}){let r=this.getConfig(t),a=d.class_({name:r.fullStyleClassName??Nl,access:d.Access.Public}),o=d.parameter({name:Il,type:d.Type.array(d.Type.string())});return a.addMethod(d.method({name:Rl,access:d.Access.Public,static_:!0,parameters:[o],body:e})),a}getRootClientBuilderArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:D.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(se.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=new Set;if([...this.context.ir.pathParameters??[],...e.request.pathParameters??[]].forEach(p=>{p.variable!=null&&o.add(p.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let p of this.context.ir.variables)if(o.has(p.id)){let x=p.name.camelCase.unsafeName;r.push({name:x,value:d.TypeLiteral.string(`YOUR_${p.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(se.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let p=this.context.ir.pathParameters.filter(x=>x.variable==null);p.length>0&&r.push(...this.getPathParameters({namedParameters:p,snippet:t}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:D.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null){if(this.context.ir.environments?.environments.type==="multipleBaseUrls"){this.context.errors.add({severity:D.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:d.TypeLiteral.string(e)}}if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:D.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return{name:"environment",value:d.TypeLiteral.reference(r)}}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?{name:"environment",value:d.TypeLiteral.reference(d.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(t).map(r=>this.context.dynamicTypeLiteralMapper.convert({typeReference:El,value:r}))}))}:void 0}}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:M(e)}}addError(e){this.context.errors.add({severity:D.Critical,message:e})}addWarning(e){this.context.errors.add({severity:D.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[{name:"credentials",value:d.TypeLiteral.raw(`"${t.username}", "${t.password}"`)}]}getRootClientBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.token),value:d.TypeLiteral.string(t.token)}]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getRootClientOAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.clientId),value:d.TypeLiteral.string(t.clientId)},{name:this.context.getMethodName(e.clientSecret),value:d.TypeLiteral.string(t.clientSecret)}]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let o=t[a.name.wireValue],u=this.getRootClientHeaderArg({header:a,value:o});u!=null&&r.push({name:this.context.getMethodName(a.name.name),value:u})}return r}getRootClientHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!d.TypeLiteral.isNop(r))return r}callMethod({endpoint:e,snippet:t}){return d.invokeMethod({on:d.codeblock(Ai),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:M(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(se.PathParameters);let a=(e.pathParameters??[]).filter(u=>u.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let o=this.getRequestOptionsArg({request:e,snippet:t});return o!=null&&r.push(o),r}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":{if(e.value.type==="optional"){let r=this.usesOptionalNullable()&&(e.value.value.type==="optional"||e.value.value.type==="nullable");if(t==null)return r?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request",isCollapsedOptionalNullable:r}),o=a.toString({packageName:"com.example",customConfig:this.context.customConfig});return o.includes("Optional.empty()")||o.includes("OptionalNullable.absent()")?a:r?this.context.getOptionalNullableOf(a):d.TypeLiteral.optional({value:a,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:M(e)}}getBytesBodyRequestArg({value:e}){return e==null?d.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:D.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),d.TypeLiteral.nop()):d.TypeLiteral.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],{inlinePathParameters:a,inlineFileProperties:o}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(se.PathParameters);let u=[],p=(e.pathParameters??[]).filter(w=>w.variable==null);p.length>0&&u.push(...this.getPathParameters({namedParameters:p,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody);let x=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...u.map(w=>w.value)),o||r.push(...x.fileFields.map(w=>w.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?u:[],filePropertyInfo:x})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:a}){this.context.errors.scope(se.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),x=this.context.sortTypeInstancesByRequiredFirst(u,e.queryParameters??[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Al(S.typeReference),value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.Headers);let _=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),J=this.context.sortTypeInstancesByRequiredFirst(_,e.headers??[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.RequestBody);let C=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)}),parameters:[...r,...J,...x,...C]})}getRequestOptionsArg({request:e,snippet:t}){let r="headers"in e?e.headers??[]:[];if(r.length===0||Object.keys(t.headers??{}).length===0)return;this.context.errors.scope(se.Headers);let a=this.context.associateByWireValue({parameters:r,values:t.headers??{}});if(this.context.errors.unscope(),a.length===0)return;let o=d.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),u=d.invokeMethod({on:o,method:"builder",arguments_:[]});for(let x of a)u=d.invokeMethod({on:u,method:"addHeader",arguments_:[d.TypeLiteral.string(x.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(x)]});let p=d.invokeMethod({on:u,method:"build",arguments_:[]});return d.TypeLiteral.reference(p)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:M(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"});default:M(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){let a=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}}).filter(u=>!this.context.isDirectLiteral(u.typeReference));return this.context.sortTypeInstancesByRequiredFirst(a,e).map(u=>({name:this.context.getMethodName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:u.typeReference,value:u.value,as:"request"})}))}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{}});for(let o of a)r.push({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>`${this.context.getMethodName(t)}()`).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getStyle(e){return e.style??this.context.options.style??Me.Full}getConfig(e){return e.config??this.context.options.config??{}}};var Ar=class extends Ct{constructor({ir:e,config:t,options:r={}}){super(new ir({ir:e,config:t,options:r}))}async generate(e,t={}){return super.generate(e,t)}generateSync(e,t={}){return super.generateSync(e,t)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new sr({context:e})}};export{Ar as DynamicSnippetsGenerator};
28
+ This prevents invalid snippet code generation that would cause formatter errors.`)}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t==null?void 0:this.context.getClassName(t.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForNullable({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:$(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`ListOf${t}`}getUndiscriminatedUnionFieldNameForMap({map:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(t==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`MapOf${t}To${r}`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Optional${t}`}getUndiscriminatedUnionFieldNameForNullable({typeReference:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`Nullable${t}`}getUndiscriminatedUnionFieldNameForSet({set:e}){let t=this.getUndiscriminatedUnionFieldName({typeReference:e});if(t!=null)return`SetOf${t}`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":return"Float";case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":return"BigInteger";case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"DATE_TIME_RFC_2822":return"DateTimeRfc2822";case"BASE_64":return"Base64";default:$(e)}}convertUnknown({value:e}){return this.context.customConfig?.["generate-unknown-as-json-node"]===!0?this.convertToJsonNode({value:e}):d.TypeLiteral.unknown(e)}convertToJsonNode({value:e}){let t=d.classReference({name:"ObjectMappers",packageName:this.context.getCorePackageName()});return typeof e=="string"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.string(e)]})):typeof e=="number"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.integer(e)]})):typeof e=="boolean"?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.boolean(e)]})):e===null?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.raw(d.codeblock("null"))]})):Array.isArray(e)?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.list({valueType:d.Type.object(),values:e.map(r=>d.TypeLiteral.unknown(r)),isParameter:!0})]})):typeof e=="object"&&e!==null?d.TypeLiteral.reference(d.invokeMethod({on:d.codeblock(r=>{r.writeNode(t),r.write(".JSON_MAPPER")}),method:"valueToTree",arguments_:[d.TypeLiteral.unknown(e)]})):d.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:r}){switch(e){case"INTEGER":case"UINT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.integer(a)}case"LONG":case"UINT_64":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.long(a)}case"FLOAT":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.float(a)}case"DOUBLE":{let a=this.getValueAsNumber({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.double(a)}case"BOOLEAN":{let a=this.getValueAsBoolean({value:t,as:r});return a==null?d.TypeLiteral.nop():d.TypeLiteral.boolean(a)}case"STRING":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.string(a)}case"DATE":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():this.context.customConfig?.["use-local-date-for-dates"]===!0?d.TypeLiteral.date(a):d.TypeLiteral.string(a)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.dateTime(a)}case"UUID":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.uuid(a)}case"BASE_64":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.bytes(a)}case"BIG_INTEGER":{let a=this.context.getValueAsString({value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.bigInteger(a)}default:$(e)}}getValueAsNumber({value:e,as:t}){let r=t==="mapKey"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:t}){let r=t==="mapKey"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};m();y();h();var nr=class{constructor({context:e}){N(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return d.Type.list(this.convert({typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return d.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":return d.Type.optional(this.convert({typeReference:e.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return d.Type.set(this.convert({typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:$(e.typeReference)}}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"discriminatedUnion":case"object":case"undiscriminatedUnion":return d.Type.reference(d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getTypesPackageName(e.declaration.fernFilepath)}));default:$(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return d.Type.boolean();case"string":return d.Type.string()}}convertUnknown(){return this.context.customConfig?.["generate-unknown-as-json-node"]===!0?d.Type.reference(d.classReference({name:"JsonNode",packageName:"com.fasterxml.jackson.databind"})):d.Type.object()}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return d.Type.integer();case"UINT":return d.Type.integer();case"LONG":return d.Type.long();case"UINT_64":return d.Type.long();case"FLOAT":return d.Type.float();case"DOUBLE":return d.Type.double();case"BOOLEAN":return d.Type.boolean();case"STRING":return d.Type.string();case"DATE":return d.Type.date();case"DATE_TIME":case"DATE_TIME_RFC_2822":return d.Type.dateTime();case"UUID":return d.Type.uuid();case"BASE_64":return d.Type.bytes();case"BIG_INTEGER":return d.Type.bigInteger();default:$(e)}}};m();y();h();var ar=class{constructor({context:e}){N(this,"context");this.context=e}getFilePropertyInfo({body:e,value:t}){let r={fileFields:[],bodyPropertyFields:[]},a=this.context.getRecord(t)??{};for(let o of e.properties)switch(o.type){case"file":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getSingleFileProperty({property:o,record:a})});break;case"fileArray":r.fileFields.push({name:this.context.getMethodName(o.name),value:this.getArrayFileProperty({property:o,record:a})});break;case"bodyProperty":r.bodyPropertyFields.push({name:this.context.getMethodName(o.name.name),value:this.getBodyProperty({property:o,record:a})});break;default:$(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return r==null?d.TypeLiteral.nop():d.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});if(r==null)return d.TypeLiteral.nop();for(let a of r)return d.TypeLiteral.reference(this.context.getFileStreamFromString(a));return d.TypeLiteral.nop()}getBodyProperty({property:e,record:t}){let r=t[e.name.wireValue];return r==null?d.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:r})}};var _l=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch"]),kl=new Set(["getClass","notify","notifyAll","wait"]),ir=class n extends Bt{constructor({ir:t,config:r,options:a,sharedCustomConfig:o}){super({ir:t,config:r,options:a});N(this,"ir");N(this,"customConfig");N(this,"dynamicTypeMapper");N(this,"dynamicTypeLiteralMapper");N(this,"filePropertyMapper");this.ir=t,this.customConfig=o??Nr.parse(r.customConfig??{}),this.dynamicTypeMapper=new nr({context:this}),this.dynamicTypeLiteralMapper=new rr({context:this}),this.filePropertyMapper=new ar({context:this})}clone(){return new n({ir:this.ir,config:this.config,options:this.options,sharedCustomConfig:this.customConfig})}getClassName(t){return this.getName(t.pascalCase.safeName)}getEnumName(t){return this.getName(t.screamingSnakeCase.safeName)}getPropertyName(t){return this.getName(t.camelCase.safeName)}getMethodName(t){let r=t.camelCase.safeName;return this.isReservedMethodName(r)?r+"_":this.getName(r)}getRootClientClassReference(){return d.classReference({name:this.getRootClientClassName(),packageName:this.getRootPackageName()})}getRootClientClassName(){return this.customConfig?.["client-class-name"]??`${this.getBaseNamePrefix()}Client`}getEnvironmentClassName(){return"Environment"}getEnvironmentTypeReferenceFromID(t){let r=this.resolveEnvironmentName(t);if(r!=null)return d.codeblock(a=>{a.writeNode(this.getEnvironmentClassReference()),a.write("."),a.write(this.getEnumName(r))})}getEnvironmentClassReference(){return d.classReference({name:this.getEnvironmentClassName(),packageName:this.getCorePackageName()})}getJavaClassReferenceFromDeclaration({declaration:t}){return d.classReference({name:t.name.pascalCase.unsafeName,packageName:this.getTypesPackageName(t.fernFilepath)})}getNullableClassReference(){return d.classReference({name:"Nullable",packageName:this.getCorePackageName()})}getNullableOfNull(){return d.TypeLiteral.reference(d.invokeMethod({on:this.getNullableClassReference(),method:"ofNull",arguments_:[]}))}getOptionalNullableClassReference(){return d.classReference({name:"OptionalNullable",packageName:this.getCorePackageName()})}getOptionalNullableAbsent(){return d.TypeLiteral.reference(d.invokeMethod({on:this.getOptionalNullableClassReference(),method:"absent",arguments_:[]}))}getOptionalNullableOf(t){return d.TypeLiteral.reference(d.invokeMethod({on:this.getOptionalNullableClassReference(),method:"of",arguments_:[t]}))}getFileStreamFromString(t){return d.TypeLiteral.reference(d.codeblock(r=>{r.write("new "),r.writeNode(this.getFileStreamClassReference()),r.write("("),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getFileStreamClassReference(){return d.classReference({name:"FileStream",packageName:this.getCorePackageName()})}getByteArrayInputStreamClassReference(){return d.classReference({name:"ByteArrayInputStream",packageName:"java.io"})}getStandardCharsetsClassReference(){return d.classReference({name:"StandardCharsets",packageName:"java.nio.charset"})}isPrimitive(t){switch(t.type){case"primitive":return!0;case"optional":case"nullable":return this.isPrimitive(t.value);case"named":{let r=this.resolveNamedType({typeId:t.value});if(r==null)return!1;switch(r.type){case"alias":return this.isPrimitive(r.typeReference);case"discriminatedUnion":case"undiscriminatedUnion":case"object":case"enum":return!1;default:$(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:$(t)}}isDirectLiteral(t){return t.type==="literal"}sortTypeInstancesByRequiredFirst(t,r){let a=new Map;r.forEach((p,g)=>{a.set(p.name.wireValue,g)});let o=[],u=[];for(let p of t)this.isOptional(p.typeReference)?u.push(p):o.push(p);return o.sort((p,g)=>(a.get(p.name.wireValue)??0)-(a.get(g.name.wireValue)??0)),[...o,...u]}associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}){let o=super.associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}),u=new Map;for(let g of o)u.set(g.name.wireValue,g);let p=[];for(let g of t){let w=u.get(g.name.wireValue);w!=null&&p.push(w)}return p}getRootPackageName(){let t=this.getPackagePrefixTokens();return this.joinPackageTokens(t)}getCorePackageName(){let t=this.getPackagePrefixTokens();return t.push("core"),this.joinPackageTokens(t)}getTypesPackageName(t){return this.getResourcesPackage(t,"types")}getRequestsPackageName(t){return this.getPackageLayout()==="flat"?this.getTypesPackageName(t):this.getResourcesPackage(t,"requests")}getResourcesPackage(t,r){let a=this.getPackagePrefixTokens();return this.getPackageLayout()==="flat"?t!=null&&a.push(...t.packagePath.map(o=>this.getPackageNameSegment(o))):(t!=null&&t.allParts.length>0&&a.push("resources"),t!=null&&a.push(...t.allParts.map(o=>this.getPackageNameSegment(o)))),r!=null&&a.push(r),this.joinPackageTokens(a)}getPackageName(t,r){let a=this.getPackageNameSegments(t);return a=r!=null?[...a,r]:a,[...this.getPackagePrefixTokens(),...a].join(".")}getPackageLayout(){return this.customConfig?.["package-layout"]??"nested"}shouldInlinePathParameters(){return this.customConfig?.["inline-path-parameters"]??!1}shouldInlineFileProperties(){return this.customConfig?.["inline-file-properties"]??!1}getPackageNameSegments(t){return t.packagePath.map(r=>this.getPackageNameSegment(r))}getPackageNameSegment(t){return t.camelCase.safeName.toLowerCase()}getPackagePrefixTokens(){if(this.customConfig?.["package-prefix"]!=null)return this.customConfig["package-prefix"].split(".");let t=[];return t.push("com"),t.push(...this.splitOnNonAlphaNumericChar(this.config.organization)),t.push(...this.splitOnNonAlphaNumericChar(this.getApiName())),t}getBaseNamePrefix(){return this.convertKebabCaseToUpperCamelCase(this.config.organization)+this.convertKebabCaseToUpperCamelCase(this.getApiName())}getApiName(){return yr(this.config.workspaceName)}startsWithNumber(t){return/^\d/.test(t)}splitOnNonAlphaNumericChar(t){return t.split(/[^a-zA-Z0-9]/)}convertKebabCaseToUpperCamelCase(t){return t.replace(/-([a-z])/g,(r,a)=>a.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}joinPackageTokens(t){return t.map(a=>this.startsWithNumber(a)?"_"+a:a).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return _l.has(t)}isReservedMethodName(t){return kl.has(t)}};m();y();h();var Ei="com.example.usage",Nl="Example",Rl="main",Il="args",Ai="client",El={type:"primitive",value:"STRING"};function Al(n){if(n.type==="optional"&&n.value.type==="list"){let t=n.value.value;if(t.type==="optional")return{type:"optional",value:{type:"list",value:t.value}}}if(n.type==="list"){let e=n.value;if(e.type==="optional")return{type:"list",value:e.value}}return n}var sr=class{constructor({context:e,formatter:t}){N(this,"context");N(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toStringAsync({packageName:a.fullStylePackageName??Ei,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){let a=this.getConfig(r);return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({packageName:a.fullStylePackageName??Ei,customConfig:this.context.customConfig,formatter:this.formatter})}async generateSnippetAst({endpoint:e,request:t,options:r}){throw new Error("Unsupported")}buildCodeBlock({endpoint:e,snippet:t,options:r}){let a=d.codeblock(u=>{u.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),u.newLine(),u.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),o=this.getStyle(r);switch(o){case Me.Concise:return a;case Me.Full:return this.buildFullCodeBlock({body:a,options:r});default:$(o)}}constructClient({endpoint:e,snippet:t}){let r=e.auth?.type==="oauth";return d.codeblock(a=>{if(a.writeNode(this.context.getRootClientClassReference()),a.write(` ${Ai} = `),r&&t.auth?.type==="oauth"){let o=t.auth;a.writeNode(this.context.getRootClientClassReference()),a.write(`.withCredentials("${o.clientId}", "${o.clientSecret}")`),a.writeNewLineIfLastLineNot(),a.indent();let u=this.getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t});for(let p of u)a.write(`.${p.name}(`),p.value.shouldWriteInLine()||a.newLine(),a.writeNode(p.value),p.value.shouldWriteInLine()||a.newLine(),a.writeLine(")");a.writeLine(".build()"),a.dedent()}else a.writeNode(d.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:e,snippet:t})}))})}getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t}){let r=[],a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(se.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=new Set;if([...this.context.ir.pathParameters??[],...e.request.pathParameters??[]].forEach(p=>{p.variable!=null&&o.add(p.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let p of this.context.ir.variables)if(o.has(p.id)){let g=p.name.camelCase.unsafeName;r.push({name:g,value:d.TypeLiteral.string(`YOUR_${p.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(se.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let p=this.context.ir.pathParameters.filter(g=>g.variable==null);p.length>0&&r.push(...this.getPathParameters({namedParameters:p,snippet:t}))}return this.context.errors.unscope(),r}buildFullCodeBlock({body:e,options:t}){let r=this.getConfig(t),a=d.class_({name:r.fullStyleClassName??Nl,access:d.Access.Public}),o=d.parameter({name:Il,type:d.Type.array(d.Type.string())});return a.addMethod(d.method({name:Rl,access:d.Access.Public,static_:!0,parameters:[o],body:e})),a}getRootClientBuilderArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:D.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(se.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let o=new Set;if([...this.context.ir.pathParameters??[],...e.request.pathParameters??[]].forEach(p=>{p.variable!=null&&o.add(p.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let p of this.context.ir.variables)if(o.has(p.id)){let g=p.name.camelCase.unsafeName;r.push({name:g,value:d.TypeLiteral.string(`YOUR_${p.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(se.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let p=this.context.ir.pathParameters.filter(g=>g.variable==null);p.length>0&&r.push(...this.getPathParameters({namedParameters:p,snippet:t}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null){this.context.errors.add({severity:D.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null){if(this.context.ir.environments?.environments.type==="multipleBaseUrls"){this.context.errors.add({severity:D.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:d.TypeLiteral.string(e)}}if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentTypeReferenceFromID(t);if(r==null){this.context.errors.add({severity:D.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return{name:"environment",value:d.TypeLiteral.reference(r)}}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?{name:"environment",value:d.TypeLiteral.reference(d.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(t).map(r=>this.context.dynamicTypeLiteralMapper.convert({typeReference:El,value:r}))}))}:void 0}}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:$(e)}}addError(e){this.context.errors.add({severity:D.Critical,message:e})}addWarning(e){this.context.errors.add({severity:D.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[{name:"credentials",value:d.TypeLiteral.raw(`"${t.username}", "${t.password}"`)}]}getRootClientBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.token),value:d.TypeLiteral.string(t.token)}]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getRootClientOAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.clientId),value:d.TypeLiteral.string(t.clientId)},{name:this.context.getMethodName(e.clientSecret),value:d.TypeLiteral.string(t.clientSecret)}]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let o=t[a.name.wireValue],u=this.getRootClientHeaderArg({header:a,value:o});u!=null&&r.push({name:this.context.getMethodName(a.name.name),value:u})}return r}getRootClientHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!d.TypeLiteral.isNop(r))return r}callMethod({endpoint:e,snippet:t}){return d.invokeMethod({on:d.codeblock(Ai),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:$(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(se.PathParameters);let a=(e.pathParameters??[]).filter(u=>u.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(u=>u.value)),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let o=this.getRequestOptionsArg({request:e,snippet:t});return o!=null&&r.push(o),r}usesOptionalNullable(){return this.context.customConfig?.["collapse-optional-nullable"]===!0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":{if(e.value.type==="optional"){let r=this.usesOptionalNullable()&&(e.value.value.type==="optional"||e.value.value.type==="nullable");if(t==null)return r?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let a=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request",isCollapsedOptionalNullable:r}),o=a.toString({packageName:"com.example",customConfig:this.context.customConfig});return o.includes("Optional.empty()")||o.includes("OptionalNullable.absent()")?a:r?this.context.getOptionalNullableOf(a):d.TypeLiteral.optional({value:a,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:$(e)}}getBytesBodyRequestArg({value:e}){return e==null?d.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:D.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),d.TypeLiteral.nop()):d.TypeLiteral.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[],{inlinePathParameters:a,inlineFileProperties:o}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(se.PathParameters);let u=[],p=(e.pathParameters??[]).filter(w=>w.variable==null);p.length>0&&u.push(...this.getPathParameters({namedParameters:p,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody);let g=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...u.map(w=>w.value)),o||r.push(...g.fileFields.map(w=>w.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?u:[],filePropertyInfo:g})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:a}){this.context.errors.scope(se.QueryParameters);let u=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),g=this.context.sortTypeInstancesByRequiredFirst(u,e.queryParameters??[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Al(S.typeReference),value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.Headers);let I=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).filter(S=>!this.context.isDirectLiteral(S.typeReference)),P=this.context.sortTypeInstancesByRequiredFirst(I,e.headers??[]).map(S=>({name:this.context.getMethodName(S.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:S.typeReference,value:S.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.RequestBody);let A=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)}),parameters:[...r,...P,...g,...A]})}getRequestOptionsArg({request:e,snippet:t}){let r="headers"in e?e.headers??[]:[];if(r.length===0||Object.keys(t.headers??{}).length===0)return;this.context.errors.scope(se.Headers);let a=this.context.associateByWireValue({parameters:r,values:t.headers??{}});if(this.context.errors.unscope(),a.length===0)return;let o=d.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),u=d.invokeMethod({on:o,method:"builder",arguments_:[]});for(let g of a)u=d.invokeMethod({on:u,method:"addHeader",arguments_:[d.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let p=d.invokeMethod({on:u,method:"build",arguments_:[]});return d.TypeLiteral.reference(p)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:$(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"});default:$(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){let a=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}}).filter(u=>!this.context.isDirectLiteral(u.typeReference));return this.context.sortTypeInstancesByRequiredFirst(a,e).map(u=>({name:this.context.getMethodName(u.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:u.typeReference,value:u.value,as:"request"})}))}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{}});for(let o of a)r.push({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert(o)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>`${this.context.getMethodName(t)}()`).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getStyle(e){return e.style??this.context.options.style??Me.Full}getConfig(e){return e.config??this.context.options.config??{}}};var Ar=class extends Ct{constructor({ir:e,config:t,options:r={}}){super(new ir({ir:e,config:t,options:r}))}async generate(e,t={}){return super.generate(e,t)}generateSync(e,t={}){return super.generateSync(e,t)}async generateSnippetAst(e){return super.generateSnippetAst(e)}createSnippetGenerator(e){return new sr({context:e})}};export{Ar as DynamicSnippetsGenerator};
29
29
  /*! Bundled license information:
30
30
 
31
31
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: