@dmgnr/kuber 2.5.0 → 2.5.1
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 +53 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var
|
|
4
|
-
`)}function G(e){return typeof e==="function"?e():e}function
|
|
5
|
-
`)}catch(r){console.error(r)}}async function
|
|
6
|
-
`)}function
|
|
7
|
-
`);process.exit(1)}}function gc(e){return(t={})=>vb(e,t)}async function xb(e){let t=await G(e.args||{}),r=new Set,o=new Set;for(let[n,i]of Object.entries(t)){r.add(n);for(let s of Ct(i.alias))o.add(s)}return{help:fc("help","h",r,o),version:fc("version","v",r,o)}}function fc(e,t,r,o){if(r.has(e)||o.has(e))return[];if(r.has(t)||o.has(t))return[`--${e}`];return[`--${e}`,`-${t}`]}var Ce,mb,Er=(e,t=39)=>(r)=>mb?r:`\x1B[${e}m${r}\x1B[${t}m`,wr,fe,xr,vr,_b;var F=_(()=>{pc();Ce=class extends Error{code;constructor(e,t){super(e);this.name="CLIError",this.code=t}};mb=(()=>{let e=globalThis.process?.env??{};return e.NO_COLOR==="1"||e.TERM==="dumb"||e.TEST||e.CI})(),wr=Er(1,22),fe=Er(36),xr=Er(90),vr=Er(4,24);_b=/^no[-A-Z]/});function g(e,t,r){function o(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=s.prototype,l=Object.keys(u);for(let f=0;f<l.length;f++){let d=l[f];if(!(d in a))a[d]=u[d].bind(a)}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let u=r?.Parent?new i:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}function W(e){if(e)Object.assign(at,e);return at}var yc,Eb,Re,ct,at;var Qe=_(()=>{Eb=Symbol("zod_brand");Re=class Re extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};ct=class ct extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(yc=globalThis).__zod_globalConfig??(yc.__zod_globalConfig={});at=globalThis.__zod_globalConfig});function $r(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Rn(e,t="|"){return e.map((r)=>Bn(r)).join(t)}function Rt(e,t){if(typeof t==="bigint")return t.toString();return t}function Tt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function We(e){return e===null||e===void 0}function Ar(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function _c(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}function T(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===bc)return;if(o===void 0)o=bc,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ze(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Tn(e){return JSON.stringify(e)}function wc(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function ut(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ke(e){if(ut(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(ut(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function In(e){if(Ke(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function w(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Bn(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Ec(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Sb(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=ze(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;s[a]=r.shape[a]}return Ge(this,"shape",s),s},checks:[]});return ce(e,i)}function $b(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=ze(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete s[a]}return Ge(this,"shape",s),s},checks:[]});return ce(e,i)}function Ab(e,t){if(!Ke(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=ze(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Ge(this,"shape",i),i}});return ce(e,n)}function kb(e,t){if(!Ke(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ze(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Ge(this,"shape",o),o}});return ce(e,r)}function Pb(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ze(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Ge(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ce(e,r)}function Cb(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let s=ze(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;c[u]=e?new e({type:"optional",innerType:a[u]}):a[u]}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Ge(this,"shape",c),c},checks:[]});return ce(t,s)}function Rb(e,t,r){let o=ze(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;i[s]=new e({type:"nonoptional",innerType:n[s]})}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return Ge(this,"shape",i),i}});return ce(t,o)}function He(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ac(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ne(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Sr(e){return typeof e==="string"?e:e?.message}function te(e,t,r){let o=e.message?e.message:Sr(e.inst?._zod.def?.error?.(e))??Sr(t?.error?.(e))??Sr(r.customError?.(e))??Sr(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:s,...a}=e;if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=s;return a}function Pr(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Cr(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function kc(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Je(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var bc,On,vc,kr,xc,Sc,$c;var ue=_(()=>{Qe();bc=Symbol("evaluating");On="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};vc=Tt(()=>{if(at.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});kr=new Set(["string","number","symbol"]),xc=new Set(["string","number","bigint","boolean","symbol","undefined"]);Sc={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},$c={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function zn(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Dn(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;while(u<a.length){let l=a[u];if(u!==a.length-1)c[l]=c[l]||{_errors:[]};else c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(s));c=c[l],u++}}}};return o(e),r}function Tb(e){let t=[],r=e.map((o)=>typeof o==="object"?o.key:o);for(let o of r)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function Cc(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)if(t.push(`\u2716 ${o.message}`),o.path?.length)t.push(` \u2192 at ${Tb(o.path)}`);return t.join(`
|
|
8
|
-
`)}var Pc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Rt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Rr,Ot;var Nn=_(()=>{Qe();ue();Rr=g("$ZodError",Pc),Ot=g("$ZodError",Pc,{Parent:Error})});var It=(e)=>(t,r,o,n)=>{let i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Re;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>te(c,i,W())));throw On(a,n?.callee),a}return s.value},Ln,Bt=(e)=>async(t,r,o,n)=>{let i=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>te(c,i,W())));throw On(a,n?.callee),a}return s.value},Vn,zt=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Re;return i.issues.length?{success:!1,error:new(e??Rr)(i.issues.map((s)=>te(s,n,W())))}:{success:!0,data:i.value}},Rc,Dt=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>te(s,n,W())))}:{success:!0,data:i.value}},Tc,Oc=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return It(e)(t,r,n)},Ic=(e)=>(t,r,o)=>It(e)(t,r,o),Bc=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Bt(e)(t,r,n)},zc=(e)=>async(t,r,o)=>Bt(e)(t,r,o),Dc=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return zt(e)(t,r,n)},Nc=(e)=>(t,r,o)=>zt(e)(t,r,o),Lc=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Dt(e)(t,r,n)},Vc=(e)=>async(t,r,o)=>Dt(e)(t,r,o);var Un=_(()=>{Qe();Nn();ue();Ln=It(Ot),Vn=Bt(Ot),Rc=zt(Ot),Tc=Dt(Ot)});var Xe={};br(Xe,{base64:()=>ri,base64url:()=>Tr,bigint:()=>ci,boolean:()=>li,browserEmail:()=>Ub,cidrv4:()=>ei,cidrv6:()=>ti,cuid:()=>Mn,cuid2:()=>Fn,date:()=>ni,datetime:()=>si,domain:()=>Fc,duration:()=>Wn,e164:()=>oi,email:()=>Kn,emoji:()=>Hn,extendedDuration:()=>Ib,guid:()=>Gn,hex:()=>qc,hostname:()=>Mc,html5Email:()=>Nb,httpProtocol:()=>Or,idnEmail:()=>Vb,integer:()=>ui,ipv4:()=>Jn,ipv6:()=>Yn,ksuid:()=>qn,lowercase:()=>fi,mac:()=>Xn,md5_base64:()=>jb,md5_base64url:()=>Zb,md5_hex:()=>Fb,nanoid:()=>Qn,null:()=>pi,number:()=>Ir,rfc5322Email:()=>Lb,sha1_base64:()=>Qb,sha1_base64url:()=>Wb,sha1_hex:()=>qb,sha256_base64:()=>Kb,sha256_base64url:()=>Hb,sha256_hex:()=>Gb,sha384_base64:()=>Yb,sha384_base64url:()=>Xb,sha384_hex:()=>Jb,sha512_base64:()=>t_,sha512_base64url:()=>r_,sha512_hex:()=>e_,string:()=>ai,time:()=>ii,ulid:()=>jn,undefined:()=>di,unicodeEmail:()=>Uc,uppercase:()=>mi,uuid:()=>Ye,uuid4:()=>Bb,uuid6:()=>zb,uuid7:()=>Db,xid:()=>Zn});function Hn(){return new RegExp(Mb,"u")}function Zc(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function ii(e){return new RegExp(`^${Zc(e)}$`)}function si(e){let t=Zc({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${jc}T(?:${o})$`)}function Nt(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Lt(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Mn,Fn,jn,Zn,qn,Qn,Wn,Ib,Gn,Ye=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Bb,zb,Db,Kn,Nb,Lb,Uc,Vb,Ub,Mb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Jn,Yn,Xn=(e)=>{let t=me(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},ei,ti,ri,Tr,Mc,Fc,Or,oi,jc="(?:(?:\\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])))",ni,ai=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ci,ui,Ir,li,pi,di,fi,mi,qc,Fb,jb,Zb,qb,Qb,Wb,Gb,Kb,Hb,Jb,Yb,Xb,e_,t_,r_;var Br=_(()=>{ue();Mn=/^[cC][0-9a-z]{6,}$/,Fn=/^[0-9a-z]+$/,jn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Zn=/^[0-9a-vA-V]{20}$/,qn=/^[A-Za-z0-9]{27}$/,Qn=/^[a-zA-Z0-9_-]{21}$/,Wn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ib=/^[-+]?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)?)??$/,Gn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bb=Ye(4),zb=Ye(6),Db=Ye(7),Kn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Nb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Lb=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Uc=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Vb=Uc,Ub=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;Jn=/^(?:(?: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])$/,Yn=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,ei=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ti=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ri=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tr=/^[A-Za-z0-9_-]*$/,Mc=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Fc=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Or=/^https?$/,oi=/^\+[1-9]\d{6,14}$/,ni=new RegExp(`^${jc}$`);ci=/^-?\d+n?$/,ui=/^-?\d+$/,Ir=/^-?\d+(?:\.\d+)?$/,li=/^(?:true|false)$/i,pi=/^null$/i,di=/^undefined$/i,fi=/^[^A-Z]*$/,mi=/^[^a-z]*$/,qc=/^[0-9a-fA-F]*$/;Fb=/^[0-9a-fA-F]{32}$/,jb=Nt(22,"=="),Zb=Lt(22),qb=/^[0-9a-fA-F]{40}$/,Qb=Nt(27,"="),Wb=Lt(27),Gb=/^[0-9a-fA-F]{64}$/,Kb=Nt(43,"="),Hb=Lt(43),Jb=/^[0-9a-fA-F]{96}$/,Yb=Nt(64,""),Xb=Lt(64),e_=/^[0-9a-fA-F]{128}$/,t_=Nt(86,"=="),r_=Lt(86)});function Qc(e,t,r){if(e.issues.length)t.issues.push(...ne(r,e.issues))}var N,Wc,hi,gi,Gc,Kc,Hc,Jc,Yc,Xc,eu,tu,ru,Vt,ou,nu,iu,su,au,cu,uu,lu,pu;var zr=_(()=>{Qe();Br();ue();N=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Wc={number:"number",bigint:"bigint",object:"date"},hi=g("$ZodCheckLessThan",(e,t)=>{N.init(e,t);let r=Wc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gi=g("$ZodCheckGreaterThan",(e,t)=>{N.init(e,t);let r=Wc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Gc=g("$ZodCheckMultipleOf",(e,t)=>{N.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):_c(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Kc=g("$ZodCheckNumberFormat",(e,t)=>{N.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=Sc[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=i,r)a.pattern=ui}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<n)s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Hc=g("$ZodCheckBigIntFormat",(e,t)=>{N.init(e,t);let[r,o]=$c[t.format];e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=(n)=>{let i=n.value;if(i<r)n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(i>o)n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Jc=g("$ZodCheckMaxSize",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.size<=t.maximum)return;o.issues.push({origin:Pr(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Yc=g("$ZodCheckMinSize",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.size>=t.minimum)return;o.issues.push({origin:Pr(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Xc=g("$ZodCheckSizeEquals",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=(o)=>{let n=o.value,i=n.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:Pr(n),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),eu=g("$ZodCheckMaxLength",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let s=Cr(n);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),tu=g("$ZodCheckMinLength",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let s=Cr(n);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ru=g("$ZodCheckLengthEquals",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,i=n.length;if(i===t.length)return;let s=Cr(n),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Vt=g("$ZodCheckStringFormat",(e,t)=>{var r,o;if(N.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),ou=g("$ZodCheckRegex",(e,t)=>{Vt.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),nu=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=fi),Vt.init(e,t)}),iu=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mi),Vt.init(e,t)}),su=g("$ZodCheckIncludes",(e,t)=>{N.init(e,t);let r=me(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),au=g("$ZodCheckStartsWith",(e,t)=>{N.init(e,t);let r=new RegExp(`^${me(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),cu=g("$ZodCheckEndsWith",(e,t)=>{N.init(e,t);let r=new RegExp(`.*${me(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});uu=g("$ZodCheckProperty",(e,t)=>{N.init(e,t),e._zod.check=(r)=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((n)=>Qc(n,r,t.property));Qc(o,r,t.property);return}}),lu=g("$ZodCheckMimeType",(e,t)=>{N.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(r.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),pu=g("$ZodCheckOverwrite",(e,t)=>{N.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}})});class yi{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
3
|
+
var ib=Object.defineProperty;var sb=(e)=>e;function ab(e,t){this[e]=sb.bind(null,t)}var vr=(e,t)=>{for(var r in t)ib(e,r,{get:t[r],enumerable:!0,configurable:!0,set:ab.bind(t,r)})};var _=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(o){r=[o]}if(r)throw r[0];return t};function lb(e=""){if(cb.test(e))return;return e!==e.toLowerCase()}function mc(e,t){let r=t??ub,o=[];if(!e||typeof e!=="string")return o;let n="",i,s;for(let a of e){let c=r.includes(a);if(c===!0){o.push(n),n="",i=void 0;continue}let u=lb(a);if(s===!1){if(i===!1&&u===!0){o.push(n),n=a,i=u;continue}if(i===!0&&u===!1&&n.length>1){let l=n.at(-1);o.push(n.slice(0,Math.max(0,n.length-1))),n=l+a,i=u;continue}}n+=a,i=u,s=c}return o.push(n),o}function pb(e){return e?e[0].toUpperCase()+e.slice(1):""}function db(e){return e?e[0].toLowerCase()+e.slice(1):""}function fb(e,t){return e?(Array.isArray(e)?e:mc(e)).map((r)=>pb(t?.normalize?r.toLowerCase():r)).join(""):""}function Ct(e,t){return db(fb(e||"",t))}function xr(e,t){return e?(Array.isArray(e)?e:mc(e)).map((r)=>r.toLowerCase()).join(t??"-"):""}function hc(e){return xr(e||"","_")}var cb,ub;var gc=_(()=>{cb=/\d/,ub=["-","_","/","."]});import{parseArgs as mb}from"util";function Rt(e){if(Array.isArray(e))return e;return e===void 0?[]:[e]}function kn(e,t=""){let r=[];for(let o of e)for(let[n,i]of o.entries())r[n]=Math.max(r[n]||0,i.length);return e.map((o)=>o.map((n,i)=>t+n[i===0?"padStart":"padEnd"](r[i])).join(" ")).join(`
|
|
4
|
+
`)}function G(e){return typeof e==="function"?e():e}function hb(e=[],t={}){let r=new Set(t.boolean||[]),o=new Set(t.string||[]),n=t.alias||{},i=t.default||{},s=new Map,a=new Map;for(let[y,b]of Object.entries(n)){let S=b;for(let x of S){if(s.set(y,x),!a.has(x))a.set(x,[]);if(a.get(x).push(y),s.set(x,y),!a.has(y))a.set(y,[]);a.get(y).push(x)}}let c={};function u(y){if(r.has(y))return"boolean";let b=a.get(y)||[];for(let S of b)if(r.has(S))return"boolean";return"string"}function l(y){if(o.has(y))return!0;let b=a.get(y)||[];for(let S of b)if(o.has(S))return!0;return!1}let f=new Set([...r,...o,...Object.keys(n),...Object.values(n).flat(),...Object.keys(i)]);for(let y of f)if(!c[y])c[y]={type:u(y),default:i[y]};for(let[y,b]of s.entries())if(y.length===1&&c[b]&&!c[b].short)c[b].short=y;let p=[],d={};for(let y=0;y<e.length;y++){let b=e[y];if(b==="--"){p.push(...e.slice(y));break}if(b.startsWith("--no-")){let S=b.slice(5);d[S]=!0;continue}p.push(b)}let m;try{m=mb({args:p,options:Object.keys(c).length>0?c:void 0,allowPositionals:!0,strict:!1})}catch{m={values:{},positionals:p}}let h={_:[]};h._=m.positionals;for(let[y,b]of Object.entries(m.values)){let S=b;if(u(y)==="boolean"&&typeof b==="string")S=b!=="false";else if(l(y)&&typeof b==="boolean")S="";h[y]=S}for(let[y]of Object.entries(d)){h[y]=!1;let b=s.get(y);if(b)h[b]=!1;let S=a.get(y);if(S)for(let x of S)h[x]=!1}for(let[y,b]of s.entries()){if(h[y]!==void 0&&h[b]===void 0)h[b]=h[y];if(h[b]!==void 0&&h[y]===void 0)h[y]=h[b];if(h[y]!==h[b]&&i[b]===h[b])h[b]=h[y]}return h}function yb(e,t){let r={boolean:[],string:[],alias:{},default:{}},o=_c(t);for(let a of o){if(a.type==="positional")continue;if(a.type==="string"||a.type==="enum")r.string.push(a.name);else if(a.type==="boolean")r.boolean.push(a.name);if(a.default!==void 0)r.default[a.name]=a.default;if(a.alias)r.alias[a.name]=a.alias;let c=Ct(a.name),u=xr(a.name);if(c!==a.name||u!==a.name){let l=Rt(r.alias[a.name]||[]);if(c!==a.name&&!l.includes(c))l.push(c);if(u!==a.name&&!l.includes(u))l.push(u);if(l.length>0)r.alias[a.name]=l}}let n=hb(e,r),[...i]=n._,s=new Proxy(n,{get(a,c){return a[c]??a[Ct(c)]??a[xr(c)]}});for(let[,a]of o.entries())if(a.type==="positional"){let c=i.shift();if(c!==void 0)s[a.name]=c;else if(a.default===void 0&&a.required!==!1)throw new Ce(`Missing required positional argument: ${a.name.toUpperCase()}`,"EARG");else s[a.name]=a.default}else if(a.type==="enum"){let c=s[a.name],u=a.options||[];if(c!==void 0&&u.length>0&&!u.includes(c))throw new Ce(`Invalid value for argument: ${fe(`--${a.name}`)} (${fe(c)}). Expected one of: ${u.map((l)=>fe(l)).join(", ")}.`,"EARG")}else if(a.required&&s[a.name]===void 0)throw new Ce(`Missing required argument: --${a.name}`,"EARG");return s}function _c(e){let t=[];for(let[r,o]of Object.entries(e||{}))t.push({...o,name:r,alias:Rt(o.alias)});return t}async function bb(e){return Promise.all(e.map((t)=>G(t)))}function E(e){return e}async function Cn(e,t){let r=await G(e.args||{}),o=yb(t.rawArgs,r),n={rawArgs:t.rawArgs,args:o,data:t.data,cmd:e},i=await bb(e.plugins??[]),s,a;try{for(let l of i)await l.setup?.(n);if(typeof e.setup==="function")await e.setup(n);let u=await G(e.subCommands);if(u&&Object.keys(u).length>0){let l=wc(t.rawArgs,r),f=t.rawArgs[l];if(f){let p=await Tn(u,f);if(!p)throw new Ce(`Unknown command ${fe(f)}`,"E_UNKNOWN_COMMAND");await Cn(p,{rawArgs:t.rawArgs.slice(l+1)})}else{let p=await G(e.default);if(p){if(e.run)throw new Ce("Cannot specify both 'run' and 'default' on the same command.","E_DEFAULT_CONFLICT");let d=await Tn(u,p);if(!d)throw new Ce(`Default sub command ${fe(p)} not found in subCommands.`,"E_UNKNOWN_COMMAND");await Cn(d,{rawArgs:t.rawArgs})}else if(!e.run)throw new Ce("No command specified.","E_NO_COMMAND")}}if(typeof e.run==="function")s=await e.run(n)}catch(u){a=u}let c=[];if(typeof e.cleanup==="function")try{await e.cleanup(n)}catch(u){c.push(u)}for(let u of[...i].reverse())try{await u.cleanup?.(n)}catch(l){c.push(l)}if(a)throw a;if(c.length===1)throw c[0];if(c.length>1)throw Error("Multiple cleanup errors",{cause:c});return{result:s}}async function Rn(e,t,r){let o=await G(e.subCommands);if(o&&Object.keys(o).length>0){let n=wc(t,await G(e.args||{})),i=t[n],s=await Tn(o,i);if(s)return Rn(s,t.slice(n+1),e)}return[e,r]}async function Tn(e,t){if(t in e)return G(e[t]);for(let r of Object.values(e)){let o=await G(r),n=await G(o?.meta);if(n?.alias){if(Rt(n.alias).includes(t))return o}}}function wc(e,t){for(let r=0;r<e.length;r++){let o=e[r];if(o==="--")return-1;if(o.startsWith("-")){if(!o.includes("=")&&_b(o,t))r++;continue}return r}return-1}function _b(e,t){let r=e.replace(/^-{1,2}/,""),o=Ct(r);for(let[n,i]of Object.entries(t)){if(i.type!=="string"&&i.type!=="enum")continue;if(o===Ct(n))return!0;if((Array.isArray(i.alias)?i.alias:i.alias?[i.alias]:[]).includes(r))return!0}return!1}async function wb(e,t){try{console.log(await xb(e,t)+`
|
|
5
|
+
`)}catch(r){console.error(r)}}async function xb(e,t){let r=await G(e.meta||{}),o=_c(await G(e.args||{})),n=await G(t?.meta||{}),i=`${n.name?`${n.name} `:""}`+(r.name||process.argv[1]),s=[],a=[],c=[],u=[];for(let d of o)if(d.type==="positional"){let m=d.name.toUpperCase(),h=d.required!==!1&&d.default===void 0;a.push([fe(m+Pn(d)),yc(d,h)]),u.push(h?`<${m}>`:`[${m}]`)}else{let m=d.required===!0&&d.default===void 0,h=[...(d.alias||[]).map((y)=>`-${y}`),`--${d.name}`].join(", ")+Pn(d);if(s.push([fe(h),yc(d,m)]),d.type==="boolean"&&(d.default===!0||d.negativeDescription)&&!vb.test(d.name)){let y=[...(d.alias||[]).map((b)=>`--no-${b}`),`--no-${d.name}`].join(", ");s.push([fe(y),[d.negativeDescription,m?$r("(Required)"):""].filter(Boolean).join(" ")])}if(m)u.push(`--${d.name}`+Pn(d))}if(e.subCommands){let d=[],m=await G(e.subCommands);for(let[h,y]of Object.entries(m)){let b=await G((await G(y))?.meta);if(b?.hidden)continue;let S=Rt(b?.alias),x=[h,...S].join(", ");c.push([fe(x),b?.description||""]),d.push(h,...S)}u.push(d.join("|"))}let l=[],f=r.version||n.version;l.push($r(`${r.description} (${i+(f?` v${f}`:"")})`),"");let p=s.length>0||a.length>0;if(l.push(`${Sr(Er("USAGE"))} ${fe(`${i}${p?" [OPTIONS]":""} ${u.join(" ")}`)}`,""),a.length>0)l.push(Sr(Er("ARGUMENTS")),""),l.push(kn(a," ")),l.push("");if(s.length>0)l.push(Sr(Er("OPTIONS")),""),l.push(kn(s," ")),l.push("");if(c.length>0)l.push(Sr(Er("COMMANDS")),""),l.push(kn(c," ")),l.push("",`Use ${fe(`${i} <command> --help`)} for more information about a command.`);return l.filter((d)=>typeof d==="string").join(`
|
|
6
|
+
`)}function Pn(e){let t=e.valueHint?`=<${e.valueHint}>`:"",r=t||`=<${hc(e.name)}>`;if(!e.type||e.type==="positional"||e.type==="boolean")return t;if(e.type==="enum"&&e.options?.length)return`=<${e.options.join("|")}>`;return r}function yc(e,t){let r=t?$r("(Required)"):"",o=e.default===void 0?"":$r(`(Default: ${e.default})`);return[e.description,r,o].filter(Boolean).join(" ")}async function Eb(e,t={}){let r=t.rawArgs||process.argv.slice(2),o=t.showUsage||wb;try{let n=await Sb(e);if(n.help.length>0&&r.some((i)=>n.help.includes(i)))await o(...await Rn(e,r)),process.exit(0);else if(r.length===1&&n.version.includes(r[0])){let i=typeof e.meta==="function"?await e.meta():await e.meta;if(!i?.version)throw new Ce("No version specified","E_NO_VERSION");console.log(i.version)}else await Cn(e,{rawArgs:r})}catch(n){if(n instanceof Ce)await o(...await Rn(e,r)),console.error(n.message);else console.error(n,`
|
|
7
|
+
`);process.exit(1)}}function vc(e){return(t={})=>Eb(e,t)}async function Sb(e){let t=await G(e.args||{}),r=new Set,o=new Set;for(let[n,i]of Object.entries(t)){r.add(n);for(let s of Rt(i.alias))o.add(s)}return{help:bc("help","h",r,o),version:bc("version","v",r,o)}}function bc(e,t,r,o){if(r.has(e)||o.has(e))return[];if(r.has(t)||o.has(t))return[`--${e}`];return[`--${e}`,`-${t}`]}var Ce,gb,Ar=(e,t=39)=>(r)=>gb?r:`\x1B[${e}m${r}\x1B[${t}m`,Er,fe,$r,Sr,vb;var M=_(()=>{gc();Ce=class extends Error{code;constructor(e,t){super(e);this.name="CLIError",this.code=t}};gb=(()=>{let e=globalThis.process?.env??{};return e.NO_COLOR==="1"||e.TERM==="dumb"||e.TEST||e.CI})(),Er=Ar(1,22),fe=Ar(36),$r=Ar(90),Sr=Ar(4,24);vb=/^no[-A-Z]/});function g(e,t,r){function o(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=s.prototype,l=Object.keys(u);for(let f=0;f<l.length;f++){let p=l[f];if(!(p in a))a[p]=u[p].bind(a)}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let u=r?.Parent?new i:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}function W(e){if(e)Object.assign(at,e);return at}var xc,$b,Re,ct,at;var Qe=_(()=>{$b=Symbol("zod_brand");Re=class Re extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};ct=class ct extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(xc=globalThis).__zod_globalConfig??(xc.__zod_globalConfig={});at=globalThis.__zod_globalConfig});function Pr(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function In(e,t="|"){return e.map((r)=>Nn(r)).join(t)}function Tt(e,t){if(typeof t==="bigint")return t.toString();return t}function Ot(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function We(e){return e===null||e===void 0}function Cr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Sc(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}function T(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===Ec)return;if(o===void 0)o=Ec,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ze(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Bn(e){return JSON.stringify(e)}function $c(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function ut(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ke(e){if(ut(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(ut(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Dn(e){if(Ke(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function w(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Nn(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Pc(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Ab(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=ze(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;s[a]=r.shape[a]}return Ge(this,"shape",s),s},checks:[]});return ce(e,i)}function kb(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=ze(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete s[a]}return Ge(this,"shape",s),s},checks:[]});return ce(e,i)}function Pb(e,t){if(!Ke(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=ze(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Ge(this,"shape",i),i}});return ce(e,n)}function Cb(e,t){if(!Ke(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ze(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Ge(this,"shape",o),o}});return ce(e,r)}function Rb(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ze(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Ge(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ce(e,r)}function Tb(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let s=ze(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;c[u]=e?new e({type:"optional",innerType:a[u]}):a[u]}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Ge(this,"shape",c),c},checks:[]});return ce(t,s)}function Ob(e,t,r){let o=ze(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;i[s]=new e({type:"nonoptional",innerType:n[s]})}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return Ge(this,"shape",i),i}});return ce(t,o)}function He(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Tc(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ne(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function kr(e){return typeof e==="string"?e:e?.message}function te(e,t,r){let o=e.message?e.message:kr(e.inst?._zod.def?.error?.(e))??kr(t?.error?.(e))??kr(r.customError?.(e))??kr(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:s,...a}=e;if(a.path??(a.path=[]),a.message=o,t?.reportInput)a.input=s;return a}function Tr(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Or(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Oc(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Je(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var Ec,zn,Ac,Rr,kc,Cc,Rc;var ue=_(()=>{Qe();Ec=Symbol("evaluating");zn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};Ac=Ot(()=>{if(at.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});Rr=new Set(["string","number","symbol"]),kc=new Set(["string","number","bigint","boolean","symbol","undefined"]);Cc={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Rc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function Ln(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Vn(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>o({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;while(u<a.length){let l=a[u];if(u!==a.length-1)c[l]=c[l]||{_errors:[]};else c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(s));c=c[l],u++}}}};return o(e),r}function Ib(e){let t=[],r=e.map((o)=>typeof o==="object"?o.key:o);for(let o of r)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function Bc(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)if(t.push(`\u2716 ${o.message}`),o.path?.length)t.push(` \u2192 at ${Ib(o.path)}`);return t.join(`
|
|
8
|
+
`)}var Ic=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Tt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ir,It;var Un=_(()=>{Qe();ue();Ir=g("$ZodError",Ic),It=g("$ZodError",Ic,{Parent:Error})});var Bt=(e)=>(t,r,o,n)=>{let i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Re;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>te(c,i,W())));throw zn(a,n?.callee),a}return s.value},Fn,zt=(e)=>async(t,r,o,n)=>{let i=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)s=await s;if(s.issues.length){let a=new(n?.Err??e)(s.issues.map((c)=>te(c,i,W())));throw zn(a,n?.callee),a}return s.value},Mn,Dt=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new Re;return i.issues.length?{success:!1,error:new(e??Ir)(i.issues.map((s)=>te(s,n,W())))}:{success:!0,data:i.value}},zc,Nt=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((s)=>te(s,n,W())))}:{success:!0,data:i.value}},Dc,Nc=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Bt(e)(t,r,n)},Lc=(e)=>(t,r,o)=>Bt(e)(t,r,o),Vc=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return zt(e)(t,r,n)},Uc=(e)=>async(t,r,o)=>zt(e)(t,r,o),Fc=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Dt(e)(t,r,n)},Mc=(e)=>(t,r,o)=>Dt(e)(t,r,o),jc=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Nt(e)(t,r,n)},Zc=(e)=>async(t,r,o)=>Nt(e)(t,r,o);var jn=_(()=>{Qe();Un();ue();Fn=Bt(It),Mn=zt(It),zc=Dt(It),Dc=Nt(It)});var Xe={};vr(Xe,{base64:()=>ii,base64url:()=>Br,bigint:()=>pi,boolean:()=>fi,browserEmail:()=>Mb,cidrv4:()=>oi,cidrv6:()=>ni,cuid:()=>Zn,cuid2:()=>qn,date:()=>ai,datetime:()=>ui,domain:()=>Wc,duration:()=>Hn,e164:()=>si,email:()=>Yn,emoji:()=>Xn,extendedDuration:()=>zb,guid:()=>Jn,hex:()=>Hc,hostname:()=>Qc,html5Email:()=>Vb,httpProtocol:()=>zr,idnEmail:()=>Fb,integer:()=>di,ipv4:()=>ei,ipv6:()=>ti,ksuid:()=>Gn,lowercase:()=>gi,mac:()=>ri,md5_base64:()=>qb,md5_base64url:()=>Qb,md5_hex:()=>Zb,nanoid:()=>Kn,null:()=>mi,number:()=>Dr,rfc5322Email:()=>Ub,sha1_base64:()=>Gb,sha1_base64url:()=>Kb,sha1_hex:()=>Wb,sha256_base64:()=>Jb,sha256_base64url:()=>Yb,sha256_hex:()=>Hb,sha384_base64:()=>e_,sha384_base64url:()=>t_,sha384_hex:()=>Xb,sha512_base64:()=>o_,sha512_base64url:()=>n_,sha512_hex:()=>r_,string:()=>li,time:()=>ci,ulid:()=>Qn,undefined:()=>hi,unicodeEmail:()=>qc,uppercase:()=>yi,uuid:()=>Ye,uuid4:()=>Db,uuid6:()=>Nb,uuid7:()=>Lb,xid:()=>Wn});function Xn(){return new RegExp(jb,"u")}function Kc(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function ci(e){return new RegExp(`^${Kc(e)}$`)}function ui(e){let t=Kc({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Gc}T(?:${o})$`)}function Lt(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Vt(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Zn,qn,Qn,Wn,Gn,Kn,Hn,zb,Jn,Ye=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Db,Nb,Lb,Yn,Vb,Ub,qc,Fb,Mb,jb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ei,ti,ri=(e)=>{let t=me(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},oi,ni,ii,Br,Qc,Wc,zr,si,Gc="(?:(?:\\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])))",ai,li=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},pi,di,Dr,fi,mi,hi,gi,yi,Hc,Zb,qb,Qb,Wb,Gb,Kb,Hb,Jb,Yb,Xb,e_,t_,r_,o_,n_;var Nr=_(()=>{ue();Zn=/^[cC][0-9a-z]{6,}$/,qn=/^[0-9a-z]+$/,Qn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wn=/^[0-9a-vA-V]{20}$/,Gn=/^[A-Za-z0-9]{27}$/,Kn=/^[a-zA-Z0-9_-]{21}$/,Hn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zb=/^[-+]?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)?)??$/,Jn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Db=Ye(4),Nb=Ye(6),Lb=Ye(7),Yn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Vb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ub=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,qc=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Fb=qc,Mb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;ei=/^(?:(?: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])$/,ti=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,oi=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,ni=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ii=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Br=/^[A-Za-z0-9_-]*$/,Qc=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Wc=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,zr=/^https?$/,si=/^\+[1-9]\d{6,14}$/,ai=new RegExp(`^${Gc}$`);pi=/^-?\d+n?$/,di=/^-?\d+$/,Dr=/^-?\d+(?:\.\d+)?$/,fi=/^(?:true|false)$/i,mi=/^null$/i,hi=/^undefined$/i,gi=/^[^A-Z]*$/,yi=/^[^a-z]*$/,Hc=/^[0-9a-fA-F]*$/;Zb=/^[0-9a-fA-F]{32}$/,qb=Lt(22,"=="),Qb=Vt(22),Wb=/^[0-9a-fA-F]{40}$/,Gb=Lt(27,"="),Kb=Vt(27),Hb=/^[0-9a-fA-F]{64}$/,Jb=Lt(43,"="),Yb=Vt(43),Xb=/^[0-9a-fA-F]{96}$/,e_=Lt(64,""),t_=Vt(64),r_=/^[0-9a-fA-F]{128}$/,o_=Lt(86,"=="),n_=Vt(86)});function Jc(e,t,r){if(e.issues.length)t.issues.push(...ne(r,e.issues))}var N,Yc,bi,_i,Xc,eu,tu,ru,ou,nu,iu,su,au,Ut,cu,uu,lu,pu,du,fu,mu,hu,gu;var Lr=_(()=>{Qe();Nr();ue();N=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Yc={number:"number",bigint:"bigint",object:"date"},bi=g("$ZodCheckLessThan",(e,t)=>{N.init(e,t);let r=Yc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_i=g("$ZodCheckGreaterThan",(e,t)=>{N.init(e,t);let r=Yc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xc=g("$ZodCheckMultipleOf",(e,t)=>{N.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Sc(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eu=g("$ZodCheckNumberFormat",(e,t)=>{N.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=Cc[t.format];e._zod.onattach.push((s)=>{let a=s._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=i,r)a.pattern=di}),e._zod.check=(s)=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<n)s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),tu=g("$ZodCheckBigIntFormat",(e,t)=>{N.init(e,t);let[r,o]=Rc[t.format];e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=(n)=>{let i=n.value;if(i<r)n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(i>o)n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),ru=g("$ZodCheckMaxSize",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.size<=t.maximum)return;o.issues.push({origin:Tr(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ou=g("$ZodCheckMinSize",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.size>=t.minimum)return;o.issues.push({origin:Tr(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),nu=g("$ZodCheckSizeEquals",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=(o)=>{let n=o.value,i=n.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:Tr(n),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),iu=g("$ZodCheckMaxLength",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let s=Or(n);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),su=g("$ZodCheckMinLength",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let s=Or(n);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),au=g("$ZodCheckLengthEquals",(e,t)=>{var r;N.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!We(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,i=n.length;if(i===t.length)return;let s=Or(n),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ut=g("$ZodCheckStringFormat",(e,t)=>{var r,o;if(N.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),cu=g("$ZodCheckRegex",(e,t)=>{Ut.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),uu=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=gi),Ut.init(e,t)}),lu=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=yi),Ut.init(e,t)}),pu=g("$ZodCheckIncludes",(e,t)=>{N.init(e,t);let r=me(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),du=g("$ZodCheckStartsWith",(e,t)=>{N.init(e,t);let r=new RegExp(`^${me(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),fu=g("$ZodCheckEndsWith",(e,t)=>{N.init(e,t);let r=new RegExp(`.*${me(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});mu=g("$ZodCheckProperty",(e,t)=>{N.init(e,t),e._zod.check=(r)=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((n)=>Jc(n,r,t.property));Jc(o,r,t.property);return}}),hu=g("$ZodCheckMimeType",(e,t)=>{N.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(r.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),gu=g("$ZodCheckOverwrite",(e,t)=>{N.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}})});class wi{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
9
9
|
`).filter((i)=>i),o=Math.min(...r.map((i)=>i.length-i.trimStart().length)),n=r.map((i)=>i.slice(o)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
|
|
10
|
-
`))}}var fu;var bi=_(()=>{fu={major:4,minor:4,patch:3}});function Gu(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function o_(e){if(!Tr.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Gu(r)}function n_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}function mu(e,t,r){if(e.issues.length)t.issues.push(...ne(r,e.issues));t.value[r]=e.value}function Vr(e,t,r,o,n,i){let s=r in o;if(e.issues.length){if(n&&i&&!s)return;t.issues.push(...ne(r,e.issues))}if(!s&&!n){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s)t.value[r]=void 0}else t.value[r]=e.value}function pl(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Ec(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function dl(e,t,r,o,n,i){let s=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",f=c.optout==="optional";for(let d in t){if(d==="__proto__")continue;if(a.has(d))continue;if(u==="never"){s.push(d);continue}let p=c.run({value:t[d],issues:[]},o);if(p instanceof Promise)e.push(p.then((h)=>Vr(h,r,d,t,l,f)));else Vr(p,r,d,t,l,f)}if(s.length)r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i});if(!e.length)return r;return Promise.all(e).then(()=>r)}function hu(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!He(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>te(s,o,W())))}),t}function gu(e,t,r,o){let n=e.filter((i)=>i.issues.length===0);if(n.length===1)return t.value=n[0].value,t;if(n.length===0)t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>te(s,o,W())))});else t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1});return t}function _i(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Ke(e)&&Ke(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let s=_i(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=_i(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function yu(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).r=!0}else e.issues.push(a);let i=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&n)e.issues.push({...n,keys:i});if(He(e))return e;let s=_i(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}function bu(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function _u(e,t,r){if(e.issues.length)t.issues.push(...ne(r,e.issues));t.value[r]=e.value}function wu(e,t,r,o,n){for(let i=0;i<r.length;i++){let s=e[i],a=i<o.length;if(s.issues.length){if(!a&&i>=n){t.value.length=i;break}t.issues.push(...ne(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=o.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}function vu(e,t,r,o,n,i,s){if(e.issues.length)if(kr.has(typeof o))r.issues.push(...ne(o,e.issues));else r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map((a)=>te(a,s,W()))});if(t.issues.length)if(kr.has(typeof o))r.issues.push(...ne(o,t.issues));else r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map((a)=>te(a,s,W()))});r.value.set(e.value,t.value)}function xu(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}function Eu(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}function Su(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}function $u(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Dr(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}function Nr(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);if(n instanceof Promise)return n.then((i)=>Lr(e,i,t.out,r));return Lr(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);if(n instanceof Promise)return n.then((i)=>Lr(e,i,t.in,r));return Lr(e,n,t.in,r)}}function Lr(e,t,r,o){if(e.issues.length)return e.aborted=!0,e;return r._zod.run({value:t,issues:e.issues},o)}function Au(e){return e.value=Object.freeze(e.value),e}function ku(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(Je(n))}}var P,lt,B,Pu,Cu,Ru,Tu,Ou,Iu,Bu,zu,Du,Nu,Lu,Vu,Uu,Mu,Fu,ju,Zu,qu,Qu,Wu,Ku,Hu,Ju,Yu,Xu,wi,el,Ur,vi,tl,rl,ol,nl,il,sl,al,cl,ul,ll,i_,fl,Mr,ml,hl,gl,xi,yl,bl,_l,wl,vl,xl,El,Ei,Sl,$l,Al,kl,Pl,Cl,Rl,Tl,Si,Fr,Ol,Il,Bl,zl,Dl,Nl,Ll;var $i=_(()=>{zr();Qe();Un();Br();ue();bi();ue();P=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fu;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,a,c)=>{let u=He(s),l;for(let f of a){if(f._zod.def.when){if(Ac(s))continue;if(!f._zod.def.when(s))continue}else if(u)continue;let d=s.issues.length,p=f._zod.check(s);if(p instanceof Promise&&c?.async===!1)throw new Re;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await p,s.issues.length===d)return;if(!u)u=He(s,d)});else{if(s.issues.length===d)continue;if(!u)u=He(s,d)}}if(l)return l.then(()=>s);return s},i=(s,a,c)=>{if(He(s))return s.aborted=!0,s;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Re;return u.then((l)=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((l)=>i(l,s,a));return i(u,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Re;return c.then((u)=>n(u,o,a))}return n(c,o,a)}}T(e,"~standard",()=>({validate:(n)=>{try{let i=Rc(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return Tc(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),lt=g("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ai(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),B=g("$ZodStringFormat",(e,t)=>{Vt.init(e,t),lt.init(e,t)}),Pu=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Gn),B.init(e,t)}),Cu=g("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ye(o))}else t.pattern??(t.pattern=Ye());B.init(e,t)}),Ru=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Kn),B.init(e,t)}),Tu=g("$ZodURL",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===Or.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let n=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=n.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ou=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Hn()),B.init(e,t)}),Iu=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Qn),B.init(e,t)}),Bu=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Mn),B.init(e,t)}),zu=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Fn),B.init(e,t)}),Du=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=jn),B.init(e,t)}),Nu=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Zn),B.init(e,t)}),Lu=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=qn),B.init(e,t)}),Vu=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=si(t)),B.init(e,t)}),Uu=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ni),B.init(e,t)}),Mu=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ii(t)),B.init(e,t)}),Fu=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Wn),B.init(e,t)}),ju=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Jn),B.init(e,t),e._zod.bag.format="ipv4"}),Zu=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Yn),B.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),qu=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Xn(t.delimiter)),B.init(e,t),e._zod.bag.format="mac"}),Qu=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ei),B.init(e,t)}),Wu=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ti),B.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[n,i]=o;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});Ku=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ri),B.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Gu(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});Hu=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Tr),B.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(o_(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ju=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=oi),B.init(e,t)});Yu=g("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{if(n_(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Xu=g("$ZodCustomStringFormat",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),wi=g("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ir,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),el=g("$ZodNumberFormat",(e,t)=>{Kc.init(e,t),wi.init(e,t)}),Ur=g("$ZodBoolean",(e,t)=>{P.init(e,t),e._zod.pattern=li,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),vi=g("$ZodBigInt",(e,t)=>{P.init(e,t),e._zod.pattern=ci,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(n){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),tl=g("$ZodBigIntFormat",(e,t)=>{Hc.init(e,t),vi.init(e,t)}),rl=g("$ZodSymbol",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),ol=g("$ZodUndefined",(e,t)=>{P.init(e,t),e._zod.pattern=di,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),nl=g("$ZodNull",(e,t)=>{P.init(e,t),e._zod.pattern=pi,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),il=g("$ZodAny",(e,t)=>{P.init(e,t),e._zod.parse=(r)=>r}),sl=g("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=(r)=>r}),al=g("$ZodNever",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),cl=g("$ZodVoid",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),ul=g("$ZodDate",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(a){}let n=r.value,i=n instanceof Date;if(i&&!Number.isNaN(n.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});ll=g("$ZodArray",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let a=n[s],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>mu(u,r,s)));else mu(c,r,s)}if(i.length)return Promise.all(i).then(()=>r);return r}});i_=g("$ZodObject",(e,t)=>{if(P.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=Tt(()=>pl(t));T(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let f of l.values)c[u].add(f)}}return c});let n=ut,i=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],f=s.shape;for(let d of s.keys){let p=f[d],h=p._zod.optin==="optional",m=p._zod.optout==="optional",y=p._zod.run({value:u[d],issues:[]},c);if(y instanceof Promise)l.push(y.then((b)=>Vr(b,a,d,u,h,m)));else Vr(y,a,d,u,h,m)}if(!i)return l.length?Promise.all(l).then(()=>a):a;return dl(l,u,a,c,o.value,e)}}),fl=g("$ZodObjectJIT",(e,t)=>{i_.init(e,t);let r=e._zod.parse,o=Tt(()=>pl(t)),n=(d)=>{let p=new yi(["shape","payload","ctx"]),h=o.value,m=(x)=>{let A=Tn(x);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};p.write("const input = payload.value;");let y=Object.create(null),b=0;for(let x of h.keys)y[x]=`key_${b++}`;p.write("const newResult = {};");for(let x of h.keys){let A=y[x],R=Tn(x),Z=d[x],_e=Z?._zod?.optin==="optional",Ze=Z?._zod?.optout==="optional";if(p.write(`const ${A} = ${m(x)};`),_e&&Ze)p.write(`
|
|
10
|
+
`))}}var bu;var vi=_(()=>{bu={major:4,minor:4,patch:3}});function Xu(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function i_(e){if(!Br.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xu(r)}function s_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}function _u(e,t,r){if(e.issues.length)t.issues.push(...ne(r,e.issues));t.value[r]=e.value}function Mr(e,t,r,o,n,i){let s=r in o;if(e.issues.length){if(n&&i&&!s)return;t.issues.push(...ne(r,e.issues))}if(!s&&!n){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s)t.value[r]=void 0}else t.value[r]=e.value}function gl(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Pc(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function yl(e,t,r,o,n,i){let s=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",f=c.optout==="optional";for(let p in t){if(p==="__proto__")continue;if(a.has(p))continue;if(u==="never"){s.push(p);continue}let d=c.run({value:t[p],issues:[]},o);if(d instanceof Promise)e.push(d.then((m)=>Mr(m,r,p,t,l,f)));else Mr(d,r,p,t,l,f)}if(s.length)r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i});if(!e.length)return r;return Promise.all(e).then(()=>r)}function wu(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!He(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>te(s,o,W())))}),t}function vu(e,t,r,o){let n=e.filter((i)=>i.issues.length===0);if(n.length===1)return t.value=n[0].value,t;if(n.length===0)t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>te(s,o,W())))});else t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1});return t}function xi(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Ke(e)&&Ke(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let s=xi(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=xi(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function xu(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).r=!0}else e.issues.push(a);let i=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&n)e.issues.push({...n,keys:i});if(He(e))return e;let s=xi(t.value,r.value);if(!s.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}function Eu(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function Su(e,t,r){if(e.issues.length)t.issues.push(...ne(r,e.issues));t.value[r]=e.value}function $u(e,t,r,o,n){for(let i=0;i<r.length;i++){let s=e[i],a=i<o.length;if(s.issues.length){if(!a&&i>=n){t.value.length=i;break}t.issues.push(...ne(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=o.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}function Au(e,t,r,o,n,i,s){if(e.issues.length)if(Rr.has(typeof o))r.issues.push(...ne(o,e.issues));else r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map((a)=>te(a,s,W()))});if(t.issues.length)if(Rr.has(typeof o))r.issues.push(...ne(o,t.issues));else r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map((a)=>te(a,s,W()))});r.value.set(e.value,t.value)}function ku(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}function Pu(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}function Cu(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}function Ru(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Vr(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}function Ur(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);if(n instanceof Promise)return n.then((i)=>Fr(e,i,t.out,r));return Fr(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);if(n instanceof Promise)return n.then((i)=>Fr(e,i,t.in,r));return Fr(e,n,t.in,r)}}function Fr(e,t,r,o){if(e.issues.length)return e.aborted=!0,e;return r._zod.run({value:t,issues:e.issues},o)}function Tu(e){return e.value=Object.freeze(e.value),e}function Ou(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(Je(n))}}var P,lt,B,Iu,Bu,zu,Du,Nu,Lu,Vu,Uu,Fu,Mu,ju,Zu,qu,Qu,Wu,Gu,Ku,Hu,Ju,Yu,el,tl,rl,ol,nl,Ei,il,jr,Si,sl,al,cl,ul,ll,pl,dl,fl,ml,hl,a_,bl,Zr,_l,wl,vl,$i,xl,El,Sl,$l,Al,kl,Pl,Ai,Cl,Rl,Tl,Ol,Il,Bl,zl,Dl,ki,qr,Nl,Ll,Vl,Ul,Fl,Ml,jl;var Pi=_(()=>{Lr();Qe();jn();Nr();ue();vi();ue();P=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bu;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,a,c)=>{let u=He(s),l;for(let f of a){if(f._zod.def.when){if(Tc(s))continue;if(!f._zod.def.when(s))continue}else if(u)continue;let p=s.issues.length,d=f._zod.check(s);if(d instanceof Promise&&c?.async===!1)throw new Re;if(l||d instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await d,s.issues.length===p)return;if(!u)u=He(s,p)});else{if(s.issues.length===p)continue;if(!u)u=He(s,p)}}if(l)return l.then(()=>s);return s},i=(s,a,c)=>{if(He(s))return s.aborted=!0,s;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Re;return u.then((l)=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((l)=>i(l,s,a));return i(u,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Re;return c.then((u)=>n(u,o,a))}return n(c,o,a)}}T(e,"~standard",()=>({validate:(n)=>{try{let i=zc(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return Dc(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),lt=g("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??li(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),B=g("$ZodStringFormat",(e,t)=>{Ut.init(e,t),lt.init(e,t)}),Iu=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Jn),B.init(e,t)}),Bu=g("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ye(o))}else t.pattern??(t.pattern=Ye());B.init(e,t)}),zu=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Yn),B.init(e,t)}),Du=g("$ZodURL",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===zr.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}}let n=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=n.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Nu=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Xn()),B.init(e,t)}),Lu=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Kn),B.init(e,t)}),Vu=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Zn),B.init(e,t)}),Uu=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qn),B.init(e,t)}),Fu=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Qn),B.init(e,t)}),Mu=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Wn),B.init(e,t)}),ju=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Gn),B.init(e,t)}),Zu=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ui(t)),B.init(e,t)}),qu=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ai),B.init(e,t)}),Qu=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ci(t)),B.init(e,t)}),Wu=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Hn),B.init(e,t)}),Gu=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ei),B.init(e,t),e._zod.bag.format="ipv4"}),Ku=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ti),B.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Hu=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=ri(t.delimiter)),B.init(e,t),e._zod.bag.format="mac"}),Ju=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=oi),B.init(e,t)}),Yu=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ni),B.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[n,i]=o;if(!i)throw Error();let s=Number(i);if(`${s}`!==i)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});el=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ii),B.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(Xu(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});tl=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Br),B.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(i_(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),rl=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=si),B.init(e,t)});ol=g("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{if(s_(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),nl=g("$ZodCustomStringFormat",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Ei=g("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=e._zod.bag.pattern??Dr,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),il=g("$ZodNumberFormat",(e,t)=>{eu.init(e,t),Ei.init(e,t)}),jr=g("$ZodBoolean",(e,t)=>{P.init(e,t),e._zod.pattern=fi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Si=g("$ZodBigInt",(e,t)=>{P.init(e,t),e._zod.pattern=pi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(n){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),sl=g("$ZodBigIntFormat",(e,t)=>{tu.init(e,t),Si.init(e,t)}),al=g("$ZodSymbol",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),cl=g("$ZodUndefined",(e,t)=>{P.init(e,t),e._zod.pattern=hi,e._zod.values=new Set([void 0]),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),ul=g("$ZodNull",(e,t)=>{P.init(e,t),e._zod.pattern=mi,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),ll=g("$ZodAny",(e,t)=>{P.init(e,t),e._zod.parse=(r)=>r}),pl=g("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=(r)=>r}),dl=g("$ZodNever",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),fl=g("$ZodVoid",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),ml=g("$ZodDate",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(a){}let n=r.value,i=n instanceof Date;if(i&&!Number.isNaN(n.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});hl=g("$ZodArray",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let a=n[s],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)i.push(c.then((u)=>_u(u,r,s)));else _u(c,r,s)}if(i.length)return Promise.all(i).then(()=>r);return r}});a_=g("$ZodObject",(e,t)=>{if(P.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=Ot(()=>gl(t));T(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let f of l.values)c[u].add(f)}}return c});let n=ut,i=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],f=s.shape;for(let p of s.keys){let d=f[p],m=d._zod.optin==="optional",h=d._zod.optout==="optional",y=d._zod.run({value:u[p],issues:[]},c);if(y instanceof Promise)l.push(y.then((b)=>Mr(b,a,p,u,m,h)));else Mr(y,a,p,u,m,h)}if(!i)return l.length?Promise.all(l).then(()=>a):a;return yl(l,u,a,c,o.value,e)}}),bl=g("$ZodObjectJIT",(e,t)=>{a_.init(e,t);let r=e._zod.parse,o=Ot(()=>gl(t)),n=(p)=>{let d=new wi(["shape","payload","ctx"]),m=o.value,h=(x)=>{let A=Bn(x);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};d.write("const input = payload.value;");let y=Object.create(null),b=0;for(let x of m.keys)y[x]=`key_${b++}`;d.write("const newResult = {};");for(let x of m.keys){let A=y[x],R=Bn(x),Z=p[x],_e=Z?._zod?.optin==="optional",Ze=Z?._zod?.optout==="optional";if(d.write(`const ${A} = ${h(x)};`),_e&&Ze)d.write(`
|
|
11
11
|
if (${A}.issues.length) {
|
|
12
12
|
if (${R} in input) {
|
|
13
13
|
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
@@ -25,7 +25,7 @@ var ob=Object.defineProperty;var nb=(e)=>e;function ib(e,t){this[e]=nb.bind(null
|
|
|
25
25
|
newResult[${R}] = ${A}.value;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
`);else if(!_e)
|
|
28
|
+
`);else if(!_e)d.write(`
|
|
29
29
|
const ${A}_present = ${R} in input;
|
|
30
30
|
if (${A}.issues.length) {
|
|
31
31
|
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
@@ -50,7 +50,7 @@ var ob=Object.defineProperty;var nb=(e)=>e;function ib(e,t){this[e]=nb.bind(null
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
`);else
|
|
53
|
+
`);else d.write(`
|
|
54
54
|
if (${A}.issues.length) {
|
|
55
55
|
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
56
56
|
...iss,
|
|
@@ -66,52 +66,52 @@ var ob=Object.defineProperty;var nb=(e)=>e;function ib(e,t){this[e]=nb.bind(null
|
|
|
66
66
|
newResult[${R}] = ${A}.value;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");let S=p.compile();return(x,A)=>S(d,x,A)},i,s=ut,a=!at.jitless,u=a&&vc.value,l=t.catchall,f;e._zod.parse=(d,p)=>{f??(f=o.value);let h=d.value;if(!s(h))return d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d;if(a&&u&&p?.async===!1&&p.jitless!==!0){if(!i)i=n(t.shape);if(d=i(d,p),!l)return d;return dl([],h,d,p,f,e)}return r(d,p)}});Mr=g("$ZodUnion",(e,t)=>{P.init(e,t),T(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),T(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),T(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),T(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${o.map((n)=>Ar(n.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return hu(s,o,e,n);return Promise.all(s).then((a)=>hu(a,o,e,n))}});ml=g("$ZodXor",(e,t)=>{Mr.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)s.push(c),i=!0;else s.push(c)}if(!i)return gu(s,o,e,n);return Promise.all(s).then((a)=>gu(a,o,e,n))}}),hl=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Mr.init(e,t);let r=e._zod.parse;T(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){if(!n[a])n[a]=new Set;for(let u of c)n[a].add(u)}}return n});let o=Tt(()=>{let n=t.options,i=new Map;for(let s of n){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!ut(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:s,path:[t.discriminator],inst:e}),n}}),gl=g("$ZodIntersection",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,u])=>yu(r,c,u));return yu(r,i,s)}});xi=g("$ZodTuple",(e,t)=>{P.init(e,t);let r=t.items;e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[],a=bu(r,"optin"),c=bu(r,"optout");if(!t.rest){if(i.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:i,inst:e,origin:"array"}),o;if(i.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:e,origin:"array"})}let u=Array(r.length);for(let l=0;l<r.length;l++){let f=r[l]._zod.run({value:i[l],issues:[]},n);if(f instanceof Promise)s.push(f.then((d)=>{u[l]=d}));else u[l]=f}if(t.rest){let l=r.length-1,f=i.slice(r.length);for(let d of f){l++;let p=t.rest._zod.run({value:d,issues:[]},n);if(p instanceof Promise)s.push(p.then((h)=>_u(h,o,l)));else _u(p,o,l)}}if(s.length)return Promise.all(s).then(()=>wu(u,o,r,i,c));return wu(u,o,r,i,c)}});yl=g("$ZodRecord",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Ke(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){a.add(typeof u==="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((p)=>te(p,o,W())),input:u,path:[u],inst:e});continue}let f=l.value,d=t.valueType._zod.run({value:n[u],issues:[]},o);if(d instanceof Promise)i.push(d.then((p)=>{if(p.issues.length)r.issues.push(...ne(u,p.issues));r.value[f]=p.value}));else{if(d.issues.length)r.issues.push(...ne(u,d.issues));r.value[f]=d.value}}let c;for(let u in n)if(!a.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Ir.test(a)&&c.issues.length){let f=t.keyType._zod.run({value:Number(a),issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)c=f}if(c.issues.length){if(t.mode==="loose")r.value[a]=n[a];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((f)=>te(f,o,W())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);if(l instanceof Promise)i.push(l.then((f)=>{if(f.issues.length)r.issues.push(...ne(a,f.issues));r.value[c.value]=f.value}));else{if(l.issues.length)r.issues.push(...ne(a,l.issues));r.value[c.value]=l.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}}),bl=g("$ZodMap",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,a]of n){let c=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);if(c instanceof Promise||u instanceof Promise)i.push(Promise.all([c,u]).then(([l,f])=>{vu(l,f,r,s,n,e,o)}));else vu(c,u,r,s,n,e,o)}if(i.length)return Promise.all(i).then(()=>r);return r}});_l=g("$ZodSet",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((c)=>xu(c,r)));else xu(a,r)}if(i.length)return Promise.all(i).then(()=>r);return r}});wl=g("$ZodEnum",(e,t)=>{P.init(e,t);let r=$r(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>kr.has(typeof n)).map((n)=>typeof n==="string"?me(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),vl=g("$ZodLiteral",(e,t)=>{if(P.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?me(o):o?me(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),xl=g("$ZodFile",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(n instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),El=g("$ZodTransform",(e,t)=>{P.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ct(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r.fallback=!0,r));if(n instanceof Promise)throw new Re;return r.value=n,r.fallback=!0,r}});Ei=g("$ZodOptional",(e,t)=>{P.init(e,t),e._zod.optin="optional",e._zod.optout="optional",T(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),T(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ar(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,i=t.innerType._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Eu(s,n));return Eu(i,n)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Sl=g("$ZodExactOptional",(e,t)=>{Ei.init(e,t),T(e._zod,"values",()=>t.innerType._zod.values),T(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),$l=g("$ZodNullable",(e,t)=>{P.init(e,t),T(e._zod,"optin",()=>t.innerType._zod.optin),T(e._zod,"optout",()=>t.innerType._zod.optout),T(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ar(r.source)}|null)$`):void 0}),T(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Al=g("$ZodDefault",(e,t)=>{P.init(e,t),e._zod.optin="optional",T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Su(i,t));return Su(n,t)}});kl=g("$ZodPrefault",(e,t)=>{P.init(e,t),e._zod.optin="optional",T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Pl=g("$ZodNonOptional",(e,t)=>{P.init(e,t),T(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>$u(i,e));return $u(n,e)}});Cl=g("$ZodSuccess",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ct("ZodSuccess");let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>(r.value=i.issues.length===0,r));return r.value=n.issues.length===0,r}}),Rl=g("$ZodCatch",(e,t)=>{P.init(e,t),e._zod.optin="optional",T(e._zod,"optout",()=>t.innerType._zod.optout),T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>te(s,o,W()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>te(i,o,W()))},input:r.value}),r.issues=[],r.fallback=!0;return r}}),Tl=g("$ZodNaN",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),Si=g("$ZodPipe",(e,t)=>{P.init(e,t),T(e._zod,"values",()=>t.in._zod.values),T(e._zod,"optin",()=>t.in._zod.optin),T(e._zod,"optout",()=>t.out._zod.optout),T(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Dr(s,t.in,o));return Dr(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Dr(i,t.out,o));return Dr(n,t.out,o)}});Fr=g("$ZodCodec",(e,t)=>{P.init(e,t),T(e._zod,"values",()=>t.in._zod.values),T(e._zod,"optin",()=>t.in._zod.optin),T(e._zod,"optout",()=>t.out._zod.optout),T(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Nr(s,t,o));return Nr(i,t,o)}else{let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Nr(s,t,o));return Nr(i,t,o)}}});Ol=g("$ZodPreprocess",(e,t)=>{Si.init(e,t)}),Il=g("$ZodReadonly",(e,t)=>{P.init(e,t),T(e._zod,"propValues",()=>t.innerType._zod.propValues),T(e._zod,"values",()=>t.innerType._zod.values),T(e._zod,"optin",()=>t.innerType?._zod?.optin),T(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Au);return Au(n)}});Bl=g("$ZodTemplateLiteral",(e,t)=>{P.init(e,t);let r=[];for(let o of t.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||xc.has(typeof o))r.push(me(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o;return o}}),zl=g("$ZodFunction",(e,t)=>(P.init(e,t),e._def=t,e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return function(...o){let n=e._def.input?Ln(e._def.input,o):o,i=Reflect.apply(r,this,n);if(e._def.output)return Ln(e._def.output,i);return i}},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let n=e._def.input?await Vn(e._def.input,o):o,i=await Reflect.apply(r,this,n);if(e._def.output)return await Vn(e._def.output,i);return i}},e._zod.parse=(r,o)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let o=e.constructor;if(Array.isArray(r[0]))return new o({type:"function",input:new xi({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new o({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),Dl=g("$ZodPromise",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then((n)=>t.innerType._zod.run({value:n,issues:[]},o))}),Nl=g("$ZodLazy",(e,t)=>{P.init(e,t),T(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),T(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),T(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),T(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),T(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Ll=g("$ZodCustom",(e,t)=>{N.init(e,t),P.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>ku(i,r,o,e));ku(n,r,o,e);return}})});function Ai(){return{localeError:a_()}}var a_=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=kc(n.input),a=o[s]??s;return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${Bn(n.values[0])}`;return`Invalid option: expected one of ${Rn(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`;return`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Rn(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0)return`Invalid discriminator value. Expected ${n.options.map((s)=>`'${s}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};var Vl=_(()=>{ue()});var ki=()=>{};class Fl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function jl(){return new Fl}var Ml,c_,u_,Y;var Ut=_(()=>{c_=Symbol("ZodOutput"),u_=Symbol("ZodInput");(Ml=globalThis).__zod_globalRegistry??(Ml.__zod_globalRegistry=jl());Y=globalThis.__zod_globalRegistry});function Zl(e,t){return new e({type:"string",...w(t)})}function Pi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function jr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function Ri(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function Ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Zr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Ii(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Bi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function zi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Di(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Ni(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function Li(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function Vi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function Ui(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Mi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function ql(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...w(t)})}function Fi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function ji(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function Zi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function qi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function Qi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function Wi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function Ql(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function Wl(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function Gl(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function Kl(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function Hl(e,t){return new e({type:"number",checks:[],...w(t)})}function Jl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function Yl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...w(t)})}function Xl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...w(t)})}function ep(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...w(t)})}function tp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...w(t)})}function rp(e,t){return new e({type:"boolean",...w(t)})}function op(e,t){return new e({type:"bigint",...w(t)})}function np(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...w(t)})}function ip(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...w(t)})}function sp(e,t){return new e({type:"symbol",...w(t)})}function ap(e,t){return new e({type:"undefined",...w(t)})}function cp(e,t){return new e({type:"null",...w(t)})}function up(e){return new e({type:"any"})}function lp(e){return new e({type:"unknown"})}function pp(e,t){return new e({type:"never",...w(t)})}function dp(e,t){return new e({type:"void",...w(t)})}function fp(e,t){return new e({type:"date",...w(t)})}function mp(e,t){return new e({type:"nan",...w(t)})}function De(e,t){return new hi({check:"less_than",...w(t),value:e,inclusive:!1})}function ge(e,t){return new hi({check:"less_than",...w(t),value:e,inclusive:!0})}function Ne(e,t){return new gi({check:"greater_than",...w(t),value:e,inclusive:!1})}function ie(e,t){return new gi({check:"greater_than",...w(t),value:e,inclusive:!0})}function hp(e){return Ne(0,e)}function gp(e){return De(0,e)}function yp(e){return ge(0,e)}function bp(e){return ie(0,e)}function pt(e,t){return new Gc({check:"multiple_of",...w(t),value:e})}function dt(e,t){return new Jc({check:"max_size",...w(t),maximum:e})}function Le(e,t){return new Yc({check:"min_size",...w(t),minimum:e})}function Mt(e,t){return new Xc({check:"size_equals",...w(t),size:e})}function Ft(e,t){return new eu({check:"max_length",...w(t),maximum:e})}function et(e,t){return new tu({check:"min_length",...w(t),minimum:e})}function jt(e,t){return new ru({check:"length_equals",...w(t),length:e})}function qr(e,t){return new ou({check:"string_format",format:"regex",...w(t),pattern:e})}function Qr(e){return new nu({check:"string_format",format:"lowercase",...w(e)})}function Wr(e){return new iu({check:"string_format",format:"uppercase",...w(e)})}function Gr(e,t){return new su({check:"string_format",format:"includes",...w(t),includes:e})}function Kr(e,t){return new au({check:"string_format",format:"starts_with",...w(t),prefix:e})}function Hr(e,t){return new cu({check:"string_format",format:"ends_with",...w(t),suffix:e})}function _p(e,t,r){return new uu({check:"property",property:e,schema:t,...w(r)})}function Jr(e,t){return new lu({check:"mime_type",mime:e,...w(t)})}function Te(e){return new pu({check:"overwrite",tx:e})}function Yr(e){return Te((t)=>t.normalize(e))}function Xr(){return Te((e)=>e.trim())}function eo(){return Te((e)=>e.toLowerCase())}function to(){return Te((e)=>e.toUpperCase())}function ro(){return Te((e)=>wc(e))}function wp(e,t,r){return new e({type:"array",element:t,...w(r)})}function vp(e,t){return new e({type:"file",...w(t)})}function xp(e,t,r){let o=w(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Ep(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}function Sp(e,t){let r=p_((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(Je(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(Je(i))}},e(o.value,o)),t);return r}function p_(e,t){let r=new N({check:"custom",...w(t)});return r._zod.check=e,r}function $p(e){let t=new N({check:"describe"});return t._zod.onattach=[(r)=>{let o=Y.get(r)??{};Y.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Ap(e){let t=new N({check:"meta"});return t._zod.onattach=[(r)=>{let o=Y.get(r)??{};Y.add(r,{...o,...e})}],t._zod.check=()=>{},t}function kp(e,t){let r=w(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((p)=>typeof p==="string"?p.toLowerCase():p),n=n.map((p)=>typeof p==="string"?p.toLowerCase():p);let i=new Set(o),s=new Set(n),a=e.Codec??Fr,c=e.Boolean??Ur,l=new(e.String??lt)({type:"string",error:r.error}),f=new c({type:"boolean",error:r.error}),d=new a({type:"pipe",in:l,out:f,transform:(p,h)=>{let m=p;if(r.case!=="sensitive")m=m.toLowerCase();if(i.has(m))return!0;else if(s.has(m))return!1;else return h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:h.value,inst:d,continue:!1}),{}},reverseTransform:(p,h)=>{if(p===!0)return o[0]||"true";else return n[0]||"false"},error:r.error});return d}function Zt(e,t,r,o={}){let n=w(o),i={...w(o),check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(a)=>r.test(a),...n};if(r instanceof RegExp)i.pattern=r;return new e(i)}var Pp=_(()=>{zr();Ut();$i();ue()});function Gi(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function U(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,p=t.processors[n.type];if(!p)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);p(e,t,d,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;U(f,t,l),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(s.schema,c);if(t.io==="input"&&X(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Ki(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=o.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let n=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let p=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=p,{defId:p,ref:`${d("__shared")}#/${a}/${p}`}}if(s[1]===r)return{ref:"#"};let u=`${"#"}/${a}/`,l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=n(s);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
70
|
-
|
|
71
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref"){i(s);continue}}}}function Hi(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){o(f);let p=e.seen.get(f),h=p.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(h);else Object.assign(u,h);if(Object.assign(u,l),a._zod.parent===f)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(!(y in l))delete u[y]}if(h.$ref&&p.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in p.def&&JSON.stringify(u[y])===JSON.stringify(p.def[y]))delete u[y]}}let d=a._zod.parent;if(d&&d!==f){o(d);let p=e.seen.get(d);if(p?.schema.$ref){if(u.$ref=p.schema.$ref,p.def)for(let h in u){if(h==="$ref"||h==="allOf")continue;if(h in p.def&&JSON.stringify(u[h])===JSON.stringify(p.def[h]))delete u[h]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;s[c.defId]=c.def}}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:qt(t,"input",e.processors),output:qt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function X(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return X(o.element,r);if(o.type==="set")return X(o.valueType,r);if(o.type==="lazy")return X(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return X(o.innerType,r);if(o.type==="intersection")return X(o.left,r)||X(o.right,r);if(o.type==="record"||o.type==="map")return X(o.keyType,r)||X(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return X(o.in,r)||X(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(X(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(X(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(X(n,r))return!0;if(o.rest&&X(o.rest,r))return!0;return!1}return!1}var Cp=(e,t={})=>(r)=>{let o=Gi({...r,processors:t});return U(e,o),Ki(o,e),Hi(o,e)},qt=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Gi({...n??{},target:i,io:t,processors:r});return U(e,s),Ki(s,e),Hi(s,e)};var oo=_(()=>{Ut()});var d_,Rp=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(a){if(n.format=d_[a]??a,n.format==="")delete n.format;if(a==="time")delete n.format}if(u)n.contentEncoding=u;if(c&&c.size>0){let l=[...c];if(l.length===1)n.pattern=l[0].source;else if(l.length>1)n.allOf=[...l.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},Tp=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))n.type="integer";else n.type="number";let f=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(p)n.minimum=l,n.exclusiveMinimum=!0;else n.exclusiveMinimum=l;else if(typeof i==="number")n.minimum=i;if(d)if(p)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof s==="number")n.maximum=s;if(typeof c==="number")n.multipleOf=c},Op=(e,t,r,o)=>{r.type="boolean"},Ip=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Bp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},zp=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Dp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Np=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Lp=(e,t,r,o)=>{r.not={}},Vp=(e,t,r,o)=>{},Up=(e,t,r,o)=>{},Mp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Fp=(e,t,r,o)=>{let n=e._zod.def,i=$r(n.entries);if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},jp=(e,t,r,o)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},Zp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},qp=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Qp=(e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=e._zod.bag;if(s!==void 0)i.minLength=s;if(a!==void 0)i.maxLength=a;if(c)if(c.length===1)i.contentMediaType=c[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=c.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},Wp=(e,t,r,o)=>{r.type="boolean"},Gp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Kp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Hp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Jp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Yp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Xp=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;if(typeof s==="number")n.minItems=s;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=U(i.element,t,{...o,path:[...o.path,"items"]})},ed=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=U(s[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter((u)=>{let l=i.shape[u]._zod;if(t.io==="input")return l.optin===void 0;else return l.optout===void 0}));if(c.size>0)n.required=Array.from(c);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=U(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Ji=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((a,c)=>U(a,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));if(i)r.oneOf=s;else r.anyOf=s},td=(e,t,r,o)=>{let n=e._zod.def,i=U(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=U(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c},rd=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((d,p)=>U(d,t,{...o,path:[...o.path,s,p]})),u=i.rest?U(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=c,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:c},u)n.items.anyOf.push(u);if(n.minItems=c.length,!u)n.maxItems=c.length}else if(n.items=c,u)n.additionalItems=u;let{minimum:l,maximum:f}=e._zod.bag;if(typeof l==="number")n.minItems=l;if(typeof f==="number")n.maxItems=f},od=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let s=i.keyType,c=s._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=U(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let f of c)n.patternProperties[f.source]=l}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=U(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=U(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=s._zod.values;if(u){let l=[...u].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)n.required=l}},nd=(e,t,r,o)=>{let n=e._zod.def,i=U(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},id=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},sd=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},ad=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},cd=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},ud=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;U(s,t,o);let a=t.seen.get(e);a.ref=s},ld=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},pd=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Yi=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},dd=(e,t,r,o)=>{let n=e._zod.innerType;U(n,t,o);let i=t.seen.get(e);i.ref=n};var fd=_(()=>{oo();ue();d_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""}});var md=()=>{};var ye=_(()=>{ue();Br();ki();md();Qe();Un();Nn();$i();zr();bi();Ut();Pp();oo()});var no={};br(no,{endsWith:()=>Hr,gt:()=>Ne,gte:()=>ie,includes:()=>Gr,length:()=>jt,lowercase:()=>Qr,lt:()=>De,lte:()=>ge,maxLength:()=>Ft,maxSize:()=>dt,mime:()=>Jr,minLength:()=>et,minSize:()=>Le,multipleOf:()=>pt,negative:()=>gp,nonnegative:()=>bp,nonpositive:()=>yp,normalize:()=>Yr,overwrite:()=>Te,positive:()=>hp,property:()=>_p,regex:()=>qr,size:()=>Mt,slugify:()=>ro,startsWith:()=>Kr,toLowerCase:()=>eo,toUpperCase:()=>to,trim:()=>Xr,uppercase:()=>Wr});var io=_(()=>{ye()});var Wt={};br(Wt,{ZodISODate:()=>gd,ZodISODateTime:()=>hd,ZodISODuration:()=>bd,ZodISOTime:()=>yd,date:()=>es,datetime:()=>Xi,duration:()=>rs,time:()=>ts});function Xi(e){return Ql(hd,e)}function es(e){return Wl(gd,e)}function ts(e){return Gl(yd,e)}function rs(e){return Kl(bd,e)}var hd,gd,yd,bd;var so=_(()=>{ye();co();hd=g("ZodISODateTime",(e,t)=>{Vu.init(e,t),z.init(e,t)});gd=g("ZodISODate",(e,t)=>{Uu.init(e,t),z.init(e,t)});yd=g("ZodISOTime",(e,t)=>{Mu.init(e,t),z.init(e,t)});bd=g("ZodISODuration",(e,t)=>{Fu.init(e,t),z.init(e,t)})});var _d=(e,t)=>{Rr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Dn(e,r)},flatten:{value:(r)=>zn(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Rt,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Rt,2)}},isEmpty:{get(){return e.issues.length===0}}})},wd,se;var os=_(()=>{ye();ye();ue();wd=g("ZodError",_d),se=g("ZodError",_d,{Parent:Error})});var vd,xd,Ed,Sd,$d,Ad,kd,Pd,Cd,Rd,Td,Od;var ns=_(()=>{ye();os();vd=It(se),xd=Bt(se),Ed=zt(se),Sd=Dt(se),$d=Oc(se),Ad=Ic(se),kd=Bc(se),Pd=zc(se),Cd=Dc(se),Rd=Nc(se),Td=Lc(se),Od=Vc(se)});var ao={};br(ao,{ZodAny:()=>Md,ZodArray:()=>Qd,ZodBase64:()=>vs,ZodBase64URL:()=>xs,ZodBigInt:()=>ks,ZodBigIntFormat:()=>Ps,ZodBoolean:()=>As,ZodCIDRv4:()=>_s,ZodCIDRv6:()=>ws,ZodCUID:()=>ds,ZodCUID2:()=>fs,ZodCatch:()=>hf,ZodCodec:()=>_o,ZodCustom:()=>wo,ZodCustomStringFormat:()=>Jt,ZodDate:()=>qd,ZodDefault:()=>uf,ZodDiscriminatedUnion:()=>Gd,ZodE164:()=>Es,ZodEmail:()=>us,ZodEmoji:()=>ls,ZodEnum:()=>Kt,ZodExactOptional:()=>sf,ZodFile:()=>of,ZodFunction:()=>$f,ZodGUID:()=>lo,ZodIPv4:()=>ys,ZodIPv6:()=>bs,ZodIntersection:()=>Kd,ZodJWT:()=>Ss,ZodKSUID:()=>gs,ZodLazy:()=>xf,ZodLiteral:()=>rf,ZodMAC:()=>Bd,ZodMap:()=>ef,ZodNaN:()=>yf,ZodNanoID:()=>ps,ZodNever:()=>jd,ZodNonOptional:()=>Bs,ZodNull:()=>Vd,ZodNullable:()=>cf,ZodNumber:()=>$s,ZodNumberFormat:()=>mt,ZodObject:()=>go,ZodOptional:()=>Is,ZodPipe:()=>bo,ZodPrefault:()=>pf,ZodPreprocess:()=>bf,ZodPromise:()=>Sf,ZodReadonly:()=>_f,ZodRecord:()=>Gt,ZodSet:()=>tf,ZodString:()=>cs,ZodStringFormat:()=>z,ZodSuccess:()=>mf,ZodSymbol:()=>Nd,ZodTemplateLiteral:()=>vf,ZodTransform:()=>nf,ZodTuple:()=>Jd,ZodType:()=>C,ZodULID:()=>ms,ZodURL:()=>mo,ZodUUID:()=>Oe,ZodUndefined:()=>Ld,ZodUnion:()=>yo,ZodUnknown:()=>Fd,ZodVoid:()=>Zd,ZodXID:()=>hs,ZodXor:()=>Wd,_ZodString:()=>as,_default:()=>lf,_function:()=>vw,any:()=>Y_,array:()=>ho,base64:()=>z_,base64url:()=>D_,bigint:()=>W_,boolean:()=>Dd,catch:()=>gf,check:()=>xw,cidrv4:()=>I_,cidrv6:()=>B_,codec:()=>yw,cuid:()=>$_,cuid2:()=>A_,custom:()=>Ew,date:()=>ew,describe:()=>Sw,discriminatedUnion:()=>sw,e164:()=>N_,email:()=>h_,emoji:()=>E_,enum:()=>Ts,exactOptional:()=>af,file:()=>fw,float32:()=>j_,float64:()=>Z_,function:()=>vw,guid:()=>g_,hash:()=>F_,hex:()=>M_,hostname:()=>U_,httpUrl:()=>x_,instanceof:()=>Aw,int:()=>is,int32:()=>q_,int64:()=>G_,intersection:()=>Hd,invertCodec:()=>bw,ipv4:()=>R_,ipv6:()=>O_,json:()=>Pw,jwt:()=>L_,keyof:()=>tw,ksuid:()=>C_,lazy:()=>Ef,literal:()=>dw,looseObject:()=>nw,looseRecord:()=>cw,mac:()=>T_,map:()=>uw,meta:()=>$w,nan:()=>gw,nanoid:()=>S_,nativeEnum:()=>pw,never:()=>Cs,nonoptional:()=>ff,null:()=>Ud,nullable:()=>fo,nullish:()=>mw,number:()=>zd,object:()=>rw,optional:()=>po,partialRecord:()=>aw,pipe:()=>ss,prefault:()=>df,preprocess:()=>Cw,promise:()=>ww,readonly:()=>wf,record:()=>Xd,refine:()=>Af,set:()=>lw,strictObject:()=>ow,string:()=>uo,stringFormat:()=>V_,stringbool:()=>kw,success:()=>hw,superRefine:()=>kf,symbol:()=>H_,templateLiteral:()=>_w,transform:()=>Os,tuple:()=>Yd,uint32:()=>Q_,uint64:()=>K_,ulid:()=>k_,undefined:()=>J_,union:()=>Rs,unknown:()=>ft,url:()=>v_,uuid:()=>y_,uuidv4:()=>b_,uuidv6:()=>__,uuidv7:()=>w_,void:()=>X_,xid:()=>P_,xor:()=>iw});function Ht(e,t,r){let o=Object.getPrototypeOf(e),n=Id.get(o);if(!n)n=new Set,Id.set(o,n);if(n.has(t))return;n.add(t);for(let i in r){let s=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}function uo(e){return Zl(cs,e)}function h_(e){return Pi(us,e)}function g_(e){return jr(lo,e)}function y_(e){return Ci(Oe,e)}function b_(e){return Ri(Oe,e)}function __(e){return Ti(Oe,e)}function w_(e){return Oi(Oe,e)}function v_(e){return Zr(mo,e)}function x_(e){return Zr(mo,{protocol:Or,hostname:Fc,...w(e)})}function E_(e){return Ii(ls,e)}function S_(e){return Bi(ps,e)}function $_(e){return zi(ds,e)}function A_(e){return Di(fs,e)}function k_(e){return Ni(ms,e)}function P_(e){return Li(hs,e)}function C_(e){return Vi(gs,e)}function R_(e){return Ui(ys,e)}function T_(e){return ql(Bd,e)}function O_(e){return Mi(bs,e)}function I_(e){return Fi(_s,e)}function B_(e){return ji(ws,e)}function z_(e){return Zi(vs,e)}function D_(e){return qi(xs,e)}function N_(e){return Qi(Es,e)}function L_(e){return Wi(Ss,e)}function V_(e,t,r={}){return Zt(Jt,e,t,r)}function U_(e){return Zt(Jt,"hostname",Mc,e)}function M_(e){return Zt(Jt,"hex",qc,e)}function F_(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=Xe[o];if(!n)throw Error(`Unrecognized hash format: ${o}`);return Zt(Jt,o,n,t)}function zd(e){return Hl($s,e)}function is(e){return Jl(mt,e)}function j_(e){return Yl(mt,e)}function Z_(e){return Xl(mt,e)}function q_(e){return ep(mt,e)}function Q_(e){return tp(mt,e)}function Dd(e){return rp(As,e)}function W_(e){return op(ks,e)}function G_(e){return np(Ps,e)}function K_(e){return ip(Ps,e)}function H_(e){return sp(Nd,e)}function J_(e){return ap(Ld,e)}function Ud(e){return cp(Vd,e)}function Y_(){return up(Md)}function ft(){return lp(Fd)}function Cs(e){return pp(jd,e)}function X_(e){return dp(Zd,e)}function ew(e){return fp(qd,e)}function ho(e,t){return wp(Qd,e,t)}function tw(e){let t=e._zod.def.shape;return Ts(Object.keys(t))}function rw(e,t){let r={type:"object",shape:e??{},...w(t)};return new go(r)}function ow(e,t){return new go({type:"object",shape:e,catchall:Cs(),...w(t)})}function nw(e,t){return new go({type:"object",shape:e,catchall:ft(),...w(t)})}function Rs(e,t){return new yo({type:"union",options:e,...w(t)})}function iw(e,t){return new Wd({type:"union",options:e,inclusive:!1,...w(t)})}function sw(e,t,r){return new Gd({type:"union",options:t,discriminator:e,...w(r)})}function Hd(e,t){return new Kd({type:"intersection",left:e,right:t})}function Yd(e,t,r){let o=t instanceof P,n=o?r:t;return new Jd({type:"tuple",items:e,rest:o?t:null,...w(n)})}function Xd(e,t,r){if(!t||!t._zod)return new Gt({type:"record",keyType:uo(),valueType:e,...w(t)});return new Gt({type:"record",keyType:e,valueType:t,...w(r)})}function aw(e,t,r){let o=ce(e);return o._zod.values=void 0,new Gt({type:"record",keyType:o,valueType:t,...w(r)})}function cw(e,t,r){return new Gt({type:"record",keyType:e,valueType:t,mode:"loose",...w(r)})}function uw(e,t,r){return new ef({type:"map",keyType:e,valueType:t,...w(r)})}function lw(e,t){return new tf({type:"set",valueType:e,...w(t)})}function Ts(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Kt({type:"enum",entries:r,...w(t)})}function pw(e,t){return new Kt({type:"enum",entries:e,...w(t)})}function dw(e,t){return new rf({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}function fw(e){return vp(of,e)}function Os(e){return new nf({type:"transform",transform:e})}function po(e){return new Is({type:"optional",innerType:e})}function af(e){return new sf({type:"optional",innerType:e})}function fo(e){return new cf({type:"nullable",innerType:e})}function mw(e){return po(fo(e))}function lf(e,t){return new uf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():In(t)}})}function df(e,t){return new pf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():In(t)}})}function ff(e,t){return new Bs({type:"nonoptional",innerType:e,...w(t)})}function hw(e){return new mf({type:"success",innerType:e})}function gf(e,t){return new hf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}function gw(e){return mp(yf,e)}function ss(e,t){return new bo({type:"pipe",in:e,out:t})}function yw(e,t,r){return new _o({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function bw(e){let t=e._zod.def;return new _o({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function wf(e){return new _f({type:"readonly",innerType:e})}function _w(e,t){return new vf({type:"template_literal",parts:e,...w(t)})}function Ef(e){return new xf({type:"lazy",getter:e})}function ww(e){return new Sf({type:"promise",innerType:e})}function vw(e){return new $f({type:"function",input:Array.isArray(e?.input)?Yd(e?.input):e?.input??ho(ft()),output:e?.output??ft()})}function xw(e){let t=new N({check:"custom"});return t._zod.check=e,t}function Ew(e,t){return xp(wo,e??(()=>!0),t)}function Af(e,t={}){return Ep(wo,e,t)}function kf(e,t){return Sp(e,t)}function Aw(e,t={}){let r=new wo({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...w(t)});return r._zod.bag.Class=e,r._zod.check=(o)=>{if(!(o.value instanceof e))o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}function Pw(e){let t=Ef(()=>Rs([uo(e),zd(),Dd(),Ud(),ho(t),Xd(uo(),t)]));return t}function Cw(e,t){return new bf({type:"pipe",in:Os(e),out:t})}var Id,C,as,cs,z,us,lo,Oe,mo,ls,ps,ds,fs,ms,hs,gs,ys,Bd,bs,_s,ws,vs,xs,Es,Ss,Jt,$s,mt,As,ks,Ps,Nd,Ld,Vd,Md,Fd,jd,Zd,qd,Qd,go,yo,Wd,Gd,Kd,Jd,Gt,ef,tf,Kt,rf,of,nf,Is,sf,cf,uf,pf,Bs,mf,hf,yf,bo,_o,bf,_f,vf,xf,Sf,$f,wo,Sw,$w,kw=(...e)=>kp({Codec:_o,Boolean:As,String:cs},...e);var co=_(()=>{ye();ye();fd();oo();io();so();ns();Id=new WeakMap;C=g("ZodType",(e,t)=>(P.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:qt(e,"input"),output:qt(e,"output")}}),e.toJSONSchema=Cp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>vd(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Ed(e,r,o),e.parseAsync=async(r,o)=>xd(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Sd(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>$d(e,r,o),e.decode=(r,o)=>Ad(e,r,o),e.encodeAsync=async(r,o)=>kd(e,r,o),e.decodeAsync=async(r,o)=>Pd(e,r,o),e.safeEncode=(r,o)=>Cd(e,r,o),e.safeDecode=(r,o)=>Rd(e,r,o),e.safeEncodeAsync=async(r,o)=>Td(e,r,o),e.safeDecodeAsync=async(r,o)=>Od(e,r,o),Ht(e,"ZodType",{check(...r){let o=this.def;return this.clone(ze(o,{checks:[...o.checks??[],...r.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return ce(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(Af(r,o))},superRefine(r,o){return this.check(kf(r,o))},overwrite(r){return this.check(Te(r))},optional(){return po(this)},exactOptional(){return af(this)},nullable(){return fo(this)},nullish(){return po(fo(this))},nonoptional(r){return ff(this,r)},array(){return ho(this)},or(r){return Rs([this,r])},and(r){return Hd(this,r)},transform(r){return ss(this,Os(r))},default(r){return lf(this,r)},prefault(r){return df(this,r)},catch(r){return gf(this,r)},pipe(r){return ss(this,r)},readonly(){return wf(this)},describe(r){let o=this.clone();return Y.add(o,{description:r}),o},meta(...r){if(r.length===0)return Y.get(this);let o=this.clone();return Y.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Y.get(e)?.description},configurable:!0}),e)),as=g("_ZodString",(e,t)=>{lt.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Rp(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Ht(e,"_ZodString",{regex(...o){return this.check(qr(...o))},includes(...o){return this.check(Gr(...o))},startsWith(...o){return this.check(Kr(...o))},endsWith(...o){return this.check(Hr(...o))},min(...o){return this.check(et(...o))},max(...o){return this.check(Ft(...o))},length(...o){return this.check(jt(...o))},nonempty(...o){return this.check(et(1,...o))},lowercase(o){return this.check(Qr(o))},uppercase(o){return this.check(Wr(o))},trim(){return this.check(Xr())},normalize(...o){return this.check(Yr(...o))},toLowerCase(){return this.check(eo())},toUpperCase(){return this.check(to())},slugify(){return this.check(ro())}})}),cs=g("ZodString",(e,t)=>{lt.init(e,t),as.init(e,t),e.email=(r)=>e.check(Pi(us,r)),e.url=(r)=>e.check(Zr(mo,r)),e.jwt=(r)=>e.check(Wi(Ss,r)),e.emoji=(r)=>e.check(Ii(ls,r)),e.guid=(r)=>e.check(jr(lo,r)),e.uuid=(r)=>e.check(Ci(Oe,r)),e.uuidv4=(r)=>e.check(Ri(Oe,r)),e.uuidv6=(r)=>e.check(Ti(Oe,r)),e.uuidv7=(r)=>e.check(Oi(Oe,r)),e.nanoid=(r)=>e.check(Bi(ps,r)),e.guid=(r)=>e.check(jr(lo,r)),e.cuid=(r)=>e.check(zi(ds,r)),e.cuid2=(r)=>e.check(Di(fs,r)),e.ulid=(r)=>e.check(Ni(ms,r)),e.base64=(r)=>e.check(Zi(vs,r)),e.base64url=(r)=>e.check(qi(xs,r)),e.xid=(r)=>e.check(Li(hs,r)),e.ksuid=(r)=>e.check(Vi(gs,r)),e.ipv4=(r)=>e.check(Ui(ys,r)),e.ipv6=(r)=>e.check(Mi(bs,r)),e.cidrv4=(r)=>e.check(Fi(_s,r)),e.cidrv6=(r)=>e.check(ji(ws,r)),e.e164=(r)=>e.check(Qi(Es,r)),e.datetime=(r)=>e.check(Xi(r)),e.date=(r)=>e.check(es(r)),e.time=(r)=>e.check(ts(r)),e.duration=(r)=>e.check(rs(r))});z=g("ZodStringFormat",(e,t)=>{B.init(e,t),as.init(e,t)}),us=g("ZodEmail",(e,t)=>{Ru.init(e,t),z.init(e,t)});lo=g("ZodGUID",(e,t)=>{Pu.init(e,t),z.init(e,t)});Oe=g("ZodUUID",(e,t)=>{Cu.init(e,t),z.init(e,t)});mo=g("ZodURL",(e,t)=>{Tu.init(e,t),z.init(e,t)});ls=g("ZodEmoji",(e,t)=>{Ou.init(e,t),z.init(e,t)});ps=g("ZodNanoID",(e,t)=>{Iu.init(e,t),z.init(e,t)});ds=g("ZodCUID",(e,t)=>{Bu.init(e,t),z.init(e,t)});fs=g("ZodCUID2",(e,t)=>{zu.init(e,t),z.init(e,t)});ms=g("ZodULID",(e,t)=>{Du.init(e,t),z.init(e,t)});hs=g("ZodXID",(e,t)=>{Nu.init(e,t),z.init(e,t)});gs=g("ZodKSUID",(e,t)=>{Lu.init(e,t),z.init(e,t)});ys=g("ZodIPv4",(e,t)=>{ju.init(e,t),z.init(e,t)});Bd=g("ZodMAC",(e,t)=>{qu.init(e,t),z.init(e,t)});bs=g("ZodIPv6",(e,t)=>{Zu.init(e,t),z.init(e,t)});_s=g("ZodCIDRv4",(e,t)=>{Qu.init(e,t),z.init(e,t)});ws=g("ZodCIDRv6",(e,t)=>{Wu.init(e,t),z.init(e,t)});vs=g("ZodBase64",(e,t)=>{Ku.init(e,t),z.init(e,t)});xs=g("ZodBase64URL",(e,t)=>{Hu.init(e,t),z.init(e,t)});Es=g("ZodE164",(e,t)=>{Ju.init(e,t),z.init(e,t)});Ss=g("ZodJWT",(e,t)=>{Yu.init(e,t),z.init(e,t)});Jt=g("ZodCustomStringFormat",(e,t)=>{Xu.init(e,t),z.init(e,t)});$s=g("ZodNumber",(e,t)=>{wi.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Tp(e,o,n,i),Ht(e,"ZodNumber",{gt(o,n){return this.check(Ne(o,n))},gte(o,n){return this.check(ie(o,n))},min(o,n){return this.check(ie(o,n))},lt(o,n){return this.check(De(o,n))},lte(o,n){return this.check(ge(o,n))},max(o,n){return this.check(ge(o,n))},int(o){return this.check(is(o))},safe(o){return this.check(is(o))},positive(o){return this.check(Ne(0,o))},nonnegative(o){return this.check(ie(0,o))},negative(o){return this.check(De(0,o))},nonpositive(o){return this.check(ge(0,o))},multipleOf(o,n){return this.check(pt(o,n))},step(o,n){return this.check(pt(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});mt=g("ZodNumberFormat",(e,t)=>{el.init(e,t),$s.init(e,t)});As=g("ZodBoolean",(e,t)=>{Ur.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Op(e,r,o,n)});ks=g("ZodBigInt",(e,t)=>{vi.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Ip(e,o,n,i),e.gte=(o,n)=>e.check(ie(o,n)),e.min=(o,n)=>e.check(ie(o,n)),e.gt=(o,n)=>e.check(Ne(o,n)),e.gte=(o,n)=>e.check(ie(o,n)),e.min=(o,n)=>e.check(ie(o,n)),e.lt=(o,n)=>e.check(De(o,n)),e.lte=(o,n)=>e.check(ge(o,n)),e.max=(o,n)=>e.check(ge(o,n)),e.positive=(o)=>e.check(Ne(BigInt(0),o)),e.negative=(o)=>e.check(De(BigInt(0),o)),e.nonpositive=(o)=>e.check(ge(BigInt(0),o)),e.nonnegative=(o)=>e.check(ie(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(pt(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});Ps=g("ZodBigIntFormat",(e,t)=>{tl.init(e,t),ks.init(e,t)});Nd=g("ZodSymbol",(e,t)=>{rl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bp(e,r,o,n)});Ld=g("ZodUndefined",(e,t)=>{ol.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dp(e,r,o,n)});Vd=g("ZodNull",(e,t)=>{nl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zp(e,r,o,n)});Md=g("ZodAny",(e,t)=>{il.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vp(e,r,o,n)});Fd=g("ZodUnknown",(e,t)=>{sl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Up(e,r,o,n)});jd=g("ZodNever",(e,t)=>{al.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lp(e,r,o,n)});Zd=g("ZodVoid",(e,t)=>{cl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Np(e,r,o,n)});qd=g("ZodDate",(e,t)=>{ul.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Mp(e,o,n,i),e.min=(o,n)=>e.check(ie(o,n)),e.max=(o,n)=>e.check(ge(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});Qd=g("ZodArray",(e,t)=>{ll.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xp(e,r,o,n),e.element=t.element,Ht(e,"ZodArray",{min(r,o){return this.check(et(r,o))},nonempty(r){return this.check(et(1,r))},max(r,o){return this.check(Ft(r,o))},length(r,o){return this.check(jt(r,o))},unwrap(){return this.element}})});go=g("ZodObject",(e,t)=>{fl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ed(e,r,o,n),T(e,"shape",()=>t.shape),Ht(e,"ZodObject",{keyof(){return Ts(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:ft()})},loose(){return this.clone({...this._zod.def,catchall:ft()})},strict(){return this.clone({...this._zod.def,catchall:Cs()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Ab(this,r)},safeExtend(r){return kb(this,r)},merge(r){return Pb(this,r)},pick(r){return Sb(this,r)},omit(r){return $b(this,r)},partial(...r){return Cb(Is,this,r[0])},required(...r){return Rb(Bs,this,r[0])}})});yo=g("ZodUnion",(e,t)=>{Mr.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ji(e,r,o,n),e.options=t.options});Wd=g("ZodXor",(e,t)=>{yo.init(e,t),ml.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ji(e,r,o,n),e.options=t.options});Gd=g("ZodDiscriminatedUnion",(e,t)=>{yo.init(e,t),hl.init(e,t)});Kd=g("ZodIntersection",(e,t)=>{gl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>td(e,r,o,n)});Jd=g("ZodTuple",(e,t)=>{xi.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rd(e,r,o,n),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});Gt=g("ZodRecord",(e,t)=>{yl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>od(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});ef=g("ZodMap",(e,t)=>{bl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jp(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Le(...r)),e.nonempty=(r)=>e.check(Le(1,r)),e.max=(...r)=>e.check(dt(...r)),e.size=(...r)=>e.check(Mt(...r))});tf=g("ZodSet",(e,t)=>{_l.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yp(e,r,o,n),e.min=(...r)=>e.check(Le(...r)),e.nonempty=(r)=>e.check(Le(1,r)),e.max=(...r)=>e.check(dt(...r)),e.size=(...r)=>e.check(Mt(...r))});Kt=g("ZodEnum",(e,t)=>{wl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Fp(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Kt({...t,checks:[],...w(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Kt({...t,checks:[],...w(n),entries:i})}});rf=g("ZodLiteral",(e,t)=>{vl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jp(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});of=g("ZodFile",(e,t)=>{xl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qp(e,r,o,n),e.min=(r,o)=>e.check(Le(r,o)),e.max=(r,o)=>e.check(dt(r,o)),e.mime=(r,o)=>e.check(Jr(Array.isArray(r)?r:[r],o))});nf=g("ZodTransform",(e,t)=>{El.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hp(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ct(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(Je(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Je(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r.fallback=!0,r));return r.value=n,r.fallback=!0,r}});Is=g("ZodOptional",(e,t)=>{Ei.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});sf=g("ZodExactOptional",(e,t)=>{Sl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yi(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});cf=g("ZodNullable",(e,t)=>{$l.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});uf=g("ZodDefault",(e,t)=>{Al.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});pf=g("ZodPrefault",(e,t)=>{kl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ad(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});Bs=g("ZodNonOptional",(e,t)=>{Pl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>id(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});mf=g("ZodSuccess",(e,t)=>{Cl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});hf=g("ZodCatch",(e,t)=>{Rl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});yf=g("ZodNaN",(e,t)=>{Tl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zp(e,r,o,n)});bo=g("ZodPipe",(e,t)=>{Si.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ud(e,r,o,n),e.in=t.in,e.out=t.out});_o=g("ZodCodec",(e,t)=>{bo.init(e,t),Fr.init(e,t)});bf=g("ZodPreprocess",(e,t)=>{bo.init(e,t),Ol.init(e,t)}),_f=g("ZodReadonly",(e,t)=>{Il.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ld(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});vf=g("ZodTemplateLiteral",(e,t)=>{Bl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qp(e,r,o,n)});xf=g("ZodLazy",(e,t)=>{Nl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dd(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});Sf=g("ZodPromise",(e,t)=>{Dl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});$f=g("ZodFunction",(e,t)=>{zl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kp(e,r,o,n)});wo=g("ZodCustom",(e,t)=>{Ll.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gp(e,r,o,n)});Sw=$p,$w=Ap});var Pf;var Cf=_(()=>{(function(e){})(Pf||(Pf={}))});function Tw(e,t){let r=e.$schema;if(r==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(r==="http://json-schema.org/draft-07/schema#")return"draft-7";if(r==="http://json-schema.org/draft-04/schema#")return"draft-4";return t??"draft-2020-12"}function Ow(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}function Rf(e,t){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return v.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return v.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=Ow(n,t),s=K(i,t);return t.refs.set(n,s),t.processing.delete(n),s}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return v.null();if(n.length===0)return v.never();if(n.length===1)return v.literal(n[0]);if(n.every((s)=>typeof s==="string"))return v.enum(n);let i=n.map((s)=>v.literal(s));if(i.length<2)return i[0];return v.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return v.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map((i)=>{let s={...e,type:i};return Rf(s,t)});if(n.length===0)return v.never();if(n.length===1)return n[0];return v.union(n)}if(!r)return v.any();let o;switch(r){case"string":{let n=v.string();if(e.format){let i=e.format;if(i==="email")n=n.check(v.email());else if(i==="uri"||i==="uri-reference")n=n.check(v.url());else if(i==="uuid"||i==="guid")n=n.check(v.uuid());else if(i==="date-time")n=n.check(v.iso.datetime());else if(i==="date")n=n.check(v.iso.date());else if(i==="time")n=n.check(v.iso.time());else if(i==="duration")n=n.check(v.iso.duration());else if(i==="ipv4")n=n.check(v.ipv4());else if(i==="ipv6")n=n.check(v.ipv6());else if(i==="mac")n=n.check(v.mac());else if(i==="cidr")n=n.check(v.cidrv4());else if(i==="cidr-v6")n=n.check(v.cidrv6());else if(i==="base64")n=n.check(v.base64());else if(i==="base64url")n=n.check(v.base64url());else if(i==="e164")n=n.check(v.e164());else if(i==="jwt")n=n.check(v.jwt());else if(i==="emoji")n=n.check(v.emoji());else if(i==="nanoid")n=n.check(v.nanoid());else if(i==="cuid")n=n.check(v.cuid());else if(i==="cuid2")n=n.check(v.cuid2());else if(i==="ulid")n=n.check(v.ulid());else if(i==="xid")n=n.check(v.xid());else if(i==="ksuid")n=n.check(v.ksuid())}if(typeof e.minLength==="number")n=n.min(e.minLength);if(typeof e.maxLength==="number")n=n.max(e.maxLength);if(e.pattern)n=n.regex(new RegExp(e.pattern));o=n;break}case"number":case"integer":{let n=r==="integer"?v.number().int():v.number();if(typeof e.minimum==="number")n=n.min(e.minimum);if(typeof e.maximum==="number")n=n.max(e.maximum);if(typeof e.exclusiveMinimum==="number")n=n.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")n=n.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")n=n.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")n=n.lt(e.maximum);if(typeof e.multipleOf==="number")n=n.multipleOf(e.multipleOf);o=n;break}case"boolean":{o=v.boolean();break}case"null":{o=v.null();break}case"object":{let n={},i=e.properties||{},s=new Set(e.required||[]);for(let[c,u]of Object.entries(i)){let l=K(u,t);n[c]=s.has(c)?l:l.optional()}if(e.propertyNames){let c=K(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties==="object"?K(e.additionalProperties,t):v.any();if(Object.keys(n).length===0){o=v.record(c,u);break}let l=v.object(n).passthrough(),f=v.looseRecord(c,u);o=v.intersection(l,f);break}if(e.patternProperties){let c=e.patternProperties,u=Object.keys(c),l=[];for(let d of u){let p=K(c[d],t),h=v.string().regex(new RegExp(d));l.push(v.looseRecord(h,p))}let f=[];if(Object.keys(n).length>0)f.push(v.object(n).passthrough());if(f.push(...l),f.length===0)o=v.object({}).passthrough();else if(f.length===1)o=f[0];else{let d=v.intersection(f[0],f[1]);for(let p=2;p<f.length;p++)d=v.intersection(d,f[p]);o=d}break}let a=v.object(n);if(e.additionalProperties===!1)o=a.strict();else if(typeof e.additionalProperties==="object")o=a.catchall(K(e.additionalProperties,t));else o=a.passthrough();break}case"array":{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let s=n.map((c)=>K(c,t)),a=i&&typeof i==="object"&&!Array.isArray(i)?K(i,t):void 0;if(a)o=v.tuple(s).rest(a);else o=v.tuple(s);if(typeof e.minItems==="number")o=o.check(v.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(v.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=i.map((c)=>K(c,t)),a=e.additionalItems&&typeof e.additionalItems==="object"?K(e.additionalItems,t):void 0;if(a)o=v.tuple(s).rest(a);else o=v.tuple(s);if(typeof e.minItems==="number")o=o.check(v.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(v.maxLength(e.maxItems))}else if(i!==void 0){let s=K(i,t),a=v.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);o=a}else o=v.array(v.any());break}default:throw Error(`Unsupported type: ${r}`)}return o}function K(e,t){if(typeof e==="boolean")return e?v.any():v.never();let r=Rf(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((u)=>K(u,t)),c=v.union(a);r=o?v.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((u)=>K(u,t)),c=v.xor(a);r=o?v.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:v.any();else{let a=o?r:K(e.allOf[0],t),c=o?0:1;for(let u=c;u<e.allOf.length;u++)a=v.intersection(a,K(e.allOf[u],t));r=a}if(e.nullable===!0&&t.version==="openapi-3.0")r=v.nullable(r);if(e.readOnly===!0)r=v.readonly(r);if(e.default!==void 0)r=r.default(e.default);let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)n[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)n[a]=e[a];for(let a of Object.keys(e))if(!Rw.has(a))n[a]=e[a];if(Object.keys(n).length>0)t.registry.add(r,n);if(e.description)r=r.describe(e.description);return r}function Tf(e,t){if(typeof e==="boolean")return e?v.any():v.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=Tw(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Y};return K(r,i)}var v,Rw;var Of=_(()=>{Ut();io();so();co();v={...ao,...no,iso:Wt},Rw=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"])});var If=()=>{};var Ds=_(()=>{ye();ye();Vl();ye();Of();ki();so();If();co();io();os();ns();Cf();W(Ai())});var Ns=_(()=>{Ds();Ds()});var zf="registry.neko-piranha.ts.net",vo="https://kuber.astrxl.dev/api/v2",H;var Ve=_(()=>{H={"app.kubernetes.io/managed-by":"kuber"}});import{chmod as Df,mkdir as zw,readFile as Dw,rename as Nw,rm as Vs,writeFile as Lw}from"fs/promises";import{randomUUID as Vw}from"crypto";import{tmpdir as Uf}from"os";import{dirname as Nf,join as xo}from"path";function Us(){let e=process.env.XDG_RUNTIME_DIR??xo(Uf(),`kuber-${process.getuid?.()??"user"}`);return xo(e,"kuber","session.json")}function Ms(){let e=process.env.XDG_CONFIG_HOME??xo(process.env.HOME??Uf(),".config");return xo(e,"kuber","session.json")}function Lf(e){return e?Ms():Us()}function Uw(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.token==="string"&&typeof t.expiresAt==="string"&&Boolean(t.user)&&typeof t.user?.username==="string"&&Array.isArray(t.user.roles)&&t.user.roles.every((r)=>typeof r==="string")}async function Vf(e){try{let t=JSON.parse(await Dw(e,"utf8"));if(!Uw(t))return;if(Date.parse(t.expiresAt)<=Date.now()){await Vs(e,{force:!0});return}return t}catch(t){if(t&&typeof t==="object"&&"code"in t&&t.code==="ENOENT")return;if(t instanceof SyntaxError)return;throw t}}async function ht(){let e=Us(),t=Ms();if(Ue?.runtimePath===e&&Ue.persistentPath===t&&(Ue.expiresAt===0||Ue.expiresAt>Date.now()))return Ue.value;let r=await Vf(e)??await Vf(t);return Ue={runtimePath:e,persistentPath:t,value:r,expiresAt:r?Date.parse(r.expiresAt):0},r}async function Mf(e,t){let r=Lf(t);await zw(Nf(r),{recursive:!0,mode:448}),await Df(Nf(r),448);let o=`${r}.${Vw()}.tmp`;return await Lw(o,`${JSON.stringify(e,null,2)}
|
|
72
|
-
`,{flag:"wx",mode:384}),await
|
|
73
|
-
`,
|
|
74
|
-
`,
|
|
75
|
-
`).map((a)=>{let c=typeof r>"u"?a:
|
|
76
|
-
`)[0]?.split(/ /g);for(let n=0;n<o.length;n++){let i=o[n];if(r){let s=xe(i);if(xe(r)+s>=e)break}r+=(n>0?" ":"")+i}return r}function
|
|
77
|
-
`)[0].matchAll(new RegExp(`(?:${
|
|
78
|
-
`,u)return a+this.renderRow(e,t,r,u);if(r.rows.length>1&&(t===0&&r.hasHeaderBorder||t<r.rows.length-1&&r.hasBodyBorder))a+=this.renderBorderRow(n,s,e,r);if(t===r.rows.length-1&&n.hasBorder())a+=this.renderBorderRow(n,void 0,e,r);return a}renderCell(e,t,r,o){let n="",i=t[e-1],s=t[e];if(!o){if(e===0){if(s.getBorder())n+=this.options.chars.left;else if(r.hasBorder)n+=" "}else if(s.getBorder()||i?.getBorder())n+=this.options.chars.middle;else if(r.hasBorder)n+=" "}let a=r.width[e],c=s.getColSpan();if(c>1){for(let f=1;f<c;f++)if(a+=r.width[e+f]+r.padding[e+f],r.hasBorder)a+=r.padding[e+f]+1}let{current:u,next:l}=this.renderCellValue(s,a);if(t[e].setValue(l),r.hasBorder)n+=" ".repeat(r.padding[e]);if(n+=u,r.hasBorder||e<r.columns-1)n+=" ".repeat(r.padding[e]);return n}renderCellValue(e,t){if(t<=0)return{current:"",next:""};let r=Math.min(t,xe(e.toString())),o=
|
|
79
|
-
`:""}renderBorderCell(e,t,r,o,n){let i=t?.[e-1],s=r?.[e-1],a=t?.[e],c=r?.[e],u=!!i?.getBorder(),l=!!s?.getBorder(),f=!!a?.getBorder(),d=!!c?.getBorder(),p=(b)=>(b?.getColSpan()??1)>1,h=(b)=>(b?.getRowSpan()??1)>1,m="";if(e===0)if(o[e]>1)if(f)m+=this.options.chars.left;else m+=" ";else if(f&&d)m+=this.options.chars.leftMid;else if(f)m+=this.options.chars.bottomLeft;else if(d)m+=this.options.chars.topLeft;else m+=" ";else if(e<n.columns)if(u&&d||f&&l){let b=p(i),S=p(s),x=p(a),A=p(c),R=h(i),Z=h(s),_e=h(a),Ze=h(c),qe=u&&d&&f&&l,En=R&&_e&&Z&&Ze,rb=b&&x&&S&&A;if(En&&qe)m+=this.options.chars.middle;else if(rb&&qe&&i===a&&s===c)m+=this.options.chars.mid;else if(b&&x&&i===a)m+=this.options.chars.topMid;else if(S&&A&&s===c)m+=this.options.chars.bottomMid;else if(R&&Z&&i===s)m+=this.options.chars.leftMid;else if(_e&&Ze&&a===c)m+=this.options.chars.rightMid;else m+=this.options.chars.midMid}else if(u&&f)if(p(i)&&p(a)&&i===a)m+=this.options.chars.bottom;else m+=this.options.chars.bottomMid;else if(f&&d)if(o[e]>1)m+=this.options.chars.left;else m+=this.options.chars.leftMid;else if(d&&l)if(p(s)&&p(c)&&s===c)m+=this.options.chars.top;else m+=this.options.chars.topMid;else if(u&&l)if(h(i)&&i===s)m+=this.options.chars.right;else m+=this.options.chars.rightMid;else if(u)m+=this.options.chars.bottomRight;else if(f)m+=this.options.chars.bottomLeft;else if(l)m+=this.options.chars.topRight;else if(d)m+=this.options.chars.topLeft;else m+=" ";let y=n.padding[e]+n.width[e]+n.padding[e];if(o[e]>1&&r){if(m+=this.renderCell(e,r,n,!0),r[e]===r[r.length-1]){if(f)m+=this.options.chars.right;else m+=" ";return m}}else if(f&&d)m+=this.options.chars.mid.repeat(y);else if(f)m+=this.options.chars.bottom.repeat(y);else if(d)m+=this.options.chars.top.repeat(y);else m+=" ".repeat(y);if(e===n.columns-1)if(f&&d)m+=this.options.chars.rightMid;else if(f)m+=this.options.chars.bottomRight;else if(d)m+=this.options.chars.topRight;else m+=" ";return m}}var Ee=(e)=>e.reduce((t,r)=>t+r,0);var em=_(()=>{So();$o();Ws()});var Me;var tm=_(()=>{qs();em();$o();Me=class Me extends Array{static _chars={...Zs};options={indent:0,border:!1,maxColWidth:1/0,minColWidth:0,padding:1,maxWidth:1/0,flexShrink:0,flexGrow:0,chars:{...Me._chars},columns:[]};headerRow;static from(e){let t=new this(...e);if(e instanceof Me)t.options={...e.options},t.headerRow=e.headerRow?ae.from(e.headerRow):void 0;return t}static fromJson(e){return new this().fromJson(e)}static chars(e){return Object.assign(this._chars,e),this}static render(e){Me.from(e).render()}fromJson(e){return this.header(Object.keys(e[0])),this.body(e.map((t)=>Object.values(t))),this}columns(e){return this.options.columns=e.map((t)=>t instanceof ve?t:ve.from(t)),this}column(e,t){if(t instanceof ve)this.options.columns[e]=t;else if(this.options.columns[e])this.options.columns[e].options(t);else this.options.columns[e]=ve.from(t);return this}header(e){return this.headerRow=e instanceof ae?e:ae.from(e),this}body(e){return this.length=0,this.push(...e),this}clone(){let e=new Me(...this.map((t)=>t instanceof ae?t.clone():ae.from(t).clone()));return e.options={...this.options},e.headerRow=this.headerRow?.clone(),e}toString(){return new Gs(this,this.options).toString()}render(){return console.log(this.toString()),this}maxColWidth(e,t=!0){if(t||typeof this.options.maxColWidth>"u")this.options.maxColWidth=e;return this}minColWidth(e,t=!0){if(t||typeof this.options.minColWidth>"u")this.options.minColWidth=e;return this}maxWidth(e,t=!0){if(t||typeof this.options.maxWidth>"u")this.options.maxWidth=e;return this}flexShrink(e=1,t=!0){if(t||typeof this.options.flexShrink>"u")this.options.flexShrink=e;return this}flexGrow(e=1,t=!0){if(t||typeof this.options.flexGrow>"u")this.options.flexGrow=e;return this}flex(e=1,t=!0){return this.flexGrow(e,t).flexShrink(e,t)}indent(e,t=!0){if(t||typeof this.options.indent>"u")this.options.indent=e;return this}padding(e,t=!0){if(t||typeof this.options.padding>"u")this.options.padding=e;return this}border(e=!0,t=!0){if(t||typeof this.options.border>"u")this.options.border=e;return this}align(e,t=!0){if(t||typeof this.options.align>"u")this.options.align=e;return this}chars(e){return Object.assign(this.options.chars,e),this}getHeader(){return this.headerRow}getBody(){return[...this]}getMaxColWidth(){return this.options.maxColWidth}getMinColWidth(){return this.options.minColWidth}getIndent(){return this.options.indent}getPadding(){return this.options.padding}getBorder(){return this.options.border===!0}hasHeaderBorder(){let e=this.headerRow?.hasBorder();return e===!0||this.getBorder()&&e!==!1}hasBodyBorder(){return this.getBorder()||this.options.columns.some((e)=>e.getBorder())||this.some((e)=>e instanceof ae?e.hasBorder():e.some((t)=>t instanceof re?t.getBorder():!1))}hasBorder(){return this.hasHeaderBorder()||this.hasBodyBorder()}getAlign(){return this.options.align??"left"}getColumns(){return this.options.columns}getColumn(e){return this.options.columns[e]??=new ve}}});var rm=_(()=>{qs();So();$o();tm()});function le(e){return new Me(Object.keys(e[0]??{}).map((t)=>t.toUpperCase()),...e.map((t)=>Object.values(t))).toString()}function om(e){if(!e)return;if(Array.isArray(e))return e.map((t)=>{let r=t.indexOf("=");return{name:r===-1?t:t.slice(0,r),value:r===-1?void 0:t.slice(r+1)}});return Object.entries(e).map(([t,r])=>({name:t,value:r===null?void 0:String(r)}))}var tt=_(()=>{rm()});async function Hw(e,t=k){let r=e?`/audit?${new URLSearchParams({workspaceId:e})}`:"/audit",o=await t(r);if(o.items.length===0)return"No audit events";return le(o.items.map((n)=>({timestamp:n.metadata.creationTimestamp,actor:n.spec.actor.username,action:n.spec.action,workspace:n.spec.workspaceId,outcome:n.spec.outcome,operation:n.spec.operationId})))}var Jw,Yw;var nm=_(()=>{F();q();tt();Jw=E({meta:{name:"ls",description:"List audit events"},args:{workspace:{type:"string",alias:"w",description:"Filter by workspace"}},async run({args:e}){console.log(await Hw(e.workspace??e._[0]))}}),Yw=E({meta:{name:"audit",description:"Inspect the audit log"},subCommands:{ls:Jw}})});import{basename as Xw,isAbsolute as ev,resolve as im}from"path";import{pathToFileURL as tv}from"url";function Ks(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`${t} must be a non-empty string`);return e.trim()}function nv(e,t){if(!e||typeof e!=="object"||Array.isArray(e))throw Error(`${t} must default export a configuration object`);let r=e;for(let o of["compose","preBuild","postBuild","postRender","postApply"])if(r[o]!==void 0&&typeof r[o]!=="function")throw Error(`${o} in ${t} must be a function`);if(r.project!==void 0)Ks(r.project,"project");if(r.composeFile!==void 0)Ks(r.composeFile,"composeFile");if(r.registry!==void 0)Ks(r.registry,"registry");if(r.rolloutTimeoutMs!==void 0&&(typeof r.rolloutTimeoutMs!=="number"||!Number.isFinite(r.rolloutTimeoutMs)||r.rolloutTimeoutMs<=0))throw Error(`rolloutTimeoutMs in ${t} must be a positive number`);return e}function sm(e){let t,r=[];for(let o=0;o<e.length;o+=1){let n=e[o];if(n==="--"){r.push(...e.slice(o));break}if(n.startsWith("--config=")){let i=n.slice(9);if(!i)throw Error("--config requires a path");if(t)throw Error("--config may only be specified once");t=i;continue}if(n==="--config"){let i=e[o+1];if(!i||i.startsWith("-"))throw Error(`${n} requires a path`);if(t)throw Error("--config may only be specified once");t=i,o+=1;continue}r.push(n)}return{configPath:t,rawArgs:r}}async function am(e,t){let r=im(e,t??rv),o=await Bun.file(r).exists();if(!o&&t)throw Error(`Config file cannot be found: ${r}`);let n=o?nv((await import(tv(r).href)).default,r):{},i=n.composeFile?.trim(),s=(n.registry?.trim()??Ao).replace(/\/+$/,"");if(!s)throw Error(`registry in ${r} cannot be empty`);return{project:n.project?.trim()??Xw(e),projectConfigured:n.project!==void 0,composeFile:i?ev(i)?i:im(e,i):void 0,registry:s,rolloutTimeoutMs:n.rolloutTimeoutMs??ov,configFile:o?r:void 0,compose:n.compose,preBuild:n.preBuild,postBuild:n.postBuild,postRender:n.postRender,postApply:n.postApply}}function cm(e,t,r){return{cwd:t,project:e.project,composeFile:r,configFile:e.configFile}}var rv=".kuberrc.ts",Ao,ov=300000;var ko=_(()=>{Ve();Ao=zf});var um;var lm=_(()=>{um={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"compose_spec.json",type:"object",title:"Compose Specification",description:"The Compose file is a YAML file defining a multi-containers based application.",properties:{version:{type:"string",deprecated:!0,description:"declared for backward compatibility, ignored. Please remove it."},name:{type:"string",description:"define the Compose project name, until user defines one explicitly."},include:{type:"array",items:{$ref:"#/$defs/include"},description:"compose sub-projects to be included."},services:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/service"}},additionalProperties:!1,description:"The services that will be used by your application."},models:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/model"}},description:"Language models that will be used by your application."},networks:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/network"}},description:"Networks that are shared among multiple services."},volumes:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/volume"}},additionalProperties:!1,description:"Named volumes that are shared among multiple services."},secrets:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/secret"}},additionalProperties:!1,description:"Secrets that are shared among multiple services."},configs:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/config"}},additionalProperties:!1,description:"Configurations that are shared among multiple services."}},patternProperties:{"^x-":{}},additionalProperties:!1,$defs:{service:{type:"object",description:"Configuration for a service.",properties:{develop:{$ref:"#/$defs/development"},deploy:{$ref:"#/$defs/deployment"},annotations:{$ref:"#/$defs/list_or_dict"},attach:{type:["boolean","string"]},build:{description:"Configuration options for building the service's image.",oneOf:[{type:"string",description:"Path to the build context. Can be a relative path or a URL."},{type:"object",properties:{context:{type:"string",description:"Path to the build context. Can be a relative path or a URL."},dockerfile:{type:"string",description:"Name of the Dockerfile to use for building the image."},dockerfile_inline:{type:"string",description:"Inline Dockerfile content to use instead of a Dockerfile from the build context."},entitlements:{type:"array",items:{type:"string"},description:"List of extra privileged entitlements to grant to the build process."},args:{$ref:"#/$defs/list_or_dict",description:"Build-time variables, specified as a map or a list of KEY=VAL pairs."},ssh:{$ref:"#/$defs/list_or_dict",description:"SSH agent socket or keys to expose to the build. Format is either a string or a list of 'default|<id>[=<socket>|<key>[,<key>]]'."},labels:{$ref:"#/$defs/list_or_dict",description:"Labels to apply to the built image."},cache_from:{type:"array",items:{type:"string"},description:"List of sources the image builder should use for cache resolution"},cache_to:{type:"array",items:{type:"string"},description:"Cache destinations for the build cache."},no_cache:{type:["boolean","string"],description:"Do not use cache when building the image."},no_cache_filter:{$ref:"#/$defs/string_or_list",description:"Do not use build cache for the specified stages."},additional_contexts:{$ref:"#/$defs/list_or_dict",description:"Additional build contexts to use, specified as a map of name to context path or URL."},network:{type:"string",description:"Network mode to use for the build. Options include 'default', 'none', 'host', or a network name."},provenance:{type:["string","boolean"],description:"Add a provenance attestation"},sbom:{type:["string","boolean"],description:"Add a SBOM attestation"},pull:{type:["boolean","string"],description:"Always attempt to pull a newer version of the image."},target:{type:"string",description:"Build stage to target in a multi-stage Dockerfile."},shm_size:{type:["integer","string"],description:"Size of /dev/shm for the build container. A string value can use suffix like '2g' for 2 gigabytes."},extra_hosts:{$ref:"#/$defs/extra_hosts",description:"Add hostname mappings for the build container."},isolation:{type:"string",description:"Container isolation technology to use for the build process."},privileged:{type:["boolean","string"],description:"Give extended privileges to the build container."},secrets:{$ref:"#/$defs/service_config_or_secret",description:"Secrets to expose to the build. These are accessible at build-time."},tags:{type:"array",items:{type:"string"},description:"Additional tags to apply to the built image."},ulimits:{$ref:"#/$defs/ulimits",description:"Override the default ulimits for the build container."},platforms:{type:"array",items:{type:"string"},description:"Platforms to build for, e.g., 'linux/amd64', 'linux/arm64', or 'windows/amd64'."}},additionalProperties:!1,patternProperties:{"^x-":{}}}]},blkio_config:{type:"object",description:"Block IO configuration for the service.",properties:{device_read_bps:{type:"array",description:"Limit read rate (bytes per second) from a device.",items:{$ref:"#/$defs/blkio_limit"}},device_read_iops:{type:"array",description:"Limit read rate (IO per second) from a device.",items:{$ref:"#/$defs/blkio_limit"}},device_write_bps:{type:"array",description:"Limit write rate (bytes per second) to a device.",items:{$ref:"#/$defs/blkio_limit"}},device_write_iops:{type:"array",description:"Limit write rate (IO per second) to a device.",items:{$ref:"#/$defs/blkio_limit"}},weight:{type:["integer","string"],description:"Block IO weight (relative weight) for the service, between 10 and 1000."},weight_device:{type:"array",description:"Block IO weight (relative weight) for specific devices.",items:{$ref:"#/$defs/blkio_weight"}}},additionalProperties:!1},cap_add:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Add Linux capabilities. For example, 'CAP_SYS_ADMIN', 'SYS_ADMIN', or 'NET_ADMIN'."},cap_drop:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Drop Linux capabilities. For example, 'CAP_SYS_ADMIN', 'SYS_ADMIN', or 'NET_ADMIN'."},cgroup:{type:"string",enum:["host","private"],description:"Specify the cgroup namespace to join. Use 'host' to use the host's cgroup namespace, or 'private' to use a private cgroup namespace."},cgroup_parent:{type:"string",description:"Specify an optional parent cgroup for the container."},command:{$ref:"#/$defs/command",description:"Override the default command declared by the container image, for example 'CMD' in Dockerfile."},configs:{$ref:"#/$defs/service_config_or_secret",description:"Grant access to Configs on a per-service basis."},container_name:{type:"string",description:"Specify a custom container name, rather than a generated default name.",pattern:"[a-zA-Z0-9][a-zA-Z0-9_.-]+"},cpu_count:{oneOf:[{type:"string"},{type:"integer",minimum:0}],description:"Number of usable CPUs."},cpu_percent:{oneOf:[{type:"string"},{type:"integer",minimum:0,maximum:100}],description:"Percentage of CPU resources to use."},cpu_shares:{type:["number","string"],description:"CPU shares (relative weight) for the container."},cpu_quota:{type:["number","string"],description:"Limit the CPU CFS (Completely Fair Scheduler) quota."},cpu_period:{type:["number","string"],description:"Limit the CPU CFS (Completely Fair Scheduler) period."},cpu_rt_period:{type:["number","string"],description:"Limit the CPU real-time period in microseconds or a duration."},cpu_rt_runtime:{type:["number","string"],description:"Limit the CPU real-time runtime in microseconds or a duration."},cpus:{type:["number","string"],description:"Number of CPUs to use. A floating-point value is supported to request partial CPUs."},cpuset:{type:"string",description:"CPUs in which to allow execution (0-3, 0,1)."},credential_spec:{type:"object",description:"Configure the credential spec for managed service account.",properties:{config:{type:"string",description:"The name of the credential spec Config to use."},file:{type:"string",description:"Path to a credential spec file."},registry:{type:"string",description:"Path to a credential spec in the Windows registry."}},additionalProperties:!1,patternProperties:{"^x-":{}}},depends_on:{oneOf:[{$ref:"#/$defs/list_of_strings"},{type:"object",additionalProperties:!1,patternProperties:{"^[a-zA-Z0-9._-]+$":{type:"object",additionalProperties:!1,patternProperties:{"^x-":{}},properties:{restart:{type:["boolean","string"],description:"Whether to restart dependent services when this service is restarted."},required:{type:"boolean",default:!0,description:"Whether the dependency is required for the dependent service to start."},condition:{type:"string",enum:["service_started","service_healthy","service_completed_successfully"],description:"Condition to wait for. 'service_started' waits until the service has started, 'service_healthy' waits until the service is healthy (as defined by its healthcheck), 'service_completed_successfully' waits until the service has completed successfully."}},required:["condition"]}}}],description:"Express dependency between services. Service dependencies cause services to be started in dependency order. The dependent service will wait for the dependency to be ready before starting."},device_cgroup_rules:{$ref:"#/$defs/list_of_strings",description:"Add rules to the cgroup allowed devices list."},devices:{type:"array",description:"List of device mappings for the container.",items:{oneOf:[{type:"string"},{type:"object",required:["source"],properties:{source:{type:"string",description:"Path on the host to the device."},target:{type:"string",description:"Path in the container where the device will be mapped."},permissions:{type:"string",description:"Cgroup permissions for the device (rwm)."}},additionalProperties:!1,patternProperties:{"^x-":{}}}]}},dns:{$ref:"#/$defs/string_or_list",description:"Custom DNS servers to set for the service container."},dns_opt:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Custom DNS options to be passed to the container's DNS resolver."},dns_search:{$ref:"#/$defs/string_or_list",description:"Custom DNS search domains to set on the service container."},domainname:{type:"string",description:"Custom domain name to use for the service container."},entrypoint:{$ref:"#/$defs/command",description:"Override the default entrypoint declared by the container image, for example 'ENTRYPOINT' in Dockerfile."},env_file:{$ref:"#/$defs/env_file",description:"Add environment variables from a file or multiple files. Can be a single file path or a list of file paths."},label_file:{$ref:"#/$defs/label_file",description:"Add metadata to containers using files containing Docker labels."},environment:{$ref:"#/$defs/list_or_dict",description:"Add environment variables. You can use either an array or a list of KEY=VAL pairs."},expose:{type:"array",items:{type:["string","number"]},uniqueItems:!0,description:"Expose ports without publishing them to the host machine - they'll only be accessible to linked services."},extends:{oneOf:[{type:"string"},{type:"object",properties:{service:{type:"string",description:"The name of the service to extend."},file:{type:"string",description:"The file path where the service to extend is defined."}},required:["service"],additionalProperties:!1}],description:"Extend another service, in the current file or another file."},provider:{type:"object",description:"Specify a service which will not be manage by Compose directly, and delegate its management to an external provider.",required:["type"],properties:{type:{type:"string",description:"External component used by Compose to manage setup and teardown lifecycle of the service."},options:{type:"object",description:"Provider-specific options.",patternProperties:{"^.+$":{oneOf:[{type:["string","number","boolean"]},{type:"array",items:{type:["string","number","boolean"]}}]}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},external_links:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Link to services started outside this Compose application. Specify services as <service_name>:<alias>."},extra_hosts:{$ref:"#/$defs/extra_hosts",description:"Add hostname mappings to the container network interface configuration."},gpus:{$ref:"#/$defs/gpus",description:"Define GPU devices to use. Can be set to 'all' to use all GPUs, or a list of specific GPU devices."},group_add:{type:"array",items:{type:["string","number"]},uniqueItems:!0,description:"Add additional groups which user inside the container should be member of."},healthcheck:{$ref:"#/$defs/healthcheck",description:"Configure a health check for the container to monitor its health status."},hostname:{type:"string",description:"Define a custom hostname for the service container."},image:{type:"string",description:"Specify the image to start the container from. Can be a repository/tag, a digest, or a local image ID."},init:{type:["boolean","string"],description:"Run as an init process inside the container that forwards signals and reaps processes."},ipc:{type:"string",description:"IPC sharing mode for the service container. Use 'host' to share the host's IPC namespace, 'service:[service_name]' to share with another service, or 'shareable' to allow other services to share this service's IPC namespace."},isolation:{type:"string",description:"Container isolation technology to use. Supported values are platform-specific."},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to containers using Docker labels. You can use either an array or a list."},links:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Link to containers in another service. Either specify both the service name and a link alias (SERVICE:ALIAS), or just the service name."},logging:{type:"object",description:"Logging configuration for the service.",properties:{driver:{type:"string",description:"Logging driver to use, such as 'json-file', 'syslog', 'journald', etc."},options:{type:"object",description:"Options for the logging driver.",patternProperties:{"^.+$":{type:["string","number","null"]}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},mac_address:{type:"string",description:"Container MAC address to set."},mem_limit:{type:["number","string"],description:"Memory limit for the container. A string value can use suffix like '2g' for 2 gigabytes."},mem_reservation:{type:["string","integer"],description:"Memory reservation for the container."},mem_swappiness:{type:["integer","string"],description:"Container memory swappiness as percentage (0 to 100)."},memswap_limit:{type:["number","string"],description:"Amount of memory the container is allowed to swap to disk. Set to -1 to enable unlimited swap."},network_mode:{type:"string",description:"Network mode. Values can be 'bridge', 'host', 'none', 'service:[service name]', or 'container:[container name]'."},models:{oneOf:[{$ref:"#/$defs/list_of_strings"},{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{oneOf:[{type:"object",properties:{endpoint_var:{type:"string",description:"Environment variable set to AI model endpoint."},model_var:{type:"string",description:"Environment variable set to AI model name."}},additionalProperties:!1,patternProperties:{"^x-":{}}},{type:"null"}]}}}],description:"AI Models to use, referencing entries under the top-level models key."},networks:{oneOf:[{$ref:"#/$defs/list_of_strings"},{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{oneOf:[{type:"object",properties:{aliases:{$ref:"#/$defs/list_of_strings",description:"Alternative hostnames for this service on the network."},interface_name:{type:"string",description:"Interface network name used to connect to network"},ipv4_address:{type:"string",description:"Specify a static IPv4 address for this service on this network."},ipv6_address:{type:"string",description:"Specify a static IPv6 address for this service on this network."},link_local_ips:{$ref:"#/$defs/list_of_strings",description:"List of link-local IPs."},mac_address:{type:"string",description:"Specify a MAC address for this service on this network."},driver_opts:{type:"object",description:"Driver options for this network.",patternProperties:{"^.+$":{type:["string","number"]}}},priority:{type:"number",description:"Specify the priority for the network connection."},gw_priority:{type:"number",description:"Specify the gateway priority for the network connection."}},additionalProperties:!1,patternProperties:{"^x-":{}}},{type:"null"}]}},additionalProperties:!1}],description:"Networks to join, referencing entries under the top-level networks key. Can be a list of network names or a mapping of network name to network configuration."},oom_kill_disable:{type:["boolean","string"],description:"Disable OOM Killer for the container."},oom_score_adj:{oneOf:[{type:"string"},{type:"integer",minimum:-1000,maximum:1000}],description:"Tune host's OOM preferences for the container (accepts -1000 to 1000)."},pid:{type:["string","null"],description:"PID mode for container."},pids_limit:{type:["number","string"],description:"Tune a container's PIDs limit. Set to -1 for unlimited PIDs."},platform:{type:"string",description:"Target platform to run on, e.g., 'linux/amd64', 'linux/arm64', or 'windows/amd64'."},ports:{type:"array",description:"Expose container ports. Short format ([HOST:]CONTAINER[/PROTOCOL]).",items:{oneOf:[{type:"number"},{type:"string"},{type:"object",properties:{name:{type:"string",description:"A human-readable name for this port mapping."},mode:{type:"string",description:"The port binding mode, either 'host' for publishing a host port or 'ingress' for load balancing."},host_ip:{type:"string",description:"The host IP to bind to."},target:{type:["integer","string"],description:"The port inside the container."},published:{type:["string","integer"],description:"The publicly exposed port."},protocol:{type:"string",description:"The port protocol (tcp or udp)."},app_protocol:{type:"string",description:"Application protocol to use with the port (e.g., http, https, mysql)."}},additionalProperties:!1,patternProperties:{"^x-":{}}}]},uniqueItems:!0},pre_start:{type:"array",items:{$ref:"#/$defs/pre_start_hook"},description:"Init containers to run to completion before the service container is started. Each step runs in its own ephemeral container, in declared order; a non-zero exit fails the bring-up of the service and its dependents."},post_start:{type:"array",items:{$ref:"#/$defs/service_hook"},description:"Commands to run after the container starts. If any command fails, the container stops."},pre_stop:{type:"array",items:{$ref:"#/$defs/service_hook"},description:"Commands to run before the container stops. If any command fails, the container stop is aborted."},privileged:{type:["boolean","string"],description:"Give extended privileges to the service container."},profiles:{$ref:"#/$defs/list_of_strings",description:"List of profiles for this service. When profiles are specified, services are only started when the profile is activated."},pull_policy:{type:"string",pattern:"always|never|build|if_not_present|missing|refresh|daily|weekly|every_([0-9]+[wdhms])+",description:"Policy for pulling images. Options include: 'always', 'never', 'if_not_present', 'missing', 'build', or time-based refresh policies."},pull_refresh_after:{type:"string",description:"Time after which to refresh the image. Used with pull_policy=refresh."},read_only:{type:["boolean","string"],description:"Mount the container's filesystem as read only."},restart:{type:"string",description:"Restart policy for the service container. Options include: 'no', 'always', 'on-failure', and 'unless-stopped'."},runtime:{type:"string",description:"Runtime to use for this container, e.g., 'runc'."},scale:{type:["integer","string"],description:"Number of containers to deploy for this service."},security_opt:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Override the default labeling scheme for each container."},shm_size:{type:["number","string"],description:"Size of /dev/shm. A string value can use suffix like '2g' for 2 gigabytes."},secrets:{$ref:"#/$defs/service_config_or_secret",description:"Grant access to Secrets on a per-service basis."},sysctls:{$ref:"#/$defs/list_or_dict",description:"Kernel parameters to set in the container. You can use either an array or a list."},stdin_open:{type:["boolean","string"],description:"Keep STDIN open even if not attached."},stop_grace_period:{type:"string",description:"Time to wait for the container to stop gracefully before sending SIGKILL (e.g., '1s', '1m30s')."},stop_signal:{type:"string",description:"Signal to stop the container (e.g., 'SIGTERM', 'SIGINT')."},storage_opt:{type:"object",description:"Storage driver options for the container."},tmpfs:{$ref:"#/$defs/string_or_list",description:"Mount a temporary filesystem (tmpfs) into the container. Can be a single value or a list."},tty:{type:["boolean","string"],description:"Allocate a pseudo-TTY to service container."},ulimits:{$ref:"#/$defs/ulimits",description:"Override the default ulimits for a container."},use_api_socket:{type:"boolean",description:"Bind mount Docker API socket and required auth."},user:{type:"string",description:"Username or UID to run the container process as."},uts:{type:"string",description:"UTS namespace to use. 'host' shares the host's UTS namespace."},userns_mode:{type:"string",description:"User namespace to use. 'host' shares the host's user namespace."},volumes:{type:"array",description:"Mount host paths or named volumes accessible to the container. Short syntax (VOLUME:CONTAINER_PATH[:MODE])",items:{oneOf:[{type:"string"},{type:"object",required:["type"],properties:{type:{type:"string",enum:["bind","volume","tmpfs","cluster","npipe","image"],description:"The mount type: bind for mounting host directories, volume for named volumes, tmpfs for temporary filesystems, cluster for cluster volumes, npipe for named pipes, or image for mounting from an image."},source:{type:"string",description:"The source of the mount, a path on the host for a bind mount, a docker image reference for an image mount, or the name of a volume defined in the top-level volumes key. Not applicable for a tmpfs mount."},target:{type:"string",description:"The path in the container where the volume is mounted."},read_only:{type:["boolean","string"],description:"Flag to set the volume as read-only."},consistency:{type:"string",description:"The consistency requirements for the mount. Available values are platform specific."},bind:{type:"object",description:"Configuration specific to bind mounts.",properties:{propagation:{type:"string",description:"The propagation mode for the bind mount: 'shared', 'slave', 'private', 'rshared', 'rslave', or 'rprivate'."},create_host_path:{type:["boolean","string"],description:"Create the host path if it doesn't exist."},recursive:{type:"string",enum:["enabled","disabled","writable","readonly"],description:"Recursively mount the source directory."},selinux:{type:"string",enum:["z","Z"],description:"SELinux relabeling options: 'z' for shared content, 'Z' for private unshared content."}},additionalProperties:!1,patternProperties:{"^x-":{}}},volume:{type:"object",description:"Configuration specific to volume mounts.",properties:{labels:{$ref:"#/$defs/list_or_dict",description:"Labels to apply to the volume."},nocopy:{type:["boolean","string"],description:"Flag to disable copying of data from a container when a volume is created."},subpath:{type:"string",description:"Path within the volume to mount instead of the volume root."}},additionalProperties:!1,patternProperties:{"^x-":{}}},tmpfs:{type:"object",description:"Configuration specific to tmpfs mounts.",properties:{size:{oneOf:[{type:"integer",minimum:0},{type:"string"}],description:"Size of the tmpfs mount in bytes."},mode:{type:["number","string"],description:"File mode of the tmpfs in octal."}},additionalProperties:!1,patternProperties:{"^x-":{}}},image:{type:"object",description:"Configuration specific to image mounts.",properties:{subpath:{type:"string",description:"Path within the image to mount instead of the image root."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},additionalProperties:!1,patternProperties:{"^x-":{}}}]},uniqueItems:!0},volumes_from:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Mount volumes from another service or container. Optionally specify read-only access (ro) or read-write (rw)."},working_dir:{type:"string",description:"The working directory in which the entrypoint or command will be run"}},patternProperties:{"^x-":{}},additionalProperties:!1},healthcheck:{type:"object",description:"Configuration options to determine whether the container is healthy.",properties:{disable:{type:["boolean","string"],description:"Disable any container-specified healthcheck. Set to true to disable."},interval:{type:"string",description:"Time between running the check (e.g., '1s', '1m30s'). Default: 30s."},retries:{type:["number","string"],description:"Number of consecutive failures needed to consider the container as unhealthy. Default: 3."},test:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The test to perform to check container health. Can be a string or a list. The first item is either NONE, CMD, or CMD-SHELL. If it's CMD, the rest of the command is exec'd. If it's CMD-SHELL, the rest is run in the shell."},timeout:{type:"string",description:"Maximum time to allow one check to run (e.g., '1s', '1m30s'). Default: 30s."},start_period:{type:"string",description:"Start period for the container to initialize before starting health-retries countdown (e.g., '1s', '1m30s'). Default: 0s."},start_interval:{type:"string",description:"Time between running the check during the start period (e.g., '1s', '1m30s'). Default: interval value."}},additionalProperties:!1,patternProperties:{"^x-":{}}},development:{type:["object","null"],description:"Development configuration for the service, used for development workflows.",properties:{watch:{type:"array",description:"Configure watch mode for the service, which monitors file changes and performs actions in response.",items:{type:"object",required:["path","action"],properties:{ignore:{$ref:"#/$defs/string_or_list",description:"Patterns to exclude from watching."},include:{$ref:"#/$defs/string_or_list",description:"Patterns to include in watching."},path:{type:"string",description:"Path to watch for changes."},action:{type:"string",enum:["rebuild","sync","restart","sync+restart","sync+exec"],description:"Action to take when a change is detected: rebuild the container, sync files, restart the container, sync and restart, or sync and execute a command."},target:{type:"string",description:"Target path in the container for sync operations."},exec:{$ref:"#/$defs/service_hook",description:"Command to execute when a change is detected and action is sync+exec."},initial_sync:{type:"boolean",description:"Ensure that an initial synchronization is done before starting watch mode for sync+x triggers"}},additionalProperties:!1,patternProperties:{"^x-":{}}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},deployment:{type:["object","null"],description:"Deployment configuration for the service.",properties:{mode:{type:"string",description:"Deployment mode for the service: 'replicated' (default) or 'global'."},endpoint_mode:{type:"string",description:"Endpoint mode for the service: 'vip' (default) or 'dnsrr'."},replicas:{type:["integer","string"],description:"Number of replicas of the service container to run."},labels:{$ref:"#/$defs/list_or_dict",description:"Labels to apply to the service."},rollback_config:{type:"object",description:"Configuration for rolling back a service update.",properties:{parallelism:{type:["integer","string"],description:"The number of containers to rollback at a time. If set to 0, all containers rollback simultaneously."},delay:{type:"string",description:"The time to wait between each container group's rollback (e.g., '1s', '1m30s')."},failure_action:{type:"string",description:"Action to take if a rollback fails: 'continue', 'pause'."},monitor:{type:"string",description:"Duration to monitor each task for failures after it is created (e.g., '1s', '1m30s')."},max_failure_ratio:{type:["number","string"],description:"Failure rate to tolerate during a rollback."},order:{type:"string",enum:["start-first","stop-first"],description:"Order of operations during rollbacks: 'stop-first' (default) or 'start-first'."}},additionalProperties:!1,patternProperties:{"^x-":{}}},update_config:{type:"object",description:"Configuration for updating a service.",properties:{parallelism:{type:["integer","string"],description:"The number of containers to update at a time."},delay:{type:"string",description:"The time to wait between updating a group of containers (e.g., '1s', '1m30s')."},failure_action:{type:"string",description:"Action to take if an update fails: 'continue', 'pause', 'rollback'."},monitor:{type:"string",description:"Duration to monitor each updated task for failures after it is created (e.g., '1s', '1m30s')."},max_failure_ratio:{type:["number","string"],description:"Failure rate to tolerate during an update (0 to 1)."},order:{type:"string",enum:["start-first","stop-first"],description:"Order of operations during updates: 'stop-first' (default) or 'start-first'."}},additionalProperties:!1,patternProperties:{"^x-":{}}},resources:{type:"object",description:"Resource constraints and reservations for the service.",properties:{limits:{type:"object",description:"Resource limits for the service containers.",properties:{cpus:{type:["number","string"],description:"Limit for how much of the available CPU resources, as number of cores, a container can use."},memory:{type:"string",description:"Limit on the amount of memory a container can allocate (e.g., '1g', '1024m')."},pids:{type:["integer","string"],description:"Maximum number of PIDs available to the container."}},additionalProperties:!1,patternProperties:{"^x-":{}}},reservations:{type:"object",description:"Resource reservations for the service containers.",properties:{cpus:{type:["number","string"],description:"Reservation for how much of the available CPU resources, as number of cores, a container can use."},memory:{type:"string",description:"Reservation on the amount of memory a container can allocate (e.g., '1g', '1024m')."},generic_resources:{$ref:"#/$defs/generic_resources",description:"User-defined resources to reserve."},devices:{$ref:"#/$defs/devices",description:"Device reservations for the container."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},restart_policy:{type:"object",description:"Restart policy for the service containers.",properties:{condition:{type:"string",description:"Condition for restarting the container: 'none', 'on-failure', 'any'."},delay:{type:"string",description:"Delay between restart attempts (e.g., '1s', '1m30s')."},max_attempts:{type:["integer","string"],description:"Maximum number of restart attempts before giving up."},window:{type:"string",description:"Time window used to evaluate the restart policy (e.g., '1s', '1m30s')."}},additionalProperties:!1,patternProperties:{"^x-":{}}},placement:{type:"object",description:"Constraints and preferences for the platform to select a physical node to run service containers",properties:{constraints:{type:"array",items:{type:"string"},description:"Placement constraints for the service (e.g., 'node.role==manager')."},preferences:{type:"array",description:"Placement preferences for the service.",items:{type:"object",properties:{spread:{type:"string",description:"Spread tasks evenly across values of the specified node label."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},max_replicas_per_node:{type:["integer","string"],description:"Maximum number of replicas of the service."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},generic_resources:{type:"array",description:"User-defined resources for services, allowing services to reserve specialized hardware resources.",items:{type:"object",properties:{discrete_resource_spec:{type:"object",description:"Specification for discrete (countable) resources.",properties:{kind:{type:"string",description:"Type of resource (e.g., 'GPU', 'FPGA', 'SSD')."},value:{type:["number","string"],description:"Number of resources of this kind to reserve."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},additionalProperties:!1,patternProperties:{"^x-":{}}}},devices:{type:"array",description:"Device reservations for containers, allowing services to access specific hardware devices.",items:{type:"object",properties:{capabilities:{$ref:"#/$defs/list_of_strings",description:"List of capabilities the device needs to have (e.g., 'gpu', 'compute', 'utility')."},count:{type:["string","integer"],description:"Number of devices of this type to reserve."},device_ids:{$ref:"#/$defs/list_of_strings",description:"List of specific device IDs to reserve."},driver:{type:"string",description:"Device driver to use (e.g., 'nvidia')."},options:{$ref:"#/$defs/list_or_dict",description:"Driver-specific options for the device."}},additionalProperties:!1,patternProperties:{"^x-":{}},required:["capabilities"]}},gpus:{oneOf:[{type:"string",enum:["all"],description:"Use all available GPUs."},{type:"array",description:"List of specific GPU devices to use.",items:{type:"object",properties:{capabilities:{$ref:"#/$defs/list_of_strings",description:"List of capabilities the GPU needs to have (e.g., 'compute', 'utility')."},count:{type:["string","integer"],description:"Number of GPUs to use."},device_ids:{$ref:"#/$defs/list_of_strings",description:"List of specific GPU device IDs to use."},driver:{type:"string",description:"GPU driver to use (e.g., 'nvidia')."},options:{$ref:"#/$defs/list_or_dict",description:"Driver-specific options for the GPU."}}},additionalProperties:!1,patternProperties:{"^x-":{}}}]},include:{description:"Compose application or sub-projects to be included.",oneOf:[{type:"string"},{type:"object",properties:{path:{$ref:"#/$defs/string_or_list",description:"Path to the Compose application or sub-project files to include."},env_file:{$ref:"#/$defs/string_or_list",description:"Path to the environment files to use to define default values when interpolating variables in the Compose files being parsed."},project_directory:{type:"string",description:"Path to resolve relative paths set in the Compose file"}},additionalProperties:!1}]},network:{type:["object","null"],description:"Network configuration for the Compose application.",properties:{name:{type:"string",description:"Custom name for this network."},driver:{type:"string",description:"Specify which driver should be used for this network. Default is 'bridge'."},driver_opts:{type:"object",description:"Specify driver-specific options defined as key/value pairs.",patternProperties:{"^.+$":{type:["string","number"]}}},ipam:{type:"object",description:"Custom IP Address Management configuration for this network.",properties:{driver:{type:"string",description:"Custom IPAM driver, instead of the default."},config:{type:"array",description:"List of IPAM configuration blocks.",items:{type:"object",properties:{subnet:{type:"string",description:"Subnet in CIDR format that represents a network segment."},ip_range:{type:"string",description:"Range of IPs from which to allocate container IPs."},gateway:{type:"string",description:"IPv4 or IPv6 gateway for the subnet."},aux_addresses:{type:"object",description:"Auxiliary IPv4 or IPv6 addresses used by Network driver.",additionalProperties:!1,patternProperties:{"^.+$":{type:"string"}}}},additionalProperties:!1,patternProperties:{"^x-":{}}}},options:{type:"object",description:"Driver-specific options for the IPAM driver.",additionalProperties:!1,patternProperties:{"^.+$":{type:"string"}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},external:{type:["boolean","string","object"],description:"Specifies that this network already exists and was created outside of Compose.",properties:{name:{deprecated:!0,type:"string",description:"Specifies the name of the external network. Deprecated: use the 'name' property instead."}},additionalProperties:!1,patternProperties:{"^x-":{}}},internal:{type:["boolean","string"],description:"Create an externally isolated network."},enable_ipv4:{type:["boolean","string"],description:"Enable IPv4 networking."},enable_ipv6:{type:["boolean","string"],description:"Enable IPv6 networking."},attachable:{type:["boolean","string"],description:"If true, standalone containers can attach to this network."},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to the network using labels."}},additionalProperties:!1,patternProperties:{"^x-":{}}},volume:{type:["object","null"],description:"Volume configuration for the Compose application.",properties:{name:{type:"string",description:"Custom name for this volume."},driver:{type:"string",description:"Specify which volume driver should be used for this volume."},driver_opts:{type:"object",description:"Specify driver-specific options.",patternProperties:{"^.+$":{type:["string","number"]}}},external:{type:["boolean","string","object"],description:"Specifies that this volume already exists and was created outside of Compose.",properties:{name:{deprecated:!0,type:"string",description:"Specifies the name of the external volume. Deprecated: use the 'name' property instead."}},additionalProperties:!1,patternProperties:{"^x-":{}}},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to the volume using labels."}},additionalProperties:!1,patternProperties:{"^x-":{}}},secret:{type:"object",description:"Secret configuration for the Compose application.",properties:{name:{type:"string",description:"Custom name for this secret."},environment:{type:"string",description:"Name of an environment variable from which to get the secret value."},file:{type:"string",description:"Path to a file containing the secret value."},external:{type:["boolean","string","object"],description:"Specifies that this secret already exists and was created outside of Compose.",properties:{name:{type:"string",description:"Specifies the name of the external secret."}}},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to the secret using labels."},driver:{type:"string",description:"Specify which secret driver should be used for this secret."},driver_opts:{type:"object",description:"Specify driver-specific options.",patternProperties:{"^.+$":{type:["string","number"]}}},template_driver:{type:"string",description:"Driver to use for templating the secret's value."}},additionalProperties:!1,patternProperties:{"^x-":{}}},config:{type:"object",description:"Config configuration for the Compose application.",properties:{name:{type:"string",description:"Custom name for this config."},content:{type:"string",description:"Inline content of the config."},environment:{type:"string",description:"Name of an environment variable from which to get the config value."},file:{type:"string",description:"Path to a file containing the config value."},external:{type:["boolean","string","object"],description:"Specifies that this config already exists and was created outside of Compose.",properties:{name:{deprecated:!0,type:"string",description:"Specifies the name of the external config. Deprecated: use the 'name' property instead."}}},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to the config using labels."},template_driver:{type:"string",description:"Driver to use for templating the config's value."}},additionalProperties:!1,patternProperties:{"^x-":{}}},model:{type:"object",description:"Language Model for the Compose application.",properties:{name:{type:"string",description:"Custom name for this model."},model:{type:"string",description:"Language Model to run."},context_size:{type:"integer"},runtime_flags:{type:"array",items:{type:"string"},description:"Raw runtime flags to pass to the inference engine."}},required:["model"],additionalProperties:!1,patternProperties:{"^x-":{}}},command:{oneOf:[{type:"null",description:"No command specified, use the container's default command."},{type:"string",description:"Command as a string, which will be executed in a shell (e.g., '/bin/sh -c')."},{type:"array",description:"Command as an array of strings, which will be executed directly without a shell.",items:{type:"string",description:"Part of the command (executable or argument)."}}],description:"Command to run in the container, which can be specified as a string (shell form) or array (exec form)."},service_hook:{type:"object",description:"Configuration for service lifecycle hooks, which are commands executed at specific points in a container's lifecycle.",properties:{command:{$ref:"#/$defs/command",description:"Command to execute as part of the hook."},user:{type:"string",description:"User to run the command as."},privileged:{type:["boolean","string"],description:"Whether to run the command with extended privileges."},working_dir:{type:"string",description:"Working directory for the command."},environment:{$ref:"#/$defs/list_or_dict",description:"Environment variables for the command."}},additionalProperties:!1,patternProperties:{"^x-":{}},required:["command"]},pre_start_hook:{type:"object",description:"Configuration for a pre_start init container, run to completion before the service container starts.",properties:{command:{$ref:"#/$defs/command",description:"Command to execute. Optional when the chosen image's entrypoint already runs the intended command."},image:{type:"string",description:"Image used for the ephemeral container. If omitted, the parent service's image is used."},user:{type:"string",description:"User to run the command as. Defaults to the user declared in image (or to the service's user when image is omitted)."},privileged:{type:["boolean","string"],description:"Whether to run the command with extended privileges."},working_dir:{type:"string",description:"Working directory for the command. Defaults to the service's working directory."},environment:{$ref:"#/$defs/list_or_dict",description:"Environment variables for the command. Appended to or overriding the service environment."},per_replica:{type:["boolean","string"],description:"Whether the hook runs once per service replica (true), or once for the service as a whole before any replica starts (false, the default)."}},additionalProperties:!1,patternProperties:{"^x-":{}}},env_file:{oneOf:[{type:"string",description:"Path to a file containing environment variables."},{type:"array",description:"List of paths to files containing environment variables.",items:{oneOf:[{type:"string",description:"Path to a file containing environment variables."},{type:"object",description:"Detailed configuration for an environment file.",additionalProperties:!1,properties:{path:{type:"string",description:"Path to the environment file."},format:{type:"string",description:"Format attribute lets you to use an alternative file formats for env_file. When not set, env_file is parsed according to Compose rules."},required:{type:["boolean","string"],default:!0,description:"Whether the file is required. If true and the file doesn't exist, an error will be raised."}},required:["path"]}]}}]},label_file:{oneOf:[{type:"string",description:"Path to a file containing Docker labels."},{type:"array",description:"List of paths to files containing Docker labels.",items:{type:"string",description:"Path to a file containing Docker labels."}}]},string_or_list:{oneOf:[{type:"string",description:"A single string value."},{$ref:"#/$defs/list_of_strings",description:"A list of string values."}],description:"Either a single string or a list of strings."},list_of_strings:{type:"array",description:"A list of unique string values.",items:{type:"string",description:"A string value in the list."},uniqueItems:!0},list_or_dict:{oneOf:[{type:"object",description:"A dictionary mapping keys to values.",patternProperties:{".+":{type:["string","number","boolean","null"],description:"Value for the key, which can be a string, number, boolean, or null."}},additionalProperties:!1},{type:"array",description:"A list of unique string values.",items:{type:"string",description:"A string value in the list."},uniqueItems:!0}],description:"Either a dictionary mapping keys to values, or a list of strings."},extra_hosts:{oneOf:[{type:"object",description:"list mapping hostnames to IP addresses.",patternProperties:{".+":{oneOf:[{type:"string",description:"IP address for the hostname."},{type:"array",description:"List of IP addresses for the hostname.",items:{type:"string",description:"IP address for the hostname."},uniqueItems:!1}]}},additionalProperties:!1},{type:"array",description:"List of host:IP mappings in the format 'hostname:IP'.",items:{type:"string",description:"Host:IP mapping in the format 'hostname:IP'."},uniqueItems:!0}],description:"Additional hostnames to be defined in the container's /etc/hosts file."},blkio_limit:{type:"object",description:"Block IO limit for a specific device.",properties:{path:{type:"string",description:"Path to the device (e.g., '/dev/sda')."},rate:{type:["integer","string"],description:"Rate limit in bytes per second or IO operations per second."}},additionalProperties:!1},blkio_weight:{type:"object",description:"Block IO weight for a specific device.",properties:{path:{type:"string",description:"Path to the device (e.g., '/dev/sda')."},weight:{type:["integer","string"],description:"Relative weight for the device, between 10 and 1000."}},additionalProperties:!1},service_config_or_secret:{type:"array",description:"Configuration for service configs or secrets, defining how they are mounted in the container.",items:{oneOf:[{type:"string",description:"Name of the config or secret to grant access to."},{type:"object",description:"Detailed configuration for a config or secret.",properties:{source:{type:"string",description:"Name of the config or secret as defined in the top-level configs or secrets section."},target:{type:"string",description:"Path in the container where the config or secret will be mounted. Defaults to /<source> for configs and /run/secrets/<source> for secrets."},uid:{type:"string",description:"UID of the file in the container. Default is 0 (root)."},gid:{type:"string",description:"GID of the file in the container. Default is 0 (root)."},mode:{type:["number","string"],description:"File permission mode inside the container, in octal. Default is 0444 for configs and 0400 for secrets."}},additionalProperties:!1,patternProperties:{"^x-":{}}}]}},ulimits:{type:"object",description:"Container ulimit options, controlling resource limits for processes inside the container.",patternProperties:{"^[a-z]+$":{oneOf:[{type:["integer","string"],description:"Single value for both soft and hard limits."},{type:"object",description:"Separate soft and hard limits.",properties:{hard:{type:["integer","string"],description:"Hard limit for the ulimit type. This is the maximum allowed value."},soft:{type:["integer","string"],description:"Soft limit for the ulimit type. This is the value that's actually enforced."}},required:["soft","hard"],additionalProperties:!1,patternProperties:{"^x-":{}}}]}}}}}});import{readdir as iv}from"fs/promises";import{join as sv}from"path";var{file:av,YAML:cv}=globalThis.Bun;function lv(){if(!Po)Po=Promise.resolve().then(() => (lm(),{})).then(({})=>Tf(um)).catch((e)=>{throw Po=void 0,e});return Po}function pm(e){return av(e).text().then(cv.parse).then(async(t)=>(await lv()).parse(t))}async function dm(e){return(await iv(e,{withFileTypes:!0})).filter((r)=>r.isFile()&&uv.has(r.name)).map((r)=>sv(e,r.name)).sort()[0]}var uv,Po;var fm=_(()=>{Ns();uv=new Set(["compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"])});import{AsyncLocalStorage as pv}from"async_hooks";function dv(e,t){if(e.projectConfigured)return e.project;return t.name?.trim()||e.project}async function hm(e,t){let r=process.cwd(),o=await am(r,t),n=Co("composeFile",()=>o.composeFile?Promise.resolve(o.composeFile):dm(r)),i=Co("parsedCompose",async()=>{let c=await n();if(!c)throw Error("Compose file cannot be found");return pm(c)});if(!o.projectConfigured){if(await n())o.project=dv(o,await i())}let s=Co("hookContext",async()=>{let c=await n();if(!c)throw Error("Compose file cannot be found");return cm(o,r,c)}),a=Co("compose",async()=>{let c=await s(),u=await i();return await o.compose?.(u,c),u});return await mm.run({project:o.project,cwd:r,config:o,path:n,hookContext:s,compose:a},e)}function I(){let e=mm.getStore();if(!e)throw Error("Not in context!");return e}function Co(e,t){let r;return()=>(r??=t().catch((o)=>{throw r=void 0,o}),r)}var mm;var ee=_(()=>{ko();fm();mm=new pv});import{createHash as fv,randomUUID as mv}from"crypto";import{chmod as gm,mkdir as hv,readFile as gv,realpath as yv,rename as bv,writeFile as _v}from"fs/promises";import{join as ym}from"path";function _m(){return ym(process.env.XDG_CONFIG_HOME??ym(process.env.HOME??"/tmp",".config"),"kuber","trust.json")}async function gt(e,t=process.cwd()){let r=await yv(t);return{project:e,fingerprint:fv("sha256").update(r).digest("hex")}}function wv(e){return!!e&&typeof e==="object"&&typeof e.project==="string"&&typeof e.fingerprint==="string"&&/^[a-f0-9]{64}$/.test(e.fingerprint)}async function Ro(){try{let e=JSON.parse(await gv(_m(),"utf8"));if(!e||typeof e!=="object"||e.version!==bm||!Array.isArray(e.records))return[];return e.records.filter(wv)}catch{return[]}}async function vv(e){let t=_m(),r=t.slice(0,t.lastIndexOf("/"));await hv(r,{recursive:!0,mode:448}),await gm(r,448);let o=`${t}.${mv()}.tmp`;await _v(o,JSON.stringify({version:bm,records:e},null,2)+`
|
|
80
|
-
`,{flag:"wx",mode:384}),await
|
|
81
|
-
${t}`,Rv,Tv,Ov=(e,t,r)=>{let o=r===""?"":`with ${r.trim()}() `,n=Cv.bind(null,o,t.toString());Object.defineProperty(n,"name",Tv);let{writable:i,enumerable:s,configurable:a}=Rv;Object.defineProperty(e,"toString",{value:n,writable:i,enumerable:s,configurable:a})};var km=_(()=>{Rv=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Tv=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name")});var Io,Pm=(e,t={})=>{if(typeof e!=="function")throw TypeError("Expected a function");let r,o=0,n=e.displayName||e.name||"<anonymous>",i=function(...s){if(Io.set(i,++o),o===1)r=e.apply(this,s),e=void 0;else if(t.throw===!0)throw Error(`Function \`${n}\` can only be called once`);return r};return ta(i,e),Io.set(i,o),i},Cm;var Rm=_(()=>{km();Io=new WeakMap;Pm.callCount=(e)=>{if(!Io.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Io.get(e)};Cm=Pm});var rt;var Tm=_(()=>{rt=[];rt.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")rt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")rt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});class Om{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(oa[ra])return oa[ra];Iv(oa,ra,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let r=this.listeners[e],o=r.indexOf(t);if(o===-1)return;if(o===0&&r.length===1)r.length=0;else r.splice(o,1)}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let o=!1;for(let n of this.listeners[e])o=n(t,r)===!0||o;if(e==="exit")o=this.emit("afterExit",t,r)||o;return o}}class ia{}var Bo=(e)=>!!e&&typeof e==="object"&&typeof e.removeListener==="function"&&typeof e.emit==="function"&&typeof e.reallyExit==="function"&&typeof e.listeners==="function"&&typeof e.kill==="function"&&typeof e.pid==="number"&&typeof e.on==="function",ra,oa,Iv,Bv=(e)=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Im,Bm,na,zm,Z0,q0;var Dm=_(()=>{Tm();ra=Symbol.for("signal-exit emitter"),oa=globalThis,Iv=Object.defineProperty.bind(Object);Im=class Im extends ia{onExit(){return()=>{}}load(){}unload(){}};Bm=class Bm extends ia{#t=na.platform==="win32"?"SIGINT":"SIGHUP";#r=new Om;#e;#o;#s;#i={};#n=!1;constructor(e){super();this.#e=e,this.#i={};for(let t of rt)this.#i[t]=()=>{let r=this.#e.listeners(t),{count:o}=this.#r,n=e;if(typeof n.__signal_exit_emitter__==="object"&&typeof n.__signal_exit_emitter__.count==="number")o+=n.__signal_exit_emitter__.count;if(r.length===o){this.unload();let i=this.#r.emit("exit",null,t),s=t==="SIGHUP"?this.#t:t;if(!i)e.kill(e.pid,s)}};this.#s=e.reallyExit,this.#o=e.emit}onExit(e,t){if(!Bo(this.#e))return()=>{};if(this.#n===!1)this.load();let r=t?.alwaysLast?"afterExit":"exit";return this.#r.on(r,e),()=>{if(this.#r.removeListener(r,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0)this.unload()}}load(){if(this.#n)return;this.#n=!0,this.#r.count+=1;for(let e of rt)try{let t=this.#i[e];if(t)this.#e.on(e,t)}catch(t){}this.#e.emit=(e,...t)=>this.#c(e,...t),this.#e.reallyExit=(e)=>this.#a(e)}unload(){if(!this.#n)return;this.#n=!1,rt.forEach((e)=>{let t=this.#i[e];if(!t)throw Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,t)}catch(r){}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#s,this.#r.count-=1}#a(e){if(!Bo(this.#e))return 0;return this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)}#c(e,...t){let r=this.#o;if(e==="exit"&&Bo(this.#e)){if(typeof t[0]==="number")this.#e.exitCode=t[0];let o=r.call(this.#e,e,...t);return this.#r.emit("exit",this.#e.exitCode,null),o}else return r.call(this.#e,e,...t)}};na=globalThis.process,{onExit:zm,load:Z0,unload:q0}=Bv(Bo(na)?new Bm(na):new Im)});import zo from"process";var Nm,zv,Lm;var Vm=_(()=>{Rm();Dm();Nm=zo.stderr.isTTY?zo.stderr:zo.stdout.isTTY?zo.stdout:void 0,zv=Nm?Cm(()=>{zm(()=>{Nm.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Lm=zv});import Um from"process";var Do=!1,_t,sa;var Mm=_(()=>{Vm();_t={};_t.show=(e=Um.stderr)=>{if(!e.isTTY)return;Do=!1,e.write("\x1B[?25h")};_t.hide=(e=Um.stderr)=>{if(!e.isTTY)return;Lm(),Do=!0,e.write("\x1B[?25l")};_t.toggle=(e,t)=>{if(e!==void 0)Do=e;if(Do)_t.show(t);else _t.hide(t)};sa=_t});function aa({onlyFirst:e=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")}function Fe(e){if(typeof e!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);if(!e.includes("\x1B")&&!e.includes("\x9B"))return e;return e.replace(Dv,"")}var Dv;var No=_(()=>{Dv=aa()});var Fm=161,jm=1114109,Zm,qm=12288,Qm=65510,Wm,Gm=4352,Km=262141,ca;var Hm=_(()=>{Zm=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Wm=[12288,12288,65281,65376,65504,65510],ca=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141]});var Lo=(e,t)=>{let r=0,o=Math.floor(e.length/2)-1;while(r<=o){let n=Math.floor((r+o)/2),i=n*2;if(t<e[i])o=n-1;else if(t>e[i+1])r=n+1;else return!0}return!1};function Vv(e){let t=e[0],r=e[1];for(let o=0;o<e.length;o+=2){let n=e[o],i=e[o+1];if(Jm>=n&&Jm<=i)return[n,i];if(i-n>r-t)t=n,r=i}return[t,r]}var Jm=19968,Nv,Lv,Ym=(e)=>{if(e<Fm||e>jm)return!1;return Lo(Zm,e)},or=(e)=>{if(e<qm||e>Qm)return!1;return Lo(Wm,e)},nr=(e)=>{if(e>=Nv&&e<=Lv)return!0;if(e<Gm||e>Km)return!1;return Lo(ca,e)};var ua=_(()=>{Hm();[Nv,Lv]=Vv(ca)});function Uv(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function ir(e,{ambiguousAsWide:t=!1}={}){if(Uv(e),or(e)||nr(e)||t&&Ym(e))return 2;return 1}var la=_(()=>{ua();ua()});function Wv(e){if(e.length>50)return!1;if(qv.test(e))return!0;if(e.includes("\u200D")){let t=e.match(Qv);return t!==null&&t.length>=2}return!1}function Gv(e){return e.replace(Fv,"")}function Kv(e){return Xm.test(e)}function eh(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function th(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function rh(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function Hv(e){return eh(e)||th(e)||rh(e)}function Jv(e,t){let r=[];for(let n of e){if(Xm.test(n))continue;r.push(n.codePointAt(0))}if(r.length===0)return;let o=0;for(let n=0;n<r.length;n++){let i=r[n];if(!Hv(i)){if(o===0)return;for(let s=n;s<r.length;s++)o+=ir(r[s],t);return o}if(eh(i)&&th(r[n+1])){o+=2,n+=rh(r[n+2])?2:1;continue}o+=ir(i,t)}return o}function Yv(e,t){let r=0,o=!0;for(let n of e){if(o){o=!1;continue}if(jv.test(n)||n>="\uFF00"&&n<="\uFFEF")r+=ir(n.codePointAt(0),t)}return r}function Q(e,t={}){if(typeof e!=="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:o=!1}=t,n=e;if(!o&&(n.includes("\x1B")||n.includes("\x9B")))n=Fe(n);if(n.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(n))return n.length;let i=0,s={ambiguousAsWide:!r};for(let{segment:a}of Mv.segment(n)){if(Kv(a))continue;if(Zv.test(a)||Wv(a)){i+=2;continue}let c=Gv(a),u=Jv(c,s);if(u!==void 0){i+=u;continue}let l=c.codePointAt(0);i+=ir(l,s),i+=Yv(c,s)}return i}var Mv,Xm,Fv,jv,Zv,qv,Qv;var Vo=_(()=>{No();la();Mv=new Intl.Segmenter,Xm=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v,Fv=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v,jv=/\p{Spacing_Mark}/v,Zv=/^\p{RGI_Emoji}$/v,qv=/^[\d#*]\u20E3$/,Qv=/\p{Extended_Pictographic}/gu});function tx(){let e=new Map;for(let[t,r]of Object.entries(M)){for(let[o,n]of Object.entries(r))M[o]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[o]=M[o],e.set(n[0],n[1]);Object.defineProperty(M,t,{value:r,enumerable:!1})}return Object.defineProperty(M,"codes",{value:e,enumerable:!1}),M.color.close="\x1B[39m",M.bgColor.close="\x1B[49m",M.color.ansi=oh(),M.color.ansi256=nh(),M.color.ansi16m=ih(),M.bgColor.ansi=oh(10),M.bgColor.ansi256=nh(10),M.bgColor.ansi16m=ih(10),Object.defineProperties(M,{rgbToAnsi256:{value(t,r,o){if(t===r&&r===o){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[o]=r;if(o.length===3)o=[...o].map((i)=>i+i).join("");let n=Number.parseInt(o,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:(t)=>M.rgbToAnsi256(...M.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,o,n;if(t>=232)r=((t-232)*10+8)/255,o=r,n=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,o=Math.floor(a/6)/5,n=a%6/5}let i=Math.max(r,o,n)*2;if(i===0)return 30;let s=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(r));if(i===2)s+=60;return s},enumerable:!1},rgbToAnsi:{value:(t,r,o)=>M.ansi256ToAnsi(M.rgbToAnsi256(t,r,o)),enumerable:!1},hexToAnsi:{value:(t)=>M.ansi256ToAnsi(M.hexToAnsi256(t)),enumerable:!1}}),M}var oh=(e=0)=>(t)=>`\x1B[${t+e}m`,nh=(e=0)=>(t)=>`\x1B[${38+e};5;${t}m`,ih=(e=0)=>(t,r,o)=>`\x1B[${38+e};2;${t};${r};${o}m`,M,vR,Xv,ex,xR,rx,pe;var pa=_(()=>{M={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},vR=Object.keys(M.modifier),Xv=Object.keys(M.color),ex=Object.keys(M.bgColor),xR=[...Xv,...ex];rx=tx(),pe=rx});function sr(e,t,r){return String(e).normalize().replaceAll(`\r
|
|
69
|
+
`)}d.write("payload.value = newResult;"),d.write("return payload;");let S=d.compile();return(x,A)=>S(p,x,A)},i,s=ut,a=!at.jitless,u=a&&Ac.value,l=t.catchall,f;e._zod.parse=(p,d)=>{f??(f=o.value);let m=p.value;if(!s(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p;if(a&&u&&d?.async===!1&&d.jitless!==!0){if(!i)i=n(t.shape);if(p=i(p,d),!l)return p;return yl([],m,p,d,f,e)}return r(p,d)}});Zr=g("$ZodUnion",(e,t)=>{P.init(e,t),T(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),T(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),T(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),T(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${o.map((n)=>Cr(n.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return wu(s,o,e,n);return Promise.all(s).then((a)=>wu(a,o,e,n))}});_l=g("$ZodXor",(e,t)=>{Zr.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)s.push(c),i=!0;else s.push(c)}if(!i)return vu(s,o,e,n);return Promise.all(s).then((a)=>vu(a,o,e,n))}}),wl=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Zr.init(e,t);let r=e._zod.parse;T(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){if(!n[a])n[a]=new Set;for(let u of c)n[a].add(u)}}return n});let o=Ot(()=>{let n=t.options,i=new Map;for(let s of n){let a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!ut(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let a=o.value.get(s?.[t.discriminator]);if(a)return a._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:s,path:[t.discriminator],inst:e}),n}}),vl=g("$ZodIntersection",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,u])=>xu(r,c,u));return xu(r,i,s)}});$i=g("$ZodTuple",(e,t)=>{P.init(e,t);let r=t.items;e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[],a=Eu(r,"optin"),c=Eu(r,"optout");if(!t.rest){if(i.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:i,inst:e,origin:"array"}),o;if(i.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:e,origin:"array"})}let u=Array(r.length);for(let l=0;l<r.length;l++){let f=r[l]._zod.run({value:i[l],issues:[]},n);if(f instanceof Promise)s.push(f.then((p)=>{u[l]=p}));else u[l]=f}if(t.rest){let l=r.length-1,f=i.slice(r.length);for(let p of f){l++;let d=t.rest._zod.run({value:p,issues:[]},n);if(d instanceof Promise)s.push(d.then((m)=>Su(m,o,l)));else Su(d,o,l)}}if(s.length)return Promise.all(s).then(()=>$u(u,o,r,i,c));return $u(u,o,r,i,c)}});xl=g("$ZodRecord",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Ke(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){r.value={};let a=new Set;for(let u of s)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){a.add(typeof u==="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((d)=>te(d,o,W())),input:u,path:[u],inst:e});continue}let f=l.value,p=t.valueType._zod.run({value:n[u],issues:[]},o);if(p instanceof Promise)i.push(p.then((d)=>{if(d.issues.length)r.issues.push(...ne(u,d.issues));r.value[f]=d.value}));else{if(p.issues.length)r.issues.push(...ne(u,p.issues));r.value[f]=p.value}}let c;for(let u in n)if(!a.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Dr.test(a)&&c.issues.length){let f=t.keyType._zod.run({value:Number(a),issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)c=f}if(c.issues.length){if(t.mode==="loose")r.value[a]=n[a];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((f)=>te(f,o,W())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);if(l instanceof Promise)i.push(l.then((f)=>{if(f.issues.length)r.issues.push(...ne(a,f.issues));r.value[c.value]=f.value}));else{if(l.issues.length)r.issues.push(...ne(a,l.issues));r.value[c.value]=l.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}}),El=g("$ZodMap",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,a]of n){let c=t.keyType._zod.run({value:s,issues:[]},o),u=t.valueType._zod.run({value:a,issues:[]},o);if(c instanceof Promise||u instanceof Promise)i.push(Promise.all([c,u]).then(([l,f])=>{Au(l,f,r,s,n,e,o)}));else Au(c,u,r,s,n,e,o)}if(i.length)return Promise.all(i).then(()=>r);return r}});Sl=g("$ZodSet",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let a=t.valueType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)i.push(a.then((c)=>ku(c,r)));else ku(a,r)}if(i.length)return Promise.all(i).then(()=>r);return r}});$l=g("$ZodEnum",(e,t)=>{P.init(e,t);let r=Pr(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>Rr.has(typeof n)).map((n)=>typeof n==="string"?me(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;if(o.has(s))return n;return n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),Al=g("$ZodLiteral",(e,t)=>{if(P.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?me(o):o?me(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),kl=g("$ZodFile",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(n instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Pl=g("$ZodTransform",(e,t)=>{P.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ct(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((s)=>(r.value=s,r.fallback=!0,r));if(n instanceof Promise)throw new Re;return r.value=n,r.fallback=!0,r}});Ai=g("$ZodOptional",(e,t)=>{P.init(e,t),e._zod.optin="optional",e._zod.optout="optional",T(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),T(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Cr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,i=t.innerType._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Pu(s,n));return Pu(i,n)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Cl=g("$ZodExactOptional",(e,t)=>{Ai.init(e,t),T(e._zod,"values",()=>t.innerType._zod.values),T(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Rl=g("$ZodNullable",(e,t)=>{P.init(e,t),T(e._zod,"optin",()=>t.innerType._zod.optin),T(e._zod,"optout",()=>t.innerType._zod.optout),T(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Cr(r.source)}|null)$`):void 0}),T(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Tl=g("$ZodDefault",(e,t)=>{P.init(e,t),e._zod.optin="optional",T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Cu(i,t));return Cu(n,t)}});Ol=g("$ZodPrefault",(e,t)=>{P.init(e,t),e._zod.optin="optional",T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Il=g("$ZodNonOptional",(e,t)=>{P.init(e,t),T(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Ru(i,e));return Ru(n,e)}});Bl=g("$ZodSuccess",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ct("ZodSuccess");let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>(r.value=i.issues.length===0,r));return r.value=n.issues.length===0,r}}),zl=g("$ZodCatch",(e,t)=>{P.init(e,t),e._zod.optin="optional",T(e._zod,"optout",()=>t.innerType._zod.optout),T(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((s)=>te(s,o,W()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>te(i,o,W()))},input:r.value}),r.issues=[],r.fallback=!0;return r}}),Dl=g("$ZodNaN",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),ki=g("$ZodPipe",(e,t)=>{P.init(e,t),T(e._zod,"values",()=>t.in._zod.values),T(e._zod,"optin",()=>t.in._zod.optin),T(e._zod,"optout",()=>t.out._zod.optout),T(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Vr(s,t.in,o));return Vr(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>Vr(i,t.out,o));return Vr(n,t.out,o)}});qr=g("$ZodCodec",(e,t)=>{P.init(e,t),T(e._zod,"values",()=>t.in._zod.values),T(e._zod,"optin",()=>t.in._zod.optin),T(e._zod,"optout",()=>t.out._zod.optout),T(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Ur(s,t,o));return Ur(i,t,o)}else{let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((s)=>Ur(s,t,o));return Ur(i,t,o)}}});Nl=g("$ZodPreprocess",(e,t)=>{ki.init(e,t)}),Ll=g("$ZodReadonly",(e,t)=>{P.init(e,t),T(e._zod,"propValues",()=>t.innerType._zod.propValues),T(e._zod,"values",()=>t.innerType._zod.values),T(e._zod,"optin",()=>t.innerType?._zod?.optin),T(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Tu);return Tu(n)}});Vl=g("$ZodTemplateLiteral",(e,t)=>{P.init(e,t);let r=[];for(let o of t.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||kc.has(typeof o))r.push(me(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o;return o}}),Ul=g("$ZodFunction",(e,t)=>(P.init(e,t),e._def=t,e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return function(...o){let n=e._def.input?Fn(e._def.input,o):o,i=Reflect.apply(r,this,n);if(e._def.output)return Fn(e._def.output,i);return i}},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let n=e._def.input?await Mn(e._def.input,o):o,i=await Reflect.apply(r,this,n);if(e._def.output)return await Mn(e._def.output,i);return i}},e._zod.parse=(r,o)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let o=e.constructor;if(Array.isArray(r[0]))return new o({type:"function",input:new $i({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new o({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),Fl=g("$ZodPromise",(e,t)=>{P.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then((n)=>t.innerType._zod.run({value:n,issues:[]},o))}),Ml=g("$ZodLazy",(e,t)=>{P.init(e,t),T(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),T(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),T(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),T(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),T(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),jl=g("$ZodCustom",(e,t)=>{N.init(e,t),P.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>Ou(i,r,o,e));Ou(n,r,o,e);return}})});function Ci(){return{localeError:u_()}}var u_=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=Oc(n.input),a=o[s]??s;return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${Nn(n.values[0])}`;return`Invalid option: expected one of ${In(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`;return`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${In(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0)return`Invalid discriminator value. Expected ${n.options.map((s)=>`'${s}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};var Zl=_(()=>{ue()});var Ri=()=>{};class Wl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Gl(){return new Wl}var Ql,l_,p_,Y;var Ft=_(()=>{l_=Symbol("ZodOutput"),p_=Symbol("ZodInput");(Ql=globalThis).__zod_globalRegistry??(Ql.__zod_globalRegistry=Gl());Y=globalThis.__zod_globalRegistry});function Kl(e,t){return new e({type:"string",...w(t)})}function Ti(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function Qr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function Ii(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function Bi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function Wr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function Di(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function Ni(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function Li(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function Vi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function Ui(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function Fi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function Mi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function ji(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function Zi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Hl(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...w(t)})}function qi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function Qi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function Wi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function Gi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function Ki(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function Hi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function Jl(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function Yl(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function Xl(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function ep(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function tp(e,t){return new e({type:"number",checks:[],...w(t)})}function rp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function op(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...w(t)})}function np(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...w(t)})}function ip(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...w(t)})}function sp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...w(t)})}function ap(e,t){return new e({type:"boolean",...w(t)})}function cp(e,t){return new e({type:"bigint",...w(t)})}function up(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...w(t)})}function lp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...w(t)})}function pp(e,t){return new e({type:"symbol",...w(t)})}function dp(e,t){return new e({type:"undefined",...w(t)})}function fp(e,t){return new e({type:"null",...w(t)})}function mp(e){return new e({type:"any"})}function hp(e){return new e({type:"unknown"})}function gp(e,t){return new e({type:"never",...w(t)})}function yp(e,t){return new e({type:"void",...w(t)})}function bp(e,t){return new e({type:"date",...w(t)})}function _p(e,t){return new e({type:"nan",...w(t)})}function De(e,t){return new bi({check:"less_than",...w(t),value:e,inclusive:!1})}function ge(e,t){return new bi({check:"less_than",...w(t),value:e,inclusive:!0})}function Ne(e,t){return new _i({check:"greater_than",...w(t),value:e,inclusive:!1})}function ie(e,t){return new _i({check:"greater_than",...w(t),value:e,inclusive:!0})}function wp(e){return Ne(0,e)}function vp(e){return De(0,e)}function xp(e){return ge(0,e)}function Ep(e){return ie(0,e)}function pt(e,t){return new Xc({check:"multiple_of",...w(t),value:e})}function dt(e,t){return new ru({check:"max_size",...w(t),maximum:e})}function Le(e,t){return new ou({check:"min_size",...w(t),minimum:e})}function Mt(e,t){return new nu({check:"size_equals",...w(t),size:e})}function jt(e,t){return new iu({check:"max_length",...w(t),maximum:e})}function et(e,t){return new su({check:"min_length",...w(t),minimum:e})}function Zt(e,t){return new au({check:"length_equals",...w(t),length:e})}function Gr(e,t){return new cu({check:"string_format",format:"regex",...w(t),pattern:e})}function Kr(e){return new uu({check:"string_format",format:"lowercase",...w(e)})}function Hr(e){return new lu({check:"string_format",format:"uppercase",...w(e)})}function Jr(e,t){return new pu({check:"string_format",format:"includes",...w(t),includes:e})}function Yr(e,t){return new du({check:"string_format",format:"starts_with",...w(t),prefix:e})}function Xr(e,t){return new fu({check:"string_format",format:"ends_with",...w(t),suffix:e})}function Sp(e,t,r){return new mu({check:"property",property:e,schema:t,...w(r)})}function eo(e,t){return new hu({check:"mime_type",mime:e,...w(t)})}function Te(e){return new gu({check:"overwrite",tx:e})}function to(e){return Te((t)=>t.normalize(e))}function ro(){return Te((e)=>e.trim())}function oo(){return Te((e)=>e.toLowerCase())}function no(){return Te((e)=>e.toUpperCase())}function io(){return Te((e)=>$c(e))}function $p(e,t,r){return new e({type:"array",element:t,...w(r)})}function Ap(e,t){return new e({type:"file",...w(t)})}function kp(e,t,r){let o=w(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Pp(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}function Cp(e,t){let r=f_((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(Je(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(Je(i))}},e(o.value,o)),t);return r}function f_(e,t){let r=new N({check:"custom",...w(t)});return r._zod.check=e,r}function Rp(e){let t=new N({check:"describe"});return t._zod.onattach=[(r)=>{let o=Y.get(r)??{};Y.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Tp(e){let t=new N({check:"meta"});return t._zod.onattach=[(r)=>{let o=Y.get(r)??{};Y.add(r,{...o,...e})}],t._zod.check=()=>{},t}function Op(e,t){let r=w(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((d)=>typeof d==="string"?d.toLowerCase():d),n=n.map((d)=>typeof d==="string"?d.toLowerCase():d);let i=new Set(o),s=new Set(n),a=e.Codec??qr,c=e.Boolean??jr,l=new(e.String??lt)({type:"string",error:r.error}),f=new c({type:"boolean",error:r.error}),p=new a({type:"pipe",in:l,out:f,transform:(d,m)=>{let h=d;if(r.case!=="sensitive")h=h.toLowerCase();if(i.has(h))return!0;else if(s.has(h))return!1;else return m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:m.value,inst:p,continue:!1}),{}},reverseTransform:(d,m)=>{if(d===!0)return o[0]||"true";else return n[0]||"false"},error:r.error});return p}function qt(e,t,r,o={}){let n=w(o),i={...w(o),check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(a)=>r.test(a),...n};if(r instanceof RegExp)i.pattern=r;return new e(i)}var Ip=_(()=>{Lr();Ft();Pi();ue()});function Ji(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function U(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let p=s.schema,d=t.processors[n.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);d(e,t,p,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;U(f,t,l),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(s.schema,c);if(t.io==="input"&&X(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(o=s.schema).default??(o.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Yi(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=o.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,s[0])}}let n=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,p=e.external.uri??((m)=>m);if(f)return{ref:p(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${p("__shared")}#/${a}/${d}`}}if(s[1]===r)return{ref:"#"};let u=`${"#"}/${a}/`,l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=n(s);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
70
|
+
|
|
71
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref"){i(s);continue}}}}function Xi(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){o(f);let d=e.seen.get(f),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(m);else Object.assign(u,m);if(Object.assign(u,l),a._zod.parent===f)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(!(y in l))delete u[y]}if(m.$ref&&d.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in d.def&&JSON.stringify(u[y])===JSON.stringify(d.def[y]))delete u[y]}}let p=a._zod.parent;if(p&&p!==f){o(p);let d=e.seen.get(p);if(d?.schema.$ref){if(u.$ref=d.schema.$ref,d.def)for(let m in u){if(m==="$ref"||m==="allOf")continue;if(m in d.def&&JSON.stringify(u[m])===JSON.stringify(d.def[m]))delete u[m]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let s=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;s[c.defId]=c.def}}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Qt(t,"input",e.processors),output:Qt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function X(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return X(o.element,r);if(o.type==="set")return X(o.valueType,r);if(o.type==="lazy")return X(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return X(o.innerType,r);if(o.type==="intersection")return X(o.left,r)||X(o.right,r);if(o.type==="record"||o.type==="map")return X(o.keyType,r)||X(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return X(o.in,r)||X(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(X(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(X(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(X(n,r))return!0;if(o.rest&&X(o.rest,r))return!0;return!1}return!1}var Bp=(e,t={})=>(r)=>{let o=Ji({...r,processors:t});return U(e,o),Yi(o,e),Xi(o,e)},Qt=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},s=Ji({...n??{},target:i,io:t,processors:r});return U(e,s),Yi(s,e),Xi(s,e)};var so=_(()=>{Ft()});var m_,zp=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof s==="number")n.maxLength=s;if(a){if(n.format=m_[a]??a,n.format==="")delete n.format;if(a==="time")delete n.format}if(u)n.contentEncoding=u;if(c&&c.size>0){let l=[...c];if(l.length===1)n.pattern=l[0].source;else if(l.length>1)n.allOf=[...l.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},Dp=(e,t,r,o)=>{let n=r,{minimum:i,maximum:s,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))n.type="integer";else n.type="number";let f=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),p=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)n.minimum=l,n.exclusiveMinimum=!0;else n.exclusiveMinimum=l;else if(typeof i==="number")n.minimum=i;if(p)if(d)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof s==="number")n.maximum=s;if(typeof c==="number")n.multipleOf=c},Np=(e,t,r,o)=>{r.type="boolean"},Lp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Vp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Up=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Fp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Mp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},jp=(e,t,r,o)=>{r.not={}},Zp=(e,t,r,o)=>{},qp=(e,t,r,o)=>{},Qp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Wp=(e,t,r,o)=>{let n=e._zod.def,i=Pr(n.entries);if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},Gp=(e,t,r,o)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(s));else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},Kp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Hp=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Jp=(e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:c}=e._zod.bag;if(s!==void 0)i.minLength=s;if(a!==void 0)i.maxLength=a;if(c)if(c.length===1)i.contentMediaType=c[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=c.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},Yp=(e,t,r,o)=>{r.type="boolean"},Xp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},ed=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},td=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},rd=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},od=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},nd=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;if(typeof s==="number")n.minItems=s;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=U(i.element,t,{...o,path:[...o.path,"items"]})},id=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let u in s)n.properties[u]=U(s[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(s)),c=new Set([...a].filter((u)=>{let l=i.shape[u]._zod;if(t.io==="input")return l.optin===void 0;else return l.optout===void 0}));if(c.size>0)n.required=Array.from(c);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=U(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},es=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((a,c)=>U(a,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));if(i)r.oneOf=s;else r.anyOf=s},sd=(e,t,r,o)=>{let n=e._zod.def,i=U(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=U(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c},ad=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,d)=>U(p,t,{...o,path:[...o.path,s,d]})),u=i.rest?U(i.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=c,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:c},u)n.items.anyOf.push(u);if(n.minItems=c.length,!u)n.maxItems=c.length}else if(n.items=c,u)n.additionalItems=u;let{minimum:l,maximum:f}=e._zod.bag;if(typeof l==="number")n.minItems=l;if(typeof f==="number")n.maxItems=f},cd=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let s=i.keyType,c=s._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=U(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let f of c)n.patternProperties[f.source]=l}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=U(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=U(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=s._zod.values;if(u){let l=[...u].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)n.required=l}},ud=(e,t,r,o)=>{let n=e._zod.def,i=U(n.innerType,t,o),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},ld=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},pd=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},dd=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},fd=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},md=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?n.out:n.in:n.out;U(s,t,o);let a=t.seen.get(e);a.ref=s},hd=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},gd=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},ts=(e,t,r,o)=>{let n=e._zod.def;U(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},yd=(e,t,r,o)=>{let n=e._zod.innerType;U(n,t,o);let i=t.seen.get(e);i.ref=n};var bd=_(()=>{so();ue();m_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""}});var _d=()=>{};var ye=_(()=>{ue();Nr();Ri();_d();Qe();jn();Un();Pi();Lr();vi();Ft();Ip();so()});var ao={};vr(ao,{endsWith:()=>Xr,gt:()=>Ne,gte:()=>ie,includes:()=>Jr,length:()=>Zt,lowercase:()=>Kr,lt:()=>De,lte:()=>ge,maxLength:()=>jt,maxSize:()=>dt,mime:()=>eo,minLength:()=>et,minSize:()=>Le,multipleOf:()=>pt,negative:()=>vp,nonnegative:()=>Ep,nonpositive:()=>xp,normalize:()=>to,overwrite:()=>Te,positive:()=>wp,property:()=>Sp,regex:()=>Gr,size:()=>Mt,slugify:()=>io,startsWith:()=>Yr,toLowerCase:()=>oo,toUpperCase:()=>no,trim:()=>ro,uppercase:()=>Hr});var co=_(()=>{ye()});var Gt={};vr(Gt,{ZodISODate:()=>vd,ZodISODateTime:()=>wd,ZodISODuration:()=>Ed,ZodISOTime:()=>xd,date:()=>os,datetime:()=>rs,duration:()=>is,time:()=>ns});function rs(e){return Jl(wd,e)}function os(e){return Yl(vd,e)}function ns(e){return Xl(xd,e)}function is(e){return ep(Ed,e)}var wd,vd,xd,Ed;var uo=_(()=>{ye();po();wd=g("ZodISODateTime",(e,t)=>{Zu.init(e,t),z.init(e,t)});vd=g("ZodISODate",(e,t)=>{qu.init(e,t),z.init(e,t)});xd=g("ZodISOTime",(e,t)=>{Qu.init(e,t),z.init(e,t)});Ed=g("ZodISODuration",(e,t)=>{Wu.init(e,t),z.init(e,t)})});var Sd=(e,t)=>{Ir.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Vn(e,r)},flatten:{value:(r)=>Ln(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Tt,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Tt,2)}},isEmpty:{get(){return e.issues.length===0}}})},$d,se;var ss=_(()=>{ye();ye();ue();$d=g("ZodError",Sd),se=g("ZodError",Sd,{Parent:Error})});var Ad,kd,Pd,Cd,Rd,Td,Od,Id,Bd,zd,Dd,Nd;var as=_(()=>{ye();ss();Ad=Bt(se),kd=zt(se),Pd=Dt(se),Cd=Nt(se),Rd=Nc(se),Td=Lc(se),Od=Vc(se),Id=Uc(se),Bd=Fc(se),zd=Mc(se),Dd=jc(se),Nd=Zc(se)});var lo={};vr(lo,{ZodAny:()=>Qd,ZodArray:()=>Jd,ZodBase64:()=>Ss,ZodBase64URL:()=>$s,ZodBigInt:()=>Rs,ZodBigIntFormat:()=>Ts,ZodBoolean:()=>Cs,ZodCIDRv4:()=>xs,ZodCIDRv6:()=>Es,ZodCUID:()=>hs,ZodCUID2:()=>gs,ZodCatch:()=>wf,ZodCodec:()=>xo,ZodCustom:()=>Eo,ZodCustomStringFormat:()=>Yt,ZodDate:()=>Hd,ZodDefault:()=>mf,ZodDiscriminatedUnion:()=>Xd,ZodE164:()=>As,ZodEmail:()=>ds,ZodEmoji:()=>fs,ZodEnum:()=>Ht,ZodExactOptional:()=>pf,ZodFile:()=>uf,ZodFunction:()=>Rf,ZodGUID:()=>mo,ZodIPv4:()=>ws,ZodIPv6:()=>vs,ZodIntersection:()=>ef,ZodJWT:()=>ks,ZodKSUID:()=>_s,ZodLazy:()=>kf,ZodLiteral:()=>cf,ZodMAC:()=>Vd,ZodMap:()=>sf,ZodNaN:()=>xf,ZodNanoID:()=>ms,ZodNever:()=>Gd,ZodNonOptional:()=>Ns,ZodNull:()=>Zd,ZodNullable:()=>ff,ZodNumber:()=>Ps,ZodNumberFormat:()=>mt,ZodObject:()=>_o,ZodOptional:()=>Ds,ZodPipe:()=>vo,ZodPrefault:()=>gf,ZodPreprocess:()=>Ef,ZodPromise:()=>Cf,ZodReadonly:()=>Sf,ZodRecord:()=>Kt,ZodSet:()=>af,ZodString:()=>ps,ZodStringFormat:()=>z,ZodSuccess:()=>_f,ZodSymbol:()=>Md,ZodTemplateLiteral:()=>Af,ZodTransform:()=>lf,ZodTuple:()=>rf,ZodType:()=>C,ZodULID:()=>ys,ZodURL:()=>yo,ZodUUID:()=>Oe,ZodUndefined:()=>jd,ZodUnion:()=>wo,ZodUnknown:()=>Wd,ZodVoid:()=>Kd,ZodXID:()=>bs,ZodXor:()=>Yd,_ZodString:()=>ls,_default:()=>hf,_function:()=>Ew,any:()=>ew,array:()=>bo,base64:()=>N_,base64url:()=>L_,bigint:()=>K_,boolean:()=>Fd,catch:()=>vf,check:()=>Sw,cidrv4:()=>z_,cidrv6:()=>D_,codec:()=>_w,cuid:()=>k_,cuid2:()=>P_,custom:()=>$w,date:()=>rw,describe:()=>Aw,discriminatedUnion:()=>cw,e164:()=>V_,email:()=>y_,emoji:()=>$_,enum:()=>Bs,exactOptional:()=>df,file:()=>hw,float32:()=>q_,float64:()=>Q_,function:()=>Ew,guid:()=>b_,hash:()=>Z_,hex:()=>j_,hostname:()=>M_,httpUrl:()=>S_,instanceof:()=>Pw,int:()=>cs,int32:()=>W_,int64:()=>H_,intersection:()=>tf,invertCodec:()=>ww,ipv4:()=>O_,ipv6:()=>B_,json:()=>Rw,jwt:()=>U_,keyof:()=>ow,ksuid:()=>T_,lazy:()=>Pf,literal:()=>mw,looseObject:()=>sw,looseRecord:()=>lw,mac:()=>I_,map:()=>pw,meta:()=>kw,nan:()=>bw,nanoid:()=>A_,nativeEnum:()=>fw,never:()=>Os,nonoptional:()=>bf,null:()=>qd,nullable:()=>go,nullish:()=>gw,number:()=>Ud,object:()=>nw,optional:()=>ho,partialRecord:()=>uw,pipe:()=>us,prefault:()=>yf,preprocess:()=>Tw,promise:()=>xw,readonly:()=>$f,record:()=>nf,refine:()=>Tf,set:()=>dw,strictObject:()=>iw,string:()=>fo,stringFormat:()=>F_,stringbool:()=>Cw,success:()=>yw,superRefine:()=>Of,symbol:()=>Y_,templateLiteral:()=>vw,transform:()=>zs,tuple:()=>of,uint32:()=>G_,uint64:()=>J_,ulid:()=>C_,undefined:()=>X_,union:()=>Is,unknown:()=>ft,url:()=>E_,uuid:()=>__,uuidv4:()=>w_,uuidv6:()=>v_,uuidv7:()=>x_,void:()=>tw,xid:()=>R_,xor:()=>aw});function Jt(e,t,r){let o=Object.getPrototypeOf(e),n=Ld.get(o);if(!n)n=new Set,Ld.set(o,n);if(n.has(t))return;n.add(t);for(let i in r){let s=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}function fo(e){return Kl(ps,e)}function y_(e){return Ti(ds,e)}function b_(e){return Qr(mo,e)}function __(e){return Oi(Oe,e)}function w_(e){return Ii(Oe,e)}function v_(e){return Bi(Oe,e)}function x_(e){return zi(Oe,e)}function E_(e){return Wr(yo,e)}function S_(e){return Wr(yo,{protocol:zr,hostname:Wc,...w(e)})}function $_(e){return Di(fs,e)}function A_(e){return Ni(ms,e)}function k_(e){return Li(hs,e)}function P_(e){return Vi(gs,e)}function C_(e){return Ui(ys,e)}function R_(e){return Fi(bs,e)}function T_(e){return Mi(_s,e)}function O_(e){return ji(ws,e)}function I_(e){return Hl(Vd,e)}function B_(e){return Zi(vs,e)}function z_(e){return qi(xs,e)}function D_(e){return Qi(Es,e)}function N_(e){return Wi(Ss,e)}function L_(e){return Gi($s,e)}function V_(e){return Ki(As,e)}function U_(e){return Hi(ks,e)}function F_(e,t,r={}){return qt(Yt,e,t,r)}function M_(e){return qt(Yt,"hostname",Qc,e)}function j_(e){return qt(Yt,"hex",Hc,e)}function Z_(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=Xe[o];if(!n)throw Error(`Unrecognized hash format: ${o}`);return qt(Yt,o,n,t)}function Ud(e){return tp(Ps,e)}function cs(e){return rp(mt,e)}function q_(e){return op(mt,e)}function Q_(e){return np(mt,e)}function W_(e){return ip(mt,e)}function G_(e){return sp(mt,e)}function Fd(e){return ap(Cs,e)}function K_(e){return cp(Rs,e)}function H_(e){return up(Ts,e)}function J_(e){return lp(Ts,e)}function Y_(e){return pp(Md,e)}function X_(e){return dp(jd,e)}function qd(e){return fp(Zd,e)}function ew(){return mp(Qd)}function ft(){return hp(Wd)}function Os(e){return gp(Gd,e)}function tw(e){return yp(Kd,e)}function rw(e){return bp(Hd,e)}function bo(e,t){return $p(Jd,e,t)}function ow(e){let t=e._zod.def.shape;return Bs(Object.keys(t))}function nw(e,t){let r={type:"object",shape:e??{},...w(t)};return new _o(r)}function iw(e,t){return new _o({type:"object",shape:e,catchall:Os(),...w(t)})}function sw(e,t){return new _o({type:"object",shape:e,catchall:ft(),...w(t)})}function Is(e,t){return new wo({type:"union",options:e,...w(t)})}function aw(e,t){return new Yd({type:"union",options:e,inclusive:!1,...w(t)})}function cw(e,t,r){return new Xd({type:"union",options:t,discriminator:e,...w(r)})}function tf(e,t){return new ef({type:"intersection",left:e,right:t})}function of(e,t,r){let o=t instanceof P,n=o?r:t;return new rf({type:"tuple",items:e,rest:o?t:null,...w(n)})}function nf(e,t,r){if(!t||!t._zod)return new Kt({type:"record",keyType:fo(),valueType:e,...w(t)});return new Kt({type:"record",keyType:e,valueType:t,...w(r)})}function uw(e,t,r){let o=ce(e);return o._zod.values=void 0,new Kt({type:"record",keyType:o,valueType:t,...w(r)})}function lw(e,t,r){return new Kt({type:"record",keyType:e,valueType:t,mode:"loose",...w(r)})}function pw(e,t,r){return new sf({type:"map",keyType:e,valueType:t,...w(r)})}function dw(e,t){return new af({type:"set",valueType:e,...w(t)})}function Bs(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Ht({type:"enum",entries:r,...w(t)})}function fw(e,t){return new Ht({type:"enum",entries:e,...w(t)})}function mw(e,t){return new cf({type:"literal",values:Array.isArray(e)?e:[e],...w(t)})}function hw(e){return Ap(uf,e)}function zs(e){return new lf({type:"transform",transform:e})}function ho(e){return new Ds({type:"optional",innerType:e})}function df(e){return new pf({type:"optional",innerType:e})}function go(e){return new ff({type:"nullable",innerType:e})}function gw(e){return ho(go(e))}function hf(e,t){return new mf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Dn(t)}})}function yf(e,t){return new gf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Dn(t)}})}function bf(e,t){return new Ns({type:"nonoptional",innerType:e,...w(t)})}function yw(e){return new _f({type:"success",innerType:e})}function vf(e,t){return new wf({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}function bw(e){return _p(xf,e)}function us(e,t){return new vo({type:"pipe",in:e,out:t})}function _w(e,t,r){return new xo({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function ww(e){let t=e._zod.def;return new xo({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function $f(e){return new Sf({type:"readonly",innerType:e})}function vw(e,t){return new Af({type:"template_literal",parts:e,...w(t)})}function Pf(e){return new kf({type:"lazy",getter:e})}function xw(e){return new Cf({type:"promise",innerType:e})}function Ew(e){return new Rf({type:"function",input:Array.isArray(e?.input)?of(e?.input):e?.input??bo(ft()),output:e?.output??ft()})}function Sw(e){let t=new N({check:"custom"});return t._zod.check=e,t}function $w(e,t){return kp(Eo,e??(()=>!0),t)}function Tf(e,t={}){return Pp(Eo,e,t)}function Of(e,t){return Cp(e,t)}function Pw(e,t={}){let r=new Eo({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...w(t)});return r._zod.bag.Class=e,r._zod.check=(o)=>{if(!(o.value instanceof e))o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}function Rw(e){let t=Pf(()=>Is([fo(e),Ud(),Fd(),qd(),bo(t),nf(fo(),t)]));return t}function Tw(e,t){return new Ef({type:"pipe",in:zs(e),out:t})}var Ld,C,ls,ps,z,ds,mo,Oe,yo,fs,ms,hs,gs,ys,bs,_s,ws,Vd,vs,xs,Es,Ss,$s,As,ks,Yt,Ps,mt,Cs,Rs,Ts,Md,jd,Zd,Qd,Wd,Gd,Kd,Hd,Jd,_o,wo,Yd,Xd,ef,rf,Kt,sf,af,Ht,cf,uf,lf,Ds,pf,ff,mf,gf,Ns,_f,wf,xf,vo,xo,Ef,Sf,Af,kf,Cf,Rf,Eo,Aw,kw,Cw=(...e)=>Op({Codec:xo,Boolean:Cs,String:ps},...e);var po=_(()=>{ye();ye();bd();so();co();uo();as();Ld=new WeakMap;C=g("ZodType",(e,t)=>(P.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Qt(e,"input"),output:Qt(e,"output")}}),e.toJSONSchema=Bp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Ad(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Pd(e,r,o),e.parseAsync=async(r,o)=>kd(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Cd(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Rd(e,r,o),e.decode=(r,o)=>Td(e,r,o),e.encodeAsync=async(r,o)=>Od(e,r,o),e.decodeAsync=async(r,o)=>Id(e,r,o),e.safeEncode=(r,o)=>Bd(e,r,o),e.safeDecode=(r,o)=>zd(e,r,o),e.safeEncodeAsync=async(r,o)=>Dd(e,r,o),e.safeDecodeAsync=async(r,o)=>Nd(e,r,o),Jt(e,"ZodType",{check(...r){let o=this.def;return this.clone(ze(o,{checks:[...o.checks??[],...r.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return ce(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(Tf(r,o))},superRefine(r,o){return this.check(Of(r,o))},overwrite(r){return this.check(Te(r))},optional(){return ho(this)},exactOptional(){return df(this)},nullable(){return go(this)},nullish(){return ho(go(this))},nonoptional(r){return bf(this,r)},array(){return bo(this)},or(r){return Is([this,r])},and(r){return tf(this,r)},transform(r){return us(this,zs(r))},default(r){return hf(this,r)},prefault(r){return yf(this,r)},catch(r){return vf(this,r)},pipe(r){return us(this,r)},readonly(){return $f(this)},describe(r){let o=this.clone();return Y.add(o,{description:r}),o},meta(...r){if(r.length===0)return Y.get(this);let o=this.clone();return Y.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Y.get(e)?.description},configurable:!0}),e)),ls=g("_ZodString",(e,t)=>{lt.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>zp(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Jt(e,"_ZodString",{regex(...o){return this.check(Gr(...o))},includes(...o){return this.check(Jr(...o))},startsWith(...o){return this.check(Yr(...o))},endsWith(...o){return this.check(Xr(...o))},min(...o){return this.check(et(...o))},max(...o){return this.check(jt(...o))},length(...o){return this.check(Zt(...o))},nonempty(...o){return this.check(et(1,...o))},lowercase(o){return this.check(Kr(o))},uppercase(o){return this.check(Hr(o))},trim(){return this.check(ro())},normalize(...o){return this.check(to(...o))},toLowerCase(){return this.check(oo())},toUpperCase(){return this.check(no())},slugify(){return this.check(io())}})}),ps=g("ZodString",(e,t)=>{lt.init(e,t),ls.init(e,t),e.email=(r)=>e.check(Ti(ds,r)),e.url=(r)=>e.check(Wr(yo,r)),e.jwt=(r)=>e.check(Hi(ks,r)),e.emoji=(r)=>e.check(Di(fs,r)),e.guid=(r)=>e.check(Qr(mo,r)),e.uuid=(r)=>e.check(Oi(Oe,r)),e.uuidv4=(r)=>e.check(Ii(Oe,r)),e.uuidv6=(r)=>e.check(Bi(Oe,r)),e.uuidv7=(r)=>e.check(zi(Oe,r)),e.nanoid=(r)=>e.check(Ni(ms,r)),e.guid=(r)=>e.check(Qr(mo,r)),e.cuid=(r)=>e.check(Li(hs,r)),e.cuid2=(r)=>e.check(Vi(gs,r)),e.ulid=(r)=>e.check(Ui(ys,r)),e.base64=(r)=>e.check(Wi(Ss,r)),e.base64url=(r)=>e.check(Gi($s,r)),e.xid=(r)=>e.check(Fi(bs,r)),e.ksuid=(r)=>e.check(Mi(_s,r)),e.ipv4=(r)=>e.check(ji(ws,r)),e.ipv6=(r)=>e.check(Zi(vs,r)),e.cidrv4=(r)=>e.check(qi(xs,r)),e.cidrv6=(r)=>e.check(Qi(Es,r)),e.e164=(r)=>e.check(Ki(As,r)),e.datetime=(r)=>e.check(rs(r)),e.date=(r)=>e.check(os(r)),e.time=(r)=>e.check(ns(r)),e.duration=(r)=>e.check(is(r))});z=g("ZodStringFormat",(e,t)=>{B.init(e,t),ls.init(e,t)}),ds=g("ZodEmail",(e,t)=>{zu.init(e,t),z.init(e,t)});mo=g("ZodGUID",(e,t)=>{Iu.init(e,t),z.init(e,t)});Oe=g("ZodUUID",(e,t)=>{Bu.init(e,t),z.init(e,t)});yo=g("ZodURL",(e,t)=>{Du.init(e,t),z.init(e,t)});fs=g("ZodEmoji",(e,t)=>{Nu.init(e,t),z.init(e,t)});ms=g("ZodNanoID",(e,t)=>{Lu.init(e,t),z.init(e,t)});hs=g("ZodCUID",(e,t)=>{Vu.init(e,t),z.init(e,t)});gs=g("ZodCUID2",(e,t)=>{Uu.init(e,t),z.init(e,t)});ys=g("ZodULID",(e,t)=>{Fu.init(e,t),z.init(e,t)});bs=g("ZodXID",(e,t)=>{Mu.init(e,t),z.init(e,t)});_s=g("ZodKSUID",(e,t)=>{ju.init(e,t),z.init(e,t)});ws=g("ZodIPv4",(e,t)=>{Gu.init(e,t),z.init(e,t)});Vd=g("ZodMAC",(e,t)=>{Hu.init(e,t),z.init(e,t)});vs=g("ZodIPv6",(e,t)=>{Ku.init(e,t),z.init(e,t)});xs=g("ZodCIDRv4",(e,t)=>{Ju.init(e,t),z.init(e,t)});Es=g("ZodCIDRv6",(e,t)=>{Yu.init(e,t),z.init(e,t)});Ss=g("ZodBase64",(e,t)=>{el.init(e,t),z.init(e,t)});$s=g("ZodBase64URL",(e,t)=>{tl.init(e,t),z.init(e,t)});As=g("ZodE164",(e,t)=>{rl.init(e,t),z.init(e,t)});ks=g("ZodJWT",(e,t)=>{ol.init(e,t),z.init(e,t)});Yt=g("ZodCustomStringFormat",(e,t)=>{nl.init(e,t),z.init(e,t)});Ps=g("ZodNumber",(e,t)=>{Ei.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Dp(e,o,n,i),Jt(e,"ZodNumber",{gt(o,n){return this.check(Ne(o,n))},gte(o,n){return this.check(ie(o,n))},min(o,n){return this.check(ie(o,n))},lt(o,n){return this.check(De(o,n))},lte(o,n){return this.check(ge(o,n))},max(o,n){return this.check(ge(o,n))},int(o){return this.check(cs(o))},safe(o){return this.check(cs(o))},positive(o){return this.check(Ne(0,o))},nonnegative(o){return this.check(ie(0,o))},negative(o){return this.check(De(0,o))},nonpositive(o){return this.check(ge(0,o))},multipleOf(o,n){return this.check(pt(o,n))},step(o,n){return this.check(pt(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});mt=g("ZodNumberFormat",(e,t)=>{il.init(e,t),Ps.init(e,t)});Cs=g("ZodBoolean",(e,t)=>{jr.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Np(e,r,o,n)});Rs=g("ZodBigInt",(e,t)=>{Si.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Lp(e,o,n,i),e.gte=(o,n)=>e.check(ie(o,n)),e.min=(o,n)=>e.check(ie(o,n)),e.gt=(o,n)=>e.check(Ne(o,n)),e.gte=(o,n)=>e.check(ie(o,n)),e.min=(o,n)=>e.check(ie(o,n)),e.lt=(o,n)=>e.check(De(o,n)),e.lte=(o,n)=>e.check(ge(o,n)),e.max=(o,n)=>e.check(ge(o,n)),e.positive=(o)=>e.check(Ne(BigInt(0),o)),e.negative=(o)=>e.check(De(BigInt(0),o)),e.nonpositive=(o)=>e.check(ge(BigInt(0),o)),e.nonnegative=(o)=>e.check(ie(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(pt(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});Ts=g("ZodBigIntFormat",(e,t)=>{sl.init(e,t),Rs.init(e,t)});Md=g("ZodSymbol",(e,t)=>{al.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vp(e,r,o,n)});jd=g("ZodUndefined",(e,t)=>{cl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fp(e,r,o,n)});Zd=g("ZodNull",(e,t)=>{ul.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Up(e,r,o,n)});Qd=g("ZodAny",(e,t)=>{ll.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zp(e,r,o,n)});Wd=g("ZodUnknown",(e,t)=>{pl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qp(e,r,o,n)});Gd=g("ZodNever",(e,t)=>{dl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jp(e,r,o,n)});Kd=g("ZodVoid",(e,t)=>{fl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mp(e,r,o,n)});Hd=g("ZodDate",(e,t)=>{ml.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Qp(e,o,n,i),e.min=(o,n)=>e.check(ie(o,n)),e.max=(o,n)=>e.check(ge(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});Jd=g("ZodArray",(e,t)=>{hl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nd(e,r,o,n),e.element=t.element,Jt(e,"ZodArray",{min(r,o){return this.check(et(r,o))},nonempty(r){return this.check(et(1,r))},max(r,o){return this.check(jt(r,o))},length(r,o){return this.check(Zt(r,o))},unwrap(){return this.element}})});_o=g("ZodObject",(e,t)=>{bl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>id(e,r,o,n),T(e,"shape",()=>t.shape),Jt(e,"ZodObject",{keyof(){return Bs(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:ft()})},loose(){return this.clone({...this._zod.def,catchall:ft()})},strict(){return this.clone({...this._zod.def,catchall:Os()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Pb(this,r)},safeExtend(r){return Cb(this,r)},merge(r){return Rb(this,r)},pick(r){return Ab(this,r)},omit(r){return kb(this,r)},partial(...r){return Tb(Ds,this,r[0])},required(...r){return Ob(Ns,this,r[0])}})});wo=g("ZodUnion",(e,t)=>{Zr.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>es(e,r,o,n),e.options=t.options});Yd=g("ZodXor",(e,t)=>{wo.init(e,t),_l.init(e,t),e._zod.processJSONSchema=(r,o,n)=>es(e,r,o,n),e.options=t.options});Xd=g("ZodDiscriminatedUnion",(e,t)=>{wo.init(e,t),wl.init(e,t)});ef=g("ZodIntersection",(e,t)=>{vl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sd(e,r,o,n)});rf=g("ZodTuple",(e,t)=>{$i.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ad(e,r,o,n),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});Kt=g("ZodRecord",(e,t)=>{xl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cd(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});sf=g("ZodMap",(e,t)=>{El.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rd(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Le(...r)),e.nonempty=(r)=>e.check(Le(1,r)),e.max=(...r)=>e.check(dt(...r)),e.size=(...r)=>e.check(Mt(...r))});af=g("ZodSet",(e,t)=>{Sl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>od(e,r,o,n),e.min=(...r)=>e.check(Le(...r)),e.nonempty=(r)=>e.check(Le(1,r)),e.max=(...r)=>e.check(dt(...r)),e.size=(...r)=>e.check(Mt(...r))});Ht=g("ZodEnum",(e,t)=>{$l.init(e,t),C.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Wp(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...w(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...w(n),entries:i})}});cf=g("ZodLiteral",(e,t)=>{Al.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gp(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});uf=g("ZodFile",(e,t)=>{kl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jp(e,r,o,n),e.min=(r,o)=>e.check(Le(r,o)),e.max=(r,o)=>e.check(dt(r,o)),e.mime=(r,o)=>e.check(eo(Array.isArray(r)?r:[r],o))});lf=g("ZodTransform",(e,t)=>{Pl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>td(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new ct(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(Je(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Je(s))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r.fallback=!0,r));return r.value=n,r.fallback=!0,r}});Ds=g("ZodOptional",(e,t)=>{Ai.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ts(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});pf=g("ZodExactOptional",(e,t)=>{Cl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ts(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});ff=g("ZodNullable",(e,t)=>{Rl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ud(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});mf=g("ZodDefault",(e,t)=>{Tl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});gf=g("ZodPrefault",(e,t)=>{Ol.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});Ns=g("ZodNonOptional",(e,t)=>{Il.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ld(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});_f=g("ZodSuccess",(e,t)=>{Bl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});wf=g("ZodCatch",(e,t)=>{zl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});xf=g("ZodNaN",(e,t)=>{Dl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kp(e,r,o,n)});vo=g("ZodPipe",(e,t)=>{ki.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>md(e,r,o,n),e.in=t.in,e.out=t.out});xo=g("ZodCodec",(e,t)=>{vo.init(e,t),qr.init(e,t)});Ef=g("ZodPreprocess",(e,t)=>{vo.init(e,t),Nl.init(e,t)}),Sf=g("ZodReadonly",(e,t)=>{Ll.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});Af=g("ZodTemplateLiteral",(e,t)=>{Vl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hp(e,r,o,n)});kf=g("ZodLazy",(e,t)=>{Ml.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yd(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});Cf=g("ZodPromise",(e,t)=>{Fl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gd(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});Rf=g("ZodFunction",(e,t)=>{Ul.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ed(e,r,o,n)});Eo=g("ZodCustom",(e,t)=>{jl.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xp(e,r,o,n)});Aw=Rp,kw=Tp});var If;var Bf=_(()=>{(function(e){})(If||(If={}))});function Iw(e,t){let r=e.$schema;if(r==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(r==="http://json-schema.org/draft-07/schema#")return"draft-7";if(r==="http://json-schema.org/draft-04/schema#")return"draft-4";return t??"draft-2020-12"}function Bw(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}function zf(e,t){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return v.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return v.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=Bw(n,t),s=K(i,t);return t.refs.set(n,s),t.processing.delete(n),s}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return v.null();if(n.length===0)return v.never();if(n.length===1)return v.literal(n[0]);if(n.every((s)=>typeof s==="string"))return v.enum(n);let i=n.map((s)=>v.literal(s));if(i.length<2)return i[0];return v.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return v.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map((i)=>{let s={...e,type:i};return zf(s,t)});if(n.length===0)return v.never();if(n.length===1)return n[0];return v.union(n)}if(!r)return v.any();let o;switch(r){case"string":{let n=v.string();if(e.format){let i=e.format;if(i==="email")n=n.check(v.email());else if(i==="uri"||i==="uri-reference")n=n.check(v.url());else if(i==="uuid"||i==="guid")n=n.check(v.uuid());else if(i==="date-time")n=n.check(v.iso.datetime());else if(i==="date")n=n.check(v.iso.date());else if(i==="time")n=n.check(v.iso.time());else if(i==="duration")n=n.check(v.iso.duration());else if(i==="ipv4")n=n.check(v.ipv4());else if(i==="ipv6")n=n.check(v.ipv6());else if(i==="mac")n=n.check(v.mac());else if(i==="cidr")n=n.check(v.cidrv4());else if(i==="cidr-v6")n=n.check(v.cidrv6());else if(i==="base64")n=n.check(v.base64());else if(i==="base64url")n=n.check(v.base64url());else if(i==="e164")n=n.check(v.e164());else if(i==="jwt")n=n.check(v.jwt());else if(i==="emoji")n=n.check(v.emoji());else if(i==="nanoid")n=n.check(v.nanoid());else if(i==="cuid")n=n.check(v.cuid());else if(i==="cuid2")n=n.check(v.cuid2());else if(i==="ulid")n=n.check(v.ulid());else if(i==="xid")n=n.check(v.xid());else if(i==="ksuid")n=n.check(v.ksuid())}if(typeof e.minLength==="number")n=n.min(e.minLength);if(typeof e.maxLength==="number")n=n.max(e.maxLength);if(e.pattern)n=n.regex(new RegExp(e.pattern));o=n;break}case"number":case"integer":{let n=r==="integer"?v.number().int():v.number();if(typeof e.minimum==="number")n=n.min(e.minimum);if(typeof e.maximum==="number")n=n.max(e.maximum);if(typeof e.exclusiveMinimum==="number")n=n.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")n=n.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")n=n.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")n=n.lt(e.maximum);if(typeof e.multipleOf==="number")n=n.multipleOf(e.multipleOf);o=n;break}case"boolean":{o=v.boolean();break}case"null":{o=v.null();break}case"object":{let n={},i=e.properties||{},s=new Set(e.required||[]);for(let[c,u]of Object.entries(i)){let l=K(u,t);n[c]=s.has(c)?l:l.optional()}if(e.propertyNames){let c=K(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties==="object"?K(e.additionalProperties,t):v.any();if(Object.keys(n).length===0){o=v.record(c,u);break}let l=v.object(n).passthrough(),f=v.looseRecord(c,u);o=v.intersection(l,f);break}if(e.patternProperties){let c=e.patternProperties,u=Object.keys(c),l=[];for(let p of u){let d=K(c[p],t),m=v.string().regex(new RegExp(p));l.push(v.looseRecord(m,d))}let f=[];if(Object.keys(n).length>0)f.push(v.object(n).passthrough());if(f.push(...l),f.length===0)o=v.object({}).passthrough();else if(f.length===1)o=f[0];else{let p=v.intersection(f[0],f[1]);for(let d=2;d<f.length;d++)p=v.intersection(p,f[d]);o=p}break}let a=v.object(n);if(e.additionalProperties===!1)o=a.strict();else if(typeof e.additionalProperties==="object")o=a.catchall(K(e.additionalProperties,t));else o=a.passthrough();break}case"array":{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let s=n.map((c)=>K(c,t)),a=i&&typeof i==="object"&&!Array.isArray(i)?K(i,t):void 0;if(a)o=v.tuple(s).rest(a);else o=v.tuple(s);if(typeof e.minItems==="number")o=o.check(v.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(v.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=i.map((c)=>K(c,t)),a=e.additionalItems&&typeof e.additionalItems==="object"?K(e.additionalItems,t):void 0;if(a)o=v.tuple(s).rest(a);else o=v.tuple(s);if(typeof e.minItems==="number")o=o.check(v.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(v.maxLength(e.maxItems))}else if(i!==void 0){let s=K(i,t),a=v.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);o=a}else o=v.array(v.any());break}default:throw Error(`Unsupported type: ${r}`)}return o}function K(e,t){if(typeof e==="boolean")return e?v.any():v.never();let r=zf(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((u)=>K(u,t)),c=v.union(a);r=o?v.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((u)=>K(u,t)),c=v.xor(a);r=o?v.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:v.any();else{let a=o?r:K(e.allOf[0],t),c=o?0:1;for(let u=c;u<e.allOf.length;u++)a=v.intersection(a,K(e.allOf[u],t));r=a}if(e.nullable===!0&&t.version==="openapi-3.0")r=v.nullable(r);if(e.readOnly===!0)r=v.readonly(r);if(e.default!==void 0)r=r.default(e.default);let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)n[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)n[a]=e[a];for(let a of Object.keys(e))if(!Ow.has(a))n[a]=e[a];if(Object.keys(n).length>0)t.registry.add(r,n);if(e.description)r=r.describe(e.description);return r}function Df(e,t){if(typeof e==="boolean")return e?v.any():v.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=Iw(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Y};return K(r,i)}var v,Ow;var Nf=_(()=>{Ft();co();uo();po();v={...lo,...ao,iso:Gt},Ow=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"])});var Lf=()=>{};var Vs=_(()=>{ye();ye();Zl();ye();Nf();Ri();uo();Lf();po();co();ss();as();Bf();W(Ci())});var Us=_(()=>{Vs();Vs()});var Uf="registry.neko-piranha.ts.net",So="https://kuber.astrxl.dev/api/v2",H;var Ve=_(()=>{H={"app.kubernetes.io/managed-by":"kuber"}});import{chmod as Ff,mkdir as Nw,readFile as Lw,rename as Vw,rm as Ms,writeFile as Uw}from"fs/promises";import{randomUUID as Fw}from"crypto";import{tmpdir as qf}from"os";import{dirname as Mf,join as $o}from"path";function js(){let e=process.env.XDG_RUNTIME_DIR??$o(qf(),`kuber-${process.getuid?.()??"user"}`);return $o(e,"kuber","session.json")}function Zs(){let e=process.env.XDG_CONFIG_HOME??$o(process.env.HOME??qf(),".config");return $o(e,"kuber","session.json")}function jf(e){return e?Zs():js()}function Mw(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.token==="string"&&typeof t.expiresAt==="string"&&Boolean(t.user)&&typeof t.user?.username==="string"&&Array.isArray(t.user.roles)&&t.user.roles.every((r)=>typeof r==="string")}async function Zf(e){try{let t=JSON.parse(await Lw(e,"utf8"));if(!Mw(t))return;if(Date.parse(t.expiresAt)<=Date.now()){await Ms(e,{force:!0});return}return t}catch(t){if(t&&typeof t==="object"&&"code"in t&&t.code==="ENOENT")return;if(t instanceof SyntaxError)return;throw t}}async function ht(){let e=js(),t=Zs();if(Ue?.runtimePath===e&&Ue.persistentPath===t&&(Ue.expiresAt===0||Ue.expiresAt>Date.now()))return Ue.value;let r=await Zf(e)??await Zf(t);return Ue={runtimePath:e,persistentPath:t,value:r,expiresAt:r?Date.parse(r.expiresAt):0},r}async function Qf(e,t){let r=jf(t);await Nw(Mf(r),{recursive:!0,mode:448}),await Ff(Mf(r),448);let o=`${r}.${Fw()}.tmp`;return await Uw(o,`${JSON.stringify(e,null,2)}
|
|
72
|
+
`,{flag:"wx",mode:384}),await Vw(o,r),await Ff(r,384),await Ms(jf(!t),{force:!0}),Ue=void 0,r}async function qs(){await Promise.all([js(),Zs()].map((e)=>Ms(e,{force:!0}))),Ue=void 0}var Ue;var Ao=()=>{};function Wf(e,t=jw){if(!Number.isFinite(t)||t<0)throw RangeError("timeoutMs must be a finite non-negative number");let r=new AbortController,o=()=>r.abort(e?.reason);if(e?.aborted)o();else e?.addEventListener("abort",o,{once:!0});let n=t===0?void 0:setTimeout(()=>{r.abort(new DOMException(`API request timed out after ${t}ms`,"TimeoutError"))},t);return{signal:r.signal,clear:()=>{if(n!==void 0)clearTimeout(n);e?.removeEventListener("abort",o)}}}function Zw(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof Blob<"u"&&e instanceof Blob||typeof ReadableStream<"u"&&e instanceof ReadableStream}async function qw(e,t){let r=new Headers(e.headers);if(!r.has("accept"))r.set("accept","application/json");if(Object.hasOwn(e,"json"))r.set("content-type","application/json");else if(e.body!==void 0&&e.body!==null&&!r.has("content-type")&&!Zw(e.body))r.set("content-type","application/json");if(t.uploadOffset!==void 0){if(!Number.isSafeInteger(t.uploadOffset)||t.uploadOffset<0)throw RangeError("uploadOffset must be a non-negative safe integer");r.set("upload-offset",String(t.uploadOffset))}if(t.authenticated!==!1){let o=t.session??await ht();if(!o)throw Error("Not logged in. Run kuber login first.");r.set("authorization",`Bearer ${o.token}`)}return r}async function Qw(e){let t;try{let r=JSON.parse(await e.text());if(r&&typeof r==="object")t=r}catch{}return{...t,status:e.status,title:t?.title||e.statusText||`HTTP ${e.status}`,code:t?.code||`HTTP_${e.status}`,requestId:t?.requestId??e.headers.get("x-request-id")??void 0,operationId:t?.operationId??e.headers.get("x-operation-id")??void 0}}async function Gf(e){if(e.ok)return;let t=await Qw(e);throw new we(t.detail||t.message||t.title,e.status,t)}async function Kf(e,t,r,o){let n=await qw(t,r),{json:i,...s}=t,a=Object.hasOwn(t,"json")?JSON.stringify(i):t.body;return fetch(`${r.baseUrl??So}${e}`,{...s,body:a,headers:n,signal:o})}async function k(e,t={},r={}){let o=Wf(t.signal,r.timeoutMs);try{let n=await Kf(e,t,r,o.signal);if(await Gf(n),t.method?.toUpperCase()==="HEAD"||n.status===204||n.status===205||n.body===null)return;let i=await n.text();if(!i.trim())return;return JSON.parse(i)}finally{o.clear()}}async function*Qs(e,t={},r={}){let o=Wf(t.signal,r.timeoutMs);try{let n=new Headers(t.headers);n.set("accept","application/x-ndjson");let i=await Kf(e,{...t,headers:n},r,o.signal);if(await Gf(i),!i.body)return;let s=i.body.getReader();try{let a=new TextDecoder,c="";for(;;){let{done:l,value:f}=await s.read();c+=a.decode(f,{stream:!l});let p=0,d=c.indexOf(`
|
|
73
|
+
`,p);while(d!==-1){let m=c.slice(p,d).replace(/\r$/,"").trim();if(m)yield JSON.parse(m);p=d+1,d=c.indexOf(`
|
|
74
|
+
`,p)}if(c=c.slice(p),l)break}let u=c.replace(/\r$/,"").trim();if(u)yield JSON.parse(u)}finally{try{await s.cancel()}catch{}s.releaseLock()}}finally{o.clear()}}var jw=30000,we;var q=_(()=>{Ve();Ao();we=class we extends Error{code;requestId;operationId;problem;constructor(e,t,r){super(e);this.name="KuberApiError",this.status=t,this.code=r?.code??`HTTP_${t}`,this.requestId=r?.requestId,this.operationId=r?.operationId,this.problem={...r,status:t,title:r?.title??e,code:this.code}}status}});var Ws;var Gs=_(()=>{Ws={top:"\u2500",topMid:"\u252C",topLeft:"\u250C",topRight:"\u2510",bottom:"\u2500",bottomMid:"\u2534",bottomLeft:"\u2514",bottomRight:"\u2518",left:"\u2502",leftMid:"\u251C",mid:"\u2500",midMid:"\u253C",right:"\u2502",rightMid:"\u2524",middle:"\u2502"}});class re{value;options;get length(){return this.toString().length}get unclosedAnsiRuns(){return this.options.unclosedAnsiRuns??""}set unclosedAnsiRuns(e){this.options.unclosedAnsiRuns=e}static from(e){let t;if(e instanceof re)t=new this(e.getValue()),t.options={...e.options};else t=new this(e);return t}constructor(e){this.value=e,this.options={}}toString(){return this.value.toString()}getValue(){return this.value}setValue(e){return this.value=e,this}clone(e){return re.from(e??this)}border(e=!0,t=!0){if(t||typeof this.options.border>"u")this.options.border=e;return this}colSpan(e,t=!0){if(t||typeof this.options.colSpan>"u")this.options.colSpan=e;return this}rowSpan(e,t=!0){if(t||typeof this.options.rowSpan>"u")this.options.rowSpan=e;return this}align(e,t=!0){if(t||typeof this.options.align>"u")this.options.align=e;return this}getBorder(){return this.options.border===!0}getColSpan(){return typeof this.options.colSpan==="number"&&this.options.colSpan>0?this.options.colSpan:1}getRowSpan(){return typeof this.options.rowSpan==="number"&&this.options.rowSpan>0?this.options.rowSpan:1}getAlign(){return this.options.align??"left"}}class ve{static from(e){let t=e instanceof ve?e.opts:e;return new ve().options(t)}opts={};options(e){return Object.assign(this.opts,e),this}minWidth(e){return this.opts.minWidth=e,this}maxWidth(e){return this.opts.maxWidth=e,this}border(e=!0){return this.opts.border=e,this}padding(e){return this.opts.padding=e,this}align(e){return this.opts.align=e,this}flexShrink(e=1){return this.opts.flexShrink=e,this}flexGrow(e=1){return this.opts.flexGrow=e,this}flex(e=1){return this.opts.flexGrow=e,this.opts.flexShrink=e,this}getMinWidth(){return this.opts.minWidth}getMaxWidth(){return this.opts.maxWidth}getBorder(){return this.opts.border}getPadding(){return this.opts.padding}getAlign(){return this.opts.align}getFlexShrink(){return this.opts.flexShrink}getFlexGrow(){return this.opts.flexGrow}}function Jf(e){return e.replace(Ww,"")}var Hf,iC,Ww;var Yf=_(()=>{({Deno:Hf}=globalThis),iC=typeof Hf?.noColor==="boolean"?Hf.noColor:!1,Ww=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TXZcf-nq-uy=><~]))"].join("|"),"g")});function Kw(e){if(!er)er=Gw.tables.map(Jw);let t=er.at(0)?.[e>>13&255]??0,r=er.at(1)?.[128*t+(e>>6&127)]??0,n=(er.at(2)?.[16*r+(e>>2&15)]??0)>>2*(e&3)&3;return n===3?1:n}function Hw(e){let t=Xf.get(e);if(t!==void 0)return t;let r=e.codePointAt(0);if(r===void 0)return null;let o;if(r<127)o=r>=32?1:r===0?0:null;else if(r>=160)o=Kw(r);else o=null;return Xf.set(e,o),o}function em(e){return[...e].map((t)=>Hw(t)??0).reduce((t,r)=>t+r,0)}function Jw({d:e,r:t}){let r=atob(e),o=atob(t),n="";for(let[i,s]of[...o].entries())n+=r.charAt(i).repeat(s.codePointAt(0)??0);return Uint8Array.from([...n].map((i)=>i.codePointAt(0)??0))}var er=null,Gw,Xf;var tm=_(()=>{Gw={UNICODE_VERSION:"15.0.0",tables:[{d:"AAECAwQFBgcICQoLDA0OAw8DDwkQCRESERIA",r:"AQEBAgEBAQEBAQEBAQEBBwEHAVABBwcBBwF4"},{d:"AAECAwQFBgcGCAYJCgsMDQ4PEAYREhMUBhUWFxgZGhscHR4fICEiIyIkJSYnKCkqJSssLS4vMDEyMzQ1Njc4OToGOzwKBj0GPj9AQUIGQwZEBkVGR0hJSktMTQZOBgoGT1BRUlNUVVZXWFkGWgZbBlxdXl1fYGFiY2RlZmdoBmlqBmsGAQZsBm1uO29wcXI7czt0dXZ3OwY7eHkGent8Bn0Gfn+AgYKDhIWGBoc7iAZdO4kGiosGAXGMBo0GjgaPBpAGkQaSBpMGlJUGlpcGmJmam5ydnp+gLgahLKIGo6SlpganqKmqqwasBq0Grq8GsLGyswa0BrUGtre4Brm6uwZHvAa9vga/wME7wjvDxAbFO8bHO8gGyQbKywbMzQbOBs/Q0QbSBr8GvgbT1AbUBtUG1gbXBtjZ2tsG3N0G3t/g4eLjO+Tl5ufoO+k76gbrBuztOwbu7/AGO+XxCgYKCwZd8g==",r:"AQEBAQEBAQEBAQEBAQEBAQEBAQMBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQECBQEOAQEBAQEBAQEBAwEBAQEBAQEBAQIBAwEIAQEBAQEBAQEBAQEBAQIBAQEBAQEBAQEBAQEBAQEBDQEBBQEBAQEBAgEBAwEBAQEBAQEBAQEBbQHaAQEFAQEBBAECAQEBAQEBAQEBAwGuASFkCAELAQEBAQEBAQEHAQMBAQEaAQIBCAEFAQEBAQEBAQEBAQEBAQEBAQEBAQECAQEBAQIBAQEBAQEBAwEDAQEBAQEBAQUBAQEBAQEBBAEBAVIBAdkBARABAQFfARMBAYoBBAEBBQEmAUkBAQcBAQIBHgEBARUBAQEBAQUBAQcBDwEBARoBAgEBAQEBAQECAQEBAQEBAQEBAQEBAQEBAQMBBAEBAgEBAQEUfwEBAQIDAXj/AQ=="},{d:"AFUVAF3Xd3X/93//VXVVV9VX9V91f1/31X93XVXdVdVV9dVV/VVX1X9X/131VfXVVXV3V1VdVV1V1/1dV1X/3VUAVf3/3/9fVf3/3/9fVV1V/11VFQBQVQEAEEEQVQBQVQBAVFUVAFVUVQUAEAAUBFBVFVFVAEBVBQBUVRUAVVFVBRAAAVBVAVVQVQBVBQBAVUVUAQBUUQEAVQVVUVVUAVRVUVUFVUVBVVRBFRRQUVVQUVUBEFRRVQVVBQBRVRQBVFVRVUFVBVVFVVRVUVVUVQRUBQRQVUFVBVVFVVBVBVVQVRVUAVRVUVUFVVFVRVUFRFVRAEBVFQBAVVEAVFUAQFVQVRFRVQEAQAAEVQEAAQBUVUVVAQQAQVVQBVRVAVRVRUFVUVVRVaoAVQFVBVRVBVUFVQVVEABQVUUBAFVRVRUAVUFVUVVAFVRVRVUBVRUUVUUAQEQBAFQVABRVAEBVAFUEQFRFVRUAVVBVBVAQUFVFUBFQVQAFVUAABABUUVVUUFUVANd/X3//BUD3XdV1VQAEAFVXVdX9V1VXVQBUVdVdVdV1VX111VXVV9V//1X/X1VdVf9fVV9VdVdV1VX31dfVXXX9193/d1X/VV9VV3VVX//1VfVVXVVdVdVVdVWlVWlVqVaWVf/f/1X/Vf/1X1Xf/19V9VVf9df1X1X1X1XVVWlVfV31VVpVd1V3VapV33/fVZVVlVX1WVWlVelV+v/v//7/31Xv/6/77/tVWaVVVlVdVWaVmlX1/1WpVVZVlVWVVlVW+V9VFVBVAKqaqlWqWlWqVaoKoKpqqapqgapVqaqpqmqqVapqqv+qVqpqVRVAAFBVBVVQVUUVVUFVVFVQVQBQVRVVBQBQVRUAUFWqVkBVFQVQVVFVAUBBVRVVVFVUVQQUVAVRVVBVRVVRVFFVqlVFVQCqWlUAqmqqaqpVqlZVqmpVAV1VUVVUVQVAVQFBVQBVQBVVQVUAVRVUVQFVBQBUVQVQVVFVAEBVFFRVFVBVFUBBUUVVUVVAVRUAAQBUVRVVUFUFAEBVARRVFVAEVUVVFQBAVVRVBQBUAFRVAAVEVUVVFQBEFQRVBVBVEFRVUFUVAEARVFUVUQAQVQEFEABVFQBBVRVEFVUABVVUVQEAQFUVABRAVRVVAUABVQUAQFBVAEAAEFUFAAUABEFVAUBFEAAQVVARVRVUVVBVBUBVRFVUFQBQVQBUVQBAVRVVFUBVqlRVWlWqVapaVapWVaqpqmmqalVlVWpZVapVqlVBAFUAUABAVRVQVRUAQAEAVQVQVQVUVQBAFQBUVVFVVFUVAAEAVQBAABQAEARAVUVVAFUAQFUAQFVWVZVV/39V/1//X1X/76uq6v9XVWpVqlWqVlVaVapaVapWVamqmqqmqlWqapWqVapWqmqmqpaqWlWVaqpVZVVpVVZVlapVqlpVVmqpVapVlVZVqlZVqlVWVapqqpqqVapWqlZVqpqqWlWlqlWqVlWqVlVRVQD/Xw==",r:"CBcBCAEBAQEBAQEBAQECAQEBAQEBAQEBAQEBAQMBAQECAQEBAQEBAQEBAQEBBAEBGAEDAQwBAwEIAQEBAQEBAQgcCAEDAQEBAQEDAQEBDQEDEAELAQEBEQEKAQEBDgEBAgIBAQoBBQQBCAEBAQEBAQEHAQEHBgEWAQIBDQECAgEFAQECAgEKAQ0BAQIKAQ0BDQEBAQEBAQEBAgEHAQ4BAQEBAQQBBgEBDgEBAQEBAQcBAQIBAQEBBAEFAQEBDgEBAQEBAQECAQcBDwECAQwCDQEBAQEBAQECAQgBAQEEAQcBDQEBAQEBAQQBBwERAQEBARYBAQECAQEBGAECAQIBARIBBgEBDQECAQEBAQECAQgBAQEZAQEBAgYBAQEDAQECAQEBAQMBCBgIBwEMAQEGAQcBBwEQAQEBAQEBAgIBCgEBDQEIAQ0BAQEBAQEBBgEBDgEBAQEBAQEBAgEMBwEMAQwBAQEBCQECAwEHAQEBAQ0BAQEBDgIBBgEDAQEBAQEBAQMBAQEBAgEBAQEBAQEBCAEBAgEBAQEBAQkBCAgBAwECAQEBAgEBAQkBAQEBAwECAQMBAQIBBwEFAQEDAQYBAQEBAgEBAQEBAQEBAQECAgEDAQECBAIDAgIBBQEEAQEBAwEPAQEBCyIBCAEJAwQBAQIBAQEBAgECAQEBAQMBAQEBAwEBAQEBAQEBAQgBAQMDAgEBAwEEAQIBAQEBBAEBAQEBAQECAQEBAQEBAQEBAQEHAQQBAwEBAQcBAgUBBgECAQYBAQwBAQEUAQELCAYBFgMFAQYDAQoBAQMBARQBAQkBAQoBBgEVAwsBCgIPAQ0BGQEBAgEHARQBAwIBBgEBAQUBBgQBAgEJAQEBBQECAQMHAQELAQECCQEQAQECAgECAQsBDAEBAQEBCgEBAQsBAQEECQ4BCAQCAQEECAEEAQEFCAEPAQEEAQEPAQgBFAEBAQEBAQEKAQEJAQ8BEAEBEwEBAQIBCwEBDgENAwEKAQEBAQELAQEBAQECAQwBCAEBAQEBDgEDAQwBAQECAQEXAQEBAQEHAgEBBQEIAQEBAQEQAgEBBQEUAQEBAQEbAQEBAQEGARQBAQEBARkBAQEBCQEBAQEQAQIBDwEBARQBAQEBBwEBAQkBAQEBAQECAQEBCwECAQEVAQEBAQQBBQEBAQEOAQEBAQEBEgEBFgEBAgEMAQEBAQ8BAQMBFgEBDgEBBQEPAQETAQECAQMOAgUBCgIBGQEBAQEIAQMBBwEBAwECEwgBAQcLAQUBFwEBAQEDAQEBBwEBBAEBDg0BAQwBAQEDAQQBAQEDBAEBBAEBAQEBEAEPAQgBAQsBAQ4BEQEMAgEBBwEOAQEHAQEBAQQBBAEDCwECAQEBAwEBBggBAgEBAREBBQMKAQEBAwQCEQEBHgEPAQIBAQYEAQYBAwEUAQUMAQEBAQEBAQECAQEBAgEIAwEBBgsBAgEODAMBAgEBCwEBAQEBAwECAQECAQEBBwgPAQ=="}]};Xf=new Map});function rm(e,t,r){let o=t.map((n)=>{let i=n[e];return(i instanceof re&&i.getColSpan()>1?"":i?.toString()||"").split(`
|
|
75
|
+
`).map((a)=>{let c=typeof r>"u"?a:tr(r,a);return xe(c)||0})}).flat();return Math.max(...o)}function om(e){let t=[];for(let{groups:i}of e.matchAll(new RegExp(Ks,"g"))){if(!i)continue;let s=Object.entries(i).find(([u,l])=>l);if(!s)continue;let[a,c]=s;t.push({kind:a.slice(1),content:c})}let r=[];for(let i of t)r=[...r.filter((s)=>s.kind!==i.kind),i];r=r.filter(({content:i,kind:s})=>i!==s);let o=r.map(({kind:i})=>`\x1B[${i}m`).reverse().join(""),n=r.map(({content:i})=>`\x1B[${i}m`).join("");return{currentSuffix:o,nextPrefix:n}}var xe=(e)=>em(Jf(e)),Ks;var Hs=_(()=>{ko();Yf();tm();Ks=/\x1b\[(?:(?<_0>0)|(?<_22>1|2|22)|(?<_23>3|23)|(?<_24>4|24)|(?<_27>7|27)|(?<_28>8|28)|(?<_29>9|29)|(?<_39>30|31|32|33|34|35|36|37|38;2;\d+;\d+;\d+|38;5;\d+|39|90|91|92|93|94|95|96|97)|(?<_49>40|41|42|43|44|45|46|47|48;2;\d+;\d+;\d+|48;5;\d+|49|100|101|102|103|104|105|106|107))m/.source});function tr(e,t){let r="",o=t.split(`
|
|
76
|
+
`)[0]?.split(/ /g);for(let n=0;n<o.length;n++){let i=o[n];if(r){let s=xe(i);if(xe(r)+s>=e)break}r+=(n>0?" ":"")+i}return r}function nm(e,t){let r="",o=[...t.split(`
|
|
77
|
+
`)[0].matchAll(new RegExp(`(?:${Ks})+|.`,"gu"))].map(([n])=>n);for(let n of o){if(r){let i=xe(n);if(xe(r)+i>e)break}r+=n}return r}var ko=_(()=>{Hs()});var ae;var Po=_(()=>{ae=class ae extends Array{options={};static from(e){let t=new this(...e);if(e instanceof ae)t.options={...e.options};return t}clone(){let e=new ae(...this.map((t)=>t instanceof re?t.clone():t));return e.options={...this.options},e}border(e=!0,t=!0){if(t||typeof this.options.border>"u")this.options.border=e;return this}align(e,t=!0){if(t||typeof this.options.align>"u")this.options.align=e;return this}getBorder(){return this.options.border===!0}hasBorder(){return this.getBorder()||this.some((e)=>e instanceof re&&e.getBorder())}getAlign(){return this.options.align??"left"}}});class Js{table;options;constructor(e,t){this.table=e,this.options=t}toString(){let e=this.createLayout();return e.rows.length?this.renderRows(e):""}createLayout(){Object.keys(this.options.chars).forEach((u)=>{if(typeof this.options.chars[u]!=="string")this.options.chars[u]=""});let e=this.table.getBorder()||this.table.hasBodyBorder(),t=this.table.hasHeaderBorder(),r=t||e,o=this.#t(),n=Math.max(...o.map((u)=>u.length));for(let u=0;u<o.length;u++){let l=o[u],f=l.length;if(f<n){let p=n-f;for(let d=0;d<p;d++)l.push(this.createCell(null,l,u,f+d))}}let{padding:i,width:s,minColWidth:a,maxColWidth:c}=this.computeColumnDimensions(n,o);if(isFinite(this.options.maxWidth)){let u=r?Ee(i)*2+(n+1):Ee(i.slice(0,-1)),l=this.options.maxWidth-u;if(Ee(s)>l)this.applyFlexShrink(s,a,l);if(Ee(s)<l)this.applyFlexGrow(s,c,l)}return{padding:i,width:s,rows:o,columns:n,hasBorder:r,hasBodyBorder:e,hasHeaderBorder:t}}computeColumnDimensions(e,t){let r=[],o=[],n=[],i=[];for(let s=0;s<e;s++){let a=this.options.columns.at(s);n[s]=a?.getMinWidth()??(Array.isArray(this.options.minColWidth)?this.options.minColWidth[s]:this.options.minColWidth)??0,i[s]=a?.getMaxWidth()??(Array.isArray(this.options.maxColWidth)?this.options.maxColWidth[s]:this.options.maxColWidth)??1/0;let c=rm(s,t,i[s]);o[s]=Math.min(i[s],Math.max(n[s],c)),r[s]=a?.getPadding()??(Array.isArray(this.options.padding)?this.options.padding[s]:this.options.padding)??0}return{padding:r,width:o,minColWidth:n,maxColWidth:i}}applyFlexShrink(e,t,r){let o=e.map((i,s)=>this.resolveColumnWeight("flexShrink",s)),n=!0;while(n){if(n=!1,Ee(e)<=r)break;let i=Ee(e)-r,s=Ee(e.map((a,c)=>o[c]>0&&a>t[c]?o[c]*a:0));if(s===0)break;for(let a=0;a<e.length;a++)if(o[a]>0&&e[a]>t[a]){let c=Math.max(Math.max(1,t[a]),Math.floor(e[a]*(1-i*o[a]/s)));if(c!==e[a])e[a]=c,n=!0}}}applyFlexGrow(e,t,r){let o=e.map((i,s)=>this.resolveColumnWeight("flexGrow",s)),n=!0;while(n){if(n=!1,Ee(e)>=r)break;let i=r-Ee(e),s=Ee(o.map((a,c)=>e[c]<t[c]?a:0));if(s===0)break;for(let a=0;a<e.length;a++)if(o[a]>0&&e[a]<t[a]){let c=Math.floor(i*o[a]/s),u=Math.min(t[a],e[a]+c);if(u!==e[a])e[a]=u,n=!0}}}resolveColumnWeight(e,t){let r=e==="flexShrink"?"getFlexShrink":"getFlexGrow",o=this.options.columns.at(t)?.[r]()??(Array.isArray(this.options[e])?this.options[e][t]:this.options[e]);return Number.isFinite(o)&&o>0?o:0}#t(){let e=this.table.getHeader(),t=e?[e,...this.table]:this.table.slice();if(t.some((o)=>o.some((n)=>n instanceof re&&(n.getColSpan()>1||n.getRowSpan()>1))))return this.spanRows(t);return t.map((o,n)=>{let i=this.createRow(o);for(let s=0;s<o.length;s++)i[s]=this.createCell(o[s],i,n,s);return i})}spanRows(e){let t=[],r=1,o=-1;while(!0){if(o++,o===e.length&&t.every((s)=>s===1))break;let n=e[o]=this.createRow(e[o]||[]),i=-1;while(!0){if(i++,i===n.length&&i===t.length&&r===1)break;if(r>1){r--,t[i]=t[i-1],n.splice(i,this.getDeleteCount(e,o,i),n[i-1]);continue}if(t[i]>1){t[i]--,e[o].splice(i,this.getDeleteCount(e,o,i),e[o-1][i]);continue}let s=n[i]=this.createCell(n[i]||null,n,o,i);r=s.getColSpan(),t[i]=s.getRowSpan()}}return e}getDeleteCount(e,t,r){return r<=e[t].length-1&&typeof e[t][r]>"u"?1:0}createRow(e){return ae.from(e).border(this.table.getBorder(),!1).align(this.table.getAlign(),!1)}createCell(e,t,r,o){let n=this.options.columns.at(o),i=this.isHeaderRow(r);return re.from(e??"").border((i?null:n?.getBorder())??t.getBorder(),!1).align((i?null:n?.getAlign())??t.getAlign(),!1)}isHeaderRow(e){return e===0&&this.table.getHeader()!==void 0}renderRows(e){let t="",r=Array(e.columns).fill(1);for(let o=0;o<e.rows.length;o++)t+=this.renderRow(r,o,e);return t.slice(0,-1)}renderRow(e,t,r,o){let n=r.rows[t],i=r.rows[t-1],s=r.rows[t+1],a="",c=1;if(!o&&t===0&&n.hasBorder())a+=this.renderBorderRow(void 0,n,e,r);let u=!1;a+=" ".repeat(this.options.indent||0);for(let l=0;l<r.columns;l++){if(c>1){c--,e[l]=e[l-1];continue}if(a+=this.renderCell(l,n,r),e[l]>1){if(!o)e[l]--}else if(!i||i[l]!==n[l])e[l]=n[l].getRowSpan();if(c=n[l].getColSpan(),e[l]===1&&n[l].length)u=!0}if(r.columns>0){if(n[r.columns-1].getBorder())a+=this.options.chars.right;else if(r.hasBorder)a+=" "}if(a+=`
|
|
78
|
+
`,u)return a+this.renderRow(e,t,r,u);if(r.rows.length>1&&(t===0&&r.hasHeaderBorder||t<r.rows.length-1&&r.hasBodyBorder))a+=this.renderBorderRow(n,s,e,r);if(t===r.rows.length-1&&n.hasBorder())a+=this.renderBorderRow(n,void 0,e,r);return a}renderCell(e,t,r,o){let n="",i=t[e-1],s=t[e];if(!o){if(e===0){if(s.getBorder())n+=this.options.chars.left;else if(r.hasBorder)n+=" "}else if(s.getBorder()||i?.getBorder())n+=this.options.chars.middle;else if(r.hasBorder)n+=" "}let a=r.width[e],c=s.getColSpan();if(c>1){for(let f=1;f<c;f++)if(a+=r.width[e+f]+r.padding[e+f],r.hasBorder)a+=r.padding[e+f]+1}let{current:u,next:l}=this.renderCellValue(s,a);if(t[e].setValue(l),r.hasBorder)n+=" ".repeat(r.padding[e]);if(n+=u,r.hasBorder||e<r.columns-1)n+=" ".repeat(r.padding[e]);return n}renderCellValue(e,t){if(t<=0)return{current:"",next:""};let r=Math.min(t,xe(e.toString())),o=tr(r,e.toString()),n=xe(o)>r;if(n)o=nm(r,o);let i=e.toString().slice(o.length+(n?0:1));o=e.unclosedAnsiRuns+o;let{currentSuffix:s,nextPrefix:a}=om(o);o+=s,e.unclosedAnsiRuns=a;let c=t-xe(o),u=e.getAlign(),l;if(c===0)l=o;else if(u==="left")l=o+" ".repeat(c);else if(u==="center")l=" ".repeat(Math.floor(c/2))+o+" ".repeat(Math.ceil(c/2));else if(u==="right")l=" ".repeat(c)+o;else throw Error("Unknown direction: "+u);return{current:l,next:i}}renderBorderRow(e,t,r,o){let n="",i=1;for(let s=0;s<o.columns;s++){if(r[s]>1){if(!t)throw Error("invalid layout");if(i>1){i--;continue}}n+=this.renderBorderCell(s,e,t,r,o),i=t?.[s].getColSpan()??1}return n.length?" ".repeat(this.options.indent)+n+`
|
|
79
|
+
`:""}renderBorderCell(e,t,r,o,n){let i=t?.[e-1],s=r?.[e-1],a=t?.[e],c=r?.[e],u=!!i?.getBorder(),l=!!s?.getBorder(),f=!!a?.getBorder(),p=!!c?.getBorder(),d=(b)=>(b?.getColSpan()??1)>1,m=(b)=>(b?.getRowSpan()??1)>1,h="";if(e===0)if(o[e]>1)if(f)h+=this.options.chars.left;else h+=" ";else if(f&&p)h+=this.options.chars.leftMid;else if(f)h+=this.options.chars.bottomLeft;else if(p)h+=this.options.chars.topLeft;else h+=" ";else if(e<n.columns)if(u&&p||f&&l){let b=d(i),S=d(s),x=d(a),A=d(c),R=m(i),Z=m(s),_e=m(a),Ze=m(c),qe=u&&p&&f&&l,An=R&&_e&&Z&&Ze,nb=b&&x&&S&&A;if(An&&qe)h+=this.options.chars.middle;else if(nb&&qe&&i===a&&s===c)h+=this.options.chars.mid;else if(b&&x&&i===a)h+=this.options.chars.topMid;else if(S&&A&&s===c)h+=this.options.chars.bottomMid;else if(R&&Z&&i===s)h+=this.options.chars.leftMid;else if(_e&&Ze&&a===c)h+=this.options.chars.rightMid;else h+=this.options.chars.midMid}else if(u&&f)if(d(i)&&d(a)&&i===a)h+=this.options.chars.bottom;else h+=this.options.chars.bottomMid;else if(f&&p)if(o[e]>1)h+=this.options.chars.left;else h+=this.options.chars.leftMid;else if(p&&l)if(d(s)&&d(c)&&s===c)h+=this.options.chars.top;else h+=this.options.chars.topMid;else if(u&&l)if(m(i)&&i===s)h+=this.options.chars.right;else h+=this.options.chars.rightMid;else if(u)h+=this.options.chars.bottomRight;else if(f)h+=this.options.chars.bottomLeft;else if(l)h+=this.options.chars.topRight;else if(p)h+=this.options.chars.topLeft;else h+=" ";let y=n.padding[e]+n.width[e]+n.padding[e];if(o[e]>1&&r){if(h+=this.renderCell(e,r,n,!0),r[e]===r[r.length-1]){if(f)h+=this.options.chars.right;else h+=" ";return h}}else if(f&&p)h+=this.options.chars.mid.repeat(y);else if(f)h+=this.options.chars.bottom.repeat(y);else if(p)h+=this.options.chars.top.repeat(y);else h+=" ".repeat(y);if(e===n.columns-1)if(f&&p)h+=this.options.chars.rightMid;else if(f)h+=this.options.chars.bottomRight;else if(p)h+=this.options.chars.topRight;else h+=" ";return h}}var Ee=(e)=>e.reduce((t,r)=>t+r,0);var im=_(()=>{ko();Po();Hs()});var Fe;var sm=_(()=>{Gs();im();Po();Fe=class Fe extends Array{static _chars={...Ws};options={indent:0,border:!1,maxColWidth:1/0,minColWidth:0,padding:1,maxWidth:1/0,flexShrink:0,flexGrow:0,chars:{...Fe._chars},columns:[]};headerRow;static from(e){let t=new this(...e);if(e instanceof Fe)t.options={...e.options},t.headerRow=e.headerRow?ae.from(e.headerRow):void 0;return t}static fromJson(e){return new this().fromJson(e)}static chars(e){return Object.assign(this._chars,e),this}static render(e){Fe.from(e).render()}fromJson(e){return this.header(Object.keys(e[0])),this.body(e.map((t)=>Object.values(t))),this}columns(e){return this.options.columns=e.map((t)=>t instanceof ve?t:ve.from(t)),this}column(e,t){if(t instanceof ve)this.options.columns[e]=t;else if(this.options.columns[e])this.options.columns[e].options(t);else this.options.columns[e]=ve.from(t);return this}header(e){return this.headerRow=e instanceof ae?e:ae.from(e),this}body(e){return this.length=0,this.push(...e),this}clone(){let e=new Fe(...this.map((t)=>t instanceof ae?t.clone():ae.from(t).clone()));return e.options={...this.options},e.headerRow=this.headerRow?.clone(),e}toString(){return new Js(this,this.options).toString()}render(){return console.log(this.toString()),this}maxColWidth(e,t=!0){if(t||typeof this.options.maxColWidth>"u")this.options.maxColWidth=e;return this}minColWidth(e,t=!0){if(t||typeof this.options.minColWidth>"u")this.options.minColWidth=e;return this}maxWidth(e,t=!0){if(t||typeof this.options.maxWidth>"u")this.options.maxWidth=e;return this}flexShrink(e=1,t=!0){if(t||typeof this.options.flexShrink>"u")this.options.flexShrink=e;return this}flexGrow(e=1,t=!0){if(t||typeof this.options.flexGrow>"u")this.options.flexGrow=e;return this}flex(e=1,t=!0){return this.flexGrow(e,t).flexShrink(e,t)}indent(e,t=!0){if(t||typeof this.options.indent>"u")this.options.indent=e;return this}padding(e,t=!0){if(t||typeof this.options.padding>"u")this.options.padding=e;return this}border(e=!0,t=!0){if(t||typeof this.options.border>"u")this.options.border=e;return this}align(e,t=!0){if(t||typeof this.options.align>"u")this.options.align=e;return this}chars(e){return Object.assign(this.options.chars,e),this}getHeader(){return this.headerRow}getBody(){return[...this]}getMaxColWidth(){return this.options.maxColWidth}getMinColWidth(){return this.options.minColWidth}getIndent(){return this.options.indent}getPadding(){return this.options.padding}getBorder(){return this.options.border===!0}hasHeaderBorder(){let e=this.headerRow?.hasBorder();return e===!0||this.getBorder()&&e!==!1}hasBodyBorder(){return this.getBorder()||this.options.columns.some((e)=>e.getBorder())||this.some((e)=>e instanceof ae?e.hasBorder():e.some((t)=>t instanceof re?t.getBorder():!1))}hasBorder(){return this.hasHeaderBorder()||this.hasBodyBorder()}getAlign(){return this.options.align??"left"}getColumns(){return this.options.columns}getColumn(e){return this.options.columns[e]??=new ve}}});var am=_(()=>{Gs();ko();Po();sm()});function le(e){return new Fe(Object.keys(e[0]??{}).map((t)=>t.toUpperCase()),...e.map((t)=>Object.values(t))).toString()}function cm(e){if(!e)return;if(Array.isArray(e))return e.map((t)=>{let r=t.indexOf("=");return{name:r===-1?t:t.slice(0,r),value:r===-1?void 0:t.slice(r+1)}});return Object.entries(e).map(([t,r])=>({name:t,value:r===null?void 0:String(r)}))}var tt=_(()=>{am()});async function Yw(e,t=k){let r=e?`/audit?${new URLSearchParams({workspaceId:e})}`:"/audit",o=await t(r);if(o.items.length===0)return"No audit events";return le(o.items.map((n)=>({timestamp:n.metadata.creationTimestamp,actor:n.spec.actor.username,action:n.spec.action,workspace:n.spec.workspaceId,outcome:n.spec.outcome,operation:n.spec.operationId})))}var Xw,ev;var um=_(()=>{M();q();tt();Xw=E({meta:{name:"ls",description:"List audit events"},args:{workspace:{type:"string",alias:"w",description:"Filter by workspace"}},async run({args:e}){console.log(await Yw(e.workspace??e._[0]))}}),ev=E({meta:{name:"audit",description:"Inspect the audit log"},subCommands:{ls:Xw}})});import{basename as tv,isAbsolute as rv,resolve as lm}from"path";import{pathToFileURL as ov}from"url";function Ys(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`${t} must be a non-empty string`);return e.trim()}function sv(e,t){if(!e||typeof e!=="object"||Array.isArray(e))throw Error(`${t} must default export a configuration object`);let r=e;for(let o of["compose","preBuild","postBuild","postRender","postApply"])if(r[o]!==void 0&&typeof r[o]!=="function")throw Error(`${o} in ${t} must be a function`);if(r.project!==void 0)Ys(r.project,"project");if(r.composeFile!==void 0)Ys(r.composeFile,"composeFile");if(r.registry!==void 0)Ys(r.registry,"registry");if(r.rolloutTimeoutMs!==void 0&&(typeof r.rolloutTimeoutMs!=="number"||!Number.isFinite(r.rolloutTimeoutMs)||r.rolloutTimeoutMs<=0))throw Error(`rolloutTimeoutMs in ${t} must be a positive number`);return e}function pm(e){let t,r=[];for(let o=0;o<e.length;o+=1){let n=e[o];if(n==="--"){r.push(...e.slice(o));break}if(n.startsWith("--config=")){let i=n.slice(9);if(!i)throw Error("--config requires a path");if(t)throw Error("--config may only be specified once");t=i;continue}if(n==="--config"){let i=e[o+1];if(!i||i.startsWith("-"))throw Error(`${n} requires a path`);if(t)throw Error("--config may only be specified once");t=i,o+=1;continue}r.push(n)}return{configPath:t,rawArgs:r}}async function dm(e,t){let r=lm(e,t??nv),o=await Bun.file(r).exists();if(!o&&t)throw Error(`Config file cannot be found: ${r}`);let n=o?sv((await import(ov(r).href)).default,r):{},i=n.composeFile?.trim(),s=(n.registry?.trim()??Co).replace(/\/+$/,"");if(!s)throw Error(`registry in ${r} cannot be empty`);return{project:n.project?.trim()??tv(e),projectConfigured:n.project!==void 0,composeFile:i?rv(i)?i:lm(e,i):void 0,registry:s,rolloutTimeoutMs:n.rolloutTimeoutMs??iv,configFile:o?r:void 0,compose:n.compose,preBuild:n.preBuild,postBuild:n.postBuild,postRender:n.postRender,postApply:n.postApply}}function fm(e,t,r){return{cwd:t,project:e.project,composeFile:r,configFile:e.configFile}}var nv=".kuberrc.ts",Co,iv=300000;var Ro=_(()=>{Ve();Co=Uf});var mm;var hm=_(()=>{mm={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"compose_spec.json",type:"object",title:"Compose Specification",description:"The Compose file is a YAML file defining a multi-containers based application.",properties:{version:{type:"string",deprecated:!0,description:"declared for backward compatibility, ignored. Please remove it."},name:{type:"string",description:"define the Compose project name, until user defines one explicitly."},include:{type:"array",items:{$ref:"#/$defs/include"},description:"compose sub-projects to be included."},services:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/service"}},additionalProperties:!1,description:"The services that will be used by your application."},models:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/model"}},description:"Language models that will be used by your application."},networks:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/network"}},description:"Networks that are shared among multiple services."},volumes:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/volume"}},additionalProperties:!1,description:"Named volumes that are shared among multiple services."},secrets:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/secret"}},additionalProperties:!1,description:"Secrets that are shared among multiple services."},configs:{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{$ref:"#/$defs/config"}},additionalProperties:!1,description:"Configurations that are shared among multiple services."}},patternProperties:{"^x-":{}},additionalProperties:!1,$defs:{service:{type:"object",description:"Configuration for a service.",properties:{develop:{$ref:"#/$defs/development"},deploy:{$ref:"#/$defs/deployment"},annotations:{$ref:"#/$defs/list_or_dict"},attach:{type:["boolean","string"]},build:{description:"Configuration options for building the service's image.",oneOf:[{type:"string",description:"Path to the build context. Can be a relative path or a URL."},{type:"object",properties:{context:{type:"string",description:"Path to the build context. Can be a relative path or a URL."},dockerfile:{type:"string",description:"Name of the Dockerfile to use for building the image."},dockerfile_inline:{type:"string",description:"Inline Dockerfile content to use instead of a Dockerfile from the build context."},entitlements:{type:"array",items:{type:"string"},description:"List of extra privileged entitlements to grant to the build process."},args:{$ref:"#/$defs/list_or_dict",description:"Build-time variables, specified as a map or a list of KEY=VAL pairs."},ssh:{$ref:"#/$defs/list_or_dict",description:"SSH agent socket or keys to expose to the build. Format is either a string or a list of 'default|<id>[=<socket>|<key>[,<key>]]'."},labels:{$ref:"#/$defs/list_or_dict",description:"Labels to apply to the built image."},cache_from:{type:"array",items:{type:"string"},description:"List of sources the image builder should use for cache resolution"},cache_to:{type:"array",items:{type:"string"},description:"Cache destinations for the build cache."},no_cache:{type:["boolean","string"],description:"Do not use cache when building the image."},no_cache_filter:{$ref:"#/$defs/string_or_list",description:"Do not use build cache for the specified stages."},additional_contexts:{$ref:"#/$defs/list_or_dict",description:"Additional build contexts to use, specified as a map of name to context path or URL."},network:{type:"string",description:"Network mode to use for the build. Options include 'default', 'none', 'host', or a network name."},provenance:{type:["string","boolean"],description:"Add a provenance attestation"},sbom:{type:["string","boolean"],description:"Add a SBOM attestation"},pull:{type:["boolean","string"],description:"Always attempt to pull a newer version of the image."},target:{type:"string",description:"Build stage to target in a multi-stage Dockerfile."},shm_size:{type:["integer","string"],description:"Size of /dev/shm for the build container. A string value can use suffix like '2g' for 2 gigabytes."},extra_hosts:{$ref:"#/$defs/extra_hosts",description:"Add hostname mappings for the build container."},isolation:{type:"string",description:"Container isolation technology to use for the build process."},privileged:{type:["boolean","string"],description:"Give extended privileges to the build container."},secrets:{$ref:"#/$defs/service_config_or_secret",description:"Secrets to expose to the build. These are accessible at build-time."},tags:{type:"array",items:{type:"string"},description:"Additional tags to apply to the built image."},ulimits:{$ref:"#/$defs/ulimits",description:"Override the default ulimits for the build container."},platforms:{type:"array",items:{type:"string"},description:"Platforms to build for, e.g., 'linux/amd64', 'linux/arm64', or 'windows/amd64'."}},additionalProperties:!1,patternProperties:{"^x-":{}}}]},blkio_config:{type:"object",description:"Block IO configuration for the service.",properties:{device_read_bps:{type:"array",description:"Limit read rate (bytes per second) from a device.",items:{$ref:"#/$defs/blkio_limit"}},device_read_iops:{type:"array",description:"Limit read rate (IO per second) from a device.",items:{$ref:"#/$defs/blkio_limit"}},device_write_bps:{type:"array",description:"Limit write rate (bytes per second) to a device.",items:{$ref:"#/$defs/blkio_limit"}},device_write_iops:{type:"array",description:"Limit write rate (IO per second) to a device.",items:{$ref:"#/$defs/blkio_limit"}},weight:{type:["integer","string"],description:"Block IO weight (relative weight) for the service, between 10 and 1000."},weight_device:{type:"array",description:"Block IO weight (relative weight) for specific devices.",items:{$ref:"#/$defs/blkio_weight"}}},additionalProperties:!1},cap_add:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Add Linux capabilities. For example, 'CAP_SYS_ADMIN', 'SYS_ADMIN', or 'NET_ADMIN'."},cap_drop:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Drop Linux capabilities. For example, 'CAP_SYS_ADMIN', 'SYS_ADMIN', or 'NET_ADMIN'."},cgroup:{type:"string",enum:["host","private"],description:"Specify the cgroup namespace to join. Use 'host' to use the host's cgroup namespace, or 'private' to use a private cgroup namespace."},cgroup_parent:{type:"string",description:"Specify an optional parent cgroup for the container."},command:{$ref:"#/$defs/command",description:"Override the default command declared by the container image, for example 'CMD' in Dockerfile."},configs:{$ref:"#/$defs/service_config_or_secret",description:"Grant access to Configs on a per-service basis."},container_name:{type:"string",description:"Specify a custom container name, rather than a generated default name.",pattern:"[a-zA-Z0-9][a-zA-Z0-9_.-]+"},cpu_count:{oneOf:[{type:"string"},{type:"integer",minimum:0}],description:"Number of usable CPUs."},cpu_percent:{oneOf:[{type:"string"},{type:"integer",minimum:0,maximum:100}],description:"Percentage of CPU resources to use."},cpu_shares:{type:["number","string"],description:"CPU shares (relative weight) for the container."},cpu_quota:{type:["number","string"],description:"Limit the CPU CFS (Completely Fair Scheduler) quota."},cpu_period:{type:["number","string"],description:"Limit the CPU CFS (Completely Fair Scheduler) period."},cpu_rt_period:{type:["number","string"],description:"Limit the CPU real-time period in microseconds or a duration."},cpu_rt_runtime:{type:["number","string"],description:"Limit the CPU real-time runtime in microseconds or a duration."},cpus:{type:["number","string"],description:"Number of CPUs to use. A floating-point value is supported to request partial CPUs."},cpuset:{type:"string",description:"CPUs in which to allow execution (0-3, 0,1)."},credential_spec:{type:"object",description:"Configure the credential spec for managed service account.",properties:{config:{type:"string",description:"The name of the credential spec Config to use."},file:{type:"string",description:"Path to a credential spec file."},registry:{type:"string",description:"Path to a credential spec in the Windows registry."}},additionalProperties:!1,patternProperties:{"^x-":{}}},depends_on:{oneOf:[{$ref:"#/$defs/list_of_strings"},{type:"object",additionalProperties:!1,patternProperties:{"^[a-zA-Z0-9._-]+$":{type:"object",additionalProperties:!1,patternProperties:{"^x-":{}},properties:{restart:{type:["boolean","string"],description:"Whether to restart dependent services when this service is restarted."},required:{type:"boolean",default:!0,description:"Whether the dependency is required for the dependent service to start."},condition:{type:"string",enum:["service_started","service_healthy","service_completed_successfully"],description:"Condition to wait for. 'service_started' waits until the service has started, 'service_healthy' waits until the service is healthy (as defined by its healthcheck), 'service_completed_successfully' waits until the service has completed successfully."}},required:["condition"]}}}],description:"Express dependency between services. Service dependencies cause services to be started in dependency order. The dependent service will wait for the dependency to be ready before starting."},device_cgroup_rules:{$ref:"#/$defs/list_of_strings",description:"Add rules to the cgroup allowed devices list."},devices:{type:"array",description:"List of device mappings for the container.",items:{oneOf:[{type:"string"},{type:"object",required:["source"],properties:{source:{type:"string",description:"Path on the host to the device."},target:{type:"string",description:"Path in the container where the device will be mapped."},permissions:{type:"string",description:"Cgroup permissions for the device (rwm)."}},additionalProperties:!1,patternProperties:{"^x-":{}}}]}},dns:{$ref:"#/$defs/string_or_list",description:"Custom DNS servers to set for the service container."},dns_opt:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Custom DNS options to be passed to the container's DNS resolver."},dns_search:{$ref:"#/$defs/string_or_list",description:"Custom DNS search domains to set on the service container."},domainname:{type:"string",description:"Custom domain name to use for the service container."},entrypoint:{$ref:"#/$defs/command",description:"Override the default entrypoint declared by the container image, for example 'ENTRYPOINT' in Dockerfile."},env_file:{$ref:"#/$defs/env_file",description:"Add environment variables from a file or multiple files. Can be a single file path or a list of file paths."},label_file:{$ref:"#/$defs/label_file",description:"Add metadata to containers using files containing Docker labels."},environment:{$ref:"#/$defs/list_or_dict",description:"Add environment variables. You can use either an array or a list of KEY=VAL pairs."},expose:{type:"array",items:{type:["string","number"]},uniqueItems:!0,description:"Expose ports without publishing them to the host machine - they'll only be accessible to linked services."},extends:{oneOf:[{type:"string"},{type:"object",properties:{service:{type:"string",description:"The name of the service to extend."},file:{type:"string",description:"The file path where the service to extend is defined."}},required:["service"],additionalProperties:!1}],description:"Extend another service, in the current file or another file."},provider:{type:"object",description:"Specify a service which will not be manage by Compose directly, and delegate its management to an external provider.",required:["type"],properties:{type:{type:"string",description:"External component used by Compose to manage setup and teardown lifecycle of the service."},options:{type:"object",description:"Provider-specific options.",patternProperties:{"^.+$":{oneOf:[{type:["string","number","boolean"]},{type:"array",items:{type:["string","number","boolean"]}}]}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},external_links:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Link to services started outside this Compose application. Specify services as <service_name>:<alias>."},extra_hosts:{$ref:"#/$defs/extra_hosts",description:"Add hostname mappings to the container network interface configuration."},gpus:{$ref:"#/$defs/gpus",description:"Define GPU devices to use. Can be set to 'all' to use all GPUs, or a list of specific GPU devices."},group_add:{type:"array",items:{type:["string","number"]},uniqueItems:!0,description:"Add additional groups which user inside the container should be member of."},healthcheck:{$ref:"#/$defs/healthcheck",description:"Configure a health check for the container to monitor its health status."},hostname:{type:"string",description:"Define a custom hostname for the service container."},image:{type:"string",description:"Specify the image to start the container from. Can be a repository/tag, a digest, or a local image ID."},init:{type:["boolean","string"],description:"Run as an init process inside the container that forwards signals and reaps processes."},ipc:{type:"string",description:"IPC sharing mode for the service container. Use 'host' to share the host's IPC namespace, 'service:[service_name]' to share with another service, or 'shareable' to allow other services to share this service's IPC namespace."},isolation:{type:"string",description:"Container isolation technology to use. Supported values are platform-specific."},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to containers using Docker labels. You can use either an array or a list."},links:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Link to containers in another service. Either specify both the service name and a link alias (SERVICE:ALIAS), or just the service name."},logging:{type:"object",description:"Logging configuration for the service.",properties:{driver:{type:"string",description:"Logging driver to use, such as 'json-file', 'syslog', 'journald', etc."},options:{type:"object",description:"Options for the logging driver.",patternProperties:{"^.+$":{type:["string","number","null"]}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},mac_address:{type:"string",description:"Container MAC address to set."},mem_limit:{type:["number","string"],description:"Memory limit for the container. A string value can use suffix like '2g' for 2 gigabytes."},mem_reservation:{type:["string","integer"],description:"Memory reservation for the container."},mem_swappiness:{type:["integer","string"],description:"Container memory swappiness as percentage (0 to 100)."},memswap_limit:{type:["number","string"],description:"Amount of memory the container is allowed to swap to disk. Set to -1 to enable unlimited swap."},network_mode:{type:"string",description:"Network mode. Values can be 'bridge', 'host', 'none', 'service:[service name]', or 'container:[container name]'."},models:{oneOf:[{$ref:"#/$defs/list_of_strings"},{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{oneOf:[{type:"object",properties:{endpoint_var:{type:"string",description:"Environment variable set to AI model endpoint."},model_var:{type:"string",description:"Environment variable set to AI model name."}},additionalProperties:!1,patternProperties:{"^x-":{}}},{type:"null"}]}}}],description:"AI Models to use, referencing entries under the top-level models key."},networks:{oneOf:[{$ref:"#/$defs/list_of_strings"},{type:"object",patternProperties:{"^[a-zA-Z0-9._-]+$":{oneOf:[{type:"object",properties:{aliases:{$ref:"#/$defs/list_of_strings",description:"Alternative hostnames for this service on the network."},interface_name:{type:"string",description:"Interface network name used to connect to network"},ipv4_address:{type:"string",description:"Specify a static IPv4 address for this service on this network."},ipv6_address:{type:"string",description:"Specify a static IPv6 address for this service on this network."},link_local_ips:{$ref:"#/$defs/list_of_strings",description:"List of link-local IPs."},mac_address:{type:"string",description:"Specify a MAC address for this service on this network."},driver_opts:{type:"object",description:"Driver options for this network.",patternProperties:{"^.+$":{type:["string","number"]}}},priority:{type:"number",description:"Specify the priority for the network connection."},gw_priority:{type:"number",description:"Specify the gateway priority for the network connection."}},additionalProperties:!1,patternProperties:{"^x-":{}}},{type:"null"}]}},additionalProperties:!1}],description:"Networks to join, referencing entries under the top-level networks key. Can be a list of network names or a mapping of network name to network configuration."},oom_kill_disable:{type:["boolean","string"],description:"Disable OOM Killer for the container."},oom_score_adj:{oneOf:[{type:"string"},{type:"integer",minimum:-1000,maximum:1000}],description:"Tune host's OOM preferences for the container (accepts -1000 to 1000)."},pid:{type:["string","null"],description:"PID mode for container."},pids_limit:{type:["number","string"],description:"Tune a container's PIDs limit. Set to -1 for unlimited PIDs."},platform:{type:"string",description:"Target platform to run on, e.g., 'linux/amd64', 'linux/arm64', or 'windows/amd64'."},ports:{type:"array",description:"Expose container ports. Short format ([HOST:]CONTAINER[/PROTOCOL]).",items:{oneOf:[{type:"number"},{type:"string"},{type:"object",properties:{name:{type:"string",description:"A human-readable name for this port mapping."},mode:{type:"string",description:"The port binding mode, either 'host' for publishing a host port or 'ingress' for load balancing."},host_ip:{type:"string",description:"The host IP to bind to."},target:{type:["integer","string"],description:"The port inside the container."},published:{type:["string","integer"],description:"The publicly exposed port."},protocol:{type:"string",description:"The port protocol (tcp or udp)."},app_protocol:{type:"string",description:"Application protocol to use with the port (e.g., http, https, mysql)."}},additionalProperties:!1,patternProperties:{"^x-":{}}}]},uniqueItems:!0},pre_start:{type:"array",items:{$ref:"#/$defs/pre_start_hook"},description:"Init containers to run to completion before the service container is started. Each step runs in its own ephemeral container, in declared order; a non-zero exit fails the bring-up of the service and its dependents."},post_start:{type:"array",items:{$ref:"#/$defs/service_hook"},description:"Commands to run after the container starts. If any command fails, the container stops."},pre_stop:{type:"array",items:{$ref:"#/$defs/service_hook"},description:"Commands to run before the container stops. If any command fails, the container stop is aborted."},privileged:{type:["boolean","string"],description:"Give extended privileges to the service container."},profiles:{$ref:"#/$defs/list_of_strings",description:"List of profiles for this service. When profiles are specified, services are only started when the profile is activated."},pull_policy:{type:"string",pattern:"always|never|build|if_not_present|missing|refresh|daily|weekly|every_([0-9]+[wdhms])+",description:"Policy for pulling images. Options include: 'always', 'never', 'if_not_present', 'missing', 'build', or time-based refresh policies."},pull_refresh_after:{type:"string",description:"Time after which to refresh the image. Used with pull_policy=refresh."},read_only:{type:["boolean","string"],description:"Mount the container's filesystem as read only."},restart:{type:"string",description:"Restart policy for the service container. Options include: 'no', 'always', 'on-failure', and 'unless-stopped'."},runtime:{type:"string",description:"Runtime to use for this container, e.g., 'runc'."},scale:{type:["integer","string"],description:"Number of containers to deploy for this service."},security_opt:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Override the default labeling scheme for each container."},shm_size:{type:["number","string"],description:"Size of /dev/shm. A string value can use suffix like '2g' for 2 gigabytes."},secrets:{$ref:"#/$defs/service_config_or_secret",description:"Grant access to Secrets on a per-service basis."},sysctls:{$ref:"#/$defs/list_or_dict",description:"Kernel parameters to set in the container. You can use either an array or a list."},stdin_open:{type:["boolean","string"],description:"Keep STDIN open even if not attached."},stop_grace_period:{type:"string",description:"Time to wait for the container to stop gracefully before sending SIGKILL (e.g., '1s', '1m30s')."},stop_signal:{type:"string",description:"Signal to stop the container (e.g., 'SIGTERM', 'SIGINT')."},storage_opt:{type:"object",description:"Storage driver options for the container."},tmpfs:{$ref:"#/$defs/string_or_list",description:"Mount a temporary filesystem (tmpfs) into the container. Can be a single value or a list."},tty:{type:["boolean","string"],description:"Allocate a pseudo-TTY to service container."},ulimits:{$ref:"#/$defs/ulimits",description:"Override the default ulimits for a container."},use_api_socket:{type:"boolean",description:"Bind mount Docker API socket and required auth."},user:{type:"string",description:"Username or UID to run the container process as."},uts:{type:"string",description:"UTS namespace to use. 'host' shares the host's UTS namespace."},userns_mode:{type:"string",description:"User namespace to use. 'host' shares the host's user namespace."},volumes:{type:"array",description:"Mount host paths or named volumes accessible to the container. Short syntax (VOLUME:CONTAINER_PATH[:MODE])",items:{oneOf:[{type:"string"},{type:"object",required:["type"],properties:{type:{type:"string",enum:["bind","volume","tmpfs","cluster","npipe","image"],description:"The mount type: bind for mounting host directories, volume for named volumes, tmpfs for temporary filesystems, cluster for cluster volumes, npipe for named pipes, or image for mounting from an image."},source:{type:"string",description:"The source of the mount, a path on the host for a bind mount, a docker image reference for an image mount, or the name of a volume defined in the top-level volumes key. Not applicable for a tmpfs mount."},target:{type:"string",description:"The path in the container where the volume is mounted."},read_only:{type:["boolean","string"],description:"Flag to set the volume as read-only."},consistency:{type:"string",description:"The consistency requirements for the mount. Available values are platform specific."},bind:{type:"object",description:"Configuration specific to bind mounts.",properties:{propagation:{type:"string",description:"The propagation mode for the bind mount: 'shared', 'slave', 'private', 'rshared', 'rslave', or 'rprivate'."},create_host_path:{type:["boolean","string"],description:"Create the host path if it doesn't exist."},recursive:{type:"string",enum:["enabled","disabled","writable","readonly"],description:"Recursively mount the source directory."},selinux:{type:"string",enum:["z","Z"],description:"SELinux relabeling options: 'z' for shared content, 'Z' for private unshared content."}},additionalProperties:!1,patternProperties:{"^x-":{}}},volume:{type:"object",description:"Configuration specific to volume mounts.",properties:{labels:{$ref:"#/$defs/list_or_dict",description:"Labels to apply to the volume."},nocopy:{type:["boolean","string"],description:"Flag to disable copying of data from a container when a volume is created."},subpath:{type:"string",description:"Path within the volume to mount instead of the volume root."}},additionalProperties:!1,patternProperties:{"^x-":{}}},tmpfs:{type:"object",description:"Configuration specific to tmpfs mounts.",properties:{size:{oneOf:[{type:"integer",minimum:0},{type:"string"}],description:"Size of the tmpfs mount in bytes."},mode:{type:["number","string"],description:"File mode of the tmpfs in octal."}},additionalProperties:!1,patternProperties:{"^x-":{}}},image:{type:"object",description:"Configuration specific to image mounts.",properties:{subpath:{type:"string",description:"Path within the image to mount instead of the image root."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},additionalProperties:!1,patternProperties:{"^x-":{}}}]},uniqueItems:!0},volumes_from:{type:"array",items:{type:"string"},uniqueItems:!0,description:"Mount volumes from another service or container. Optionally specify read-only access (ro) or read-write (rw)."},working_dir:{type:"string",description:"The working directory in which the entrypoint or command will be run"}},patternProperties:{"^x-":{}},additionalProperties:!1},healthcheck:{type:"object",description:"Configuration options to determine whether the container is healthy.",properties:{disable:{type:["boolean","string"],description:"Disable any container-specified healthcheck. Set to true to disable."},interval:{type:"string",description:"Time between running the check (e.g., '1s', '1m30s'). Default: 30s."},retries:{type:["number","string"],description:"Number of consecutive failures needed to consider the container as unhealthy. Default: 3."},test:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"The test to perform to check container health. Can be a string or a list. The first item is either NONE, CMD, or CMD-SHELL. If it's CMD, the rest of the command is exec'd. If it's CMD-SHELL, the rest is run in the shell."},timeout:{type:"string",description:"Maximum time to allow one check to run (e.g., '1s', '1m30s'). Default: 30s."},start_period:{type:"string",description:"Start period for the container to initialize before starting health-retries countdown (e.g., '1s', '1m30s'). Default: 0s."},start_interval:{type:"string",description:"Time between running the check during the start period (e.g., '1s', '1m30s'). Default: interval value."}},additionalProperties:!1,patternProperties:{"^x-":{}}},development:{type:["object","null"],description:"Development configuration for the service, used for development workflows.",properties:{watch:{type:"array",description:"Configure watch mode for the service, which monitors file changes and performs actions in response.",items:{type:"object",required:["path","action"],properties:{ignore:{$ref:"#/$defs/string_or_list",description:"Patterns to exclude from watching."},include:{$ref:"#/$defs/string_or_list",description:"Patterns to include in watching."},path:{type:"string",description:"Path to watch for changes."},action:{type:"string",enum:["rebuild","sync","restart","sync+restart","sync+exec"],description:"Action to take when a change is detected: rebuild the container, sync files, restart the container, sync and restart, or sync and execute a command."},target:{type:"string",description:"Target path in the container for sync operations."},exec:{$ref:"#/$defs/service_hook",description:"Command to execute when a change is detected and action is sync+exec."},initial_sync:{type:"boolean",description:"Ensure that an initial synchronization is done before starting watch mode for sync+x triggers"}},additionalProperties:!1,patternProperties:{"^x-":{}}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},deployment:{type:["object","null"],description:"Deployment configuration for the service.",properties:{mode:{type:"string",description:"Deployment mode for the service: 'replicated' (default) or 'global'."},endpoint_mode:{type:"string",description:"Endpoint mode for the service: 'vip' (default) or 'dnsrr'."},replicas:{type:["integer","string"],description:"Number of replicas of the service container to run."},labels:{$ref:"#/$defs/list_or_dict",description:"Labels to apply to the service."},rollback_config:{type:"object",description:"Configuration for rolling back a service update.",properties:{parallelism:{type:["integer","string"],description:"The number of containers to rollback at a time. If set to 0, all containers rollback simultaneously."},delay:{type:"string",description:"The time to wait between each container group's rollback (e.g., '1s', '1m30s')."},failure_action:{type:"string",description:"Action to take if a rollback fails: 'continue', 'pause'."},monitor:{type:"string",description:"Duration to monitor each task for failures after it is created (e.g., '1s', '1m30s')."},max_failure_ratio:{type:["number","string"],description:"Failure rate to tolerate during a rollback."},order:{type:"string",enum:["start-first","stop-first"],description:"Order of operations during rollbacks: 'stop-first' (default) or 'start-first'."}},additionalProperties:!1,patternProperties:{"^x-":{}}},update_config:{type:"object",description:"Configuration for updating a service.",properties:{parallelism:{type:["integer","string"],description:"The number of containers to update at a time."},delay:{type:"string",description:"The time to wait between updating a group of containers (e.g., '1s', '1m30s')."},failure_action:{type:"string",description:"Action to take if an update fails: 'continue', 'pause', 'rollback'."},monitor:{type:"string",description:"Duration to monitor each updated task for failures after it is created (e.g., '1s', '1m30s')."},max_failure_ratio:{type:["number","string"],description:"Failure rate to tolerate during an update (0 to 1)."},order:{type:"string",enum:["start-first","stop-first"],description:"Order of operations during updates: 'stop-first' (default) or 'start-first'."}},additionalProperties:!1,patternProperties:{"^x-":{}}},resources:{type:"object",description:"Resource constraints and reservations for the service.",properties:{limits:{type:"object",description:"Resource limits for the service containers.",properties:{cpus:{type:["number","string"],description:"Limit for how much of the available CPU resources, as number of cores, a container can use."},memory:{type:"string",description:"Limit on the amount of memory a container can allocate (e.g., '1g', '1024m')."},pids:{type:["integer","string"],description:"Maximum number of PIDs available to the container."}},additionalProperties:!1,patternProperties:{"^x-":{}}},reservations:{type:"object",description:"Resource reservations for the service containers.",properties:{cpus:{type:["number","string"],description:"Reservation for how much of the available CPU resources, as number of cores, a container can use."},memory:{type:"string",description:"Reservation on the amount of memory a container can allocate (e.g., '1g', '1024m')."},generic_resources:{$ref:"#/$defs/generic_resources",description:"User-defined resources to reserve."},devices:{$ref:"#/$defs/devices",description:"Device reservations for the container."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},restart_policy:{type:"object",description:"Restart policy for the service containers.",properties:{condition:{type:"string",description:"Condition for restarting the container: 'none', 'on-failure', 'any'."},delay:{type:"string",description:"Delay between restart attempts (e.g., '1s', '1m30s')."},max_attempts:{type:["integer","string"],description:"Maximum number of restart attempts before giving up."},window:{type:"string",description:"Time window used to evaluate the restart policy (e.g., '1s', '1m30s')."}},additionalProperties:!1,patternProperties:{"^x-":{}}},placement:{type:"object",description:"Constraints and preferences for the platform to select a physical node to run service containers",properties:{constraints:{type:"array",items:{type:"string"},description:"Placement constraints for the service (e.g., 'node.role==manager')."},preferences:{type:"array",description:"Placement preferences for the service.",items:{type:"object",properties:{spread:{type:"string",description:"Spread tasks evenly across values of the specified node label."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},max_replicas_per_node:{type:["integer","string"],description:"Maximum number of replicas of the service."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},generic_resources:{type:"array",description:"User-defined resources for services, allowing services to reserve specialized hardware resources.",items:{type:"object",properties:{discrete_resource_spec:{type:"object",description:"Specification for discrete (countable) resources.",properties:{kind:{type:"string",description:"Type of resource (e.g., 'GPU', 'FPGA', 'SSD')."},value:{type:["number","string"],description:"Number of resources of this kind to reserve."}},additionalProperties:!1,patternProperties:{"^x-":{}}}},additionalProperties:!1,patternProperties:{"^x-":{}}}},devices:{type:"array",description:"Device reservations for containers, allowing services to access specific hardware devices.",items:{type:"object",properties:{capabilities:{$ref:"#/$defs/list_of_strings",description:"List of capabilities the device needs to have (e.g., 'gpu', 'compute', 'utility')."},count:{type:["string","integer"],description:"Number of devices of this type to reserve."},device_ids:{$ref:"#/$defs/list_of_strings",description:"List of specific device IDs to reserve."},driver:{type:"string",description:"Device driver to use (e.g., 'nvidia')."},options:{$ref:"#/$defs/list_or_dict",description:"Driver-specific options for the device."}},additionalProperties:!1,patternProperties:{"^x-":{}},required:["capabilities"]}},gpus:{oneOf:[{type:"string",enum:["all"],description:"Use all available GPUs."},{type:"array",description:"List of specific GPU devices to use.",items:{type:"object",properties:{capabilities:{$ref:"#/$defs/list_of_strings",description:"List of capabilities the GPU needs to have (e.g., 'compute', 'utility')."},count:{type:["string","integer"],description:"Number of GPUs to use."},device_ids:{$ref:"#/$defs/list_of_strings",description:"List of specific GPU device IDs to use."},driver:{type:"string",description:"GPU driver to use (e.g., 'nvidia')."},options:{$ref:"#/$defs/list_or_dict",description:"Driver-specific options for the GPU."}}},additionalProperties:!1,patternProperties:{"^x-":{}}}]},include:{description:"Compose application or sub-projects to be included.",oneOf:[{type:"string"},{type:"object",properties:{path:{$ref:"#/$defs/string_or_list",description:"Path to the Compose application or sub-project files to include."},env_file:{$ref:"#/$defs/string_or_list",description:"Path to the environment files to use to define default values when interpolating variables in the Compose files being parsed."},project_directory:{type:"string",description:"Path to resolve relative paths set in the Compose file"}},additionalProperties:!1}]},network:{type:["object","null"],description:"Network configuration for the Compose application.",properties:{name:{type:"string",description:"Custom name for this network."},driver:{type:"string",description:"Specify which driver should be used for this network. Default is 'bridge'."},driver_opts:{type:"object",description:"Specify driver-specific options defined as key/value pairs.",patternProperties:{"^.+$":{type:["string","number"]}}},ipam:{type:"object",description:"Custom IP Address Management configuration for this network.",properties:{driver:{type:"string",description:"Custom IPAM driver, instead of the default."},config:{type:"array",description:"List of IPAM configuration blocks.",items:{type:"object",properties:{subnet:{type:"string",description:"Subnet in CIDR format that represents a network segment."},ip_range:{type:"string",description:"Range of IPs from which to allocate container IPs."},gateway:{type:"string",description:"IPv4 or IPv6 gateway for the subnet."},aux_addresses:{type:"object",description:"Auxiliary IPv4 or IPv6 addresses used by Network driver.",additionalProperties:!1,patternProperties:{"^.+$":{type:"string"}}}},additionalProperties:!1,patternProperties:{"^x-":{}}}},options:{type:"object",description:"Driver-specific options for the IPAM driver.",additionalProperties:!1,patternProperties:{"^.+$":{type:"string"}}}},additionalProperties:!1,patternProperties:{"^x-":{}}},external:{type:["boolean","string","object"],description:"Specifies that this network already exists and was created outside of Compose.",properties:{name:{deprecated:!0,type:"string",description:"Specifies the name of the external network. Deprecated: use the 'name' property instead."}},additionalProperties:!1,patternProperties:{"^x-":{}}},internal:{type:["boolean","string"],description:"Create an externally isolated network."},enable_ipv4:{type:["boolean","string"],description:"Enable IPv4 networking."},enable_ipv6:{type:["boolean","string"],description:"Enable IPv6 networking."},attachable:{type:["boolean","string"],description:"If true, standalone containers can attach to this network."},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to the network using labels."}},additionalProperties:!1,patternProperties:{"^x-":{}}},volume:{type:["object","null"],description:"Volume configuration for the Compose application.",properties:{name:{type:"string",description:"Custom name for this volume."},driver:{type:"string",description:"Specify which volume driver should be used for this volume."},driver_opts:{type:"object",description:"Specify driver-specific options.",patternProperties:{"^.+$":{type:["string","number"]}}},external:{type:["boolean","string","object"],description:"Specifies that this volume already exists and was created outside of Compose.",properties:{name:{deprecated:!0,type:"string",description:"Specifies the name of the external volume. Deprecated: use the 'name' property instead."}},additionalProperties:!1,patternProperties:{"^x-":{}}},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to the volume using labels."}},additionalProperties:!1,patternProperties:{"^x-":{}}},secret:{type:"object",description:"Secret configuration for the Compose application.",properties:{name:{type:"string",description:"Custom name for this secret."},environment:{type:"string",description:"Name of an environment variable from which to get the secret value."},file:{type:"string",description:"Path to a file containing the secret value."},external:{type:["boolean","string","object"],description:"Specifies that this secret already exists and was created outside of Compose.",properties:{name:{type:"string",description:"Specifies the name of the external secret."}}},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to the secret using labels."},driver:{type:"string",description:"Specify which secret driver should be used for this secret."},driver_opts:{type:"object",description:"Specify driver-specific options.",patternProperties:{"^.+$":{type:["string","number"]}}},template_driver:{type:"string",description:"Driver to use for templating the secret's value."}},additionalProperties:!1,patternProperties:{"^x-":{}}},config:{type:"object",description:"Config configuration for the Compose application.",properties:{name:{type:"string",description:"Custom name for this config."},content:{type:"string",description:"Inline content of the config."},environment:{type:"string",description:"Name of an environment variable from which to get the config value."},file:{type:"string",description:"Path to a file containing the config value."},external:{type:["boolean","string","object"],description:"Specifies that this config already exists and was created outside of Compose.",properties:{name:{deprecated:!0,type:"string",description:"Specifies the name of the external config. Deprecated: use the 'name' property instead."}}},labels:{$ref:"#/$defs/list_or_dict",description:"Add metadata to the config using labels."},template_driver:{type:"string",description:"Driver to use for templating the config's value."}},additionalProperties:!1,patternProperties:{"^x-":{}}},model:{type:"object",description:"Language Model for the Compose application.",properties:{name:{type:"string",description:"Custom name for this model."},model:{type:"string",description:"Language Model to run."},context_size:{type:"integer"},runtime_flags:{type:"array",items:{type:"string"},description:"Raw runtime flags to pass to the inference engine."}},required:["model"],additionalProperties:!1,patternProperties:{"^x-":{}}},command:{oneOf:[{type:"null",description:"No command specified, use the container's default command."},{type:"string",description:"Command as a string, which will be executed in a shell (e.g., '/bin/sh -c')."},{type:"array",description:"Command as an array of strings, which will be executed directly without a shell.",items:{type:"string",description:"Part of the command (executable or argument)."}}],description:"Command to run in the container, which can be specified as a string (shell form) or array (exec form)."},service_hook:{type:"object",description:"Configuration for service lifecycle hooks, which are commands executed at specific points in a container's lifecycle.",properties:{command:{$ref:"#/$defs/command",description:"Command to execute as part of the hook."},user:{type:"string",description:"User to run the command as."},privileged:{type:["boolean","string"],description:"Whether to run the command with extended privileges."},working_dir:{type:"string",description:"Working directory for the command."},environment:{$ref:"#/$defs/list_or_dict",description:"Environment variables for the command."}},additionalProperties:!1,patternProperties:{"^x-":{}},required:["command"]},pre_start_hook:{type:"object",description:"Configuration for a pre_start init container, run to completion before the service container starts.",properties:{command:{$ref:"#/$defs/command",description:"Command to execute. Optional when the chosen image's entrypoint already runs the intended command."},image:{type:"string",description:"Image used for the ephemeral container. If omitted, the parent service's image is used."},user:{type:"string",description:"User to run the command as. Defaults to the user declared in image (or to the service's user when image is omitted)."},privileged:{type:["boolean","string"],description:"Whether to run the command with extended privileges."},working_dir:{type:"string",description:"Working directory for the command. Defaults to the service's working directory."},environment:{$ref:"#/$defs/list_or_dict",description:"Environment variables for the command. Appended to or overriding the service environment."},per_replica:{type:["boolean","string"],description:"Whether the hook runs once per service replica (true), or once for the service as a whole before any replica starts (false, the default)."}},additionalProperties:!1,patternProperties:{"^x-":{}}},env_file:{oneOf:[{type:"string",description:"Path to a file containing environment variables."},{type:"array",description:"List of paths to files containing environment variables.",items:{oneOf:[{type:"string",description:"Path to a file containing environment variables."},{type:"object",description:"Detailed configuration for an environment file.",additionalProperties:!1,properties:{path:{type:"string",description:"Path to the environment file."},format:{type:"string",description:"Format attribute lets you to use an alternative file formats for env_file. When not set, env_file is parsed according to Compose rules."},required:{type:["boolean","string"],default:!0,description:"Whether the file is required. If true and the file doesn't exist, an error will be raised."}},required:["path"]}]}}]},label_file:{oneOf:[{type:"string",description:"Path to a file containing Docker labels."},{type:"array",description:"List of paths to files containing Docker labels.",items:{type:"string",description:"Path to a file containing Docker labels."}}]},string_or_list:{oneOf:[{type:"string",description:"A single string value."},{$ref:"#/$defs/list_of_strings",description:"A list of string values."}],description:"Either a single string or a list of strings."},list_of_strings:{type:"array",description:"A list of unique string values.",items:{type:"string",description:"A string value in the list."},uniqueItems:!0},list_or_dict:{oneOf:[{type:"object",description:"A dictionary mapping keys to values.",patternProperties:{".+":{type:["string","number","boolean","null"],description:"Value for the key, which can be a string, number, boolean, or null."}},additionalProperties:!1},{type:"array",description:"A list of unique string values.",items:{type:"string",description:"A string value in the list."},uniqueItems:!0}],description:"Either a dictionary mapping keys to values, or a list of strings."},extra_hosts:{oneOf:[{type:"object",description:"list mapping hostnames to IP addresses.",patternProperties:{".+":{oneOf:[{type:"string",description:"IP address for the hostname."},{type:"array",description:"List of IP addresses for the hostname.",items:{type:"string",description:"IP address for the hostname."},uniqueItems:!1}]}},additionalProperties:!1},{type:"array",description:"List of host:IP mappings in the format 'hostname:IP'.",items:{type:"string",description:"Host:IP mapping in the format 'hostname:IP'."},uniqueItems:!0}],description:"Additional hostnames to be defined in the container's /etc/hosts file."},blkio_limit:{type:"object",description:"Block IO limit for a specific device.",properties:{path:{type:"string",description:"Path to the device (e.g., '/dev/sda')."},rate:{type:["integer","string"],description:"Rate limit in bytes per second or IO operations per second."}},additionalProperties:!1},blkio_weight:{type:"object",description:"Block IO weight for a specific device.",properties:{path:{type:"string",description:"Path to the device (e.g., '/dev/sda')."},weight:{type:["integer","string"],description:"Relative weight for the device, between 10 and 1000."}},additionalProperties:!1},service_config_or_secret:{type:"array",description:"Configuration for service configs or secrets, defining how they are mounted in the container.",items:{oneOf:[{type:"string",description:"Name of the config or secret to grant access to."},{type:"object",description:"Detailed configuration for a config or secret.",properties:{source:{type:"string",description:"Name of the config or secret as defined in the top-level configs or secrets section."},target:{type:"string",description:"Path in the container where the config or secret will be mounted. Defaults to /<source> for configs and /run/secrets/<source> for secrets."},uid:{type:"string",description:"UID of the file in the container. Default is 0 (root)."},gid:{type:"string",description:"GID of the file in the container. Default is 0 (root)."},mode:{type:["number","string"],description:"File permission mode inside the container, in octal. Default is 0444 for configs and 0400 for secrets."}},additionalProperties:!1,patternProperties:{"^x-":{}}}]}},ulimits:{type:"object",description:"Container ulimit options, controlling resource limits for processes inside the container.",patternProperties:{"^[a-z]+$":{oneOf:[{type:["integer","string"],description:"Single value for both soft and hard limits."},{type:"object",description:"Separate soft and hard limits.",properties:{hard:{type:["integer","string"],description:"Hard limit for the ulimit type. This is the maximum allowed value."},soft:{type:["integer","string"],description:"Soft limit for the ulimit type. This is the value that's actually enforced."}},required:["soft","hard"],additionalProperties:!1,patternProperties:{"^x-":{}}}]}}}}}});import{readdir as av}from"fs/promises";import{join as cv}from"path";var{file:uv,YAML:lv}=globalThis.Bun;function dv(){if(!To)To=Promise.resolve().then(() => (hm(),{})).then(({})=>Df(mm)).catch((e)=>{throw To=void 0,e});return To}function gm(e){return uv(e).text().then(lv.parse).then(async(t)=>(await dv()).parse(t))}async function ym(e){return(await av(e,{withFileTypes:!0})).filter((r)=>r.isFile()&&pv.has(r.name)).map((r)=>cv(e,r.name)).sort()[0]}var pv,To;var bm=_(()=>{Us();pv=new Set(["compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"])});import{AsyncLocalStorage as fv}from"async_hooks";function mv(e,t){if(e.projectConfigured)return e.project;return t.name?.trim()||e.project}async function wm(e,t){let r=process.cwd(),o=await dm(r,t),n=Oo("composeFile",()=>o.composeFile?Promise.resolve(o.composeFile):ym(r)),i=Oo("parsedCompose",async()=>{let c=await n();if(!c)throw Error("Compose file cannot be found");return gm(c)});if(!o.projectConfigured){if(await n())o.project=mv(o,await i())}let s=Oo("hookContext",async()=>{let c=await n();if(!c)throw Error("Compose file cannot be found");return fm(o,r,c)}),a=Oo("compose",async()=>{let c=await s(),u=await i();return await o.compose?.(u,c),u});return await _m.run({project:o.project,cwd:r,config:o,path:n,hookContext:s,compose:a},e)}function I(){let e=_m.getStore();if(!e)throw Error("Not in context!");return e}function Oo(e,t){let r;return()=>(r??=t().catch((o)=>{throw r=void 0,o}),r)}var _m;var ee=_(()=>{Ro();bm();_m=new fv});import{createHash as hv,randomUUID as gv}from"crypto";import{chmod as vm,mkdir as yv,readFile as bv,realpath as _v,rename as wv,writeFile as vv}from"fs/promises";import{join as xm}from"path";function Sm(){return xm(process.env.XDG_CONFIG_HOME??xm(process.env.HOME??"/tmp",".config"),"kuber","trust.json")}async function gt(e,t=process.cwd()){let r=await _v(t);return{project:e,fingerprint:hv("sha256").update(r).digest("hex")}}function xv(e){return!!e&&typeof e==="object"&&typeof e.project==="string"&&typeof e.fingerprint==="string"&&/^[a-f0-9]{64}$/.test(e.fingerprint)}async function Io(){try{let e=JSON.parse(await bv(Sm(),"utf8"));if(!e||typeof e!=="object"||e.version!==Em||!Array.isArray(e.records))return[];return e.records.filter(xv)}catch{return[]}}async function Ev(e){let t=Sm(),r=t.slice(0,t.lastIndexOf("/"));await yv(r,{recursive:!0,mode:448}),await vm(r,448);let o=`${t}.${gv()}.tmp`;await vv(o,JSON.stringify({version:Em,records:e},null,2)+`
|
|
80
|
+
`,{flag:"wx",mode:384}),await wv(o,t),await vm(t,384)}async function Xs(e){await Ev(e(await Io()))}function $m(e){return{"x-kuber-trust-project":e.project,"x-kuber-trust-fingerprint":e.fingerprint}}async function Am(e){let t=(await Io()).find((r)=>r.project===e.project&&r.fingerprint===e.fingerprint);if(t)return t;throw Error("TRUST_REQUIRED: this directory is not trusted for this namespace. Run kuber trust before kuber up.")}var Em=1;var Bo=()=>{};var yt,i0,s0,a0,c0,u0,l0,p0,d0,f0,rr,m0,h0,g0,y0,b0;var km=_(()=>{yt=globalThis.window?.document!==void 0,i0=globalThis.process?.versions?.node!==void 0,s0=globalThis.process?.versions?.bun!==void 0,a0=globalThis.Deno?.version?.deno!==void 0,c0=globalThis.process?.versions?.electron!==void 0,u0=globalThis.navigator?.userAgent?.includes("jsdom")===!0,l0=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,p0=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,d0=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,f0=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,rr=globalThis.navigator?.userAgentData?.platform,m0=rr==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",h0=rr==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",g0=rr==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",y0=rr==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),b0=rr==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android"});import bt from"process";import Sv from"os";var L="\x1B[",Pm,$v,E0,S0,zo=(e=1)=>L+e+"A",ta=(e=1)=>L+e+"B",ra,$0,A0,k0,P0,C0,R0,T0,or=(e)=>{let t="";for(let r=0;r<e;r++)t+=Cm+(r<e-1?zo():"");if(e)t+=ra;return t},Av,O0,Cm,I0,B0,ea,z0,D0,N0,kv=()=>{if(yt||!$v)return!1;let e=Sv.release().split("."),t=Number(e[0]),r=Number(e[2]??0);if(t<10)return!0;if(t===10&&r<10586)return!0;return!1},L0,V0,U0,F0,M0;var oa=_(()=>{km();Pm=!yt&&bt.env.TERM_PROGRAM==="Apple_Terminal",$v=!yt&&bt.platform==="win32",E0=!yt&&(bt.env.TERM?.startsWith("screen")||bt.env.TERM?.startsWith("tmux")||bt.env.TMUX!==void 0),S0=yt?()=>{throw Error("`process.cwd()` only works in Node.js, not the browser.")}:bt.cwd,ra=L+"G",$0=Pm?"\x1B7":L+"s",A0=Pm?"\x1B8":L+"u",k0=L+"6n",P0=L+"E",C0=L+"F",R0=L+"?25l",T0=L+"?25h",Av=L+"K",O0=L+"1K",Cm=L+"2K",I0=L+"J",B0=L+"1J",ea=L+"2J",z0=L+"S",D0=L+"T",N0=`${ea}${L}H`,L0=kv()?`${ea}${L}0f`:`${ea}${L}3J${L}H`,V0=L+"?1049h",U0=L+"?1049l",F0=L+"?2026h",M0=L+"?2026l"});var Tm=_(()=>{oa();oa()});function na(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:o}=e;for(let n of Reflect.ownKeys(t))Pv(e,t,n,r);return Rv(e,t),Bv(e,t,o),e}var Pv=(e,t,r,o)=>{if(r==="length"||r==="prototype")return;if(r==="arguments"||r==="caller")return;let n=Object.getOwnPropertyDescriptor(e,r),i=Object.getOwnPropertyDescriptor(t,r);if(!Cv(n,i)&&o)return;Object.defineProperty(e,r,i)},Cv=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Rv=(e,t)=>{let r=Object.getPrototypeOf(t);if(r===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,r)},Tv=(e,t)=>`/* Wrapped ${e}*/
|
|
81
|
+
${t}`,Ov,Iv,Bv=(e,t,r)=>{let o=r===""?"":`with ${r.trim()}() `,n=Tv.bind(null,o,t.toString());Object.defineProperty(n,"name",Iv);let{writable:i,enumerable:s,configurable:a}=Ov;Object.defineProperty(e,"toString",{value:n,writable:i,enumerable:s,configurable:a})};var Om=_(()=>{Ov=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Iv=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name")});var Do,Im=(e,t={})=>{if(typeof e!=="function")throw TypeError("Expected a function");let r,o=0,n=e.displayName||e.name||"<anonymous>",i=function(...s){if(Do.set(i,++o),o===1)r=e.apply(this,s),e=void 0;else if(t.throw===!0)throw Error(`Function \`${n}\` can only be called once`);return r};return na(i,e),Do.set(i,o),i},Bm;var zm=_(()=>{Om();Do=new WeakMap;Im.callCount=(e)=>{if(!Do.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Do.get(e)};Bm=Im});var rt;var Dm=_(()=>{rt=[];rt.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")rt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")rt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});class Nm{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(sa[ia])return sa[ia];zv(sa,ia,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let r=this.listeners[e],o=r.indexOf(t);if(o===-1)return;if(o===0&&r.length===1)r.length=0;else r.splice(o,1)}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let o=!1;for(let n of this.listeners[e])o=n(t,r)===!0||o;if(e==="exit")o=this.emit("afterExit",t,r)||o;return o}}class ca{}var No=(e)=>!!e&&typeof e==="object"&&typeof e.removeListener==="function"&&typeof e.emit==="function"&&typeof e.reallyExit==="function"&&typeof e.listeners==="function"&&typeof e.kill==="function"&&typeof e.pid==="number"&&typeof e.on==="function",ia,sa,zv,Dv=(e)=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Lm,Vm,aa,Um,H0,J0;var Fm=_(()=>{Dm();ia=Symbol.for("signal-exit emitter"),sa=globalThis,zv=Object.defineProperty.bind(Object);Lm=class Lm extends ca{onExit(){return()=>{}}load(){}unload(){}};Vm=class Vm extends ca{#t=aa.platform==="win32"?"SIGINT":"SIGHUP";#r=new Nm;#e;#o;#s;#i={};#n=!1;constructor(e){super();this.#e=e,this.#i={};for(let t of rt)this.#i[t]=()=>{let r=this.#e.listeners(t),{count:o}=this.#r,n=e;if(typeof n.__signal_exit_emitter__==="object"&&typeof n.__signal_exit_emitter__.count==="number")o+=n.__signal_exit_emitter__.count;if(r.length===o){this.unload();let i=this.#r.emit("exit",null,t),s=t==="SIGHUP"?this.#t:t;if(!i)e.kill(e.pid,s)}};this.#s=e.reallyExit,this.#o=e.emit}onExit(e,t){if(!No(this.#e))return()=>{};if(this.#n===!1)this.load();let r=t?.alwaysLast?"afterExit":"exit";return this.#r.on(r,e),()=>{if(this.#r.removeListener(r,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0)this.unload()}}load(){if(this.#n)return;this.#n=!0,this.#r.count+=1;for(let e of rt)try{let t=this.#i[e];if(t)this.#e.on(e,t)}catch(t){}this.#e.emit=(e,...t)=>this.#c(e,...t),this.#e.reallyExit=(e)=>this.#a(e)}unload(){if(!this.#n)return;this.#n=!1,rt.forEach((e)=>{let t=this.#i[e];if(!t)throw Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,t)}catch(r){}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#s,this.#r.count-=1}#a(e){if(!No(this.#e))return 0;return this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)}#c(e,...t){let r=this.#o;if(e==="exit"&&No(this.#e)){if(typeof t[0]==="number")this.#e.exitCode=t[0];let o=r.call(this.#e,e,...t);return this.#r.emit("exit",this.#e.exitCode,null),o}else return r.call(this.#e,e,...t)}};aa=globalThis.process,{onExit:Um,load:H0,unload:J0}=Dv(No(aa)?new Vm(aa):new Lm)});import Lo from"process";var Mm,Nv,jm;var Zm=_(()=>{zm();Fm();Mm=Lo.stderr.isTTY?Lo.stderr:Lo.stdout.isTTY?Lo.stdout:void 0,Nv=Mm?Bm(()=>{Um(()=>{Mm.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},jm=Nv});import qm from"process";var Vo=!1,_t,ua;var Qm=_(()=>{Zm();_t={};_t.show=(e=qm.stderr)=>{if(!e.isTTY)return;Vo=!1,e.write("\x1B[?25h")};_t.hide=(e=qm.stderr)=>{if(!e.isTTY)return;jm(),Vo=!0,e.write("\x1B[?25l")};_t.toggle=(e,t)=>{if(e!==void 0)Vo=e;if(Vo)_t.show(t);else _t.hide(t)};ua=_t});function la({onlyFirst:e=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")}function Me(e){if(typeof e!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);if(!e.includes("\x1B")&&!e.includes("\x9B"))return e;return e.replace(Lv,"")}var Lv;var Uo=_(()=>{Lv=la()});var Wm=161,Gm=1114109,Km,Hm=12288,Jm=65510,Ym,Xm=4352,eh=262141,pa;var th=_(()=>{Km=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Ym=[12288,12288,65281,65376,65504,65510],pa=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141]});var Fo=(e,t)=>{let r=0,o=Math.floor(e.length/2)-1;while(r<=o){let n=Math.floor((r+o)/2),i=n*2;if(t<e[i])o=n-1;else if(t>e[i+1])r=n+1;else return!0}return!1};function Fv(e){let t=e[0],r=e[1];for(let o=0;o<e.length;o+=2){let n=e[o],i=e[o+1];if(rh>=n&&rh<=i)return[n,i];if(i-n>r-t)t=n,r=i}return[t,r]}var rh=19968,Vv,Uv,oh=(e)=>{if(e<Wm||e>Gm)return!1;return Fo(Km,e)},nr=(e)=>{if(e<Hm||e>Jm)return!1;return Fo(Ym,e)},ir=(e)=>{if(e>=Vv&&e<=Uv)return!0;if(e<Xm||e>eh)return!1;return Fo(pa,e)};var da=_(()=>{th();[Vv,Uv]=Fv(pa)});function Mv(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function sr(e,{ambiguousAsWide:t=!1}={}){if(Mv(e),nr(e)||ir(e)||t&&oh(e))return 2;return 1}var fa=_(()=>{da();da()});function Kv(e){if(e.length>50)return!1;if(Wv.test(e))return!0;if(e.includes("\u200D")){let t=e.match(Gv);return t!==null&&t.length>=2}return!1}function Hv(e){return e.replace(Zv,"")}function Jv(e){return nh.test(e)}function ih(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function sh(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function ah(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function Yv(e){return ih(e)||sh(e)||ah(e)}function Xv(e,t){let r=[];for(let n of e){if(nh.test(n))continue;r.push(n.codePointAt(0))}if(r.length===0)return;let o=0;for(let n=0;n<r.length;n++){let i=r[n];if(!Yv(i)){if(o===0)return;for(let s=n;s<r.length;s++)o+=sr(r[s],t);return o}if(ih(i)&&sh(r[n+1])){o+=2,n+=ah(r[n+2])?2:1;continue}o+=sr(i,t)}return o}function ex(e,t){let r=0,o=!0;for(let n of e){if(o){o=!1;continue}if(qv.test(n)||n>="\uFF00"&&n<="\uFFEF")r+=sr(n.codePointAt(0),t)}return r}function Q(e,t={}){if(typeof e!=="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:o=!1}=t,n=e;if(!o&&(n.includes("\x1B")||n.includes("\x9B")))n=Me(n);if(n.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(n))return n.length;let i=0,s={ambiguousAsWide:!r};for(let{segment:a}of jv.segment(n)){if(Jv(a))continue;if(Qv.test(a)||Kv(a)){i+=2;continue}let c=Hv(a),u=Xv(c,s);if(u!==void 0){i+=u;continue}let l=c.codePointAt(0);i+=sr(l,s),i+=ex(c,s)}return i}var jv,nh,Zv,qv,Qv,Wv,Gv;var Mo=_(()=>{Uo();fa();jv=new Intl.Segmenter,nh=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v,Zv=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v,qv=/\p{Spacing_Mark}/v,Qv=/^\p{RGI_Emoji}$/v,Wv=/^[\d#*]\u20E3$/,Gv=/\p{Extended_Pictographic}/gu});function ox(){let e=new Map;for(let[t,r]of Object.entries(F)){for(let[o,n]of Object.entries(r))F[o]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[o]=F[o],e.set(n[0],n[1]);Object.defineProperty(F,t,{value:r,enumerable:!1})}return Object.defineProperty(F,"codes",{value:e,enumerable:!1}),F.color.close="\x1B[39m",F.bgColor.close="\x1B[49m",F.color.ansi=ch(),F.color.ansi256=uh(),F.color.ansi16m=lh(),F.bgColor.ansi=ch(10),F.bgColor.ansi256=uh(10),F.bgColor.ansi16m=lh(10),Object.defineProperties(F,{rgbToAnsi256:{value(t,r,o){if(t===r&&r===o){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(o/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[o]=r;if(o.length===3)o=[...o].map((i)=>i+i).join("");let n=Number.parseInt(o,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:(t)=>F.rgbToAnsi256(...F.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,o,n;if(t>=232)r=((t-232)*10+8)/255,o=r,n=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,o=Math.floor(a/6)/5,n=a%6/5}let i=Math.max(r,o,n)*2;if(i===0)return 30;let s=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(r));if(i===2)s+=60;return s},enumerable:!1},rgbToAnsi:{value:(t,r,o)=>F.ansi256ToAnsi(F.rgbToAnsi256(t,r,o)),enumerable:!1},hexToAnsi:{value:(t)=>F.ansi256ToAnsi(F.hexToAnsi256(t)),enumerable:!1}}),F}var ch=(e=0)=>(t)=>`\x1B[${t+e}m`,uh=(e=0)=>(t)=>`\x1B[${38+e};5;${t}m`,lh=(e=0)=>(t,r,o)=>`\x1B[${38+e};2;${t};${r};${o}m`,F,kR,tx,rx,PR,nx,pe;var ma=_(()=>{F={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},kR=Object.keys(F.modifier),tx=Object.keys(F.color),rx=Object.keys(F.bgColor),PR=[...tx,...rx];nx=ox(),pe=nx});function ar(e,t,r){return String(e).normalize().replaceAll(`\r
|
|
82
82
|
`,`
|
|
83
83
|
`).split(`
|
|
84
|
-
`).map((o)=>
|
|
85
|
-
`)}var ot="\x1B",
|
|
86
|
-
`),u=
|
|
87
|
-
`){if(n)o+=
|
|
88
|
-
`){let p=[...i];if(px(c.slice(l+1),p),o+=fx(p),n)o+=ah(n)}l+=d.length}return o};var ma=_(()=>{Vo();No();pa();ox=new Set([ot,fa]),Mo=`${nx}8;;`,_h=new RegExp(`^\\u001B(?:\\${dh}(?<sgr>[0-9;]*)${Fo}|${Mo}(?<uri>[^\\u0007\\u001B]*)(?:\\u0007|\\u001B\\\\))`),wh=new RegExp(`^\\u009B(?<sgr>[0-9;]*)${Fo}`),vh=new Set(pe.codes.values());vh.delete(jo);ax=new Intl.Segmenter});function Zo(e){if(!Number.isInteger(e))return!1;return or(e)||nr(e)}var Ah=_(()=>{la()});function qx(e){return e>=$x&&e<=Ax||e===kx||e===Px}function Qx(e){return e>=Cx&&e<=Rx}function Wx(e){return e>=Tx&&e<=Ox}function Gx(e){return e>=Ix&&e<=Bx}function Kx(e){return e>=zx&&e<=Dx}function be(e,t){return{token:{type:"control",code:e},endIndex:t}}function Hx(e){if(Zx.test(e))return!0;for(let t of e){let r=t.codePointAt(0);if(r===Fx||r===jx)return!0}return!1}function Uh(e){let t=0;for(let r of e){let o=r.codePointAt(0);if(Zo(o))return 2;if(Kx(o))t++}if(t>=1)return 2;if(Hx(e))return 2;return 1}function Jx(e){if(e.startsWith("\x9B"))return"\x9B";return`${wt}${va}`}function ar(e,t){return`${e}${t.join(";")}${Nh}`}function Yx(e){let t=[],r=Jx(e),o;if(e.startsWith(`${wt}${va}`))o=e.slice(2,-1);else if(e.startsWith("\x9B"))o=e.slice(1,-1);else return t;let n=o.length===0?[String(kh)]:o.split(";"),i=0;while(i<n.length){let s=Number.parseInt(n[i],10);if(Number.isNaN(s)){i++;continue}if(s===kh){t.push({type:"reset"}),i++;continue}if(s===qo||s===Nx){let u=Number.parseInt(n[i+1],10);if(u===Lx&&i+Ux<n.length){let f=ar(r,n.slice(i,i+Ph));t.push({type:"start",code:f,endCode:pe.color.ansi(s===qo?ha:ga)}),i+=Ph;continue}if(u===Vx&&i+Mx<n.length){let f=ar(r,n.slice(i,i+Ch));t.push({type:"start",code:f,endCode:pe.color.ansi(s===qo?ha:ga)}),i+=Ch;continue}let l=ar(r,[n[i]]);t.push({type:"start",code:l,endCode:pe.color.ansi(s===qo?ha:ga)}),i++;continue}if(Vh.has(s)){t.push({type:"end",endCode:pe.color.ansi(s)}),i++;continue}let a=pe.codes.get(s);if(a!==void 0){let u=ar(r,[n[i]]);t.push({type:"start",code:u,endCode:pe.color.ansi(a)}),i++;continue}let c=ar(r,[n[i]]);t.push({type:"start",code:c,endCode:pe.reset.open}),i++}if(t.length===0)t.push({type:"reset"});return t}function Xx(e,t){let r=e.codePointAt(t),o;if(r===cr){if(e[t+1]!==va)return;o=t+2}else if(r===Oh)o=t+1;else return;let n=!0;for(let i=o;i<e.length;i++){let s=e.codePointAt(i);if(Gx(s)){let c=e.slice(t,i+1);if(e[i]!==Nh||!n)return be(c,i+1);return{token:{type:"sgr",code:c,fragments:Yx(c)},endIndex:i+1}}if(Qx(s)){if(!qx(s))n=!1;continue}if(Wx(s)){n=!1;continue}let a=i;return be(e.slice(t,a),a)}return be(e.slice(t),e.length)}function eE(e,t){let r,o,n=e.codePointAt(t);if(n===cr&&e.startsWith(_a,t))r=_a,o=Ex;else if(n===Go&&e.startsWith(wa,t))r=wa,o=Sx;else return;let i=e.indexOf(";",t+r.length);if(i===-1)return be(e.slice(t),e.length);for(let s=i+1;s<e.length;s++){let a=e[s];if(a===ba){let c=e.slice(t,s+1),u=s===i+1?"close":"open";return{token:{type:"hyperlink",code:c,action:u,closePrefix:o,terminator:ba},endIndex:s+1}}if(a===wt&&e[s+1]===Qo){let c=e.slice(t,s+2),u=s===i+1?"close":"open";return{token:{type:"hyperlink",code:c,action:u,closePrefix:o,terminator:Lh},endIndex:s+2}}if(a===Wo){let c=e.slice(t,s+1),u=s===i+1?"close":"open";return{token:{type:"hyperlink",code:c,action:u,closePrefix:o,terminator:Wo},endIndex:s+1}}}return be(e.slice(t),e.length)}function tE(e,t){let r=e.codePointAt(t),o,n=!1;switch(r){case cr:{switch(e[t+1]){case Dh:{o=t+2,n=!0;break}case bx:case _x:case wx:case vx:{o=t+2;break}case Qo:return be(Lh,t+2);default:return}break}case Go:{o=t+1,n=!0;break}case Rh:case Th:case Bh:case zh:{o=t+1;break}case Ih:return be(Wo,t+1);default:return}for(let i=o;i<e.length;i++){if(n&&e[i]===ba)return be(e.slice(t,i+1),i+1);if(e[i]===wt&&e[i+1]===Qo)return be(e.slice(t,i+2),i+2);if(e[i]===Wo)return be(e.slice(t,i+1),i+1)}return be(e.slice(t),e.length)}function lr(e,t){let r=e.codePointAt(t);if(r===cr||r===Go){let n=eE(e,t);if(n)return n}let o=tE(e,t);if(o)return o;return Xx(e,t)}function Mh(e,t,r){while(t<e.length){let o=e.codePointAt(t);if(!ur.has(o))break;let n=lr(e,t);if(!n)break;r.push(n.token),t=n.endIndex}return t}function Fh(e,t,r){let o=r.containing(t);if(!o||o.index!==t)return;return{token:{type:"character",value:o.segment,visibleWidth:Uh(o.segment),isGraphemeContinuation:!1},endIndex:t+o.segment.length}}function rE(e){let t=[],r=0;while(r<e.length){let o=e.codePointAt(r);if(ur.has(o)){let i=lr(e,r);if(i){r=i.endIndex;continue}}let n=String.fromCodePoint(o);t.push({value:n,visibleWidth:1,isGraphemeContinuation:!1}),r+=n.length}return t}function oE(e){if(e.length===0)return;let t=e.map(({value:i})=>i).join(""),r=[],o=0;for(let i of e)r.push(o),o+=i.value.length;let n=0;for(let i of xa.segment(t)){while(n<e.length&&r[n]<i.index)n++;let s=n,a=!0;while(s<e.length&&r[s]<i.index+i.segment.length)e[s].visibleWidth=a?Uh(i.segment):0,e[s].isGraphemeContinuation=!a,a=!1,s++;n=s}}function ya(e,{endCharacter:t=Number.POSITIVE_INFINITY}={}){let r=[],o=rE(e);oE(o);let n=0,i=0,s=0;while(n<e.length){let a=e.codePointAt(n);if(ur.has(a)){let d=lr(e,n);if(d){r.push(d.token),n=d.endIndex;continue}}let c=String.fromCodePoint(a),u=o[i],l=Zo(a)?2:c.length;if(u)l=u.visibleWidth;let f={type:"character",value:c,visibleWidth:l,isGraphemeContinuation:u?u.isGraphemeContinuation:!1};if(r.push(f),n+=c.length,i++,s+=f.visibleWidth,s>=t){let d=o[i];if(!d||!d.isGraphemeContinuation){n=Mh(e,n,r);break}}}return r}function jh(e,t){let r=`${e}${t}`,o=e.length;for(let n of xa.segment(r)){if(n.index===o)return!1;if(n.index>o)return!0}return!0}function nE(e,t,r,o){if(!r)return!1;let n=t,i=!1;while(n<e.length){let s=e.codePointAt(n);if(ur.has(s)){let c=lr(e,n);if(c){i=!0,n=c.endIndex;continue}}if(!i)return!1;let a=Fh(e,n,o);if(!a)return!0;return jh(r,a.token.value)}return!1}function Ea(e,{endCharacter:t=Number.POSITIVE_INFINITY}={}){let r=[],o=xa.segment(e),n=0,i=0,s,a=!1;while(n<e.length){let c=e.codePointAt(n);if(ur.has(c)){let l=lr(e,n);if(l){r.push(l.token),n=l.endIndex,a=!0;continue}}let u=Fh(e,n,o);if(!u)return ya(e,{endCharacter:t});if(a&&s&&jh(s,u.token.value))return ya(e,{endCharacter:t});if(r.push(u.token),n=u.endIndex,i+=u.token.visibleWidth,a=!1,s=u.token.value,i>=t){if(nE(e,n,s,o))return ya(e,{endCharacter:t});n=Mh(e,n,r);break}}return r}var cr=27,Rh=144,Th=152,Oh=155,Ih=156,Go=157,Bh=158,zh=159,ur,wt="\x1B",ba="\x07",va="[",Dh="]",bx="P",_x="X",wx="^",vx="_",Nh="m",Qo="\\",Lh,xx="\x9D",Wo="\x9C",_a,wa,Ex,Sx,$x,Ax,kx,Px,Cx,Rx,Tx,Ox,Ix,Bx,zx=127462,Dx=127487,kh=0,qo=38,ha=39,Nx=48,ga=49,Lx=5,Vx=2,Ph=3,Ch=5,Ux=2,Mx=4,Fx=65039,jx=8419,Zx,xa,Vh;var Zh=_(()=>{pa();Ah();ur=new Set([cr,Rh,Th,Oh,Ih,Go,Bh,zh]),Lh=`${wt}${Qo}`,_a=`${wt}${Dh}8;`,wa=`${xx}8;`,Ex=`${_a};`,Sx=`${wa};`,$x="0".codePointAt(0),Ax="9".codePointAt(0),kx=";".codePointAt(0),Px=":".codePointAt(0),Cx="0".codePointAt(0),Rx="?".codePointAt(0),Tx=" ".codePointAt(0),Ox="/".codePointAt(0),Ix="@".codePointAt(0),Bx="~".codePointAt(0),Zx=/\p{Emoji_Presentation}/v,xa=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Vh=new Set;for(let[,e]of pe.codes)Vh.add(e)});function iE(e,t){for(let r of t)switch(r.type){case"reset":{e.clear();break}case"end":{e.delete(r.endCode);break}case"start":{e.delete(r.endCode),e.set(r.endCode,r.code);break}default:break}return e}function sE(e){return[...e.keys()].toReversed().join("")}function aE(e){return`${e.closePrefix}${e.terminator}`}function cE(e,t){let r=!1,o=!1;for(let n of e.fragments){if(n.type==="start"){r=!0;continue}if(n.type==="reset"&&t.size>0){o=!0;continue}if(n.type==="end"&&t.has(n.endCode))o=!0}return o&&!r}function uE(e){return e.fragments.some((t)=>t.type==="start")}function qh(e){if(e.activeHyperlink&&!e.activeHyperlinkHasVisibleText&&e.activeHyperlinkOutputIndex!==void 0){let t=e.activeHyperlink.code.length;if(e.returnValue=e.returnValue.slice(0,e.activeHyperlinkOutputIndex)+e.returnValue.slice(e.activeHyperlinkOutputIndex+t),e.pendingSgrOutputIndex!==void 0&&e.pendingSgrOutputIndex>e.activeHyperlinkOutputIndex)e.pendingSgrOutputIndex-=t}e.activeHyperlink=void 0,e.activeHyperlinkHasVisibleText=!1,e.activeHyperlinkOutputIndex=void 0}function lE(e){if(e.isPastEnd&&!cE(e.token,e.activeStyles))return e;if(e.include&&uE(e.token)&&e.pendingSgrOutputIndex===void 0)e.pendingSgrOutputIndex=e.returnValue.length,e.pendingSgrActiveStyles=new Map(e.activeStyles);if(e.activeStyles=iE(e.activeStyles,e.token.fragments),e.include)e.returnValue+=e.token.code;return e}function pE(e){if(e.isPastEnd&&(e.token.action!=="close"||!e.activeHyperlink))return e;if(e.token.action==="open"){if(e.activeHyperlink=e.token,e.activeHyperlinkHasVisibleText=!1,e.activeHyperlinkOutputIndex=void 0,e.include)e.activeHyperlinkOutputIndex=e.returnValue.length}else if(e.token.action==="close"){if(e.include&&e.activeHyperlink&&!e.activeHyperlinkHasVisibleText)return qh(e),e;e.activeHyperlink=void 0,e.activeHyperlinkHasVisibleText=!1,e.activeHyperlinkOutputIndex=void 0}if(e.include)e.returnValue+=e.token.code;return e}function dE(e){if(!e.isPastEnd&&e.include)e.returnValue+=e.token.code;return e}function fE(e){if(!e.include&&e.position>=e.start&&!e.token.isGraphemeContinuation){if(e.include=!0,e.returnValue=[...e.activeStyles.values()].join(""),e.activeHyperlink)e.activeHyperlinkOutputIndex=e.returnValue.length,e.returnValue+=e.activeHyperlink.code}if(e.include){if(e.returnValue+=e.token.value,e.pendingSgrOutputIndex=void 0,e.pendingSgrActiveStyles=void 0,e.activeHyperlink)e.activeHyperlinkHasVisibleText=!0}return e.position+=e.token.visibleWidth,e}function hE(e){let t=mE[e.token.type];if(!t)return e;return t(e)}function gE(e){let t=Array.from({length:e.length},()=>!1),r=!1;for(let o=e.length-1;o>=0;o--){let n=e[o];if(t[o]=r,n.type==="character")r=Boolean(n.isGraphemeContinuation)}return t}function yE(e,t,r){if(r===void 0)return!1;if(t>=r)return!0;return e.type==="character"&&!e.isGraphemeContinuation&&t+e.visibleWidth>r}function oe(e,t,r){let o=Ea(e,{endCharacter:r}),n=gE(o),i=new Map,s,a=!1,c,u,l,f=0,d="",p=!1;for(let[h,m]of o.entries()){let y=yE(m,f,r);if(y&&m.type!=="character"&&n[h])y=!1;if(y&&m.type==="character"&&!m.isGraphemeContinuation){if(s&&!a){let b={activeHyperlink:s,activeHyperlinkHasVisibleText:a,activeHyperlinkOutputIndex:c,pendingSgrOutputIndex:u,returnValue:d};qh(b),{activeHyperlink:s,activeHyperlinkHasVisibleText:a,activeHyperlinkOutputIndex:c,pendingSgrOutputIndex:u,returnValue:d}=b}if(u!==void 0)d=d.slice(0,u),i=l,u=void 0,l=void 0;break}({activeStyles:i,activeHyperlink:s,activeHyperlinkHasVisibleText:a,activeHyperlinkOutputIndex:c,pendingSgrOutputIndex:u,pendingSgrActiveStyles:l,position:f,returnValue:d,include:p}=hE({token:m,isPastEnd:y,start:t,activeStyles:i,activeHyperlink:s,activeHyperlinkHasVisibleText:a,activeHyperlinkOutputIndex:c,pendingSgrOutputIndex:u,pendingSgrActiveStyles:l,position:f,returnValue:d,include:p}))}if(!p)return"";if(s)d+=aE(s);return d+=sE(i),d}var mE;var Sa=_(()=>{Zh();mE={sgr:lE,hyperlink:pE,control:dE,character:fE}});import Qh from"process";function Ho(e,{showCursor:t=!1,defaultWidth:r,defaultHeight:o}={}){let n=0,i=Ko(e,r),s="",a=e.isTTY===!0,c=(d)=>{if(d==="")return;if(a){e.write(bE+d+_E);return}e.write(d)},u=(d,p,h=!0)=>{let m=String(d),y=m.endsWith(`
|
|
89
|
-
`)?
|
|
90
|
-
`,b=
|
|
91
|
-
`);return{wrapped:S,lines:A,wasClipped:x}},l=()=>{s="",i=
|
|
92
|
-
`),{start:S,endPrevious:x,endNext:A}=
|
|
93
|
-
`)});c(R),s=
|
|
94
|
-
`).length
|
|
95
|
-
`).length},
|
|
96
|
-
`),s=Math.max(0,i.length-o);if(s===0)return{text:t,wasClipped:!1};let a=0;for(let l=0;l<s;l++)a+=Q(i[l])+1;let c=oe(t,a),u
|
|
97
|
-
`),y=i&&o<n.length-1&&!
|
|
98
|
-
`);if(s+=
|
|
99
|
-
`,f++}let d=t+f,h=n.length-1-d;if(h>0)s+=Ys(h);if(h<0)s+=Oo(-h);return s},FR,jR;var Wh=_(()=>{Am();Mm();ma();Sa();No();Vo();FR=Ho(Qh.stdout),jR=Ho(Qh.stderr)});function Jo(e,t,r){if(e.charAt(t)===" ")return t;let o=r?1:-1;for(let n=0;n<=3;n++){let i=t+n*o;if(e.charAt(i)===" ")return i}return t}function $E(e,t,r,o){if(typeof e!=="string")throw TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof t!=="number")throw TypeError(`Expected \`columns\` to be a number, got ${typeof t}`);if(!Number.isFinite(t))throw TypeError(`Expected \`columns\` to be a finite number, got ${t}`);if(!SE.has(r))throw TypeError(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${r}`);if(typeof o!=="string")throw TypeError(`Expected \`options.truncationCharacter\` to be a string, got ${typeof o}`)}function Aa(e,t,r={}){let{position:o="end",space:n=!1,preferTruncationOnSpace:i=!1}=r,{truncationCharacter:s="\u2026"}=r;if($E(e,t,o,s),t<1)return"";let a=Q(e);if(a<=t)return e;if(t===1)return s;let c={ESC:27,LEFT_BRACKET:91,LETTER_M:109},u=(h)=>h>=48&&h<=57||h===59;function l(h){let m=0;while(m+2<h.length&&h.codePointAt(m)===c.ESC&&h.codePointAt(m+1)===c.LEFT_BRACKET){let y=m+2;while(y<h.length&&u(h.codePointAt(y)))y++;if(y<h.length&&h.codePointAt(y)===c.LETTER_M){m=y+1;continue}break}return m}function f(h){let m=h.length;while(m>1&&h.codePointAt(m-1)===c.LETTER_M){let y=m-2;while(y>=0&&u(h.codePointAt(y)))y--;if(y>=1&&h.codePointAt(y-1)===c.ESC&&h.codePointAt(y)===c.LEFT_BRACKET){m=y-1;continue}break}return m}function d(h,m){let y=f(h);if(y===h.length)return h+m;return h.slice(0,y)+m+h.slice(y)}function p(h,m){let y=l(m);if(y===0)return h+m;return m.slice(0,y)+h+m.slice(y)}if(o==="start"){if(i){let m=Jo(e,a-t+Q(s),!0),y=oe(e,m,a).trim();return p(s,y)}if(n)s+=" ";let h=oe(e,a-t+Q(s),a);return p(s,h)}if(o==="middle"){if(n){if(s=` ${s} `,Q(s)>=t)s=s.trim()}let h=Q(s),m=Math.min(Math.floor(t/2),Math.max(0,t-h));if(i){let y=Jo(e,m),b=Jo(e,a-(t-m)+h,!0);return oe(e,0,y)+s+oe(e,b,a).trim()}return oe(e,0,m)+s+oe(e,a-(t-m)+h,a)}if(o==="end"){if(i){let m=Jo(e,t-Q(s)),y=oe(e,0,m);return d(y,s)}if(n)s=` ${s}`;let h=oe(e,0,t-Q(s));return d(h,s)}}var SE;var Gh=_(()=>{Sa();Vo();SE=new Set(["start","middle","end"])});import AE,{setMaxListeners as kE}from"events";import{inspect as PE,styleText as CE}from"util";import{format as RE}from"util";import{EOL as Se}from"os";import{StringDecoder as TE}from"string_decoder";import{Writable as OE}from"stream";import{randomUUID as IE}from"crypto";function NE(e){return!!e&&typeof e==="object"&&typeof e.subscribe==="function"}function LE(e){return!!e&&typeof e==="object"&&e.readable===!0&&typeof e.read==="function"&&typeof e.on==="function"}function rg(){return!!process.env.LISTR_FORCE_UNICODE||process.platform!=="win32"||!!process.env.CI||!!process.env.WT_SESSION||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}function dr(e){return String(e).replace(new RegExp(VE,"gmi"),"").trim()}function Jh(e,t){return e.replace(/^(?!\s*$)/gm," ".repeat(t))}function pr(e,...t){return RE(String(e),...t)}function FE(e){let t=new OE;return t.rows=1/0,t.columns=1/0,t.write=(r)=>(e(r.toString()),!0),t}function ZE(e){let t=Math.floor(e/1000),r=Math.floor(t/60),o;if(t===0&&r===0)o=`0.${Math.floor(e/100)}s`;if(t>0)o=`${t%60}s`;if(r>0)o=`${r}m${o}`;return o}function JE(e){return process.stdout.isTTY===!0||e.nonTTY===!0}function Yo(e){if(typeof e==="string")return ka[e]??ka.default;return typeof e==="function"?e:ka.default}function YE(e){if(vt(e?.silentRendererCondition))return{renderer:Yo("silent"),selection:"SILENT"};let t={renderer:Yo(e.renderer),options:e.rendererOptions,selection:"PRIMARY"};if(!JE(t.renderer)||vt(e?.fallbackRendererCondition))return{renderer:Yo(e.fallbackRenderer),options:e.fallbackRendererOptions,selection:"SECONDARY"};return t}function vt(e,...t){if(typeof e==="function")return e(...t);else return e}function eS(e){return new Promise((t)=>{setTimeout(t,e)})}var Kh,BE,tg=class{emitter=new AE;constructor(){this.emitter.setMaxListeners(0)}emit(e,t){this.emitter.emit(e,t)}on(e,t){if(!t)return;this.emitter.addListener(e,t)}once(e,t){if(!t)return;this.emitter.once(e,t)}off(e,t){if(t)this.emitter.off(e,t);else this.emitter.removeAllListeners(e)}complete(){this.emitter.removeAllListeners()}},zE,Hh,DE,VE="(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+",O,og,UE,V,Xo,ng,en=class{options;process;constructor(e){this.options=e,this.options={useIcons:!0,toStderr:[],...e??{}},this.options.fields??={},this.options.fields.prefix??=[],this.options.fields.suffix??=[],this.process=this.options.processOutput??new ME}log(e,t,r){let o=this.format(e,t,r);if(this.options.toStderr.includes(e)){this.process.toStderr(o);return}this.process.toStdout(o)}toStdout(e,t,r=!0){this.process.toStdout(this.format(null,e,t),r)}toStderr(e,t,r=!0){this.process.toStderr(this.format(null,e,t),r)}wrap(e,t){if(!e)return e;return this.applyFormat(`[${e}]`,t)}splat(...e){let t=e.shift()??"";return e.length===0?t:pr(t,e)}suffix(e,...t){return t.filter(Boolean).forEach((r)=>{if(e+=this.spacing(e),typeof r==="string")e+=this.wrap(r);else if(typeof r==="object"){if(r.args??=[],typeof r.condition==="function"?!r.condition(...r.args):!(r.condition??!0))return e;e+=this.wrap(typeof r.field==="function"?r.field(...r.args):r.field,{format:r?.format(...r.args)})}}),e}prefix(e,...t){return t.filter(Boolean).forEach((r)=>{if(e=this.spacing(e)+e,typeof r==="string")e=this.wrap(r)+e;else if(typeof r==="object"){if(r.args??=[],typeof r.condition==="function"?!r.condition(...r.args):!(r.condition??!0))return e;e=this.wrap(typeof r.field==="function"?r.field(...r.args):r.field,{format:r?.format()})+e}}),e}fields(e,t){if(this.options?.fields?.prefix)e=this.prefix(e,...this.options.fields.prefix);if(t?.prefix)e=this.prefix(e,...t.prefix);if(t?.suffix)e=this.suffix(e,...t.suffix);if(this.options?.fields?.suffix)e=this.suffix(e,...this.options.fields.suffix);return e}icon(e,t){if(!e)return null;if(!t){let o=this.options.icon?.[e];t=typeof o==="function"?o():o}let r=this.options.color?.[e];if(t&&r)t=r(t);return t}format(e,t,r){if(!Array.isArray(t))t=[t];return t=this.splat(t.shift(),...t).toString().split(Se).filter((o)=>!o||o.trim()!=="").map((o)=>this.style(e,this.fields(o,{prefix:Array.isArray(r?.prefix)?r.prefix:[r?.prefix],suffix:Array.isArray(r?.suffix)?r.suffix:[r?.suffix]}))).join(Se),t}style(e,t){if(!e||!t)return t;let r=this.icon(e,!this.options.useIcons&&this.wrap(e));if(r)t=r+" "+t;return t}applyFormat(e,t){if(t?.format)return t.format(e);return e}spacing(e){return typeof e>"u"||e.trim()===""?"":" "}},Pa=class{options;buffer=[];decoder=new TE;constructor(e){this.options=e}get all(){return this.buffer}get last(){return this.buffer.at(-1)}get length(){return this.buffer.length}write(e,...t){let r=t[t.length-1];if(this.buffer.push({time:Date.now(),stream:this.options?.stream,entry:this.decoder.write(typeof e==="string"?Buffer.from(e,typeof t[0]==="string"?t[0]:void 0):Buffer.from(e))}),this.options?.limit)this.buffer=this.buffer.slice(-this.options.limit);if(typeof r==="function")r();return!0}reset(){this.buffer=[]}},Yh=class{stream;method;buffer;constructor(e){this.stream=e,this.method=e.write,this.buffer=new Pa({stream:e})}get out(){let e=this;return new Proxy(this.stream,{get(t,r,o){if(r==="write")return e.write.bind(e);return Reflect.get(t,r,o)}})}hijack(){this.stream.write=this.buffer.write.bind(this.buffer)}release(){this.stream.write=this.method;let e=[...this.buffer.all];return this.buffer.reset(),e}write(...e){return this.method.apply(this.stream,e)}},ME=class{options;stream;active;constructor(e,t,r){this.options=r,this.stream={stdout:new Yh(e??process.stdout),stderr:new Yh(t??process.stderr)},this.options={dump:["stdout","stderr"],leaveEmptyLine:!0,...r}}get stdout(){return this.stream.stdout.out}get stderr(){return this.stream.stderr.out}hijack(){if(this.active)throw Error("ProcessOutput has been already hijacked!");this.stream.stdout.write(Kh.CURSOR_HIDE),Object.values(this.stream).forEach((e)=>e.hijack()),this.active=!0}release(){let e=Object.entries(this.stream).map(([t,r])=>({name:t,buffer:r.release()})).filter((t)=>this.options.dump.includes(t.name)).flatMap((t)=>t.buffer).sort((t,r)=>t.time-r.time).map((t)=>({...t,entry:dr(t.entry)})).filter((t)=>t.entry);if(e.length>0){if(this.options.leaveEmptyLine)this.stdout.write(Se);e.forEach((t)=>{(t.stream??this.stdout).write(t.entry+Se)})}this.stream.stdout.write(Kh.CURSOR_SHOW),this.active=!1}toStdout(e,t=!0){if(t)e=e+Se;return this.stream.stdout.write(e)}toStderr(e,t=!0){if(t)e=e+Se;return this.stream.stderr.write(e)}},jE=class{spinner=!rg()?["-","\\","|","/"]:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];id;spinnerPosition=0;spin(){this.spinnerPosition=++this.spinnerPosition%this.spinner.length}fetch(){return this.spinner[this.spinnerPosition]}isRunning(){return!!this.id}start(e,t=100){this.id=setInterval(()=>{if(this.spin(),e)e()},t)}stop(){clearInterval(this.id),this.id=void 0}},Xh,Ca,qE,QE=class{tasks;options;static nonTTY=!0;static rendererOptions;static rendererTaskOptions;constructor(e,t){this.tasks=e,this.options=t}render(){}end(){}},WE,GE=class{options;constructor(e){this.options=e}serialize(e,t,r){return JSON.stringify(this.generate(e,t,r))}generate(e,t,r){let o={event:e,data:t};if(typeof this.options?.task!=="boolean"){let n=Object.fromEntries(this.options.task.map((i)=>{let s=r[i];if(typeof s==="function")return[i,s.call(r)];return[i,s]}));if(Object.keys(r).length>0)o.task=n}return o}},KE,HE,ka,XE=class{concurrency;count;queue;constructor(e){this.concurrency=e.concurrency,this.count=0,this.queue=new Set}add(e){if(this.count<this.concurrency)return this.run(e);return new Promise((t)=>{let r=()=>t(this.run(e));this.queue.add(r)})}flush(){for(let e of this.queue){if(this.count>=this.concurrency)break;this.queue.delete(e),e()}}run(e){this.count++;let t=e(),r=()=>{this.count--,this.flush()};return t.then(r,()=>{this.queue.clear()}),t}},tS=class{task;constructor(e){this.task=e}get title(){return this.task.title}set title(e){e=Array.isArray(e)?e:[e],this.task.title$=pr(e.shift(),...e)}get output(){return this.task.output}set output(e){if(e===null){this.task.outputReset$=null;return}e=Array.isArray(e)?e:[e],this.task.output$=pr(e.shift(),...e)}set promptOutput(e){this.task.promptOutput$=e}get signal(){return this.task.listr.signal}cancel(){this.task.listr.cancel()}newListr(e,t){let r;if(typeof e==="function")r=e(this);else r=e;return new de(r,t,this.task)}report(e,t){if(this.task.options.collectErrors)this.task.listr.errors?.push(new zE(e,t,this.task));this.task.message$={error:e.message??this.task?.title}}skip(e,...t){if(this.task.state$="SKIPPED",e)this.task.message$={skip:e?pr(e,...t):this.task?.title}}isRetrying(){return this.task.isRetrying()?this.task.retry:{count:0}}prompt(e){if(this.task.prompt)return this.task.prompt;return new e(this.task,this)}stdout(e){return FE((t)=>{switch(e){case"PROMPT":this.promptOutput=t;break;default:this.output=t}})}run(e){return this.task.run(e,this)}},rS,oS,eg,de=class{task;options;parentTask;tasks=[];errors;ctx;events;path=[];rendererClass;rendererClassOptions;rendererSelection;boundSignalHandler;signal;concurrency;renderer;abortController;startedTasks=[];constructor(e,t,r){if(this.task=e,this.options=t,this.parentTask=r,this.options={concurrent:!1,renderer:"default",fallbackRenderer:"simple",exitOnError:!0,exitAfterRollback:!0,collectErrors:!1,registerSignalListeners:!0,...this.parentTask?.options??{},...t},this.options.concurrent===!0)this.options.concurrent=1/0;else if(typeof this.options.concurrent!=="number")this.options.concurrent=1;if(this.concurrency=new XE({concurrency:this.options.concurrent}),r)this.path=[...r.listr.path,r.title],this.errors=r.listr.errors;else this.errors=this.options.collectErrors?[]:null;if(this.parentTask?.listr.events instanceof eg)this.events=this.parentTask.listr.events;else this.events=new eg;if(this.parentTask?.listr.abortController instanceof AbortController)this.abortController=this.parentTask.listr.abortController;else this.abortController=new AbortController,kE(0,this.abortController.signal);if(this.signal=this.abortController.signal,this.options?.forceTTY||process.env.LISTR_FORCE_TTY)process.stdout.isTTY=!0,process.stderr.isTTY=!0;if(this.options?.forceUnicode)process.env.LISTR_FORCE_UNICODE="1";let o=YE({renderer:this.options.renderer,rendererOptions:this.options.rendererOptions,fallbackRenderer:this.options.fallbackRenderer,fallbackRendererOptions:this.options.fallbackRendererOptions,fallbackRendererCondition:this.options?.fallbackRendererCondition,silentRendererCondition:this.options?.silentRendererCondition});if(this.rendererClass=o.renderer,this.rendererClassOptions=o.options,this.rendererSelection=o.selection,this.add(e??[]),this.options.registerSignalListeners&&this.isRoot())this.boundSignalHandler=this.signalHandler.bind(this),process.on("SIGINT",this.boundSignalHandler).setMaxListeners(0)}isRoot(){return!this.parentTask}isSubtask(){return!!this.parentTask}add(e){this.tasks.push(...this.generate(e))}async run(e){if(!this.renderer)this.renderer=new this.rendererClass(this.tasks,this.rendererClassOptions,this.events);await this.renderer.render(),this.ctx=this.options?.ctx??e??{};let t,r=!1;try{await Promise.all(this.tasks.map((o)=>o.check(this.ctx))),await Promise.all(this.tasks.map((o)=>this.concurrency.add(()=>this.runTask(o))))}catch(o){r=!0,t=o}if(this.signal.aborted){if(await Promise.allSettled(this.startedTasks),this.isRoot())return this.cancelUnfinishedTasks(),this.renderer.end(),this.removeSignalHandler(),process.exit(127),this.ctx;throw t??Error("Interrupted.")}if(r&&this.options.exitOnError!==!1)throw this.renderer.end(t),this.removeSignalHandler(),t;if(!r)this.renderer.end(),this.removeSignalHandler();return this.ctx}cancel(){this.abortController.abort()}generate(e){return e=Array.isArray(e)?e:[e],e.map((t)=>{let r;if(this.rendererSelection==="PRIMARY")r=t.rendererOptions;else if(this.rendererSelection==="SECONDARY")r=t.fallbackRendererOptions;return new oS(this,t,this.options,this.rendererClassOptions,r)})}async runTask(e){if(!await e.check(this.ctx))return;let t=new tS(e).run(this.ctx);return this.startedTasks.push(t),t}signalHandler(){this.abortController.abort()}removeSignalHandler(){if(this.boundSignalHandler)process.removeListener("SIGINT",this.boundSignalHandler)}cancelUnfinishedTasks(e=this.tasks){for(let t of e){if(t.hasSubtasks())this.cancelUnfinishedTasks(t.subtasks);if(t.isEnabled()!==!1&&!t.hasFinalized())t.state$="CANCELLED"}}};var xt=_(()=>{Kh={CURSOR_HIDE:"\x1B[?25l",CURSOR_SHOW:"\x1B[?25h"},BE=function(e){return e.WAITING="WAITING",e.STARTED="STARTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.SKIPPED="SKIPPED",e.ROLLING_BACK="ROLLING_BACK",e.ROLLED_BACK="ROLLED_BACK",e.RETRY="RETRY",e.PAUSED="PAUSED",e.PROMPT="PROMPT",e.PROMPT_COMPLETED="PROMPT_COMPLETED",e.PROMPT_FAILED="PROMPT_FAILED",e.CANCELLED="CANCELLED",e}({}),zE=class extends Error{error;type;task;path;constructor(e,t,r){super(e.message);this.error=e,this.type=t,this.task=r,this.name="ListrError",this.path=r.path,this.stack=e?.stack}},Hh=class extends Error{},DE=class extends Error{};O=Object.fromEntries(Object.keys(PE.colors).map((e)=>[e,(t)=>CE(e,String(t))]));og={warning:"\u26A0",cross:"\u2716",arrowDown:"\u2193",tick:"\u2714",arrowRight:"\u2192",pointer:"\u276F",checkboxOn:"\u2612",arrowLeft:"\u2190",squareSmallFilled:"\u25FC",pointerSmall:"\u203A",circleSlash:"\u2298"},UE={...og,warning:"\u203C",cross:"\xD7",tick:"\u221A",pointer:">",checkboxOn:"[\xD7]",squareSmallFilled:"\u25A0",circleSlash:"\xF8"},V=rg()?og:UE;Xo={icon:{["STARTED"]:V.pointer,["FAILED"]:V.cross,["SKIPPED"]:V.arrowDown,["COMPLETED"]:V.tick,["OUTPUT"]:V.pointerSmall,["TITLE"]:V.arrowRight,["RETRY"]:V.warning,["ROLLBACK"]:V.arrowLeft,["PAUSED"]:V.squareSmallFilled,["CANCELLED"]:V.circleSlash},color:{["STARTED"]:O.yellow,["FAILED"]:O.red,["SKIPPED"]:O.yellow,["COMPLETED"]:O.green,["RETRY"]:O.yellowBright,["ROLLBACK"]:O.redBright,["PAUSED"]:O.yellowBright,["CANCELLED"]:O.red}},ng=["RETRY","ROLLBACK","FAILED"];Xh={icon:{["SKIPPED_WITH_COLLAPSE"]:V.arrowDown,["SKIPPED_WITHOUT_COLLAPSE"]:V.warning,["OUTPUT"]:V.pointerSmall,["OUTPUT_WITH_BOTTOMBAR"]:V.pointerSmall,["PENDING"]:V.pointer,["COMPLETED"]:V.tick,["COMPLETED_WITH_FAILED_SUBTASKS"]:V.warning,["COMPLETED_WITH_SISTER_TASKS_FAILED"]:V.squareSmallFilled,["RETRY"]:V.warning,["ROLLING_BACK"]:V.warning,["ROLLED_BACK"]:V.arrowLeft,["FAILED"]:V.cross,["FAILED_WITH_SUBTASKS"]:V.pointer,["WAITING"]:V.squareSmallFilled,["PAUSED"]:V.squareSmallFilled,["CANCELLED"]:V.circleSlash},color:{["SKIPPED_WITH_COLLAPSE"]:O.yellow,["SKIPPED_WITHOUT_COLLAPSE"]:O.yellow,["PENDING"]:O.yellow,["COMPLETED"]:O.green,["COMPLETED_WITH_FAILED_SUBTASKS"]:O.yellow,["COMPLETED_WITH_SISTER_TASKS_FAILED"]:O.red,["RETRY"]:O.yellowBright,["ROLLING_BACK"]:O.redBright,["ROLLED_BACK"]:O.redBright,["FAILED"]:O.red,["FAILED_WITH_SUBTASKS"]:O.red,["WAITING"]:O.dim,["PAUSED"]:O.yellowBright,["CANCELLED"]:O.red}};Ca={condition:!0,field:ZE,format:()=>O.dim},qE=class e{tasks;options;events;static nonTTY=!1;static rendererOptions={indentation:2,clearOutput:!1,showSubtasks:!0,collapseSubtasks:!0,collapseSkips:!0,showSkipMessage:!0,suffixSkips:!1,collapseErrors:!0,showErrorMessage:!0,suffixRetries:!0,lazy:!1,removeEmptyLines:!0,formatOutput:"wrap",pausedTimer:{...Ca,format:()=>O.yellowBright}};static rendererTaskOptions={outputBar:!0};prompt;activePrompt;spinner;logger;updater;truncate;wrap;buffer={output:new Map,bottom:new Map};cache={render:new Map,rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r,o){this.tasks=t,this.options=r,this.events=o,this.options={...e.rendererOptions,...this.options,icon:{...Xh.icon,...r?.icon??{}},color:{...Xh.color,...r?.color??{}}},this.spinner=this.options.spinner??new jE,this.logger=this.options.logger??new en({useIcons:!0,toStderr:[]}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color}async render(){await Promise.resolve().then(() => Wh());await Promise.resolve().then(() => Gh());await Promise.resolve().then(() => ma());if(this.updater=Ho(this.logger.process.stdout),this.truncate=Aa,this.wrap=sr,this.logger.process.hijack(),!this.options?.lazy)this.spinner.start(()=>{this.update()});this.events.on("SHOUD_REFRESH_RENDER",this.refresh)}update(){this.updater(this.create())}end(){if(this.spinner.stop(),this.events.off("SHOUD_REFRESH_RENDER",this.refresh),this.updater.clear(),this.updater.done(),!this.options.clearOutput)this.logger.process.toStdout(this.create({prompt:!1}));this.logger.process.release()}create(t){t={tasks:!0,bottomBar:!0,prompt:!0,...t};let r=[],o=this.renderer(this.tasks),n=this.renderBottomBar(),i=this.renderPrompt();if(t.tasks&&o.length>0)r.push(...o);if(t.bottomBar&&n.length>0){if(r.length>0)r.push("");r.push(...n)}if(t.prompt&&i.length>0){if(r.length>0)r.push("");r.push(...i)}return r.join(Se)}style(t,r=!1){let o=this.cache.rendererOptions.get(t.id);if(t.isSkipped()){if(r||o.collapseSkips)return this.logger.icon("SKIPPED_WITH_COLLAPSE");else if(o.collapseSkips===!1)return this.logger.icon("SKIPPED_WITHOUT_COLLAPSE")}if(r){if(this.shouldOutputToBottomBar(t))return this.logger.icon("OUTPUT_WITH_BOTTOMBAR");return this.logger.icon("OUTPUT")}if(t.hasSubtasks()){if(t.isStarted()||t.isPrompt()&&o.showSubtasks!==!1&&!t.subtasks.every((n)=>!n.hasTitle()))return this.logger.icon("PENDING");else if(t.isCompleted()&&t.subtasks.some((n)=>n.hasFailed()))return this.logger.icon("COMPLETED_WITH_FAILED_SUBTASKS");else if(t.hasFailed())return this.logger.icon("FAILED_WITH_SUBTASKS")}if(t.isStarted()||t.isPrompt())return this.logger.icon("PENDING",!this.options?.lazy&&this.spinner.fetch());else if(t.isCompleted())return this.logger.icon("COMPLETED");else if(t.isRetrying())return this.logger.icon("RETRY",!this.options?.lazy&&this.spinner.fetch());else if(t.isRollingBack())return this.logger.icon("ROLLING_BACK",!this.options?.lazy&&this.spinner.fetch());else if(t.hasRolledBack())return this.logger.icon("ROLLED_BACK");else if(t.hasFailed())return this.logger.icon("FAILED");else if(t.isCancelled())return this.logger.icon("CANCELLED");else if(t.isPaused())return this.logger.icon("PAUSED");return this.logger.icon("WAITING")}format(t,r,o){if(t.trim()==="")return[];if(r)t=r+" "+t;let n,i=(this.logger.process.stdout.columns??80)-o*this.options.indentation-2;switch(this.options.formatOutput){case"truncate":n=t.split(Se).map((s,a)=>this.truncate(this.indent(s,a),i));break;case"wrap":n=this.wrap(t,i,{hard:!0,trim:!1}).split(Se).map((s,a)=>this.indent(s,a));break;default:throw new Hh("Format option for the renderer is wrong.")}if(this.options.removeEmptyLines)n=n.filter(Boolean);return n.map((s)=>Jh(s,o*this.options.indentation))}shouldOutputToOutputBar(t){let r=this.cache.rendererTaskOptions.get(t.id).outputBar;return typeof r==="number"&&r!==0||typeof r==="boolean"&&r!==!1}shouldOutputToBottomBar(t){let r=this.cache.rendererTaskOptions.get(t.id).bottomBar;return typeof r==="number"&&r!==0||typeof r==="boolean"&&r!==!1||!t.hasTitle()}refresh=()=>{this.update()};renderer(t,r=0){return t.flatMap((o)=>{if(!o.isEnabled())return[];if(this.cache.render.has(o.id))return this.cache.render.get(o.id);this.calculate(o),this.setupBuffer(o);let n=this.cache.rendererOptions.get(o.id),i=this.cache.rendererTaskOptions.get(o.id),s=[];if(o.isPrompt()){if(this.activePrompt&&this.activePrompt!==o.id)throw new Hh("Only one prompt can be active at the given time, please re-evaluate your task design.");else if(!this.activePrompt)o.on("PROMPT",(a)=>{let c=dr(a);if(c)this.prompt=c}),o.on("STATE",(a)=>{if(a==="PROMPT_COMPLETED"||o.hasFinalized()||o.hasReset())this.prompt=null,this.activePrompt=null,o.off("PROMPT")}),this.activePrompt=o.id}if(o.hasTitle())if(!(t.some((a)=>a.hasFailed())&&!o.hasFailed()&&o.options.exitOnError!==!1&&!(o.isCompleted()||o.isSkipped()||o.isCancelled())))if(o.hasFailed()&&n.collapseErrors)s.push(...this.format(!o.hasSubtasks()&&o.message.error&&n.showErrorMessage?o.message.error:o.title,this.style(o),r));else if(o.isSkipped()&&n.collapseSkips)s.push(...this.format(this.logger.suffix(o.message.skip&&n.showSkipMessage?o.message.skip:o.title,{field:"SKIPPED",condition:n.suffixSkips,format:()=>O.dim}),this.style(o),r));else if(o.isRetrying())s.push(...this.format(this.logger.suffix(o.title,{field:`RETRY:${o.message.retry.count}`,format:()=>O.yellow,condition:n.suffixRetries}),this.style(o),r));else if(o.isCompleted()&&o.hasTitle()&&vt(i.timer?.condition,o.message.duration))s.push(...this.format(this.logger.suffix(o?.title,{...i.timer,args:[o.message.duration]}),this.style(o),r));else if(o.isPaused())s.push(...this.format(this.logger.suffix(o.title,{...n.pausedTimer,args:[o.message.paused-Date.now()]}),this.style(o),r));else s.push(...this.format(o.title,this.style(o),r));else s.push(...this.format(o.title,this.logger.icon("COMPLETED_WITH_SISTER_TASKS_FAILED"),r));if(!o.hasSubtasks()||!n.showSubtasks){if(o.hasFailed()&&n.collapseErrors===!1&&(n.showErrorMessage||!n.showSubtasks))s.push(...this.dump(o,r,"FAILED"));else if(o.isSkipped()&&n.collapseSkips===!1&&(n.showSkipMessage||!n.showSubtasks))s.push(...this.dump(o,r,"SKIPPED"))}if(o.isPending()||i.persistentOutput)s.push(...this.renderOutputBar(o,r));if(n.showSubtasks!==!1&&o.hasSubtasks()&&(o.isPending()||o.hasFinalized()&&!o.hasTitle()||o.isCompleted()&&n.collapseSubtasks===!1&&!o.subtasks.some((a)=>this.cache.rendererOptions.get(a.id)?.collapseSubtasks===!0)||o.subtasks.some((a)=>this.cache.rendererOptions.get(a.id)?.collapseSubtasks===!1)||o.subtasks.some((a)=>a.hasFailed())||o.subtasks.some((a)=>a.hasRolledBack())||o.subtasks.some((a)=>a.isCancelled()))){let a=!o.hasTitle()?r:r+1,c=this.renderer(o.subtasks,a);s.push(...c)}if(o.hasFinalized()){if(!i.persistentOutput)this.buffer.bottom.delete(o.id),this.buffer.output.delete(o.id)}if(o.isClosed())this.cache.render.set(o.id,s),this.reset(o);return s})}renderOutputBar(t,r){let o=this.buffer.output.get(t.id);if(!o)return[];return o.all.flatMap((n)=>this.dump(t,r,"OUTPUT",n.entry))}renderBottomBar(){if(this.buffer.bottom.size===0)return[];return Array.from(this.buffer.bottom.values()).flatMap((t)=>t.all).sort((t,r)=>t.time-r.time).map((t)=>t.entry)}renderPrompt(){if(!this.prompt)return[];return[this.prompt]}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...e.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}setupBuffer(t){if(this.buffer.bottom.has(t.id)||this.buffer.output.has(t.id))return;if(t.hasFinalized())return;let r=this.cache.rendererTaskOptions.get(t.id);if(this.shouldOutputToBottomBar(t)&&!this.buffer.bottom.has(t.id))this.buffer.bottom.set(t.id,new Pa({limit:typeof r.bottomBar==="number"?r.bottomBar:1})),t.on("OUTPUT",(o)=>{let n=this.dump(t,-1,"OUTPUT",o);this.buffer.bottom.get(t.id).write(n.join(Se))}),t.on("OUTPUT_RESET",()=>{this.buffer.bottom.get(t.id)?.reset()}),t.on("STATE",(o)=>{if(o==="RETRY"||o==="ROLLING_BACK")this.buffer.bottom.delete(t.id)});else if(this.shouldOutputToOutputBar(t)&&!this.buffer.output.has(t.id))this.buffer.output.set(t.id,new Pa({limit:typeof r.outputBar==="number"?r.outputBar:1})),t.on("OUTPUT",(o)=>{this.buffer.output.get(t.id).write(o)}),t.on("OUTPUT_RESET",()=>{this.buffer.output.get(t.id)?.reset()}),t.on("STATE",(o)=>{if(o==="RETRY"||o==="ROLLING_BACK")this.buffer.output.delete(t.id)})}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id),this.buffer.output.delete(t.id)}dump(t,r,o="OUTPUT",n){if(!n)switch(o){case"OUTPUT":n=t.output;break;case"SKIPPED":n=t.message.skip;break;case"FAILED":n=t.message.error;break}if(t.hasTitle()&&o==="FAILED"&&n===t.title||typeof n!=="string")return[];if(o==="OUTPUT")n=dr(n);return this.format(n,this.style(t,!0),r+1)}indent(t,r){return r>0?Jh(t.trimEnd(),this.options.indentation):t.trimEnd()}},WE=class e{tasks;options;static nonTTY=!0;static rendererOptions={pausedTimer:{...Ca,field:(t)=>`PAUSED:${t}`,format:()=>O.yellowBright}};static rendererTaskOptions={};logger;cache={rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r){if(this.tasks=t,this.options=r,this.options={...e.rendererOptions,...r,icon:{...Xo.icon,...r?.icon??{}},color:{...Xo.color,...r?.color??{}}},this.logger=this.options.logger??new en({useIcons:!0,toStderr:ng}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp)this.logger.options.fields.prefix.unshift(this.options.timestamp)}end(){}render(){this.renderer(this.tasks)}renderer(t){t.forEach((r)=>{this.calculate(r),r.once("CLOSED",()=>{this.reset(r)});let o=this.cache.rendererOptions.get(r.id),n=this.cache.rendererTaskOptions.get(r.id);r.on("SUBTASK",(i)=>{this.renderer(i)}),r.on("STATE",(i)=>{if(!r.hasTitle())return;if(i==="STARTED")this.logger.log("STARTED",r.title);else if(i==="COMPLETED"){let s=n?.timer;this.logger.log("COMPLETED",r.title,s&&{suffix:{...s,condition:!!r.message?.duration&&s.condition,args:[r.message.duration]}})}else if(i==="PROMPT")this.logger.process.hijack(),r.on("PROMPT",(s)=>{this.logger.process.toStderr(s,!1)});else if(i==="PROMPT_COMPLETED")r.off("PROMPT"),this.logger.process.release();else if(i==="CANCELLED")this.logger.log("CANCELLED",r.title)}),r.on("OUTPUT",(i)=>{this.logger.log("OUTPUT",i)}),r.on("MESSAGE",(i)=>{if(i.error)this.logger.log("FAILED",r.title,{suffix:{field:`FAILED: ${i.error}`,format:()=>O.red}});else if(i.skip)this.logger.log("SKIPPED",r.title,{suffix:{field:`SKIPPED: ${i.skip}`,format:()=>O.yellow}});else if(i.rollback)this.logger.log("ROLLBACK",r.title,{suffix:{field:`ROLLBACK: ${i.rollback}`,format:()=>O.red}});else if(i.retry)this.logger.log("RETRY",r.title,{suffix:{field:`RETRY:${i.retry.count}`,format:()=>O.red}});else if(i.paused){let s=o?.pausedTimer;this.logger.log("PAUSED",r.title,s&&{suffix:{...s,condition:!!i?.paused&&s.condition,args:[i.paused-Date.now()]}})}})})}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...e.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id)}},KE=class e{tasks;options;static nonTTY=!0;static rendererOptions={subtasks:!0,state:Object.values(BE),output:!0,prompt:!0,title:!0,messages:["skip","error","retry","rollback","paused"],messagesToStderr:["error","rollback","retry"],task:["hasRolledBack","isRollingBack","isCompleted","isSkipped","hasFinalized","hasSubtasks","title","hasReset","hasTitle","isPrompt","isPaused","isPending","isCancelled","isStarted","hasFailed","isEnabled","isRetrying","path"]};static rendererTaskOptions;logger;serializer;constructor(t,r){this.tasks=t,this.options=r,this.options={...e.rendererOptions,...this.options},this.logger=this.options.logger??new en({useIcons:!1}),this.serializer=new GE(this.options)}render(){this.renderer(this.tasks)}end(){}renderer(t){t.forEach((r)=>{if(this.options.subtasks)r.on("SUBTASK",(o)=>{this.renderer(o)});if(this.options.state)r.on("STATE",(o)=>{this.logger.toStdout(this.serializer.serialize("STATE",o,r))});if(this.options.output)r.on("OUTPUT",(o)=>{this.logger.toStdout(this.serializer.serialize("OUTPUT",o,r))});if(this.options.prompt)r.on("PROMPT",(o)=>{this.logger.toStdout(this.serializer.serialize("PROMPT",o,r))});if(this.options.title)r.on("TITLE",(o)=>{this.logger.toStdout(this.serializer.serialize("TITLE",o,r))});r.on("MESSAGE",(o)=>{let n=Object.fromEntries(Object.entries(o).map(([i,s])=>{if(this.options.messages.includes(i))return[i,s]}).filter(Boolean));if(Object.keys(n).length>0){let i=this.serializer.serialize("MESSAGE",n,r);if(this.options.messagesToStderr.some((s)=>Object.keys(n).includes(s)))this.logger.toStderr(i);else this.logger.toStdout(i)}})})}},HE=class e{tasks;options;static nonTTY=!0;static rendererOptions={logTitleChange:!1,pausedTimer:{...Ca,format:()=>O.yellowBright}};static rendererTaskOptions;logger;cache={rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r){if(this.tasks=t,this.options=r,this.options={...e.rendererOptions,...this.options,icon:{...Xo.icon,...r?.icon??{}},color:{...Xo.color,...r?.color??{}}},this.logger=this.options.logger??new en({useIcons:!1,toStderr:ng}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp)this.logger.options.fields.prefix.unshift(this.options.timestamp)}render(){this.renderer(this.tasks)}end(){}renderer(t){t.forEach((r)=>{this.calculate(r),r.once("CLOSED",()=>{this.reset(r)});let o=this.cache.rendererOptions.get(r.id),n=this.cache.rendererTaskOptions.get(r.id);if(r.on("SUBTASK",(i)=>{this.renderer(i)}),r.on("STATE",(i)=>{if(!r.hasTitle())return;if(i==="STARTED")this.logger.log("STARTED",r.title);else if(i==="COMPLETED"){let s=n.timer;this.logger.log("COMPLETED",r.title,s&&{suffix:{...s,condition:!!r.message?.duration&&s.condition,args:[r.message.duration]}})}else if(i==="CANCELLED")this.logger.log("CANCELLED",r.title)}),r.on("OUTPUT",(i)=>{this.logger.log("OUTPUT",i)}),r.on("PROMPT",(i)=>{let s=dr(i);if(s)this.logger.log("PROMPT",s)}),this.options?.logTitleChange!==!1)r.on("TITLE",(i)=>{this.logger.log("TITLE",i)});r.on("MESSAGE",(i)=>{if(i?.error)this.logger.log("FAILED",i.error);else if(i?.skip)this.logger.log("SKIPPED",i.skip);else if(i?.rollback)this.logger.log("ROLLBACK",i.rollback);else if(i?.retry)this.logger.log("RETRY",r.title,{suffix:i.retry.count.toString()});else if(i?.paused){let s=o?.pausedTimer;this.logger.log("PAUSED",r.title,s&&{suffix:{...s,condition:!!i?.paused&&s.condition,args:[i.paused-Date.now()]}})}})})}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...e.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id)}},ka={default:qE,simple:WE,verbose:HE,test:KE,silent:QE};rS=class extends tg{},oS=class extends rS{listr;task;options;rendererOptions;rendererTaskOptions;id=IE();state="WAITING";subtasks;title;initialTitle;output;retry;message={};prompt;parent;enabled;taskFn;closed;constructor(e,t,r,o,n){super();if(this.listr=e,this.task=t,this.options=r,this.rendererOptions=o,this.rendererTaskOptions=n,t.title){let i=Array.isArray(t?.title)?t.title:[t.title];this.title=pr(i.shift(),...i),this.initialTitle=this.title}this.taskFn=t.task,this.parent=e.parentTask}set state$(e){if(this.state=e,this.emit("STATE",e),this.hasSubtasks()&&this.hasFailed()){for(let t of this.subtasks)if(t.state==="STARTED")t.state$="FAILED"}this.listr.events.emit("SHOUD_REFRESH_RENDER")}set output$(e){this.output=e,this.emit("OUTPUT",e),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set outputReset$(e){this.output=e,this.emit("OUTPUT_RESET"),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set promptOutput$(e){if(this.emit("PROMPT",e),dr(e))this.listr.events.emit("SHOUD_REFRESH_RENDER")}set message$(e){this.message={...this.message,...e},this.emit("MESSAGE",e),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set title$(e){this.title=e,this.emit("TITLE",e),this.listr.events.emit("SHOUD_REFRESH_RENDER")}get path(){return[...this.listr.path,this.initialTitle]}async check(e){if(this.state==="WAITING")this.enabled=await vt(this.task?.enabled??!0,e),this.emit("ENABLED",this.enabled),this.listr.events.emit("SHOUD_REFRESH_RENDER");return this.enabled}hasSubtasks(){return this.subtasks?.length>0}hasFinalized(){return this.isCompleted()||this.hasFailed()||this.isSkipped()||this.hasRolledBack()||this.isCancelled()}isPending(){return this.isStarted()||this.isPrompt()||this.hasReset()}isStarted(){return this.state==="STARTED"}isSkipped(){return this.state==="SKIPPED"}isCompleted(){return this.state==="COMPLETED"}hasFailed(){return this.state==="FAILED"}isCancelled(){return this.state==="CANCELLED"}isRollingBack(){return this.state==="ROLLING_BACK"}hasRolledBack(){return this.state==="ROLLED_BACK"}isRetrying(){return this.state==="RETRY"}hasReset(){return this.state==="RETRY"||this.state==="ROLLING_BACK"}isEnabled(){return this.enabled}hasTitle(){return typeof this?.title==="string"}isPrompt(){return this.state==="PROMPT"}isPaused(){return this.state==="PAUSED"}isClosed(){return this.closed}async pause(e){let t=this.state;this.state$="PAUSED",this.message$={paused:Date.now()+e},await eS(e),this.state$=t,this.message$={paused:null}}async run(e,t){let r=(i)=>{if(i instanceof de)i.options={...this.options,...i.options},i.rendererClass=Yo("silent"),this.subtasks=i.tasks,i.errors=this.listr.errors,this.emit("SUBTASK",this.subtasks),i=i.run(e);else if(i instanceof Promise)i=i.then(r);else if(LE(i))i=new Promise((s,a)=>{i.on("data",(c)=>{this.output$=c.toString()}),i.on("error",(c)=>a(c)),i.on("end",()=>s(null))});else if(NE(i))i=new Promise((s,a)=>{i.subscribe({next:(c)=>{this.output$=c},error:a,complete:s})});return i},o=Date.now();this.state$="STARTED";let n=await vt(this.task?.skip??!1,e);if(n){if(typeof n==="string")this.message$={skip:n};else if(this.hasTitle())this.message$={skip:this.title};else this.message$={skip:"Skipped task without a title."};this.state$="SKIPPED";return}try{let i=typeof this.task?.retry==="number"&&this.task.retry>0?this.task.retry+1:typeof this.task?.retry==="object"&&this.task.retry.tries>0?this.task.retry.tries+1:1,s=typeof this.task.retry==="object"&&this.task.retry.delay;for(let a=1;a<=i;a++)try{await Promise.race([r(this.taskFn(e,t)),this.whenInterrupted()]);break}catch(c){if(this.listr.signal.aborted)throw c;if(a!==i){if(this.retry={count:a,error:c},this.message$={retry:this.retry},this.title$=this.initialTitle,this.output=void 0,t.report(c,"WILL_RETRY"),this.state$="RETRY",s)await this.pause(s)}else throw c}if(this.isStarted()||this.isRetrying())this.message$={duration:Date.now()-o},this.state$="COMPLETED"}catch(i){if(this.prompt instanceof DE)i=this.prompt;if(this.task?.rollback){t.report(i,"WILL_ROLLBACK");try{this.state$="ROLLING_BACK",await this.task.rollback(e,t),this.message$={rollback:this.title},this.state$="ROLLED_BACK"}catch(s){throw this.state$="FAILED",t.report(s,"HAS_FAILED_TO_ROLLBACK"),this.close(),s}if(this.listr.options?.exitAfterRollback!==!1)throw this.close(),i}else{if(this.listr.signal.aborted)throw this.state$="CANCELLED",i;if(this.state$="FAILED",this.listr.options.exitOnError!==!1&&await vt(this.task?.exitOnError,e)!==!1)throw t.report(i,"HAS_FAILED"),this.close(),i;else if(!this.hasSubtasks())t.report(i,"HAS_FAILED_WITHOUT_ERROR")}}finally{this.close()}}close(){this.emit("CLOSED"),this.listr.events.emit("SHOUD_REFRESH_RENDER"),this.complete()}whenInterrupted(){return new Promise((e,t)=>{let r=()=>{if(!this.hasSubtasks())t(Error("Interrupted."))};if(this.listr.signal.aborted){r();return}this.listr.signal.addEventListener("abort",r,{once:!0})})}},eg=class extends tg{}});function nS(e){return typeof e==="string"&&/^sha256:[a-f0-9]{64}$/.test(e)}function ig(e){if(!nS(e))throw Error(`Invalid SHA-256 digest: ${e}`)}var fr=1;import{AsyncLocalStorage as iS}from"async_hooks";function Ra(e){return e["x-arch"]==="amd64"?"amd64":"arm64"}function sg(e){if(Ra(e)!=="amd64")return{};return{nodeSelector:{"kubernetes.io/arch":"amd64"},tolerations:[{key:"arch",operator:"Equal",value:"amd64",effect:"NoExecute"}]}}var vT;var Ta=_(()=>{vT=new iS});import{execFile as sS,spawn as aS}from"child_process";import{createHash as cS}from"crypto";import{constants as ag}from"fs";import{chmod as kT,lstat as uS,mkdir as PT,open as lS,readdir as pS,readlink as dS,realpath as fS,symlink as CT}from"fs/promises";import{dirname as mS,isAbsolute as Ba,relative as lg,resolve as Oa,sep as pg}from"path";import{promisify as hS}from"util";function Ia(e){return`sha256:${cS("sha256").update(e).digest("hex")}`}function fg(e){if(!e||e.includes("\x00")||e.includes("\\")||Ba(e)||e.split("/").some((t)=>!t||t==="."||t===".."))throw Error(`Unsafe workspace path: ${JSON.stringify(e)}`)}function cg(e,t){let r=lg(e,t);return r===""||!r.startsWith(`..${pg}`)&&r!==".."&&!Ba(r)}async function ug(e,t){let{stdout:r}=await dg("git",["-C",e,"ls-files","-z",...t],{encoding:"buffer",maxBuffer:67108864}),o=new TextDecoder("utf-8",{fatal:!0}),n=[],i=0;for(let s=r.indexOf(0);s!==-1;s=r.indexOf(0,i)){if(s>i)n.push(o.decode(r.subarray(i,s)));i=s+1}return n}async function gS(e){let[t,r]=await Promise.all([ug(e,["--cached","--others","--exclude-standard"]),ug(e,["--others","--ignored","--exclude-standard","--",".env*","**/.env*"])]);return[...new Set([...t,...r])].sort((o,n)=>Buffer.from(o).compare(Buffer.from(n)))}async function yS(e){let t=await dg("git",["-C",e,"ls-files","--others","--ignored","--exclude-standard","--directory","-z"],{encoding:"buffer",maxBuffer:67108864}),r=new TextDecoder("utf-8",{fatal:!0}),o=new Set,n=0;for(let h=t.stdout.indexOf(0);h!==-1;h=t.stdout.indexOf(0,n)){if(h>n){let m=r.decode(t.stdout.subarray(n,h));if(m.endsWith("/"))o.add(m.slice(0,-1))}n=h+1}let i=[],s=async(h)=>{for(let m of await pS(h,{withFileTypes:!0})){if(h===e&&m.name===".git")continue;let y=Oa(h,m.name),b=lg(e,y).split(pg).join("/");if(m.isDirectory()){if(!o.has(b))await s(y)}else if(!m.isFile()&&!m.isSymbolicLink())i.push(b)}};if(await s(e),i.length===0)return;let a=Buffer.from(`${i.join("\x00")}\x00`),c=aS("git",["-C",e,"check-ignore","--stdin","-z"]),u=[],l=[];c.stdout.on("data",(h)=>u.push(h)),c.stderr.on("data",(h)=>l.push(h));let f=new Promise((h,m)=>{c.once("error",m),c.once("close",(y)=>{if(y===0||y===1)h();else m(Error(Buffer.concat(l).toString("utf8")||`git check-ignore exited with ${y}`))})});c.stdin.end(a),await f;let d=Buffer.concat(u),p=new Set;n=0;for(let h=d.indexOf(0);h!==-1;h=d.indexOf(0,n)){if(h>n)p.add(r.decode(d.subarray(n,h)));n=h+1}for(let h of i){let m=h.slice(h.lastIndexOf("/")+1);if(!p.has(h)||m.startsWith(".env"))throw Error(`Special files are not allowed in workspaces: ${h}`)}}function bS(e){return JSON.stringify({version:e.version,files:e.files.map((t)=>({path:t.path,type:t.type,digest:t.digest,size:t.size,mode:t.mode}))})}function za(e){return wS(e),Buffer.from(bS(e))}function _S(e){return Ia(za(e))}function wS(e){if(e.version!==fr||!Array.isArray(e.files))throw Error("Unsupported workspace manifest");let t="",r=new Set;for(let o of e.files){if(fg(o.path),ig(o.digest),!Number.isSafeInteger(o.size)||o.size<0)throw Error(`Invalid size for ${o.path}`);if(o.type==="file"&&o.mode!==420&&o.mode!==493||o.type==="symlink"&&o.mode!==511)throw Error(`Invalid mode for ${o.path}`);if(o.type!=="file"&&o.type!=="symlink")throw Error(`Invalid entry type for ${o.path}`);if(r.has(o.path))throw Error(`Duplicate workspace path: ${o.path}`);for(let n of o.path.split("/").slice(0,-1).map((i,s,a)=>a.slice(0,s+1).join("/")))if(r.has(n))throw Error(`Workspace entry is used as a directory: ${n}`);if(t&&Buffer.from(t).compare(Buffer.from(o.path))>=0)throw Error("Workspace files must be bytewise sorted");r.add(o.path),t=o.path}}async function tn(e){let t=await fS(e);await yS(t);let r=await gS(t),o=[],n=new Map;for(let s of r){fg(s);let a=Oa(t,s);if(!cg(t,a))throw Error(`Workspace path escapes root: ${s}`);let c;try{c=await uS(a)}catch(f){if(f.code==="ENOENT")continue;throw f}let u,l;if(c.isSymbolicLink()){let f=await dS(a);if(Ba(f)||!cg(t,Oa(mS(a),f)))throw Error(`Symlink escapes workspace: ${s} -> ${f}`);u=Buffer.from(f),l={path:s,type:"symlink",digest:Ia(u),size:u.byteLength,mode:511}}else if(c.isFile()){let f,d=await lS(a,ag.O_RDONLY|ag.O_NOFOLLOW);try{let p=await d.stat();if(!p.isFile())throw Error(`Not a regular file: ${s}`);f=p.mode&73?493:420,u=await d.readFile()}finally{await d.close()}l={path:s,type:"file",digest:Ia(u),size:u.byteLength,mode:f}}else throw Error(`Special files are not allowed in workspaces: ${s}`);o.push(l),n.set(l.digest,u)}let i={version:fr,files:o};return{manifest:i,digest:_S(i),blobs:[...n].map(([s,a])=>({digest:s,data:a}))}}var dg;var Da=_(()=>{dg=hS(sS)});import{randomUUID as vS}from"crypto";import{execFile as xS}from"child_process";import{isAbsolute as ES,relative as bg,resolve as mg,sep as _g}from"path";import{promisify as SS}from"util";class vg{inflight=0;maxInflight;maxPerSecond;requestStarts=[];waiting=[];rateGate=Promise.resolve();clock;sleep;constructor(e){if(this.maxInflight=e?.maxInflight??CS,this.maxPerSecond=e?.maxPerSecond??RS,!Number.isSafeInteger(this.maxInflight)||this.maxInflight<1)throw RangeError("maxInflight must be a positive integer");if(!Number.isSafeInteger(this.maxPerSecond)||this.maxPerSecond<1)throw RangeError("maxPerSecond must be a positive integer");this.clock=e?.clock??{now:()=>Date.now()},this.sleep=e?.sleep??((t)=>Bun.sleep(t))}get currentInflight(){return this.inflight}get maxConcurrent(){return this.maxInflight}get currentRequestStarts(){return this.pruneOldStarts(),this.requestStarts.length}pruneOldStarts(){let e=this.clock.now()-1000;while(this.requestStarts.length>0&&this.requestStarts[0]<=e)this.requestStarts.shift()}async acquire(){if(this.inflight<this.maxInflight){this.inflight++;return}await new Promise((e)=>{this.waiting.push(e)})}release(){if(this.waiting.length>0)this.waiting.shift()();else this.inflight--}waitForRateLimit(){let e=this.rateGate.then(async()=>{for(;;){if(this.pruneOldStarts(),this.requestStarts.length<this.maxPerSecond){this.requestStarts.push(this.clock.now());return}let t=this.requestStarts[0];await this.sleep(Math.max(1,t+1000-this.clock.now()))}});return this.rateGate=e.catch(()=>{}),e}async run(e){await this.acquire();try{return await this.waitForRateLimit(),await e()}finally{this.release()}}}async function TS(e,t,r){let o=0,n=async()=>{for(;;){let i=o++;if(i>=e.length)return;await r(e[i])}};await Promise.all(Array.from({length:Math.min(t,e.length)},n))}function OS(e,t){return bg(e,t).split(_g).join("/")||"."}function gg(e,t,r,o){let n=bg(e,t);if(n.startsWith(`..${_g}`)||n===".."||ES(n))throw Error(`${r} must stay inside the git repo for service ${o}`);return OS(e,t)}function IS(e){if(!e.build||typeof e.build==="string"||!e.build.args)return[];if(Array.isArray(e.build.args))return[...e.build.args];return Object.entries(e.build.args).filter(([,t])=>t!==null).map(([t,r])=>`${t}=${String(r)}`)}function BS(e,t,r,o,n,i){if(!r.build)return;let s=r.build,a=typeof s==="string"?s:s.context??".";if(a.includes("://"))throw Error(`Remote build context is not supported for service ${t}`);if(typeof s!=="string"&&s.dockerfile_inline)throw Error(`dockerfile_inline is not supported for service ${t}`);let c=mg(o,a),u=gg(n,c,"Build context",t),l=typeof s==="string"||!s.dockerfile?void 0:mg(c,s.dockerfile);return{name:t,image:zS(e,t,i),context:u,dockerfile:l?gg(n,l,"Dockerfile",t):void 0,target:typeof s==="string"?void 0:s.target,buildArgs:IS(r)}}function zS(e,t,r=Ao){return`${r.replace(/\/+$/,"")}/kuber/${e}-${t}:latest`}async function Na(e){let{stdout:t}=await $S("git",["-C",e,"rev-parse","--show-toplevel"]);return t.trim()}async function DS(e,t,r,o,n){let i=`/blobs/${encodeURIComponent(e)}/uploads`,s=n?`?project=${encodeURIComponent(n)}`:"",a=`${i}${s}`,c=await o.run(()=>r(a,{method:"POST",json:{size:t.byteLength}})),u=c.offset;while(!c.complete&&u<t.byteLength){let l=t.subarray(u,u+AS),f=await o.run(()=>r(a,{method:"PATCH",headers:{"content-type":"application/octet-stream","upload-offset":String(u)},body:l}));if(f.offset<=u)throw Error(`Blob upload for ${e} made no progress`);u=f.offset}if(!c.complete)await o.run(()=>r(`${i}/complete${s}`,{method:"POST",json:{}}))}async function NS(e,t=k,r,o,n){let i=new Map(e.blobs.map((a)=>[a.digest,a.data]));i.set(e.digest,za(e.manifest));let s=o??new vg;for(;;){let a=await s.run(()=>t("/snapshots/negotiate",{method:"POST",json:{workspace:e.digest,...n&&{project:n}}}));if(a.ready)return;if(a.missing.length===0)throw Error("Snapshot negotiation is incomplete but reported no missing blobs");await TS(a.missing,s.maxConcurrent,async(c)=>{let u=i.get(c);if(!u)throw Error(`Server requested unknown workspace blob ${c}`);await r?.progress?.(`Uploading ${c}`),await DS(c,u,t,s,n)})}}async function LS(e,t,r,o){if(e.type==="status"){if(!r?.has(e.status.state))r?.add(e.status.state),await t?.progress?.(`${o?`${o}: `:""}Build ${e.status.state}`);return 0}if(t?.stream)t.stream.write(o?`[${o}] ${e.message}`:e.message);else await t?.progress?.(`${o?`${o}: `:""}${e.message.trimEnd()}`);return e.sequence}function VS(e){if(!(e instanceof Error)||e.name==="AbortError")return!1;if(e.name==="TimeoutError"||e instanceof TypeError)return!0;let t="code"in e&&typeof e.code==="string"?e.code:e.cause&&typeof e.cause==="object"&&("code"in e.cause)&&typeof e.cause.code==="string"?e.cause.code:void 0;return t==="ECONNABORTED"||t==="ECONNRESET"||t==="ECONNREFUSED"||t==="EAI_AGAIN"||t==="ETIMEDOUT"}async function yg(e,t,r,o,n,i){for(let s=1;s<=hg;s++)try{return i?.throwIfAborted(),await e(t,{...r,signal:i},{timeoutMs:PS})}catch(a){if(!VS(a)||s===hg)throw a;i?.throwIfAborted(),await n(o)}throw Error("Build poll retries exhausted")}async function US(e,t,r,o,n,i,s,a){let c=i,u=0,l=new Set;for(;;){let f=await yg(t,`/builds/${encodeURIComponent(e)}/events?after=${u}`,void 0,o,n,s);for(let d of f)u=Math.max(u,await LS(d,r,l,a));if(c.state==="succeeded"||c.state==="failed")return c;if(c=await yg(t,`/builds/${encodeURIComponent(e)}/reconcile`,{method:"POST",json:{}},o,n,s),c.state!=="succeeded"&&c.state!=="failed")s?.throwIfAborted(),await n(o)}}async function rn(e,t,r={}){let o=r.request??k,n=Object.entries(t.services??{}).filter(([,a])=>a.build).map(([a])=>a),i=Array(n.length),s=0;return await Promise.all(Array.from({length:Math.min(wg,n.length)},async()=>{for(;;){let a=s++;if(a>=n.length)return;let c=n[a];r.signal?.throwIfAborted();try{i[a]=(await o("/images/resolve",{method:"POST",json:{project:e,service:c},signal:r.signal})).reference}catch(u){throw Error(`Cannot resolve a published image for service ${c}. Run kuber up to build it.`,{cause:u})}}})),Object.fromEntries(n.map((a,c)=>[a,i[c]]))}async function xg(e,t,r=process.cwd(),o,n={}){if(!Object.values(t.services??{}).some((b)=>b.build))return{built:[],changed:[],images:{}};let i=n.buildConcurrency??wg;if(!Number.isSafeInteger(i)||i<1)throw RangeError("buildConcurrency must be a positive integer");let s=n.request??k,a=await Na(r),c=n.snapshot??await tn(a),u=Object.entries(t.services??{}).flatMap(([b,S])=>{let x=BS(e,b,S,r,a,n.registry??Ao);return x?[x]:[]});await NS(c,s,o,n.scheduler,e);let l=Array(u.length),f=0,d,p=!1,h=async()=>{while(!p&&f<u.length){let b=f++,S=u[b];try{n.signal?.throwIfAborted(),await o?.progress?.(`Building ${S.name}`),l[b]=await m(S)}catch(x){if(!p)d=x;p=!0}}},m=async(b)=>{let S=vS(),x={version:fr,id:S,project:e,service:b.name,spec:{architecture:Ra(t),image:b.image,context:b.context,dockerfile:b.dockerfile,target:b.target,buildArgs:b.buildArgs,workspace:c.digest}},A=await s("/builds",{method:"POST",json:x,signal:n.signal},{timeoutMs:300000}),R=await US(S,s,o,n.pollIntervalMs??kS,n.sleep??((Z)=>Bun.sleep(Z)),A,n.signal,b.name);if(R.state!=="succeeded")throw Error(`Build failed for service ${b.name}: ${R.error??"unknown error"}`);return(await s(`/builds/${encodeURIComponent(S)}/result`,{signal:n.signal})).reference};if(await Promise.all(Array.from({length:Math.min(i,u.length)},h)),p)throw d;let y=Object.fromEntries(u.map((b,S)=>[b.name,l[S]]));return{built:u.map((b)=>b.name),changed:u.map((b)=>b.name),images:y}}var $S,AS=8388608,kS=1000,PS=300000,hg=3,wg=3,CS=20,RS=40;var La=_(()=>{Ta();q();ko();Da();$S=SS(xS)});function Eg(e){return MS[e.kind]??999}function Sg(e){return[...e].sort((t,r)=>Eg(t)-Eg(r))}var MS,GT,KT;var on=_(()=>{Ve();MS={Namespace:0,GarageBucket:1,GarageKey:2,ServiceAccount:3,ClusterRole:4,Role:5,ClusterRoleBinding:6,RoleBinding:7,StorageClass:8,PersistentVolumeClaim:9,Secret:10,ConfigMap:11,Service:12,Deployment:13,HorizontalPodAutoscaler:14,Ingress:15,IngressRoute:16},GT=`app.kubernetes.io/managed-by=${H["app.kubernetes.io/managed-by"]}`,KT=H["app.kubernetes.io/managed-by"]});function qS(e){return`${ZS}-${e}`}function Va(e){return encodeURIComponent(e)}function $g(e,t){return`postgresql://${Va(t.username)}:${Va(t.password)}@${Ua}:${Ma}/${Va(e.database)}`}function Ag(e){if(!e.startsWith("postgresql:"))return;let t=e.split(":");if(t.length!==2)throw Error(`Invalid postgres volume ${e}. Use postgresql:<name> or postgresql:<user>/<database>.`);let r=t[1]?.trim();if(!r)throw Error(`Invalid postgres volume ${e}. Use postgresql:<name> or postgresql:<user>/<database>.`);let o=r.split("/");if(o.length>2||o.some((s)=>s.trim()===""))throw Error(`Invalid postgres volume ${e}. Use postgresql:<name> or postgresql:<user>/<database>.`);let n=o[0],i=o[1]??n;return{username:n,database:i}}function kg(e){return typeof e==="string"&&Ag(e)!==void 0}function QS(e,t){let r=t.volumes?.flatMap((o)=>{if(typeof o!=="string")return[];let n=Ag(o);return n?[{...n,service:e,secretName:qS(n.username)}]:[]})??[];if(r.length>1)throw Error(`Service ${e} declares multiple postgres volumes. Only zero or one postgresql:<...> entry is allowed per service.`);return r[0]}function nt(e){let t=Object.entries(e.services??{}).flatMap(([o,n])=>{let i=QS(o,n);return i?[i]:[]}),r=new Map;for(let o of t){let n=r.get(o.database);if(n&&n!==o.username)throw Error(`Database ${o.database} is claimed by both ${n} and ${o.username}. A database can only have one owner.`);r.set(o.database,o.username)}return t}var jS="database",ZS="postgres",Ua,Ma=5432;var mr=_(()=>{Ve();on();Ua=`c.${jS}.svc.cluster.local`});function nn(e,t){if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return t;let r=Array.isArray(e)?[...e]:{...e};for(let o of Object.keys(t)){let n=r[o],i=t[o];if(Array.isArray(n)&&Array.isArray(i))r[o]=[...n,...i];else if(n&&typeof n==="object"&&i&&typeof i==="object")r[o]=nn(n,i);else r[o]=i}return r}function Pg(e){if(!e.startsWith("s3:"))return;let t=e.split(":");if(t.length!==2)throw Error(`Invalid S3 volume ${e}. Use s3:<name> or s3:<key>/<bucket>.`);let r=t[1]?.trim();if(!r)throw Error(`Invalid S3 volume ${e}. Use s3:<name> or s3:<key>/<bucket>.`);let o=r.split("/");if(o.length>2||o.some((s)=>s.trim()===""))throw Error(`Invalid S3 volume ${e}. Use s3:<name> or s3:<key>/<bucket>.`);let n=o[0],i=o[1]??n;return{key:n,bucket:i}}function Cg(e){return typeof e==="string"&&Pg(e)!==void 0}function WS(e,t){let r=t.volumes?.flatMap((o)=>{if(typeof o!=="string")return[];let n=Pg(o);return n?[{...n,service:e}]:[]})??[];if(r.length>1)throw Error(`Service ${e} declares multiple S3 volumes. Only zero or one s3:<...> entry is allowed per service.`);return r[0]}function it(e){let t=Object.entries(e.services??{}).flatMap(([o,n])=>{let i=WS(o,n);return i?[i]:[]}),r=new Map;for(let o of t){let n=r.get(o.key);if(n&&n!==o.bucket)throw Error(`S3 key ${o.key} is claimed for both ${n} and ${o.bucket}. A managed key can only target one bucket.`);r.set(o.key,o.bucket)}return t}var hr=_(()=>{Ve();on()});import{existsSync as Rg,readFileSync as GS,realpathSync as ja,statSync as KS}from"fs";import{dirname as HS,isAbsolute as Tg,normalize as JS,relative as YS,resolve as sn,sep as Og}from"path";function Et(e,t){return Object.assign(Error(e),t?{code:t}:{})}function XS(e){if(!e||e.includes("\x00")||e.includes("\\")||e.startsWith("~")||Tg(e))throw Et(`Artifact path must be workspace-relative: ${e}`);let t=JS(e);if(t===".."||t.startsWith(`..${Og}`))throw Et(`Artifact path escapes the workspace: ${e}`);return t.replace(/^\.\//,"")}function Za(e,t){let r=YS(e,t);if(r===".."||r.startsWith(`..${Og}`)||Tg(r))throw Et(`Artifact path escapes the workspace: ${t}`)}function e$(e,t){let r=t;while(!Rg(r)){let o=HS(r);if(o===r)break;r=o}Za(e,ja(r))}function Fa(e,t){if(t!==void 0&&(!Number.isSafeInteger(t)||t<0))throw Error(`${e} must be a non-negative safe integer`)}class Ig{#t;#r=0;#e=0;constructor(e){Fa("maxArtifactCount",e.maxArtifactCount),Fa("maxArtifactBytes",e.maxArtifactBytes),Fa("maxTotalBytes",e.maxTotalBytes),this.#t=e}add(e,t){let r=Buffer.byteLength(t);if(this.#t.maxArtifactBytes!==void 0&&r>this.#t.maxArtifactBytes)throw Et(`Artifact ${e} exceeds the ${this.#t.maxArtifactBytes} byte limit`);if(this.#t.maxArtifactCount!==void 0&&this.#r+1>this.#t.maxArtifactCount)throw Et(`Artifact count exceeds the ${this.#t.maxArtifactCount} limit`);if(this.#t.maxTotalBytes!==void 0&&this.#e+r>this.#t.maxTotalBytes)throw Et(`Artifact bytes exceed the ${this.#t.maxTotalBytes} byte limit`);this.#r+=1,this.#e+=r}}class je{#t;#r;#e;constructor(e){this.#t=e.strict?ja(e.workspace):sn(e.workspace),this.#r=e.strict??!1,this.#e=new Ig(e)}#o(e,t){if(!this.#r)return t.expandHome&&e.startsWith("~")?sn(process.env.HOME??"",e.slice(1)):sn(this.#t,e);let r=sn(this.#t,XS(e));return Za(this.#t,r),e$(this.#t,r),r}isFile(e,t={}){let r=this.#o(e,t);return Rg(r)&&KS(r).isFile()}readText(e,t={}){let r=this.#o(e,t);if(this.#r)Za(this.#t,ja(r));let o=GS(r,"utf8");return this.#e.add(e,o),o}}var Bg=()=>{};import{createHash as Ug}from"crypto";import{basename as Mg}from"path";function Fg(e){if(!e.diskTag&&e.replicaCount===void 0&&!e.dataLocality)return;return{diskTag:e.diskTag?[...e.diskTag].sort():void 0,replicaCount:e.replicaCount,dataLocality:e.dataLocality}}function jg(e){return`kuber-longhorn-${Ug("sha256").update(JSON.stringify(e)).digest("hex").slice(0,12)}`}function st(e){if(typeof e==="number")return e;if(!e||e.includes("-"))return;let t=Number(e);return Number.isInteger(t)?t:void 0}function zg(e){if(typeof e!=="string"&&typeof e!=="number")return;let t=String(e).trim(),r=t$.exec(t);if(!r)return;let o=Number(r[1]),n=Number(r[2]);if(!Number.isInteger(o)||!Number.isInteger(n))return;if(o<1||n<1)throw Error(`Invalid replica range ${t}. Range bounds must be positive integers.`);if(o>n)throw Error(`Invalid replica range ${t}. Minimum (${o}) cannot exceed maximum (${n}).`);return{kind:"range",min:o,max:n}}function cn(e,t){if(t===void 0||t.trim()==="")return;let r=Number(t);if(!Number.isInteger(r)||r<0)throw Error(`Invalid ${e} value ${JSON.stringify(t)}. Expected a non-negative integer (zero allowed for a fixed replica count), a numeric string, or a "min-max" range.`)}function Dg(e){if(e.scale!==void 0){let t=st(e.scale);if(t!==void 0)return cn("scale",String(e.scale)),t;cn("scale",String(e.scale))}if(e.deploy?.replicas!==void 0){let t=st(e.deploy.replicas);if(t!==void 0)return cn("deploy.replicas",String(e.deploy.replicas)),t;cn("deploy.replicas",String(e.deploy.replicas))}return 1}function Zg(e){let t=zg(e.scale);if(t)return Ng(t);if(e.scale!==void 0)return{kind:"fixed",value:Dg(e)};let r=zg(e.deploy?.replicas);if(r)return Ng(r);return{kind:"fixed",value:Dg(e)}}function Ng(e){if(e.min===e.max)return{kind:"fixed",value:e.min};return e}function r$(e){if(e.kind==="range")return e.max>1;return e.value>1}function o$(e,t,r){if(t.build){let o=r[e];if(!o)throw Error(`Missing resolved build image for service ${e}`);return o}return t.image}function qa(e){return e?.toUpperCase()==="UDP"?"UDP":"TCP"}function un(e){if(!e)return;return/[a-z]/i.test(e)?e:void 0}function ln(e){return typeof e==="string"?JSON.stringify(e):String(e)}function Lg(e,t){let r=String(e).trim(),o=n$.exec(r);if(!o)throw Error(`Invalid ${t} value ${ln(e)}. Expected a non-negative finite decimal number of CPU cores.`);let n=BigInt(o[1]??"0"),i=o[2]??"",s=n*1000n+(i?BigInt(i.padEnd(3,"0").slice(0,3)):0n);if(i.slice(3).replaceAll("0","")!=="")throw Error(`Invalid ${t} value ${ln(e)}. CPU cores must be representable in whole millicores.`);return s%1000n===0n?String(s/1000n):`${s}m`}function Vg(e,t){let r=e.trim(),o=i$.exec(r);if(!o)throw Error(`Invalid ${t} value ${ln(e)}. Expected a non-negative memory quantity.`);let n=o[1]??"",i=(()=>{switch(n.toLowerCase()){case"b":return"";case"k":case"kb":return"k";case"m":case"mb":return"M";case"g":case"gb":return"G";case"t":case"tb":return"T";case"p":case"pb":return"P";case"e":case"eb":return"E";default:return n}})();if(!["","n","u","m","k","M","G","T","P","E","Ki","Mi","Gi","Ti","Pi","Ei"].includes(i))throw Error(`Invalid ${t} value ${ln(e)}. Expected a valid Kubernetes or Compose memory quantity.`);return`${r.slice(0,r.length-n.length)}${i}`}function s$(e){let t=e.deploy?.resources;if(!t)return;let r={...t.limits?.cpus!==void 0?{cpu:Lg(t.limits.cpus,"deploy.resources.limits.cpus")}:{},...t.limits?.memory!==void 0?{memory:Vg(t.limits.memory,"deploy.resources.limits.memory")}:{}},o={...t.reservations?.cpus!==void 0?{cpu:Lg(t.reservations.cpus,"deploy.resources.reservations.cpus")}:{},...t.reservations?.memory!==void 0?{memory:Vg(t.reservations.memory,"deploy.resources.reservations.memory")}:{}};if(Object.keys(r).length===0&&Object.keys(o).length===0)return;return{...Object.keys(r).length>0?{limits:r}:{},...Object.keys(o).length>0?{requests:o}:{}}}function a$(e){if(typeof e==="boolean")return e;if(!e)return;switch(e.toLowerCase()){case"1":case"true":case"yes":case"on":case"ro":return!0;case"0":case"false":case"no":case"off":case"rw":return!1}}function pn(e){return e.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,63)}function Qa(e){if(e===void 0||e===null)return;let t=String(e).trim();if(!t)return;return t}function qg(e){if(e===void 0||e===null)return;let t=(Array.isArray(e)?e:[e]).flatMap((r)=>String(r).split(",")).map((r)=>r.trim()).filter(Boolean);return t.length>0?[...new Set(t)]:void 0}function Qg(e){if(e===void 0||e===null||e==="")return;let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=20?t:void 0}function c$(e){let[t,r]=e.split(/\s+on\s+/i,2).map((n)=>n?.trim());if(!r)return{requestedStorage:Qa(t)};let o=/^(?:(?<replicas>\d+)\s+)?(?<tags>.+)$/.exec(r);return{requestedStorage:Qa(t),diskTag:qg(o?.groups?.tags),replicaCount:Qg(o?.groups?.replicas),dataLocality:"none"}}function u$(e){let t=/^(?<name>[^()]+)\((?<size>[^()]+)\)$/.exec(e.trim());if(!t?.groups)return;let r=t.groups.name?.trim(),{requestedStorage:o,diskTag:n,replicaCount:i,dataLocality:s}=c$(t.groups.size??"");if(!r)return;return{source:r,requestedStorage:o,diskTag:n,replicaCount:i,dataLocality:s}}function Wg(e){if(!e||Wa(e))return{source:e};let t=u$(e);if(!t)return{source:e};if(!t.source)throw Error(`Invalid volume source ${e}. Expected name(size).`);return t}function Gg(e){return Qa(e?.["x-size"])}function Kg(e){return qg(e?.["x-diskTag"])}function Hg(e){return Qg(e?.["x-replicaCount"])}function Jg(e){return e?.["x-dataLocality"]==="none"?"none":void 0}function Yg(e){return pn(`bind-${Bun.hash(e).toString(36)}`)}function Wa(e){return e.startsWith(".")||e.startsWith("/")||e.startsWith("~")||e.includes("/")}function Xg(e,t){return t.isFile(e,{expandHome:!0})}function l$(e,t,r){if(kg(e)||Cg(e))return;let o=e.split(":");if(o.length===1)return{name:`volume-${t}`,kind:"volume",target:e};let n=o.at(-1),i=n==="ro"||n==="rw",s=o.at(i?-2:-1),a=o.slice(0,i?-2:-1).join(":");if(!s)return;let{source:c,requestedStorage:u,diskTag:l,replicaCount:f,dataLocality:d}=Wg(a||void 0);return{name:c&&Wa(c)?Yg(c):`volume-${t}`,kind:c&&Wa(c)?Xg(c,r)?"config-file":"bind":"volume",source:c||void 0,target:s,configKey:c?Mg(c):void 0,readOnly:i?n==="ro":void 0,requestedStorage:u,diskTag:l,replicaCount:f,dataLocality:d}}function p$(e,t,r){if(typeof e==="string")return l$(e,t,r);if(!e.target)return;if(e.type!=="bind"&&e.type!=="volume"&&e.type!=="tmpfs")return;let{source:o,requestedStorage:n,diskTag:i,replicaCount:s,dataLocality:a}=Wg(e.source);return{name:o?e.type==="bind"?Yg(o):`${e.type}-${pn(o)||t}`:`${e.type}-${t}`,kind:e.type==="bind"&&o&&Xg(o,r)?"config-file":e.type,source:o,target:e.target,readOnly:a$(e.read_only),configKey:o?Mg(o):void 0,subPath:e.volume?.subpath,sizeLimit:e.type==="tmpfs"&&e.tmpfs?.size!==void 0?String(e.tmpfs.size):void 0,requestedStorage:n??Gg(e.volume),diskTag:i??Kg(e.volume),replicaCount:s??Hg(e.volume),dataLocality:a??Jg(e.volume)}}function d$(e,t){if(!t||!e)return;let r=e[t];return Gg(r)}function f$(e,t){if(!t||!e)return;let r=e[t];return Kg(r)}function m$(e,t){if(!t||!e)return;let r=e[t];return Hg(r)}function h$(e,t){if(!t||!e)return;let r=e[t];return Jg(r)}function dn(e,t,r={}){let o=e.volumes?.flatMap((i,s)=>{let a=p$(i,s,t);if(!a)return[];return[{...a,requestedStorage:a.requestedStorage??d$(r,a.source)??(a.kind==="volume"&&a.source?an.requestedStorage:void 0),diskTag:a.diskTag??f$(r,a.source)??(a.kind==="volume"&&a.source?an.diskTag:void 0),replicaCount:a.replicaCount??m$(r,a.source)??(a.kind==="volume"&&a.source?an.replicaCount:void 0),dataLocality:a.dataLocality??h$(r,a.source)??(a.kind==="volume"&&a.source?an.dataLocality:void 0)}]})??[],n=(Array.isArray(e.tmpfs)?e.tmpfs:[e.tmpfs]).filter((i)=>Boolean(i)).map((i,s)=>({name:`tmpfs-${o.length+s}`,kind:"tmpfs",target:i}));return[...o,...n]}function g$(e){if(e.length===0)return;return e.map((t)=>({name:t.name,mountPath:t.target,readOnly:t.readOnly,subPath:t.kind==="config-file"?t.configKey:t.subPath}))}function y$(e,t){if(t.length===0)return;return t.map((r)=>{if(r.kind==="config-file")return{name:r.name,configMap:{name:r.name}};if(r.kind==="bind"){if(!r.source)return{name:r.name,emptyDir:{}};return{name:r.name,persistentVolumeClaim:{claimName:r.name}}}if(r.kind==="tmpfs")return{name:r.name,emptyDir:{medium:"Memory",sizeLimit:r.sizeLimit}};if(!r.source)return{name:r.name,emptyDir:{}};return{name:r.name,persistentVolumeClaim:{claimName:pn(`${e}-${r.source}`)}}})}function b$(e){return[...new Set(e.split(",").map((t)=>t.trim()).filter(Boolean).map((t)=>t.startsWith("/")?t:`/${t}`))]}function _$(e){let t=/^(?<portSpec>.+):protected(?:\((?<paths>[^)]*)\))?$/.exec(e);if(!t?.groups)return{portSpec:e};let r=t.groups.portSpec?.trim();if(!r)throw Error(`Invalid protected port syntax ${e}.`);let o=t.groups.paths?.trim();if(o===void 0)return{portSpec:r,routingKind:"ingressroute"};let n=b$(o);if(n.length===0)throw Error(`Invalid protected port syntax ${e}. Expected one or more paths.`);return{portSpec:r,routingKind:"ingressroute",paths:n}}function fn(e){let t=e.ports?.flatMap((o,n)=>{if(typeof o==="number")return[{name:`port-${n}`,containerPort:o,servicePort:o,protocol:"TCP"}];if(typeof o==="string"){let a=/\/(tcp|udp)$/i.exec(o),c=a?o.slice(0,-a[0].length):o,u=a?.[1];if(!c)return[];let{portSpec:l,routingKind:f,paths:d}=_$(c),p=l.split(":"),h=st(p.at(-1));if(!h)return[];let m=st(p.at(-2)),y=m!==void 0?un(p.at(-3)):un(p.at(-2));return[{name:`port-${n}`,containerPort:h,servicePort:m??h,hostPort:m,host:y,protocol:qa(u),routingKind:y?f??"ingress":void 0,paths:d}]}let i=st(o.target);if(!i)return[];let s=st(o.published);return[{name:o.name??`port-${n}`,containerPort:i,servicePort:s??i,hostPort:s,host:un(o.host_ip),protocol:qa(o.protocol),routingKind:un(o.host_ip)?"ingress":void 0}]})??[],r=e.expose?.flatMap((o,n)=>{let[i,s]=String(o).split("/"),a=st(i);if(!a)return[];return[{name:`expose-${n}`,containerPort:a,servicePort:a,protocol:qa(s)}]})??[];return[...t,...r]}function w$(e){if(e.length===0)return;let t=new Map;for(let r of e)t.set(`${r.containerPort}:${r.protocol}`,{name:r.name,containerPort:r.containerPort,hostPort:r.hostPort,protocol:r.protocol});return[...t.values()]}function v$(e){if(e.length===0)return;let t=new Map;for(let r of e)t.set(`${r.servicePort}:${r.protocol}`,{name:r.name,port:r.servicePort,targetPort:r.containerPort,protocol:r.protocol});return[...t.values()]}function x$(e,t){let r=new Set;return t.flatMap((o)=>{if(!o.host||o.routingKind==="ingressroute"||r.has(o.host))return[];return r.add(o.host),[{host:o.host,http:{paths:[{path:"/",pathType:"Prefix",backend:{service:{name:e,port:{number:o.servicePort}}}}]}}]})}function E$(e,t,r){let o=r.flatMap((n)=>{if(!n.host||n.routingKind!=="ingressroute")return[];return(n.paths&&n.paths.length>0?n.paths.map((s)=>`Host(\`${n.host}\`) && PathPrefix(\`${s}\`)`):[`Host(\`${n.host}\`)`]).map((s)=>({kind:"Rule",match:s,middlewares:[{name:"cf-auth",namespace:"routing"}],services:[{name:t,port:n.servicePort}]}))});if(o.length===0)return;return{apiVersion:"traefik.io/v1alpha1",kind:"IngressRoute",metadata:{name:t,namespace:e,labels:H},spec:{routes:o}}}function S$(e){if(!e)return[];return(Array.isArray(e)?e:[e]).map((r)=>typeof r==="string"?{path:r,required:!0}:{path:r.path,required:r.required!==!1&&r.required!=="false"})}function $$(e){let t={};for(let r of e.split(/\r?\n/)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(n===-1)continue;let i=o.slice(0,n).trim(),s=o.slice(n+1);if(!i)continue;t[i]=s}return t}async function A$(e,t){let r={};for(let o of S$(e))try{let n=t.readText(o.path);Object.assign(r,$$(n))}catch(n){if(!o.required&&n&&typeof n==="object"&&"code"in n&&n.code==="ENOENT")continue;throw n}return r}function k$(e,t,r,o,n=process.cwd(),i={},s={},a={},c=new je({workspace:n}),u={}){let l=dn(o,c,s),f=fn(o),d=Boolean(o.env_file)||Object.keys(i).length>0,p=u.replicaSpec??Zg(o),h=p.kind==="range"?p.min:p.value,m=[nn({name:t,imagePullPolicy:"Always",env:om(o.environment),image:o$(t,o,a),command:o.command instanceof Array?o.command:o.command?o.command.split(" "):void 0,envFrom:d?[{secretRef:{name:`${t}-env`}}]:void 0,ports:w$(f),resources:s$(o),volumeMounts:g$(l)},o["x-container"]??{})],y={restartPolicy:"Always",...sg(r),volumes:y$(e,l),containers:m};if(r$(p))y.topologySpreadConstraints=[{maxSkew:1,topologyKey:"kubernetes.io/hostname",whenUnsatisfiable:"ScheduleAnyway",labelSelector:{matchLabels:{app:t}}}];return nn({apiVersion:"apps/v1",kind:"Deployment",metadata:{name:t,namespace:e,labels:H},spec:{replicas:h,strategy:{rollingUpdate:{maxSurge:"25%",maxUnavailable:"25%"}},selector:{matchLabels:{app:t}},template:{metadata:{labels:{app:t}},spec:y}}},o["x-deployment"]??{})}function P$(e,t,r){let o=v$(fn(r));if(!o)return;return{apiVersion:"v1",kind:"Service",metadata:{name:t,namespace:e,labels:H},spec:{type:"ClusterIP",selector:{app:t},ports:o}}}function C$(e,t,r){let o=x$(t,fn(r));if(o.length===0)return;return{apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:t,namespace:e,labels:H},spec:{rules:o}}}function R$(e,t,r=process.cwd(),o={},n=new je({workspace:r})){let i=new Map;for(let s of dn(t,n,o)){let a=s.kind==="bind"?s.source?s.name:void 0:s.kind==="volume"&&s.source?pn(`${e}-${s.source}`):void 0;if(!a||i.has(a))continue;let c=Fg(s);i.set(a,{apiVersion:"v1",kind:"PersistentVolumeClaim",metadata:{name:a,namespace:e,labels:H},spec:{accessModes:["ReadWriteMany"],storageClassName:c?jg(c):void 0,resources:{requests:{storage:s.requestedStorage??"1Gi"}}}})}return[...i.values()]}function T$(e,t=process.cwd(),r={},o=new je({workspace:t})){let n=new Map;for(let i of dn(e,o,r)){let s=Fg(i);if(!s)continue;let a=jg(s);n.set(a,{apiVersion:"storage.k8s.io/v1",kind:"StorageClass",metadata:{name:a,labels:H},provisioner:"driver.longhorn.io",allowVolumeExpansion:!0,reclaimPolicy:"Delete",volumeBindingMode:"Immediate",parameters:{...s.diskTag?{diskSelector:s.diskTag.join(",")}:{},...s.replicaCount!==void 0?{numberOfReplicas:String(s.replicaCount)}:{},...s.dataLocality?{dataLocality:"disabled"}:{}}})}return[...n.values()]}function O$(e,t,r=process.cwd(),o={},n=new je({workspace:r})){let i=new Map;for(let s of dn(t,n,o)){if(s.kind!=="config-file"||!s.source||!s.configKey)continue;i.set(s.name,{apiVersion:"v1",kind:"ConfigMap",metadata:{name:s.name,namespace:e,labels:H},data:{[s.configKey]:n.readText(s.source,{expandHome:!0})}})}return[...i.values()]}async function I$(e,t,r,o=process.cwd(),n={},i=new je({workspace:o})){let s={...await A$(r.env_file,i),...n};if(Object.keys(s).length===0)return[];return[{apiVersion:"v1",kind:"Secret",metadata:{name:`${t}-env`,namespace:e,labels:H},type:"Opaque",stringData:s}]}function B$(e){let t=Object.entries(e.stringData??{}).sort(([r],[o])=>r.localeCompare(o));return Ug("sha256").update(JSON.stringify(t)).digest("hex")}function z$(e){return{apiVersion:"v1",kind:"Namespace",metadata:{name:e,labels:H}}}function D$(e,t){let r=e.spec?.template.spec?.containers[0];if(!r)return;if(t["x-container"]?.resources?.requests?.cpu!==void 0)return;if(r.resources??={},r.resources.requests??={},r.resources.requests.cpu===void 0)r.resources.requests.cpu="100m"}function N$(e,t,r){return{apiVersion:"autoscaling/v2",kind:"HorizontalPodAutoscaler",metadata:{name:t,namespace:e,labels:H},spec:{scaleTargetRef:{apiVersion:"apps/v1",kind:"Deployment",name:t},minReplicas:r.min,maxReplicas:r.max,metrics:[{type:"Resource",resource:{name:"cpu",target:{type:"Utilization",averageUtilization:80}}}]}}}function $e(e){return`${e.kind}:${e.metadata?.namespace??""}:${e.metadata?.name??""}`}async function mn(e,t,r=process.cwd(),o={},n={},i=new je({workspace:r})){let s=new Map,a=z$(e);s.set($e(a),a);for(let[c,u]of Object.entries(t.services??{})){for(let b of T$(u,r,t.volumes,i))s.set($e(b),b);for(let b of R$(e,u,r,t.volumes,i))s.set($e(b),b);for(let b of O$(e,u,r,t.volumes,i))s.set($e(b),b);let l=await I$(e,c,u,r,o[c]??{},i);for(let b of l)s.set($e(b),b);let f=P$(e,c,u);if(f)s.set($e(f),f);let d=Zg(u),p=k$(e,c,t,u,r,o[c]??{},t.volumes,n,i,{replicaSpec:d}),h=l[0];if(h)p.spec.template.metadata.annotations={...p.spec?.template.metadata?.annotations,"kuber.astrxl.dev/env-checksum":B$(h)};if(s.set($e(p),p),d.kind==="range"){D$(p,u);let b=N$(e,c,d);s.set($e(b),b)}let m=C$(e,c,u);if(m)s.set($e(m),m);let y=E$(e,c,fn(u));if(y)s.set($e(y),y)}return[...s.values()]}var an,t$,n$,i$;var Ga=_(()=>{Ve();Ta();mr();tt();hr();Bg();an={requestedStorage:"1Gi",diskTag:["fast"],replicaCount:2,dataLocality:"none"};t$=/^\s*(\d+)\s*-\s*(\d+)\s*$/;n$=/^(\d+)(?:\.(\d+))?$/,i$=/^(?:\d+(?:\.\d+)?|\.\d+)([a-zA-Z]*)$/});import{randomUUID as Ka}from"crypto";import{isDeepStrictEqual as ey}from"util";function ay(e){return`/workspaces/${encodeURIComponent(e)}/adopt`}function ty(e,t){let r={...e};for(let[o,n]of Object.entries(t))r[o]={...r[o],...n};return r}function F$(e){let{resource:t,phase:r,state:o}=e.data;return`${r==="apply"?"Applied":r==="wait"?"Waited for":"Deleted"} ${t.kind}/${t.name}: ${o}`}function j$(e){if(!e||typeof e!=="object")return!1;let{sequence:t,data:r}=e;if(!Number.isSafeInteger(t)||!r||typeof r!=="object")return!1;let{resource:o,phase:n,state:i}=r;if(!o||typeof o!=="object")return!1;let s=o;return typeof s.apiVersion==="string"&&typeof s.kind==="string"&&typeof s.name==="string"&&(s.namespace===void 0||typeof s.namespace==="string")&&(n==="apply"||n==="wait"||n==="delete")&&(i==="started"||i==="succeeded"||i==="failed"||i==="aborted")}function Z$(e,t){return{source:{uri:`cas://${t.digest}`,digest:t.digest},config:{compose:e}}}function q$(e,t){return ey(e.spec?.source,t.source)&&ey(e.spec?.config,t.config)}function ry(e){if(e instanceof we)return e.status===409;if(e instanceof DOMException&&e.name==="AbortError")return!1;if(e instanceof Error&&e.name==="AbortError")return!1;return e instanceof TypeError||e instanceof Error&&e.name==="TimeoutError"}async function Q$(e,t,r,o=k){let n=`/workspaces/${encodeURIComponent(e)}`,i=Z$(t,r),s=(u)=>o(n,{method:"PUT",headers:{"if-match":`"${u.metadata.resourceVersion}"`},json:i}),a=async(u)=>{try{let l=await o(n);if(q$(l,i))return l;return await s(l)}catch{throw u}},c;try{c=await o(n)}catch(u){if(!(u instanceof we)||u.status!==404)throw u;try{return await o("/workspaces",{method:"POST",json:{id:e,...i}})}catch(l){if(!ry(l))throw l;return a(l)}}try{return await s(c)}catch(u){if(!ry(u))throw u;return a(u)}}function oy(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>t!=="operation"&&t!=="operationId"&&r!==null&&typeof r==="object"&&!Array.isArray(r)))}function hn(e,t){let r=t instanceof Error?t.message:String(t);if(!/namespace .* (?:external|different-workspace)/i.test(r))return t instanceof Error?t:Error(r);return Error(`${r}. Safe adoption requires ${sy} ${ay(e)} with namespace UID and ownership preconditions.`,{cause:t})}async function $t(e,t,r,o){try{return await t(r,o)}catch(n){throw hn(e,n)}}function W$(e){if(!e||typeof e!=="object")return;let t=e.operationId;return typeof t==="string"&&t?t:void 0}function G$(e){if(!e||typeof e!=="object")return;let t=e.operation?.status;return t&&typeof t==="object"?t:void 0}function ny(e,t){let r=t.error,o=t.state==="cancelled",n=typeof r?.message==="string"?r.message:o?"The operation was cancelled":"The operation failed",i=typeof r?.code==="string"?r.code:o?"OPERATION_CANCELLED":"OPERATION_FAILED";return new we(n,o?409:500,{title:o?"Operation cancelled":"Operation failed",status:o?409:500,code:i,operationId:e})}function K$(e){if(e instanceof we)return M$.has(e.code);if(e instanceof DOMException&&e.name==="AbortError")return!1;if(e instanceof Error&&e.name==="AbortError")return!1;return e instanceof TypeError||e instanceof Error&&e.name==="TimeoutError"}function H$(e){return e.state==="failed"&&e.error?.code==="OPERATION_INTERRUPTED"}function J$(e,t){return e.cursorGap===!0||Number.isSafeInteger(e.retainedFirstSequence)&&e.retainedFirstSequence>t+1}function Y$(e,t){return t+Math.max(e,0)+U$}function cy(e){return e.reason??new DOMException("The operation was aborted","AbortError")}function St(e){if(e?.aborted)throw cy(e)}function X$(e,t){return St(t),new Promise((r,o)=>{let n,i=()=>{if(n!==void 0)clearTimeout(n);t?.removeEventListener("abort",a)},s=()=>{i(),r()},a=()=>{i(),o(cy(t))};if(n=setTimeout(s,e),t?.addEventListener("abort",a,{once:!0}),t?.aborted)a()})}async function Ha(e,t,r,o,n,i){let s=i.now??Date.now,a=Y$(n,s()),c=new Headers(o.headers);c.set("idempotency-key",Ka()),c.set("prefer","respond-async");let u={...o,headers:c,signal:i.signal??o.signal},l,f=L$,d=!1,p=0;for(;;){if(St(i.signal),d&&s()>=a)throw Error("Timed out while reconnecting to resume the operation");try{let y;if(l)y=(await $t(e,t,`/operations/${encodeURIComponent(l)}`,{signal:i.signal})).status;else{d=!1;let b=await $t(e,t,r,u);l=W$(b),y=G$(b)}if(l)try{let b=await $t(e,t,`/operations/${encodeURIComponent(l)}/events?after=${p}`,{signal:i.signal});if(J$(b,p))throw new Xa;for(let S of b.items??[]){if(!Number.isSafeInteger(S.sequence)||S.sequence<=p)continue;if(p=S.sequence,!j$(S))continue;i.onEvent?.(S)}}catch(b){if(b instanceof Xa)throw b;St(i.signal)}if(!l||!y||y.state==="succeeded")return;if(H$(y)){if(s()>=a)throw ny(l,y);l=void 0,p=0,d=!0,c.set("idempotency-key",Ka()),u={...o,headers:c,signal:i.signal??o.signal}}else if(y.state==="failed"||y.state==="cancelled")throw ny(l,y)}catch(y){if(St(i.signal),y instanceof we&&y.code==="OPERATION_INTERRUPTED"){if(s()>=a)throw hn(e,y);l=void 0,p=0,d=!0,c.set("idempotency-key",Ka()),u={...o,headers:c,signal:i.signal??o.signal}}else{if(!K$(y))throw hn(e,y);if(s()>=a)throw hn(e,y)}}let h=a-s();if(h<=0)throw Error("Timed out while reconnecting to resume the operation");let m=Math.min(f,h);if(i.sleep)St(i.signal),await i.sleep(m),St(i.signal);else await X$(m,i.signal);f=Math.min(f*2,V$)}}async function eA(e,t,r=k){let o=`/workspaces/${encodeURIComponent(e)}`;return $t(e,r,`${o}/resources/plan`,{method:"POST",json:{resources:t}})}function Ja(e){let t=e.name??e.metadata?.name;if(!e.apiVersion||!e.kind||!t)return;return{apiVersion:e.apiVersion,kind:e.kind,name:t,namespace:e.namespace??e.metadata?.namespace}}function iy(e){return`${e.apiVersion}\x00${e.kind}\x00${e.namespace??""}\x00${e.name}`}function tA(e,t){return`${e==="apply"?"Apply":e==="wait"?"Wait for":"Delete"} ${t.kind}/${t.name}`}function Ya(e,t,r,o,n={}){if(r.length===0)return o(()=>{},e.signal);let i=new Map,s=new Set,a=0;return e.newListr(r.map((c)=>({title:tA(t,c),task:async(u,l)=>{if(i.set(iy(c),l),n.onTaskStarted?.(c,l),a+=1,a!==r.length)return new Promise((f)=>{let d=()=>{e.signal.removeEventListener("abort",d),s.delete(d),f()};if(s.add(d),e.signal.aborted)d();else e.signal.addEventListener("abort",d,{once:!0})});try{await o((f)=>{let d=f.data.resource,p=i.get(iy(d));if(!p)return;p.output=f.data.state,e.output=F$(f)},e.signal)}finally{for(let f of[...s])f()}}})),{concurrent:!0})}async function gr(e,t=k,r={}){let{project:o,compose:n,cwd:i,config:s,hookContext:a}=I(),c=r.trust??await vm(await gt(o,i)),u=t;t=async(d,p={},h)=>{let m=new Headers(p.headers);for(let[y,b]of Object.entries(wm(c)))m.set(y,b);return u(d,{...p,headers:m},h)};let l=`/workspaces/${encodeURIComponent(o)}`;return await new de([{title:"Read compose",task:async(d,p)=>{if(d.compose=await n(),e)await s.preBuild?.(d.compose,await a());p.output=`${Object.keys(d.compose.services??{}).length} services`}},{title:"Snapshot workspace",task:async(d,p)=>{d.snapshot=await tn(await Na(i)),p.output=`${d.snapshot.manifest.files.length} files`}},{title:"Build images",rendererOptions:{outputBar:10,persistentOutput:!0},enabled:async()=>e&&Object.values((await n()).services??{}).some((d)=>d.build),task:async(d,p)=>{let h=await xg(o,d.compose,i,{progress:(m)=>{p.output=m},stream:p.stdout()},{...s,request:t,snapshot:d.snapshot,signal:p.signal});d.buildImages=h.images,await s.postBuild?.(h,await a()),p.output=`Built ${h.built.length} image${h.built.length===1?"":"s"}`}},{title:"Resolve images",enabled:async()=>!e&&Object.values((await n()).services??{}).some((d)=>d.build),task:async(d,p)=>{d.buildImages=await rn(o,d.compose,{...s,request:t}),p.output=`${Object.keys(d.buildImages).length} images`}},{title:"Update workspace",task:async(d,p)=>{let h=await Q$(o,d.compose,d.snapshot,t),m=await t(ay(o),{method:sy,json:{workspaceUid:h.metadata.uid}});p.output=m.resourcesAdopted?`Adopted ${m.resourcesAdopted} existing resources`:"Workspace ready"}},{title:"Reconcile backing services",task:async(d,p)=>{let h={},m={};await p.newListr([{title:"Reconcile databases",enabled:()=>nt(d.compose).length>0,task:async(y,b)=>{let S=await $t(o,t,`${l}/databases`,{method:"POST",json:{compose:d.compose}});h=oy(S),b.output=`${Object.keys(h).length} services`}},{title:"Reconcile S3 storage",enabled:()=>it(d.compose).length>0,task:async(y,b)=>{let S=await $t(o,t,`${l}/storage`,{method:"POST",json:{compose:d.compose}});m=oy(S),b.output=`${Object.keys(m).length} services`}}],{concurrent:!0}).run(),d.serviceEnv=ty(ty(d.serviceEnv,h),m)}},{title:"Render manifests",task:async(d,p)=>{d.resources=await mn(o,d.compose,i,d.serviceEnv,d.buildImages),await s.postRender?.(d.resources,await a()),p.output=`${d.resources.length} resources`}},{title:"Reconcile resources",task:async(d,p)=>{d.plan=await eA(o,d.resources,t);let h=d.plan,m=h.desired.map(Ja).filter((x)=>Boolean(x)),y=h.desired.filter((x)=>x.kind==="Deployment").map(Ja).filter((x)=>Boolean(x)),b=h.stale.map(Ja).filter((x)=>Boolean(x)),S=`${l}/resources`;return p.newListr([{title:"Apply resources",task:async(x,A)=>Ya(A,"apply",m,(R,Z)=>Ha(o,t,`${S}/apply`,{method:"POST",json:{resources:h.desired}},s.rolloutTimeoutMs,{onEvent:R,signal:Z}))},{title:"Run post-apply hook",skip:!s.postApply,task:async()=>s.postApply?.(h.desired,await a())},{title:"Wait for deployments",skip:y.length===0,task:async(x,A)=>Ya(A,"wait",y,(R,Z)=>Ha(o,t,`${S}/wait`,{method:"POST",json:{deployments:y.map((_e)=>_e.name),timeoutMs:s.rolloutTimeoutMs}},s.rolloutTimeoutMs,{onEvent:R,signal:Z}))},{title:"Delete stale resources",skip:b.length===0,task:async(x,A)=>Ya(A,"delete",b,(R,Z)=>Ha(o,t,`${S}/delete`,{method:"POST",json:{resources:h.stale}},s.rolloutTimeoutMs,{onEvent:R,signal:Z}))}])}}],{rendererOptions:{collapseErrors:!1}}).run()}var sy="POST",L$=250,V$=5000,U$=60000,M$,Xa,rA;var gn=_(()=>{F();xt();q();La();Ga();ee();mr();hr();Da();To();M$=new Set(["HTTP_502","HTTP_503","HTTP_504"]);Xa=class Xa extends Error{constructor(){super("Operation progress history was truncated; refusing to report an incomplete resource stream")}};rA=E({meta:{name:"up",description:"Create and start deployments"},args:{build:{type:"boolean",default:!0,alias:"b",description:"Build images before starting deployments",negativeDescription:"Don't build an image, even if it's policy"}},async run({args:e}){await gr(e.build)}})});function oA(e){let t=e?.trim();if(!t)throw Error("KUBER_API_KEY or --api-key is required for kuber ci");return t}function nA(e){return(t,r={},o={})=>{let n=new Headers(r.headers);return n.set("authorization",`Bearer ${e}`),k(t,{...r,headers:n},{...o,authenticated:!1})}}async function iA(e,t,r,o=nA(r)){let{project:n,cwd:i}=I(),s=await gt(n,i);if(t)await o(`/workspaces/${encodeURIComponent(n)}/trust`,{method:"POST",json:{fingerprint:s.fingerprint}});await gr(e,o,{trust:t?s:void 0})}var sA;var uy=_(()=>{F();q();ee();To();gn();sA=E({meta:{name:"ci",description:"Deploy using an API key without a session"},args:{apiKey:{type:"string",description:"API key (defaults to KUBER_API_KEY)"},trust:{type:"boolean",description:"Grant current directory trust before deploying"},build:{type:"boolean",default:!0,negativeDescription:"Resolve existing images without building"}},async run({args:e}){await iA(e.build,Boolean(e.trust),oA(e.apiKey??process.env.KUBER_API_KEY))}})});function aA(e,t,r=k){return r(`/workspaces/${encodeURIComponent(e)}/databases/credentials`,{method:"POST",json:{claim:t}})}var cA,uA,lA;var ly=_(()=>{F();q();ee();mr();tt();cA=E({meta:{name:"ls",description:"List managed postgres claims"},async run(){let e=nt(await I().compose());if(e.length===0){console.log("No managed postgres volumes declared");return}console.log(le(e.map((t)=>({service:t.service,username:t.username,database:t.database,secret:t.secretName}))))}}),uA=E({meta:{name:"creds",description:"Print postgres credentials for a service"},async run({args:e}){let t=e._[0];if(!t)throw Error("Service name is required");let r=I(),o=nt(await r.compose()).find((s)=>s.service===t);if(!o)throw Error(`Service ${t} does not declare a managed postgres volume.`);let n=await aA(r.project,o),i=$g(o,n);console.log(le([{service:o.service,username:n.username,database:o.database,host:Ua,port:Ma,secret:o.secretName}])),console.log(`DATABASE_URL=${i}`)}}),lA=E({meta:{name:"db",description:"Inspect managed postgres databases"},subCommands:{creds:uA,ls:cA}})});function pA(e,t=!1,r=k){return r(`/workspaces/${encodeURIComponent(e)}/down`,{method:"POST",json:{full:t}})}var dA;var py=_(()=>{F();xt();q();ee();dA=E({meta:{name:"down",description:"Delete managed resources except ingress and PVCs"},args:{full:{type:"boolean",alias:"f",description:"Also delete ingress, PVCs, and the namespace"}},async run({args:e}){let{project:t}=I();await new de([{title:"Delete resources",task:async(r,o)=>{let n=await pA(t,e.full);o.output=`${n.delete.length} resources queued`}}]).run()}})});async function dy(e,t,r=process.cwd(),o={}){let n=[...nt(t).length?["Postgres"]:[],...it(t).length?["S3"]:[]];if(n.length>0)throw Error(`Cannot export without generated ${n.join(" and ")} credentials. Export is side-effect-free; run kuber up or remove managed provider claims.`);let i=await rn(e,t,o);return mn(e,t,r,{},i)}var fy=_(()=>{Ga();mr();hr();La()});import{resolve as fA}from"path";var{YAML:mA}=globalThis.Bun;function hA(e){return`${Sg(e).map((t)=>mA.stringify(t,null,2).trimEnd()).join(`
|
|
84
|
+
`).map((o)=>_x(bx(o),t,r)).join(`
|
|
85
|
+
`)}var ot="\x1B",ga="\x9B",ix,gh="\x07",yh="[",sx="]",qo="m",Qo=0,bh=39,_h=49,wh=59,vh=38,xh=48,Eh=58,ax=5,cx=2,Zo,Sh,$h,Ah,ux,kh=(e)=>Array.from(ux.segment(e),({segment:t})=>t),ph=8,Ph=(e)=>`${ot}${yh}${e}${qo}`,dh=(e)=>`${ot}${Zo}${e}${gh}`,Ch=(e)=>{let t=e.split(";").map((o)=>o===""?Qo:Number.parseInt(o,10)),r=[];for(let o=0;o<t.length;o++){let n=t[o];if(!Number.isFinite(n))continue;if(n===vh||n===xh||n===Eh){if(o+1>=t.length)break;let i=t[o+1];if(i===ax&&Number.isFinite(t[o+2])){r.push([n,i,t[o+2]]),o+=2;continue}let s=t[o+2],a=t[o+3],c=t[o+4];if(i===cx&&Number.isFinite(s)&&Number.isFinite(a)&&Number.isFinite(c)){r.push([n,i,s,a,c]),o+=4;continue}break}r.push([n])}return r},jo=(e,t)=>{let r=e.findIndex((o)=>o.family===t);if(r!==-1)e.splice(r,1)},fh=(e,t)=>{jo(e,t.family),e.push(t)},lx=(e,t)=>{for(let r=e.length-1;r>=0;r--){let o=e[r];if(o.family.startsWith("modifier-")&&o.close===t)e.splice(r,1)}},px=(e,t)=>{if(e>=30&&e<=37||e>=90&&e<=97||e===vh&&t.length>1)return{family:"foreground",open:t.join(";"),close:bh};if(e>=40&&e<=47||e>=100&&e<=107||e===xh&&t.length>1)return{family:"background",open:t.join(";"),close:_h};if(e===Eh&&t.length>1)return{family:"underlineColor",open:t.join(";"),close:wh}},Rh=(e,t)=>{if(e===Qo)return t.length=0,!0;if(e===bh)return jo(t,"foreground"),!0;if(e===_h)return jo(t,"background"),!0;if(e===wh)return jo(t,"underlineColor"),!0;if(Ah.has(e))return lx(t,e),!0;return!1},dx=(e,t)=>{let[r]=e;if(Rh(r,t))return;let o=px(r,e);if(o){fh(t,o);return}let n=pe.codes.get(r);if(n!==void 0&&n!==Qo)fh(t,{family:`modifier-${r}`,open:e.join(";"),close:n})},mh=(e,t)=>{for(let r of Ch(e))dx(r,t)},hh=(e,t)=>{for(let r of Ch(e)){let[o]=r;Rh(o,t)}},fx=(e,t)=>{let r=e;while(r.length>0){if(r.startsWith(ot)&&r[1]!=="\\"){let o=Sh.exec(r);if(!o)break;if(o.groups.sgr!==void 0)hh(o.groups.sgr,t);r=r.slice(o[0].length);continue}if(r.startsWith(ga)){let o=$h.exec(r);if(!o||o.groups.sgr===void 0)break;hh(o.groups.sgr,t),r=r.slice(o[0].length);continue}break}},mx=(e)=>[...e].reverse().map((t)=>Ph(t.close)).join(""),hx=(e)=>e.map((t)=>Ph(t.open)).join(""),gx=(e)=>e.split(" ").map((t)=>Q(t)),ha=(e,t,r)=>{let o=kh(t),n=!1,i=!1,s=Q(Me(e.at(-1)));for(let[a,c]of o.entries()){let u=Q(c);if(s+u<=r)e[e.length-1]+=c;else e.push(c),s=0;if(ix.has(c)&&!(i&&c===ot&&o[a+1]==="\\"))n=!0,i=o.slice(a+1,a+1+Zo.length).join("")===Zo;if(n){if(i){if(c===gh||c==="\\"&&a>0&&o[a-1]===ot)n=!1,i=!1}else if(c===qo)n=!1;continue}if(s+=u,s===r&&a<o.length-1)e.push(""),s=0}if(!s&&e.at(-1).length>0&&e.length>1)e[e.length-2]+=e.pop()},yx=(e)=>{let t=e.split(" "),r=t.length;while(r>0){if(Q(t[r-1])>0)break;r--}if(r===t.length)return e;return t.slice(0,r).join(" ")+t.slice(r).join("")},bx=(e)=>{if(!e.includes("\t"))return e;let t=e.split("\t"),r=0,o="";for(let[n,i]of t.entries())if(o+=i,r+=Q(i),n<t.length-1){let s=ph-r%ph;o+=" ".repeat(s),r+=s}return o},_x=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let o="",n,i=[],s=gx(e),a=[""];for(let[f,p]of e.split(" ").entries()){if(r.trim!==!1)a[a.length-1]=a.at(-1).trimStart();let d=Q(a.at(-1));if(f!==0){if(d>=t&&(r.wordWrap===!1||r.trim===!1))a.push(""),d=0;if(d>0||r.trim===!1)a[a.length-1]+=" ",d++}if(r.hard&&r.wordWrap!==!1&&s[f]>t){let m=t-d,h=1+Math.floor((s[f]-m-1)/t);if(Math.floor((s[f]-1)/t)<h)a.push("");ha(a,p,t);continue}if(d+s[f]>t&&d>0&&s[f]>0){if(r.wordWrap===!1&&d<t){ha(a,p,t);continue}a.push("")}if(d+s[f]>t&&r.wordWrap===!1){ha(a,p,t);continue}a[a.length-1]+=p}if(r.trim!==!1)a=a.map((f)=>yx(f));let c=a.join(`
|
|
86
|
+
`),u=kh(c),l=0;for(let[f,p]of u.entries()){if(o+=p,p===ot&&u[f+1]!=="\\"){let{groups:d}=Sh.exec(c.slice(l))||{groups:{}};if(d.sgr!==void 0)mh(d.sgr,i);else if(d.uri!==void 0)n=d.uri.length===0?void 0:d.uri}else if(p===ga){let{groups:d}=$h.exec(c.slice(l))||{groups:{}};if(d.sgr!==void 0)mh(d.sgr,i)}if(u[f+1]===`
|
|
87
|
+
`){if(n)o+=dh("");o+=mx(i)}else if(p===`
|
|
88
|
+
`){let d=[...i];if(fx(c.slice(l+1),d),o+=hx(d),n)o+=dh(n)}l+=p.length}return o};var ya=_(()=>{Mo();Uo();ma();ix=new Set([ot,ga]),Zo=`${sx}8;;`,Sh=new RegExp(`^\\u001B(?:\\${yh}(?<sgr>[0-9;]*)${qo}|${Zo}(?<uri>[^\\u0007\\u001B]*)(?:\\u0007|\\u001B\\\\))`),$h=new RegExp(`^\\u009B(?<sgr>[0-9;]*)${qo}`),Ah=new Set(pe.codes.values());Ah.delete(Qo);ux=new Intl.Segmenter});function Wo(e){if(!Number.isInteger(e))return!1;return nr(e)||ir(e)}var Th=_(()=>{fa()});function Wx(e){return e>=kx&&e<=Px||e===Cx||e===Rx}function Gx(e){return e>=Tx&&e<=Ox}function Kx(e){return e>=Ix&&e<=Bx}function Hx(e){return e>=zx&&e<=Dx}function Jx(e){return e>=Nx&&e<=Lx}function be(e,t){return{token:{type:"control",code:e},endIndex:t}}function Yx(e){if(Qx.test(e))return!0;for(let t of e){let r=t.codePointAt(0);if(r===Zx||r===qx)return!0}return!1}function qh(e){let t=0;for(let r of e){let o=r.codePointAt(0);if(Wo(o))return 2;if(Jx(o))t++}if(t>=1)return 2;if(Yx(e))return 2;return 1}function Xx(e){if(e.startsWith("\x9B"))return"\x9B";return`${wt}${Sa}`}function cr(e,t){return`${e}${t.join(";")}${Mh}`}function eE(e){let t=[],r=Xx(e),o;if(e.startsWith(`${wt}${Sa}`))o=e.slice(2,-1);else if(e.startsWith("\x9B"))o=e.slice(1,-1);else return t;let n=o.length===0?[String(Oh)]:o.split(";"),i=0;while(i<n.length){let s=Number.parseInt(n[i],10);if(Number.isNaN(s)){i++;continue}if(s===Oh){t.push({type:"reset"}),i++;continue}if(s===Go||s===Vx){let u=Number.parseInt(n[i+1],10);if(u===Ux&&i+Mx<n.length){let f=cr(r,n.slice(i,i+Ih));t.push({type:"start",code:f,endCode:pe.color.ansi(s===Go?ba:_a)}),i+=Ih;continue}if(u===Fx&&i+jx<n.length){let f=cr(r,n.slice(i,i+Bh));t.push({type:"start",code:f,endCode:pe.color.ansi(s===Go?ba:_a)}),i+=Bh;continue}let l=cr(r,[n[i]]);t.push({type:"start",code:l,endCode:pe.color.ansi(s===Go?ba:_a)}),i++;continue}if(Zh.has(s)){t.push({type:"end",endCode:pe.color.ansi(s)}),i++;continue}let a=pe.codes.get(s);if(a!==void 0){let u=cr(r,[n[i]]);t.push({type:"start",code:u,endCode:pe.color.ansi(a)}),i++;continue}let c=cr(r,[n[i]]);t.push({type:"start",code:c,endCode:pe.reset.open}),i++}if(t.length===0)t.push({type:"reset"});return t}function tE(e,t){let r=e.codePointAt(t),o;if(r===ur){if(e[t+1]!==Sa)return;o=t+2}else if(r===Nh)o=t+1;else return;let n=!0;for(let i=o;i<e.length;i++){let s=e.codePointAt(i);if(Hx(s)){let c=e.slice(t,i+1);if(e[i]!==Mh||!n)return be(c,i+1);return{token:{type:"sgr",code:c,fragments:eE(c)},endIndex:i+1}}if(Gx(s)){if(!Wx(s))n=!1;continue}if(Kx(s)){n=!1;continue}let a=i;return be(e.slice(t,a),a)}return be(e.slice(t),e.length)}function rE(e,t){let r,o,n=e.codePointAt(t);if(n===ur&&e.startsWith(xa,t))r=xa,o=$x;else if(n===Jo&&e.startsWith(Ea,t))r=Ea,o=Ax;else return;let i=e.indexOf(";",t+r.length);if(i===-1)return be(e.slice(t),e.length);for(let s=i+1;s<e.length;s++){let a=e[s];if(a===va){let c=e.slice(t,s+1),u=s===i+1?"close":"open";return{token:{type:"hyperlink",code:c,action:u,closePrefix:o,terminator:va},endIndex:s+1}}if(a===wt&&e[s+1]===Ko){let c=e.slice(t,s+2),u=s===i+1?"close":"open";return{token:{type:"hyperlink",code:c,action:u,closePrefix:o,terminator:jh},endIndex:s+2}}if(a===Ho){let c=e.slice(t,s+1),u=s===i+1?"close":"open";return{token:{type:"hyperlink",code:c,action:u,closePrefix:o,terminator:Ho},endIndex:s+1}}}return be(e.slice(t),e.length)}function oE(e,t){let r=e.codePointAt(t),o,n=!1;switch(r){case ur:{switch(e[t+1]){case Fh:{o=t+2,n=!0;break}case wx:case vx:case xx:case Ex:{o=t+2;break}case Ko:return be(jh,t+2);default:return}break}case Jo:{o=t+1,n=!0;break}case zh:case Dh:case Vh:case Uh:{o=t+1;break}case Lh:return be(Ho,t+1);default:return}for(let i=o;i<e.length;i++){if(n&&e[i]===va)return be(e.slice(t,i+1),i+1);if(e[i]===wt&&e[i+1]===Ko)return be(e.slice(t,i+2),i+2);if(e[i]===Ho)return be(e.slice(t,i+1),i+1)}return be(e.slice(t),e.length)}function pr(e,t){let r=e.codePointAt(t);if(r===ur||r===Jo){let n=rE(e,t);if(n)return n}let o=oE(e,t);if(o)return o;return tE(e,t)}function Qh(e,t,r){while(t<e.length){let o=e.codePointAt(t);if(!lr.has(o))break;let n=pr(e,t);if(!n)break;r.push(n.token),t=n.endIndex}return t}function Wh(e,t,r){let o=r.containing(t);if(!o||o.index!==t)return;return{token:{type:"character",value:o.segment,visibleWidth:qh(o.segment),isGraphemeContinuation:!1},endIndex:t+o.segment.length}}function nE(e){let t=[],r=0;while(r<e.length){let o=e.codePointAt(r);if(lr.has(o)){let i=pr(e,r);if(i){r=i.endIndex;continue}}let n=String.fromCodePoint(o);t.push({value:n,visibleWidth:1,isGraphemeContinuation:!1}),r+=n.length}return t}function iE(e){if(e.length===0)return;let t=e.map(({value:i})=>i).join(""),r=[],o=0;for(let i of e)r.push(o),o+=i.value.length;let n=0;for(let i of $a.segment(t)){while(n<e.length&&r[n]<i.index)n++;let s=n,a=!0;while(s<e.length&&r[s]<i.index+i.segment.length)e[s].visibleWidth=a?qh(i.segment):0,e[s].isGraphemeContinuation=!a,a=!1,s++;n=s}}function wa(e,{endCharacter:t=Number.POSITIVE_INFINITY}={}){let r=[],o=nE(e);iE(o);let n=0,i=0,s=0;while(n<e.length){let a=e.codePointAt(n);if(lr.has(a)){let p=pr(e,n);if(p){r.push(p.token),n=p.endIndex;continue}}let c=String.fromCodePoint(a),u=o[i],l=Wo(a)?2:c.length;if(u)l=u.visibleWidth;let f={type:"character",value:c,visibleWidth:l,isGraphemeContinuation:u?u.isGraphemeContinuation:!1};if(r.push(f),n+=c.length,i++,s+=f.visibleWidth,s>=t){let p=o[i];if(!p||!p.isGraphemeContinuation){n=Qh(e,n,r);break}}}return r}function Gh(e,t){let r=`${e}${t}`,o=e.length;for(let n of $a.segment(r)){if(n.index===o)return!1;if(n.index>o)return!0}return!0}function sE(e,t,r,o){if(!r)return!1;let n=t,i=!1;while(n<e.length){let s=e.codePointAt(n);if(lr.has(s)){let c=pr(e,n);if(c){i=!0,n=c.endIndex;continue}}if(!i)return!1;let a=Wh(e,n,o);if(!a)return!0;return Gh(r,a.token.value)}return!1}function Aa(e,{endCharacter:t=Number.POSITIVE_INFINITY}={}){let r=[],o=$a.segment(e),n=0,i=0,s,a=!1;while(n<e.length){let c=e.codePointAt(n);if(lr.has(c)){let l=pr(e,n);if(l){r.push(l.token),n=l.endIndex,a=!0;continue}}let u=Wh(e,n,o);if(!u)return wa(e,{endCharacter:t});if(a&&s&&Gh(s,u.token.value))return wa(e,{endCharacter:t});if(r.push(u.token),n=u.endIndex,i+=u.token.visibleWidth,a=!1,s=u.token.value,i>=t){if(sE(e,n,s,o))return wa(e,{endCharacter:t});n=Qh(e,n,r);break}}return r}var ur=27,zh=144,Dh=152,Nh=155,Lh=156,Jo=157,Vh=158,Uh=159,lr,wt="\x1B",va="\x07",Sa="[",Fh="]",wx="P",vx="X",xx="^",Ex="_",Mh="m",Ko="\\",jh,Sx="\x9D",Ho="\x9C",xa,Ea,$x,Ax,kx,Px,Cx,Rx,Tx,Ox,Ix,Bx,zx,Dx,Nx=127462,Lx=127487,Oh=0,Go=38,ba=39,Vx=48,_a=49,Ux=5,Fx=2,Ih=3,Bh=5,Mx=2,jx=4,Zx=65039,qx=8419,Qx,$a,Zh;var Kh=_(()=>{ma();Th();lr=new Set([ur,zh,Dh,Nh,Lh,Jo,Vh,Uh]),jh=`${wt}${Ko}`,xa=`${wt}${Fh}8;`,Ea=`${Sx}8;`,$x=`${xa};`,Ax=`${Ea};`,kx="0".codePointAt(0),Px="9".codePointAt(0),Cx=";".codePointAt(0),Rx=":".codePointAt(0),Tx="0".codePointAt(0),Ox="?".codePointAt(0),Ix=" ".codePointAt(0),Bx="/".codePointAt(0),zx="@".codePointAt(0),Dx="~".codePointAt(0),Qx=/\p{Emoji_Presentation}/v,$a=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Zh=new Set;for(let[,e]of pe.codes)Zh.add(e)});function aE(e,t){for(let r of t)switch(r.type){case"reset":{e.clear();break}case"end":{e.delete(r.endCode);break}case"start":{e.delete(r.endCode),e.set(r.endCode,r.code);break}default:break}return e}function cE(e){return[...e.keys()].toReversed().join("")}function uE(e){return`${e.closePrefix}${e.terminator}`}function lE(e,t){let r=!1,o=!1;for(let n of e.fragments){if(n.type==="start"){r=!0;continue}if(n.type==="reset"&&t.size>0){o=!0;continue}if(n.type==="end"&&t.has(n.endCode))o=!0}return o&&!r}function pE(e){return e.fragments.some((t)=>t.type==="start")}function Hh(e){if(e.activeHyperlink&&!e.activeHyperlinkHasVisibleText&&e.activeHyperlinkOutputIndex!==void 0){let t=e.activeHyperlink.code.length;if(e.returnValue=e.returnValue.slice(0,e.activeHyperlinkOutputIndex)+e.returnValue.slice(e.activeHyperlinkOutputIndex+t),e.pendingSgrOutputIndex!==void 0&&e.pendingSgrOutputIndex>e.activeHyperlinkOutputIndex)e.pendingSgrOutputIndex-=t}e.activeHyperlink=void 0,e.activeHyperlinkHasVisibleText=!1,e.activeHyperlinkOutputIndex=void 0}function dE(e){if(e.isPastEnd&&!lE(e.token,e.activeStyles))return e;if(e.include&&pE(e.token)&&e.pendingSgrOutputIndex===void 0)e.pendingSgrOutputIndex=e.returnValue.length,e.pendingSgrActiveStyles=new Map(e.activeStyles);if(e.activeStyles=aE(e.activeStyles,e.token.fragments),e.include)e.returnValue+=e.token.code;return e}function fE(e){if(e.isPastEnd&&(e.token.action!=="close"||!e.activeHyperlink))return e;if(e.token.action==="open"){if(e.activeHyperlink=e.token,e.activeHyperlinkHasVisibleText=!1,e.activeHyperlinkOutputIndex=void 0,e.include)e.activeHyperlinkOutputIndex=e.returnValue.length}else if(e.token.action==="close"){if(e.include&&e.activeHyperlink&&!e.activeHyperlinkHasVisibleText)return Hh(e),e;e.activeHyperlink=void 0,e.activeHyperlinkHasVisibleText=!1,e.activeHyperlinkOutputIndex=void 0}if(e.include)e.returnValue+=e.token.code;return e}function mE(e){if(!e.isPastEnd&&e.include)e.returnValue+=e.token.code;return e}function hE(e){if(!e.include&&e.position>=e.start&&!e.token.isGraphemeContinuation){if(e.include=!0,e.returnValue=[...e.activeStyles.values()].join(""),e.activeHyperlink)e.activeHyperlinkOutputIndex=e.returnValue.length,e.returnValue+=e.activeHyperlink.code}if(e.include){if(e.returnValue+=e.token.value,e.pendingSgrOutputIndex=void 0,e.pendingSgrActiveStyles=void 0,e.activeHyperlink)e.activeHyperlinkHasVisibleText=!0}return e.position+=e.token.visibleWidth,e}function yE(e){let t=gE[e.token.type];if(!t)return e;return t(e)}function bE(e){let t=Array.from({length:e.length},()=>!1),r=!1;for(let o=e.length-1;o>=0;o--){let n=e[o];if(t[o]=r,n.type==="character")r=Boolean(n.isGraphemeContinuation)}return t}function _E(e,t,r){if(r===void 0)return!1;if(t>=r)return!0;return e.type==="character"&&!e.isGraphemeContinuation&&t+e.visibleWidth>r}function oe(e,t,r){let o=Aa(e,{endCharacter:r}),n=bE(o),i=new Map,s,a=!1,c,u,l,f=0,p="",d=!1;for(let[m,h]of o.entries()){let y=_E(h,f,r);if(y&&h.type!=="character"&&n[m])y=!1;if(y&&h.type==="character"&&!h.isGraphemeContinuation){if(s&&!a){let b={activeHyperlink:s,activeHyperlinkHasVisibleText:a,activeHyperlinkOutputIndex:c,pendingSgrOutputIndex:u,returnValue:p};Hh(b),{activeHyperlink:s,activeHyperlinkHasVisibleText:a,activeHyperlinkOutputIndex:c,pendingSgrOutputIndex:u,returnValue:p}=b}if(u!==void 0)p=p.slice(0,u),i=l,u=void 0,l=void 0;break}({activeStyles:i,activeHyperlink:s,activeHyperlinkHasVisibleText:a,activeHyperlinkOutputIndex:c,pendingSgrOutputIndex:u,pendingSgrActiveStyles:l,position:f,returnValue:p,include:d}=yE({token:h,isPastEnd:y,start:t,activeStyles:i,activeHyperlink:s,activeHyperlinkHasVisibleText:a,activeHyperlinkOutputIndex:c,pendingSgrOutputIndex:u,pendingSgrActiveStyles:l,position:f,returnValue:p,include:d}))}if(!d)return"";if(s)p+=uE(s);return p+=cE(i),p}var gE;var ka=_(()=>{Kh();gE={sgr:dE,hyperlink:fE,control:mE,character:hE}});import Jh from"process";function Xo(e,{showCursor:t=!1,defaultWidth:r,defaultHeight:o}={}){let n=0,i=Yo(e,r),s="",a=e.isTTY===!0,c=(p)=>{if(p==="")return;if(a){e.write(wE+p+vE);return}e.write(p)},u=(p,d,m=!0)=>{let h=String(p),y=h.endsWith(`
|
|
89
|
+
`)?h:`${h}
|
|
90
|
+
`,b=ar(y,d,{trim:!1,hard:!0,wordWrap:!1}),{text:S,wasClipped:x}=m?EE(e,b,o):{text:b,wasClipped:!1},A=S===""?[]:S.split(`
|
|
91
|
+
`);return{wrapped:S,lines:A,wasClipped:x}},l=()=>{s="",i=Yo(e,r),n=0},f=(...p)=>{if(!t)ua.hide();let d=Yo(e,r),{wrapped:m,lines:h,wasClipped:y}=u(p.join(" "),d);if(h.length===0){if(n>0)c(or(n));s=m,i=d,n=0;return}if(m===s&&i===d)return;if(n===0){c(m),s=m,i=d,n=h.length;return}if(i!==d||y){c(or(n)+m),s=m,i=d,n=h.length;return}let b=s===""?[]:s.split(`
|
|
92
|
+
`),{start:S,endPrevious:x,endNext:A}=SE(b,h);if(b.length!==h.length)x=b.length-1,A=h.length-1;if(S===h.length&&n===h.length)return;if(S===0){c(or(n)+m),s=m,i=d,n=h.length;return}let R=$E({prevCount:n,start:S,endPrevious:x,endNext:A,nextLines:h,nextWrappedEndsWithNewline:m.endsWith(`
|
|
93
|
+
`)});c(R),s=m,i=d,n=h.length};return f.clear=()=>{c(or(n)),l()},f.done=()=>{if(l(),!t)ua.show()},f.persist=(...p)=>{let d=n>0?or(n):"",m=Yo(e,r),{wrapped:h}=u(p.join(" "),m,!1);c(d+h),l()},f}var Yo=(e,t)=>e.columns??t??80,wE="\x1B[?2026h",vE="\x1B[?2026l",xE=(e)=>e.split(`
|
|
94
|
+
`).length,Pa=(e)=>{let t=Me(e);return t===""?0:t.split(`
|
|
95
|
+
`).length},EE=(e,t,r)=>{let o=e.rows??r??24;if(o===0)return{text:"",wasClipped:t!==""};let i=Me(t).split(`
|
|
96
|
+
`),s=Math.max(0,i.length-o);if(s===0)return{text:t,wasClipped:!1};let a=0;for(let l=0;l<s;l++)a+=Q(i[l])+1;let c=oe(t,a),u=Pa(c);while(u>o)a++,c=oe(t,a),u=Pa(c);while(a>0){let l=oe(t,a-1);if(Pa(l)>o)break;a--,c=l}return{text:c,wasClipped:a>0}},SE=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;let o=e.length-1,n=t.length-1;while(o>=r&&n>=r&&e[o]===t[n])o--,n--;return{start:r,endPrevious:o,endNext:n}},$E=({prevCount:e,start:t,endPrevious:r,endNext:o,nextLines:n,nextWrappedEndsWithNewline:i})=>{let s="",a=e-1,c=t-a;if(c>0)s+=ta(c);if(c<0)s+=zo(-c);s+=ra;let u=Math.max(0,r-t+1);for(let h=0;h<u;h++)if(s+=Cm,h<u-1)s+=ta();if(u>1)s+=zo(u-1);s+=ra;let l=n.slice(t,o+1),f=0;if(l.length>0){let h=l.join(`
|
|
97
|
+
`),y=i&&o<n.length-1&&!h.endsWith(`
|
|
98
|
+
`);if(s+=h,f=xE(h)-1,s+=Av,y)s+=`
|
|
99
|
+
`,f++}let p=t+f,m=n.length-1-p;if(m>0)s+=ta(m);if(m<0)s+=zo(-m);return s},GR,KR;var Yh=_(()=>{Tm();Qm();ya();ka();Uo();Mo();GR=Xo(Jh.stdout),KR=Xo(Jh.stderr)});function en(e,t,r){if(e.charAt(t)===" ")return t;let o=r?1:-1;for(let n=0;n<=3;n++){let i=t+n*o;if(e.charAt(i)===" ")return i}return t}function kE(e,t,r,o){if(typeof e!=="string")throw TypeError(`Expected \`input\` to be a string, got ${typeof e}`);if(typeof t!=="number")throw TypeError(`Expected \`columns\` to be a number, got ${typeof t}`);if(!Number.isFinite(t))throw TypeError(`Expected \`columns\` to be a finite number, got ${t}`);if(!AE.has(r))throw TypeError(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${r}`);if(typeof o!=="string")throw TypeError(`Expected \`options.truncationCharacter\` to be a string, got ${typeof o}`)}function Ca(e,t,r={}){let{position:o="end",space:n=!1,preferTruncationOnSpace:i=!1}=r,{truncationCharacter:s="\u2026"}=r;if(kE(e,t,o,s),t<1)return"";let a=Q(e);if(a<=t)return e;if(t===1)return s;let c={ESC:27,LEFT_BRACKET:91,LETTER_M:109},u=(m)=>m>=48&&m<=57||m===59;function l(m){let h=0;while(h+2<m.length&&m.codePointAt(h)===c.ESC&&m.codePointAt(h+1)===c.LEFT_BRACKET){let y=h+2;while(y<m.length&&u(m.codePointAt(y)))y++;if(y<m.length&&m.codePointAt(y)===c.LETTER_M){h=y+1;continue}break}return h}function f(m){let h=m.length;while(h>1&&m.codePointAt(h-1)===c.LETTER_M){let y=h-2;while(y>=0&&u(m.codePointAt(y)))y--;if(y>=1&&m.codePointAt(y-1)===c.ESC&&m.codePointAt(y)===c.LEFT_BRACKET){h=y-1;continue}break}return h}function p(m,h){let y=f(m);if(y===m.length)return m+h;return m.slice(0,y)+h+m.slice(y)}function d(m,h){let y=l(h);if(y===0)return m+h;return h.slice(0,y)+m+h.slice(y)}if(o==="start"){if(i){let h=en(e,a-t+Q(s),!0),y=oe(e,h,a).trim();return d(s,y)}if(n)s+=" ";let m=oe(e,a-t+Q(s),a);return d(s,m)}if(o==="middle"){if(n){if(s=` ${s} `,Q(s)>=t)s=s.trim()}let m=Q(s),h=Math.min(Math.floor(t/2),Math.max(0,t-m));if(i){let y=en(e,h),b=en(e,a-(t-h)+m,!0);return oe(e,0,y)+s+oe(e,b,a).trim()}return oe(e,0,h)+s+oe(e,a-(t-h)+m,a)}if(o==="end"){if(i){let h=en(e,t-Q(s)),y=oe(e,0,h);return p(y,s)}if(n)s=` ${s}`;let m=oe(e,0,t-Q(s));return p(m,s)}}var AE;var Xh=_(()=>{ka();Mo();AE=new Set(["start","middle","end"])});import PE,{setMaxListeners as CE}from"events";import{inspect as RE,styleText as TE}from"util";import{format as OE}from"util";import{EOL as Se}from"os";import{StringDecoder as IE}from"string_decoder";import{Writable as BE}from"stream";import{randomUUID as zE}from"crypto";function VE(e){return!!e&&typeof e==="object"&&typeof e.subscribe==="function"}function UE(e){return!!e&&typeof e==="object"&&e.readable===!0&&typeof e.read==="function"&&typeof e.on==="function"}function ag(){return!!process.env.LISTR_FORCE_UNICODE||process.platform!=="win32"||!!process.env.CI||!!process.env.WT_SESSION||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}function fr(e){return String(e).replace(new RegExp(FE,"gmi"),"").trim()}function rg(e,t){return e.replace(/^(?!\s*$)/gm," ".repeat(t))}function dr(e,...t){return OE(String(e),...t)}function ZE(e){let t=new BE;return t.rows=1/0,t.columns=1/0,t.write=(r)=>(e(r.toString()),!0),t}function QE(e){let t=Math.floor(e/1000),r=Math.floor(t/60),o;if(t===0&&r===0)o=`0.${Math.floor(e/100)}s`;if(t>0)o=`${t%60}s`;if(r>0)o=`${r}m${o}`;return o}function XE(e){return process.stdout.isTTY===!0||e.nonTTY===!0}function tn(e){if(typeof e==="string")return Ra[e]??Ra.default;return typeof e==="function"?e:Ra.default}function eS(e){if(vt(e?.silentRendererCondition))return{renderer:tn("silent"),selection:"SILENT"};let t={renderer:tn(e.renderer),options:e.rendererOptions,selection:"PRIMARY"};if(!XE(t.renderer)||vt(e?.fallbackRendererCondition))return{renderer:tn(e.fallbackRenderer),options:e.fallbackRendererOptions,selection:"SECONDARY"};return t}function vt(e,...t){if(typeof e==="function")return e(...t);else return e}function rS(e){return new Promise((t)=>{setTimeout(t,e)})}var eg,DE,sg=class{emitter=new PE;constructor(){this.emitter.setMaxListeners(0)}emit(e,t){this.emitter.emit(e,t)}on(e,t){if(!t)return;this.emitter.addListener(e,t)}once(e,t){if(!t)return;this.emitter.once(e,t)}off(e,t){if(t)this.emitter.off(e,t);else this.emitter.removeAllListeners(e)}complete(){this.emitter.removeAllListeners()}},NE,tg,LE,FE="(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+",O,cg,ME,V,rn,ug,on=class{options;process;constructor(e){this.options=e,this.options={useIcons:!0,toStderr:[],...e??{}},this.options.fields??={},this.options.fields.prefix??=[],this.options.fields.suffix??=[],this.process=this.options.processOutput??new jE}log(e,t,r){let o=this.format(e,t,r);if(this.options.toStderr.includes(e)){this.process.toStderr(o);return}this.process.toStdout(o)}toStdout(e,t,r=!0){this.process.toStdout(this.format(null,e,t),r)}toStderr(e,t,r=!0){this.process.toStderr(this.format(null,e,t),r)}wrap(e,t){if(!e)return e;return this.applyFormat(`[${e}]`,t)}splat(...e){let t=e.shift()??"";return e.length===0?t:dr(t,e)}suffix(e,...t){return t.filter(Boolean).forEach((r)=>{if(e+=this.spacing(e),typeof r==="string")e+=this.wrap(r);else if(typeof r==="object"){if(r.args??=[],typeof r.condition==="function"?!r.condition(...r.args):!(r.condition??!0))return e;e+=this.wrap(typeof r.field==="function"?r.field(...r.args):r.field,{format:r?.format(...r.args)})}}),e}prefix(e,...t){return t.filter(Boolean).forEach((r)=>{if(e=this.spacing(e)+e,typeof r==="string")e=this.wrap(r)+e;else if(typeof r==="object"){if(r.args??=[],typeof r.condition==="function"?!r.condition(...r.args):!(r.condition??!0))return e;e=this.wrap(typeof r.field==="function"?r.field(...r.args):r.field,{format:r?.format()})+e}}),e}fields(e,t){if(this.options?.fields?.prefix)e=this.prefix(e,...this.options.fields.prefix);if(t?.prefix)e=this.prefix(e,...t.prefix);if(t?.suffix)e=this.suffix(e,...t.suffix);if(this.options?.fields?.suffix)e=this.suffix(e,...this.options.fields.suffix);return e}icon(e,t){if(!e)return null;if(!t){let o=this.options.icon?.[e];t=typeof o==="function"?o():o}let r=this.options.color?.[e];if(t&&r)t=r(t);return t}format(e,t,r){if(!Array.isArray(t))t=[t];return t=this.splat(t.shift(),...t).toString().split(Se).filter((o)=>!o||o.trim()!=="").map((o)=>this.style(e,this.fields(o,{prefix:Array.isArray(r?.prefix)?r.prefix:[r?.prefix],suffix:Array.isArray(r?.suffix)?r.suffix:[r?.suffix]}))).join(Se),t}style(e,t){if(!e||!t)return t;let r=this.icon(e,!this.options.useIcons&&this.wrap(e));if(r)t=r+" "+t;return t}applyFormat(e,t){if(t?.format)return t.format(e);return e}spacing(e){return typeof e>"u"||e.trim()===""?"":" "}},Ta=class{options;buffer=[];decoder=new IE;constructor(e){this.options=e}get all(){return this.buffer}get last(){return this.buffer.at(-1)}get length(){return this.buffer.length}write(e,...t){let r=t[t.length-1];if(this.buffer.push({time:Date.now(),stream:this.options?.stream,entry:this.decoder.write(typeof e==="string"?Buffer.from(e,typeof t[0]==="string"?t[0]:void 0):Buffer.from(e))}),this.options?.limit)this.buffer=this.buffer.slice(-this.options.limit);if(typeof r==="function")r();return!0}reset(){this.buffer=[]}},og=class{stream;method;buffer;constructor(e){this.stream=e,this.method=e.write,this.buffer=new Ta({stream:e})}get out(){let e=this;return new Proxy(this.stream,{get(t,r,o){if(r==="write")return e.write.bind(e);return Reflect.get(t,r,o)}})}hijack(){this.stream.write=this.buffer.write.bind(this.buffer)}release(){this.stream.write=this.method;let e=[...this.buffer.all];return this.buffer.reset(),e}write(...e){return this.method.apply(this.stream,e)}},jE=class{options;stream;active;constructor(e,t,r){this.options=r,this.stream={stdout:new og(e??process.stdout),stderr:new og(t??process.stderr)},this.options={dump:["stdout","stderr"],leaveEmptyLine:!0,...r}}get stdout(){return this.stream.stdout.out}get stderr(){return this.stream.stderr.out}hijack(){if(this.active)throw Error("ProcessOutput has been already hijacked!");this.stream.stdout.write(eg.CURSOR_HIDE),Object.values(this.stream).forEach((e)=>e.hijack()),this.active=!0}release(){let e=Object.entries(this.stream).map(([t,r])=>({name:t,buffer:r.release()})).filter((t)=>this.options.dump.includes(t.name)).flatMap((t)=>t.buffer).sort((t,r)=>t.time-r.time).map((t)=>({...t,entry:fr(t.entry)})).filter((t)=>t.entry);if(e.length>0){if(this.options.leaveEmptyLine)this.stdout.write(Se);e.forEach((t)=>{(t.stream??this.stdout).write(t.entry+Se)})}this.stream.stdout.write(eg.CURSOR_SHOW),this.active=!1}toStdout(e,t=!0){if(t)e=e+Se;return this.stream.stdout.write(e)}toStderr(e,t=!0){if(t)e=e+Se;return this.stream.stderr.write(e)}},qE=class{spinner=!ag()?["-","\\","|","/"]:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];id;spinnerPosition=0;spin(){this.spinnerPosition=++this.spinnerPosition%this.spinner.length}fetch(){return this.spinner[this.spinnerPosition]}isRunning(){return!!this.id}start(e,t=100){this.id=setInterval(()=>{if(this.spin(),e)e()},t)}stop(){clearInterval(this.id),this.id=void 0}},ng,Oa,WE,GE=class{tasks;options;static nonTTY=!0;static rendererOptions;static rendererTaskOptions;constructor(e,t){this.tasks=e,this.options=t}render(){}end(){}},KE,HE=class{options;constructor(e){this.options=e}serialize(e,t,r){return JSON.stringify(this.generate(e,t,r))}generate(e,t,r){let o={event:e,data:t};if(typeof this.options?.task!=="boolean"){let n=Object.fromEntries(this.options.task.map((i)=>{let s=r[i];if(typeof s==="function")return[i,s.call(r)];return[i,s]}));if(Object.keys(r).length>0)o.task=n}return o}},JE,YE,Ra,tS=class{concurrency;count;queue;constructor(e){this.concurrency=e.concurrency,this.count=0,this.queue=new Set}add(e){if(this.count<this.concurrency)return this.run(e);return new Promise((t)=>{let r=()=>t(this.run(e));this.queue.add(r)})}flush(){for(let e of this.queue){if(this.count>=this.concurrency)break;this.queue.delete(e),e()}}run(e){this.count++;let t=e(),r=()=>{this.count--,this.flush()};return t.then(r,()=>{this.queue.clear()}),t}},oS=class{task;constructor(e){this.task=e}get title(){return this.task.title}set title(e){e=Array.isArray(e)?e:[e],this.task.title$=dr(e.shift(),...e)}get output(){return this.task.output}set output(e){if(e===null){this.task.outputReset$=null;return}e=Array.isArray(e)?e:[e],this.task.output$=dr(e.shift(),...e)}set promptOutput(e){this.task.promptOutput$=e}get signal(){return this.task.listr.signal}cancel(){this.task.listr.cancel()}newListr(e,t){let r;if(typeof e==="function")r=e(this);else r=e;return new de(r,t,this.task)}report(e,t){if(this.task.options.collectErrors)this.task.listr.errors?.push(new NE(e,t,this.task));this.task.message$={error:e.message??this.task?.title}}skip(e,...t){if(this.task.state$="SKIPPED",e)this.task.message$={skip:e?dr(e,...t):this.task?.title}}isRetrying(){return this.task.isRetrying()?this.task.retry:{count:0}}prompt(e){if(this.task.prompt)return this.task.prompt;return new e(this.task,this)}stdout(e){return ZE((t)=>{switch(e){case"PROMPT":this.promptOutput=t;break;default:this.output=t}})}run(e){return this.task.run(e,this)}},nS,iS,ig,de=class{task;options;parentTask;tasks=[];errors;ctx;events;path=[];rendererClass;rendererClassOptions;rendererSelection;boundSignalHandler;signal;concurrency;renderer;abortController;startedTasks=[];constructor(e,t,r){if(this.task=e,this.options=t,this.parentTask=r,this.options={concurrent:!1,renderer:"default",fallbackRenderer:"simple",exitOnError:!0,exitAfterRollback:!0,collectErrors:!1,registerSignalListeners:!0,...this.parentTask?.options??{},...t},this.options.concurrent===!0)this.options.concurrent=1/0;else if(typeof this.options.concurrent!=="number")this.options.concurrent=1;if(this.concurrency=new tS({concurrency:this.options.concurrent}),r)this.path=[...r.listr.path,r.title],this.errors=r.listr.errors;else this.errors=this.options.collectErrors?[]:null;if(this.parentTask?.listr.events instanceof ig)this.events=this.parentTask.listr.events;else this.events=new ig;if(this.parentTask?.listr.abortController instanceof AbortController)this.abortController=this.parentTask.listr.abortController;else this.abortController=new AbortController,CE(0,this.abortController.signal);if(this.signal=this.abortController.signal,this.options?.forceTTY||process.env.LISTR_FORCE_TTY)process.stdout.isTTY=!0,process.stderr.isTTY=!0;if(this.options?.forceUnicode)process.env.LISTR_FORCE_UNICODE="1";let o=eS({renderer:this.options.renderer,rendererOptions:this.options.rendererOptions,fallbackRenderer:this.options.fallbackRenderer,fallbackRendererOptions:this.options.fallbackRendererOptions,fallbackRendererCondition:this.options?.fallbackRendererCondition,silentRendererCondition:this.options?.silentRendererCondition});if(this.rendererClass=o.renderer,this.rendererClassOptions=o.options,this.rendererSelection=o.selection,this.add(e??[]),this.options.registerSignalListeners&&this.isRoot())this.boundSignalHandler=this.signalHandler.bind(this),process.on("SIGINT",this.boundSignalHandler).setMaxListeners(0)}isRoot(){return!this.parentTask}isSubtask(){return!!this.parentTask}add(e){this.tasks.push(...this.generate(e))}async run(e){if(!this.renderer)this.renderer=new this.rendererClass(this.tasks,this.rendererClassOptions,this.events);await this.renderer.render(),this.ctx=this.options?.ctx??e??{};let t,r=!1;try{await Promise.all(this.tasks.map((o)=>o.check(this.ctx))),await Promise.all(this.tasks.map((o)=>this.concurrency.add(()=>this.runTask(o))))}catch(o){r=!0,t=o}if(this.signal.aborted){if(await Promise.allSettled(this.startedTasks),this.isRoot())return this.cancelUnfinishedTasks(),this.renderer.end(),this.removeSignalHandler(),process.exit(127),this.ctx;throw t??Error("Interrupted.")}if(r&&this.options.exitOnError!==!1)throw this.renderer.end(t),this.removeSignalHandler(),t;if(!r)this.renderer.end(),this.removeSignalHandler();return this.ctx}cancel(){this.abortController.abort()}generate(e){return e=Array.isArray(e)?e:[e],e.map((t)=>{let r;if(this.rendererSelection==="PRIMARY")r=t.rendererOptions;else if(this.rendererSelection==="SECONDARY")r=t.fallbackRendererOptions;return new iS(this,t,this.options,this.rendererClassOptions,r)})}async runTask(e){if(!await e.check(this.ctx))return;let t=new oS(e).run(this.ctx);return this.startedTasks.push(t),t}signalHandler(){this.abortController.abort()}removeSignalHandler(){if(this.boundSignalHandler)process.removeListener("SIGINT",this.boundSignalHandler)}cancelUnfinishedTasks(e=this.tasks){for(let t of e){if(t.hasSubtasks())this.cancelUnfinishedTasks(t.subtasks);if(t.isEnabled()!==!1&&!t.hasFinalized())t.state$="CANCELLED"}}};var xt=_(()=>{eg={CURSOR_HIDE:"\x1B[?25l",CURSOR_SHOW:"\x1B[?25h"},DE=function(e){return e.WAITING="WAITING",e.STARTED="STARTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.SKIPPED="SKIPPED",e.ROLLING_BACK="ROLLING_BACK",e.ROLLED_BACK="ROLLED_BACK",e.RETRY="RETRY",e.PAUSED="PAUSED",e.PROMPT="PROMPT",e.PROMPT_COMPLETED="PROMPT_COMPLETED",e.PROMPT_FAILED="PROMPT_FAILED",e.CANCELLED="CANCELLED",e}({}),NE=class extends Error{error;type;task;path;constructor(e,t,r){super(e.message);this.error=e,this.type=t,this.task=r,this.name="ListrError",this.path=r.path,this.stack=e?.stack}},tg=class extends Error{},LE=class extends Error{};O=Object.fromEntries(Object.keys(RE.colors).map((e)=>[e,(t)=>TE(e,String(t))]));cg={warning:"\u26A0",cross:"\u2716",arrowDown:"\u2193",tick:"\u2714",arrowRight:"\u2192",pointer:"\u276F",checkboxOn:"\u2612",arrowLeft:"\u2190",squareSmallFilled:"\u25FC",pointerSmall:"\u203A",circleSlash:"\u2298"},ME={...cg,warning:"\u203C",cross:"\xD7",tick:"\u221A",pointer:">",checkboxOn:"[\xD7]",squareSmallFilled:"\u25A0",circleSlash:"\xF8"},V=ag()?cg:ME;rn={icon:{["STARTED"]:V.pointer,["FAILED"]:V.cross,["SKIPPED"]:V.arrowDown,["COMPLETED"]:V.tick,["OUTPUT"]:V.pointerSmall,["TITLE"]:V.arrowRight,["RETRY"]:V.warning,["ROLLBACK"]:V.arrowLeft,["PAUSED"]:V.squareSmallFilled,["CANCELLED"]:V.circleSlash},color:{["STARTED"]:O.yellow,["FAILED"]:O.red,["SKIPPED"]:O.yellow,["COMPLETED"]:O.green,["RETRY"]:O.yellowBright,["ROLLBACK"]:O.redBright,["PAUSED"]:O.yellowBright,["CANCELLED"]:O.red}},ug=["RETRY","ROLLBACK","FAILED"];ng={icon:{["SKIPPED_WITH_COLLAPSE"]:V.arrowDown,["SKIPPED_WITHOUT_COLLAPSE"]:V.warning,["OUTPUT"]:V.pointerSmall,["OUTPUT_WITH_BOTTOMBAR"]:V.pointerSmall,["PENDING"]:V.pointer,["COMPLETED"]:V.tick,["COMPLETED_WITH_FAILED_SUBTASKS"]:V.warning,["COMPLETED_WITH_SISTER_TASKS_FAILED"]:V.squareSmallFilled,["RETRY"]:V.warning,["ROLLING_BACK"]:V.warning,["ROLLED_BACK"]:V.arrowLeft,["FAILED"]:V.cross,["FAILED_WITH_SUBTASKS"]:V.pointer,["WAITING"]:V.squareSmallFilled,["PAUSED"]:V.squareSmallFilled,["CANCELLED"]:V.circleSlash},color:{["SKIPPED_WITH_COLLAPSE"]:O.yellow,["SKIPPED_WITHOUT_COLLAPSE"]:O.yellow,["PENDING"]:O.yellow,["COMPLETED"]:O.green,["COMPLETED_WITH_FAILED_SUBTASKS"]:O.yellow,["COMPLETED_WITH_SISTER_TASKS_FAILED"]:O.red,["RETRY"]:O.yellowBright,["ROLLING_BACK"]:O.redBright,["ROLLED_BACK"]:O.redBright,["FAILED"]:O.red,["FAILED_WITH_SUBTASKS"]:O.red,["WAITING"]:O.dim,["PAUSED"]:O.yellowBright,["CANCELLED"]:O.red}};Oa={condition:!0,field:QE,format:()=>O.dim},WE=class e{tasks;options;events;static nonTTY=!1;static rendererOptions={indentation:2,clearOutput:!1,showSubtasks:!0,collapseSubtasks:!0,collapseSkips:!0,showSkipMessage:!0,suffixSkips:!1,collapseErrors:!0,showErrorMessage:!0,suffixRetries:!0,lazy:!1,removeEmptyLines:!0,formatOutput:"wrap",pausedTimer:{...Oa,format:()=>O.yellowBright}};static rendererTaskOptions={outputBar:!0};prompt;activePrompt;spinner;logger;updater;truncate;wrap;buffer={output:new Map,bottom:new Map};cache={render:new Map,rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r,o){this.tasks=t,this.options=r,this.events=o,this.options={...e.rendererOptions,...this.options,icon:{...ng.icon,...r?.icon??{}},color:{...ng.color,...r?.color??{}}},this.spinner=this.options.spinner??new qE,this.logger=this.options.logger??new on({useIcons:!0,toStderr:[]}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color}async render(){await Promise.resolve().then(() => Yh());await Promise.resolve().then(() => Xh());await Promise.resolve().then(() => ya());if(this.updater=Xo(this.logger.process.stdout),this.truncate=Ca,this.wrap=ar,this.logger.process.hijack(),!this.options?.lazy)this.spinner.start(()=>{this.update()});this.events.on("SHOUD_REFRESH_RENDER",this.refresh)}update(){this.updater(this.create())}end(){if(this.spinner.stop(),this.events.off("SHOUD_REFRESH_RENDER",this.refresh),this.updater.clear(),this.updater.done(),!this.options.clearOutput)this.logger.process.toStdout(this.create({prompt:!1}));this.logger.process.release()}create(t){t={tasks:!0,bottomBar:!0,prompt:!0,...t};let r=[],o=this.renderer(this.tasks),n=this.renderBottomBar(),i=this.renderPrompt();if(t.tasks&&o.length>0)r.push(...o);if(t.bottomBar&&n.length>0){if(r.length>0)r.push("");r.push(...n)}if(t.prompt&&i.length>0){if(r.length>0)r.push("");r.push(...i)}return r.join(Se)}style(t,r=!1){let o=this.cache.rendererOptions.get(t.id);if(t.isSkipped()){if(r||o.collapseSkips)return this.logger.icon("SKIPPED_WITH_COLLAPSE");else if(o.collapseSkips===!1)return this.logger.icon("SKIPPED_WITHOUT_COLLAPSE")}if(r){if(this.shouldOutputToBottomBar(t))return this.logger.icon("OUTPUT_WITH_BOTTOMBAR");return this.logger.icon("OUTPUT")}if(t.hasSubtasks()){if(t.isStarted()||t.isPrompt()&&o.showSubtasks!==!1&&!t.subtasks.every((n)=>!n.hasTitle()))return this.logger.icon("PENDING");else if(t.isCompleted()&&t.subtasks.some((n)=>n.hasFailed()))return this.logger.icon("COMPLETED_WITH_FAILED_SUBTASKS");else if(t.hasFailed())return this.logger.icon("FAILED_WITH_SUBTASKS")}if(t.isStarted()||t.isPrompt())return this.logger.icon("PENDING",!this.options?.lazy&&this.spinner.fetch());else if(t.isCompleted())return this.logger.icon("COMPLETED");else if(t.isRetrying())return this.logger.icon("RETRY",!this.options?.lazy&&this.spinner.fetch());else if(t.isRollingBack())return this.logger.icon("ROLLING_BACK",!this.options?.lazy&&this.spinner.fetch());else if(t.hasRolledBack())return this.logger.icon("ROLLED_BACK");else if(t.hasFailed())return this.logger.icon("FAILED");else if(t.isCancelled())return this.logger.icon("CANCELLED");else if(t.isPaused())return this.logger.icon("PAUSED");return this.logger.icon("WAITING")}format(t,r,o){if(t.trim()==="")return[];if(r)t=r+" "+t;let n,i=(this.logger.process.stdout.columns??80)-o*this.options.indentation-2;switch(this.options.formatOutput){case"truncate":n=t.split(Se).map((s,a)=>this.truncate(this.indent(s,a),i));break;case"wrap":n=this.wrap(t,i,{hard:!0,trim:!1}).split(Se).map((s,a)=>this.indent(s,a));break;default:throw new tg("Format option for the renderer is wrong.")}if(this.options.removeEmptyLines)n=n.filter(Boolean);return n.map((s)=>rg(s,o*this.options.indentation))}shouldOutputToOutputBar(t){let r=this.cache.rendererTaskOptions.get(t.id).outputBar;return typeof r==="number"&&r!==0||typeof r==="boolean"&&r!==!1}shouldOutputToBottomBar(t){let r=this.cache.rendererTaskOptions.get(t.id).bottomBar;return typeof r==="number"&&r!==0||typeof r==="boolean"&&r!==!1||!t.hasTitle()}refresh=()=>{this.update()};renderer(t,r=0){return t.flatMap((o)=>{if(!o.isEnabled())return[];if(this.cache.render.has(o.id))return this.cache.render.get(o.id);this.calculate(o),this.setupBuffer(o);let n=this.cache.rendererOptions.get(o.id),i=this.cache.rendererTaskOptions.get(o.id),s=[];if(o.isPrompt()){if(this.activePrompt&&this.activePrompt!==o.id)throw new tg("Only one prompt can be active at the given time, please re-evaluate your task design.");else if(!this.activePrompt)o.on("PROMPT",(a)=>{let c=fr(a);if(c)this.prompt=c}),o.on("STATE",(a)=>{if(a==="PROMPT_COMPLETED"||o.hasFinalized()||o.hasReset())this.prompt=null,this.activePrompt=null,o.off("PROMPT")}),this.activePrompt=o.id}if(o.hasTitle())if(!(t.some((a)=>a.hasFailed())&&!o.hasFailed()&&o.options.exitOnError!==!1&&!(o.isCompleted()||o.isSkipped()||o.isCancelled())))if(o.hasFailed()&&n.collapseErrors)s.push(...this.format(!o.hasSubtasks()&&o.message.error&&n.showErrorMessage?o.message.error:o.title,this.style(o),r));else if(o.isSkipped()&&n.collapseSkips)s.push(...this.format(this.logger.suffix(o.message.skip&&n.showSkipMessage?o.message.skip:o.title,{field:"SKIPPED",condition:n.suffixSkips,format:()=>O.dim}),this.style(o),r));else if(o.isRetrying())s.push(...this.format(this.logger.suffix(o.title,{field:`RETRY:${o.message.retry.count}`,format:()=>O.yellow,condition:n.suffixRetries}),this.style(o),r));else if(o.isCompleted()&&o.hasTitle()&&vt(i.timer?.condition,o.message.duration))s.push(...this.format(this.logger.suffix(o?.title,{...i.timer,args:[o.message.duration]}),this.style(o),r));else if(o.isPaused())s.push(...this.format(this.logger.suffix(o.title,{...n.pausedTimer,args:[o.message.paused-Date.now()]}),this.style(o),r));else s.push(...this.format(o.title,this.style(o),r));else s.push(...this.format(o.title,this.logger.icon("COMPLETED_WITH_SISTER_TASKS_FAILED"),r));if(!o.hasSubtasks()||!n.showSubtasks){if(o.hasFailed()&&n.collapseErrors===!1&&(n.showErrorMessage||!n.showSubtasks))s.push(...this.dump(o,r,"FAILED"));else if(o.isSkipped()&&n.collapseSkips===!1&&(n.showSkipMessage||!n.showSubtasks))s.push(...this.dump(o,r,"SKIPPED"))}if(o.isPending()||i.persistentOutput)s.push(...this.renderOutputBar(o,r));if(n.showSubtasks!==!1&&o.hasSubtasks()&&(o.isPending()||o.hasFinalized()&&!o.hasTitle()||o.isCompleted()&&n.collapseSubtasks===!1&&!o.subtasks.some((a)=>this.cache.rendererOptions.get(a.id)?.collapseSubtasks===!0)||o.subtasks.some((a)=>this.cache.rendererOptions.get(a.id)?.collapseSubtasks===!1)||o.subtasks.some((a)=>a.hasFailed())||o.subtasks.some((a)=>a.hasRolledBack())||o.subtasks.some((a)=>a.isCancelled()))){let a=!o.hasTitle()?r:r+1,c=this.renderer(o.subtasks,a);s.push(...c)}if(o.hasFinalized()){if(!i.persistentOutput)this.buffer.bottom.delete(o.id),this.buffer.output.delete(o.id)}if(o.isClosed())this.cache.render.set(o.id,s),this.reset(o);return s})}renderOutputBar(t,r){let o=this.buffer.output.get(t.id);if(!o)return[];return o.all.flatMap((n)=>this.dump(t,r,"OUTPUT",n.entry))}renderBottomBar(){if(this.buffer.bottom.size===0)return[];return Array.from(this.buffer.bottom.values()).flatMap((t)=>t.all).sort((t,r)=>t.time-r.time).map((t)=>t.entry)}renderPrompt(){if(!this.prompt)return[];return[this.prompt]}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...e.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}setupBuffer(t){if(this.buffer.bottom.has(t.id)||this.buffer.output.has(t.id))return;if(t.hasFinalized())return;let r=this.cache.rendererTaskOptions.get(t.id);if(this.shouldOutputToBottomBar(t)&&!this.buffer.bottom.has(t.id))this.buffer.bottom.set(t.id,new Ta({limit:typeof r.bottomBar==="number"?r.bottomBar:1})),t.on("OUTPUT",(o)=>{let n=this.dump(t,-1,"OUTPUT",o);this.buffer.bottom.get(t.id).write(n.join(Se))}),t.on("OUTPUT_RESET",()=>{this.buffer.bottom.get(t.id)?.reset()}),t.on("STATE",(o)=>{if(o==="RETRY"||o==="ROLLING_BACK")this.buffer.bottom.delete(t.id)});else if(this.shouldOutputToOutputBar(t)&&!this.buffer.output.has(t.id))this.buffer.output.set(t.id,new Ta({limit:typeof r.outputBar==="number"?r.outputBar:1})),t.on("OUTPUT",(o)=>{this.buffer.output.get(t.id).write(o)}),t.on("OUTPUT_RESET",()=>{this.buffer.output.get(t.id)?.reset()}),t.on("STATE",(o)=>{if(o==="RETRY"||o==="ROLLING_BACK")this.buffer.output.delete(t.id)})}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id),this.buffer.output.delete(t.id)}dump(t,r,o="OUTPUT",n){if(!n)switch(o){case"OUTPUT":n=t.output;break;case"SKIPPED":n=t.message.skip;break;case"FAILED":n=t.message.error;break}if(t.hasTitle()&&o==="FAILED"&&n===t.title||typeof n!=="string")return[];if(o==="OUTPUT")n=fr(n);return this.format(n,this.style(t,!0),r+1)}indent(t,r){return r>0?rg(t.trimEnd(),this.options.indentation):t.trimEnd()}},KE=class e{tasks;options;static nonTTY=!0;static rendererOptions={pausedTimer:{...Oa,field:(t)=>`PAUSED:${t}`,format:()=>O.yellowBright}};static rendererTaskOptions={};logger;cache={rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r){if(this.tasks=t,this.options=r,this.options={...e.rendererOptions,...r,icon:{...rn.icon,...r?.icon??{}},color:{...rn.color,...r?.color??{}}},this.logger=this.options.logger??new on({useIcons:!0,toStderr:ug}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp)this.logger.options.fields.prefix.unshift(this.options.timestamp)}end(){}render(){this.renderer(this.tasks)}renderer(t){t.forEach((r)=>{this.calculate(r),r.once("CLOSED",()=>{this.reset(r)});let o=this.cache.rendererOptions.get(r.id),n=this.cache.rendererTaskOptions.get(r.id);r.on("SUBTASK",(i)=>{this.renderer(i)}),r.on("STATE",(i)=>{if(!r.hasTitle())return;if(i==="STARTED")this.logger.log("STARTED",r.title);else if(i==="COMPLETED"){let s=n?.timer;this.logger.log("COMPLETED",r.title,s&&{suffix:{...s,condition:!!r.message?.duration&&s.condition,args:[r.message.duration]}})}else if(i==="PROMPT")this.logger.process.hijack(),r.on("PROMPT",(s)=>{this.logger.process.toStderr(s,!1)});else if(i==="PROMPT_COMPLETED")r.off("PROMPT"),this.logger.process.release();else if(i==="CANCELLED")this.logger.log("CANCELLED",r.title)}),r.on("OUTPUT",(i)=>{this.logger.log("OUTPUT",i)}),r.on("MESSAGE",(i)=>{if(i.error)this.logger.log("FAILED",r.title,{suffix:{field:`FAILED: ${i.error}`,format:()=>O.red}});else if(i.skip)this.logger.log("SKIPPED",r.title,{suffix:{field:`SKIPPED: ${i.skip}`,format:()=>O.yellow}});else if(i.rollback)this.logger.log("ROLLBACK",r.title,{suffix:{field:`ROLLBACK: ${i.rollback}`,format:()=>O.red}});else if(i.retry)this.logger.log("RETRY",r.title,{suffix:{field:`RETRY:${i.retry.count}`,format:()=>O.red}});else if(i.paused){let s=o?.pausedTimer;this.logger.log("PAUSED",r.title,s&&{suffix:{...s,condition:!!i?.paused&&s.condition,args:[i.paused-Date.now()]}})}})})}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...e.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id)}},JE=class e{tasks;options;static nonTTY=!0;static rendererOptions={subtasks:!0,state:Object.values(DE),output:!0,prompt:!0,title:!0,messages:["skip","error","retry","rollback","paused"],messagesToStderr:["error","rollback","retry"],task:["hasRolledBack","isRollingBack","isCompleted","isSkipped","hasFinalized","hasSubtasks","title","hasReset","hasTitle","isPrompt","isPaused","isPending","isCancelled","isStarted","hasFailed","isEnabled","isRetrying","path"]};static rendererTaskOptions;logger;serializer;constructor(t,r){this.tasks=t,this.options=r,this.options={...e.rendererOptions,...this.options},this.logger=this.options.logger??new on({useIcons:!1}),this.serializer=new HE(this.options)}render(){this.renderer(this.tasks)}end(){}renderer(t){t.forEach((r)=>{if(this.options.subtasks)r.on("SUBTASK",(o)=>{this.renderer(o)});if(this.options.state)r.on("STATE",(o)=>{this.logger.toStdout(this.serializer.serialize("STATE",o,r))});if(this.options.output)r.on("OUTPUT",(o)=>{this.logger.toStdout(this.serializer.serialize("OUTPUT",o,r))});if(this.options.prompt)r.on("PROMPT",(o)=>{this.logger.toStdout(this.serializer.serialize("PROMPT",o,r))});if(this.options.title)r.on("TITLE",(o)=>{this.logger.toStdout(this.serializer.serialize("TITLE",o,r))});r.on("MESSAGE",(o)=>{let n=Object.fromEntries(Object.entries(o).map(([i,s])=>{if(this.options.messages.includes(i))return[i,s]}).filter(Boolean));if(Object.keys(n).length>0){let i=this.serializer.serialize("MESSAGE",n,r);if(this.options.messagesToStderr.some((s)=>Object.keys(n).includes(s)))this.logger.toStderr(i);else this.logger.toStdout(i)}})})}},YE=class e{tasks;options;static nonTTY=!0;static rendererOptions={logTitleChange:!1,pausedTimer:{...Oa,format:()=>O.yellowBright}};static rendererTaskOptions;logger;cache={rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r){if(this.tasks=t,this.options=r,this.options={...e.rendererOptions,...this.options,icon:{...rn.icon,...r?.icon??{}},color:{...rn.color,...r?.color??{}}},this.logger=this.options.logger??new on({useIcons:!1,toStderr:ug}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp)this.logger.options.fields.prefix.unshift(this.options.timestamp)}render(){this.renderer(this.tasks)}end(){}renderer(t){t.forEach((r)=>{this.calculate(r),r.once("CLOSED",()=>{this.reset(r)});let o=this.cache.rendererOptions.get(r.id),n=this.cache.rendererTaskOptions.get(r.id);if(r.on("SUBTASK",(i)=>{this.renderer(i)}),r.on("STATE",(i)=>{if(!r.hasTitle())return;if(i==="STARTED")this.logger.log("STARTED",r.title);else if(i==="COMPLETED"){let s=n.timer;this.logger.log("COMPLETED",r.title,s&&{suffix:{...s,condition:!!r.message?.duration&&s.condition,args:[r.message.duration]}})}else if(i==="CANCELLED")this.logger.log("CANCELLED",r.title)}),r.on("OUTPUT",(i)=>{this.logger.log("OUTPUT",i)}),r.on("PROMPT",(i)=>{let s=fr(i);if(s)this.logger.log("PROMPT",s)}),this.options?.logTitleChange!==!1)r.on("TITLE",(i)=>{this.logger.log("TITLE",i)});r.on("MESSAGE",(i)=>{if(i?.error)this.logger.log("FAILED",i.error);else if(i?.skip)this.logger.log("SKIPPED",i.skip);else if(i?.rollback)this.logger.log("ROLLBACK",i.rollback);else if(i?.retry)this.logger.log("RETRY",r.title,{suffix:i.retry.count.toString()});else if(i?.paused){let s=o?.pausedTimer;this.logger.log("PAUSED",r.title,s&&{suffix:{...s,condition:!!i?.paused&&s.condition,args:[i.paused-Date.now()]}})}})})}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...e.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id)}},Ra={default:WE,simple:KE,verbose:YE,test:JE,silent:GE};nS=class extends sg{},iS=class extends nS{listr;task;options;rendererOptions;rendererTaskOptions;id=zE();state="WAITING";subtasks;title;initialTitle;output;retry;message={};prompt;parent;enabled;taskFn;closed;constructor(e,t,r,o,n){super();if(this.listr=e,this.task=t,this.options=r,this.rendererOptions=o,this.rendererTaskOptions=n,t.title){let i=Array.isArray(t?.title)?t.title:[t.title];this.title=dr(i.shift(),...i),this.initialTitle=this.title}this.taskFn=t.task,this.parent=e.parentTask}set state$(e){if(this.state=e,this.emit("STATE",e),this.hasSubtasks()&&this.hasFailed()){for(let t of this.subtasks)if(t.state==="STARTED")t.state$="FAILED"}this.listr.events.emit("SHOUD_REFRESH_RENDER")}set output$(e){this.output=e,this.emit("OUTPUT",e),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set outputReset$(e){this.output=e,this.emit("OUTPUT_RESET"),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set promptOutput$(e){if(this.emit("PROMPT",e),fr(e))this.listr.events.emit("SHOUD_REFRESH_RENDER")}set message$(e){this.message={...this.message,...e},this.emit("MESSAGE",e),this.listr.events.emit("SHOUD_REFRESH_RENDER")}set title$(e){this.title=e,this.emit("TITLE",e),this.listr.events.emit("SHOUD_REFRESH_RENDER")}get path(){return[...this.listr.path,this.initialTitle]}async check(e){if(this.state==="WAITING")this.enabled=await vt(this.task?.enabled??!0,e),this.emit("ENABLED",this.enabled),this.listr.events.emit("SHOUD_REFRESH_RENDER");return this.enabled}hasSubtasks(){return this.subtasks?.length>0}hasFinalized(){return this.isCompleted()||this.hasFailed()||this.isSkipped()||this.hasRolledBack()||this.isCancelled()}isPending(){return this.isStarted()||this.isPrompt()||this.hasReset()}isStarted(){return this.state==="STARTED"}isSkipped(){return this.state==="SKIPPED"}isCompleted(){return this.state==="COMPLETED"}hasFailed(){return this.state==="FAILED"}isCancelled(){return this.state==="CANCELLED"}isRollingBack(){return this.state==="ROLLING_BACK"}hasRolledBack(){return this.state==="ROLLED_BACK"}isRetrying(){return this.state==="RETRY"}hasReset(){return this.state==="RETRY"||this.state==="ROLLING_BACK"}isEnabled(){return this.enabled}hasTitle(){return typeof this?.title==="string"}isPrompt(){return this.state==="PROMPT"}isPaused(){return this.state==="PAUSED"}isClosed(){return this.closed}async pause(e){let t=this.state;this.state$="PAUSED",this.message$={paused:Date.now()+e},await rS(e),this.state$=t,this.message$={paused:null}}async run(e,t){let r=(i)=>{if(i instanceof de)i.options={...this.options,...i.options},i.rendererClass=tn("silent"),this.subtasks=i.tasks,i.errors=this.listr.errors,this.emit("SUBTASK",this.subtasks),i=i.run(e);else if(i instanceof Promise)i=i.then(r);else if(UE(i))i=new Promise((s,a)=>{i.on("data",(c)=>{this.output$=c.toString()}),i.on("error",(c)=>a(c)),i.on("end",()=>s(null))});else if(VE(i))i=new Promise((s,a)=>{i.subscribe({next:(c)=>{this.output$=c},error:a,complete:s})});return i},o=Date.now();this.state$="STARTED";let n=await vt(this.task?.skip??!1,e);if(n){if(typeof n==="string")this.message$={skip:n};else if(this.hasTitle())this.message$={skip:this.title};else this.message$={skip:"Skipped task without a title."};this.state$="SKIPPED";return}try{let i=typeof this.task?.retry==="number"&&this.task.retry>0?this.task.retry+1:typeof this.task?.retry==="object"&&this.task.retry.tries>0?this.task.retry.tries+1:1,s=typeof this.task.retry==="object"&&this.task.retry.delay;for(let a=1;a<=i;a++)try{await Promise.race([r(this.taskFn(e,t)),this.whenInterrupted()]);break}catch(c){if(this.listr.signal.aborted)throw c;if(a!==i){if(this.retry={count:a,error:c},this.message$={retry:this.retry},this.title$=this.initialTitle,this.output=void 0,t.report(c,"WILL_RETRY"),this.state$="RETRY",s)await this.pause(s)}else throw c}if(this.isStarted()||this.isRetrying())this.message$={duration:Date.now()-o},this.state$="COMPLETED"}catch(i){if(this.prompt instanceof LE)i=this.prompt;if(this.task?.rollback){t.report(i,"WILL_ROLLBACK");try{this.state$="ROLLING_BACK",await this.task.rollback(e,t),this.message$={rollback:this.title},this.state$="ROLLED_BACK"}catch(s){throw this.state$="FAILED",t.report(s,"HAS_FAILED_TO_ROLLBACK"),this.close(),s}if(this.listr.options?.exitAfterRollback!==!1)throw this.close(),i}else{if(this.listr.signal.aborted)throw this.state$="CANCELLED",i;if(this.state$="FAILED",this.listr.options.exitOnError!==!1&&await vt(this.task?.exitOnError,e)!==!1)throw t.report(i,"HAS_FAILED"),this.close(),i;else if(!this.hasSubtasks())t.report(i,"HAS_FAILED_WITHOUT_ERROR")}}finally{this.close()}}close(){this.emit("CLOSED"),this.listr.events.emit("SHOUD_REFRESH_RENDER"),this.complete()}whenInterrupted(){return new Promise((e,t)=>{let r=()=>{if(!this.hasSubtasks())t(Error("Interrupted."))};if(this.listr.signal.aborted){r();return}this.listr.signal.addEventListener("abort",r,{once:!0})})}},ig=class extends sg{}});function sS(e){return typeof e==="string"&&/^sha256:[a-f0-9]{64}$/.test(e)}function lg(e){if(!sS(e))throw Error(`Invalid SHA-256 digest: ${e}`)}var mr=1;import{AsyncLocalStorage as aS}from"async_hooks";function Ia(e){return e["x-arch"]==="amd64"?"amd64":"arm64"}function pg(e){if(Ia(e)!=="amd64")return{};return{nodeSelector:{"kubernetes.io/arch":"amd64"},tolerations:[{key:"arch",operator:"Equal",value:"amd64",effect:"NoExecute"}]}}var kT;var Ba=_(()=>{kT=new aS});import{execFile as cS,spawn as uS}from"child_process";import{createHash as lS}from"crypto";import{constants as za}from"fs";import{access as pS}from"fs/promises";import{chmod as BT,lstat as dS,mkdir as zT,open as fS,readdir as mg,readlink as mS,realpath as hS,symlink as DT,readFile as gS}from"fs/promises";import{delimiter as yS,dirname as bS,isAbsolute as Na,relative as hr,resolve as Et,sep as gr}from"path";import{promisify as _S}from"util";async function Va(){for(let e of(process.env.PATH??"").split(yS)){if(!e)continue;try{return await pS(Et(e,process.platform==="win32"?"git.exe":"git"),za.X_OK),!0}catch{}}return!1}function Da(e){return`sha256:${lS("sha256").update(e).digest("hex")}`}function hg(e){if(!e||e.includes("\x00")||e.includes("\\")||Na(e)||e.split("/").some((t)=>!t||t==="."||t===".."))throw Error(`Unsafe workspace path: ${JSON.stringify(e)}`)}function dg(e,t){let r=hr(e,t);return r===""||!r.startsWith(`..${gr}`)&&r!==".."&&!Na(r)}async function fg(e,t){let{stdout:r}=await La("git",["-C",e,"ls-files","-z",...t],{encoding:"buffer",maxBuffer:67108864}),o=new TextDecoder("utf-8",{fatal:!0}),n=[],i=0;for(let s=r.indexOf(0);s!==-1;s=r.indexOf(0,i)){if(s>i)n.push(o.decode(r.subarray(i,s)));i=s+1}return n}async function wS(e){let[t,r]=await Promise.all([fg(e,["--cached","--others","--exclude-standard"]),fg(e,["--others","--ignored","--exclude-standard","--",".env*","**/.env*"])]);return[...new Set([...t,...r])].sort((o,n)=>Buffer.from(o).compare(Buffer.from(n)))}async function vS(e){let t=[],r=new Set([".git",".hg",".svn","node_modules","vendor","bower_components",".venv","venv","__pycache__",".tox",".mypy_cache",".pytest_cache",".next",".nuxt",".svelte-kit",".cache",".turbo","dist","build","coverage","target","out","tmp","temp"]),o=/(?:^|[-_.])(?:secrets?|credentials?|configs?)(?:$|[-_.])/i,n=[],i=async(c)=>{try{let u=await gS(Et(c,".gitignore"),"utf8");for(let l of u.split(/\r?\n/)){let f=l.trim();if(!f||f.startsWith("#"))continue;if(f.startsWith("!"))continue;let p=f.replace(/^\//,"");if(p)n.push({base:hr(e,c).split(gr).join("/"),pattern:p.replace(/\/$/,""),directory:f.endsWith("/")})}}catch(u){if(u.code!=="ENOENT")throw u}},s=(c,u)=>{let l=!1;for(let f of n){let p=f.base?`${f.base}/`:"";if(f.base&&c!==f.base&&!c.startsWith(p))continue;let d=f.base&&c.startsWith(p)?c.slice(p.length):c,m=f.pattern.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLESTAR__").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]").replace(/__DOUBLESTAR__/g,".*"),h=new RegExp(`^(?:${m})(?:/.*)?$`),y=new RegExp(`^(?:${m})$`);if((h.test(d)||d.split("/").some((b)=>y.test(b)))&&(!f.directory||u||d.includes("/")))l=!0}return l},a=async(c)=>{await i(c);for(let u of await mg(c,{withFileTypes:!0})){let l=Et(c,u.name),f=hr(e,l).split(gr).join("/");if(u.isDirectory()){if(r.has(u.name)||o.test(u.name)||s(f,!0))continue;await a(l)}else if(u.isFile()||u.isSymbolicLink()){if(s(f,!1))continue;if(/^\.env/i.test(u.name)||/(?:secret|credential|password|token|private[-_.]?key)/i.test(u.name)||/^(?:id_rsa|id_ed25519|known_hosts|config\.json|\.npmrc|\.pypirc|\.netrc)$/i.test(u.name))continue;t.push(f)}else throw Error(`Special files are not allowed in workspaces: ${hr(e,l).split(gr).join("/")}`)}};return await a(e),t.sort((c,u)=>Buffer.from(c).compare(Buffer.from(u)))}async function xS(e){if(!await Va())return!1;try{return await La("git",["-C",e,"rev-parse","--show-toplevel"]),!0}catch(t){let{code:r,exitCode:o}=t,n=t instanceof Error?t.message:String(t);if(r==="ENOENT")return!1;if(o===128||r===128||/not a git repository/i.test(n))return!1;throw t}}async function ES(e){let t=await La("git",["-C",e,"ls-files","--others","--ignored","--exclude-standard","--directory","-z"],{encoding:"buffer",maxBuffer:67108864}),r=new TextDecoder("utf-8",{fatal:!0}),o=new Set,n=0;for(let m=t.stdout.indexOf(0);m!==-1;m=t.stdout.indexOf(0,n)){if(m>n){let h=r.decode(t.stdout.subarray(n,m));if(h.endsWith("/"))o.add(h.slice(0,-1))}n=m+1}let i=[],s=async(m)=>{for(let h of await mg(m,{withFileTypes:!0})){if(m===e&&h.name===".git")continue;let y=Et(m,h.name),b=hr(e,y).split(gr).join("/");if(h.isDirectory()){if(!o.has(b))await s(y)}else if(!h.isFile()&&!h.isSymbolicLink())i.push(b)}};if(await s(e),i.length===0)return;let a=Buffer.from(`${i.join("\x00")}\x00`),c=uS("git",["-C",e,"check-ignore","--stdin","-z"]),u=[],l=[];c.stdout.on("data",(m)=>u.push(m)),c.stderr.on("data",(m)=>l.push(m));let f=new Promise((m,h)=>{c.once("error",h),c.once("close",(y)=>{if(y===0||y===1)m();else h(Error(Buffer.concat(l).toString("utf8")||`git check-ignore exited with ${y}`))})});c.stdin.end(a),await f;let p=Buffer.concat(u),d=new Set;n=0;for(let m=p.indexOf(0);m!==-1;m=p.indexOf(0,n)){if(m>n)d.add(r.decode(p.subarray(n,m)));n=m+1}for(let m of i){let h=m.slice(m.lastIndexOf("/")+1);if(!d.has(m)||h.startsWith(".env"))throw Error(`Special files are not allowed in workspaces: ${m}`)}}function SS(e){return JSON.stringify({version:e.version,files:e.files.map((t)=>({path:t.path,type:t.type,digest:t.digest,size:t.size,mode:t.mode}))})}function Ua(e){return AS(e),Buffer.from(SS(e))}function $S(e){return Da(Ua(e))}function AS(e){if(e.version!==mr||!Array.isArray(e.files))throw Error("Unsupported workspace manifest");let t="",r=new Set;for(let o of e.files){if(hg(o.path),lg(o.digest),!Number.isSafeInteger(o.size)||o.size<0)throw Error(`Invalid size for ${o.path}`);if(o.type==="file"&&o.mode!==420&&o.mode!==493||o.type==="symlink"&&o.mode!==511)throw Error(`Invalid mode for ${o.path}`);if(o.type!=="file"&&o.type!=="symlink")throw Error(`Invalid entry type for ${o.path}`);if(r.has(o.path))throw Error(`Duplicate workspace path: ${o.path}`);for(let n of o.path.split("/").slice(0,-1).map((i,s,a)=>a.slice(0,s+1).join("/")))if(r.has(n))throw Error(`Workspace entry is used as a directory: ${n}`);if(t&&Buffer.from(t).compare(Buffer.from(o.path))>=0)throw Error("Workspace files must be bytewise sorted");r.add(o.path),t=o.path}}async function nn(e){let t=await hS(e),o=await xS(t)?await(async()=>(await ES(t),wS(t)))():await vS(t),n=[],i=new Map;for(let a of o){hg(a);let c=Et(t,a);if(!dg(t,c))throw Error(`Workspace path escapes root: ${a}`);let u;try{u=await dS(c)}catch(p){if(p.code==="ENOENT")continue;throw p}let l,f;if(u.isSymbolicLink()){let p=await mS(c);if(Na(p)||!dg(t,Et(bS(c),p)))throw Error(`Symlink escapes workspace: ${a} -> ${p}`);l=Buffer.from(p),f={path:a,type:"symlink",digest:Da(l),size:l.byteLength,mode:511}}else if(u.isFile()){let p,d=await fS(c,za.O_RDONLY|za.O_NOFOLLOW);try{let m=await d.stat();if(!m.isFile())throw Error(`Not a regular file: ${a}`);p=m.mode&73?493:420,l=await d.readFile()}finally{await d.close()}f={path:a,type:"file",digest:Da(l),size:l.byteLength,mode:p}}else throw Error(`Special files are not allowed in workspaces: ${a}`);n.push(f),i.set(f.digest,l)}let s={version:mr,files:n};return{manifest:s,digest:$S(s),blobs:[...i].map(([a,c])=>({digest:a,data:c}))}}var La;var Fa=_(()=>{La=_S(cS)});import{randomUUID as kS}from"crypto";import{execFile as PS}from"child_process";import{isAbsolute as CS,relative as wg,resolve as gg,sep as vg}from"path";import{promisify as RS}from"util";class Eg{inflight=0;maxInflight;maxPerSecond;requestStarts=[];waiting=[];rateGate=Promise.resolve();clock;sleep;constructor(e){if(this.maxInflight=e?.maxInflight??zS,this.maxPerSecond=e?.maxPerSecond??DS,!Number.isSafeInteger(this.maxInflight)||this.maxInflight<1)throw RangeError("maxInflight must be a positive integer");if(!Number.isSafeInteger(this.maxPerSecond)||this.maxPerSecond<1)throw RangeError("maxPerSecond must be a positive integer");this.clock=e?.clock??{now:()=>Date.now()},this.sleep=e?.sleep??((t)=>Bun.sleep(t))}get currentInflight(){return this.inflight}get maxConcurrent(){return this.maxInflight}get currentRequestStarts(){return this.pruneOldStarts(),this.requestStarts.length}pruneOldStarts(){let e=this.clock.now()-1000;while(this.requestStarts.length>0&&this.requestStarts[0]<=e)this.requestStarts.shift()}async acquire(){if(this.inflight<this.maxInflight){this.inflight++;return}await new Promise((e)=>{this.waiting.push(e)})}release(){if(this.waiting.length>0)this.waiting.shift()();else this.inflight--}waitForRateLimit(){let e=this.rateGate.then(async()=>{for(;;){if(this.pruneOldStarts(),this.requestStarts.length<this.maxPerSecond){this.requestStarts.push(this.clock.now());return}let t=this.requestStarts[0];await this.sleep(Math.max(1,t+1000-this.clock.now()))}});return this.rateGate=e.catch(()=>{}),e}async run(e){await this.acquire();try{return await this.waitForRateLimit(),await e()}finally{this.release()}}}async function NS(e,t,r){let o=0,n=async()=>{for(;;){let i=o++;if(i>=e.length)return;await r(e[i])}};await Promise.all(Array.from({length:Math.min(t,e.length)},n))}function LS(e,t){return wg(e,t).split(vg).join("/")||"."}function bg(e,t,r,o){let n=wg(e,t);if(n.startsWith(`..${vg}`)||n===".."||CS(n))throw Error(`${r} must stay inside the git repo for service ${o}`);return LS(e,t)}function VS(e){if(!e.build||typeof e.build==="string"||!e.build.args)return[];if(Array.isArray(e.build.args))return[...e.build.args];return Object.entries(e.build.args).filter(([,t])=>t!==null).map(([t,r])=>`${t}=${String(r)}`)}function US(e,t,r,o,n,i){if(!r.build)return;let s=r.build,a=typeof s==="string"?s:s.context??".";if(a.includes("://"))throw Error(`Remote build context is not supported for service ${t}`);if(typeof s!=="string"&&s.dockerfile_inline)throw Error(`dockerfile_inline is not supported for service ${t}`);let c=gg(o,a),u=bg(n,c,"Build context",t),l=typeof s==="string"||!s.dockerfile?void 0:gg(c,s.dockerfile);return{name:t,image:FS(e,t,i),context:u,dockerfile:l?bg(n,l,"Dockerfile",t):void 0,target:typeof s==="string"?void 0:s.target,buildArgs:VS(r)}}function FS(e,t,r=Co){return`${r.replace(/\/+$/,"")}/kuber/${e}-${t}:latest`}async function Ma(e){if(!await Va())return e;try{let{stdout:t}=await TS("git",["-C",e,"rev-parse","--show-toplevel"]);return t.trim()}catch(t){if(t.code==="ENOENT")return e;throw t}}async function MS(e,t,r,o,n){let i=`/blobs/${encodeURIComponent(e)}/uploads`,s=n?`?project=${encodeURIComponent(n)}`:"",a=`${i}${s}`,c=await o.run(()=>r(a,{method:"POST",json:{size:t.byteLength}})),u=c.offset;while(!c.complete&&u<t.byteLength){let l=t.subarray(u,u+OS),f=await o.run(()=>r(a,{method:"PATCH",headers:{"content-type":"application/octet-stream","upload-offset":String(u)},body:l}));if(f.offset<=u)throw Error(`Blob upload for ${e} made no progress`);u=f.offset}if(!c.complete)await o.run(()=>r(`${i}/complete${s}`,{method:"POST",json:{}}))}async function jS(e,t=k,r,o,n){let i=new Map(e.blobs.map((a)=>[a.digest,a.data]));i.set(e.digest,Ua(e.manifest));let s=o??new Eg;for(;;){let a=await s.run(()=>t("/snapshots/negotiate",{method:"POST",json:{workspace:e.digest,...n&&{project:n}}}));if(a.ready)return;if(a.missing.length===0)throw Error("Snapshot negotiation is incomplete but reported no missing blobs");await NS(a.missing,s.maxConcurrent,async(c)=>{let u=i.get(c);if(!u)throw Error(`Server requested unknown workspace blob ${c}`);await r?.progress?.(`Uploading ${c}`),await MS(c,u,t,s,n)})}}async function ZS(e,t,r,o){if(e.type==="status"){if(!r?.has(e.status.state))r?.add(e.status.state),await t?.progress?.(`${o?`${o}: `:""}Build ${e.status.state}`);return 0}if(t?.stream)t.stream.write(o?`[${o}] ${e.message}`:e.message);else await t?.progress?.(`${o?`${o}: `:""}${e.message.trimEnd()}`);return e.sequence}function qS(e){if(!(e instanceof Error)||e.name==="AbortError")return!1;if(e.name==="TimeoutError"||e instanceof TypeError)return!0;let t="code"in e&&typeof e.code==="string"?e.code:e.cause&&typeof e.cause==="object"&&("code"in e.cause)&&typeof e.cause.code==="string"?e.cause.code:void 0;return t==="ECONNABORTED"||t==="ECONNRESET"||t==="ECONNREFUSED"||t==="EAI_AGAIN"||t==="ETIMEDOUT"}async function _g(e,t,r,o,n,i){for(let s=1;s<=yg;s++)try{return i?.throwIfAborted(),await e(t,{...r,signal:i},{timeoutMs:BS})}catch(a){if(!qS(a)||s===yg)throw a;i?.throwIfAborted(),await n(o)}throw Error("Build poll retries exhausted")}async function QS(e,t,r,o,n,i,s,a){let c=i,u=0,l=new Set;for(;;){let f=await _g(t,`/builds/${encodeURIComponent(e)}/events?after=${u}`,void 0,o,n,s);for(let p of f)u=Math.max(u,await ZS(p,r,l,a));if(c.state==="succeeded"||c.state==="failed")return c;if(c=await _g(t,`/builds/${encodeURIComponent(e)}/reconcile`,{method:"POST",json:{}},o,n,s),c.state!=="succeeded"&&c.state!=="failed")s?.throwIfAborted(),await n(o)}}async function sn(e,t,r={}){let o=r.request??k,n=Object.entries(t.services??{}).filter(([,a])=>a.build).map(([a])=>a),i=Array(n.length),s=0;return await Promise.all(Array.from({length:Math.min(xg,n.length)},async()=>{for(;;){let a=s++;if(a>=n.length)return;let c=n[a];r.signal?.throwIfAborted();try{i[a]=(await o("/images/resolve",{method:"POST",json:{project:e,service:c},signal:r.signal})).reference}catch(u){throw Error(`Cannot resolve a published image for service ${c}. Run kuber up to build it.`,{cause:u})}}})),Object.fromEntries(n.map((a,c)=>[a,i[c]]))}async function Sg(e,t,r=process.cwd(),o,n={}){if(!Object.values(t.services??{}).some((b)=>b.build))return{built:[],changed:[],images:{}};let i=n.buildConcurrency??xg;if(!Number.isSafeInteger(i)||i<1)throw RangeError("buildConcurrency must be a positive integer");let s=n.request??k,a=n.workspaceRoot;if(!a&&!n.snapshot)try{a=await Ma(r)}catch(b){a=r}a??=r;let c=n.snapshot??await nn(a),u=Object.entries(t.services??{}).flatMap(([b,S])=>{let x=US(e,b,S,r,a,n.registry??Co);return x?[x]:[]});await jS(c,s,o,n.scheduler,e);let l=Array(u.length),f=0,p,d=!1,m=async()=>{while(!d&&f<u.length){let b=f++,S=u[b];try{n.signal?.throwIfAborted(),await o?.progress?.(`Building ${S.name}`),l[b]=await h(S)}catch(x){if(!d)p=x;d=!0}}},h=async(b)=>{let S=kS(),x={version:mr,id:S,project:e,service:b.name,spec:{architecture:Ia(t),image:b.image,context:b.context,dockerfile:b.dockerfile,target:b.target,buildArgs:b.buildArgs,workspace:c.digest}},A=await s("/builds",{method:"POST",json:x,signal:n.signal},{timeoutMs:300000}),R=await QS(S,s,o,n.pollIntervalMs??IS,n.sleep??((Z)=>Bun.sleep(Z)),A,n.signal,b.name);if(R.state!=="succeeded")throw Error(`Build failed for service ${b.name}: ${R.error??"unknown error"}`);return(await s(`/builds/${encodeURIComponent(S)}/result`,{signal:n.signal})).reference};if(await Promise.all(Array.from({length:Math.min(i,u.length)},m)),d)throw p;let y=Object.fromEntries(u.map((b,S)=>[b.name,l[S]]));return{built:u.map((b)=>b.name),changed:u.map((b)=>b.name),images:y}}var TS,OS=8388608,IS=1000,BS=300000,yg=3,xg=3,zS=20,DS=40;var ja=_(()=>{Ba();q();Ro();Fa();TS=RS(PS)});function $g(e){return WS[e.kind]??999}function Ag(e){return[...e].sort((t,r)=>$g(t)-$g(r))}var WS,tO,rO;var an=_(()=>{Ve();WS={Namespace:0,GarageBucket:1,GarageKey:2,ServiceAccount:3,ClusterRole:4,Role:5,ClusterRoleBinding:6,RoleBinding:7,StorageClass:8,PersistentVolumeClaim:9,Secret:10,ConfigMap:11,Service:12,Deployment:13,HorizontalPodAutoscaler:14,Ingress:15,IngressRoute:16},tO=`app.kubernetes.io/managed-by=${H["app.kubernetes.io/managed-by"]}`,rO=H["app.kubernetes.io/managed-by"]});function JS(e){return`${HS}-${e}`}function Za(e){return encodeURIComponent(e)}function kg(e,t){return`postgresql://${Za(t.username)}:${Za(t.password)}@${qa}:${Qa}/${Za(e.database)}`}function Pg(e){if(!e.startsWith("postgresql:"))return;let t=e.split(":");if(t.length!==2)throw Error(`Invalid postgres volume ${e}. Use postgresql:<name> or postgresql:<user>/<database>.`);let r=t[1]?.trim();if(!r)throw Error(`Invalid postgres volume ${e}. Use postgresql:<name> or postgresql:<user>/<database>.`);let o=r.split("/");if(o.length>2||o.some((s)=>s.trim()===""))throw Error(`Invalid postgres volume ${e}. Use postgresql:<name> or postgresql:<user>/<database>.`);let n=o[0],i=o[1]??n;return{username:n,database:i}}function Cg(e){return typeof e==="string"&&Pg(e)!==void 0}function YS(e,t){let r=t.volumes?.flatMap((o)=>{if(typeof o!=="string")return[];let n=Pg(o);return n?[{...n,service:e,secretName:JS(n.username)}]:[]})??[];if(r.length>1)throw Error(`Service ${e} declares multiple postgres volumes. Only zero or one postgresql:<...> entry is allowed per service.`);return r[0]}function nt(e){let t=Object.entries(e.services??{}).flatMap(([o,n])=>{let i=YS(o,n);return i?[i]:[]}),r=new Map;for(let o of t){let n=r.get(o.database);if(n&&n!==o.username)throw Error(`Database ${o.database} is claimed by both ${n} and ${o.username}. A database can only have one owner.`);r.set(o.database,o.username)}return t}var KS="database",HS="postgres",qa,Qa=5432;var yr=_(()=>{Ve();an();qa=`c.${KS}.svc.cluster.local`});function cn(e,t){if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return t;let r=Array.isArray(e)?[...e]:{...e};for(let o of Object.keys(t)){let n=r[o],i=t[o];if(Array.isArray(n)&&Array.isArray(i))r[o]=[...n,...i];else if(n&&typeof n==="object"&&i&&typeof i==="object")r[o]=cn(n,i);else r[o]=i}return r}function Rg(e){if(!e.startsWith("s3:"))return;let t=e.split(":");if(t.length!==2)throw Error(`Invalid S3 volume ${e}. Use s3:<name> or s3:<key>/<bucket>.`);let r=t[1]?.trim();if(!r)throw Error(`Invalid S3 volume ${e}. Use s3:<name> or s3:<key>/<bucket>.`);let o=r.split("/");if(o.length>2||o.some((s)=>s.trim()===""))throw Error(`Invalid S3 volume ${e}. Use s3:<name> or s3:<key>/<bucket>.`);let n=o[0],i=o[1]??n;return{key:n,bucket:i}}function Tg(e){return typeof e==="string"&&Rg(e)!==void 0}function XS(e,t){let r=t.volumes?.flatMap((o)=>{if(typeof o!=="string")return[];let n=Rg(o);return n?[{...n,service:e}]:[]})??[];if(r.length>1)throw Error(`Service ${e} declares multiple S3 volumes. Only zero or one s3:<...> entry is allowed per service.`);return r[0]}function it(e){let t=Object.entries(e.services??{}).flatMap(([o,n])=>{let i=XS(o,n);return i?[i]:[]}),r=new Map;for(let o of t){let n=r.get(o.key);if(n&&n!==o.bucket)throw Error(`S3 key ${o.key} is claimed for both ${n} and ${o.bucket}. A managed key can only target one bucket.`);r.set(o.key,o.bucket)}return t}var br=_(()=>{Ve();an()});import{existsSync as Og,readFileSync as e$,realpathSync as Ga,statSync as t$}from"fs";import{dirname as r$,isAbsolute as Ig,normalize as o$,relative as n$,resolve as un,sep as Bg}from"path";function St(e,t){return Object.assign(Error(e),t?{code:t}:{})}function i$(e){if(!e||e.includes("\x00")||e.includes("\\")||e.startsWith("~")||Ig(e))throw St(`Artifact path must be workspace-relative: ${e}`);let t=o$(e);if(t===".."||t.startsWith(`..${Bg}`))throw St(`Artifact path escapes the workspace: ${e}`);return t.replace(/^\.\//,"")}function Ka(e,t){let r=n$(e,t);if(r===".."||r.startsWith(`..${Bg}`)||Ig(r))throw St(`Artifact path escapes the workspace: ${t}`)}function s$(e,t){let r=t;while(!Og(r)){let o=r$(r);if(o===r)break;r=o}Ka(e,Ga(r))}function Wa(e,t){if(t!==void 0&&(!Number.isSafeInteger(t)||t<0))throw Error(`${e} must be a non-negative safe integer`)}class zg{#t;#r=0;#e=0;constructor(e){Wa("maxArtifactCount",e.maxArtifactCount),Wa("maxArtifactBytes",e.maxArtifactBytes),Wa("maxTotalBytes",e.maxTotalBytes),this.#t=e}add(e,t){let r=Buffer.byteLength(t);if(this.#t.maxArtifactBytes!==void 0&&r>this.#t.maxArtifactBytes)throw St(`Artifact ${e} exceeds the ${this.#t.maxArtifactBytes} byte limit`);if(this.#t.maxArtifactCount!==void 0&&this.#r+1>this.#t.maxArtifactCount)throw St(`Artifact count exceeds the ${this.#t.maxArtifactCount} limit`);if(this.#t.maxTotalBytes!==void 0&&this.#e+r>this.#t.maxTotalBytes)throw St(`Artifact bytes exceed the ${this.#t.maxTotalBytes} byte limit`);this.#r+=1,this.#e+=r}}class je{#t;#r;#e;constructor(e){this.#t=e.strict?Ga(e.workspace):un(e.workspace),this.#r=e.strict??!1,this.#e=new zg(e)}#o(e,t){if(!this.#r)return t.expandHome&&e.startsWith("~")?un(process.env.HOME??"",e.slice(1)):un(this.#t,e);let r=un(this.#t,i$(e));return Ka(this.#t,r),s$(this.#t,r),r}isFile(e,t={}){let r=this.#o(e,t);return Og(r)&&t$(r).isFile()}readText(e,t={}){let r=this.#o(e,t);if(this.#r)Ka(this.#t,Ga(r));let o=e$(r,"utf8");return this.#e.add(e,o),o}}var Dg=()=>{};import{createHash as Mg}from"crypto";import{basename as jg}from"path";function Zg(e){if(!e.diskTag&&e.replicaCount===void 0&&!e.dataLocality)return;return{diskTag:e.diskTag?[...e.diskTag].sort():void 0,replicaCount:e.replicaCount,dataLocality:e.dataLocality}}function qg(e){return`kuber-longhorn-${Mg("sha256").update(JSON.stringify(e)).digest("hex").slice(0,12)}`}function st(e){if(typeof e==="number")return e;if(!e||e.includes("-"))return;let t=Number(e);return Number.isInteger(t)?t:void 0}function Ng(e){if(typeof e!=="string"&&typeof e!=="number")return;let t=String(e).trim(),r=a$.exec(t);if(!r)return;let o=Number(r[1]),n=Number(r[2]);if(!Number.isInteger(o)||!Number.isInteger(n))return;if(o<1||n<1)throw Error(`Invalid replica range ${t}. Range bounds must be positive integers.`);if(o>n)throw Error(`Invalid replica range ${t}. Minimum (${o}) cannot exceed maximum (${n}).`);return{kind:"range",min:o,max:n}}function pn(e,t){if(t===void 0||t.trim()==="")return;let r=Number(t);if(!Number.isInteger(r)||r<0)throw Error(`Invalid ${e} value ${JSON.stringify(t)}. Expected a non-negative integer (zero allowed for a fixed replica count), a numeric string, or a "min-max" range.`)}function Lg(e){if(e.scale!==void 0){let t=st(e.scale);if(t!==void 0)return pn("scale",String(e.scale)),t;pn("scale",String(e.scale))}if(e.deploy?.replicas!==void 0){let t=st(e.deploy.replicas);if(t!==void 0)return pn("deploy.replicas",String(e.deploy.replicas)),t;pn("deploy.replicas",String(e.deploy.replicas))}return 1}function Qg(e){let t=Ng(e.scale);if(t)return Vg(t);if(e.scale!==void 0)return{kind:"fixed",value:Lg(e)};let r=Ng(e.deploy?.replicas);if(r)return Vg(r);return{kind:"fixed",value:Lg(e)}}function Vg(e){if(e.min===e.max)return{kind:"fixed",value:e.min};return e}function c$(e){if(e.kind==="range")return e.max>1;return e.value>1}function u$(e,t,r){if(t.build){let o=r[e];if(!o)throw Error(`Missing resolved build image for service ${e}`);return o}return t.image}function Ha(e){return e?.toUpperCase()==="UDP"?"UDP":"TCP"}function dn(e){if(!e)return;return/[a-z]/i.test(e)?e:void 0}function fn(e){return typeof e==="string"?JSON.stringify(e):String(e)}function Ug(e,t){let r=String(e).trim(),o=l$.exec(r);if(!o)throw Error(`Invalid ${t} value ${fn(e)}. Expected a non-negative finite decimal number of CPU cores.`);let n=BigInt(o[1]??"0"),i=o[2]??"",s=n*1000n+(i?BigInt(i.padEnd(3,"0").slice(0,3)):0n);if(i.slice(3).replaceAll("0","")!=="")throw Error(`Invalid ${t} value ${fn(e)}. CPU cores must be representable in whole millicores.`);return s%1000n===0n?String(s/1000n):`${s}m`}function Fg(e,t){let r=e.trim(),o=p$.exec(r);if(!o)throw Error(`Invalid ${t} value ${fn(e)}. Expected a non-negative memory quantity.`);let n=o[1]??"",i=(()=>{switch(n.toLowerCase()){case"b":return"";case"k":case"kb":return"k";case"m":case"mb":return"M";case"g":case"gb":return"G";case"t":case"tb":return"T";case"p":case"pb":return"P";case"e":case"eb":return"E";default:return n}})();if(!["","n","u","m","k","M","G","T","P","E","Ki","Mi","Gi","Ti","Pi","Ei"].includes(i))throw Error(`Invalid ${t} value ${fn(e)}. Expected a valid Kubernetes or Compose memory quantity.`);return`${r.slice(0,r.length-n.length)}${i}`}function d$(e){let t=e.deploy?.resources;if(!t)return;let r={...t.limits?.cpus!==void 0?{cpu:Ug(t.limits.cpus,"deploy.resources.limits.cpus")}:{},...t.limits?.memory!==void 0?{memory:Fg(t.limits.memory,"deploy.resources.limits.memory")}:{}},o={...t.reservations?.cpus!==void 0?{cpu:Ug(t.reservations.cpus,"deploy.resources.reservations.cpus")}:{},...t.reservations?.memory!==void 0?{memory:Fg(t.reservations.memory,"deploy.resources.reservations.memory")}:{}};if(Object.keys(r).length===0&&Object.keys(o).length===0)return;return{...Object.keys(r).length>0?{limits:r}:{},...Object.keys(o).length>0?{requests:o}:{}}}function f$(e){if(typeof e==="boolean")return e;if(!e)return;switch(e.toLowerCase()){case"1":case"true":case"yes":case"on":case"ro":return!0;case"0":case"false":case"no":case"off":case"rw":return!1}}function mn(e){return e.toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,63)}function Ja(e){if(e===void 0||e===null)return;let t=String(e).trim();if(!t)return;return t}function Wg(e){if(e===void 0||e===null)return;let t=(Array.isArray(e)?e:[e]).flatMap((r)=>String(r).split(",")).map((r)=>r.trim()).filter(Boolean);return t.length>0?[...new Set(t)]:void 0}function Gg(e){if(e===void 0||e===null||e==="")return;let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=20?t:void 0}function m$(e){let[t,r]=e.split(/\s+on\s+/i,2).map((n)=>n?.trim());if(!r)return{requestedStorage:Ja(t)};let o=/^(?:(?<replicas>\d+)\s+)?(?<tags>.+)$/.exec(r);return{requestedStorage:Ja(t),diskTag:Wg(o?.groups?.tags),replicaCount:Gg(o?.groups?.replicas),dataLocality:"none"}}function h$(e){let t=/^(?<name>[^()]+)\((?<size>[^()]+)\)$/.exec(e.trim());if(!t?.groups)return;let r=t.groups.name?.trim(),{requestedStorage:o,diskTag:n,replicaCount:i,dataLocality:s}=m$(t.groups.size??"");if(!r)return;return{source:r,requestedStorage:o,diskTag:n,replicaCount:i,dataLocality:s}}function Kg(e){if(!e||Ya(e))return{source:e};let t=h$(e);if(!t)return{source:e};if(!t.source)throw Error(`Invalid volume source ${e}. Expected name(size).`);return t}function Hg(e){return Ja(e?.["x-size"])}function Jg(e){return Wg(e?.["x-diskTag"])}function Yg(e){return Gg(e?.["x-replicaCount"])}function Xg(e){return e?.["x-dataLocality"]==="none"?"none":void 0}function ey(e){return mn(`bind-${Bun.hash(e).toString(36)}`)}function Ya(e){return e.startsWith(".")||e.startsWith("/")||e.startsWith("~")||e.includes("/")}function ty(e,t){return t.isFile(e,{expandHome:!0})}function g$(e,t,r){if(Cg(e)||Tg(e))return;let o=e.split(":");if(o.length===1)return{name:`volume-${t}`,kind:"volume",target:e};let n=o.at(-1),i=n==="ro"||n==="rw",s=o.at(i?-2:-1),a=o.slice(0,i?-2:-1).join(":");if(!s)return;let{source:c,requestedStorage:u,diskTag:l,replicaCount:f,dataLocality:p}=Kg(a||void 0);return{name:c&&Ya(c)?ey(c):`volume-${t}`,kind:c&&Ya(c)?ty(c,r)?"config-file":"bind":"volume",source:c||void 0,target:s,configKey:c?jg(c):void 0,readOnly:i?n==="ro":void 0,requestedStorage:u,diskTag:l,replicaCount:f,dataLocality:p}}function y$(e,t,r){if(typeof e==="string")return g$(e,t,r);if(!e.target)return;if(e.type!=="bind"&&e.type!=="volume"&&e.type!=="tmpfs")return;let{source:o,requestedStorage:n,diskTag:i,replicaCount:s,dataLocality:a}=Kg(e.source);return{name:o?e.type==="bind"?ey(o):`${e.type}-${mn(o)||t}`:`${e.type}-${t}`,kind:e.type==="bind"&&o&&ty(o,r)?"config-file":e.type,source:o,target:e.target,readOnly:f$(e.read_only),configKey:o?jg(o):void 0,subPath:e.volume?.subpath,sizeLimit:e.type==="tmpfs"&&e.tmpfs?.size!==void 0?String(e.tmpfs.size):void 0,requestedStorage:n??Hg(e.volume),diskTag:i??Jg(e.volume),replicaCount:s??Yg(e.volume),dataLocality:a??Xg(e.volume)}}function b$(e,t){if(!t||!e)return;let r=e[t];return Hg(r)}function _$(e,t){if(!t||!e)return;let r=e[t];return Jg(r)}function w$(e,t){if(!t||!e)return;let r=e[t];return Yg(r)}function v$(e,t){if(!t||!e)return;let r=e[t];return Xg(r)}function hn(e,t,r={}){let o=e.volumes?.flatMap((i,s)=>{let a=y$(i,s,t);if(!a)return[];return[{...a,requestedStorage:a.requestedStorage??b$(r,a.source)??(a.kind==="volume"&&a.source?ln.requestedStorage:void 0),diskTag:a.diskTag??_$(r,a.source)??(a.kind==="volume"&&a.source?ln.diskTag:void 0),replicaCount:a.replicaCount??w$(r,a.source)??(a.kind==="volume"&&a.source?ln.replicaCount:void 0),dataLocality:a.dataLocality??v$(r,a.source)??(a.kind==="volume"&&a.source?ln.dataLocality:void 0)}]})??[],n=(Array.isArray(e.tmpfs)?e.tmpfs:[e.tmpfs]).filter((i)=>Boolean(i)).map((i,s)=>({name:`tmpfs-${o.length+s}`,kind:"tmpfs",target:i}));return[...o,...n]}function x$(e){if(e.length===0)return;return e.map((t)=>({name:t.name,mountPath:t.target,readOnly:t.readOnly,subPath:t.kind==="config-file"?t.configKey:t.subPath}))}function E$(e,t){if(t.length===0)return;return t.map((r)=>{if(r.kind==="config-file")return{name:r.name,configMap:{name:r.name}};if(r.kind==="bind"){if(!r.source)return{name:r.name,emptyDir:{}};return{name:r.name,persistentVolumeClaim:{claimName:r.name}}}if(r.kind==="tmpfs")return{name:r.name,emptyDir:{medium:"Memory",sizeLimit:r.sizeLimit}};if(!r.source)return{name:r.name,emptyDir:{}};return{name:r.name,persistentVolumeClaim:{claimName:mn(`${e}-${r.source}`)}}})}function S$(e){return[...new Set(e.split(",").map((t)=>t.trim()).filter(Boolean).map((t)=>t.startsWith("/")?t:`/${t}`))]}function $$(e){let t=/^(?<portSpec>.+):protected(?:\((?<paths>[^)]*)\))?$/.exec(e);if(!t?.groups)return{portSpec:e};let r=t.groups.portSpec?.trim();if(!r)throw Error(`Invalid protected port syntax ${e}.`);let o=t.groups.paths?.trim();if(o===void 0)return{portSpec:r,routingKind:"ingressroute"};let n=S$(o);if(n.length===0)throw Error(`Invalid protected port syntax ${e}. Expected one or more paths.`);return{portSpec:r,routingKind:"ingressroute",paths:n}}function gn(e){let t=e.ports?.flatMap((o,n)=>{if(typeof o==="number")return[{name:`port-${n}`,containerPort:o,servicePort:o,protocol:"TCP"}];if(typeof o==="string"){let a=/\/(tcp|udp)$/i.exec(o),c=a?o.slice(0,-a[0].length):o,u=a?.[1];if(!c)return[];let{portSpec:l,routingKind:f,paths:p}=$$(c),d=l.split(":"),m=st(d.at(-1));if(!m)return[];let h=st(d.at(-2)),y=h!==void 0?dn(d.at(-3)):dn(d.at(-2));return[{name:`port-${n}`,containerPort:m,servicePort:h??m,hostPort:h,host:y,protocol:Ha(u),routingKind:y?f??"ingress":void 0,paths:p}]}let i=st(o.target);if(!i)return[];let s=st(o.published);return[{name:o.name??`port-${n}`,containerPort:i,servicePort:s??i,hostPort:s,host:dn(o.host_ip),protocol:Ha(o.protocol),routingKind:dn(o.host_ip)?"ingress":void 0}]})??[],r=e.expose?.flatMap((o,n)=>{let[i,s]=String(o).split("/"),a=st(i);if(!a)return[];return[{name:`expose-${n}`,containerPort:a,servicePort:a,protocol:Ha(s)}]})??[];return[...t,...r]}function A$(e){if(e.length===0)return;let t=new Map;for(let r of e)t.set(`${r.containerPort}:${r.protocol}`,{name:r.name,containerPort:r.containerPort,hostPort:r.hostPort,protocol:r.protocol});return[...t.values()]}function k$(e){if(e.length===0)return;let t=new Map;for(let r of e)t.set(`${r.servicePort}:${r.protocol}`,{name:r.name,port:r.servicePort,targetPort:r.containerPort,protocol:r.protocol});return[...t.values()]}function P$(e,t){let r=new Set;return t.flatMap((o)=>{if(!o.host||o.routingKind==="ingressroute"||r.has(o.host))return[];return r.add(o.host),[{host:o.host,http:{paths:[{path:"/",pathType:"Prefix",backend:{service:{name:e,port:{number:o.servicePort}}}}]}}]})}function C$(e,t,r){let o=r.flatMap((n)=>{if(!n.host||n.routingKind!=="ingressroute")return[];return(n.paths&&n.paths.length>0?n.paths.map((s)=>`Host(\`${n.host}\`) && PathPrefix(\`${s}\`)`):[`Host(\`${n.host}\`)`]).map((s)=>({kind:"Rule",match:s,middlewares:[{name:"cf-auth",namespace:"routing"}],services:[{name:t,port:n.servicePort}]}))});if(o.length===0)return;return{apiVersion:"traefik.io/v1alpha1",kind:"IngressRoute",metadata:{name:t,namespace:e,labels:H},spec:{routes:o}}}function R$(e){if(!e)return[];return(Array.isArray(e)?e:[e]).map((r)=>typeof r==="string"?{path:r,required:!0}:{path:r.path,required:r.required!==!1&&r.required!=="false"})}function T$(e){let t={};for(let r of e.split(/\r?\n/)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(n===-1)continue;let i=o.slice(0,n).trim(),s=o.slice(n+1);if(!i)continue;t[i]=s}return t}async function O$(e,t){let r={};for(let o of R$(e))try{let n=t.readText(o.path);Object.assign(r,T$(n))}catch(n){if(!o.required&&n&&typeof n==="object"&&"code"in n&&n.code==="ENOENT")continue;throw n}return r}function I$(e,t,r,o,n=process.cwd(),i={},s={},a={},c=new je({workspace:n}),u={}){let l=hn(o,c,s),f=gn(o),p=Boolean(o.env_file)||Object.keys(i).length>0,d=u.replicaSpec??Qg(o),m=d.kind==="range"?d.min:d.value,h=[cn({name:t,imagePullPolicy:"Always",env:cm(o.environment),image:u$(t,o,a),command:o.command instanceof Array?o.command:o.command?o.command.split(" "):void 0,envFrom:p?[{secretRef:{name:`${t}-env`}}]:void 0,ports:A$(f),resources:d$(o),volumeMounts:x$(l)},o["x-container"]??{})],y={restartPolicy:"Always",...pg(r),volumes:E$(e,l),containers:h};if(c$(d))y.topologySpreadConstraints=[{maxSkew:1,topologyKey:"kubernetes.io/hostname",whenUnsatisfiable:"ScheduleAnyway",labelSelector:{matchLabels:{app:t}}}];return cn({apiVersion:"apps/v1",kind:"Deployment",metadata:{name:t,namespace:e,labels:H},spec:{replicas:m,strategy:{rollingUpdate:{maxSurge:"25%",maxUnavailable:"25%"}},selector:{matchLabels:{app:t}},template:{metadata:{labels:{app:t}},spec:y}}},o["x-deployment"]??{})}function B$(e,t,r){let o=k$(gn(r));if(!o)return;return{apiVersion:"v1",kind:"Service",metadata:{name:t,namespace:e,labels:H},spec:{type:"ClusterIP",selector:{app:t},ports:o}}}function z$(e,t,r){let o=P$(t,gn(r));if(o.length===0)return;return{apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:t,namespace:e,labels:H},spec:{rules:o}}}function D$(e,t,r=process.cwd(),o={},n=new je({workspace:r})){let i=new Map;for(let s of hn(t,n,o)){let a=s.kind==="bind"?s.source?s.name:void 0:s.kind==="volume"&&s.source?mn(`${e}-${s.source}`):void 0;if(!a||i.has(a))continue;let c=Zg(s);i.set(a,{apiVersion:"v1",kind:"PersistentVolumeClaim",metadata:{name:a,namespace:e,labels:H},spec:{accessModes:["ReadWriteMany"],storageClassName:c?qg(c):void 0,resources:{requests:{storage:s.requestedStorage??"1Gi"}}}})}return[...i.values()]}function N$(e,t=process.cwd(),r={},o=new je({workspace:t})){let n=new Map;for(let i of hn(e,o,r)){let s=Zg(i);if(!s)continue;let a=qg(s);n.set(a,{apiVersion:"storage.k8s.io/v1",kind:"StorageClass",metadata:{name:a,labels:H},provisioner:"driver.longhorn.io",allowVolumeExpansion:!0,reclaimPolicy:"Delete",volumeBindingMode:"Immediate",parameters:{...s.diskTag?{diskSelector:s.diskTag.join(",")}:{},...s.replicaCount!==void 0?{numberOfReplicas:String(s.replicaCount)}:{},...s.dataLocality?{dataLocality:"disabled"}:{}}})}return[...n.values()]}function L$(e,t,r=process.cwd(),o={},n=new je({workspace:r})){let i=new Map;for(let s of hn(t,n,o)){if(s.kind!=="config-file"||!s.source||!s.configKey)continue;i.set(s.name,{apiVersion:"v1",kind:"ConfigMap",metadata:{name:s.name,namespace:e,labels:H},data:{[s.configKey]:n.readText(s.source,{expandHome:!0})}})}return[...i.values()]}async function V$(e,t,r,o=process.cwd(),n={},i=new je({workspace:o})){let s={...await O$(r.env_file,i),...n};if(Object.keys(s).length===0)return[];return[{apiVersion:"v1",kind:"Secret",metadata:{name:`${t}-env`,namespace:e,labels:H},type:"Opaque",stringData:s}]}function U$(e){let t=Object.entries(e.stringData??{}).sort(([r],[o])=>r.localeCompare(o));return Mg("sha256").update(JSON.stringify(t)).digest("hex")}function F$(e){return{apiVersion:"v1",kind:"Namespace",metadata:{name:e,labels:H}}}function M$(e,t){let r=e.spec?.template.spec?.containers[0];if(!r)return;if(t["x-container"]?.resources?.requests?.cpu!==void 0)return;if(r.resources??={},r.resources.requests??={},r.resources.requests.cpu===void 0)r.resources.requests.cpu="100m"}function j$(e,t,r){return{apiVersion:"autoscaling/v2",kind:"HorizontalPodAutoscaler",metadata:{name:t,namespace:e,labels:H},spec:{scaleTargetRef:{apiVersion:"apps/v1",kind:"Deployment",name:t},minReplicas:r.min,maxReplicas:r.max,metrics:[{type:"Resource",resource:{name:"cpu",target:{type:"Utilization",averageUtilization:80}}}]}}}function $e(e){return`${e.kind}:${e.metadata?.namespace??""}:${e.metadata?.name??""}`}async function yn(e,t,r=process.cwd(),o={},n={},i=new je({workspace:r})){let s=new Map,a=F$(e);s.set($e(a),a);for(let[c,u]of Object.entries(t.services??{})){for(let b of N$(u,r,t.volumes,i))s.set($e(b),b);for(let b of D$(e,u,r,t.volumes,i))s.set($e(b),b);for(let b of L$(e,u,r,t.volumes,i))s.set($e(b),b);let l=await V$(e,c,u,r,o[c]??{},i);for(let b of l)s.set($e(b),b);let f=B$(e,c,u);if(f)s.set($e(f),f);let p=Qg(u),d=I$(e,c,t,u,r,o[c]??{},t.volumes,n,i,{replicaSpec:p}),m=l[0];if(m)d.spec.template.metadata.annotations={...d.spec?.template.metadata?.annotations,"kuber.astrxl.dev/env-checksum":U$(m)};if(s.set($e(d),d),p.kind==="range"){M$(d,u);let b=j$(e,c,p);s.set($e(b),b)}let h=z$(e,c,u);if(h)s.set($e(h),h);let y=C$(e,c,gn(u));if(y)s.set($e(y),y)}return[...s.values()]}var ln,a$,l$,p$;var Xa=_(()=>{Ve();Ba();yr();tt();br();Dg();ln={requestedStorage:"1Gi",diskTag:["fast"],replicaCount:2,dataLocality:"none"};a$=/^\s*(\d+)\s*-\s*(\d+)\s*$/;l$=/^(\d+)(?:\.(\d+))?$/,p$=/^(?:\d+(?:\.\d+)?|\.\d+)([a-zA-Z]*)$/});import{randomUUID as ec}from"crypto";import{isDeepStrictEqual as ry}from"util";function uy(e){return`/workspaces/${encodeURIComponent(e)}/adopt`}function oy(e,t){let r={...e};for(let[o,n]of Object.entries(t))r[o]={...r[o],...n};return r}function G$(e){let{resource:t,phase:r,state:o}=e.data;return`${r==="apply"?"Applied":r==="wait"?"Waited for":"Deleted"} ${t.kind}/${t.name}: ${o}`}function K$(e){if(!e||typeof e!=="object")return!1;let{sequence:t,data:r}=e;if(!Number.isSafeInteger(t)||!r||typeof r!=="object")return!1;let{resource:o,phase:n,state:i}=r;if(!o||typeof o!=="object")return!1;let s=o;return typeof s.apiVersion==="string"&&typeof s.kind==="string"&&typeof s.name==="string"&&(s.namespace===void 0||typeof s.namespace==="string")&&(n==="apply"||n==="wait"||n==="delete")&&(i==="started"||i==="succeeded"||i==="failed"||i==="aborted")}function H$(e,t){return{source:{uri:`cas://${t.digest}`,digest:t.digest},config:{compose:e}}}function J$(e,t){return ry(e.spec?.source,t.source)&&ry(e.spec?.config,t.config)}function ny(e){if(e instanceof we)return e.status===409;if(e instanceof DOMException&&e.name==="AbortError")return!1;if(e instanceof Error&&e.name==="AbortError")return!1;return e instanceof TypeError||e instanceof Error&&e.name==="TimeoutError"}async function Y$(e,t,r,o=k){let n=`/workspaces/${encodeURIComponent(e)}`,i=H$(t,r),s=(u)=>o(n,{method:"PUT",headers:{"if-match":`"${u.metadata.resourceVersion}"`},json:i}),a=async(u)=>{try{let l=await o(n);if(J$(l,i))return l;return await s(l)}catch{throw u}},c;try{c=await o(n)}catch(u){if(!(u instanceof we)||u.status!==404)throw u;try{return await o("/workspaces",{method:"POST",json:{id:e,...i}})}catch(l){if(!ny(l))throw l;return a(l)}}try{return await s(c)}catch(u){if(!ny(u))throw u;return a(u)}}function iy(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>t!=="operation"&&t!=="operationId"&&r!==null&&typeof r==="object"&&!Array.isArray(r)))}function bn(e,t){let r=t instanceof Error?t.message:String(t);if(!/namespace .* (?:external|different-workspace)/i.test(r))return t instanceof Error?t:Error(r);return Error(`${r}. Safe adoption requires ${cy} ${uy(e)} with namespace UID and ownership preconditions.`,{cause:t})}async function At(e,t,r,o){try{return await t(r,o)}catch(n){throw bn(e,n)}}function X$(e){if(!e||typeof e!=="object")return;let t=e.operationId;return typeof t==="string"&&t?t:void 0}function eA(e){if(!e||typeof e!=="object")return;let t=e.operation?.status;return t&&typeof t==="object"?t:void 0}function sy(e,t){let r=t.error,o=t.state==="cancelled",n=typeof r?.message==="string"?r.message:o?"The operation was cancelled":"The operation failed",i=typeof r?.code==="string"?r.code:o?"OPERATION_CANCELLED":"OPERATION_FAILED";return new we(n,o?409:500,{title:o?"Operation cancelled":"Operation failed",status:o?409:500,code:i,operationId:e})}function tA(e){if(e instanceof we)return W$.has(e.code);if(e instanceof DOMException&&e.name==="AbortError")return!1;if(e instanceof Error&&e.name==="AbortError")return!1;return e instanceof TypeError||e instanceof Error&&e.name==="TimeoutError"}function rA(e){return e.state==="failed"&&e.error?.code==="OPERATION_INTERRUPTED"}function oA(e,t){return e.cursorGap===!0||Number.isSafeInteger(e.retainedFirstSequence)&&e.retainedFirstSequence>t+1}function nA(e,t){return t+Math.max(e,0)+Q$}function ly(e){return e.reason??new DOMException("The operation was aborted","AbortError")}function $t(e){if(e?.aborted)throw ly(e)}function iA(e,t){return $t(t),new Promise((r,o)=>{let n,i=()=>{if(n!==void 0)clearTimeout(n);t?.removeEventListener("abort",a)},s=()=>{i(),r()},a=()=>{i(),o(ly(t))};if(n=setTimeout(s,e),t?.addEventListener("abort",a,{once:!0}),t?.aborted)a()})}async function tc(e,t,r,o,n,i){let s=i.now??Date.now,a=nA(n,s()),c=new Headers(o.headers);c.set("idempotency-key",ec()),c.set("prefer","respond-async");let u={...o,headers:c,signal:i.signal??o.signal},l,f=Z$,p=!1,d=0;for(;;){if($t(i.signal),p&&s()>=a)throw Error("Timed out while reconnecting to resume the operation");try{let y;if(l)y=(await At(e,t,`/operations/${encodeURIComponent(l)}`,{signal:i.signal})).status;else{p=!1;let b=await At(e,t,r,u);l=X$(b),y=eA(b)}if(l)try{let b=await At(e,t,`/operations/${encodeURIComponent(l)}/events?after=${d}`,{signal:i.signal});if(oA(b,d))throw new nc;for(let S of b.items??[]){if(!Number.isSafeInteger(S.sequence)||S.sequence<=d)continue;if(d=S.sequence,!K$(S))continue;i.onEvent?.(S)}}catch(b){if(b instanceof nc)throw b;$t(i.signal)}if(!l||!y||y.state==="succeeded")return;if(rA(y)){if(s()>=a)throw sy(l,y);l=void 0,d=0,p=!0,c.set("idempotency-key",ec()),u={...o,headers:c,signal:i.signal??o.signal}}else if(y.state==="failed"||y.state==="cancelled")throw sy(l,y)}catch(y){if($t(i.signal),y instanceof we&&y.code==="OPERATION_INTERRUPTED"){if(s()>=a)throw bn(e,y);l=void 0,d=0,p=!0,c.set("idempotency-key",ec()),u={...o,headers:c,signal:i.signal??o.signal}}else{if(!tA(y))throw bn(e,y);if(s()>=a)throw bn(e,y)}}let m=a-s();if(m<=0)throw Error("Timed out while reconnecting to resume the operation");let h=Math.min(f,m);if(i.sleep)$t(i.signal),await i.sleep(h),$t(i.signal);else await iA(h,i.signal);f=Math.min(f*2,q$)}}async function sA(e,t,r=k){let o=`/workspaces/${encodeURIComponent(e)}`;return At(e,r,`${o}/resources/plan`,{method:"POST",json:{resources:t}})}function rc(e){let t=e.name??e.metadata?.name;if(!e.apiVersion||!e.kind||!t)return;return{apiVersion:e.apiVersion,kind:e.kind,name:t,namespace:e.namespace??e.metadata?.namespace}}function ay(e){return`${e.apiVersion}\x00${e.kind}\x00${e.namespace??""}\x00${e.name}`}function aA(e,t){return`${e==="apply"?"Apply":e==="wait"?"Wait for":"Delete"} ${t.kind}/${t.name}`}function oc(e,t,r,o,n={}){if(r.length===0)return o(()=>{},e.signal);let i=new Map,s=new Set,a=0;return e.newListr(r.map((c)=>({title:aA(t,c),task:async(u,l)=>{if(i.set(ay(c),l),n.onTaskStarted?.(c,l),a+=1,a!==r.length)return new Promise((f)=>{let p=()=>{e.signal.removeEventListener("abort",p),s.delete(p),f()};if(s.add(p),e.signal.aborted)p();else e.signal.addEventListener("abort",p,{once:!0})});try{await o((f)=>{let p=f.data.resource,d=i.get(ay(p));if(!d)return;d.output=f.data.state,e.output=G$(f)},e.signal)}finally{for(let f of[...s])f()}}})),{concurrent:!0})}async function _r(e,t=k,r={}){let{project:o,compose:n,cwd:i,config:s,hookContext:a}=I(),c=r.trust??await Am(await gt(o,i)),u=t;t=async(p,d={},m)=>{let h=new Headers(d.headers);for(let[y,b]of Object.entries($m(c)))h.set(y,b);return u(p,{...d,headers:h},m)};let l=`/workspaces/${encodeURIComponent(o)}`;return await new de([{title:"Read compose",task:async(p,d)=>{if(p.compose=await n(),e)await s.preBuild?.(p.compose,await a());d.output=`${Object.keys(p.compose.services??{}).length} services`}},{title:"Snapshot workspace",task:async(p,d)=>{let m;try{m=await Ma(i)}catch(h){m=i}p.workspaceRoot=m,p.snapshot=await nn(m),d.output=`${p.snapshot.manifest.files.length} files`}},{title:"Build images",rendererOptions:{outputBar:10,persistentOutput:!0},enabled:async()=>e&&Object.values((await n()).services??{}).some((p)=>p.build),task:async(p,d)=>{let m=await Sg(o,p.compose,i,{progress:(h)=>{d.output=h},stream:d.stdout()},{...s,request:t,snapshot:p.snapshot,workspaceRoot:p.workspaceRoot,signal:d.signal});p.buildImages=m.images,await s.postBuild?.(m,await a()),d.output=`Built ${m.built.length} image${m.built.length===1?"":"s"}`}},{title:"Resolve images",enabled:async()=>!e&&Object.values((await n()).services??{}).some((p)=>p.build),task:async(p,d)=>{p.buildImages=await sn(o,p.compose,{...s,request:t}),d.output=`${Object.keys(p.buildImages).length} images`}},{title:"Update workspace",task:async(p,d)=>{let m=await Y$(o,p.compose,p.snapshot,t),h=await t(uy(o),{method:cy,json:{workspaceUid:m.metadata.uid}});d.output=h.resourcesAdopted?`Adopted ${h.resourcesAdopted} existing resources`:"Workspace ready"}},{title:"Reconcile backing services",task:async(p,d)=>{let m={},h={};await d.newListr([{title:"Reconcile databases",enabled:()=>nt(p.compose).length>0,task:async(y,b)=>{let S=await At(o,t,`${l}/databases`,{method:"POST",json:{compose:p.compose}});m=iy(S),b.output=`${Object.keys(m).length} services`}},{title:"Reconcile S3 storage",enabled:()=>it(p.compose).length>0,task:async(y,b)=>{let S=await At(o,t,`${l}/storage`,{method:"POST",json:{compose:p.compose}});h=iy(S),b.output=`${Object.keys(h).length} services`}}],{concurrent:!0}).run(),p.serviceEnv=oy(oy(p.serviceEnv,m),h)}},{title:"Render manifests",task:async(p,d)=>{p.resources=await yn(o,p.compose,i,p.serviceEnv,p.buildImages),await s.postRender?.(p.resources,await a()),d.output=`${p.resources.length} resources`}},{title:"Reconcile resources",task:async(p,d)=>{p.plan=await sA(o,p.resources,t);let m=p.plan,h=m.desired.map(rc).filter((x)=>Boolean(x)),y=m.desired.filter((x)=>x.kind==="Deployment").map(rc).filter((x)=>Boolean(x)),b=m.stale.map(rc).filter((x)=>Boolean(x)),S=`${l}/resources`;return d.newListr([{title:"Apply resources",task:async(x,A)=>oc(A,"apply",h,(R,Z)=>tc(o,t,`${S}/apply`,{method:"POST",json:{resources:m.desired}},s.rolloutTimeoutMs,{onEvent:R,signal:Z}))},{title:"Run post-apply hook",skip:!s.postApply,task:async()=>s.postApply?.(m.desired,await a())},{title:"Wait for deployments",skip:y.length===0,task:async(x,A)=>oc(A,"wait",y,(R,Z)=>tc(o,t,`${S}/wait`,{method:"POST",json:{deployments:y.map((_e)=>_e.name),timeoutMs:s.rolloutTimeoutMs}},s.rolloutTimeoutMs,{onEvent:R,signal:Z}))},{title:"Delete stale resources",skip:b.length===0,task:async(x,A)=>oc(A,"delete",b,(R,Z)=>tc(o,t,`${S}/delete`,{method:"POST",json:{resources:m.stale}},s.rolloutTimeoutMs,{onEvent:R,signal:Z}))}])}}],{rendererOptions:{collapseErrors:!1}}).run()}var cy="POST",Z$=250,q$=5000,Q$=60000,W$,nc,cA;var _n=_(()=>{M();xt();q();ja();Xa();ee();yr();br();Fa();Bo();W$=new Set(["HTTP_502","HTTP_503","HTTP_504"]);nc=class nc extends Error{constructor(){super("Operation progress history was truncated; refusing to report an incomplete resource stream")}};cA=E({meta:{name:"up",description:"Create and start deployments"},args:{build:{type:"boolean",default:!0,alias:"b",description:"Build images before starting deployments",negativeDescription:"Don't build an image, even if it's policy"}},async run({args:e}){await _r(e.build)}})});function uA(e){let t=e?.trim();if(!t)throw Error("KUBER_API_KEY or --api-key is required for kuber ci");return t}function lA(e){return(t,r={},o={})=>{let n=new Headers(r.headers);return n.set("authorization",`Bearer ${e}`),k(t,{...r,headers:n},{...o,authenticated:!1})}}async function pA(e,t,r,o=lA(r)){let{project:n,cwd:i}=I(),s=await gt(n,i);if(t)await o(`/workspaces/${encodeURIComponent(n)}/trust`,{method:"POST",json:{fingerprint:s.fingerprint}});await _r(e,o,{trust:t?s:void 0})}var dA;var py=_(()=>{M();q();ee();Bo();_n();dA=E({meta:{name:"ci",description:"Deploy using an API key without a session"},args:{apiKey:{type:"string",description:"API key (defaults to KUBER_API_KEY)"},trust:{type:"boolean",description:"Grant current directory trust before deploying"},build:{type:"boolean",default:!0,negativeDescription:"Resolve existing images without building"}},async run({args:e}){await pA(e.build,Boolean(e.trust),uA(e.apiKey??process.env.KUBER_API_KEY))}})});function fA(e,t,r=k){return r(`/workspaces/${encodeURIComponent(e)}/databases/credentials`,{method:"POST",json:{claim:t}})}var mA,hA,gA;var dy=_(()=>{M();q();ee();yr();tt();mA=E({meta:{name:"ls",description:"List managed postgres claims"},async run(){let e=nt(await I().compose());if(e.length===0){console.log("No managed postgres volumes declared");return}console.log(le(e.map((t)=>({service:t.service,username:t.username,database:t.database,secret:t.secretName}))))}}),hA=E({meta:{name:"creds",description:"Print postgres credentials for a service"},async run({args:e}){let t=e._[0];if(!t)throw Error("Service name is required");let r=I(),o=nt(await r.compose()).find((s)=>s.service===t);if(!o)throw Error(`Service ${t} does not declare a managed postgres volume.`);let n=await fA(r.project,o),i=kg(o,n);console.log(le([{service:o.service,username:n.username,database:o.database,host:qa,port:Qa,secret:o.secretName}])),console.log(`DATABASE_URL=${i}`)}}),gA=E({meta:{name:"db",description:"Inspect managed postgres databases"},subCommands:{creds:hA,ls:mA}})});function yA(e,t=!1,r=k){return r(`/workspaces/${encodeURIComponent(e)}/down`,{method:"POST",json:{full:t}})}var bA;var fy=_(()=>{M();xt();q();ee();bA=E({meta:{name:"down",description:"Delete managed resources except ingress and PVCs"},args:{full:{type:"boolean",alias:"f",description:"Also delete ingress, PVCs, and the namespace"}},async run({args:e}){let{project:t}=I();await new de([{title:"Delete resources",task:async(r,o)=>{let n=await yA(t,e.full);o.output=`${n.delete.length} resources queued`}}]).run()}})});async function my(e,t,r=process.cwd(),o={}){let n=[...nt(t).length?["Postgres"]:[],...it(t).length?["S3"]:[]];if(n.length>0)throw Error(`Cannot export without generated ${n.join(" and ")} credentials. Export is side-effect-free; run kuber up or remove managed provider claims.`);let i=await sn(e,t,o);return yn(e,t,r,{},i)}var hy=_(()=>{Xa();yr();br();ja()});import{resolve as _A}from"path";var{YAML:wA}=globalThis.Bun;function vA(e){return`${Ag(e).map((t)=>wA.stringify(t,null,2).trimEnd()).join(`
|
|
100
100
|
---
|
|
101
101
|
`)}
|
|
102
|
-
`}var
|
|
102
|
+
`}var xA;var gy=_(()=>{M();an();ee();hy();xA=E({meta:{name:"export",description:"Write rendered manifests to a YAML file"},args:{output:{type:"string",alias:"o",description:"Output YAML file path"}},async run({args:e}){let{project:t,compose:r,cwd:o,config:n,hookContext:i}=I(),s=await my(t,await r(),o,n);await n.postRender?.(s,await i());let a=_A(o,e.output||`${t}.yaml`);await Bun.write(a,vA(s)),console.log(a)}})});function EA(e,t){let r=new URL(`${e}${t}`);return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}function $A(e){if(typeof e!=="string")throw Error("Exec frame must be JSON text");let t=JSON.parse(e);if(!t||typeof t!=="object"||!("type"in t))throw Error("Invalid exec frame");let r=t;if(r.type==="stdout"||r.type==="stderr"){if(r.encoding!=="base64"||typeof r.data!=="string")throw Error("Invalid exec output frame");return{type:r.type,data:Uint8Array.from(Buffer.from(r.data,"base64"))}}if(r.type==="exit"&&Number.isSafeInteger(r.exitCode))return r;if(r.type==="error"&&typeof r.message==="string")return r;throw Error("Invalid exec frame")}async function yy(e,t,r,o={}){if(r.aborted)throw r.reason??new DOMException("Aborted","AbortError");let n=o.session??await ht();if(!n)throw Error("Not logged in. Run kuber login first.");let i=`/workspaces/${encodeURIComponent(e)}/exec`,s=(o.socketFactory??SA)(EA(o.baseUrl??So,i),{authorization:`Bearer ${n.token}`});s.binaryType="arraybuffer",await new Promise((x,A)=>{let R=()=>{qe(),s.send(JSON.stringify({type:"start",version:1,...t})),x()},Z=(An)=>{qe(),A(An.error??Error("Exec WebSocket connection failed"))},_e=()=>{qe(),A(Error("Exec WebSocket closed before opening"))},Ze=()=>{qe(),s.close(1000,"aborted"),A(r.reason??new DOMException("Aborted","AbortError"))},qe=()=>{s.removeEventListener("open",R),s.removeEventListener("error",Z),s.removeEventListener("close",_e),r.removeEventListener("abort",Ze)};s.addEventListener("open",R),s.addEventListener("error",Z),s.addEventListener("close",_e),r.addEventListener("abort",Ze,{once:!0})});let a=[],c=[],u=!1,l,f=!1,p=[],d=(x)=>{if(u)return;u=!0,l=x,s.removeEventListener("message",m),s.removeEventListener("error",h),s.removeEventListener("close",y),r.removeEventListener("abort",b);for(let A of c.splice(0))if(x)A.reject(x);else A.resolve({done:!0,value:void 0})},m=(x)=>{try{if(!f){f=!0;for(let Z of p.splice(0))s.send(JSON.stringify(Z))}let A=$A(x.data),R=c.shift();if(R)R.resolve({done:!1,value:A});else a.push(A)}catch(A){s.close(1002,"invalid frame"),d(A)}},h=(x)=>d(x.error??Error("Exec WebSocket failed")),y=()=>d(),b=()=>{s.close(1000,"aborted"),d()};s.addEventListener("message",m),s.addEventListener("error",h),s.addEventListener("close",y),r.addEventListener("abort",b,{once:!0});let S=(x)=>{if(u)throw l??Error("Exec session is closed");if(!f){p.push(x);return}s.send(JSON.stringify(x))};return{sendStdin(x,A){S({type:"stdin",data:Buffer.from(x).toString("base64"),encoding:"base64",...A?{eof:!0}:{}})},resize(x,A){S({type:"resize",columns:x,rows:A})},close(){if(!u&&s.readyState===1)S({type:"close"});s.close(1000,"client closed"),d()},[Symbol.asyncIterator](){return{next(){let x=a.shift();if(x)return Promise.resolve({done:!1,value:x});if(l)return Promise.reject(l);if(u)return Promise.resolve({done:!0,value:void 0});return new Promise((A,R)=>c.push({resolve:A,reject:R}))}}}}}var SA=(e,t)=>new WebSocket(e,{headers:t});var by=_(()=>{Ve();Ao()});function _y(){return{columns:process.stdout.columns,rows:process.stdout.rows}}async function AA(e,t,r,o,n=yy,i){if(!t)throw Error("Deployment name is required");if(r.length===0)throw Error("Command is required");let s=Boolean(process.stdin.isTTY&&process.stdout.isTTY&&process.stdin.isRaw),a=await n(e,{deployment:t,command:r,tty:s,...s?_y():{}},o,i),c=(f)=>a.sendStdin(typeof f==="string"?new TextEncoder().encode(f):f),u=()=>a.sendStdin(new Uint8Array,!0),l=()=>{let{columns:f,rows:p}=_y();if(f&&p)a.resize(f,p)};if(process.stdin.on("data",c),process.stdin.once("end",u),s)process.stdout.on("resize",l);try{for await(let f of a)if(f.type==="stdout")process.stdout.write(f.data);else if(f.type==="stderr")process.stderr.write(f.data);else if(f.type==="error")throw Error(f.message);else return f.exitCode;if(o.aborted)return 0;throw Error("Exec connection closed without an exit status")}finally{process.stdin.off("data",c),process.stdin.off("end",u),process.stdout.off("resize",l),a.close()}}var kA;var wy=_(()=>{M();ee();by();kA=E({meta:{name:"exec",description:"Execute a command inside a deployment pod"},async run({args:e}){let[t,...r]=e._;if(!t)throw Error("Deployment name is required");if(r.length===0)throw Error("Command is required");let o=new AbortController,n=()=>o.abort();process.on("SIGINT",n),process.on("SIGTERM",n);let i=Boolean(process.stdin.isTTY);if(i)process.stdin.setRawMode?.(!0),process.stdin.resume();try{let s=await AA(I().project,t,r,o.signal);if(s!==0)process.exitCode=s}catch(s){if(!o.signal.aborted)throw s}finally{if(process.off("SIGINT",n),process.off("SIGTERM",n),i)process.stdin.setRawMode?.(!1),process.stdin.pause()}}})});import{styleText as kt}from"util";var{inspect:vy}=globalThis.Bun;function sc(e){let t=Date.now(),r=xy[ic];ic=(ic+1)%xy.length;function o(i,s){return(a,...c)=>{if(!(i===console?process.stdout.isTTY:process.stderr.isTTY)){let f=`${(e??`${Date.now()-t}ms`).padStart(7)} \u258C${s?"\u258C":" "}`,p=a.reduce((d,m,h)=>d+m+(typeof c[h]==="string"?c[h]:typeof c[h]<"u"?vy(c[h],{colors:!1}):""),"");p=p.split(`
|
|
103
103
|
`).join(`
|
|
104
|
-
${" ".repeat(7)} \u258C${s?"\u258C":" "}`),i.write(`${f}${
|
|
105
|
-
`);return}let l=
|
|
106
|
-
`).map((f,
|
|
104
|
+
${" ".repeat(7)} \u258C${s?"\u258C":" "}`),i.write(`${f}${p}
|
|
105
|
+
`);return}let l=kt(r,`${(s?kt:(f,p)=>p)("bold",(e??`${Date.now()-t}ms`).padStart(7))} \u258C${s?kt(s,"\u258C"):" "}${a.reduce((f,p,d)=>f+kt(r,p)+(typeof c[d]==="string"?c[d]:typeof c[d]<"u"?vy(c[d],{colors:!0}):""),"").split(`
|
|
106
|
+
`).map((f,p)=>kt(r,p?`${" ".repeat(7)} \u258C${s?kt(s,"\u258C"):" "}${f}`:f)).join(`
|
|
107
107
|
`)}
|
|
108
|
-
`);i.write(l)}}let n=o(console);return n.error=o(process.stderr,"redBright"),n.warn=o(console,"yellow"),n.debug=o(console,"blue"),n}var
|
|
108
|
+
`);i.write(l)}}let n=o(console);return n.error=o(process.stderr,"redBright"),n.warn=o(console,"yellow"),n.debug=o(console,"blue"),n}var xy,ic=0,E1;var Ey=_(()=>{xy=["red","green","yellow","blue","magenta","cyan","white","redBright","greenBright","yellowBright","blueBright","magentaBright","cyanBright","whiteBright"];E1=sc("APP")});function Sy(){let e=new Map;return(t,r,o)=>{let n=e.get(t);if(!n)n=sc(t),e.set(t,n);if(o)n.warn`${r}`;else n`${r}`}}function PA(e){let t=Number(e);if(!/^\d+$/.test(e)||!Number.isSafeInteger(t))throw Error("-n must be a non-negative integer");return t}async function CA(e,t,r,o,n=Qs,i=Sy(),s){if(s!==void 0&&(!Number.isSafeInteger(s)||s<0))throw Error("-n must be a non-negative integer");let a=new URLSearchParams;if(t)a.set("service",t);if(r)a.set("follow","true");if(s!==void 0)a.set("tailLines",String(s));let c=a.size?`?${a}`:"";for await(let u of n(`/workspaces/${encodeURIComponent(e)}/logs${c}`,{signal:o},{timeoutMs:r?0:void 0})){if(u.type==="heartbeat")continue;if(u.type==="error"){i(t??u.pod??e,u.message,!0);continue}i(u.targetName||t||e,u.message,!1)}}var RA;var $y=_(()=>{M();q();ee();Ey();RA=E({meta:{name:"logs",description:"Show deployment logs"},args:{follow:{type:"boolean",alias:"f",description:"Follow log output"},tail:{type:"string",alias:"n",description:"Show the last N lines per container"}},async run({args:e}){let t=e._[0],r=new AbortController,o=()=>r.abort();process.on("SIGINT",o),process.on("SIGTERM",o);try{await CA(I().project,t,Boolean(e.follow),r.signal,Qs,Sy(),e.tail===void 0?void 0:PA(e.tail))}catch(n){if(!r.signal.aborted)throw n}finally{process.off("SIGINT",o),process.off("SIGTERM",o)}}})});import{mkdir as TA,readFile as OA,rm as IA,writeFile as BA}from"fs/promises";import{join as Ay}from"path";async function DA(e){try{let t=JSON.parse(await OA(wn,"utf8"));if(t.host===e&&typeof t.expiresAt==="number"&&t.expiresAt>Date.now())return await IA(wn,{force:!0}),!0}catch{}return await TA(Ay(wn,".."),{recursive:!0,mode:448}),await BA(wn,JSON.stringify({host:e,expiresAt:Date.now()+zA}),{mode:384}),!1}async function NA(e,t=k,r=DA){let o=await t(`/maintenance/${encodeURIComponent(e)}`);if(!await r(o.host))return console.log(`${o.host} maintenance is currently ${o.enabled?"\x1B[31mON\x1B[0m":"\x1B[32mOFF\x1B[0m"}, run this command again to toggle.`),o;let n=await t(`/maintenance/${encodeURIComponent(o.host)}`,{method:"POST",json:{enabled:!o.enabled}});return console.log(`${n.host} maintenance is now ${n.enabled?"\x1B[31mON\x1B[0m":"\x1B[32mOFF\x1B[0m"}`),n}var wn,zA=60000,LA;var ky=_(()=>{M();q();wn=Ay(process.env.XDG_RUNTIME_DIR??"/tmp","kuber","maintenance-confirmation");LA=E({meta:{name:"maintenance",description:"Toggle a global hostname maintenance override"},args:{host:{type:"positional",required:!0,description:"DNS hostname"}},async run({args:e}){await NA(e.host)}})});import{createInterface as VA}from"readline/promises";import{stdin as Ie,stdout as ac}from"process";async function UA(){let e=VA({input:Ie,output:ac});try{return(await e.question("Username: ")).trim()}finally{e.close()}}async function FA(){if(!Ie.isTTY||!Ie.setRawMode)throw Error("Password input requires an interactive terminal");return ac.write("Password: "),Ie.setRawMode(!0),Ie.resume(),new Promise((e,t)=>{let r="",o=()=>{Ie.off("data",n),Ie.setRawMode(!1),Ie.pause(),ac.write(`
|
|
109
109
|
`)},n=(i)=>{let s=i.toString("utf8");if(s==="\x03"){o(),t(Error("Login cancelled"));return}if(s==="\r"||s===`
|
|
110
|
-
`){o(),e(r);return}if(s==="\x7F"||s==="\b"){r=r.slice(0,-1);return}r+=s};Ie.on("data",n)})}async function
|
|
111
|
-
`)}var
|
|
112
|
-
`)}var Ae;var
|
|
110
|
+
`){o(),e(r);return}if(s==="\x7F"||s==="\b"){r=r.slice(0,-1);return}r+=s};Ie.on("data",n)})}async function MA(e,t,r){let o=await k("/login",{method:"POST",body:JSON.stringify({username:e,password:t,persistent:r})},{authenticated:!1});return await Qf(o,r),o}var jA,ZA,qA;var vn=_(()=>{M();q();Ao();jA=E({meta:{name:"login",description:"Log in to kuber.astrxl.dev"},args:{persist:{type:"boolean",description:"Keep the login across reboots"}},async run({args:e}){let t=String(e._[0]??"").trim()||await UA();if(!t)throw Error("Username is required");let r=await MA(t,await FA(),Boolean(e.persist));console.log(`Logged in as ${r.user.username}`)}}),ZA=E({meta:{name:"logout",description:"Log out of kuber.astrxl.dev"},async run(){let e=await ht();if(e)try{await k("/logout",{method:"POST"},{session:e})}finally{await qs()}else await qs();console.log("Logged out")}}),qA=E({meta:{name:"whoami",description:"Show the current kuber user"},async run(){let e=await k("/me");console.log(`${e.username} (${e.roles.join(", ")})`)}})});function QA(e){return e?`/operations?${new URLSearchParams({workspaceId:e})}`:"/operations"}function Py(e){if(e.length===0)return"No operations";return le(e.map((t)=>({id:t.metadata.name,workspace:t.spec.workspaceId,action:t.spec.action,state:t.status.state,created:t.metadata.creationTimestamp,finished:t.status.finishedAt})))}async function WA(e,t=k){let r=await t(QA(e));return Py(r.items)}async function GA(e,t=k){let r=await t(`/operations/${encodeURIComponent(e)}`),o=[Py([r])];if(r.status.error)o.push(`Error: ${r.status.error.code}: ${r.status.error.message}`);if(r.status.result!==void 0)o.push(`Result: ${JSON.stringify(r.status.result)}`);return o.join(`
|
|
111
|
+
`)}var KA,HA,JA;var Cy=_(()=>{M();q();tt();KA=E({meta:{name:"ls",description:"List operations"},args:{workspace:{type:"string",alias:"w",description:"Filter by workspace"}},async run({args:e}){console.log(await WA(e.workspace??e._[0]))}}),HA=E({meta:{name:"get",description:"Get an operation"},async run({args:e}){let t=String(e._[0]??"").trim();if(!t)throw Error("Operation ID is required");console.log(await GA(t))}}),JA=E({meta:{name:"operations",description:"Inspect server operations"},subCommands:{get:HA,ls:KA}})});function YA(e){return`${e.level==="good"?Ae.bgGreen:e.level==="bad"?Ae.bgRed:Ae.bgYellow}${Ae.fgBlack} ${e.label} ${Ae.reset}`}function XA(e){let t=e.split("/",1)[0],r=t==="Deployment"?Ae.fgBlue:t==="Service"?Ae.fgPurple:t==="Ingress"?Ae.fgYellow:t==="Pod"?Ae.fgGreen:void 0;return r?`${r}${e}${Ae.reset}`:e}function Ry(e){let t=[],r=(o,n,i)=>{t.push(`${n}${i?"\u2514\u2500 ":"\u251C\u2500 "}${XA(o.id)} ${YA(o.status)}`);let s=n+(i?" ":"\u2502 ");o.children.forEach((a,c)=>{r(a,s,c===o.children.length-1)})};for(let o of e)t.push(o.namespace),o.roots.forEach((n,i)=>{r(n,"",i===o.roots.length-1)}),t.push("");return t.join(`
|
|
112
|
+
`)}var Ae;var Ty=_(()=>{Ae={reset:"\x1B[0m",fgBlack:"\x1B[30m",fgBlue:"\x1B[34m",fgPurple:"\x1B[35m",fgYellow:"\x1B[33m",fgGreen:"\x1B[32m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgRed:"\x1B[41m"}});async function ek(e,t=!1,r=k){let o=t?"?includeIdle=true":"",n=await r(`/workspaces/${encodeURIComponent(e)}/status${o}`);return Ry(n)}var tk;var Oy=_(()=>{M();q();Ty();ee();tk=E({meta:{name:"ps",description:"List deployments"},args:{all:{type:"boolean",alias:"a",description:"Show all stopped deployments (including those created by the run command)"}},async run({args:{all:e}}){console.log(await ek(I().project,e))}})});function rk(e,t,r=k){return r(`/workspaces/${encodeURIComponent(e)}/lifecycle`,{method:"POST",json:{action:"restart",...t&&{services:[t]}}})}var ok;var Iy=_(()=>{M();xt();q();ee();ok=E({meta:{name:"restart",description:"Roll out a restart for managed deployments"},args:{deployment:{type:"positional",description:"Deployment name to restart (defaults to all managed)",required:!1}},async run({args:e}){await new de([{title:"Restart deployments",task:async(t,r)=>{let{deployments:o}=await rk(I().project,e.deployment);r.output=`${o.length} deployments queued`}}]).run()}})});function nk(e,t,r,o=k){return o(`/workspaces/${encodeURIComponent(e)}/rollback`,{method:"POST",json:{...t&&{services:[t]},timeoutMs:r}})}var ik;var By=_(()=>{M();xt();q();ee();ik=E({meta:{name:"rollback",description:"Roll deployments back to the previous release",alias:"fuck"},args:{deployment:{type:"positional",description:"Deployment name to roll back (defaults to all managed)",required:!1}},async run({args:e}){let{project:t,config:r}=I(),o=[];if(await new de([{title:"Roll back deployments",task:async(n,i)=>{({deployments:o}=await nk(t,e.deployment,r.rolloutTimeoutMs)),i.output=`${o.length} deployment${o.length===1?"":"s"} queued`}}]).run(),o.length===0)if(e.deployment)console.log(`${e.deployment} has no previous release to roll back to`);else console.log("No deployments have a previous release to roll back to")}})});function ak(e,t,r=k){return r(`/workspaces/${encodeURIComponent(e)}/storage/credentials`,{method:"POST",json:{claim:t}})}function ck(e){return`${sk}/buckets/${encodeURIComponent(e)}/objects`}async function zy(e){let t=it(await I().compose()).find((r)=>r.service===e);if(!t)throw Error(`Service ${e} does not declare a managed S3 volume.`);return t}var sk="http://garage-ui.garage-system.svc.cluster.local",uk,lk,pk,dk;var Dy=_(()=>{M();q();ee();tt();br();uk=E({meta:{name:"ls",description:"List managed S3 claims"},async run(){let e=it(await I().compose());if(e.length===0){console.log("No managed S3 volumes declared");return}console.log(le(e.map((t)=>({service:t.service,key:t.key,bucket:t.bucket}))))}}),lk=E({meta:{name:"creds",description:"Print S3 environment variables for a service"},async run({args:e}){let t=e._[0];if(!t)throw Error("Service name is required");let r=await ak(I().project,await zy(t));for(let[o,n]of Object.entries(r))console.log(`${o}=${n}`)}}),pk=E({meta:{name:"ui",description:"Print the Garage UI URL for a service bucket"},async run({args:e}){let t=e._[0];if(!t)throw Error("Service name is required");console.log(ck((await zy(t)).bucket))}}),dk=E({meta:{name:"s3",description:"Inspect managed S3 storage"},subCommands:{creds:lk,ls:uk,ui:pk}})});var fk;var Ny=_(()=>{M();_n();fk=E({meta:{name:"start",description:"Start deployments without rebuilding images"},async run(){await _r(!1)}})});function mk(e,t=k){return t(`/workspaces/${encodeURIComponent(e)}/lifecycle`,{method:"POST",json:{action:"stop"}})}var hk;var Ly=_(()=>{M();xt();q();ee();hk=E({meta:{name:"stop",description:"Scale managed deployments to zero"},async run(){await new de([{title:"Scale deployments",task:async(e,t)=>{let{deployments:r}=await mk(I().project);t.output=`${r.length} deployments queued`}}]).run()}})});import{stdin as ke,stdout as cc}from"process";import{createInterface as gk}from"readline/promises";function Be(e){let t=String(e??"").trim();if(!t)throw Error("Username is required");return t}function Uy(e){let t=String(e??"").split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)throw Error("At least one role is required (for example: --roles admin)");let r=t.find((o)=>!["viewer","operator","admin"].includes(o));if(r)throw Error(`Unknown role: ${r}`);return[...new Set(t)]}function yk(e){let t=String(e??"").split(",").map((o)=>o.trim()).filter(Boolean),r=new Set(["kubernetes:read","kubernetes:write","kubernetes:exec","users:read","users:write","sessions:revoke","platform:adopt"]);if(!t.length||t.some((o)=>!r.has(o)))throw Error("Provide at least one valid capability");return[...new Set(t)]}function uc(e){if(e.length===0)return"No users";return le(e.map((t)=>({username:t.username,roles:t.roles.join(","),disabled:t.disabled?"yes":"no",updated:t.updatedAt})))}async function Fy(e="Password: "){if(!ke.isTTY||!ke.setRawMode)throw Error("Password input requires an interactive terminal");return cc.write(e),ke.setRawMode(!0),ke.resume(),new Promise((t,r)=>{let o="",n=()=>{ke.off("data",s),ke.setRawMode(!1),ke.pause(),cc.write(`
|
|
113
113
|
`)},i=(a)=>{if(n(),a)r(a);else if(!o)r(Error("Password is required"));else t(o)},s=(a)=>{for(let c of a.toString()){if(c==="\x03"||c==="\x04"){i(Error("Password input cancelled"));return}if(c==="\r"||c===`
|
|
114
|
-
`){i();return}if(c==="\x7F"||c==="\b")o=o.slice(0,-1);else o+=c}};ke.on("data",s)})}async function Uy(e){if(!ke.isTTY)throw Error("Confirmation requires an interactive terminal; use --yes");let t=lk({input:ke,output:oc});try{return(await t.question(`Delete user '${e}'? [y/N] `)).trim().toLowerCase()==="y"}finally{t.close()}}async function dk(e=k){let t=await e("/users");return nc(t.items)}async function fk(e,t,r,o=k){let i=await o("/users",{method:"POST",json:{username:e,password:t,roles:r}});return nc([i])}async function My(e,t,r=k){if(Object.keys(t).length===0)throw Error("No user updates specified");let o=await r(`/users/${encodeURIComponent(e)}`,{method:"PATCH",json:t});return nc([o])}function mk(e,t,r=k){return My(e,{disabled:t},r)}async function hk(e,t,r=k){if(!t)return"Deletion cancelled";return await r(`/users/${encodeURIComponent(e)}`,{method:"DELETE"}),`Deleted user ${e}`}async function gk(e,t=k){let r=await t(`/users/${encodeURIComponent(e)}/sessions/revoke`,{method:"POST"});return`Revoked ${r.revoked} session${r.revoked===1?"":"s"} for ${r.username}`}function Fy(e){if(!e.length)return"No API keys";return le(e.map((t)=>({id:t.id,capabilities:t.capabilities.join(","),workspace:t.workspace??"",expires:t.expiresAt,disabled:t.disabled?"yes":"no"})))}async function yk(e,t=k){let r=await t(`/users/${encodeURIComponent(e)}/keys`);return Fy(r.items)}async function bk(e,t,r=k){return r(`/users/${encodeURIComponent(e)}/keys`,{method:"POST",json:t})}async function _k(e,t,r,o=k){if(!r)return"API key revocation cancelled";return await o(`/users/${encodeURIComponent(e)}/keys/${encodeURIComponent(t)}`,{method:"DELETE"}),`Revoked API key ${t} for ${e}`}function Ny(e,t){return E({meta:{name:e,description:`${t?"Disable":"Enable"} a user`},async run({args:r}){console.log(await mk(Be(r._[0]),t))}})}var wk,vk,xk,Ek,Sk,$k,Ak;var jy=_(()=>{F();q();tt();wk=E({meta:{name:"ls",description:"List users"},async run(){console.log(await dk())}}),vk=E({meta:{name:"add",description:"Add a user"},args:{roles:{type:"string",description:"Comma-separated roles"}},async run({args:e}){let t=Be(e._[0]);console.log(await fk(t,await Vy(),Ly(e.roles)))}}),xk=E({meta:{name:"update",description:"Update a user's roles or password"},args:{roles:{type:"string",description:"Comma-separated roles"},password:{type:"boolean",description:"Prompt for a new password"}},async run({args:e}){let t=Be(e._[0]),r={};if(e.roles!==void 0)r.roles=Ly(e.roles);if(e.password)r.password=await Vy("New password: ");console.log(await My(t,r))}});Ek=E({meta:{name:"delete",description:"Delete a user"},args:{yes:{type:"boolean",alias:"y",description:"Delete without confirmation"}},async run({args:e}){let t=Be(e._[0]),r=Boolean(e.yes)||await Uy(t);console.log(await hk(t,r))}}),Sk=E({meta:{name:"revoke",description:"Revoke all sessions for a user"},async run({args:e}){console.log(await gk(Be(e._[0])))}}),$k=E({meta:{name:"keys",description:"Manage user API keys"},subCommands:{ls:E({meta:{name:"ls",description:"List a user's API keys"},async run({args:e}){console.log(await yk(Be(e._[0])))}}),create:E({meta:{name:"create",description:"Create an API key"},args:{capabilities:{type:"string",required:!0,description:"Comma-separated capabilities"},workspace:{type:"string",description:"Restrict the key to a workspace"},expiresDays:{type:"string",default:"90",description:"Expiry in days (1-365)"}},async run({args:e}){let t=Number(e.expiresDays);if(!Number.isSafeInteger(t)||t<1||t>365)throw Error("--expires-days must be an integer from 1 to 365");let r=await bk(Be(e._[0]),{capabilities:pk(e.capabilities),...e.workspace&&{workspace:e.workspace},expiresAt:new Date(Date.now()+t*24*60*60*1000).toISOString()});console.log("Store this API key securely now. It will not be shown again:"),console.log(r.token),console.log(Fy([r]))}}),revoke:E({meta:{name:"revoke",description:"Revoke an API key"},args:{yes:{type:"boolean",alias:"y",description:"Revoke without confirmation"}},async run({args:e}){let t=Be(e._[0]),r=Be(e._[1]),o=Boolean(e.yes)||await Uy(`API key '${r}' for ${t}`);console.log(await _k(t,r,o))}})}}),Ak=E({meta:{name:"users",description:"Administer users"},subCommands:{add:vk,delete:Ek,disable:Ny("disable",!0),enable:Ny("enable",!1),keys:$k,ls:wk,revoke:Sk,update:xk}})});function sc(e){return`/workspaces/${encodeURIComponent(e)}/trust`}async function ic(){let{project:e,cwd:t}=I();return gt(e,t)}async function kk(e,t=k){await t(sc(e.project),{method:"POST",json:{fingerprint:e.fingerprint}}),await Hs((r)=>[...r.filter((o)=>o.project!==e.project||o.fingerprint!==e.fingerprint),e]),console.log(`Trusted this directory for namespace ${e.project}`)}async function Pk(e,t=k){let r=(await Ro()).some((i)=>i.project===e.project&&i.fingerprint===e.fingerprint),n=(await t(sc(e.project))).fingerprints.includes(e.fingerprint);console.log(`Namespace: ${e.project}`),console.log(`Local: ${r?"trusted":"untrusted"}`),console.log(`Server: ${n?"registered":"not registered"}`)}async function Ck(e,t=k){let r;try{await t(`${sc(e.project)}?fingerprint=${encodeURIComponent(e.fingerprint)}`,{method:"DELETE"})}catch(o){if(!(o instanceof we&&o.status===404))r=o}if(await Hs((o)=>o.filter((n)=>n.project!==e.project||n.fingerprint!==e.fingerprint)),r){let o=r instanceof Error?r.message:String(r);throw Error(`Removed local trust for namespace ${e.project}, but failed to revoke the server registration: ${o}`,{cause:r})}console.log(`Revoked trust for namespace ${e.project}`)}var Rk;var Zy=_(()=>{F();q();ee();To();Rk=E({meta:{name:"trust",description:"Trust this directory for kuber up"},subCommands:{status:E({meta:{name:"status",description:"Show local and server trust"},async run(){await Pk(await ic())}}),revoke:E({meta:{name:"revoke",description:"Revoke this directory trust"},async run(){await Ck(await ic())}})},async run(){await kk(await ic())}})});import Tk from"assert";var D,Ok=class{name;variadic;command;handler;constructor(e,t,r,o=!1){this.command=e,this.name=t,this.handler=r,this.variadic=o}},Ik=class{value;description;command;handler;alias;isBoolean;constructor(e,t,r,o,n,i){this.command=e,this.value=t,this.description=r,this.handler=o,this.alias=n,this.isBoolean=i}},qy=class{value;description;options=new Map;arguments=new Map;parent;constructor(e,t){this.value=e,this.description=t}option(e,t,r,o){let n,i,s;typeof r=="function"?(n=r,i=o,s=!1):typeof r=="string"?(n=void 0,i=r,s=!0):(n=void 0,i=void 0,s=!0);let a=new Ik(this,e,t,n,i,s);return this.options.set(e,a),this}argument(e,t,r=!1){let o=new Ok(this,e,t,r);return this.arguments.set(e,o),this}},Bk,Pe;var ac=_(()=>{cc();D={ShellCompDirectiveError:1,ShellCompDirectiveNoSpace:2,ShellCompDirectiveNoFileComp:4,ShellCompDirectiveFilterFileExt:8,ShellCompDirectiveFilterDirs:16,ShellCompDirectiveKeepOrder:32,shellCompDirectiveMaxValue:64,ShellCompDirectiveDefault:0},Bk=class extends qy{commands=new Map;completions=[];directive=D.ShellCompDirectiveDefault;constructor(){super("","")}command(e,t){let r=new qy(e,t);return this.commands.set(e,r),r}stripOptions(e){let t=[],r=0;for(;r<e.length;){let o=e[r];if(o.startsWith("-")){r++;let n=!1,i=this.findOption(this,o);if(i)n=i.isBoolean??!1;else for(let[,s]of this.commands){let a=this.findOption(s,o);if(a){n=a.isBoolean??!1;break}}!n&&r<e.length&&!e[r].startsWith("-")&&r++}else t.push(o),r++}return t}matchCommand(e){e=this.stripOptions(e);let t=[],r=[],o=null;for(let n=0;n<e.length;n++){let i=e[n];t.push(i);let s=this.commands.get(t.join(" "));if(s)o=s;else{r=e.slice(n,e.length);break}}return[o||this,r]}shouldCompleteFlags(e,t){if(t.startsWith("-"))return!0;if(e?.startsWith("-")){let r=this.findOption(this,e);if(!r){for(let[,o]of this.commands)if(r=this.findOption(o,e),r)break}return!(r&&r.isBoolean)}return!1}shouldCompleteCommands(e){return!e.startsWith("-")}handleFlagCompletion(e,t,r,o){let n;if(r.includes("=")){let[i]=r.split("=");n=i}else if(o?.startsWith("-")){let i=this.findOption(e,o);i&&!i.isBoolean&&(n=o)}if(n){let i=this.findOption(e,n);if(i?.handler){let s=[];i.handler.call(i,(a,c)=>s.push({value:a,description:c}),e.options),this.completions=s}return}if(r.startsWith("-")){let i=r.startsWith("-")&&!r.startsWith("--"),s=r.replace(/^-+/,"");for(let[a,c]of e.options)i&&c.alias&&`-${c.alias}`.startsWith(r)?this.completions.push({value:`-${c.alias}`,description:c.description}):!i&&a.startsWith(s)&&this.completions.push({value:`--${a}`,description:c.description})}}findOption(e,t){let r=e.options.get(t);if(r||(r=e.options.get(t.replace(/^-+/,"")),r))return r;for(let[o,n]of e.options)if(n.alias&&`-${n.alias}`===t)return n}handleCommandCompletion(e,t){let r=this.stripOptions(e);for(let[o,n]of this.commands){if(o==="")continue;let i=o.split(" ");i.slice(0,r.length).every((s,a)=>s===r[a])&&i[r.length]?.startsWith(t)&&this.completions.push({value:i[r.length],description:n.description})}}handlePositionalCompletion(e,t){let r=this.stripOptions(t),o=e.value.split(" ").length,n=Math.max(0,r.length-o),i=Array.from(e.arguments.entries());if(i.length>0){let s;if(n<i.length){let[a,c]=i[n];s=c}else{let a=i[i.length-1][1];a.variadic&&(s=a)}if(s&&s.handler&&typeof s.handler=="function"){let a=[];s.handler.call(s,(c,u)=>a.push({value:c,description:u}),e.options),this.completions.push(...a)}}}complete(e){this.directive=D.ShellCompDirectiveNoFileComp;let t=new Set;this.completions.filter((r)=>t.has(r.value)?!1:(t.add(r.value),!0)).filter((r)=>{if(e.includes("=")){let[,o]=e.split("=");return r.value.startsWith(o)}return r.value.startsWith(e)}).forEach((r)=>console.log(`${r.value} ${r.description??""}`)),console.log(`:${this.directive}`)}parse(e){this.completions=[];let t=e[e.length-1]==="";t&&e.pop();let r=e[e.length-1]||"",o=e.slice(0,-1);t&&(r!==""&&o.push(r),r="");let[n]=this.matchCommand(o),i=o[o.length-1];this.shouldCompleteFlags(i,r)?this.handleFlagCompletion(n,o,r,i):(this.shouldCompleteCommands(r)&&this.handleCommandCompletion(o,r),n&&n.arguments.size>0&&this.handlePositionalCompletion(n,o)),this.complete(r)}setup(e,t,r){switch(Tk(r==="zsh"||r==="bash"||r==="fish"||r==="powershell","Unsupported shell"),r){case"zsh":{let o=_n(e,t);console.log(o);break}case"bash":{let o=wn(e,t);console.log(o);break}case"fish":{let o=vn(e,t);console.log(o);break}case"powershell":{let o=xn(e,t);console.log(o);break}}}},Pe=new Bk});function _n(e,t){return`#compdef ${e}
|
|
114
|
+
`){i();return}if(c==="\x7F"||c==="\b")o=o.slice(0,-1);else o+=c}};ke.on("data",s)})}async function My(e){if(!ke.isTTY)throw Error("Confirmation requires an interactive terminal; use --yes");let t=gk({input:ke,output:cc});try{return(await t.question(`Delete user '${e}'? [y/N] `)).trim().toLowerCase()==="y"}finally{t.close()}}async function bk(e=k){let t=await e("/users");return uc(t.items)}async function _k(e,t,r,o=k){let i=await o("/users",{method:"POST",json:{username:e,password:t,roles:r}});return uc([i])}async function jy(e,t,r=k){if(Object.keys(t).length===0)throw Error("No user updates specified");let o=await r(`/users/${encodeURIComponent(e)}`,{method:"PATCH",json:t});return uc([o])}function wk(e,t,r=k){return jy(e,{disabled:t},r)}async function vk(e,t,r=k){if(!t)return"Deletion cancelled";return await r(`/users/${encodeURIComponent(e)}`,{method:"DELETE"}),`Deleted user ${e}`}async function xk(e,t=k){let r=await t(`/users/${encodeURIComponent(e)}/sessions/revoke`,{method:"POST"});return`Revoked ${r.revoked} session${r.revoked===1?"":"s"} for ${r.username}`}function Zy(e){if(!e.length)return"No API keys";return le(e.map((t)=>({id:t.id,capabilities:t.capabilities.join(","),workspace:t.workspace??"",expires:t.expiresAt,disabled:t.disabled?"yes":"no"})))}async function Ek(e,t=k){let r=await t(`/users/${encodeURIComponent(e)}/keys`);return Zy(r.items)}async function Sk(e,t,r=k){return r(`/users/${encodeURIComponent(e)}/keys`,{method:"POST",json:t})}async function $k(e,t,r,o=k){if(!r)return"API key revocation cancelled";return await o(`/users/${encodeURIComponent(e)}/keys/${encodeURIComponent(t)}`,{method:"DELETE"}),`Revoked API key ${t} for ${e}`}function Vy(e,t){return E({meta:{name:e,description:`${t?"Disable":"Enable"} a user`},async run({args:r}){console.log(await wk(Be(r._[0]),t))}})}var Ak,kk,Pk,Ck,Rk,Tk,Ok;var qy=_(()=>{M();q();tt();Ak=E({meta:{name:"ls",description:"List users"},async run(){console.log(await bk())}}),kk=E({meta:{name:"add",description:"Add a user"},args:{roles:{type:"string",description:"Comma-separated roles"}},async run({args:e}){let t=Be(e._[0]);console.log(await _k(t,await Fy(),Uy(e.roles)))}}),Pk=E({meta:{name:"update",description:"Update a user's roles or password"},args:{roles:{type:"string",description:"Comma-separated roles"},password:{type:"boolean",description:"Prompt for a new password"}},async run({args:e}){let t=Be(e._[0]),r={};if(e.roles!==void 0)r.roles=Uy(e.roles);if(e.password)r.password=await Fy("New password: ");console.log(await jy(t,r))}});Ck=E({meta:{name:"delete",description:"Delete a user"},args:{yes:{type:"boolean",alias:"y",description:"Delete without confirmation"}},async run({args:e}){let t=Be(e._[0]),r=Boolean(e.yes)||await My(t);console.log(await vk(t,r))}}),Rk=E({meta:{name:"revoke",description:"Revoke all sessions for a user"},async run({args:e}){console.log(await xk(Be(e._[0])))}}),Tk=E({meta:{name:"keys",description:"Manage user API keys"},subCommands:{ls:E({meta:{name:"ls",description:"List a user's API keys"},async run({args:e}){console.log(await Ek(Be(e._[0])))}}),create:E({meta:{name:"create",description:"Create an API key"},args:{capabilities:{type:"string",required:!0,description:"Comma-separated capabilities"},workspace:{type:"string",description:"Restrict the key to a workspace"},expiresDays:{type:"string",default:"90",description:"Expiry in days (1-365)"}},async run({args:e}){let t=Number(e.expiresDays);if(!Number.isSafeInteger(t)||t<1||t>365)throw Error("--expires-days must be an integer from 1 to 365");let r=await Sk(Be(e._[0]),{capabilities:yk(e.capabilities),...e.workspace&&{workspace:e.workspace},expiresAt:new Date(Date.now()+t*24*60*60*1000).toISOString()});console.log("Store this API key securely now. It will not be shown again:"),console.log(r.token),console.log(Zy([r]))}}),revoke:E({meta:{name:"revoke",description:"Revoke an API key"},args:{yes:{type:"boolean",alias:"y",description:"Revoke without confirmation"}},async run({args:e}){let t=Be(e._[0]),r=Be(e._[1]),o=Boolean(e.yes)||await My(`API key '${r}' for ${t}`);console.log(await $k(t,r,o))}})}}),Ok=E({meta:{name:"users",description:"Administer users"},subCommands:{add:kk,delete:Ck,disable:Vy("disable",!0),enable:Vy("enable",!1),keys:Tk,ls:Ak,revoke:Rk,update:Pk}})});function pc(e){return`/workspaces/${encodeURIComponent(e)}/trust`}async function lc(){let{project:e,cwd:t}=I();return gt(e,t)}async function Ik(e,t=k){await t(pc(e.project),{method:"POST",json:{fingerprint:e.fingerprint}}),await Xs((r)=>[...r.filter((o)=>o.project!==e.project||o.fingerprint!==e.fingerprint),e]),console.log(`Trusted this directory for namespace ${e.project}`)}async function Bk(e,t=k){let r=(await Io()).some((i)=>i.project===e.project&&i.fingerprint===e.fingerprint),n=(await t(pc(e.project))).fingerprints.includes(e.fingerprint);console.log(`Namespace: ${e.project}`),console.log(`Local: ${r?"trusted":"untrusted"}`),console.log(`Server: ${n?"registered":"not registered"}`)}async function zk(e,t=k){let r;try{await t(`${pc(e.project)}?fingerprint=${encodeURIComponent(e.fingerprint)}`,{method:"DELETE"})}catch(o){if(!(o instanceof we&&o.status===404))r=o}if(await Xs((o)=>o.filter((n)=>n.project!==e.project||n.fingerprint!==e.fingerprint)),r){let o=r instanceof Error?r.message:String(r);throw Error(`Removed local trust for namespace ${e.project}, but failed to revoke the server registration: ${o}`,{cause:r})}console.log(`Revoked trust for namespace ${e.project}`)}var Dk;var Qy=_(()=>{M();q();ee();Bo();Dk=E({meta:{name:"trust",description:"Trust this directory for kuber up"},subCommands:{status:E({meta:{name:"status",description:"Show local and server trust"},async run(){await Bk(await lc())}}),revoke:E({meta:{name:"revoke",description:"Revoke this directory trust"},async run(){await zk(await lc())}})},async run(){await Ik(await lc())}})});import Nk from"assert";var D,Lk=class{name;variadic;command;handler;constructor(e,t,r,o=!1){this.command=e,this.name=t,this.handler=r,this.variadic=o}},Vk=class{value;description;command;handler;alias;isBoolean;constructor(e,t,r,o,n,i){this.command=e,this.value=t,this.description=r,this.handler=o,this.alias=n,this.isBoolean=i}},Wy=class{value;description;options=new Map;arguments=new Map;parent;constructor(e,t){this.value=e,this.description=t}option(e,t,r,o){let n,i,s;typeof r=="function"?(n=r,i=o,s=!1):typeof r=="string"?(n=void 0,i=r,s=!0):(n=void 0,i=void 0,s=!0);let a=new Vk(this,e,t,n,i,s);return this.options.set(e,a),this}argument(e,t,r=!1){let o=new Lk(this,e,t,r);return this.arguments.set(e,o),this}},Uk,Pe;var dc=_(()=>{fc();D={ShellCompDirectiveError:1,ShellCompDirectiveNoSpace:2,ShellCompDirectiveNoFileComp:4,ShellCompDirectiveFilterFileExt:8,ShellCompDirectiveFilterDirs:16,ShellCompDirectiveKeepOrder:32,shellCompDirectiveMaxValue:64,ShellCompDirectiveDefault:0},Uk=class extends Wy{commands=new Map;completions=[];directive=D.ShellCompDirectiveDefault;constructor(){super("","")}command(e,t){let r=new Wy(e,t);return this.commands.set(e,r),r}stripOptions(e){let t=[],r=0;for(;r<e.length;){let o=e[r];if(o.startsWith("-")){r++;let n=!1,i=this.findOption(this,o);if(i)n=i.isBoolean??!1;else for(let[,s]of this.commands){let a=this.findOption(s,o);if(a){n=a.isBoolean??!1;break}}!n&&r<e.length&&!e[r].startsWith("-")&&r++}else t.push(o),r++}return t}matchCommand(e){e=this.stripOptions(e);let t=[],r=[],o=null;for(let n=0;n<e.length;n++){let i=e[n];t.push(i);let s=this.commands.get(t.join(" "));if(s)o=s;else{r=e.slice(n,e.length);break}}return[o||this,r]}shouldCompleteFlags(e,t){if(t.startsWith("-"))return!0;if(e?.startsWith("-")){let r=this.findOption(this,e);if(!r){for(let[,o]of this.commands)if(r=this.findOption(o,e),r)break}return!(r&&r.isBoolean)}return!1}shouldCompleteCommands(e){return!e.startsWith("-")}handleFlagCompletion(e,t,r,o){let n;if(r.includes("=")){let[i]=r.split("=");n=i}else if(o?.startsWith("-")){let i=this.findOption(e,o);i&&!i.isBoolean&&(n=o)}if(n){let i=this.findOption(e,n);if(i?.handler){let s=[];i.handler.call(i,(a,c)=>s.push({value:a,description:c}),e.options),this.completions=s}return}if(r.startsWith("-")){let i=r.startsWith("-")&&!r.startsWith("--"),s=r.replace(/^-+/,"");for(let[a,c]of e.options)i&&c.alias&&`-${c.alias}`.startsWith(r)?this.completions.push({value:`-${c.alias}`,description:c.description}):!i&&a.startsWith(s)&&this.completions.push({value:`--${a}`,description:c.description})}}findOption(e,t){let r=e.options.get(t);if(r||(r=e.options.get(t.replace(/^-+/,"")),r))return r;for(let[o,n]of e.options)if(n.alias&&`-${n.alias}`===t)return n}handleCommandCompletion(e,t){let r=this.stripOptions(e);for(let[o,n]of this.commands){if(o==="")continue;let i=o.split(" ");i.slice(0,r.length).every((s,a)=>s===r[a])&&i[r.length]?.startsWith(t)&&this.completions.push({value:i[r.length],description:n.description})}}handlePositionalCompletion(e,t){let r=this.stripOptions(t),o=e.value.split(" ").length,n=Math.max(0,r.length-o),i=Array.from(e.arguments.entries());if(i.length>0){let s;if(n<i.length){let[a,c]=i[n];s=c}else{let a=i[i.length-1][1];a.variadic&&(s=a)}if(s&&s.handler&&typeof s.handler=="function"){let a=[];s.handler.call(s,(c,u)=>a.push({value:c,description:u}),e.options),this.completions.push(...a)}}}complete(e){this.directive=D.ShellCompDirectiveNoFileComp;let t=new Set;this.completions.filter((r)=>t.has(r.value)?!1:(t.add(r.value),!0)).filter((r)=>{if(e.includes("=")){let[,o]=e.split("=");return r.value.startsWith(o)}return r.value.startsWith(e)}).forEach((r)=>console.log(`${r.value} ${r.description??""}`)),console.log(`:${this.directive}`)}parse(e){this.completions=[];let t=e[e.length-1]==="";t&&e.pop();let r=e[e.length-1]||"",o=e.slice(0,-1);t&&(r!==""&&o.push(r),r="");let[n]=this.matchCommand(o),i=o[o.length-1];this.shouldCompleteFlags(i,r)?this.handleFlagCompletion(n,o,r,i):(this.shouldCompleteCommands(r)&&this.handleCommandCompletion(o,r),n&&n.arguments.size>0&&this.handlePositionalCompletion(n,o)),this.complete(r)}setup(e,t,r){switch(Nk(r==="zsh"||r==="bash"||r==="fish"||r==="powershell","Unsupported shell"),r){case"zsh":{let o=xn(e,t);console.log(o);break}case"bash":{let o=En(e,t);console.log(o);break}case"fish":{let o=Sn(e,t);console.log(o);break}case"powershell":{let o=$n(e,t);console.log(o);break}}}},Pe=new Uk});function xn(e,t){return`#compdef ${e}
|
|
115
115
|
compdef _${e} ${e}
|
|
116
116
|
|
|
117
117
|
# zsh completion for ${e} -*- shell-script -*-
|
|
@@ -329,7 +329,7 @@ _${e}() {
|
|
|
329
329
|
if [ "\${funcstack[1]}" = "_${e}" ]; then
|
|
330
330
|
_${e}
|
|
331
331
|
fi
|
|
332
|
-
`}function
|
|
332
|
+
`}function En(e,t){let r=e.replace(/[-:]/g,"_");return`# bash completion for ${e}
|
|
333
333
|
|
|
334
334
|
# Define shell completion directives
|
|
335
335
|
readonly ShellCompDirectiveError=${D.ShellCompDirectiveError}
|
|
@@ -430,7 +430,7 @@ __${r}_complete() {
|
|
|
430
430
|
|
|
431
431
|
# Register completion function
|
|
432
432
|
complete -F __${r}_complete ${e}
|
|
433
|
-
`}function
|
|
433
|
+
`}function Sn(e,t){let r=e.replace(/[-:]/g,"_"),o=D.ShellCompDirectiveError,n=D.ShellCompDirectiveNoSpace,i=D.ShellCompDirectiveNoFileComp,s=D.ShellCompDirectiveFilterFileExt,a=D.ShellCompDirectiveFilterDirs;return`# fish completion for ${e} -*- shell-script -*-
|
|
434
434
|
|
|
435
435
|
function __${r}_debug
|
|
436
436
|
set -l file "$BASH_COMP_DEBUG_FILE"
|
|
@@ -662,7 +662,7 @@ complete -c ${e} -n '__${r}_clear_perform_completion_once_result'
|
|
|
662
662
|
complete -c ${e} -n 'not __${r}_requires_order_preservation && __${r}_prepare_completions' -f -a '$__${r}_comp_results'
|
|
663
663
|
# Otherwise we use the -k flag
|
|
664
664
|
complete -k -c ${e} -n '__${r}_requires_order_preservation && __${r}_prepare_completions' -f -a '$__${r}_comp_results'
|
|
665
|
-
`}function
|
|
665
|
+
`}function $n(e,t){let r=e.replace(/[-:]/g,"_");return`# powershell completion for ${e} -*- shell-script -*-
|
|
666
666
|
|
|
667
667
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
668
668
|
function __${e}_debug {
|
|
@@ -912,7 +912,7 @@ complete -k -c ${e} -n '__${r}_requires_order_preservation && __${r}_prepare_com
|
|
|
912
912
|
}
|
|
913
913
|
|
|
914
914
|
Register-ArgumentCompleter -CommandName '${e}' -ScriptBlock $__${r}CompleterBlock
|
|
915
|
-
`}var
|
|
916
|
-
Example: ${e} complete -- <args>`;console.error(t),process.exit(1)}}var
|
|
915
|
+
`}var fc=_(()=>{dc()});function Gy(e="cli"){if(process.argv.indexOf("--")===-1){let t=`Error: You need to use -- to separate completion arguments.
|
|
916
|
+
Example: ${e} complete -- <args>`;console.error(t),process.exit(1)}}var Ky=()=>{};async function Fk(e){let t=[],r=[];for(let[o,n]of Object.entries(e))if(n.type==="positional"){let i=n;r.push({name:o,description:i.description,isOptional:!i.required,isVariadic:o.startsWith("[...")||o.startsWith("<...")})}else{let i={name:`--${o}`,description:n.description||"",isRequired:n.required};"alias"in n&&n.alias&&(Array.isArray(n.alias)?n.alias:[n.alias]).forEach((s)=>{t.push({...i,name:`-${s}`})}),t.push(i)}return{options:t,args:r}}async function Hy(e,t=""){let r=await Promise.resolve(e.meta),o=await Promise.resolve(e.subCommands);if(!r||!r.name)throw Error("Command meta or name is missing");let n={name:t?`${t} ${r.name}`:r.name,description:r.description||""};if(e.args){let{options:i,args:s}=await Fk(await Promise.resolve(e.args));i.length>0&&(n.options=i),s.length>0&&(n.args=s)}return o&&(n.subcommands=await Promise.all(Object.entries(o).map(async([i,s])=>Hy(await Promise.resolve(s),n.name)))),n}async function Mk(e){let t=await Hy(e);return JSON.stringify(t,null,2)}function Jy(e){return e.args&&Object.values(e.args).some((t)=>t.type==="positional")}async function Yy(e,t,r){for(let[o,n]of Object.entries(e)){let i=await wr(n),s=await wr(i.meta),a=await wr(i.subCommands),c=r?.[o];if(!s||typeof s?.description!="string")throw Error("Invalid meta or missing description.");let u=Jy(i),l=t?`${t} ${o}`:o,f=Pe.command(l,s.description);if(u&&i.args)for(let[p,d]of Object.entries(i.args)){let m=d;if(m.type==="positional"){let h=m.required===!1,y=c?.args?.[p];y?f.argument(p,y,h):f.argument(p,void 0,h)}}if(a&&await Yy(a,l,c?.subCommands),i.args)for(let[p,d]of Object.entries(i.args)){let m=d,h=typeof m=="object"&&"alias"in m?Array.isArray(m.alias)?m.alias[0]:m.alias:void 0,y=c?.options?.[p];y?h?f.option(p,m.description??"",y,h):f.option(p,m.description??"",y):h?f.option(p,m.description??"",h):f.option(p,m.description??"")}}}async function Xy(e,t){let r=await wr(e.meta);if(!r)throw Error("Invalid meta.");let o=r.name;if(!o)throw Error("Invalid meta or missing name.");let n=await wr(e.subCommands);if(Jy(e)&&e.args)for(let[s,a]of Object.entries(e.args)){let c=a;if(c.type==="positional"){let u=c.required===!1,l=t?.args?.[s];l?Pe.argument(s,l,u):Pe.argument(s,void 0,u)}}if(n&&await Yy(n,void 0,t?.subCommands),e.args)for(let[s,a]of Object.entries(e.args)){let c=a,u=typeof c=="object"&&"alias"in c?Array.isArray(c.alias)?c.alias[0]:c.alias:void 0,l=t?.options?.[s];l?u?Pe.option(s,c.description??"",l,u):Pe.option(s,c.description??"",l):u?Pe.option(s,c.description??"",u):Pe.option(s,c.description??"")}let i=E({meta:{name:"complete",description:"Generate shell completion scripts"},args:{shell:{type:"positional",description:"Shell type (zsh, bash, fish, powershell, fig)",required:!1}},async run(s){let a=s.rawArgs[0];a==="--"&&(a=void 0);let c=o;switch(a){case"zsh":{let u=xn(o,c);console.log(u);break}case"bash":{let u=En(o,c);console.log(u);break}case"fish":{let u=Sn(o,c);console.log(u);break}case"powershell":{let u=$n(o,c);console.log(u);break}case"fig":{let u=await Mk(e);console.log(u);break}default:{Gy(o);let u=s.rawArgs.slice(s.rawArgs.indexOf("--")+1);return Pe.parse(u)}}}});return n?n.complete=i:e.subCommands={complete:i},Pe}async function wr(e){return e instanceof Function?await e():await e}var eb=_(()=>{fc();dc();Ky();M()});M();M();Us();var Vf=Symbol("wrappedCommand");function Fs(e){if(e instanceof $d)return Bc(e);if(e instanceof Error){let t=e.stack?.split(`
|
|
917
917
|
`).slice(0,3).join(`
|
|
918
|
-
`);return t&&t.trim().length>0?t:e.message}try{return JSON.stringify(e,null,2)}catch{return String(e)}}function
|
|
918
|
+
`);return t&&t.trim().length>0?t:e.message}try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Dw(e){console.error(Fs(e)),process.exitCode=1}function Xt(e,t=Dw){let r=e;if(r[Vf])return;if(r[Vf]=!0,e.run){let o=e.run;e.run=async(...n)=>{try{return await o(...n)}catch(i){t(i)}}}if(!e.subCommands||typeof e.subCommands!=="object")return;for(let o of Object.values(e.subCommands))if(o&&typeof o==="object")Xt(o,t)}function j(e){let t;return()=>t??=e().then((r)=>{let o=rb(r);return Xt(o),o}).catch((r)=>{throw t=void 0,r})}function rb(e){let t={...e},r=t.subCommands;if(r&&typeof r==="object")t.subCommands=Object.fromEntries(Object.entries(r).map(([o,n])=>[o,n&&typeof n==="object"?rb(n):n]));return t}var Pt=E({meta:{name:"kuber",version:"2.5.1",description:"Docker Compose -> K8s translation layer"},args:{config:{type:"string",description:"Path to a kuber configuration file"}},subCommands:{audit:j(()=>Promise.resolve().then(() => (um(),{})).then((e)=>ev)),ci:j(()=>Promise.resolve().then(() => (py(),{})).then((e)=>dA)),db:j(()=>Promise.resolve().then(() => (dy(),{})).then((e)=>gA)),down:j(()=>Promise.resolve().then(() => (fy(),{})).then((e)=>bA)),export:j(()=>Promise.resolve().then(() => (gy(),{})).then((e)=>xA)),exec:j(()=>Promise.resolve().then(() => (wy(),{})).then((e)=>kA)),logs:j(()=>Promise.resolve().then(() => ($y(),{})).then((e)=>RA)),maintenance:j(()=>Promise.resolve().then(() => (ky(),{})).then((e)=>LA)),login:j(()=>Promise.resolve().then(() => (vn(),{})).then((e)=>jA)),logout:j(()=>Promise.resolve().then(() => (vn(),{})).then((e)=>ZA)),operations:j(()=>Promise.resolve().then(() => (Cy(),{})).then((e)=>JA)),ps:j(()=>Promise.resolve().then(() => (Oy(),{})).then((e)=>tk)),restart:j(()=>Promise.resolve().then(() => (Iy(),{})).then((e)=>ok)),rollback:j(()=>Promise.resolve().then(() => (By(),{})).then((e)=>ik)),s3:j(()=>Promise.resolve().then(() => (Dy(),{})).then((e)=>dk)),start:j(()=>Promise.resolve().then(() => (Ny(),{})).then((e)=>fk)),stop:j(()=>Promise.resolve().then(() => (Ly(),{})).then((e)=>hk)),up:j(()=>Promise.resolve().then(() => (_n(),{})).then((e)=>cA)),users:j(()=>Promise.resolve().then(() => (qy(),{})).then((e)=>Ok)),trust:j(()=>Promise.resolve().then(() => (Qy(),{})).then((e)=>Dk)),whoami:j(()=>Promise.resolve().then(() => (vn(),{})).then((e)=>qA))}}),tb;function ob(){return tb??=(async()=>{let e=Pt.subCommands;if(e&&typeof e!=="function")Pt.subCommands=Object.fromEntries(await Promise.all(Object.entries(e).map(async([r,o])=>[r,typeof o==="function"?await o():await o])));await Promise.resolve().then(() => eb());return Xy(Pt)})(),tb}ee();Ro();async function jk(){let{configPath:e,rawArgs:t}=pm(process.argv.slice(2));if(t[0]==="fuck")t[0]="rollback";if(t.length===0||t[0]==="complete"||t[0]==="--help"||t[0]==="-h")await ob();Xt(Pt);let r=vc(Pt),o=new Set(["login","logout","whoami","maintenance"]);if(t[0]&&o.has(t[0])){await r({rawArgs:t});return}await wm(()=>r({rawArgs:t}),e)}jk().catch((e)=>{console.error(Fs(e)),process.exitCode=1});
|