@fern-api/java-dynamic-snippets 4.37.8 → 4.37.10

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,5 +1,5 @@
1
- var qr=Object.defineProperty;var Ki=(n,e,t)=>e in n?qr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var cr=(n,e)=>{for(var t in e)qr(n,t,{get:e[t],enumerable:!0})};var R=(n,e,t)=>Ki(n,typeof e!="symbol"?e+"":e,t);var m=pt(()=>{"use strict"});var T={};cr(T,{_debugEnd:()=>Bn,_debugProcess:()=>Ln,_events:()=>Hn,_eventsCount:()=>Yn,_exiting:()=>fn,_fatalExceptions:()=>Cn,_getActiveHandles:()=>gn,_getActiveRequests:()=>yn,_kill:()=>vn,_linkedBinding:()=>pn,_maxListeners:()=>Jn,_preload_modules:()=>zn,_rawDebug:()=>un,_startProfilerIdleNotifier:()=>Pn,_stopProfilerIdleNotifier:()=>Fn,_tickCallback:()=>Sn,abort:()=>Mn,addListener:()=>Kn,allowedNodeEnvironmentFlags:()=>kn,arch:()=>Jr,argv:()=>Kr,argv0:()=>Wn,assert:()=>Nn,binding:()=>rn,browser:()=>ln,chdir:()=>sn,config:()=>mn,cpuUsage:()=>Dt,cwd:()=>an,debugPort:()=>qn,default:()=>sa,dlopen:()=>hn,domain:()=>dn,emit:()=>ra,emitWarning:()=>tn,env:()=>Yr,execArgv:()=>Qr,execPath:()=>Dn,exit:()=>Rn,features:()=>In,hasUncaughtExceptionCaptureCallback:()=>An,hrtime:()=>Vt,kill:()=>Tn,listeners:()=>ia,memoryUsage:()=>bn,moduleLoadList:()=>cn,nextTick:()=>zr,off:()=>Xn,on:()=>Te,once:()=>Qn,openStdin:()=>_n,pid:()=>$n,platform:()=>Hr,ppid:()=>Vn,prependListener:()=>na,prependOnceListener:()=>aa,reallyExit:()=>xn,release:()=>on,removeAllListeners:()=>ta,removeListener:()=>ea,resourceUsage:()=>wn,setSourceMapsEnabled:()=>Zn,setUncaughtExceptionCaptureCallback:()=>En,stderr:()=>jn,stdin:()=>Un,stdout:()=>On,title:()=>Gr,umask:()=>nn,uptime:()=>Gn,version:()=>Xr,versions:()=>en});function fr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function Qi(){!dt||!Fe||(dt=!1,Fe.length?be=Fe.concat(be):$t=-1,be.length&&Wr())}function Wr(){if(!dt){var n=setTimeout(Qi,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 zr(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 Zr(n,e)),be.length===1&&!dt&&setTimeout(Wr,0)}function Zr(n,e){this.fun=n,this.array=e}function te(){}function pn(n){fr("_linkedBinding")}function hn(n){fr("dlopen")}function yn(){return[]}function gn(){return[]}function Nn(n,e){if(!n)throw new Error(e||"assertion error")}function An(){return!1}function Gn(){return Ee.now()/1e3}function Vt(n){var e=Math.floor((Date.now()-Ee.now())*.001),t=Ee.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 sa}function ia(n){return[]}var be,dt,Fe,$t,Gr,Jr,Hr,Yr,Kr,Qr,Xr,en,tn,rn,nn,an,sn,on,ln,un,cn,dn,fn,mn,xn,vn,Dt,wn,bn,Tn,Rn,_n,kn,In,Cn,En,Sn,Ln,Bn,Pn,Fn,On,jn,Un,Mn,$n,Vn,Dn,qn,Wn,zn,Zn,Ee,pr,dr,Jn,Hn,Yn,Kn,Qn,Xn,ea,ta,ra,na,aa,sa,oa=pt(()=>{"use strict";m();y();h();be=[],dt=!1,$t=-1;Zr.prototype.run=function(){this.fun.apply(null,this.array)};Gr="browser",Jr="x64",Hr="browser",Yr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Kr=["/usr/bin/node"],Qr=[],Xr="v16.8.0",en={},tn=function(n,e){console.warn((e?e+": ":"")+n)},rn=function(n){fr("binding")},nn=function(n){return 0},an=function(){return"/"},sn=function(n){},on={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};ln=!0,un=te,cn=[];dn={},fn=!1,mn={};xn=te,vn=te,Dt=function(){return{}},wn=Dt,bn=Dt,Tn=te,Rn=te,_n=te,kn={};In={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Cn=te,En=te;Sn=te,Ln=te,Bn=te,Pn=te,Fn=te,On=void 0,jn=void 0,Un=void 0,Mn=te,$n=2,Vn=1,Dn="/bin/usr/node",qn=9229,Wn="node",zn=[],Zn=te,Ee={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Ee.now===void 0&&(pr=Date.now(),Ee.timing&&Ee.timing.navigationStart&&(pr=Ee.timing.navigationStart),Ee.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])};Jn=10,Hn={},Yn=0;Kn=Te,Qn=Te,Xn=Te,ea=Te,ta=Te,ra=te,na=Te,aa=Te;sa={version:Xr,versions:en,arch:Jr,platform:Hr,browser:ln,release:on,_rawDebug:un,moduleLoadList:cn,binding:rn,_linkedBinding:pn,_events:Hn,_eventsCount:Yn,_maxListeners:Jn,on:Te,addListener:Kn,once:Qn,off:Xn,removeListener:ea,removeAllListeners:ta,emit:ra,prependListener:na,prependOnceListener:aa,listeners:ia,domain:dn,_exiting:fn,config:mn,dlopen:hn,uptime:Gn,_getActiveRequests:yn,_getActiveHandles:gn,reallyExit:xn,_kill:vn,cpuUsage:Dt,resourceUsage:wn,memoryUsage:bn,kill:Tn,exit:Rn,openStdin:_n,allowedNodeEnvironmentFlags:kn,assert:Nn,features:In,_fatalExceptions:Cn,setUncaughtExceptionCaptureCallback:En,hasUncaughtExceptionCaptureCallback:An,emitWarning:tn,nextTick:zr,_tickCallback:Sn,_debugProcess:Ln,_debugEnd:Bn,_startProfilerIdleNotifier:Pn,_stopProfilerIdleNotifier:Fn,stdout:On,stdin:Un,stderr:jn,abort:Mn,umask:nn,chdir:sn,cwd:an,env:Yr,title:Gr,argv:Kr,execArgv:Qr,pid:$n,ppid:Vn,execPath:Dn,debugPort:qn,hrtime:Vt,argv0:Wn,_preload_modules:zn,setSourceMapsEnabled:Zn}});var h=pt(()=>{"use strict";oa()});function Xi(){if(la)return Rt;la=!0,Rt.byteLength=p,Rt.toByteArray=v,Rt.fromByteArray=G;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 l(A){var O=A.length;if(O%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var j=A.indexOf("=");j===-1&&(j=O);var B=j===O?0:4-j%4;return[j,B]}function p(A){var O=l(A),j=O[0],B=O[1];return(j+B)*3/4-B}function g(A,O,j){return(O+j)*3/4-j}function v(A){var O,j=l(A),B=j[0],z=j[1],H=new t(g(A,B,z)),ae=0,ce=z>0?B-4:B,ne;for(ne=0;ne<ce;ne+=4)O=e[A.charCodeAt(ne)]<<18|e[A.charCodeAt(ne+1)]<<12|e[A.charCodeAt(ne+2)]<<6|e[A.charCodeAt(ne+3)],H[ae++]=O>>16&255,H[ae++]=O>>8&255,H[ae++]=O&255;return z===2&&(O=e[A.charCodeAt(ne)]<<2|e[A.charCodeAt(ne+1)]>>4,H[ae++]=O&255),z===1&&(O=e[A.charCodeAt(ne)]<<10|e[A.charCodeAt(ne+1)]<<4|e[A.charCodeAt(ne+2)]>>2,H[ae++]=O>>8&255,H[ae++]=O&255),H}function N(A){return n[A>>18&63]+n[A>>12&63]+n[A>>6&63]+n[A&63]}function F(A,O,j){for(var B,z=[],H=O;H<j;H+=3)B=(A[H]<<16&16711680)+(A[H+1]<<8&65280)+(A[H+2]&255),z.push(N(B));return z.join("")}function G(A){for(var O,j=A.length,B=j%3,z=[],H=16383,ae=0,ce=j-B;ae<ce;ae+=H)z.push(F(A,ae,ae+H>ce?ce:ae+H));return B===1?(O=A[j-1],z.push(n[O>>2]+n[O<<4&63]+"==")):B===2&&(O=(A[j-2]<<8)+A[j-1],z.push(n[O>>10]+n[O>>4&63]+n[O<<2&63]+"=")),z.join("")}return Rt}function es(){if(ua)return qt;ua=!0;return qt.read=function(n,e,t,r,a){var o,l,p=a*8-r-1,g=(1<<p)-1,v=g>>1,N=-7,F=t?a-1:0,G=t?-1:1,A=n[e+F];for(F+=G,o=A&(1<<-N)-1,A>>=-N,N+=p;N>0;o=o*256+n[e+F],F+=G,N-=8);for(l=o&(1<<-N)-1,o>>=-N,N+=r;N>0;l=l*256+n[e+F],F+=G,N-=8);if(o===0)o=1-v;else{if(o===g)return l?NaN:(A?-1:1)*(1/0);l=l+Math.pow(2,r),o=o-v}return(A?-1:1)*l*Math.pow(2,o-r)},qt.write=function(n,e,t,r,a,o){var l,p,g,v=o*8-a-1,N=(1<<v)-1,F=N>>1,G=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=r?0:o-1,O=r?1:-1,j=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,l=N):(l=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-l))<1&&(l--,g*=2),l+F>=1?e+=G/g:e+=G*Math.pow(2,1-F),e*g>=2&&(l++,g/=2),l+F>=N?(p=0,l=N):l+F>=1?(p=(e*g-1)*Math.pow(2,a),l=l+F):(p=e*Math.pow(2,F-1)*Math.pow(2,a),l=0));a>=8;n[t+A]=p&255,A+=O,p/=256,a-=8);for(l=l<<a|p,v+=a;v>0;n[t+A]=l&255,A+=O,l/=256,v-=8);n[t+A-O]|=j*128},qt}function pa(){if(ca)return Oe;ca=!0;let n=Xi(),e=es(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=l,Oe.SlowBuffer=z,Oe.INSPECT_MAX_BYTES=50;let r=2147483647;Oe.kMaxLength=r,l.TYPED_ARRAY_SUPPORT=a(),!l.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 u=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(u,i),u.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function o(u){if(u>r)throw new RangeError('The value "'+u+'" is invalid for option "size"');let i=new Uint8Array(u);return Object.setPrototypeOf(i,l.prototype),i}function l(u,i,s){if(typeof u=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return N(u)}return p(u,i,s)}l.poolSize=8192;function p(u,i,s){if(typeof u=="string")return F(u,i);if(ArrayBuffer.isView(u))return A(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);if(ye(u,ArrayBuffer)||u&&ye(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(u,SharedArrayBuffer)||u&&ye(u.buffer,SharedArrayBuffer)))return O(u,i,s);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=u.valueOf&&u.valueOf();if(c!=null&&c!==u)return l.from(c,i,s);let f=j(u);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return l.from(u[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 u)}l.from=function(u,i,s){return p(u,i,s)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function g(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}function v(u,i,s){return g(u),u<=0?o(u):i!==void 0?typeof s=="string"?o(u).fill(i,s):o(u).fill(i):o(u)}l.alloc=function(u,i,s){return v(u,i,s)};function N(u){return g(u),o(u<0?0:B(u)|0)}l.allocUnsafe=function(u){return N(u)},l.allocUnsafeSlow=function(u){return N(u)};function F(u,i){if((typeof i!="string"||i==="")&&(i="utf8"),!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=H(u,i)|0,c=o(s),f=c.write(u,i);return f!==s&&(c=c.slice(0,f)),c}function G(u){let i=u.length<0?0:B(u.length)|0,s=o(i);for(let c=0;c<i;c+=1)s[c]=u[c]&255;return s}function A(u){if(ye(u,Uint8Array)){let i=new Uint8Array(u);return O(i.buffer,i.byteOffset,i.byteLength)}return G(u)}function O(u,i,s){if(i<0||u.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(u.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(u):s===void 0?c=new Uint8Array(u,i):c=new Uint8Array(u,i,s),Object.setPrototypeOf(c,l.prototype),c}function j(u){if(l.isBuffer(u)){let i=B(u.length)|0,s=o(i);return s.length===0||u.copy(s,0,0,i),s}if(u.length!==void 0)return typeof u.length!="number"||ur(u.length)?o(0):G(u);if(u.type==="Buffer"&&Array.isArray(u.data))return G(u.data)}function B(u){if(u>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return u|0}function z(u){return+u!=u&&(u=0),l.alloc(+u)}l.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==l.prototype},l.compare=function(i,s){if(ye(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),ye(s,Uint8Array)&&(s=l.from(s,s.offset,s.byteLength)),!l.isBuffer(i)||!l.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,w=Math.min(c,f);x<w;++x)if(i[x]!==s[x]){c=i[x],f=s[x];break}return c<f?-1:f<c?1:0},l.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}},l.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return l.alloc(0);let c;if(s===void 0)for(s=0,c=0;c<i.length;++c)s+=i[c].length;let f=l.allocUnsafe(s),x=0;for(c=0;c<i.length;++c){let w=i[c];if(ye(w,Uint8Array))x+w.length>f.length?(l.isBuffer(w)||(w=l.from(w)),w.copy(f,x)):Uint8Array.prototype.set.call(f,w,x);else if(l.isBuffer(w))w.copy(f,x);else throw new TypeError('"list" argument must be an Array of Buffers');x+=w.length}return f};function H(u,i){if(l.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||ye(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof u);let s=u.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 lr(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Dr(u).length;default:if(f)return c?-1:lr(u).length;i=(""+i).toLowerCase(),f=!0}}l.byteLength=H;function ae(u,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(u||(u="utf8");;)switch(u){case"hex":return Di(this,i,s);case"utf8":case"utf-8":return Br(this,i,s);case"ascii":return $i(this,i,s);case"latin1":case"binary":return Vi(this,i,s);case"base64":return Ui(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qi(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function ce(u,i,s){let c=u[i];u[i]=u[s],u[s]=c}l.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},l.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},l.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},l.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Br(this,0,i):ae.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(i){if(!l.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:l.compare(this,i)===0},l.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&&(l.prototype[t]=l.prototype.inspect),l.prototype.compare=function(i,s,c,f,x){if(ye(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),!l.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 w=x-f,V=c-s,K=Math.min(w,V),J=this.slice(f,x),Q=i.slice(s,c);for(let Z=0;Z<K;++Z)if(J[Z]!==Q[Z]){w=J[Z],V=Q[Z];break}return w<V?-1:V<w?1:0};function ne(u,i,s,c,f){if(u.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,ur(s)&&(s=f?0:u.length-1),s<0&&(s=u.length+s),s>=u.length){if(f)return-1;s=u.length-1}else if(s<0)if(f)s=0;else return-1;if(typeof i=="string"&&(i=l.from(i,c)),l.isBuffer(i))return i.length===0?-1:Lr(u,i,s,c,f);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(u,i,s):Uint8Array.prototype.lastIndexOf.call(u,i,s):Lr(u,[i],s,c,f);throw new TypeError("val must be string, number or Buffer")}function Lr(u,i,s,c,f){let x=1,w=u.length,V=i.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(u.length<2||i.length<2)return-1;x=2,w/=2,V/=2,s/=2}function K(Q,Z){return x===1?Q[Z]:Q.readUInt16BE(Z*x)}let J;if(f){let Q=-1;for(J=s;J<w;J++)if(K(u,J)===K(i,Q===-1?0:J-Q)){if(Q===-1&&(Q=J),J-Q+1===V)return Q*x}else Q!==-1&&(J-=J-Q),Q=-1}else for(s+V>w&&(s=w-V),J=s;J>=0;J--){let Q=!0;for(let Z=0;Z<V;Z++)if(K(u,J+Z)!==K(i,Z)){Q=!1;break}if(Q)return J}return-1}l.prototype.includes=function(i,s,c){return this.indexOf(i,s,c)!==-1},l.prototype.indexOf=function(i,s,c){return ne(this,i,s,c,!0)},l.prototype.lastIndexOf=function(i,s,c){return ne(this,i,s,c,!1)};function Bi(u,i,s,c){s=Number(s)||0;let f=u.length-s;c?(c=Number(c),c>f&&(c=f)):c=f;let x=i.length;c>x/2&&(c=x/2);let w;for(w=0;w<c;++w){let V=parseInt(i.substr(w*2,2),16);if(ur(V))return w;u[s+w]=V}return w}function Pi(u,i,s,c){return Mt(lr(i,u.length-s),u,s,c)}function Fi(u,i,s,c){return Mt(Gi(i),u,s,c)}function Oi(u,i,s,c){return Mt(Dr(i),u,s,c)}function ji(u,i,s,c){return Mt(Ji(i,u.length-s),u,s,c)}l.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 w=!1;for(;;)switch(f){case"hex":return Bi(this,i,s,c);case"utf8":case"utf-8":return Pi(this,i,s,c);case"ascii":case"latin1":case"binary":return Fi(this,i,s,c);case"base64":return Oi(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ji(this,i,s,c);default:if(w)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),w=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ui(u,i,s){return i===0&&s===u.length?n.fromByteArray(u):n.fromByteArray(u.slice(i,s))}function Br(u,i,s){s=Math.min(u.length,s);let c=[],f=i;for(;f<s;){let x=u[f],w=null,V=x>239?4:x>223?3:x>191?2:1;if(f+V<=s){let K,J,Q,Z;switch(V){case 1:x<128&&(w=x);break;case 2:K=u[f+1],(K&192)===128&&(Z=(x&31)<<6|K&63,Z>127&&(w=Z));break;case 3:K=u[f+1],J=u[f+2],(K&192)===128&&(J&192)===128&&(Z=(x&15)<<12|(K&63)<<6|J&63,Z>2047&&(Z<55296||Z>57343)&&(w=Z));break;case 4:K=u[f+1],J=u[f+2],Q=u[f+3],(K&192)===128&&(J&192)===128&&(Q&192)===128&&(Z=(x&15)<<18|(K&63)<<12|(J&63)<<6|Q&63,Z>65535&&Z<1114112&&(w=Z))}}w===null?(w=65533,V=1):w>65535&&(w-=65536,c.push(w>>>10&1023|55296),w=56320|w&1023),c.push(w),f+=V}return Mi(c)}let Pr=4096;function Mi(u){let i=u.length;if(i<=Pr)return String.fromCharCode.apply(String,u);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,u.slice(c,c+=Pr));return s}function $i(u,i,s){let c="";s=Math.min(u.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(u[f]&127);return c}function Vi(u,i,s){let c="";s=Math.min(u.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(u[f]);return c}function Di(u,i,s){let c=u.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let f="";for(let x=i;x<s;++x)f+=Hi[u[x]];return f}function qi(u,i,s){let c=u.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}l.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,l.prototype),f};function X(u,i,s){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+i>s)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i],x=1,w=0;for(;++w<s&&(x*=256);)f+=this[i+w]*x;return f},l.prototype.readUintBE=l.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i+--s],x=1;for(;s>0&&(x*=256);)f+=this[i+--s]*x;return f},l.prototype.readUint8=l.prototype.readUInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]|this[i+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]<<8|this[i+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},l.prototype.readBigUInt64LE=Ce(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))}),l.prototype.readBigUInt64BE=Ce(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)}),l.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i],x=1,w=0;for(;++w<s&&(x*=256);)f+=this[i+w]*x;return x*=128,f>=x&&(f-=Math.pow(2,8*s)),f},l.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=s,x=1,w=this[i+--f];for(;f>0&&(x*=256);)w+=this[i+--f]*x;return x*=128,w>=x&&(w-=Math.pow(2,8*s)),w},l.prototype.readInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},l.prototype.readInt16LE=function(i,s){i=i>>>0,s||X(i,2,this.length);let c=this[i]|this[i+1]<<8;return c&32768?c|4294901760:c},l.prototype.readInt16BE=function(i,s){i=i>>>0,s||X(i,2,this.length);let c=this[i+1]|this[i]<<8;return c&32768?c|4294901760:c},l.prototype.readInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},l.prototype.readInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},l.prototype.readBigInt64LE=Ce(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)}),l.prototype.readBigInt64BE=Ce(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)}),l.prototype.readFloatLE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!0,23,4)},l.prototype.readFloatBE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!1,23,4)},l.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!0,52,8)},l.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!1,52,8)};function ie(u,i,s,c,f,x){if(!l.isBuffer(u))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>u.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let V=Math.pow(2,8*c)-1;ie(this,i,s,c,V,0)}let x=1,w=0;for(this[s]=i&255;++w<c&&(x*=256);)this[s+w]=i/x&255;return s+c},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let V=Math.pow(2,8*c)-1;ie(this,i,s,c,V,0)}let x=c-1,w=1;for(this[s+x]=i&255;--x>=0&&(w*=256);)this[s+x]=i/w&255;return s+c},l.prototype.writeUint8=l.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},l.prototype.writeUint16LE=l.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},l.prototype.writeUint16BE=l.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},l.prototype.writeUint32LE=l.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},l.prototype.writeUint32BE=l.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 Fr(u,i,s,c,f){Vr(i,c,f,u,s,7);let x=Number(i&BigInt(4294967295));u[s++]=x,x=x>>8,u[s++]=x,x=x>>8,u[s++]=x,x=x>>8,u[s++]=x;let w=Number(i>>BigInt(32)&BigInt(4294967295));return u[s++]=w,w=w>>8,u[s++]=w,w=w>>8,u[s++]=w,w=w>>8,u[s++]=w,s}function Or(u,i,s,c,f){Vr(i,c,f,u,s,7);let x=Number(i&BigInt(4294967295));u[s+7]=x,x=x>>8,u[s+6]=x,x=x>>8,u[s+5]=x,x=x>>8,u[s+4]=x;let w=Number(i>>BigInt(32)&BigInt(4294967295));return u[s+3]=w,w=w>>8,u[s+2]=w,w=w>>8,u[s+1]=w,w=w>>8,u[s]=w,s+8}l.prototype.writeBigUInt64LE=Ce(function(i,s=0){return Fr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Ce(function(i,s=0){return Or(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let K=Math.pow(2,8*c-1);ie(this,i,s,c,K-1,-K)}let x=0,w=1,V=0;for(this[s]=i&255;++x<c&&(w*=256);)i<0&&V===0&&this[s+x-1]!==0&&(V=1),this[s+x]=(i/w>>0)-V&255;return s+c},l.prototype.writeIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let K=Math.pow(2,8*c-1);ie(this,i,s,c,K-1,-K)}let x=c-1,w=1,V=0;for(this[s+x]=i&255;--x>=0&&(w*=256);)i<0&&V===0&&this[s+x+1]!==0&&(V=1),this[s+x]=(i/w>>0)-V&255;return s+c},l.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},l.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},l.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},l.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},l.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},l.prototype.writeBigInt64LE=Ce(function(i,s=0){return Fr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Ce(function(i,s=0){return Or(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function jr(u,i,s,c,f,x){if(s+c>u.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Ur(u,i,s,c,f){return i=+i,s=s>>>0,f||jr(u,i,s,4),e.write(u,i,s,c,23,4),s+4}l.prototype.writeFloatLE=function(i,s,c){return Ur(this,i,s,!0,c)},l.prototype.writeFloatBE=function(i,s,c){return Ur(this,i,s,!1,c)};function Mr(u,i,s,c,f){return i=+i,s=s>>>0,f||jr(u,i,s,8),e.write(u,i,s,c,52,8),s+8}l.prototype.writeDoubleLE=function(i,s,c){return Mr(this,i,s,!0,c)},l.prototype.writeDoubleBE=function(i,s,c){return Mr(this,i,s,!1,c)},l.prototype.copy=function(i,s,c,f){if(!l.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},l.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"&&!l.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(i.length===1){let w=i.charCodeAt(0);(f==="utf8"&&w<128||f==="latin1")&&(i=w)}}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 w=l.isBuffer(i)?i:l.from(i,f),V=w.length;if(V===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(x=0;x<c-s;++x)this[x+s]=w[x%V]}return this};let ut={};function or(u,i,s){ut[u]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${u}]`,this.stack,delete this.name}get code(){return u}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${u}]: ${this.message}`}}}or("ERR_BUFFER_OUT_OF_BOUNDS",function(u){return u?`${u} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),or("ERR_INVALID_ARG_TYPE",function(u,i){return`The "${u}" argument must be of type number. Received type ${typeof i}`},TypeError),or("ERR_OUT_OF_RANGE",function(u,i,s){let c=`The value of "${u}" is out of range.`,f=s;return Number.isInteger(s)&&Math.abs(s)>2**32?f=$r(String(s)):typeof s=="bigint"&&(f=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(f=$r(f)),f+="n"),c+=` It must be ${i}. Received ${f}`,c},RangeError);function $r(u){let i="",s=u.length,c=u[0]==="-"?1:0;for(;s>=c+4;s-=3)i=`_${u.slice(s-3,s)}${i}`;return`${u.slice(0,s)}${i}`}function Wi(u,i,s){ct(i,"offset"),(u[i]===void 0||u[i+s]===void 0)&&Tt(i,u.length-(s+1))}function Vr(u,i,s,c,f,x){if(u>s||u<i){let w=typeof i=="bigint"?"n":"",V;throw i===0||i===BigInt(0)?V=`>= 0${w} and < 2${w} ** ${(x+1)*8}${w}`:V=`>= -(2${w} ** ${(x+1)*8-1}${w}) and < 2 ** ${(x+1)*8-1}${w}`,new ut.ERR_OUT_OF_RANGE("value",V,u)}Wi(c,f,x)}function ct(u,i){if(typeof u!="number")throw new ut.ERR_INVALID_ARG_TYPE(i,"number",u)}function Tt(u,i,s){throw Math.floor(u)!==u?(ct(u,s),new ut.ERR_OUT_OF_RANGE("offset","an integer",u)):i<0?new ut.ERR_BUFFER_OUT_OF_BOUNDS:new ut.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,u)}let zi=/[^+/0-9A-Za-z-_]/g;function Zi(u){if(u=u.split("=")[0],u=u.trim().replace(zi,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}function lr(u,i){i=i||1/0;let s,c=u.length,f=null,x=[];for(let w=0;w<c;++w){if(s=u.charCodeAt(w),s>55295&&s<57344){if(!f){if(s>56319){(i-=3)>-1&&x.push(239,191,189);continue}else if(w+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 Gi(u){let i=[];for(let s=0;s<u.length;++s)i.push(u.charCodeAt(s)&255);return i}function Ji(u,i){let s,c,f,x=[];for(let w=0;w<u.length&&!((i-=2)<0);++w)s=u.charCodeAt(w),c=s>>8,f=s%256,x.push(f),x.push(c);return x}function Dr(u){return n.toByteArray(Zi(u))}function Mt(u,i,s,c){let f;for(f=0;f<c&&!(f+s>=i.length||f>=u.length);++f)i[f+s]=u[f];return f}function ye(u,i){return u instanceof i||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===i.name}function ur(u){return u!==u}let Hi=(function(){let u="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]=u[s]+u[f]}return i})();function Ce(u){return typeof BigInt>"u"?Yi:u}function Yi(){throw new Error("BigInt not supported")}return Oe}var Rt,la,qt,ua,Oe,ca,da=pt(()=>{"use strict";m();y();h();Rt={},la=!1;qt={},ua=!1;Oe={},ca=!1});var je,_,Gu,Ju,fa=pt(()=>{"use strict";m();y();h();da();je=pa();je.Buffer;je.SlowBuffer;je.INSPECT_MAX_BYTES;je.kMaxLength;_=je.Buffer,Gu=je.INSPECT_MAX_BYTES,Ju=je.kMaxLength});var y=pt(()=>{"use strict";fa()});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 ts=typeof global=="object"&&global&&global.Object===Object&&global,ma=ts;var rs=typeof self=="object"&&self&&self.Object===Object&&self,ns=ma||rs||Function("return this")(),ha=ns;var as=ha.Symbol,Re=as;m();y();h();var ya=Object.prototype,is=ya.hasOwnProperty,ss=ya.toString,_t=Re?Re.toStringTag:void 0;function os(n){var e=is.call(n,_t),t=n[_t];try{n[_t]=void 0;var r=!0}catch{}var a=ss.call(n);return r&&(e?n[_t]=t:delete n[_t]),a}var ga=os;m();y();h();var ls=Object.prototype,us=ls.toString;function cs(n){return us.call(n)}var xa=cs;var ps="[object Null]",ds="[object Undefined]",va=Re?Re.toStringTag:void 0;function fs(n){return n==null?n===void 0?ds:ps:va&&va in Object(n)?ga(n):xa(n)}var wa=fs;m();y();h();function ms(n){return n!=null&&typeof n=="object"}var ba=ms;var hs="[object Symbol]";function ys(n){return typeof n=="symbol"||ba(n)&&wa(n)==hs}var Ta=ys;m();y();h();m();y();h();function gs(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 Ra=gs;m();y();h();var xs=Array.isArray,_a=xs;var vs=1/0,ka=Re?Re.prototype:void 0,Na=ka?ka.toString:void 0;function Ia(n){if(typeof n=="string")return n;if(_a(n))return Ra(n,Ia)+"";if(Ta(n))return Na?Na.call(n):"";var e=n+"";return e=="0"&&1/n==-vs?"-0":e}var Ca=Ia;m();y();h();function ws(n){return n==null?"":Ca(n)}var Ae=ws;m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();function bs(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 Ea=bs;function Ts(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Ea(n,e,t)}var Aa=Ts;m();y();h();var Rs="\\ud800-\\udfff",_s="\\u0300-\\u036f",ks="\\ufe20-\\ufe2f",Ns="\\u20d0-\\u20ff",Is=_s+ks+Ns,Cs="\\ufe0e\\ufe0f",Es="\\u200d",As=RegExp("["+Es+Rs+Is+Cs+"]");function Ss(n){return As.test(n)}var Wt=Ss;m();y();h();m();y();h();function Ls(n){return n.split("")}var Sa=Ls;m();y();h();var La="\\ud800-\\udfff",Bs="\\u0300-\\u036f",Ps="\\ufe20-\\ufe2f",Fs="\\u20d0-\\u20ff",Os=Bs+Ps+Fs,js="\\ufe0e\\ufe0f",Us="["+La+"]",mr="["+Os+"]",hr="\\ud83c[\\udffb-\\udfff]",Ms="(?:"+mr+"|"+hr+")",Ba="[^"+La+"]",Pa="(?:\\ud83c[\\udde6-\\uddff]){2}",Fa="[\\ud800-\\udbff][\\udc00-\\udfff]",$s="\\u200d",Oa=Ms+"?",ja="["+js+"]?",Vs="(?:"+$s+"(?:"+[Ba,Pa,Fa].join("|")+")"+ja+Oa+")*",Ds=ja+Oa+Vs,qs="(?:"+[Ba+mr+"?",mr,Pa,Fa,Us].join("|")+")",Ws=RegExp(hr+"(?="+hr+")|"+qs+Ds,"g");function zs(n){return n.match(Ws)||[]}var Ua=zs;function Zs(n){return Wt(n)?Ua(n):Sa(n)}var Ma=Zs;function Gs(n){return function(e){e=Ae(e);var t=Wt(e)?Ma(e):void 0,r=t?t[0]:e.charAt(0),a=t?Aa(t,1).join(""):e.slice(1);return r[n]()+a}}var $a=Gs;var Js=$a("toUpperCase"),Va=Js;function Hs(n){return Va(Ae(n).toLowerCase())}var Da=Hs;m();y();h();m();y();h();function Ys(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 qa=Ys;m();y();h();m();y();h();m();y();h();function Ks(n){return function(e){return n?.[e]}}var Wa=Ks;var Qs={\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"},Xs=Wa(Qs),za=Xs;var eo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,to="\\u0300-\\u036f",ro="\\ufe20-\\ufe2f",no="\\u20d0-\\u20ff",ao=to+ro+no,io="["+ao+"]",so=RegExp(io,"g");function oo(n){return n=Ae(n),n&&n.replace(eo,za).replace(so,"")}var Za=oo;m();y();h();m();y();h();var lo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function uo(n){return n.match(lo)||[]}var Ga=uo;m();y();h();var co=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function po(n){return co.test(n)}var Ja=po;m();y();h();var Xa="\\ud800-\\udfff",fo="\\u0300-\\u036f",mo="\\ufe20-\\ufe2f",ho="\\u20d0-\\u20ff",yo=fo+mo+ho,ei="\\u2700-\\u27bf",ti="a-z\\xdf-\\xf6\\xf8-\\xff",go="\\xac\\xb1\\xd7\\xf7",xo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vo="\\u2000-\\u206f",wo=" \\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",ri="A-Z\\xc0-\\xd6\\xd8-\\xde",bo="\\ufe0e\\ufe0f",ni=go+xo+vo+wo,ai="['\u2019]",Ha="["+ni+"]",To="["+yo+"]",ii="\\d+",Ro="["+ei+"]",si="["+ti+"]",oi="[^"+Xa+ni+ii+ei+ti+ri+"]",_o="\\ud83c[\\udffb-\\udfff]",ko="(?:"+To+"|"+_o+")",No="[^"+Xa+"]",li="(?:\\ud83c[\\udde6-\\uddff]){2}",ui="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="["+ri+"]",Io="\\u200d",Ya="(?:"+si+"|"+oi+")",Co="(?:"+ft+"|"+oi+")",Ka="(?:"+ai+"(?:d|ll|m|re|s|t|ve))?",Qa="(?:"+ai+"(?:D|LL|M|RE|S|T|VE))?",ci=ko+"?",pi="["+bo+"]?",Eo="(?:"+Io+"(?:"+[No,li,ui].join("|")+")"+pi+ci+")*",Ao="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",So="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lo=pi+ci+Eo,Bo="(?:"+[Ro,li,ui].join("|")+")"+Lo,Po=RegExp([ft+"?"+si+"+"+Ka+"(?="+[Ha,ft,"$"].join("|")+")",Co+"+"+Qa+"(?="+[Ha,ft+Ya,"$"].join("|")+")",ft+"?"+Ya+"+"+Ka,ft+"+"+Qa,So,Ao,ii,Bo].join("|"),"g");function Fo(n){return n.match(Po)||[]}var di=Fo;function Oo(n,e,t){return n=Ae(n),e=t?void 0:e,e===void 0?Ja(n)?di(n):Ga(n):n.match(e)||[]}var fi=Oo;var jo="['\u2019]",Uo=RegExp(jo,"g");function Mo(n){return function(e){return qa(fi(Za(e).replace(Uo,"")),n,"")}}var mi=Mo;var $o=mi(function(n,e,t){return e=e.toLowerCase(),n+(t?Da(e):e)}),yr=$o;m();y();h();function $(n){throw new Error("Unexpected value: "+JSON.stringify(n))}m();y();h();function kt(n){return Object.keys(n)}m();y();h();m();y();h();m();y();h();var Nt=T.env.FERN_STACK_TRACK?.toLowerCase()??"",ge=Nt!==""&&Nt!=="0"&&Nt!=="false",gr=["single","multiline","box"].includes(Nt)?Nt:"single";ge&&(Error.stackTraceLimit=50);var Vo=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Do=new Set(["stacktrace"]);function Zt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:l=!0,formatFilename:p=g=>g}={}){if(!ge)return[];r=[...r,...Vo],t=[...t,...Do],a=[...a,"runInteractiveTask"];let g=!1;return(new Error().stack??"").split(`
2
- `).map(v=>{let N=v.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(N&&N.length===5){let[,F,G,A,O]=N;if(!F||!G||!A||!O)return;if(g||a.some(j=>F?.includes(j))){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(G),position:`${A}:${O}`}}}).filter(v=>v&&!r.some(N=>v.fn.includes(N))&&!(o&&v.path?.startsWith("node:"))&&!(l&&v.path?.endsWith(".js"))&&!t.some(N=>v.path.includes(N))).slice(e,e+n)}var zt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:l=!0,filterJs:p=!0,multiline:g=!1,formatFilename:v=N=>N}={}){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=l,this.filterJs=p,this.multiline=g,this.formatFilename=v}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?`
1
+ var qr=Object.defineProperty;var Ki=(n,e,t)=>e in n?qr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var pt=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var cr=(n,e)=>{for(var t in e)qr(n,t,{get:e[t],enumerable:!0})};var R=(n,e,t)=>Ki(n,typeof e!="symbol"?e+"":e,t);var m=pt(()=>{"use strict"});var T={};cr(T,{_debugEnd:()=>Bn,_debugProcess:()=>Ln,_events:()=>Hn,_eventsCount:()=>Yn,_exiting:()=>fn,_fatalExceptions:()=>Cn,_getActiveHandles:()=>gn,_getActiveRequests:()=>yn,_kill:()=>vn,_linkedBinding:()=>pn,_maxListeners:()=>Jn,_preload_modules:()=>zn,_rawDebug:()=>un,_startProfilerIdleNotifier:()=>Pn,_stopProfilerIdleNotifier:()=>Fn,_tickCallback:()=>Sn,abort:()=>Mn,addListener:()=>Kn,allowedNodeEnvironmentFlags:()=>kn,arch:()=>Jr,argv:()=>Kr,argv0:()=>Wn,assert:()=>Nn,binding:()=>rn,browser:()=>ln,chdir:()=>sn,config:()=>mn,cpuUsage:()=>Vt,cwd:()=>an,debugPort:()=>qn,default:()=>sa,dlopen:()=>hn,domain:()=>dn,emit:()=>ra,emitWarning:()=>tn,env:()=>Yr,execArgv:()=>Qr,execPath:()=>Vn,exit:()=>Rn,features:()=>In,hasUncaughtExceptionCaptureCallback:()=>En,hrtime:()=>$t,kill:()=>Tn,listeners:()=>ia,memoryUsage:()=>bn,moduleLoadList:()=>cn,nextTick:()=>zr,off:()=>Xn,on:()=>Te,once:()=>Qn,openStdin:()=>_n,pid:()=>Dn,platform:()=>Hr,ppid:()=>$n,prependListener:()=>na,prependOnceListener:()=>aa,reallyExit:()=>xn,release:()=>on,removeAllListeners:()=>ta,removeListener:()=>ea,resourceUsage:()=>wn,setSourceMapsEnabled:()=>Zn,setUncaughtExceptionCaptureCallback:()=>An,stderr:()=>jn,stdin:()=>Un,stdout:()=>On,title:()=>Gr,umask:()=>nn,uptime:()=>Gn,version:()=>Xr,versions:()=>en});function fr(n){throw new Error("Node.js process "+n+" is not supported by JSPM core outside of Node.js")}function Qi(){!dt||!Fe||(dt=!1,Fe.length?be=Fe.concat(be):Dt=-1,be.length&&Wr())}function Wr(){if(!dt){var n=setTimeout(Qi,0);dt=!0;for(var e=be.length;e;){for(Fe=be,be=[];++Dt<e;)Fe&&Fe[Dt].run();Dt=-1,e=be.length}Fe=null,dt=!1,clearTimeout(n)}}function zr(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 Zr(n,e)),be.length===1&&!dt&&setTimeout(Wr,0)}function Zr(n,e){this.fun=n,this.array=e}function te(){}function pn(n){fr("_linkedBinding")}function hn(n){fr("dlopen")}function yn(){return[]}function gn(){return[]}function Nn(n,e){if(!n)throw new Error(e||"assertion error")}function En(){return!1}function Gn(){return Ae.now()/1e3}function $t(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 sa}function ia(n){return[]}var be,dt,Fe,Dt,Gr,Jr,Hr,Yr,Kr,Qr,Xr,en,tn,rn,nn,an,sn,on,ln,un,cn,dn,fn,mn,xn,vn,Vt,wn,bn,Tn,Rn,_n,kn,In,Cn,An,Sn,Ln,Bn,Pn,Fn,On,jn,Un,Mn,Dn,$n,Vn,qn,Wn,zn,Zn,Ae,pr,dr,Jn,Hn,Yn,Kn,Qn,Xn,ea,ta,ra,na,aa,sa,oa=pt(()=>{"use strict";m();y();h();be=[],dt=!1,Dt=-1;Zr.prototype.run=function(){this.fun.apply(null,this.array)};Gr="browser",Jr="x64",Hr="browser",Yr={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},Kr=["/usr/bin/node"],Qr=[],Xr="v16.8.0",en={},tn=function(n,e){console.warn((e?e+": ":"")+n)},rn=function(n){fr("binding")},nn=function(n){return 0},an=function(){return"/"},sn=function(n){},on={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};ln=!0,un=te,cn=[];dn={},fn=!1,mn={};xn=te,vn=te,Vt=function(){return{}},wn=Vt,bn=Vt,Tn=te,Rn=te,_n=te,kn={};In={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Cn=te,An=te;Sn=te,Ln=te,Bn=te,Pn=te,Fn=te,On=void 0,jn=void 0,Un=void 0,Mn=te,Dn=2,$n=1,Vn="/bin/usr/node",qn=9229,Wn="node",zn=[],Zn=te,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;$t.bigint=function(n){var e=$t(n);return typeof BigInt>"u"?e[0]*dr+e[1]:BigInt(e[0]*dr)+BigInt(e[1])};Jn=10,Hn={},Yn=0;Kn=Te,Qn=Te,Xn=Te,ea=Te,ta=Te,ra=te,na=Te,aa=Te;sa={version:Xr,versions:en,arch:Jr,platform:Hr,browser:ln,release:on,_rawDebug:un,moduleLoadList:cn,binding:rn,_linkedBinding:pn,_events:Hn,_eventsCount:Yn,_maxListeners:Jn,on:Te,addListener:Kn,once:Qn,off:Xn,removeListener:ea,removeAllListeners:ta,emit:ra,prependListener:na,prependOnceListener:aa,listeners:ia,domain:dn,_exiting:fn,config:mn,dlopen:hn,uptime:Gn,_getActiveRequests:yn,_getActiveHandles:gn,reallyExit:xn,_kill:vn,cpuUsage:Vt,resourceUsage:wn,memoryUsage:bn,kill:Tn,exit:Rn,openStdin:_n,allowedNodeEnvironmentFlags:kn,assert:Nn,features:In,_fatalExceptions:Cn,setUncaughtExceptionCaptureCallback:An,hasUncaughtExceptionCaptureCallback:En,emitWarning:tn,nextTick:zr,_tickCallback:Sn,_debugProcess:Ln,_debugEnd:Bn,_startProfilerIdleNotifier:Pn,_stopProfilerIdleNotifier:Fn,stdout:On,stdin:Un,stderr:jn,abort:Mn,umask:nn,chdir:sn,cwd:an,env:Yr,title:Gr,argv:Kr,execArgv:Qr,pid:Dn,ppid:$n,execPath:Vn,debugPort:qn,hrtime:$t,argv0:Wn,_preload_modules:zn,setSourceMapsEnabled:Zn}});var h=pt(()=>{"use strict";oa()});function Xi(){if(la)return Rt;la=!0,Rt.byteLength=p,Rt.toByteArray=v,Rt.fromByteArray=G;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 l(E){var O=E.length;if(O%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var j=E.indexOf("=");j===-1&&(j=O);var B=j===O?0:4-j%4;return[j,B]}function p(E){var O=l(E),j=O[0],B=O[1];return(j+B)*3/4-B}function g(E,O,j){return(O+j)*3/4-j}function v(E){var O,j=l(E),B=j[0],z=j[1],H=new t(g(E,B,z)),ae=0,ce=z>0?B-4:B,ne;for(ne=0;ne<ce;ne+=4)O=e[E.charCodeAt(ne)]<<18|e[E.charCodeAt(ne+1)]<<12|e[E.charCodeAt(ne+2)]<<6|e[E.charCodeAt(ne+3)],H[ae++]=O>>16&255,H[ae++]=O>>8&255,H[ae++]=O&255;return z===2&&(O=e[E.charCodeAt(ne)]<<2|e[E.charCodeAt(ne+1)]>>4,H[ae++]=O&255),z===1&&(O=e[E.charCodeAt(ne)]<<10|e[E.charCodeAt(ne+1)]<<4|e[E.charCodeAt(ne+2)]>>2,H[ae++]=O>>8&255,H[ae++]=O&255),H}function N(E){return n[E>>18&63]+n[E>>12&63]+n[E>>6&63]+n[E&63]}function F(E,O,j){for(var B,z=[],H=O;H<j;H+=3)B=(E[H]<<16&16711680)+(E[H+1]<<8&65280)+(E[H+2]&255),z.push(N(B));return z.join("")}function G(E){for(var O,j=E.length,B=j%3,z=[],H=16383,ae=0,ce=j-B;ae<ce;ae+=H)z.push(F(E,ae,ae+H>ce?ce:ae+H));return B===1?(O=E[j-1],z.push(n[O>>2]+n[O<<4&63]+"==")):B===2&&(O=(E[j-2]<<8)+E[j-1],z.push(n[O>>10]+n[O>>4&63]+n[O<<2&63]+"=")),z.join("")}return Rt}function es(){if(ua)return qt;ua=!0;return qt.read=function(n,e,t,r,a){var o,l,p=a*8-r-1,g=(1<<p)-1,v=g>>1,N=-7,F=t?a-1:0,G=t?-1:1,E=n[e+F];for(F+=G,o=E&(1<<-N)-1,E>>=-N,N+=p;N>0;o=o*256+n[e+F],F+=G,N-=8);for(l=o&(1<<-N)-1,o>>=-N,N+=r;N>0;l=l*256+n[e+F],F+=G,N-=8);if(o===0)o=1-v;else{if(o===g)return l?NaN:(E?-1:1)*(1/0);l=l+Math.pow(2,r),o=o-v}return(E?-1:1)*l*Math.pow(2,o-r)},qt.write=function(n,e,t,r,a,o){var l,p,g,v=o*8-a-1,N=(1<<v)-1,F=N>>1,G=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=r?0:o-1,O=r?1:-1,j=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(p=isNaN(e)?1:0,l=N):(l=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-l))<1&&(l--,g*=2),l+F>=1?e+=G/g:e+=G*Math.pow(2,1-F),e*g>=2&&(l++,g/=2),l+F>=N?(p=0,l=N):l+F>=1?(p=(e*g-1)*Math.pow(2,a),l=l+F):(p=e*Math.pow(2,F-1)*Math.pow(2,a),l=0));a>=8;n[t+E]=p&255,E+=O,p/=256,a-=8);for(l=l<<a|p,v+=a;v>0;n[t+E]=l&255,E+=O,l/=256,v-=8);n[t+E-O]|=j*128},qt}function pa(){if(ca)return Oe;ca=!0;let n=Xi(),e=es(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Oe.Buffer=l,Oe.SlowBuffer=z,Oe.INSPECT_MAX_BYTES=50;let r=2147483647;Oe.kMaxLength=r,l.TYPED_ARRAY_SUPPORT=a(),!l.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 u=new Uint8Array(1),i={foo:function(){return 42}};return Object.setPrototypeOf(i,Uint8Array.prototype),Object.setPrototypeOf(u,i),u.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function o(u){if(u>r)throw new RangeError('The value "'+u+'" is invalid for option "size"');let i=new Uint8Array(u);return Object.setPrototypeOf(i,l.prototype),i}function l(u,i,s){if(typeof u=="number"){if(typeof i=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return N(u)}return p(u,i,s)}l.poolSize=8192;function p(u,i,s){if(typeof u=="string")return F(u,i);if(ArrayBuffer.isView(u))return E(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);if(ye(u,ArrayBuffer)||u&&ye(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ye(u,SharedArrayBuffer)||u&&ye(u.buffer,SharedArrayBuffer)))return O(u,i,s);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=u.valueOf&&u.valueOf();if(c!=null&&c!==u)return l.from(c,i,s);let f=j(u);if(f)return f;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return l.from(u[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 u)}l.from=function(u,i,s){return p(u,i,s)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function g(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}function v(u,i,s){return g(u),u<=0?o(u):i!==void 0?typeof s=="string"?o(u).fill(i,s):o(u).fill(i):o(u)}l.alloc=function(u,i,s){return v(u,i,s)};function N(u){return g(u),o(u<0?0:B(u)|0)}l.allocUnsafe=function(u){return N(u)},l.allocUnsafeSlow=function(u){return N(u)};function F(u,i){if((typeof i!="string"||i==="")&&(i="utf8"),!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);let s=H(u,i)|0,c=o(s),f=c.write(u,i);return f!==s&&(c=c.slice(0,f)),c}function G(u){let i=u.length<0?0:B(u.length)|0,s=o(i);for(let c=0;c<i;c+=1)s[c]=u[c]&255;return s}function E(u){if(ye(u,Uint8Array)){let i=new Uint8Array(u);return O(i.buffer,i.byteOffset,i.byteLength)}return G(u)}function O(u,i,s){if(i<0||u.byteLength<i)throw new RangeError('"offset" is outside of buffer bounds');if(u.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(u):s===void 0?c=new Uint8Array(u,i):c=new Uint8Array(u,i,s),Object.setPrototypeOf(c,l.prototype),c}function j(u){if(l.isBuffer(u)){let i=B(u.length)|0,s=o(i);return s.length===0||u.copy(s,0,0,i),s}if(u.length!==void 0)return typeof u.length!="number"||ur(u.length)?o(0):G(u);if(u.type==="Buffer"&&Array.isArray(u.data))return G(u.data)}function B(u){if(u>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return u|0}function z(u){return+u!=u&&(u=0),l.alloc(+u)}l.isBuffer=function(i){return i!=null&&i._isBuffer===!0&&i!==l.prototype},l.compare=function(i,s){if(ye(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),ye(s,Uint8Array)&&(s=l.from(s,s.offset,s.byteLength)),!l.isBuffer(i)||!l.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,w=Math.min(c,f);x<w;++x)if(i[x]!==s[x]){c=i[x],f=s[x];break}return c<f?-1:f<c?1:0},l.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}},l.concat=function(i,s){if(!Array.isArray(i))throw new TypeError('"list" argument must be an Array of Buffers');if(i.length===0)return l.alloc(0);let c;if(s===void 0)for(s=0,c=0;c<i.length;++c)s+=i[c].length;let f=l.allocUnsafe(s),x=0;for(c=0;c<i.length;++c){let w=i[c];if(ye(w,Uint8Array))x+w.length>f.length?(l.isBuffer(w)||(w=l.from(w)),w.copy(f,x)):Uint8Array.prototype.set.call(f,w,x);else if(l.isBuffer(w))w.copy(f,x);else throw new TypeError('"list" argument must be an Array of Buffers');x+=w.length}return f};function H(u,i){if(l.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||ye(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof u);let s=u.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 lr(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s*2;case"hex":return s>>>1;case"base64":return Vr(u).length;default:if(f)return c?-1:lr(u).length;i=(""+i).toLowerCase(),f=!0}}l.byteLength=H;function ae(u,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(u||(u="utf8");;)switch(u){case"hex":return Vi(this,i,s);case"utf8":case"utf-8":return Br(this,i,s);case"ascii":return Di(this,i,s);case"latin1":case"binary":return $i(this,i,s);case"base64":return Ui(this,i,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qi(this,i,s);default:if(c)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function ce(u,i,s){let c=u[i];u[i]=u[s],u[s]=c}l.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},l.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},l.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},l.prototype.toString=function(){let i=this.length;return i===0?"":arguments.length===0?Br(this,0,i):ae.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(i){if(!l.isBuffer(i))throw new TypeError("Argument must be a Buffer");return this===i?!0:l.compare(this,i)===0},l.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&&(l.prototype[t]=l.prototype.inspect),l.prototype.compare=function(i,s,c,f,x){if(ye(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),!l.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 w=x-f,$=c-s,K=Math.min(w,$),J=this.slice(f,x),Q=i.slice(s,c);for(let Z=0;Z<K;++Z)if(J[Z]!==Q[Z]){w=J[Z],$=Q[Z];break}return w<$?-1:$<w?1:0};function ne(u,i,s,c,f){if(u.length===0)return-1;if(typeof s=="string"?(c=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),s=+s,ur(s)&&(s=f?0:u.length-1),s<0&&(s=u.length+s),s>=u.length){if(f)return-1;s=u.length-1}else if(s<0)if(f)s=0;else return-1;if(typeof i=="string"&&(i=l.from(i,c)),l.isBuffer(i))return i.length===0?-1:Lr(u,i,s,c,f);if(typeof i=="number")return i=i&255,typeof Uint8Array.prototype.indexOf=="function"?f?Uint8Array.prototype.indexOf.call(u,i,s):Uint8Array.prototype.lastIndexOf.call(u,i,s):Lr(u,[i],s,c,f);throw new TypeError("val must be string, number or Buffer")}function Lr(u,i,s,c,f){let x=1,w=u.length,$=i.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(u.length<2||i.length<2)return-1;x=2,w/=2,$/=2,s/=2}function K(Q,Z){return x===1?Q[Z]:Q.readUInt16BE(Z*x)}let J;if(f){let Q=-1;for(J=s;J<w;J++)if(K(u,J)===K(i,Q===-1?0:J-Q)){if(Q===-1&&(Q=J),J-Q+1===$)return Q*x}else Q!==-1&&(J-=J-Q),Q=-1}else for(s+$>w&&(s=w-$),J=s;J>=0;J--){let Q=!0;for(let Z=0;Z<$;Z++)if(K(u,J+Z)!==K(i,Z)){Q=!1;break}if(Q)return J}return-1}l.prototype.includes=function(i,s,c){return this.indexOf(i,s,c)!==-1},l.prototype.indexOf=function(i,s,c){return ne(this,i,s,c,!0)},l.prototype.lastIndexOf=function(i,s,c){return ne(this,i,s,c,!1)};function Bi(u,i,s,c){s=Number(s)||0;let f=u.length-s;c?(c=Number(c),c>f&&(c=f)):c=f;let x=i.length;c>x/2&&(c=x/2);let w;for(w=0;w<c;++w){let $=parseInt(i.substr(w*2,2),16);if(ur($))return w;u[s+w]=$}return w}function Pi(u,i,s,c){return Mt(lr(i,u.length-s),u,s,c)}function Fi(u,i,s,c){return Mt(Gi(i),u,s,c)}function Oi(u,i,s,c){return Mt(Vr(i),u,s,c)}function ji(u,i,s,c){return Mt(Ji(i,u.length-s),u,s,c)}l.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 w=!1;for(;;)switch(f){case"hex":return Bi(this,i,s,c);case"utf8":case"utf-8":return Pi(this,i,s,c);case"ascii":case"latin1":case"binary":return Fi(this,i,s,c);case"base64":return Oi(this,i,s,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ji(this,i,s,c);default:if(w)throw new TypeError("Unknown encoding: "+f);f=(""+f).toLowerCase(),w=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ui(u,i,s){return i===0&&s===u.length?n.fromByteArray(u):n.fromByteArray(u.slice(i,s))}function Br(u,i,s){s=Math.min(u.length,s);let c=[],f=i;for(;f<s;){let x=u[f],w=null,$=x>239?4:x>223?3:x>191?2:1;if(f+$<=s){let K,J,Q,Z;switch($){case 1:x<128&&(w=x);break;case 2:K=u[f+1],(K&192)===128&&(Z=(x&31)<<6|K&63,Z>127&&(w=Z));break;case 3:K=u[f+1],J=u[f+2],(K&192)===128&&(J&192)===128&&(Z=(x&15)<<12|(K&63)<<6|J&63,Z>2047&&(Z<55296||Z>57343)&&(w=Z));break;case 4:K=u[f+1],J=u[f+2],Q=u[f+3],(K&192)===128&&(J&192)===128&&(Q&192)===128&&(Z=(x&15)<<18|(K&63)<<12|(J&63)<<6|Q&63,Z>65535&&Z<1114112&&(w=Z))}}w===null?(w=65533,$=1):w>65535&&(w-=65536,c.push(w>>>10&1023|55296),w=56320|w&1023),c.push(w),f+=$}return Mi(c)}let Pr=4096;function Mi(u){let i=u.length;if(i<=Pr)return String.fromCharCode.apply(String,u);let s="",c=0;for(;c<i;)s+=String.fromCharCode.apply(String,u.slice(c,c+=Pr));return s}function Di(u,i,s){let c="";s=Math.min(u.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(u[f]&127);return c}function $i(u,i,s){let c="";s=Math.min(u.length,s);for(let f=i;f<s;++f)c+=String.fromCharCode(u[f]);return c}function Vi(u,i,s){let c=u.length;(!i||i<0)&&(i=0),(!s||s<0||s>c)&&(s=c);let f="";for(let x=i;x<s;++x)f+=Hi[u[x]];return f}function qi(u,i,s){let c=u.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}l.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,l.prototype),f};function X(u,i,s){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+i>s)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i],x=1,w=0;for(;++w<s&&(x*=256);)f+=this[i+w]*x;return f},l.prototype.readUintBE=l.prototype.readUIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i+--s],x=1;for(;s>0&&(x*=256);)f+=this[i+--s]*x;return f},l.prototype.readUint8=l.prototype.readUInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]|this[i+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(i,s){return i=i>>>0,s||X(i,2,this.length),this[i]<<8|this[i+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),(this[i]|this[i+1]<<8|this[i+2]<<16)+this[i+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]*16777216+(this[i+1]<<16|this[i+2]<<8|this[i+3])},l.prototype.readBigUInt64LE=Ce(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))}),l.prototype.readBigUInt64BE=Ce(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)}),l.prototype.readIntLE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=this[i],x=1,w=0;for(;++w<s&&(x*=256);)f+=this[i+w]*x;return x*=128,f>=x&&(f-=Math.pow(2,8*s)),f},l.prototype.readIntBE=function(i,s,c){i=i>>>0,s=s>>>0,c||X(i,s,this.length);let f=s,x=1,w=this[i+--f];for(;f>0&&(x*=256);)w+=this[i+--f]*x;return x*=128,w>=x&&(w-=Math.pow(2,8*s)),w},l.prototype.readInt8=function(i,s){return i=i>>>0,s||X(i,1,this.length),this[i]&128?(255-this[i]+1)*-1:this[i]},l.prototype.readInt16LE=function(i,s){i=i>>>0,s||X(i,2,this.length);let c=this[i]|this[i+1]<<8;return c&32768?c|4294901760:c},l.prototype.readInt16BE=function(i,s){i=i>>>0,s||X(i,2,this.length);let c=this[i+1]|this[i]<<8;return c&32768?c|4294901760:c},l.prototype.readInt32LE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]|this[i+1]<<8|this[i+2]<<16|this[i+3]<<24},l.prototype.readInt32BE=function(i,s){return i=i>>>0,s||X(i,4,this.length),this[i]<<24|this[i+1]<<16|this[i+2]<<8|this[i+3]},l.prototype.readBigInt64LE=Ce(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)}),l.prototype.readBigInt64BE=Ce(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)}),l.prototype.readFloatLE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!0,23,4)},l.prototype.readFloatBE=function(i,s){return i=i>>>0,s||X(i,4,this.length),e.read(this,i,!1,23,4)},l.prototype.readDoubleLE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!0,52,8)},l.prototype.readDoubleBE=function(i,s){return i=i>>>0,s||X(i,8,this.length),e.read(this,i,!1,52,8)};function ie(u,i,s,c,f,x){if(!l.isBuffer(u))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>u.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let $=Math.pow(2,8*c)-1;ie(this,i,s,c,$,0)}let x=1,w=0;for(this[s]=i&255;++w<c&&(x*=256);)this[s+w]=i/x&255;return s+c},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,c=c>>>0,!f){let $=Math.pow(2,8*c)-1;ie(this,i,s,c,$,0)}let x=c-1,w=1;for(this[s+x]=i&255;--x>=0&&(w*=256);)this[s+x]=i/w&255;return s+c},l.prototype.writeUint8=l.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},l.prototype.writeUint16LE=l.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},l.prototype.writeUint16BE=l.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},l.prototype.writeUint32LE=l.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},l.prototype.writeUint32BE=l.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 Fr(u,i,s,c,f){$r(i,c,f,u,s,7);let x=Number(i&BigInt(4294967295));u[s++]=x,x=x>>8,u[s++]=x,x=x>>8,u[s++]=x,x=x>>8,u[s++]=x;let w=Number(i>>BigInt(32)&BigInt(4294967295));return u[s++]=w,w=w>>8,u[s++]=w,w=w>>8,u[s++]=w,w=w>>8,u[s++]=w,s}function Or(u,i,s,c,f){$r(i,c,f,u,s,7);let x=Number(i&BigInt(4294967295));u[s+7]=x,x=x>>8,u[s+6]=x,x=x>>8,u[s+5]=x,x=x>>8,u[s+4]=x;let w=Number(i>>BigInt(32)&BigInt(4294967295));return u[s+3]=w,w=w>>8,u[s+2]=w,w=w>>8,u[s+1]=w,w=w>>8,u[s]=w,s+8}l.prototype.writeBigUInt64LE=Ce(function(i,s=0){return Fr(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Ce(function(i,s=0){return Or(this,i,s,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let K=Math.pow(2,8*c-1);ie(this,i,s,c,K-1,-K)}let x=0,w=1,$=0;for(this[s]=i&255;++x<c&&(w*=256);)i<0&&$===0&&this[s+x-1]!==0&&($=1),this[s+x]=(i/w>>0)-$&255;return s+c},l.prototype.writeIntBE=function(i,s,c,f){if(i=+i,s=s>>>0,!f){let K=Math.pow(2,8*c-1);ie(this,i,s,c,K-1,-K)}let x=c-1,w=1,$=0;for(this[s+x]=i&255;--x>=0&&(w*=256);)i<0&&$===0&&this[s+x+1]!==0&&($=1),this[s+x]=(i/w>>0)-$&255;return s+c},l.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},l.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},l.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},l.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},l.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},l.prototype.writeBigInt64LE=Ce(function(i,s=0){return Fr(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Ce(function(i,s=0){return Or(this,i,s,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function jr(u,i,s,c,f,x){if(s+c>u.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function Ur(u,i,s,c,f){return i=+i,s=s>>>0,f||jr(u,i,s,4),e.write(u,i,s,c,23,4),s+4}l.prototype.writeFloatLE=function(i,s,c){return Ur(this,i,s,!0,c)},l.prototype.writeFloatBE=function(i,s,c){return Ur(this,i,s,!1,c)};function Mr(u,i,s,c,f){return i=+i,s=s>>>0,f||jr(u,i,s,8),e.write(u,i,s,c,52,8),s+8}l.prototype.writeDoubleLE=function(i,s,c){return Mr(this,i,s,!0,c)},l.prototype.writeDoubleBE=function(i,s,c){return Mr(this,i,s,!1,c)},l.prototype.copy=function(i,s,c,f){if(!l.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},l.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"&&!l.isEncoding(f))throw new TypeError("Unknown encoding: "+f);if(i.length===1){let w=i.charCodeAt(0);(f==="utf8"&&w<128||f==="latin1")&&(i=w)}}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 w=l.isBuffer(i)?i:l.from(i,f),$=w.length;if($===0)throw new TypeError('The value "'+i+'" is invalid for argument "value"');for(x=0;x<c-s;++x)this[x+s]=w[x%$]}return this};let ut={};function or(u,i,s){ut[u]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:i.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${u}]`,this.stack,delete this.name}get code(){return u}set code(f){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:f,writable:!0})}toString(){return`${this.name} [${u}]: ${this.message}`}}}or("ERR_BUFFER_OUT_OF_BOUNDS",function(u){return u?`${u} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),or("ERR_INVALID_ARG_TYPE",function(u,i){return`The "${u}" argument must be of type number. Received type ${typeof i}`},TypeError),or("ERR_OUT_OF_RANGE",function(u,i,s){let c=`The value of "${u}" is out of range.`,f=s;return Number.isInteger(s)&&Math.abs(s)>2**32?f=Dr(String(s)):typeof s=="bigint"&&(f=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(f=Dr(f)),f+="n"),c+=` It must be ${i}. Received ${f}`,c},RangeError);function Dr(u){let i="",s=u.length,c=u[0]==="-"?1:0;for(;s>=c+4;s-=3)i=`_${u.slice(s-3,s)}${i}`;return`${u.slice(0,s)}${i}`}function Wi(u,i,s){ct(i,"offset"),(u[i]===void 0||u[i+s]===void 0)&&Tt(i,u.length-(s+1))}function $r(u,i,s,c,f,x){if(u>s||u<i){let w=typeof i=="bigint"?"n":"",$;throw i===0||i===BigInt(0)?$=`>= 0${w} and < 2${w} ** ${(x+1)*8}${w}`:$=`>= -(2${w} ** ${(x+1)*8-1}${w}) and < 2 ** ${(x+1)*8-1}${w}`,new ut.ERR_OUT_OF_RANGE("value",$,u)}Wi(c,f,x)}function ct(u,i){if(typeof u!="number")throw new ut.ERR_INVALID_ARG_TYPE(i,"number",u)}function Tt(u,i,s){throw Math.floor(u)!==u?(ct(u,s),new ut.ERR_OUT_OF_RANGE("offset","an integer",u)):i<0?new ut.ERR_BUFFER_OUT_OF_BOUNDS:new ut.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${i}`,u)}let zi=/[^+/0-9A-Za-z-_]/g;function Zi(u){if(u=u.split("=")[0],u=u.trim().replace(zi,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}function lr(u,i){i=i||1/0;let s,c=u.length,f=null,x=[];for(let w=0;w<c;++w){if(s=u.charCodeAt(w),s>55295&&s<57344){if(!f){if(s>56319){(i-=3)>-1&&x.push(239,191,189);continue}else if(w+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 Gi(u){let i=[];for(let s=0;s<u.length;++s)i.push(u.charCodeAt(s)&255);return i}function Ji(u,i){let s,c,f,x=[];for(let w=0;w<u.length&&!((i-=2)<0);++w)s=u.charCodeAt(w),c=s>>8,f=s%256,x.push(f),x.push(c);return x}function Vr(u){return n.toByteArray(Zi(u))}function Mt(u,i,s,c){let f;for(f=0;f<c&&!(f+s>=i.length||f>=u.length);++f)i[f+s]=u[f];return f}function ye(u,i){return u instanceof i||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===i.name}function ur(u){return u!==u}let Hi=(function(){let u="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]=u[s]+u[f]}return i})();function Ce(u){return typeof BigInt>"u"?Yi:u}function Yi(){throw new Error("BigInt not supported")}return Oe}var Rt,la,qt,ua,Oe,ca,da=pt(()=>{"use strict";m();y();h();Rt={},la=!1;qt={},ua=!1;Oe={},ca=!1});var je,_,Gu,Ju,fa=pt(()=>{"use strict";m();y();h();da();je=pa();je.Buffer;je.SlowBuffer;je.INSPECT_MAX_BYTES;je.kMaxLength;_=je.Buffer,Gu=je.INSPECT_MAX_BYTES,Ju=je.kMaxLength});var y=pt(()=>{"use strict";fa()});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 ts=typeof global=="object"&&global&&global.Object===Object&&global,ma=ts;var rs=typeof self=="object"&&self&&self.Object===Object&&self,ns=ma||rs||Function("return this")(),ha=ns;var as=ha.Symbol,Re=as;m();y();h();var ya=Object.prototype,is=ya.hasOwnProperty,ss=ya.toString,_t=Re?Re.toStringTag:void 0;function os(n){var e=is.call(n,_t),t=n[_t];try{n[_t]=void 0;var r=!0}catch{}var a=ss.call(n);return r&&(e?n[_t]=t:delete n[_t]),a}var ga=os;m();y();h();var ls=Object.prototype,us=ls.toString;function cs(n){return us.call(n)}var xa=cs;var ps="[object Null]",ds="[object Undefined]",va=Re?Re.toStringTag:void 0;function fs(n){return n==null?n===void 0?ds:ps:va&&va in Object(n)?ga(n):xa(n)}var wa=fs;m();y();h();function ms(n){return n!=null&&typeof n=="object"}var ba=ms;var hs="[object Symbol]";function ys(n){return typeof n=="symbol"||ba(n)&&wa(n)==hs}var Ta=ys;m();y();h();m();y();h();function gs(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 Ra=gs;m();y();h();var xs=Array.isArray,_a=xs;var vs=1/0,ka=Re?Re.prototype:void 0,Na=ka?ka.toString:void 0;function Ia(n){if(typeof n=="string")return n;if(_a(n))return Ra(n,Ia)+"";if(Ta(n))return Na?Na.call(n):"";var e=n+"";return e=="0"&&1/n==-vs?"-0":e}var Ca=Ia;m();y();h();function ws(n){return n==null?"":Ca(n)}var Ee=ws;m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();function bs(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 Aa=bs;function Ts(n,e,t){var r=n.length;return t=t===void 0?r:t,!e&&t>=r?n:Aa(n,e,t)}var Ea=Ts;m();y();h();var Rs="\\ud800-\\udfff",_s="\\u0300-\\u036f",ks="\\ufe20-\\ufe2f",Ns="\\u20d0-\\u20ff",Is=_s+ks+Ns,Cs="\\ufe0e\\ufe0f",As="\\u200d",Es=RegExp("["+As+Rs+Is+Cs+"]");function Ss(n){return Es.test(n)}var Wt=Ss;m();y();h();m();y();h();function Ls(n){return n.split("")}var Sa=Ls;m();y();h();var La="\\ud800-\\udfff",Bs="\\u0300-\\u036f",Ps="\\ufe20-\\ufe2f",Fs="\\u20d0-\\u20ff",Os=Bs+Ps+Fs,js="\\ufe0e\\ufe0f",Us="["+La+"]",mr="["+Os+"]",hr="\\ud83c[\\udffb-\\udfff]",Ms="(?:"+mr+"|"+hr+")",Ba="[^"+La+"]",Pa="(?:\\ud83c[\\udde6-\\uddff]){2}",Fa="[\\ud800-\\udbff][\\udc00-\\udfff]",Ds="\\u200d",Oa=Ms+"?",ja="["+js+"]?",$s="(?:"+Ds+"(?:"+[Ba,Pa,Fa].join("|")+")"+ja+Oa+")*",Vs=ja+Oa+$s,qs="(?:"+[Ba+mr+"?",mr,Pa,Fa,Us].join("|")+")",Ws=RegExp(hr+"(?="+hr+")|"+qs+Vs,"g");function zs(n){return n.match(Ws)||[]}var Ua=zs;function Zs(n){return Wt(n)?Ua(n):Sa(n)}var Ma=Zs;function Gs(n){return function(e){e=Ee(e);var t=Wt(e)?Ma(e):void 0,r=t?t[0]:e.charAt(0),a=t?Ea(t,1).join(""):e.slice(1);return r[n]()+a}}var Da=Gs;var Js=Da("toUpperCase"),$a=Js;function Hs(n){return $a(Ee(n).toLowerCase())}var Va=Hs;m();y();h();m();y();h();function Ys(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 qa=Ys;m();y();h();m();y();h();m();y();h();function Ks(n){return function(e){return n?.[e]}}var Wa=Ks;var Qs={\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"},Xs=Wa(Qs),za=Xs;var eo=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,to="\\u0300-\\u036f",ro="\\ufe20-\\ufe2f",no="\\u20d0-\\u20ff",ao=to+ro+no,io="["+ao+"]",so=RegExp(io,"g");function oo(n){return n=Ee(n),n&&n.replace(eo,za).replace(so,"")}var Za=oo;m();y();h();m();y();h();var lo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function uo(n){return n.match(lo)||[]}var Ga=uo;m();y();h();var co=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function po(n){return co.test(n)}var Ja=po;m();y();h();var Xa="\\ud800-\\udfff",fo="\\u0300-\\u036f",mo="\\ufe20-\\ufe2f",ho="\\u20d0-\\u20ff",yo=fo+mo+ho,ei="\\u2700-\\u27bf",ti="a-z\\xdf-\\xf6\\xf8-\\xff",go="\\xac\\xb1\\xd7\\xf7",xo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vo="\\u2000-\\u206f",wo=" \\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",ri="A-Z\\xc0-\\xd6\\xd8-\\xde",bo="\\ufe0e\\ufe0f",ni=go+xo+vo+wo,ai="['\u2019]",Ha="["+ni+"]",To="["+yo+"]",ii="\\d+",Ro="["+ei+"]",si="["+ti+"]",oi="[^"+Xa+ni+ii+ei+ti+ri+"]",_o="\\ud83c[\\udffb-\\udfff]",ko="(?:"+To+"|"+_o+")",No="[^"+Xa+"]",li="(?:\\ud83c[\\udde6-\\uddff]){2}",ui="[\\ud800-\\udbff][\\udc00-\\udfff]",ft="["+ri+"]",Io="\\u200d",Ya="(?:"+si+"|"+oi+")",Co="(?:"+ft+"|"+oi+")",Ka="(?:"+ai+"(?:d|ll|m|re|s|t|ve))?",Qa="(?:"+ai+"(?:D|LL|M|RE|S|T|VE))?",ci=ko+"?",pi="["+bo+"]?",Ao="(?:"+Io+"(?:"+[No,li,ui].join("|")+")"+pi+ci+")*",Eo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",So="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lo=pi+ci+Ao,Bo="(?:"+[Ro,li,ui].join("|")+")"+Lo,Po=RegExp([ft+"?"+si+"+"+Ka+"(?="+[Ha,ft,"$"].join("|")+")",Co+"+"+Qa+"(?="+[Ha,ft+Ya,"$"].join("|")+")",ft+"?"+Ya+"+"+Ka,ft+"+"+Qa,So,Eo,ii,Bo].join("|"),"g");function Fo(n){return n.match(Po)||[]}var di=Fo;function Oo(n,e,t){return n=Ee(n),e=t?void 0:e,e===void 0?Ja(n)?di(n):Ga(n):n.match(e)||[]}var fi=Oo;var jo="['\u2019]",Uo=RegExp(jo,"g");function Mo(n){return function(e){return qa(fi(Za(e).replace(Uo,"")),n,"")}}var mi=Mo;var Do=mi(function(n,e,t){return e=e.toLowerCase(),n+(t?Va(e):e)}),yr=Do;m();y();h();function D(n){throw new Error("Unexpected value: "+JSON.stringify(n))}m();y();h();function kt(n){return Object.keys(n)}m();y();h();m();y();h();m();y();h();var Nt=T.env.FERN_STACK_TRACK?.toLowerCase()??"",ge=Nt!==""&&Nt!=="0"&&Nt!=="false",gr=["single","multiline","box"].includes(Nt)?Nt:"single";ge&&(Error.stackTraceLimit=50);var $o=new Set(["SdkGeneratorCLI","runCli","LoggerImpl","Array.forEach"]),Vo=new Set(["stacktrace"]);function Zt({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:l=!0,formatFilename:p=g=>g}={}){if(!ge)return[];r=[...r,...$o],t=[...t,...Vo],a=[...a,"runInteractiveTask"];let g=!1;return(new Error().stack??"").split(`
2
+ `).map(v=>{let N=v.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(N&&N.length===5){let[,F,G,E,O]=N;if(!F||!G||!E||!O)return;if(g||a.some(j=>F?.includes(j))){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(G),position:`${E}:${O}`}}}).filter(v=>v&&!r.some(N=>v.fn.includes(N))&&!(o&&v.path?.startsWith("node:"))&&!(l&&v.path?.endsWith(".js"))&&!t.some(N=>v.path.includes(N))).slice(e,e+n)}var zt=class{constructor({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:a=[],stopOn:o=[],filterNode:l=!0,filterJs:p=!0,multiline:g=!1,formatFilename:v=N=>N}={}){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=l,this.filterJs=p,this.multiline=g,this.formatFilename=v}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
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}},xr;function hi({maxFrames:n=50,skip:e=0,filterPaths:t=[],filterFunctions:r=[],stopOn:a=[],filterNode:o=!0,filterJs:l=!0,multiline:p=!1,formatFilename:g=v=>v}={}){ge&&(xr??(xr=new zt({maxFrames:n,skip:e,filterPaths:t,filterFunctions:r,stopOn:a,filterNode:o,filterJs:l,multiline:p,formatFilename:g})))}function yi(n){xr?.tag(n)}function vr(n){return xr?.frames(n)??[]}var Ue=class{constructor(){yi(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 Ue{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 qo=4;hi({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ct=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(`
4
4
  `),this.lineBuffer.join(`
5
5
  `)+(this.lastCharacterIsNewline?`
@@ -12,14 +12,14 @@ ${o}`);this.isAtStartOfLine()&&(l=o+l),r&&(l+=`
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 l=e[o];l!=null&&r(l)}}}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,gr){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 qo}};m();y();h();function wr(n){return n?.name!=null&&n?.assignment!=null}m();y();h();m();y();h();m();y();h();var Et=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 At=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 Et;for(let o of r){let l=this.context.clone(),p=this.createSnippetGenerator(l);try{let g=await p.generateSnippet({endpoint:o,request:e,options:t});if(l.errors.empty())return{snippet:g,errors:void 0};a.update({context:l,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 l=this.context.clone(),p=this.createSnippetGenerator(l);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 Et;for(let o of r){let l=this.context.clone(),p=this.createSnippetGenerator(l);try{let g=p.generateSnippetSync({endpoint:o,request:e,options:t});if(l.errors.empty())return{snippet:g,errors:void 0};a.update({context:l,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(){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 q={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 l=e.find(g=>g.name.wireValue===a);if(l==null)throw this.newParameterNotRecognizedError(a);let p=this.isListTypeReference(l.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:l.name,typeReference:l.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:q.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=[],o=new Set;for(let l of e){let p=l.name.wireValue,g=t[p];if(g!==void 0){o.add(p),this.errors.scope(p);try{a.push({name:l.name,typeReference:l.typeReference,value:g})}finally{this.errors.unscope()}}}if(!r){for(let[l,p]of Object.entries(t))if(!(p===void 0||o.has(l))){this.errors.scope(l);try{this.errors.add({severity:q.Critical,message:this.newParameterNotRecognizedError(l).message})}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 l=r[o.name.wireValue];l==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:l})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:q.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:q.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:q.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:q.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:q.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:q.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:q.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let l=e.types[o];if(l==null){this.errors.add({severity:q.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:p,...g}=r;return{singleDiscriminatedUnionType:l,discriminantValue:l.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:q.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:q.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:q.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(kt(r.urls));for(let o of kt(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:q.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${kt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:q.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:q.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:q.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 Ct{constructor({packageName:t,customConfig:r,formatter:a}){super();R(this,"packageName");R(this,"customConfig");R(this,"formatter");R(this,"imports",new Set);R(this,"importedSimpleNames",new Map);this.packageName=t,this.customConfig=r,this.formatter=a??new It}addImport(t){this.imports.add(t)}addReference({name:t,packageName:r}){let a=this.importedSimpleNames.get(t);return a==null?(this.importedSimpleNames.set(t,r),this.imports.add(`${r}.${t}`),{shouldFullyQualify:!1}):a===r?(this.imports.add(`${r}.${t}`),{shouldFullyQualify:!1}):{shouldFullyQualify:!0}}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,gr){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 qo}};m();y();h();function wr(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 Et=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 l=this.context.clone(),p=this.createSnippetGenerator(l);try{let g=await p.generateSnippet({endpoint:o,request:e,options:t});if(l.errors.empty())return{snippet:g,errors:void 0};a.update({context:l,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 l=this.context.clone(),p=this.createSnippetGenerator(l);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 l=this.context.clone(),p=this.createSnippetGenerator(l);try{let g=p.generateSnippetSync({endpoint:o,request:e,options:t});if(l.errors.empty())return{snippet:g,errors:void 0};a.update({context:l,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(){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 q={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 l=e.find(g=>g.name.wireValue===a);if(l==null)throw this.newParameterNotRecognizedError(a);let p=this.isListTypeReference(l.typeReference)&&!Array.isArray(o)?[o]:o;r.push({name:l.name,typeReference:l.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:q.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=[],o=new Set;for(let l of e){let p=l.name.wireValue,g=t[p];if(g!==void 0){o.add(p),this.errors.scope(p);try{a.push({name:l.name,typeReference:l.typeReference,value:g})}finally{this.errors.unscope()}}}if(!r){for(let[l,p]of Object.entries(t))if(!(p===void 0||o.has(l))){this.errors.scope(l);try{this.errors.add({severity:q.Critical,message:this.newParameterNotRecognizedError(l).message})}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 l=r[o.name.wireValue];l==null?o.typeReference.type==="nullable"&&a.push({name:o.name,typeReference:o.typeReference,value:null}):a.push({name:o.name,typeReference:o.typeReference,value:l})}return a}getSingleFileValue({property:e,record:t}){let r=t[e.wireValue];if(r!=null){if(typeof r!="string"){this.errors.add({severity:q.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:q.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:q.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:q.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:q.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:q.Critical,message:this.newParameterNotRecognizedError(a).message});return}if(typeof o!="string"){this.errors.add({severity:q.Critical,message:`Expected discriminant value to be a string but got: ${typeof o}`});return}let l=e.types[o];if(l==null){this.errors.add({severity:q.Critical,message:`No type found for discriminant value "${o}"`});return}let{[a]:p,...g}=r;return{singleDiscriminatedUnionType:l,discriminantValue:l.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:D(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:D(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:q.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:q.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:q.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let a=new Set(kt(r.urls));for(let o of kt(e))a.has(o)&&a.delete(o);return a.size>0?(this.errors.add({severity:q.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${kt(r.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:q.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:q.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:q.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:D(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:D(t)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(t=>{switch(t.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:D(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 De=class extends Ct{constructor({packageName:t,customConfig:r,formatter:a}){super();R(this,"packageName");R(this,"customConfig");R(this,"formatter");R(this,"imports",new Set);R(this,"importedSimpleNames",new Map);this.packageName=t,this.customConfig=r,this.formatter=a??new It}addImport(t){this.imports.add(t)}addReference({name:t,packageName:r}){let a=this.importedSimpleNames.get(t);return a==null?(this.importedSimpleNames.set(t,r),this.imports.add(`${r}.${t}`),{shouldFullyQualify:!1}):a===r?(this.imports.add(`${r}.${t}`),{shouldFullyQualify:!1}):{shouldFullyQualify:!0}}getImports(){return new Set(this.imports)}};var Pt=class extends De{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 S={};cr(S,{BRAND:()=>hl,DIRTY:()=>Ve,EMPTY_PATH:()=>Go,INVALID:()=>L,NEVER:()=>Xl,OK:()=>re,ParseStatus:()=>ee,Schema:()=>M,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:()=>He,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>De,ZodObject:()=>le,ZodOptional:()=>pe,ZodParsedType:()=>C,ZodPipeline:()=>jt,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Kt,ZodSchema:()=>M,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>M,ZodUndefined:()=>Ze,ZodUnion:()=>Je,ZodUnknown:()=>Ne,ZodVoid:()=>xt,addIssueToContext:()=>I,any:()=>_l,array:()=>Cl,bigint:()=>vl,boolean:()=>Ii,coerce:()=>Ql,custom:()=>_i,date:()=>wl,datetimeRegex:()=>Ti,defaultErrorMap:()=>_e,discriminatedUnion:()=>Ll,effect:()=>Wl,enum:()=>Vl,function:()=>Ul,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>gl,intersection:()=>Bl,isAborted:()=>Jt,isAsync:()=>ht,isDirty:()=>Ht,isValid:()=>Se,late:()=>yl,lazy:()=>Ml,literal:()=>$l,makeIssue:()=>Ft,map:()=>Ol,nan:()=>xl,nativeEnum:()=>Dl,never:()=>Nl,null:()=>Rl,nullable:()=>Zl,number:()=>Ni,object:()=>El,objectUtil:()=>br,oboolean:()=>Kl,onumber:()=>Yl,optional:()=>zl,ostring:()=>Hl,pipeline:()=>Jl,preprocess:()=>Gl,promise:()=>ql,quotelessJson:()=>Wo,record:()=>Fl,set:()=>jl,setErrorMap:()=>Zo,strictObject:()=>Al,string:()=>ki,symbol:()=>bl,transformer:()=>Wl,tuple:()=>Pl,undefined:()=>Tl,union:()=>Sl,unknown:()=>kl,util:()=>D,void:()=>Il});m();y();h();m();y();h();m();y();h();m();y();h();m();y();h();var D;(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 l of a)o[l]=l;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(p=>typeof a[a[p]]!="number"),l={};for(let p of o)l[p]=a[p];return n.objectValues(l)},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 l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},n.find=(a,o)=>{for(let l of a)if(o(l))return l},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(l=>typeof l=="string"?`'${l}'`:l).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(D||(D={}));var br;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(br||(br={}));var C=D.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 C.undefined;case"string":return C.string;case"number":return Number.isNaN(n)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(n)?C.array:n===null?C.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?C.promise:typeof Map<"u"&&n instanceof Map?C.map:typeof Set<"u"&&n instanceof Set?C.set:typeof Date<"u"&&n instanceof Date?C.date:C.object;default:return C.unknown}};var b=D.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"]),Wo=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 l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)r._errors.push(t(l));else{let p=r,g=0;for(;g<l.path.length;){let v=l.path[g];g===l.path.length-1?(p[v]=p[v]||{_errors:[]},p[v]._errors.push(t(l))):p[v]=p[v]||{_errors:[]},p=p[v],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,D.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 zo=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===C.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,D.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${D.joinValues(n.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${D.joinValues(n.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${D.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}"`:D.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,D.assertNever(n)}return{message:t}},_e=zo;var gi=_e;function Zo(n){gi=n}function mt(){return gi}m();y();h();var Ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let p="",g=r.filter(v=>!!v).slice().reverse();for(let v of g)p=v(l,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},Go=[];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===_e?void 0:_e].filter(a=>!!a)});n.common.issues.push(r)}var ee=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,l=await a.value;r.push({key:o,value:l})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return L;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(r[o.value]=l.value)}return{status:e.value,value:r}}},L=Object.freeze({status:"aborted"}),Ve=n=>({status:"dirty",value:n}),re=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 E;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(E||(E={}));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}},xi=(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 U(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:(l,p)=>{let{message:g}=n;return l.code==="invalid_enum_value"?{message:g??p.defaultError}:typeof p.data>"u"?{message:g??r??p.defaultError}:l.code!=="invalid_type"?{message:p.defaultError}:{message:g??t??p.defaultError}},description:a}}var M=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 ee,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 xi(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 xi(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 l=e(a),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(g=>g?!0:(p(),!1)):l?!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 Je.create([this,e],this._def)}and(e){return He.create(this,e,this._def)}transform(e){return new fe({...U(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...U(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new Ot({typeName:P.ZodBranded,type:this,...U(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...U(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 jt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Jo=/^c[^\s-]{8,}$/i,Ho=/^[0-9a-z]+$/,Yo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ko=/^[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,Qo=/^[a-z0-9_-]{21}$/i,Xo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,el=/^[-+]?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)?)??$/,tl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tr,nl=/^(?:(?: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])$/,al=/^(?:(?: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])$/,il=/^(([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]))$/,sl=/^(([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])$/,ol=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ll=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wi="((\\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])))",ul=new RegExp(`^${wi}$`);function bi(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 cl(n){return new RegExp(`^${bi(n)}$`)}function Ti(n){let e=`${wi}T${bi(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 pl(n,e){return!!((e==="v4"||!e)&&nl.test(n)||(e==="v6"||!e)&&il.test(n))}function dl(n,e){if(!Xo.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 fl(n,e){return!!((e==="v4"||!e)&&al.test(n)||(e==="v6"||!e)&&sl.test(n))}var Le=class n extends M{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.string,received:o.parsedType}),L}let r=new ee,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 l=e.data.length>o.value,p=e.data.length<o.value;(l||p)&&(a=this._getOrReturnCtx(e,a),l?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")tl.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")Tr||(Tr=new RegExp(rl,"u")),Tr.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")Ko.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")Qo.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")Jo.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")Ho.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")Yo.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"?Ti(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"?ul.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?cl(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"?el.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?pl(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"?dl(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"?fl(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"?ol.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?ll.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):D.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,...E.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...E.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...E.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,...E.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,...E.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...E.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.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,...U(n)});function ml(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(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return o%l/10**a}var De=class n extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.number,received:o.parsedType}),L}let r,a=new ee;for(let o of this._def.checks)o.kind==="int"?D.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"?ml(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()):D.assertNever(o);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.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"&&D.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:P.ZodNumber,coerce:n?.coerce||!1,...U(n)});var qe=class n extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let r,a=new ee;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()):D.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:C.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.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:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.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,...U(n)});var We=class extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.boolean,received:r.parsedType}),L}return re(e.data)}};We.create=n=>new We({typeName:P.ZodBoolean,coerce:n?.coerce||!1,...U(n)});var ze=class n extends M{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.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 ee,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()):D.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:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.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,...U(n)});var gt=class extends M{_parse(e){if(this._getType(e)!==C.symbol){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.symbol,received:r.parsedType}),L}return re(e.data)}};gt.create=n=>new gt({typeName:P.ZodSymbol,...U(n)});var Ze=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.undefined,received:r.parsedType}),L}return re(e.data)}};Ze.create=n=>new Ze({typeName:P.ZodUndefined,...U(n)});var Ge=class extends M{_parse(e){if(this._getType(e)!==C.null){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.null,received:r.parsedType}),L}return re(e.data)}};Ge.create=n=>new Ge({typeName:P.ZodNull,...U(n)});var Be=class extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return re(e.data)}};Be.create=n=>new Be({typeName:P.ZodAny,...U(n)});var Ne=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return re(e.data)}};Ne.create=n=>new Ne({typeName:P.ZodUnknown,...U(n)});var he=class extends M{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:C.never,received:t.parsedType}),L}};he.create=n=>new he({typeName:P.ZodNever,...U(n)});var xt=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.void,received:r.parsedType}),L}return re(e.data)}};xt.create=n=>new xt({typeName:P.ZodVoid,...U(n)});var Ie=class n extends M{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==C.array)return I(t,{code:b.invalid_type,expected:C.array,received:t.parsedType}),L;if(a.exactLength!==null){let l=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(l||p)&&(I(t,{code:l?b.too_big:b.too_small,minimum:p?a.exactLength.value:void 0,maximum:l?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((l,p)=>a.type._parseAsync(new de(t,l,t.path,p)))).then(l=>ee.mergeArray(r,l));let o=[...t.data].map((l,p)=>a.type._parseSync(new de(t,l,t.path,p)));return ee.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:E.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,...U(e)});function yt(n){if(n instanceof le){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new le({...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 le=class n extends M{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=D.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==C.object){let v=this._getOrReturnCtx(e);return I(v,{code:b.invalid_type,expected:C.object,received:v.parsedType}),L}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let v in a.data)l.includes(v)||p.push(v);let g=[];for(let v of l){let N=o[v],F=a.data[v];g.push({key:{status:"valid",value:v},value:N._parse(new de(a,F,a.path,v)),alwaysSet:v in a.data})}if(this._def.catchall instanceof he){let v=this._def.unknownKeys;if(v==="passthrough")for(let N of p)g.push({key:{status:"valid",value:N},value:{status:"valid",value:a.data[N]}});else if(v==="strict")p.length>0&&(I(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(v!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let v=this._def.catchall;for(let N of p){let F=a.data[N];g.push({key:{status:"valid",value:N},value:v._parse(new de(a,F,a.path,N)),alwaysSet:N in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let v=[];for(let N of g){let F=await N.key,G=await N.value;v.push({key:F,value:G,alwaysSet:N.alwaysSet})}return v}).then(v=>ee.mergeObjectSync(r,v)):ee.mergeObjectSync(r,g)}get shape(){return this._def.shape()}strict(e){return E.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:E.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 D.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 D.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 D.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 D.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 Ri(D.objectKeys(this.shape))}};le.create=(n,e)=>new le({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:P.ZodObject,...U(e)});le.strictCreate=(n,e)=>new le({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:P.ZodObject,...U(e)});le.lazycreate=(n,e)=>new le({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:P.ZodObject,...U(e)});var Je=class extends M{_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 l=o.map(p=>new oe(p.ctx.common.issues));return I(t,{code:b.invalid_union,unionErrors:l}),L}if(t.common.async)return Promise.all(r.map(async o=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(a);{let o,l=[];for(let g of r){let v={...t,common:{...t.common,issues:[]},parent:null},N=g._parseSync({data:t.data,path:t.path,parent:v});if(N.status==="valid")return N;N.status==="dirty"&&!o&&(o={result:N,ctx:v}),v.common.issues.length&&l.push(v.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=l.map(g=>new oe(g));return I(t,{code:b.invalid_union,unionErrors:p}),L}}get options(){return this._def.options}};Je.create=(n,e)=>new Je({options:n,typeName:P.ZodUnion,...U(e)});var ke=n=>n instanceof Ye?ke(n.schema):n instanceof fe?ke(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?D.objectValues(n.enum):n instanceof et?ke(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...ke(n.unwrap())]:n instanceof we?[null,...ke(n.unwrap())]:n instanceof Ot||n instanceof rt?ke(n.unwrap()):n instanceof tt?ke(n._def.innerType):[],Yt=class n extends M{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return I(t,{code:b.invalid_type,expected:C.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 l=ke(o.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of l){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,...U(r)})}};function Rr(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===C.object&&r===C.object){let a=D.objectKeys(e),o=D.objectKeys(n).filter(p=>a.indexOf(p)!==-1),l={...n,...e};for(let p of o){let g=Rr(n[p],e[p]);if(!g.valid)return{valid:!1};l[p]=g.data}return{valid:!0,data:l}}else if(t===C.array&&r===C.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let l=n[o],p=e[o],g=Rr(l,p);if(!g.valid)return{valid:!1};a.push(g.data)}return{valid:!0,data:a}}else return t===C.date&&r===C.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var He=class extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,l)=>{if(Jt(o)||Jt(l))return L;let p=Rr(o.value,l.value);return p.valid?((Ht(o)||Ht(l))&&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,l])=>a(o,l)):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:P.ZodIntersection,...U(t)});var ve=class n extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return I(r,{code:b.invalid_type,expected:C.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((l,p)=>{let g=this._def.items[p]||this._def.rest;return g?g._parse(new de(r,l,r.path,p)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>ee.mergeArray(t,l)):ee.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,...U(e)})};var Kt=class n extends M{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!==C.object)return I(r,{code:b.invalid_type,expected:C.object,received:r.parsedType}),L;let a=[],o=this._def.keyType,l=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:l._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?ee.mergeObjectAsync(t,a):ee.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof M?new n({keyType:e,valueType:t,typeName:P.ZodRecord,...U(r)}):new n({keyType:Le.create(),valueType:e,typeName:P.ZodRecord,...U(t)})}},vt=class extends M{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!==C.map)return I(r,{code:b.invalid_type,expected:C.map,received:r.parsedType}),L;let a=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([p,g],v)=>({key:a._parse(new de(r,p,r.path,[v,"key"])),value:o._parse(new de(r,g,r.path,[v,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let g of l){let v=await g.key,N=await g.value;if(v.status==="aborted"||N.status==="aborted")return L;(v.status==="dirty"||N.status==="dirty")&&t.dirty(),p.set(v.value,N.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let g of l){let v=g.key,N=g.value;if(v.status==="aborted"||N.status==="aborted")return L;(v.status==="dirty"||N.status==="dirty")&&t.dirty(),p.set(v.value,N.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:P.ZodMap,...U(t)});var wt=class n extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return I(r,{code:b.invalid_type,expected:C.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 l(g){let v=new Set;for(let N of g){if(N.status==="aborted")return L;N.status==="dirty"&&t.dirty(),v.add(N.value)}return{status:t.value,value:v}}let p=[...r.data.values()].map((g,v)=>o._parse(new de(r,g,r.path,v)));return r.common.async?Promise.all(p).then(g=>l(g)):l(p)}min(e,t){return new n({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:E.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,...U(e)});var Qt=class n extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return I(t,{code:b.invalid_type,expected:C.function,received:t.parsedType}),L;function r(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),_e].filter(v=>!!v),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(),_e].filter(v=>!!v),issueData:{code:b.invalid_return_type,returnTypeError:g}})}let o={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof Pe){let p=this;return re(async function(...g){let v=new oe([]),N=await p._def.args.parseAsync(g,o).catch(A=>{throw v.addIssue(r(g,A)),v}),F=await Reflect.apply(l,this,N);return await p._def.returns._def.type.parseAsync(F,o).catch(A=>{throw v.addIssue(a(F,A)),v})})}else{let p=this;return re(function(...g){let v=p._def.args.safeParse(g,o);if(!v.success)throw new oe([r(g,v.error)]);let N=Reflect.apply(l,this,v.data),F=p._def.returns.safeParse(N,o);if(!F.success)throw new oe([a(N,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(Ne.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(Ne.create()),returns:t||Ne.create(),typeName:P.ZodFunction,...U(r)})}},Ye=class extends M{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,...U(e)});var Ke=class extends M{_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,...U(e)});function Ri(n,e){return new Qe({values:n,typeName:P.ZodEnum,...U(e)})}var Qe=class n extends M{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return I(t,{expected:D.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 re(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=Ri;var Xe=class extends M{_parse(e){let t=D.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==C.string&&r.parsedType!==C.number){let a=D.objectValues(t);return I(r,{expected:D.joinValues(a),received:r.parsedType,code:b.invalid_type}),L}if(this._cache||(this._cache=new Set(D.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=D.objectValues(t);return I(r,{received:r.data,code:b.invalid_enum_value,options:a}),L}return re(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:P.ZodNativeEnum,...U(e)});var Pe=class extends M{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return I(t,{code:b.invalid_type,expected:C.promise,received:t.parsedType}),L;let r=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return re(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,...U(e)});var fe=class extends M{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:l=>{I(r,l),l.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let l=a.transform(r.data,o);if(r.common.async)return Promise.resolve(l).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:l,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 l=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(),l(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(),l(p.value).then(()=>({status:t.value,value:p.value}))))}if(a.type==="transform")if(r.common.async===!1){let l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Se(l))return L;let p=a.transform(l.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(l=>Se(l)?Promise.resolve(a.transform(l.value,o)).then(p=>({status:t.value,value:p})):L);D.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:P.ZodEffects,effect:e,...U(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:P.ZodEffects,...U(t)});var pe=class extends M{_parse(e){return this._getType(e)===C.undefined?re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:P.ZodOptional,...U(e)});var we=class extends M{_parse(e){return this._getType(e)===C.null?re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:P.ZodNullable,...U(e)});var et=class extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===C.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,...U(e)});var tt=class extends M{_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,...U(e)});var bt=class extends M{_parse(e){if(this._getType(e)!==C.nan){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:P.ZodNaN,...U(n)});var hl=Symbol("zod_brand"),Ot=class extends M{_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}},jt=class n extends M{_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:P.ZodPipeline})}},rt=class extends M{_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,...U(e)});function vi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function _i(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(l=>{if(!l){let p=vi(e,r),g=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:g})}});if(!o){let l=vi(e,r),p=l.fatal??t??!0;a.addIssue({code:"custom",...l,fatal:p})}}):Be.create()}var yl={object:le.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 gl=(n,e={message:`Input not instance of ${n.name}`})=>_i(t=>t instanceof n,e),ki=Le.create,Ni=De.create,xl=bt.create,vl=qe.create,Ii=We.create,wl=ze.create,bl=gt.create,Tl=Ze.create,Rl=Ge.create,_l=Be.create,kl=Ne.create,Nl=he.create,Il=xt.create,Cl=Ie.create,El=le.create,Al=le.strictCreate,Sl=Je.create,Ll=Yt.create,Bl=He.create,Pl=ve.create,Fl=Kt.create,Ol=vt.create,jl=wt.create,Ul=Qt.create,Ml=Ye.create,$l=Ke.create,Vl=Qe.create,Dl=Xe.create,ql=Pe.create,Wl=fe.create,zl=pe.create,Zl=we.create,Gl=fe.createWithPreprocess,Jl=jt.create,Hl=()=>ki().optional(),Yl=()=>Ni().optional(),Kl=()=>Ii().optional(),Ql={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 Xl=L;m();y();h();var Ci=S.strictObject({title:S.string(),content:S.string()});var _r=S.object({"base-api-exception-class-name":S.string().optional(),"base-exception-class-name":S.string().optional(),"client-class-name":S.string().optional(),"exported-client-class-name":S.string().optional(),"inline-file-properties":S.boolean().optional(),"inline-path-parameters":S.boolean().optional(),"package-layout":S.enum(["flat","nested"]).optional(),"package-prefix":S.string().optional(),"respect-optional-request-body":S.boolean().optional(),"legacy-input-stream-upload-overloads":S.boolean().optional(),"use-local-date-for-dates":S.boolean().optional(),"custom-dependencies":S.array(S.string()).optional(),"custom-plugins":S.array(S.string()).optional(),"disable-required-property-builder-checks":S.boolean().optional(),"enable-forward-compatible-enums":S.boolean().optional(),"enable-inline-types":S.boolean().optional(),"enable-public-constructors":S.boolean().optional(),"generate-unknown-as-json-node":S.boolean().optional(),"json-include":S.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":S.boolean().optional(),"use-default-request-parameter-values":S.boolean().optional(),"enable-wire-tests":S.boolean().default(!1),"wire-tests-fallback-to-autogenerated-error-examples":S.boolean().optional(),"collapse-optional-nullable":S.boolean().optional(),"use-nullable-annotation":S.boolean().optional(),"custom-readme-sections":S.array(Ci).optional(),"custom-pager-name":S.string().optional(),"offset-semantics":S.enum(["item-index","page-index"]).optional(),"default-timeout-in-seconds":S.number().optional(),"gradle-distribution-url":S.string().optional(),"gradle-plugin-management":S.string().optional(),"gradle-central-dependency-management":S.boolean().optional(),"output-directory":S.enum(["source-root","project-root"]).optional(),"custom-interceptors":S.boolean().optional(),"omit-fern-headers":S.boolean().optional(),includePlatformHeaders:S.boolean().optional(),userAgentOnly:S.boolean().optional(),"retry-status-codes":S.optional(S.enum(["legacy","recommended"])),"enable-gradle-profiling":S.boolean().optional(),"wrapped-aliases":S.boolean().optional(),maxRetries:S.number().int().min(0).optional()});var d={};cr(d,{Access:()=>kr,AstNode:()=>Y,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>W,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>lt,Type:()=>Ut,TypeLiteral:()=>ue,Writer:()=>$e,classReference:()=>Tu,class_:()=>bu,codeblock:()=>wu,instantiateClass:()=>Ru,invokeMethod:()=>_u,method:()=>ku,parameter:()=>Nu});m();y();h();m();y();h();m();y();h();var Y=class extends Ue{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 Y{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 kr={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();m();y();h();m();y();h();var W=class extends Y{constructor({name:t,packageName:r,fullyQualified:a,enclosingClasses:o}){super();R(this,"name");R(this,"packageName");R(this,"fullyQualified");R(this,"enclosingClasses");this.name=t,this.packageName=r,this.fullyQualified=a??!1,this.enclosingClasses=o??[]}write(t){let r=this.enclosingClasses[0]??this.name,a=[...this.enclosingClasses,this.name].join(".");if(this.fullyQualified){t.write(`${this.packageName}.${a}`);return}let{shouldFullyQualify:o}=t.addReference({name:r,packageName:this.packageName});if(o){t.write(`${this.packageName}.${a}`);return}t.write(a)}};m();y();h();var Ut=class extends Y{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(eu);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.customConfig?.["use-local-date-for-dates"]===!0?t.writeNode(nu):t.write("String");break;case"dateTime":t.writeNode(au);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(ou);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(su);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(tu),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(ru),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Nr),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(lu),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(iu),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Xt=new W({name:"Arrays",packageName:"java.util"}),eu=new W({name:"BigInteger",packageName:"java.math"}),mg=new W({name:"HashMap",packageName:"java.util"}),tu=new W({name:"List",packageName:"java.util"}),ru=new W({name:"Map",packageName:"java.util"}),nu=new W({name:"LocalDate",packageName:"java.time"}),au=new W({name:"OffsetDateTime",packageName:"java.time"}),Nr=new W({name:"Optional",packageName:"java.util"}),iu=new W({name:"Set",packageName:"java.util"}),su=new W({name:"UUID",packageName:"java.util"}),ou=new W({name:"InputStream",packageName:"java.io"}),lu=new W({name:"Iterable",packageName:"java.lang"});var ue=class n extends Y{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 Y?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:uu,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(hu({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=>this.isRequiredBuilderParameter(a))?t.sort((a,o)=>{let l=!this.isRequiredBuilderParameter(a),p=!this.isRequiredBuilderParameter(o);return l&&!p?1:!l&&p?-1:0}):t.sort((a,o)=>{let l=a.value.isOptional(),p=o.value.isOptional();return l&&!p?1:!l&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isRequiredBuilderParameter(t){return t.isRequired!=null?t.isRequired:!this.isNonRequired(t.value)}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=mu({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:pu,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:du,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=yu({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:Nr,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"?Ir:cu,o=gu({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(Ir),t.write("<Object>()");return}t.write("new "),t.writeNode(Ir),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,l]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(l)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:fu,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"}},Ir=new W({name:"ArrayList",packageName:"java.util"}),uu=new W({name:"BigInteger",packageName:"java.math"}),er=new W({name:"HashMap",packageName:"java.util"}),cu=new W({name:"HashSet",packageName:"java.util"}),kg=new W({name:"List",packageName:"java.util"}),pu=new W({name:"LocalDate",packageName:"java.time"}),Ng=new W({name:"Map",packageName:"java.util"}),du=new W({name:"OffsetDateTime",packageName:"java.time"}),Ig=new W({name:"Set",packageName:"java.util"}),fu=new W({name:"UUID",packageName:"java.util"});function mu({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function hu({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function yu({entries:n}){return n.filter(e=>!ue.isNop(e.key)&&!ue.isNop(e.value))}function gu({values:n}){return n.filter(e=>!ue.isNop(e))}function tr({writer:n,arguments_:e}){let t=vu(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof ue&&!a.shouldWriteInLine())){xu({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ei({writer:n,argument:a})}),n.write(")")}function xu({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ei({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ei({writer:n,argument:e}){wr(e)?n.writeNodeOrString(e.assignment):e.write(n)}function vu(n){return n.filter(e=>!(e instanceof ue&&ue.isNop(e)))}var at=class extends Y{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 Y{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 Y{constructor({name:t,access:r,parameters:a,body:o,static_:l,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_=l??!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 Y{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 lt=class extends Y{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 wu(n){return new it(n)}function bu(n){return new nt(n)}function Tu(n){return new W(n)}function Ru(n){return new at(n)}function _u(n){return new ot(n)}function ku(n){return new st(n)}function Nu(n){return new lt(n)}m();y();h();var Iu=new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while","true","false","null","_"]);function Ai(n){return Iu.has(n.toLowerCase())}function Cr(n){return Ai(n)?"_"+n:n}m();y();h();var rr=class{constructor({context:e}){R(this,"context");this.context=e}usesOptionalNullable(){return this.context.usesOptionalNullable()}usesNullableAnnotation(){return this.context.usesNullableAnnotation()}wrapInOptionalIfNotNop(e,t=!1,r=!1){return d.TypeLiteral.isNop(e)?e:r?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}wrapNullableOrOptionalValue({value:e,wrapperType:t,useOf:r,propagatedCollapse:a}){return d.TypeLiteral.isNop(e)||t==="nullable"&&this.usesNullableAnnotation()?e:a||this.usesOptionalNullable()&&t==="nullable"?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:r})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:q.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,nestedClassReference:e.nestedClassReference});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,nestedClassReference:e.nestedClassReference});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,nestedClassReference:e.nestedClassReference})}case"nullable":case"optional":{let t=e.typeReference.type,r=e.typeReference.value;if((e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&r.type==="named")&&!(t==="nullable"&&this.usesNullableAnnotation()))return e.isCollapsedOptionalNullable||this.usesOptionalNullable()&&(t==="nullable"||r.type==="optional"||r.type==="nullable")?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(this.usesOptionalNullable()&&(r.type==="optional"||r.type==="nullable"))return this.convert({typeReference:r,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,isCollapsedOptionalNullable:!0,nestedClassReference:e.nestedClassReference});if(r.type==="list"){let l=this.convertList({list:r.value,value:e.value,nestedClassReference:e.nestedClassReference});return this.wrapNullableOrOptionalValue({value:l,wrapperType:t,useOf:!0,propagatedCollapse:e.isCollapsedOptionalNullable===!0})}let a=this.convert({typeReference:r,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,nestedClassReference:e.nestedClassReference}),o=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapNullableOrOptionalValue({value:a,wrapperType:t,useOf:o,propagatedCollapse: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,nestedClassReference:e.nestedClassReference});case"unknown":return this.convertUnknown({value:e.value});default:$(e.typeReference)}}convertList({list:e,value:t,as:r,nestedClassReference:a}){if(!Array.isArray(t))return this.context.errors.add({severity:q.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let o=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((l,p)=>{this.context.errors.scope({index:p});try{if(o&&(e.type==="optional"||e.type==="nullable")){let g=this.convert({typeReference:e.value,value:l,as:r,nestedClassReference:a});return this.wrapNullableOrOptionalValue({value:g,wrapperType:e.type,useOf:!0,propagatedCollapse:!1})}return this.convert({typeReference:e,value:l,as:r,nestedClassReference:a})}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,nestedClassReference:a}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:t.map((o,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:e,value:o,as:r,nestedClassReference:a})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:q.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r,nestedClassReference:a}){return typeof t!="object"||t==null?(this.context.errors.add({severity:q.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(([o,l])=>{this.context.errors.scope(o);try{return{key:this.convert({typeReference:e.key,value:o,as:"mapKey"}),value:this.convert({typeReference:e.value,value:l,as:"mapValue",nestedClassReference:a})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o}){switch(e.type){case"alias":if(e.typeReference.type==="unknown"){let l=this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});return d.TypeLiteral.reference(d.invokeMethod({on:o??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[l]}))}return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t,as:r,nestedClassReference:o});case"enum":return this.convertEnum({enum_:e,value:t,nestedClassReference:o});case"object":return this.convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,as:r,nestedClassReference:o});default:$(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t,as:r,nestedClassReference:a}){let o=a??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),l=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(l==null)return d.TypeLiteral.nop();let p=l.singleDiscriminatedUnionType,g=new Set([...o.enclosingClasses,o.name]),v=new Set(Object.values(e.types).map(N=>this.context.getClassName(N.discriminantValue.name)));switch(p.type){case"samePropertiesAsObject":{let N=this.context.resolveNamedType({typeId:p.typeId});if(N==null)return d.TypeLiteral.nop();let F=this.resolveInlineNestedClassReference({enclosing:o,baseName:this.context.getClassName(p.discriminantValue.name),typeReference:{type:"named",value:p.typeId},reservedNames:g,siblingPropertyNames:v});return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[this.convertNamed({named:N,value:l.value,as:r,nestedClassReference:F})]}))}case"singleProperty":{let N=this.context.getRecord(l.value);if(N==null)return d.TypeLiteral.nop();try{this.context.errors.scope(p.discriminantValue.wireValue);let F="value",G=this.resolveInlineNestedClassReference({enclosing:o,baseName:this.context.getClassName(p.discriminantValue.name),typeReference:p.typeReference,reservedNames:g,siblingPropertyNames:v});return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[this.convert({typeReference:p.typeReference,value:N[F],as:r,nestedClassReference:G})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[]}));default:$(p)}}convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o}){let l=o??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),p=this.context.getRecord(t)??{},g=this.context.associateByWireValue({parameters:e.properties,values:p}),v=new Set(g.map(B=>B.name.wireValue));for(let B of e.properties)if(!v.has(B.name.wireValue)&&!this.context.isOptional(B.typeReference)){if(a===!0)throw new Error(`Required property "${B.name.wireValue}" is missing from value`);let z=this.getDefaultValueForTypeReference(B.typeReference);z!==void 0&&g.push({name:B.name,typeReference:B.typeReference,value:z})}let N=new Map,F=new Set;e.properties.forEach((B,z)=>{N.set(B.name.wireValue,z),F.add(B.name.wireValue)}),g.sort((B,z)=>(N.get(B.name.wireValue)??0)-(N.get(z.name.wireValue)??0));let G=r==="request"?g.filter(B=>!this.context.isDirectLiteral(B.typeReference)):g,A=new Set([...l.enclosingClasses,l.name]),O=new Set(e.properties.map(B=>this.context.getClassName(B.name.name))),j=[];for(let B of G){this.context.errors.scope(B.name.wireValue);try{let z=this.convert({typeReference:B.typeReference,value:B.value,as:r,inUndiscriminatedUnion:a,nestedClassReference:this.resolveInlineNestedClassReference({enclosing:l,baseName:this.context.getClassName(B.name.name),typeReference:B.typeReference,reservedNames:A,siblingPropertyNames:O})});if(d.TypeLiteral.isNop(z)&&!this.context.isOptional(B.typeReference)){if(a===!0)throw new Error(`Required property "${B.name.wireValue}" could not be converted`);continue}j.push({name:this.context.getMethodName(B.name.name),value:z,isRequired:this.isStagedBuilderProperty(B.typeReference)})}finally{this.context.errors.unscope()}}for(let[B,z]of Object.entries(p))if(!F.has(B)&&z!==void 0){let H=this.convertToRawJavaLiteral(z);H!=null&&j.push({name:"additionalProperty",value:d.TypeLiteral.raw(`"${this.escapeJavaString(B)}", ${H}`),isRequired:!1})}return d.TypeLiteral.builder({classReference:l,parameters:j})}resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:r,reservedNames:a,siblingPropertyNames:o}){if(this.context.enableInlineTypes())switch(r.type){case"optional":case"nullable":return this.resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"list":case"set":return this.resolveInlineNestedClassReference({enclosing:e,baseName:`${t}Item`,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"map":return this.resolveInlineNestedClassReference({enclosing:e,baseName:`${t}Value`,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"named":{let l=r.value,p=this.context.resolveNamedType({typeId:l});if(p==null)return;if(p.type==="alias"&&!this.context.wrappedAliases())return this.resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:p.typeReference,reservedNames:a,siblingPropertyNames:o});if(!this.context.isInlineType(l))return;let g=t;for(;a.has(g)||o.has(g)&&g!==t;)g=`${g}_`;return a.add(g),this.context.getNestedInlineClassReference({enclosing:e,name:g})}case"primitive":case"literal":case"unknown":return;default:$(r)}}resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t,reservedNames:r,unionPrefix:a}){if(this.context.enableInlineTypes())switch(t.type){case"optional":case"nullable":case"list":case"set":return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t.value,reservedNames:r,unionPrefix:a});case"map":return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t.value,reservedNames:r,unionPrefix:a});case"named":{let o=t.value,l=this.context.resolveNamedType({typeId:o});if(l==null)return;if(l.type==="alias"&&!this.context.wrappedAliases())return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:l.typeReference,reservedNames:r,unionPrefix:a});if(!this.context.isInlineType(o))return;let p=this.context.getClassName(l.declaration.name);for(p.startsWith(a)&&p!==a&&(p=p.substring(a.length));r.has(p);)p=`${p}_`;return this.context.getNestedInlineClassReference({enclosing:e,name:p})}case"primitive":case"literal":case"unknown":return;default:$(t)}}isStagedBuilderProperty(e){switch(e.type){case"optional":case"nullable":case"list":case"set":case"map":return!1;case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t!=null&&t.type==="alias"?this.isStagedBuilderProperty(t.typeReference):!0}default:return!0}}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,nestedClassReference:r}){let a=this.getEnumValueName({enum_:e,value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:r??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:a})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:q.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:q.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,as:r,nestedClassReference:a}){let o=a??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),l=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,as:r,enclosing:o});return l==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:o,method:"of",arguments_:[l.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,as:r,enclosing:a}){let o=new Set([...a.enclosingClasses,a.name]),l=this.context.getClassName(e.declaration.name);for(let p of e.types){let g=this.context.errors.size();try{let v=this.convert({typeReference:p,value:t,as:r,inUndiscriminatedUnion:!0,nestedClassReference:this.resolveUndiscriminatedInlineNestedClassReference({enclosing:a,typeReference:p,reservedNames:new Set(o),unionPrefix:l})});if(d.TypeLiteral.isNop(v)||this.context.errors.size()>g){this.context.errors.truncate(g);continue}return{valueTypeReference:p,typeInstantiation:v}}catch{this.context.errors.truncate(g);continue}}this.context.errors.add({severity:q.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}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}){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":{let t=e.typeReference.value;return this.context.usesOptionalNullable()&&(t.type==="nullable"||t.type==="optional")?d.Type.generic(this.context.getOptionalNullableClassReference(),[this.convert({typeReference:t.value})]):d.Type.optional(this.convert({typeReference:t}))}case"nullable":{let t=e.typeReference.value;if(this.context.usesNullableAnnotation())return this.convert({typeReference:t});if(this.context.usesOptionalNullable()){let r=t.type==="optional"||t.type==="nullable"?t.value:t;return d.Type.generic(this.context.getOptionalNullableClassReference(),[this.convert({typeReference:r})])}return d.Type.optional(this.convert({typeReference:t}))}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 Er="path/to/file",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:$(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return this.context.shouldInlineFileProperties()?this.context.getJavaIoFileFromString(r??Er):r==null?this.getMissingFileArgument(e):d.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});if(this.context.shouldInlineFileProperties()){let a=r?.[0]??Er;return this.context.getJavaIoFileFromString(a)}if(r==null||r.length===0)return this.getMissingFileArgument(e);for(let a of r)return d.TypeLiteral.reference(this.context.getFileStreamFromString(a));return d.TypeLiteral.nop()}getMissingFileArgument(e){switch(e.isOptional){case!0:return d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));case!1:return this.context.getJavaIoFileFromString(Er);default: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 Cu=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch"]),Eu=new Set(["getClass","notify","notifyAll","wait"]),ir=class n extends Bt{constructor({ir:t,config:r,options:a,sharedCustomConfig:o,inlineTypeIds:l}){super({ir:t,config:r,options:a});R(this,"ir");R(this,"customConfig");R(this,"dynamicTypeMapper");R(this,"dynamicTypeLiteralMapper");R(this,"filePropertyMapper");R(this,"inlineTypeIds");this.ir=t,this.customConfig=o??_r.parse(r.customConfig??{}),this.dynamicTypeMapper=new nr({context:this}),this.dynamicTypeLiteralMapper=new rr({context:this}),this.filePropertyMapper=new ar({context:this}),this.inlineTypeIds=l??new Set}clone(){return new n({ir:this.ir,config:this.config,options:this.options,sharedCustomConfig:this.customConfig,inlineTypeIds:this.inlineTypeIds})}isInlineType(t){return this.inlineTypeIds.has(t)}getNestedInlineClassReference({enclosing:t,name:r}){return d.classReference({name:r,packageName:t.packageName,enclosingClasses:[...t.enclosingClasses,t.name]})}wrappedAliases(){return this.customConfig?.["wrapped-aliases"]??!1}enableInlineTypes(){return this.customConfig?.["enable-inline-types"]??!1}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.getRootClientClassNameForSnippets(),packageName:this.getRootPackageName()})}getRootClientClassName(){return this.customConfig?.["client-class-name"]??`${this.getBaseNamePrefix()}Client`}getRootClientClassNameForSnippets(){return this.customConfig?.["exported-client-class-name"]??this.getRootClientClassName()}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("(new "),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getJavaIoFileFromString(t){return d.TypeLiteral.reference(d.codeblock(r=>{r.write("new "),r.writeNode(this.getJavaIoFileClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(")")}))}getJavaIoFileClassReference(){return d.classReference({name:"File",packageName:"java.io"})}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=[],l=[];for(let p of t)this.isOptional(p.typeReference)?l.push(p):o.push(p);return o.sort((p,g)=>(a.get(p.name.wireValue)??0)-(a.get(g.name.wireValue)??0)),[...o,...l]}associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}){let o=super.associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}),l=new Map;for(let g of o)l.set(g.name.wireValue,g);let p=[];for(let g of t){let v=l.get(g.name.wireValue);v!=null&&p.push(v)}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}usesNullableAnnotation(){return this.customConfig?.["use-nullable-annotation"]===!0}usesOptionalNullable(){return this.customConfig?.["collapse-optional-nullable"]===!0}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:Cr(a)).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return Cu.has(t)}isReservedMethodName(t){return Eu.has(t)}};m();y();h();var Si="com.example.usage",Au="Example",Su="main",Lu="args",Li="client",Bu={type:"primitive",value:"STRING"};function Ar(n){let e=n;for(;e.type==="optional"||e.type==="nullable";)e=e.value;return e}function Pu(n){if(n.type==="optional"&&n.value.type==="list"){let e=n.value.value,t=Ar(e);return t===e?n:{type:"optional",value:{type:"list",value:t}}}if(n.type==="list"){let e=Ar(n.value);return e===n.value?n:{type:"list",value:e}}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??Si,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??Si,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(l=>{l.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),l.newLine(),l.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(` ${Li} = `),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 l=this.getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t});for(let p of l)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??Au,access:d.Access.Public}),o=d.parameter({name:Lu,type:d.Type.array(d.Type.string())});return a.addMethod(d.method({name:Su,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:q.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:q.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:q.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:q.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:Bu,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:q.Critical,message:e})}addWarning(e){this.context.errors.add({severity:q.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){let r=e,a=!!r.usernameOmit,o=!!r.passwordOmit,l=[];return a||l.push(`"${t.username}"`),o||l.push(`"${t.password}"`),l.length===0?[]:[{name:"credentials",value:d.TypeLiteral.raw(l.join(", "))}]}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],l=this.getRootClientHeaderArg({header:a,value:o});l!=null&&r.push({name:this.context.getMethodName(a.name.name),value:l})}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(Li),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(l=>l.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(l=>l.value)),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody),e.body!=null&&!this.callOmitsRequestBody({request:e,snippet:t})&&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}callOmitsRequestBody({request:e,snippet:t}){if(this.context.customConfig?.["respect-optional-request-body"]!==!0||e.bodyRequired!==!1)return!1;let r=t.requestBody;return r==null||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0}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});if(o.includes("Optional.empty()")||o.includes("OptionalNullable.absent()"))return a;let l=this.context.dynamicTypeLiteralMapper.convert({typeReference:Ar(e.value),value:t,as:"request"});return r?this.context.getOptionalNullableOf(l):d.TypeLiteral.optional({value:l,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:q.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 l=[],p=(e.pathParameters??[]).filter(v=>v.variable==null);p.length>0&&l.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(...l.map(v=>v.value)),o||r.push(...g.fileFields.map(v=>d.TypeLiteral.isNop(v.value)?d.TypeLiteral.raw("null"):v.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?l:[],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 l=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).filter(j=>!this.context.isDirectLiteral(j.typeReference)),g=this.context.sortTypeInstancesByRequiredFirst(l,e.queryParameters??[]).map(j=>({name:this.context.getMethodName(j.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Pu(j.typeReference),value:j.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.Headers);let N=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).filter(j=>!this.context.isDirectLiteral(j.typeReference)),G=this.context.sortTypeInstancesByRequiredFirst(N,e.headers??[]).map(j=>({name:this.context.getMethodName(j.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:j.typeReference,value:j.value,as:"request"})}));this.context.errors.unscope();let A=d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)});this.context.errors.scope(se.RequestBody);let O=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a,enclosing:A}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:A,parameters:[...r,...G,...g,...O]})}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()}),l=d.invokeMethod({on:o,method:"builder",arguments_:[]});for(let g of a)l=d.invokeMethod({on:l,method:"addHeader",arguments_:[d.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let p=d.invokeMethod({on:l,method:"build",arguments_:[]});return d.TypeLiteral.reference(p)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r,enclosing:a}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t,enclosing:a});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.bodyPropertyFields,...e.fileFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:e.bodyType.type==="typeReference"?t??{}: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,enclosing:r}){let o=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}}).filter(v=>!this.context.isDirectLiteral(v.typeReference)),l=this.context.sortTypeInstancesByRequiredFirst(o,e),p=new Set([...r.enclosingClasses,r.name]),g=new Set(e.map(v=>this.context.getClassName(v.name.name)));return l.map(v=>({name:this.context.getMethodName(v.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:v.typeReference,value:v.value,as:"request",nestedClassReference:this.context.dynamicTypeLiteralMapper.resolveInlineNestedClassReference({enclosing:r,baseName:this.context.getClassName(v.name.name),typeReference:v.typeReference,reservedNames:p,siblingPropertyNames:g})})}))}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{},ignoreMissingParameters:!0});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 Sr=class extends At{constructor({ir:e,config:t,options:r={},inlineTypeIds:a}){super(new ir({ir:e,config:t,options:r,inlineTypeIds:a}))}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{Sr as DynamicSnippetsGenerator};
22
+ `)}};m();y();h();m();y();h();var S={};cr(S,{BRAND:()=>hl,DIRTY:()=>$e,EMPTY_PATH:()=>Go,INVALID:()=>L,NEVER:()=>Xl,OK:()=>re,ParseStatus:()=>ee,Schema:()=>M,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:()=>He,ZodIssueCode:()=>b,ZodLazy:()=>Ye,ZodLiteral:()=>Ke,ZodMap:()=>vt,ZodNaN:()=>bt,ZodNativeEnum:()=>Xe,ZodNever:()=>he,ZodNull:()=>Ge,ZodNullable:()=>we,ZodNumber:()=>Ve,ZodObject:()=>le,ZodOptional:()=>pe,ZodParsedType:()=>C,ZodPipeline:()=>jt,ZodPromise:()=>Pe,ZodReadonly:()=>rt,ZodRecord:()=>Kt,ZodSchema:()=>M,ZodSet:()=>wt,ZodString:()=>Le,ZodSymbol:()=>gt,ZodTransformer:()=>fe,ZodTuple:()=>ve,ZodType:()=>M,ZodUndefined:()=>Ze,ZodUnion:()=>Je,ZodUnknown:()=>Ne,ZodVoid:()=>xt,addIssueToContext:()=>I,any:()=>_l,array:()=>Cl,bigint:()=>vl,boolean:()=>Ii,coerce:()=>Ql,custom:()=>_i,date:()=>wl,datetimeRegex:()=>Ti,defaultErrorMap:()=>_e,discriminatedUnion:()=>Ll,effect:()=>Wl,enum:()=>$l,function:()=>Ul,getErrorMap:()=>mt,getParsedType:()=>xe,instanceof:()=>gl,intersection:()=>Bl,isAborted:()=>Jt,isAsync:()=>ht,isDirty:()=>Ht,isValid:()=>Se,late:()=>yl,lazy:()=>Ml,literal:()=>Dl,makeIssue:()=>Ft,map:()=>Ol,nan:()=>xl,nativeEnum:()=>Vl,never:()=>Nl,null:()=>Rl,nullable:()=>Zl,number:()=>Ni,object:()=>Al,objectUtil:()=>br,oboolean:()=>Kl,onumber:()=>Yl,optional:()=>zl,ostring:()=>Hl,pipeline:()=>Jl,preprocess:()=>Gl,promise:()=>ql,quotelessJson:()=>Wo,record:()=>Fl,set:()=>jl,setErrorMap:()=>Zo,strictObject:()=>El,string:()=>ki,symbol:()=>bl,transformer:()=>Wl,tuple:()=>Pl,undefined:()=>Tl,union:()=>Sl,unknown:()=>kl,util:()=>V,void:()=>Il});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 l of a)o[l]=l;return o},n.getValidEnumValues=a=>{let o=n.objectKeys(a).filter(p=>typeof a[a[p]]!="number"),l={};for(let p of o)l[p]=a[p];return n.objectValues(l)},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 l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},n.find=(a,o)=>{for(let l of a)if(o(l))return l},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(l=>typeof l=="string"?`'${l}'`:l).join(o)}n.joinValues=r,n.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(V||(V={}));var br;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(br||(br={}));var C=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 C.undefined;case"string":return C.string;case"number":return Number.isNaN(n)?C.nan:C.number;case"boolean":return C.boolean;case"function":return C.function;case"bigint":return C.bigint;case"symbol":return C.symbol;case"object":return Array.isArray(n)?C.array:n===null?C.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?C.promise:typeof Map<"u"&&n instanceof Map?C.map:typeof Set<"u"&&n instanceof Set?C.set:typeof Date<"u"&&n instanceof Date?C.date:C.object;default:return C.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"]),Wo=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 l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)r._errors.push(t(l));else{let p=r,g=0;for(;g<l.path.length;){let v=l.path[g];g===l.path.length-1?(p[v]=p[v]||{_errors:[]},p[v]._errors.push(t(l))):p[v]=p[v]||{_errors:[]},p=p[v],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 zo=(n,e)=>{let t;switch(n.code){case b.invalid_type:n.received===C.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}},_e=zo;var gi=_e;function Zo(n){gi=n}function mt(){return gi}m();y();h();var Ft=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,o=[...t,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let p="",g=r.filter(v=>!!v).slice().reverse();for(let v of g)p=v(l,{data:e,defaultError:p}).message;return{...a,path:o,message:p}},Go=[];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===_e?void 0:_e].filter(a=>!!a)});n.common.issues.push(r)}var ee=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,l=await a.value;r.push({key:o,value:l})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return L;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(r[o.value]=l.value)}return{status:e.value,value:r}}},L=Object.freeze({status:"aborted"}),$e=n=>({status:"dirty",value:n}),re=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 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}},xi=(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 U(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:(l,p)=>{let{message:g}=n;return l.code==="invalid_enum_value"?{message:g??p.defaultError}:typeof p.data>"u"?{message:g??r??p.defaultError}:l.code!=="invalid_type"?{message:p.defaultError}:{message:g??t??p.defaultError}},description:a}}var M=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 ee,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 xi(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 xi(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 l=e(a),p=()=>o.addIssue({code:b.custom,...r(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(g=>g?!0:(p(),!1)):l?!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 Je.create([this,e],this._def)}and(e){return He.create(this,e,this._def)}transform(e){return new fe({...U(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...U(this._def),innerType:this,defaultValue:t,typeName:P.ZodDefault})}brand(){return new Ot({typeName:P.ZodBranded,type:this,...U(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...U(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 jt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Jo=/^c[^\s-]{8,}$/i,Ho=/^[0-9a-z]+$/,Yo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ko=/^[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,Qo=/^[a-z0-9_-]{21}$/i,Xo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,el=/^[-+]?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)?)??$/,tl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tr,nl=/^(?:(?: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])$/,al=/^(?:(?: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])$/,il=/^(([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]))$/,sl=/^(([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])$/,ol=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ll=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wi="((\\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])))",ul=new RegExp(`^${wi}$`);function bi(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 cl(n){return new RegExp(`^${bi(n)}$`)}function Ti(n){let e=`${wi}T${bi(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 pl(n,e){return!!((e==="v4"||!e)&&nl.test(n)||(e==="v6"||!e)&&il.test(n))}function dl(n,e){if(!Xo.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 fl(n,e){return!!((e==="v4"||!e)&&al.test(n)||(e==="v6"||!e)&&sl.test(n))}var Le=class n extends M{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==C.string){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.string,received:o.parsedType}),L}let r=new ee,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 l=e.data.length>o.value,p=e.data.length<o.value;(l||p)&&(a=this._getOrReturnCtx(e,a),l?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")tl.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")Tr||(Tr=new RegExp(rl,"u")),Tr.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")Ko.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")Qo.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")Jo.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")Ho.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")Yo.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"?Ti(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"?ul.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?cl(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"?el.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?pl(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"?dl(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"?fl(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"?ol.test(e.data)||(a=this._getOrReturnCtx(e,a),I(a,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?ll.test(e.data)||(a=this._getOrReturnCtx(e,a),I(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,...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,...U(n)});function ml(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(".","")),l=Number.parseInt(e.toFixed(a).replace(".",""));return o%l/10**a}var Ve=class n extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==C.number){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.number,received:o.parsedType}),L}let r,a=new ee;for(let o of this._def.checks)o.kind==="int"?V.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"?ml(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()):V.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"&&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)}};Ve.create=n=>new Ve({checks:[],typeName:P.ZodNumber,coerce:n?.coerce||!1,...U(n)});var qe=class n extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==C.bigint)return this._getInvalidInput(e);let r,a=new ee;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()):V.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:C.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,...U(n)});var We=class extends M{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==C.boolean){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.boolean,received:r.parsedType}),L}return re(e.data)}};We.create=n=>new We({typeName:P.ZodBoolean,coerce:n?.coerce||!1,...U(n)});var ze=class n extends M{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==C.date){let o=this._getOrReturnCtx(e);return I(o,{code:b.invalid_type,expected:C.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 ee,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()):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: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,...U(n)});var gt=class extends M{_parse(e){if(this._getType(e)!==C.symbol){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.symbol,received:r.parsedType}),L}return re(e.data)}};gt.create=n=>new gt({typeName:P.ZodSymbol,...U(n)});var Ze=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.undefined,received:r.parsedType}),L}return re(e.data)}};Ze.create=n=>new Ze({typeName:P.ZodUndefined,...U(n)});var Ge=class extends M{_parse(e){if(this._getType(e)!==C.null){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.null,received:r.parsedType}),L}return re(e.data)}};Ge.create=n=>new Ge({typeName:P.ZodNull,...U(n)});var Be=class extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return re(e.data)}};Be.create=n=>new Be({typeName:P.ZodAny,...U(n)});var Ne=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return re(e.data)}};Ne.create=n=>new Ne({typeName:P.ZodUnknown,...U(n)});var he=class extends M{_parse(e){let t=this._getOrReturnCtx(e);return I(t,{code:b.invalid_type,expected:C.never,received:t.parsedType}),L}};he.create=n=>new he({typeName:P.ZodNever,...U(n)});var xt=class extends M{_parse(e){if(this._getType(e)!==C.undefined){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.void,received:r.parsedType}),L}return re(e.data)}};xt.create=n=>new xt({typeName:P.ZodVoid,...U(n)});var Ie=class n extends M{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==C.array)return I(t,{code:b.invalid_type,expected:C.array,received:t.parsedType}),L;if(a.exactLength!==null){let l=t.data.length>a.exactLength.value,p=t.data.length<a.exactLength.value;(l||p)&&(I(t,{code:l?b.too_big:b.too_small,minimum:p?a.exactLength.value:void 0,maximum:l?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((l,p)=>a.type._parseAsync(new de(t,l,t.path,p)))).then(l=>ee.mergeArray(r,l));let o=[...t.data].map((l,p)=>a.type._parseSync(new de(t,l,t.path,p)));return ee.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,...U(e)});function yt(n){if(n instanceof le){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=pe.create(yt(r))}return new le({...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 le=class n extends M{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)!==C.object){let v=this._getOrReturnCtx(e);return I(v,{code:b.invalid_type,expected:C.object,received:v.parsedType}),L}let{status:r,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),p=[];if(!(this._def.catchall instanceof he&&this._def.unknownKeys==="strip"))for(let v in a.data)l.includes(v)||p.push(v);let g=[];for(let v of l){let N=o[v],F=a.data[v];g.push({key:{status:"valid",value:v},value:N._parse(new de(a,F,a.path,v)),alwaysSet:v in a.data})}if(this._def.catchall instanceof he){let v=this._def.unknownKeys;if(v==="passthrough")for(let N of p)g.push({key:{status:"valid",value:N},value:{status:"valid",value:a.data[N]}});else if(v==="strict")p.length>0&&(I(a,{code:b.unrecognized_keys,keys:p}),r.dirty());else if(v!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let v=this._def.catchall;for(let N of p){let F=a.data[N];g.push({key:{status:"valid",value:N},value:v._parse(new de(a,F,a.path,N)),alwaysSet:N in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let v=[];for(let N of g){let F=await N.key,G=await N.value;v.push({key:F,value:G,alwaysSet:N.alwaysSet})}return v}).then(v=>ee.mergeObjectSync(r,v)):ee.mergeObjectSync(r,g)}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 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 Ri(V.objectKeys(this.shape))}};le.create=(n,e)=>new le({shape:()=>n,unknownKeys:"strip",catchall:he.create(),typeName:P.ZodObject,...U(e)});le.strictCreate=(n,e)=>new le({shape:()=>n,unknownKeys:"strict",catchall:he.create(),typeName:P.ZodObject,...U(e)});le.lazycreate=(n,e)=>new le({shape:n,unknownKeys:"strip",catchall:he.create(),typeName:P.ZodObject,...U(e)});var Je=class extends M{_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 l=o.map(p=>new oe(p.ctx.common.issues));return I(t,{code:b.invalid_union,unionErrors:l}),L}if(t.common.async)return Promise.all(r.map(async o=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(a);{let o,l=[];for(let g of r){let v={...t,common:{...t.common,issues:[]},parent:null},N=g._parseSync({data:t.data,path:t.path,parent:v});if(N.status==="valid")return N;N.status==="dirty"&&!o&&(o={result:N,ctx:v}),v.common.issues.length&&l.push(v.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let p=l.map(g=>new oe(g));return I(t,{code:b.invalid_union,unionErrors:p}),L}}get options(){return this._def.options}};Je.create=(n,e)=>new Je({options:n,typeName:P.ZodUnion,...U(e)});var ke=n=>n instanceof Ye?ke(n.schema):n instanceof fe?ke(n.innerType()):n instanceof Ke?[n.value]:n instanceof Qe?n.options:n instanceof Xe?V.objectValues(n.enum):n instanceof et?ke(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof pe?[void 0,...ke(n.unwrap())]:n instanceof we?[null,...ke(n.unwrap())]:n instanceof Ot||n instanceof rt?ke(n.unwrap()):n instanceof tt?ke(n._def.innerType):[],Yt=class n extends M{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.object)return I(t,{code:b.invalid_type,expected:C.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 l=ke(o.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let p of l){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,...U(r)})}};function Rr(n,e){let t=xe(n),r=xe(e);if(n===e)return{valid:!0,data:n};if(t===C.object&&r===C.object){let a=V.objectKeys(e),o=V.objectKeys(n).filter(p=>a.indexOf(p)!==-1),l={...n,...e};for(let p of o){let g=Rr(n[p],e[p]);if(!g.valid)return{valid:!1};l[p]=g.data}return{valid:!0,data:l}}else if(t===C.array&&r===C.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let o=0;o<n.length;o++){let l=n[o],p=e[o],g=Rr(l,p);if(!g.valid)return{valid:!1};a.push(g.data)}return{valid:!0,data:a}}else return t===C.date&&r===C.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var He=class extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(o,l)=>{if(Jt(o)||Jt(l))return L;let p=Rr(o.value,l.value);return p.valid?((Ht(o)||Ht(l))&&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,l])=>a(o,l)):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:P.ZodIntersection,...U(t)});var ve=class n extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.array)return I(r,{code:b.invalid_type,expected:C.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((l,p)=>{let g=this._def.items[p]||this._def.rest;return g?g._parse(new de(r,l,r.path,p)):null}).filter(l=>!!l);return r.common.async?Promise.all(o).then(l=>ee.mergeArray(t,l)):ee.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,...U(e)})};var Kt=class n extends M{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!==C.object)return I(r,{code:b.invalid_type,expected:C.object,received:r.parsedType}),L;let a=[],o=this._def.keyType,l=this._def.valueType;for(let p in r.data)a.push({key:o._parse(new de(r,p,r.path,p)),value:l._parse(new de(r,r.data[p],r.path,p)),alwaysSet:p in r.data});return r.common.async?ee.mergeObjectAsync(t,a):ee.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof M?new n({keyType:e,valueType:t,typeName:P.ZodRecord,...U(r)}):new n({keyType:Le.create(),valueType:e,typeName:P.ZodRecord,...U(t)})}},vt=class extends M{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!==C.map)return I(r,{code:b.invalid_type,expected:C.map,received:r.parsedType}),L;let a=this._def.keyType,o=this._def.valueType,l=[...r.data.entries()].map(([p,g],v)=>({key:a._parse(new de(r,p,r.path,[v,"key"])),value:o._parse(new de(r,g,r.path,[v,"value"]))}));if(r.common.async){let p=new Map;return Promise.resolve().then(async()=>{for(let g of l){let v=await g.key,N=await g.value;if(v.status==="aborted"||N.status==="aborted")return L;(v.status==="dirty"||N.status==="dirty")&&t.dirty(),p.set(v.value,N.value)}return{status:t.value,value:p}})}else{let p=new Map;for(let g of l){let v=g.key,N=g.value;if(v.status==="aborted"||N.status==="aborted")return L;(v.status==="dirty"||N.status==="dirty")&&t.dirty(),p.set(v.value,N.value)}return{status:t.value,value:p}}}};vt.create=(n,e,t)=>new vt({valueType:e,keyType:n,typeName:P.ZodMap,...U(t)});var wt=class n extends M{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==C.set)return I(r,{code:b.invalid_type,expected:C.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 l(g){let v=new Set;for(let N of g){if(N.status==="aborted")return L;N.status==="dirty"&&t.dirty(),v.add(N.value)}return{status:t.value,value:v}}let p=[...r.data.values()].map((g,v)=>o._parse(new de(r,g,r.path,v)));return r.common.async?Promise.all(p).then(g=>l(g)):l(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,...U(e)});var Qt=class n extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.function)return I(t,{code:b.invalid_type,expected:C.function,received:t.parsedType}),L;function r(p,g){return Ft({data:p,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),_e].filter(v=>!!v),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(),_e].filter(v=>!!v),issueData:{code:b.invalid_return_type,returnTypeError:g}})}let o={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof Pe){let p=this;return re(async function(...g){let v=new oe([]),N=await p._def.args.parseAsync(g,o).catch(E=>{throw v.addIssue(r(g,E)),v}),F=await Reflect.apply(l,this,N);return await p._def.returns._def.type.parseAsync(F,o).catch(E=>{throw v.addIssue(a(F,E)),v})})}else{let p=this;return re(function(...g){let v=p._def.args.safeParse(g,o);if(!v.success)throw new oe([r(g,v.error)]);let N=Reflect.apply(l,this,v.data),F=p._def.returns.safeParse(N,o);if(!F.success)throw new oe([a(N,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(Ne.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(Ne.create()),returns:t||Ne.create(),typeName:P.ZodFunction,...U(r)})}},Ye=class extends M{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,...U(e)});var Ke=class extends M{_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,...U(e)});function Ri(n,e){return new Qe({values:n,typeName:P.ZodEnum,...U(e)})}var Qe=class n extends M{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return I(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 I(t,{received:t.data,code:b.invalid_enum_value,options:r}),L}return re(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=Ri;var Xe=class extends M{_parse(e){let t=V.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==C.string&&r.parsedType!==C.number){let a=V.objectValues(t);return I(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 I(r,{received:r.data,code:b.invalid_enum_value,options:a}),L}return re(e.data)}get enum(){return this._def.values}};Xe.create=(n,e)=>new Xe({values:n,typeName:P.ZodNativeEnum,...U(e)});var Pe=class extends M{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==C.promise&&t.common.async===!1)return I(t,{code:b.invalid_type,expected:C.promise,received:t.parsedType}),L;let r=t.parsedType===C.promise?t.data:Promise.resolve(t.data);return re(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,...U(e)});var fe=class extends M{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:l=>{I(r,l),l.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){let l=a.transform(r.data,o);if(r.common.async)return Promise.resolve(l).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"?$e(g.value):t.value==="dirty"?$e(g.value):g});{if(t.value==="aborted")return L;let p=this._def.schema._parseSync({data:l,path:r.path,parent:r});return p.status==="aborted"?L:p.status==="dirty"?$e(p.value):t.value==="dirty"?$e(p.value):p}}if(a.type==="refinement"){let l=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(),l(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(),l(p.value).then(()=>({status:t.value,value:p.value}))))}if(a.type==="transform")if(r.common.async===!1){let l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Se(l))return L;let p=a.transform(l.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(l=>Se(l)?Promise.resolve(a.transform(l.value,o)).then(p=>({status:t.value,value:p})):L);V.assertNever(a)}};fe.create=(n,e,t)=>new fe({schema:n,typeName:P.ZodEffects,effect:e,...U(t)});fe.createWithPreprocess=(n,e,t)=>new fe({schema:e,effect:{type:"preprocess",transform:n},typeName:P.ZodEffects,...U(t)});var pe=class extends M{_parse(e){return this._getType(e)===C.undefined?re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pe.create=(n,e)=>new pe({innerType:n,typeName:P.ZodOptional,...U(e)});var we=class extends M{_parse(e){return this._getType(e)===C.null?re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.create=(n,e)=>new we({innerType:n,typeName:P.ZodNullable,...U(e)});var et=class extends M{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===C.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,...U(e)});var tt=class extends M{_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,...U(e)});var bt=class extends M{_parse(e){if(this._getType(e)!==C.nan){let r=this._getOrReturnCtx(e);return I(r,{code:b.invalid_type,expected:C.nan,received:r.parsedType}),L}return{status:"valid",value:e.data}}};bt.create=n=>new bt({typeName:P.ZodNaN,...U(n)});var hl=Symbol("zod_brand"),Ot=class extends M{_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}},jt=class n extends M{_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(),$e(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 M{_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,...U(e)});function vi(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function _i(n,e={},t){return n?Be.create().superRefine((r,a)=>{let o=n(r);if(o instanceof Promise)return o.then(l=>{if(!l){let p=vi(e,r),g=p.fatal??t??!0;a.addIssue({code:"custom",...p,fatal:g})}});if(!o){let l=vi(e,r),p=l.fatal??t??!0;a.addIssue({code:"custom",...l,fatal:p})}}):Be.create()}var yl={object:le.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 gl=(n,e={message:`Input not instance of ${n.name}`})=>_i(t=>t instanceof n,e),ki=Le.create,Ni=Ve.create,xl=bt.create,vl=qe.create,Ii=We.create,wl=ze.create,bl=gt.create,Tl=Ze.create,Rl=Ge.create,_l=Be.create,kl=Ne.create,Nl=he.create,Il=xt.create,Cl=Ie.create,Al=le.create,El=le.strictCreate,Sl=Je.create,Ll=Yt.create,Bl=He.create,Pl=ve.create,Fl=Kt.create,Ol=vt.create,jl=wt.create,Ul=Qt.create,Ml=Ye.create,Dl=Ke.create,$l=Qe.create,Vl=Xe.create,ql=Pe.create,Wl=fe.create,zl=pe.create,Zl=we.create,Gl=fe.createWithPreprocess,Jl=jt.create,Hl=()=>ki().optional(),Yl=()=>Ni().optional(),Kl=()=>Ii().optional(),Ql={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 Xl=L;m();y();h();var Ci=S.strictObject({title:S.string(),content:S.string()});var _r=S.object({"base-api-exception-class-name":S.string().optional(),"base-exception-class-name":S.string().optional(),"client-class-name":S.string().optional(),"exported-client-class-name":S.string().optional(),"inline-file-properties":S.boolean().optional(),"inline-path-parameters":S.boolean().optional(),"package-layout":S.enum(["flat","nested"]).optional(),"package-prefix":S.string().optional(),"respect-optional-request-body":S.boolean().optional(),"legacy-input-stream-upload-overloads":S.boolean().optional(),"use-local-date-for-dates":S.boolean().optional(),"custom-dependencies":S.array(S.string()).optional(),"custom-plugins":S.array(S.string()).optional(),"disable-required-property-builder-checks":S.boolean().optional(),"enable-forward-compatible-enums":S.boolean().optional(),"enable-inline-types":S.boolean().optional(),"enable-public-constructors":S.boolean().optional(),"generate-unknown-as-json-node":S.boolean().optional(),"json-include":S.enum(["non-absent","non-empty"]).optional(),"enable-extensible-builders":S.boolean().optional(),"use-default-request-parameter-values":S.boolean().optional(),"enable-wire-tests":S.boolean().default(!1),"wire-tests-fallback-to-autogenerated-error-examples":S.boolean().optional(),"collapse-optional-nullable":S.boolean().optional(),"use-nullable-annotation":S.boolean().optional(),"custom-readme-sections":S.array(Ci).optional(),"custom-pager-name":S.string().optional(),"offset-semantics":S.enum(["item-index","page-index"]).optional(),"default-timeout-in-seconds":S.number().optional(),"gradle-distribution-url":S.string().optional(),"gradle-plugin-management":S.string().optional(),"gradle-central-dependency-management":S.boolean().optional(),"output-directory":S.enum(["source-root","project-root"]).optional(),"custom-interceptors":S.boolean().optional(),"omit-fern-headers":S.boolean().optional(),includePlatformHeaders:S.boolean().optional(),userAgentOnly:S.boolean().optional(),"retry-status-codes":S.optional(S.enum(["legacy","recommended"])),"enable-gradle-profiling":S.boolean().optional(),"wrapped-aliases":S.boolean().optional(),maxRetries:S.number().int().min(0).optional()});var d={};cr(d,{Access:()=>kr,AstNode:()=>Y,Class:()=>nt,ClassInstantiation:()=>at,ClassReference:()=>W,CodeBlock:()=>it,Method:()=>st,MethodInvocation:()=>ot,Parameter:()=>lt,Type:()=>Ut,TypeLiteral:()=>ue,Writer:()=>De,classReference:()=>Tu,class_:()=>bu,codeblock:()=>wu,instantiateClass:()=>Ru,invokeMethod:()=>_u,method:()=>ku,parameter:()=>Nu});m();y();h();m();y();h();m();y();h();var Y=class extends Ue{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 Y{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 kr={Public:"public",Protected:"protected",Private:"private"};m();y();h();m();y();h();m();y();h();m();y();h();var W=class extends Y{constructor({name:t,packageName:r,fullyQualified:a,enclosingClasses:o}){super();R(this,"name");R(this,"packageName");R(this,"fullyQualified");R(this,"enclosingClasses");this.name=t,this.packageName=r,this.fullyQualified=a??!1,this.enclosingClasses=o??[]}write(t){let r=this.enclosingClasses[0]??this.name,a=[...this.enclosingClasses,this.name].join(".");if(this.fullyQualified){t.write(`${this.packageName}.${a}`);return}let{shouldFullyQualify:o}=t.addReference({name:r,packageName:this.packageName});if(o){t.write(`${this.packageName}.${a}`);return}t.write(a)}};m();y();h();var Ut=class extends Y{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(eu);break;case"boolean":t.write("Boolean");break;case"bytes":t.write("byte[]");break;case"date":t.customConfig?.["use-local-date-for-dates"]===!0?t.writeNode(nu):t.write("String");break;case"dateTime":t.writeNode(au);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(ou);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(su);break;case"void":t.write("Void");break;default:D(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(tu),t.write("<"),r.value.write(t),t.write(">")}writeMap({writer:t,map:r}){t.writeNode(ru),t.write("<"),r.keyType.write(t),t.write(", "),r.valueType.write(t),t.write(">")}writeOptional({writer:t,optional:r}){t.writeNode(Nr),t.write("<"),r.value.write(t),t.write(">")}writeIterable({writer:t,iterable:r}){t.writeNode(lu),t.write("<"),r.value.write(t),t.write(">")}writeSet({writer:t,set:r}){t.writeNode(iu),t.write("<"),r.value.write(t),t.write(">")}static isAlreadyOptional(t){return t.internalType.type==="optional"}},Xt=new W({name:"Arrays",packageName:"java.util"}),eu=new W({name:"BigInteger",packageName:"java.math"}),mg=new W({name:"HashMap",packageName:"java.util"}),tu=new W({name:"List",packageName:"java.util"}),ru=new W({name:"Map",packageName:"java.util"}),nu=new W({name:"LocalDate",packageName:"java.time"}),au=new W({name:"OffsetDateTime",packageName:"java.time"}),Nr=new W({name:"Optional",packageName:"java.util"}),iu=new W({name:"Set",packageName:"java.util"}),su=new W({name:"UUID",packageName:"java.util"}),ou=new W({name:"InputStream",packageName:"java.io"}),lu=new W({name:"Iterable",packageName:"java.lang"});var ue=class n extends Y{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 Y?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:D(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:D(this.internalType)}}writeBigInteger({writer:t,bigInteger:r}){t.write("new "),t.writeNode(d.instantiateClass({classReference:uu,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(hu({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=>this.isRequiredBuilderParameter(a))?t.sort((a,o)=>{let l=!this.isRequiredBuilderParameter(a),p=!this.isRequiredBuilderParameter(o);return l&&!p?1:!l&&p?-1:0}):t.sort((a,o)=>{let l=a.value.isOptional(),p=o.value.isOptional();return l&&!p?1:!l&&p?-1:0})}isCollection(t){let r=t.internalType.type;return r==="list"||r==="set"||r==="map"}isRequiredBuilderParameter(t){return t.isRequired!=null?t.isRequired:!this.isNonRequired(t.value)}isNonRequired(t){return t.isOptional()||this.isCollection(t)}writeClass({writer:t,class_:r}){let a=mu({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:pu,method:"parse",arguments_:[n.string(r.value)]}))}writeDateTime({writer:t,dateTime:r}){t.writeNode(d.invokeMethod({on:du,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=yu({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:Nr,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"?Ir:cu,o=gu({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(Ir),t.write("<Object>()");return}t.write("new "),t.writeNode(Ir),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,l]of a)t.write(`put("${o}", `),t.writeNode(n.unknown(l)),t.writeLine(");");t.dedent(),t.write("}}")}writeUUID({writer:t,uuid:r}){t.writeNode(d.invokeMethod({on:fu,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"}},Ir=new W({name:"ArrayList",packageName:"java.util"}),uu=new W({name:"BigInteger",packageName:"java.math"}),er=new W({name:"HashMap",packageName:"java.util"}),cu=new W({name:"HashSet",packageName:"java.util"}),kg=new W({name:"List",packageName:"java.util"}),pu=new W({name:"LocalDate",packageName:"java.time"}),Ng=new W({name:"Map",packageName:"java.util"}),du=new W({name:"OffsetDateTime",packageName:"java.time"}),Ig=new W({name:"Set",packageName:"java.util"}),fu=new W({name:"UUID",packageName:"java.util"});function mu({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function hu({parameters:n}){return n.filter(e=>!ue.isNop(e.value))}function yu({entries:n}){return n.filter(e=>!ue.isNop(e.key)&&!ue.isNop(e.value))}function gu({values:n}){return n.filter(e=>!ue.isNop(e))}function tr({writer:n,arguments_:e}){let t=vu(e);if(t.length===0){n.write("()");return}if(t.some(a=>a instanceof ue&&!a.shouldWriteInLine())){xu({writer:n,arguments_:t});return}n.write("("),t.forEach((a,o)=>{o>0&&n.write(", "),Ai({writer:n,argument:a})}),n.write(")")}function xu({writer:n,arguments_:e}){n.writeLine("("),n.indent(),e.forEach((t,r)=>{r>0&&n.writeLine(","),Ai({writer:n,argument:t})}),n.dedent(),e.length>0&&n.newLine(),n.write(")")}function Ai({writer:n,argument:e}){wr(e)?n.writeNodeOrString(e.assignment):e.write(n)}function vu(n){return n.filter(e=>!(e instanceof ue&&ue.isNop(e)))}var at=class extends Y{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 Y{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 Y{constructor({name:t,access:r,parameters:a,body:o,static_:l,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_=l??!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 Y{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 lt=class extends Y{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 wu(n){return new it(n)}function bu(n){return new nt(n)}function Tu(n){return new W(n)}function Ru(n){return new at(n)}function _u(n){return new ot(n)}function ku(n){return new st(n)}function Nu(n){return new lt(n)}m();y();h();var Iu=new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while","true","false","null","_"]);function Ei(n){return Iu.has(n.toLowerCase())}function Cr(n){return Ei(n)?"_"+n:n}m();y();h();var rr=class{constructor({context:e}){R(this,"context");R(this,"aliasDepth",0);this.context=e}usesOptionalNullable(){return this.context.usesOptionalNullable()}usesNullableAnnotation(){return this.context.usesNullableAnnotation()}wrapInOptionalIfNotNop(e,t=!1,r=!1){return d.TypeLiteral.isNop(e)?e:r?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:t})}wrapNullableOrOptionalValue({value:e,wrapperType:t,useOf:r,propagatedCollapse:a}){return d.TypeLiteral.isNop(e)||t==="nullable"&&this.usesNullableAnnotation()?e:a||this.usesOptionalNullable()&&t==="nullable"?this.context.getOptionalNullableOf(e):d.TypeLiteral.optional({value:e,useOf:r})}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?this.context.getNullableOfNull():(this.context.errors.add({severity:q.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,nestedClassReference:e.nestedClassReference});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,nestedClassReference:e.nestedClassReference});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,nestedClassReference:e.nestedClassReference})}case"nullable":case"optional":{let t=e.typeReference.type,r=e.typeReference.value;if((e.value===void 0||typeof e.value=="object"&&e.value!==null&&Object.keys(e.value).length===0&&r.type==="named")&&!(t==="nullable"&&this.usesNullableAnnotation()))return e.isCollapsedOptionalNullable||this.usesOptionalNullable()&&(t==="nullable"||r.type==="optional"||r.type==="nullable")?this.context.getOptionalNullableAbsent():d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));if(this.usesOptionalNullable()&&(r.type==="optional"||r.type==="nullable"))return this.convert({typeReference:r,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,isCollapsedOptionalNullable:!0,nestedClassReference:e.nestedClassReference});if(r.type==="list"){let l=this.convertList({list:r.value,value:e.value,nestedClassReference:e.nestedClassReference});return this.wrapNullableOrOptionalValue({value:l,wrapperType:t,useOf:!0,propagatedCollapse:e.isCollapsedOptionalNullable===!0})}let a=this.convert({typeReference:r,value:e.value,as:e.as,inUndiscriminatedUnion:e.inUndiscriminatedUnion,nestedClassReference:e.nestedClassReference}),o=e.as==="mapValue"||e.inUndiscriminatedUnion===!0;return this.wrapNullableOrOptionalValue({value:a,wrapperType:t,useOf:o,propagatedCollapse: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,nestedClassReference:e.nestedClassReference});case"unknown":return this.convertUnknown({value:e.value});default:D(e.typeReference)}}convertList({list:e,value:t,as:r,nestedClassReference:a}){if(!Array.isArray(t))return this.context.errors.add({severity:q.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop();let o=e.type==="optional"||e.type==="nullable";return d.TypeLiteral.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,withinAlias:this.aliasDepth>0}),values:t.map((l,p)=>{this.context.errors.scope({index:p});try{if(o&&(e.type==="optional"||e.type==="nullable")){let g=this.convert({typeReference:e.value,value:l,as:r,nestedClassReference:a});return this.wrapNullableOrOptionalValue({value:g,wrapperType:e.type,useOf:!0,propagatedCollapse:!1})}return this.convert({typeReference:e,value:l,as:r,nestedClassReference:a})}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:D(e)}}convertSet({set:e,value:t,as:r,nestedClassReference:a}){return Array.isArray(t)?d.TypeLiteral.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:e,withinAlias:this.aliasDepth>0}),values:t.map((o,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:e,value:o,as:r,nestedClassReference:a})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:q.Critical,message:`Expected array but got: ${typeof t}`}),d.TypeLiteral.nop())}convertMap({map:e,value:t,as:r,nestedClassReference:a}){return typeof t!="object"||t==null?(this.context.errors.add({severity:q.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,withinAlias:this.aliasDepth>0}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value,withinAlias:this.aliasDepth>0}),entries:Object.entries(t).map(([o,l])=>{this.context.errors.scope(o);try{return{key:this.convert({typeReference:e.key,value:o,as:"mapKey"}),value:this.convert({typeReference:e.value,value:l,as:"mapValue",nestedClassReference:a})}}finally{this.context.errors.unscope()}})})}convertNamed(e){if(e.named.type!=="alias")return this.convertNamedType(e);this.aliasDepth++;try{return this.convertNamedType(e)}finally{this.aliasDepth--}}convertNamedType({named:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o}){switch(e.type){case"alias":if(e.typeReference.type==="unknown"){let l=this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a});return d.TypeLiteral.reference(d.invokeMethod({on:o??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),method:"of",arguments_:[l]}))}return this.convert({typeReference:e.typeReference,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t,as:r,nestedClassReference:o});case"enum":return this.convertEnum({enum_:e,value:t,nestedClassReference:o});case"object":return this.convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t,as:r,nestedClassReference:o});default:D(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t,as:r,nestedClassReference:a}){let o=a??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),l=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:t});if(l==null)return d.TypeLiteral.nop();let p=l.singleDiscriminatedUnionType,g=new Set([...o.enclosingClasses,o.name]),v=new Set(Object.values(e.types).map(N=>this.context.getClassName(N.discriminantValue.name)));switch(p.type){case"samePropertiesAsObject":{let N=this.context.resolveNamedType({typeId:p.typeId});if(N==null)return d.TypeLiteral.nop();let F=this.resolveInlineNestedClassReference({enclosing:o,baseName:this.context.getClassName(p.discriminantValue.name),typeReference:{type:"named",value:p.typeId},reservedNames:g,siblingPropertyNames:v});return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[this.convertNamed({named:N,value:l.value,as:r,nestedClassReference:F})]}))}case"singleProperty":{let N=this.context.getRecord(l.value);if(N==null)return d.TypeLiteral.nop();try{this.context.errors.scope(p.discriminantValue.wireValue);let F="value",G=this.resolveInlineNestedClassReference({enclosing:o,baseName:this.context.getClassName(p.discriminantValue.name),typeReference:p.typeReference,reservedNames:g,siblingPropertyNames:v});return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[this.convert({typeReference:p.typeReference,value:N[F],as:r,nestedClassReference:G})]}))}finally{this.context.errors.unscope()}}case"noProperties":return d.TypeLiteral.reference(d.invokeMethod({on:o,method:this.context.getPropertyName(p.discriminantValue.name),arguments_:[]}));default:D(p)}}convertObject({object_:e,value:t,as:r,inUndiscriminatedUnion:a,nestedClassReference:o}){let l=o??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),p=this.context.getRecord(t)??{},g=this.context.associateByWireValue({parameters:e.properties,values:p}),v=new Set(g.map(B=>B.name.wireValue));for(let B of e.properties)if(!v.has(B.name.wireValue)&&!this.context.isOptional(B.typeReference)){if(a===!0)throw new Error(`Required property "${B.name.wireValue}" is missing from value`);let z=this.getDefaultValueForTypeReference(B.typeReference);z!==void 0&&g.push({name:B.name,typeReference:B.typeReference,value:z})}let N=new Map,F=new Set;e.properties.forEach((B,z)=>{N.set(B.name.wireValue,z),F.add(B.name.wireValue)}),g.sort((B,z)=>(N.get(B.name.wireValue)??0)-(N.get(z.name.wireValue)??0));let G=r==="request"?g.filter(B=>!this.context.isDirectLiteral(B.typeReference)):g,E=new Set([...l.enclosingClasses,l.name]),O=new Set(e.properties.map(B=>this.context.getClassName(B.name.name))),j=[];for(let B of G){this.context.errors.scope(B.name.wireValue);try{let z=this.convert({typeReference:B.typeReference,value:B.value,as:r,inUndiscriminatedUnion:a,nestedClassReference:this.resolveInlineNestedClassReference({enclosing:l,baseName:this.context.getClassName(B.name.name),typeReference:B.typeReference,reservedNames:E,siblingPropertyNames:O})});if(d.TypeLiteral.isNop(z)&&!this.context.isOptional(B.typeReference)){if(a===!0)throw new Error(`Required property "${B.name.wireValue}" could not be converted`);continue}j.push({name:this.context.getMethodName(B.name.name),value:z,isRequired:this.isStagedBuilderProperty(B.typeReference)})}finally{this.context.errors.unscope()}}for(let[B,z]of Object.entries(p))if(!F.has(B)&&z!==void 0){let H=this.convertToRawJavaLiteral(z);H!=null&&j.push({name:"additionalProperty",value:d.TypeLiteral.raw(`"${this.escapeJavaString(B)}", ${H}`),isRequired:!1})}return d.TypeLiteral.builder({classReference:l,parameters:j})}resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:r,reservedNames:a,siblingPropertyNames:o}){if(this.context.enableInlineTypes())switch(r.type){case"optional":case"nullable":return this.resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"list":case"set":return this.resolveInlineNestedClassReference({enclosing:e,baseName:`${t}Item`,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"map":return this.resolveInlineNestedClassReference({enclosing:e,baseName:`${t}Value`,typeReference:r.value,reservedNames:a,siblingPropertyNames:o});case"named":{let l=r.value,p=this.context.resolveNamedType({typeId:l});if(p==null)return;if(p.type==="alias"&&!this.context.wrappedAliases())return this.resolveInlineNestedClassReference({enclosing:e,baseName:t,typeReference:p.typeReference,reservedNames:a,siblingPropertyNames:o});if(!this.context.isInlineType(l))return;let g=t;for(;a.has(g)||o.has(g)&&g!==t;)g=`${g}_`;return a.add(g),this.context.getNestedInlineClassReference({enclosing:e,name:g})}case"primitive":case"literal":case"unknown":return;default:D(r)}}resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t,reservedNames:r,unionPrefix:a}){if(this.context.enableInlineTypes())switch(t.type){case"optional":case"nullable":case"list":case"set":return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t.value,reservedNames:r,unionPrefix:a});case"map":return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:t.value,reservedNames:r,unionPrefix:a});case"named":{let o=t.value,l=this.context.resolveNamedType({typeId:o});if(l==null)return;if(l.type==="alias"&&!this.context.wrappedAliases())return this.resolveUndiscriminatedInlineNestedClassReference({enclosing:e,typeReference:l.typeReference,reservedNames:r,unionPrefix:a});if(!this.context.isInlineType(o))return;let p=this.context.getClassName(l.declaration.name);for(p.startsWith(a)&&p!==a&&(p=p.substring(a.length));r.has(p);)p=`${p}_`;return this.context.getNestedInlineClassReference({enclosing:e,name:p})}case"primitive":case"literal":case"unknown":return;default:D(t)}}isStagedBuilderProperty(e){switch(e.type){case"optional":case"nullable":case"list":case"set":case"map":return!1;case"named":{let t=this.context.resolveNamedType({typeId:e.value});return t!=null&&t.type==="alias"?this.isStagedBuilderProperty(t.typeReference):!0}default:return!0}}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:D(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,nestedClassReference:r}){let a=this.getEnumValueName({enum_:e,value:t});return a==null?d.TypeLiteral.nop():d.TypeLiteral.enum_({classReference:r??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),value:a})}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:q.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:q.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,as:r,nestedClassReference:a}){let o=a??this.context.getJavaClassReferenceFromDeclaration({declaration:e.declaration}),l=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,as:r,enclosing:o});return l==null?d.TypeLiteral.nop():d.TypeLiteral.reference(d.invokeMethod({on:o,method:"of",arguments_:[l.typeInstantiation]}))}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t,as:r,enclosing:a}){let o=new Set([...a.enclosingClasses,a.name]),l=this.context.getClassName(e.declaration.name);for(let p of e.types){let g=this.context.errors.size();try{let v=this.convert({typeReference:p,value:t,as:r,inUndiscriminatedUnion:!0,nestedClassReference:this.resolveUndiscriminatedInlineNestedClassReference({enclosing:a,typeReference:p,reservedNames:new Set(o),unionPrefix:l})});if(d.TypeLiteral.isNop(v)||this.context.errors.size()>g){this.context.errors.truncate(g);continue}return{valueTypeReference:p,typeInstantiation:v}}catch{this.context.errors.truncate(g);continue}}this.context.errors.add({severity:q.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}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:D(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:D(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:D(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({withinAlias:e.withinAlias,typeReference:e.typeReference}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return d.Type.map(this.convert({withinAlias:e.withinAlias,typeReference:e.typeReference.key}),this.convert({withinAlias:e.withinAlias,typeReference:e.typeReference.value}));case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t,withinAlias:e.withinAlias})}case"optional":{let t=e.typeReference.value;return this.context.usesOptionalNullable()&&(t.type==="nullable"||t.type==="optional")?d.Type.generic(this.context.getOptionalNullableClassReference(),[this.convert({withinAlias:e.withinAlias,typeReference:t.value})]):d.Type.optional(this.convert({withinAlias:e.withinAlias,typeReference:t}))}case"nullable":{let t=e.typeReference.value;if(this.context.usesNullableAnnotation())return this.convert({withinAlias:e.withinAlias,typeReference:t});if(this.context.usesOptionalNullable()){let r=t.type==="optional"||t.type==="nullable"?t.value:t;return d.Type.generic(this.context.getOptionalNullableClassReference(),[this.convert({withinAlias:e.withinAlias,typeReference:r})])}return d.Type.optional(this.convert({withinAlias:e.withinAlias,typeReference:t}))}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return d.Type.set(this.convert({withinAlias:e.withinAlias,typeReference:e.typeReference}));case"unknown":return this.convertUnknown();default:D(e.typeReference)}}convertNamed({named:e,withinAlias:t}){switch(e.type){case"alias":return e.typeReference.type==="unknown"&&!t?d.Type.reference(d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getTypesPackageName(e.declaration.fernFilepath)})):this.convert({typeReference:e.typeReference,withinAlias:!0});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:D(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:D(e)}}};m();y();h();var Ar="path/to/file",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:D(o)}return r}getSingleFileProperty({property:e,record:t}){let r=this.context.getSingleFileValue({property:e,record:t});return this.context.shouldInlineFileProperties()?this.context.getJavaIoFileFromString(r??Ar):r==null?this.getMissingFileArgument(e):d.TypeLiteral.reference(this.context.getFileStreamFromString(r))}getArrayFileProperty({property:e,record:t}){let r=this.context.getFileArrayValues({property:e,record:t});if(this.context.shouldInlineFileProperties()){let a=r?.[0]??Ar;return this.context.getJavaIoFileFromString(a)}if(r==null||r.length===0)return this.getMissingFileArgument(e);for(let a of r)return d.TypeLiteral.reference(this.context.getFileStreamFromString(a));return d.TypeLiteral.nop()}getMissingFileArgument(e){switch(e.isOptional){case!0:return d.TypeLiteral.reference(d.invokeMethod({on:d.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));case!1:return this.context.getJavaIoFileFromString(Ar);default: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 Cu=new Set(["enum","extends","package","void","short","class","abstract","return","import","for","assert","switch"]),Au=new Set(["getClass","notify","notifyAll","wait"]),ir=class n extends Bt{constructor({ir:t,config:r,options:a,sharedCustomConfig:o,inlineTypeIds:l}){super({ir:t,config:r,options:a});R(this,"ir");R(this,"customConfig");R(this,"dynamicTypeMapper");R(this,"dynamicTypeLiteralMapper");R(this,"filePropertyMapper");R(this,"inlineTypeIds");this.ir=t,this.customConfig=o??_r.parse(r.customConfig??{}),this.dynamicTypeMapper=new nr({context:this}),this.dynamicTypeLiteralMapper=new rr({context:this}),this.filePropertyMapper=new ar({context:this}),this.inlineTypeIds=l??new Set}clone(){return new n({ir:this.ir,config:this.config,options:this.options,sharedCustomConfig:this.customConfig,inlineTypeIds:this.inlineTypeIds})}isInlineType(t){return this.inlineTypeIds.has(t)}getNestedInlineClassReference({enclosing:t,name:r}){return d.classReference({name:r,packageName:t.packageName,enclosingClasses:[...t.enclosingClasses,t.name]})}wrappedAliases(){return this.customConfig?.["wrapped-aliases"]??!1}enableInlineTypes(){return this.customConfig?.["enable-inline-types"]??!1}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.getRootClientClassNameForSnippets(),packageName:this.getRootPackageName()})}getRootClientClassName(){return this.customConfig?.["client-class-name"]??`${this.getBaseNamePrefix()}Client`}getRootClientClassNameForSnippets(){return this.customConfig?.["exported-client-class-name"]??this.getRootClientClassName()}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("(new "),r.writeNode(this.getByteArrayInputStreamClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(".getBytes("),r.writeNode(this.getStandardCharsetsClassReference()),r.write(".UTF_8)))")}))}getJavaIoFileFromString(t){return d.TypeLiteral.reference(d.codeblock(r=>{r.write("new "),r.writeNode(this.getJavaIoFileClassReference()),r.write("("),r.writeNode(d.TypeLiteral.string(t)),r.write(")")}))}getJavaIoFileClassReference(){return d.classReference({name:"File",packageName:"java.io"})}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:D(r)}break}case"list":case"set":case"map":case"literal":case"unknown":return!1;default:D(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=[],l=[];for(let p of t)this.isOptional(p.typeReference)?l.push(p):o.push(p);return o.sort((p,g)=>(a.get(p.name.wireValue)??0)-(a.get(g.name.wireValue)??0)),[...o,...l]}associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}){let o=super.associateByWireValue({parameters:t,values:r,ignoreMissingParameters:a}),l=new Map;for(let g of o)l.set(g.name.wireValue,g);let p=[];for(let g of t){let v=l.get(g.name.wireValue);v!=null&&p.push(v)}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}usesNullableAnnotation(){return this.customConfig?.["use-nullable-annotation"]===!0}usesOptionalNullable(){return this.customConfig?.["collapse-optional-nullable"]===!0}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:Cr(a)).join(".")}getName(t){return this.isReservedName(t)?"_"+t:t}isReservedName(t){return Cu.has(t)}isReservedMethodName(t){return Au.has(t)}};m();y();h();var Si="com.example.usage",Eu="Example",Su="main",Lu="args",Li="client",Bu={type:"primitive",value:"STRING"};function Er(n){let e=n;for(;e.type==="optional"||e.type==="nullable";)e=e.value;return e}function Pu(n){if(n.type==="optional"&&n.value.type==="list"){let e=n.value.value,t=Er(e);return t===e?n:{type:"optional",value:{type:"list",value:t}}}if(n.type==="list"){let e=Er(n.value);return e===n.value?n:{type:"list",value:e}}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??Si,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??Si,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(l=>{l.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),l.newLine(),l.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:D(o)}}constructClient({endpoint:e,snippet:t}){let r=e.auth?.type==="oauth";return d.codeblock(a=>{if(a.writeNode(this.context.getRootClientClassReference()),a.write(` ${Li} = `),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 l=this.getRootClientBuilderArgsExcludingAuth({endpoint:e,snippet:t});for(let p of l)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??Eu,access:d.Access.Public}),o=d.parameter({name:Lu,type:d.Type.array(d.Type.string())});return a.addMethod(d.method({name:Su,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:q.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:q.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:q.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:q.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:Bu,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:D(e)}}addError(e){this.context.errors.add({severity:q.Critical,message:e})}addWarning(e){this.context.errors.add({severity:q.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){let r=e,a=!!r.usernameOmit,o=!!r.passwordOmit,l=[];return a||l.push(`"${t.username}"`),o||l.push(`"${t.password}"`),l.length===0?[]:[{name:"credentials",value:d.TypeLiteral.raw(l.join(", "))}]}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],l=this.getRootClientHeaderArg({header:a,value:o});l!=null&&r.push({name:this.context.getMethodName(a.name.name),value:l})}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(Li),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:D(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(se.PathParameters);let a=(e.pathParameters??[]).filter(l=>l.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(l=>l.value)),this.context.errors.unscope(),this.context.errors.scope(se.RequestBody),e.body!=null&&!this.callOmitsRequestBody({request:e,snippet:t})&&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}callOmitsRequestBody({request:e,snippet:t}){if(this.context.customConfig?.["respect-optional-request-body"]!==!0||e.bodyRequired!==!1)return!1;let r=t.requestBody;return r==null||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0}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});if(o.includes("Optional.empty()")||o.includes("OptionalNullable.absent()"))return a;let l=this.context.dynamicTypeLiteralMapper.convert({typeReference:Er(e.value),value:t,as:"request"});return r?this.context.getOptionalNullableOf(l):d.TypeLiteral.optional({value:l,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:D(e)}}getBytesBodyRequestArg({value:e}){return e==null?d.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:q.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 l=[],p=(e.pathParameters??[]).filter(v=>v.variable==null);p.length>0&&l.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(...l.map(v=>v.value)),o||r.push(...g.fileFields.map(v=>d.TypeLiteral.isNop(v.value)?d.TypeLiteral.raw("null"):v.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?l:[],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 l=this.context.associateQueryParametersByWireValue({parameters:e.queryParameters??[],values:t.queryParameters??{}}).filter(j=>!this.context.isDirectLiteral(j.typeReference)),g=this.context.sortTypeInstancesByRequiredFirst(l,e.queryParameters??[]).map(j=>({name:this.context.getMethodName(j.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:Pu(j.typeReference),value:j.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(se.Headers);let N=this.context.associateByWireValue({parameters:e.headers??[],values:t.headers??{}}).filter(j=>!this.context.isDirectLiteral(j.typeReference)),G=this.context.sortTypeInstancesByRequiredFirst(N,e.headers??[]).map(j=>({name:this.context.getMethodName(j.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:j.typeReference,value:j.value,as:"request"})}));this.context.errors.unscope();let E=d.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)});this.context.errors.scope(se.RequestBody);let O=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a,enclosing:E}):[];return this.context.errors.unscope(),d.TypeLiteral.builder({classReference:E,parameters:[...r,...G,...g,...O]})}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()}),l=d.invokeMethod({on:o,method:"builder",arguments_:[]});for(let g of a)l=d.invokeMethod({on:l,method:"addHeader",arguments_:[d.TypeLiteral.string(g.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(g)]});let p=d.invokeMethod({on:l,method:"build",arguments_:[]});return d.TypeLiteral.reference(p)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r,enclosing:a}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t,enclosing:a});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:D(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.bodyPropertyFields,...e.fileFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:e.bodyType.type==="typeReference"?t??{}: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:D(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t,enclosing:r}){let o=this.context.associateByWireValue({parameters:e,values:this.context.getRecord(t)??{}}).filter(v=>!this.context.isDirectLiteral(v.typeReference)),l=this.context.sortTypeInstancesByRequiredFirst(o,e),p=new Set([...r.enclosingClasses,r.name]),g=new Set(e.map(v=>this.context.getClassName(v.name.name)));return l.map(v=>({name:this.context.getMethodName(v.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:v.typeReference,value:v.value,as:"request",nestedClassReference:this.context.dynamicTypeLiteralMapper.resolveInlineNestedClassReference({enclosing:r,baseName:this.context.getClassName(v.name.name),typeReference:v.typeReference,reservedNames:p,siblingPropertyNames:g})})}))}getPathParameters({namedParameters:e,snippet:t}){let r=[],a=this.context.associateByWireValue({parameters:e,values:t.pathParameters??{},ignoreMissingParameters:!0});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 Sr=class extends Et{constructor({ir:e,config:t,options:r={},inlineTypeIds:a}){super(new ir({ir:e,config:t,options:r,inlineTypeIds:a}))}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{Sr as DynamicSnippetsGenerator};
23
23
  /*! Bundled license information:
24
24
 
25
25
  @jspm/core/nodelibs/browser/chunk-DtuTasat.js: