@chneau/x 0.0.161 → 0.0.163
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/package.json +1 -1
- package/x.js +1 -1
package/package.json
CHANGED
package/x.js
CHANGED
|
@@ -190,7 +190,7 @@ globstar while`,$,M,f,k,z),this.matchOne($.slice(M),f.slice(k),_))return this.de
|
|
|
190
190
|
`+"\t".repeat(f)})}};var z7;(function($){$.DEFAULT={allowTrailingComma:!1}})(z7||(z7={}));function D1($,f=[],_=z7.DEFAULT){let q=null,P=[],K=[];function w(T){if(Array.isArray(P))P.push(T);else if(q!==null)P[q]=T}return h1($,{onObjectBegin:()=>{let T={};w(T),K.push(P),P=T,q=null},onObjectProperty:(T)=>{q=T},onObjectEnd:()=>{P=K.pop()},onArrayBegin:()=>{let T=[];w(T),K.push(P),P=T,q=null},onArrayEnd:()=>{P=K.pop()},onLiteralValue:w,onError:(T,j,M)=>{f.push({error:T,offset:j,length:M})}},_),P[0]}function h1($,f,_=z7.DEFAULT){let q=k7($,!1),P=[],K=0;function w(d){return d?()=>K===0&&d(q.getTokenOffset(),q.getTokenLength(),q.getTokenStartLine(),q.getTokenStartCharacter()):()=>!0}function O(d){return d?(U)=>K===0&&d(U,q.getTokenOffset(),q.getTokenLength(),q.getTokenStartLine(),q.getTokenStartCharacter()):()=>!0}function T(d){return d?(U)=>K===0&&d(U,q.getTokenOffset(),q.getTokenLength(),q.getTokenStartLine(),q.getTokenStartCharacter(),()=>P.slice()):()=>!0}function j(d){return d?()=>{if(K>0)K++;else if(d(q.getTokenOffset(),q.getTokenLength(),q.getTokenStartLine(),q.getTokenStartCharacter(),()=>P.slice())===!1)K=1}:()=>!0}function M(d){return d?()=>{if(K>0)K--;if(K===0)d(q.getTokenOffset(),q.getTokenLength(),q.getTokenStartLine(),q.getTokenStartCharacter())}:()=>!0}let k=j(f.onObjectBegin),z=T(f.onObjectProperty),H=M(f.onObjectEnd),N=j(f.onArrayBegin),h=M(f.onArrayEnd),A=T(f.onLiteralValue),L=O(f.onSeparator),u=w(f.onComment),r=O(f.onError),n=_&&_.disallowComments,y=_&&_.allowTrailingComma;function W(){while(!0){let d=q.scan();switch(q.getTokenError()){case 4:p(14);break;case 5:p(15);break;case 3:p(13);break;case 1:if(!n)p(11);break;case 2:p(12);break;case 6:p(16);break}switch(d){case 12:case 13:if(n)p(10);else u();break;case 16:p(1);break;case 15:case 14:break;default:return d}}}function p(d,U=[],Uq=[]){if(r(d),U.length+Uq.length>0){let qq=q.getToken();while(qq!==17){if(U.indexOf(qq)!==-1){W();break}else if(Uq.indexOf(qq)!==-1)break;qq=W()}}}function m(d){let U=q.getTokenValue();if(d)A(U);else z(U),P.push(U);return W(),!0}function b(){switch(q.getToken()){case 11:let d=q.getTokenValue(),U=Number(d);if(isNaN(U))p(2),U=0;A(U);break;case 7:A(null);break;case 8:A(!0);break;case 9:A(!1);break;default:return!1}return W(),!0}function D$(){if(q.getToken()!==10)return p(3,[],[2,5]),!1;if(m(!1),q.getToken()===6){if(L(":"),W(),!u$())p(4,[],[2,5])}else p(5,[],[2,5]);return P.pop(),!0}function R$(){k(),W();let d=!1;while(q.getToken()!==2&&q.getToken()!==17){if(q.getToken()===5){if(!d)p(4,[],[]);if(L(","),W(),q.getToken()===2&&y)break}else if(d)p(6,[],[]);if(!D$())p(4,[],[2,5]);d=!0}if(H(),q.getToken()!==2)p(7,[2],[]);else W();return!0}function F(){N(),W();let d=!0,U=!1;while(q.getToken()!==4&&q.getToken()!==17){if(q.getToken()===5){if(!U)p(4,[],[]);if(L(","),W(),q.getToken()===4&&y)break}else if(U)p(6,[],[]);if(d)P.push(0),d=!1;else P[P.length-1]++;if(!u$())p(4,[],[4,5]);U=!0}if(h(),!d)P.pop();if(q.getToken()!==4)p(8,[4],[]);else W();return!0}function u$(){switch(q.getToken()){case 3:return F();case 1:return R$();case 10:return m(!0);default:return b()}}if(W(),q.getToken()===17){if(_.allowEmptyContent)return!0;return p(4,[],[]),!1}if(!u$())return p(4,[],[]),!1;if(q.getToken()!==17)p(9,[],[]);return!0}var Y1;(function($){$[$.None=0]="None",$[$.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",$[$.UnexpectedEndOfString=2]="UnexpectedEndOfString",$[$.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",$[$.InvalidUnicode=4]="InvalidUnicode",$[$.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",$[$.InvalidCharacter=6]="InvalidCharacter"})(Y1||(Y1={}));var H1;(function($){$[$.OpenBraceToken=1]="OpenBraceToken",$[$.CloseBraceToken=2]="CloseBraceToken",$[$.OpenBracketToken=3]="OpenBracketToken",$[$.CloseBracketToken=4]="CloseBracketToken",$[$.CommaToken=5]="CommaToken",$[$.ColonToken=6]="ColonToken",$[$.NullKeyword=7]="NullKeyword",$[$.TrueKeyword=8]="TrueKeyword",$[$.FalseKeyword=9]="FalseKeyword",$[$.StringLiteral=10]="StringLiteral",$[$.NumericLiteral=11]="NumericLiteral",$[$.LineCommentTrivia=12]="LineCommentTrivia",$[$.BlockCommentTrivia=13]="BlockCommentTrivia",$[$.LineBreakTrivia=14]="LineBreakTrivia",$[$.Trivia=15]="Trivia",$[$.Unknown=16]="Unknown",$[$.EOF=17]="EOF"})(H1||(H1={}));var J1=D1;var A1;(function($){$[$.InvalidSymbol=1]="InvalidSymbol",$[$.InvalidNumberFormat=2]="InvalidNumberFormat",$[$.PropertyNameExpected=3]="PropertyNameExpected",$[$.ValueExpected=4]="ValueExpected",$[$.ColonExpected=5]="ColonExpected",$[$.CommaExpected=6]="CommaExpected",$[$.CloseBraceExpected=7]="CloseBraceExpected",$[$.CloseBracketExpected=8]="CloseBracketExpected",$[$.EndOfFileExpected=9]="EndOfFileExpected",$[$.InvalidCommentToken=10]="InvalidCommentToken",$[$.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",$[$.UnexpectedEndOfString=12]="UnexpectedEndOfString",$[$.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",$[$.InvalidUnicode=14]="InvalidUnicode",$[$.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",$[$.InvalidCharacter=16]="InvalidCharacter"})(A1||(A1={}));var Z4=T7(E1(),1);class D7 extends Error{constructor($){super($);this.name="TimeoutError"}}class L1 extends Error{constructor($){super();this.name="AbortError",this.message=$}}var S1=($)=>globalThis.DOMException===void 0?new L1($):new DOMException($),N1=($)=>{let f=$.reason===void 0?S1("This operation was aborted."):$.reason;return f instanceof Error?f:S1(f)};function o4($,f){let{milliseconds:_,fallback:q,message:P,customTimers:K={setTimeout,clearTimeout}}=f,w,T=new Promise((j,M)=>{if(typeof _!=="number"||Math.sign(_)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${_}\``);if(f.signal){let{signal:z}=f;if(z.aborted)M(N1(z));z.addEventListener("abort",()=>{M(N1(z))})}if(_===Number.POSITIVE_INFINITY){$.then(j,M);return}let k=new D7;w=K.setTimeout.call(void 0,()=>{if(q){try{j(q())}catch(z){M(z)}return}if(typeof $.cancel==="function")$.cancel();if(P===!1)j();else if(P instanceof Error)M(P);else k.message=P??`Promise timed out after ${_} milliseconds`,M(k)},_),(async()=>{try{j(await $)}catch(z){M(z)}})()}).finally(()=>{T.clear()});return T.clear=()=>{K.clearTimeout.call(void 0,w),w=void 0},T}function e4($,f,_){let q=0,P=$.length;while(P>0){let K=Math.trunc(P/2),w=q+K;if(_($[w],f)<=0)q=++w,P-=K+1;else P=K}return q}class h7{#$=[];enqueue($,f){f={priority:0,...f};let _={priority:f.priority,id:f.id,run:$};if(this.size===0||this.#$[this.size-1].priority>=f.priority){this.#$.push(_);return}let q=e4(this.#$,_,(P,K)=>K.priority-P.priority);this.#$.splice(q,0,_)}setPriority($,f){let _=this.#$.findIndex((P)=>P.id===$);if(_===-1)throw new ReferenceError(`No promise function with the id "${$}" exists in the queue.`);let[q]=this.#$.splice(_,1);this.enqueue(q.run,{priority:f,id:$})}dequeue(){return this.#$.shift()?.run}filter($){return this.#$.filter((f)=>f.priority===$.priority).map((f)=>f.run)}get size(){return this.#$.length}}class Y7 extends Z4.default{#$;#w;#K=0;#v;#O;#D=0;#f;#T;#_;#h;#q=0;#j;#P;#Y;#J=1n;timeout;constructor($){super();if($={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:h7,...$},!(typeof $.intervalCap==="number"&&$.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${$.intervalCap?.toString()??""}\` (${typeof $.intervalCap})`);if($.interval===void 0||!(Number.isFinite($.interval)&&$.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${$.interval?.toString()??""}\` (${typeof $.interval})`);this.#$=$.carryoverConcurrencyCount,this.#w=$.intervalCap===Number.POSITIVE_INFINITY||$.interval===0,this.#v=$.intervalCap,this.#O=$.interval,this.#_=new $.queueClass,this.#h=$.queueClass,this.concurrency=$.concurrency,this.timeout=$.timeout,this.#Y=$.throwOnTimeout===!0,this.#P=$.autoStart===!1}get#r(){return this.#w||this.#K<this.#v}get#E(){return this.#q<this.#j}#S(){this.#q--,this.#M(),this.emit("next")}#N(){this.#A(),this.#H(),this.#T=void 0}get#L(){let $=Date.now();if(this.#f===void 0){let f=this.#D-$;if(f<0)this.#K=this.#$?this.#q:0;else{if(this.#T===void 0)this.#T=setTimeout(()=>{this.#N()},f);return!0}}return!1}#M(){if(this.#_.size===0){if(this.#f)clearInterval(this.#f);if(this.#f=void 0,this.emit("empty"),this.#q===0)this.emit("idle");return!1}if(!this.#P){let $=!this.#L;if(this.#r&&this.#E){let f=this.#_.dequeue();if(!f)return!1;if(this.emit("active"),f(),$)this.#H();return!0}}return!1}#H(){if(this.#w||this.#f!==void 0)return;this.#f=setInterval(()=>{this.#A()},this.#O),this.#D=Date.now()+this.#O}#A(){if(this.#K===0&&this.#q===0&&this.#f)clearInterval(this.#f),this.#f=void 0;this.#K=this.#$?this.#q:0,this.#k()}#k(){while(this.#M());}get concurrency(){return this.#j}set concurrency($){if(!(typeof $==="number"&&$>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${$}\` (${typeof $})`);this.#j=$,this.#k()}async#n($){return new Promise((f,_)=>{$.addEventListener("abort",()=>{_($.reason)},{once:!0})})}setPriority($,f){this.#_.setPriority($,f)}async add($,f={}){return f.id??=(this.#J++).toString(),f={timeout:this.timeout,throwOnTimeout:this.#Y,...f},new Promise((_,q)=>{this.#_.enqueue(async()=>{this.#q++,this.#K++;try{f.signal?.throwIfAborted();let P=$({signal:f.signal});if(f.timeout)P=o4(Promise.resolve(P),{milliseconds:f.timeout});if(f.signal)P=Promise.race([P,this.#n(f.signal)]);let K=await P;_(K),this.emit("completed",K)}catch(P){if(P instanceof D7&&!f.throwOnTimeout){_();return}q(P),this.emit("error",P)}finally{this.#S()}},f),this.emit("add"),this.#M()})}async addAll($,f){return Promise.all($.map(async(_)=>this.add(_,f)))}start(){if(!this.#P)return this;return this.#P=!1,this.#k(),this}pause(){this.#P=!0}clear(){this.#_=new this.#h}async onEmpty(){if(this.#_.size===0)return;await this.#z("empty")}async onSizeLessThan($){if(this.#_.size<$)return;await this.#z("next",()=>this.#_.size<$)}async onIdle(){if(this.#q===0&&this.#_.size===0)return;await this.#z("idle")}async#z($,f){return new Promise((_)=>{let q=()=>{if(f&&!f())return;this.off($,q),_()};this.on($,q)})}get size(){return this.#_.size}sizeBy($){return this.#_.filter($).length}get pending(){return this.#q}get isPaused(){return this.#P}}var n1=async($=".")=>(await an($,{withFileTypes:!0})).filter((f)=>f.isDirectory()).filter((f)=>!f.name.startsWith(".")).filter((f)=>!f.name.includes("node_modules")).filter((f)=>!f.name.includes(".git")).map((f)=>`${$}/${f.name}`),Zn=async($=".",f=0)=>{if(f===0)return[$];let _=await n1($),q=f-1;while(q>0){for(let P of _){let K=await n1(P);_.push(...K)}q--}return _.push($),_},X1=async()=>{let $=m$.processedArgs[0];if(typeof $!=="string")$=".";let f=m$.opts().recursive;if(typeof f!=="number")f=0;if(f>4)console.error("\uD83D\uDC41\uFE0F Recursion level is too high"),process.exit(1);let _=await Zn($,f),q=new Y7({concurrency:xn().length});await Promise.all(_.map((P)=>q.add(()=>on(P).catch(console.error)))).catch(console.error)},on=async($)=>{console.log(`\uD83D\uDE80 Managing files in ${$}`),await tn($).catch(console.error),await en($).catch(console.error);let f=await sn($).catch(console.error),_=await Gn($).catch(console.error);if(await dn($,f??!1).catch(console.error),f)console.log("\uD83D\uDE80 Updating everything!"),await Bun.$`timeout 20s bun run --cwd=${$} upgrade`.nothrow().catch(console.error);if(_)console.log("\uD83D\uDE80 Checking and linting!"),await Promise.all([Bun.$`timeout 6s bun run --cwd=${$} check`.nothrow(),Bun.$`timeout 3s bun run --cwd=${$} lint`.nothrow()]).catch(console.error);console.log("\uD83C\uDF89 Done with all files")},en=async($)=>{let f=`${$}/yarn.lock`;if(!await Bun.file(f).exists())return!1;return await Bun.$`rm -f ${f}`.nothrow(),console.log(`\u2705 Done with ${f}`),!0},tn=async($)=>{let f=`${$}/package-lock.json`;if(!await Bun.file(f).exists())return!1;return await Bun.$`rm -f ${f}`.nothrow(),console.log(`\u2705 Done with ${f}`),!0},dn=async($,f)=>{let _=`${$}/.gitignore`,q=Bun.file(_);if(!await q.exists())return!1;let K=(await q.text()).split(`
|
|
191
191
|
`).map((O)=>O.trim()).filter(Boolean);if(K.length>10)console.error(`\uD83D\uDC41\uFE0F ${_} is too long`);if(f){if(!K.includes("node_modules"))K.push("node_modules")}return await Bun.write(q,K.join(`
|
|
192
192
|
`)),console.log(`\u2705 Done with ${_}`),!0},Gn=async($)=>{let f=`${$}/tsconfig.json`,_=Bun.file(f);if(!await _.exists())return!1;let q=J1(await _.text());if(!q.compilerOptions)return!1;let P={noUnusedLocals:!0,noUnusedParameters:!0,noUncheckedIndexedAccess:!0,noFallthroughCasesInSwitch:!0,noEmit:!0,strict:!0,skipLibCheck:!0};for(let[K,w]of Object.entries(P)){if(q.compilerOptions[K]===w)continue;q.compilerOptions[K]=w}return await Bun.write(_,JSON.stringify(q,null,2)),await Bun.$`biome check --write --unsafe ${f}`.nothrow(),console.log(`\u2705 Done with ${f}`),!0},sn=async($)=>{let f=`${$}/package.json`,_=Bun.file(f);if(!await _.exists())return!1;let q=await _.json();if(q.scripts??={},!(q.dependencies||q.devDependencies))return!1;let K={upgrade:"bun update --latest",check:"deno fmt --use-tabs --quiet; oxlint --fix-dangerously --quiet; biome check --write --unsafe .",lint:"tsc",all:"bun run upgrade; bun run check; bun run lint"};for(let[w,O]of Object.entries(K)){if(typeof q.scripts[w]==="string"&&q.scripts[w].includes("bun")&&(q.scripts[w].includes("--filter")||q.scripts[w].includes("--cwd")))continue;if(q.scripts[w]===O)continue;q.scripts[w]=O}return q.prettier=void 0,await Bun.write(_,JSON.stringify(q,null,2)),await Bun.$`biome check --write --unsafe ${f}`.nothrow(),console.log(`\u2705 Done with ${f}`),!0};import EL from"path";var t;(function($){$.assertEqual=(P)=>P;function f(P){}$.assertIs=f;function _(P){throw new Error}$.assertNever=_,$.arrayToEnum=(P)=>{let K={};for(let w of P)K[w]=w;return K},$.getValidEnumValues=(P)=>{let K=$.objectKeys(P).filter((O)=>typeof P[P[O]]!=="number"),w={};for(let O of K)w[O]=P[O];return $.objectValues(w)},$.objectValues=(P)=>{return $.objectKeys(P).map(function(K){return P[K]})},$.objectKeys=typeof Object.keys==="function"?(P)=>Object.keys(P):(P)=>{let K=[];for(let w in P)if(Object.prototype.hasOwnProperty.call(P,w))K.push(w);return K},$.find=(P,K)=>{for(let w of P)if(K(w))return w;return},$.isInteger=typeof Number.isInteger==="function"?(P)=>Number.isInteger(P):(P)=>typeof P==="number"&&isFinite(P)&&Math.floor(P)===P;function q(P,K=" | "){return P.map((w)=>typeof w==="string"?`'${w}'`:w).join(K)}$.joinValues=q,$.jsonStringifyReplacer=(P,K)=>{if(typeof K==="bigint")return K.toString();return K}})(t||(t={}));var i4;(function($){$.mergeShapes=(f,_)=>{return{...f,..._}}})(i4||(i4={}));var V=t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),q_=($)=>{switch(typeof $){case"undefined":return V.undefined;case"string":return V.string;case"number":return isNaN($)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":if(Array.isArray($))return V.array;if($===null)return V.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return V.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return V.map;if(typeof Set!=="undefined"&&$ instanceof Set)return V.set;if(typeof Date!=="undefined"&&$ instanceof Date)return V.date;return V.object;default:return V.unknown}},E=t.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"]),bn=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class X$ extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(_)=>{this.issues=[...this.issues,_]},this.addIssues=(_=[])=>{this.issues=[...this.issues,..._]};let f=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,f);else this.__proto__=f;this.name="ZodError",this.issues=$}format($){let f=$||function(P){return P.message},_={_errors:[]},q=(P)=>{for(let K of P.issues)if(K.code==="invalid_union")K.unionErrors.map(q);else if(K.code==="invalid_return_type")q(K.returnTypeError);else if(K.code==="invalid_arguments")q(K.argumentsError);else if(K.path.length===0)_._errors.push(f(K));else{let w=_,O=0;while(O<K.path.length){let T=K.path[O];if(O!==K.path.length-1)w[T]=w[T]||{_errors:[]};else w[T]=w[T]||{_errors:[]},w[T]._errors.push(f(K));w=w[T],O++}}};return q(this),_}static assert($){if(!($ instanceof X$))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,t.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(f)=>f.message){let f={},_=[];for(let q of this.issues)if(q.path.length>0)f[q.path[0]]=f[q.path[0]]||[],f[q.path[0]].push($(q));else _.push($(q));return{formErrors:_,fieldErrors:f}}get formErrors(){return this.flatten()}}X$.create=($)=>{return new X$($)};var Tq=($,f)=>{let _;switch($.code){case E.invalid_type:if($.received===V.undefined)_="Required";else _=`Expected ${$.expected}, received ${$.received}`;break;case E.invalid_literal:_=`Invalid literal value, expected ${JSON.stringify($.expected,t.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:_=`Unrecognized key(s) in object: ${t.joinValues($.keys,", ")}`;break;case E.invalid_union:_="Invalid input";break;case E.invalid_union_discriminator:_=`Invalid discriminator value. Expected ${t.joinValues($.options)}`;break;case E.invalid_enum_value:_=`Invalid enum value. Expected ${t.joinValues($.options)}, received '${$.received}'`;break;case E.invalid_arguments:_="Invalid function arguments";break;case E.invalid_return_type:_="Invalid function return type";break;case E.invalid_date:_="Invalid date";break;case E.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(_=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")_=`${_} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)_=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)_=`Invalid input: must end with "${$.validation.endsWith}"`;else t.assertNever($.validation);else if($.validation!=="regex")_=`Invalid ${$.validation}`;else _="Invalid";break;case E.too_small:if($.type==="array")_=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")_=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")_=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")_=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else _="Invalid input";break;case E.too_big:if($.type==="array")_=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")_=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")_=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")_=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")_=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else _="Invalid input";break;case E.custom:_="Invalid input";break;case E.invalid_intersection_types:_="Intersection results could not be merged";break;case E.not_multiple_of:_=`Number must be a multiple of ${$.multipleOf}`;break;case E.not_finite:_="Number must be finite";break;default:_=f.defaultError,t.assertNever($)}return{message:_}},u1=Tq;function ln($){u1=$}function H7(){return u1}var A7=($)=>{let{data:f,path:_,errorMaps:q,issueData:P}=$,K=[..._,...P.path||[]],w={...P,path:K};if(P.message!==void 0)return{...P,path:K,message:P.message};let O="",T=q.filter((j)=>!!j).slice().reverse();for(let j of T)O=j(w,{data:f,defaultError:O}).message;return{...P,path:K,message:O}},gn=[];function X($,f){let _=H7(),q=A7({issueData:f,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,_,_===Tq?void 0:Tq].filter((P)=>!!P)});$.common.issues.push(q)}class M${constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,f){let _=[];for(let q of f){if(q.status==="aborted")return x;if(q.status==="dirty")$.dirty();_.push(q.value)}return{status:$.value,value:_}}static async mergeObjectAsync($,f){let _=[];for(let q of f){let P=await q.key,K=await q.value;_.push({key:P,value:K})}return M$.mergeObjectSync($,_)}static mergeObjectSync($,f){let _={};for(let q of f){let{key:P,value:K}=q;if(P.status==="aborted")return x;if(K.status==="aborted")return x;if(P.status==="dirty")$.dirty();if(K.status==="dirty")$.dirty();if(P.value!=="__proto__"&&(typeof K.value!=="undefined"||q.alwaysSet))_[P.value]=K.value}return{status:$.value,value:_}}}var x=Object.freeze({status:"aborted"}),wq=($)=>({status:"dirty",value:$}),Y$=($)=>({status:"valid",value:$}),d4=($)=>$.status==="aborted",G4=($)=>$.status==="dirty",x_=($)=>$.status==="valid",qP=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;function J7($,f,_,q){if(_==="a"&&!q)throw new TypeError("Private accessor was defined without a getter");if(typeof f==="function"?$!==f||!q:!f.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return _==="m"?q:_==="a"?q.call($):q?q.value:f.get($)}function m1($,f,_,q,P){if(q==="m")throw new TypeError("Private method is not writable");if(q==="a"&&!P)throw new TypeError("Private accessor was defined without a setter");if(typeof f==="function"?$!==f||!P:!f.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return q==="a"?P.call($,_):P?P.value=_:f.set($,_),_}var C;(function($){$.errToObj=(f)=>typeof f==="string"?{message:f}:f||{},$.toString=(f)=>typeof f==="string"?f:f===null||f===void 0?void 0:f.message})(C||(C={}));var _P,fP;class i${constructor($,f,_,q){this._cachedPath=[],this.parent=$,this.data=f,this._path=_,this._key=q}get path(){if(!this._cachedPath.length)if(this._key instanceof Array)this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var W1=($,f)=>{if(x_(f))return{success:!0,data:f.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let _=new X$($.common.issues);return this._error=_,this._error}}}};function Z($){if(!$)return{};let{errorMap:f,invalid_type_error:_,required_error:q,description:P}=$;if(f&&(_||q))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(f)return{errorMap:f,description:P};return{errorMap:(w,O)=>{var T,j;let{message:M}=$;if(w.code==="invalid_enum_value")return{message:M!==null&&M!==void 0?M:O.defaultError};if(typeof O.data==="undefined")return{message:(T=M!==null&&M!==void 0?M:q)!==null&&T!==void 0?T:O.defaultError};if(w.code!=="invalid_type")return{message:O.defaultError};return{message:(j=M!==null&&M!==void 0?M:_)!==null&&j!==void 0?j:O.defaultError}},description:P}}class o{get description(){return this._def.description}_getType($){return q_($.data)}_getOrReturnCtx($,f){return f||{common:$.parent.common,data:$.data,parsedType:q_($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new M$,ctx:{common:$.parent.common,data:$.data,parsedType:q_($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let f=this._parse($);if(qP(f))throw new Error("Synchronous parse encountered promise.");return f}_parseAsync($){let f=this._parse($);return Promise.resolve(f)}parse($,f){let _=this.safeParse($,f);if(_.success)return _.data;throw _.error}safeParse($,f){var _;let q={common:{issues:[],async:(_=f===null||f===void 0?void 0:f.async)!==null&&_!==void 0?_:!1,contextualErrorMap:f===null||f===void 0?void 0:f.errorMap},path:(f===null||f===void 0?void 0:f.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:q_($)},P=this._parseSync({data:$,path:q.path,parent:q});return W1(q,P)}"~validate"($){var f,_;let q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:q_($)};if(!this["~standard"].async)try{let P=this._parseSync({data:$,path:[],parent:q});return x_(P)?{value:P.value}:{issues:q.common.issues}}catch(P){if((_=(f=P===null||P===void 0?void 0:P.message)===null||f===void 0?void 0:f.toLowerCase())===null||_===void 0?void 0:_.includes("encountered"))this["~standard"].async=!0;q.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:q}).then((P)=>x_(P)?{value:P.value}:{issues:q.common.issues})}async parseAsync($,f){let _=await this.safeParseAsync($,f);if(_.success)return _.data;throw _.error}async safeParseAsync($,f){let _={common:{issues:[],contextualErrorMap:f===null||f===void 0?void 0:f.errorMap,async:!0},path:(f===null||f===void 0?void 0:f.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:q_($)},q=this._parse({data:$,path:_.path,parent:_}),P=await(qP(q)?q:Promise.resolve(q));return W1(_,P)}refine($,f){let _=(q)=>{if(typeof f==="string"||typeof f==="undefined")return{message:f};else if(typeof f==="function")return f(q);else return f};return this._refinement((q,P)=>{let K=$(q),w=()=>P.addIssue({code:E.custom,..._(q)});if(typeof Promise!=="undefined"&&K instanceof Promise)return K.then((O)=>{if(!O)return w(),!1;else return!0});if(!K)return w(),!1;else return!0})}refinement($,f){return this._refinement((_,q)=>{if(!$(_))return q.addIssue(typeof f==="function"?f(_,q):f),!1;else return!0})}_refinement($){return new V$({schema:this,typeName:a.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,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:(f)=>this["~validate"](f)}}optional(){return t$.create(this,this._def)}nullable(){return P_.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return e$.create(this)}promise(){return t_.create(this,this._def)}or($){return zq.create([this,$],this._def)}and($){return vq.create(this,$,this._def)}transform($){return new V$({...Z(this._def),schema:this,typeName:a.ZodEffects,effect:{type:"transform",transform:$}})}default($){let f=typeof $==="function"?$:()=>$;return new Hq({...Z(this._def),innerType:this,defaultValue:f,typeName:a.ZodDefault})}brand(){return new E7({typeName:a.ZodBranded,type:this,...Z(this._def)})}catch($){let f=typeof $==="function"?$:()=>$;return new Aq({...Z(this._def),innerType:this,catchValue:f,typeName:a.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return jP.create(this,$)}readonly(){return Jq.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var In=/^c[^\s-]{8,}$/i,cn=/^[0-9a-z]+$/,Fn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Un=/^[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,Qn=/^[a-z0-9_-]{21}$/i,Bn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$X=/^[-+]?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)?)??$/,_X=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",t4,qX=/^(?:(?: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])$/,PX=/^(?:(?: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])$/,KX=/^(([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]))$/,wX=/^(([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])$/,OX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TX=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,V1="((\\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])))",jX=new RegExp(`^${V1}$`);function y1($){let f="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";if($.precision)f=`${f}\\.\\d{${$.precision}}`;else if($.precision==null)f=`${f}(\\.\\d+)?`;return f}function MX($){return new RegExp(`^${y1($)}$`)}function C1($){let f=`${V1}T${y1($)}`,_=[];if(_.push($.local?"Z?":"Z"),$.offset)_.push("([+-]\\d{2}:?\\d{2})");return f=`${f}(${_.join("|")})`,new RegExp(`^${f}$`)}function kX($,f){if((f==="v4"||!f)&&qX.test($))return!0;if((f==="v6"||!f)&&KX.test($))return!0;return!1}function zX($,f){if(!Bn.test($))return!1;try{let[_]=$.split("."),q=_.replace(/-/g,"+").replace(/_/g,"/").padEnd(_.length+(4-_.length%4)%4,"="),P=JSON.parse(atob(q));if(typeof P!=="object"||P===null)return!1;if(!P.typ||!P.alg)return!1;if(f&&P.alg!==f)return!1;return!0}catch(_){return!1}}function vX($,f){if((f==="v4"||!f)&&PX.test($))return!0;if((f==="v6"||!f)&&wX.test($))return!0;return!1}class o$ extends o{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==V.string){let P=this._getOrReturnCtx($);return X(P,{code:E.invalid_type,expected:V.string,received:P.parsedType}),x}let _=new M$,q=void 0;for(let P of this._def.checks)if(P.kind==="min"){if($.data.length<P.value)q=this._getOrReturnCtx($,q),X(q,{code:E.too_small,minimum:P.value,type:"string",inclusive:!0,exact:!1,message:P.message}),_.dirty()}else if(P.kind==="max"){if($.data.length>P.value)q=this._getOrReturnCtx($,q),X(q,{code:E.too_big,maximum:P.value,type:"string",inclusive:!0,exact:!1,message:P.message}),_.dirty()}else if(P.kind==="length"){let K=$.data.length>P.value,w=$.data.length<P.value;if(K||w){if(q=this._getOrReturnCtx($,q),K)X(q,{code:E.too_big,maximum:P.value,type:"string",inclusive:!0,exact:!0,message:P.message});else if(w)X(q,{code:E.too_small,minimum:P.value,type:"string",inclusive:!0,exact:!0,message:P.message});_.dirty()}}else if(P.kind==="email"){if(!_X.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"email",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="emoji"){if(!t4)t4=new RegExp(fX,"u");if(!t4.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"emoji",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="uuid"){if(!Un.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"uuid",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="nanoid"){if(!Qn.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"nanoid",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="cuid"){if(!In.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"cuid",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="cuid2"){if(!cn.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"cuid2",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="ulid"){if(!Fn.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"ulid",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="url")try{new URL($.data)}catch(K){q=this._getOrReturnCtx($,q),X(q,{validation:"url",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="regex"){if(P.regex.lastIndex=0,!P.regex.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"regex",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="trim")$.data=$.data.trim();else if(P.kind==="includes"){if(!$.data.includes(P.value,P.position))q=this._getOrReturnCtx($,q),X(q,{code:E.invalid_string,validation:{includes:P.value,position:P.position},message:P.message}),_.dirty()}else if(P.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(P.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(P.kind==="startsWith"){if(!$.data.startsWith(P.value))q=this._getOrReturnCtx($,q),X(q,{code:E.invalid_string,validation:{startsWith:P.value},message:P.message}),_.dirty()}else if(P.kind==="endsWith"){if(!$.data.endsWith(P.value))q=this._getOrReturnCtx($,q),X(q,{code:E.invalid_string,validation:{endsWith:P.value},message:P.message}),_.dirty()}else if(P.kind==="datetime"){if(!C1(P).test($.data))q=this._getOrReturnCtx($,q),X(q,{code:E.invalid_string,validation:"datetime",message:P.message}),_.dirty()}else if(P.kind==="date"){if(!jX.test($.data))q=this._getOrReturnCtx($,q),X(q,{code:E.invalid_string,validation:"date",message:P.message}),_.dirty()}else if(P.kind==="time"){if(!MX(P).test($.data))q=this._getOrReturnCtx($,q),X(q,{code:E.invalid_string,validation:"time",message:P.message}),_.dirty()}else if(P.kind==="duration"){if(!$X.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"duration",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="ip"){if(!kX($.data,P.version))q=this._getOrReturnCtx($,q),X(q,{validation:"ip",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="jwt"){if(!zX($.data,P.alg))q=this._getOrReturnCtx($,q),X(q,{validation:"jwt",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="cidr"){if(!vX($.data,P.version))q=this._getOrReturnCtx($,q),X(q,{validation:"cidr",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="base64"){if(!OX.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"base64",code:E.invalid_string,message:P.message}),_.dirty()}else if(P.kind==="base64url"){if(!TX.test($.data))q=this._getOrReturnCtx($,q),X(q,{validation:"base64url",code:E.invalid_string,message:P.message}),_.dirty()}else t.assertNever(P);return{status:_.value,value:$.data}}_regex($,f,_){return this.refinement((q)=>$.test(q),{validation:f,code:E.invalid_string,...C.errToObj(_)})}_addCheck($){return new o$({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...C.errToObj($)})}url($){return this._addCheck({kind:"url",...C.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...C.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...C.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...C.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...C.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...C.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...C.errToObj($)})}base64($){return this._addCheck({kind:"base64",...C.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...C.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...C.errToObj($)})}ip($){return this._addCheck({kind:"ip",...C.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...C.errToObj($)})}datetime($){var f,_;if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,offset:(f=$===null||$===void 0?void 0:$.offset)!==null&&f!==void 0?f:!1,local:(_=$===null||$===void 0?void 0:$.local)!==null&&_!==void 0?_:!1,...C.errToObj($===null||$===void 0?void 0:$.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof($===null||$===void 0?void 0:$.precision)==="undefined"?null:$===null||$===void 0?void 0:$.precision,...C.errToObj($===null||$===void 0?void 0:$.message)})}duration($){return this._addCheck({kind:"duration",...C.errToObj($)})}regex($,f){return this._addCheck({kind:"regex",regex:$,...C.errToObj(f)})}includes($,f){return this._addCheck({kind:"includes",value:$,position:f===null||f===void 0?void 0:f.position,...C.errToObj(f===null||f===void 0?void 0:f.message)})}startsWith($,f){return this._addCheck({kind:"startsWith",value:$,...C.errToObj(f)})}endsWith($,f){return this._addCheck({kind:"endsWith",value:$,...C.errToObj(f)})}min($,f){return this._addCheck({kind:"min",value:$,...C.errToObj(f)})}max($,f){return this._addCheck({kind:"max",value:$,...C.errToObj(f)})}length($,f){return this._addCheck({kind:"length",value:$,...C.errToObj(f)})}nonempty($){return this.min(1,C.errToObj($))}trim(){return new o$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new o$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new o$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let f of this._def.checks)if(f.kind==="min"){if($===null||f.value>$)$=f.value}return $}get maxLength(){let $=null;for(let f of this._def.checks)if(f.kind==="max"){if($===null||f.value<$)$=f.value}return $}}o$.create=($)=>{var f;return new o$({checks:[],typeName:a.ZodString,coerce:(f=$===null||$===void 0?void 0:$.coerce)!==null&&f!==void 0?f:!1,...Z($)})};function DX($,f){let _=($.toString().split(".")[1]||"").length,q=(f.toString().split(".")[1]||"").length,P=_>q?_:q,K=parseInt($.toFixed(P).replace(".","")),w=parseInt(f.toFixed(P).replace(".",""));return K%w/Math.pow(10,P)}class h_ extends o{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==V.number){let P=this._getOrReturnCtx($);return X(P,{code:E.invalid_type,expected:V.number,received:P.parsedType}),x}let _=void 0,q=new M$;for(let P of this._def.checks)if(P.kind==="int"){if(!t.isInteger($.data))_=this._getOrReturnCtx($,_),X(_,{code:E.invalid_type,expected:"integer",received:"float",message:P.message}),q.dirty()}else if(P.kind==="min"){if(P.inclusive?$.data<P.value:$.data<=P.value)_=this._getOrReturnCtx($,_),X(_,{code:E.too_small,minimum:P.value,type:"number",inclusive:P.inclusive,exact:!1,message:P.message}),q.dirty()}else if(P.kind==="max"){if(P.inclusive?$.data>P.value:$.data>=P.value)_=this._getOrReturnCtx($,_),X(_,{code:E.too_big,maximum:P.value,type:"number",inclusive:P.inclusive,exact:!1,message:P.message}),q.dirty()}else if(P.kind==="multipleOf"){if(DX($.data,P.value)!==0)_=this._getOrReturnCtx($,_),X(_,{code:E.not_multiple_of,multipleOf:P.value,message:P.message}),q.dirty()}else if(P.kind==="finite"){if(!Number.isFinite($.data))_=this._getOrReturnCtx($,_),X(_,{code:E.not_finite,message:P.message}),q.dirty()}else t.assertNever(P);return{status:q.value,value:$.data}}gte($,f){return this.setLimit("min",$,!0,C.toString(f))}gt($,f){return this.setLimit("min",$,!1,C.toString(f))}lte($,f){return this.setLimit("max",$,!0,C.toString(f))}lt($,f){return this.setLimit("max",$,!1,C.toString(f))}setLimit($,f,_,q){return new h_({...this._def,checks:[...this._def.checks,{kind:$,value:f,inclusive:_,message:C.toString(q)}]})}_addCheck($){return new h_({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:C.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString($)})}multipleOf($,f){return this._addCheck({kind:"multipleOf",value:$,message:C.toString(f)})}finite($){return this._addCheck({kind:"finite",message:C.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.toString($)})}get minValue(){let $=null;for(let f of this._def.checks)if(f.kind==="min"){if($===null||f.value>$)$=f.value}return $}get maxValue(){let $=null;for(let f of this._def.checks)if(f.kind==="max"){if($===null||f.value<$)$=f.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&t.isInteger($.value))}get isFinite(){let $=null,f=null;for(let _ of this._def.checks)if(_.kind==="finite"||_.kind==="int"||_.kind==="multipleOf")return!0;else if(_.kind==="min"){if(f===null||_.value>f)f=_.value}else if(_.kind==="max"){if($===null||_.value<$)$=_.value}return Number.isFinite(f)&&Number.isFinite($)}}h_.create=($)=>{return new h_({checks:[],typeName:a.ZodNumber,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...Z($)})};class Y_ extends o{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch(P){return this._getInvalidInput($)}if(this._getType($)!==V.bigint)return this._getInvalidInput($);let _=void 0,q=new M$;for(let P of this._def.checks)if(P.kind==="min"){if(P.inclusive?$.data<P.value:$.data<=P.value)_=this._getOrReturnCtx($,_),X(_,{code:E.too_small,type:"bigint",minimum:P.value,inclusive:P.inclusive,message:P.message}),q.dirty()}else if(P.kind==="max"){if(P.inclusive?$.data>P.value:$.data>=P.value)_=this._getOrReturnCtx($,_),X(_,{code:E.too_big,type:"bigint",maximum:P.value,inclusive:P.inclusive,message:P.message}),q.dirty()}else if(P.kind==="multipleOf"){if($.data%P.value!==BigInt(0))_=this._getOrReturnCtx($,_),X(_,{code:E.not_multiple_of,multipleOf:P.value,message:P.message}),q.dirty()}else t.assertNever(P);return{status:q.value,value:$.data}}_getInvalidInput($){let f=this._getOrReturnCtx($);return X(f,{code:E.invalid_type,expected:V.bigint,received:f.parsedType}),x}gte($,f){return this.setLimit("min",$,!0,C.toString(f))}gt($,f){return this.setLimit("min",$,!1,C.toString(f))}lte($,f){return this.setLimit("max",$,!0,C.toString(f))}lt($,f){return this.setLimit("max",$,!1,C.toString(f))}setLimit($,f,_,q){return new Y_({...this._def,checks:[...this._def.checks,{kind:$,value:f,inclusive:_,message:C.toString(q)}]})}_addCheck($){return new Y_({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString($)})}multipleOf($,f){return this._addCheck({kind:"multipleOf",value:$,message:C.toString(f)})}get minValue(){let $=null;for(let f of this._def.checks)if(f.kind==="min"){if($===null||f.value>$)$=f.value}return $}get maxValue(){let $=null;for(let f of this._def.checks)if(f.kind==="max"){if($===null||f.value<$)$=f.value}return $}}Y_.create=($)=>{var f;return new Y_({checks:[],typeName:a.ZodBigInt,coerce:(f=$===null||$===void 0?void 0:$.coerce)!==null&&f!==void 0?f:!1,...Z($)})};class jq extends o{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==V.boolean){let _=this._getOrReturnCtx($);return X(_,{code:E.invalid_type,expected:V.boolean,received:_.parsedType}),x}return Y$($.data)}}jq.create=($)=>{return new jq({typeName:a.ZodBoolean,coerce:($===null||$===void 0?void 0:$.coerce)||!1,...Z($)})};class Z_ extends o{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==V.date){let P=this._getOrReturnCtx($);return X(P,{code:E.invalid_type,expected:V.date,received:P.parsedType}),x}if(isNaN($.data.getTime())){let P=this._getOrReturnCtx($);return X(P,{code:E.invalid_date}),x}let _=new M$,q=void 0;for(let P of this._def.checks)if(P.kind==="min"){if($.data.getTime()<P.value)q=this._getOrReturnCtx($,q),X(q,{code:E.too_small,message:P.message,inclusive:!0,exact:!1,minimum:P.value,type:"date"}),_.dirty()}else if(P.kind==="max"){if($.data.getTime()>P.value)q=this._getOrReturnCtx($,q),X(q,{code:E.too_big,message:P.message,inclusive:!0,exact:!1,maximum:P.value,type:"date"}),_.dirty()}else t.assertNever(P);return{status:_.value,value:new Date($.data.getTime())}}_addCheck($){return new Z_({...this._def,checks:[...this._def.checks,$]})}min($,f){return this._addCheck({kind:"min",value:$.getTime(),message:C.toString(f)})}max($,f){return this._addCheck({kind:"max",value:$.getTime(),message:C.toString(f)})}get minDate(){let $=null;for(let f of this._def.checks)if(f.kind==="min"){if($===null||f.value>$)$=f.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let f of this._def.checks)if(f.kind==="max"){if($===null||f.value<$)$=f.value}return $!=null?new Date($):null}}Z_.create=($)=>{return new Z_({checks:[],coerce:($===null||$===void 0?void 0:$.coerce)||!1,typeName:a.ZodDate,...Z($)})};class PP extends o{_parse($){if(this._getType($)!==V.symbol){let _=this._getOrReturnCtx($);return X(_,{code:E.invalid_type,expected:V.symbol,received:_.parsedType}),x}return Y$($.data)}}PP.create=($)=>{return new PP({typeName:a.ZodSymbol,...Z($)})};class Mq extends o{_parse($){if(this._getType($)!==V.undefined){let _=this._getOrReturnCtx($);return X(_,{code:E.invalid_type,expected:V.undefined,received:_.parsedType}),x}return Y$($.data)}}Mq.create=($)=>{return new Mq({typeName:a.ZodUndefined,...Z($)})};class kq extends o{_parse($){if(this._getType($)!==V.null){let _=this._getOrReturnCtx($);return X(_,{code:E.invalid_type,expected:V.null,received:_.parsedType}),x}return Y$($.data)}}kq.create=($)=>{return new kq({typeName:a.ZodNull,...Z($)})};class o_ extends o{constructor(){super(...arguments);this._any=!0}_parse($){return Y$($.data)}}o_.create=($)=>{return new o_({typeName:a.ZodAny,...Z($)})};class D_ extends o{constructor(){super(...arguments);this._unknown=!0}_parse($){return Y$($.data)}}D_.create=($)=>{return new D_({typeName:a.ZodUnknown,...Z($)})};class b$ extends o{_parse($){let f=this._getOrReturnCtx($);return X(f,{code:E.invalid_type,expected:V.never,received:f.parsedType}),x}}b$.create=($)=>{return new b$({typeName:a.ZodNever,...Z($)})};class KP extends o{_parse($){if(this._getType($)!==V.undefined){let _=this._getOrReturnCtx($);return X(_,{code:E.invalid_type,expected:V.void,received:_.parsedType}),x}return Y$($.data)}}KP.create=($)=>{return new KP({typeName:a.ZodVoid,...Z($)})};class e$ extends o{_parse($){let{ctx:f,status:_}=this._processInputParams($),q=this._def;if(f.parsedType!==V.array)return X(f,{code:E.invalid_type,expected:V.array,received:f.parsedType}),x;if(q.exactLength!==null){let K=f.data.length>q.exactLength.value,w=f.data.length<q.exactLength.value;if(K||w)X(f,{code:K?E.too_big:E.too_small,minimum:w?q.exactLength.value:void 0,maximum:K?q.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:q.exactLength.message}),_.dirty()}if(q.minLength!==null){if(f.data.length<q.minLength.value)X(f,{code:E.too_small,minimum:q.minLength.value,type:"array",inclusive:!0,exact:!1,message:q.minLength.message}),_.dirty()}if(q.maxLength!==null){if(f.data.length>q.maxLength.value)X(f,{code:E.too_big,maximum:q.maxLength.value,type:"array",inclusive:!0,exact:!1,message:q.maxLength.message}),_.dirty()}if(f.common.async)return Promise.all([...f.data].map((K,w)=>{return q.type._parseAsync(new i$(f,K,f.path,w))})).then((K)=>{return M$.mergeArray(_,K)});let P=[...f.data].map((K,w)=>{return q.type._parseSync(new i$(f,K,f.path,w))});return M$.mergeArray(_,P)}get element(){return this._def.type}min($,f){return new e$({...this._def,minLength:{value:$,message:C.toString(f)}})}max($,f){return new e$({...this._def,maxLength:{value:$,message:C.toString(f)}})}length($,f){return new e$({...this._def,exactLength:{value:$,message:C.toString(f)}})}nonempty($){return this.min(1,$)}}e$.create=($,f)=>{return new e$({type:$,minLength:null,maxLength:null,exactLength:null,typeName:a.ZodArray,...Z(f)})};function Kq($){if($ instanceof Q){let f={};for(let _ in $.shape){let q=$.shape[_];f[_]=t$.create(Kq(q))}return new Q({...$._def,shape:()=>f})}else if($ instanceof e$)return new e$({...$._def,type:Kq($.element)});else if($ instanceof t$)return t$.create(Kq($.unwrap()));else if($ instanceof P_)return P_.create(Kq($.unwrap()));else if($ instanceof l$)return l$.create($.items.map((f)=>Kq(f)));else return $}class Q extends o{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),f=t.objectKeys($);return this._cached={shape:$,keys:f}}_parse($){if(this._getType($)!==V.object){let T=this._getOrReturnCtx($);return X(T,{code:E.invalid_type,expected:V.object,received:T.parsedType}),x}let{status:_,ctx:q}=this._processInputParams($),{shape:P,keys:K}=this._getCached(),w=[];if(!(this._def.catchall instanceof b$&&this._def.unknownKeys==="strip")){for(let T in q.data)if(!K.includes(T))w.push(T)}let O=[];for(let T of K){let j=P[T],M=q.data[T];O.push({key:{status:"valid",value:T},value:j._parse(new i$(q,M,q.path,T)),alwaysSet:T in q.data})}if(this._def.catchall instanceof b$){let T=this._def.unknownKeys;if(T==="passthrough")for(let j of w)O.push({key:{status:"valid",value:j},value:{status:"valid",value:q.data[j]}});else if(T==="strict"){if(w.length>0)X(q,{code:E.unrecognized_keys,keys:w}),_.dirty()}else if(T==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let T=this._def.catchall;for(let j of w){let M=q.data[j];O.push({key:{status:"valid",value:j},value:T._parse(new i$(q,M,q.path,j)),alwaysSet:j in q.data})}}if(q.common.async)return Promise.resolve().then(async()=>{let T=[];for(let j of O){let M=await j.key,k=await j.value;T.push({key:M,value:k,alwaysSet:j.alwaysSet})}return T}).then((T)=>{return M$.mergeObjectSync(_,T)});else return M$.mergeObjectSync(_,O)}get shape(){return this._def.shape()}strict($){return C.errToObj,new Q({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(f,_)=>{var q,P,K,w;let O=(K=(P=(q=this._def).errorMap)===null||P===void 0?void 0:P.call(q,f,_).message)!==null&&K!==void 0?K:_.defaultError;if(f.code==="unrecognized_keys")return{message:(w=C.errToObj($).message)!==null&&w!==void 0?w:O};return{message:O}}}:{}})}strip(){return new Q({...this._def,unknownKeys:"strip"})}passthrough(){return new Q({...this._def,unknownKeys:"passthrough"})}extend($){return new Q({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new Q({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:a.ZodObject})}setKey($,f){return this.augment({[$]:f})}catchall($){return new Q({...this._def,catchall:$})}pick($){let f={};return t.objectKeys($).forEach((_)=>{if($[_]&&this.shape[_])f[_]=this.shape[_]}),new Q({...this._def,shape:()=>f})}omit($){let f={};return t.objectKeys(this.shape).forEach((_)=>{if(!$[_])f[_]=this.shape[_]}),new Q({...this._def,shape:()=>f})}deepPartial(){return Kq(this)}partial($){let f={};return t.objectKeys(this.shape).forEach((_)=>{let q=this.shape[_];if($&&!$[_])f[_]=q;else f[_]=q.optional()}),new Q({...this._def,shape:()=>f})}required($){let f={};return t.objectKeys(this.shape).forEach((_)=>{if($&&!$[_])f[_]=this.shape[_];else{let P=this.shape[_];while(P instanceof t$)P=P._def.innerType;f[_]=P}}),new Q({...this._def,shape:()=>f})}keyof(){return a1(t.objectKeys(this.shape))}}Q.create=($,f)=>{return new Q({shape:()=>$,unknownKeys:"strip",catchall:b$.create(),typeName:a.ZodObject,...Z(f)})};Q.strictCreate=($,f)=>{return new Q({shape:()=>$,unknownKeys:"strict",catchall:b$.create(),typeName:a.ZodObject,...Z(f)})};Q.lazycreate=($,f)=>{return new Q({shape:$,unknownKeys:"strip",catchall:b$.create(),typeName:a.ZodObject,...Z(f)})};class zq extends o{_parse($){let{ctx:f}=this._processInputParams($),_=this._def.options;function q(P){for(let w of P)if(w.result.status==="valid")return w.result;for(let w of P)if(w.result.status==="dirty")return f.common.issues.push(...w.ctx.common.issues),w.result;let K=P.map((w)=>new X$(w.ctx.common.issues));return X(f,{code:E.invalid_union,unionErrors:K}),x}if(f.common.async)return Promise.all(_.map(async(P)=>{let K={...f,common:{...f.common,issues:[]},parent:null};return{result:await P._parseAsync({data:f.data,path:f.path,parent:K}),ctx:K}})).then(q);else{let P=void 0,K=[];for(let O of _){let T={...f,common:{...f.common,issues:[]},parent:null},j=O._parseSync({data:f.data,path:f.path,parent:T});if(j.status==="valid")return j;else if(j.status==="dirty"&&!P)P={result:j,ctx:T};if(T.common.issues.length)K.push(T.common.issues)}if(P)return f.common.issues.push(...P.ctx.common.issues),P.result;let w=K.map((O)=>new X$(O));return X(f,{code:E.invalid_union,unionErrors:w}),x}}get options(){return this._def.options}}zq.create=($,f)=>{return new zq({options:$,typeName:a.ZodUnion,...Z(f)})};var f_=($)=>{if($ instanceof Dq)return f_($.schema);else if($ instanceof V$)return f_($.innerType());else if($ instanceof hq)return[$.value];else if($ instanceof H_)return $.options;else if($ instanceof Yq)return t.objectValues($.enum);else if($ instanceof Hq)return f_($._def.innerType);else if($ instanceof Mq)return[void 0];else if($ instanceof kq)return[null];else if($ instanceof t$)return[void 0,...f_($.unwrap())];else if($ instanceof P_)return[null,...f_($.unwrap())];else if($ instanceof E7)return f_($.unwrap());else if($ instanceof Jq)return f_($.unwrap());else if($ instanceof Aq)return f_($._def.innerType);else return[]};class r7 extends o{_parse($){let{ctx:f}=this._processInputParams($);if(f.parsedType!==V.object)return X(f,{code:E.invalid_type,expected:V.object,received:f.parsedType}),x;let _=this.discriminator,q=f.data[_],P=this.optionsMap.get(q);if(!P)return X(f,{code:E.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[_]}),x;if(f.common.async)return P._parseAsync({data:f.data,path:f.path,parent:f});else return P._parseSync({data:f.data,path:f.path,parent:f})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,f,_){let q=new Map;for(let P of f){let K=f_(P.shape[$]);if(!K.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let w of K){if(q.has(w))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(w)}`);q.set(w,P)}}return new r7({typeName:a.ZodDiscriminatedUnion,discriminator:$,options:f,optionsMap:q,...Z(_)})}}function s4($,f){let _=q_($),q=q_(f);if($===f)return{valid:!0,data:$};else if(_===V.object&&q===V.object){let P=t.objectKeys(f),K=t.objectKeys($).filter((O)=>P.indexOf(O)!==-1),w={...$,...f};for(let O of K){let T=s4($[O],f[O]);if(!T.valid)return{valid:!1};w[O]=T.data}return{valid:!0,data:w}}else if(_===V.array&&q===V.array){if($.length!==f.length)return{valid:!1};let P=[];for(let K=0;K<$.length;K++){let w=$[K],O=f[K],T=s4(w,O);if(!T.valid)return{valid:!1};P.push(T.data)}return{valid:!0,data:P}}else if(_===V.date&&q===V.date&&+$===+f)return{valid:!0,data:$};else return{valid:!1}}class vq extends o{_parse($){let{status:f,ctx:_}=this._processInputParams($),q=(P,K)=>{if(d4(P)||d4(K))return x;let w=s4(P.value,K.value);if(!w.valid)return X(_,{code:E.invalid_intersection_types}),x;if(G4(P)||G4(K))f.dirty();return{status:f.value,value:w.data}};if(_.common.async)return Promise.all([this._def.left._parseAsync({data:_.data,path:_.path,parent:_}),this._def.right._parseAsync({data:_.data,path:_.path,parent:_})]).then(([P,K])=>q(P,K));else return q(this._def.left._parseSync({data:_.data,path:_.path,parent:_}),this._def.right._parseSync({data:_.data,path:_.path,parent:_}))}}vq.create=($,f,_)=>{return new vq({left:$,right:f,typeName:a.ZodIntersection,...Z(_)})};class l$ extends o{_parse($){let{status:f,ctx:_}=this._processInputParams($);if(_.parsedType!==V.array)return X(_,{code:E.invalid_type,expected:V.array,received:_.parsedType}),x;if(_.data.length<this._def.items.length)return X(_,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;if(!this._def.rest&&_.data.length>this._def.items.length)X(_,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f.dirty();let P=[..._.data].map((K,w)=>{let O=this._def.items[w]||this._def.rest;if(!O)return null;return O._parse(new i$(_,K,_.path,w))}).filter((K)=>!!K);if(_.common.async)return Promise.all(P).then((K)=>{return M$.mergeArray(f,K)});else return M$.mergeArray(f,P)}get items(){return this._def.items}rest($){return new l$({...this._def,rest:$})}}l$.create=($,f)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new l$({items:$,typeName:a.ZodTuple,rest:null,...Z(f)})};class wP extends o{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:f,ctx:_}=this._processInputParams($);if(_.parsedType!==V.object)return X(_,{code:E.invalid_type,expected:V.object,received:_.parsedType}),x;let q=[],P=this._def.keyType,K=this._def.valueType;for(let w in _.data)q.push({key:P._parse(new i$(_,w,_.path,w)),value:K._parse(new i$(_,_.data[w],_.path,w)),alwaysSet:w in _.data});if(_.common.async)return M$.mergeObjectAsync(f,q);else return M$.mergeObjectSync(f,q)}get element(){return this._def.valueType}static create($,f,_){if(f instanceof o)return new wP({keyType:$,valueType:f,typeName:a.ZodRecord,...Z(_)});return new wP({keyType:o$.create(),valueType:$,typeName:a.ZodRecord,...Z(f)})}}class OP extends o{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:f,ctx:_}=this._processInputParams($);if(_.parsedType!==V.map)return X(_,{code:E.invalid_type,expected:V.map,received:_.parsedType}),x;let q=this._def.keyType,P=this._def.valueType,K=[..._.data.entries()].map(([w,O],T)=>{return{key:q._parse(new i$(_,w,_.path,[T,"key"])),value:P._parse(new i$(_,O,_.path,[T,"value"]))}});if(_.common.async){let w=new Map;return Promise.resolve().then(async()=>{for(let O of K){let T=await O.key,j=await O.value;if(T.status==="aborted"||j.status==="aborted")return x;if(T.status==="dirty"||j.status==="dirty")f.dirty();w.set(T.value,j.value)}return{status:f.value,value:w}})}else{let w=new Map;for(let O of K){let{key:T,value:j}=O;if(T.status==="aborted"||j.status==="aborted")return x;if(T.status==="dirty"||j.status==="dirty")f.dirty();w.set(T.value,j.value)}return{status:f.value,value:w}}}}OP.create=($,f,_)=>{return new OP({valueType:f,keyType:$,typeName:a.ZodMap,...Z(_)})};class e_ extends o{_parse($){let{status:f,ctx:_}=this._processInputParams($);if(_.parsedType!==V.set)return X(_,{code:E.invalid_type,expected:V.set,received:_.parsedType}),x;let q=this._def;if(q.minSize!==null){if(_.data.size<q.minSize.value)X(_,{code:E.too_small,minimum:q.minSize.value,type:"set",inclusive:!0,exact:!1,message:q.minSize.message}),f.dirty()}if(q.maxSize!==null){if(_.data.size>q.maxSize.value)X(_,{code:E.too_big,maximum:q.maxSize.value,type:"set",inclusive:!0,exact:!1,message:q.maxSize.message}),f.dirty()}let P=this._def.valueType;function K(O){let T=new Set;for(let j of O){if(j.status==="aborted")return x;if(j.status==="dirty")f.dirty();T.add(j.value)}return{status:f.value,value:T}}let w=[..._.data.values()].map((O,T)=>P._parse(new i$(_,O,_.path,T)));if(_.common.async)return Promise.all(w).then((O)=>K(O));else return K(w)}min($,f){return new e_({...this._def,minSize:{value:$,message:C.toString(f)}})}max($,f){return new e_({...this._def,maxSize:{value:$,message:C.toString(f)}})}size($,f){return this.min($,f).max($,f)}nonempty($){return this.min(1,$)}}e_.create=($,f)=>{return new e_({valueType:$,minSize:null,maxSize:null,typeName:a.ZodSet,...Z(f)})};class Oq extends o{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:f}=this._processInputParams($);if(f.parsedType!==V.function)return X(f,{code:E.invalid_type,expected:V.function,received:f.parsedType}),x;function _(w,O){return A7({data:w,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,H7(),Tq].filter((T)=>!!T),issueData:{code:E.invalid_arguments,argumentsError:O}})}function q(w,O){return A7({data:w,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,H7(),Tq].filter((T)=>!!T),issueData:{code:E.invalid_return_type,returnTypeError:O}})}let P={errorMap:f.common.contextualErrorMap},K=f.data;if(this._def.returns instanceof t_){let w=this;return Y$(async function(...O){let T=new X$([]),j=await w._def.args.parseAsync(O,P).catch((z)=>{throw T.addIssue(_(O,z)),T}),M=await Reflect.apply(K,this,j);return await w._def.returns._def.type.parseAsync(M,P).catch((z)=>{throw T.addIssue(q(M,z)),T})})}else{let w=this;return Y$(function(...O){let T=w._def.args.safeParse(O,P);if(!T.success)throw new X$([_(O,T.error)]);let j=Reflect.apply(K,this,T.data),M=w._def.returns.safeParse(j,P);if(!M.success)throw new X$([q(j,M.error)]);return M.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new Oq({...this._def,args:l$.create($).rest(D_.create())})}returns($){return new Oq({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,f,_){return new Oq({args:$?$:l$.create([]).rest(D_.create()),returns:f||D_.create(),typeName:a.ZodFunction,...Z(_)})}}class Dq extends o{get schema(){return this._def.getter()}_parse($){let{ctx:f}=this._processInputParams($);return this._def.getter()._parse({data:f.data,path:f.path,parent:f})}}Dq.create=($,f)=>{return new Dq({getter:$,typeName:a.ZodLazy,...Z(f)})};class hq extends o{_parse($){if($.data!==this._def.value){let f=this._getOrReturnCtx($);return X(f,{received:f.data,code:E.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:$.data}}get value(){return this._def.value}}hq.create=($,f)=>{return new hq({value:$,typeName:a.ZodLiteral,...Z(f)})};function a1($,f){return new H_({values:$,typeName:a.ZodEnum,...Z(f)})}class H_ extends o{constructor(){super(...arguments);_P.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let f=this._getOrReturnCtx($),_=this._def.values;return X(f,{expected:t.joinValues(_),received:f.parsedType,code:E.invalid_type}),x}if(!J7(this,_P,"f"))m1(this,_P,new Set(this._def.values),"f");if(!J7(this,_P,"f").has($.data)){let f=this._getOrReturnCtx($),_=this._def.values;return X(f,{received:f.data,code:E.invalid_enum_value,options:_}),x}return Y$($.data)}get options(){return this._def.values}get enum(){let $={};for(let f of this._def.values)$[f]=f;return $}get Values(){let $={};for(let f of this._def.values)$[f]=f;return $}get Enum(){let $={};for(let f of this._def.values)$[f]=f;return $}extract($,f=this._def){return H_.create($,{...this._def,...f})}exclude($,f=this._def){return H_.create(this.options.filter((_)=>!$.includes(_)),{...this._def,...f})}}_P=new WeakMap;H_.create=a1;class Yq extends o{constructor(){super(...arguments);fP.set(this,void 0)}_parse($){let f=t.getValidEnumValues(this._def.values),_=this._getOrReturnCtx($);if(_.parsedType!==V.string&&_.parsedType!==V.number){let q=t.objectValues(f);return X(_,{expected:t.joinValues(q),received:_.parsedType,code:E.invalid_type}),x}if(!J7(this,fP,"f"))m1(this,fP,new Set(t.getValidEnumValues(this._def.values)),"f");if(!J7(this,fP,"f").has($.data)){let q=t.objectValues(f);return X(_,{received:_.data,code:E.invalid_enum_value,options:q}),x}return Y$($.data)}get enum(){return this._def.values}}fP=new WeakMap;Yq.create=($,f)=>{return new Yq({values:$,typeName:a.ZodNativeEnum,...Z(f)})};class t_ extends o{unwrap(){return this._def.type}_parse($){let{ctx:f}=this._processInputParams($);if(f.parsedType!==V.promise&&f.common.async===!1)return X(f,{code:E.invalid_type,expected:V.promise,received:f.parsedType}),x;let _=f.parsedType===V.promise?f.data:Promise.resolve(f.data);return Y$(_.then((q)=>{return this._def.type.parseAsync(q,{path:f.path,errorMap:f.common.contextualErrorMap})}))}}t_.create=($,f)=>{return new t_({type:$,typeName:a.ZodPromise,...Z(f)})};class V$ extends o{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===a.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:f,ctx:_}=this._processInputParams($),q=this._def.effect||null,P={addIssue:(K)=>{if(X(_,K),K.fatal)f.abort();else f.dirty()},get path(){return _.path}};if(P.addIssue=P.addIssue.bind(P),q.type==="preprocess"){let K=q.transform(_.data,P);if(_.common.async)return Promise.resolve(K).then(async(w)=>{if(f.value==="aborted")return x;let O=await this._def.schema._parseAsync({data:w,path:_.path,parent:_});if(O.status==="aborted")return x;if(O.status==="dirty")return wq(O.value);if(f.value==="dirty")return wq(O.value);return O});else{if(f.value==="aborted")return x;let w=this._def.schema._parseSync({data:K,path:_.path,parent:_});if(w.status==="aborted")return x;if(w.status==="dirty")return wq(w.value);if(f.value==="dirty")return wq(w.value);return w}}if(q.type==="refinement"){let K=(w)=>{let O=q.refinement(w,P);if(_.common.async)return Promise.resolve(O);if(O instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return w};if(_.common.async===!1){let w=this._def.schema._parseSync({data:_.data,path:_.path,parent:_});if(w.status==="aborted")return x;if(w.status==="dirty")f.dirty();return K(w.value),{status:f.value,value:w.value}}else return this._def.schema._parseAsync({data:_.data,path:_.path,parent:_}).then((w)=>{if(w.status==="aborted")return x;if(w.status==="dirty")f.dirty();return K(w.value).then(()=>{return{status:f.value,value:w.value}})})}if(q.type==="transform")if(_.common.async===!1){let K=this._def.schema._parseSync({data:_.data,path:_.path,parent:_});if(!x_(K))return K;let w=q.transform(K.value,P);if(w instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:f.value,value:w}}else return this._def.schema._parseAsync({data:_.data,path:_.path,parent:_}).then((K)=>{if(!x_(K))return K;return Promise.resolve(q.transform(K.value,P)).then((w)=>({status:f.value,value:w}))});t.assertNever(q)}}V$.create=($,f,_)=>{return new V$({schema:$,typeName:a.ZodEffects,effect:f,...Z(_)})};V$.createWithPreprocess=($,f,_)=>{return new V$({schema:f,effect:{type:"preprocess",transform:$},typeName:a.ZodEffects,...Z(_)})};class t$ extends o{_parse($){if(this._getType($)===V.undefined)return Y$(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}t$.create=($,f)=>{return new t$({innerType:$,typeName:a.ZodOptional,...Z(f)})};class P_ extends o{_parse($){if(this._getType($)===V.null)return Y$(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}P_.create=($,f)=>{return new P_({innerType:$,typeName:a.ZodNullable,...Z(f)})};class Hq extends o{_parse($){let{ctx:f}=this._processInputParams($),_=f.data;if(f.parsedType===V.undefined)_=this._def.defaultValue();return this._def.innerType._parse({data:_,path:f.path,parent:f})}removeDefault(){return this._def.innerType}}Hq.create=($,f)=>{return new Hq({innerType:$,typeName:a.ZodDefault,defaultValue:typeof f.default==="function"?f.default:()=>f.default,...Z(f)})};class Aq extends o{_parse($){let{ctx:f}=this._processInputParams($),_={...f,common:{...f.common,issues:[]}},q=this._def.innerType._parse({data:_.data,path:_.path,parent:{..._}});if(qP(q))return q.then((P)=>{return{status:"valid",value:P.status==="valid"?P.value:this._def.catchValue({get error(){return new X$(_.common.issues)},input:_.data})}});else return{status:"valid",value:q.status==="valid"?q.value:this._def.catchValue({get error(){return new X$(_.common.issues)},input:_.data})}}removeCatch(){return this._def.innerType}}Aq.create=($,f)=>{return new Aq({innerType:$,typeName:a.ZodCatch,catchValue:typeof f.catch==="function"?f.catch:()=>f.catch,...Z(f)})};class TP extends o{_parse($){if(this._getType($)!==V.nan){let _=this._getOrReturnCtx($);return X(_,{code:E.invalid_type,expected:V.nan,received:_.parsedType}),x}return{status:"valid",value:$.data}}}TP.create=($)=>{return new TP({typeName:a.ZodNaN,...Z($)})};var hX=Symbol("zod_brand");class E7 extends o{_parse($){let{ctx:f}=this._processInputParams($),_=f.data;return this._def.type._parse({data:_,path:f.path,parent:f})}unwrap(){return this._def.type}}class jP extends o{_parse($){let{status:f,ctx:_}=this._processInputParams($);if(_.common.async)return(async()=>{let P=await this._def.in._parseAsync({data:_.data,path:_.path,parent:_});if(P.status==="aborted")return x;if(P.status==="dirty")return f.dirty(),wq(P.value);else return this._def.out._parseAsync({data:P.value,path:_.path,parent:_})})();else{let q=this._def.in._parseSync({data:_.data,path:_.path,parent:_});if(q.status==="aborted")return x;if(q.status==="dirty")return f.dirty(),{status:"dirty",value:q.value};else return this._def.out._parseSync({data:q.value,path:_.path,parent:_})}}static create($,f){return new jP({in:$,out:f,typeName:a.ZodPipeline})}}class Jq extends o{_parse($){let f=this._def.innerType._parse($),_=(q)=>{if(x_(q))q.value=Object.freeze(q.value);return q};return qP(f)?f.then((q)=>_(q)):_(f)}unwrap(){return this._def.innerType}}Jq.create=($,f)=>{return new Jq({innerType:$,typeName:a.ZodReadonly,...Z(f)})};function p1($,f){let _=typeof $==="function"?$(f):typeof $==="string"?{message:$}:$;return typeof _==="string"?{message:_}:_}function x1($,f={},_){if($)return o_.create().superRefine((q,P)=>{var K,w;let O=$(q);if(O instanceof Promise)return O.then((T)=>{var j,M;if(!T){let k=p1(f,q),z=(M=(j=k.fatal)!==null&&j!==void 0?j:_)!==null&&M!==void 0?M:!0;P.addIssue({code:"custom",...k,fatal:z})}});if(!O){let T=p1(f,q),j=(w=(K=T.fatal)!==null&&K!==void 0?K:_)!==null&&w!==void 0?w:!0;P.addIssue({code:"custom",...T,fatal:j})}return});return o_.create()}var YX={object:Q.lazycreate},a;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(a||(a={}));var HX=($,f={message:`Input not instance of ${$.name}`})=>x1((_)=>_ instanceof $,f),Z1=o$.create,o1=h_.create,AX=TP.create,JX=Y_.create,e1=jq.create,rX=Z_.create,EX=PP.create,SX=Mq.create,NX=kq.create,LX=o_.create,nX=D_.create,XX=b$.create,WX=KP.create,pX=e$.create,RX=Q.create,uX=Q.strictCreate,mX=zq.create,VX=r7.create,yX=vq.create,CX=l$.create,aX=wP.create,xX=OP.create,ZX=e_.create,oX=Oq.create,eX=Dq.create,tX=hq.create,iX=H_.create,dX=Yq.create,GX=t_.create,R1=V$.create,sX=t$.create,bX=P_.create,lX=V$.createWithPreprocess,gX=jP.create,IX=()=>Z1().optional(),cX=()=>o1().optional(),FX=()=>e1().optional(),UX={string:($)=>o$.create({...$,coerce:!0}),number:($)=>h_.create({...$,coerce:!0}),boolean:($)=>jq.create({...$,coerce:!0}),bigint:($)=>Y_.create({...$,coerce:!0}),date:($)=>Z_.create({...$,coerce:!0})},QX=x,G=Object.freeze({__proto__:null,defaultErrorMap:Tq,setErrorMap:ln,getErrorMap:H7,makeIssue:A7,EMPTY_PATH:gn,addIssueToContext:X,ParseStatus:M$,INVALID:x,DIRTY:wq,OK:Y$,isAborted:d4,isDirty:G4,isValid:x_,isAsync:qP,get util(){return t},get objectUtil(){return i4},ZodParsedType:V,getParsedType:q_,ZodType:o,datetimeRegex:C1,ZodString:o$,ZodNumber:h_,ZodBigInt:Y_,ZodBoolean:jq,ZodDate:Z_,ZodSymbol:PP,ZodUndefined:Mq,ZodNull:kq,ZodAny:o_,ZodUnknown:D_,ZodNever:b$,ZodVoid:KP,ZodArray:e$,ZodObject:Q,ZodUnion:zq,ZodDiscriminatedUnion:r7,ZodIntersection:vq,ZodTuple:l$,ZodRecord:wP,ZodMap:OP,ZodSet:e_,ZodFunction:Oq,ZodLazy:Dq,ZodLiteral:hq,ZodEnum:H_,ZodNativeEnum:Yq,ZodPromise:t_,ZodEffects:V$,ZodTransformer:V$,ZodOptional:t$,ZodNullable:P_,ZodDefault:Hq,ZodCatch:Aq,ZodNaN:TP,BRAND:hX,ZodBranded:E7,ZodPipeline:jP,ZodReadonly:Jq,custom:x1,Schema:o,ZodSchema:o,late:YX,get ZodFirstPartyTypeKind(){return a},coerce:UX,any:LX,array:pX,bigint:JX,boolean:e1,date:rX,discriminatedUnion:VX,effect:R1,enum:iX,function:oX,instanceof:HX,intersection:yX,lazy:eX,literal:tX,map:xX,nan:AX,nativeEnum:dX,never:XX,null:NX,nullable:bX,number:o1,object:RX,oboolean:FX,onumber:cX,optional:sX,ostring:IX,pipeline:gX,preprocess:lX,promise:GX,record:aX,set:ZX,strictObject:uX,string:Z1,symbol:EX,transformer:R1,tuple:CX,undefined:SX,union:mX,unknown:nX,void:WX,NEVER:QX,ZodIssueCode:E,quotelessJson:bn,ZodError:X$});var fq=T7(B(),1),n$=T7(AL(),1),$Q=($,f,_,q)=>{let P={[f]:{username:_,password:q,auth:btoa(`${_}:${q}`)}},K=JSON.stringify({auths:P},null,2);return new n$.Secret($,"docker-secret",{stringData:{".dockerconfigjson":K},type:"kubernetes.io/dockerconfigjson"})},_Q=($)=>{let f={};for(let[_,q]of Object.entries($))f[_]=n$.EnvValue.fromValue(q);return f},fQ=($,f,_)=>{let q=new n$.Ingress($,"ingress",{className:"nginx"});for(let P of _)q.addRules({backend:n$.IngressBackend.fromService(f),host:P,path:"/"}),q.addTls([{hosts:[P],secret:{name:P.replace(/\.|:|\//g,"-")}}]);return q.metadata.addAnnotation("cert-manager.io/cluster-issuer","letsencrypt"),q},JL=async({registry:$,image:f,service:_})=>{let q=new fq.App({outputFileExtension:".yml"}),P=new fq.Chart(q,f.imageName,{namespace:_.namespace,disableResourceNameHashes:!0});new n$.Namespace(P,_.namespace);let K=$Q(P,$.hostname,$.username,$.password),w=new n$.Deployment(P,"deployment",{replicas:_.replicas,metadata:{name:f.imageName},terminationGracePeriod:fq.Duration.seconds(0),dockerRegistryAuth:K}),O=`${$.hostname}/${f.repository}/${f.imageName}:${f.tag}`;w.addContainer({name:f.imageName,image:O,portNumber:_.port,envVariables:_Q({..._.env,DEPLOYMENT_DATE:new Date().toISOString()}),resources:{},securityContext:{readOnlyRootFilesystem:_.readOnlyRootFilesystem},startup:n$.Probe.fromTcpSocket({periodSeconds:fq.Duration.seconds(1)})});let T=w.exposeViaService({name:f.imageName});return fQ(P,T,_.endpoints),q.synthYaml()};var rL=($)=>{let f=Bun.env;return $.replace(/\${(.*?)}/g,(_,q)=>f[q]||"")};var qQ=G.object({hostname:G.string(),username:G.string(),password:G.string()}),PQ=G.object({registry:G.string(),dockerfile:G.string().default("Dockerfile"),target:G.string().optional(),args:G.record(G.string()).default({}),context:G.string().default("."),repository:G.string(),imageName:G.string(),tag:G.string().default("latest")}),KQ=G.object({image:G.string(),replicas:G.number().default(1),file:G.string().default("kubeconfig"),context:G.string(),namespace:G.string(),port:G.number().min(1).max(65535).default(3000),env:G.record(G.string(),G.string()).default({}),readOnlyRootFilesystem:G.boolean().default(!1),endpoints:G.array(G.string().regex(/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)).default([])}),wQ=G.object({$schema:G.string().optional(),registries:G.record(qQ).default({}),images:G.record(PQ),services:G.record(KQ)}),SL=async()=>{let $=Bun.argv.slice(3),f=$.filter((w)=>w.endsWith(".json")),_=$.filter((w)=>!w.endsWith(".json")),q=f.length>0;if(f.length===0)f.push(...(await Bun.$`ls *.json`.text()).split(`
|
|
193
|
-
`).filter(Boolean));let P=!1,K=[];for(let w of f){let T=await Bun.file(w).text().catch(()=>null);if(!T)continue;let j=rL(T),M=JSON.parse(j),k=await wQ.parseAsync(M).catch(()=>null);if(!k)continue;if(_.length)for(let H in k.services){if(_.includes(H))continue;delete k.services[H]}if(!Object.keys(k.services).length)continue;P=!0;for(let[H,N]of Object.entries(k.services))K.push(OQ({...k,services:{[H]:N}},EL.dirname(w)))}if(!P&&!q)console.log("\u274C TODO: create a template file");if(q&&!P)console.log("\u274C No valid json files found");await Promise.all(K)},OQ=async($,f)=>{for(let[_,q]of Object.entries($.services)){console.log(`\uD83D\uDD52 Deploying ${_}...`);let P=$.images[q.image];if(!P){console.error(`\u274C Image ${q.image} not found`);continue}let K=P.registry?$.registries[P.registry]:null;if(!K)console.info(`\u2753 Registry ${P.registry} not found`);else{console.log(`\uD83D\uDD11 Logging in to ${K.hostname}...`),await Bun.$`echo ${K.password} | docker login --username ${K.username} --password-stdin ${K.hostname}`,console.log(`... \u2705 Logged in to ${K.hostname}`);let w=`${K.hostname}/${P.repository}/${P.imageName}:${P.tag}`;console.log(`\uD83D\uDD28 Building ${w}...`);let O={raw:Object.entries(P.args).map(([M,k])=>`--build-arg=${M}=${k}`).join(" ")};await Bun.$`docker build --pull --push -t ${w} -f ${P.dockerfile} ${O} ${P.context}`.cwd(f),console.log(`... \u2705 Built ${w}`),console.log(`\uD83D\uDD17 Creating deployment for ${_}...`);let T=await JL({registry:K,image:P,service:q});console.log(`... \u2705 Created deployment for ${_}`),console.log(`\uD83D\uDE80 Deploying ${_}...`);let j={...Bun.env,KUBECONFIG:EL.join(f,q.file)};await Bun.$`echo ${T} | kubectl --context=${q.context} apply -f -`.env(j),console.log(`... \u2705 Deployed ${_}`)
|
|
193
|
+
`).filter(Boolean));console.log(`\uD83D\uDD0D Checking ${f}...`);let P=!1,K=[];for(let w of f){let T=await Bun.file(w).text().catch(()=>null);if(!T)continue;let j=rL(T),M=JSON.parse(j),k=await wQ.parseAsync(M).catch(()=>null);if(!k)continue;if(_.length)for(let H in k.services){if(_.includes(H))continue;delete k.services[H]}if(!Object.keys(k.services).length)continue;P=!0;for(let[H,N]of Object.entries(k.services))K.push(OQ({...k,services:{[H]:N}},EL.dirname(w)))}if(!P&&!q)console.log("\u274C TODO: create a template file");if(q&&!P)console.log("\u274C No valid json files found");await Promise.all(K)},OQ=async($,f)=>{for(let[_,q]of Object.entries($.services)){console.log(`\uD83D\uDD52 Deploying ${_}...`);let P=$.images[q.image];if(!P){console.error(`\u274C Image ${q.image} not found`);continue}let K=P.registry?$.registries[P.registry]:null;if(!K)console.info(`\u2753 Registry ${P.registry} not found`);else{console.log(`\uD83D\uDD11 Logging in to ${K.hostname}...`),await Bun.$`echo ${K.password} | docker login --username ${K.username} --password-stdin ${K.hostname}`,console.log(`... \u2705 Logged in to ${K.hostname}`);let w=`${K.hostname}/${P.repository}/${P.imageName}:${P.tag}`;console.log(`\uD83D\uDD28 Building ${w}...`);let O={raw:Object.entries(P.args).map(([M,k])=>`--build-arg=${M}=${k}`).join(" ")};await Bun.$`docker build --pull --push -t ${w} -f ${P.dockerfile} ${O} ${P.context}`.cwd(f),console.log(`... \u2705 Built ${w}`),console.log(`\uD83D\uDD17 Creating deployment for ${_}...`);let T=await JL({registry:K,image:P,service:q});console.log(`... \u2705 Created deployment for ${_}`),console.log(`\uD83D\uDE80 Deploying ${_}...`);let j={...Bun.env,KUBECONFIG:EL.join(f,q.file)};await Bun.$`echo ${T} | kubectl --context=${q.context} apply -f -`.env(j),console.log(`... \u2705 Deployed ${_}`)}}};var{$:$_}=globalThis.Bun;var{$:bk}=globalThis.Bun;var a_=async($)=>(await bk`which ${$}`.text().catch(()=>"")).trim()!=="",S4=async()=>{return(await bk`id -u`.text()).trim()==="0"},N4=async()=>{return(await bk`sudo echo 0`.text().catch(()=>"")).trim()==="0"},L4=async()=>await Bun.file(`${import.meta.dir}/package.json`).json().then(($)=>$.version).catch(()=>"UNKNOWN");var{$:O7}=globalThis.Bun;var w7=($)=>({name:$,check:async()=>a_($),install:async()=>await O7`sudo apt install -y ${$}`}),TQ=[w7("git"),w7("curl"),w7("wget"),w7("unzip"),w7("bash")],J$=($,f)=>({name:$,check:async()=>a_(f??$),install:async()=>await O7`brew install ${$}`}),jQ=[J$("aichat"),J$("bpytop"),J$("docker-compose"),J$("go"),J$("graphviz","dot"),J$("helm"),J$("hyperfine"),J$("kubecolor"),J$("kubectx"),J$("kubernetes-cli","kubectl"),J$("lazygit"),J$("node"),J$("openjdk","javac"),J$("pipx"),J$("zsh")],r$=($,f)=>({name:$,check:async()=>a_(f??$),install:async()=>await O7`bun install --force --global ${$}`}),MQ=[r$("@biomejs/biome","biome"),r$("concurrently"),r$("depcheck"),r$("fkill-cli","fkill"),r$("http-server"),r$("live-server"),r$("nodemon"),r$("npm-check-updates"),r$("npm-check"),r$("oxlint"),r$("prettier"),r$("ts-unused-exports"),r$("tsx"),r$("typesync"),r$("ungit")],NL=[...TQ,{name:"brew",check:async()=>a_("brew"),install:async()=>await O7`HOME=/tmp CI=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`},{name:"deno",check:async()=>a_("deno"),install:async()=>await O7`curl -fsSL https://deno.land/install.sh | sh`},...jQ,...MQ];Bun.env.PATH=[Bun.env.PATH??"","/home/linuxbrew/.linuxbrew/bin","/home/linuxbrew/.linuxbrew/sbin","$BUN_INSTALL/bin","$HOME/go/bin","$HOME/.arkade/bin","${KREW_ROOT:-$HOME/.krew}/bin","$HOME/.cargo/bin","$HOME/.dotnet","$HOME/.dotnet/tools","$HOME/.go/bin","$HOME/.local/bin","$HOME/bin","/snap/bin","/usr/local/sbin","/usr/sbin","/sbin"].join(":");var kQ=async()=>{if(!await S4())console.log("\u2705 You are not root");else throw new Error("\u274C You are root")},zQ=async()=>{if(await N4())console.log("\u2705 You can sudo");else throw new Error("\u274C You cannot sudo")},vQ=async()=>{let $=await Promise.all(NL.map(async(f)=>({name:f.name,exists:await f.check(),install:f.install}))).then((f)=>f.filter((_)=>!_.exists));if(!$.length)console.log("\u2705 All packages are installed");else{console.log("\u274C Some packages are not installed"),console.table($);for(let f of $)console.log(`\uD83D\uDD52 Installing ${f.name}`),await f.install().then(()=>console.log(`\u2705 Installed ${f.name}`)).catch(()=>console.log(`\u274C Failed to install ${f.name}`))}},DQ=async()=>{if(await Bun.file(`${Bun.env.HOME}/.gitconfig`).text().catch(()=>"")!==`[user]
|
|
194
194
|
email = charles63500@gmail.com
|
|
195
195
|
name = chneau
|
|
196
196
|
[url "ssh://git@github.com/"]
|