@skyramp/testbot-core 0.13.0-v3.282 → 0.13.0-v3.283
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/VERSION.json +1 -1
- package/dist/main.js +3 -3
- package/dist/post.js +1 -1
- package/dist/runner-client.cjs +1 -1
- package/package.json +1 -1
package/dist/runner-client.cjs
CHANGED
|
@@ -53,7 +53,7 @@ ${u}`,this.dataLineCount++;return}if(Pu(t,s,T1)){M1(t,i)&&(this.setEventFieldSiz
|
|
|
53
53
|
`),`
|
|
54
54
|
`,t)}o(xR,"boundedFailureText");function ao(e){return zu(nV(e),[]).trim()}o(ao,"commandFailureText");var rV=/^(.*?:\s*)?Command failed: (?:git|gh)\b.*$/;function Zu(e,t=Ku){let[n="",...r]=e.split(`
|
|
55
55
|
`).map(a=>a.trim()).filter(Boolean),s=r.length?rV.exec(n):null,i=s?[`${s[1]??""}${r[0]}`,...r.slice(1)]:[n,...r];return vR(i," ",t,Math.floor(t*2/3))}o(Zu,"failureReason");function Xu(e){return e.replace(new RegExp("\x1B\\[[0-9;]*m","g"),"")}o(Xu,"stripAnsi");function sV(e){let t=/^(yarn run v|info Visit|error Command failed|npm ERR!|husky\b|\$ )/i,n=Xu(e).split(`
|
|
56
|
-
`).map(a=>a.trim()).filter(Boolean),r=n.filter(a=>!t.test(a)),s=r.length?r:n;return[...s].reverse().find(a=>/(error|warning|problem|✖|✗|✘|fail|not listed|cannot|denied)/i.test(a))??s[s.length-1]??"(no output)"}o(sV,"hookSummary");function TR(e){if(!/\bhook\b|husky|pre-commit|lint-staged/i.test(e))return;let t=sV(e),n=ee().staged.commitHook(/husky\s*[->]\s*([\w-]+)\s+(?:script|hook)\b/i.exec(Xu(e))?.[1]);return/\(code 127\)|exit code 127/i.test(e)||/command not found|: not found$/i.test(t)?ee().staged.commitHookCouldNotRun(n,t):ee().staged.commitRefusedByHook(n,t)}o(TR,"hookRefusal");var c={};Nm(c,{BRAND:()=>xV,DIRTY:()=>Fs,EMPTY_PATH:()=>cV,INVALID:()=>ne,NEVER:()=>gH,OK:()=>gt,ParseStatus:()=>ot,Schema:()=>pe,ZodAny:()=>Vr,ZodArray:()=>Ar,ZodBigInt:()=>Us,ZodBoolean:()=>Ls,ZodBranded:()=>Xa,ZodCatch:()=>Ys,ZodDate:()=>_s,ZodDefault:()=>Js,ZodDiscriminatedUnion:()=>nl,ZodEffects:()=>sn,ZodEnum:()=>qs,ZodError:()=>xt,ZodFirstPartyTypeKind:()=>oe,ZodFunction:()=>sl,ZodIntersection:()=>Gs,ZodIssueCode:()=>U,ZodLazy:()=>Vs,ZodLiteral:()=>Hs,ZodMap:()=>go,ZodNaN:()=>fo,ZodNativeEnum:()=>js,ZodNever:()=>In,ZodNull:()=>Ps,ZodNullable:()=>On,ZodNumber:()=>Ms,ZodObject:()=>Tt,ZodOptional:()=>nn,ZodParsedType:()=>q,ZodPipeline:()=>ec,ZodPromise:()=>Hr,ZodReadonly:()=>Ws,ZodRecord:()=>rl,ZodSchema:()=>pe,ZodSet:()=>ho,ZodString:()=>Gr,ZodSymbol:()=>lo,ZodTransformer:()=>sn,ZodTuple:()=>Pn,ZodType:()=>pe,ZodUndefined:()=>$s,ZodUnion:()=>Os,ZodUnknown:()=>cr,ZodVoid:()=>po,addIssueToContext:()=>V,any:()=>$V,array:()=>VV,bigint:()=>FV,boolean:()=>GR,coerce:()=>pH,custom:()=>$R,date:()=>MV,datetimeRegex:()=>LR,defaultErrorMap:()=>or,discriminatedUnion:()=>JV,effect:()=>iH,enum:()=>nH,function:()=>XV,getErrorMap:()=>co,getParsedType:()=>$n,instanceof:()=>DV,intersection:()=>YV,isAborted:()=>el,isAsync:()=>Ao,isDirty:()=>tl,isValid:()=>Or,late:()=>TV,lazy:()=>eH,literal:()=>tH,makeIssue:()=>Za,map:()=>KV,nan:()=>NV,nativeEnum:()=>rH,never:()=>OV,null:()=>_V,nullable:()=>aH,number:()=>OR,object:()=>HV,objectUtil:()=>Lh,oboolean:()=>dH,onumber:()=>lH,optional:()=>oH,ostring:()=>uH,pipeline:()=>AH,preprocess:()=>cH,promise:()=>sH,quotelessJson:()=>iV,record:()=>zV,set:()=>ZV,setErrorMap:()=>aV,strictObject:()=>qV,string:()=>PR,symbol:()=>UV,transformer:()=>iH,tuple:()=>WV,undefined:()=>LV,union:()=>jV,unknown:()=>PV,util:()=>Ee,void:()=>GV});var Ee;(function(e){e.assertEqual=s=>{};function t(s){}o(t,"assertIs"),e.assertIs=t;function n(s){throw new Error}o(n,"assertNever"),e.assertNever=n,e.arrayToEnum=s=>{let i={};for(let a of s)i[a]=a;return i},e.getValidEnumValues=s=>{let i=e.objectKeys(s).filter(A=>typeof s[s[A]]!="number"),a={};for(let A of i)a[A]=s[A];return e.objectValues(a)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},e.find=(s,i)=>{for(let a of s)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}o(r,"joinValues"),e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ee||(Ee={}));var Lh;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Lh||(Lh={}));var q=Ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$n=o(e=>{switch(typeof e){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(e)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(e)?q.array:e===null?q.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?q.promise:typeof Map<"u"&&e instanceof Map?q.map:typeof Set<"u"&&e instanceof Set?q.set:typeof Date<"u"&&e instanceof Date?q.date:q.object;default:return q.unknown}},"getParsedType");var U=Ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),iV=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),xt=class e extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_errors:[]},s=o(i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let A=r,u=0;for(;u<a.path.length;){let d=a.path[u],p=u===a.path.length-1;if(d==="_errors"){p&&A._errors.push(n(a)),u++;continue}Object.prototype.hasOwnProperty.call(A,d)||(d==="__proto__"?Object.defineProperty(A,d,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):A[d]={_errors:[]}),A=A[d],p&&A._errors.push(n(a)),u++}}},"processError");return s(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};xt.create=e=>new xt(e);var oV=o((e,t)=>{let n;switch(e.code){case U.invalid_type:e.received===q.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ee.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ee.joinValues(e.keys,", ")}`;break;case U.invalid_union:n="Invalid input";break;case U.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ee.joinValues(e.options)}`;break;case U.invalid_enum_value:n=`Invalid enum value. Expected ${Ee.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:n="Invalid function arguments";break;case U.invalid_return_type:n="Invalid function return type";break;case U.invalid_date:n="Invalid date";break;case U.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ee.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case U.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case U.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case U.custom:n="Invalid input";break;case U.invalid_intersection_types:n="Intersection results could not be merged";break;case U.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ee.assertNever(e)}return{message:n}},"errorMap"),or=oV;var DR=or;function aV(e){DR=e}o(aV,"setErrorMap");function co(){return DR}o(co,"getErrorMap");var Za=o(e=>{let{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let A="",u=r.filter(d=>!!d).slice().reverse();for(let d of u)A=d(a,{data:t,defaultError:A}).message;return{...s,path:i,message:A}},"makeIssue"),cV=[];function V(e,t){let n=co(),r=Za({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===or?void 0:or].filter(s=>!!s)});e.common.issues.push(r)}o(V,"addIssueToContext");var ot=class e{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let s of n){if(s.status==="aborted")return ne;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let s of n){let i=await s.key,a=await s.value;r.push({key:i,value:a})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let s of n){let{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return ne;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:t.value,value:r}}},ne=Object.freeze({status:"aborted"}),Fs=o(e=>({status:"dirty",value:e}),"DIRTY"),gt=o(e=>({status:"valid",value:e}),"OK"),el=o(e=>e.status==="aborted","isAborted"),tl=o(e=>e.status==="dirty","isDirty"),Or=o(e=>e.status==="valid","isValid"),Ao=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");var J;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(J||(J={}));var rn=class{static{o(this,"ParseInputLazyPath")}constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},NR=o((e,t)=>{if(Or(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new xt(e.common.issues);return this._error=n,this._error}}},"handleResult");function ue(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:o((a,A)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??A.defaultError}:typeof A.data>"u"?{message:u??r??A.defaultError}:a.code!=="invalid_type"?{message:A.defaultError}:{message:u??n??A.defaultError}},"customMap"),description:s}}o(ue,"processCreateParams");var pe=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(t){return $n(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:$n(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ot,ctx:{common:t.parent.common,data:t.data,parsedType:$n(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Ao(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$n(t)},s=this._parseSync({data:t,path:r.path,parent:r});return NR(r,s)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$n(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Or(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Or(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$n(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(Ao(s)?s:Promise.resolve(s));return NR(r,i)}refine(t,n){let r=o(s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n,"getIssueProperties");return this._refinement((s,i)=>{let a=t(s),A=o(()=>i.addIssue({code:U.custom,...r(s)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(A(),!1)):a?!0:(A(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new sn({schema:this,typeName:oe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(n=>this["~validate"](n),"validate")}}optional(){return nn.create(this,this._def)}nullable(){return On.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ar.create(this)}promise(){return Hr.create(this,this._def)}or(t){return Os.create([this,t],this._def)}and(t){return Gs.create(this,t,this._def)}transform(t){return new sn({...ue(this._def),schema:this,typeName:oe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Js({...ue(this._def),innerType:this,defaultValue:n,typeName:oe.ZodDefault})}brand(){return new Xa({typeName:oe.ZodBranded,type:this,...ue(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Ys({...ue(this._def),innerType:this,catchValue:n,typeName:oe.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ec.create(this,t)}readonly(){return Ws.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},AV=/^c[^\s-]{8,}$/i,uV=/^[0-9a-z]+$/,lV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dV=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,pV=/^[a-z0-9_-]{21}$/i,gV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hV=/^[-+]?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)?)??$/,fV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mV="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",_h,EV=/^(?:(?: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])$/,yV=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,CV=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,IV=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,QV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,MR="((\\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])))",wV=new RegExp(`^${MR}$`);function UR(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}o(UR,"timeRegexSource");function bV(e){return new RegExp(`^${UR(e)}$`)}o(bV,"timeRegex");function LR(e){let t=`${MR}T${UR(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}o(LR,"datetimeRegex");function RV(e,t){return!!((t==="v4"||!t)&&EV.test(e)||(t==="v6"||!t)&&CV.test(e))}o(RV,"isValidIP");function SV(e,t){if(!gV.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}o(SV,"isValidJWT");function kV(e,t){return!!((t==="v4"||!t)&&yV.test(e)||(t==="v6"||!t)&&IV.test(e))}o(kV,"isValidCidr");var Gr=class e extends pe{static{o(this,"ZodString")}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==q.string){let i=this._getOrReturnCtx(t);return V(i,{code:U.invalid_type,expected:q.string,received:i.parsedType}),ne}let r=new ot,s;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,A=t.data.length<i.value;(a||A)&&(s=this._getOrReturnCtx(t,s),a?V(s,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):A&&V(s,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")fV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"email",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")_h||(_h=new RegExp(mV,"u")),_h.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"emoji",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")dV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"uuid",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")pV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"nanoid",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")AV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cuid",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")uV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cuid2",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")lV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"ulid",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),V(s,{validation:"url",code:U.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"regex",code:U.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?LR(i).test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?wV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?bV(i).test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?hV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"duration",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?RV(t.data,i.version)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"ip",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?SV(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"jwt",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?kV(t.data,i.version)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cidr",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?BV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"base64",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?QV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"base64url",code:U.invalid_string,message:i.message}),r.dirty()):Ee.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:U.invalid_string,...J.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...J.errToObj(t)})}url(t){return this._addCheck({kind:"url",...J.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...J.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...J.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...J.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...J.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...J.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...J.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...J.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...J.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...J.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...J.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...J.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...J.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...J.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...J.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...J.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...J.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...J.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...J.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...J.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...J.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...J.errToObj(n)})}nonempty(t){return this.min(1,J.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Gr.create=e=>new Gr({checks:[],typeName:oe.ZodString,coerce:e?.coerce??!1,...ue(e)});function vV(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}o(vV,"floatSafeRemainder");var Ms=class e extends pe{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==q.number){let i=this._getOrReturnCtx(t);return V(i,{code:U.invalid_type,expected:q.number,received:i.parsedType}),ne}let r,s=new ot;for(let i of this._def.checks)i.kind==="int"?Ee.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),V(r,{code:U.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?vV(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),V(r,{code:U.not_finite,message:i.message}),s.dirty()):Ee.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,J.toString(n))}gt(t,n){return this.setLimit("min",t,!1,J.toString(n))}lte(t,n){return this.setLimit("max",t,!0,J.toString(n))}lt(t,n){return this.setLimit("max",t,!1,J.toString(n))}setLimit(t,n,r,s){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:J.toString(s)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:J.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:J.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ee.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};Ms.create=e=>new Ms({checks:[],typeName:oe.ZodNumber,coerce:e?.coerce||!1,...ue(e)});var Us=class e extends pe{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==q.bigint)return this._getInvalidInput(t);let r,s=new ot;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ee.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return V(n,{code:U.invalid_type,expected:q.bigint,received:n.parsedType}),ne}gte(t,n){return this.setLimit("min",t,!0,J.toString(n))}gt(t,n){return this.setLimit("min",t,!1,J.toString(n))}lte(t,n){return this.setLimit("max",t,!0,J.toString(n))}lt(t,n){return this.setLimit("max",t,!1,J.toString(n))}setLimit(t,n,r,s){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:J.toString(s)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Us.create=e=>new Us({checks:[],typeName:oe.ZodBigInt,coerce:e?.coerce??!1,...ue(e)});var Ls=class extends pe{static{o(this,"ZodBoolean")}_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==q.boolean){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.boolean,received:r.parsedType}),ne}return gt(t.data)}};Ls.create=e=>new Ls({typeName:oe.ZodBoolean,coerce:e?.coerce||!1,...ue(e)});var _s=class e extends pe{static{o(this,"ZodDate")}_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==q.date){let i=this._getOrReturnCtx(t);return V(i,{code:U.invalid_type,expected:q.date,received:i.parsedType}),ne}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return V(i,{code:U.invalid_date}),ne}let r=new ot,s;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:U.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:U.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ee.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:J.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:J.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};_s.create=e=>new _s({checks:[],coerce:e?.coerce||!1,typeName:oe.ZodDate,...ue(e)});var lo=class extends pe{static{o(this,"ZodSymbol")}_parse(t){if(this._getType(t)!==q.symbol){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.symbol,received:r.parsedType}),ne}return gt(t.data)}};lo.create=e=>new lo({typeName:oe.ZodSymbol,...ue(e)});var $s=class extends pe{static{o(this,"ZodUndefined")}_parse(t){if(this._getType(t)!==q.undefined){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.undefined,received:r.parsedType}),ne}return gt(t.data)}};$s.create=e=>new $s({typeName:oe.ZodUndefined,...ue(e)});var Ps=class extends pe{static{o(this,"ZodNull")}_parse(t){if(this._getType(t)!==q.null){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.null,received:r.parsedType}),ne}return gt(t.data)}};Ps.create=e=>new Ps({typeName:oe.ZodNull,...ue(e)});var Vr=class extends pe{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(t){return gt(t.data)}};Vr.create=e=>new Vr({typeName:oe.ZodAny,...ue(e)});var cr=class extends pe{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(t){return gt(t.data)}};cr.create=e=>new cr({typeName:oe.ZodUnknown,...ue(e)});var In=class extends pe{static{o(this,"ZodNever")}_parse(t){let n=this._getOrReturnCtx(t);return V(n,{code:U.invalid_type,expected:q.never,received:n.parsedType}),ne}};In.create=e=>new In({typeName:oe.ZodNever,...ue(e)});var po=class extends pe{static{o(this,"ZodVoid")}_parse(t){if(this._getType(t)!==q.undefined){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.void,received:r.parsedType}),ne}return gt(t.data)}};po.create=e=>new po({typeName:oe.ZodVoid,...ue(e)});var Ar=class e extends pe{static{o(this,"ZodArray")}_parse(t){let{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==q.array)return V(n,{code:U.invalid_type,expected:q.array,received:n.parsedType}),ne;if(s.exactLength!==null){let a=n.data.length>s.exactLength.value,A=n.data.length<s.exactLength.value;(a||A)&&(V(n,{code:a?U.too_big:U.too_small,minimum:A?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(V(n,{code:U.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(V(n,{code:U.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,A)=>s.type._parseAsync(new rn(n,a,n.path,A)))).then(a=>ot.mergeArray(r,a));let i=[...n.data].map((a,A)=>s.type._parseSync(new rn(n,a,n.path,A)));return ot.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:J.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:J.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:J.toString(n)}})}nonempty(t){return this.min(1,t)}};Ar.create=(e,t)=>new Ar({type:e,minLength:null,maxLength:null,exactLength:null,typeName:oe.ZodArray,...ue(t)});function uo(e){if(e instanceof Tt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=nn.create(uo(r))}return new Tt({...e._def,shape:o(()=>t,"shape")})}else return e instanceof Ar?new Ar({...e._def,type:uo(e.element)}):e instanceof nn?nn.create(uo(e.unwrap())):e instanceof On?On.create(uo(e.unwrap())):e instanceof Pn?Pn.create(e.items.map(t=>uo(t))):e}o(uo,"deepPartialify");var Tt=class e extends pe{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Ee.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==q.object){let d=this._getOrReturnCtx(t);return V(d,{code:U.invalid_type,expected:q.object,received:d.parsedType}),ne}let{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),A=[];if(!(this._def.catchall instanceof In&&this._def.unknownKeys==="strip"))for(let d in s.data)a.includes(d)||A.push(d);let u=[];for(let d of a){let p=i[d],g=s.data[d];u.push({key:{status:"valid",value:d},value:p._parse(new rn(s,g,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof In){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of A)u.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")A.length>0&&(V(s,{code:U.unrecognized_keys,keys:A}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of A){let g=s.data[p];u.push({key:{status:"valid",value:p},value:d._parse(new rn(s,g,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of u){let g=await p.key,f=await p.value;d.push({key:g,value:f,alwaysSet:p.alwaysSet})}return d}).then(d=>ot.mergeObjectSync(r,d)):ot.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(t){return J.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:o((n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:J.errToObj(t).message??s}:{message:s}},"errorMap")}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:o(()=>({...this._def.shape(),...t}),"shape")})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:o(()=>({...this._def.shape(),...t._def.shape()}),"shape"),typeName:oe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of Ee.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:o(()=>n,"shape")})}omit(t){let n={};for(let r of Ee.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return uo(this)}partial(t){let n={};for(let r of Ee.objectKeys(this.shape)){let s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new e({...this._def,shape:o(()=>n,"shape")})}required(t){let n={};for(let r of Ee.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof nn;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:o(()=>n,"shape")})}keyof(){return _R(Ee.objectKeys(this.shape))}};Tt.create=(e,t)=>new Tt({shape:o(()=>e,"shape"),unknownKeys:"strip",catchall:In.create(),typeName:oe.ZodObject,...ue(t)});Tt.strictCreate=(e,t)=>new Tt({shape:o(()=>e,"shape"),unknownKeys:"strict",catchall:In.create(),typeName:oe.ZodObject,...ue(t)});Tt.lazycreate=(e,t)=>new Tt({shape:e,unknownKeys:"strip",catchall:In.create(),typeName:oe.ZodObject,...ue(t)});var Os=class extends pe{static{o(this,"ZodUnion")}_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(let A of i)if(A.result.status==="valid")return A.result;for(let A of i)if(A.result.status==="dirty")return n.common.issues.push(...A.ctx.common.issues),A.result;let a=i.map(A=>new xt(A.ctx.common.issues));return V(n,{code:U.invalid_union,unionErrors:a}),ne}if(o(s,"handleResults"),n.common.async)return Promise.all(r.map(async i=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(s);{let i,a=[];for(let u of r){let d={...n,common:{...n.common,issues:[]},parent:null},p=u._parseSync({data:n.data,path:n.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let A=a.map(u=>new xt(u));return V(n,{code:U.invalid_union,unionErrors:A}),ne}}get options(){return this._def.options}};Os.create=(e,t)=>new Os({options:e,typeName:oe.ZodUnion,...ue(t)});var ar=o(e=>e instanceof Vs?ar(e.schema):e instanceof sn?ar(e.innerType()):e instanceof Hs?[e.value]:e instanceof qs?e.options:e instanceof js?Ee.objectValues(e.enum):e instanceof Js?ar(e._def.innerType):e instanceof $s?[void 0]:e instanceof Ps?[null]:e instanceof nn?[void 0,...ar(e.unwrap())]:e instanceof On?[null,...ar(e.unwrap())]:e instanceof Xa||e instanceof Ws?ar(e.unwrap()):e instanceof Ys?ar(e._def.innerType):[],"getDiscriminator"),nl=class e extends pe{static{o(this,"ZodDiscriminatedUnion")}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==q.object)return V(n,{code:U.invalid_type,expected:q.object,received:n.parsedType}),ne;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(V(n,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let s=new Map;for(let i of n){let a=ar(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let A of a){if(s.has(A))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(A)}`);s.set(A,i)}}return new e({typeName:oe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...ue(r)})}};function $h(e,t){let n=$n(e),r=$n(t);if(e===t)return{valid:!0,data:e};if(n===q.object&&r===q.object){let s=Ee.objectKeys(t),i=Ee.objectKeys(e).filter(A=>s.indexOf(A)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let A of i){if(A==="__proto__")continue;let u=$h(e[A],t[A]);if(!u.valid)return{valid:!1};a[A]=u.data}return{valid:!0,data:a}}else if(n===q.array&&r===q.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let i=0;i<e.length;i++){let a=e[i],A=t[i],u=$h(a,A);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===q.date&&r===q.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}o($h,"mergeValues");var Gs=class extends pe{static{o(this,"ZodIntersection")}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),s=o((i,a)=>{if(el(i)||el(a))return ne;let A=$h(i.value,a.value);return A.valid?((tl(i)||tl(a))&&n.dirty(),{status:n.value,value:A.data}):(V(r,{code:U.invalid_intersection_types}),ne)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Gs.create=(e,t,n)=>new Gs({left:e,right:t,typeName:oe.ZodIntersection,...ue(n)});var Pn=class e extends pe{static{o(this,"ZodTuple")}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==q.array)return V(r,{code:U.invalid_type,expected:q.array,received:r.parsedType}),ne;if(r.data.length<this._def.items.length)return V(r,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&r.data.length>this._def.items.length&&(V(r,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((a,A)=>{let u=this._def.items[A]||this._def.rest;return u?u._parse(new rn(r,a,r.path,A)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>ot.mergeArray(n,a)):ot.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Pn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pn({items:e,typeName:oe.ZodTuple,rest:null,...ue(t)})};var rl=class e extends pe{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==q.object)return V(r,{code:U.invalid_type,expected:q.object,received:r.parsedType}),ne;let s=[],i=this._def.keyType,a=this._def.valueType;for(let A in r.data)s.push({key:i._parse(new rn(r,A,r.path,A)),value:a._parse(new rn(r,r.data[A],r.path,A)),alwaysSet:A in r.data});return r.common.async?ot.mergeObjectAsync(n,s):ot.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof pe?new e({keyType:t,valueType:n,typeName:oe.ZodRecord,...ue(r)}):new e({keyType:Gr.create(),valueType:t,typeName:oe.ZodRecord,...ue(n)})}},go=class extends pe{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==q.map)return V(r,{code:U.invalid_type,expected:q.map,received:r.parsedType}),ne;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([A,u],d)=>({key:s._parse(new rn(r,A,r.path,[d,"key"])),value:i._parse(new rn(r,u,r.path,[d,"value"]))}));if(r.common.async){let A=new Map;return Promise.resolve().then(async()=>{for(let u of a){let d=await u.key,p=await u.value;if(d.status==="aborted"||p.status==="aborted")return ne;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),A.set(d.value,p.value)}return{status:n.value,value:A}})}else{let A=new Map;for(let u of a){let d=u.key,p=u.value;if(d.status==="aborted"||p.status==="aborted")return ne;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),A.set(d.value,p.value)}return{status:n.value,value:A}}}};go.create=(e,t,n)=>new go({valueType:t,keyType:e,typeName:oe.ZodMap,...ue(n)});var ho=class e extends pe{static{o(this,"ZodSet")}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==q.set)return V(r,{code:U.invalid_type,expected:q.set,received:r.parsedType}),ne;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(V(r,{code:U.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(V(r,{code:U.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function a(u){let d=new Set;for(let p of u){if(p.status==="aborted")return ne;p.status==="dirty"&&n.dirty(),d.add(p.value)}return{status:n.value,value:d}}o(a,"finalizeSet");let A=[...r.data.values()].map((u,d)=>i._parse(new rn(r,u,r.path,d)));return r.common.async?Promise.all(A).then(u=>a(u)):a(A)}min(t,n){return new e({...this._def,minSize:{value:t,message:J.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:J.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};ho.create=(e,t)=>new ho({valueType:e,minSize:null,maxSize:null,typeName:oe.ZodSet,...ue(t)});var sl=class e extends pe{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==q.function)return V(n,{code:U.invalid_type,expected:q.function,received:n.parsedType}),ne;function r(A,u){return Za({data:A,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,co(),or].filter(d=>!!d),issueData:{code:U.invalid_arguments,argumentsError:u}})}o(r,"makeArgsIssue");function s(A,u){return Za({data:A,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,co(),or].filter(d=>!!d),issueData:{code:U.invalid_return_type,returnTypeError:u}})}o(s,"makeReturnsIssue");let i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Hr){let A=this;return gt(async function(...u){let d=new xt([]),p=await A._def.args.parseAsync(u,i).catch(m=>{throw d.addIssue(r(u,m)),d}),g=await Reflect.apply(a,this,p);return await A._def.returns._def.type.parseAsync(g,i).catch(m=>{throw d.addIssue(s(g,m)),d})})}else{let A=this;return gt(function(...u){let d=A._def.args.safeParse(u,i);if(!d.success)throw new xt([r(u,d.error)]);let p=Reflect.apply(a,this,d.data),g=A._def.returns.safeParse(p,i);if(!g.success)throw new xt([s(p,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Pn.create(t).rest(cr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||Pn.create([]).rest(cr.create()),returns:n||cr.create(),typeName:oe.ZodFunction,...ue(r)})}},Vs=class extends pe{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Vs.create=(e,t)=>new Vs({getter:e,typeName:oe.ZodLazy,...ue(t)});var Hs=class extends pe{static{o(this,"ZodLiteral")}_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return V(n,{received:n.data,code:U.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:t.data}}get value(){return this._def.value}};Hs.create=(e,t)=>new Hs({value:e,typeName:oe.ZodLiteral,...ue(t)});function _R(e,t){return new qs({values:e,typeName:oe.ZodEnum,...ue(t)})}o(_R,"createZodEnum");var qs=class e extends pe{static{o(this,"ZodEnum")}_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return V(n,{expected:Ee.joinValues(r),received:n.parsedType,code:U.invalid_type}),ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return V(n,{received:n.data,code:U.invalid_enum_value,options:r}),ne}return gt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};qs.create=_R;var js=class extends pe{static{o(this,"ZodNativeEnum")}_parse(t){let n=Ee.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==q.string&&r.parsedType!==q.number){let s=Ee.objectValues(n);return V(r,{expected:Ee.joinValues(s),received:r.parsedType,code:U.invalid_type}),ne}if(this._cache||(this._cache=new Set(Ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let s=Ee.objectValues(n);return V(r,{received:r.data,code:U.invalid_enum_value,options:s}),ne}return gt(t.data)}get enum(){return this._def.values}};js.create=(e,t)=>new js({values:e,typeName:oe.ZodNativeEnum,...ue(t)});var Hr=class extends pe{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==q.promise&&n.common.async===!1)return V(n,{code:U.invalid_type,expected:q.promise,received:n.parsedType}),ne;let r=n.parsedType===q.promise?n.data:Promise.resolve(n.data);return gt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Hr.create=(e,t)=>new Hr({type:e,typeName:oe.ZodPromise,...ue(t)});var sn=class extends pe{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o(a=>{V(r,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async A=>{if(n.value==="aborted")return ne;let u=await this._def.schema._parseAsync({data:A,path:r.path,parent:r});return u.status==="aborted"?ne:u.status==="dirty"?Fs(u.value):n.value==="dirty"?Fs(u.value):u});{if(n.value==="aborted")return ne;let A=this._def.schema._parseSync({data:a,path:r.path,parent:r});return A.status==="aborted"?ne:A.status==="dirty"?Fs(A.value):n.value==="dirty"?Fs(A.value):A}}if(s.type==="refinement"){let a=o(A=>{let u=s.refinement(A,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return A},"executeRefinement");if(r.common.async===!1){let A=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return A.status==="aborted"?ne:(A.status==="dirty"&&n.dirty(),a(A.value),{status:n.value,value:A.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(A=>A.status==="aborted"?ne:(A.status==="dirty"&&n.dirty(),a(A.value).then(()=>({status:n.value,value:A.value}))))}if(s.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Or(a))return ne;let A=s.transform(a.value,i);if(A instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:A}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Or(a)?Promise.resolve(s.transform(a.value,i)).then(A=>({status:n.value,value:A})):ne);Ee.assertNever(s)}};sn.create=(e,t,n)=>new sn({schema:e,typeName:oe.ZodEffects,effect:t,...ue(n)});sn.createWithPreprocess=(e,t,n)=>new sn({schema:t,effect:{type:"preprocess",transform:e},typeName:oe.ZodEffects,...ue(n)});var nn=class extends pe{static{o(this,"ZodOptional")}_parse(t){return this._getType(t)===q.undefined?gt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};nn.create=(e,t)=>new nn({innerType:e,typeName:oe.ZodOptional,...ue(t)});var On=class extends pe{static{o(this,"ZodNullable")}_parse(t){return this._getType(t)===q.null?gt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};On.create=(e,t)=>new On({innerType:e,typeName:oe.ZodNullable,...ue(t)});var Js=class extends pe{static{o(this,"ZodDefault")}_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Js.create=(e,t)=>new Js({innerType:e,typeName:oe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ue(t)});var Ys=class extends pe{static{o(this,"ZodCatch")}_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ao(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xt(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new xt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ys.create=(e,t)=>new Ys({innerType:e,typeName:oe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ue(t)});var fo=class extends pe{static{o(this,"ZodNaN")}_parse(t){if(this._getType(t)!==q.nan){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.nan,received:r.parsedType}),ne}return{status:"valid",value:t.data}}};fo.create=e=>new fo({typeName:oe.ZodNaN,...ue(e)});var xV=Symbol("zod_brand"),Xa=class extends pe{static{o(this,"ZodBranded")}_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},ec=class e extends pe{static{o(this,"ZodPipeline")}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return o(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ne:i.status==="dirty"?(n.dirty(),Fs(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})},"handleAsync")();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ne:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:oe.ZodPipeline})}},Ws=class extends pe{static{o(this,"ZodReadonly")}_parse(t){let n=this._def.innerType._parse(t),r=o(s=>(Or(s)&&(s.value=Object.freeze(s.value)),s),"freeze");return Ao(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Ws.create=(e,t)=>new Ws({innerType:e,typeName:oe.ZodReadonly,...ue(t)});function FR(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}o(FR,"cleanParams");function $R(e,t={},n){return e?Vr.create().superRefine((r,s)=>{let i=e(r);if(i instanceof Promise)return i.then(a=>{if(!a){let A=FR(t,r),u=A.fatal??n??!0;s.addIssue({code:"custom",...A,fatal:u})}});if(!i){let a=FR(t,r),A=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:A})}}):Vr.create()}o($R,"custom");var TV={object:Tt.lazycreate},oe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(oe||(oe={}));var DV=o((e,t={message:`Input not instance of ${e.name}`})=>$R(n=>n instanceof e,t),"instanceOfType"),PR=Gr.create,OR=Ms.create,NV=fo.create,FV=Us.create,GR=Ls.create,MV=_s.create,UV=lo.create,LV=$s.create,_V=Ps.create,$V=Vr.create,PV=cr.create,OV=In.create,GV=po.create,VV=Ar.create,HV=Tt.create,qV=Tt.strictCreate,jV=Os.create,JV=nl.create,YV=Gs.create,WV=Pn.create,zV=rl.create,KV=go.create,ZV=ho.create,XV=sl.create,eH=Vs.create,tH=Hs.create,nH=qs.create,rH=js.create,sH=Hr.create,iH=sn.create,oH=nn.create,aH=On.create,cH=sn.createWithPreprocess,AH=ec.create,uH=o(()=>PR().optional(),"ostring"),lH=o(()=>OR().optional(),"onumber"),dH=o(()=>GR().optional(),"oboolean"),pH={string:o((e=>Gr.create({...e,coerce:!0})),"string"),number:o((e=>Ms.create({...e,coerce:!0})),"number"),boolean:o((e=>Ls.create({...e,coerce:!0})),"boolean"),bigint:o((e=>Us.create({...e,coerce:!0})),"bigint"),date:o((e=>_s.create({...e,coerce:!0})),"date")};var gH=ne;var AS=require("node:crypto");var zs=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(zs||{});var Ph=o(e=>`${e.source}:${e.site??""}:${e.key}`,"requirementItemId");var tc=/^pasted-[0-9a-f]{16}$/,mo=/^file-[0-9a-f]{16}$/,nc=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(nc||{}),rc=o(e=>e.trim().toUpperCase(),"normalKey"),VR=o((e,t)=>{let n=e.trim();return tc.test(n.toLowerCase())?"Pasted text":mo.test(n.toLowerCase())?t?.get(rc(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()},"itemName");var il=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(il||{}),qr=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(qr||{}),Eo=(C=>(C.RelatedChangeConflict="related_change_conflict",C.ReferenceOutsideTarget="reference_outside_target",C.SourceAccessLost="source_access_lost",C.ConfigurationIncomplete="configuration_incomplete",C.CredentialUnavailable="credential_unavailable",C.WorkflowBindingUnverified="workflow_binding_unverified",C.WorkflowRefUnprotected="workflow_ref_unprotected",C.BedrockWorkflowRequired="bedrock_workflow_required",C.DeploymentReview="deployment_review",C.SutRevisionMismatch="sut_revision_mismatch",C.IsolationUnavailable="isolation_unavailable",C.EvidenceInsufficient="evidence_insufficient",C.ConfigurationUnresolved="configuration_unresolved",C.ModelProviderDenied="model_provider_denied",C.ModelProviderUnavailable="model_provider_unavailable",C.RunnerProviderNotReady="runner_provider_not_ready",C.MergeConflict="merge_conflict",C))(Eo||{}),jr=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(jr||{}),ol=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(ol||{}),al=(A=>(A.AuthToken="auth_token",A.Secret="secret",A.DataConnection="data_connection",A.AppNotStarted="app_not_started",A.Login="login",A.ExternalDependency="external_dependency",A.RecordingReplay="recording_replay",A))(al||{});var cl=(n=>(n.Probe="probe",n.Agent="agent",n))(cl||{}),Al=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(Al||{}),ul=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(ul||{});var Oh=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Oh||{}),Je=c.string().trim().min(1),hH=c.object({action:c.enum(["start","run","wait"]),text:Je,source:c.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Je.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(e=>e.source==="file"==(e.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),fH=/^[A-Za-z_][A-Za-z0-9_]*$/,sc=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,yo=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(yo||{}),Gn="shared",mH=Je.refine(e=>{try{let t=new URL(e);return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}},"an http(s) URL with no login in it"),Co=c.object({address:mH,readyWhen:Je.nullable(),credentials:c.array(c.string().regex(sc)).max(50),revisionSources:c.array(c.object({method:c.nativeEnum(yo),detail:Je.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:c.array(Je).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),Gh={steps:c.array(hH).max(20).optional().describe("how it starts, in order"),kind:c.enum(["web_app","service","database","external_service"]).optional(),from:c.object({file:Je,service:Je.nullable()}).strict().optional(),credentials:c.array(c.string().max(100).regex(fH)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},EH=c.object({name:Je,repository:Je.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:c.boolean(),...Gh,deployed:Je.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),yH=c.object({component:Je,problem:Je,evidence:Je.describe("the exact command and output that shows it"),fix:Je.describe("what the user must provide, and where")}),CH=c.object({framework:Je,file:Je.describe("the test file run, relative to its repository root"),result:c.enum(["pass","fail","error"])}),IH=c.object({input:Je.describe("the part of the user's SUT input, as given"),reason:Je}),c8=c.object({schemaVersion:c.literal(1),status:c.nativeEnum(Oh).describe("ready only if every component came up healthy and the recipe is written"),components:c.array(EH),suites:c.array(CH).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:c.array(Je).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:c.array(c.object({input:Je.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Je.describe("what the recipe did with it")})).optional(),inputsNotUsed:c.array(IH).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one that names a file, command, port, route or setting that does not exist or does not work"),blockers:c.array(yH).describe("required (non-empty) when status is blocked"),environment:Co.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var Vh=64*1024,Hh=512*1024,HR=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var jR=fe(require("path"));var ur=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(ur||{}),Bn=c.string().trim().min(1),BH=c.object({url:c.string().optional().describe("the URL probed, if the check is an HTTP request"),command:c.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:c.record(c.string()).optional(),status:c.union([c.number(),c.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:Bn.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),qh=c.array(c.object({component:Bn.describe("a shared component listed above"),url:Bn.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:Bn.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),QH=c.object({name:Bn.describe("the credential's environment variable name, as listed above; never its value"),component:Bn.describe("the component that refused it"),status:c.number().int().min(400).max(599).optional().describe("the HTTP status it got, such as 401 or 403; leave it out when the refusal was not an HTTP answer"),evidence:Bn.describe("the request or command you tested it with and what came back, never the value")}),qR=c.object({schemaVersion:c.literal(1),baseUrls:c.record(c.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:BH.optional(),teardown:Bn.describe("command that tears the SUT down"),dependencies:c.record(c.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:c.nativeEnum(ur).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:c.array(c.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:c.object({command:Bn,output:Bn}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:c.array(c.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:c.boolean(),startedAt:Bn.describe("ISO timestamp"),revisions:qh.optional(),credentialsRefused:c.array(QH).optional().describe("only for credentials the prompt lists to test: each that was refused when you tested it, such as with a 401 or 403; leave it out when none was, or when none is listed"),recipeRecorded:c.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var at=c.string().trim().min(1),ll=at,jh=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(jh||{}),Jh=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],JR=c.object({schemaVersion:c.literal(1),type:c.nativeEnum(jh).optional(),repository:ll.optional().describe("namespace/name of the source whose checkout the recipe was written and proven in (SKYR-5380); a run replays it from there. Never on a customer_deployed plan"),status:c.enum(["ready","blocked"]),environment:Co.optional(),components:c.array(c.object({name:at,repository:at.describe(`owner/repo, or "${Gn}" for a customer-deployed component no repository builds`),healthy:c.boolean(),url:c.string().min(1).nullable(),...Gh,credentials:c.array(c.string().regex(sc)).max(50).optional(),deployed:at.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:c.array(c.object({framework:at,file:at,result:c.enum(["pass","fail","error"])}).strict()),inputsUsed:c.array(at),inputsUsedHow:c.array(c.object({input:at,how:at}).strict()).optional(),inputsNotUsed:c.array(c.object({input:at,reason:at}).strict()),blockers:c.array(c.object({component:at,problem:at,evidence:at,fix:at}).strict()),replay:c.object({outcome:at,durationSeconds:c.number().nonnegative().nullable()}).strict().nullable(),files:c.array(c.object({path:at,content:c.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((s,i)=>{e.inputsUsed.includes(s.input)||t.addIssue({code:c.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),e.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:c.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:c.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),e.environment&&new Set(e.environment.credentials).size!==e.environment.credentials.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(e.components.map(s=>s.name));if(e.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((a,A)=>{r.has(a)||t.addIssue({code:c.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",A],message:"not one of components"})})}),e.components.forEach((s,i)=>{s.deployed!==void 0!==n&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===Gn&&!n&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${Gn}`})}),n&&(e.components.forEach((s,i)=>{e.components.findIndex(a=>a.name===s.name)!==i&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:c.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((s,i)=>{Jh.includes(s.path)&&t.addIssue({code:c.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let s=new Set(e.environment?.revisionSources.flatMap(i=>i.components));e.components.forEach((i,a)=>{i.repository!==Gn&&!s.has(i.name)&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var m8=["clean","recipe-drift"];function ic(e){let t=jR.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}o(ic,"isRuntimePlanFile");var Ks=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(Ks||{}),ml=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(ml||{}),Wh=(a=>(a.PullRequest="pull_request",a.ReadyForReview="ready_for_review",a.Schedule="schedule",a.Manual="manual",a.SutSetup="sut_setup",a.RevisionRead="revision_read",a))(Wh||{}),wH=["sut_setup"],bH=["sut_setup","schedule","revision_read"],RH=["sut_setup"],zh=(t=>(t.PullRequest="pull_request",t))(zh||{}),Kh=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(Kh||{}),YR=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"],uS=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(uS||{}),El=(s=>(s.None="none",s.Delivered="delivered",s.Partial="partial",s.Failed="failed",s))(El||{}),Ac=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(Ac||{}),lS=(n=>(n.Running="running",n.Ended="ended",n))(lS||{}),uc=(g=>(g.TimedOut="timed_out",g.AgentFailed="agent_failed",g.SetupFailed="setup_failed",g.CredentialMissing="credential_missing",g.RunnerLost="runner_lost",g.CheckoutFailed="checkout_failed",g.EnvironmentUnverified="environment_unverified",g.ModelProviderDenied="model_provider_denied",g.ModelProviderUnavailable="model_provider_unavailable",g.RunnerProviderNotReady="runner_provider_not_ready",g.MergeConflict="merge_conflict",g))(uc||{}),dS=(r=>(r.Onboard="onboard",r.Deploy="deploy",r.Recheck="recheck",r))(dS||{}),pS=(n=>(n.Started="started",n.Finished="finished",n))(pS||{}),gS=(r=>(r.Passed="passed",r.Failed="failed",r.Skipped="skipped",r))(gS||{});var hS=(r=>(r.ChooseCredential="choose_credential",r.FreeText="free_text",r.ChooseSource="choose_source",r))(hS||{});var Zh=(r=>(r.Discover="discover",r.Start="start",r.Check="check",r))(Zh||{}),fS=(s=>(s.ValidationPlan="validation_plan",s.TestEnvironment="test_environment",s.TestConditions="test_conditions",s.Tests="tests",s))(fS||{});var Xh=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(Xh||{}),an=c.string().regex(/^[1-9][0-9]{0,18}$/),Qn=c.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),Bo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,rt=c.string().regex(Bo),It=c.string().regex(/^[0-9a-f]{64}$/),gl=c.object({id:rt,revision:an}).strict(),yl={provider:c.literal("github"),providerAccountId:an,providerRepositoryId:an},Cl={provider:c.literal("azure-devops"),providerAccountId:rt,providerRepositoryId:rt},Vn=c.discriminatedUnion("provider",[c.object(yl).strict(),c.object(Cl).strict()]),ef=c.discriminatedUnion("provider",[c.object(yl).passthrough(),c.object(Cl).passthrough()]),dr=o(e=>`${e.provider}:${e.providerRepositoryId}`,"sourceKey"),WR={namespace:c.string().min(1),name:c.string().min(1)},mS=c.discriminatedUnion("provider",[c.object({...yl,...WR}).strict(),c.object({...Cl,...WR}).strict()]),zR=c.object({ref:c.string().min(1),revision:Qn}).strict(),SH=c.object({kind:c.nativeEnum(Kh),number:an.optional(),ref:c.string().min(1),revision:Qn,reason:c.nativeEnum(ml)}).strict(),kH=c.object({repository:mS,revision:Qn,ref:c.string().nullable(),reason:c.nativeEnum(ml),change:c.object({kind:c.nativeEnum(zh),number:an,base:zR.optional()}).strict().nullable(),compareWith:zR.optional(),merge:c.array(SH).min(2).optional()}).strict();function vH(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,r=new Set;for(let[i,a]of t.entries()){if(a.kind==="pull_request"!=(a.number!==void 0))return{path:["merge",i,"number"],message:"a pull request names its number, and a branch none"};if(!YR.includes(a.reason))return{path:["merge",i,"reason"],message:`${a.reason} does not select a merged revision`};if(a.kind==="branch"&&a.reason!=="MANUAL_OVERRIDE")return{path:["merge",i,"reason"],message:"only a person chooses a branch to merge"};if(a.ref===e.ref)return{path:["merge",i,"ref"],message:"the baseline branch is what the source merges onto"};if(a.number!==void 0&&n.has(a.number)||r.has(a.ref))return{path:["merge",i],message:"names a revision the source already merges"};a.number!==void 0&&n.add(a.number),r.add(a.ref)}let s=YR.find(i=>t.some(a=>a.reason===i));return e.reason!==s?{path:["reason"],message:`a source that merges these revisions is ${s}`}:null}o(vH,"mergedSourceIssue");function xH(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,sources:r}=e.baseline;if(t!==null&&n!==void 0)return"a run compares with one baseline";let s=e.trigger.kind==="schedule"&&t!==null||n!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(t===null&&n===void 0)return"a run with no Confirmed Baseline names no baseline sources";let i=new Set(e.sources.map(u=>dr(u.repository))),a=new Set(r.map(u=>dr(u.repository)));return a.size===r.length&&a.size===i.size&&[...a].every(u=>i.has(u))?null:"names every source of the snapshot, once"}o(xH,"baselineSourcesIssue");var ES=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,yS=/^[1-9][0-9]{0,18}$/,KR=new RegExp(`${ES.source}|${yS.source}`),ZR=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,TH=c.union([c.object({source:c.literal("jira"),site:c.string().regex(ZR),key:c.string().regex(ES),updated:c.string().datetime(),contentHash:It}).strict(),c.object({source:c.literal("confluence"),site:c.string().regex(ZR),key:c.string().regex(yS),version:c.number().int().positive(),contentHash:It}).strict(),c.object({source:c.literal("other"),key:c.string().regex(tc),contentHash:It}).strict(),c.object({source:c.literal("other"),key:c.string().regex(mo),contentHash:It,fileName:c.string().min(1).max(255),mediaType:c.nativeEnum(nc)}).strict()]),XR=c.union([c.literal("jira"),c.literal("confluence")]),DH=c.object({schemaVersion:c.literal(1),items:c.array(c.union([c.object({source:XR,site:c.string(),key:c.string().regex(KR),state:c.literal("read"),text:c.string(),version:c.string().min(1),contentMatches:c.boolean()}).strict(),c.object({source:XR,site:c.string(),key:c.string().regex(KR),state:c.literal("not_read"),reason:c.nativeEnum(zs)}).strict(),c.object({source:c.literal("other"),key:c.string().regex(tc),state:c.literal("read"),text:c.string(),version:c.string().min(1),contentMatches:c.boolean()}).strict(),c.object({source:c.literal("other"),key:c.string().regex(tc),state:c.literal("not_read"),reason:c.nativeEnum(zs)}).strict(),c.object({source:c.literal("other"),key:c.string().regex(mo),state:c.literal("read"),version:It,fileName:c.string().min(1).max(255),mediaType:c.nativeEnum(nc)}).strict(),c.object({source:c.literal("other"),key:c.string().regex(mo),state:c.literal("not_read"),reason:c.nativeEnum(zs)}).strict()])),instructions:c.array(c.string()).optional()}).strict(),NH=c.object({schemaVersion:c.literal(1),runId:rt,skyrampOrgId:rt,target:gl,policy:gl.nullable(),trigger:c.object({kind:c.nativeEnum(Wh),requestedAt:c.string().datetime()}).strict(),configuration:c.object({captureId:rt,revision:an.nullable(),hash:It}).strict(),baseline:c.object({confirmedRunId:rt.nullable(),initialBaselineId:rt.optional(),sources:c.array(c.object({repository:Vn,revision:Qn}).strict()).optional()}).strict().optional(),sources:c.array(kH).min(1),execution:c.object({provider:c.nativeEnum(Ks),repository:mS,workflowPath:c.string(),ref:c.string()}).strict(),credentials:c.array(c.object({name:c.string(),purpose:c.nativeEnum(uS),required:c.boolean()}).strict()),requirements:c.array(TH).min(1).optional(),instructions:c.object({contentHash:It}).strict().optional(),deployedRevisions:c.array(c.object({repository:Vn,revision:Qn}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((u,d)=>{let p="fileName"in u?"file":"pasted";u.source==="other"&&u.key!==`${p}-${u.contentHash.slice(0,16)}`&&t.addIssue({code:c.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",d,"key"]});let g=Ph({source:u.source,key:u.key});n.has(g)&&t.addIssue({code:c.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",d,"key"]}),n.add(g)});let r=e.trigger.kind,s=wH.includes(r);s!==(e.policy===null)&&t.addIssue({code:c.ZodIssueCode.custom,path:["policy"],message:s?`a ${r} run has no policy`:"names the policy revision"});let i=xH(e);i&&t.addIssue({code:c.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:i}),bH.includes(r)&&e.sources.forEach((u,d)=>{u.reason!=="BASELINE"&&t.addIssue({code:c.ZodIssueCode.custom,path:["sources",d,"reason"],message:`a ${r} run selects only BASELINE sources`})}),e.deployedRevisions&&r!=="manual"&&t.addIssue({code:c.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(e.sources.map(u=>dr(u.repository))),A=new Set;(e.deployedRevisions??[]).forEach((u,d)=>{let p=dr(u.repository);a.has(p)?A.has(p)&&t.addIssue({code:c.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"repository appears twice"}):t.addIssue({code:c.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"names a repository outside the snapshot"}),A.add(p)}),e.sources.forEach((u,d)=>{u.compareWith&&(u.reason!=="MANUAL_OVERRIDE"||u.change)&&t.addIssue({code:c.ZodIssueCode.custom,path:["sources",d,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"});let p=vH(u);p&&t.addIssue({code:c.ZodIssueCode.custom,path:["sources",d,...p.path],message:p.message})})});var tf=(n=>(n.Person="person",n.Policy="policy",n))(tf||{}),FH=c.object({kind:c.nativeEnum(tf),name:c.string().min(1).max(256)}).strict(),MH=c.object({mcp:c.discriminatedUnion("source",[c.object({source:c.literal("npm"),version:c.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),c.object({source:c.literal("github"),ref:c.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:c.object({region:c.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:c.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),UH=c.object({schemaVersion:c.literal(1),attempt:c.object({id:rt,number:c.number().int().positive(),deadlineAt:c.string().datetime()}).strict(),manifest:NH,manifestHash:It,entitlements:c.array(c.string()).optional(),runToken:c.string().min(1).optional(),requestedBy:FH.nullable().optional(),writeAllowed:c.boolean().optional(),claudeCodeVersion:c.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:c.array(c.object({repository:Vn,revision:Qn}).strict()).optional(),statedRevisions:c.array(c.object({repository:Vn,revision:Qn}).strict()).optional(),runSettings:MH.optional(),credentialRelay:c.boolean().optional()}).strict(),eS={providerRunAttempt:c.number().int().positive(),workflowRef:c.string().min(1)},LH=c.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),_H=c.object({schemaVersion:c.literal(1),runId:rt,execution:c.discriminatedUnion("provider",[c.object({...eS,provider:c.literal("github"),repository:c.object(yl).strict(),providerRunId:an}).strict(),c.object({...eS,provider:c.literal("azure-devops"),repository:c.object(Cl).strict(),providerRunId:LH}).strict()]),requester:c.literal(!0).optional(),writeCheck:c.literal(!0).optional(),claudeCodePin:c.literal(!0).optional(),deployedPins:c.literal(!0).optional(),statedPins:c.literal(!0).optional(),runSettings:c.literal(!0).optional(),credentialRelay:c.literal(!0).optional()}).strict(),tS=c.object({repository:Vn,number:an,commitSha:Qn.optional()}).strict(),$H=c.discriminatedUnion("status",[c.object({status:c.literal("none")}).strict(),c.object({status:c.literal("delivered"),pullRequests:c.array(tS).min(1)}).strict(),c.object({status:c.literal("partial"),pullRequests:c.array(tS).min(1),failures:c.array(c.object({repository:Vn,message:c.string()}).strict()).min(1)}).strict(),c.object({status:c.literal("failed"),message:c.string()}).strict()]),CS=1024*1024,dl=o(e=>c.array(c.object({[e]:c.string()}).strict()).optional(),"texts"),PH=c.object({language:c.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:c.string(),validation:c.object({rationale:c.string(),gaps:c.array(c.string())}).strict().optional(),changes:c.array(c.object({id:c.string(),text:c.string()}).strict()).optional(),issuesFound:dl("description"),newTestsCreated:dl("description"),testResults:dl("details"),caveats:dl("text")}).strict(),OH=c.object({blockedPreflight:c.object({file:c.string().min(1),repository:c.string().min(1).optional(),reason:c.string().min(1).max(300),evidence:c.string().min(1).max(400)}).strict().optional(),sufficiency:c.nativeEnum(qr),rationale:c.string().min(1),gaps:c.array(c.string().min(1)),acceptedEvidence:c.array(c.object({kind:c.nativeEnum(jr),repository:c.string().min(1),revision:Qn,reference:c.string().min(1),summary:c.string().min(1)}).strict()),actionRequired:c.array(c.nativeEnum(Eo))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:c.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),pl=500,IS=2048,BS=1e3,GH=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,nS=o(e=>e.length>0&&e.length<=64&&e===e.trim()&&!GH.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),"isAzureName"),VH=o(e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,r,...s]=e.split("/");return e.length<=201&&s.length===0&&r!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&nS(n)&&nS(r)},"isResultRepository"),HH=c.object({testResults:c.array(c.object({resultId:c.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:c.string().refine(VH,"Invalid"),testType:c.string(),endpoint:c.string(),status:c.enum(["Pass","Fail","Skipped"]),details:c.string(),fileName:c.string().optional(),testId:c.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:c.object({kind:c.nativeEnum(ol),family:c.nativeEnum(al).optional()}).strict().optional(),origin:c.nativeEnum(il).optional()}).strict()),validation:OH,changes:c.array(c.object({id:c.string().min(1).max(512),text:c.string().max(16384),source:c.string().max(IS),testedBy:c.array(c.string().min(1).max(1024)).max(pl),writtenBy:c.array(c.string().min(1).max(1024)).max(pl),maintainedBy:c.array(c.string().min(1).max(1024)).max(pl)}).strict()).max(BS).optional(),traceVersion:c.literal(1),display:PH.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,r={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let i of["issuesFound","newTestsCreated","testResults","caveats"]){let a=n?.[i];a&&a.length!==(Array.isArray(r[i])?r[i].length:0)&&t.addIssue({code:c.ZodIssueCode.custom,path:["display",i],message:`has not one row per ${i} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let s=new Set;e.testResults.forEach((i,a)=>{let A=i.failureCause;A&&i.status==="Pass"&&t.addIssue({code:c.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"a passing result has no failure cause"}),A&&A.kind==="environment"!=(A.family!==void 0)&&t.addIssue({code:c.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"an environment cause names its family, and no other cause does"});let u=["testResults",a,"resultId"],d=i.resultId.slice(`${i.repository}:${i.testType}:`.length);(!i.resultId.startsWith(`${i.repository}:${i.testType}:`)||d===""||d.startsWith("/")||d.startsWith("#"))&&t.addIssue({code:c.ZodIssueCode.custom,path:u,message:"is not repository:testType:path for this result"}),s.has(i.resultId)&&t.addIssue({code:c.ZodIssueCode.custom,path:u,message:"stable identity repeated"}),s.add(i.resultId)})}),rS=o(e=>e.replace(/[%:#]/g,t=>encodeURIComponent(t)),"encodeIdPart");function nf(e,t,n,r){let s=n.replace(/\\/g,"/"),i=s.split("/").filter(u=>u!==""&&u!==".");if(s.startsWith("/")||/^[A-Za-z]:/.test(s)||i.length===0||i.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=i.join("/"),A=`${e}:${t}:${rS(a)}`;return r?`${A}#${rS(r)}`:A}o(nf,"testResultId");var Il=(r=>(r.BranchPushed="branch_pushed",r.PullRequestOpened="pull_request_opened",r.PullRequestEdited="pull_request_edited",r))(Il||{}),QS=50,sS=c.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),wS=c.discriminatedUnion("kind",[c.object({kind:c.literal("branch_pushed"),repository:Vn,branch:sS,commit:Qn}).strict(),c.object({kind:c.enum(["pull_request_opened","pull_request_edited"]),repository:Vn,number:an,branch:sS}).strict()]),bS=c.object({schemaVersion:c.literal(1),run:c.object({runId:rt,attemptNumber:c.number().int().positive(),manifestHash:It}).strict(),target:gl,policy:gl,provenance:c.object({sources:c.array(c.object({repository:Vn,revision:Qn}).strict()),firstQualification:c.literal(!0).optional()}).strict(),delivery:c.object({generatedTests:$H}).strict(),producer:c.object({testbot:c.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:c.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:HH,githubWrites:c.array(wS).max(QS).optional()}).strict(),b8=bS.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:JR}).strict().superRefine(({recipe:e},t)=>{let n=o((i,a)=>t.addIssue({code:c.ZodIssueCode.custom,path:["recipe",...i],message:a}),"issue");e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let r=new Set,s=0;e.files.forEach((i,a)=>{ic(i.path)||n(["files",a,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),r.has(i.path)&&n(["files",a,"path"],"file repeated"),r.add(i.path),HR.test(i.content)&&n(["files",a,"content"],"is not text");let A=Buffer.byteLength(i.content,"utf8");s+=A,A>Vh&&n(["files",a,"content"],`larger than ${Vh} bytes`)}),s>Hh&&n(["files"],`recipe text over ${Hh} bytes in total`)}),R8=c.object({components:c.array(c.object({name:c.string().min(1),repository:c.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),observedRevision:c.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:c.nativeEnum(cl),evidence:c.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var qH=c.object({schemaVersion:c.literal(1),stage:c.nativeEnum(dS),event:c.nativeEnum(pS),status:c.nativeEnum(gS).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Bl=100,jH=5e3,ac=2e3,iS=100,RS=/^[A-Za-z0-9_-]{1,64}$/,JH=20,YH=200,WH=100,zH=100,KH=200,oS="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",ZH=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${oS}/${oS})$`),XH=500,e2=50,t2=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,on=o(e=>c.string().max(e).refine(t=>t.trim().length>0&&!t2.test(t),"blank, or not text"),"setupText"),lr={sequence:c.number().int().min(1).max(jH),at:c.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},n2=c.discriminatedUnion("kind",[c.object({...lr,kind:c.literal("log"),phase:c.nativeEnum(Zh),text:on(ac)}).strict(),c.object({...lr,kind:c.literal("component"),name:on(iS),repository:on(KH).refine(e=>ZH.test(e)||e===Gn,"not owner/name"),file:on(XH).nullable(),status:c.nativeEnum(Xh),version:on(zH).optional()}).strict(),c.object({...lr,kind:c.literal("reply"),to:c.string().uuid(),accepted:c.boolean(),text:on(ac)}).strict(),c.object({...lr,kind:c.literal("question"),id:c.string().regex(RS),type:c.nativeEnum(hS),text:on(ac),component:on(iS).nullable(),choices:c.array(on(YH)).max(JH),placeholder:on(WH).optional()}).strict(),c.object({...lr,kind:c.literal("delivered"),ids:c.array(c.string().uuid()).max(Bl)}).strict(),c.object({...lr,kind:c.literal("credentials"),names:c.array(c.string().regex(sc)).min(1).max(e2)}).strict()]).superRefine((e,t)=>{e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:c.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),r2=c.object({schemaVersion:c.literal(1),events:c.array(n2).max(Bl)}).strict(),s2=c.discriminatedUnion("kind",[c.object({...lr,kind:c.literal("log"),stage:c.nativeEnum(fS),text:on(ac)}).strict(),c.object({...lr,kind:c.literal("reply"),to:c.string().uuid(),accepted:c.boolean(),text:on(ac)}).strict(),c.object({...lr,kind:c.literal("delivered"),ids:c.array(c.string().uuid()).max(Bl)}).strict()]),i2=c.object({schemaVersion:c.literal(1),events:c.array(s2).max(Bl)}).strict(),aS={id:c.string().uuid(),text:c.string(),by:c.string().nullable(),at:c.string(),replied:c.literal(!0).optional()},SS=c.discriminatedUnion("kind",[c.object({...aS,kind:c.literal("instruction"),question:c.null()}),c.object({...aS,kind:c.literal("answer"),question:c.string().regex(RS)})]),kS=c.string().regex(/^[A-Za-z0-9+/]{43}=$/),o2=c.object({id:c.string().uuid(),revision:c.string(),by:c.string().nullable(),at:c.string(),target:c.string(),own:c.object({source:c.enum(["policy","test_environment"]),text:c.string()}).nullable()}),vS=c.string().regex(/^[A-Za-z0-9+/]{43}=$/),a2=c.object({ephemeralPublicKey:vS,iv:c.string().regex(/^[A-Za-z0-9+/]{16}$/),ciphertext:c.string().min(1).max(65536),tag:c.string().regex(/^[A-Za-z0-9+/]{22}==$/)}).strict();var c2=/^[A-Z][A-Z0-9_]{0,99}$/,A2=new Set(["PATH","HOME","SHELL","USER","LOGNAME","PWD","OLDPWD","TMPDIR","TMP","TEMP","IFS","ENV","BASH_ENV","CDPATH","PS4","NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_TLS_REJECT_UNAUTHORIZED","PYTHONPATH","PYTHONHOME","PYTHONSTARTUP","RUBYOPT","RUBYLIB","PERL5OPT","PERL5LIB","JAVA_TOOL_OPTIONS","SSL_CERT_FILE","SSL_CERT_DIR","CURL_CA_BUNDLE","REQUESTS_CA_BUNDLE","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","ALL_PROXY","SSH_AUTH_SOCK","DOCKER_HOST","GIT_SSH","GIT_SSH_COMMAND","GIT_ASKPASS","GIT_EXEC_PATH","GIT_DIR","GIT_WORK_TREE","GIT_PROXY_COMMAND"]),u2=["LD_","DYLD_","GIT_CONFIG","GITHUB_","RUNNER_","ACTIONS_","INPUT_","SKYRAMP_RUNNER_"],l2=o(e=>c2.test(e)&&!A2.has(e)&&!u2.some(t=>e.startsWith(t)),"relayCredentialNameAllowed"),xS=c.string().refine(l2,"not a name a relay may set"),oc={id:rt,credentialName:xS},d2=c.discriminatedUnion("status",[c.object({...oc,status:c.literal("sealed"),sealed:a2}),c.object({...oc,status:c.literal("pending")}),c.object({...oc,status:c.literal("empty")}),c.object({...oc,status:c.literal("failed")}),c.object({...oc,status:c.literal("expired")})]),S8=c.object({schemaVersion:c.literal(1),relayId:rt,attemptId:rt,credentialName:xS,publicKey:vS}).strict(),p2=c.object({schemaVersion:c.literal(1),leftOut:c.array(c.string()),messages:c.array(SS).optional(),stop:c.object({key:kS}).optional(),notes:o2.optional(),relays:c.array(c.unknown()).transform(e=>e.flatMap(t=>{let n=d2.safeParse(t);return n.success?[n.data]:[]})).optional()}),g2=c.object({schemaVersion:c.literal(1),messages:c.array(SS).optional()});var h2=500*1024*1024,TS=c.object({id:an,name:c.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:an,expiresAt:c.string().datetime()}).strict(),f2=c.object({schemaVersion:c.literal(1),artifact:TS,sessionId:rt,contentHash:It,bytes:c.number().int().min(1).max(h2)}).strict(),m2=c.object({schemaVersion:c.literal(1),checkpoint:c.object({artifact:TS,repository:c.object({namespace:c.string().min(1),name:c.string().min(1)}).strict(),sessionId:rt,contentHash:It,key:kS}).strict().nullable()}).strict(),E2=200,Io=100,DS=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(DS||{}),y2=c.object({kind:c.nativeEnum(DS),setup:c.object({runId:rt,endedAt:c.string().nullable(),outcome:c.string().nullable()}).strict(),components:c.array(c.object({name:c.string().min(1),repository:c.string().min(1),status:c.nativeEnum(Xh)}).strict()).max(Io),credentials:c.array(c.string().min(1)).max(Io),answers:c.array(c.object({question:c.string(),answer:c.string().nullable()}).strict()).max(Io),instructions:c.array(c.object({text:c.string(),reply:c.string().nullable()}).strict()).max(Io),log:c.array(c.object({phase:c.nativeEnum(Zh),text:c.string()}).strict()).max(E2),recipe:c.object({files:c.array(c.object({path:c.string().min(1),content:c.string()}).strict()).max(Io),blockers:c.array(c.object({component:c.string(),problem:c.string(),evidence:c.string(),fix:c.string()}).strict()).max(Io)}).strict().optional()}).strict(),C2=c.object({schemaVersion:c.literal(1),context:y2.nullable()}).strict(),I2=c.object({schemaVersion:c.literal(1),configuration:c.object({captureId:rt,revision:an.nullable(),hash:It}).strict(),capture:c.object({schemaVersion:c.literal(1),settings:c.object({target:c.object({environment:c.unknown()}).passthrough(),timeoutMinutes:c.number().int().positive(),answerWaitMinutes:c.number().int().positive().optional(),testEnvironment:c.object({name:c.string().min(1),address:c.string().min(1).optional(),readyWhen:c.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:c.object({}).passthrough(),hash:It}).strict()}).strict(),B2=Co.extend({version:c.number().int().positive(),components:c.array(c.object({name:c.string().min(1),repository:c.string().min(1)}).strict()),contentHash:It.optional(),files:c.array(c.object({path:c.string().refine(e=>ic(e)&&!Jh.includes(e),"not a file of a customer_deployed plan"),content:c.string()}).strict()).optional()}).strict(),Q2=c.object({schemaVersion:c.literal(1),testEnvironment:B2.nullable().optional(),runtimePlan:c.object({version:c.number().int().positive(),contentHash:It,files:c.array(c.object({path:c.string().refine(ic,"not a recipe file path"),content:c.string()}).strict()).min(1),repository:ll.optional(),recipeRepository:ll.optional(),recipe:c.record(c.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),NS=c.object({schemaVersion:c.literal(1),state:c.nativeEnum(lS),ending:c.nativeEnum(Ac).nullable(),cause:c.nativeEnum(uc).nullable(),deadlineAt:c.string().datetime()}).strict();function FS(e,t){return e.state==="ended"?e.ending==="cancelled"?"cancelled":e.cause==="runner_lost"?"expired":"ended":t.getTime()>=Date.parse(e.deadlineAt)?"expired":null}o(FS,"attemptClosure");var MS=50,k8=c.object({repository:Vn,revisions:c.array(c.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:c.array(c.string().min(1)).min(1).max(MS)}).strict();function Yh(e){if(typeof e=="number"&&!Number.isFinite(e))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(e))return`[${e.map(Yh).join(",")}]`;if(e!==null&&typeof e=="object"){let n=e;return`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${Yh(n[r])}`).join(",")}}`}let t=JSON.stringify(e);if(t===void 0)throw new TypeError("Canonical JSON requires JSON values");return t}o(Yh,"canonicalJson");function US(e){return(0,AS.createHash)("sha256").update(Yh(e),"utf8").digest("hex")}o(US,"manifestHash");var hl=o(e=>({provider:e.provider,providerAccountId:e.providerAccountId,providerRepositoryId:e.providerRepositoryId}),"toSourceRef");function rf(e,t,{statedPins:n=!0}={}){return _H.parse({schemaVersion:1,runId:e,execution:t.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{},...t.runSettingsFromApp?{runSettings:!0}:{},credentialRelay:!0})}o(rf,"handshakeRequest");function LS(e){let t=UH.parse(e);if(US(t.manifest)!==t.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return t}o(LS,"parseHandshakeResponse");function w2(e){let t=o(n=>n.map(r=>({repository:hl(r.repository),number:r.number,...r.commitSha===void 0?{}:{commitSha:r.commitSha}})),"pullRequests");return e.status==="delivered"?{status:e.status,pullRequests:t(e.pullRequests)}:e.status==="partial"?{status:e.status,pullRequests:t(e.pullRequests),failures:e.failures.map(n=>({repository:hl(n.repository),message:n.message}))}:e}o(w2,"toDelivery");function b2(e){return e.issues.map(t=>`${t.path.map((r,s)=>typeof r=="number"?`[${r}]`:s===0?r:`.${r}`).join("")}: ${t.message}`).join("; ")}o(b2,"describeIssues");function _S(e){let{manifest:t}=e;if(RH.includes(t.trigger.kind))throw new Error(`The report upload is invalid: a ${t.trigger.kind} run uploads its SUT recipe, never a report`);if(t.trigger.kind==="revision_read")throw new Error("The report upload is invalid: a revision_read run uploads what each component runs, never a report");if(e.firstQualification&&!t.baseline?.sources)throw new Error("The report upload is invalid: only a run whose manifest names baseline sources can be a first qualification");let n=bS.safeParse({schemaVersion:1,run:{runId:t.runId,attemptNumber:e.attemptNumber,manifestHash:US(t)},target:{id:t.target.id,revision:t.target.revision},policy:t.policy&&{id:t.policy.id,revision:t.policy.revision},provenance:{sources:e.checkedOut.map(r=>({repository:hl(r.repository),revision:r.revision})),...e.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:w2(e.generatedTests)},producer:e.producer,report:e.report,...e.githubWrites?.length?{githubWrites:e.githubWrites.map(r=>({...r,repository:hl(r.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${b2(n.error)}`);return R2(n.data,t,e.checkedOut),n.data}o(_S,"buildReportUpload");function R2(e,t,n){let r=o(i=>n.find(a=>dr(a.repository)===dr(i.repository))?.revision??i.revision,"revisionOf"),s=new Map(t.sources.map(i=>[`${i.repository.namespace}/${i.repository.name}`.toLowerCase(),r(i)]));e.report.validation.acceptedEvidence.forEach((i,a)=>{let A=`report.validation.acceptedEvidence[${a}]`,u=s.get(i.repository.toLowerCase());if(!u)throw new Error(`${A}.repository: ${i.repository} is outside the run's snapshot`);if(i.revision!==u)throw new Error(`${A}.revision: evidence is not from the checked-out revision ${u}`)})}o(R2,"assertEvidenceFromSnapshot");function $S(e){return e.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:e.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:e.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:e.mergeConflict&&cS(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict}:{schemaVersion:1,reason:"no_report",cause:cS({...e,mergeConflict:void 0})}}o($S,"attemptEndFor");function cS(e){return e.runnerProviderNotReady?"runner_provider_not_ready":e.credentialMissing?"credential_missing":e.mergeConflict?"merge_conflict":e.checkoutFailed?"checkout_failed":e.environmentUnverified?"environment_unverified":e.setupFailed?"setup_failed":e.timedOut?"timed_out":e.modelProviderDenied?"model_provider_denied":e.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}o(cS,"noReportCause");var Jr=fe(require("path"));var D8={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var sf=o(e=>new Map((e??[]).flatMap(t=>t.file?[[rc(t.key),t.file.name]]:[])),"itemNames"),S2=10*1024*1024,k2=o(e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","needsExtraction"),OS=o((e,t)=>Jr.join(Jr.dirname(e),`${Jr.basename(e,Jr.extname(e))}${t}`),"besideFile"),v2=o(e=>OS(e,".extracted.txt"),"extractedTextPath");var x2=o(e=>OS(e,".quotes.txt"),"confirmedQuotesPath");function GS(e){return k2(e.file)?v2(e.path):e.file?.mediaType==="application/pdf"?x2(e.path):e.path}o(GS,"itemTextPath");var lc=o(e=>e.slice(0,12),"shortCommit");var T2=["generate-unit","native-run"],_8=["preflight","plan","write",...T2,"report","deliver"];var Ql=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(Ql||{});var dc=fe(require("fs")),pc=fe(require("path"));var D2=8;function ht(e,t,n={}){let r=t.slice(0,D2),s=t.length-r.length;return{name:e,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}o(ht,"fail");function Zs(e){if(dc.existsSync(e))try{return JSON.parse(dc.readFileSync(e,"utf-8"))}catch{return}}o(Zs,"readJsonFile");function $e(e,t){return Zs(pc.join(e.outputsDir,t))}o($e,"readArtifact");function cn(e,t){return{name:e,verify(n,r){let{errors:s}=t(n,r);return s.length===0?{name:this.name,passed:!0}:ht(this.name,s,{fatal:!0})}}}o(cn,"schemaGate");function gc(e){return e.replace(/\s+/g," ").trim()}o(gc,"normalizeCode");var wl=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var VS=require("child_process");var hc=fe(require("path"));var Yr="Skyramp Testbot",Xs="test-bot@skyramp.dev";var N2=o((e,t)=>(0,VS.execFileSync)("git",t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim(),"git");function HS(e){let t="";try{t=N2(e,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(t);return n&&!t.startsWith("/")&&!t.startsWith(".")?`${n[1]}/${n[2]}`:`local/${hc.basename(hc.resolve(e)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}o(HS,"repositorySlug");var z8=new Set(Object.values(jr));var K8=c.object({checks:c.array(c.object({repository:c.string().optional(),name:c.string().min(1),headSha:c.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:c.string().default("completed"),conclusion:c.string().nullable().optional(),url:c.string().optional(),summary:c.string().optional()}))});var of=new Map;function F2(e){return e.repositorySlug?e.repositorySlug:(of.has(e.repositoryPath)||of.set(e.repositoryPath,HS(e.repositoryPath)),of.get(e.repositoryPath))}o(F2,"workingSlug");function wn(e){return[{slug:F2(e),path:e.repositoryPath,writable:!0,working:!0},...(e.relatedRepos??[]).map(t=>({slug:t.slug,path:t.path,writable:t.writable===!0,working:!1}))]}o(wn,"runSources");var af=o((e,t)=>e.toLowerCase()===t.toLowerCase(),"sameSlug");function cf(e,t){return t?.trim()?e.find(n=>af(n.slug,t.trim())):e[0]}o(cf,"findSource");function Qo(e,t){return cf(wn(e),t)}o(Qo,"resolveSource");var M2=o((e,t)=>`${t} is not a repository of this run (${wn(e).map(n=>n.slug).join(", ")})`,"notARepository");function fc(e,t){let n=Qo(e,t);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${wn(e).filter(r=>r.writable).map(r=>r.slug).join(", ")}`}:{error:M2(e,t)}}o(fc,"writableSource");var mc=(n=>(n.Full="full",n.Static="static",n))(mc||{}),Wr=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(Wr||{}),Ec=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(Ec||{}),zr=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(zr||{}),bl=(d=>(d.Equals="equals",d.NotEquals="not_equals",d.GreaterThan="greater_than",d.LessThan="less_than",d.Contains="contains",d.NotContains="not_contains",d.Matches="matches",d.Absent="absent",d.Present="present",d))(bl||{});var jt=c.string().trim().min(1),L2=c.object({subject:jt.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:c.nativeEnum(bl),value:c.union([c.string(),c.number(),c.boolean(),c.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),_2=c.object({test:jt.describe("existing test path, relative to its repository"),repository:jt.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:c.nativeEnum(zr),evidence:jt.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:c.array(c.string()).optional().describe("analyze behavior ids this maintenance covers")});var $2=c.object({surface:jt.describe("a surface from the list, copied verbatim"),axis:c.nativeEnum(Ec)}),P2=c.object({id:jt.describe("short-slug, unique across generate[]"),type:c.nativeEnum(Wr),target:jt.describe('"METHOD /path", or a business-flow name'),from_finding:c.string().optional().describe("analyze finding id this case catches"),from_behavior:c.string().optional().describe("analyze behavior id this case pins"),derived_from:$2.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:jt.describe("why this test matters"),expected_observable:jt.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:L2.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:jt.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:c.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),O2=c.object({covered:c.array(c.string()).optional(),abstain:c.string().optional()}).superRefine((e,t)=>{let n=Array.isArray(e.covered),r=typeof e.abstain=="string";if(n===r)return void t.addIssue({code:c.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&e.covered.length===0&&t.addIssue({code:c.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!e.abstain.trim()&&t.addIssue({code:c.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),G2=c.object({surface:jt.describe("a surface from the list, copied verbatim"),axes:c.object(Object.fromEntries(Object.values(Ec).map(e=>[e,O2])))}),qS=c.object({schemaVersion:c.literal(1),mode:c.nativeEnum(mc),maintenance:c.array(_2),generate:c.array(P2),surfaces:c.array(G2).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:c.object({total:c.number().describe("case count"),rationale:jt}),summary:jt.describe("one paragraph")});var Kr=["-c","core.fsmonitor=false"],V2=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),Af=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function Jt(e=process.env,t,n="repo-command"){let r={};for(let[s,i]of Object.entries(e))n==="repo-command"&&Af.has(s)||(r[s]=i);Object.assign(r,t??{});for(let s of Object.keys(r))(V2.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}o(Jt,"untrustedChildEnv");var H2=".skyramp/sut/deployed-revisions.sh",uf=(n=>(n.Running="running",n.Requested="requested",n))(uf||{});var g3=new Set(Object.values(uf));var h3=`Fix ${H2} so it prints the full commit each component runs, then set it up again.`;var yc="shared-environment";var v3=64*1024;var x3=new Set(["version_endpoint","api"]);function lf(e){return(e?.components??[]).filter(t=>!!t.repository&&!!t.expectedRevision)}o(lf,"verifiableComponents");var jS=o((e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase(),"sameRepository"),j2=o((e,t)=>e.name===t.name&&jS(e.repository,t.repository),"sameComponent");function JS(e){return lf(e).length>0||(e?.dependencies.length??0)>0}o(JS,"hasSharedSystem");function YS(e){let t=e.inputs?.sharedEnvironment;if(!JS(t))return;let n=$e(e,`${yc}.json`);if(n)return{components:zS(t,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:lf(t).map(s=>WS(s,r)),dependencies:t.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}o(YS,"sharedSystem");var WS=o((e,t)=>({name:e.name,repository:e.repository,url:e.url,expectedRevision:e.expectedRevision,observedRevision:null,status:"unverifiable",source:e.revisionUrl||e.revisionScript?"probe":"agent",evidence:t}),"unrecordedRow");function zS(e,t){let n=new Set(t.map(s=>s.name.toLowerCase())),r=lf(e).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...t,...r.map(s=>WS(s,"Not checked: the run recorded no read of it."))]}o(zS,"withUnrecordedTouched");function df(e){return(YS(e)?.components??[]).filter(t=>t.status!=="verified")}o(df,"unverifiedComponents");function pf(e,t,n){if(!e.appRunning||n===!1)return[];let r=(e.sharedEnvironment?.components??[]).filter(s=>s.touched);return zS(e.sharedEnvironment,t?.components??[]).filter(s=>s.status!=="verified"&&r.some(i=>j2(i,s)))}o(pf,"blockingComponents");function KS(e){let t=o(n=>{let r=`${n.name} (${n.repository}) must run ${lc(n.expectedRevision)}`;if(n.observedRevision&&n.expectedRevision&&(n.observedRevision.startsWith(n.expectedRevision)||n.expectedRevision.startsWith(n.observedRevision)))return`${r}: ${n.evidence}`;let s=n.observedRevision?`runs ${lc(n.observedRevision)}`:"no revision could be read";return`${r}, but ${s}: ${n.evidence}`},"text");return e.length?`the Test Environment does not verifiably run the change: ${e.map(t).join("; ")}`:void 0}o(KS,"blockReason");function gf(e){return(e?.components??[]).filter(t=>!!t.repository&&!t.expectedRevision)}o(gf,"unfrozenComponents");var xc=fe(require("path"));function ct(e,t=[]){let n=e.trim();if(!n)return{error:"session produced no output"};let r=o(u=>{try{let d=JSON.parse(u);return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:void 0}catch{return}},"tryParse"),s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(u){i=u instanceof Error?u.message:String(u)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let u=a.length-1;u>=0;u--){let d=r(a[u][1].trim());if(d!==void 0)return{value:d}}let A;for(let u=n.indexOf("{");u!==-1;u=n.indexOf("{",u+1)){let d=0,p=!1,g=!1;for(let f=u;f<n.length;f++){let m=n[f];if(g){g=!1;continue}if(m==="\\"){g=p;continue}if(m==='"'){p=!p;continue}if(!p){if(m==="{")d++;else if(m==="}"&&(d--,d===0)){let E=r(n.slice(u,f+1));E!==void 0&&Object.keys(E).length>0&&(A=E,u=f);break}}}}return i&&(A===void 0||Object.keys(A).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:A!==void 0?{value:A}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${J2(ir(n,t))}"`}}o(ct,"extractJsonObject");var ZS=240;function J2(e){let t=e.replace(/\s+/g," ").trim();return t.length<=ZS?t:`\u2026${t.slice(-ZS)}`}o(J2,"snippetOf");function Y2(e){return e.issues.map(t=>{let n=t.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(t.message))return`${r} ${t.message}`;switch(t.code){case"invalid_type":return n?t.expected==="object"?`${r} must be an object`:t.received==="undefined"?`${r} is required`:`${r} must be ${t.expected}, got ${t.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(t.received),i=t.options.find(A=>typeof A=="string"&&typeof t.received=="string"&&t.received.startsWith(A)),a=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${t.options.join(", ")}${a}`}case"invalid_literal":return`${r} must be ${JSON.stringify(t.expected)}`;case"too_small":return t.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${t.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${t.keys.join(", ")}`;default:return`${r}: ${t.message}`}})}o(Y2,"issuesToMessages");function Yt(e,t){let n=e.safeParse(t);if(n.success)return{value:n.data,errors:[]};let r=o((i,a)=>a.reduce((A,u)=>A&&typeof A=="object"?A[u]:void 0,i),"at"),s=n.error.issues.filter(i=>i.path.length&&r(t,i.path)===null);if(s.length===n.error.issues.length)try{let i=e.safeParse(s.reduce((a,{path:A})=>XS(a,A),t));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:Y2(n.error)}}o(Yt,"validateWith");function XS(e,t){if(!t.length||!e||typeof e!="object")return e;let[n,...r]=t,s=Array.isArray(e)?e.slice():{...e};return r.length?s[n]=XS(s[n],r):delete s[n],s}o(XS,"withoutAt");function hf(e){let t=e.split(/[\\/]/)[0];return t===".skyramp"||t===".testbot"}o(hf,"inUnshippedFolder");var pr=fe(require("path"));var tk=require("child_process");var ek=[".skyramp/sut",".skyramp/workspace.yml"];var W2=256*1024*1024,z2=3e4;function nk(e,t,n=z2){let r=(0,tk.spawnSync)("git",[...Kr,...t],{env:Jt(),cwd:e,encoding:"utf-8",timeout:n,maxBuffer:W2});return r.status===0?r.stdout.trimEnd():void 0}o(nk,"git");var K3=["--",":/",...ek.map(e=>`:(exclude)${e}`)],rk="--literal-pathspecs";function sk(e,t){return!!nk(e,[rk,"status","--porcelain","--",t])}o(sk,"pathChanged");function ff(e,t){return/ blob /.test(nk(e,[rk,"ls-tree","HEAD","--",t])??"")}o(ff,"fileAtHead");var Qc=fe(require("fs")),Ue=fe(require("path"));function K2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(K2,"getDefaultExportFromCjs");var ft={},Rl={},Zr={},ik;function Cc(){if(ik)return Zr;ik=1;function e(a){return typeof a>"u"||a===null}o(e,"isNothing");function t(a){return typeof a=="object"&&a!==null}o(t,"isObject");function n(a){return Array.isArray(a)?a:e(a)?[]:[a]}o(n,"toArray");function r(a,A){if(A){let u=Object.keys(A);for(let d=0,p=u.length;d<p;d+=1){let g=u[d];a[g]=A[g]}}return a}o(r,"extend");function s(a,A){let u="";for(let d=0;d<A;d+=1)u+=a;return u}o(s,"repeat");function i(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return o(i,"isNegativeZero"),Zr.isNothing=e,Zr.isObject=t,Zr.toArray=n,Zr.repeat=s,Zr.isNegativeZero=i,Zr.extend=r,Zr}o(Cc,"requireCommon");var mf,ok;function Ic(){if(ok)return mf;ok=1;function e(n,r){let s="",i=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(s+='in "'+n.mark.name+'" '),s+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!r&&n.mark.snippet&&(s+=`
|
|
56
|
+
`).map(a=>a.trim()).filter(Boolean),r=n.filter(a=>!t.test(a)),s=r.length?r:n;return[...s].reverse().find(a=>/(error|warning|problem|✖|✗|✘|fail|not listed|cannot|denied)/i.test(a))??s[s.length-1]??"(no output)"}o(sV,"hookSummary");function TR(e){if(!/\bhook\b|husky|pre-commit|lint-staged/i.test(e))return;let t=sV(e),n=ee().staged.commitHook(/husky\s*[->]\s*([\w-]+)\s+(?:script|hook)\b/i.exec(Xu(e))?.[1]);return/\(code 127\)|exit code 127/i.test(e)||/command not found|: not found$/i.test(t)?ee().staged.commitHookCouldNotRun(n,t):ee().staged.commitRefusedByHook(n,t)}o(TR,"hookRefusal");var c={};Nm(c,{BRAND:()=>xV,DIRTY:()=>Fs,EMPTY_PATH:()=>cV,INVALID:()=>ne,NEVER:()=>gH,OK:()=>gt,ParseStatus:()=>ot,Schema:()=>pe,ZodAny:()=>Vr,ZodArray:()=>Ar,ZodBigInt:()=>Us,ZodBoolean:()=>Ls,ZodBranded:()=>Xa,ZodCatch:()=>Ys,ZodDate:()=>_s,ZodDefault:()=>Js,ZodDiscriminatedUnion:()=>nl,ZodEffects:()=>sn,ZodEnum:()=>qs,ZodError:()=>xt,ZodFirstPartyTypeKind:()=>oe,ZodFunction:()=>sl,ZodIntersection:()=>Gs,ZodIssueCode:()=>U,ZodLazy:()=>Vs,ZodLiteral:()=>Hs,ZodMap:()=>go,ZodNaN:()=>fo,ZodNativeEnum:()=>js,ZodNever:()=>In,ZodNull:()=>Ps,ZodNullable:()=>On,ZodNumber:()=>Ms,ZodObject:()=>Tt,ZodOptional:()=>nn,ZodParsedType:()=>q,ZodPipeline:()=>ec,ZodPromise:()=>Hr,ZodReadonly:()=>Ws,ZodRecord:()=>rl,ZodSchema:()=>pe,ZodSet:()=>ho,ZodString:()=>Gr,ZodSymbol:()=>lo,ZodTransformer:()=>sn,ZodTuple:()=>Pn,ZodType:()=>pe,ZodUndefined:()=>$s,ZodUnion:()=>Os,ZodUnknown:()=>cr,ZodVoid:()=>po,addIssueToContext:()=>V,any:()=>$V,array:()=>VV,bigint:()=>FV,boolean:()=>GR,coerce:()=>pH,custom:()=>$R,date:()=>MV,datetimeRegex:()=>LR,defaultErrorMap:()=>or,discriminatedUnion:()=>JV,effect:()=>iH,enum:()=>nH,function:()=>XV,getErrorMap:()=>co,getParsedType:()=>$n,instanceof:()=>DV,intersection:()=>YV,isAborted:()=>el,isAsync:()=>Ao,isDirty:()=>tl,isValid:()=>Or,late:()=>TV,lazy:()=>eH,literal:()=>tH,makeIssue:()=>Za,map:()=>KV,nan:()=>NV,nativeEnum:()=>rH,never:()=>OV,null:()=>_V,nullable:()=>aH,number:()=>OR,object:()=>HV,objectUtil:()=>Lh,oboolean:()=>dH,onumber:()=>lH,optional:()=>oH,ostring:()=>uH,pipeline:()=>AH,preprocess:()=>cH,promise:()=>sH,quotelessJson:()=>iV,record:()=>zV,set:()=>ZV,setErrorMap:()=>aV,strictObject:()=>qV,string:()=>PR,symbol:()=>UV,transformer:()=>iH,tuple:()=>WV,undefined:()=>LV,union:()=>jV,unknown:()=>PV,util:()=>Ee,void:()=>GV});var Ee;(function(e){e.assertEqual=s=>{};function t(s){}o(t,"assertIs"),e.assertIs=t;function n(s){throw new Error}o(n,"assertNever"),e.assertNever=n,e.arrayToEnum=s=>{let i={};for(let a of s)i[a]=a;return i},e.getValidEnumValues=s=>{let i=e.objectKeys(s).filter(A=>typeof s[s[A]]!="number"),a={};for(let A of i)a[A]=s[A];return e.objectValues(a)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},e.find=(s,i)=>{for(let a of s)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}o(r,"joinValues"),e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Ee||(Ee={}));var Lh;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Lh||(Lh={}));var q=Ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$n=o(e=>{switch(typeof e){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(e)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(e)?q.array:e===null?q.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?q.promise:typeof Map<"u"&&e instanceof Map?q.map:typeof Set<"u"&&e instanceof Set?q.set:typeof Date<"u"&&e instanceof Date?q.date:q.object;default:return q.unknown}},"getParsedType");var U=Ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),iV=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),xt=class e extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(i){return i.message},r={_errors:[]},s=o(i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let A=r,u=0;for(;u<a.path.length;){let d=a.path[u],p=u===a.path.length-1;if(d==="_errors"){p&&A._errors.push(n(a)),u++;continue}Object.prototype.hasOwnProperty.call(A,d)||(d==="__proto__"?Object.defineProperty(A,d,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):A[d]={_errors:[]}),A=A[d],p&&A._errors.push(n(a)),u++}}},"processError");return s(this),r}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};xt.create=e=>new xt(e);var oV=o((e,t)=>{let n;switch(e.code){case U.invalid_type:e.received===q.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ee.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ee.joinValues(e.keys,", ")}`;break;case U.invalid_union:n="Invalid input";break;case U.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ee.joinValues(e.options)}`;break;case U.invalid_enum_value:n=`Invalid enum value. Expected ${Ee.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:n="Invalid function arguments";break;case U.invalid_return_type:n="Invalid function return type";break;case U.invalid_date:n="Invalid date";break;case U.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ee.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case U.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case U.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case U.custom:n="Invalid input";break;case U.invalid_intersection_types:n="Intersection results could not be merged";break;case U.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ee.assertNever(e)}return{message:n}},"errorMap"),or=oV;var DR=or;function aV(e){DR=e}o(aV,"setErrorMap");function co(){return DR}o(co,"getErrorMap");var Za=o(e=>{let{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let A="",u=r.filter(d=>!!d).slice().reverse();for(let d of u)A=d(a,{data:t,defaultError:A}).message;return{...s,path:i,message:A}},"makeIssue"),cV=[];function V(e,t){let n=co(),r=Za({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===or?void 0:or].filter(s=>!!s)});e.common.issues.push(r)}o(V,"addIssueToContext");var ot=class e{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let r=[];for(let s of n){if(s.status==="aborted")return ne;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){let r=[];for(let s of n){let i=await s.key,a=await s.value;r.push({key:i,value:a})}return e.mergeObjectSync(t,r)}static mergeObjectSync(t,n){let r={};for(let s of n){let{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return ne;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:t.value,value:r}}},ne=Object.freeze({status:"aborted"}),Fs=o(e=>({status:"dirty",value:e}),"DIRTY"),gt=o(e=>({status:"valid",value:e}),"OK"),el=o(e=>e.status==="aborted","isAborted"),tl=o(e=>e.status==="dirty","isDirty"),Or=o(e=>e.status==="valid","isValid"),Ao=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");var J;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(J||(J={}));var rn=class{static{o(this,"ParseInputLazyPath")}constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},NR=o((e,t)=>{if(Or(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new xt(e.common.issues);return this._error=n,this._error}}},"handleResult");function ue(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:o((a,A)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??A.defaultError}:typeof A.data>"u"?{message:u??r??A.defaultError}:a.code!=="invalid_type"?{message:A.defaultError}:{message:u??n??A.defaultError}},"customMap"),description:s}}o(ue,"processCreateParams");var pe=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(t){return $n(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:$n(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ot,ctx:{common:t.parent.common,data:t.data,parsedType:$n(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(Ao(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$n(t)},s=this._parseSync({data:t,path:r.path,parent:r});return NR(r,s)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$n(t)};if(!this["~standard"].async)try{let r=this._parseSync({data:t,path:[],parent:n});return Or(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Or(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){let r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$n(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(Ao(s)?s:Promise.resolve(s));return NR(r,i)}refine(t,n){let r=o(s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n,"getIssueProperties");return this._refinement((s,i)=>{let a=t(s),A=o(()=>i.addIssue({code:U.custom,...r(s)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(A(),!1)):a?!0:(A(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new sn({schema:this,typeName:oe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(n=>this["~validate"](n),"validate")}}optional(){return nn.create(this,this._def)}nullable(){return On.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ar.create(this)}promise(){return Hr.create(this,this._def)}or(t){return Os.create([this,t],this._def)}and(t){return Gs.create(this,t,this._def)}transform(t){return new sn({...ue(this._def),schema:this,typeName:oe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Js({...ue(this._def),innerType:this,defaultValue:n,typeName:oe.ZodDefault})}brand(){return new Xa({typeName:oe.ZodBranded,type:this,...ue(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Ys({...ue(this._def),innerType:this,catchValue:n,typeName:oe.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ec.create(this,t)}readonly(){return Ws.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},AV=/^c[^\s-]{8,}$/i,uV=/^[0-9a-z]+$/,lV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dV=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,pV=/^[a-z0-9_-]{21}$/i,gV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hV=/^[-+]?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)?)??$/,fV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mV="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",_h,EV=/^(?:(?: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])$/,yV=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,CV=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,IV=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,QV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,MR="((\\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])))",wV=new RegExp(`^${MR}$`);function UR(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}o(UR,"timeRegexSource");function bV(e){return new RegExp(`^${UR(e)}$`)}o(bV,"timeRegex");function LR(e){let t=`${MR}T${UR(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}o(LR,"datetimeRegex");function RV(e,t){return!!((t==="v4"||!t)&&EV.test(e)||(t==="v6"||!t)&&CV.test(e))}o(RV,"isValidIP");function SV(e,t){if(!gV.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}o(SV,"isValidJWT");function kV(e,t){return!!((t==="v4"||!t)&&yV.test(e)||(t==="v6"||!t)&&IV.test(e))}o(kV,"isValidCidr");var Gr=class e extends pe{static{o(this,"ZodString")}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==q.string){let i=this._getOrReturnCtx(t);return V(i,{code:U.invalid_type,expected:q.string,received:i.parsedType}),ne}let r=new ot,s;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,A=t.data.length<i.value;(a||A)&&(s=this._getOrReturnCtx(t,s),a?V(s,{code:U.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):A&&V(s,{code:U.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")fV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"email",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")_h||(_h=new RegExp(mV,"u")),_h.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"emoji",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")dV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"uuid",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")pV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"nanoid",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")AV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cuid",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")uV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cuid2",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")lV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"ulid",code:U.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),V(s,{validation:"url",code:U.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"regex",code:U.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?LR(i).test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?wV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?bV(i).test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{code:U.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?hV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"duration",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?RV(t.data,i.version)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"ip",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?SV(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"jwt",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?kV(t.data,i.version)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"cidr",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?BV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"base64",code:U.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?QV.test(t.data)||(s=this._getOrReturnCtx(t,s),V(s,{validation:"base64url",code:U.invalid_string,message:i.message}),r.dirty()):Ee.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:U.invalid_string,...J.errToObj(r)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...J.errToObj(t)})}url(t){return this._addCheck({kind:"url",...J.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...J.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...J.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...J.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...J.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...J.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...J.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...J.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...J.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...J.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...J.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...J.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...J.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...J.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...J.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...J.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...J.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...J.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...J.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...J.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...J.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...J.errToObj(n)})}nonempty(t){return this.min(1,J.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Gr.create=e=>new Gr({checks:[],typeName:oe.ZodString,coerce:e?.coerce??!1,...ue(e)});function vV(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}o(vV,"floatSafeRemainder");var Ms=class e extends pe{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==q.number){let i=this._getOrReturnCtx(t);return V(i,{code:U.invalid_type,expected:q.number,received:i.parsedType}),ne}let r,s=new ot;for(let i of this._def.checks)i.kind==="int"?Ee.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),V(r,{code:U.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?vV(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),V(r,{code:U.not_finite,message:i.message}),s.dirty()):Ee.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,J.toString(n))}gt(t,n){return this.setLimit("min",t,!1,J.toString(n))}lte(t,n){return this.setLimit("max",t,!0,J.toString(n))}lt(t,n){return this.setLimit("max",t,!1,J.toString(n))}setLimit(t,n,r,s){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:J.toString(s)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:J.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:J.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ee.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}};Ms.create=e=>new Ms({checks:[],typeName:oe.ZodNumber,coerce:e?.coerce||!1,...ue(e)});var Us=class e extends pe{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==q.bigint)return this._getInvalidInput(t);let r,s=new ot;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),V(r,{code:U.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Ee.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return V(n,{code:U.invalid_type,expected:q.bigint,received:n.parsedType}),ne}gte(t,n){return this.setLimit("min",t,!0,J.toString(n))}gt(t,n){return this.setLimit("min",t,!1,J.toString(n))}lte(t,n){return this.setLimit("max",t,!0,J.toString(n))}lt(t,n){return this.setLimit("max",t,!1,J.toString(n))}setLimit(t,n,r,s){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:J.toString(s)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:J.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Us.create=e=>new Us({checks:[],typeName:oe.ZodBigInt,coerce:e?.coerce??!1,...ue(e)});var Ls=class extends pe{static{o(this,"ZodBoolean")}_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==q.boolean){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.boolean,received:r.parsedType}),ne}return gt(t.data)}};Ls.create=e=>new Ls({typeName:oe.ZodBoolean,coerce:e?.coerce||!1,...ue(e)});var _s=class e extends pe{static{o(this,"ZodDate")}_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==q.date){let i=this._getOrReturnCtx(t);return V(i,{code:U.invalid_type,expected:q.date,received:i.parsedType}),ne}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return V(i,{code:U.invalid_date}),ne}let r=new ot,s;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:U.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),V(s,{code:U.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Ee.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:J.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:J.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};_s.create=e=>new _s({checks:[],coerce:e?.coerce||!1,typeName:oe.ZodDate,...ue(e)});var lo=class extends pe{static{o(this,"ZodSymbol")}_parse(t){if(this._getType(t)!==q.symbol){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.symbol,received:r.parsedType}),ne}return gt(t.data)}};lo.create=e=>new lo({typeName:oe.ZodSymbol,...ue(e)});var $s=class extends pe{static{o(this,"ZodUndefined")}_parse(t){if(this._getType(t)!==q.undefined){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.undefined,received:r.parsedType}),ne}return gt(t.data)}};$s.create=e=>new $s({typeName:oe.ZodUndefined,...ue(e)});var Ps=class extends pe{static{o(this,"ZodNull")}_parse(t){if(this._getType(t)!==q.null){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.null,received:r.parsedType}),ne}return gt(t.data)}};Ps.create=e=>new Ps({typeName:oe.ZodNull,...ue(e)});var Vr=class extends pe{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(t){return gt(t.data)}};Vr.create=e=>new Vr({typeName:oe.ZodAny,...ue(e)});var cr=class extends pe{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(t){return gt(t.data)}};cr.create=e=>new cr({typeName:oe.ZodUnknown,...ue(e)});var In=class extends pe{static{o(this,"ZodNever")}_parse(t){let n=this._getOrReturnCtx(t);return V(n,{code:U.invalid_type,expected:q.never,received:n.parsedType}),ne}};In.create=e=>new In({typeName:oe.ZodNever,...ue(e)});var po=class extends pe{static{o(this,"ZodVoid")}_parse(t){if(this._getType(t)!==q.undefined){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.void,received:r.parsedType}),ne}return gt(t.data)}};po.create=e=>new po({typeName:oe.ZodVoid,...ue(e)});var Ar=class e extends pe{static{o(this,"ZodArray")}_parse(t){let{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==q.array)return V(n,{code:U.invalid_type,expected:q.array,received:n.parsedType}),ne;if(s.exactLength!==null){let a=n.data.length>s.exactLength.value,A=n.data.length<s.exactLength.value;(a||A)&&(V(n,{code:a?U.too_big:U.too_small,minimum:A?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(V(n,{code:U.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(V(n,{code:U.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,A)=>s.type._parseAsync(new rn(n,a,n.path,A)))).then(a=>ot.mergeArray(r,a));let i=[...n.data].map((a,A)=>s.type._parseSync(new rn(n,a,n.path,A)));return ot.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:J.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:J.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:J.toString(n)}})}nonempty(t){return this.min(1,t)}};Ar.create=(e,t)=>new Ar({type:e,minLength:null,maxLength:null,exactLength:null,typeName:oe.ZodArray,...ue(t)});function uo(e){if(e instanceof Tt){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=nn.create(uo(r))}return new Tt({...e._def,shape:o(()=>t,"shape")})}else return e instanceof Ar?new Ar({...e._def,type:uo(e.element)}):e instanceof nn?nn.create(uo(e.unwrap())):e instanceof On?On.create(uo(e.unwrap())):e instanceof Pn?Pn.create(e.items.map(t=>uo(t))):e}o(uo,"deepPartialify");var Tt=class e extends pe{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Ee.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==q.object){let d=this._getOrReturnCtx(t);return V(d,{code:U.invalid_type,expected:q.object,received:d.parsedType}),ne}let{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),A=[];if(!(this._def.catchall instanceof In&&this._def.unknownKeys==="strip"))for(let d in s.data)a.includes(d)||A.push(d);let u=[];for(let d of a){let p=i[d],g=s.data[d];u.push({key:{status:"valid",value:d},value:p._parse(new rn(s,g,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof In){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of A)u.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")A.length>0&&(V(s,{code:U.unrecognized_keys,keys:A}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of A){let g=s.data[p];u.push({key:{status:"valid",value:p},value:d._parse(new rn(s,g,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of u){let g=await p.key,f=await p.value;d.push({key:g,value:f,alwaysSet:p.alwaysSet})}return d}).then(d=>ot.mergeObjectSync(r,d)):ot.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(t){return J.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:o((n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:J.errToObj(t).message??s}:{message:s}},"errorMap")}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:o(()=>({...this._def.shape(),...t}),"shape")})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:o(()=>({...this._def.shape(),...t._def.shape()}),"shape"),typeName:oe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let r of Ee.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new e({...this._def,shape:o(()=>n,"shape")})}omit(t){let n={};for(let r of Ee.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new e({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return uo(this)}partial(t){let n={};for(let r of Ee.objectKeys(this.shape)){let s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new e({...this._def,shape:o(()=>n,"shape")})}required(t){let n={};for(let r of Ee.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof nn;)i=i._def.innerType;n[r]=i}return new e({...this._def,shape:o(()=>n,"shape")})}keyof(){return _R(Ee.objectKeys(this.shape))}};Tt.create=(e,t)=>new Tt({shape:o(()=>e,"shape"),unknownKeys:"strip",catchall:In.create(),typeName:oe.ZodObject,...ue(t)});Tt.strictCreate=(e,t)=>new Tt({shape:o(()=>e,"shape"),unknownKeys:"strict",catchall:In.create(),typeName:oe.ZodObject,...ue(t)});Tt.lazycreate=(e,t)=>new Tt({shape:e,unknownKeys:"strip",catchall:In.create(),typeName:oe.ZodObject,...ue(t)});var Os=class extends pe{static{o(this,"ZodUnion")}_parse(t){let{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(let A of i)if(A.result.status==="valid")return A.result;for(let A of i)if(A.result.status==="dirty")return n.common.issues.push(...A.ctx.common.issues),A.result;let a=i.map(A=>new xt(A.ctx.common.issues));return V(n,{code:U.invalid_union,unionErrors:a}),ne}if(o(s,"handleResults"),n.common.async)return Promise.all(r.map(async i=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(s);{let i,a=[];for(let u of r){let d={...n,common:{...n.common,issues:[]},parent:null},p=u._parseSync({data:n.data,path:n.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:d}),d.common.issues.length&&a.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let A=a.map(u=>new xt(u));return V(n,{code:U.invalid_union,unionErrors:A}),ne}}get options(){return this._def.options}};Os.create=(e,t)=>new Os({options:e,typeName:oe.ZodUnion,...ue(t)});var ar=o(e=>e instanceof Vs?ar(e.schema):e instanceof sn?ar(e.innerType()):e instanceof Hs?[e.value]:e instanceof qs?e.options:e instanceof js?Ee.objectValues(e.enum):e instanceof Js?ar(e._def.innerType):e instanceof $s?[void 0]:e instanceof Ps?[null]:e instanceof nn?[void 0,...ar(e.unwrap())]:e instanceof On?[null,...ar(e.unwrap())]:e instanceof Xa||e instanceof Ws?ar(e.unwrap()):e instanceof Ys?ar(e._def.innerType):[],"getDiscriminator"),nl=class e extends pe{static{o(this,"ZodDiscriminatedUnion")}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==q.object)return V(n,{code:U.invalid_type,expected:q.object,received:n.parsedType}),ne;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(V(n,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let s=new Map;for(let i of n){let a=ar(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let A of a){if(s.has(A))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(A)}`);s.set(A,i)}}return new e({typeName:oe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...ue(r)})}};function $h(e,t){let n=$n(e),r=$n(t);if(e===t)return{valid:!0,data:e};if(n===q.object&&r===q.object){let s=Ee.objectKeys(t),i=Ee.objectKeys(e).filter(A=>s.indexOf(A)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let A of i){if(A==="__proto__")continue;let u=$h(e[A],t[A]);if(!u.valid)return{valid:!1};a[A]=u.data}return{valid:!0,data:a}}else if(n===q.array&&r===q.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let i=0;i<e.length;i++){let a=e[i],A=t[i],u=$h(a,A);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===q.date&&r===q.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}o($h,"mergeValues");var Gs=class extends pe{static{o(this,"ZodIntersection")}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),s=o((i,a)=>{if(el(i)||el(a))return ne;let A=$h(i.value,a.value);return A.valid?((tl(i)||tl(a))&&n.dirty(),{status:n.value,value:A.data}):(V(r,{code:U.invalid_intersection_types}),ne)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Gs.create=(e,t,n)=>new Gs({left:e,right:t,typeName:oe.ZodIntersection,...ue(n)});var Pn=class e extends pe{static{o(this,"ZodTuple")}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==q.array)return V(r,{code:U.invalid_type,expected:q.array,received:r.parsedType}),ne;if(r.data.length<this._def.items.length)return V(r,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&r.data.length>this._def.items.length&&(V(r,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((a,A)=>{let u=this._def.items[A]||this._def.rest;return u?u._parse(new rn(r,a,r.path,A)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>ot.mergeArray(n,a)):ot.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Pn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pn({items:e,typeName:oe.ZodTuple,rest:null,...ue(t)})};var rl=class e extends pe{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==q.object)return V(r,{code:U.invalid_type,expected:q.object,received:r.parsedType}),ne;let s=[],i=this._def.keyType,a=this._def.valueType;for(let A in r.data)s.push({key:i._parse(new rn(r,A,r.path,A)),value:a._parse(new rn(r,r.data[A],r.path,A)),alwaysSet:A in r.data});return r.common.async?ot.mergeObjectAsync(n,s):ot.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof pe?new e({keyType:t,valueType:n,typeName:oe.ZodRecord,...ue(r)}):new e({keyType:Gr.create(),valueType:t,typeName:oe.ZodRecord,...ue(n)})}},go=class extends pe{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==q.map)return V(r,{code:U.invalid_type,expected:q.map,received:r.parsedType}),ne;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([A,u],d)=>({key:s._parse(new rn(r,A,r.path,[d,"key"])),value:i._parse(new rn(r,u,r.path,[d,"value"]))}));if(r.common.async){let A=new Map;return Promise.resolve().then(async()=>{for(let u of a){let d=await u.key,p=await u.value;if(d.status==="aborted"||p.status==="aborted")return ne;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),A.set(d.value,p.value)}return{status:n.value,value:A}})}else{let A=new Map;for(let u of a){let d=u.key,p=u.value;if(d.status==="aborted"||p.status==="aborted")return ne;(d.status==="dirty"||p.status==="dirty")&&n.dirty(),A.set(d.value,p.value)}return{status:n.value,value:A}}}};go.create=(e,t,n)=>new go({valueType:t,keyType:e,typeName:oe.ZodMap,...ue(n)});var ho=class e extends pe{static{o(this,"ZodSet")}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==q.set)return V(r,{code:U.invalid_type,expected:q.set,received:r.parsedType}),ne;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(V(r,{code:U.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(V(r,{code:U.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function a(u){let d=new Set;for(let p of u){if(p.status==="aborted")return ne;p.status==="dirty"&&n.dirty(),d.add(p.value)}return{status:n.value,value:d}}o(a,"finalizeSet");let A=[...r.data.values()].map((u,d)=>i._parse(new rn(r,u,r.path,d)));return r.common.async?Promise.all(A).then(u=>a(u)):a(A)}min(t,n){return new e({...this._def,minSize:{value:t,message:J.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:J.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};ho.create=(e,t)=>new ho({valueType:e,minSize:null,maxSize:null,typeName:oe.ZodSet,...ue(t)});var sl=class e extends pe{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==q.function)return V(n,{code:U.invalid_type,expected:q.function,received:n.parsedType}),ne;function r(A,u){return Za({data:A,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,co(),or].filter(d=>!!d),issueData:{code:U.invalid_arguments,argumentsError:u}})}o(r,"makeArgsIssue");function s(A,u){return Za({data:A,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,co(),or].filter(d=>!!d),issueData:{code:U.invalid_return_type,returnTypeError:u}})}o(s,"makeReturnsIssue");let i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Hr){let A=this;return gt(async function(...u){let d=new xt([]),p=await A._def.args.parseAsync(u,i).catch(m=>{throw d.addIssue(r(u,m)),d}),g=await Reflect.apply(a,this,p);return await A._def.returns._def.type.parseAsync(g,i).catch(m=>{throw d.addIssue(s(g,m)),d})})}else{let A=this;return gt(function(...u){let d=A._def.args.safeParse(u,i);if(!d.success)throw new xt([r(u,d.error)]);let p=Reflect.apply(a,this,d.data),g=A._def.returns.safeParse(p,i);if(!g.success)throw new xt([s(p,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Pn.create(t).rest(cr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new e({args:t||Pn.create([]).rest(cr.create()),returns:n||cr.create(),typeName:oe.ZodFunction,...ue(r)})}},Vs=class extends pe{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};Vs.create=(e,t)=>new Vs({getter:e,typeName:oe.ZodLazy,...ue(t)});var Hs=class extends pe{static{o(this,"ZodLiteral")}_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return V(n,{received:n.data,code:U.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:t.data}}get value(){return this._def.value}};Hs.create=(e,t)=>new Hs({value:e,typeName:oe.ZodLiteral,...ue(t)});function _R(e,t){return new qs({values:e,typeName:oe.ZodEnum,...ue(t)})}o(_R,"createZodEnum");var qs=class e extends pe{static{o(this,"ZodEnum")}_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),r=this._def.values;return V(n,{expected:Ee.joinValues(r),received:n.parsedType,code:U.invalid_type}),ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),r=this._def.values;return V(n,{received:n.data,code:U.invalid_enum_value,options:r}),ne}return gt(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}};qs.create=_R;var js=class extends pe{static{o(this,"ZodNativeEnum")}_parse(t){let n=Ee.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==q.string&&r.parsedType!==q.number){let s=Ee.objectValues(n);return V(r,{expected:Ee.joinValues(s),received:r.parsedType,code:U.invalid_type}),ne}if(this._cache||(this._cache=new Set(Ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let s=Ee.objectValues(n);return V(r,{received:r.data,code:U.invalid_enum_value,options:s}),ne}return gt(t.data)}get enum(){return this._def.values}};js.create=(e,t)=>new js({values:e,typeName:oe.ZodNativeEnum,...ue(t)});var Hr=class extends pe{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==q.promise&&n.common.async===!1)return V(n,{code:U.invalid_type,expected:q.promise,received:n.parsedType}),ne;let r=n.parsedType===q.promise?n.data:Promise.resolve(n.data);return gt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Hr.create=(e,t)=>new Hr({type:e,typeName:oe.ZodPromise,...ue(t)});var sn=class extends pe{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o(a=>{V(r,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async A=>{if(n.value==="aborted")return ne;let u=await this._def.schema._parseAsync({data:A,path:r.path,parent:r});return u.status==="aborted"?ne:u.status==="dirty"?Fs(u.value):n.value==="dirty"?Fs(u.value):u});{if(n.value==="aborted")return ne;let A=this._def.schema._parseSync({data:a,path:r.path,parent:r});return A.status==="aborted"?ne:A.status==="dirty"?Fs(A.value):n.value==="dirty"?Fs(A.value):A}}if(s.type==="refinement"){let a=o(A=>{let u=s.refinement(A,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return A},"executeRefinement");if(r.common.async===!1){let A=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return A.status==="aborted"?ne:(A.status==="dirty"&&n.dirty(),a(A.value),{status:n.value,value:A.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(A=>A.status==="aborted"?ne:(A.status==="dirty"&&n.dirty(),a(A.value).then(()=>({status:n.value,value:A.value}))))}if(s.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Or(a))return ne;let A=s.transform(a.value,i);if(A instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:A}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Or(a)?Promise.resolve(s.transform(a.value,i)).then(A=>({status:n.value,value:A})):ne);Ee.assertNever(s)}};sn.create=(e,t,n)=>new sn({schema:e,typeName:oe.ZodEffects,effect:t,...ue(n)});sn.createWithPreprocess=(e,t,n)=>new sn({schema:t,effect:{type:"preprocess",transform:e},typeName:oe.ZodEffects,...ue(n)});var nn=class extends pe{static{o(this,"ZodOptional")}_parse(t){return this._getType(t)===q.undefined?gt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};nn.create=(e,t)=>new nn({innerType:e,typeName:oe.ZodOptional,...ue(t)});var On=class extends pe{static{o(this,"ZodNullable")}_parse(t){return this._getType(t)===q.null?gt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};On.create=(e,t)=>new On({innerType:e,typeName:oe.ZodNullable,...ue(t)});var Js=class extends pe{static{o(this,"ZodDefault")}_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return n.parsedType===q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Js.create=(e,t)=>new Js({innerType:e,typeName:oe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ue(t)});var Ys=class extends pe{static{o(this,"ZodCatch")}_parse(t){let{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ao(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xt(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new xt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Ys.create=(e,t)=>new Ys({innerType:e,typeName:oe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ue(t)});var fo=class extends pe{static{o(this,"ZodNaN")}_parse(t){if(this._getType(t)!==q.nan){let r=this._getOrReturnCtx(t);return V(r,{code:U.invalid_type,expected:q.nan,received:r.parsedType}),ne}return{status:"valid",value:t.data}}};fo.create=e=>new fo({typeName:oe.ZodNaN,...ue(e)});var xV=Symbol("zod_brand"),Xa=class extends pe{static{o(this,"ZodBranded")}_parse(t){let{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},ec=class e extends pe{static{o(this,"ZodPipeline")}_parse(t){let{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return o(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ne:i.status==="dirty"?(n.dirty(),Fs(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})},"handleAsync")();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ne:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new e({in:t,out:n,typeName:oe.ZodPipeline})}},Ws=class extends pe{static{o(this,"ZodReadonly")}_parse(t){let n=this._def.innerType._parse(t),r=o(s=>(Or(s)&&(s.value=Object.freeze(s.value)),s),"freeze");return Ao(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Ws.create=(e,t)=>new Ws({innerType:e,typeName:oe.ZodReadonly,...ue(t)});function FR(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}o(FR,"cleanParams");function $R(e,t={},n){return e?Vr.create().superRefine((r,s)=>{let i=e(r);if(i instanceof Promise)return i.then(a=>{if(!a){let A=FR(t,r),u=A.fatal??n??!0;s.addIssue({code:"custom",...A,fatal:u})}});if(!i){let a=FR(t,r),A=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:A})}}):Vr.create()}o($R,"custom");var TV={object:Tt.lazycreate},oe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(oe||(oe={}));var DV=o((e,t={message:`Input not instance of ${e.name}`})=>$R(n=>n instanceof e,t),"instanceOfType"),PR=Gr.create,OR=Ms.create,NV=fo.create,FV=Us.create,GR=Ls.create,MV=_s.create,UV=lo.create,LV=$s.create,_V=Ps.create,$V=Vr.create,PV=cr.create,OV=In.create,GV=po.create,VV=Ar.create,HV=Tt.create,qV=Tt.strictCreate,jV=Os.create,JV=nl.create,YV=Gs.create,WV=Pn.create,zV=rl.create,KV=go.create,ZV=ho.create,XV=sl.create,eH=Vs.create,tH=Hs.create,nH=qs.create,rH=js.create,sH=Hr.create,iH=sn.create,oH=nn.create,aH=On.create,cH=sn.createWithPreprocess,AH=ec.create,uH=o(()=>PR().optional(),"ostring"),lH=o(()=>OR().optional(),"onumber"),dH=o(()=>GR().optional(),"oboolean"),pH={string:o((e=>Gr.create({...e,coerce:!0})),"string"),number:o((e=>Ms.create({...e,coerce:!0})),"number"),boolean:o((e=>Ls.create({...e,coerce:!0})),"boolean"),bigint:o((e=>Us.create({...e,coerce:!0})),"bigint"),date:o((e=>_s.create({...e,coerce:!0})),"date")};var gH=ne;var AS=require("node:crypto");var zs=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(zs||{});var Ph=o(e=>`${e.source}:${e.site??""}:${e.key}`,"requirementItemId");var tc=/^pasted-[0-9a-f]{16}$/,mo=/^file-[0-9a-f]{16}$/,nc=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(nc||{}),rc=o(e=>e.trim().toUpperCase(),"normalKey"),VR=o((e,t)=>{let n=e.trim();return tc.test(n.toLowerCase())?"Pasted text":mo.test(n.toLowerCase())?t?.get(rc(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()},"itemName");var il=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(il||{}),qr=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(qr||{}),Eo=(C=>(C.RelatedChangeConflict="related_change_conflict",C.ReferenceOutsideTarget="reference_outside_target",C.SourceAccessLost="source_access_lost",C.ConfigurationIncomplete="configuration_incomplete",C.CredentialUnavailable="credential_unavailable",C.WorkflowBindingUnverified="workflow_binding_unverified",C.WorkflowRefUnprotected="workflow_ref_unprotected",C.BedrockWorkflowRequired="bedrock_workflow_required",C.DeploymentReview="deployment_review",C.SutRevisionMismatch="sut_revision_mismatch",C.IsolationUnavailable="isolation_unavailable",C.EvidenceInsufficient="evidence_insufficient",C.ConfigurationUnresolved="configuration_unresolved",C.ModelProviderDenied="model_provider_denied",C.ModelProviderUnavailable="model_provider_unavailable",C.RunnerProviderNotReady="runner_provider_not_ready",C.MergeConflict="merge_conflict",C))(Eo||{}),jr=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(jr||{}),ol=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(ol||{}),al=(A=>(A.AuthToken="auth_token",A.Secret="secret",A.DataConnection="data_connection",A.AppNotStarted="app_not_started",A.Login="login",A.ExternalDependency="external_dependency",A.RecordingReplay="recording_replay",A))(al||{});var cl=(n=>(n.Probe="probe",n.Agent="agent",n))(cl||{}),Al=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(Al||{}),ul=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(ul||{});var Oh=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Oh||{}),Je=c.string().trim().min(1),hH=c.object({action:c.enum(["start","run","wait"]),text:Je,source:c.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Je.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(e=>e.source==="file"==(e.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),fH=/^[A-Za-z_][A-Za-z0-9_]*$/,sc=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,yo=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(yo||{}),Gn="shared",mH=Je.refine(e=>{try{let t=new URL(e);return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}},"an http(s) URL with no login in it"),Co=c.object({address:mH,readyWhen:Je.nullable(),credentials:c.array(c.string().regex(sc)).max(50),revisionSources:c.array(c.object({method:c.nativeEnum(yo),detail:Je.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:c.array(Je).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),Gh={steps:c.array(hH).max(20).optional().describe("how it starts, in order"),kind:c.enum(["web_app","service","database","external_service"]).optional(),from:c.object({file:Je,service:Je.nullable()}).strict().optional(),credentials:c.array(c.string().max(100).regex(fH)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},EH=c.object({name:Je,repository:Je.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:c.boolean(),...Gh,deployed:Je.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),yH=c.object({component:Je,problem:Je,evidence:Je.describe("the exact command and output that shows it"),fix:Je.describe("what the user must provide, and where")}),CH=c.object({framework:Je,file:Je.describe("the test file run, relative to its repository root"),result:c.enum(["pass","fail","error"])}),IH=c.object({input:Je.describe("the part of the user's SUT input, as given"),reason:Je}),c8=c.object({schemaVersion:c.literal(1),status:c.nativeEnum(Oh).describe("ready only if every component came up healthy and the recipe is written"),components:c.array(EH),suites:c.array(CH).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:c.array(Je).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:c.array(c.object({input:Je.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Je.describe("what the recipe did with it")})).optional(),inputsNotUsed:c.array(IH).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one the repositories or the app show is wrong, such as a file, command, port, route or setting that is not there. Something outside them that does not answer is not one: that is a blocker"),blockers:c.array(yH).describe("required (non-empty) when status is blocked"),environment:Co.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var Vh=64*1024,Hh=512*1024,HR=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var jR=fe(require("path"));var ur=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(ur||{}),Bn=c.string().trim().min(1),BH=c.object({url:c.string().optional().describe("the URL probed, if the check is an HTTP request"),command:c.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:c.record(c.string()).optional(),status:c.union([c.number(),c.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:Bn.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),qh=c.array(c.object({component:Bn.describe("a shared component listed above"),url:Bn.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:Bn.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),QH=c.object({name:Bn.describe("the credential's environment variable name, as listed above; never its value"),component:Bn.describe("the component that refused it"),status:c.number().int().min(400).max(599).optional().describe("the HTTP status it got, such as 401 or 403; leave it out when the refusal was not an HTTP answer"),evidence:Bn.describe("the request or command you tested it with and what came back, never the value")}),qR=c.object({schemaVersion:c.literal(1),baseUrls:c.record(c.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:BH.optional(),teardown:Bn.describe("command that tears the SUT down"),dependencies:c.record(c.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:c.nativeEnum(ur).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:c.array(c.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:c.object({command:Bn,output:Bn}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:c.array(c.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:c.boolean(),startedAt:Bn.describe("ISO timestamp"),revisions:qh.optional(),credentialsRefused:c.array(QH).optional().describe("only for credentials the prompt lists to test: each that was refused when you tested it, such as with a 401 or 403; leave it out when none was, or when none is listed"),recipeRecorded:c.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var at=c.string().trim().min(1),ll=at,jh=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(jh||{}),Jh=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],JR=c.object({schemaVersion:c.literal(1),type:c.nativeEnum(jh).optional(),repository:ll.optional().describe("namespace/name of the source whose checkout the recipe was written and proven in (SKYR-5380); a run replays it from there. Never on a customer_deployed plan"),status:c.enum(["ready","blocked"]),environment:Co.optional(),components:c.array(c.object({name:at,repository:at.describe(`owner/repo, or "${Gn}" for a customer-deployed component no repository builds`),healthy:c.boolean(),url:c.string().min(1).nullable(),...Gh,credentials:c.array(c.string().regex(sc)).max(50).optional(),deployed:at.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:c.array(c.object({framework:at,file:at,result:c.enum(["pass","fail","error"])}).strict()),inputsUsed:c.array(at),inputsUsedHow:c.array(c.object({input:at,how:at}).strict()).optional(),inputsNotUsed:c.array(c.object({input:at,reason:at}).strict()),blockers:c.array(c.object({component:at,problem:at,evidence:at,fix:at}).strict()),replay:c.object({outcome:at,durationSeconds:c.number().nonnegative().nullable()}).strict().nullable(),files:c.array(c.object({path:at,content:c.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((s,i)=>{e.inputsUsed.includes(s.input)||t.addIssue({code:c.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),e.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:c.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:c.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),e.environment&&new Set(e.environment.credentials).size!==e.environment.credentials.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(e.components.map(s=>s.name));if(e.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((a,A)=>{r.has(a)||t.addIssue({code:c.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",A],message:"not one of components"})})}),e.components.forEach((s,i)=>{s.deployed!==void 0!==n&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===Gn&&!n&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${Gn}`})}),n&&(e.components.forEach((s,i)=>{e.components.findIndex(a=>a.name===s.name)!==i&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:c.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((s,i)=>{Jh.includes(s.path)&&t.addIssue({code:c.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let s=new Set(e.environment?.revisionSources.flatMap(i=>i.components));e.components.forEach((i,a)=>{i.repository!==Gn&&!s.has(i.name)&&t.addIssue({code:c.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var m8=["clean","recipe-drift"];function ic(e){let t=jR.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}o(ic,"isRuntimePlanFile");var Ks=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(Ks||{}),ml=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(ml||{}),Wh=(a=>(a.PullRequest="pull_request",a.ReadyForReview="ready_for_review",a.Schedule="schedule",a.Manual="manual",a.SutSetup="sut_setup",a.RevisionRead="revision_read",a))(Wh||{}),wH=["sut_setup"],bH=["sut_setup","schedule","revision_read"],RH=["sut_setup"],zh=(t=>(t.PullRequest="pull_request",t))(zh||{}),Kh=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(Kh||{}),YR=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"],uS=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(uS||{}),El=(s=>(s.None="none",s.Delivered="delivered",s.Partial="partial",s.Failed="failed",s))(El||{}),Ac=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(Ac||{}),lS=(n=>(n.Running="running",n.Ended="ended",n))(lS||{}),uc=(g=>(g.TimedOut="timed_out",g.AgentFailed="agent_failed",g.SetupFailed="setup_failed",g.CredentialMissing="credential_missing",g.RunnerLost="runner_lost",g.CheckoutFailed="checkout_failed",g.EnvironmentUnverified="environment_unverified",g.ModelProviderDenied="model_provider_denied",g.ModelProviderUnavailable="model_provider_unavailable",g.RunnerProviderNotReady="runner_provider_not_ready",g.MergeConflict="merge_conflict",g))(uc||{}),dS=(r=>(r.Onboard="onboard",r.Deploy="deploy",r.Recheck="recheck",r))(dS||{}),pS=(n=>(n.Started="started",n.Finished="finished",n))(pS||{}),gS=(r=>(r.Passed="passed",r.Failed="failed",r.Skipped="skipped",r))(gS||{});var hS=(r=>(r.ChooseCredential="choose_credential",r.FreeText="free_text",r.ChooseSource="choose_source",r))(hS||{});var Zh=(r=>(r.Discover="discover",r.Start="start",r.Check="check",r))(Zh||{}),fS=(s=>(s.ValidationPlan="validation_plan",s.TestEnvironment="test_environment",s.TestConditions="test_conditions",s.Tests="tests",s))(fS||{});var Xh=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(Xh||{}),an=c.string().regex(/^[1-9][0-9]{0,18}$/),Qn=c.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),Bo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,rt=c.string().regex(Bo),It=c.string().regex(/^[0-9a-f]{64}$/),gl=c.object({id:rt,revision:an}).strict(),yl={provider:c.literal("github"),providerAccountId:an,providerRepositoryId:an},Cl={provider:c.literal("azure-devops"),providerAccountId:rt,providerRepositoryId:rt},Vn=c.discriminatedUnion("provider",[c.object(yl).strict(),c.object(Cl).strict()]),ef=c.discriminatedUnion("provider",[c.object(yl).passthrough(),c.object(Cl).passthrough()]),dr=o(e=>`${e.provider}:${e.providerRepositoryId}`,"sourceKey"),WR={namespace:c.string().min(1),name:c.string().min(1)},mS=c.discriminatedUnion("provider",[c.object({...yl,...WR}).strict(),c.object({...Cl,...WR}).strict()]),zR=c.object({ref:c.string().min(1),revision:Qn}).strict(),SH=c.object({kind:c.nativeEnum(Kh),number:an.optional(),ref:c.string().min(1),revision:Qn,reason:c.nativeEnum(ml)}).strict(),kH=c.object({repository:mS,revision:Qn,ref:c.string().nullable(),reason:c.nativeEnum(ml),change:c.object({kind:c.nativeEnum(zh),number:an,base:zR.optional()}).strict().nullable(),compareWith:zR.optional(),merge:c.array(SH).min(2).optional()}).strict();function vH(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,r=new Set;for(let[i,a]of t.entries()){if(a.kind==="pull_request"!=(a.number!==void 0))return{path:["merge",i,"number"],message:"a pull request names its number, and a branch none"};if(!YR.includes(a.reason))return{path:["merge",i,"reason"],message:`${a.reason} does not select a merged revision`};if(a.kind==="branch"&&a.reason!=="MANUAL_OVERRIDE")return{path:["merge",i,"reason"],message:"only a person chooses a branch to merge"};if(a.ref===e.ref)return{path:["merge",i,"ref"],message:"the baseline branch is what the source merges onto"};if(a.number!==void 0&&n.has(a.number)||r.has(a.ref))return{path:["merge",i],message:"names a revision the source already merges"};a.number!==void 0&&n.add(a.number),r.add(a.ref)}let s=YR.find(i=>t.some(a=>a.reason===i));return e.reason!==s?{path:["reason"],message:`a source that merges these revisions is ${s}`}:null}o(vH,"mergedSourceIssue");function xH(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,sources:r}=e.baseline;if(t!==null&&n!==void 0)return"a run compares with one baseline";let s=e.trigger.kind==="schedule"&&t!==null||n!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(t===null&&n===void 0)return"a run with no Confirmed Baseline names no baseline sources";let i=new Set(e.sources.map(u=>dr(u.repository))),a=new Set(r.map(u=>dr(u.repository)));return a.size===r.length&&a.size===i.size&&[...a].every(u=>i.has(u))?null:"names every source of the snapshot, once"}o(xH,"baselineSourcesIssue");var ES=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,yS=/^[1-9][0-9]{0,18}$/,KR=new RegExp(`${ES.source}|${yS.source}`),ZR=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,TH=c.union([c.object({source:c.literal("jira"),site:c.string().regex(ZR),key:c.string().regex(ES),updated:c.string().datetime(),contentHash:It}).strict(),c.object({source:c.literal("confluence"),site:c.string().regex(ZR),key:c.string().regex(yS),version:c.number().int().positive(),contentHash:It}).strict(),c.object({source:c.literal("other"),key:c.string().regex(tc),contentHash:It}).strict(),c.object({source:c.literal("other"),key:c.string().regex(mo),contentHash:It,fileName:c.string().min(1).max(255),mediaType:c.nativeEnum(nc)}).strict()]),XR=c.union([c.literal("jira"),c.literal("confluence")]),DH=c.object({schemaVersion:c.literal(1),items:c.array(c.union([c.object({source:XR,site:c.string(),key:c.string().regex(KR),state:c.literal("read"),text:c.string(),version:c.string().min(1),contentMatches:c.boolean()}).strict(),c.object({source:XR,site:c.string(),key:c.string().regex(KR),state:c.literal("not_read"),reason:c.nativeEnum(zs)}).strict(),c.object({source:c.literal("other"),key:c.string().regex(tc),state:c.literal("read"),text:c.string(),version:c.string().min(1),contentMatches:c.boolean()}).strict(),c.object({source:c.literal("other"),key:c.string().regex(tc),state:c.literal("not_read"),reason:c.nativeEnum(zs)}).strict(),c.object({source:c.literal("other"),key:c.string().regex(mo),state:c.literal("read"),version:It,fileName:c.string().min(1).max(255),mediaType:c.nativeEnum(nc)}).strict(),c.object({source:c.literal("other"),key:c.string().regex(mo),state:c.literal("not_read"),reason:c.nativeEnum(zs)}).strict()])),instructions:c.array(c.string()).optional()}).strict(),NH=c.object({schemaVersion:c.literal(1),runId:rt,skyrampOrgId:rt,target:gl,policy:gl.nullable(),trigger:c.object({kind:c.nativeEnum(Wh),requestedAt:c.string().datetime()}).strict(),configuration:c.object({captureId:rt,revision:an.nullable(),hash:It}).strict(),baseline:c.object({confirmedRunId:rt.nullable(),initialBaselineId:rt.optional(),sources:c.array(c.object({repository:Vn,revision:Qn}).strict()).optional()}).strict().optional(),sources:c.array(kH).min(1),execution:c.object({provider:c.nativeEnum(Ks),repository:mS,workflowPath:c.string(),ref:c.string()}).strict(),credentials:c.array(c.object({name:c.string(),purpose:c.nativeEnum(uS),required:c.boolean()}).strict()),requirements:c.array(TH).min(1).optional(),instructions:c.object({contentHash:It}).strict().optional(),deployedRevisions:c.array(c.object({repository:Vn,revision:Qn}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((u,d)=>{let p="fileName"in u?"file":"pasted";u.source==="other"&&u.key!==`${p}-${u.contentHash.slice(0,16)}`&&t.addIssue({code:c.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",d,"key"]});let g=Ph({source:u.source,key:u.key});n.has(g)&&t.addIssue({code:c.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",d,"key"]}),n.add(g)});let r=e.trigger.kind,s=wH.includes(r);s!==(e.policy===null)&&t.addIssue({code:c.ZodIssueCode.custom,path:["policy"],message:s?`a ${r} run has no policy`:"names the policy revision"});let i=xH(e);i&&t.addIssue({code:c.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:i}),bH.includes(r)&&e.sources.forEach((u,d)=>{u.reason!=="BASELINE"&&t.addIssue({code:c.ZodIssueCode.custom,path:["sources",d,"reason"],message:`a ${r} run selects only BASELINE sources`})}),e.deployedRevisions&&r!=="manual"&&t.addIssue({code:c.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(e.sources.map(u=>dr(u.repository))),A=new Set;(e.deployedRevisions??[]).forEach((u,d)=>{let p=dr(u.repository);a.has(p)?A.has(p)&&t.addIssue({code:c.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"repository appears twice"}):t.addIssue({code:c.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"names a repository outside the snapshot"}),A.add(p)}),e.sources.forEach((u,d)=>{u.compareWith&&(u.reason!=="MANUAL_OVERRIDE"||u.change)&&t.addIssue({code:c.ZodIssueCode.custom,path:["sources",d,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"});let p=vH(u);p&&t.addIssue({code:c.ZodIssueCode.custom,path:["sources",d,...p.path],message:p.message})})});var tf=(n=>(n.Person="person",n.Policy="policy",n))(tf||{}),FH=c.object({kind:c.nativeEnum(tf),name:c.string().min(1).max(256)}).strict(),MH=c.object({mcp:c.discriminatedUnion("source",[c.object({source:c.literal("npm"),version:c.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),c.object({source:c.literal("github"),ref:c.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:c.object({region:c.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:c.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),UH=c.object({schemaVersion:c.literal(1),attempt:c.object({id:rt,number:c.number().int().positive(),deadlineAt:c.string().datetime()}).strict(),manifest:NH,manifestHash:It,entitlements:c.array(c.string()).optional(),runToken:c.string().min(1).optional(),requestedBy:FH.nullable().optional(),writeAllowed:c.boolean().optional(),claudeCodeVersion:c.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:c.array(c.object({repository:Vn,revision:Qn}).strict()).optional(),statedRevisions:c.array(c.object({repository:Vn,revision:Qn}).strict()).optional(),runSettings:MH.optional(),credentialRelay:c.boolean().optional()}).strict(),eS={providerRunAttempt:c.number().int().positive(),workflowRef:c.string().min(1)},LH=c.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),_H=c.object({schemaVersion:c.literal(1),runId:rt,execution:c.discriminatedUnion("provider",[c.object({...eS,provider:c.literal("github"),repository:c.object(yl).strict(),providerRunId:an}).strict(),c.object({...eS,provider:c.literal("azure-devops"),repository:c.object(Cl).strict(),providerRunId:LH}).strict()]),requester:c.literal(!0).optional(),writeCheck:c.literal(!0).optional(),claudeCodePin:c.literal(!0).optional(),deployedPins:c.literal(!0).optional(),statedPins:c.literal(!0).optional(),runSettings:c.literal(!0).optional(),credentialRelay:c.literal(!0).optional()}).strict(),tS=c.object({repository:Vn,number:an,commitSha:Qn.optional()}).strict(),$H=c.discriminatedUnion("status",[c.object({status:c.literal("none")}).strict(),c.object({status:c.literal("delivered"),pullRequests:c.array(tS).min(1)}).strict(),c.object({status:c.literal("partial"),pullRequests:c.array(tS).min(1),failures:c.array(c.object({repository:Vn,message:c.string()}).strict()).min(1)}).strict(),c.object({status:c.literal("failed"),message:c.string()}).strict()]),CS=1024*1024,dl=o(e=>c.array(c.object({[e]:c.string()}).strict()).optional(),"texts"),PH=c.object({language:c.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:c.string(),validation:c.object({rationale:c.string(),gaps:c.array(c.string())}).strict().optional(),changes:c.array(c.object({id:c.string(),text:c.string()}).strict()).optional(),issuesFound:dl("description"),newTestsCreated:dl("description"),testResults:dl("details"),caveats:dl("text")}).strict(),OH=c.object({blockedPreflight:c.object({file:c.string().min(1),repository:c.string().min(1).optional(),reason:c.string().min(1).max(300),evidence:c.string().min(1).max(400)}).strict().optional(),sufficiency:c.nativeEnum(qr),rationale:c.string().min(1),gaps:c.array(c.string().min(1)),acceptedEvidence:c.array(c.object({kind:c.nativeEnum(jr),repository:c.string().min(1),revision:Qn,reference:c.string().min(1),summary:c.string().min(1)}).strict()),actionRequired:c.array(c.nativeEnum(Eo))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:c.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),pl=500,IS=2048,BS=1e3,GH=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,nS=o(e=>e.length>0&&e.length<=64&&e===e.trim()&&!GH.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),"isAzureName"),VH=o(e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,r,...s]=e.split("/");return e.length<=201&&s.length===0&&r!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&nS(n)&&nS(r)},"isResultRepository"),HH=c.object({testResults:c.array(c.object({resultId:c.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:c.string().refine(VH,"Invalid"),testType:c.string(),endpoint:c.string(),status:c.enum(["Pass","Fail","Skipped"]),details:c.string(),fileName:c.string().optional(),testId:c.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:c.object({kind:c.nativeEnum(ol),family:c.nativeEnum(al).optional()}).strict().optional(),origin:c.nativeEnum(il).optional()}).strict()),validation:OH,changes:c.array(c.object({id:c.string().min(1).max(512),text:c.string().max(16384),source:c.string().max(IS),testedBy:c.array(c.string().min(1).max(1024)).max(pl),writtenBy:c.array(c.string().min(1).max(1024)).max(pl),maintainedBy:c.array(c.string().min(1).max(1024)).max(pl)}).strict()).max(BS).optional(),traceVersion:c.literal(1),display:PH.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,r={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let i of["issuesFound","newTestsCreated","testResults","caveats"]){let a=n?.[i];a&&a.length!==(Array.isArray(r[i])?r[i].length:0)&&t.addIssue({code:c.ZodIssueCode.custom,path:["display",i],message:`has not one row per ${i} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let s=new Set;e.testResults.forEach((i,a)=>{let A=i.failureCause;A&&i.status==="Pass"&&t.addIssue({code:c.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"a passing result has no failure cause"}),A&&A.kind==="environment"!=(A.family!==void 0)&&t.addIssue({code:c.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"an environment cause names its family, and no other cause does"});let u=["testResults",a,"resultId"],d=i.resultId.slice(`${i.repository}:${i.testType}:`.length);(!i.resultId.startsWith(`${i.repository}:${i.testType}:`)||d===""||d.startsWith("/")||d.startsWith("#"))&&t.addIssue({code:c.ZodIssueCode.custom,path:u,message:"is not repository:testType:path for this result"}),s.has(i.resultId)&&t.addIssue({code:c.ZodIssueCode.custom,path:u,message:"stable identity repeated"}),s.add(i.resultId)})}),rS=o(e=>e.replace(/[%:#]/g,t=>encodeURIComponent(t)),"encodeIdPart");function nf(e,t,n,r){let s=n.replace(/\\/g,"/"),i=s.split("/").filter(u=>u!==""&&u!==".");if(s.startsWith("/")||/^[A-Za-z]:/.test(s)||i.length===0||i.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=i.join("/"),A=`${e}:${t}:${rS(a)}`;return r?`${A}#${rS(r)}`:A}o(nf,"testResultId");var Il=(r=>(r.BranchPushed="branch_pushed",r.PullRequestOpened="pull_request_opened",r.PullRequestEdited="pull_request_edited",r))(Il||{}),QS=50,sS=c.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),wS=c.discriminatedUnion("kind",[c.object({kind:c.literal("branch_pushed"),repository:Vn,branch:sS,commit:Qn}).strict(),c.object({kind:c.enum(["pull_request_opened","pull_request_edited"]),repository:Vn,number:an,branch:sS}).strict()]),bS=c.object({schemaVersion:c.literal(1),run:c.object({runId:rt,attemptNumber:c.number().int().positive(),manifestHash:It}).strict(),target:gl,policy:gl,provenance:c.object({sources:c.array(c.object({repository:Vn,revision:Qn}).strict()),firstQualification:c.literal(!0).optional()}).strict(),delivery:c.object({generatedTests:$H}).strict(),producer:c.object({testbot:c.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:c.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:HH,githubWrites:c.array(wS).max(QS).optional()}).strict(),b8=bS.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:JR}).strict().superRefine(({recipe:e},t)=>{let n=o((i,a)=>t.addIssue({code:c.ZodIssueCode.custom,path:["recipe",...i],message:a}),"issue");e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let r=new Set,s=0;e.files.forEach((i,a)=>{ic(i.path)||n(["files",a,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),r.has(i.path)&&n(["files",a,"path"],"file repeated"),r.add(i.path),HR.test(i.content)&&n(["files",a,"content"],"is not text");let A=Buffer.byteLength(i.content,"utf8");s+=A,A>Vh&&n(["files",a,"content"],`larger than ${Vh} bytes`)}),s>Hh&&n(["files"],`recipe text over ${Hh} bytes in total`)}),R8=c.object({components:c.array(c.object({name:c.string().min(1),repository:c.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),observedRevision:c.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:c.nativeEnum(cl),evidence:c.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var qH=c.object({schemaVersion:c.literal(1),stage:c.nativeEnum(dS),event:c.nativeEnum(pS),status:c.nativeEnum(gS).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Bl=100,jH=5e3,ac=2e3,iS=100,RS=/^[A-Za-z0-9_-]{1,64}$/,JH=20,YH=200,WH=100,zH=100,KH=200,oS="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",ZH=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${oS}/${oS})$`),XH=500,e2=50,t2=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,on=o(e=>c.string().max(e).refine(t=>t.trim().length>0&&!t2.test(t),"blank, or not text"),"setupText"),lr={sequence:c.number().int().min(1).max(jH),at:c.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},n2=c.discriminatedUnion("kind",[c.object({...lr,kind:c.literal("log"),phase:c.nativeEnum(Zh),text:on(ac)}).strict(),c.object({...lr,kind:c.literal("component"),name:on(iS),repository:on(KH).refine(e=>ZH.test(e)||e===Gn,"not owner/name"),file:on(XH).nullable(),status:c.nativeEnum(Xh),version:on(zH).optional()}).strict(),c.object({...lr,kind:c.literal("reply"),to:c.string().uuid(),accepted:c.boolean(),text:on(ac)}).strict(),c.object({...lr,kind:c.literal("question"),id:c.string().regex(RS),type:c.nativeEnum(hS),text:on(ac),component:on(iS).nullable(),choices:c.array(on(YH)).max(JH),placeholder:on(WH).optional()}).strict(),c.object({...lr,kind:c.literal("delivered"),ids:c.array(c.string().uuid()).max(Bl)}).strict(),c.object({...lr,kind:c.literal("credentials"),names:c.array(c.string().regex(sc)).min(1).max(e2)}).strict()]).superRefine((e,t)=>{e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:c.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:c.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),r2=c.object({schemaVersion:c.literal(1),events:c.array(n2).max(Bl)}).strict(),s2=c.discriminatedUnion("kind",[c.object({...lr,kind:c.literal("log"),stage:c.nativeEnum(fS),text:on(ac)}).strict(),c.object({...lr,kind:c.literal("reply"),to:c.string().uuid(),accepted:c.boolean(),text:on(ac)}).strict(),c.object({...lr,kind:c.literal("delivered"),ids:c.array(c.string().uuid()).max(Bl)}).strict()]),i2=c.object({schemaVersion:c.literal(1),events:c.array(s2).max(Bl)}).strict(),aS={id:c.string().uuid(),text:c.string(),by:c.string().nullable(),at:c.string(),replied:c.literal(!0).optional()},SS=c.discriminatedUnion("kind",[c.object({...aS,kind:c.literal("instruction"),question:c.null()}),c.object({...aS,kind:c.literal("answer"),question:c.string().regex(RS)})]),kS=c.string().regex(/^[A-Za-z0-9+/]{43}=$/),o2=c.object({id:c.string().uuid(),revision:c.string(),by:c.string().nullable(),at:c.string(),target:c.string(),own:c.object({source:c.enum(["policy","test_environment"]),text:c.string()}).nullable()}),vS=c.string().regex(/^[A-Za-z0-9+/]{43}=$/),a2=c.object({ephemeralPublicKey:vS,iv:c.string().regex(/^[A-Za-z0-9+/]{16}$/),ciphertext:c.string().min(1).max(65536),tag:c.string().regex(/^[A-Za-z0-9+/]{22}==$/)}).strict();var c2=/^[A-Z][A-Z0-9_]{0,99}$/,A2=new Set(["PATH","HOME","SHELL","USER","LOGNAME","PWD","OLDPWD","TMPDIR","TMP","TEMP","IFS","ENV","BASH_ENV","CDPATH","PS4","NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_TLS_REJECT_UNAUTHORIZED","PYTHONPATH","PYTHONHOME","PYTHONSTARTUP","RUBYOPT","RUBYLIB","PERL5OPT","PERL5LIB","JAVA_TOOL_OPTIONS","SSL_CERT_FILE","SSL_CERT_DIR","CURL_CA_BUNDLE","REQUESTS_CA_BUNDLE","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","ALL_PROXY","SSH_AUTH_SOCK","DOCKER_HOST","GIT_SSH","GIT_SSH_COMMAND","GIT_ASKPASS","GIT_EXEC_PATH","GIT_DIR","GIT_WORK_TREE","GIT_PROXY_COMMAND"]),u2=["LD_","DYLD_","GIT_CONFIG","GITHUB_","RUNNER_","ACTIONS_","INPUT_","SKYRAMP_RUNNER_"],l2=o(e=>c2.test(e)&&!A2.has(e)&&!u2.some(t=>e.startsWith(t)),"relayCredentialNameAllowed"),xS=c.string().refine(l2,"not a name a relay may set"),oc={id:rt,credentialName:xS},d2=c.discriminatedUnion("status",[c.object({...oc,status:c.literal("sealed"),sealed:a2}),c.object({...oc,status:c.literal("pending")}),c.object({...oc,status:c.literal("empty")}),c.object({...oc,status:c.literal("failed")}),c.object({...oc,status:c.literal("expired")})]),S8=c.object({schemaVersion:c.literal(1),relayId:rt,attemptId:rt,credentialName:xS,publicKey:vS}).strict(),p2=c.object({schemaVersion:c.literal(1),leftOut:c.array(c.string()),messages:c.array(SS).optional(),stop:c.object({key:kS}).optional(),notes:o2.optional(),relays:c.array(c.unknown()).transform(e=>e.flatMap(t=>{let n=d2.safeParse(t);return n.success?[n.data]:[]})).optional()}),g2=c.object({schemaVersion:c.literal(1),messages:c.array(SS).optional()});var h2=500*1024*1024,TS=c.object({id:an,name:c.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:an,expiresAt:c.string().datetime()}).strict(),f2=c.object({schemaVersion:c.literal(1),artifact:TS,sessionId:rt,contentHash:It,bytes:c.number().int().min(1).max(h2)}).strict(),m2=c.object({schemaVersion:c.literal(1),checkpoint:c.object({artifact:TS,repository:c.object({namespace:c.string().min(1),name:c.string().min(1)}).strict(),sessionId:rt,contentHash:It,key:kS}).strict().nullable()}).strict(),E2=200,Io=100,DS=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(DS||{}),y2=c.object({kind:c.nativeEnum(DS),setup:c.object({runId:rt,endedAt:c.string().nullable(),outcome:c.string().nullable()}).strict(),components:c.array(c.object({name:c.string().min(1),repository:c.string().min(1),status:c.nativeEnum(Xh)}).strict()).max(Io),credentials:c.array(c.string().min(1)).max(Io),answers:c.array(c.object({question:c.string(),answer:c.string().nullable()}).strict()).max(Io),instructions:c.array(c.object({text:c.string(),reply:c.string().nullable()}).strict()).max(Io),log:c.array(c.object({phase:c.nativeEnum(Zh),text:c.string()}).strict()).max(E2),recipe:c.object({files:c.array(c.object({path:c.string().min(1),content:c.string()}).strict()).max(Io),blockers:c.array(c.object({component:c.string(),problem:c.string(),evidence:c.string(),fix:c.string()}).strict()).max(Io)}).strict().optional()}).strict(),C2=c.object({schemaVersion:c.literal(1),context:y2.nullable()}).strict(),I2=c.object({schemaVersion:c.literal(1),configuration:c.object({captureId:rt,revision:an.nullable(),hash:It}).strict(),capture:c.object({schemaVersion:c.literal(1),settings:c.object({target:c.object({environment:c.unknown()}).passthrough(),timeoutMinutes:c.number().int().positive(),answerWaitMinutes:c.number().int().positive().optional(),testEnvironment:c.object({name:c.string().min(1),address:c.string().min(1).optional(),readyWhen:c.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:c.object({}).passthrough(),hash:It}).strict()}).strict(),B2=Co.extend({version:c.number().int().positive(),components:c.array(c.object({name:c.string().min(1),repository:c.string().min(1)}).strict()),contentHash:It.optional(),files:c.array(c.object({path:c.string().refine(e=>ic(e)&&!Jh.includes(e),"not a file of a customer_deployed plan"),content:c.string()}).strict()).optional()}).strict(),Q2=c.object({schemaVersion:c.literal(1),testEnvironment:B2.nullable().optional(),runtimePlan:c.object({version:c.number().int().positive(),contentHash:It,files:c.array(c.object({path:c.string().refine(ic,"not a recipe file path"),content:c.string()}).strict()).min(1),repository:ll.optional(),recipeRepository:ll.optional(),recipe:c.record(c.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),NS=c.object({schemaVersion:c.literal(1),state:c.nativeEnum(lS),ending:c.nativeEnum(Ac).nullable(),cause:c.nativeEnum(uc).nullable(),deadlineAt:c.string().datetime()}).strict();function FS(e,t){return e.state==="ended"?e.ending==="cancelled"?"cancelled":e.cause==="runner_lost"?"expired":"ended":t.getTime()>=Date.parse(e.deadlineAt)?"expired":null}o(FS,"attemptClosure");var MS=50,k8=c.object({repository:Vn,revisions:c.array(c.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:c.array(c.string().min(1)).min(1).max(MS)}).strict();function Yh(e){if(typeof e=="number"&&!Number.isFinite(e))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(e))return`[${e.map(Yh).join(",")}]`;if(e!==null&&typeof e=="object"){let n=e;return`{${Object.keys(n).sort().map(r=>`${JSON.stringify(r)}:${Yh(n[r])}`).join(",")}}`}let t=JSON.stringify(e);if(t===void 0)throw new TypeError("Canonical JSON requires JSON values");return t}o(Yh,"canonicalJson");function US(e){return(0,AS.createHash)("sha256").update(Yh(e),"utf8").digest("hex")}o(US,"manifestHash");var hl=o(e=>({provider:e.provider,providerAccountId:e.providerAccountId,providerRepositoryId:e.providerRepositoryId}),"toSourceRef");function rf(e,t,{statedPins:n=!0}={}){return _H.parse({schemaVersion:1,runId:e,execution:t.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{},...t.runSettingsFromApp?{runSettings:!0}:{},credentialRelay:!0})}o(rf,"handshakeRequest");function LS(e){let t=UH.parse(e);if(US(t.manifest)!==t.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return t}o(LS,"parseHandshakeResponse");function w2(e){let t=o(n=>n.map(r=>({repository:hl(r.repository),number:r.number,...r.commitSha===void 0?{}:{commitSha:r.commitSha}})),"pullRequests");return e.status==="delivered"?{status:e.status,pullRequests:t(e.pullRequests)}:e.status==="partial"?{status:e.status,pullRequests:t(e.pullRequests),failures:e.failures.map(n=>({repository:hl(n.repository),message:n.message}))}:e}o(w2,"toDelivery");function b2(e){return e.issues.map(t=>`${t.path.map((r,s)=>typeof r=="number"?`[${r}]`:s===0?r:`.${r}`).join("")}: ${t.message}`).join("; ")}o(b2,"describeIssues");function _S(e){let{manifest:t}=e;if(RH.includes(t.trigger.kind))throw new Error(`The report upload is invalid: a ${t.trigger.kind} run uploads its SUT recipe, never a report`);if(t.trigger.kind==="revision_read")throw new Error("The report upload is invalid: a revision_read run uploads what each component runs, never a report");if(e.firstQualification&&!t.baseline?.sources)throw new Error("The report upload is invalid: only a run whose manifest names baseline sources can be a first qualification");let n=bS.safeParse({schemaVersion:1,run:{runId:t.runId,attemptNumber:e.attemptNumber,manifestHash:US(t)},target:{id:t.target.id,revision:t.target.revision},policy:t.policy&&{id:t.policy.id,revision:t.policy.revision},provenance:{sources:e.checkedOut.map(r=>({repository:hl(r.repository),revision:r.revision})),...e.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:w2(e.generatedTests)},producer:e.producer,report:e.report,...e.githubWrites?.length?{githubWrites:e.githubWrites.map(r=>({...r,repository:hl(r.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${b2(n.error)}`);return R2(n.data,t,e.checkedOut),n.data}o(_S,"buildReportUpload");function R2(e,t,n){let r=o(i=>n.find(a=>dr(a.repository)===dr(i.repository))?.revision??i.revision,"revisionOf"),s=new Map(t.sources.map(i=>[`${i.repository.namespace}/${i.repository.name}`.toLowerCase(),r(i)]));e.report.validation.acceptedEvidence.forEach((i,a)=>{let A=`report.validation.acceptedEvidence[${a}]`,u=s.get(i.repository.toLowerCase());if(!u)throw new Error(`${A}.repository: ${i.repository} is outside the run's snapshot`);if(i.revision!==u)throw new Error(`${A}.revision: evidence is not from the checked-out revision ${u}`)})}o(R2,"assertEvidenceFromSnapshot");function $S(e){return e.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:e.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:e.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:e.mergeConflict&&cS(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict}:{schemaVersion:1,reason:"no_report",cause:cS({...e,mergeConflict:void 0})}}o($S,"attemptEndFor");function cS(e){return e.runnerProviderNotReady?"runner_provider_not_ready":e.credentialMissing?"credential_missing":e.mergeConflict?"merge_conflict":e.checkoutFailed?"checkout_failed":e.environmentUnverified?"environment_unverified":e.setupFailed?"setup_failed":e.timedOut?"timed_out":e.modelProviderDenied?"model_provider_denied":e.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}o(cS,"noReportCause");var Jr=fe(require("path"));var D8={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var sf=o(e=>new Map((e??[]).flatMap(t=>t.file?[[rc(t.key),t.file.name]]:[])),"itemNames"),S2=10*1024*1024,k2=o(e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","needsExtraction"),OS=o((e,t)=>Jr.join(Jr.dirname(e),`${Jr.basename(e,Jr.extname(e))}${t}`),"besideFile"),v2=o(e=>OS(e,".extracted.txt"),"extractedTextPath");var x2=o(e=>OS(e,".quotes.txt"),"confirmedQuotesPath");function GS(e){return k2(e.file)?v2(e.path):e.file?.mediaType==="application/pdf"?x2(e.path):e.path}o(GS,"itemTextPath");var lc=o(e=>e.slice(0,12),"shortCommit");var T2=["generate-unit","native-run"],_8=["preflight","plan","write",...T2,"report","deliver"];var Ql=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(Ql||{});var dc=fe(require("fs")),pc=fe(require("path"));var D2=8;function ht(e,t,n={}){let r=t.slice(0,D2),s=t.length-r.length;return{name:e,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}o(ht,"fail");function Zs(e){if(dc.existsSync(e))try{return JSON.parse(dc.readFileSync(e,"utf-8"))}catch{return}}o(Zs,"readJsonFile");function $e(e,t){return Zs(pc.join(e.outputsDir,t))}o($e,"readArtifact");function cn(e,t){return{name:e,verify(n,r){let{errors:s}=t(n,r);return s.length===0?{name:this.name,passed:!0}:ht(this.name,s,{fatal:!0})}}}o(cn,"schemaGate");function gc(e){return e.replace(/\s+/g," ").trim()}o(gc,"normalizeCode");var wl=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var VS=require("child_process");var hc=fe(require("path"));var Yr="Skyramp Testbot",Xs="test-bot@skyramp.dev";var N2=o((e,t)=>(0,VS.execFileSync)("git",t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim(),"git");function HS(e){let t="";try{t=N2(e,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(t);return n&&!t.startsWith("/")&&!t.startsWith(".")?`${n[1]}/${n[2]}`:`local/${hc.basename(hc.resolve(e)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}o(HS,"repositorySlug");var z8=new Set(Object.values(jr));var K8=c.object({checks:c.array(c.object({repository:c.string().optional(),name:c.string().min(1),headSha:c.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:c.string().default("completed"),conclusion:c.string().nullable().optional(),url:c.string().optional(),summary:c.string().optional()}))});var of=new Map;function F2(e){return e.repositorySlug?e.repositorySlug:(of.has(e.repositoryPath)||of.set(e.repositoryPath,HS(e.repositoryPath)),of.get(e.repositoryPath))}o(F2,"workingSlug");function wn(e){return[{slug:F2(e),path:e.repositoryPath,writable:!0,working:!0},...(e.relatedRepos??[]).map(t=>({slug:t.slug,path:t.path,writable:t.writable===!0,working:!1}))]}o(wn,"runSources");var af=o((e,t)=>e.toLowerCase()===t.toLowerCase(),"sameSlug");function cf(e,t){return t?.trim()?e.find(n=>af(n.slug,t.trim())):e[0]}o(cf,"findSource");function Qo(e,t){return cf(wn(e),t)}o(Qo,"resolveSource");var M2=o((e,t)=>`${t} is not a repository of this run (${wn(e).map(n=>n.slug).join(", ")})`,"notARepository");function fc(e,t){let n=Qo(e,t);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${wn(e).filter(r=>r.writable).map(r=>r.slug).join(", ")}`}:{error:M2(e,t)}}o(fc,"writableSource");var mc=(n=>(n.Full="full",n.Static="static",n))(mc||{}),Wr=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(Wr||{}),Ec=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(Ec||{}),zr=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(zr||{}),bl=(d=>(d.Equals="equals",d.NotEquals="not_equals",d.GreaterThan="greater_than",d.LessThan="less_than",d.Contains="contains",d.NotContains="not_contains",d.Matches="matches",d.Absent="absent",d.Present="present",d))(bl||{});var jt=c.string().trim().min(1),L2=c.object({subject:jt.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:c.nativeEnum(bl),value:c.union([c.string(),c.number(),c.boolean(),c.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),_2=c.object({test:jt.describe("existing test path, relative to its repository"),repository:jt.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:c.nativeEnum(zr),evidence:jt.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:c.array(c.string()).optional().describe("analyze behavior ids this maintenance covers")});var $2=c.object({surface:jt.describe("a surface from the list, copied verbatim"),axis:c.nativeEnum(Ec)}),P2=c.object({id:jt.describe("short-slug, unique across generate[]"),type:c.nativeEnum(Wr),target:jt.describe('"METHOD /path", or a business-flow name'),from_finding:c.string().optional().describe("analyze finding id this case catches"),from_behavior:c.string().optional().describe("analyze behavior id this case pins"),derived_from:$2.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:jt.describe("why this test matters"),expected_observable:jt.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:L2.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:jt.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:c.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),O2=c.object({covered:c.array(c.string()).optional(),abstain:c.string().optional()}).superRefine((e,t)=>{let n=Array.isArray(e.covered),r=typeof e.abstain=="string";if(n===r)return void t.addIssue({code:c.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&e.covered.length===0&&t.addIssue({code:c.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!e.abstain.trim()&&t.addIssue({code:c.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),G2=c.object({surface:jt.describe("a surface from the list, copied verbatim"),axes:c.object(Object.fromEntries(Object.values(Ec).map(e=>[e,O2])))}),qS=c.object({schemaVersion:c.literal(1),mode:c.nativeEnum(mc),maintenance:c.array(_2),generate:c.array(P2),surfaces:c.array(G2).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:c.object({total:c.number().describe("case count"),rationale:jt}),summary:jt.describe("one paragraph")});var Kr=["-c","core.fsmonitor=false"],V2=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),Af=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function Jt(e=process.env,t,n="repo-command"){let r={};for(let[s,i]of Object.entries(e))n==="repo-command"&&Af.has(s)||(r[s]=i);Object.assign(r,t??{});for(let s of Object.keys(r))(V2.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}o(Jt,"untrustedChildEnv");var H2=".skyramp/sut/deployed-revisions.sh",uf=(n=>(n.Running="running",n.Requested="requested",n))(uf||{});var g3=new Set(Object.values(uf));var h3=`Fix ${H2} so it prints the full commit each component runs, then set it up again.`;var yc="shared-environment";var v3=64*1024;var x3=new Set(["version_endpoint","api"]);function lf(e){return(e?.components??[]).filter(t=>!!t.repository&&!!t.expectedRevision)}o(lf,"verifiableComponents");var jS=o((e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase(),"sameRepository"),j2=o((e,t)=>e.name===t.name&&jS(e.repository,t.repository),"sameComponent");function JS(e){return lf(e).length>0||(e?.dependencies.length??0)>0}o(JS,"hasSharedSystem");function YS(e){let t=e.inputs?.sharedEnvironment;if(!JS(t))return;let n=$e(e,`${yc}.json`);if(n)return{components:zS(t,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:lf(t).map(s=>WS(s,r)),dependencies:t.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}o(YS,"sharedSystem");var WS=o((e,t)=>({name:e.name,repository:e.repository,url:e.url,expectedRevision:e.expectedRevision,observedRevision:null,status:"unverifiable",source:e.revisionUrl||e.revisionScript?"probe":"agent",evidence:t}),"unrecordedRow");function zS(e,t){let n=new Set(t.map(s=>s.name.toLowerCase())),r=lf(e).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...t,...r.map(s=>WS(s,"Not checked: the run recorded no read of it."))]}o(zS,"withUnrecordedTouched");function df(e){return(YS(e)?.components??[]).filter(t=>t.status!=="verified")}o(df,"unverifiedComponents");function pf(e,t,n){if(!e.appRunning||n===!1)return[];let r=(e.sharedEnvironment?.components??[]).filter(s=>s.touched);return zS(e.sharedEnvironment,t?.components??[]).filter(s=>s.status!=="verified"&&r.some(i=>j2(i,s)))}o(pf,"blockingComponents");function KS(e){let t=o(n=>{let r=`${n.name} (${n.repository}) must run ${lc(n.expectedRevision)}`;if(n.observedRevision&&n.expectedRevision&&(n.observedRevision.startsWith(n.expectedRevision)||n.expectedRevision.startsWith(n.observedRevision)))return`${r}: ${n.evidence}`;let s=n.observedRevision?`runs ${lc(n.observedRevision)}`:"no revision could be read";return`${r}, but ${s}: ${n.evidence}`},"text");return e.length?`the Test Environment does not verifiably run the change: ${e.map(t).join("; ")}`:void 0}o(KS,"blockReason");function gf(e){return(e?.components??[]).filter(t=>!!t.repository&&!t.expectedRevision)}o(gf,"unfrozenComponents");var xc=fe(require("path"));function ct(e,t=[]){let n=e.trim();if(!n)return{error:"session produced no output"};let r=o(u=>{try{let d=JSON.parse(u);return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:void 0}catch{return}},"tryParse"),s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(u){i=u instanceof Error?u.message:String(u)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let u=a.length-1;u>=0;u--){let d=r(a[u][1].trim());if(d!==void 0)return{value:d}}let A;for(let u=n.indexOf("{");u!==-1;u=n.indexOf("{",u+1)){let d=0,p=!1,g=!1;for(let f=u;f<n.length;f++){let m=n[f];if(g){g=!1;continue}if(m==="\\"){g=p;continue}if(m==='"'){p=!p;continue}if(!p){if(m==="{")d++;else if(m==="}"&&(d--,d===0)){let E=r(n.slice(u,f+1));E!==void 0&&Object.keys(E).length>0&&(A=E,u=f);break}}}}return i&&(A===void 0||Object.keys(A).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:A!==void 0?{value:A}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${J2(ir(n,t))}"`}}o(ct,"extractJsonObject");var ZS=240;function J2(e){let t=e.replace(/\s+/g," ").trim();return t.length<=ZS?t:`\u2026${t.slice(-ZS)}`}o(J2,"snippetOf");function Y2(e){return e.issues.map(t=>{let n=t.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(t.message))return`${r} ${t.message}`;switch(t.code){case"invalid_type":return n?t.expected==="object"?`${r} must be an object`:t.received==="undefined"?`${r} is required`:`${r} must be ${t.expected}, got ${t.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(t.received),i=t.options.find(A=>typeof A=="string"&&typeof t.received=="string"&&t.received.startsWith(A)),a=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${t.options.join(", ")}${a}`}case"invalid_literal":return`${r} must be ${JSON.stringify(t.expected)}`;case"too_small":return t.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${t.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${t.keys.join(", ")}`;default:return`${r}: ${t.message}`}})}o(Y2,"issuesToMessages");function Yt(e,t){let n=e.safeParse(t);if(n.success)return{value:n.data,errors:[]};let r=o((i,a)=>a.reduce((A,u)=>A&&typeof A=="object"?A[u]:void 0,i),"at"),s=n.error.issues.filter(i=>i.path.length&&r(t,i.path)===null);if(s.length===n.error.issues.length)try{let i=e.safeParse(s.reduce((a,{path:A})=>XS(a,A),t));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:Y2(n.error)}}o(Yt,"validateWith");function XS(e,t){if(!t.length||!e||typeof e!="object")return e;let[n,...r]=t,s=Array.isArray(e)?e.slice():{...e};return r.length?s[n]=XS(s[n],r):delete s[n],s}o(XS,"withoutAt");function hf(e){let t=e.split(/[\\/]/)[0];return t===".skyramp"||t===".testbot"}o(hf,"inUnshippedFolder");var pr=fe(require("path"));var tk=require("child_process");var ek=[".skyramp/sut",".skyramp/workspace.yml"];var W2=256*1024*1024,z2=3e4;function nk(e,t,n=z2){let r=(0,tk.spawnSync)("git",[...Kr,...t],{env:Jt(),cwd:e,encoding:"utf-8",timeout:n,maxBuffer:W2});return r.status===0?r.stdout.trimEnd():void 0}o(nk,"git");var K3=["--",":/",...ek.map(e=>`:(exclude)${e}`)],rk="--literal-pathspecs";function sk(e,t){return!!nk(e,[rk,"status","--porcelain","--",t])}o(sk,"pathChanged");function ff(e,t){return/ blob /.test(nk(e,[rk,"ls-tree","HEAD","--",t])??"")}o(ff,"fileAtHead");var Qc=fe(require("fs")),Ue=fe(require("path"));function K2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(K2,"getDefaultExportFromCjs");var ft={},Rl={},Zr={},ik;function Cc(){if(ik)return Zr;ik=1;function e(a){return typeof a>"u"||a===null}o(e,"isNothing");function t(a){return typeof a=="object"&&a!==null}o(t,"isObject");function n(a){return Array.isArray(a)?a:e(a)?[]:[a]}o(n,"toArray");function r(a,A){if(A){let u=Object.keys(A);for(let d=0,p=u.length;d<p;d+=1){let g=u[d];a[g]=A[g]}}return a}o(r,"extend");function s(a,A){let u="";for(let d=0;d<A;d+=1)u+=a;return u}o(s,"repeat");function i(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return o(i,"isNegativeZero"),Zr.isNothing=e,Zr.isObject=t,Zr.toArray=n,Zr.repeat=s,Zr.isNegativeZero=i,Zr.extend=r,Zr}o(Cc,"requireCommon");var mf,ok;function Ic(){if(ok)return mf;ok=1;function e(n,r){let s="",i=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(s+='in "'+n.mark.name+'" '),s+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!r&&n.mark.snippet&&(s+=`
|
|
57
57
|
|
|
58
58
|
`+n.mark.snippet),i+" "+s):i}o(e,"formatError");function t(n,r){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=r,this.message=e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return o(t,"YAMLException2"),t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.prototype.toString=o(function(r){return this.name+": "+e(this,r)},"toString"),mf=t,mf}o(Ic,"requireException");var Ef,ak;function Z2(){if(ak)return Ef;ak=1;let e=Cc();function t(s,i,a,A,u){let d="",p="",g=Math.floor(u/2)-1;return A-i>g&&(d=" ... ",i=A-g+d.length),a-A>g&&(p=" ...",a=A+g-p.length),{str:d+s.slice(i,a).replace(/\t/g,"\u2192")+p,pos:A-i+d.length}}o(t,"getLine");function n(s,i){return e.repeat(" ",i-s.length)+s}o(n,"padStart");function r(s,i){if(i=Object.create(i||null),!s.buffer)return null;i.maxLength||(i.maxLength=79),typeof i.indent!="number"&&(i.indent=1),typeof i.linesBefore!="number"&&(i.linesBefore=3),typeof i.linesAfter!="number"&&(i.linesAfter=2);let a=/\r?\n|\r|\0/g,A=[0],u=[],d,p=-1;for(;d=a.exec(s.buffer);)u.push(d.index),A.push(d.index+d[0].length),s.position<=d.index&&p<0&&(p=A.length-2);p<0&&(p=A.length-1);let g="",f=Math.min(s.line+i.linesAfter,u.length).toString().length,m=i.maxLength-(i.indent+f+3);for(let I=1;I<=i.linesBefore&&!(p-I<0);I++){let k=t(s.buffer,A[p-I],u[p-I],s.position-(A[p]-A[p-I]),m);g=e.repeat(" ",i.indent)+n((s.line-I+1).toString(),f)+" | "+k.str+`
|
|
59
59
|
`+g}let E=t(s.buffer,A[p],u[p],s.position,m);g+=e.repeat(" ",i.indent)+n((s.line+1).toString(),f)+" | "+E.str+`
|