@skyramp/testbot-core 0.13.3-v3.554 → 0.13.3-v3.556

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.
@@ -139,7 +139,7 @@ ${i}
139
139
  `),`
140
140
  `,t)}o(Lj,"boundedFailureText");function ha(e){return no(Vie(e),[]).trim()}o(ha,"commandFailureText");var zie=/^(.*?:\s*)?Command failed: (?:git|gh)\b.*$/;function sp(e,t=qh){let[n="",...i]=e.split(`
141
141
  `).map(a=>a.trim()).filter(Boolean),r=i.length?zie.exec(n):null,s=r?[`${r[1]??""}${i[0]}`,...i.slice(1)]:[n,...i];return Mj(s," ",t,Math.floor(t*2/3))}o(sp,"failureReason");function yu(e){return e.replace(new RegExp("\x1B\\[[0-9;]*m","g"),"")}o(yu,"stripAnsi");function qie(e){let t=/^(yarn run v|info Visit|error Command failed|npm ERR!|husky\b|\$ )/i,n=yu(e).split(`
142
- `).map(a=>a.trim()).filter(Boolean),i=n.filter(a=>!t.test(a)),r=i.length?i:n;return[...r].reverse().find(a=>/(error|warning|problem|✖|✗|✘|fail|not listed|cannot|denied)/i.test(a))??r[r.length-1]??"(no output)"}o(qie,"hookSummary");function jj(e){if(!/\bhook\b|husky|pre-commit|lint-staged/i.test(e))return;let t=qie(e),n=ue().staged.commitHook(/husky\s*[->]\s*([\w-]+)\s+(?:script|hook)\b/i.exec(yu(e))?.[1]);return/\(code 127\)|exit code 127/i.test(e)||/command not found|: not found$/i.test(t)?ue().staged.commitHookCouldNotRun(n,t):ue().staged.commitRefusedByHook(n,t)}o(jj,"hookRefusal");var d={};ei(d,{BRAND:()=>yse,DIRTY:()=>ma,EMPTY_PATH:()=>Wie,INVALID:()=>Ce,NEVER:()=>noe,OK:()=>vn,ParseStatus:()=>un,Schema:()=>Ve,ZodAny:()=>so,ZodArray:()=>As,ZodBigInt:()=>Ea,ZodBoolean:()=>ba,ZodBranded:()=>ap,ZodCatch:()=>$a,ZodDate:()=>va,ZodDefault:()=>Qa,ZodDiscriminatedUnion:()=>Yh,ZodEffects:()=>Mr,ZodEnum:()=>Ra,ZodError:()=>Wn,ZodFirstPartyTypeKind:()=>xe,ZodFunction:()=>Zh,ZodIntersection:()=>Sa,ZodIssueCode:()=>G,ZodLazy:()=>ka,ZodLiteral:()=>Ba,ZodMap:()=>Cu,ZodNaN:()=>ku,ZodNativeEnum:()=>xa,ZodNever:()=>li,ZodNull:()=>wa,ZodNullable:()=>Pi,ZodNumber:()=>ya,ZodObject:()=>Zn,ZodOptional:()=>Fr,ZodParsedType:()=>re,ZodPipeline:()=>cp,ZodPromise:()=>oo,ZodReadonly:()=>Ta,ZodRecord:()=>Wh,ZodSchema:()=>Ve,ZodSet:()=>Su,ZodString:()=>io,ZodSymbol:()=>Iu,ZodTransformer:()=>Mr,ZodTuple:()=>Ni,ZodType:()=>Ve,ZodUndefined:()=>Ia,ZodUnion:()=>Ca,ZodUnknown:()=>gs,ZodVoid:()=>wu,addIssueToContext:()=>X,any:()=>Bse,array:()=>$se,bigint:()=>Ise,boolean:()=>Xj,coerce:()=>toe,custom:()=>Wj,date:()=>wse,datetimeRegex:()=>Jj,defaultErrorMap:()=>ps,discriminatedUnion:()=>Nse,effect:()=>Hse,enum:()=>Vse,function:()=>Lse,getErrorMap:()=>Eu,getParsedType:()=>_i,instanceof:()=>bse,intersection:()=>Pse,isAborted:()=>Hh,isAsync:()=>bu,isDirty:()=>Jh,isValid:()=>ro,late:()=>Ese,lazy:()=>jse,literal:()=>Gse,makeIssue:()=>op,map:()=>Ose,nan:()=>vse,nativeEnum:()=>zse,never:()=>xse,null:()=>kse,nullable:()=>Yse,number:()=>Kj,object:()=>Tse,objectUtil:()=>BC,oboolean:()=>eoe,onumber:()=>Xse,optional:()=>Jse,ostring:()=>Kse,pipeline:()=>Zse,preprocess:()=>Wse,promise:()=>qse,quotelessJson:()=>Hie,record:()=>Fse,set:()=>Mse,setErrorMap:()=>Yie,strictObject:()=>Dse,string:()=>Zj,symbol:()=>Cse,transformer:()=>Hse,tuple:()=>Use,undefined:()=>Sse,union:()=>_se,unknown:()=>Rse,util:()=>Ye,void:()=>Qse});var Ye;(function(e){e.assertEqual=r=>{};function t(r){}o(t,"assertIs"),e.assertIs=t;function n(r){throw new Error}o(n,"assertNever"),e.assertNever=n,e.arrayToEnum=r=>{let s={};for(let a of r)s[a]=a;return s},e.getValidEnumValues=r=>{let s=e.objectKeys(r).filter(c=>typeof r[r[c]]!="number"),a={};for(let c of s)a[c]=r[c];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(s){return r[s]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&s.push(a);return s},e.find=(r,s)=>{for(let a of r)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}o(i,"joinValues"),e.joinValues=i,e.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Ye||(Ye={}));var BC;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(BC||(BC={}));var re=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_i=o(e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return Number.isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.unknown}},"getParsedType");var G=Ye.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"]),Hie=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Wn=class e extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};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(s){return s.message},i={_errors:[]},r=o(s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let c=i,u=0;for(;u<a.path.length;){let l=a.path[u],p=u===a.path.length-1;if(l==="_errors"){p&&c._errors.push(n(a)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||(l==="__proto__"?Object.defineProperty(c,l,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[l]={_errors:[]}),c=c[l],p&&c._errors.push(n(a)),u++}}},"processError");return r(this),i}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,Ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),i=[];for(let r of this.issues)if(r.path.length>0){let s=r.path[0];n[s]=n[s]||[],n[s].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};Wn.create=e=>new Wn(e);var Jie=o((e,t)=>{let n;switch(e.code){case G.invalid_type:e.received===re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ye.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ye.joinValues(e.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ye.joinValues(e.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${Ye.joinValues(e.options)}, received '${e.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.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}"`:Ye.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case G.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 G.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 G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ye.assertNever(e)}return{message:n}},"errorMap"),ps=Jie;var Gj=ps;function Yie(e){Gj=e}o(Yie,"setErrorMap");function Eu(){return Gj}o(Eu,"getErrorMap");var op=o(e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,s=[...n,...r.path||[]],a={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let c="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)c=l(a,{data:t,defaultError:c}).message;return{...r,path:s,message:c}},"makeIssue"),Wie=[];function X(e,t){let n=Eu(),i=op({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ps?void 0:ps].filter(r=>!!r)});e.common.issues.push(i)}o(X,"addIssueToContext");var un=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 i=[];for(let r of n){if(r.status==="aborted")return Ce;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let s=await r.key,a=await r.value;i.push({key:s,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:s,value:a}=r;if(s.status==="aborted"||a.status==="aborted")return Ce;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[s.value]=a.value)}return{status:t.value,value:i}}},Ce=Object.freeze({status:"aborted"}),ma=o(e=>({status:"dirty",value:e}),"DIRTY"),vn=o(e=>({status:"valid",value:e}),"OK"),Hh=o(e=>e.status==="aborted","isAborted"),Jh=o(e=>e.status==="dirty","isDirty"),ro=o(e=>e.status==="valid","isValid"),bu=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");var de;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(de||(de={}));var Or=class{static{o(this,"ParseInputLazyPath")}constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}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}},Vj=o((e,t)=>{if(ro(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 Wn(e.common.issues);return this._error=n,this._error}}},"handleResult");function Fe(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:o((a,c)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??i??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},"customMap"),description:r}}o(Fe,"processCreateParams");var Ve=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(t){return _i(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:_i(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new un,ctx:{common:t.parent.common,data:t.data,parsedType:_i(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(bu(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 i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_i(t)},r=this._parseSync({data:t,path:i.path,parent:i});return Vj(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_i(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return ro(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>ro(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_i(t)},r=this._parse({data:t,path:i.path,parent:i}),s=await(bu(r)?r:Promise.resolve(r));return Vj(i,s)}refine(t,n){let i=o(r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n,"getIssueProperties");return this._refinement((r,s)=>{let a=t(r),c=o(()=>s.addIssue({code:G.custom,...i(r)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Mr({schema:this,typeName:xe.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 Fr.create(this,this._def)}nullable(){return Pi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return As.create(this)}promise(){return oo.create(this,this._def)}or(t){return Ca.create([this,t],this._def)}and(t){return Sa.create(this,t,this._def)}transform(t){return new Mr({...Fe(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Qa({...Fe(this._def),innerType:this,defaultValue:n,typeName:xe.ZodDefault})}brand(){return new ap({typeName:xe.ZodBranded,type:this,...Fe(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new $a({...Fe(this._def),innerType:this,catchValue:n,typeName:xe.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return cp.create(this,t)}readonly(){return Ta.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Zie=/^c[^\s-]{8,}$/i,Kie=/^[0-9a-z]+$/,Xie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ese=/^[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,tse=/^[a-z0-9_-]{21}$/i,nse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rse=/^[-+]?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)?)??$/,ise=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sse="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",RC,ose=/^(?:(?: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])$/,ase=/^(?:(?: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])$/,cse=/^(([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]))$/,use=/^(([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])$/,lse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dse=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qj="((\\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])))",pse=new RegExp(`^${qj}$`);function Hj(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(Hj,"timeRegexSource");function fse(e){return new RegExp(`^${Hj(e)}$`)}o(fse,"timeRegex");function Jj(e){let t=`${qj}T${Hj(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(Jj,"datetimeRegex");function gse(e,t){return!!((t==="v4"||!t)&&ose.test(e)||(t==="v6"||!t)&&cse.test(e))}o(gse,"isValidIP");function Ase(e,t){if(!nse.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}o(Ase,"isValidJWT");function hse(e,t){return!!((t==="v4"||!t)&&ase.test(e)||(t==="v6"||!t)&&use.test(e))}o(hse,"isValidCidr");var io=class e extends Ve{static{o(this,"ZodString")}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){let s=this._getOrReturnCtx(t);return X(s,{code:G.invalid_type,expected:re.string,received:s.parsedType}),Ce}let i=new un,r;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),X(r,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),X(r,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){let a=t.data.length>s.value,c=t.data.length<s.value;(a||c)&&(r=this._getOrReturnCtx(t,r),a?X(r,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&X(r,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")ise.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"email",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")RC||(RC=new RegExp(sse,"u")),RC.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"emoji",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")ese.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"uuid",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")tse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"nanoid",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")Zie.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"cuid",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")Kie.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"cuid2",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")Xie.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"ulid",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),X(r,{validation:"url",code:G.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"regex",code:G.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?Jj(s).test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?pse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?fse(s).test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?rse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"duration",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?gse(t.data,s.version)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"ip",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?Ase(t.data,s.alg)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"jwt",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?hse(t.data,s.version)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"cidr",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?lse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"base64",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?dse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"base64url",code:G.invalid_string,message:s.message}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:G.invalid_string,...de.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...de.errToObj(t)})}url(t){return this._addCheck({kind:"url",...de.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...de.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...de.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...de.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...de.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...de.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...de.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...de.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...de.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...de.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...de.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...de.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,...de.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,...de.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...de.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...de.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...de.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...de.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...de.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...de.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...de.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...de.errToObj(n)})}nonempty(t){return this.min(1,de.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}};io.create=e=>new io({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...Fe(e)});function mse(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(e.toFixed(r).replace(".","")),a=Number.parseInt(t.toFixed(r).replace(".",""));return s%a/10**r}o(mse,"floatSafeRemainder");var ya=class e extends Ve{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)!==re.number){let s=this._getOrReturnCtx(t);return X(s,{code:G.invalid_type,expected:re.number,received:s.parsedType}),Ce}let i,r=new un;for(let s of this._def.checks)s.kind==="int"?Ye.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:G.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?mse(t.data,s.value)!==0&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:G.not_finite,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,de.toString(n))}gt(t,n){return this.setLimit("min",t,!1,de.toString(n))}lte(t,n){return this.setLimit("max",t,!0,de.toString(n))}lt(t,n){return this.setLimit("max",t,!1,de.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:de.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:de.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:de.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:de.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:de.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:de.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:de.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"&&Ye.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};ya.create=e=>new ya({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...Fe(e)});var Ea=class e extends Ve{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)!==re.bigint)return this._getInvalidInput(t);let i,r=new un;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return X(n,{code:G.invalid_type,expected:re.bigint,received:n.parsedType}),Ce}gte(t,n){return this.setLimit("min",t,!0,de.toString(n))}gt(t,n){return this.setLimit("min",t,!1,de.toString(n))}lte(t,n){return this.setLimit("max",t,!0,de.toString(n))}lt(t,n){return this.setLimit("max",t,!1,de.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:de.toString(r)}]})}_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:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:de.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:de.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}};Ea.create=e=>new Ea({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...Fe(e)});var ba=class extends Ve{static{o(this,"ZodBoolean")}_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==re.boolean){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.boolean,received:i.parsedType}),Ce}return vn(t.data)}};ba.create=e=>new ba({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...Fe(e)});var va=class e extends Ve{static{o(this,"ZodDate")}_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){let s=this._getOrReturnCtx(t);return X(s,{code:G.invalid_type,expected:re.date,received:s.parsedType}),Ce}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return X(s,{code:G.invalid_date}),Ce}let i=new un,r;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),X(r,{code:G.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),X(r,{code:G.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Ye.assertNever(s);return{status:i.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:de.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:de.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}};va.create=e=>new va({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...Fe(e)});var Iu=class extends Ve{static{o(this,"ZodSymbol")}_parse(t){if(this._getType(t)!==re.symbol){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.symbol,received:i.parsedType}),Ce}return vn(t.data)}};Iu.create=e=>new Iu({typeName:xe.ZodSymbol,...Fe(e)});var Ia=class extends Ve{static{o(this,"ZodUndefined")}_parse(t){if(this._getType(t)!==re.undefined){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.undefined,received:i.parsedType}),Ce}return vn(t.data)}};Ia.create=e=>new Ia({typeName:xe.ZodUndefined,...Fe(e)});var wa=class extends Ve{static{o(this,"ZodNull")}_parse(t){if(this._getType(t)!==re.null){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.null,received:i.parsedType}),Ce}return vn(t.data)}};wa.create=e=>new wa({typeName:xe.ZodNull,...Fe(e)});var so=class extends Ve{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(t){return vn(t.data)}};so.create=e=>new so({typeName:xe.ZodAny,...Fe(e)});var gs=class extends Ve{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(t){return vn(t.data)}};gs.create=e=>new gs({typeName:xe.ZodUnknown,...Fe(e)});var li=class extends Ve{static{o(this,"ZodNever")}_parse(t){let n=this._getOrReturnCtx(t);return X(n,{code:G.invalid_type,expected:re.never,received:n.parsedType}),Ce}};li.create=e=>new li({typeName:xe.ZodNever,...Fe(e)});var wu=class extends Ve{static{o(this,"ZodVoid")}_parse(t){if(this._getType(t)!==re.undefined){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.void,received:i.parsedType}),Ce}return vn(t.data)}};wu.create=e=>new wu({typeName:xe.ZodVoid,...Fe(e)});var As=class e extends Ve{static{o(this,"ZodArray")}_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==re.array)return X(n,{code:G.invalid_type,expected:re.array,received:n.parsedType}),Ce;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,c=n.data.length<r.exactLength.value;(a||c)&&(X(n,{code:a?G.too_big:G.too_small,minimum:c?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(X(n,{code:G.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(X(n,{code:G.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>r.type._parseAsync(new Or(n,a,n.path,c)))).then(a=>un.mergeArray(i,a));let s=[...n.data].map((a,c)=>r.type._parseSync(new Or(n,a,n.path,c)));return un.mergeArray(i,s)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:de.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:de.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:de.toString(n)}})}nonempty(t){return this.min(1,t)}};As.create=(e,t)=>new As({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...Fe(t)});function vu(e){if(e instanceof Zn){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=Fr.create(vu(i))}return new Zn({...e._def,shape:o(()=>t,"shape")})}else return e instanceof As?new As({...e._def,type:vu(e.element)}):e instanceof Fr?Fr.create(vu(e.unwrap())):e instanceof Pi?Pi.create(vu(e.unwrap())):e instanceof Ni?Ni.create(e.items.map(t=>vu(t))):e}o(vu,"deepPartialify");var Zn=class e extends Ve{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=Ye.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==re.object){let l=this._getOrReturnCtx(t);return X(l,{code:G.invalid_type,expected:re.object,received:l.parsedType}),Ce}let{status:i,ctx:r}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof li&&this._def.unknownKeys==="strip"))for(let l in r.data)a.includes(l)||c.push(l);let u=[];for(let l of a){let p=s[l],f=r.data[l];u.push({key:{status:"valid",value:l},value:p._parse(new Or(r,f,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof li){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of c)u.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(l==="strict")c.length>0&&(X(r,{code:G.unrecognized_keys,keys:c}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of c){let f=r.data[p];u.push({key:{status:"valid",value:p},value:l._parse(new Or(r,f,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of u){let f=await p.key,A=await p.value;l.push({key:f,value:A,alwaysSet:p.alwaysSet})}return l}).then(l=>un.mergeObjectSync(i,l)):un.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(t){return de.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:o((n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:de.errToObj(t).message??r}:{message:r}},"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:xe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Ye.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:o(()=>n,"shape")})}omit(t){let n={};for(let i of Ye.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return vu(this)}partial(t){let n={};for(let i of Ye.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:o(()=>n,"shape")})}required(t){let n={};for(let i of Ye.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof Fr;)s=s._def.innerType;n[i]=s}return new e({...this._def,shape:o(()=>n,"shape")})}keyof(){return Yj(Ye.objectKeys(this.shape))}};Zn.create=(e,t)=>new Zn({shape:o(()=>e,"shape"),unknownKeys:"strip",catchall:li.create(),typeName:xe.ZodObject,...Fe(t)});Zn.strictCreate=(e,t)=>new Zn({shape:o(()=>e,"shape"),unknownKeys:"strict",catchall:li.create(),typeName:xe.ZodObject,...Fe(t)});Zn.lazycreate=(e,t)=>new Zn({shape:e,unknownKeys:"strip",catchall:li.create(),typeName:xe.ZodObject,...Fe(t)});var Ca=class extends Ve{static{o(this,"ZodUnion")}_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new Wn(c.ctx.common.issues));return X(n,{code:G.invalid_union,unionErrors:a}),Ce}if(o(r,"handleResults"),n.common.async)return Promise.all(i.map(async s=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let s,a=[];for(let u of i){let l={...n,common:{...n.common,issues:[]},parent:null},p=u._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(u=>new Wn(u));return X(n,{code:G.invalid_union,unionErrors:c}),Ce}}get options(){return this._def.options}};Ca.create=(e,t)=>new Ca({options:e,typeName:xe.ZodUnion,...Fe(t)});var fs=o(e=>e instanceof ka?fs(e.schema):e instanceof Mr?fs(e.innerType()):e instanceof Ba?[e.value]:e instanceof Ra?e.options:e instanceof xa?Ye.objectValues(e.enum):e instanceof Qa?fs(e._def.innerType):e instanceof Ia?[void 0]:e instanceof wa?[null]:e instanceof Fr?[void 0,...fs(e.unwrap())]:e instanceof Pi?[null,...fs(e.unwrap())]:e instanceof ap||e instanceof Ta?fs(e.unwrap()):e instanceof $a?fs(e._def.innerType):[],"getDiscriminator"),Yh=class e extends Ve{static{o(this,"ZodDiscriminatedUnion")}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.object)return X(n,{code:G.invalid_type,expected:re.object,received:n.parsedType}),Ce;let i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(X(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let s of n){let a=fs(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let c of a){if(r.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);r.set(c,s)}}return new e({typeName:xe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Fe(i)})}};function xC(e,t){let n=_i(e),i=_i(t);if(e===t)return{valid:!0,data:e};if(n===re.object&&i===re.object){let r=Ye.objectKeys(t),s=Ye.objectKeys(e).filter(c=>r.indexOf(c)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let c of s){if(c==="__proto__")continue;let u=xC(e[c],t[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(n===re.array&&i===re.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let s=0;s<e.length;s++){let a=e[s],c=t[s],u=xC(a,c);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return n===re.date&&i===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}o(xC,"mergeValues");var Sa=class extends Ve{static{o(this,"ZodIntersection")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=o((s,a)=>{if(Hh(s)||Hh(a))return Ce;let c=xC(s.value,a.value);return c.valid?((Jh(s)||Jh(a))&&n.dirty(),{status:n.value,value:c.data}):(X(i,{code:G.invalid_intersection_types}),Ce)},"handleParsed");return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,a])=>r(s,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Sa.create=(e,t,n)=>new Sa({left:e,right:t,typeName:xe.ZodIntersection,...Fe(n)});var Ni=class e extends Ve{static{o(this,"ZodTuple")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==re.array)return X(i,{code:G.invalid_type,expected:re.array,received:i.parsedType}),Ce;if(i.data.length<this._def.items.length)return X(i,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ce;!this._def.rest&&i.data.length>this._def.items.length&&(X(i,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...i.data].map((a,c)=>{let u=this._def.items[c]||this._def.rest;return u?u._parse(new Or(i,a,i.path,c)):null}).filter(a=>!!a);return i.common.async?Promise.all(s).then(a=>un.mergeArray(n,a)):un.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ni.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ni({items:e,typeName:xe.ZodTuple,rest:null,...Fe(t)})};var Wh=class e extends Ve{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==re.object)return X(i,{code:G.invalid_type,expected:re.object,received:i.parsedType}),Ce;let r=[],s=this._def.keyType,a=this._def.valueType;for(let c in i.data)r.push({key:s._parse(new Or(i,c,i.path,c)),value:a._parse(new Or(i,i.data[c],i.path,c)),alwaysSet:c in i.data});return i.common.async?un.mergeObjectAsync(n,r):un.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof Ve?new e({keyType:t,valueType:n,typeName:xe.ZodRecord,...Fe(i)}):new e({keyType:io.create(),valueType:t,typeName:xe.ZodRecord,...Fe(n)})}},Cu=class extends Ve{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==re.map)return X(i,{code:G.invalid_type,expected:re.map,received:i.parsedType}),Ce;let r=this._def.keyType,s=this._def.valueType,a=[...i.data.entries()].map(([c,u],l)=>({key:r._parse(new Or(i,c,i.path,[l,"key"])),value:s._parse(new Or(i,u,i.path,[l,"value"]))}));if(i.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,p=await u.value;if(l.status==="aborted"||p.status==="aborted")return Ce;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let u of a){let l=u.key,p=u.value;if(l.status==="aborted"||p.status==="aborted")return Ce;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}}}};Cu.create=(e,t,n)=>new Cu({valueType:t,keyType:e,typeName:xe.ZodMap,...Fe(n)});var Su=class e extends Ve{static{o(this,"ZodSet")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==re.set)return X(i,{code:G.invalid_type,expected:re.set,received:i.parsedType}),Ce;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(X(i,{code:G.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(X(i,{code:G.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let s=this._def.valueType;function a(u){let l=new Set;for(let p of u){if(p.status==="aborted")return Ce;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}o(a,"finalizeSet");let c=[...i.data.values()].map((u,l)=>s._parse(new Or(i,u,i.path,l)));return i.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:de.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:de.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Su.create=(e,t)=>new Su({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...Fe(t)});var Zh=class e extends Ve{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.function)return X(n,{code:G.invalid_type,expected:re.function,received:n.parsedType}),Ce;function i(c,u){return op({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Eu(),ps].filter(l=>!!l),issueData:{code:G.invalid_arguments,argumentsError:u}})}o(i,"makeArgsIssue");function r(c,u){return op({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Eu(),ps].filter(l=>!!l),issueData:{code:G.invalid_return_type,returnTypeError:u}})}o(r,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof oo){let c=this;return vn(async function(...u){let l=new Wn([]),p=await c._def.args.parseAsync(u,s).catch(h=>{throw l.addIssue(i(u,h)),l}),f=await Reflect.apply(a,this,p);return await c._def.returns._def.type.parseAsync(f,s).catch(h=>{throw l.addIssue(r(f,h)),l})})}else{let c=this;return vn(function(...u){let l=c._def.args.safeParse(u,s);if(!l.success)throw new Wn([i(u,l.error)]);let p=Reflect.apply(a,this,l.data),f=c._def.returns.safeParse(p,s);if(!f.success)throw new Wn([r(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ni.create(t).rest(gs.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,i){return new e({args:t||Ni.create([]).rest(gs.create()),returns:n||gs.create(),typeName:xe.ZodFunction,...Fe(i)})}},ka=class extends Ve{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})}};ka.create=(e,t)=>new ka({getter:e,typeName:xe.ZodLazy,...Fe(t)});var Ba=class extends Ve{static{o(this,"ZodLiteral")}_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return X(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),Ce}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ba.create=(e,t)=>new Ba({value:e,typeName:xe.ZodLiteral,...Fe(t)});function Yj(e,t){return new Ra({values:e,typeName:xe.ZodEnum,...Fe(t)})}o(Yj,"createZodEnum");var Ra=class e extends Ve{static{o(this,"ZodEnum")}_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return X(n,{expected:Ye.joinValues(i),received:n.parsedType,code:G.invalid_type}),Ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return X(n,{received:n.data,code:G.invalid_enum_value,options:i}),Ce}return vn(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(i=>!t.includes(i)),{...this._def,...n})}};Ra.create=Yj;var xa=class extends Ve{static{o(this,"ZodNativeEnum")}_parse(t){let n=Ye.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==re.string&&i.parsedType!==re.number){let r=Ye.objectValues(n);return X(i,{expected:Ye.joinValues(r),received:i.parsedType,code:G.invalid_type}),Ce}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Ye.objectValues(n);return X(i,{received:i.data,code:G.invalid_enum_value,options:r}),Ce}return vn(t.data)}get enum(){return this._def.values}};xa.create=(e,t)=>new xa({values:e,typeName:xe.ZodNativeEnum,...Fe(t)});var oo=class extends Ve{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.promise&&n.common.async===!1)return X(n,{code:G.invalid_type,expected:re.promise,received:n.parsedType}),Ce;let i=n.parsedType===re.promise?n.data:Promise.resolve(n.data);return vn(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};oo.create=(e,t)=>new oo({type:e,typeName:xe.ZodPromise,...Fe(t)});var Mr=class extends Ve{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:o(a=>{X(i,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let a=r.transform(i.data,s);if(i.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return Ce;let u=await this._def.schema._parseAsync({data:c,path:i.path,parent:i});return u.status==="aborted"?Ce:u.status==="dirty"?ma(u.value):n.value==="dirty"?ma(u.value):u});{if(n.value==="aborted")return Ce;let c=this._def.schema._parseSync({data:a,path:i.path,parent:i});return c.status==="aborted"?Ce:c.status==="dirty"?ma(c.value):n.value==="dirty"?ma(c.value):c}}if(r.type==="refinement"){let a=o(c=>{let u=r.refinement(c,s);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(i.common.async===!1){let c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?Ce:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?Ce:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!ro(a))return Ce;let c=r.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>ro(a)?Promise.resolve(r.transform(a.value,s)).then(c=>({status:n.value,value:c})):Ce);Ye.assertNever(r)}};Mr.create=(e,t,n)=>new Mr({schema:e,typeName:xe.ZodEffects,effect:t,...Fe(n)});Mr.createWithPreprocess=(e,t,n)=>new Mr({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...Fe(n)});var Fr=class extends Ve{static{o(this,"ZodOptional")}_parse(t){return this._getType(t)===re.undefined?vn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Fr.create=(e,t)=>new Fr({innerType:e,typeName:xe.ZodOptional,...Fe(t)});var Pi=class extends Ve{static{o(this,"ZodNullable")}_parse(t){return this._getType(t)===re.null?vn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Pi.create=(e,t)=>new Pi({innerType:e,typeName:xe.ZodNullable,...Fe(t)});var Qa=class extends Ve{static{o(this,"ZodDefault")}_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===re.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Qa.create=(e,t)=>new Qa({innerType:e,typeName:xe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Fe(t)});var $a=class extends Ve{static{o(this,"ZodCatch")}_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return bu(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wn(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Wn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};$a.create=(e,t)=>new $a({innerType:e,typeName:xe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Fe(t)});var ku=class extends Ve{static{o(this,"ZodNaN")}_parse(t){if(this._getType(t)!==re.nan){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.nan,received:i.parsedType}),Ce}return{status:"valid",value:t.data}}};ku.create=e=>new ku({typeName:xe.ZodNaN,...Fe(e)});var yse=Symbol("zod_brand"),ap=class extends Ve{static{o(this,"ZodBranded")}_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},cp=class e extends Ve{static{o(this,"ZodPipeline")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return o(async()=>{let s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Ce:s.status==="dirty"?(n.dirty(),ma(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})},"handleAsync")();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Ce:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:xe.ZodPipeline})}},Ta=class extends Ve{static{o(this,"ZodReadonly")}_parse(t){let n=this._def.innerType._parse(t),i=o(r=>(ro(r)&&(r.value=Object.freeze(r.value)),r),"freeze");return bu(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};Ta.create=(e,t)=>new Ta({innerType:e,typeName:xe.ZodReadonly,...Fe(t)});function zj(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}o(zj,"cleanParams");function Wj(e,t={},n){return e?so.create().superRefine((i,r)=>{let s=e(i);if(s instanceof Promise)return s.then(a=>{if(!a){let c=zj(t,i),u=c.fatal??n??!0;r.addIssue({code:"custom",...c,fatal:u})}});if(!s){let a=zj(t,i),c=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:c})}}):so.create()}o(Wj,"custom");var Ese={object:Zn.lazycreate},xe;(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"})(xe||(xe={}));var bse=o((e,t={message:`Input not instance of ${e.name}`})=>Wj(n=>n instanceof e,t),"instanceOfType"),Zj=io.create,Kj=ya.create,vse=ku.create,Ise=Ea.create,Xj=ba.create,wse=va.create,Cse=Iu.create,Sse=Ia.create,kse=wa.create,Bse=so.create,Rse=gs.create,xse=li.create,Qse=wu.create,$se=As.create,Tse=Zn.create,Dse=Zn.strictCreate,_se=Ca.create,Nse=Yh.create,Pse=Sa.create,Use=Ni.create,Fse=Wh.create,Ose=Cu.create,Mse=Su.create,Lse=Zh.create,jse=ka.create,Gse=Ba.create,Vse=Ra.create,zse=xa.create,qse=oo.create,Hse=Mr.create,Jse=Fr.create,Yse=Pi.create,Wse=Mr.createWithPreprocess,Zse=cp.create,Kse=o(()=>Zj().optional(),"ostring"),Xse=o(()=>Kj().optional(),"onumber"),eoe=o(()=>Xj().optional(),"oboolean"),toe={string:o((e=>io.create({...e,coerce:!0})),"string"),number:o((e=>ya.create({...e,coerce:!0})),"number"),boolean:o((e=>ba.create({...e,coerce:!0})),"boolean"),bigint:o((e=>Ea.create({...e,coerce:!0})),"bigint"),date:o((e=>va.create({...e,coerce:!0})),"date")};var noe=Ce;var up=(r=>(r.ModelProvider="model_provider",r.SutAccess="sut_access",r.Skyramp="skyramp",r.Other="other",r))(up||{}),QC=(i=>(i.Ready="ready",i.Blocked="blocked",i.NeedsInputs="needs_inputs",i))(QC||{});var Kh=300,dt=d.string().trim().min(1),roe=d.object({action:d.enum(["start","run","wait"]),text:dt,source:d.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:dt.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"}),lp=/^[A-Za-z_][A-Za-z0-9_]*$/,Kn=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Bu=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Bu||{}),Ui="shared",ioe=dt.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"),Ru=d.object({address:ioe,readyWhen:dt.nullable(),credentials:d.array(d.string().regex(Kn)).max(50),revisionSources:d.array(d.object({method:d.nativeEnum(Bu),detail:dt.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:d.array(dt).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),$C={steps:d.array(roe).max(20).optional().describe("how it starts, in order"),kind:d.enum(["web_app","service","database","external_service"]).optional(),from:d.object({file:dt,service:dt.nullable()}).strict().optional(),credentials:d.array(d.string().max(100).regex(lp)).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")},TC=d.object({name:dt,repository:dt.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:d.boolean(),...$C,deployed:dt.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')}),soe=d.object({name:d.string().regex(Kn).describe("the credential's environment variable name, as the recipe reads it and the credentials event names it"),purpose:d.enum(["sut_access","other"]).describe("sut_access: it signs in to or calls the SUT or a service it needs; other: anything else"),required:d.boolean().describe("false only when the SUT starts without it, with less working"),how:dt.max(Kh).describe('one short sentence: what the value is and where a person gets it, such as "A Mattermost Enterprise licence key, from the customer portal"; never a value')}),DC=d.object({name:dt.describe("the credential's environment variable name, as listed above; never its value"),component:dt.describe("the component that refused it"),status:d.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:dt.describe("the request or command you tested it with and what came back, never the value")}),ooe=400,e1=o((e,t)=>dt.max(ooe).optional().describe(`one or two plain sentences: ${e}, such as "${t}"; never the value`),"credentialExplanation"),aoe=DC.extend({name:d.string().regex(Kn).describe("the credential's environment variable name, as the SUT input lists it; never its value"),explanation:e1("what the component did with the value and why it is wrong","The app checks the licence key at startup and exits: the value this run has does not match the licence it expects.")}),coe=d.object({name:d.string().regex(Kn).describe("the credential's environment variable name, as the SUT input lists it"),component:dt.describe("the component that cannot come up or work without it"),evidence:dt.describe("the command you ran and what came back that shows it needs a value, never a value"),explanation:e1("what the component needs the value for and what it does without one","The app reads the licence key at startup and exits when it is empty.")}),uoe=d.object({component:dt,problem:dt,evidence:dt.describe("the exact command and output that shows it"),fix:dt.describe("what the user must provide, and where")}),loe=d.object({framework:dt,file:dt.describe("the test file run, relative to its repository root"),result:d.enum(["pass","fail","error"])}),doe=d.object({input:dt.describe("the part of the user's SUT input, as given"),reason:dt}),sRe=d.object({schemaVersion:d.literal(1),status:d.nativeEnum(QC).describe("ready only if every component came up healthy and the recipe is written; needs_inputs when the recipe is written but a component cannot start without a credential this run has no value for"),components:d.array(TC),suites:d.array(loe).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:d.array(dt).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:d.array(d.object({input:dt.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:dt.describe("what the recipe did with it")})).optional(),inputsNotUsed:d.array(doe).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:d.array(uoe).describe("required (non-empty) when status is blocked, unless credentialsRefused or credentialsWithoutValue says why; never one for a credential either of them names"),inputs:d.array(soe).max(50).optional().describe("required (non-empty) when status is needs_inputs, else left out: each credential the candidate recipe needs a value for"),credentialsRefused:d.array(aoe).max(50).optional().describe("only with status blocked: each credential the SUT input lists that the SUT still refused after a person confirmed it, or when no other credential worked. Testbot writes its blocker"),credentialsWithoutValue:d.array(coe).max(50).optional().describe("only with status blocked: each credential the SUT input lists as empty in this run that a component cannot come up or work without. Testbot writes its blocker"),environment:Ru.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 or proxy; a client certificate is named in .skyramp/sut/client-cert.json instead)")});var _C=64*1024,NC=512*1024,t1=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Fi=(r=>(r.Clean="clean",r.RecipeDrift="recipe-drift",r.ChangeBrokeBringup="change-broke-bringup",r.BringupFailed="bringup-failed",r))(Fi||{}),ao=d.string().trim().min(1),poe=d.object({url:d.string().optional().describe("the URL probed, if the check is an HTTP request"),command:d.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:d.record(d.string()).optional(),status:d.union([d.number(),d.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:ao.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),PC=d.array(d.object({component:ao.describe("a shared component listed above"),url:ao.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:ao.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"),n1=d.object({schemaVersion:d.literal(1),baseUrls:d.record(d.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:poe.optional(),teardown:ao.describe("command that tears the SUT down"),dependencies:d.record(d.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:d.nativeEnum(Fi).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:d.array(d.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:d.object({command:ao,output:ao}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:d.array(d.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:d.boolean(),startedAt:ao.describe("ISO timestamp"),revisions:PC.optional(),missingSecrets:d.array(d.string().regex(lp)).optional().describe("bringup-failed only: each secret the app cannot start without that this run has no value for, by its environment variable name; never a value"),credentialsRefused:d.array(DC).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:d.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var T1=require("node:crypto");var Da=(s=>(s.NotFound="not_found",s.NoAccess="no_access",s.Unavailable="unavailable",s.AccessLost="access_lost",s.CannotOpen="cannot_open",s))(Da||{});var UC=o(e=>`${e.source}:${e.site??""}:${e.key}`,"requirementItemId");var dp=/^pasted-[0-9a-f]{16}$/,hs=/^file-[0-9a-f]{16}$/,pp=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(pp||{}),_a=o(e=>e.trim().toUpperCase(),"normalKey"),r1=o((e,t)=>{let n=e.trim();return dp.test(n.toLowerCase())?"Pasted text":hs.test(n.toLowerCase())?t?.get(_a(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()},"itemName");var Xh=(i=>(i.New="new",i.Updated="updated",i.Existing="existing",i))(Xh||{}),Oi=(i=>(i.Sufficient="sufficient",i.Insufficient="insufficient",i.NoChange="no_change",i))(Oi||{}),xu=(v=>(v.RelatedChangeConflict="related_change_conflict",v.ReferenceOutsideTarget="reference_outside_target",v.SourceAccessLost="source_access_lost",v.ConfigurationIncomplete="configuration_incomplete",v.CredentialUnavailable="credential_unavailable",v.WorkflowBindingUnverified="workflow_binding_unverified",v.WorkflowRefUnprotected="workflow_ref_unprotected",v.BedrockWorkflowRequired="bedrock_workflow_required",v.DeploymentReview="deployment_review",v.SutRevisionMismatch="sut_revision_mismatch",v.IsolationUnavailable="isolation_unavailable",v.EvidenceInsufficient="evidence_insufficient",v.ConfigurationUnresolved="configuration_unresolved",v.ModelProviderDenied="model_provider_denied",v.ModelProviderUnavailable="model_provider_unavailable",v.RunnerProviderNotReady="runner_provider_not_ready",v.MergeConflict="merge_conflict",v))(xu||{}),co=(s=>(s.CiCheck="ci_check",s.TestReport="test_report",s.StaticAnalysis="static_analysis",s.CodeReview="code_review",s.Other="other",s))(co||{}),fp=(i=>(i.Application="application",i.Environment="environment",i.TestDefect="test_defect",i))(fp||{}),gp=(c=>(c.AuthToken="auth_token",c.Secret="secret",c.DataConnection="data_connection",c.AppNotStarted="app_not_started",c.Login="login",c.ExternalDependency="external_dependency",c.RecordingReplay="recording_replay",c))(gp||{});var em=(n=>(n.Probe="probe",n.Agent="agent",n))(em||{}),Ap=(i=>(i.Seed="seed",i.RuntimeMock="runtime_mock",i.EnvOverride="env_override",i))(Ap||{}),tm=(i=>(i.TestCode="test_code",i.SkyrampMocker="skyramp_mocker",i.RecipeOverride="recipe_override",i))(tm||{});function nm(e){return e==="failed"?2:e==="unknown"?1:0}o(nm,"cleanupShortfall");var hp=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(hp||{}),Mi=d.string().trim().min(1),foe=d.object({case:Mi.describe("recommend id this assertion enforces"),evidence:Mi.describe("the exact assertion line from the file that checks that case's observable")});var i1=d.object({route:d.literal("persistence"),url:d.string().url()}).strict(),mp=d.object({kind:d.nativeEnum(Ap).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:Mi.describe("the dependency, endpoint or data it affects"),mechanism:d.nativeEnum(tm).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:Mi.describe("what it sets up"),worker:Mi.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),safety:i1.optional().describe("shared seed that keeps its data only because the environment permits it: the persistence route and the exact endpoint; Testbot checks the current permission just before it runs the test"),cleanup:Mi.optional().describe("seed: when its data can be removed, a command that removes it if the test does not; otherwise declare leftBehind instead. Run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that"),leftBehind:Mi.optional().describe("seed: the records the test creates and cannot remove from the app, and how to find them")}).refine(e=>!e.leftBehind||e.kind==="seed",{message:"leftBehind is for a seed only: a runtime mock or an env override creates no records",path:["leftBehind"]}),goe=d.object({file:Mi.describe("staged path under .skyramp/staged/"),source:d.nativeEnum(hp),language:Mi,covers:d.array(d.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:d.array(foe).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:d.array(mp).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),FC=d.object({schemaVersion:d.literal(1),tests:d.array(goe),deferredUi:d.array(d.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:Mi.describe("one paragraph")});var ms=(a=>(a.Place="place",a.Update="update",a.Regenerate="regenerate",a.Delete="delete",a.Verify="verify",a.None="none",a))(ms||{}),Tn=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(Tn||{}),$n=d.string().trim().min(1),OC=(r=>(r.Setup="setup",r.Expectation="expectation",r.Locator="locator",r.Other="other",r))(OC||{}),rm=d.object({kind:d.nativeEnum(OC),reason:$n.describe("what in the test is wrong, with the evidence: the setup error it raised, or the requirement or changed line its expectation contradicts")}),yp=d.array(d.string().url().max(2048).regex(/^https?:\/\//i)).max(50),s1=d.object({case:$n.describe("a covers id \u2014 the recommend case this test realizes"),status:d.nativeEnum(Tn),runtimeTargets:yp.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),environmentRestriction:$n.optional().describe("for a skipped case: what this run lacks to execute it; the test is still written"),fromJourney:d.boolean().optional(),testProblem:rm.optional().describe("[derived] write's reading of a failing case: the test, not the app, is at fault"),defect:d.boolean().optional().describe("[derived] write's reading of a failing case: true when the app is wrong and the test is right"),failure:d.string().optional().describe("[derived] for a failing case: the runner's failure for it, as printed")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"}),o1=d.object({started:d.boolean().optional().describe("with exit null: true if the test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:d.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:d.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:d.array(s1).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),a1=d.object({context:d.array(mp).optional().describe("[derived] setup declarations retained for every executed test, including maintained tests"),from:d.string().optional().describe("staged path \u2014 required for placements"),file:$n.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:$n.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(ms),covers:d.array(d.string()).optional().describe("recommend ids a placed test covers"),repro:d.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:d.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:d.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:$n.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:$n.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:o1,assertionCount:d.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:d.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there"),added:d.array($n).optional().describe("[derived] the cases of the test functions the run added to an existing file: functions it did not have"),staleOnBase:d.boolean().optional().describe("[derived] an existing test that fails the same way on the base branch: its failure is the test's own")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),c1=(n=>(n.Junit="junit",n.Converter="converter",n))(c1||{}),Aoe=$n.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),hoe=d.object({results:$n.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:d.nativeEnum(c1),run:$n.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:d.array($n).min(1).describe("the items[].file paths this run covered"),cases:d.array(d.object({test:$n.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:$n.describe("the covers id it realizes"),file:Aoe})).describe("map each reported test name to the case it covers")}),moe=d.object({suites:d.array(hoe).min(1)}),MC=d.object({schemaVersion:d.literal(1),items:d.array(a1),runnerResults:moe.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:d.array(d.string()).describe("existing tests assessed and deliberately left untouched"),summary:$n.describe("one paragraph")});mu();SC();function u1(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}o(u1,"credentialKeyFromRole");var l1=ee(require("path"));var nn=d.string().trim().min(1),im=nn,LC=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(LC||{}),jC=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],d1=(n=>(n.Refused="refused",n.NoValue="no_value",n))(d1||{}),yoe=d.object({name:d.string().regex(Kn),kind:d.nativeEnum(d1),explanation:nn.optional()}).strict(),p1=d.object({schemaVersion:d.literal(1),type:d.nativeEnum(LC).optional(),repository:im.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:d.enum(["ready","blocked"]),environment:Ru.optional(),components:d.array(d.object({name:nn,repository:nn.describe(`owner/repo, or "${Ui}" for a customer-deployed component no repository builds`),healthy:d.boolean(),url:d.string().min(1).nullable(),...$C,credentials:d.array(d.string().regex(Kn)).max(50).optional(),deployed:nn.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:d.array(d.object({framework:nn,file:nn,result:d.enum(["pass","fail","error"])}).strict()),inputsUsed:d.array(nn),inputsUsedHow:d.array(d.object({input:nn,how:nn}).strict()).optional(),inputsNotUsed:d.array(d.object({input:nn,reason:nn}).strict()),blockers:d.array(d.object({component:nn,problem:nn,evidence:nn,fix:nn,credential:yoe.optional()}).strict()),replay:d.object({outcome:nn,durationSeconds:d.number().nonnegative().nullable()}).strict().nullable(),files:d.array(d.object({path:nn,content:d.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((r,s)=>{e.inputsUsed.includes(r.input)||t.addIssue({code:d.ZodIssueCode.custom,path:["inputsUsedHow",s,"input"],message:"not one of inputsUsed"})}),e.components.forEach((r,s)=>{r.credentials&&new Set(r.credentials).size!==r.credentials.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:d.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:d.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let i=new Set(e.components.map(r=>r.name));if(e.environment?.revisionSources.forEach((r,s)=>{r.components.forEach((a,c)=>{i.has(a)||t.addIssue({code:d.ZodIssueCode.custom,path:["environment","revisionSources",s,"components",c],message:"not one of components"})})}),e.components.forEach((r,s)=>{r.deployed!==void 0!==n&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),r.repository===Ui&&!n&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"repository"],message:`only a customer_deployed component is ${Ui}`})}),n&&(e.components.forEach((r,s)=>{e.components.findIndex(a=>a.name===r.name)!==s&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:d.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((r,s)=>{jC.includes(r.path)&&t.addIssue({code:d.ZodIssueCode.custom,path:["files",s,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let r=new Set(e.environment?.revisionSources.flatMap(s=>s.components));e.components.forEach((s,a)=>{s.repository!==Ui&&!r.has(s.name)&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var $Re=["clean","recipe-drift"];function Ep(e){let t=l1.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}o(Ep,"isRuntimePlanFile");var bp=d.string().uuid(),vp=d.object({environmentId:d.string().uuid(),allowed:d.boolean(),revision:bp,updatedAt:d.string().datetime(),updatedBy:d.string().uuid()}).strict();var Ip=(a=>(a.NoEnvironment="no_environment",a.NoRecordedGrant="no_recorded_grant",a.Unavailable="unavailable",a.Changed="changed",a.Denied="denied",a.OutOfScope="out_of_scope",a))(Ip||{});function wp(e){switch(e){case"no_environment":return"the run has no selected Test Environment address";case"no_recorded_grant":return"the run's configuration did not record permission to keep test data in this environment";case"unavailable":return"the current permission to keep test data could not be read";case"changed":return"the permission to keep test data changed after the run started";case"denied":return"the environment does not permit test data to stay";case"out_of_scope":return"the request is outside the environment's address"}}o(wp,"persistenceRefusalText");function sm(e,t,n){let i=vp.safeParse(t);return!i.success||!i.data.allowed||!e.environmentId||i.data.environmentId!==e.environmentId||!e.environmentAddress||e.persistentDataPolicy&&e.persistentDataPolicy.revision!==i.data.revision?!1:uo(e.environmentAddress,n)}o(sm,"persistentDataPolicyApplies");function uo(e,t){try{let n=new URL(t),i=new URL(e);if(i.search||i.hash)return!1;let r=/%(?:2f|5c|2e|25)/i;if(t.includes("\\")||e.includes("\\")||r.test(n.pathname)||r.test(i.pathname))return!1;let s=i.pathname.replace(/\/$/,"");return["https:","http:"].includes(i.protocol)&&n.origin===i.origin&&(n.pathname===s||n.pathname.startsWith(`${s}/`))}catch{return!1}}o(uo,"environmentContainsUrl");var GC="delivery-persistence.json",f1=d.object({environmentId:d.string().uuid(),environmentAddress:d.string().url(),revision:bp}).strict(),g1=d.object({refusal:d.nativeEnum(Ip)}).strict();var D1=d.unknown().optional(),_1={handshake:"/api/v1/runner/runs/:runId/attempts",report:"/api/v1/runner/attempts/:attemptId/report",end:"/api/v1/runner/attempts/:attemptId/end",configuration:"/api/v1/runner/attempts/:attemptId/configuration",progress:"/api/v1/runner/attempts/:attemptId/progress",sutRecipe:"/api/v1/runner/attempts/:attemptId/sut-recipe",runtimePlan:"/api/v1/runner/attempts/:attemptId/runtime-plan",persistentDataPolicy:"/api/v1/runner/attempts/:attemptId/persistent-data-policy",heartbeat:"/api/v1/runner/attempts/:attemptId/heartbeat",setupEvents:"/api/v1/runner/attempts/:attemptId/setup-events",runEvents:"/api/v1/runner/attempts/:attemptId/run-events",requirements:"/api/v1/runner/attempts/:attemptId/requirements",requirementFile:"/api/v1/runner/attempts/:attemptId/requirements/:key/file",deployedRevisions:"/api/v1/runner/attempts/:attemptId/deployed-revisions"},Pa=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(Pa||{}),dm=(s=>(s.Trigger="TRIGGER",s.Baseline="BASELINE",s.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",s.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",s.ManualOverride="MANUAL_OVERRIDE",s))(dm||{}),pm=(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))(pm||{}),Eoe=["sut_setup"],boe=["sut_setup","schedule","revision_read"],voe=["sut_setup"],HC=(t=>(t.PullRequest="pull_request",t))(HC||{}),JC=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(JC||{}),A1=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var fm=(r=>(r.None="none",r.Delivered="delivered",r.Partial="partial",r.Failed="failed",r))(fm||{}),kp=(s=>(s.ReportUploaded="report_uploaded",s.NoReport="no_report",s.Cancelled="cancelled",s.RecipeUploaded="recipe_uploaded",s.RevisionsUploaded="revisions_uploaded",s))(kp||{}),N1=(n=>(n.Running="running",n.Ended="ended",n))(N1||{}),Bp=(A=>(A.TimedOut="timed_out",A.AgentFailed="agent_failed",A.SetupFailed="setup_failed",A.CredentialMissing="credential_missing",A.RunnerLost="runner_lost",A.CheckoutFailed="checkout_failed",A.EnvironmentUnverified="environment_unverified",A.ModelProviderDenied="model_provider_denied",A.ModelProviderUnavailable="model_provider_unavailable",A.RunnerProviderNotReady="runner_provider_not_ready",A.MergeConflict="merge_conflict",A.EnvironmentUnavailable="environment_unavailable",A))(Bp||{}),P1=(i=>(i.Onboard="onboard",i.Deploy="deploy",i.Recheck="recheck",i))(P1||{}),YC=(n=>(n.Started="started",n.Finished="finished",n))(YC||{}),U1=(i=>(i.Passed="passed",i.Failed="failed",i.Skipped="skipped",i))(U1||{});var F1=(i=>(i.ChooseCredential="choose_credential",i.FreeText="free_text",i.ChooseSource="choose_source",i))(F1||{});var O1=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(O1||{}),WC=(i=>(i.Discover="discover",i.Start="start",i.Check="check",i))(WC||{}),VC=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(VC||{});var ZC=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(ZC||{}),Lr=d.string().regex(/^[1-9][0-9]{0,18}$/),jr=d.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),zC=d.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Du=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function M1(e,t){return`${e.replace(/\/+$/,"")}/runs/${t}`}o(M1,"skyrampRunPageUrl");var In=d.string().regex(Du),Dn=d.string().regex(/^[0-9a-f]{64}$/),lm=d.object({id:In,revision:Lr}).strict(),gm={provider:d.literal("github"),providerAccountId:Lr,providerRepositoryId:Lr},Am={provider:d.literal("azure-devops"),providerAccountId:In,providerRepositoryId:In},Ir=d.discriminatedUnion("provider",[d.object(gm).strict(),d.object(Am).strict()]),KC=d.discriminatedUnion("provider",[d.object(gm).passthrough(),d.object(Am).passthrough()]),ji=o(e=>`${e.provider}:${e.providerRepositoryId}`,"sourceKey"),h1={namespace:d.string().min(1),name:d.string().min(1)},L1=d.discriminatedUnion("provider",[d.object({...gm,...h1}).strict(),d.object({...Am,...h1}).strict()]),m1=d.object({ref:d.string().min(1),revision:jr}).strict(),Ioe=d.object({kind:d.nativeEnum(JC),number:Lr.optional(),ref:d.string().min(1),revision:jr,reason:d.nativeEnum(dm)}).strict(),woe=d.object({repository:L1,revision:jr,ref:d.string().nullable(),reason:d.nativeEnum(dm),change:d.object({kind:d.nativeEnum(HC),number:Lr,base:m1.optional()}).strict().nullable(),compareWith:m1.optional(),merge:d.array(Ioe).min(2).optional()}).strict();function Coe(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,i=new Set;for(let[s,a]of t.entries()){if(a.kind==="pull_request"!=(a.number!==void 0))return{path:["merge",s,"number"],message:"a pull request names its number, and a branch none"};if(!A1.includes(a.reason))return{path:["merge",s,"reason"],message:`${a.reason} does not select a merged revision`};if(a.kind==="branch"&&a.reason!=="MANUAL_OVERRIDE")return{path:["merge",s,"reason"],message:"only a person chooses a branch to merge"};if(a.ref===e.ref)return{path:["merge",s,"ref"],message:"the baseline branch is what the source merges onto"};if(a.number!==void 0&&n.has(a.number)||i.has(a.ref))return{path:["merge",s],message:"names a revision the source already merges"};a.number!==void 0&&n.add(a.number),i.add(a.ref)}let r=A1.find(s=>t.some(a=>a.reason===s));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}o(Coe,"mergedSourceIssue");function Soe(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,comparisonBaselineId:i,sources:r}=e.baseline;if([t,n,i].filter(l=>l!=null).length>1)return"a run compares with one baseline";let s=e.trigger.kind==="schedule"&&t!==null||n!==void 0||i!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&i===void 0)return"a run with no Confirmed Baseline names no baseline sources";let a=new Set(e.sources.map(l=>ji(l.repository))),c=new Set(r.map(l=>ji(l.repository)));return c.size===r.length&&c.size===a.size&&[...c].every(l=>a.has(l))?null:"names every source of the snapshot, once"}o(Soe,"baselineSourcesIssue");var j1=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,G1=/^[1-9][0-9]{0,18}$/,y1=new RegExp(`${j1.source}|${G1.source}`),E1=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,koe=d.union([d.object({source:d.literal("jira"),site:d.string().regex(E1),key:d.string().regex(j1),updated:d.string().datetime(),contentHash:Dn}).strict(),d.object({source:d.literal("confluence"),site:d.string().regex(E1),key:d.string().regex(G1),version:d.number().int().positive(),contentHash:Dn}).strict(),d.object({source:d.literal("other"),key:d.string().regex(dp),contentHash:Dn}).strict(),d.object({source:d.literal("other"),key:d.string().regex(hs),contentHash:Dn,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(pp)}).strict()]),b1=d.union([d.literal("jira"),d.literal("confluence")]),Boe=d.object({schemaVersion:d.literal(1),items:d.array(d.union([d.object({source:b1,site:d.string(),key:d.string().regex(y1),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:b1,site:d.string(),key:d.string().regex(y1),state:d.literal("not_read"),reason:d.nativeEnum(Da)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(dp),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:d.literal("other"),key:d.string().regex(dp),state:d.literal("not_read"),reason:d.nativeEnum(Da)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(hs),state:d.literal("read"),version:Dn,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(pp)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(hs),state:d.literal("not_read"),reason:d.nativeEnum(Da)}).strict()])),instructions:d.array(d.string()).optional()}).strict(),Roe=d.object({resultId:d.string().min(1),repository:d.string().min(1),testType:d.string().min(1),path:d.string(),finding:d.string().min(1)}).strict(),xoe=d.object({schemaVersion:d.literal(1),runId:In,skyrampOrgId:In,target:lm,policy:lm.nullable(),trigger:d.object({kind:d.nativeEnum(pm),requestedAt:d.string().datetime()}).strict(),configuration:d.object({captureId:In,revision:Lr.nullable(),hash:Dn}).strict(),baseline:d.object({confirmedRunId:In.nullable(),initialBaselineId:In.optional(),comparisonBaselineId:In.optional(),knownFailures:d.array(Roe).optional(),sources:d.array(d.object({repository:Ir,revision:jr}).strict()).optional()}).strict().optional(),sources:d.array(woe).min(1).max(1e3),execution:d.object({provider:d.nativeEnum(Pa),repository:L1,workflowPath:d.string(),ref:d.string()}).strict(),credentials:d.array(d.object({name:d.string(),purpose:d.nativeEnum(up),required:d.boolean()}).strict()),requirements:d.array(koe).min(1).optional(),instructions:d.object({contentHash:Dn}).strict().optional(),deployedRevisions:d.array(d.object({repository:Ir,revision:jr}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((u,l)=>{let p="fileName"in u?"file":"pasted";u.source==="other"&&u.key!==`${p}-${u.contentHash.slice(0,16)}`&&t.addIssue({code:d.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",l,"key"]});let f=UC({source:u.source,key:u.key});n.has(f)&&t.addIssue({code:d.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",l,"key"]}),n.add(f)});let i=e.trigger.kind,r=Eoe.includes(i);r!==(e.policy===null)&&t.addIssue({code:d.ZodIssueCode.custom,path:["policy"],message:r?`a ${i} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:d.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let s=Soe(e);s&&t.addIssue({code:d.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:s}),boe.includes(i)&&e.sources.forEach((u,l)=>{u.reason!=="BASELINE"&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,"reason"],message:`a ${i} run selects only BASELINE sources`})}),e.deployedRevisions&&i!=="manual"&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(e.sources.map(u=>ji(u.repository))),c=new Set;(e.deployedRevisions??[]).forEach((u,l)=>{let p=ji(u.repository);a.has(p)?c.has(p)&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",l,"repository"],message:"repository appears twice"}):t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",l,"repository"],message:"names a repository outside the snapshot"}),c.add(p)}),e.sources.forEach((u,l)=>{u.compareWith&&(u.reason!=="MANUAL_OVERRIDE"||u.change)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(u.change?.base||u.compareWith||u.merge)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let p=Coe(u);p&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,...p.path],message:p.message})})});var XC=(n=>(n.Person="person",n.Policy="policy",n))(XC||{}),Qoe=d.object({kind:d.nativeEnum(XC),name:d.string().min(1).max(256)}).strict(),$oe=d.object({mcp:d.discriminatedUnion("source",[d.object({source:d.literal("npm"),version:d.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),d.object({source:d.literal("github"),ref:d.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:d.object({region:d.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:d.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Toe=d.object({schemaVersion:d.literal(1),attempt:d.object({id:In,number:d.number().int().positive(),deadlineAt:d.string().datetime()}).strict(),manifest:xoe,manifestHash:Dn,entitlements:d.array(d.string()).optional(),runToken:d.string().min(1).optional(),requestedBy:Qoe.nullable().optional(),writeAllowed:d.boolean().optional(),claudeCodeVersion:d.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:d.array(d.object({repository:Ir,revision:jr}).strict()).optional(),statedRevisions:d.array(d.object({repository:Ir,revision:jr}).strict()).optional(),runSettings:$oe.optional()}).strict(),v1={providerRunAttempt:d.number().int().positive(),workflowRef:d.string().min(1)},Doe=d.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),_oe=d.object({schemaVersion:d.literal(1),runId:In,execution:d.discriminatedUnion("provider",[d.object({...v1,provider:d.literal("github"),repository:d.object(gm).strict(),providerRunId:Lr}).strict(),d.object({...v1,provider:d.literal("azure-devops"),repository:d.object(Am).strict(),providerRunId:Doe}).strict()]),requester:d.literal(!0).optional(),writeCheck:d.literal(!0).optional(),claudeCodePin:d.literal(!0).optional(),deployedPins:d.literal(!0).optional(),statedPins:d.literal(!0).optional(),runSettings:d.literal(!0).optional(),credentialKinds:d.literal(!0).optional(),credentialBlockers:d.literal(!0).optional()}).strict(),I1=d.object({repository:Ir,number:Lr,commitSha:jr.optional()}).strict(),om=d.array(d.object({repository:Ir,reason:d.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),V1=d.object({branch:zC.optional(),commitSha:jr.optional()}).strict(),hm=4096,z1=d.array(d.object({file:d.string().max(4096).regex(/\S/),dependsOn:d.array(d.string().max(2048).regex(/\S/)).max(100)}).strict()).min(1).max(500),w1=d.object({repository:Ir,message:d.string().max(hm),...V1.shape,heldBack:z1.optional()}).strict(),Noe=d.discriminatedUnion("status",[d.object({status:d.literal("none"),noTests:om}).strict(),d.object({status:d.literal("delivered"),noTests:om,pullRequests:d.array(I1).min(1)}).strict(),d.object({status:d.literal("partial"),noTests:om,pullRequests:d.array(I1).min(1),failures:d.array(w1).min(1)}).strict(),d.object({status:d.literal("failed"),message:d.string().max(hm),noTests:om,failures:d.array(w1).min(1).optional()}).strict()]),eS=1024*1024,q1=16*1024*1024,Cp={id:4096,text:16384,businessCase:65536},Rp={id:Cp.id,statement:Cp.text,rows:1e3},C1=d.string().min(1).max(Cp.id),cm=d.string().max(Cp.text),am=o((e,t)=>d.array(d.object({[e]:cm}).strict()).max(t).optional(),"texts"),tS=d.object({language:d.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:d.string().max(Cp.businessCase),validation:d.object({rationale:cm.min(1),gaps:d.array(d.string().min(1).max(4096)).max(200)}).strict().optional(),changes:d.array(d.object({id:C1,text:cm}).strict()).max(1e3).optional(),requirements:d.array(d.object({id:C1,statement:cm}).strict()).max(Rp.rows).optional(),issuesFound:am("description",5e3),newTestsCreated:am("description",5e3),testResults:am("details",5e3),caveats:am("text",100)}).strict(),Poe=d.object({blockedPreflight:d.object({file:d.string().min(1),repository:d.string().min(1).optional(),reason:d.string().min(1).max(300),evidence:d.string().min(1).max(400)}).strict().optional(),sufficiency:d.nativeEnum(Oi),rationale:d.string().min(1),gaps:d.array(d.string().min(1)),acceptedEvidence:d.array(d.object({kind:d.nativeEnum(co),repository:d.string().min(1),revision:jr,reference:d.string().min(1),summary:d.string().min(1)}).strict()),actionRequired:d.array(d.nativeEnum(xu))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:d.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:d.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),um=500,H1=2048,J1=1e3,Uoe=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,S1=o(e=>e.length>0&&e.length<=64&&e===e.trim()&&!Uoe.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),"isAzureName"),Y1=o(e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,i,...r]=e.split("/");return e.length<=201&&r.length===0&&i!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&S1(n)&&S1(i)},"isResultRepository"),Foe=d.object({testResults:d.array(d.object({resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:d.string().refine(Y1,"Invalid"),testType:d.string(),runtimeTargets:yp.optional(),endpoint:d.string(),status:d.enum(["Pass","Fail","Skipped"]),details:d.string(),fileName:d.string().optional(),testId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:d.object({kind:d.nativeEnum(fp),family:d.nativeEnum(gp).optional()}).strict().optional(),origin:d.nativeEnum(Xh).optional()}).strict()),validation:Poe,changes:d.array(d.object({id:d.string().min(1).max(512),text:d.string().max(16384),source:d.string().max(H1),testedBy:d.array(d.string().min(1).max(1024)).max(um),writtenBy:d.array(d.string().min(1).max(1024)).max(um),maintainedBy:d.array(d.string().min(1).max(1024)).max(um)}).strict()).max(J1).optional(),traceVersion:d.literal(1),display:tS.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,i={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let s of["issuesFound","newTestsCreated","testResults","caveats"]){let a=n?.[s];a&&a.length!==(Array.isArray(i[s])?i[s].length:0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["display",s],message:`has not one row per ${s} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((s,a)=>{let c=s.failureCause;c&&s.status==="Pass"&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"a passing result has no failure cause"}),c&&c.kind==="environment"!=(c.family!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"an environment cause names its family, and no other cause does"});let u=["testResults",a,"resultId"],l=s.resultId.slice(`${s.repository}:${s.testType}:`.length);(!s.resultId.startsWith(`${s.repository}:${s.testType}:`)||l===""||l.startsWith("/")||l.startsWith("#"))&&t.addIssue({code:d.ZodIssueCode.custom,path:u,message:"is not repository:testType:path for this result"}),r.has(s.resultId)&&t.addIssue({code:d.ZodIssueCode.custom,path:u,message:"stable identity repeated"}),r.add(s.resultId)})}),k1=o(e=>e.replace(/[%:#]/g,t=>encodeURIComponent(t)),"encodeIdPart");function nS(e,t,n,i){let r=n.replace(/\\/g,"/"),s=r.split("/").filter(u=>u!==""&&u!==".");if(r.startsWith("/")||/^[A-Za-z]:/.test(r)||s.length===0||s.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=s.join("/"),c=`${e}:${t}:${k1(a)}`;return i?`${c}#${k1(i)}`:c}o(nS,"testResultId");var mm=(i=>(i.BranchPushed="branch_pushed",i.PullRequestOpened="pull_request_opened",i.PullRequestEdited="pull_request_edited",i))(mm||{}),W1=50,Z1=d.discriminatedUnion("kind",[d.object({kind:d.literal("branch_pushed"),repository:Ir,branch:zC,commit:jr}).strict(),d.object({kind:d.enum(["pull_request_opened","pull_request_edited"]),repository:Ir,number:Lr,branch:zC}).strict()]),Ooe=100,Moe=2048,zRe=d.object({records:d.array(d.string().regex(/^https?:\/\/[^\s/?#@]+(\/[^\s?#]*)?$/).max(Moe)).max(Ooe),unlisted:d.number().int().nonnegative()}).strict().refine(e=>e.records.length+e.unlisted>0,"names at least one create"),K1=d.object({schemaVersion:d.literal(1),run:d.object({runId:In,attemptNumber:d.number().int().positive(),manifestHash:Dn}).strict(),target:lm,policy:lm,provenance:d.object({sources:d.array(d.object({repository:Ir,revision:jr}).strict()),firstQualification:d.literal(!0).optional()}).strict(),delivery:d.object({generatedTests:Noe}).strict(),producer:d.object({testbot:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Foe,githubWrites:d.array(Z1).max(W1).optional()}).strict(),rS=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(rS||{}),iS=200,Loe=d.object({cause:d.nativeEnum(rS),credential:d.string().regex(Kn).optional(),reason:d.string().trim().min(1).max(iS).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),joe=d.object({name:d.string().regex(Kn),purpose:d.enum(["sut_access","other"]),required:d.boolean(),how:d.string().trim().min(1).max(Kh)}).strict(),qRe=K1.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:p1,check:Loe.optional(),inputs:d.array(joe).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=o((s,a)=>t.addIssue({code:d.ZodIssueCode.custom,path:["recipe",...s],message:a}),"issue");e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let i=new Set,r=0;e.files.forEach((s,a)=>{Ep(s.path)||n(["files",a,"path"],"is not a file under .skyramp/sut/, or the .skyramp/workspace.yml a recipe stored before SKYR-5829 carries"),i.has(s.path)&&n(["files",a,"path"],"file repeated"),i.add(s.path),t1.test(s.content)&&n(["files",a,"content"],"is not text");let c=Buffer.byteLength(s.content,"utf8");r+=c,c>_C&&n(["files",a,"content"],`larger than ${_C} bytes`)}),r>NC&&n(["files"],`recipe text over ${NC} bytes in total`)}),HRe=d.object({components:d.array(d.object({name:d.string().min(1),repository:d.string().refine(Y1,"Invalid"),observedRevision:d.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:d.nativeEnum(em),evidence:d.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();function X1(e){return e.trigger.kind==="schedule"||e.trigger.kind==="manual"&&e.sources.every(t=>t.reason==="BASELINE")}o(X1,"readsDeployedState");var Goe=d.object({schemaVersion:d.literal(1),stage:d.nativeEnum(P1),event:d.nativeEnum(YC),status:d.nativeEnum(U1).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),ym=100,Voe=5e3,Na=2e3,B1=100,eG=/^[A-Za-z0-9_-]{1,64}$/,zoe=20,qoe=200,Hoe=100,Joe=100,Yoe=200,R1="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Woe=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${R1}/${R1})$`),Zoe=500,x1=50,Koe=10,Xoe=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,tG=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,vr=o(e=>d.string().max(e).refine(t=>t.trim().length>0&&!tG.test(t),"blank, or not text"),"setupText"),Li={sequence:d.number().int().min(1).max(Voe),at:d.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},nG=d.object({...Li,kind:d.literal("reply"),to:d.string().uuid(),outcome:d.nativeEnum(O1),accepted:d.boolean(),text:vr(Na),note:d.object({source:d.enum(["target","environment"]),quote:vr(Na)}).strict().optional(),kept:vr(Na).optional()}).strict();function rG(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:d.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}o(rG,"checkReply");var eae=d.discriminatedUnion("kind",[d.object({...Li,kind:d.literal("log"),phase:d.nativeEnum(WC),text:vr(Na)}).strict(),d.object({...Li,kind:d.literal("component"),name:vr(B1),repository:vr(Yoe).refine(e=>Woe.test(e)||e===Ui,"not owner/name"),file:vr(Zoe).nullable(),status:d.nativeEnum(ZC),version:vr(Joe).optional()}).strict(),nG,d.object({...Li,kind:d.literal("question"),id:d.string().regex(eG),type:d.nativeEnum(F1),text:vr(Na),component:vr(B1).nullable(),choices:d.array(vr(qoe)).max(zoe),placeholder:vr(Hoe).optional()}).strict(),d.object({...Li,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(ym)}).strict(),d.object({...Li,kind:d.literal("credentials"),names:d.array(d.string().regex(Kn)).min(1).max(x1),logins:d.array(d.object({key:d.string().regex(Xoe),usernameVariable:d.string().regex(Kn),passwordVariable:d.string().regex(Kn)}).strict()).min(1).max(Koe).optional(),variables:d.array(d.string().regex(Kn)).min(1).max(x1).optional()}).strict()]).superRefine((e,t)=>{if(rG(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(i=>u1(i.key));new Set(n).size!==n.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((i,r)=>{for(let s of["usernameVariable","passwordVariable"])e.names.includes(i[s])||t.addIssue({code:d.ZodIssueCode.custom,path:["logins",r,s],message:"not one of the names"})})}e.kind==="credentials"&&e.variables&&(new Set(e.variables).size!==e.variables.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["variables"],message:"a name twice"}),e.variables.forEach((n,i)=>{e.names.includes(n)||t.addIssue({code:d.ZodIssueCode.custom,path:["variables",i],message:"not one of the names"})})),e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:d.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:d.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),tae=d.object({schemaVersion:d.literal(1),events:d.array(eae).max(ym)}).strict(),nae=d.discriminatedUnion("kind",[d.object({...Li,kind:d.literal("log"),stage:d.nativeEnum(VC),text:vr(Na)}).strict(),nG,d.object({...Li,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(ym)}).strict(),d.object({...Li,kind:d.literal("stage"),stage:d.nativeEnum(VC),event:d.nativeEnum(YC)}).strict(),d.object({...Li,kind:d.literal("test"),resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:d.enum(["Pass","Fail","Skipped"]),details:d.string().max(Na).refine(e=>!tG.test(e),"not text")}).strict()]).superRefine(rG),rae=d.object({schemaVersion:d.literal(1),events:d.array(nae).max(ym)}).strict(),Q1={id:d.string().uuid(),text:d.string(),by:d.string().nullable(),at:d.string(),replied:d.literal(!0).optional()},iG=d.discriminatedUnion("kind",[d.object({...Q1,kind:d.literal("instruction"),question:d.null()}),d.object({...Q1,kind:d.literal("answer"),question:d.string().regex(eG)})]),sG=d.string().regex(/^[A-Za-z0-9+/]{43}=$/),iae=d.object({id:d.string().uuid(),revision:d.string(),by:d.string().nullable(),at:d.string(),target:d.string(),own:d.object({source:d.enum(["policy","test_environment"]),text:d.string()}).nullable()}),sae=d.object({schemaVersion:d.literal(1),leftOut:d.array(d.string()),messages:d.array(iG).optional(),stop:d.object({key:sG}).optional(),notes:iae.optional()}),oae=d.object({schemaVersion:d.literal(1),messages:d.array(iG).optional()});var aae=500*1024*1024,oG=d.object({id:Lr,name:d.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Lr,expiresAt:d.string().datetime()}).strict(),cae=d.object({schemaVersion:d.literal(1),artifact:oG,sessionId:In,contentHash:Dn,bytes:d.number().int().min(1).max(aae)}).strict(),uae=d.object({schemaVersion:d.literal(1),checkpoint:d.object({artifact:oG,repository:d.object({namespace:d.string().min(1),name:d.string().min(1)}).strict(),sessionId:In,contentHash:Dn,key:sG}).strict().nullable()}).strict(),lae=200,Qu=100,aG=(i=>(i.Resume="resume",i.Retry="retry",i.Update="update",i))(aG||{}),dae=d.object({kind:d.nativeEnum(aG),setup:d.object({runId:In,endedAt:d.string().nullable(),outcome:d.string().nullable()}).strict(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1),status:d.nativeEnum(ZC)}).strict()).max(Qu),credentials:d.array(d.string().min(1)).max(Qu),answers:d.array(d.object({question:d.string(),answer:d.string().nullable()}).strict()).max(Qu),instructions:d.array(d.object({text:d.string(),reply:d.string().nullable()}).strict()).max(Qu),log:d.array(d.object({phase:d.nativeEnum(WC),text:d.string()}).strict()).max(lae),recipe:d.object({files:d.array(d.object({path:d.string().min(1),content:d.string()}).strict()).max(Qu),blockers:d.array(d.object({component:d.string(),problem:d.string(),evidence:d.string(),fix:d.string()}).strict()).max(Qu)}).strict().optional()}).strict(),pae=d.object({schemaVersion:d.literal(1),context:dae.nullable()}).strict(),fae=d.object({schemaVersion:d.literal(1),configuration:d.object({captureId:In,revision:Lr.nullable(),hash:Dn}).strict(),capture:d.object({schemaVersion:d.literal(1),settings:d.object({target:d.object({environment:d.unknown()}).passthrough(),timeoutMinutes:d.number().int().positive(),answerWaitMinutes:d.number().int().positive().optional(),testEnvironment:d.object({name:d.string().min(1),address:d.string().min(1).optional(),readyWhen:d.string().min(1).optional(),environmentId:d.string().uuid().optional(),persistentDataPolicy:D1}).passthrough().optional()}).passthrough(),provenance:d.object({}).passthrough(),hash:Dn}).strict()}).strict(),cG=d.object({schemaVersion:d.literal(1),environmentId:d.string().uuid().nullable(),environmentAddress:d.string().url().nullable(),persistentDataPolicy:vp.nullable()}).strict(),gae=Ru.extend({environmentId:d.string().uuid().optional(),persistentDataPolicy:D1,version:d.number().int().positive(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1)}).strict()),contentHash:Dn.optional(),files:d.array(d.object({path:d.string().refine(e=>Ep(e)&&!jC.includes(e),"not a file of a customer_deployed plan"),content:d.string()}).strict()).optional()}).strict(),Aae=d.object({schemaVersion:d.literal(1),testEnvironment:gae.nullable().optional(),runtimePlan:d.object({version:d.number().int().positive(),contentHash:Dn,files:d.array(d.object({path:d.string().refine(Ep,"not a recipe file path"),content:d.string()}).strict()).min(1),repository:im.optional(),recipeRepository:im.optional(),recipe:d.record(d.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"]}),uG=d.object({schemaVersion:d.literal(1),state:d.nativeEnum(N1),ending:d.nativeEnum(kp).nullable(),cause:d.nativeEnum(Bp).nullable(),deadlineAt:d.string().datetime()}).strict();function lG(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(lG,"attemptClosure");var dG=50,JRe=d.object({repository:Ir,revisions:d.array(d.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:d.array(d.string().min(1)).min(1).max(dG)}).strict();function qC(e){if(typeof e=="number"&&!Number.isFinite(e))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(e))return`[${e.map(qC).join(",")}]`;if(e!==null&&typeof e=="object"){let n=e;return`{${Object.keys(n).sort().map(i=>`${JSON.stringify(i)}:${qC(n[i])}`).join(",")}}`}let t=JSON.stringify(e);if(t===void 0)throw new TypeError("Canonical JSON requires JSON values");return t}o(qC,"canonicalJson");function pG(e){return(0,T1.createHash)("sha256").update(qC(e),"utf8").digest("hex")}o(pG,"manifestHash");var $u=o(e=>({provider:e.provider,providerAccountId:e.providerAccountId,providerRepositoryId:e.providerRepositoryId}),"toSourceRef");function sS(e,t,{statedPins:n=!0,credentialKinds:i=!0,credentialBlockers:r=!0}={}){return _oe.parse({schemaVersion:1,runId:e,execution:t.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{},...t.runSettingsFromApp?{runSettings:!0}:{},...i?{credentialKinds:!0}:{},...r?{credentialBlockers:!0}:{}})}o(sS,"handshakeRequest");function fG(e){let t=Toe.parse(e);if(pG(t.manifest)!==t.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return t}o(fG,"parseHandshakeResponse");function hae(e){let t=o(r=>r.map(s=>({repository:$u(s.repository),number:s.number,...s.commitSha===void 0?{}:{commitSha:s.commitSha}})),"pullRequests"),n=e.noTests?{noTests:e.noTests.map(r=>({repository:$u(r.repository),reason:r.reason}))}:{};if(e.status==="delivered")return{status:e.status,...n,pullRequests:t(e.pullRequests)};let i=o(r=>r.map(s=>({repository:$u(s.repository),message:s.message,...s.branch===void 0?{}:{branch:s.branch},...s.commitSha===void 0?{}:{commitSha:s.commitSha},...s.heldBack===void 0?{}:{heldBack:s.heldBack}})),"failures");return e.status==="partial"?{status:e.status,...n,pullRequests:t(e.pullRequests),failures:i(e.failures)}:e.status==="failed"&&e.failures?{...e,...n,failures:i(e.failures)}:{...e,...n}}o(hae,"toDelivery");function mae(e){return e.issues.map(t=>`${t.path.map((i,r)=>typeof i=="number"?`[${i}]`:r===0?i:`.${i}`).join("")}: ${t.message}`).join("; ")}o(mae,"describeIssues");function gG(e){let{manifest:t}=e;if(voe.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=K1.safeParse({schemaVersion:1,run:{runId:t.runId,attemptNumber:e.attemptNumber,manifestHash:pG(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(i=>({repository:$u(i.repository),revision:i.revision})),...e.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:hae(e.generatedTests)},producer:e.producer,report:e.report,...e.githubWrites?.length?{githubWrites:e.githubWrites.map(i=>({...i,repository:$u(i.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${mae(n.error)}`);return yae(n.data,t,e.checkedOut),n.data}o(gG,"buildReportUpload");function yae(e,t,n){let i=o(s=>n.find(a=>ji(a.repository)===ji(s.repository))?.revision??s.revision,"revisionOf"),r=new Map(t.sources.map(s=>[`${s.repository.namespace}/${s.repository.name}`.toLowerCase(),i(s)]));e.report.validation.acceptedEvidence.forEach((s,a)=>{let c=`report.validation.acceptedEvidence[${a}]`,u=r.get(s.repository.toLowerCase());if(!u)throw new Error(`${c}.repository: ${s.repository} is outside the run's snapshot`);if(s.revision!==u)throw new Error(`${c}.revision: evidence is not from the checked-out revision ${u}`)})}o(yae,"assertEvidenceFromSnapshot");function AG(e){if(e.reportUploaded)return{schemaVersion:1,reason:"report_uploaded",cause:null};if(e.recipeUploaded)return{schemaVersion:1,reason:"recipe_uploaded",cause:null};if(e.revisionsUploaded)return{schemaVersion:1,reason:"revisions_uploaded",cause:null};let t=e.githubWrites?.length?{githubWrites:e.githubWrites.map(i=>({...i,repository:$u(i.repository)}))}:{},n=e.sharedEnvironmentRecords?{sharedEnvironmentRecords:e.sharedEnvironmentRecords}:{};return e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null,...t,...n}:e.mergeConflict&&$1(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict,...t,...n}:{schemaVersion:1,reason:"no_report",cause:$1({...e,mergeConflict:void 0}),...t,...n}}o(AG,"attemptEndFor");function $1(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":e.environmentUnavailable?"environment_unavailable":"agent_failed"}o($1,"noReportCause");var nxe=["clean","recipe-drift"];var lo=ee(require("path"));var oxe={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var oS=o(e=>new Map((e??[]).flatMap(t=>t.file?[[_a(t.key),t.file.name]]:[])),"itemNames"),vae=10*1024*1024,mG=o(e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","needsExtraction"),yG=o((e,t)=>lo.join(lo.dirname(e),`${lo.basename(e,lo.extname(e))}${t}`),"besideFile"),EG=o(e=>yG(e,".extracted.txt"),"extractedTextPath");var Iae=o(e=>yG(e,".quotes.txt"),"confirmedQuotesPath");function bG(e){return mG(e.file)?EG(e.path):e.file?.mediaType==="application/pdf"?Iae(e.path):e.path}o(bG,"itemTextPath");var xp=ee(require("fs")),Ua=ee(require("path"));var wae=8;function ln(e,t,n={}){let i=t.slice(0,wae),r=t.length-i.length;return{name:e,passed:!1,details:i.join("; ")+(r>0?`; \u2026and ${r} more`:""),...n.fatal?{fatal:!0}:{}}}o(ln,"fail");function Gi(e){if(xp.existsSync(e))try{return JSON.parse(xp.readFileSync(e,"utf-8"))}catch{return}}o(Gi,"readJsonFile");function ve(e,t){return Gi(Ua.join(e.outputsDir,t))}o(ve,"readArtifact");function Xn(e,t){return{name:e,verify(n,i){let{errors:r}=t(n,i);return r.length===0?{name:this.name,passed:!0}:ln(this.name,r,{fatal:!0})}}}o(Xn,"schemaGate");function di(e,t){return Ua.relative(e,Ua.resolve(e,t)).replace(/\/+$/,"")}o(di,"relNorm");function Qp(e){return e.replace(/\s+/g," ").trim()}o(Qp,"normalizeCode");var $p=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");function Nt(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(r=>r.length)),n="`".repeat(t+1),i=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${i}${e}${i}${n}`}o(Nt,"codeSpan");var vG=ee(require("path"));var aS="outputs/preflight.json",Fa="pr-diff.txt",cS="related-diffs";function uS(e){return vG.join(cS,`${e.toLowerCase().replace(/\//g,"__").replace(/[^a-z0-9._-]/g,"_")}.diff`)}o(uS,"relatedDiffArtifact");var ys=ee(require("path"));var Tp=ee(require("path"));var po="Skyramp Testbot",Oa="test-bot@skyramp.dev";var _u=o(e=>e.slice(0,12),"shortCommit");var Cae=o((e,t)=>Vt(t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim(),"git");function IG(e){let t="";try{t=Cae(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/${Tp.basename(Tp.resolve(e)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}o(IG,"repositorySlug");var Rxe=new Set(Object.values(co));var xxe=d.object({checks:d.array(d.object({repository:d.string().optional(),name:d.string().min(1),headSha:d.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:d.string().default("completed"),conclusion:d.string().nullable().optional(),url:d.string().optional(),summary:d.string().optional()}))});var Sae=["generate-unit","native-run"],Dxe=["preflight","plan","write",...Sae,"report","deliver"];var Em=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(Em||{}),kae=Object.values(Em);var wG=8e3;function CG(e,t){return(e.contextRepositories??[]).some(n=>pi(n,t))}o(CG,"pinnedForContext");var lS=new Map;function Rae(e){return e.repositorySlug?e.repositorySlug:(lS.has(e.repositoryPath)||lS.set(e.repositoryPath,IG(e.repositoryPath)),lS.get(e.repositoryPath))}o(Rae,"workingSlug");function Jt(e){let t=Rae(e);return[{slug:t,path:e.repositoryPath,writable:!CG(e,t),working:!0},...(e.relatedRepos??[]).map(n=>({slug:n.slug,path:n.path,writable:n.writable===!0,working:!1}))]}o(Jt,"runSources");var pi=o((e,t)=>e.toLowerCase()===t.toLowerCase(),"sameSlug");function Nu(e,t){return t?.trim()?e.find(n=>pi(n.slug,t.trim())):e[0]}o(Nu,"findSource");function wr(e,t){return Nu(Jt(e),t)}o(wr,"resolveSource");var xae=o((e,t)=>`${t} is not a repository of this run (${Jt(e).map(n=>n.slug).join(", ")})`,"notARepository");function Es(e,t){let n=wr(e,t);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${Jt(e).filter(i=>i.writable).map(i=>i.slug).join(", ")}`}:{error:xae(e,t)}}o(Es,"writableSource");function fi(e,t){return SG(Jt(e),t)}o(fi,"checkoutLabel");var dS=o(e=>ys.basename(ys.resolve(e.path)),"relatedDirName");function SG(e,t){return e.length<2?"":`${Nu(e,t)?.slug??t}: `}o(SG,"labelAmong");var Hxe={focused:"Focused",impacted_critical:"Impacted and critical",broad:"Broad"};var Uu=o(e=>!!e.inputs?.scheduledValidation?.comparisonBaselineId,"retestsKnownFailures");var hb=ee(require("fs")),Dt=ee(require("path"));var Br=ee(require("fs")),Sq=require("child_process"),kq=require("module"),Bq=ee(require("os")),yi=ee(require("path"));var pe={};ei(pe,{$brand:()=>kS,$input:()=>ix,$output:()=>rx,INVALID:()=>Pn,NEVER:()=>SS,TimePrecision:()=>hx,ZodAny:()=>r$,ZodArray:()=>a$,ZodBase64:()=>pE,ZodBase64URL:()=>fE,ZodBigInt:()=>vl,ZodBigIntFormat:()=>hE,ZodBoolean:()=>bl,ZodCIDRv4:()=>lE,ZodCIDRv6:()=>dE,ZodCUID:()=>rE,ZodCUID2:()=>iE,ZodCatch:()=>R$,ZodCodec:()=>$f,ZodCompileAsyncError:()=>Ai,ZodCompileUnsupportedError:()=>He,ZodCreditCard:()=>YQ,ZodCustom:()=>Tf,ZodCustomStringFormat:()=>nc,ZodDate:()=>Sf,ZodDefault:()=>I$,ZodDiscriminatedUnion:()=>u$,ZodE164:()=>gE,ZodEmail:()=>Xy,ZodEmoji:()=>tE,ZodEnum:()=>ml,ZodError:()=>Yde,ZodExactOptional:()=>bE,ZodFile:()=>y$,ZodFirstPartyTypeKind:()=>j$,ZodFunction:()=>F$,ZodGUID:()=>eE,ZodIBAN:()=>WQ,ZodIPv4:()=>cE,ZodIPv6:()=>uE,ZodISODate:()=>Co,ZodISODateTime:()=>wo,ZodISODuration:()=>ko,ZodISOTime:()=>So,ZodInstanceOf:()=>L$,ZodIntersection:()=>l$,ZodIssueCode:()=>Kde,ZodJWT:()=>AE,ZodKSUID:()=>aE,ZodLazy:()=>N$,ZodLiteral:()=>m$,ZodMAC:()=>JQ,ZodMap:()=>A$,ZodNaN:()=>Q$,ZodNanoID:()=>nE,ZodNever:()=>s$,ZodNonOptional:()=>vE,ZodNull:()=>t$,ZodNullable:()=>v$,ZodNumber:()=>El,ZodNumberFormat:()=>rc,ZodObject:()=>Bf,ZodOptional:()=>xf,ZodPipe:()=>Qf,ZodPrefault:()=>C$,ZodPreprocess:()=>$$,ZodPromise:()=>U$,ZodReadonly:()=>T$,ZodRealError:()=>ir,ZodRecord:()=>hl,ZodSet:()=>h$,ZodString:()=>yl,ZodStringFormat:()=>pt,ZodSuccess:()=>B$,ZodSymbol:()=>XQ,ZodTemplateLiteral:()=>_$,ZodTransform:()=>E$,ZodTuple:()=>p$,ZodType:()=>Oe,ZodULID:()=>sE,ZodURL:()=>Cf,ZodUUID:()=>Hi,ZodUndefined:()=>e$,ZodUnion:()=>Rf,ZodUnknown:()=>i$,ZodVoid:()=>o$,ZodXID:()=>oE,ZodXor:()=>c$,_ZodString:()=>Ky,_default:()=>w$,_function:()=>Xz,any:()=>Qz,array:()=>kf,base64:()=>lz,base64url:()=>dz,bigint:()=>Sz,boolean:()=>KQ,catch:()=>x$,check:()=>eq,cidrv4:()=>cz,cidrv6:()=>uz,clone:()=>st,codec:()=>Yz,coerce:()=>V$,compile:()=>cx,config:()=>Pt,core:()=>Cs,creditCard:()=>fz,cuid:()=>ez,cuid2:()=>tz,currencyCode:()=>Ez,custom:()=>tq,date:()=>Tz,decode:()=>LQ,decodeAsync:()=>GQ,deepPartial:()=>gq,describe:()=>nq,discriminatedUnion:()=>Fz,e164:()=>pz,email:()=>VV,emoji:()=>KV,encode:()=>MQ,encodeAsync:()=>jQ,endsWith:()=>sl,enum:()=>yE,exactOptional:()=>b$,file:()=>zz,flattenError:()=>Gp,float32:()=>vz,float64:()=>Iz,formatError:()=>Vp,fromJSONSchema:()=>pq,function:()=>Xz,getDiscriminatedOption:()=>SB,getErrorMap:()=>epe,globalRegistry:()=>pn,gt:()=>zi,gte:()=>Sr,guid:()=>zV,hash:()=>bz,hex:()=>yz,hostname:()=>mz,httpUrl:()=>ZV,iban:()=>gz,includes:()=>rl,input:()=>hq,instanceof:()=>iq,int:()=>Wy,int32:()=>wz,int64:()=>kz,intersection:()=>d$,invertCodec:()=>Wz,ipv4:()=>sz,ipv6:()=>az,iso:()=>Df,json:()=>oq,jwt:()=>Az,keyof:()=>Dz,ksuid:()=>iz,lazy:()=>P$,length:()=>Za,literal:()=>Vz,locales:()=>gf,looseObject:()=>Pz,looseRecord:()=>Mz,lowercase:()=>tl,lt:()=>Vi,lte:()=>Cr,mac:()=>oz,map:()=>Lz,maxLength:()=>Wa,maxSize:()=>Eo,memoizer:()=>uf,meta:()=>rq,mime:()=>al,minLength:()=>ws,minSize:()=>qi,multipleOf:()=>yo,nan:()=>Jz,nanoid:()=>XV,nativeEnum:()=>Gz,negative:()=>Oy,never:()=>mE,nonnegative:()=>Ly,nonoptional:()=>k$,nonpositive:()=>My,normalize:()=>cl,null:()=>n$,nullable:()=>wf,nullish:()=>qz,number:()=>ZQ,object:()=>_z,optional:()=>ec,output:()=>mq,overwrite:()=>hi,parse:()=>PQ,parseAsync:()=>UQ,partialRecord:()=>Oz,pipe:()=>Zy,positive:()=>Fy,prefault:()=>S$,preprocess:()=>aq,prettifyError:()=>$S,promise:()=>Kz,properties:()=>ol,property:()=>jy,readonly:()=>D$,record:()=>g$,refine:()=>O$,regex:()=>el,regexes:()=>zr,registry:()=>fy,safeDecode:()=>zQ,safeDecodeAsync:()=>HQ,safeEncode:()=>VQ,safeEncodeAsync:()=>qQ,safeParse:()=>FQ,safeParseAsync:()=>OQ,set:()=>jz,setErrorMap:()=>Xde,size:()=>Ya,slugify:()=>pl,startsWith:()=>il,strictObject:()=>Nz,string:()=>If,stringFormat:()=>hz,stringbool:()=>sq,success:()=>Hz,superRefine:()=>M$,symbol:()=>Rz,templateLiteral:()=>Zz,toJSONSchema:()=>qy,toLowerCase:()=>ll,toUpperCase:()=>dl,toZod:()=>Dp,transform:()=>EE,treeifyError:()=>QS,trim:()=>ul,tuple:()=>f$,uint32:()=>Cz,uint64:()=>Bz,ulid:()=>nz,undefined:()=>xz,union:()=>Il,unknown:()=>Xa,uppercase:()=>nl,url:()=>WV,util:()=>N,uuid:()=>qV,uuidv4:()=>HV,uuidv6:()=>JV,uuidv7:()=>YV,validate:()=>zp,validateAsync:()=>qp,void:()=>$z,withParser:()=>gy,xid:()=>rz,xor:()=>Uz});var Cs={};ei(Cs,{$ZodAny:()=>hB,$ZodArray:()=>IB,$ZodAsyncError:()=>nr,$ZodBase64:()=>iB,$ZodBase64URL:()=>sB,$ZodBigInt:()=>ny,$ZodBigIntFormat:()=>pB,$ZodBoolean:()=>nf,$ZodCIDRv4:()=>nB,$ZodCIDRv6:()=>rB,$ZodCUID:()=>Vk,$ZodCUID2:()=>zk,$ZodCatch:()=>LB,$ZodCheck:()=>yt,$ZodCheckBigIntFormat:()=>mk,$ZodCheckEndsWith:()=>xk,$ZodCheckGreaterThan:()=>Mm,$ZodCheckIncludes:()=>Bk,$ZodCheckLengthEquals:()=>wk,$ZodCheckLessThan:()=>Om,$ZodCheckLowerCase:()=>Sk,$ZodCheckMaxLength:()=>vk,$ZodCheckMaxSize:()=>yk,$ZodCheckMimeType:()=>Tk,$ZodCheckMinLength:()=>Ik,$ZodCheckMinSize:()=>Ek,$ZodCheckMultipleOf:()=>Ak,$ZodCheckNumberFormat:()=>hk,$ZodCheckOverwrite:()=>Dk,$ZodCheckProperties:()=>$k,$ZodCheckProperty:()=>Qk,$ZodCheckRegex:()=>Ck,$ZodCheckSizeEquals:()=>bk,$ZodCheckStartsWith:()=>Rk,$ZodCheckStringFormat:()=>Yu,$ZodCheckUpperCase:()=>kk,$ZodCodec:()=>sf,$ZodCreditCard:()=>aB,$ZodCustom:()=>JB,$ZodCustomStringFormat:()=>lB,$ZodCyclicError:()=>uy,$ZodDate:()=>bB,$ZodDefault:()=>UB,$ZodDiscriminatedUnion:()=>kB,$ZodE164:()=>oB,$ZodEmail:()=>Fk,$ZodEmoji:()=>jk,$ZodEncodeError:()=>ho,$ZodEnum:()=>$B,$ZodError:()=>xS,$ZodExactOptional:()=>NB,$ZodFile:()=>DB,$ZodFunction:()=>qB,$ZodGUID:()=>Pk,$ZodIBAN:()=>cB,$ZodIPv4:()=>Xk,$ZodIPv6:()=>eB,$ZodISODate:()=>Wk,$ZodISODateTime:()=>Yk,$ZodISODuration:()=>Kk,$ZodISOTime:()=>Zk,$ZodIntersection:()=>BB,$ZodJWT:()=>uB,$ZodKSUID:()=>Jk,$ZodLazy:()=>of,$ZodLiteral:()=>TB,$ZodMAC:()=>tB,$ZodMap:()=>xB,$ZodNaN:()=>jB,$ZodNanoID:()=>Gk,$ZodNever:()=>yB,$ZodNonOptional:()=>OB,$ZodNull:()=>AB,$ZodNullable:()=>PB,$ZodNumber:()=>ty,$ZodNumberFormat:()=>dB,$ZodObject:()=>oV,$ZodObjectJIT:()=>wB,$ZodOptional:()=>iy,$ZodPipe:()=>sy,$ZodPrefault:()=>FB,$ZodPreprocess:()=>GB,$ZodPromise:()=>HB,$ZodReadonly:()=>VB,$ZodRealError:()=>rr,$ZodRecord:()=>RB,$ZodRegistry:()=>py,$ZodSet:()=>QB,$ZodString:()=>za,$ZodStringFormat:()=>ot,$ZodSuccess:()=>MB,$ZodSymbol:()=>fB,$ZodTemplateLiteral:()=>zB,$ZodTransform:()=>_B,$ZodTuple:()=>ry,$ZodType:()=>De,$ZodULID:()=>qk,$ZodURL:()=>Lk,$ZodUUID:()=>Uk,$ZodUndefined:()=>gB,$ZodUnion:()=>rf,$ZodUnknown:()=>mB,$ZodVoid:()=>EB,$ZodXID:()=>Hk,$ZodXor:()=>CB,$brand:()=>kS,$constructor:()=>S,$input:()=>ix,$output:()=>rx,Doc:()=>Va,INVALID:()=>Pn,JSONSchema:()=>LV,JSONSchemaGenerator:()=>Hy,NEVER:()=>SS,TimePrecision:()=>hx,URL_BAD_FORMAT:()=>Ok,URL_UNPARSEABLE:()=>Zp,ZodCompileAsyncError:()=>Ai,ZodCompileUnsupportedError:()=>He,_any:()=>Dx,_array:()=>Mx,_base64:()=>_y,_base64url:()=>Ny,_bigint:()=>kx,_boolean:()=>Cx,_catch:()=>Ude,_check:()=>SV,_cidrv4:()=>Ty,_cidrv6:()=>Dy,_coercedBigint:()=>Bx,_coercedBoolean:()=>Sx,_coercedDate:()=>Fx,_coercedNumber:()=>yx,_coercedString:()=>px,_creditCard:()=>gx,_cuid:()=>Sy,_cuid2:()=>ky,_custom:()=>jx,_date:()=>Ux,_decode:()=>Rm,_decodeAsync:()=>Qm,_default:()=>_de,_discriminatedUnion:()=>Ide,_e164:()=>Py,_email:()=>my,_emoji:()=>wy,_encode:()=>Bm,_encodeAsync:()=>xm,_endsWith:()=>sl,_enum:()=>Rde,_file:()=>Lx,_float32:()=>bx,_float64:()=>vx,_gt:()=>zi,_gte:()=>Sr,_guid:()=>yy,_iban:()=>Ax,_includes:()=>rl,_int:()=>Ex,_int32:()=>Ix,_int64:()=>Rx,_intersection:()=>wde,_ipv4:()=>Qy,_ipv6:()=>$y,_isoDate:()=>mf,_isoDateTime:()=>hf,_isoDuration:()=>Ef,_isoTime:()=>yf,_jwt:()=>Uy,_ksuid:()=>xy,_lazy:()=>Lde,_length:()=>Za,_literal:()=>Qde,_lowercase:()=>tl,_lt:()=>Vi,_lte:()=>Cr,_mac:()=>fx,_map:()=>kde,_max:()=>Cr,_maxLength:()=>Wa,_maxSize:()=>Eo,_mime:()=>al,_min:()=>Sr,_minLength:()=>ws,_minSize:()=>qi,_multipleOf:()=>yo,_nan:()=>Ox,_nanoid:()=>Cy,_nativeEnum:()=>xde,_negative:()=>Oy,_never:()=>Nx,_nonnegative:()=>Ly,_nonoptional:()=>Nde,_nonpositive:()=>My,_normalize:()=>cl,_null:()=>Tx,_nullable:()=>Dde,_number:()=>mx,_optional:()=>Tde,_overwrite:()=>hi,_parse:()=>zu,_parseAsync:()=>qu,_pipe:()=>Fde,_positive:()=>Fy,_promise:()=>jde,_properties:()=>ol,_property:()=>jy,_readonly:()=>Ode,_record:()=>Sde,_refine:()=>Gx,_regex:()=>el,_safeDecode:()=>Tm,_safeDecodeAsync:()=>_m,_safeEncode:()=>$m,_safeEncodeAsync:()=>Dm,_safeParse:()=>Hu,_safeParseAsync:()=>Ju,_set:()=>Bde,_size:()=>Ya,_slugify:()=>pl,_startsWith:()=>il,_string:()=>dx,_stringFormat:()=>Ka,_stringbool:()=>Hx,_success:()=>Pde,_superRefine:()=>Vx,_symbol:()=>Qx,_templateLiteral:()=>Mde,_toLowerCase:()=>ll,_toUpperCase:()=>dl,_transform:()=>$de,_trim:()=>ul,_tuple:()=>Cde,_uint32:()=>wx,_uint64:()=>xx,_ulid:()=>By,_undefined:()=>$x,_union:()=>bde,_unknown:()=>_x,_uppercase:()=>nl,_url:()=>Af,_uuid:()=>Ey,_uuidv4:()=>by,_uuidv6:()=>vy,_uuidv7:()=>Iy,_void:()=>Px,_xid:()=>Ry,_xor:()=>vde,base64Charset:()=>Wm,base64urlCharset:()=>tf,canParseURL:()=>Mk,clone:()=>st,compile:()=>cx,compileFn:()=>Ay,config:()=>Pt,createStandardJSONSchemaMethod:()=>fl,createToJSONSchemaMethod:()=>Yx,decode:()=>vce,decodeAsync:()=>wce,describe:()=>zx,encode:()=>bce,encodeAsync:()=>Ice,extractDefs:()=>vo,finalize:()=>Io,flattenError:()=>Gp,formatError:()=>Vp,getDiscriminatedOption:()=>SB,globalConfig:()=>rn,globalRegistry:()=>pn,handleUnrepresentable:()=>Yt,initializeContext:()=>bo,isBackEdge:()=>dy,isRecursiveSchema:()=>ly,isValidBase64:()=>ef,isValidBase64URL:()=>Zm,isValidCIDRv6:()=>Ym,isValidCreditCard:()=>Km,isValidIBAN:()=>Xm,isValidIPv6:()=>Xp,isValidJWT:()=>ey,locales:()=>gf,memoizer:()=>uf,mergeValues:()=>Wu,meta:()=>qx,parse:()=>Sm,parseAsync:()=>km,parseURLObject:()=>rV,prettifyError:()=>$S,process:()=>at,processSchema:()=>at,regexes:()=>zr,registry:()=>fy,safeDecode:()=>Sce,safeDecodeAsync:()=>Bce,safeEncode:()=>Cce,safeEncodeAsync:()=>kce,safeParse:()=>Ace,safeParseAsync:()=>hce,standardProps:()=>zm,stripTabAndNewline:()=>Kp,toDotPath:()=>PG,toJSONSchema:()=>qy,toZod:()=>Dp,treeifyError:()=>QS,urlHostnameOk:()=>Hm,urlProtocolOk:()=>Jm,util:()=>N,validate:()=>zp,validateAsync:()=>qp,validateURL:()=>qm,version:()=>_k,withParser:()=>gy});var N={};ei(N,{BIGINT_FORMAT_RANGES:()=>Fp,CONSTANT_CATCH:()=>wm,Class:()=>AS,NUMBER_FORMAT_RANGES:()=>Up,aborted:()=>Nn,allowsEval:()=>yS,assert:()=>Nae,assertEqual:()=>$ae,assertIs:()=>Dae,assertNever:()=>_ae,assertNotEqual:()=>Tae,assignProp:()=>dn,attachSchema:()=>Op,base64ToUint8Array:()=>QG,base64urlToUint8Array:()=>ece,cached:()=>Lu,captureStackTrace:()=>vm,cleanEnum:()=>Xae,cleanRegex:()=>vs,clone:()=>st,cloneDef:()=>Fae,codePointLength:()=>ja,constantCatch:()=>wS,createTransparentProxy:()=>Vae,defineLazy:()=>hS,defineLazyInternal:()=>Ge,derived:()=>ice,esc:()=>_n,escapeRegex:()=>Vr,explicitlyAborted:()=>vS,extend:()=>Hae,finalizeIssue:()=>tr,floatSafeRemainder:()=>_p,getElementAtPath:()=>Oae,getEnumValues:()=>Ou,getLengthableOrigin:()=>Lp,getParsedType:()=>Gae,getSizableOrigin:()=>Mp,hexToUint8Array:()=>nce,hide:()=>jp,installLazyProp:()=>cce,isObject:()=>La,isPlainObject:()=>Gr,issue:()=>Vu,joinValues:()=>k,jsonStringifyReplacer:()=>Mu,members:()=>IS,merge:()=>Yae,mergeDefs:()=>gi,normalizeParams:()=>q,nullish:()=>bm,numKeys:()=>jae,objectClone:()=>Pae,omit:()=>qae,optionalKeys:()=>bS,own:()=>Ao,parsedType:()=>U,partial:()=>Wae,pick:()=>zae,prefixIssues:()=>er,primitiveTypes:()=>ES,promiseAllObject:()=>Mae,propertyKeyTypes:()=>Pp,randomString:()=>Lae,rawShape:()=>ju,required:()=>Zae,safeExtend:()=>Jae,shallowClone:()=>Np,sizeCaps:()=>Gu,slugify:()=>mS,stringifyPrimitive:()=>P,toZod:()=>Dp,uint8ArrayToBase64:()=>$G,uint8ArrayToBase64url:()=>tce,uint8ArrayToHex:()=>rce,unwrapMessage:()=>Fu});function $ae(e){return e}o($ae,"assertEqual");function Tae(e){return e}o(Tae,"assertNotEqual");function Dp(){return e=>e}o(Dp,"toZod");function Dae(e){}o(Dae,"assertIs");function _ae(e){throw new Error("Unexpected value in exhaustive check")}o(_ae,"assertNever");function Nae(e){}o(Nae,"assert");function Ou(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}o(Ou,"getEnumValues");function k(e,t="|"){return e.map(n=>P(n)).join(t)}o(k,"joinValues");function Mu(e,t){return typeof t=="bigint"?t.toString():t}o(Mu,"jsonStringifyReplacer");var gS=class{static{o(this,"Cached")}constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Lu(e){return new gS(e)}o(Lu,"cached");function bm(e){return e==null}o(bm,"nullish");function vs(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}o(vs,"cleanRegex");function _p(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}o(_p,"floatSafeRemainder");var kG=Symbol("evaluating");function hS(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==kG)return i===void 0&&(i=kG,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}o(hS,"defineLazy");function Pae(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}o(Pae,"objectClone");function dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}o(dn,"assignProp");function ju(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}o(ju,"rawShape");function bs(e){return ju(e._zod.def)??e._zod.def.shape}o(bs,"sourceShape");function BG(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return dn(this,t,i),i},enumerable:!0,configurable:!0})}o(BG,"deferProp");function RG(e,t,n){t in e?dn(e,t,n):e[t]=n}o(RG,"putProp");function Ma(e,t,n,i){let r=bs(t);for(let s of n){let a=Object.getOwnPropertyDescriptor(r,s);a.enumerable&&(a.get?BG(e,s,()=>{let c=t._zod.def.shape[s];return i?i(c,s):c}):RG(e,s,i?i(a.value,s):a.value))}}o(Ma,"mirrorShape");function Uae(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);i.enumerable&&(i.get?BG(e,n,()=>t[n]):RG(e,n,i.value))}}o(Uae,"mirrorProps");function gi(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}o(gi,"mergeDefs");function Fae(e){return gi(e._zod.def)}o(Fae,"cloneDef");function Oae(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}o(Oae,"getElementAtPath");function Mae(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let s=0;s<t.length;s++)r[t[s]]=i[s];return r})}o(Mae,"promiseAllObject");function Lae(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}o(Lae,"randomString");function _n(e){return JSON.stringify(e)}o(_n,"esc");function mS(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}o(mS,"slugify");var vm="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function La(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(La,"isObject");var yS=Lu(()=>{if(rn.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gr(e){if(La(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(La(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}o(Gr,"isPlainObject");function Np(e){return Gr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}o(Np,"shallowClone");function jae(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}o(jae,"numKeys");var Gae=o(e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},"getParsedType"),Pp=new Set(["string","number","symbol"]),ES=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Vr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(Vr,"escapeRegex");function st(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}o(st,"clone");function q(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(q,"normalizeParams");function Vae(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,s){return t??(t=e()),Reflect.set(t,i,r,s)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}o(Vae,"createTransparentProxy");function P(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}o(P,"stringifyPrimitive");function bS(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}o(bS,"optionalKeys");var Up={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Fp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zae(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return Ma(s,e,Im(e,t)),st(e,gi(n,{shape:s,checks:[]}))}o(zae,"pick");function Im(e,t){let n=bs(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw new Error(`Unrecognized key: "${String(r)}"`);t[r]&&i.push(r)}return i}o(Im,"maskedKeys");function qae(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Im(e,t)),a={};return Ma(a,e,Reflect.ownKeys(bs(e)).filter(c=>!s.has(c))),st(e,gi(n,{shape:a,checks:[]}))}o(qae,"omit");function Hae(e,t){if(!Gr(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=bs(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return st(e,gi(e._zod.def,{shape:xG(e,t)}))}o(Hae,"extend");function xG(e,t){let n={};return Ma(n,e,Reflect.ownKeys(bs(e))),Uae(n,t),n}o(xG,"extended");function Jae(e,t){if(!Gr(t))throw new Error("Invalid input to safeExtend: expected a plain object");return st(e,gi(e._zod.def,{shape:xG(e,t)}))}o(Jae,"safeExtend");function Yae(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Ma(n,e,Reflect.ownKeys(bs(e))),Ma(n,t,Reflect.ownKeys(bs(t)));let i=gi(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return st(e,i)}o(Yae,"merge");function Wae(e,t,n,i="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let c=n?new Set(Im(t,n)):void 0,u={};return Ma(u,t,Reflect.ownKeys(bs(t)),e&&((l,p)=>c&&!c.has(p)?l:new e({type:"optional",innerType:l}))),st(t,gi(t._zod.def,{shape:u,checks:[]}))}o(Wae,"partial");function Zae(e,t,n){let i=n?new Set(Im(t,n)):void 0,r={};return Ma(r,t,Reflect.ownKeys(bs(t)),(s,a)=>i&&!i.has(a)?s:new e({type:"nonoptional",innerType:s})),st(t,gi(t._zod.def,{shape:r}))}o(Zae,"required");function Nn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}o(Nn,"aborted");function vS(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}o(vS,"explicitlyAborted");function er(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}o(er,"prefixIssues");function Fu(e){return typeof e=="string"?e:e?.message}o(Fu,"unwrapMessage");function Gu(e){let t=[];for(let n of e??[]){let i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;let r=i.maximum??i.length??i.size;r>=0&&t.push([r,n])}return t}o(Gu,"sizeCaps");function Op(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}o(Op,"attachSchema");function tr(e,t,n){var i;let r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:Fu(e.inst?._zod.def?.error?.(e))??Fu(s?.(e))??Fu(t?.error?.(e))??Fu(n.customError?.(e))??Fu(n.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(c[u]=e[u]);return c.path??(c.path=[]),c.message=a,t?.reportInput&&(c.input=e.input),c}o(tr,"finalizeIssue");function Mp(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}o(Mp,"getSizableOrigin");var Kae=/[\uD800-\uDBFF]/;function ja(e){let t=e.length;if(!Kae.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}o(ja,"codePointLength");function Lp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(Lp,"getLengthableOrigin");function U(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}o(U,"parsedType");function Vu(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}o(Vu,"issue");function Xae(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}o(Xae,"cleanEnum");function QG(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}o(QG,"base64ToUint8Array");function $G(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}o($G,"uint8ArrayToBase64");function ece(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return QG(t+n)}o(ece,"base64urlToUint8Array");function tce(e){return $G(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}o(tce,"uint8ArrayToBase64url");function nce(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}o(nce,"hexToUint8Array");function rce(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}o(rce,"uint8ArrayToHex");var AS=class{static{o(this,"Class")}constructor(...t){}};function IS(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):sce(e,n,i.value)}}o(IS,"members");function Ao(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}o(Ao,"own");function jp(e,t,n){return Ao(e,t,n,!1)}o(jp,"hide");function ice(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ao(this,n,i(this))},set(r){Ao(this,n,r)}})}return t}o(ice,"derived");function sce(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ao(this,t,n.bind(this))},set(i){Ao(this,t,i)}})}o(sce,"defineBound");function oce(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}o(oce,"claim");var fS,go=!1,ace={configurable:!0,get(){go=!0}};function Ge(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&fS!==e._zod){fS=void 0;return}fS=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,ace);let r=go;go=!1;try{let s=n(this);return go?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),go=go||r,s}catch(s){throw delete this[t],go=go||r,s}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}o(Ge,"defineLazyInternal");function cce(e,t,n,i){let r=oce(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:s})}})}o(cce,"installLazyProp");var wm="~constantCatch";function wS(e){let t=o(()=>e,"fn");return t[wm]=!0,t}o(wS,"constantCatch");var TG,SS=Object.freeze({status:"aborted"}),CS={value:void 0,enumerable:!1},DG="captureStackTrace"in Error?Error:null;function uce(e){let t=DG;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return DG=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}o(uce,"newError");function S(e,t,n,i){let r={};function s(A){this.def=A,this.constr=f,this.traits=new Set}o(s,"Internals"),s.prototype=r;let a=n,c=a&&new WeakSet;function u(A,h){if(A._zod){if(A._zod.traits.has(e))return}else{CS.value=new s(h);try{Object.defineProperty(A,"_zod",CS)}finally{CS.value=void 0}}if(A._zod.traits.add(e),t(A,h),c){let E=Object.getPrototypeOf(A),b=A._zod.constr.prototype,v=E;for(;v&&v!==b;)v=Object.getPrototypeOf(v);let I=v??E;c.has(I)||(c.add(I),IS(I,a))}let m=f.prototype;for(let E in m)Object.prototype.hasOwnProperty.call(m,E)&&(E in A||(A[E]=m[E].bind(A)))}o(u,"init");let l=i?.Parent??Object;class p extends l{static{o(this,"Definition")}}Object.defineProperty(p,"name",{value:e});function f(A){let h=i?.Parent?uce(p):this;u(h,A);let m=h._zod.deferred;if(m){for(let b of m)b();h._zod.deferred=void 0}let E=globalThis.__zod_globalConfig?.postProcessor;return E&&E(h),h}return o(f,"_"),Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:o(A=>i?.Parent&&A instanceof i.Parent?!0:A?._zod?.traits?.has(e),"value")}),Object.defineProperty(f,"name",{value:e}),f}o(S,"$constructor");var kS=Symbol("zod_brand"),nr=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ho=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(TG=globalThis).__zod_globalConfig??(TG.__zod_globalConfig={});var rn=globalThis.__zod_globalConfig;function Pt(e){return e&&Object.assign(rn,e),rn}o(Pt,"config");function lce(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Mu,2)),e.message}o(lce,"_getMessage");function dce(e){this._zod.message=e}o(dce,"_setMessage");var pce={get:lce,set:dce,enumerable:!0,configurable:!0},RS={value:void 0,enumerable:!1},_G=new WeakSet([Object.prototype,Error.prototype]),NG=o((e,t)=>{e.name="$ZodError",RS.value=t,Object.defineProperty(e,"issues",RS),RS.value=void 0,Object.defineProperty(e,"message",pce);let n=Object.getPrototypeOf(e);_G.has(n)||(_G.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=o(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},"initializer"),xS=S("$ZodError",NG),rr=S("$ZodError",NG,void 0,{Parent:Error});function fce(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}o(fce,"node");function Gp(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?fce(n,r.path[0],()=>[]).push(t(r)):i.push(t(r));return{formErrors:i,fieldErrors:n}}o(Gp,"flattenError");function Vp(e,t=n=>n.message){let n={_errors:[]},i=o((r,s=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>i({issues:c},[...s,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...s,...a.path]);else{let c=[...s,...a.path];if(c.length===0)n._errors.push(t(a));else{let u=n,l=0;for(;l<c.length;){let p=c[l],f=l===c.length-1;if(p==="_errors"){f&&u._errors.push(t(a)),l++;continue}Object.prototype.hasOwnProperty.call(u,p)||Object.defineProperty(u,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let A=u[p];f&&A._errors.push(t(a)),u=A,l++}}}},"processError");return i(e),n}o(Vp,"formatError");function QS(e,t=n=>n.message){let n={errors:[]},i=o((r,s=[])=>{var a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>i({issues:u},[...s,...c.path]));else if(c.code==="invalid_key")i({issues:c.issues},[...s,...c.path]);else if(c.code==="invalid_element")i({issues:c.issues},[...s,...c.path]);else{let u=[...s,...c.path];if(u.length===0){n.errors.push(t(c));continue}let l=n,p=0;for(;p<u.length;){let f=u[p],A=p===u.length-1;typeof f=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,f)||Object.defineProperty(l.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[f]):(l.items??(l.items=[]),(a=l.items)[f]??(a[f]={errors:[]}),l=l.items[f]),A&&l.errors.push(t(c)),p++}}},"processError");return i(e),n}o(QS,"treeifyError");function PG(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}o(PG,"toDotPath");function $S(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${PG(i.path)}`);return t.join(`
142
+ `).map(a=>a.trim()).filter(Boolean),i=n.filter(a=>!t.test(a)),r=i.length?i:n;return[...r].reverse().find(a=>/(error|warning|problem|✖|✗|✘|fail|not listed|cannot|denied)/i.test(a))??r[r.length-1]??"(no output)"}o(qie,"hookSummary");function jj(e){if(!/\bhook\b|husky|pre-commit|lint-staged/i.test(e))return;let t=qie(e),n=ue().staged.commitHook(/husky\s*[->]\s*([\w-]+)\s+(?:script|hook)\b/i.exec(yu(e))?.[1]);return/\(code 127\)|exit code 127/i.test(e)||/command not found|: not found$/i.test(t)?ue().staged.commitHookCouldNotRun(n,t):ue().staged.commitRefusedByHook(n,t)}o(jj,"hookRefusal");var d={};ei(d,{BRAND:()=>yse,DIRTY:()=>ma,EMPTY_PATH:()=>Wie,INVALID:()=>Ce,NEVER:()=>noe,OK:()=>vn,ParseStatus:()=>un,Schema:()=>Ve,ZodAny:()=>so,ZodArray:()=>As,ZodBigInt:()=>Ea,ZodBoolean:()=>ba,ZodBranded:()=>ap,ZodCatch:()=>$a,ZodDate:()=>va,ZodDefault:()=>Qa,ZodDiscriminatedUnion:()=>Yh,ZodEffects:()=>Mr,ZodEnum:()=>Ra,ZodError:()=>Wn,ZodFirstPartyTypeKind:()=>xe,ZodFunction:()=>Zh,ZodIntersection:()=>Sa,ZodIssueCode:()=>G,ZodLazy:()=>ka,ZodLiteral:()=>Ba,ZodMap:()=>Cu,ZodNaN:()=>ku,ZodNativeEnum:()=>xa,ZodNever:()=>li,ZodNull:()=>wa,ZodNullable:()=>Pi,ZodNumber:()=>ya,ZodObject:()=>Zn,ZodOptional:()=>Fr,ZodParsedType:()=>re,ZodPipeline:()=>cp,ZodPromise:()=>oo,ZodReadonly:()=>Ta,ZodRecord:()=>Wh,ZodSchema:()=>Ve,ZodSet:()=>Su,ZodString:()=>io,ZodSymbol:()=>Iu,ZodTransformer:()=>Mr,ZodTuple:()=>Ni,ZodType:()=>Ve,ZodUndefined:()=>Ia,ZodUnion:()=>Ca,ZodUnknown:()=>gs,ZodVoid:()=>wu,addIssueToContext:()=>X,any:()=>Bse,array:()=>$se,bigint:()=>Ise,boolean:()=>Xj,coerce:()=>toe,custom:()=>Wj,date:()=>wse,datetimeRegex:()=>Jj,defaultErrorMap:()=>ps,discriminatedUnion:()=>Nse,effect:()=>Hse,enum:()=>Vse,function:()=>Lse,getErrorMap:()=>Eu,getParsedType:()=>_i,instanceof:()=>bse,intersection:()=>Pse,isAborted:()=>Hh,isAsync:()=>bu,isDirty:()=>Jh,isValid:()=>ro,late:()=>Ese,lazy:()=>jse,literal:()=>Gse,makeIssue:()=>op,map:()=>Ose,nan:()=>vse,nativeEnum:()=>zse,never:()=>xse,null:()=>kse,nullable:()=>Yse,number:()=>Kj,object:()=>Tse,objectUtil:()=>BC,oboolean:()=>eoe,onumber:()=>Xse,optional:()=>Jse,ostring:()=>Kse,pipeline:()=>Zse,preprocess:()=>Wse,promise:()=>qse,quotelessJson:()=>Hie,record:()=>Fse,set:()=>Mse,setErrorMap:()=>Yie,strictObject:()=>Dse,string:()=>Zj,symbol:()=>Cse,transformer:()=>Hse,tuple:()=>Use,undefined:()=>Sse,union:()=>_se,unknown:()=>Rse,util:()=>Ye,void:()=>Qse});var Ye;(function(e){e.assertEqual=r=>{};function t(r){}o(t,"assertIs"),e.assertIs=t;function n(r){throw new Error}o(n,"assertNever"),e.assertNever=n,e.arrayToEnum=r=>{let s={};for(let a of r)s[a]=a;return s},e.getValidEnumValues=r=>{let s=e.objectKeys(r).filter(c=>typeof r[r[c]]!="number"),a={};for(let c of s)a[c]=r[c];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(s){return r[s]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&s.push(a);return s},e.find=(r,s)=>{for(let a of r)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}o(i,"joinValues"),e.joinValues=i,e.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Ye||(Ye={}));var BC;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(BC||(BC={}));var re=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),_i=o(e=>{switch(typeof e){case"undefined":return re.undefined;case"string":return re.string;case"number":return Number.isNaN(e)?re.nan:re.number;case"boolean":return re.boolean;case"function":return re.function;case"bigint":return re.bigint;case"symbol":return re.symbol;case"object":return Array.isArray(e)?re.array:e===null?re.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?re.promise:typeof Map<"u"&&e instanceof Map?re.map:typeof Set<"u"&&e instanceof Set?re.set:typeof Date<"u"&&e instanceof Date?re.date:re.object;default:return re.unknown}},"getParsedType");var G=Ye.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"]),Hie=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Wn=class e extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};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(s){return s.message},i={_errors:[]},r=o(s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let c=i,u=0;for(;u<a.path.length;){let l=a.path[u],p=u===a.path.length-1;if(l==="_errors"){p&&c._errors.push(n(a)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||(l==="__proto__"?Object.defineProperty(c,l,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[l]={_errors:[]}),c=c[l],p&&c._errors.push(n(a)),u++}}},"processError");return r(this),i}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,Ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),i=[];for(let r of this.issues)if(r.path.length>0){let s=r.path[0];n[s]=n[s]||[],n[s].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};Wn.create=e=>new Wn(e);var Jie=o((e,t)=>{let n;switch(e.code){case G.invalid_type:e.received===re.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ye.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ye.joinValues(e.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ye.joinValues(e.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${Ye.joinValues(e.options)}, received '${e.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.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}"`:Ye.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case G.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 G.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 G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ye.assertNever(e)}return{message:n}},"errorMap"),ps=Jie;var Gj=ps;function Yie(e){Gj=e}o(Yie,"setErrorMap");function Eu(){return Gj}o(Eu,"getErrorMap");var op=o(e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,s=[...n,...r.path||[]],a={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let c="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)c=l(a,{data:t,defaultError:c}).message;return{...r,path:s,message:c}},"makeIssue"),Wie=[];function X(e,t){let n=Eu(),i=op({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ps?void 0:ps].filter(r=>!!r)});e.common.issues.push(i)}o(X,"addIssueToContext");var un=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 i=[];for(let r of n){if(r.status==="aborted")return Ce;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let s=await r.key,a=await r.value;i.push({key:s,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:s,value:a}=r;if(s.status==="aborted"||a.status==="aborted")return Ce;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[s.value]=a.value)}return{status:t.value,value:i}}},Ce=Object.freeze({status:"aborted"}),ma=o(e=>({status:"dirty",value:e}),"DIRTY"),vn=o(e=>({status:"valid",value:e}),"OK"),Hh=o(e=>e.status==="aborted","isAborted"),Jh=o(e=>e.status==="dirty","isDirty"),ro=o(e=>e.status==="valid","isValid"),bu=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");var de;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(de||(de={}));var Or=class{static{o(this,"ParseInputLazyPath")}constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}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}},Vj=o((e,t)=>{if(ro(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 Wn(e.common.issues);return this._error=n,this._error}}},"handleResult");function Fe(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:o((a,c)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??i??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},"customMap"),description:r}}o(Fe,"processCreateParams");var Ve=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(t){return _i(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:_i(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new un,ctx:{common:t.parent.common,data:t.data,parsedType:_i(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(bu(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 i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_i(t)},r=this._parseSync({data:t,path:i.path,parent:i});return Vj(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_i(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return ro(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>ro(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:_i(t)},r=this._parse({data:t,path:i.path,parent:i}),s=await(bu(r)?r:Promise.resolve(r));return Vj(i,s)}refine(t,n){let i=o(r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n,"getIssueProperties");return this._refinement((r,s)=>{let a=t(r),c=o(()=>s.addIssue({code:G.custom,...i(r)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Mr({schema:this,typeName:xe.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 Fr.create(this,this._def)}nullable(){return Pi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return As.create(this)}promise(){return oo.create(this,this._def)}or(t){return Ca.create([this,t],this._def)}and(t){return Sa.create(this,t,this._def)}transform(t){return new Mr({...Fe(this._def),schema:this,typeName:xe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new Qa({...Fe(this._def),innerType:this,defaultValue:n,typeName:xe.ZodDefault})}brand(){return new ap({typeName:xe.ZodBranded,type:this,...Fe(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new $a({...Fe(this._def),innerType:this,catchValue:n,typeName:xe.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return cp.create(this,t)}readonly(){return Ta.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Zie=/^c[^\s-]{8,}$/i,Kie=/^[0-9a-z]+$/,Xie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ese=/^[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,tse=/^[a-z0-9_-]{21}$/i,nse=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rse=/^[-+]?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)?)??$/,ise=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sse="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",RC,ose=/^(?:(?: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])$/,ase=/^(?:(?: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])$/,cse=/^(([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]))$/,use=/^(([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])$/,lse=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dse=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qj="((\\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])))",pse=new RegExp(`^${qj}$`);function Hj(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(Hj,"timeRegexSource");function fse(e){return new RegExp(`^${Hj(e)}$`)}o(fse,"timeRegex");function Jj(e){let t=`${qj}T${Hj(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(Jj,"datetimeRegex");function gse(e,t){return!!((t==="v4"||!t)&&ose.test(e)||(t==="v6"||!t)&&cse.test(e))}o(gse,"isValidIP");function Ase(e,t){if(!nse.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}o(Ase,"isValidJWT");function hse(e,t){return!!((t==="v4"||!t)&&ase.test(e)||(t==="v6"||!t)&&use.test(e))}o(hse,"isValidCidr");var io=class e extends Ve{static{o(this,"ZodString")}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==re.string){let s=this._getOrReturnCtx(t);return X(s,{code:G.invalid_type,expected:re.string,received:s.parsedType}),Ce}let i=new un,r;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),X(r,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),X(r,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){let a=t.data.length>s.value,c=t.data.length<s.value;(a||c)&&(r=this._getOrReturnCtx(t,r),a?X(r,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&X(r,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")ise.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"email",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")RC||(RC=new RegExp(sse,"u")),RC.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"emoji",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")ese.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"uuid",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")tse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"nanoid",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")Zie.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"cuid",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")Kie.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"cuid2",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")Xie.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"ulid",code:G.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),X(r,{validation:"url",code:G.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"regex",code:G.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?Jj(s).test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?pse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?fse(s).test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{code:G.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?rse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"duration",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?gse(t.data,s.version)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"ip",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?Ase(t.data,s.alg)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"jwt",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?hse(t.data,s.version)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"cidr",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?lse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"base64",code:G.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?dse.test(t.data)||(r=this._getOrReturnCtx(t,r),X(r,{validation:"base64url",code:G.invalid_string,message:s.message}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:G.invalid_string,...de.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...de.errToObj(t)})}url(t){return this._addCheck({kind:"url",...de.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...de.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...de.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...de.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...de.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...de.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...de.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...de.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...de.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...de.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...de.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...de.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,...de.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,...de.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...de.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...de.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...de.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...de.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...de.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...de.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...de.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...de.errToObj(n)})}nonempty(t){return this.min(1,de.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}};io.create=e=>new io({checks:[],typeName:xe.ZodString,coerce:e?.coerce??!1,...Fe(e)});function mse(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(e.toFixed(r).replace(".","")),a=Number.parseInt(t.toFixed(r).replace(".",""));return s%a/10**r}o(mse,"floatSafeRemainder");var ya=class e extends Ve{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)!==re.number){let s=this._getOrReturnCtx(t);return X(s,{code:G.invalid_type,expected:re.number,received:s.parsedType}),Ce}let i,r=new un;for(let s of this._def.checks)s.kind==="int"?Ye.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:G.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?mse(t.data,s.value)!==0&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),X(i,{code:G.not_finite,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,de.toString(n))}gt(t,n){return this.setLimit("min",t,!1,de.toString(n))}lte(t,n){return this.setLimit("max",t,!0,de.toString(n))}lt(t,n){return this.setLimit("max",t,!1,de.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:de.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:de.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:de.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:de.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:de.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:de.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:de.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"&&Ye.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};ya.create=e=>new ya({checks:[],typeName:xe.ZodNumber,coerce:e?.coerce||!1,...Fe(e)});var Ea=class e extends Ve{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)!==re.bigint)return this._getInvalidInput(t);let i,r=new un;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),X(i,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return X(n,{code:G.invalid_type,expected:re.bigint,received:n.parsedType}),Ce}gte(t,n){return this.setLimit("min",t,!0,de.toString(n))}gt(t,n){return this.setLimit("min",t,!1,de.toString(n))}lte(t,n){return this.setLimit("max",t,!0,de.toString(n))}lt(t,n){return this.setLimit("max",t,!1,de.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:de.toString(r)}]})}_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:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:de.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:de.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}};Ea.create=e=>new Ea({checks:[],typeName:xe.ZodBigInt,coerce:e?.coerce??!1,...Fe(e)});var ba=class extends Ve{static{o(this,"ZodBoolean")}_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==re.boolean){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.boolean,received:i.parsedType}),Ce}return vn(t.data)}};ba.create=e=>new ba({typeName:xe.ZodBoolean,coerce:e?.coerce||!1,...Fe(e)});var va=class e extends Ve{static{o(this,"ZodDate")}_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==re.date){let s=this._getOrReturnCtx(t);return X(s,{code:G.invalid_type,expected:re.date,received:s.parsedType}),Ce}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return X(s,{code:G.invalid_date}),Ce}let i=new un,r;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),X(r,{code:G.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),X(r,{code:G.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Ye.assertNever(s);return{status:i.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:de.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:de.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}};va.create=e=>new va({checks:[],coerce:e?.coerce||!1,typeName:xe.ZodDate,...Fe(e)});var Iu=class extends Ve{static{o(this,"ZodSymbol")}_parse(t){if(this._getType(t)!==re.symbol){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.symbol,received:i.parsedType}),Ce}return vn(t.data)}};Iu.create=e=>new Iu({typeName:xe.ZodSymbol,...Fe(e)});var Ia=class extends Ve{static{o(this,"ZodUndefined")}_parse(t){if(this._getType(t)!==re.undefined){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.undefined,received:i.parsedType}),Ce}return vn(t.data)}};Ia.create=e=>new Ia({typeName:xe.ZodUndefined,...Fe(e)});var wa=class extends Ve{static{o(this,"ZodNull")}_parse(t){if(this._getType(t)!==re.null){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.null,received:i.parsedType}),Ce}return vn(t.data)}};wa.create=e=>new wa({typeName:xe.ZodNull,...Fe(e)});var so=class extends Ve{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(t){return vn(t.data)}};so.create=e=>new so({typeName:xe.ZodAny,...Fe(e)});var gs=class extends Ve{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(t){return vn(t.data)}};gs.create=e=>new gs({typeName:xe.ZodUnknown,...Fe(e)});var li=class extends Ve{static{o(this,"ZodNever")}_parse(t){let n=this._getOrReturnCtx(t);return X(n,{code:G.invalid_type,expected:re.never,received:n.parsedType}),Ce}};li.create=e=>new li({typeName:xe.ZodNever,...Fe(e)});var wu=class extends Ve{static{o(this,"ZodVoid")}_parse(t){if(this._getType(t)!==re.undefined){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.void,received:i.parsedType}),Ce}return vn(t.data)}};wu.create=e=>new wu({typeName:xe.ZodVoid,...Fe(e)});var As=class e extends Ve{static{o(this,"ZodArray")}_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==re.array)return X(n,{code:G.invalid_type,expected:re.array,received:n.parsedType}),Ce;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,c=n.data.length<r.exactLength.value;(a||c)&&(X(n,{code:a?G.too_big:G.too_small,minimum:c?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(X(n,{code:G.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(X(n,{code:G.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>r.type._parseAsync(new Or(n,a,n.path,c)))).then(a=>un.mergeArray(i,a));let s=[...n.data].map((a,c)=>r.type._parseSync(new Or(n,a,n.path,c)));return un.mergeArray(i,s)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:de.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:de.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:de.toString(n)}})}nonempty(t){return this.min(1,t)}};As.create=(e,t)=>new As({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xe.ZodArray,...Fe(t)});function vu(e){if(e instanceof Zn){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=Fr.create(vu(i))}return new Zn({...e._def,shape:o(()=>t,"shape")})}else return e instanceof As?new As({...e._def,type:vu(e.element)}):e instanceof Fr?Fr.create(vu(e.unwrap())):e instanceof Pi?Pi.create(vu(e.unwrap())):e instanceof Ni?Ni.create(e.items.map(t=>vu(t))):e}o(vu,"deepPartialify");var Zn=class e extends Ve{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=Ye.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==re.object){let l=this._getOrReturnCtx(t);return X(l,{code:G.invalid_type,expected:re.object,received:l.parsedType}),Ce}let{status:i,ctx:r}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof li&&this._def.unknownKeys==="strip"))for(let l in r.data)a.includes(l)||c.push(l);let u=[];for(let l of a){let p=s[l],f=r.data[l];u.push({key:{status:"valid",value:l},value:p._parse(new Or(r,f,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof li){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of c)u.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(l==="strict")c.length>0&&(X(r,{code:G.unrecognized_keys,keys:c}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of c){let f=r.data[p];u.push({key:{status:"valid",value:p},value:l._parse(new Or(r,f,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of u){let f=await p.key,A=await p.value;l.push({key:f,value:A,alwaysSet:p.alwaysSet})}return l}).then(l=>un.mergeObjectSync(i,l)):un.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(t){return de.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:o((n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:de.errToObj(t).message??r}:{message:r}},"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:xe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Ye.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:o(()=>n,"shape")})}omit(t){let n={};for(let i of Ye.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return vu(this)}partial(t){let n={};for(let i of Ye.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:o(()=>n,"shape")})}required(t){let n={};for(let i of Ye.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof Fr;)s=s._def.innerType;n[i]=s}return new e({...this._def,shape:o(()=>n,"shape")})}keyof(){return Yj(Ye.objectKeys(this.shape))}};Zn.create=(e,t)=>new Zn({shape:o(()=>e,"shape"),unknownKeys:"strip",catchall:li.create(),typeName:xe.ZodObject,...Fe(t)});Zn.strictCreate=(e,t)=>new Zn({shape:o(()=>e,"shape"),unknownKeys:"strict",catchall:li.create(),typeName:xe.ZodObject,...Fe(t)});Zn.lazycreate=(e,t)=>new Zn({shape:e,unknownKeys:"strip",catchall:li.create(),typeName:xe.ZodObject,...Fe(t)});var Ca=class extends Ve{static{o(this,"ZodUnion")}_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new Wn(c.ctx.common.issues));return X(n,{code:G.invalid_union,unionErrors:a}),Ce}if(o(r,"handleResults"),n.common.async)return Promise.all(i.map(async s=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let s,a=[];for(let u of i){let l={...n,common:{...n.common,issues:[]},parent:null},p=u._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(u=>new Wn(u));return X(n,{code:G.invalid_union,unionErrors:c}),Ce}}get options(){return this._def.options}};Ca.create=(e,t)=>new Ca({options:e,typeName:xe.ZodUnion,...Fe(t)});var fs=o(e=>e instanceof ka?fs(e.schema):e instanceof Mr?fs(e.innerType()):e instanceof Ba?[e.value]:e instanceof Ra?e.options:e instanceof xa?Ye.objectValues(e.enum):e instanceof Qa?fs(e._def.innerType):e instanceof Ia?[void 0]:e instanceof wa?[null]:e instanceof Fr?[void 0,...fs(e.unwrap())]:e instanceof Pi?[null,...fs(e.unwrap())]:e instanceof ap||e instanceof Ta?fs(e.unwrap()):e instanceof $a?fs(e._def.innerType):[],"getDiscriminator"),Yh=class e extends Ve{static{o(this,"ZodDiscriminatedUnion")}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.object)return X(n,{code:G.invalid_type,expected:re.object,received:n.parsedType}),Ce;let i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(X(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let s of n){let a=fs(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let c of a){if(r.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);r.set(c,s)}}return new e({typeName:xe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Fe(i)})}};function xC(e,t){let n=_i(e),i=_i(t);if(e===t)return{valid:!0,data:e};if(n===re.object&&i===re.object){let r=Ye.objectKeys(t),s=Ye.objectKeys(e).filter(c=>r.indexOf(c)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let c of s){if(c==="__proto__")continue;let u=xC(e[c],t[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(n===re.array&&i===re.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let s=0;s<e.length;s++){let a=e[s],c=t[s],u=xC(a,c);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return n===re.date&&i===re.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}o(xC,"mergeValues");var Sa=class extends Ve{static{o(this,"ZodIntersection")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=o((s,a)=>{if(Hh(s)||Hh(a))return Ce;let c=xC(s.value,a.value);return c.valid?((Jh(s)||Jh(a))&&n.dirty(),{status:n.value,value:c.data}):(X(i,{code:G.invalid_intersection_types}),Ce)},"handleParsed");return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,a])=>r(s,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Sa.create=(e,t,n)=>new Sa({left:e,right:t,typeName:xe.ZodIntersection,...Fe(n)});var Ni=class e extends Ve{static{o(this,"ZodTuple")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==re.array)return X(i,{code:G.invalid_type,expected:re.array,received:i.parsedType}),Ce;if(i.data.length<this._def.items.length)return X(i,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ce;!this._def.rest&&i.data.length>this._def.items.length&&(X(i,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...i.data].map((a,c)=>{let u=this._def.items[c]||this._def.rest;return u?u._parse(new Or(i,a,i.path,c)):null}).filter(a=>!!a);return i.common.async?Promise.all(s).then(a=>un.mergeArray(n,a)):un.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ni.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ni({items:e,typeName:xe.ZodTuple,rest:null,...Fe(t)})};var Wh=class e extends Ve{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==re.object)return X(i,{code:G.invalid_type,expected:re.object,received:i.parsedType}),Ce;let r=[],s=this._def.keyType,a=this._def.valueType;for(let c in i.data)r.push({key:s._parse(new Or(i,c,i.path,c)),value:a._parse(new Or(i,i.data[c],i.path,c)),alwaysSet:c in i.data});return i.common.async?un.mergeObjectAsync(n,r):un.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof Ve?new e({keyType:t,valueType:n,typeName:xe.ZodRecord,...Fe(i)}):new e({keyType:io.create(),valueType:t,typeName:xe.ZodRecord,...Fe(n)})}},Cu=class extends Ve{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==re.map)return X(i,{code:G.invalid_type,expected:re.map,received:i.parsedType}),Ce;let r=this._def.keyType,s=this._def.valueType,a=[...i.data.entries()].map(([c,u],l)=>({key:r._parse(new Or(i,c,i.path,[l,"key"])),value:s._parse(new Or(i,u,i.path,[l,"value"]))}));if(i.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,p=await u.value;if(l.status==="aborted"||p.status==="aborted")return Ce;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let u of a){let l=u.key,p=u.value;if(l.status==="aborted"||p.status==="aborted")return Ce;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}}}};Cu.create=(e,t,n)=>new Cu({valueType:t,keyType:e,typeName:xe.ZodMap,...Fe(n)});var Su=class e extends Ve{static{o(this,"ZodSet")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==re.set)return X(i,{code:G.invalid_type,expected:re.set,received:i.parsedType}),Ce;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(X(i,{code:G.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(X(i,{code:G.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let s=this._def.valueType;function a(u){let l=new Set;for(let p of u){if(p.status==="aborted")return Ce;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}o(a,"finalizeSet");let c=[...i.data.values()].map((u,l)=>s._parse(new Or(i,u,i.path,l)));return i.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:de.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:de.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};Su.create=(e,t)=>new Su({valueType:e,minSize:null,maxSize:null,typeName:xe.ZodSet,...Fe(t)});var Zh=class e extends Ve{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.function)return X(n,{code:G.invalid_type,expected:re.function,received:n.parsedType}),Ce;function i(c,u){return op({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Eu(),ps].filter(l=>!!l),issueData:{code:G.invalid_arguments,argumentsError:u}})}o(i,"makeArgsIssue");function r(c,u){return op({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Eu(),ps].filter(l=>!!l),issueData:{code:G.invalid_return_type,returnTypeError:u}})}o(r,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof oo){let c=this;return vn(async function(...u){let l=new Wn([]),p=await c._def.args.parseAsync(u,s).catch(h=>{throw l.addIssue(i(u,h)),l}),f=await Reflect.apply(a,this,p);return await c._def.returns._def.type.parseAsync(f,s).catch(h=>{throw l.addIssue(r(f,h)),l})})}else{let c=this;return vn(function(...u){let l=c._def.args.safeParse(u,s);if(!l.success)throw new Wn([i(u,l.error)]);let p=Reflect.apply(a,this,l.data),f=c._def.returns.safeParse(p,s);if(!f.success)throw new Wn([r(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ni.create(t).rest(gs.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,i){return new e({args:t||Ni.create([]).rest(gs.create()),returns:n||gs.create(),typeName:xe.ZodFunction,...Fe(i)})}},ka=class extends Ve{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})}};ka.create=(e,t)=>new ka({getter:e,typeName:xe.ZodLazy,...Fe(t)});var Ba=class extends Ve{static{o(this,"ZodLiteral")}_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return X(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),Ce}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ba.create=(e,t)=>new Ba({value:e,typeName:xe.ZodLiteral,...Fe(t)});function Yj(e,t){return new Ra({values:e,typeName:xe.ZodEnum,...Fe(t)})}o(Yj,"createZodEnum");var Ra=class e extends Ve{static{o(this,"ZodEnum")}_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return X(n,{expected:Ye.joinValues(i),received:n.parsedType,code:G.invalid_type}),Ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return X(n,{received:n.data,code:G.invalid_enum_value,options:i}),Ce}return vn(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(i=>!t.includes(i)),{...this._def,...n})}};Ra.create=Yj;var xa=class extends Ve{static{o(this,"ZodNativeEnum")}_parse(t){let n=Ye.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==re.string&&i.parsedType!==re.number){let r=Ye.objectValues(n);return X(i,{expected:Ye.joinValues(r),received:i.parsedType,code:G.invalid_type}),Ce}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Ye.objectValues(n);return X(i,{received:i.data,code:G.invalid_enum_value,options:r}),Ce}return vn(t.data)}get enum(){return this._def.values}};xa.create=(e,t)=>new xa({values:e,typeName:xe.ZodNativeEnum,...Fe(t)});var oo=class extends Ve{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==re.promise&&n.common.async===!1)return X(n,{code:G.invalid_type,expected:re.promise,received:n.parsedType}),Ce;let i=n.parsedType===re.promise?n.data:Promise.resolve(n.data);return vn(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};oo.create=(e,t)=>new oo({type:e,typeName:xe.ZodPromise,...Fe(t)});var Mr=class extends Ve{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:o(a=>{X(i,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let a=r.transform(i.data,s);if(i.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return Ce;let u=await this._def.schema._parseAsync({data:c,path:i.path,parent:i});return u.status==="aborted"?Ce:u.status==="dirty"?ma(u.value):n.value==="dirty"?ma(u.value):u});{if(n.value==="aborted")return Ce;let c=this._def.schema._parseSync({data:a,path:i.path,parent:i});return c.status==="aborted"?Ce:c.status==="dirty"?ma(c.value):n.value==="dirty"?ma(c.value):c}}if(r.type==="refinement"){let a=o(c=>{let u=r.refinement(c,s);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(i.common.async===!1){let c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?Ce:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?Ce:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!ro(a))return Ce;let c=r.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>ro(a)?Promise.resolve(r.transform(a.value,s)).then(c=>({status:n.value,value:c})):Ce);Ye.assertNever(r)}};Mr.create=(e,t,n)=>new Mr({schema:e,typeName:xe.ZodEffects,effect:t,...Fe(n)});Mr.createWithPreprocess=(e,t,n)=>new Mr({schema:t,effect:{type:"preprocess",transform:e},typeName:xe.ZodEffects,...Fe(n)});var Fr=class extends Ve{static{o(this,"ZodOptional")}_parse(t){return this._getType(t)===re.undefined?vn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Fr.create=(e,t)=>new Fr({innerType:e,typeName:xe.ZodOptional,...Fe(t)});var Pi=class extends Ve{static{o(this,"ZodNullable")}_parse(t){return this._getType(t)===re.null?vn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Pi.create=(e,t)=>new Pi({innerType:e,typeName:xe.ZodNullable,...Fe(t)});var Qa=class extends Ve{static{o(this,"ZodDefault")}_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===re.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Qa.create=(e,t)=>new Qa({innerType:e,typeName:xe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Fe(t)});var $a=class extends Ve{static{o(this,"ZodCatch")}_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return bu(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Wn(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Wn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};$a.create=(e,t)=>new $a({innerType:e,typeName:xe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Fe(t)});var ku=class extends Ve{static{o(this,"ZodNaN")}_parse(t){if(this._getType(t)!==re.nan){let i=this._getOrReturnCtx(t);return X(i,{code:G.invalid_type,expected:re.nan,received:i.parsedType}),Ce}return{status:"valid",value:t.data}}};ku.create=e=>new ku({typeName:xe.ZodNaN,...Fe(e)});var yse=Symbol("zod_brand"),ap=class extends Ve{static{o(this,"ZodBranded")}_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},cp=class e extends Ve{static{o(this,"ZodPipeline")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return o(async()=>{let s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Ce:s.status==="dirty"?(n.dirty(),ma(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})},"handleAsync")();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Ce:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:xe.ZodPipeline})}},Ta=class extends Ve{static{o(this,"ZodReadonly")}_parse(t){let n=this._def.innerType._parse(t),i=o(r=>(ro(r)&&(r.value=Object.freeze(r.value)),r),"freeze");return bu(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};Ta.create=(e,t)=>new Ta({innerType:e,typeName:xe.ZodReadonly,...Fe(t)});function zj(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}o(zj,"cleanParams");function Wj(e,t={},n){return e?so.create().superRefine((i,r)=>{let s=e(i);if(s instanceof Promise)return s.then(a=>{if(!a){let c=zj(t,i),u=c.fatal??n??!0;r.addIssue({code:"custom",...c,fatal:u})}});if(!s){let a=zj(t,i),c=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:c})}}):so.create()}o(Wj,"custom");var Ese={object:Zn.lazycreate},xe;(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"})(xe||(xe={}));var bse=o((e,t={message:`Input not instance of ${e.name}`})=>Wj(n=>n instanceof e,t),"instanceOfType"),Zj=io.create,Kj=ya.create,vse=ku.create,Ise=Ea.create,Xj=ba.create,wse=va.create,Cse=Iu.create,Sse=Ia.create,kse=wa.create,Bse=so.create,Rse=gs.create,xse=li.create,Qse=wu.create,$se=As.create,Tse=Zn.create,Dse=Zn.strictCreate,_se=Ca.create,Nse=Yh.create,Pse=Sa.create,Use=Ni.create,Fse=Wh.create,Ose=Cu.create,Mse=Su.create,Lse=Zh.create,jse=ka.create,Gse=Ba.create,Vse=Ra.create,zse=xa.create,qse=oo.create,Hse=Mr.create,Jse=Fr.create,Yse=Pi.create,Wse=Mr.createWithPreprocess,Zse=cp.create,Kse=o(()=>Zj().optional(),"ostring"),Xse=o(()=>Kj().optional(),"onumber"),eoe=o(()=>Xj().optional(),"oboolean"),toe={string:o((e=>io.create({...e,coerce:!0})),"string"),number:o((e=>ya.create({...e,coerce:!0})),"number"),boolean:o((e=>ba.create({...e,coerce:!0})),"boolean"),bigint:o((e=>Ea.create({...e,coerce:!0})),"bigint"),date:o((e=>va.create({...e,coerce:!0})),"date")};var noe=Ce;var up=(r=>(r.ModelProvider="model_provider",r.SutAccess="sut_access",r.Skyramp="skyramp",r.Other="other",r))(up||{}),QC=(i=>(i.Ready="ready",i.Blocked="blocked",i.NeedsInputs="needs_inputs",i))(QC||{});var Kh=300,dt=d.string().trim().min(1),roe=d.object({action:d.enum(["start","run","wait"]),text:dt,source:d.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:dt.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"}),lp=/^[A-Za-z_][A-Za-z0-9_]*$/,Kn=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Bu=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Bu||{}),Ui="shared",ioe=dt.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"),Ru=d.object({address:ioe,readyWhen:dt.nullable(),credentials:d.array(d.string().regex(Kn)).max(50),revisionSources:d.array(d.object({method:d.nativeEnum(Bu),detail:dt.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:d.array(dt).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),$C={steps:d.array(roe).max(20).optional().describe("how it starts, in order"),kind:d.enum(["web_app","service","database","external_service"]).optional(),from:d.object({file:dt,service:dt.nullable()}).strict().optional(),credentials:d.array(d.string().max(100).regex(lp)).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")},TC=d.object({name:dt,repository:dt.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:d.boolean(),...$C,deployed:dt.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')}),soe=d.object({name:d.string().regex(Kn).describe("the credential's environment variable name, as the recipe reads it and the credentials event names it"),purpose:d.enum(["sut_access","other"]).describe("sut_access: it signs in to or calls the SUT or a service it needs; other: anything else"),required:d.boolean().describe("false only when the SUT starts without it, with less working"),how:dt.max(Kh).describe('one short sentence: what the value is and where a person gets it, such as "A Mattermost Enterprise licence key, from the customer portal"; never a value')}),DC=d.object({name:dt.describe("the credential's environment variable name, as listed above; never its value"),component:dt.describe("the component that refused it"),status:d.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:dt.describe("the request or command you tested it with and what came back, never the value")}),ooe=400,e1=o((e,t)=>dt.max(ooe).optional().describe(`one or two plain sentences: ${e}, such as "${t}"; never the value`),"credentialExplanation"),aoe=DC.extend({name:d.string().regex(Kn).describe("the credential's environment variable name, as the SUT input lists it; never its value"),explanation:e1("what the component did with the value and why it is wrong","The app checks the licence key at startup and exits: the value this run has does not match the licence it expects.")}),coe=d.object({name:d.string().regex(Kn).describe("the credential's environment variable name, as the SUT input lists it"),component:dt.describe("the component that cannot come up or work without it"),evidence:dt.describe("the command you ran and what came back that shows it needs a value, never a value"),explanation:e1("what the component needs the value for and what it does without one","The app reads the licence key at startup and exits when it is empty.")}),uoe=d.object({component:dt,problem:dt,evidence:dt.describe("the exact command and output that shows it"),fix:dt.describe("what the user must provide, and where; never a change to a file under .skyramp/sut/")}),loe=d.object({framework:dt,file:dt.describe("the test file run, relative to its repository root"),result:d.enum(["pass","fail","error"])}),doe=d.object({input:dt.describe("the part of the user's SUT input, as given"),reason:dt}),sRe=d.object({schemaVersion:d.literal(1),status:d.nativeEnum(QC).describe("ready only if every component came up healthy and the recipe is written; needs_inputs when the recipe is written but a component cannot start without a credential this run has no value for"),components:d.array(TC),suites:d.array(loe).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:d.array(dt).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:d.array(d.object({input:dt.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:dt.describe("what the recipe did with it")})).optional(),inputsNotUsed:d.array(doe).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:d.array(uoe).describe("required (non-empty) when status is blocked, unless credentialsRefused or credentialsWithoutValue says why; never one for a credential either of them names"),inputs:d.array(soe).max(50).optional().describe("required (non-empty) when status is needs_inputs, else left out: each credential the candidate recipe needs a value for"),credentialsRefused:d.array(aoe).max(50).optional().describe("only with status blocked: each credential the SUT input lists that the SUT still refused after a person confirmed it, or when no other credential worked. Testbot writes its blocker"),credentialsWithoutValue:d.array(coe).max(50).optional().describe("only with status blocked: each credential the SUT input lists as empty in this run that a component cannot come up or work without. Testbot writes its blocker"),environment:Ru.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 or proxy; a client certificate is named in .skyramp/sut/client-cert.json instead)")});var _C=64*1024,NC=512*1024,t1=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Fi=(r=>(r.Clean="clean",r.RecipeDrift="recipe-drift",r.ChangeBrokeBringup="change-broke-bringup",r.BringupFailed="bringup-failed",r))(Fi||{}),ao=d.string().trim().min(1),poe=d.object({url:d.string().optional().describe("the URL probed, if the check is an HTTP request"),command:d.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:d.record(d.string()).optional(),status:d.union([d.number(),d.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:ao.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),PC=d.array(d.object({component:ao.describe("a shared component listed above"),url:ao.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:ao.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"),n1=d.object({schemaVersion:d.literal(1),baseUrls:d.record(d.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:poe.optional(),teardown:ao.describe("command that tears the SUT down"),dependencies:d.record(d.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:d.nativeEnum(Fi).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:d.array(d.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:d.object({command:ao,output:ao}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:d.array(d.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:d.boolean(),startedAt:ao.describe("ISO timestamp"),revisions:PC.optional(),missingSecrets:d.array(d.string().regex(lp)).optional().describe("bringup-failed only: each secret the app cannot start without that this run has no value for, by its environment variable name; never a value"),credentialsRefused:d.array(DC).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:d.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var T1=require("node:crypto");var Da=(s=>(s.NotFound="not_found",s.NoAccess="no_access",s.Unavailable="unavailable",s.AccessLost="access_lost",s.CannotOpen="cannot_open",s))(Da||{});var UC=o(e=>`${e.source}:${e.site??""}:${e.key}`,"requirementItemId");var dp=/^pasted-[0-9a-f]{16}$/,hs=/^file-[0-9a-f]{16}$/,pp=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(pp||{}),_a=o(e=>e.trim().toUpperCase(),"normalKey"),r1=o((e,t)=>{let n=e.trim();return dp.test(n.toLowerCase())?"Pasted text":hs.test(n.toLowerCase())?t?.get(_a(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()},"itemName");var Xh=(i=>(i.New="new",i.Updated="updated",i.Existing="existing",i))(Xh||{}),Oi=(i=>(i.Sufficient="sufficient",i.Insufficient="insufficient",i.NoChange="no_change",i))(Oi||{}),xu=(v=>(v.RelatedChangeConflict="related_change_conflict",v.ReferenceOutsideTarget="reference_outside_target",v.SourceAccessLost="source_access_lost",v.ConfigurationIncomplete="configuration_incomplete",v.CredentialUnavailable="credential_unavailable",v.WorkflowBindingUnverified="workflow_binding_unverified",v.WorkflowRefUnprotected="workflow_ref_unprotected",v.BedrockWorkflowRequired="bedrock_workflow_required",v.DeploymentReview="deployment_review",v.SutRevisionMismatch="sut_revision_mismatch",v.IsolationUnavailable="isolation_unavailable",v.EvidenceInsufficient="evidence_insufficient",v.ConfigurationUnresolved="configuration_unresolved",v.ModelProviderDenied="model_provider_denied",v.ModelProviderUnavailable="model_provider_unavailable",v.RunnerProviderNotReady="runner_provider_not_ready",v.MergeConflict="merge_conflict",v))(xu||{}),co=(s=>(s.CiCheck="ci_check",s.TestReport="test_report",s.StaticAnalysis="static_analysis",s.CodeReview="code_review",s.Other="other",s))(co||{}),fp=(i=>(i.Application="application",i.Environment="environment",i.TestDefect="test_defect",i))(fp||{}),gp=(c=>(c.AuthToken="auth_token",c.Secret="secret",c.DataConnection="data_connection",c.AppNotStarted="app_not_started",c.Login="login",c.ExternalDependency="external_dependency",c.RecordingReplay="recording_replay",c))(gp||{});var em=(n=>(n.Probe="probe",n.Agent="agent",n))(em||{}),Ap=(i=>(i.Seed="seed",i.RuntimeMock="runtime_mock",i.EnvOverride="env_override",i))(Ap||{}),tm=(i=>(i.TestCode="test_code",i.SkyrampMocker="skyramp_mocker",i.RecipeOverride="recipe_override",i))(tm||{});function nm(e){return e==="failed"?2:e==="unknown"?1:0}o(nm,"cleanupShortfall");var hp=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(hp||{}),Mi=d.string().trim().min(1),foe=d.object({case:Mi.describe("recommend id this assertion enforces"),evidence:Mi.describe("the exact assertion line from the file that checks that case's observable")});var i1=d.object({route:d.literal("persistence"),url:d.string().url()}).strict(),mp=d.object({kind:d.nativeEnum(Ap).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:Mi.describe("the dependency, endpoint or data it affects"),mechanism:d.nativeEnum(tm).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:Mi.describe("what it sets up"),worker:Mi.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),safety:i1.optional().describe("shared seed that keeps its data only because the environment permits it: the persistence route and the exact endpoint; Testbot checks the current permission just before it runs the test"),cleanup:Mi.optional().describe("seed: when its data can be removed, a command that removes it if the test does not; otherwise declare leftBehind instead. Run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that"),leftBehind:Mi.optional().describe("seed: the records the test creates and cannot remove from the app, and how to find them")}).refine(e=>!e.leftBehind||e.kind==="seed",{message:"leftBehind is for a seed only: a runtime mock or an env override creates no records",path:["leftBehind"]}),goe=d.object({file:Mi.describe("staged path under .skyramp/staged/"),source:d.nativeEnum(hp),language:Mi,covers:d.array(d.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:d.array(foe).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:d.array(mp).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),FC=d.object({schemaVersion:d.literal(1),tests:d.array(goe),deferredUi:d.array(d.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:Mi.describe("one paragraph")});var ms=(a=>(a.Place="place",a.Update="update",a.Regenerate="regenerate",a.Delete="delete",a.Verify="verify",a.None="none",a))(ms||{}),Tn=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(Tn||{}),$n=d.string().trim().min(1),OC=(r=>(r.Setup="setup",r.Expectation="expectation",r.Locator="locator",r.Other="other",r))(OC||{}),rm=d.object({kind:d.nativeEnum(OC),reason:$n.describe("what in the test is wrong, with the evidence: the setup error it raised, or the requirement or changed line its expectation contradicts")}),yp=d.array(d.string().url().max(2048).regex(/^https?:\/\//i)).max(50),s1=d.object({case:$n.describe("a covers id \u2014 the recommend case this test realizes"),status:d.nativeEnum(Tn),runtimeTargets:yp.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),environmentRestriction:$n.optional().describe("for a skipped case: what this run lacks to execute it; the test is still written"),fromJourney:d.boolean().optional(),testProblem:rm.optional().describe("[derived] write's reading of a failing case: the test, not the app, is at fault"),defect:d.boolean().optional().describe("[derived] write's reading of a failing case: true when the app is wrong and the test is right"),failure:d.string().optional().describe("[derived] for a failing case: the runner's failure for it, as printed")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"}),o1=d.object({started:d.boolean().optional().describe("with exit null: true if the test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:d.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:d.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:d.array(s1).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),a1=d.object({context:d.array(mp).optional().describe("[derived] setup declarations retained for every executed test, including maintained tests"),from:d.string().optional().describe("staged path \u2014 required for placements"),file:$n.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:$n.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(ms),covers:d.array(d.string()).optional().describe("recommend ids a placed test covers"),repro:d.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:d.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:d.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:$n.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:$n.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:o1,assertionCount:d.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:d.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there"),added:d.array($n).optional().describe("[derived] the cases of the test functions the run added to an existing file: functions it did not have"),staleOnBase:d.boolean().optional().describe("[derived] an existing test that fails the same way on the base branch: its failure is the test's own")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),c1=(n=>(n.Junit="junit",n.Converter="converter",n))(c1||{}),Aoe=$n.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),hoe=d.object({results:$n.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:d.nativeEnum(c1),run:$n.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:d.array($n).min(1).describe("the items[].file paths this run covered"),cases:d.array(d.object({test:$n.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:$n.describe("the covers id it realizes"),file:Aoe})).describe("map each reported test name to the case it covers")}),moe=d.object({suites:d.array(hoe).min(1)}),MC=d.object({schemaVersion:d.literal(1),items:d.array(a1),runnerResults:moe.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:d.array(d.string()).describe("existing tests assessed and deliberately left untouched"),summary:$n.describe("one paragraph")});mu();SC();function u1(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}o(u1,"credentialKeyFromRole");var l1=ee(require("path"));var nn=d.string().trim().min(1),im=nn,LC=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(LC||{}),jC=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],d1=(n=>(n.Refused="refused",n.NoValue="no_value",n))(d1||{}),yoe=d.object({name:d.string().regex(Kn),kind:d.nativeEnum(d1),explanation:nn.optional()}).strict(),p1=d.object({schemaVersion:d.literal(1),type:d.nativeEnum(LC).optional(),repository:im.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:d.enum(["ready","blocked"]),environment:Ru.optional(),components:d.array(d.object({name:nn,repository:nn.describe(`owner/repo, or "${Ui}" for a customer-deployed component no repository builds`),healthy:d.boolean(),url:d.string().min(1).nullable(),...$C,credentials:d.array(d.string().regex(Kn)).max(50).optional(),deployed:nn.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:d.array(d.object({framework:nn,file:nn,result:d.enum(["pass","fail","error"])}).strict()),inputsUsed:d.array(nn),inputsUsedHow:d.array(d.object({input:nn,how:nn}).strict()).optional(),inputsNotUsed:d.array(d.object({input:nn,reason:nn}).strict()),blockers:d.array(d.object({component:nn,problem:nn,evidence:nn,fix:nn,credential:yoe.optional()}).strict()),replay:d.object({outcome:nn,durationSeconds:d.number().nonnegative().nullable()}).strict().nullable(),files:d.array(d.object({path:nn,content:d.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((r,s)=>{e.inputsUsed.includes(r.input)||t.addIssue({code:d.ZodIssueCode.custom,path:["inputsUsedHow",s,"input"],message:"not one of inputsUsed"})}),e.components.forEach((r,s)=>{r.credentials&&new Set(r.credentials).size!==r.credentials.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:d.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:d.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let i=new Set(e.components.map(r=>r.name));if(e.environment?.revisionSources.forEach((r,s)=>{r.components.forEach((a,c)=>{i.has(a)||t.addIssue({code:d.ZodIssueCode.custom,path:["environment","revisionSources",s,"components",c],message:"not one of components"})})}),e.components.forEach((r,s)=>{r.deployed!==void 0!==n&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),r.repository===Ui&&!n&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"repository"],message:`only a customer_deployed component is ${Ui}`})}),n&&(e.components.forEach((r,s)=>{e.components.findIndex(a=>a.name===r.name)!==s&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:d.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((r,s)=>{jC.includes(r.path)&&t.addIssue({code:d.ZodIssueCode.custom,path:["files",s,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let r=new Set(e.environment?.revisionSources.flatMap(s=>s.components));e.components.forEach((s,a)=>{s.repository!==Ui&&!r.has(s.name)&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var $Re=["clean","recipe-drift"];function Ep(e){let t=l1.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}o(Ep,"isRuntimePlanFile");var bp=d.string().uuid(),vp=d.object({environmentId:d.string().uuid(),allowed:d.boolean(),revision:bp,updatedAt:d.string().datetime(),updatedBy:d.string().uuid()}).strict();var Ip=(a=>(a.NoEnvironment="no_environment",a.NoRecordedGrant="no_recorded_grant",a.Unavailable="unavailable",a.Changed="changed",a.Denied="denied",a.OutOfScope="out_of_scope",a))(Ip||{});function wp(e){switch(e){case"no_environment":return"the run has no selected Test Environment address";case"no_recorded_grant":return"the run's configuration did not record permission to keep test data in this environment";case"unavailable":return"the current permission to keep test data could not be read";case"changed":return"the permission to keep test data changed after the run started";case"denied":return"the environment does not permit test data to stay";case"out_of_scope":return"the request is outside the environment's address"}}o(wp,"persistenceRefusalText");function sm(e,t,n){let i=vp.safeParse(t);return!i.success||!i.data.allowed||!e.environmentId||i.data.environmentId!==e.environmentId||!e.environmentAddress||e.persistentDataPolicy&&e.persistentDataPolicy.revision!==i.data.revision?!1:uo(e.environmentAddress,n)}o(sm,"persistentDataPolicyApplies");function uo(e,t){try{let n=new URL(t),i=new URL(e);if(i.search||i.hash)return!1;let r=/%(?:2f|5c|2e|25)/i;if(t.includes("\\")||e.includes("\\")||r.test(n.pathname)||r.test(i.pathname))return!1;let s=i.pathname.replace(/\/$/,"");return["https:","http:"].includes(i.protocol)&&n.origin===i.origin&&(n.pathname===s||n.pathname.startsWith(`${s}/`))}catch{return!1}}o(uo,"environmentContainsUrl");var GC="delivery-persistence.json",f1=d.object({environmentId:d.string().uuid(),environmentAddress:d.string().url(),revision:bp}).strict(),g1=d.object({refusal:d.nativeEnum(Ip)}).strict();var D1=d.unknown().optional(),_1={handshake:"/api/v1/runner/runs/:runId/attempts",report:"/api/v1/runner/attempts/:attemptId/report",end:"/api/v1/runner/attempts/:attemptId/end",configuration:"/api/v1/runner/attempts/:attemptId/configuration",progress:"/api/v1/runner/attempts/:attemptId/progress",sutRecipe:"/api/v1/runner/attempts/:attemptId/sut-recipe",runtimePlan:"/api/v1/runner/attempts/:attemptId/runtime-plan",persistentDataPolicy:"/api/v1/runner/attempts/:attemptId/persistent-data-policy",heartbeat:"/api/v1/runner/attempts/:attemptId/heartbeat",setupEvents:"/api/v1/runner/attempts/:attemptId/setup-events",runEvents:"/api/v1/runner/attempts/:attemptId/run-events",requirements:"/api/v1/runner/attempts/:attemptId/requirements",requirementFile:"/api/v1/runner/attempts/:attemptId/requirements/:key/file",deployedRevisions:"/api/v1/runner/attempts/:attemptId/deployed-revisions"},Pa=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(Pa||{}),dm=(s=>(s.Trigger="TRIGGER",s.Baseline="BASELINE",s.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",s.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",s.ManualOverride="MANUAL_OVERRIDE",s))(dm||{}),pm=(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))(pm||{}),Eoe=["sut_setup"],boe=["sut_setup","schedule","revision_read"],voe=["sut_setup"],HC=(t=>(t.PullRequest="pull_request",t))(HC||{}),JC=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(JC||{}),A1=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var fm=(r=>(r.None="none",r.Delivered="delivered",r.Partial="partial",r.Failed="failed",r))(fm||{}),kp=(s=>(s.ReportUploaded="report_uploaded",s.NoReport="no_report",s.Cancelled="cancelled",s.RecipeUploaded="recipe_uploaded",s.RevisionsUploaded="revisions_uploaded",s))(kp||{}),N1=(n=>(n.Running="running",n.Ended="ended",n))(N1||{}),Bp=(A=>(A.TimedOut="timed_out",A.AgentFailed="agent_failed",A.SetupFailed="setup_failed",A.CredentialMissing="credential_missing",A.RunnerLost="runner_lost",A.CheckoutFailed="checkout_failed",A.EnvironmentUnverified="environment_unverified",A.ModelProviderDenied="model_provider_denied",A.ModelProviderUnavailable="model_provider_unavailable",A.RunnerProviderNotReady="runner_provider_not_ready",A.MergeConflict="merge_conflict",A.EnvironmentUnavailable="environment_unavailable",A))(Bp||{}),P1=(i=>(i.Onboard="onboard",i.Deploy="deploy",i.Recheck="recheck",i))(P1||{}),YC=(n=>(n.Started="started",n.Finished="finished",n))(YC||{}),U1=(i=>(i.Passed="passed",i.Failed="failed",i.Skipped="skipped",i))(U1||{});var F1=(i=>(i.ChooseCredential="choose_credential",i.FreeText="free_text",i.ChooseSource="choose_source",i))(F1||{});var O1=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(O1||{}),WC=(i=>(i.Discover="discover",i.Start="start",i.Check="check",i))(WC||{}),VC=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(VC||{});var ZC=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(ZC||{}),Lr=d.string().regex(/^[1-9][0-9]{0,18}$/),jr=d.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),zC=d.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Du=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function M1(e,t){return`${e.replace(/\/+$/,"")}/runs/${t}`}o(M1,"skyrampRunPageUrl");var In=d.string().regex(Du),Dn=d.string().regex(/^[0-9a-f]{64}$/),lm=d.object({id:In,revision:Lr}).strict(),gm={provider:d.literal("github"),providerAccountId:Lr,providerRepositoryId:Lr},Am={provider:d.literal("azure-devops"),providerAccountId:In,providerRepositoryId:In},Ir=d.discriminatedUnion("provider",[d.object(gm).strict(),d.object(Am).strict()]),KC=d.discriminatedUnion("provider",[d.object(gm).passthrough(),d.object(Am).passthrough()]),ji=o(e=>`${e.provider}:${e.providerRepositoryId}`,"sourceKey"),h1={namespace:d.string().min(1),name:d.string().min(1)},L1=d.discriminatedUnion("provider",[d.object({...gm,...h1}).strict(),d.object({...Am,...h1}).strict()]),m1=d.object({ref:d.string().min(1),revision:jr}).strict(),Ioe=d.object({kind:d.nativeEnum(JC),number:Lr.optional(),ref:d.string().min(1),revision:jr,reason:d.nativeEnum(dm)}).strict(),woe=d.object({repository:L1,revision:jr,ref:d.string().nullable(),reason:d.nativeEnum(dm),change:d.object({kind:d.nativeEnum(HC),number:Lr,base:m1.optional()}).strict().nullable(),compareWith:m1.optional(),merge:d.array(Ioe).min(2).optional()}).strict();function Coe(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,i=new Set;for(let[s,a]of t.entries()){if(a.kind==="pull_request"!=(a.number!==void 0))return{path:["merge",s,"number"],message:"a pull request names its number, and a branch none"};if(!A1.includes(a.reason))return{path:["merge",s,"reason"],message:`${a.reason} does not select a merged revision`};if(a.kind==="branch"&&a.reason!=="MANUAL_OVERRIDE")return{path:["merge",s,"reason"],message:"only a person chooses a branch to merge"};if(a.ref===e.ref)return{path:["merge",s,"ref"],message:"the baseline branch is what the source merges onto"};if(a.number!==void 0&&n.has(a.number)||i.has(a.ref))return{path:["merge",s],message:"names a revision the source already merges"};a.number!==void 0&&n.add(a.number),i.add(a.ref)}let r=A1.find(s=>t.some(a=>a.reason===s));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}o(Coe,"mergedSourceIssue");function Soe(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,comparisonBaselineId:i,sources:r}=e.baseline;if([t,n,i].filter(l=>l!=null).length>1)return"a run compares with one baseline";let s=e.trigger.kind==="schedule"&&t!==null||n!==void 0||i!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&i===void 0)return"a run with no Confirmed Baseline names no baseline sources";let a=new Set(e.sources.map(l=>ji(l.repository))),c=new Set(r.map(l=>ji(l.repository)));return c.size===r.length&&c.size===a.size&&[...c].every(l=>a.has(l))?null:"names every source of the snapshot, once"}o(Soe,"baselineSourcesIssue");var j1=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,G1=/^[1-9][0-9]{0,18}$/,y1=new RegExp(`${j1.source}|${G1.source}`),E1=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,koe=d.union([d.object({source:d.literal("jira"),site:d.string().regex(E1),key:d.string().regex(j1),updated:d.string().datetime(),contentHash:Dn}).strict(),d.object({source:d.literal("confluence"),site:d.string().regex(E1),key:d.string().regex(G1),version:d.number().int().positive(),contentHash:Dn}).strict(),d.object({source:d.literal("other"),key:d.string().regex(dp),contentHash:Dn}).strict(),d.object({source:d.literal("other"),key:d.string().regex(hs),contentHash:Dn,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(pp)}).strict()]),b1=d.union([d.literal("jira"),d.literal("confluence")]),Boe=d.object({schemaVersion:d.literal(1),items:d.array(d.union([d.object({source:b1,site:d.string(),key:d.string().regex(y1),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:b1,site:d.string(),key:d.string().regex(y1),state:d.literal("not_read"),reason:d.nativeEnum(Da)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(dp),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:d.literal("other"),key:d.string().regex(dp),state:d.literal("not_read"),reason:d.nativeEnum(Da)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(hs),state:d.literal("read"),version:Dn,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(pp)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(hs),state:d.literal("not_read"),reason:d.nativeEnum(Da)}).strict()])),instructions:d.array(d.string()).optional()}).strict(),Roe=d.object({resultId:d.string().min(1),repository:d.string().min(1),testType:d.string().min(1),path:d.string(),finding:d.string().min(1)}).strict(),xoe=d.object({schemaVersion:d.literal(1),runId:In,skyrampOrgId:In,target:lm,policy:lm.nullable(),trigger:d.object({kind:d.nativeEnum(pm),requestedAt:d.string().datetime()}).strict(),configuration:d.object({captureId:In,revision:Lr.nullable(),hash:Dn}).strict(),baseline:d.object({confirmedRunId:In.nullable(),initialBaselineId:In.optional(),comparisonBaselineId:In.optional(),knownFailures:d.array(Roe).optional(),sources:d.array(d.object({repository:Ir,revision:jr}).strict()).optional()}).strict().optional(),sources:d.array(woe).min(1).max(1e3),execution:d.object({provider:d.nativeEnum(Pa),repository:L1,workflowPath:d.string(),ref:d.string()}).strict(),credentials:d.array(d.object({name:d.string(),purpose:d.nativeEnum(up),required:d.boolean()}).strict()),requirements:d.array(koe).min(1).optional(),instructions:d.object({contentHash:Dn}).strict().optional(),deployedRevisions:d.array(d.object({repository:Ir,revision:jr}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((u,l)=>{let p="fileName"in u?"file":"pasted";u.source==="other"&&u.key!==`${p}-${u.contentHash.slice(0,16)}`&&t.addIssue({code:d.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",l,"key"]});let f=UC({source:u.source,key:u.key});n.has(f)&&t.addIssue({code:d.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",l,"key"]}),n.add(f)});let i=e.trigger.kind,r=Eoe.includes(i);r!==(e.policy===null)&&t.addIssue({code:d.ZodIssueCode.custom,path:["policy"],message:r?`a ${i} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:d.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let s=Soe(e);s&&t.addIssue({code:d.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:s}),boe.includes(i)&&e.sources.forEach((u,l)=>{u.reason!=="BASELINE"&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,"reason"],message:`a ${i} run selects only BASELINE sources`})}),e.deployedRevisions&&i!=="manual"&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(e.sources.map(u=>ji(u.repository))),c=new Set;(e.deployedRevisions??[]).forEach((u,l)=>{let p=ji(u.repository);a.has(p)?c.has(p)&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",l,"repository"],message:"repository appears twice"}):t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",l,"repository"],message:"names a repository outside the snapshot"}),c.add(p)}),e.sources.forEach((u,l)=>{u.compareWith&&(u.reason!=="MANUAL_OVERRIDE"||u.change)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(u.change?.base||u.compareWith||u.merge)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let p=Coe(u);p&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,...p.path],message:p.message})})});var XC=(n=>(n.Person="person",n.Policy="policy",n))(XC||{}),Qoe=d.object({kind:d.nativeEnum(XC),name:d.string().min(1).max(256)}).strict(),$oe=d.object({mcp:d.discriminatedUnion("source",[d.object({source:d.literal("npm"),version:d.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),d.object({source:d.literal("github"),ref:d.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:d.object({region:d.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:d.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Toe=d.object({schemaVersion:d.literal(1),attempt:d.object({id:In,number:d.number().int().positive(),deadlineAt:d.string().datetime()}).strict(),manifest:xoe,manifestHash:Dn,entitlements:d.array(d.string()).optional(),runToken:d.string().min(1).optional(),requestedBy:Qoe.nullable().optional(),writeAllowed:d.boolean().optional(),claudeCodeVersion:d.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:d.array(d.object({repository:Ir,revision:jr}).strict()).optional(),statedRevisions:d.array(d.object({repository:Ir,revision:jr}).strict()).optional(),runSettings:$oe.optional()}).strict(),v1={providerRunAttempt:d.number().int().positive(),workflowRef:d.string().min(1)},Doe=d.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),_oe=d.object({schemaVersion:d.literal(1),runId:In,execution:d.discriminatedUnion("provider",[d.object({...v1,provider:d.literal("github"),repository:d.object(gm).strict(),providerRunId:Lr}).strict(),d.object({...v1,provider:d.literal("azure-devops"),repository:d.object(Am).strict(),providerRunId:Doe}).strict()]),requester:d.literal(!0).optional(),writeCheck:d.literal(!0).optional(),claudeCodePin:d.literal(!0).optional(),deployedPins:d.literal(!0).optional(),statedPins:d.literal(!0).optional(),runSettings:d.literal(!0).optional(),credentialKinds:d.literal(!0).optional(),credentialBlockers:d.literal(!0).optional()}).strict(),I1=d.object({repository:Ir,number:Lr,commitSha:jr.optional()}).strict(),om=d.array(d.object({repository:Ir,reason:d.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),V1=d.object({branch:zC.optional(),commitSha:jr.optional()}).strict(),hm=4096,z1=d.array(d.object({file:d.string().max(4096).regex(/\S/),dependsOn:d.array(d.string().max(2048).regex(/\S/)).max(100)}).strict()).min(1).max(500),w1=d.object({repository:Ir,message:d.string().max(hm),...V1.shape,heldBack:z1.optional()}).strict(),Noe=d.discriminatedUnion("status",[d.object({status:d.literal("none"),noTests:om}).strict(),d.object({status:d.literal("delivered"),noTests:om,pullRequests:d.array(I1).min(1)}).strict(),d.object({status:d.literal("partial"),noTests:om,pullRequests:d.array(I1).min(1),failures:d.array(w1).min(1)}).strict(),d.object({status:d.literal("failed"),message:d.string().max(hm),noTests:om,failures:d.array(w1).min(1).optional()}).strict()]),eS=1024*1024,q1=16*1024*1024,Cp={id:4096,text:16384,businessCase:65536},Rp={id:Cp.id,statement:Cp.text,rows:1e3},C1=d.string().min(1).max(Cp.id),cm=d.string().max(Cp.text),am=o((e,t)=>d.array(d.object({[e]:cm}).strict()).max(t).optional(),"texts"),tS=d.object({language:d.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:d.string().max(Cp.businessCase),validation:d.object({rationale:cm.min(1),gaps:d.array(d.string().min(1).max(4096)).max(200)}).strict().optional(),changes:d.array(d.object({id:C1,text:cm}).strict()).max(1e3).optional(),requirements:d.array(d.object({id:C1,statement:cm}).strict()).max(Rp.rows).optional(),issuesFound:am("description",5e3),newTestsCreated:am("description",5e3),testResults:am("details",5e3),caveats:am("text",100)}).strict(),Poe=d.object({blockedPreflight:d.object({file:d.string().min(1),repository:d.string().min(1).optional(),reason:d.string().min(1).max(300),evidence:d.string().min(1).max(400)}).strict().optional(),sufficiency:d.nativeEnum(Oi),rationale:d.string().min(1),gaps:d.array(d.string().min(1)),acceptedEvidence:d.array(d.object({kind:d.nativeEnum(co),repository:d.string().min(1),revision:jr,reference:d.string().min(1),summary:d.string().min(1)}).strict()),actionRequired:d.array(d.nativeEnum(xu))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:d.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:d.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),um=500,H1=2048,J1=1e3,Uoe=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,S1=o(e=>e.length>0&&e.length<=64&&e===e.trim()&&!Uoe.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),"isAzureName"),Y1=o(e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,i,...r]=e.split("/");return e.length<=201&&r.length===0&&i!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&S1(n)&&S1(i)},"isResultRepository"),Foe=d.object({testResults:d.array(d.object({resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:d.string().refine(Y1,"Invalid"),testType:d.string(),runtimeTargets:yp.optional(),endpoint:d.string(),status:d.enum(["Pass","Fail","Skipped"]),details:d.string(),fileName:d.string().optional(),testId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:d.object({kind:d.nativeEnum(fp),family:d.nativeEnum(gp).optional()}).strict().optional(),origin:d.nativeEnum(Xh).optional()}).strict()),validation:Poe,changes:d.array(d.object({id:d.string().min(1).max(512),text:d.string().max(16384),source:d.string().max(H1),testedBy:d.array(d.string().min(1).max(1024)).max(um),writtenBy:d.array(d.string().min(1).max(1024)).max(um),maintainedBy:d.array(d.string().min(1).max(1024)).max(um)}).strict()).max(J1).optional(),traceVersion:d.literal(1),display:tS.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,i={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let s of["issuesFound","newTestsCreated","testResults","caveats"]){let a=n?.[s];a&&a.length!==(Array.isArray(i[s])?i[s].length:0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["display",s],message:`has not one row per ${s} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((s,a)=>{let c=s.failureCause;c&&s.status==="Pass"&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"a passing result has no failure cause"}),c&&c.kind==="environment"!=(c.family!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"an environment cause names its family, and no other cause does"});let u=["testResults",a,"resultId"],l=s.resultId.slice(`${s.repository}:${s.testType}:`.length);(!s.resultId.startsWith(`${s.repository}:${s.testType}:`)||l===""||l.startsWith("/")||l.startsWith("#"))&&t.addIssue({code:d.ZodIssueCode.custom,path:u,message:"is not repository:testType:path for this result"}),r.has(s.resultId)&&t.addIssue({code:d.ZodIssueCode.custom,path:u,message:"stable identity repeated"}),r.add(s.resultId)})}),k1=o(e=>e.replace(/[%:#]/g,t=>encodeURIComponent(t)),"encodeIdPart");function nS(e,t,n,i){let r=n.replace(/\\/g,"/"),s=r.split("/").filter(u=>u!==""&&u!==".");if(r.startsWith("/")||/^[A-Za-z]:/.test(r)||s.length===0||s.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=s.join("/"),c=`${e}:${t}:${k1(a)}`;return i?`${c}#${k1(i)}`:c}o(nS,"testResultId");var mm=(i=>(i.BranchPushed="branch_pushed",i.PullRequestOpened="pull_request_opened",i.PullRequestEdited="pull_request_edited",i))(mm||{}),W1=50,Z1=d.discriminatedUnion("kind",[d.object({kind:d.literal("branch_pushed"),repository:Ir,branch:zC,commit:jr}).strict(),d.object({kind:d.enum(["pull_request_opened","pull_request_edited"]),repository:Ir,number:Lr,branch:zC}).strict()]),Ooe=100,Moe=2048,zRe=d.object({records:d.array(d.string().regex(/^https?:\/\/[^\s/?#@]+(\/[^\s?#]*)?$/).max(Moe)).max(Ooe),unlisted:d.number().int().nonnegative()}).strict().refine(e=>e.records.length+e.unlisted>0,"names at least one create"),K1=d.object({schemaVersion:d.literal(1),run:d.object({runId:In,attemptNumber:d.number().int().positive(),manifestHash:Dn}).strict(),target:lm,policy:lm,provenance:d.object({sources:d.array(d.object({repository:Ir,revision:jr}).strict()),firstQualification:d.literal(!0).optional()}).strict(),delivery:d.object({generatedTests:Noe}).strict(),producer:d.object({testbot:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Foe,githubWrites:d.array(Z1).max(W1).optional()}).strict(),rS=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(rS||{}),iS=200,Loe=d.object({cause:d.nativeEnum(rS),credential:d.string().regex(Kn).optional(),reason:d.string().trim().min(1).max(iS).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),joe=d.object({name:d.string().regex(Kn),purpose:d.enum(["sut_access","other"]),required:d.boolean(),how:d.string().trim().min(1).max(Kh)}).strict(),qRe=K1.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:p1,check:Loe.optional(),inputs:d.array(joe).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=o((s,a)=>t.addIssue({code:d.ZodIssueCode.custom,path:["recipe",...s],message:a}),"issue");e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let i=new Set,r=0;e.files.forEach((s,a)=>{Ep(s.path)||n(["files",a,"path"],"is not a file under .skyramp/sut/, or the .skyramp/workspace.yml a recipe stored before SKYR-5829 carries"),i.has(s.path)&&n(["files",a,"path"],"file repeated"),i.add(s.path),t1.test(s.content)&&n(["files",a,"content"],"is not text");let c=Buffer.byteLength(s.content,"utf8");r+=c,c>_C&&n(["files",a,"content"],`larger than ${_C} bytes`)}),r>NC&&n(["files"],`recipe text over ${NC} bytes in total`)}),HRe=d.object({components:d.array(d.object({name:d.string().min(1),repository:d.string().refine(Y1,"Invalid"),observedRevision:d.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:d.nativeEnum(em),evidence:d.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();function X1(e){return e.trigger.kind==="schedule"||e.trigger.kind==="manual"&&e.sources.every(t=>t.reason==="BASELINE")}o(X1,"readsDeployedState");var Goe=d.object({schemaVersion:d.literal(1),stage:d.nativeEnum(P1),event:d.nativeEnum(YC),status:d.nativeEnum(U1).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),ym=100,Voe=5e3,Na=2e3,B1=100,eG=/^[A-Za-z0-9_-]{1,64}$/,zoe=20,qoe=200,Hoe=100,Joe=100,Yoe=200,R1="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Woe=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${R1}/${R1})$`),Zoe=500,x1=50,Koe=10,Xoe=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,tG=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,vr=o(e=>d.string().max(e).refine(t=>t.trim().length>0&&!tG.test(t),"blank, or not text"),"setupText"),Li={sequence:d.number().int().min(1).max(Voe),at:d.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},nG=d.object({...Li,kind:d.literal("reply"),to:d.string().uuid(),outcome:d.nativeEnum(O1),accepted:d.boolean(),text:vr(Na),note:d.object({source:d.enum(["target","environment"]),quote:vr(Na)}).strict().optional(),kept:vr(Na).optional()}).strict();function rG(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:d.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}o(rG,"checkReply");var eae=d.discriminatedUnion("kind",[d.object({...Li,kind:d.literal("log"),phase:d.nativeEnum(WC),text:vr(Na)}).strict(),d.object({...Li,kind:d.literal("component"),name:vr(B1),repository:vr(Yoe).refine(e=>Woe.test(e)||e===Ui,"not owner/name"),file:vr(Zoe).nullable(),status:d.nativeEnum(ZC),version:vr(Joe).optional()}).strict(),nG,d.object({...Li,kind:d.literal("question"),id:d.string().regex(eG),type:d.nativeEnum(F1),text:vr(Na),component:vr(B1).nullable(),choices:d.array(vr(qoe)).max(zoe),placeholder:vr(Hoe).optional()}).strict(),d.object({...Li,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(ym)}).strict(),d.object({...Li,kind:d.literal("credentials"),names:d.array(d.string().regex(Kn)).min(1).max(x1),logins:d.array(d.object({key:d.string().regex(Xoe),usernameVariable:d.string().regex(Kn),passwordVariable:d.string().regex(Kn)}).strict()).min(1).max(Koe).optional(),variables:d.array(d.string().regex(Kn)).min(1).max(x1).optional()}).strict()]).superRefine((e,t)=>{if(rG(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(i=>u1(i.key));new Set(n).size!==n.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((i,r)=>{for(let s of["usernameVariable","passwordVariable"])e.names.includes(i[s])||t.addIssue({code:d.ZodIssueCode.custom,path:["logins",r,s],message:"not one of the names"})})}e.kind==="credentials"&&e.variables&&(new Set(e.variables).size!==e.variables.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["variables"],message:"a name twice"}),e.variables.forEach((n,i)=>{e.names.includes(n)||t.addIssue({code:d.ZodIssueCode.custom,path:["variables",i],message:"not one of the names"})})),e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:d.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:d.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),tae=d.object({schemaVersion:d.literal(1),events:d.array(eae).max(ym)}).strict(),nae=d.discriminatedUnion("kind",[d.object({...Li,kind:d.literal("log"),stage:d.nativeEnum(VC),text:vr(Na)}).strict(),nG,d.object({...Li,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(ym)}).strict(),d.object({...Li,kind:d.literal("stage"),stage:d.nativeEnum(VC),event:d.nativeEnum(YC)}).strict(),d.object({...Li,kind:d.literal("test"),resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:d.enum(["Pass","Fail","Skipped"]),details:d.string().max(Na).refine(e=>!tG.test(e),"not text")}).strict()]).superRefine(rG),rae=d.object({schemaVersion:d.literal(1),events:d.array(nae).max(ym)}).strict(),Q1={id:d.string().uuid(),text:d.string(),by:d.string().nullable(),at:d.string(),replied:d.literal(!0).optional()},iG=d.discriminatedUnion("kind",[d.object({...Q1,kind:d.literal("instruction"),question:d.null()}),d.object({...Q1,kind:d.literal("answer"),question:d.string().regex(eG)})]),sG=d.string().regex(/^[A-Za-z0-9+/]{43}=$/),iae=d.object({id:d.string().uuid(),revision:d.string(),by:d.string().nullable(),at:d.string(),target:d.string(),own:d.object({source:d.enum(["policy","test_environment"]),text:d.string()}).nullable()}),sae=d.object({schemaVersion:d.literal(1),leftOut:d.array(d.string()),messages:d.array(iG).optional(),stop:d.object({key:sG}).optional(),notes:iae.optional()}),oae=d.object({schemaVersion:d.literal(1),messages:d.array(iG).optional()});var aae=500*1024*1024,oG=d.object({id:Lr,name:d.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Lr,expiresAt:d.string().datetime()}).strict(),cae=d.object({schemaVersion:d.literal(1),artifact:oG,sessionId:In,contentHash:Dn,bytes:d.number().int().min(1).max(aae)}).strict(),uae=d.object({schemaVersion:d.literal(1),checkpoint:d.object({artifact:oG,repository:d.object({namespace:d.string().min(1),name:d.string().min(1)}).strict(),sessionId:In,contentHash:Dn,key:sG}).strict().nullable()}).strict(),lae=200,Qu=100,aG=(i=>(i.Resume="resume",i.Retry="retry",i.Update="update",i))(aG||{}),dae=d.object({kind:d.nativeEnum(aG),setup:d.object({runId:In,endedAt:d.string().nullable(),outcome:d.string().nullable()}).strict(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1),status:d.nativeEnum(ZC)}).strict()).max(Qu),credentials:d.array(d.string().min(1)).max(Qu),answers:d.array(d.object({question:d.string(),answer:d.string().nullable()}).strict()).max(Qu),instructions:d.array(d.object({text:d.string(),reply:d.string().nullable()}).strict()).max(Qu),log:d.array(d.object({phase:d.nativeEnum(WC),text:d.string()}).strict()).max(lae),recipe:d.object({files:d.array(d.object({path:d.string().min(1),content:d.string()}).strict()).max(Qu),blockers:d.array(d.object({component:d.string(),problem:d.string(),evidence:d.string(),fix:d.string()}).strict()).max(Qu)}).strict().optional()}).strict(),pae=d.object({schemaVersion:d.literal(1),context:dae.nullable()}).strict(),fae=d.object({schemaVersion:d.literal(1),configuration:d.object({captureId:In,revision:Lr.nullable(),hash:Dn}).strict(),capture:d.object({schemaVersion:d.literal(1),settings:d.object({target:d.object({environment:d.unknown()}).passthrough(),timeoutMinutes:d.number().int().positive(),answerWaitMinutes:d.number().int().positive().optional(),testEnvironment:d.object({name:d.string().min(1),address:d.string().min(1).optional(),readyWhen:d.string().min(1).optional(),environmentId:d.string().uuid().optional(),persistentDataPolicy:D1}).passthrough().optional()}).passthrough(),provenance:d.object({}).passthrough(),hash:Dn}).strict()}).strict(),cG=d.object({schemaVersion:d.literal(1),environmentId:d.string().uuid().nullable(),environmentAddress:d.string().url().nullable(),persistentDataPolicy:vp.nullable()}).strict(),gae=Ru.extend({environmentId:d.string().uuid().optional(),persistentDataPolicy:D1,version:d.number().int().positive(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1)}).strict()),contentHash:Dn.optional(),files:d.array(d.object({path:d.string().refine(e=>Ep(e)&&!jC.includes(e),"not a file of a customer_deployed plan"),content:d.string()}).strict()).optional()}).strict(),Aae=d.object({schemaVersion:d.literal(1),testEnvironment:gae.nullable().optional(),runtimePlan:d.object({version:d.number().int().positive(),contentHash:Dn,files:d.array(d.object({path:d.string().refine(Ep,"not a recipe file path"),content:d.string()}).strict()).min(1),repository:im.optional(),recipeRepository:im.optional(),recipe:d.record(d.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"]}),uG=d.object({schemaVersion:d.literal(1),state:d.nativeEnum(N1),ending:d.nativeEnum(kp).nullable(),cause:d.nativeEnum(Bp).nullable(),deadlineAt:d.string().datetime()}).strict();function lG(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(lG,"attemptClosure");var dG=50,JRe=d.object({repository:Ir,revisions:d.array(d.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:d.array(d.string().min(1)).min(1).max(dG)}).strict();function qC(e){if(typeof e=="number"&&!Number.isFinite(e))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(e))return`[${e.map(qC).join(",")}]`;if(e!==null&&typeof e=="object"){let n=e;return`{${Object.keys(n).sort().map(i=>`${JSON.stringify(i)}:${qC(n[i])}`).join(",")}}`}let t=JSON.stringify(e);if(t===void 0)throw new TypeError("Canonical JSON requires JSON values");return t}o(qC,"canonicalJson");function pG(e){return(0,T1.createHash)("sha256").update(qC(e),"utf8").digest("hex")}o(pG,"manifestHash");var $u=o(e=>({provider:e.provider,providerAccountId:e.providerAccountId,providerRepositoryId:e.providerRepositoryId}),"toSourceRef");function sS(e,t,{statedPins:n=!0,credentialKinds:i=!0,credentialBlockers:r=!0}={}){return _oe.parse({schemaVersion:1,runId:e,execution:t.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{},...t.runSettingsFromApp?{runSettings:!0}:{},...i?{credentialKinds:!0}:{},...r?{credentialBlockers:!0}:{}})}o(sS,"handshakeRequest");function fG(e){let t=Toe.parse(e);if(pG(t.manifest)!==t.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return t}o(fG,"parseHandshakeResponse");function hae(e){let t=o(r=>r.map(s=>({repository:$u(s.repository),number:s.number,...s.commitSha===void 0?{}:{commitSha:s.commitSha}})),"pullRequests"),n=e.noTests?{noTests:e.noTests.map(r=>({repository:$u(r.repository),reason:r.reason}))}:{};if(e.status==="delivered")return{status:e.status,...n,pullRequests:t(e.pullRequests)};let i=o(r=>r.map(s=>({repository:$u(s.repository),message:s.message,...s.branch===void 0?{}:{branch:s.branch},...s.commitSha===void 0?{}:{commitSha:s.commitSha},...s.heldBack===void 0?{}:{heldBack:s.heldBack}})),"failures");return e.status==="partial"?{status:e.status,...n,pullRequests:t(e.pullRequests),failures:i(e.failures)}:e.status==="failed"&&e.failures?{...e,...n,failures:i(e.failures)}:{...e,...n}}o(hae,"toDelivery");function mae(e){return e.issues.map(t=>`${t.path.map((i,r)=>typeof i=="number"?`[${i}]`:r===0?i:`.${i}`).join("")}: ${t.message}`).join("; ")}o(mae,"describeIssues");function gG(e){let{manifest:t}=e;if(voe.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=K1.safeParse({schemaVersion:1,run:{runId:t.runId,attemptNumber:e.attemptNumber,manifestHash:pG(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(i=>({repository:$u(i.repository),revision:i.revision})),...e.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:hae(e.generatedTests)},producer:e.producer,report:e.report,...e.githubWrites?.length?{githubWrites:e.githubWrites.map(i=>({...i,repository:$u(i.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${mae(n.error)}`);return yae(n.data,t,e.checkedOut),n.data}o(gG,"buildReportUpload");function yae(e,t,n){let i=o(s=>n.find(a=>ji(a.repository)===ji(s.repository))?.revision??s.revision,"revisionOf"),r=new Map(t.sources.map(s=>[`${s.repository.namespace}/${s.repository.name}`.toLowerCase(),i(s)]));e.report.validation.acceptedEvidence.forEach((s,a)=>{let c=`report.validation.acceptedEvidence[${a}]`,u=r.get(s.repository.toLowerCase());if(!u)throw new Error(`${c}.repository: ${s.repository} is outside the run's snapshot`);if(s.revision!==u)throw new Error(`${c}.revision: evidence is not from the checked-out revision ${u}`)})}o(yae,"assertEvidenceFromSnapshot");function AG(e){if(e.reportUploaded)return{schemaVersion:1,reason:"report_uploaded",cause:null};if(e.recipeUploaded)return{schemaVersion:1,reason:"recipe_uploaded",cause:null};if(e.revisionsUploaded)return{schemaVersion:1,reason:"revisions_uploaded",cause:null};let t=e.githubWrites?.length?{githubWrites:e.githubWrites.map(i=>({...i,repository:$u(i.repository)}))}:{},n=e.sharedEnvironmentRecords?{sharedEnvironmentRecords:e.sharedEnvironmentRecords}:{};return e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null,...t,...n}:e.mergeConflict&&$1(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict,...t,...n}:{schemaVersion:1,reason:"no_report",cause:$1({...e,mergeConflict:void 0}),...t,...n}}o(AG,"attemptEndFor");function $1(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":e.environmentUnavailable?"environment_unavailable":"agent_failed"}o($1,"noReportCause");var nxe=["clean","recipe-drift"];var lo=ee(require("path"));var oxe={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var oS=o(e=>new Map((e??[]).flatMap(t=>t.file?[[_a(t.key),t.file.name]]:[])),"itemNames"),vae=10*1024*1024,mG=o(e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","needsExtraction"),yG=o((e,t)=>lo.join(lo.dirname(e),`${lo.basename(e,lo.extname(e))}${t}`),"besideFile"),EG=o(e=>yG(e,".extracted.txt"),"extractedTextPath");var Iae=o(e=>yG(e,".quotes.txt"),"confirmedQuotesPath");function bG(e){return mG(e.file)?EG(e.path):e.file?.mediaType==="application/pdf"?Iae(e.path):e.path}o(bG,"itemTextPath");var xp=ee(require("fs")),Ua=ee(require("path"));var wae=8;function ln(e,t,n={}){let i=t.slice(0,wae),r=t.length-i.length;return{name:e,passed:!1,details:i.join("; ")+(r>0?`; \u2026and ${r} more`:""),...n.fatal?{fatal:!0}:{}}}o(ln,"fail");function Gi(e){if(xp.existsSync(e))try{return JSON.parse(xp.readFileSync(e,"utf-8"))}catch{return}}o(Gi,"readJsonFile");function ve(e,t){return Gi(Ua.join(e.outputsDir,t))}o(ve,"readArtifact");function Xn(e,t){return{name:e,verify(n,i){let{errors:r}=t(n,i);return r.length===0?{name:this.name,passed:!0}:ln(this.name,r,{fatal:!0})}}}o(Xn,"schemaGate");function di(e,t){return Ua.relative(e,Ua.resolve(e,t)).replace(/\/+$/,"")}o(di,"relNorm");function Qp(e){return e.replace(/\s+/g," ").trim()}o(Qp,"normalizeCode");var $p=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");function Nt(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(r=>r.length)),n="`".repeat(t+1),i=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${i}${e}${i}${n}`}o(Nt,"codeSpan");var vG=ee(require("path"));var aS="outputs/preflight.json",Fa="pr-diff.txt",cS="related-diffs";function uS(e){return vG.join(cS,`${e.toLowerCase().replace(/\//g,"__").replace(/[^a-z0-9._-]/g,"_")}.diff`)}o(uS,"relatedDiffArtifact");var ys=ee(require("path"));var Tp=ee(require("path"));var po="Skyramp Testbot",Oa="test-bot@skyramp.dev";var _u=o(e=>e.slice(0,12),"shortCommit");var Cae=o((e,t)=>Vt(t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim(),"git");function IG(e){let t="";try{t=Cae(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/${Tp.basename(Tp.resolve(e)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}o(IG,"repositorySlug");var Rxe=new Set(Object.values(co));var xxe=d.object({checks:d.array(d.object({repository:d.string().optional(),name:d.string().min(1),headSha:d.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:d.string().default("completed"),conclusion:d.string().nullable().optional(),url:d.string().optional(),summary:d.string().optional()}))});var Sae=["generate-unit","native-run"],Dxe=["preflight","plan","write",...Sae,"report","deliver"];var Em=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(Em||{}),kae=Object.values(Em);var wG=8e3;function CG(e,t){return(e.contextRepositories??[]).some(n=>pi(n,t))}o(CG,"pinnedForContext");var lS=new Map;function Rae(e){return e.repositorySlug?e.repositorySlug:(lS.has(e.repositoryPath)||lS.set(e.repositoryPath,IG(e.repositoryPath)),lS.get(e.repositoryPath))}o(Rae,"workingSlug");function Jt(e){let t=Rae(e);return[{slug:t,path:e.repositoryPath,writable:!CG(e,t),working:!0},...(e.relatedRepos??[]).map(n=>({slug:n.slug,path:n.path,writable:n.writable===!0,working:!1}))]}o(Jt,"runSources");var pi=o((e,t)=>e.toLowerCase()===t.toLowerCase(),"sameSlug");function Nu(e,t){return t?.trim()?e.find(n=>pi(n.slug,t.trim())):e[0]}o(Nu,"findSource");function wr(e,t){return Nu(Jt(e),t)}o(wr,"resolveSource");var xae=o((e,t)=>`${t} is not a repository of this run (${Jt(e).map(n=>n.slug).join(", ")})`,"notARepository");function Es(e,t){let n=wr(e,t);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${Jt(e).filter(i=>i.writable).map(i=>i.slug).join(", ")}`}:{error:xae(e,t)}}o(Es,"writableSource");function fi(e,t){return SG(Jt(e),t)}o(fi,"checkoutLabel");var dS=o(e=>ys.basename(ys.resolve(e.path)),"relatedDirName");function SG(e,t){return e.length<2?"":`${Nu(e,t)?.slug??t}: `}o(SG,"labelAmong");var Hxe={focused:"Focused",impacted_critical:"Impacted and critical",broad:"Broad"};var Uu=o(e=>!!e.inputs?.scheduledValidation?.comparisonBaselineId,"retestsKnownFailures");var hb=ee(require("fs")),Dt=ee(require("path"));var Br=ee(require("fs")),Sq=require("child_process"),kq=require("module"),Bq=ee(require("os")),yi=ee(require("path"));var pe={};ei(pe,{$brand:()=>kS,$input:()=>ix,$output:()=>rx,INVALID:()=>Pn,NEVER:()=>SS,TimePrecision:()=>hx,ZodAny:()=>r$,ZodArray:()=>a$,ZodBase64:()=>pE,ZodBase64URL:()=>fE,ZodBigInt:()=>vl,ZodBigIntFormat:()=>hE,ZodBoolean:()=>bl,ZodCIDRv4:()=>lE,ZodCIDRv6:()=>dE,ZodCUID:()=>rE,ZodCUID2:()=>iE,ZodCatch:()=>R$,ZodCodec:()=>$f,ZodCompileAsyncError:()=>Ai,ZodCompileUnsupportedError:()=>He,ZodCreditCard:()=>YQ,ZodCustom:()=>Tf,ZodCustomStringFormat:()=>nc,ZodDate:()=>Sf,ZodDefault:()=>I$,ZodDiscriminatedUnion:()=>u$,ZodE164:()=>gE,ZodEmail:()=>Xy,ZodEmoji:()=>tE,ZodEnum:()=>ml,ZodError:()=>Yde,ZodExactOptional:()=>bE,ZodFile:()=>y$,ZodFirstPartyTypeKind:()=>j$,ZodFunction:()=>F$,ZodGUID:()=>eE,ZodIBAN:()=>WQ,ZodIPv4:()=>cE,ZodIPv6:()=>uE,ZodISODate:()=>Co,ZodISODateTime:()=>wo,ZodISODuration:()=>ko,ZodISOTime:()=>So,ZodInstanceOf:()=>L$,ZodIntersection:()=>l$,ZodIssueCode:()=>Kde,ZodJWT:()=>AE,ZodKSUID:()=>aE,ZodLazy:()=>N$,ZodLiteral:()=>m$,ZodMAC:()=>JQ,ZodMap:()=>A$,ZodNaN:()=>Q$,ZodNanoID:()=>nE,ZodNever:()=>s$,ZodNonOptional:()=>vE,ZodNull:()=>t$,ZodNullable:()=>v$,ZodNumber:()=>El,ZodNumberFormat:()=>rc,ZodObject:()=>Bf,ZodOptional:()=>xf,ZodPipe:()=>Qf,ZodPrefault:()=>C$,ZodPreprocess:()=>$$,ZodPromise:()=>U$,ZodReadonly:()=>T$,ZodRealError:()=>ir,ZodRecord:()=>hl,ZodSet:()=>h$,ZodString:()=>yl,ZodStringFormat:()=>pt,ZodSuccess:()=>B$,ZodSymbol:()=>XQ,ZodTemplateLiteral:()=>_$,ZodTransform:()=>E$,ZodTuple:()=>p$,ZodType:()=>Oe,ZodULID:()=>sE,ZodURL:()=>Cf,ZodUUID:()=>Hi,ZodUndefined:()=>e$,ZodUnion:()=>Rf,ZodUnknown:()=>i$,ZodVoid:()=>o$,ZodXID:()=>oE,ZodXor:()=>c$,_ZodString:()=>Ky,_default:()=>w$,_function:()=>Xz,any:()=>Qz,array:()=>kf,base64:()=>lz,base64url:()=>dz,bigint:()=>Sz,boolean:()=>KQ,catch:()=>x$,check:()=>eq,cidrv4:()=>cz,cidrv6:()=>uz,clone:()=>st,codec:()=>Yz,coerce:()=>V$,compile:()=>cx,config:()=>Pt,core:()=>Cs,creditCard:()=>fz,cuid:()=>ez,cuid2:()=>tz,currencyCode:()=>Ez,custom:()=>tq,date:()=>Tz,decode:()=>LQ,decodeAsync:()=>GQ,deepPartial:()=>gq,describe:()=>nq,discriminatedUnion:()=>Fz,e164:()=>pz,email:()=>VV,emoji:()=>KV,encode:()=>MQ,encodeAsync:()=>jQ,endsWith:()=>sl,enum:()=>yE,exactOptional:()=>b$,file:()=>zz,flattenError:()=>Gp,float32:()=>vz,float64:()=>Iz,formatError:()=>Vp,fromJSONSchema:()=>pq,function:()=>Xz,getDiscriminatedOption:()=>SB,getErrorMap:()=>epe,globalRegistry:()=>pn,gt:()=>zi,gte:()=>Sr,guid:()=>zV,hash:()=>bz,hex:()=>yz,hostname:()=>mz,httpUrl:()=>ZV,iban:()=>gz,includes:()=>rl,input:()=>hq,instanceof:()=>iq,int:()=>Wy,int32:()=>wz,int64:()=>kz,intersection:()=>d$,invertCodec:()=>Wz,ipv4:()=>sz,ipv6:()=>az,iso:()=>Df,json:()=>oq,jwt:()=>Az,keyof:()=>Dz,ksuid:()=>iz,lazy:()=>P$,length:()=>Za,literal:()=>Vz,locales:()=>gf,looseObject:()=>Pz,looseRecord:()=>Mz,lowercase:()=>tl,lt:()=>Vi,lte:()=>Cr,mac:()=>oz,map:()=>Lz,maxLength:()=>Wa,maxSize:()=>Eo,memoizer:()=>uf,meta:()=>rq,mime:()=>al,minLength:()=>ws,minSize:()=>qi,multipleOf:()=>yo,nan:()=>Jz,nanoid:()=>XV,nativeEnum:()=>Gz,negative:()=>Oy,never:()=>mE,nonnegative:()=>Ly,nonoptional:()=>k$,nonpositive:()=>My,normalize:()=>cl,null:()=>n$,nullable:()=>wf,nullish:()=>qz,number:()=>ZQ,object:()=>_z,optional:()=>ec,output:()=>mq,overwrite:()=>hi,parse:()=>PQ,parseAsync:()=>UQ,partialRecord:()=>Oz,pipe:()=>Zy,positive:()=>Fy,prefault:()=>S$,preprocess:()=>aq,prettifyError:()=>$S,promise:()=>Kz,properties:()=>ol,property:()=>jy,readonly:()=>D$,record:()=>g$,refine:()=>O$,regex:()=>el,regexes:()=>zr,registry:()=>fy,safeDecode:()=>zQ,safeDecodeAsync:()=>HQ,safeEncode:()=>VQ,safeEncodeAsync:()=>qQ,safeParse:()=>FQ,safeParseAsync:()=>OQ,set:()=>jz,setErrorMap:()=>Xde,size:()=>Ya,slugify:()=>pl,startsWith:()=>il,strictObject:()=>Nz,string:()=>If,stringFormat:()=>hz,stringbool:()=>sq,success:()=>Hz,superRefine:()=>M$,symbol:()=>Rz,templateLiteral:()=>Zz,toJSONSchema:()=>qy,toLowerCase:()=>ll,toUpperCase:()=>dl,toZod:()=>Dp,transform:()=>EE,treeifyError:()=>QS,trim:()=>ul,tuple:()=>f$,uint32:()=>Cz,uint64:()=>Bz,ulid:()=>nz,undefined:()=>xz,union:()=>Il,unknown:()=>Xa,uppercase:()=>nl,url:()=>WV,util:()=>N,uuid:()=>qV,uuidv4:()=>HV,uuidv6:()=>JV,uuidv7:()=>YV,validate:()=>zp,validateAsync:()=>qp,void:()=>$z,withParser:()=>gy,xid:()=>rz,xor:()=>Uz});var Cs={};ei(Cs,{$ZodAny:()=>hB,$ZodArray:()=>IB,$ZodAsyncError:()=>nr,$ZodBase64:()=>iB,$ZodBase64URL:()=>sB,$ZodBigInt:()=>ny,$ZodBigIntFormat:()=>pB,$ZodBoolean:()=>nf,$ZodCIDRv4:()=>nB,$ZodCIDRv6:()=>rB,$ZodCUID:()=>Vk,$ZodCUID2:()=>zk,$ZodCatch:()=>LB,$ZodCheck:()=>yt,$ZodCheckBigIntFormat:()=>mk,$ZodCheckEndsWith:()=>xk,$ZodCheckGreaterThan:()=>Mm,$ZodCheckIncludes:()=>Bk,$ZodCheckLengthEquals:()=>wk,$ZodCheckLessThan:()=>Om,$ZodCheckLowerCase:()=>Sk,$ZodCheckMaxLength:()=>vk,$ZodCheckMaxSize:()=>yk,$ZodCheckMimeType:()=>Tk,$ZodCheckMinLength:()=>Ik,$ZodCheckMinSize:()=>Ek,$ZodCheckMultipleOf:()=>Ak,$ZodCheckNumberFormat:()=>hk,$ZodCheckOverwrite:()=>Dk,$ZodCheckProperties:()=>$k,$ZodCheckProperty:()=>Qk,$ZodCheckRegex:()=>Ck,$ZodCheckSizeEquals:()=>bk,$ZodCheckStartsWith:()=>Rk,$ZodCheckStringFormat:()=>Yu,$ZodCheckUpperCase:()=>kk,$ZodCodec:()=>sf,$ZodCreditCard:()=>aB,$ZodCustom:()=>JB,$ZodCustomStringFormat:()=>lB,$ZodCyclicError:()=>uy,$ZodDate:()=>bB,$ZodDefault:()=>UB,$ZodDiscriminatedUnion:()=>kB,$ZodE164:()=>oB,$ZodEmail:()=>Fk,$ZodEmoji:()=>jk,$ZodEncodeError:()=>ho,$ZodEnum:()=>$B,$ZodError:()=>xS,$ZodExactOptional:()=>NB,$ZodFile:()=>DB,$ZodFunction:()=>qB,$ZodGUID:()=>Pk,$ZodIBAN:()=>cB,$ZodIPv4:()=>Xk,$ZodIPv6:()=>eB,$ZodISODate:()=>Wk,$ZodISODateTime:()=>Yk,$ZodISODuration:()=>Kk,$ZodISOTime:()=>Zk,$ZodIntersection:()=>BB,$ZodJWT:()=>uB,$ZodKSUID:()=>Jk,$ZodLazy:()=>of,$ZodLiteral:()=>TB,$ZodMAC:()=>tB,$ZodMap:()=>xB,$ZodNaN:()=>jB,$ZodNanoID:()=>Gk,$ZodNever:()=>yB,$ZodNonOptional:()=>OB,$ZodNull:()=>AB,$ZodNullable:()=>PB,$ZodNumber:()=>ty,$ZodNumberFormat:()=>dB,$ZodObject:()=>oV,$ZodObjectJIT:()=>wB,$ZodOptional:()=>iy,$ZodPipe:()=>sy,$ZodPrefault:()=>FB,$ZodPreprocess:()=>GB,$ZodPromise:()=>HB,$ZodReadonly:()=>VB,$ZodRealError:()=>rr,$ZodRecord:()=>RB,$ZodRegistry:()=>py,$ZodSet:()=>QB,$ZodString:()=>za,$ZodStringFormat:()=>ot,$ZodSuccess:()=>MB,$ZodSymbol:()=>fB,$ZodTemplateLiteral:()=>zB,$ZodTransform:()=>_B,$ZodTuple:()=>ry,$ZodType:()=>De,$ZodULID:()=>qk,$ZodURL:()=>Lk,$ZodUUID:()=>Uk,$ZodUndefined:()=>gB,$ZodUnion:()=>rf,$ZodUnknown:()=>mB,$ZodVoid:()=>EB,$ZodXID:()=>Hk,$ZodXor:()=>CB,$brand:()=>kS,$constructor:()=>S,$input:()=>ix,$output:()=>rx,Doc:()=>Va,INVALID:()=>Pn,JSONSchema:()=>LV,JSONSchemaGenerator:()=>Hy,NEVER:()=>SS,TimePrecision:()=>hx,URL_BAD_FORMAT:()=>Ok,URL_UNPARSEABLE:()=>Zp,ZodCompileAsyncError:()=>Ai,ZodCompileUnsupportedError:()=>He,_any:()=>Dx,_array:()=>Mx,_base64:()=>_y,_base64url:()=>Ny,_bigint:()=>kx,_boolean:()=>Cx,_catch:()=>Ude,_check:()=>SV,_cidrv4:()=>Ty,_cidrv6:()=>Dy,_coercedBigint:()=>Bx,_coercedBoolean:()=>Sx,_coercedDate:()=>Fx,_coercedNumber:()=>yx,_coercedString:()=>px,_creditCard:()=>gx,_cuid:()=>Sy,_cuid2:()=>ky,_custom:()=>jx,_date:()=>Ux,_decode:()=>Rm,_decodeAsync:()=>Qm,_default:()=>_de,_discriminatedUnion:()=>Ide,_e164:()=>Py,_email:()=>my,_emoji:()=>wy,_encode:()=>Bm,_encodeAsync:()=>xm,_endsWith:()=>sl,_enum:()=>Rde,_file:()=>Lx,_float32:()=>bx,_float64:()=>vx,_gt:()=>zi,_gte:()=>Sr,_guid:()=>yy,_iban:()=>Ax,_includes:()=>rl,_int:()=>Ex,_int32:()=>Ix,_int64:()=>Rx,_intersection:()=>wde,_ipv4:()=>Qy,_ipv6:()=>$y,_isoDate:()=>mf,_isoDateTime:()=>hf,_isoDuration:()=>Ef,_isoTime:()=>yf,_jwt:()=>Uy,_ksuid:()=>xy,_lazy:()=>Lde,_length:()=>Za,_literal:()=>Qde,_lowercase:()=>tl,_lt:()=>Vi,_lte:()=>Cr,_mac:()=>fx,_map:()=>kde,_max:()=>Cr,_maxLength:()=>Wa,_maxSize:()=>Eo,_mime:()=>al,_min:()=>Sr,_minLength:()=>ws,_minSize:()=>qi,_multipleOf:()=>yo,_nan:()=>Ox,_nanoid:()=>Cy,_nativeEnum:()=>xde,_negative:()=>Oy,_never:()=>Nx,_nonnegative:()=>Ly,_nonoptional:()=>Nde,_nonpositive:()=>My,_normalize:()=>cl,_null:()=>Tx,_nullable:()=>Dde,_number:()=>mx,_optional:()=>Tde,_overwrite:()=>hi,_parse:()=>zu,_parseAsync:()=>qu,_pipe:()=>Fde,_positive:()=>Fy,_promise:()=>jde,_properties:()=>ol,_property:()=>jy,_readonly:()=>Ode,_record:()=>Sde,_refine:()=>Gx,_regex:()=>el,_safeDecode:()=>Tm,_safeDecodeAsync:()=>_m,_safeEncode:()=>$m,_safeEncodeAsync:()=>Dm,_safeParse:()=>Hu,_safeParseAsync:()=>Ju,_set:()=>Bde,_size:()=>Ya,_slugify:()=>pl,_startsWith:()=>il,_string:()=>dx,_stringFormat:()=>Ka,_stringbool:()=>Hx,_success:()=>Pde,_superRefine:()=>Vx,_symbol:()=>Qx,_templateLiteral:()=>Mde,_toLowerCase:()=>ll,_toUpperCase:()=>dl,_transform:()=>$de,_trim:()=>ul,_tuple:()=>Cde,_uint32:()=>wx,_uint64:()=>xx,_ulid:()=>By,_undefined:()=>$x,_union:()=>bde,_unknown:()=>_x,_uppercase:()=>nl,_url:()=>Af,_uuid:()=>Ey,_uuidv4:()=>by,_uuidv6:()=>vy,_uuidv7:()=>Iy,_void:()=>Px,_xid:()=>Ry,_xor:()=>vde,base64Charset:()=>Wm,base64urlCharset:()=>tf,canParseURL:()=>Mk,clone:()=>st,compile:()=>cx,compileFn:()=>Ay,config:()=>Pt,createStandardJSONSchemaMethod:()=>fl,createToJSONSchemaMethod:()=>Yx,decode:()=>vce,decodeAsync:()=>wce,describe:()=>zx,encode:()=>bce,encodeAsync:()=>Ice,extractDefs:()=>vo,finalize:()=>Io,flattenError:()=>Gp,formatError:()=>Vp,getDiscriminatedOption:()=>SB,globalConfig:()=>rn,globalRegistry:()=>pn,handleUnrepresentable:()=>Yt,initializeContext:()=>bo,isBackEdge:()=>dy,isRecursiveSchema:()=>ly,isValidBase64:()=>ef,isValidBase64URL:()=>Zm,isValidCIDRv6:()=>Ym,isValidCreditCard:()=>Km,isValidIBAN:()=>Xm,isValidIPv6:()=>Xp,isValidJWT:()=>ey,locales:()=>gf,memoizer:()=>uf,mergeValues:()=>Wu,meta:()=>qx,parse:()=>Sm,parseAsync:()=>km,parseURLObject:()=>rV,prettifyError:()=>$S,process:()=>at,processSchema:()=>at,regexes:()=>zr,registry:()=>fy,safeDecode:()=>Sce,safeDecodeAsync:()=>Bce,safeEncode:()=>Cce,safeEncodeAsync:()=>kce,safeParse:()=>Ace,safeParseAsync:()=>hce,standardProps:()=>zm,stripTabAndNewline:()=>Kp,toDotPath:()=>PG,toJSONSchema:()=>qy,toZod:()=>Dp,treeifyError:()=>QS,urlHostnameOk:()=>Hm,urlProtocolOk:()=>Jm,util:()=>N,validate:()=>zp,validateAsync:()=>qp,validateURL:()=>qm,version:()=>_k,withParser:()=>gy});var N={};ei(N,{BIGINT_FORMAT_RANGES:()=>Fp,CONSTANT_CATCH:()=>wm,Class:()=>AS,NUMBER_FORMAT_RANGES:()=>Up,aborted:()=>Nn,allowsEval:()=>yS,assert:()=>Nae,assertEqual:()=>$ae,assertIs:()=>Dae,assertNever:()=>_ae,assertNotEqual:()=>Tae,assignProp:()=>dn,attachSchema:()=>Op,base64ToUint8Array:()=>QG,base64urlToUint8Array:()=>ece,cached:()=>Lu,captureStackTrace:()=>vm,cleanEnum:()=>Xae,cleanRegex:()=>vs,clone:()=>st,cloneDef:()=>Fae,codePointLength:()=>ja,constantCatch:()=>wS,createTransparentProxy:()=>Vae,defineLazy:()=>hS,defineLazyInternal:()=>Ge,derived:()=>ice,esc:()=>_n,escapeRegex:()=>Vr,explicitlyAborted:()=>vS,extend:()=>Hae,finalizeIssue:()=>tr,floatSafeRemainder:()=>_p,getElementAtPath:()=>Oae,getEnumValues:()=>Ou,getLengthableOrigin:()=>Lp,getParsedType:()=>Gae,getSizableOrigin:()=>Mp,hexToUint8Array:()=>nce,hide:()=>jp,installLazyProp:()=>cce,isObject:()=>La,isPlainObject:()=>Gr,issue:()=>Vu,joinValues:()=>k,jsonStringifyReplacer:()=>Mu,members:()=>IS,merge:()=>Yae,mergeDefs:()=>gi,normalizeParams:()=>q,nullish:()=>bm,numKeys:()=>jae,objectClone:()=>Pae,omit:()=>qae,optionalKeys:()=>bS,own:()=>Ao,parsedType:()=>U,partial:()=>Wae,pick:()=>zae,prefixIssues:()=>er,primitiveTypes:()=>ES,promiseAllObject:()=>Mae,propertyKeyTypes:()=>Pp,randomString:()=>Lae,rawShape:()=>ju,required:()=>Zae,safeExtend:()=>Jae,shallowClone:()=>Np,sizeCaps:()=>Gu,slugify:()=>mS,stringifyPrimitive:()=>P,toZod:()=>Dp,uint8ArrayToBase64:()=>$G,uint8ArrayToBase64url:()=>tce,uint8ArrayToHex:()=>rce,unwrapMessage:()=>Fu});function $ae(e){return e}o($ae,"assertEqual");function Tae(e){return e}o(Tae,"assertNotEqual");function Dp(){return e=>e}o(Dp,"toZod");function Dae(e){}o(Dae,"assertIs");function _ae(e){throw new Error("Unexpected value in exhaustive check")}o(_ae,"assertNever");function Nae(e){}o(Nae,"assert");function Ou(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}o(Ou,"getEnumValues");function k(e,t="|"){return e.map(n=>P(n)).join(t)}o(k,"joinValues");function Mu(e,t){return typeof t=="bigint"?t.toString():t}o(Mu,"jsonStringifyReplacer");var gS=class{static{o(this,"Cached")}constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Lu(e){return new gS(e)}o(Lu,"cached");function bm(e){return e==null}o(bm,"nullish");function vs(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}o(vs,"cleanRegex");function _p(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}o(_p,"floatSafeRemainder");var kG=Symbol("evaluating");function hS(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==kG)return i===void 0&&(i=kG,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}o(hS,"defineLazy");function Pae(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}o(Pae,"objectClone");function dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}o(dn,"assignProp");function ju(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}o(ju,"rawShape");function bs(e){return ju(e._zod.def)??e._zod.def.shape}o(bs,"sourceShape");function BG(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return dn(this,t,i),i},enumerable:!0,configurable:!0})}o(BG,"deferProp");function RG(e,t,n){t in e?dn(e,t,n):e[t]=n}o(RG,"putProp");function Ma(e,t,n,i){let r=bs(t);for(let s of n){let a=Object.getOwnPropertyDescriptor(r,s);a.enumerable&&(a.get?BG(e,s,()=>{let c=t._zod.def.shape[s];return i?i(c,s):c}):RG(e,s,i?i(a.value,s):a.value))}}o(Ma,"mirrorShape");function Uae(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);i.enumerable&&(i.get?BG(e,n,()=>t[n]):RG(e,n,i.value))}}o(Uae,"mirrorProps");function gi(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}o(gi,"mergeDefs");function Fae(e){return gi(e._zod.def)}o(Fae,"cloneDef");function Oae(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}o(Oae,"getElementAtPath");function Mae(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let s=0;s<t.length;s++)r[t[s]]=i[s];return r})}o(Mae,"promiseAllObject");function Lae(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}o(Lae,"randomString");function _n(e){return JSON.stringify(e)}o(_n,"esc");function mS(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}o(mS,"slugify");var vm="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function La(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(La,"isObject");var yS=Lu(()=>{if(rn.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gr(e){if(La(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(La(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}o(Gr,"isPlainObject");function Np(e){return Gr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}o(Np,"shallowClone");function jae(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}o(jae,"numKeys");var Gae=o(e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},"getParsedType"),Pp=new Set(["string","number","symbol"]),ES=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Vr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(Vr,"escapeRegex");function st(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}o(st,"clone");function q(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(q,"normalizeParams");function Vae(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,s){return t??(t=e()),Reflect.set(t,i,r,s)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}o(Vae,"createTransparentProxy");function P(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}o(P,"stringifyPrimitive");function bS(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}o(bS,"optionalKeys");var Up={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Fp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zae(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return Ma(s,e,Im(e,t)),st(e,gi(n,{shape:s,checks:[]}))}o(zae,"pick");function Im(e,t){let n=bs(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw new Error(`Unrecognized key: "${String(r)}"`);t[r]&&i.push(r)}return i}o(Im,"maskedKeys");function qae(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Im(e,t)),a={};return Ma(a,e,Reflect.ownKeys(bs(e)).filter(c=>!s.has(c))),st(e,gi(n,{shape:a,checks:[]}))}o(qae,"omit");function Hae(e,t){if(!Gr(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=bs(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return st(e,gi(e._zod.def,{shape:xG(e,t)}))}o(Hae,"extend");function xG(e,t){let n={};return Ma(n,e,Reflect.ownKeys(bs(e))),Uae(n,t),n}o(xG,"extended");function Jae(e,t){if(!Gr(t))throw new Error("Invalid input to safeExtend: expected a plain object");return st(e,gi(e._zod.def,{shape:xG(e,t)}))}o(Jae,"safeExtend");function Yae(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Ma(n,e,Reflect.ownKeys(bs(e))),Ma(n,t,Reflect.ownKeys(bs(t)));let i=gi(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return st(e,i)}o(Yae,"merge");function Wae(e,t,n,i="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let c=n?new Set(Im(t,n)):void 0,u={};return Ma(u,t,Reflect.ownKeys(bs(t)),e&&((l,p)=>c&&!c.has(p)?l:new e({type:"optional",innerType:l}))),st(t,gi(t._zod.def,{shape:u,checks:[]}))}o(Wae,"partial");function Zae(e,t,n){let i=n?new Set(Im(t,n)):void 0,r={};return Ma(r,t,Reflect.ownKeys(bs(t)),(s,a)=>i&&!i.has(a)?s:new e({type:"nonoptional",innerType:s})),st(t,gi(t._zod.def,{shape:r}))}o(Zae,"required");function Nn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}o(Nn,"aborted");function vS(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}o(vS,"explicitlyAborted");function er(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}o(er,"prefixIssues");function Fu(e){return typeof e=="string"?e:e?.message}o(Fu,"unwrapMessage");function Gu(e){let t=[];for(let n of e??[]){let i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;let r=i.maximum??i.length??i.size;r>=0&&t.push([r,n])}return t}o(Gu,"sizeCaps");function Op(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}o(Op,"attachSchema");function tr(e,t,n){var i;let r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:Fu(e.inst?._zod.def?.error?.(e))??Fu(s?.(e))??Fu(t?.error?.(e))??Fu(n.customError?.(e))??Fu(n.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(c[u]=e[u]);return c.path??(c.path=[]),c.message=a,t?.reportInput&&(c.input=e.input),c}o(tr,"finalizeIssue");function Mp(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}o(Mp,"getSizableOrigin");var Kae=/[\uD800-\uDBFF]/;function ja(e){let t=e.length;if(!Kae.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}o(ja,"codePointLength");function Lp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(Lp,"getLengthableOrigin");function U(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}o(U,"parsedType");function Vu(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}o(Vu,"issue");function Xae(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}o(Xae,"cleanEnum");function QG(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}o(QG,"base64ToUint8Array");function $G(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}o($G,"uint8ArrayToBase64");function ece(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return QG(t+n)}o(ece,"base64urlToUint8Array");function tce(e){return $G(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}o(tce,"uint8ArrayToBase64url");function nce(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}o(nce,"hexToUint8Array");function rce(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}o(rce,"uint8ArrayToHex");var AS=class{static{o(this,"Class")}constructor(...t){}};function IS(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):sce(e,n,i.value)}}o(IS,"members");function Ao(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}o(Ao,"own");function jp(e,t,n){return Ao(e,t,n,!1)}o(jp,"hide");function ice(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ao(this,n,i(this))},set(r){Ao(this,n,r)}})}return t}o(ice,"derived");function sce(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ao(this,t,n.bind(this))},set(i){Ao(this,t,i)}})}o(sce,"defineBound");function oce(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}o(oce,"claim");var fS,go=!1,ace={configurable:!0,get(){go=!0}};function Ge(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&fS!==e._zod){fS=void 0;return}fS=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,ace);let r=go;go=!1;try{let s=n(this);return go?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),go=go||r,s}catch(s){throw delete this[t],go=go||r,s}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}o(Ge,"defineLazyInternal");function cce(e,t,n,i){let r=oce(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:s})}})}o(cce,"installLazyProp");var wm="~constantCatch";function wS(e){let t=o(()=>e,"fn");return t[wm]=!0,t}o(wS,"constantCatch");var TG,SS=Object.freeze({status:"aborted"}),CS={value:void 0,enumerable:!1},DG="captureStackTrace"in Error?Error:null;function uce(e){let t=DG;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return DG=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}o(uce,"newError");function S(e,t,n,i){let r={};function s(A){this.def=A,this.constr=f,this.traits=new Set}o(s,"Internals"),s.prototype=r;let a=n,c=a&&new WeakSet;function u(A,h){if(A._zod){if(A._zod.traits.has(e))return}else{CS.value=new s(h);try{Object.defineProperty(A,"_zod",CS)}finally{CS.value=void 0}}if(A._zod.traits.add(e),t(A,h),c){let E=Object.getPrototypeOf(A),b=A._zod.constr.prototype,v=E;for(;v&&v!==b;)v=Object.getPrototypeOf(v);let I=v??E;c.has(I)||(c.add(I),IS(I,a))}let m=f.prototype;for(let E in m)Object.prototype.hasOwnProperty.call(m,E)&&(E in A||(A[E]=m[E].bind(A)))}o(u,"init");let l=i?.Parent??Object;class p extends l{static{o(this,"Definition")}}Object.defineProperty(p,"name",{value:e});function f(A){let h=i?.Parent?uce(p):this;u(h,A);let m=h._zod.deferred;if(m){for(let b of m)b();h._zod.deferred=void 0}let E=globalThis.__zod_globalConfig?.postProcessor;return E&&E(h),h}return o(f,"_"),Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:o(A=>i?.Parent&&A instanceof i.Parent?!0:A?._zod?.traits?.has(e),"value")}),Object.defineProperty(f,"name",{value:e}),f}o(S,"$constructor");var kS=Symbol("zod_brand"),nr=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ho=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(TG=globalThis).__zod_globalConfig??(TG.__zod_globalConfig={});var rn=globalThis.__zod_globalConfig;function Pt(e){return e&&Object.assign(rn,e),rn}o(Pt,"config");function lce(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Mu,2)),e.message}o(lce,"_getMessage");function dce(e){this._zod.message=e}o(dce,"_setMessage");var pce={get:lce,set:dce,enumerable:!0,configurable:!0},RS={value:void 0,enumerable:!1},_G=new WeakSet([Object.prototype,Error.prototype]),NG=o((e,t)=>{e.name="$ZodError",RS.value=t,Object.defineProperty(e,"issues",RS),RS.value=void 0,Object.defineProperty(e,"message",pce);let n=Object.getPrototypeOf(e);_G.has(n)||(_G.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=o(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},"initializer"),xS=S("$ZodError",NG),rr=S("$ZodError",NG,void 0,{Parent:Error});function fce(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}o(fce,"node");function Gp(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?fce(n,r.path[0],()=>[]).push(t(r)):i.push(t(r));return{formErrors:i,fieldErrors:n}}o(Gp,"flattenError");function Vp(e,t=n=>n.message){let n={_errors:[]},i=o((r,s=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>i({issues:c},[...s,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...s,...a.path]);else{let c=[...s,...a.path];if(c.length===0)n._errors.push(t(a));else{let u=n,l=0;for(;l<c.length;){let p=c[l],f=l===c.length-1;if(p==="_errors"){f&&u._errors.push(t(a)),l++;continue}Object.prototype.hasOwnProperty.call(u,p)||Object.defineProperty(u,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let A=u[p];f&&A._errors.push(t(a)),u=A,l++}}}},"processError");return i(e),n}o(Vp,"formatError");function QS(e,t=n=>n.message){let n={errors:[]},i=o((r,s=[])=>{var a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>i({issues:u},[...s,...c.path]));else if(c.code==="invalid_key")i({issues:c.issues},[...s,...c.path]);else if(c.code==="invalid_element")i({issues:c.issues},[...s,...c.path]);else{let u=[...s,...c.path];if(u.length===0){n.errors.push(t(c));continue}let l=n,p=0;for(;p<u.length;){let f=u[p],A=p===u.length-1;typeof f=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,f)||Object.defineProperty(l.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[f]):(l.items??(l.items=[]),(a=l.items)[f]??(a[f]={errors:[]}),l=l.items[f]),A&&l.errors.push(t(c)),p++}}},"processError");return i(e),n}o(QS,"treeifyError");function PG(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}o(PG,"toDotPath");function $S(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${PG(i.path)}`);return t.join(`
143
143
  `)}o($S,"prettifyError");function Cm(e,t){return{callee:t?.callee??e,Err:t?.Err}}o(Cm,"finalizeParams");var zu=o(e=>{let t=o((n,i,r,s)=>{let a=r?{...r,async:!1}:{async:!1},c=n._zod.run({value:i,issues:[]},a);if(c instanceof Promise)throw new nr;if(c.issues.length){let u=new(s?.Err??e)(c.issues.map(l=>tr(l,a,Pt())));throw vm(u,s?.callee??t),u}return c.value},"fn");return t},"_parse"),Sm=zu(rr),qu=o(e=>{let t=o(async(n,i,r,s)=>{let a=r?{...r,async:!0}:{async:!0},c=n._zod.run({value:i,issues:[]},a);if(c instanceof Promise&&(c=await c),c.issues.length){let u=new(s?.Err??e)(c.issues.map(l=>tr(l,a,Pt())));throw vm(u,s?.callee??t),u}return c.value},"fn");return t},"_parseAsync"),km=qu(rr),Hu=o(e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new nr;return s.issues.length?UG(e,s.issues,r):{success:!0,data:s.value}},"_safeParse"),Ace=Hu(rr);function UG(e,t,n){let i;return{success:!1,get error(){return i||(i=new e(t.map(r=>tr(r,n,Pt()))),t=void 0,n=void 0),i},set error(r){i=r,t=void 0,n=void 0}}}o(UG,"failure");var Ju=o(e=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?UG(e,s.issues,r):{success:!0,data:s.value}},"_safeParseAsync"),hce=Ju(rr),mce=Symbol.for("zod.compile.invalid"),yce=Symbol.for("zod.compile.fallback"),zp=o(((e,t,n)=>{let i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==mce)return!0;if(i.definite===!0&&n===void 0)return!1}return Ece(e,t,n)}),"validate");function Ece(e,t,n){let i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,s;if(r?(i[yce]=!0,s=r({value:t,issues:[]},i)):s=e._zod.run({value:t,issues:[]},i),s instanceof Promise)throw new nr;return s.issues.length===0}o(Ece,"validateFallback");var qp=o(async(e,t,n)=>{let i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},r=e._zod.run({value:t,issues:[]},i);return r instanceof Promise&&(r=await r),r.issues.length===0},"validateAsync"),Bm=o(e=>{let t=zu(e),n=o((i,r,s,a)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return t(i,r,c,Cm(n,a))},"fn");return n},"_encode"),bce=Bm(rr),Rm=o(e=>{let t=zu(e),n=o((i,r,s,a)=>t(i,r,s,Cm(n,a)),"fn");return n},"_decode"),vce=Rm(rr),xm=o(e=>{let t=qu(e),n=o(async(i,r,s,a)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(i,r,c,Cm(n,a))},"fn");return n},"_encodeAsync"),Ice=xm(rr),Qm=o(e=>{let t=qu(e),n=o(async(i,r,s,a)=>await t(i,r,s,Cm(n,a)),"fn");return n},"_decodeAsync"),wce=Qm(rr),$m=o(e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Hu(e)(t,n,r)},"_safeEncode"),Cce=$m(rr),Tm=o(e=>(t,n,i)=>Hu(e)(t,n,i),"_safeDecode"),Sce=Tm(rr),Dm=o(e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ju(e)(t,n,r)},"_safeEncodeAsync"),kce=Dm(rr),_m=o(e=>async(t,n,i)=>Ju(e)(t,n,i),"_safeDecodeAsync"),Bce=_m(rr);var zr={};ei(zr,{anyString:()=>ik,base64:()=>YS,base64url:()=>WS,bigint:()=>ok,boolean:()=>ak,browserEmail:()=>Nce,cidrv4:()=>HS,cidrv6:()=>JS,creditCard:()=>Nm,cuid:()=>DS,cuid2:()=>_S,currencyCode:()=>ek,date:()=>tk,datetime:()=>rk,domain:()=>KS,duration:()=>MS,e164:()=>XS,email:()=>jS,emoji:()=>GS,extendedDuration:()=>Rce,guid:()=>LS,hex:()=>pk,hostname:()=>ZS,html5Email:()=>Tce,httpProtocol:()=>Hp,iban:()=>Pm,idnEmail:()=>_ce,integer:()=>Jp,ipv4:()=>VS,ipv6:()=>zS,ksuid:()=>US,lowercase:()=>lk,mac:()=>qS,md5_base64:()=>Oce,md5_base64url:()=>Mce,md5_hex:()=>Fce,nanoid:()=>FS,nanoidOfLength:()=>OS,null:()=>ck,number:()=>Is,rfc5322Email:()=>Dce,sha1_base64:()=>jce,sha1_base64url:()=>Gce,sha1_hex:()=>Lce,sha256_base64:()=>zce,sha256_base64url:()=>qce,sha256_hex:()=>Vce,sha384_base64:()=>Jce,sha384_base64url:()=>Yce,sha384_hex:()=>Hce,sha512_base64:()=>Zce,sha512_base64url:()=>Kce,sha512_hex:()=>Wce,string:()=>sk,time:()=>nk,ulid:()=>NS,undefined:()=>uk,unicodeEmail:()=>FG,uppercase:()=>dk,uuid:()=>Ga,uuid4:()=>xce,uuid6:()=>Qce,uuid7:()=>$ce,xid:()=>PS});var DS=/^[cC][0-9a-z]{6,}$/,_S=/^[0-9a-z]+$/,NS=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,PS=/^[0-9a-vA-V]{20}$/,US=/^[A-Za-z0-9]{27}$/,FS=/^[a-zA-Z0-9_-]{21}$/;function OS(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}o(OS,"nanoidOfLength");var MS=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rce=/^[-+]?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)?)??$/,LS=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ga=o(e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,"uuid"),xce=Ga(4),Qce=Ga(6),$ce=Ga(7),jS=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Tce=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Dce=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,FG=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,_ce=FG,Nce=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Pce="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function GS(){return new RegExp(Pce,"u")}o(GS,"emoji");var VS=/^(?:(?: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])$/,zS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,qS=o(e=>{let t=Vr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},"mac"),HS=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,JS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,YS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,WS=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ZS=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,KS=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Hp=/^https?$/,XS=/^\+[1-9]\d{6,14}$/,Nm=/^\d(?:[ -]?\d){11,18}$/,ek=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Pm=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,OG="(?:(?:\\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])))";function Uce(e){return new RegExp(`^${e}$`)}o(Uce,"anchor");var tk=Uce(OG);function TS(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}o(TS,"timeSource");function nk(e){return new RegExp(`^${TS(e)}$`)}o(nk,"time");function rk(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${TS({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${n}|${TS({precision:e.precision})}`:n;return new RegExp(`^${OG}T(?:${i})$`)}o(rk,"datetime");var ik=/^[\s\S]{0,}$/,sk=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),ok=/^-?\d+n?$/,Jp=/^-?\d+$/,Is=/^-?\d+(?:\.\d+)?$/,ak=/^(?:true|false)$/i,ck=/^null$/i;var uk=/^undefined$/i;var lk=/^[^A-Z]*$/,dk=/^[^a-z]*$/,pk=/^[0-9a-fA-F]*$/;function Yp(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}o(Yp,"fixedBase64");function Wp(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}o(Wp,"fixedBase64url");var Fce=/^[0-9a-fA-F]{32}$/,Oce=Yp(22,"=="),Mce=Wp(22),Lce=/^[0-9a-fA-F]{40}$/,jce=Yp(27,"="),Gce=Wp(27),Vce=/^[0-9a-fA-F]{64}$/,zce=Yp(43,"="),qce=Wp(43),Hce=/^[0-9a-fA-F]{96}$/,Jce=Yp(64,""),Yce=Wp(64),Wce=/^[0-9a-fA-F]{128}$/,Zce=Yp(86,"=="),Kce=Wp(86);var yt=S("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),fk=o(e=>{let t=e.value;return!bm(t)&&t.size!==void 0},"_whenHasSize"),gk=o(e=>{let t=e.value;return!bm(t)&&t.length!==void 0},"_whenHasLength"),Um={number:"number",bigint:"bigint",object:"date"},Om=S("$ZodCheckLessThan",(e,t)=>{yt.init(e,t);let n=Um[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:Um[typeof i.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Mm=S("$ZodCheckGreaterThan",(e,t)=>{yt.init(e,t);let n=Um[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:Um[typeof i.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ak=S("$ZodCheckMultipleOf",(e,t)=>{yt.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):_p(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),hk=S("$ZodCheckNumberFormat",(e,t)=>{yt.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,s]=Up[t.format];e._zod.check=a=>{let c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}c<r&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),mk=S("$ZodCheckBigIntFormat",(e,t)=>{yt.init(e,t);let[n,i]=Fp[t.format];e._zod.check=r=>{let s=r.value;s<n&&r.issues.push({origin:"bigint",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>i&&r.issues.push({origin:"bigint",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),yk=S("$ZodCheckMaxSize",(e,t)=>{var n;yt.init(e,t),(n=e._zod.def).when??(n.when=fk),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:Mp(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ek=S("$ZodCheckMinSize",(e,t)=>{var n;yt.init(e,t),(n=e._zod.def).when??(n.when=fk),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:Mp(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bk=S("$ZodCheckSizeEquals",(e,t)=>{var n;yt.init(e,t),(n=e._zod.def).when??(n.when=fk),e._zod.check=i=>{let r=i.value,s=r.size;if(s===t.size)return;let a=s>t.size;i.issues.push({origin:Mp(r),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),vk=S("$ZodCheckMaxLength",(e,t)=>{var n;yt.init(e,t),(n=e._zod.def).when??(n.when=gk),e._zod.check=i=>{let r=i.value,s=r.length;if((typeof r=="string"&&s>t.maximum?ja(r):s)<=t.maximum)return;let c=Lp(r);i.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ik=S("$ZodCheckMinLength",(e,t)=>{var n;yt.init(e,t),(n=e._zod.def).when??(n.when=gk),e._zod.check=i=>{let r=i.value,s=r.length;if((typeof r=="string"&&s>=t.minimum&&s<t.minimum*2?ja(r):s)>=t.minimum)return;let c=Lp(r);i.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wk=S("$ZodCheckLengthEquals",(e,t)=>{var n;yt.init(e,t),(n=e._zod.def).when??(n.when=gk),e._zod.check=i=>{let r=i.value,s=r.length,a=typeof r=="string"&&s>=t.length&&s<=t.length*2?ja(r):s;if(a===t.length)return;let c=Lp(r),u=a>t.length;i.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Yu=S("$ZodCheckStringFormat",(e,t)=>{var n,i;yt.init(e,t),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),Ck=S("$ZodCheckRegex",(e,t)=>{Yu.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Sk=S("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lk),Yu.init(e,t)}),kk=S("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dk),Yu.init(e,t)}),Bk=S("$ZodCheckIncludes",(e,t)=>{yt.init(e,t);let n=Vr(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=i,e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Rk=S("$ZodCheckStartsWith",(e,t)=>{yt.init(e,t);let n=new RegExp(`^${Vr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),xk=S("$ZodCheckEndsWith",(e,t)=>{yt.init(e,t);let n=new RegExp(`.*${Vr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function Fm(e,t,n){e.issues.length&&t.issues.push(...er(n,e.issues))}o(Fm,"handleCheckPropertyResult");var Qk=S("$ZodCheckProperty",(e,t)=>{yt.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>Fm(r,n,t.property));Fm(i,n,t.property)}}),$k=S("$ZodCheckProperties",(e,t)=>{yt.init(e,t),jp(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=i=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(a=>[a,t.shape[a]]));let r=i.value,s;for(let[a,c]of n){let u=c._zod.run({value:r[a],issues:[]},{});u instanceof Promise?(s??(s=[]),s.push(u.then(l=>Fm(l,i,a)))):Fm(u,i,a)}if(s)return Promise.all(s).then(()=>{})}}),Tk=S("$ZodCheckMimeType",(e,t)=>{yt.init(e,t);let n=new Set(t.mime);e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),Dk=S("$ZodCheckOverwrite",(e,t)=>{yt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var Va=class{static{o(this,"Doc")}constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
144
144
  `).filter(a=>a),r=Math.min(...i.map(a=>a.length-a.trimStart().length)),s=i.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(let a of s)this.content.push(a)}compile(){let t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
145
145
  ${n.join(`
@@ -265,7 +265,7 @@ else require("node:test").test(spec.name, () => { throw new Error("required shar
265
265
  `),s}o(mEe,"conformed");function _l(e,t,n){if(n.length>dEe||n.includes(0))return n;let i=xr.resolve(e),r=hEe(i,xr.resolve(i,t),s=>{try{return AEe(ab.readFileSync(xr.join(s,".editorconfig"),"utf-8"))}catch{return}});return Buffer.from(mEe(n.toString("latin1"),r),"latin1")}o(_l,"conformDeliveredBytes");var VY=ee(require("fs")),zY=ee(require("path"));function Uo(e=__dirname){try{let t=VY.readFileSync(zY.join(e,"VERSION.json"),"utf-8"),n=JSON.parse(t);if(typeof n.version=="string"&&typeof n.commit=="string")return{version:n.version,commit:n.commit}}catch{}return{version:"unknown",commit:"unknown"}}o(Uo,"getTestbotVersion");var lc=ee(require("node:fs")),dc=ee(require("node:path"));function V0(e,t){let n=dc.relative(e,t);try{let i=lc.lstatSync(t);if(i.isSymbolicLink())return"test entry is a symlink";if(!i.isFile())return"test entry is not a regular file";let r=lc.realpathSync(e),s=lc.realpathSync(t),a=dc.relative(r,s);return!a||a.startsWith("..")||dc.isAbsolute(a)?`test entry's real path is outside the checkout (${a})`:a!==n?`test entry's real path is ${a}, not ${n}, after canonicalisation`:void 0}catch(i){return i.code==="ENOENT"?`test entry is missing: no file is at ${n} in the checkout`:`test entry cannot be read: ${Pl(i,e)}`}}o(V0,"guardedEntryProblem");function Nl(e,t){let n=V0(e,t);if(n)return n;try{return lc.readFileSync(t)}catch(i){return`test entry cannot be read: ${Pl(i,e)}`}}o(Nl,"readGuardedEntry");function Pl(e,t){return(e instanceof Error?e.message:String(e)).split(t+dc.sep).join("")}o(Pl,"errorWithoutCheckout");function yEe(e){return ve(e,`${Z$}.json`)?.guardUnavailable===!0}o(yEe,"writeGuardUnavailable");function qY(e){let t=ve(e,"recommend.json"),n=ve(e,`${Z$}.json`),i=new Map(yEe(e)?(t?.generate??[]).map(({id:r})=>[r,wE]):[]);for(let{id:r,reason:s}of t?.withheld??[])i.has(r)||i.set(r,`off-limits execution (${s??"environment policy"})`);if(n?.browserWithheld)for(let r of t?.generate??[])r.type==="ui"&&!i.has(r.id)&&i.set(r.id,"the shared-environment browser guard is unavailable");return i}o(qY,"writeExecutionRestrictions");function HY(e,t){let n=new Set((e.covers??[]).flatMap(i=>{let r=t.get(i);return r?[r]:[]}));return n.size?`environment restriction: ${[...n].join("; ")}`:void 0}o(HY,"writtenRestriction");function bEe(e){return!!e.guardedDelivery||!!e.context?.some(t=>t.safety?.route==="persistence")}o(bEe,"keepsSharedData");function Ul(e,t){let n=e.inputs.sharedEnvironment?.environmentAddress;return!!n&&(t.result?.cases??[]).some(i=>i.runtimeTargets?.some(r=>uo(n,r)))}o(Ul,"usesSharedRuntime");function hg(e,t,n=Uo().version){if(!On(e.inputs))return[];let i=e.inputs.sharedEnvironment,r=i?.environmentAddress,s=ve(e,GC),a=f1.safeParse(s),c=a.success&&a.data.environmentId===i?.environmentId&&a.data.environmentAddress===r?a.data:void 0,u=g1.safeParse(s),l=u.success?wp(u.data.refusal):a.success?wp("changed"):wp("unavailable"),p=qY(e),f=new Map(sb(e,t).map(v=>[v.file,v.verdict])),A=Q0(R0(e)),h=ve(e,"recommend.json"),m=new Map((h?.generate??[]).map(({id:v,target:I})=>[v,I])),E=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),b=new Map;for(let v of t.tests){if(v.change==="deleted")continue;let I=E(v.file);if(!Zr(I)||Qo(I.rel))continue;let C=Es(e.inputs,I.repository);if("error"in C)continue;let x=C.source,w=Ut.resolve(x.path,I.rel),$=HY(v,p)??vEe(A,I),B=bEe(v),Z=Ul(e,v),ie;if(!$&&!Z&&!B){if(!w.endsWith(".test.cjs"))continue;try{if(!z0(x.path,w))continue;ie=$s(Lt.readFileSync(w,"utf8"))}catch{continue}if(!ie||"restriction"in ie)continue}let H=(v.covers??[]).flatMap(Bt=>{let Xe=m.get(Bt)?.match(/^(GET|HEAD|OPTIONS|POST|PUT|PATCH|DELETE)\s+(\S+?)[,;]?(?:\s|$)/i);return!Xe||!r?[]:Xe[2].startsWith("/")||uo(r,Xe[2])?[{method:Xe[1].toUpperCase(),route:Xe[2]}]:[]}),me=REe(e,x.path,I.rel);if(!$&&v.change!=="added"&&(me===!1||me===void 0&&!e.inputs.deliver))continue;let _e=o(Bt=>`${v.file}: shared-environment delivery is blocked: ${Bt}`,"problem"),Ue={repository:x.slug,file:I.rel,sourceAsset:`${I.rel}.source`},Ie=Nl(x.path,w);if(typeof Ie=="string"){b.set(w,{record:Ue,source:x,original:Buffer.alloc(0),problems:[_e(`${Ie} (planGuardedDelivery)`)]});continue}if(v.change!=="added"&&Ei(e,x.path,I.rel)){$&&(Ue.reason=$,b.set(w,{record:Ue,source:x,original:Ie,problems:[]}));continue}if(me===!1||v.change!=="added"&&me!==!0){b.set(w,{record:Ue,source:x,original:Ie,problems:[_e(me===!1?"the file changes an existing test; retain the assertions in a new file":"cannot prove whether the shared test already exists; use a host-pinned checkout")]});continue}if(ie??=$s(Ie.toString("utf8")),!$&&ie&&"restriction"in ie)continue;let K,V=rb.safeParse(v.guardedDelivery),Me=c&&i?{environmentId:c.environmentId,environmentAddress:c.environmentAddress,persistenceRevision:c.revision,offLimits:i.offLimits??[],route:{kind:"persistence"}}:void 0,Ze=`environment restriction: persistence permission was not confirmed at generation: ${l}`;if($)K=$;else if(B&&!Me)K=Ze;else if(!V.success||!Me)K="no guarded HTTP representation preserves the test's assertions";else if(!v.covers?.length||(v.functions?.length??1)!==1)K="guarded HTTP delivery requires one test function";else if(!/\.test\.cjs$/.test(I.rel)||!SEe(v.ci))K="the test has no compatible Node CI entry";else if(!v.ci?.collected&&f.get(v.file)!=="not-collected")K="Testbot could not confirm that the repo's CI leaves it out, and only node --test can run the entry";else if(!kEe(x.path,w,n))K=`the CI package does not declare @skyramp/testbot-core ${n}, the released guarded runtime the entry needs`;else{let{steps:Bt}=V.data,Xe=Me.offLimits.length?Y$(e.inputs.skyrampMcp,Me.offLimits):void 0,yn=new Map,gt=Bt.flatMap(ut=>{if(ut.op==="create"){let ne=IEe(Me.environmentAddress,ut.collection);return ne&&yn.set(ut.as,ne),[{method:"POST",url:ne,child:!1}]}if(ut.op!=="read"&&ut.op!=="update")return[];let $e=yn.get(ut.resource);return $e&&yn.set(ut.as,$e),[{method:ut.op==="read"?"GET":ut.method??"PATCH",url:$e,child:!0}]});gt.some(({url:ut})=>!ut)?K="the guarded HTTP steps name an unknown resource or a collection outside the Test Environment":Xe&&i&&gt.some(({url:ut,child:$e})=>!$e&&Qq(ut.href,i,Xe))?K="the guarded HTTP steps name an off-limits collection":H.length&&!H.some(({method:ut,route:$e})=>gt.some(ne=>ne.url&&ne.method===ut&&wEe(Me.environmentAddress,ne.url,ne.child,$e)))&&(K="the guarded HTTP steps do not represent the planned HTTP operation")}let jt;if(K)Ue.reason=K;else if(V.success&&Me){let{bearerTokenEnv:Bt,...Xe}=V.data;jt={...Xe,definition:{...Me,...Bt?{bearerTokenEnv:Bt}:{}}},Ue.entry=I.rel}let ct=Ut.resolve(x.path,Ue.sourceAsset),on=lb(ct)&&!Ag(x.path,ct,Ie)?[_e("the inert source asset path already contains different bytes")]:[];b.set(w,{record:Ue,source:x,original:Ie,spec:jt,problems:on})}return[...b.values()]}o(hg,"planGuardedDelivery");function vEe(e,t){return e.find(n=>x0(n,{file:t.rel,repository:t.repository}))?.environmentRestriction}o(vEe,"restrictionRecordedAtRun");function IEe(e,t){try{let n=new URL(t,`${e.replace(/\/$/,"")}/`);return!n.search&&!n.hash&&!n.username&&!n.password&&!/[\\]|%(?:2f|5c|2e|25)/i.test(t)&&uo(e,n.href)?n:void 0}catch{return}}o(IEe,"guardedCollection");function wEe(e,t,n,i){try{let r=new URL(i,t.origin),s=i.startsWith("/")&&!i.startsWith("//")&&!uo(e,r.href)?new URL(i.slice(1),`${e.replace(/\/$/,"")}/`):r;if(!uo(e,s.href))return!1;let a=t.pathname.replace(/\/$/,""),c=s.pathname.replace(/\/$/,"");if(!n)return c===a;if(!c.startsWith(`${a}/`))return!1;let u=decodeURIComponent(c.slice(a.length+1));return/^(:[\w-]+|\{[^/{}]+\}|<[^/<>]+>)$/.test(u)}catch{return!1}}o(wEe,"representsRoute");function CEe(e){return!!e&&/^(?:node|node:test|node\s+(?:.*\s)?--test(?:\s.*)?)$/i.test(e.trim())}o(CEe,"nodeTestRunner");function SEe(e){return e?.collected===!1||!!e?.collected&&CEe(e.runner)}o(SEe,"nodeTestEntry");function z0(e,t){let n=Lt.realpathSync(e);return Lt.lstatSync(t).isFile()&&Lt.realpathSync(t)===Ut.join(n,Ut.relative(e,t))}o(z0,"regularFileIn");function Ag(e,t,n){try{return z0(e,t)&&Lt.readFileSync(t).equals(n)}catch{return!1}}o(Ag,"sameRegularBytes");function lb(e){try{return Lt.lstatSync(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}o(lb,"pathExists");function kEe(e,t,n){if(n==="unknown")return!1;for(let i=Ut.dirname(t);;i=Ut.dirname(i)){let r=Ut.join(i,"package.json");if(lb(r))try{if(!z0(e,r))return!1;let s=JSON.parse(Lt.readFileSync(r,"utf-8"));return(s.devDependencies?.["@skyramp/testbot-core"]??s.dependencies?.["@skyramp/testbot-core"])===n}catch{return!1}if(i===e)return!1}}o(kEe,"hasGuardRuntime");function BEe(e){let t=ve(e,"write.json");return t?hg(e,t):[]}o(BEe,"guardedDeliveryPlan");function JY(e,t=BEe(e),n=[],i=[]){return t.flatMap(({record:r,source:s,original:a,spec:c,problems:u})=>{if(u.length)return u;let l=Ut.join(s.path,r.sourceAsset),p=Ut.join(s.path,r.file),f=`reading ${r.file}`;try{let A=Nl(s.path,p);if(typeof A=="string")return[`${r.file}: ${A} (writeGuardedDeliveryFiles)`];if(!A.equals(a))return[`${r.file}: native source changed before guarded delivery`];f=`preparing ${r.sourceAsset}`;let h=uc(a.toString("utf-8"),n).content;if(no(h,e.secretValues??[])!==h)return[`${r.file}: the retained source contains a credential`];let m=_l(s.path,r.sourceAsset,Buffer.from(h));if(f=`writing ${r.sourceAsset}`,lb(l)){if(!Ag(s.path,l,a)&&!Ag(s.path,l,m))return[`${r.file}: the inert source asset path already contains different bytes`];Ag(s.path,l,m)||(i.push(()=>Lt.writeFileSync(l,a)),Lt.writeFileSync(l,m))}else Lt.writeFileSync(l,m,{flag:"wx"}),i.push(()=>Lt.rmSync(l,{force:!0}));if(r.entry&&c){let E=cg({...c,name:Dl(c.name,n)}),b=_l(s.path,r.entry,Buffer.from(E));if(!$s(b.toString("utf-8")))return[`${r.file}: the repository's file conventions changed the guarded entry`];if(no(b.toString("utf-8"),e.secretValues??[])!==b.toString("utf-8"))return[`${r.file}: guarded delivery steps include a credential`];f=`writing ${r.entry}`,i.push(()=>Lt.writeFileSync(p,a)),Lt.writeFileSync(p,b)}return[]}catch(A){return[`${r.file}: could not assemble its guarded delivery files (writeGuardedDeliveryFiles): ${f} failed: ${Pl(A,s.path)}`]}})}o(JY,"writeGuardedDeliveryFiles");function REe(e,t,n){let i=e.executionSafetySources?.find(r=>Ut.resolve(r.path)===Ut.resolve(t));if(i)try{return(0,ub.execFileSync)("git",["--literal-pathspecs","ls-tree",i.head,"--",n],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})===""}catch{return}}o(REe,"newAtSourcePin");function Ei(e,t,n){let i=e.executionSafetySources?.find(r=>Ut.resolve(r.path)===Ut.resolve(t));if(!i||!/^[a-f0-9]{40,64}$/.test(i.head))return!1;try{let r=Ut.join(t,n),s=Lt.lstatSync(r);if(!s.isFile()||Lt.realpathSync(r)!==r)return!1;let a=db(t,i.head,n);return!a||(s.mode&73)!==0!==a.executable?!1:Lt.readFileSync(r).equals(a.bytes)}catch{return!1}}o(Ei,"unchangedSource");var cb=new Map;function db(e,t,n){let i=`${Ut.resolve(e)}\0${t}\0${n}`,r=cb.get(i);if(r!==void 0)return r;let s=null;try{let a=(0,ub.execFileSync)("git",["--literal-pathspecs","ls-tree",t,"--",n],{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]});/^100(?:644|755) blob /.test(a)&&(s={executable:a.startsWith("100755"),bytes:(0,ub.execFileSync)("git",["show",`${t}:${n}`],{cwd:e,stdio:["ignore","pipe","ignore"]})})}catch{s=null}return cb.size>=1e4&&cb.clear(),cb.set(i,s),s}o(db,"pinnedBlob");function YY(e,t,n,i){if(!i.size)return[...n];let r=new Map(n.map(a=>[Ut.resolve(a.source.path,a.record.file),a])),s=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]);for(let a of t.tests){if(a.change==="deleted")continue;let c=s(a.file);if(!Zr(c)||Qo(c.rel))continue;let u=Es(e.inputs,c.repository);if("error"in u)continue;let l=u.source,p=Ut.resolve(l.path,c.rel),f=i.get(p);if(!f)continue;let A=r.get(p);if(A){if(A.record.reason)continue;let I={...A.record,reason:f};delete I.entry,r.set(p,{...A,record:I,spec:void 0});continue}let h={repository:l.slug,file:c.rel,sourceAsset:`${c.rel}.source`,reason:f},m=o(I=>[`${a.file}: shared-environment delivery is blocked: ${I}`],"problem"),E=Nl(l.path,p);if(typeof E=="string"){r.set(p,{record:h,source:l,original:Buffer.alloc(0),problems:m(`${E} (holdDependents)`)});continue}let b=Ut.resolve(l.path,h.sourceAsset),v=lb(b)&&!Ag(l.path,b,E)?m("the inert source asset path already contains different bytes"):[];r.set(p,{record:h,source:l,original:E,problems:v})}return[...r.values()]}o(YY,"holdDependents");var Kr=ee(require("node:fs")),Se=ee(require("node:path"));var pc=ee(require("path"));var q2e={python:"pytest",typescript:"playwright",javascript:"playwright"},H2e={pytest:"pytest",playwright:"playwright"};var DEe=new Set(["package.json","package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","pyproject.toml","poetry.lock","uv.lock","pdm.lock","Pipfile","Pipfile.lock","setup.py","setup.cfg","go.mod","go.sum","Gemfile","Gemfile.lock","pom.xml","build.gradle","build.gradle.kts"]);function pb(e){let t=pc.basename(e);return DEe.has(t)||/^requirements[^/\\]*\.(txt|in)$/.test(t)}o(pb,"isDependencyFile");var KY="shared-environment delivery cannot verify it for guarded execution",XY=o((e,t)=>`${fi(e.inputs,t.source.slug)}${t.file}`,"omittedLabel");function fb(e,t,n){let i=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),r=new Set(n.map(s=>Se.resolve(s.source.path,s.record.file)));return t.tests.filter(s=>{let a=i(s.file);return!r.has(Se.resolve(a.root,a.rel))&&s.change!=="updated"&&Ul(e,s)})}o(fb,"unplannedSharedTests");function gb(e,t,n,i){let r=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),s=new Map(n.map(u=>[Se.resolve(u.source.path,u.record.file),u])),a=new Set,c=[];for(let u of t.tests){let l=r(u.file),p=Se.resolve(l.root,l.rel),f=s.get(p);if(f){a.add(Se.resolve(l.root,f.record.sourceAsset)),f.record.entry&&a.add(p);continue}if(u.change==="deleted"){HEe(e,l.root,l.rel)?a.add(p):c.push(`${u.file}: a deleted shared-environment test must actually be absent and be a tracked regular file in the host-pinned source`);continue}if(u.change==="updated"||!Ul(e,u)){a.add(p);continue}if(Ei(e,l.root,l.rel)){a.add(p);continue}try{let A=$s(Kr.readFileSync(p,"utf-8"));if(!A)continue;if(a.add(p),"restriction"in A){let h=Se.resolve(Se.dirname(p),A.sourceAsset.path);a.add(h),!i.has(h)&&!Ei(e,l.root,Se.relative(l.root,h))&&c.push(`${u.file}: its restricted source asset is missing from the actual delivery commit`)}}catch{}}return{allowed:a,problems:c}}o(gb,"verifiedDeliveryPaths");function Ab(e,t,n,i){let r=[];for(let[s,a]of t)for(let c of a)n.has(Se.resolve(s.path,c))||!i.length&&!e.inputs.deliver&&Uo().version==="unknown"||qEe(e,s.path,c)||Ei(e,s.path,c)||r.push({source:s,file:c});return r}o(Ab,"unverifiedDeliveryPaths");var eW=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".json"],tW=/(?:\bfrom\s*|\bimport(?:\s*\()?\s*|\brequire\s*\(\s*)["'`]([^"'`\n]+)["'`]/g,_Ee=/^[ \t]*from[ \t]+([.\w]+)[ \t]+import[ \t]+\(?([\w\t ,*]+)/gm,NEe=/^[ \t]*import[ \t]+([\w.]+)/gm;function PEe(e,t){if(!/^\.\.?(?:\/|$)/.test(t))return[];let n=Se.resolve(e,t),i=/\.[cm]?jsx?$/.test(n)?[n.replace(/\.([cm]?)js(x?)$/,".$1ts$2")]:[];return[n,...i,...eW.flatMap(r=>[n+r,Se.join(n,`index${r}`)])]}o(PEe,"jsCandidates");function WY(e,t,n,i){let r=/^\.*/.exec(n)[0].length,s=n.slice(r).split(".").filter(Boolean);return(r?[Se.resolve(t,...Array(r-1).fill(".."))]:[e,t]).flatMap(c=>{let u=Se.join(c,...s);return[`${u}.py`,Se.join(u,"__init__.py"),...i.map(l=>Se.join(u,`${l}.py`))]})}o(WY,"pyCandidates");function UEe(e,t,n){let i=Se.dirname(t),r=new Set;if(t.endsWith(".py")){for(let[,s,a]of n.matchAll(_Ee))for(let c of WY(e,i,s,a.split(/[\s,]+/).filter(u=>/^\w+$/.test(u))))r.add(c);for(let[,s]of n.matchAll(NEe))for(let a of WY(e,i,s,[]))r.add(a)}else for(let[,s]of n.matchAll(tW))for(let a of PEe(i,s))r.add(a);return r}o(UEe,"importedFiles");function FEe(e,t){let n=new Set;if(e.endsWith(".py")||e.endsWith(".go"))return n;for(let[,i]of t.matchAll(tW)){if(/^\.\.?(?:\/|$)/.test(i)||/^[a-z][\w+.-]*:/i.test(i))continue;let r=i.split("/").pop()??"";r&&n.add(r.replace(/\.[cm]?[jt]sx?$/,""))}return n}o(FEe,"aliasedStems");function OEe(e,t){let n=Se.extname(t);if(!eW.includes(n))return!1;let i=Se.basename(t,n);return e.has(i)||i==="index"&&e.has(Se.basename(Se.dirname(t)))}o(OEe,"aliasNeeds");function MEe(e,t){let n=Se.basename(t).replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?<![\\w.-])${n}(?![\\w.-])`).test(e)}o(MEe,"mentions");function ZY(e,t){for(let n=Se.dirname(t);;n=Se.dirname(n)){if(Kr.existsSync(Se.join(n,"go.mod")))return n;if(n===e||Se.dirname(n)===n)return e}}o(ZY,"goModule");function LEe(e,t){let n=[];t.isolatedRun&&n.push({cwd:".",text:t.isolatedRun}),t.run&&n.push({cwd:t.run.cwd,text:t.run.argv.join(" ")}),t.ci?.list&&n.push({cwd:t.ci.list.cwd,text:t.ci.list.argv.join(" ")});for(let r of t.ci?.steps??[])n.push({cwd:".",text:r.line});for(let r of t.context??[])r.cleanup&&n.push({cwd:".",text:r.cleanup});let i=new Set;for(let{cwd:r,text:s}of n)for(let a of s.split(/[\s"'`;&|()<>=,]+/))a&&!/^[a-z][\w+.-]*:/i.test(a)&&i.add(Se.resolve(e,r,a));return i}o(LEe,"commandFiles");var jEe={".py":"python",".js":"node",".cjs":"node",".mjs":"node",".jsx":"node",".ts":"node",".cts":"node",".mts":"node",".tsx":"node",".go":"go",".rb":"ruby",".java":"jvm",".kt":"jvm",".kts":"jvm",".scala":"jvm",".groovy":"jvm"},GEe=[[/^(?:playwright|vitest|jest)\.config\.(?:[cm]?[jt]s|json)$/,"node"],[/^tsconfig\.json$/,"node"],[/^(?:pytest|tox)\.ini$/,"python"]];function VEe(e){let t=Se.basename(e);if(["conftest.py","__init__.py"].includes(t))return"python";let n=GEe.find(([i])=>i.test(t));if(n)return n[1];if(pb(e))return/^(?:package\.json|package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb?)$/.test(t)?"node":/^go\.(?:mod|sum)$/.test(t)?"go":/^Gemfile(?:\.lock)?$/.test(t)?"ruby":/^(?:pom\.xml|build\.gradle(?:\.kts)?)$/.test(t)?"jvm":"python"}o(VEe,"implicitEcosystem");function zEe(e,t,n){let i=jEe[Se.extname(t)];if(i==="go"&&Se.extname(n)===".go"&&ZY(e,n)===ZY(e,t))return!0;let r=VEe(n);if(!r||i&&i!==r)return!1;let s=Se.relative(Se.dirname(n),t);return!s.startsWith("..")&&!Se.isAbsolute(s)}o(zEe,"implicitlyNeeds");function nW(e,t,n){let i=new Map;if(!n.length)return i;let r=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]);for(let s of t.tests){if(s.change==="deleted")continue;let a=r(s.file);if(!Zr(a)||Ei(e,a.root,a.rel))continue;let c=Se.resolve(a.root),u=Se.resolve(c,a.rel),l=n.filter(E=>Se.resolve(E.source.path)===c);if(!l.length)continue;let p="";try{p=Kr.readFileSync(u,"utf-8")}catch{}let f=UEe(c,u,p),A=FEe(u,p),h=LEe(c,s),m=l.filter(E=>{let b=Se.resolve(c,E.file);return f.has(b)||h.has(b)||OEe(A,b)||MEe(p,b)||zEe(c,u,b)});m.length&&i.set(u,`needs ${m.map(E=>XY(e,E)).join(", ")}, which is not in the tests PR: ${KY}`)}return i}o(nW,"supportDependents");function Fo(e){return Array.isArray(e)?`[${e.map(Fo).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${Fo(n)}`).join(",")}}`:JSON.stringify(e)??"undefined"}o(Fo,"stable");function qEe(e,t,n){let i=Se.basename(n);if(i!=="package.json"&&i!=="package-lock.json")return!1;let r=Uo().version;if(r==="unknown")return!1;let s,a;try{let c=Se.resolve(t,n);if(!Kr.lstatSync(c).isFile()||Kr.realpathSync(c)!==c)return!1;s=JSON.parse(Kr.readFileSync(c,"utf-8"));let u=e.executionSafetySources?.find(A=>Se.resolve(A.path)===Se.resolve(t));if(u){let A=db(t,u.head,n);A&&(a=JSON.parse(A.bytes.toString("utf-8")))}else if(Kr.existsSync(Se.join(t,".git")))return!1;let l=o(A=>{let h=structuredClone(A);for(let m of["dependencies","devDependencies"])h[m]&&(delete h[m]["@skyramp/testbot-core"],Object.keys(h[m]).length||delete h[m]);return h},"withoutCore");if(i==="package.json")return(s.devDependencies?.["@skyramp/testbot-core"]??s.dependencies?.["@skyramp/testbot-core"])!==r?!1:a?Fo(l(s))===Fo(l(a)):Object.keys(s).every(A=>["name","version","private","type","scripts","dependencies","devDependencies"].includes(A))&&(!s.scripts||Fo(s.scripts)===Fo({test:"node --test"}))&&Object.keys(s.dependencies??{}).every(A=>A==="@skyramp/testbot-core")&&Object.keys(s.devDependencies??{}).every(A=>A==="@skyramp/testbot-core");let p=s.packages?.["node_modules/@skyramp/testbot-core"];if(!p||p.version!==r||p.link||p.hasInstallScript||p.resolved!==`https://registry.npmjs.org/@skyramp/testbot-core/-/testbot-core-${r}.tgz`||!/^sha512-[A-Za-z0-9+/=]+$/.test(p.integrity??""))return!1;let f=o(A=>{let h=structuredClone(A);return h.packages&&(delete h.packages["node_modules/@skyramp/testbot-core"],h.packages[""]&&(h.packages[""]=l(h.packages[""]))),h},"stripped");return a?Fo(f(s))===Fo(f(a)):Object.keys(s.packages??{}).every(A=>A===""||A==="node_modules/@skyramp/testbot-core")&&!s.packages?.[""]?.scripts}catch{return!1}}o(qEe,"safeRuntimeManifest");function HEe(e,t,n){try{return Kr.lstatSync(Se.join(t,n)),!1}catch(r){if(r.code!=="ENOENT")return!1}let i=e.executionSafetySources?.find(r=>Se.resolve(r.path)===Se.resolve(t));return!i||!/^[a-f0-9]{40,64}$/.test(i.head)?!1:db(t,i.head,n)!==null}o(HEe,"trackedDeletion");function JEe(e){try{return hb.lstatSync(e),!0}catch{return!1}}o(JEe,"lexists");function mb(e,t=mg(e)){let n=new Set(t.omitted.map(({source:i,file:r})=>Dt.resolve(i.path,r)));return new Map([...rW(e,t.assemblies)].map(([i,r])=>[i,r.filter(s=>!n.has(Dt.resolve(i.path,s)))]))}o(mb,"deliverAllowlist");function mg(e,t=ve(e,"write.json")){if(!t||!On(e.inputs))return{assemblies:[],omitted:[],hasSharedTests:!1};let n=hg(e,t),i=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),r=new Set(t.tests.map(c=>{let u=i(c.file);return Dt.resolve(u.root,u.rel)})),s=[],a=n;for(;;){let c=a.length>0||fb(e,t,a).length>0;if(!c)return{assemblies:a,omitted:s,hasSharedTests:c};let u=rW(e,a),l=new Set([...u].flatMap(([h,m])=>m.map(E=>Dt.resolve(h.path,E)))),{allowed:p}=gb(e,t,a,l),f=new Set(s.map(({source:h,file:m})=>Dt.resolve(h.path,m))),A=Ab(e,u,p,a).filter(({source:h,file:m})=>{let E=Dt.resolve(h.path,m);return!f.has(E)&&!r.has(E)});if(!A.length)return{assemblies:a,omitted:s,hasSharedTests:c};s.push(...A),a=YY(e,t,n,nW(e,t,s))}}o(mg,"sharedDeliveryPlan");function rW(e,t){let n=new Set(t.filter(({record:b})=>!b.entry).map(({source:b,record:v})=>Dt.join(b.path,v.file))),i=ve(e,"adapt.json"),r=ve(e,"finalize.json"),s=ve(e,gg),a=new Map,c=o(b=>{let v=Es(e.inputs,b);if("error"in v)return;let I=a.get(v.source.path)??{source:v.source,paths:new Set};return a.set(v.source.path,I),{repo:I.source.path,paths:I.paths}},"pathsOf"),u=o((b,v)=>Dt.relative(b,Dt.resolve(b,v.trim())).replace(/\/+$/,""),"norm"),l=o((b,v)=>{let I=v?.trim()&&c(b);if(!I)return;let C=u(I.repo,v);I.paths.add(C);for(let x of["__init__.py","conftest.py"]){let w=Dt.join(Dt.dirname(C),x);hb.existsSync(Dt.join(I.repo,w))&&(!n.has(Dt.join(I.repo,C))||!Ei(e,I.repo,w))&&I.paths.add(w)}},"addTest"),p=o((b,v)=>{if(typeof v!="string"||!v.trim())return;let I=c(b);if(!I)return;let C=u(I.repo,v);if(eg(Dt.join(I.repo,C)))return I.paths.add(C),{...I,rel:C}},"addEdited"),f=M0(e),A=(i?.items??[]).filter(b=>b.action==="place"&&f.has(b.from??b.file??"")),h=o((b,v)=>A.some(I=>I.repository===b&&I.file&&Dt.normalize(I.file)===v),"heldIn"),m=(i?.items??[]).filter(b=>!A.includes(b));for(let b of[...m,...s?.tests??[],...s?.maintained??[]])l(b.repository,b.file);for(let b of r?.dependencies?.added??[]){let v=p(b.repository,b.manifest);if(v)for(let I of d0(v.repo,JE(v.repo,v.rel)))v.paths.add(I)}for(let b of r?.lint??[])for(let v of b.fixed??[])p(b.repository,v);for(let b of r?.support??[])p(b.repository,b.file);let E=ve(e,YE)?.packages??[];for(let b of new Set(E.map(v=>v.repository))){let v=c(b),I=E.filter(C=>C.repository===b).map(C=>C.dir);if(v)for(let{path:C}of tb(v.repo)){let x=u(v.repo,C),w=Dt.join(v.repo,x);WE(x,I)&&!p0(x)&&!h(b,x)&&(!JEe(w)||eg(w))&&v.paths.add(x)}}for(let{record:b,source:v,problems:I}of t){let C=a.get(v.path)?.paths;C?.has(b.file)&&(C.delete(b.file),!I.length&&(b.entry&&C.add(b.entry),C.add(b.sourceAsset)))}return new Map([...a.values()].map(({source:b,paths:v})=>[b,[...v].filter(I=>I&&I!==".."&&!I.startsWith(`..${Dt.sep}`)&&!Qo(I))]))}o(rW,"candidateAllowlist");mu();var uJe=5*6e4,lJe=12*6e4,dJe=2*6e4;var yJe=["class TestbotProjectBrowsers {"," onBegin(config) {",' const projects = config.projects.map((p) => ({ browserName: p.use.browserName ?? p.use.defaultBrowserType ?? "chromium", channel: p.use.channel ?? null }));',' process.stdout.write("TESTBOT_PROJECT_BROWSERS " + JSON.stringify(projects) + "\\n");'," }"," printsToStdio() { return true; }","}","module.exports = TestbotProjectBrowsers;",""].join(`
266
266
  `);var cr=ee(require("fs")),Ts=ee(require("path"));var Oo=ee(require("fs")),yb=ee(require("path"));var ZEe="change-inputs",KEe=o((e,t)=>`${t}-${e.replace(/[^\w.-]+/g,n=>n==="/"?"__":"-")}.md`,"fileName");function XEe(e){return[...(e.pullRequests??[]).map(t=>({label:`${t.repository}#${t.number}`,body:t.body?.trim()??""})),...(e.relatedRepos??[]).map(t=>({label:t.slug,body:t.prDescription?.trim()??""}))].map((t,n)=>({...t,file:KEe(t.label,n)})).filter(t=>t.body.length>wG)}o(XEe,"longDescriptions");function iW(e,t,n){let i=yb.join(t,ZEe);Oo.rmSync(i,{recursive:!0,force:!0}),Oo.mkdirSync(i,{recursive:!0}),Oo.writeFileSync(yb.join(i,Fa),n,{mode:292});for(let r of XEe(e))Oo.writeFileSync(yb.join(i,r.file),`${r.body}
267
267
  `,{mode:292})}o(iW,"writeChangeInputs");var ebe=[/^\.github\//,/^\.gitlab(-ci)?/,/^\.circleci\//,/(^|\/)Jenkinsfile$/,/^docs?\//,/\.(md|mdx|rst)$/i,/(^|\/)LICENSE([._-].*)?$/i,/(^|\/)CODEOWNERS$/,/(^|\/)\.gitignore$/,/(^|\/)\.gitattributes$/,/(^|\/)\.editorconfig$/,/(^|\/)\.prettierrc[^/]*$/,/(^|\/)\.eslintrc[^/]*$/,/(^|\/)eslint\.config\.[^/]+$/,/(^|\/)package-lock\.json$/,/(^|\/)yarn\.lock$/,/(^|\/)pnpm-lock\.yaml$/,/(^|\/)poetry\.lock$/,/(^|\/)Pipfile\.lock$/,/(^|\/)Cargo\.lock$/,/(^|\/)go\.sum$/,/(^|\/)composer\.lock$/,/(^|\/)Gemfile\.lock$/,/\.(png|jpe?g|gif|svg|ico|webp)$/i];function sW(e){return ebe.some(t=>t.test(e))}o(sW,"isNonApplicationFile");function tbe(e){let t=[],n=e.inputs.repositoryPath;return!n||!cr.existsSync(n)?t.push(`repository path does not exist: ${n}`):JT(n)?Jf(n,e.inputs.baseBranch)||t.push(e.inputs.baseBranch?`base branch "${e.inputs.baseBranch}" does not resolve`:"could not auto-detect a base branch (origin/HEAD, main, master)"):t.push(`not a git repository: ${n}`),{ok:t.length===0,reasons:t}}o(tbe,"validatePreflightInput");function nbe(e){return(e.inputs.relatedRepos??[]).map(t=>{let n=cr.existsSync(t.path)?GE(t.path,t.base):void 0;return n?{repository:t.slug,changedFiles:n.changedFiles}:{repository:t.slug,changedFiles:[],note:`could not read the change in ${t.path}`}})}o(nbe,"collectRelatedChanges");function rbe(e){cr.rmSync(Ts.join(e.runDir,cS),{recursive:!0,force:!0});for(let t of e.inputs.relatedRepos??[]){let n=cr.existsSync(t.path)?YT(t.path,t.base):void 0;if(!n)continue;let i=Ts.join(e.runDir,uS(t.slug));cr.mkdirSync(Ts.dirname(i),{recursive:!0}),cr.writeFileSync(i,n.diffContent)}}o(rbe,"writeRelatedDiffs");function ibe(e){let{repositoryPath:t,baseBranch:n}=e.inputs;cr.rmSync(Ts.join(t,S0),{recursive:!0,force:!0});let i=GE(t,n);if(!i)throw new Error(`could not compute git facts for ${t}`);let r=YT(t,n);if(!r)throw new Error(`could not compute the PR diff for ${t}`);let s=nbe(e),a=[i.changedFiles,...s.map(f=>f.changedFiles)].flat(),c=a.map(f=>f.path).filter(sW),u=!Uu(e)&&a.length>0&&c.length===a.length,l={schemaVersion:1,repository:{path:t,currentBranch:i.currentBranch,baseBranch:i.baseBranch},changedFiles:i.changedFiles,...s.length?{relatedChanges:s}:{},newFiles:r.newFiles,deletedFiles:r.deletedFiles,diffStat:r.diffStat,diffBytes:r.diffContent.length,nonApplicationFiles:c,nonApplicationOnly:u,sutRequired:!u};cr.writeFileSync(Ts.join(e.runDir,Fa),r.diffContent),iW(e.inputs,e.runDir,r.diffContent),rbe(e);let p=Ts.join(e.runDir,aS);return cr.mkdirSync(Ts.dirname(p),{recursive:!0}),cr.writeFileSync(p,JSON.stringify(l,null,2)+`
268
- `),e.prepared={preflight:l},{preflight:aS,diff:Fa}}o(ibe,"executePreflight");var QYe={name:"preflight",timeoutMinutes:1,requires:[],validateInput:tbe,execute:ibe};var yg=ee(require("path"));function sbe(e){return jn(N0,e).errors}o(sbe,"validateFinalizeOutput");function obe(e,t=[]){let{value:n,error:i}=Kt(e,t);if(i)return{errors:[i]};let r=sbe(n);return r.length>0?{errors:r}:{finalize:n,errors:[]}}o(obe,"parseFinalizeText");var abe="finalize-scratch";function cbe(e,t){let n=obe(e.stdout,t?.secretValues);if(!n.finalize||!t?.outputsDir)return n;let i=o((r,s)=>r.trim()&&Db(r.trim(),yg.join(t.outputsDir,abe,s),"finalize")||r,"script");return{...n,finalize:{...n.finalize,lint:n.finalize.lint.map((r,s)=>({...r,command:i(r.command??"",`lint-${s+1}.sh`)}))}}}o(cbe,"parseFinalizeFromSession");var ZWe=Xn("finalize-schema",(e,t)=>cbe(t,e));var aW=ee(require("path"));var x4e=new Set(["targeted_unit","existing_evidence_sufficient"]);var gbe="triage.json";var JZe=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),YZe={existing_evidence:"existing evidence",unaffected:"showing the change cannot reach it",existing_unit:"running the existing unit tests",new_unit:"a new unit test",runtime:"tests against the running application"};function Abe(e){let{value:t,error:n}=Kt(e);if(n)return{errors:[n]};let{value:i,errors:r}=jn(ng,t);return r.length?{errors:r}:{triage:i,errors:[]}}o(Abe,"parseTriageText");function hbe(e){return Abe(e.stdout)}o(hbe,"parseTriageFromSession");var WZe=Xn("triage-schema",(e,t)=>hbe(t));function mbe(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}o(mbe,"triageDecider");function H0(e){if(mbe(e)?.status==="passed")return Gi(aW.join(e.outputsDir,gbe))}o(H0,"readTriage");function J0(e){if(!SE(e))return XJ(b0(e.inputs,ve(e,`${rg}.json`),H0(e)?.sutRequired))}o(J0,"revisionBlockReason");var ZZe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);function Y0(e){return e.functions?.length?e.functions:[(e.testType==="unit"?e.testId.split("::").slice(1).join("::").replace(/\[.*\]$/,""):"")||e.testId]}o(Y0,"rowFunctions");function Fl(e){return new Set(e.flatMap(t=>Y0(t).map(n=>`${t.repository??""}\0${t.fileName}\0${n}`))).size}o(Fl,"testCount");function ybe(e){return jn(_0,e).errors}o(ybe,"validateAnalysisOutput");function cW(e,t=[]){let{value:n,error:i}=Kt(e,t);if(i)return{errors:[i]};let r=ybe(n);return r.length>0?{errors:r}:{analysis:n,errors:[]}}o(cW,"parseAnalysisText");function Ebe(e,t=[]){return cW(e.stdout,t)}o(Ebe,"parseAnalysisFromSession");var y6e=Xn("analysis-schema",(e,t)=>Ebe(t,e.secretValues));var E9e=zh.rows.notRun(!0);var Eg="kept, not ";var bg="(declined the planned ";function W0(e){if(!e)return[];let t=[],n=0,i=0;for(let r=0;r<e.length;r++){let s=e[r];s==="("?n++:s===")"?n=Math.max(0,n-1):n===0&&s===";"&&e[r+1]===" "&&e[r-1]===")"&&(t.push(e.slice(i,r)),i=r+2)}return t.push(e.slice(i)),t.map(r=>{let s=r.trim();if(!s.endsWith(")"))return{expectation:s};let a=0;for(let c=s.length-1;c>=0;c--)if(s[c]===")")a++;else if(s[c]==="("&&--a===0){let u=s.slice(0,c).trim(),l=s.slice(c+1,-1).trim();return u&&l?{expectation:u,expected:l}:{expectation:s}}return{expectation:s}})}o(W0,"assertionParts");var Z0=new Set(["update","regenerate","delete"]);var b9e={update:"updated",regenerate:"regenerated",delete:"deleted",verify:"verified",none:"touched"};var mn=ee(require("node:fs")),kt=ee(require("node:path")),bb=require("node:crypto");function Ibe(e,t,n=Uo().version){if(!On(e.inputs))return[];let i=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),r=hg(e,t,n),s=new Map(r.map(a=>[kt.resolve(a.source.path,a.record.file),a.problems]));return t.tests.flatMap(a=>{let c=i(a.file),u=s.get(kt.resolve(c.root,c.rel));if(u)return u;if(a.change!=="added")return[];if(!Ul(e,a))return[];let p=o(m=>[`${a.file}: shared-environment delivery is blocked: ${m}`],"problem");if(!Zr(c))return p("test file is outside its checkout");let f=Nl(c.root,kt.join(c.root,c.rel));if(typeof f=="string")return p(`${f} (restrictedDeliveryProblems)`);let A=$s(f.toString("utf-8"));if(!A)return p("use the exact supported delivered harness; preserve unsupported assertions in an inactive source asset, never unrestricted executable code");if("restriction"in A){if(!A.sourceAsset.path.endsWith(".source"))return p("restricted source asset must use an inactive .source extension");let m=kt.resolve(kt.dirname(kt.join(c.root,c.rel)),A.sourceAsset.path),E=kt.relative(c.root,m);if(!E||E.startsWith("..")||kt.isAbsolute(E))return p("restricted source asset must remain inside its checkout");try{if(!mn.lstatSync(m).isFile()||mn.realpathSync(m)!==m||(0,bb.createHash)("sha256").update(mn.readFileSync(m)).digest("hex")!==A.sourceAsset.sha256)return p("restricted source asset is missing, changed or a symlink")}catch{return p("restricted source asset is unavailable")}if(!(t.supportFiles??[]).some(b=>{let v=i(b);return kt.join(v.root,v.rel)===m}))return p("restricted source asset must be delivered in supportFiles")}else{let m=e.inputs.sharedEnvironment;if(A.definition.environmentId!==m?.environmentId||A.definition.environmentAddress!==m?.environmentAddress)return p("harness identity/address differs from the selected Test Environment");if((m.offLimits??[]).some(E=>!A.definition.offLimits.includes(E)))return p("harness omits a configured off-limits route")}if(n==="unknown")return e.inputs.deliver?p("guarded CI delivery is unavailable from an unreleased engine build"):[];let h=kt.dirname(kt.join(c.root,c.rel));for(;h.startsWith(c.root);){let m=kt.join(h,"package.json");if(mn.existsSync(m))try{let E=JSON.parse(mn.readFileSync(m,"utf-8"));return(E.devDependencies?.["@skyramp/testbot-core"]??E.dependencies?.["@skyramp/testbot-core"])===n?[]:p("declare the exact released engine version containing this harness; an unavailable or older runtime cannot protect direct invocation")}catch{return p("test package manifest is unreadable")}if(h===c.root)break;h=kt.dirname(h)}return p("the delivered test has no package manifest declaring its guarded runtime")})}o(Ibe,"restrictedDeliveryProblems");function K0(e,t){if(!On(e.inputs))return[];let n=ve(e,"write.json");if(!n)return["shared-environment delivery requires its generated-test record"];let i=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),r=t??mg(e,n),{assemblies:s}=r;if(!r.hasSharedTests)return n.tests.flatMap(p=>{if(p.change!=="deleted")return[];let f=i(p.file);return Zr(f)&&mn.existsSync(kt.join(f.root,f.rel))?[`${p.file}: a deleted test must actually be absent`]:[]});let a=fb(e,n,s).filter(p=>{let f=i(p.file);return p.change!=="deleted"&&!Ei(e,f.root,f.rel)}).map(p=>({...p,change:"added"})),c=mb(e,r),u=new Set([...c].flatMap(([p,f])=>f.map(A=>kt.resolve(p.path,A)))),l=gb(e,n,s,u);return[...s.flatMap(p=>p.problems),...Ibe(e,{...n,tests:a}),...l.problems,...Ab(e,c,l.allowed,s).map(({file:p})=>`${p}: shared-environment delivery refuses an unverified executable/support/manifest path`)]}o(K0,"sharedDeliveryAllowlistProblems");function uW(e,t,n=[]){if(!On(e.inputs))return[];let i=[],r=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]);for(let s of t.tests){if(s.change==="deleted")continue;let a=r(s.file),c=kt.join(a.root,a.rel);if(Ei(e,a.root,a.rel)||!Zr(a)||V0(a.root,c))continue;let u=`reading ${a.rel}`;try{let l=$s(mn.readFileSync(c,"utf-8"));if(!l)continue;if("restriction"in l){let f=kt.resolve(kt.dirname(c),l.sourceAsset.path),A=kt.relative(a.root,f);if(u=`reading ${A}`,!A||A.startsWith("..")||kt.isAbsolute(A)||!mn.lstatSync(f).isFile()||mn.realpathSync(f)!==f){i.push(`${s.file}: restricted source asset is not a regular file in its checkout`);continue}let h=mn.readFileSync(f);if((0,bb.createHash)("sha256").update(h).digest("hex")!==l.sourceAsset.sha256){i.push(`${s.file}: restricted source asset changed before trusted formatting; not refreshing its hash`);continue}let m=uc(h.toString("utf-8"),n).content,E=_l(a.root,A,Buffer.from(m));u=`writing ${A}`,mn.writeFileSync(f,E),l.sourceAsset.sha256=(0,bb.createHash)("sha256").update(E).digest("hex")}let p=uc(cg(l),n).content;u=`writing ${a.rel}`,mn.writeFileSync(c,_l(a.root,a.rel,Buffer.from(p)))}catch(l){i.push(`${s.file}: could not assemble its guarded entry after trusted formatting (prepareSharedDeliveryFiles): ${u} failed: ${Pl(l,a.root)}`)}}return i}o(uW,"prepareSharedDeliveryFiles");var sn=ee(require("fs")),bi=ee(require("path")),VW=ee(require("crypto")),zW=require("child_process");var Cg=require("crypto");var lW=d.string().trim().min(1),X0=d.object({schemaVersion:d.literal(1).optional(),businessCaseAnalysis:lW.describe("1-2 sentences: what this change means for a user, and whether the evidence shows it working; no count of tests, which the report gives"),issuesFound:d.array(d.object({description:lW,severity:d.string().optional().describe("critical | high | medium | low"),category:d.string().optional().describe("bug | lint | type | config"),sourceFile:d.string().optional(),sourceLine:d.number().optional(),findingId:d.string().optional(),requirementIds:d.array(d.string()).optional()})).describe("every real problem this run exposed \u2014 cause, file:line, severity"),nextSteps:d.array(d.string()).describe("concrete follow-ups the author can act on; required non-empty when a disclosure is BLOCKING")});function Cbe(e){return jn(X0,e).errors}o(Cbe,"validateProseOutput");function Sbe(e,t=[]){let{value:n,error:i}=Kt(e.stdout,t);if(i)return{errors:[i]};let r=Cbe(n);return r.length>0?{errors:r}:{prose:n,errors:[]}}o(Sbe,"parseProseFromSession");var Y9e=Xn("report-schema",(e,t)=>Sbe(t,e.secretValues));var eD="<!-- skyramp-testbot -->",tD=Z0,Bbe=new Set(["lint","type","config"]),dW={critical:0,high:1,medium:2,low:3},EW=new Set(["Pass","Fail"]);var nD=o(e=>to(ue().statusLabels,e),"statusLabel"),Ib=o(e=>to(ue().testTypeCellLabels,e),"testTypeLabel");function tt(e){return(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>").trim()}o(tt,"escCell");function pW(e){return e.inferred?" (inferred)":""}o(pW,"inferredMark");function fW(e,t){return!e||!EW.has(e)?"\u2014":t?`${nD(e)} (${tt(bW(t))})`:nD(e)}o(fW,"maintStatus");function bW(e){let t=o(i=>{let r=i.indexOf(": ");return r<0?i:to(ue().staged.maintenanceActions,i.slice(0,r))+i.slice(r)},"action");if(e.startsWith(Eg))return ue().staged.keptNot+t(e.slice(Eg.length));let n=e.indexOf(bg);return n<0?e:e.slice(0,n)+ue().staged.declinedPlanned+t(e.slice(n+bg.length))}o(bW,"declineNote");function gW(e){return e.category!==void 0&&Bbe.has(e.category.toLowerCase())}o(gW,"isTooling");function AW(e,t){return(dW[(e.severity??"").toLowerCase()]??4)-(dW[(t.severity??"").toLowerCase()]??4)}o(AW,"bySeverity");var wb=o(e=>e?.length?` (${e.join(", ")})`:"","forPullRequests");function hW(e){return`- ${e.severity?`**[${to(ue().severityLabels,e.severity.toLowerCase()).toUpperCase()}]** `:""}${e.description.trim()}${wb(e.pullRequests)}`}o(hW,"issueLine");function Rbe(e){let t=e.resultId?.split("#").slice(1).join("#");if(e.testType!=="unit"||!t)return;let n=t;try{n=decodeURIComponent(t)}catch{}let i=/^(.*?)(\[.*\])$/.exec(n);return i?{fn:i[1],kase:i[2]}:{fn:n}}o(Rbe,"unitTestOf");var vW=o((e,t)=>e!==void 0&&t!==void 0&&e.replace(/^\.\//,"")===t.replace(/^\.\//,""),"samePath");function IW(e,t){return(e.testVideos??[]).find(n=>n.url&&t(n))?.url}o(IW,"videoLink");function rD(e,t){return IW(e,n=>vW(n.fileName,t.fileName)&&(!n.repository||!t.repository||n.repository.toLowerCase()===t.repository.toLowerCase()))}o(rD,"resultVideoLink");function iD(e,t){return IW(e,n=>vW(n.writtenAs??n.fileName,t))}o(iD,"journeyVideoLink");function xbe(e,t,n){return n?rD(e,{fileName:t,repository:n}):iD(e,t)}o(xbe,"requirementVideoLink");function Qbe(e){let t=[],n=new Map;for(let a of e.newTestsCreated)a.testType==="unit"&&n.set(a.fileName,[...n.get(a.fileName)??[],a.testId.split("::").slice(1).join("::")]);let i=new Map,r=o((a,c)=>(n.get(a??"")??[]).find(u=>u!==c&&jJ(c,u)),"parentOf"),s=new Map;for(let a of e.testResults){let c=Rbe(a),u=c&&!c.kase?r(a.fileName,c.fn):void 0;if(c&&u&&(c={fn:u,kase:`"${c.fn}"`}),c?.kase&&i.set(a,c.kase),!c){t.push({testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:a.details??"",...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}});continue}let l=`${a.fileName??""}#${c.fn}`,p=s.get(l);p||(p={row:{testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:"",test:c.fn,...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}},cases:[]},s.set(l,p),t.push(p.row)),p.cases.push(a)}for(let{row:a,cases:c}of s.values()){let u=c.filter(A=>A.status==="Fail"),l=c.filter(A=>A.status==="Pass").length,p=c.filter(A=>A.status==="Skipped").length;a.cases=c.length,a.status=u.length?"Fail":p?"Skipped":"Pass";let f=u[0];a.details=c.length===1?c[0].details??"":ue().staged.casesPassed(l,c.length,p)+(f?`; ${i.get(f)??""} ${f.details??""}`.replace(/; +/,"; ").trimEnd():"")}return t}o(Qbe,"resultRows");function $be(e){return W0(e).map(t=>t.expected===void 0?t.expectation:`${t.expectation}: ${Nt(t.expected)}`)}o($be,"unitAssertions");function wg(e){return e.newTestsCreated.some(t=>t.testType!=="unit")&&e.testResults.every(t=>t.status==="Skipped")&&e.testResults.some(t=>t.failureCause?.kind==="environment"&&(t.failureCause.family==="app_not_started"||t.failureCause.family==="secret"))}o(wg,"nothingExecuted");function wW(e){let t=e.pullRequests??[];return t.length<2?[]:[ue().staged.validatedTogether(t.map(n=>`${Nt(`${n.repository}#${n.number}`)}${n.title?` ${Xr(n.title,120)}`:""}`).join("; "))]}o(wW,"pullRequestsLine");function CW(e,t=1/0){let n=Array.from(e.name.replace(/\s+/g," ").trim()).slice(0,t).join("").replace(/[<>[\]()*_`\\|#]/g,"\\$&").replace(/@/g,"@\u200D");return e.kind==="person"?ue().staged.requestedByPerson(n):ue().staged.requestedByPolicy(n)}o(CW,"requesterLine");function SW(e,t={}){if(t.audience==="testbot-pr")return Obe(e,t);let{audience:n,collapsed:i=!1,existingEvidence:r=[],requestedBy:s,sourcePullRequest:a}=t,c=n!=="comment",u=(e.requirements??[]).filter(w=>/^file-[a-f0-9]{16}-/i.test(w.id)).sort((w,$)=>$.id.length-w.id.length),l=o(w=>{let $=u.find(B=>w.toLowerCase().startsWith(B.id.toLowerCase()));return $?$.label+w.slice($.id.length):w},"displayId"),p=[eD];a&&p.push(ue().staged.testsSourcePullRequest(Nt(a)),"");for(let w of wW(e))p.push(w,"");s&&p.push(CW(s),""),e.notTranslated&&p.push(to(ue().staged.notTranslated,e.notTranslated),"");let f=o(w=>{i?p.push("<details>",`<summary>${w}</summary>`,""):p.push(`### ${w}`)},"sectionStart"),A=o(()=>{i&&p.push("","</details>"),p.push("")},"sectionEnd");for(let w of e.businessCaseAnalysis.trim().split(/\r?\n/))p.push(`> ${w}`);if(p.push(""),wg(e)&&p.push(ue().staged.noLiveApp(Fl(e.newTestsCreated)),""),c&&e.newTestsCreated.length){let w=new Map;for(let B of e.newTestsCreated){if(B.testType!=="unit")continue;let Z=Y0(B)[0],ie=w.get(B.fileName)??{functions:new Set,endpoints:[],descriptions:new Map};B.endpoint&&!ie.endpoints.includes(B.endpoint)&&ie.endpoints.push(B.endpoint);let H=B.description?.trim()??"",me=ie.descriptions.get(Z)??[];me.includes(H)||me.push(H),ie.functions.add(Z),ie.descriptions.set(Z,me),w.set(B.fileName,ie)}let $=e.newTestsCreated.filter(B=>B.testType!=="unit");f(ue().testRecommendationsImplementedHeader(Fl(e.newTestsCreated),$.length+Fl(e.newTestsCreated.filter(B=>B.testType==="unit"))));for(let[B,{functions:Z,endpoints:ie,descriptions:H}]of w){let me=Z.size;p.push(ue().staged.unitTestsInFile(`\`${B}\``,me,ie.map(Ie=>`\`${Ie}\``).join(", ")),"");let _e=new Map;for(let[Ie,K]of H){let V=K.join("\0"),Me=_e.get(V)??{fns:[],descriptions:K};Me.fns.push(Ie),_e.set(V,Me)}let Ue=0;for(let{fns:Ie,descriptions:K}of _e.values()){p.push(`${++Ue}. ${Ie.map(Me=>`\`${Me}\``).join(", ")}`);let V=[...new Set(K.flatMap(Me=>$be(Me)))];for(let Me of V)p.push(` - ${Me}`)}p.push("")}for(let B of $){let Z=B.testId?Nt(l(B.testId)):Ib(B.testType),ie=B.fileName?` (\`${B.fileName}\`)`:"",H=B.endpoint?`
268
+ `),e.prepared={preflight:l},{preflight:aS,diff:Fa}}o(ibe,"executePreflight");var QYe={name:"preflight",timeoutMinutes:1,requires:[],validateInput:tbe,execute:ibe};var yg=ee(require("path"));function sbe(e){return jn(N0,e).errors}o(sbe,"validateFinalizeOutput");function obe(e,t=[]){let{value:n,error:i}=Kt(e,t);if(i)return{errors:[i]};let r=sbe(n);return r.length>0?{errors:r}:{finalize:n,errors:[]}}o(obe,"parseFinalizeText");var abe="finalize-scratch";function cbe(e,t){let n=obe(e.stdout,t?.secretValues);if(!n.finalize||!t?.outputsDir)return n;let i=o((r,s)=>r.trim()&&Db(r.trim(),yg.join(t.outputsDir,abe,s),"finalize")||r,"script");return{...n,finalize:{...n.finalize,lint:n.finalize.lint.map((r,s)=>({...r,command:i(r.command??"",`lint-${s+1}.sh`)}))}}}o(cbe,"parseFinalizeFromSession");var ZWe=Xn("finalize-schema",(e,t)=>cbe(t,e));var aW=ee(require("path"));var x4e=new Set(["targeted_unit","existing_evidence_sufficient"]);var gbe="triage.json";var YZe=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),WZe={existing_evidence:"existing evidence",unaffected:"showing the change cannot reach it",existing_unit:"running the existing unit tests",new_unit:"a new unit test",runtime:"tests against the running application"};function Abe(e){let{value:t,error:n}=Kt(e);if(n)return{errors:[n]};let{value:i,errors:r}=jn(ng,t);return r.length?{errors:r}:{triage:i,errors:[]}}o(Abe,"parseTriageText");function hbe(e){return Abe(e.stdout)}o(hbe,"parseTriageFromSession");var ZZe=Xn("triage-schema",(e,t)=>hbe(t));var KZe={requirements:"this run has no change, so its requirement references set the scope; unchanged code still needs evidence or a gap",instructions:"this run has no change, so its Instructions set the scope; unchanged code still needs evidence or a gap"};function mbe(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}o(mbe,"triageDecider");function H0(e){if(mbe(e)?.status==="passed")return Gi(aW.join(e.outputsDir,gbe))}o(H0,"readTriage");function J0(e){if(!SE(e))return XJ(b0(e.inputs,ve(e,`${rg}.json`),H0(e)?.sutRequired))}o(J0,"revisionBlockReason");var XZe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);function Y0(e){return e.functions?.length?e.functions:[(e.testType==="unit"?e.testId.split("::").slice(1).join("::").replace(/\[.*\]$/,""):"")||e.testId]}o(Y0,"rowFunctions");function Fl(e){return new Set(e.flatMap(t=>Y0(t).map(n=>`${t.repository??""}\0${t.fileName}\0${n}`))).size}o(Fl,"testCount");function ybe(e){return jn(_0,e).errors}o(ybe,"validateAnalysisOutput");function cW(e,t=[]){let{value:n,error:i}=Kt(e,t);if(i)return{errors:[i]};let r=ybe(n);return r.length>0?{errors:r}:{analysis:n,errors:[]}}o(cW,"parseAnalysisText");function Ebe(e,t=[]){return cW(e.stdout,t)}o(Ebe,"parseAnalysisFromSession");var b6e=Xn("analysis-schema",(e,t)=>Ebe(t,e.secretValues));var v9e=zh.rows.notRun(!0);var Eg="kept, not ";var bg="(declined the planned ";function W0(e){if(!e)return[];let t=[],n=0,i=0;for(let r=0;r<e.length;r++){let s=e[r];s==="("?n++:s===")"?n=Math.max(0,n-1):n===0&&s===";"&&e[r+1]===" "&&e[r-1]===")"&&(t.push(e.slice(i,r)),i=r+2)}return t.push(e.slice(i)),t.map(r=>{let s=r.trim();if(!s.endsWith(")"))return{expectation:s};let a=0;for(let c=s.length-1;c>=0;c--)if(s[c]===")")a++;else if(s[c]==="("&&--a===0){let u=s.slice(0,c).trim(),l=s.slice(c+1,-1).trim();return u&&l?{expectation:u,expected:l}:{expectation:s}}return{expectation:s}})}o(W0,"assertionParts");var Z0=new Set(["update","regenerate","delete"]);var I9e={update:"updated",regenerate:"regenerated",delete:"deleted",verify:"verified",none:"touched"};var mn=ee(require("node:fs")),kt=ee(require("node:path")),bb=require("node:crypto");function Ibe(e,t,n=Uo().version){if(!On(e.inputs))return[];let i=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),r=hg(e,t,n),s=new Map(r.map(a=>[kt.resolve(a.source.path,a.record.file),a.problems]));return t.tests.flatMap(a=>{let c=i(a.file),u=s.get(kt.resolve(c.root,c.rel));if(u)return u;if(a.change!=="added")return[];if(!Ul(e,a))return[];let p=o(m=>[`${a.file}: shared-environment delivery is blocked: ${m}`],"problem");if(!Zr(c))return p("test file is outside its checkout");let f=Nl(c.root,kt.join(c.root,c.rel));if(typeof f=="string")return p(`${f} (restrictedDeliveryProblems)`);let A=$s(f.toString("utf-8"));if(!A)return p("use the exact supported delivered harness; preserve unsupported assertions in an inactive source asset, never unrestricted executable code");if("restriction"in A){if(!A.sourceAsset.path.endsWith(".source"))return p("restricted source asset must use an inactive .source extension");let m=kt.resolve(kt.dirname(kt.join(c.root,c.rel)),A.sourceAsset.path),E=kt.relative(c.root,m);if(!E||E.startsWith("..")||kt.isAbsolute(E))return p("restricted source asset must remain inside its checkout");try{if(!mn.lstatSync(m).isFile()||mn.realpathSync(m)!==m||(0,bb.createHash)("sha256").update(mn.readFileSync(m)).digest("hex")!==A.sourceAsset.sha256)return p("restricted source asset is missing, changed or a symlink")}catch{return p("restricted source asset is unavailable")}if(!(t.supportFiles??[]).some(b=>{let v=i(b);return kt.join(v.root,v.rel)===m}))return p("restricted source asset must be delivered in supportFiles")}else{let m=e.inputs.sharedEnvironment;if(A.definition.environmentId!==m?.environmentId||A.definition.environmentAddress!==m?.environmentAddress)return p("harness identity/address differs from the selected Test Environment");if((m.offLimits??[]).some(E=>!A.definition.offLimits.includes(E)))return p("harness omits a configured off-limits route")}if(n==="unknown")return e.inputs.deliver?p("guarded CI delivery is unavailable from an unreleased engine build"):[];let h=kt.dirname(kt.join(c.root,c.rel));for(;h.startsWith(c.root);){let m=kt.join(h,"package.json");if(mn.existsSync(m))try{let E=JSON.parse(mn.readFileSync(m,"utf-8"));return(E.devDependencies?.["@skyramp/testbot-core"]??E.dependencies?.["@skyramp/testbot-core"])===n?[]:p("declare the exact released engine version containing this harness; an unavailable or older runtime cannot protect direct invocation")}catch{return p("test package manifest is unreadable")}if(h===c.root)break;h=kt.dirname(h)}return p("the delivered test has no package manifest declaring its guarded runtime")})}o(Ibe,"restrictedDeliveryProblems");function K0(e,t){if(!On(e.inputs))return[];let n=ve(e,"write.json");if(!n)return["shared-environment delivery requires its generated-test record"];let i=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),r=t??mg(e,n),{assemblies:s}=r;if(!r.hasSharedTests)return n.tests.flatMap(p=>{if(p.change!=="deleted")return[];let f=i(p.file);return Zr(f)&&mn.existsSync(kt.join(f.root,f.rel))?[`${p.file}: a deleted test must actually be absent`]:[]});let a=fb(e,n,s).filter(p=>{let f=i(p.file);return p.change!=="deleted"&&!Ei(e,f.root,f.rel)}).map(p=>({...p,change:"added"})),c=mb(e,r),u=new Set([...c].flatMap(([p,f])=>f.map(A=>kt.resolve(p.path,A)))),l=gb(e,n,s,u);return[...s.flatMap(p=>p.problems),...Ibe(e,{...n,tests:a}),...l.problems,...Ab(e,c,l.allowed,s).map(({file:p})=>`${p}: shared-environment delivery refuses an unverified executable/support/manifest path`)]}o(K0,"sharedDeliveryAllowlistProblems");function uW(e,t,n=[]){if(!On(e.inputs))return[];let i=[],r=An(e.inputs.repositoryPath,e.inputs.relatedRepos??[]);for(let s of t.tests){if(s.change==="deleted")continue;let a=r(s.file),c=kt.join(a.root,a.rel);if(Ei(e,a.root,a.rel)||!Zr(a)||V0(a.root,c))continue;let u=`reading ${a.rel}`;try{let l=$s(mn.readFileSync(c,"utf-8"));if(!l)continue;if("restriction"in l){let f=kt.resolve(kt.dirname(c),l.sourceAsset.path),A=kt.relative(a.root,f);if(u=`reading ${A}`,!A||A.startsWith("..")||kt.isAbsolute(A)||!mn.lstatSync(f).isFile()||mn.realpathSync(f)!==f){i.push(`${s.file}: restricted source asset is not a regular file in its checkout`);continue}let h=mn.readFileSync(f);if((0,bb.createHash)("sha256").update(h).digest("hex")!==l.sourceAsset.sha256){i.push(`${s.file}: restricted source asset changed before trusted formatting; not refreshing its hash`);continue}let m=uc(h.toString("utf-8"),n).content,E=_l(a.root,A,Buffer.from(m));u=`writing ${A}`,mn.writeFileSync(f,E),l.sourceAsset.sha256=(0,bb.createHash)("sha256").update(E).digest("hex")}let p=uc(cg(l),n).content;u=`writing ${a.rel}`,mn.writeFileSync(c,_l(a.root,a.rel,Buffer.from(p)))}catch(l){i.push(`${s.file}: could not assemble its guarded entry after trusted formatting (prepareSharedDeliveryFiles): ${u} failed: ${Pl(l,a.root)}`)}}return i}o(uW,"prepareSharedDeliveryFiles");var sn=ee(require("fs")),bi=ee(require("path")),VW=ee(require("crypto")),zW=require("child_process");var Cg=require("crypto");var lW=d.string().trim().min(1),X0=d.object({schemaVersion:d.literal(1).optional(),businessCaseAnalysis:lW.describe("1-2 sentences: what this change means for a user, and whether the evidence shows it working; no count of tests, which the report gives"),issuesFound:d.array(d.object({description:lW,severity:d.string().optional().describe("critical | high | medium | low"),category:d.string().optional().describe("bug | lint | type | config"),sourceFile:d.string().optional(),sourceLine:d.number().optional(),findingId:d.string().optional(),requirementIds:d.array(d.string()).optional()})).describe("every real problem this run exposed \u2014 cause, file:line, severity"),nextSteps:d.array(d.string()).describe("concrete follow-ups the author can act on; required non-empty when a disclosure is BLOCKING")});function Cbe(e){return jn(X0,e).errors}o(Cbe,"validateProseOutput");function Sbe(e,t=[]){let{value:n,error:i}=Kt(e.stdout,t);if(i)return{errors:[i]};let r=Cbe(n);return r.length>0?{errors:r}:{prose:n,errors:[]}}o(Sbe,"parseProseFromSession");var Z9e=Xn("report-schema",(e,t)=>Sbe(t,e.secretValues));var eD="<!-- skyramp-testbot -->",tD=Z0,Bbe=new Set(["lint","type","config"]),dW={critical:0,high:1,medium:2,low:3},EW=new Set(["Pass","Fail"]);var nD=o(e=>to(ue().statusLabels,e),"statusLabel"),Ib=o(e=>to(ue().testTypeCellLabels,e),"testTypeLabel");function tt(e){return(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>").trim()}o(tt,"escCell");function pW(e){return e.inferred?" (inferred)":""}o(pW,"inferredMark");function fW(e,t){return!e||!EW.has(e)?"\u2014":t?`${nD(e)} (${tt(bW(t))})`:nD(e)}o(fW,"maintStatus");function bW(e){let t=o(i=>{let r=i.indexOf(": ");return r<0?i:to(ue().staged.maintenanceActions,i.slice(0,r))+i.slice(r)},"action");if(e.startsWith(Eg))return ue().staged.keptNot+t(e.slice(Eg.length));let n=e.indexOf(bg);return n<0?e:e.slice(0,n)+ue().staged.declinedPlanned+t(e.slice(n+bg.length))}o(bW,"declineNote");function gW(e){return e.category!==void 0&&Bbe.has(e.category.toLowerCase())}o(gW,"isTooling");function AW(e,t){return(dW[(e.severity??"").toLowerCase()]??4)-(dW[(t.severity??"").toLowerCase()]??4)}o(AW,"bySeverity");var wb=o(e=>e?.length?` (${e.join(", ")})`:"","forPullRequests");function hW(e){return`- ${e.severity?`**[${to(ue().severityLabels,e.severity.toLowerCase()).toUpperCase()}]** `:""}${e.description.trim()}${wb(e.pullRequests)}`}o(hW,"issueLine");function Rbe(e){let t=e.resultId?.split("#").slice(1).join("#");if(e.testType!=="unit"||!t)return;let n=t;try{n=decodeURIComponent(t)}catch{}let i=/^(.*?)(\[.*\])$/.exec(n);return i?{fn:i[1],kase:i[2]}:{fn:n}}o(Rbe,"unitTestOf");var vW=o((e,t)=>e!==void 0&&t!==void 0&&e.replace(/^\.\//,"")===t.replace(/^\.\//,""),"samePath");function IW(e,t){return(e.testVideos??[]).find(n=>n.url&&t(n))?.url}o(IW,"videoLink");function rD(e,t){return IW(e,n=>vW(n.fileName,t.fileName)&&(!n.repository||!t.repository||n.repository.toLowerCase()===t.repository.toLowerCase()))}o(rD,"resultVideoLink");function iD(e,t){return IW(e,n=>vW(n.writtenAs??n.fileName,t))}o(iD,"journeyVideoLink");function xbe(e,t,n){return n?rD(e,{fileName:t,repository:n}):iD(e,t)}o(xbe,"requirementVideoLink");function Qbe(e){let t=[],n=new Map;for(let a of e.newTestsCreated)a.testType==="unit"&&n.set(a.fileName,[...n.get(a.fileName)??[],a.testId.split("::").slice(1).join("::")]);let i=new Map,r=o((a,c)=>(n.get(a??"")??[]).find(u=>u!==c&&jJ(c,u)),"parentOf"),s=new Map;for(let a of e.testResults){let c=Rbe(a),u=c&&!c.kase?r(a.fileName,c.fn):void 0;if(c&&u&&(c={fn:u,kase:`"${c.fn}"`}),c?.kase&&i.set(a,c.kase),!c){t.push({testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:a.details??"",...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}});continue}let l=`${a.fileName??""}#${c.fn}`,p=s.get(l);p||(p={row:{testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:"",test:c.fn,...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}},cases:[]},s.set(l,p),t.push(p.row)),p.cases.push(a)}for(let{row:a,cases:c}of s.values()){let u=c.filter(A=>A.status==="Fail"),l=c.filter(A=>A.status==="Pass").length,p=c.filter(A=>A.status==="Skipped").length;a.cases=c.length,a.status=u.length?"Fail":p?"Skipped":"Pass";let f=u[0];a.details=c.length===1?c[0].details??"":ue().staged.casesPassed(l,c.length,p)+(f?`; ${i.get(f)??""} ${f.details??""}`.replace(/; +/,"; ").trimEnd():"")}return t}o(Qbe,"resultRows");function $be(e){return W0(e).map(t=>t.expected===void 0?t.expectation:`${t.expectation}: ${Nt(t.expected)}`)}o($be,"unitAssertions");function wg(e){return e.newTestsCreated.some(t=>t.testType!=="unit")&&e.testResults.every(t=>t.status==="Skipped")&&e.testResults.some(t=>t.failureCause?.kind==="environment"&&(t.failureCause.family==="app_not_started"||t.failureCause.family==="secret"))}o(wg,"nothingExecuted");function wW(e){let t=e.pullRequests??[];return t.length<2?[]:[ue().staged.validatedTogether(t.map(n=>`${Nt(`${n.repository}#${n.number}`)}${n.title?` ${Xr(n.title,120)}`:""}`).join("; "))]}o(wW,"pullRequestsLine");function CW(e,t=1/0){let n=Array.from(e.name.replace(/\s+/g," ").trim()).slice(0,t).join("").replace(/[<>[\]()*_`\\|#]/g,"\\$&").replace(/@/g,"@\u200D");return e.kind==="person"?ue().staged.requestedByPerson(n):ue().staged.requestedByPolicy(n)}o(CW,"requesterLine");function SW(e,t={}){if(t.audience==="testbot-pr")return Obe(e,t);let{audience:n,collapsed:i=!1,existingEvidence:r=[],requestedBy:s,sourcePullRequest:a}=t,c=n!=="comment",u=(e.requirements??[]).filter(w=>/^file-[a-f0-9]{16}-/i.test(w.id)).sort((w,$)=>$.id.length-w.id.length),l=o(w=>{let $=u.find(B=>w.toLowerCase().startsWith(B.id.toLowerCase()));return $?$.label+w.slice($.id.length):w},"displayId"),p=[eD];a&&p.push(ue().staged.testsSourcePullRequest(Nt(a)),"");for(let w of wW(e))p.push(w,"");s&&p.push(CW(s),""),e.notTranslated&&p.push(to(ue().staged.notTranslated,e.notTranslated),"");let f=o(w=>{i?p.push("<details>",`<summary>${w}</summary>`,""):p.push(`### ${w}`)},"sectionStart"),A=o(()=>{i&&p.push("","</details>"),p.push("")},"sectionEnd");for(let w of e.businessCaseAnalysis.trim().split(/\r?\n/))p.push(`> ${w}`);if(p.push(""),wg(e)&&p.push(ue().staged.noLiveApp(Fl(e.newTestsCreated)),""),c&&e.newTestsCreated.length){let w=new Map;for(let B of e.newTestsCreated){if(B.testType!=="unit")continue;let Z=Y0(B)[0],ie=w.get(B.fileName)??{functions:new Set,endpoints:[],descriptions:new Map};B.endpoint&&!ie.endpoints.includes(B.endpoint)&&ie.endpoints.push(B.endpoint);let H=B.description?.trim()??"",me=ie.descriptions.get(Z)??[];me.includes(H)||me.push(H),ie.functions.add(Z),ie.descriptions.set(Z,me),w.set(B.fileName,ie)}let $=e.newTestsCreated.filter(B=>B.testType!=="unit");f(ue().testRecommendationsImplementedHeader(Fl(e.newTestsCreated),$.length+Fl(e.newTestsCreated.filter(B=>B.testType==="unit"))));for(let[B,{functions:Z,endpoints:ie,descriptions:H}]of w){let me=Z.size;p.push(ue().staged.unitTestsInFile(`\`${B}\``,me,ie.map(Ie=>`\`${Ie}\``).join(", ")),"");let _e=new Map;for(let[Ie,K]of H){let V=K.join("\0"),Me=_e.get(V)??{fns:[],descriptions:K};Me.fns.push(Ie),_e.set(V,Me)}let Ue=0;for(let{fns:Ie,descriptions:K}of _e.values()){p.push(`${++Ue}. ${Ie.map(Me=>`\`${Me}\``).join(", ")}`);let V=[...new Set(K.flatMap(Me=>$be(Me)))];for(let Me of V)p.push(` - ${Me}`)}p.push("")}for(let B of $){let Z=B.testId?Nt(l(B.testId)):Ib(B.testType),ie=B.fileName?` (\`${B.fileName}\`)`:"",H=B.endpoint?`
269
269
  \`${B.endpoint}\``:"",me=B.description?`
270
270
  ${B.description.trim()}`:"";p.push(`- ${Z}${ie}${wb(B.pullRequests)}${H}${me}`)}A()}let h=(e.testMaintenance??[]).filter(w=>tD.has(w.action));if(c&&h.length){f(ue().staged.testMaintenanceHeader),p.push(ue().maintenanceTableHeader),p.push("|-----------|----------|------|--------|--------|-------|");for(let w of h)p.push(`| ${tt(Ib(w.testType))} | ${tt(w.endpoint)} | \`${tt(w.fileName)}\` | ${tt(w.description)} | ${fW(w.beforeStatus,w.beforeDetails)} | ${fW(w.afterStatus,w.afterDetails)} |`);A()}let m=o(w=>w.startsWith(Eg)||w.includes(bg),"hasDeclineNote"),E=(e.testMaintenance??[]).filter(w=>m(w.afterDetails)&&(!tD.has(w.action)||!EW.has(w.afterStatus??"")));if(c&&E.length){f(ue().staged.declinedMaintenanceHeader);for(let w of E)p.push(`- \`${tt(w.fileName)}\`: ${tt(bW(w.afterDetails))}`);A()}if(c&&r.length){f(ue().staged.existingEvidenceHeader);let w=new Map;for(let $ of r){let B=`${$.check}\0${$.url??""}\0${$.revision??""}`;w.set(B,[...w.get(B)??[],$])}for(let[,[$,...B]]of w){let Z=$.url?`[${Nt($.check)}](${$.url})`:Nt($.check);p.push(ue().staged.trustedCheckPassed(Z,$.revision?Nt($.revision.slice(0,7)):""),"");for(let ie of[$,...B])p.push(`- ${Nt(ie.behavior)}`);p.push("")}A()}if(c&&e.testResults.length){f(ue().staged.testResultsHeader);let w=Qbe(e),$=w.some(H=>H.test),B=w.some(H=>rD(e,H)),Z=$?ue().staged.unitResultsTableHeader:ue().staged.resultsTableHeader;p.push(B?`${Z} ${ue().columnVideo} |`:Z),p.push(`${$?"|---------|-----------|----------|------|-------|--------|---------|":"|---------|-----------|----------|--------|---------|"}${B?"-------|":""}`);for(let H of w){let me=H.details.replace(/(\S+\.(?:py|ts|js|spec\.\w+))/gi,"`$1`"),_e=H.testId?Nt(tt(l(H.testId))):"\u2014",Ue=$?` ${H.test?`\`${tt(H.test)}\``:""} | ${H.cases??""} |`:"",Ie=rD(e,H),K=B?` ${Ie?ue().videoDownloadLink(Ie):"\u2014"} |`:"";p.push(`| ${_e} | ${tt(Ib(H.testType))} | ${tt(H.endpoint)} |${Ue} ${tt(nD(H.status))} | ${tt(me)} |${K}`)}let ie=(e.testVideos??[]).find(H=>H.artifactsUrl)?.artifactsUrl;!B&&ie&&p.push("",ue().videosArtifactFallback(ie)),A()}if(e.requirements?.length){let w=e.requirements.flatMap(H=>H.clauses),$=o(H=>H.status==="Pass"||H.status==="Passed, test not kept","passes"),B=w.filter($).length;f(ue().staged.requirementsHeader(B,w.length));let Z=o(H=>to(ue().staged.clauseStatuses,H.status),"status"),ie=o(H=>(H.status==="Not tested"||H.status==="Passed, test not kept")&&H.notTested?`${Z(H)}: ${H.notTested}`:H.findings.length?`${Z(H)} \u2014 ${H.findings.join(", ")}`:Z(H),"result");if(c){p.push(ue().staged.requirementsTableHeader),p.push("|-------------|--------|-------|--------|");for(let H of e.requirements)H.clauses.forEach((me,_e)=>{let Ue=_e===0?`**${tt(H.label)}**${H.statement?` ${tt(H.statement)}`:""}${wb(H.pullRequests)}`:"",Ie=`${Nt(tt(l(me.id)))}${pW(me)}${me.text?` ${tt(me.text)}`:""}`,K=new Map;for(let Ze of me.tests){let jt=Ze.fileName??l(Ze.testId),ct=K.get(jt)??{fns:new Set};for(let on of Ze.functions)ct.fns.add(on);ct.video??=Ze.fileName?xbe(e,Ze.fileName,Ze.repository):void 0,K.set(jt,ct)}let V=K.size?[...K].map(([Ze,{fns:jt,video:ct}])=>`${Nt(tt(Ze))}${jt.size?` \u2014 ${[...jt].map(on=>`\`${tt(on)}\``).join(", ")}`:""}${ct?` ${ue().videoDownloadLink(ct)}`:""}`).join("<br>"):"\u2014",Me=H.source==="could-break"&&me.status==="Pass"?ue().staged.regressionGuard:"";p.push(`| ${Ue} | ${Ie} | ${V} | ${tt(ie(me)+Me)} |`)})}else{p.push(ue().staged.requirementsSummaryTableHeader),p.push("|-------------|-----------------|-------------|");for(let H of e.requirements){let me=H.clauses.filter($).length,_e=H.clauses.filter(Ue=>!$(Ue)).map(Ue=>`${Nt(tt(l(Ue.id)))}${pW(Ue)} ${tt(ie(Ue))}`);p.push(`| **${tt(H.label)}**${H.statement?` ${tt(H.statement)}`:""}${wb(H.pullRequests)} | ${me}/${H.clauses.length} | ${_e.join("<br>")||"\u2014"} |`)}}A()}if(c&&e.changes?.length&&!e.requirements?.length){let w=e.executionCoverage,$=w?ue().staged.coverageCaption(w.generated,w.modified,w.verified,w.executed):"";f(`${ue().staged.behaviourCoverageHeader}${$}`),p.push(ue().staged.coverageTableHeader),p.push("|-----------|--------|-----------|----------------|");for(let B of e.changes){let Z=B.testedBy.length?B.testedBy.map(H=>`\`${tt(H)}\``).join(", "):B.writtenBy.length?ue().staged.writtenNotRun:"\u2014",ie=B.maintainedBy.length?B.maintainedBy.map(H=>`\`${tt(H)}\``).join(", "):"\u2014";p.push(`| ${tt(B.text)} | \`${tt(B.source)}\` | ${Z} | ${ie} |`)}A()}if(e.userJourneys?.length){let w=e.userJourneys.filter(B=>B.status==="Pass"&&!B.problems.length).length;f(`\u{1F9ED} User Journeys Covered (${w}/${e.userJourneys.length} walked end to end)`);let $=e.userJourneys.some(B=>iD(e,B.fileName));p.push(`| Journey | Test | Status | Notes |${$?` ${ue().columnVideo} |`:""}`),p.push(`|---------|------|--------|-------|${$?"-------|":""}`);for(let B of e.userJourneys){let Z=B.fileName?`\`${tt(B.fileName)}\`${B.test?` \u2014 ${tt(B.test)}`:""}`:"\u2014",ie=B.source&&B.source!=="inferred"?`; described in the ${B.source==="spec"?"spec":"PR description"}`:"; inferred from the app",H=(B.uncovered?`not covered: ${B.uncovered}`:B.problems.length?`does not walk it end to end: ${B.problems.join("; ")}`:`from ${B.entry}, ${B.steps} steps`)+ie,me=$?iD(e,B.fileName):void 0;p.push(`| ${tt(B.name)} | ${Z} | ${tt(B.status)} | ${tt(H)} |${$?` ${me?ue().videoDownloadLink(me):"\u2014"} |`:""}`)}A()}let b=e.issuesFound.filter(w=>!gW(w)).sort(AW),v=e.issuesFound.filter(gW).sort(AW);if(b.length){f(ue().staged.issuesFoundHeader);for(let w of b)p.push(hW(w));A()}if(v.length){p.push(`### ${ue().configErrorsHeader}`);for(let w of v)p.push(hW(w));p.push("")}let I=e.testPackages??[],C=e.dependencyChanges??[];if(I.length){p.push(ue().staged.testPackagesHeader,"");for(let w of I)p.push(`- ${ue().staged.testPackageLine(w.directory,w.entrypoint,Object.entries(w.dependencies??{}).map(([$,B])=>w.runner==="pytest"?`${$}==${B}`:`${$}@${B}`).join(", "))}`);C.length||p.push(`- ${ue().staged.appManifestsUntouched}`),p.push("")}if(C.length){p.push(ue().staged.dependencyChangesHeader,"");for(let w of C)p.push(`- ${ue().staged.dependencyChangeLine(w.package,w.repository?`${w.repository}: ${w.manifest}`:w.manifest,(w.reason??"").replace(/\s+/g," ").trim())}`);p.push("")}let x=(e.caveats??[]).filter(w=>w.kind!=="tests-not-executed"||w.subject==="written-cases"||!wg(e));if(x.length){p.push(ue().staged.caveatsHeader,"");for(let w of x)p.push(`- ${w.text}`);p.push("")}if(e.nextSteps.length){p.push(ue().nextStepsHeader,"");for(let w of e.nextSteps)p.push(`- ${w.trim()}`);p.push("")}return p.join(`
271
271
  `).replace(/\n{3,}/g,`
@@ -281,7 +281,7 @@ else require("node:test").test(spec.name, () => { throw new Error("required shar
281
281
  `;return $.length<=i?$:[eD,...l,...c,n.filesChanged].join(`
282
282
 
283
283
  `)+`
284
- `}o(Obe,"renderTestsPrBody");var Mo=ee(require("fs")),sD=ee(require("path"));var Lbe="report.json",jbe="report-display.json",S8e={en:"English",ja:"Japanese"};function kW(e){let t=sD.join(e,jbe);if(Mo.existsSync(t))try{return JSON.parse(Mo.readFileSync(t,"utf-8"))}catch{}let n=sD.join(e,Lbe);return Mo.existsSync(n)?JSON.parse(Mo.readFileSync(n,"utf-8")):void 0}o(kW,"readDisplayReport");function BW(e,t){return t?`<!-- skyramp-testbot-run: ${t} -->
284
+ `}o(Obe,"renderTestsPrBody");var Mo=ee(require("fs")),sD=ee(require("path"));var Lbe="report.json",jbe="report-display.json",B8e={en:"English",ja:"Japanese"};function kW(e){let t=sD.join(e,jbe);if(Mo.existsSync(t))try{return JSON.parse(Mo.readFileSync(t,"utf-8"))}catch{}let n=sD.join(e,Lbe);return Mo.existsSync(n)?JSON.parse(Mo.readFileSync(n,"utf-8")):void 0}o(kW,"readDisplayReport");function BW(e,t){return t?`<!-- skyramp-testbot-run: ${t} -->
285
285
  ${e}`:e}o(BW,"withRunMarker");var gc=ee(require("fs")),fc=ee(require("path"));var Cb=["build","chore","ci","docs","feat","fix","perf","refactor","revert","style","test"],Vbe=["build","ci","docs","feat","fix","perf","refactor","revert","style","test"],zbe="amannn/action-semantic-pull-request",ur=o(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj");function RW(e){return typeof e!="string"?!1:e.split("@")[0].split("/").some(n=>n.toLowerCase().split(/[-_.]/).includes("dco"))}o(RW,"usesDco");function xW(e){return typeof e=="string"&&(/\bdco-check\b/.test(e)||/signed-off-by/i.test(e))}o(xW,"scriptChecksDco");function qbe(e){if(!ur(e)||!ur(e.jobs))return!1;for(let t of Object.values(e.jobs))if(ur(t)){if(RW(t.uses))return!0;if(Array.isArray(t.steps)){for(let n of t.steps)if(ur(n)&&(RW(n.uses)||xW(n.run)||ur(n.with)&&Object.values(n.with).some(xW)))return!0}}return!1}o(qbe,"workflowChecksDco");function DW(e){let t=fc.join(e,".github","workflows"),n;try{n=gc.readdirSync(t).filter(i=>/\.ya?ml$/i.test(i)).sort()}catch{return[]}return n.flatMap(i=>{try{return[{file:fc.join(".github","workflows",i),doc:Ro(gc.readFileSync(fc.join(t,i),"utf-8"))}]}catch{return[]}})}o(DW,"workflows");function Hbe(e){return!ur(e)||!ur(e.jobs)?[]:Object.values(e.jobs).flatMap(t=>ur(t)&&Array.isArray(t.steps)?t.steps.filter(ur):[])}o(Hbe,"steps");function Jbe(e){let t=fc.join(".github","dco.yml");if(gc.existsSync(fc.join(e,t)))return{file:t};let n=DW(e).find(i=>qbe(i.doc));return n&&{file:n.file}}o(Jbe,"signOffRule");var QW=o(e=>typeof e=="string"?e.split(/\r?\n/).map(t=>t.trim()).filter(Boolean):void 0,"inputList");function Ybe(e){for(let t of DW(e)){let n=Hbe(t.doc).find(s=>typeof s.uses=="string"&&s.uses.split("@")[0].trim().toLowerCase()===zbe);if(!n)continue;let i=ur(n.with)?n.with:{},r=QW(i.scopes);return{file:t.file,types:QW(i.types)??Cb,...r?.length?{scopes:r}:{},scopeRequired:i.requireScope===!0||String(i.requireScope).trim()==="true"}}}o(Ybe,"semanticPrTitleRule");var Wbe=["package.json",".commitlintrc",".commitlintrc.json",".commitlintrc.yaml",".commitlintrc.yml",".commitlintrc.js",".commitlintrc.cjs",".commitlintrc.mjs",".commitlintrc.ts",".commitlintrc.cts","commitlint.config.js","commitlint.config.cjs","commitlint.config.mjs","commitlint.config.ts","commitlint.config.cts","commitlint.config.mts"],Zbe=["type-enum","scope-enum","scope-empty","subject-case","header-max-length","body-max-line-length"];function _W(e){let t=[];for(let n of e)n==="@commitlint/config-conventional"||n==="@commitlint/config-angular"?t.push(n):t.length=0;return t}o(_W,"knownPresets");var Kbe={Disabled:"0",Warning:"1",Error:"2"};function Xbe(e){return e.replace(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`|\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g,t=>t.startsWith("/")?t.replace(/[^\r\n]/g," "):t)}o(Xbe,"withoutComments");function $W(e,t){let n=new RegExp(`["']?${t}["']?\\s*:\\s*`).exec(e);if(!n)return;let i=n.index+n[0].length;if(e[i]!=="[")return null;let r=0;for(let s=i;s<e.length;s++)if(e[s]==="[")r++;else if(e[s]==="]"&&--r===0){if(!/^\s*(?:as\s+const\s*)?(?:[,}]|$)/.test(e.slice(s+1)))return null;let a=e.slice(i,s+1).replace(/\bRuleConfigSeverity\.(\w+)/g,(u,l)=>Kbe[l]??u).replace(/,(\s*\])/g,"$1"),c=a.replace(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g,'""');try{return JSON.parse(c),Ro(a)}catch{return null}}}o($W,"ruleFromSource");var NW=o(e=>Object.fromEntries(Zbe.map(t=>[t,e(t)])),"pickRules");function TW(e,t){if(!ur(t))return;let n=[].concat(t.extends??[]),i=ur(t.rules)?t.rules:{};return{file:e,presets:_W(n),rules:NW(r=>i[r])}}o(TW,"configFromObject");function eve(e){for(let t of Wbe){let n;try{n=gc.readFileSync(fc.join(e,t),"utf-8")}catch{continue}if(/\.[cm]?[jt]s$/.test(t)){let r=Xbe(n),s=/(?:^|[,{])\s*["']?extends["']?\s*:\s*/.exec(r),a=s?$W(r.slice(s.index),"extends"):void 0,c=s?/^(["'])([^"']+)\1\s*(?:[,}]|$)/.exec(r.slice(s.index+s[0].length))?.[2]:void 0,u=Array.isArray(a)?a:c?[c]:[];return{file:t,presets:_W(u),rules:NW(l=>$W(r,l))}}let i;try{i=Ro(n)}catch{return}if(t!=="package.json")return TW(t,i);if(ur(i)&&ur(i.commitlint))return TW(t,i.commitlint)}}o(eve,"commitlintConfig");function Ol(e){if(!Array.isArray(e))return;let t=Number(e[0]);if(t===1||t===2)return[String(e[1]??"always"),e[2]]}o(Ol,"ruleWhenOn");var oD=o(e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?e:void 0,"stringList");function tve(e,t){if(!e)return t?"not-capitalized":void 0;let[n,i]=e,r=typeof i=="string"?[i]:oD(i)??[];if(n==="always"&&r.length===1&&r[0]==="lower-case")return"lower-case";if(n==="always"&&r.length===1&&r[0]==="sentence-case")return"sentence-case";if(n==="never"&&r.some(s=>["sentence-case","start-case","pascal-case","upper-case"].includes(s)))return"not-capitalized"}o(tve,"subjectCaseOf");function nve(e){let t=eve(e);if(!t)return;let{file:n,rules:i}=t,r=t.presets.at(-1)==="@commitlint/config-angular",s=o(b=>t.presets.length>0&&i[b]===void 0,"preset"),a=Ol(i["type-enum"]),c=a?.[0]==="always"?oD(a[1]):s("type-enum")?r?Vbe:Cb:void 0,u=c===void 0,l=c??Cb;u&&console.warn(`[commit-rules] ${n}: allowed commit types could not be read; using a conventional header fallback. Additional preset rules may still reject it.`);let p=Ol(i["scope-enum"]),f=p?.[0]==="always"?oD(p[1]):void 0,A=o((b,v)=>{let I=Ol(i[b]);return I?typeof I[1]=="number"?I[1]:void 0:s(b)?v:void 0},"limit"),h=tve(Ol(i["subject-case"]),s("subject-case")),m=A("header-max-length",r?72:100)??(u&&i["header-max-length"]===void 0?Qs:void 0),E=A("body-max-line-length",t.presets.includes("@commitlint/config-conventional")?100:void 0);return{file:n,types:l,...u?{typesFromFallback:!0}:{},...u&&!h&&i["subject-case"]===void 0?{fallbackSubjectCase:"not-capitalized"}:{},...f?.length?{scopes:f}:{},scopeRequired:Ol(i["scope-empty"])?.[0]==="never",...Ol(i["scope-empty"])?.[0]==="always"?{scopeForbidden:!0}:{},...h?{subjectCase:h}:{},...m?{headerMaxLength:m}:{},...E?{bodyMaxLineLength:E}:{}}}o(nve,"commitlintRule");function PW(e){let t=Jbe(e),n=nve(e),i=Ybe(e);return{...t?{signOff:t}:{},...n?{commitlint:n}:{},...i?{prTitle:i}:{}}}o(PW,"readCommitRules");function rve(e){let t=[e.commitlint,e.prTitle].filter(a=>!!a);if(!t.length)return;let n=t.map(a=>a.types).reduce((a,c)=>a.filter(u=>c.includes(u)));n.length||console.warn(`[commit-rules] ${t.map(a=>a.file).join(", ")}: no common commit type; using ${t[0].types.join(", ")} from ${t[0].file}. This may fail another rule.`);let i=t.map(a=>a.subjectCase),r=i.includes("lower-case")?"lower-case":i.find(a=>a!==void 0)??t.find(a=>a.fallbackSubjectCase)?.fallbackSubjectCase,s=Math.min(...t.map(a=>a.bodyMaxLineLength??1/0));return{rules:t,types:n.length?n:t[0].types,scopeRequired:t.some(a=>a.scopeRequired),...r?{subjectCase:r}:{},headerMaxLength:Math.min(Qs,...t.map(a=>a.headerMaxLength??1/0)),...Number.isFinite(s)?{bodyMaxLineLength:s}:{}}}o(rve,"mergedHeaderRules");function Sb(e,t){return e.scopeForbidden?!1:e.scopes?e.scopes.some(n=>{if(n===t)return!0;try{return new RegExp(`^(?:${n})$`).test(t)}catch{return!1}}):!0}o(Sb,"allowsScope");function ive(e,t){let n=e.find(s=>s.scopes)?.scopes??[],i=n.filter(s=>/^[\w./-]+$/.test(s)&&e.every(a=>Sb(a,s)));if(!i.length)return e.every(s=>Sb(s,"tests"))||console.warn(`[commit-rules] ${e.map(s=>s.file).join(", ")}: no usable required scope; using tests, which may fail the declared scope rules (${n.join(", ")}).`),"tests";let r=o(s=>t.some(a=>a.startsWith(`${s}/`)||a.split("/").slice(0,-1).includes(s)),"under");return[...i].filter(r).sort((s,a)=>a.length-s.length)[0]??i[0]}o(ive,"pickScope");var UW=/^([A-Za-z][\w-]*)(?:\(([^)]*)\))?!?:\s*(.*)$/,sve=o(e=>e.split(/(`.*?`|".*?"|'.*?')/).map((t,n)=>n%2?t:t.toLowerCase()).join(""),"lowerOutsideQuotes");function FW(e,t){return t==="lower-case"?sve(e):t==="sentence-case"?e.charAt(0).toUpperCase()+e.slice(1):t==="not-capitalized"&&/^[A-Z]/.test(e)?e.replace(/^\S+/,n=>n.toLowerCase()):e}o(FW,"withSubjectCase");function ove(e,t){return FW(e.trim().replace(/\.+$/,"").trim()||"add tests",t)}o(ove,"conformSubject");function OW(e,t){let[n,...i]=e.replace(/\s+$/,"").split(`
286
286
  `),r=UW.exec(n);return[t.commitlint,t.prTitle].every(s=>{if(!s)return!0;if(!s.typesFromFallback&&(!r||!s.types.includes(r[1]))||s.headerMaxLength&&n.length>s.headerMaxLength)return!1;let a=s.bodyMaxLineLength;if(a&&i.some(u=>u.length>a&&!/\bhttps?:\/\/\S+/.test(u)))return!1;let c=r?.[2];if(s.scopeRequired&&!c||c&&!Sb(s,c)||r&&!r[3].trim())return!1;if(s.subjectCase){if(!r)return!1;let u=r[3],l=u.replace(/`.*?`|".*?"|'.*?'/g,"").trim();if(/^[\p{Ll}\p{Lu}\p{Lt}]/u.test(u)&&!/^\d/.test(l)&&FW(l,s.subjectCase)!==l)return!1}return!0})}o(OW,"matchesCommitRules");function ave(e,t){if(e.length<=t)return e;let n=e.slice(0,t-1),i=n.lastIndexOf(" ");return`${(i>0?n.slice(0,i):n).replace(/[\s.,;:]+$/,"")}\u2026`}o(ave,"fitSubject");function cve(e,t){if(e.length<=t)return[e];let n=/^\s*/.exec(e)?.[0]??"",i=[],r="";for(let s of e.trim().split(/\s+/))r&&r.length+1+s.length>t?(i.push(r),r=n+s):r?r=`${r} ${s}`:r=n+s;return r&&i.push(r),i}o(cve,"wrap");function MW(e,t,n){let i=rve(t);if(!i)return e;let[r,...s]=e.replace(/\s+$/,"").split(`
287
287
  `),a=UW.exec(r.trim()),c=a&&[...Cb,...i.types].some(I=>I.toLowerCase()===a[1].toLowerCase())?a:null,u=c?.[1].toLowerCase(),l=c?c[3]:r.replace(/^\s*Skyramp Testbot:\s*/i,""),p=c?.[2]?.trim()||void 0;p&&t.commitlint&&!t.commitlint.scopes&&(p=p.toLowerCase());let f=[u,"test","chore"].find(I=>!!I&&i.types.includes(I))??i.types[0],A=p&&i.rules.every(I=>Sb(I,p))?p:void 0;!A&&i.scopeRequired&&(A=ive(i.rules,n));let h=A?`${f}(${A}): `:`${f}: `,m=h+ave(ove(l,i.subjectCase),i.headerMaxLength-h.length),E=s.join(`
@@ -297,7 +297,7 @@ ${n}`}o(kb,"withSignOff");function LW(e){let t=[],n=!1;for(let i of e.split(`
297
297
  `))/^\s*signed-off-by:/i.test(i)?n=!0:n&&i.trim()===""&&t.at(-1)?.trim()===""||(t.push(i),n=!1);return t.join(`
298
298
  `).replace(/\s+$/,"")}o(LW,"withoutSignOff");function aD(e){let t=/\b(claude|anthropic)\b/i;return e.split(`
299
299
  `).filter(i=>{let r=i.trim();return!(/^co-authored-by:/i.test(r)&&t.test(r))&&!(/^[^\w\s]*\s*generated (?:with|by) /i.test(r)&&t.test(r))}).join(`
300
- `).replace(/\s+$/,"")}o(aD,"stripAgentAttribution");var Bb="Skyramp-Pull-Request",Ml="Skyramp-Delivery-Base",cD="Skyramp-Tested-Revision",uD="Skyramp-Delivery-Run";var G8e=["%H","%P","%an","%ae","%ce",`%(trailers:key=${Bb},valueonly,separator=%x2C)`,"%s",`%(trailers:key=${Ml},valueonly,separator=%x2C)`,`%(trailers:key=${cD},valueonly,separator=%x2C)`,`%(trailers:key=${uD},valueonly,separator=%x2C)`];function jW(e,t){let n=e(["log","-1","--format=%B"]);if(!n.includes(`${Bb}:`)&&!n.includes(`${Ml}:`))return;let i=n.split(`
300
+ `).replace(/\s+$/,"")}o(aD,"stripAgentAttribution");var Bb="Skyramp-Pull-Request",Ml="Skyramp-Delivery-Base",cD="Skyramp-Tested-Revision",uD="Skyramp-Delivery-Run";var z8e=["%H","%P","%an","%ae","%ce",`%(trailers:key=${Bb},valueonly,separator=%x2C)`,"%s",`%(trailers:key=${Ml},valueonly,separator=%x2C)`,`%(trailers:key=${cD},valueonly,separator=%x2C)`,`%(trailers:key=${uD},valueonly,separator=%x2C)`];function jW(e,t){let n=e(["log","-1","--format=%B"]);if(!n.includes(`${Bb}:`)&&!n.includes(`${Ml}:`))return;let i=n.split(`
301
301
  `).filter(a=>!a.startsWith(`${Ml}:`)).join(`
302
302
  `).trimEnd(),r=t?`${i}
303
303
  ${Ml}: ${t}`:i;e(["log","-1","--format=%(trailers:key=Signed-off-by,valueonly)"]).split(`
@@ -316,7 +316,7 @@ ${n}`}:{prFailure:"unknown",prDetail:t}}o(kve,"thrownFailure");async function Bv
316
316
  `}catch{return""}}o($ve,"heldBackPatch");var YW=o(e=>e.map(t=>t.dependsOn.length?`${t.file} (needs ${t.dependsOn.join(", ")})`:t.file).join("; "),"heldBackText");async function Tve(e,t,n,i,r,s){let a=A0(i.path,e.runDir),c=process.env.PATH;a.dir&&(process.env.PATH=VJ(a).PATH);try{return await Dve(e,t,n,i,r,s)}finally{a.dir&&(process.env.PATH=c),a.cleanup()}}o(Tve,"deliverOne");async function Dve(e,t,n,i,r,s){let a=i.slug,c,u=!1,l,p=[];try{let f=i.path,A=await Bve(e,t,n,i,r,s),{texts:h,shown:m,title:E,bot:b,remote:v,base:I,owner:C,testsBranch:x,origin:w,mergedBase:$}=A,B=o((ne=[])=>aD(BW(Eve(ne,I)+SW(yve(mve(m,e,i),ne.map(At=>At.file)),{audience:"testbot-pr",runUrl:e.inputs.skyrampRunUrl,requestedBy:e.inputs.requestedBy,sourcePullRequest:w&&`${w.repository.namespace}/${w.repository.name}#${w.number}`}),e.inputs.skyrampRunUrl))+`
317
317
  `,"bodyOf"),Z=s?"pr-body.md":`pr-body-${qW(a)}.md`,ie=bi.join(e.outputsDir,Z);sn.writeFileSync(ie,B());let H=nt(f,["rev-parse","HEAD"]),me=$??H;nt(f,["checkout","-B",x]),c=x,nt(f,["reset"]);let _e=ve(e,"write.json"),Ue=mg(e,_e),Ie=Ue.assemblies.filter(ne=>ne.source.path===i.path&&r.includes(ne.record.sourceAsset)),K=K0(e,Ue);if(K.length)throw new Error(K.join("; "));let V=_e?uW(e,_e,h):[];if(V.length)throw new Error(V.join("; "));let Me=new Set(Ie.flatMap(({record:ne})=>[ne.sourceAsset,...ne.entry?[ne.entry]:[]]));for(let ne of r)Me.has(ne)||hve(bi.join(f,ne),h);let Ze=JY(e,Ie,h,p);if(Ze.length)throw new Error(Ze.join("; "));let jt=new Map([...Me].map(ne=>{let At=sn.readFileSync(bi.join(f,ne)),Le=o(Ac=>nt(f,["hash-object","--no-filters","--stdin"],Ac),"blobHash"),Et=new Set([Le(At)]),Qr=At.toString("latin1");return!At.includes(0)&&Qr.includes(`\r
318
318
  `)&&Et.add(Le(Buffer.from(Qr.replace(/\r\n/g,`
319
- `),"latin1"))),[ne,Et]})),ct=[];for(let ne of r)try{nt(f,["--literal-pathspecs","add","--",ne])}catch{ct.push(ne)}if(ct.some(ne=>Me.has(ne)))throw new Error("could not stage every guarded delivery file");let on=new Map([...jt].map(([ne,At])=>{let Le=nt(f,["--literal-pathspecs","ls-files","--stage","--",ne]),Et=/^100(?:644|755) ([a-f0-9]+) 0\t/.exec(Le)?.[1];if(!Et||!At.has(Et))throw new Error(`the staged guarded file differs from the generated file: ${ne}`);return[ne,Et]}));try{nt(f,["diff","--cached","--quiet"])}catch{try{let ne=Rve(f,A,H,me,e.inputs.skyrampRunUrl);nt(f,["-c",`user.name=${b.name}`,"-c",`user.email=${b.email}`,"commit","-m",ne])}catch(ne){throw new Rb(ne)}u=!0}u&&(p.length=0),l=nt(f,["rev-parse","HEAD"]);let Bt,Xe,yn,gt=$??s?.headSha;if(u&&gt&&gt!==H){let ne=!1,At=l;try{nt(f,["checkout","-q","-B",c,gt]),ne=!0;try{nt(f,["-c",`user.name=${b.name}`,"-c",`user.email=${b.email}`,"cherry-pick","--keep-redundant-commits",l])}catch(Le){let Et=$?Qve(f,b,At):void 0;if(!Et||(Xe=Et.files.map(Qr=>({file:Qr,dependsOn:xve(f,a,$,H,Qr)})),yn={repository:a,base:I,files:Xe,patch:$ve(f,H,At,Et.files)},!Et.delivered))throw Le}ne=!1,jW(Le=>nt(f,Le),gt),l=nt(f,["rev-parse","HEAD"])}catch(Le){try{nt(f,["cherry-pick","--abort"])}catch{}nt(f,["checkout","-q","-B",c,l]);let Et=sp(ha(Le),1/0);if($&&!ne)throw Le;if($)return{thrown:!1,held:yn,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:I,committed:u,commitSha:l,pushed:!1,prAction:"skipped",prTitle:E,unstaged:ct,...Xe?{heldBack:Xe}:{},reason:Xe?`every test change needs a merged revision ${I} does not have yet, so no tests PR was opened: ${YW(Xe)}`:`the tests do not apply to ${I} at ${$.slice(0,12)} without the merged revisions (${Et}), so no tests PR was opened`}};Bt=`tests committed on the checkout's merge commit (re-cut onto ${gt.slice(0,12)} failed: ${Et})`}}Xe&&sn.writeFileSync(ie,B(Xe));for(let[ne,At]of on){if(Xe?.some(Et=>Et.file===ne))continue;let Le=nt(f,["--literal-pathspecs","ls-tree",l,"--",ne]);if(/^100(?:644|755) blob ([a-f0-9]+)\t/.exec(Le)?.[1]!==At)throw new Error(`the committed guarded file differs from the generated file: ${ne}`)}for(let{record:ne}of Ie){if(ne.entry)continue;let At=nt(f,["--literal-pathspecs","ls-tree",l,"--",ne.file]);if(At&&At!==nt(f,["--literal-pathspecs","ls-tree",H,"--",ne.file]))throw new Error(`the delivery included executable source for a held test: ${ne.file}`)}let ut=s?{}:{repositoryPath:f,repoSlug:a,devPr:null};if(!u){let ne=await t.markTestsPrUnchanged({branch:c,...ut});return{thrown:!1,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:I,committed:!1,commitSha:l,pushed:!1,prAction:ne.action==="unchanged"?"unchanged":"skipped",prUrl:ne.url,prTitle:E,unstaged:ct,reason:ne.action==="unchanged"?"no test changes to commit \u2014 existing tests PR annotated as unchanged":"no test changes to commit \u2014 nothing pushed, no PR opened"}}}let $e=await t.publishTestsPr({repositoryPath:f,...ut,remote:v,branch:c,base:I,commitSha:l,title:E,bodyFile:ie,mode:e.inputs.deliverMode,deliveryOwner:C,...e.inputs.firstQualification?{firstQualification:!0}:{},runUrl:e.inputs.skyrampRunUrl,signal:e.signal,deadlineMs:e.deadlineMs});return{thrown:!1,held:yn,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:$e.base,requestedBase:I,committed:u,commitSha:l,pushed:$e.pushed,...$e.pushedCommits?{pushedCommits:$e.pushedCommits}:{},...$e.deliveredCommit?{deliveredCommit:$e.deliveredCommit}:{},prAction:$e.action,...$e.retargetedAs?{retargetedAs:$e.retargetedAs}:{},prUrl:$e.url,prTitle:E,...$e.failure?{prFailure:$e.failure,prDetail:$e.detail}:{},...Bt?{cutNote:Bt}:{},...$e.action==="skipped"&&$e.detail?{reason:$e.detail}:{},unstaged:ct,...Xe?{heldBack:Xe}:{}}}}catch(f){return{thrown:!0,record:{schemaVersion:1,repository:a,branch:c,committed:u,commitSha:l,pushed:!1,prAction:"failed",...kve(f),unstaged:[]}}}finally{if(p.length){try{nt(i.path,["reset"])}catch{}for(let f of p.reverse())try{f()}catch{}}}}o(Dve,"deliverRepository");var m3e={name:"deliver",timeoutMinutes:5,execute:Ive,validateInput:o(e=>{let t=J0(e);return t?{ok:!1,reasons:[t]}:dve(e)},"validateInput"),requires:["report"],branchRequires:{runtime:["write"],"no-runtime":["generate-unit"]}};var _ve=10*6e4,Nve=4*6e4,Pve=6e4;function Uve(e,t){return e.getTime()-t.getTime()-_ve}o(Uve,"remainingBudgetMs");var WW="This attempt revoked its scoped GitHub credentials; it mints no more.";var Fve=10*6e4;var Ove=o(e=>!!e&&Object.keys(e).length===1&&e.contents==="read","onlyReads"),Mve=3e4,Lve=3,ZW=30,vi=class extends Error{constructor(n,i,r,s){super(n);this.status=i;this.code=r;this.path=s}status;code;path;static{o(this,"AppRefusal")}},Wi=class extends Error{static{o(this,"AppUnreachable")}},Ll=class extends Wi{static{o(this,"AppNotReady")}},pD=class extends Ll{static{o(this,"RunnerProviderNotReady")}};function fD(e){let t;try{t=new URL(e)}catch{throw new Error(`skyrampAppOrigin "${e}" is not a URL`)}if(t.protocol!=="https:"||t.origin!==e.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${e}"`);return t.origin}o(fD,"appOrigin");function e4(e,t){if(!Du.test(e))throw new Error(`The ${t} "${e}" is not a uuid`);return e}o(e4,"routeId");function t4(e,t,n,i){throw t<500&&t!==429?new vi(e,t,n,i):t===503&&n==="RUNNER_PROVIDER_NOT_READY"?new pD(e):t===503&&n==="RUN_NOT_READY"?new Ll(e):new Wi(e)}o(t4,"refusedOrUnreachable");async function n4(e,t,n,i,r,s=1/0){let a=fD(e.origin),c=`The time limit for ${t} ${n} to the Skyramp web app was reached`,u,l=0;for(let p=1;p<=Lve||u instanceof Ll;p+=1){if(u instanceof Ll){if(l===ZW)throw u;l+=1,p-=1,e.log?.(`${u.message}; trying again (${l} of ${ZW}).`),await new Promise(f=>setTimeout(f,Math.max(0,Math.min(e.readyWaitMs??1e4,s-Date.now()))))}else p>1&&await new Promise(f=>setTimeout(f,Math.max(0,Math.min((e.retryDelayMs??2e3)*(p-1),s-Date.now()))));if(Date.now()>=s)throw new Wi(c);try{let f,A=await(Number.isFinite(s)?Promise.race([e.idToken(a),new Promise((m,E)=>{f=setTimeout(()=>E(new Wi(c)),Math.max(1,s-Date.now()))})]).finally(()=>{f&&clearTimeout(f)}):e.idToken(a));if(Date.now()>=s)throw new Wi(c);let h=await(e.fetch??fetch)(new URL(n,a).toString(),{...i(A),redirect:"error",signal:AbortSignal.timeout(Math.max(1,Math.min(Mve,s-Date.now())))}).catch(m=>{let E=m instanceof Error?m.message:String(m);throw new Wi(`The Skyramp web app did not answer ${t} ${n}: ${E}`,{cause:m})});return await r(h)}catch(f){if(f instanceof vi||Date.now()>=s)throw f;u=f}}throw u}o(n4,"callWithRetries");function r4(e,t,n,i,r){let s=i.headers.get("cf-ray");e.log?.(`Testbot V3: the Skyramp web app answered ${t} ${n} with ${i.status}${s?`, cf-ray ${s}`:""}: ${r.replace(/\s+/g," ").slice(0,200)}`)}o(r4,"logRefusal");var Sg=class extends Error{static{o(this,"ReportUploadSizeError")}};function i4(e){let t=Buffer.byteLength(e,"utf8");if(t<=eS)return{body:e};if(t>q1)throw new Sg("The report exceeds the Skyramp web app's 16 MiB expanded report limit");let n=new Uint8Array((0,XW.gzipSync)(e));if(n.length>eS)throw new Sg("The compressed report exceeds the Skyramp web app's 1 MiB report upload limit");return{body:n,gzip:!0}}o(i4,"encodeReportUpload");function gD(e,t,n,i,r){let s=t==="GET"?void 0:JSON.stringify(i),a=t==="PUT"&&/^\/api\/v1\/runner\/attempts\/[^/]+\/report$/.test(n)&&s!==void 0?i4(s):{body:s};return s4(e,t,n,a,r)}o(gD,"callApp");function s4(e,t,n,i,r){return n4(e,t,n,o(a=>({method:t,headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json",...i.gzip?{"Content-Encoding":"gzip"}:{}},body:i.body}),"request"),async a=>{let c=await a.text().catch(()=>""),u={};try{u=JSON.parse(c)}catch{}if(a.ok)return u.data;r4(e,t,n,a,c);let l=u.error?.fields,p=typeof l?.path=="string"&&typeof l.reason=="string"?` at ${l.path}: ${l.reason}`:"",f=`The Skyramp web app refused ${t} ${n}: ${a.status} ${u.error?.code??"no error code"}${p}`;return t4(f,a.status,u.error?.code,typeof l?.path=="string"?l.path:void 0)},r)}o(s4,"callEncodedApp");function jve(e,t,n){return n4(e,"GET",t,o(r=>({method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"application/octet-stream"}}),"request"),async r=>{if(!r.ok)return r4(e,"GET",t,r,await r.text().catch(()=>"")),t4(`The Skyramp web app refused GET ${t}: ${r.status}`,r.status);let s=Buffer.from(await r.arrayBuffer());if(s.length>n)throw new vi(`The Skyramp web app answered GET ${t} with more than ${n} bytes`,r.status);return s})}o(jve,"callAppBytes");var kg=class{constructor(t,n,i,r,s,a,c,u,l,p=[],f=[],A,h=!1,m=!1){this.attemptId=t;this.attemptNumber=n;this.deadlineAt=i;this.manifest=r;this.deps=s;this.license=a;this.requestedBy=c;this.writeAllowed=u;this.claudeCodeVersion=l;this.deployedPins=p;this.statedPins=f;this.runSettings=A;this.credentialKinds=h;this.credentialBlockers=m}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;deployedPins;statedPins;runSettings;credentialKinds;credentialBlockers;static{o(this,"V3Attempt")}budgetMs(t,n){let i=n===void 0?void 0:Date.parse(this.manifest.trigger.requestedAt)+n*6e4;if(this.deadlineAt.getTime()!==i)return Uve(this.deadlineAt,t);let r=this.deadlineAt.getTime()-t.getTime(),s=Math.max(Pve,Math.min(Nve,r/2));return r-s}get skyrampRunUrl(){return M1(fD(this.deps.origin),this.manifest.runId)}log(t){this.deps.log?.(t)}send(t,n,i,r){return gD(this.deps,t,n,i,r)}async sendReport(t){await s4(this.deps,"PUT",`/api/v1/runner/attempts/${this.attemptId}/report`,t)}readBytes(t,n){return jve(this.deps,t,n)}issuedTokens=[];closure;modelKey;modelCredentials=[];credentials={};revocation;token(){return this.cachedToken("run")}readOnlyToken(){return this.cachedToken("read")}async cachedToken(t){if(this.revocation)throw new Error(WW);let n=(this.deps.now??(()=>new Date))().getTime(),i=this.credentials[t],r=i&&await i.catch(()=>{});if(this.credentials[t]!==i)return(await this.credentials[t]).token;if(r&&r.expiresAt-n>=Fve)return r.token;if(this.revocation)throw new Error(WW);let s=t==="read",a=s?{schemaVersion:1,access:t}:{schemaVersion:1},c=s?"read-only":"scoped",u=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,a).then(l=>{let p={...l,token:l.token??this.jobToken()};if(this.issuedTokens.push(p.token),this.deps.mask?.(p.token),p.anthropicApiKey&&this.deps.mask?.(p.anthropicApiKey),s&&l.token&&!Ove(p.permissions))throw new Error(`The Skyramp web app was asked for a read-only GitHub token, but its token grants ${JSON.stringify(p.permissions??null)}`);!s&&!r&&p.anthropicApiKey&&(this.modelKey=p.anthropicApiKey),this.deps.onTokenGranted?.(t);let f=r?"Renewed":"Received";return l.token&&this.deps.log?.(`${f} ${c} GitHub credentials; they expire at ${p.expiresAt}.`),{token:p.token,expiresAt:l.token?new Date(p.expiresAt).getTime():Number.POSITIVE_INFINITY}},l=>{if(this.deps.onTokenRefused?.(l,t),!(l instanceof vi)||l.code!=="CREDENTIALS_UNAVAILABLE")throw l;let p=o(h=>[...new Set(h.map(m=>m.namespace))].join(", "),"unique"),f=this.manifest.sources.map(h=>h.repository);if(new Set(f.map(h=>h.providerAccountId)).size>1)throw new vi(`${l.message}. The run's repositories are on more than one GitHub account (${p(f)}), which Skyramp does not support yet.`,l.status,l.code);let A=p([...f,this.manifest.execution.repository]);throw new vi(`${l.message}. Check the Skyramp GitHub App installation on ${A}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,l.status,l.code)});return this.credentials[t]=u,(await u).token}jobToken(){if(this.deps.sourceToken)return this.deps.sourceToken;throw new Error("The Skyramp web app answered the credentials request without a token, and the job gave Testbot none of its own: on Azure Pipelines, set SYSTEM_ACCESSTOKEN to $(System.AccessToken) in the Testbot step's env.")}sourceFetch(t){return t.fetch??this.deps.fetch??fetch}revokeTokens(t={}){let n=t.host??i0();return this.revocation??=n.revokeToken?this.revokeIssued(i=>n.revokeToken(i,this.sourceFetch(t))):Promise.resolve([]),this.revocation}async revokeIssued(t){let n=[...this.issuedTokens],i=Promise.all(n.map(a=>this.revokeOne(a,t)));await Promise.all(Object.values(this.credentials).map(a=>a.catch(()=>{})));let r=this.issuedTokens.filter(a=>!n.includes(a));return[...await i,...await Promise.all(r.map(a=>this.revokeOne(a,t)))].filter(a=>a!==void 0)}async revokeOne(t,n){try{await n(t);return}catch(i){return`token ${this.issuedTokens.indexOf(t)+1} of ${this.issuedTokens.length}: ${i instanceof Error?i.message:String(i)}`}}};async function o4(e,t,n){e4(e,"run id"),fD(n.origin);let i={statedPins:!0,credentialKinds:!0,credentialBlockers:!0},r=sS(e,t,i),s=`/api/v1/runner/runs/${e}/attempts`,a;for(;;)try{a=await gD(n,"POST",s,r);break}catch(p){let f=p instanceof vi&&p.status===400?Gve(p,i):void 0;if(!f)throw p;i[f]=!1,r=sS(e,t,i)}let c=fG(a);if(c.manifest.runId!==e)throw new Error(`The Skyramp web app answered the handshake of run ${e} with the manifest of another run (${c.manifest.runId})`);let u=c.manifest.sources.find(p=>p.repository.provider!==r.execution.provider);if(u)throw new Error(`The manifest of run ${e} names ${u.repository.namespace}/${u.repository.name} on ${u.repository.provider}, but this job runs on ${r.execution.provider}`);Vve(c.manifest,[...c.deployedRevisions??[],...c.statedRevisions??[]]),c.runToken&&n.mask?.(c.runToken);let l=c.runToken?{entitlements:c.entitlements??[],runToken:c.runToken}:void 0;return new kg(c.attempt.id,c.attempt.number,new Date(c.attempt.deadlineAt),c.manifest,n,l,c.requestedBy??void 0,c.writeAllowed,c.claudeCodeVersion??void 0,c.deployedRevisions??[],c.statedRevisions??[],c.runSettings,r.credentialKinds===!0,r.credentialBlockers===!0)}o(o4,"startV3Attempt");function Gve(e,t){let n=["credentialBlockers","credentialKinds","statedPins"];return e.path===void 0?e.code==="INVALID_REQUEST"?n.find(i=>t[i]):void 0:n.find(i=>t[i]&&e.path===`$.${i}`)}o(Gve,"handshakeFieldRefused");function Vve(e,t){if(t.length===0)return;if(!X1(e))throw new Error(`The Skyramp web app pinned an attempt of a ${e.trigger.kind} run; only a scheduled run or unchosen manual run's retry is pinned to an earlier attempt's read`);let n=new Set(e.sources.map(r=>ji(r.repository))),i=new Set;for(let r of t){let s=ji(r.repository);if(!n.has(s))throw new Error(`The Skyramp web app pinned the attempt to repository ${r.repository.providerRepositoryId}, which is not a source of the run`);if(i.has(s))throw new Error(`The Skyramp web app pinned repository ${r.repository.providerRepositoryId} twice`);i.add(s)}}o(Vve,"checkAttemptPins");async function AD(e,t){return uG.parse(await e.send("POST",`/api/v1/runner/attempts/${e.attemptId}/heartbeat`,{schemaVersion:1},t))}o(AD,"heartbeatV3Attempt");async function a4(e,t=()=>new Date,n){if(e.closure)return e.closure;let i=await AD(e,n).then(r=>lG(r,t())).catch(()=>null);return i&&(e.closure=i),i}o(a4,"closedV3Attempt");var AXe=10*6e4;var hXe=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];var mXe=d.object({tests:d.object({placements:d.array(d.unknown()).optional()}).passthrough().optional()}).passthrough(),yXe=d.object({repository:KC,testType:d.string(),directory:d.string()}).passthrough();var EXe=d.object({report:d.object({language:d.string()}).passthrough()}).passthrough();var bXe=d.object({environment:d.object({components:d.array(d.unknown()).optional(),dependencies:d.array(d.unknown()).optional()}).passthrough()}).passthrough(),vXe=d.object({environment:d.object({offLimits:d.unknown().optional()}).passthrough()}).passthrough();var IXe=d.object({environment:d.object({allowedEgress:d.unknown().optional()}).passthrough()}).passthrough();var wXe=d.object({name:d.string().min(1),provision:d.literal("existing"),url:d.string().min(1),repository:KC.optional(),revisionUrl:d.string().min(1).optional()}).passthrough(),CXe=d.object({name:d.string().min(1),url:d.string().nullable(),versionUrl:d.string().nullable(),notes:d.string().nullable()}).passthrough();var SXe=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function c4(e){let t=o(n=>e.testResults.filter(i=>i.status===n).length,"count");return{passed:t("Pass"),failed:t("Fail"),skipped:t("Skipped")}}o(c4,"statusCounts");function zve(e){let{passed:t,failed:n,skipped:i}=c4(e);return t+n===0?{sufficiency:"insufficient",rationale:i>0?`Every test was skipped (${i}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${t+n} tests ran against the frozen sources: ${t} passed, ${n} failed${i?`, ${i} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}o(zve,"executedTestsValidation");function qve(e,t){let n=e.map(c=>({result:c,repository:c.repository??t,path:c.fileName||c.testType})),i=new Map;for(let c of n){let u=`${c.repository}:${c.result.testType}:${c.path}`;i.set(u,(i.get(u)??0)+1)}let r=n.map(({result:c,repository:u,path:l})=>{let p=(i.get(`${u}:${c.testType}:${l}`)??0)>1;return c.resultId??nS(u,c.testType,l,p&&c.endpoint||void 0)}),s=new Map;for(let c of r)s.set(c,(s.get(c)??0)+1);let a=new Set(r.filter(c=>s.get(c)===1));return n.map(({result:c,repository:u},l)=>{let p=r[l],f=p;if(s.get(p)>1&&a.has(p))for(let A=2;a.has(f)||f===p;A+=1)f=p.includes("#")?`${p}.${A}`:`${p}#${A}`;return a.add(f),{...c,repository:u,resultId:f}})}o(qve,"withResultIds");function Hve({notTranslated:e,...t},n){let i=qve(t.testResults,n);return{...t,testResults:i,...Jve(t,i,n),validation:Zve(Kve(t,Yve(t,t.validation??zve(t)))),traceVersion:1}}o(Hve,"v3Report");function Jve(e,t,n){if(!e.testExecutionContexts)return{};let i=new Set,r=o(c=>{let u=c;for(let l=2;i.has(u);l+=1)u=`${c}#${l}`;return i.add(u),u},"unique"),s=[],a=new Map;for(let{repository:c,...u}of e.testExecutionContexts){let l=u.status==="not_run"?[]:t.filter(p=>p.fileName===u.test&&p.repository===(c?.trim()||n));l.length||s.push(u);for(let{resultId:p}of l){let f=a.get(p),A=f!==void 0&&nm(s[f].cleanup.status)>=Math.max(1,nm(u.cleanup.status))?s[f].cleanup:u.cleanup,h={...u,cleanup:A,test:p,resultId:p};f===void 0?a.set(p,s.push(h)-1):s[f]=h}}for(let c of s)c.resultId&&i.add(c.resultId);return{testExecutionContexts:s.map(c=>c.resultId?c:{...c,test:r(c.test.slice(0,512))}).slice(0,5e3)}}o(Jve,"linkedContexts");function Yve(e,t){let{passed:n,failed:i}=c4(e);return t.sufficiency!=="sufficient"||n+i>0||t.acceptedEvidence.length>0?t:{...t,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}o(Yve,"withEvidence");var Wve={"model-provider-denied":"model_provider_denied","model-provider-unavailable":"model_provider_unavailable"};function Zve(e){return{...e,gaps:Of(e.gaps)}}o(Zve,"boundedGaps");function Kve(e,t){if(t.sufficiency==="sufficient")return t;let n=(e.caveats??[]).map(r=>Wve[r.kind]).filter(r=>r!==void 0),i=[...new Set(n)].filter(r=>!t.actionRequired.includes(r));return i.length?{...t,actionRequired:[...i,...t.actionRequired]}:t}o(Kve,"withModelProviderFailure");function Xve(e,t,n){let{language:i,report:r}=t;if(i==="en")return;let s={language:i,businessCaseAnalysis:r.businessCaseAnalysis},a=o((b,v,I)=>Array.isArray(b)&&Array.isArray(v)&&b.length===v.length?b.map(C=>({[I]:C[I]})):void 0,"rows"),c=e.validation;r.validation&&c&&c.rationale===n.validation.rationale&&JSON.stringify(Of(c.gaps))===JSON.stringify(n.validation.gaps)&&Of(r.validation.gaps).length===n.validation.gaps.length&&(s.validation={rationale:r.validation.rationale,gaps:Of(r.validation.gaps)});let u=new Set((n.changes??[]).map(b=>b.id)),l=(r.changes??[]).filter(b=>u.has(b.id)).map(({id:b,text:v})=>({id:b,text:v}));l.length&&(s.changes=l);let p=new Set((n.requirements??[]).filter(b=>b.statement!==void 0).map(b=>b.id)),f=(r.requirements??[]).flatMap(({id:b,statement:v})=>p.has(b)&&b.length>0&&b.length<=Rp.id&&v?.trim()?[{id:b,statement:v.slice(0,Rp.statement)}]:[]);f.length&&(s.requirements=f.slice(0,Rp.rows));let A=a(r.issuesFound,n.issuesFound,"description");A&&(s.issuesFound=A);let h=a(r.newTestsCreated,n.newTestsCreated,"description");h&&(s.newTestsCreated=h);let m=a(r.testResults,n.testResults,"details");m&&(s.testResults=m);let E=a(r.caveats,n.caveats,"text");return E&&(s.caveats=E),s}o(Xve,"v3Display");async function u4(e,t){let n=Uj([...e.issuedTokens,...t.secrets??[]]),i={...Hve(t.report,t.workingSlug),...t.notTranslated?{notTranslated:t.notTranslated}:{}},r=t.translated&&Xve(t.report,t.translated,i),s=eIe(Aa(t.delivery,n)),a=t.sources.map(({repository:m,revision:E})=>({repository:m,revision:E})),c=Aa(i,n),u=r&&tS.safeParse(Aa(r,n)),l=u?.success?u.data:void 0;if(u&&!u.success){let m=u.error.issues[0]?.path.join(".");e.log(`Testbot V3: omitted the translated display because ${m?`display.${m}`:"it"} did not meet the report field limits.`)}let p=o((m,E)=>gG({manifest:e.manifest,attemptNumber:e.attemptNumber,checkedOut:a,firstQualification:t.firstQualification,generatedTests:m,producer:t.producer,report:E&&l?{...c,display:l}:c,githubWrites:t.githubWrites}),"build"),f=o((m,E)=>i4(JSON.stringify(p(m,E))),"encode"),A=(s.status==="partial"||s.status==="failed")&&s.failures?.some(m=>m.heldBack)?{...s,failures:s.failures.map(({heldBack:m,...E})=>E)}:void 0,h=[{delivery:s,display:!!l}];A&&h.push({delivery:A,display:!!l}),l&&(h.push({delivery:s,display:!1}),A&&h.push({delivery:A,display:!1}));for(let[m,E]of h.entries()){let b;try{b=f(E.delivery,E.display)}catch(v){if(!(v instanceof Sg)||m===h.length-1)throw v;continue}l&&!E.display&&e.log("Testbot V3: omitted the translated display to fit the report upload."),E.delivery===A&&e.log("Testbot V3: omitted structured held-back files to fit the report upload. See held-back.json for the complete list."),await e.sendReport(b);return}}o(u4,"uploadV3Report");async function hD(e,t,n){if(!d.string().uuid().safeParse(t).success)return{refusal:"no_environment"};let i;try{i=cG.parse(await e.send("GET",_1.persistentDataPolicy.replace(":attemptId",e.attemptId),void 0))}catch{return{refusal:"unavailable"}}try{if(!i.environmentAddress||new URL(i.environmentAddress).href!==new URL(n).href)return{refusal:"changed"}}catch{return{refusal:"changed"}}if(i.environmentId!==t)return{refusal:"changed"};let r=i.persistentDataPolicy;return r?r.environmentId===t?{policy:r}:{refusal:"changed"}:{refusal:"denied"}}o(hD,"fetchV3PersistentDataPolicy");async function l4(e,t,n){let{environmentId:i,environmentAddress:r}=t;if(!i||!r)return{allowed:!1,refusal:"no_environment"};let s=t.persistentDataPolicy;if(!s?.allowed||s.environmentId!==i)return{allowed:!1,refusal:"no_recorded_grant"};let a=await hD(e,i,r);return"refusal"in a?{allowed:!1,refusal:a.refusal}:a.policy.allowed?a.policy.revision!==s.revision?{allowed:!1,refusal:"changed"}:sm(t,a.policy,n)?{allowed:!0,policy:a.policy}:{allowed:!1,refusal:"out_of_scope"}:{allowed:!1,refusal:"denied"}}o(l4,"currentV3PersistenceDecision");var KW=o((e,t=hm)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e,"boundDeliveryMessage");function eIe(e){let t=o(n=>n.map(i=>({...i,message:KW(i.message)})),"bound");return e.status==="partial"?{...e,failures:t(e.failures)}:e.status==="failed"?{...e,message:KW(e.message),...e.failures&&{failures:t(e.failures)}}:e}o(eIe,"boundDeliveryMessages");async function d4(e,t){return e4(e.attemptId,"attempt id"),gD(t,"POST",`/api/v1/runner/attempts/${e.attemptId}/end`,AG({reportUploaded:e.reportUploaded,recipeUploaded:e.recipeUploaded,revisionsUploaded:e.revisionsUploaded,cancelled:e.cause==="cancelled",timedOut:e.cause==="timed_out",setupFailed:e.cause==="setup_failed",checkoutFailed:e.cause==="checkout_failed"||e.cause==="merge_conflict"&&!e.conflict,mergeConflict:e.cause==="merge_conflict"?e.conflict:void 0,environmentUnverified:e.cause==="environment_unverified",runnerProviderNotReady:e.cause==="runner_provider_not_ready",credentialMissing:e.cause==="credential_missing",modelProviderDenied:e.cause==="model_provider_denied",modelProviderUnavailable:e.cause==="model_provider_unavailable",githubWrites:e.githubWrites,environmentUnavailable:e.cause==="environment_unavailable",sharedEnvironmentRecords:e.sharedEnvironmentRecords}))}o(d4,"endV3Attempt");0&&(module.exports={AppRefusal,AppUnreachable,AttemptEndReason,DeliveryStatus,GitHubWriteKind,NoReportCause,SourceProvider,TARGET_ENVIRONMENT_KEYS,V3Attempt,ValidationSufficiency,closedV3Attempt,currentV3PersistenceDecision,endV3Attempt,fetchV3PersistentDataPolicy,heartbeatV3Attempt,startV3Attempt,uploadV3Report});
319
+ `),"latin1"))),[ne,Et]})),ct=[];for(let ne of r)try{nt(f,["--literal-pathspecs","add","--",ne])}catch{ct.push(ne)}if(ct.some(ne=>Me.has(ne)))throw new Error("could not stage every guarded delivery file");let on=new Map([...jt].map(([ne,At])=>{let Le=nt(f,["--literal-pathspecs","ls-files","--stage","--",ne]),Et=/^100(?:644|755) ([a-f0-9]+) 0\t/.exec(Le)?.[1];if(!Et||!At.has(Et))throw new Error(`the staged guarded file differs from the generated file: ${ne}`);return[ne,Et]}));try{nt(f,["diff","--cached","--quiet"])}catch{try{let ne=Rve(f,A,H,me,e.inputs.skyrampRunUrl);nt(f,["-c",`user.name=${b.name}`,"-c",`user.email=${b.email}`,"commit","-m",ne])}catch(ne){throw new Rb(ne)}u=!0}u&&(p.length=0),l=nt(f,["rev-parse","HEAD"]);let Bt,Xe,yn,gt=$??s?.headSha;if(u&&gt&&gt!==H){let ne=!1,At=l;try{nt(f,["checkout","-q","-B",c,gt]),ne=!0;try{nt(f,["-c",`user.name=${b.name}`,"-c",`user.email=${b.email}`,"cherry-pick","--keep-redundant-commits",l])}catch(Le){let Et=$?Qve(f,b,At):void 0;if(!Et||(Xe=Et.files.map(Qr=>({file:Qr,dependsOn:xve(f,a,$,H,Qr)})),yn={repository:a,base:I,files:Xe,patch:$ve(f,H,At,Et.files)},!Et.delivered))throw Le}ne=!1,jW(Le=>nt(f,Le),gt),l=nt(f,["rev-parse","HEAD"])}catch(Le){try{nt(f,["cherry-pick","--abort"])}catch{}nt(f,["checkout","-q","-B",c,l]);let Et=sp(ha(Le),1/0);if($&&!ne)throw Le;if($)return{thrown:!1,held:yn,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:I,committed:u,commitSha:l,pushed:!1,prAction:"skipped",prTitle:E,unstaged:ct,...Xe?{heldBack:Xe}:{},reason:Xe?`every test change needs a merged revision ${I} does not have yet, so no tests PR was opened: ${YW(Xe)}`:`the tests do not apply to ${I} at ${$.slice(0,12)} without the merged revisions (${Et}), so no tests PR was opened`}};Bt=`tests committed on the checkout's merge commit (re-cut onto ${gt.slice(0,12)} failed: ${Et})`}}Xe&&sn.writeFileSync(ie,B(Xe));for(let[ne,At]of on){if(Xe?.some(Et=>Et.file===ne))continue;let Le=nt(f,["--literal-pathspecs","ls-tree",l,"--",ne]);if(/^100(?:644|755) blob ([a-f0-9]+)\t/.exec(Le)?.[1]!==At)throw new Error(`the committed guarded file differs from the generated file: ${ne}`)}for(let{record:ne}of Ie){if(ne.entry)continue;let At=nt(f,["--literal-pathspecs","ls-tree",l,"--",ne.file]);if(At&&At!==nt(f,["--literal-pathspecs","ls-tree",H,"--",ne.file]))throw new Error(`the delivery included executable source for a held test: ${ne.file}`)}let ut=s?{}:{repositoryPath:f,repoSlug:a,devPr:null};if(!u){let ne=await t.markTestsPrUnchanged({branch:c,...ut});return{thrown:!1,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:I,committed:!1,commitSha:l,pushed:!1,prAction:ne.action==="unchanged"?"unchanged":"skipped",prUrl:ne.url,prTitle:E,unstaged:ct,reason:ne.action==="unchanged"?"no test changes to commit \u2014 existing tests PR annotated as unchanged":"no test changes to commit \u2014 nothing pushed, no PR opened"}}}let $e=await t.publishTestsPr({repositoryPath:f,...ut,remote:v,branch:c,base:I,commitSha:l,title:E,bodyFile:ie,mode:e.inputs.deliverMode,deliveryOwner:C,...e.inputs.firstQualification?{firstQualification:!0}:{},runUrl:e.inputs.skyrampRunUrl,signal:e.signal,deadlineMs:e.deadlineMs});return{thrown:!1,held:yn,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:$e.base,requestedBase:I,committed:u,commitSha:l,pushed:$e.pushed,...$e.pushedCommits?{pushedCommits:$e.pushedCommits}:{},...$e.deliveredCommit?{deliveredCommit:$e.deliveredCommit}:{},prAction:$e.action,...$e.retargetedAs?{retargetedAs:$e.retargetedAs}:{},prUrl:$e.url,prTitle:E,...$e.failure?{prFailure:$e.failure,prDetail:$e.detail}:{},...Bt?{cutNote:Bt}:{},...$e.action==="skipped"&&$e.detail?{reason:$e.detail}:{},unstaged:ct,...Xe?{heldBack:Xe}:{}}}}catch(f){return{thrown:!0,record:{schemaVersion:1,repository:a,branch:c,committed:u,commitSha:l,pushed:!1,prAction:"failed",...kve(f),unstaged:[]}}}finally{if(p.length){try{nt(i.path,["reset"])}catch{}for(let f of p.reverse())try{f()}catch{}}}}o(Dve,"deliverRepository");var E3e={name:"deliver",timeoutMinutes:5,execute:Ive,validateInput:o(e=>{let t=J0(e);return t?{ok:!1,reasons:[t]}:dve(e)},"validateInput"),requires:["report"],branchRequires:{runtime:["write"],"no-runtime":["generate-unit"]}};var _ve=10*6e4,Nve=4*6e4,Pve=6e4;function Uve(e,t){return e.getTime()-t.getTime()-_ve}o(Uve,"remainingBudgetMs");var WW="This attempt revoked its scoped GitHub credentials; it mints no more.";var Fve=10*6e4;var Ove=o(e=>!!e&&Object.keys(e).length===1&&e.contents==="read","onlyReads"),Mve=3e4,Lve=3,ZW=30,vi=class extends Error{constructor(n,i,r,s){super(n);this.status=i;this.code=r;this.path=s}status;code;path;static{o(this,"AppRefusal")}},Wi=class extends Error{static{o(this,"AppUnreachable")}},Ll=class extends Wi{static{o(this,"AppNotReady")}},pD=class extends Ll{static{o(this,"RunnerProviderNotReady")}};function fD(e){let t;try{t=new URL(e)}catch{throw new Error(`skyrampAppOrigin "${e}" is not a URL`)}if(t.protocol!=="https:"||t.origin!==e.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${e}"`);return t.origin}o(fD,"appOrigin");function e4(e,t){if(!Du.test(e))throw new Error(`The ${t} "${e}" is not a uuid`);return e}o(e4,"routeId");function t4(e,t,n,i){throw t<500&&t!==429?new vi(e,t,n,i):t===503&&n==="RUNNER_PROVIDER_NOT_READY"?new pD(e):t===503&&n==="RUN_NOT_READY"?new Ll(e):new Wi(e)}o(t4,"refusedOrUnreachable");async function n4(e,t,n,i,r,s=1/0){let a=fD(e.origin),c=`The time limit for ${t} ${n} to the Skyramp web app was reached`,u,l=0;for(let p=1;p<=Lve||u instanceof Ll;p+=1){if(u instanceof Ll){if(l===ZW)throw u;l+=1,p-=1,e.log?.(`${u.message}; trying again (${l} of ${ZW}).`),await new Promise(f=>setTimeout(f,Math.max(0,Math.min(e.readyWaitMs??1e4,s-Date.now()))))}else p>1&&await new Promise(f=>setTimeout(f,Math.max(0,Math.min((e.retryDelayMs??2e3)*(p-1),s-Date.now()))));if(Date.now()>=s)throw new Wi(c);try{let f,A=await(Number.isFinite(s)?Promise.race([e.idToken(a),new Promise((m,E)=>{f=setTimeout(()=>E(new Wi(c)),Math.max(1,s-Date.now()))})]).finally(()=>{f&&clearTimeout(f)}):e.idToken(a));if(Date.now()>=s)throw new Wi(c);let h=await(e.fetch??fetch)(new URL(n,a).toString(),{...i(A),redirect:"error",signal:AbortSignal.timeout(Math.max(1,Math.min(Mve,s-Date.now())))}).catch(m=>{let E=m instanceof Error?m.message:String(m);throw new Wi(`The Skyramp web app did not answer ${t} ${n}: ${E}`,{cause:m})});return await r(h)}catch(f){if(f instanceof vi||Date.now()>=s)throw f;u=f}}throw u}o(n4,"callWithRetries");function r4(e,t,n,i,r){let s=i.headers.get("cf-ray");e.log?.(`Testbot V3: the Skyramp web app answered ${t} ${n} with ${i.status}${s?`, cf-ray ${s}`:""}: ${r.replace(/\s+/g," ").slice(0,200)}`)}o(r4,"logRefusal");var Sg=class extends Error{static{o(this,"ReportUploadSizeError")}};function i4(e){let t=Buffer.byteLength(e,"utf8");if(t<=eS)return{body:e};if(t>q1)throw new Sg("The report exceeds the Skyramp web app's 16 MiB expanded report limit");let n=new Uint8Array((0,XW.gzipSync)(e));if(n.length>eS)throw new Sg("The compressed report exceeds the Skyramp web app's 1 MiB report upload limit");return{body:n,gzip:!0}}o(i4,"encodeReportUpload");function gD(e,t,n,i,r){let s=t==="GET"?void 0:JSON.stringify(i),a=t==="PUT"&&/^\/api\/v1\/runner\/attempts\/[^/]+\/report$/.test(n)&&s!==void 0?i4(s):{body:s};return s4(e,t,n,a,r)}o(gD,"callApp");function s4(e,t,n,i,r){return n4(e,t,n,o(a=>({method:t,headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json",...i.gzip?{"Content-Encoding":"gzip"}:{}},body:i.body}),"request"),async a=>{let c=await a.text().catch(()=>""),u={};try{u=JSON.parse(c)}catch{}if(a.ok)return u.data;r4(e,t,n,a,c);let l=u.error?.fields,p=typeof l?.path=="string"&&typeof l.reason=="string"?` at ${l.path}: ${l.reason}`:"",f=`The Skyramp web app refused ${t} ${n}: ${a.status} ${u.error?.code??"no error code"}${p}`;return t4(f,a.status,u.error?.code,typeof l?.path=="string"?l.path:void 0)},r)}o(s4,"callEncodedApp");function jve(e,t,n){return n4(e,"GET",t,o(r=>({method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"application/octet-stream"}}),"request"),async r=>{if(!r.ok)return r4(e,"GET",t,r,await r.text().catch(()=>"")),t4(`The Skyramp web app refused GET ${t}: ${r.status}`,r.status);let s=Buffer.from(await r.arrayBuffer());if(s.length>n)throw new vi(`The Skyramp web app answered GET ${t} with more than ${n} bytes`,r.status);return s})}o(jve,"callAppBytes");var kg=class{constructor(t,n,i,r,s,a,c,u,l,p=[],f=[],A,h=!1,m=!1){this.attemptId=t;this.attemptNumber=n;this.deadlineAt=i;this.manifest=r;this.deps=s;this.license=a;this.requestedBy=c;this.writeAllowed=u;this.claudeCodeVersion=l;this.deployedPins=p;this.statedPins=f;this.runSettings=A;this.credentialKinds=h;this.credentialBlockers=m}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;deployedPins;statedPins;runSettings;credentialKinds;credentialBlockers;static{o(this,"V3Attempt")}budgetMs(t,n){let i=n===void 0?void 0:Date.parse(this.manifest.trigger.requestedAt)+n*6e4;if(this.deadlineAt.getTime()!==i)return Uve(this.deadlineAt,t);let r=this.deadlineAt.getTime()-t.getTime(),s=Math.max(Pve,Math.min(Nve,r/2));return r-s}get skyrampRunUrl(){return M1(fD(this.deps.origin),this.manifest.runId)}log(t){this.deps.log?.(t)}send(t,n,i,r){return gD(this.deps,t,n,i,r)}async sendReport(t){await s4(this.deps,"PUT",`/api/v1/runner/attempts/${this.attemptId}/report`,t)}readBytes(t,n){return jve(this.deps,t,n)}issuedTokens=[];closure;modelKey;modelCredentials=[];credentials={};revocation;token(){return this.cachedToken("run")}readOnlyToken(){return this.cachedToken("read")}async cachedToken(t){if(this.revocation)throw new Error(WW);let n=(this.deps.now??(()=>new Date))().getTime(),i=this.credentials[t],r=i&&await i.catch(()=>{});if(this.credentials[t]!==i)return(await this.credentials[t]).token;if(r&&r.expiresAt-n>=Fve)return r.token;if(this.revocation)throw new Error(WW);let s=t==="read",a=s?{schemaVersion:1,access:t}:{schemaVersion:1},c=s?"read-only":"scoped",u=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,a).then(l=>{let p={...l,token:l.token??this.jobToken()};if(this.issuedTokens.push(p.token),this.deps.mask?.(p.token),p.anthropicApiKey&&this.deps.mask?.(p.anthropicApiKey),s&&l.token&&!Ove(p.permissions))throw new Error(`The Skyramp web app was asked for a read-only GitHub token, but its token grants ${JSON.stringify(p.permissions??null)}`);!s&&!r&&p.anthropicApiKey&&(this.modelKey=p.anthropicApiKey),this.deps.onTokenGranted?.(t);let f=r?"Renewed":"Received";return l.token&&this.deps.log?.(`${f} ${c} GitHub credentials; they expire at ${p.expiresAt}.`),{token:p.token,expiresAt:l.token?new Date(p.expiresAt).getTime():Number.POSITIVE_INFINITY}},l=>{if(this.deps.onTokenRefused?.(l,t),!(l instanceof vi)||l.code!=="CREDENTIALS_UNAVAILABLE")throw l;let p=o(h=>[...new Set(h.map(m=>m.namespace))].join(", "),"unique"),f=this.manifest.sources.map(h=>h.repository);if(new Set(f.map(h=>h.providerAccountId)).size>1)throw new vi(`${l.message}. The run's repositories are on more than one GitHub account (${p(f)}), which Skyramp does not support yet.`,l.status,l.code);let A=p([...f,this.manifest.execution.repository]);throw new vi(`${l.message}. Check the Skyramp GitHub App installation on ${A}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,l.status,l.code)});return this.credentials[t]=u,(await u).token}jobToken(){if(this.deps.sourceToken)return this.deps.sourceToken;throw new Error("The Skyramp web app answered the credentials request without a token, and the job gave Testbot none of its own: on Azure Pipelines, set SYSTEM_ACCESSTOKEN to $(System.AccessToken) in the Testbot step's env.")}sourceFetch(t){return t.fetch??this.deps.fetch??fetch}revokeTokens(t={}){let n=t.host??i0();return this.revocation??=n.revokeToken?this.revokeIssued(i=>n.revokeToken(i,this.sourceFetch(t))):Promise.resolve([]),this.revocation}async revokeIssued(t){let n=[...this.issuedTokens],i=Promise.all(n.map(a=>this.revokeOne(a,t)));await Promise.all(Object.values(this.credentials).map(a=>a.catch(()=>{})));let r=this.issuedTokens.filter(a=>!n.includes(a));return[...await i,...await Promise.all(r.map(a=>this.revokeOne(a,t)))].filter(a=>a!==void 0)}async revokeOne(t,n){try{await n(t);return}catch(i){return`token ${this.issuedTokens.indexOf(t)+1} of ${this.issuedTokens.length}: ${i instanceof Error?i.message:String(i)}`}}};async function o4(e,t,n){e4(e,"run id"),fD(n.origin);let i={statedPins:!0,credentialKinds:!0,credentialBlockers:!0},r=sS(e,t,i),s=`/api/v1/runner/runs/${e}/attempts`,a;for(;;)try{a=await gD(n,"POST",s,r);break}catch(p){let f=p instanceof vi&&p.status===400?Gve(p,i):void 0;if(!f)throw p;i[f]=!1,r=sS(e,t,i)}let c=fG(a);if(c.manifest.runId!==e)throw new Error(`The Skyramp web app answered the handshake of run ${e} with the manifest of another run (${c.manifest.runId})`);let u=c.manifest.sources.find(p=>p.repository.provider!==r.execution.provider);if(u)throw new Error(`The manifest of run ${e} names ${u.repository.namespace}/${u.repository.name} on ${u.repository.provider}, but this job runs on ${r.execution.provider}`);Vve(c.manifest,[...c.deployedRevisions??[],...c.statedRevisions??[]]),c.runToken&&n.mask?.(c.runToken);let l=c.runToken?{entitlements:c.entitlements??[],runToken:c.runToken}:void 0;return new kg(c.attempt.id,c.attempt.number,new Date(c.attempt.deadlineAt),c.manifest,n,l,c.requestedBy??void 0,c.writeAllowed,c.claudeCodeVersion??void 0,c.deployedRevisions??[],c.statedRevisions??[],c.runSettings,r.credentialKinds===!0,r.credentialBlockers===!0)}o(o4,"startV3Attempt");function Gve(e,t){let n=["credentialBlockers","credentialKinds","statedPins"];return e.path===void 0?e.code==="INVALID_REQUEST"?n.find(i=>t[i]):void 0:n.find(i=>t[i]&&e.path===`$.${i}`)}o(Gve,"handshakeFieldRefused");function Vve(e,t){if(t.length===0)return;if(!X1(e))throw new Error(`The Skyramp web app pinned an attempt of a ${e.trigger.kind} run; only a scheduled run or unchosen manual run's retry is pinned to an earlier attempt's read`);let n=new Set(e.sources.map(r=>ji(r.repository))),i=new Set;for(let r of t){let s=ji(r.repository);if(!n.has(s))throw new Error(`The Skyramp web app pinned the attempt to repository ${r.repository.providerRepositoryId}, which is not a source of the run`);if(i.has(s))throw new Error(`The Skyramp web app pinned repository ${r.repository.providerRepositoryId} twice`);i.add(s)}}o(Vve,"checkAttemptPins");async function AD(e,t){return uG.parse(await e.send("POST",`/api/v1/runner/attempts/${e.attemptId}/heartbeat`,{schemaVersion:1},t))}o(AD,"heartbeatV3Attempt");async function a4(e,t=()=>new Date,n){if(e.closure)return e.closure;let i=await AD(e,n).then(r=>lG(r,t())).catch(()=>null);return i&&(e.closure=i),i}o(a4,"closedV3Attempt");var mXe=10*6e4;var yXe=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];var EXe=d.object({tests:d.object({placements:d.array(d.unknown()).optional()}).passthrough().optional()}).passthrough(),bXe=d.object({repository:KC,testType:d.string(),directory:d.string()}).passthrough();var vXe=d.object({report:d.object({language:d.string()}).passthrough()}).passthrough();var IXe=d.object({environment:d.object({components:d.array(d.unknown()).optional(),dependencies:d.array(d.unknown()).optional()}).passthrough()}).passthrough(),wXe=d.object({environment:d.object({offLimits:d.unknown().optional()}).passthrough()}).passthrough();var CXe=d.object({environment:d.object({allowedEgress:d.unknown().optional()}).passthrough()}).passthrough();var SXe=d.object({name:d.string().min(1),provision:d.literal("existing"),url:d.string().min(1),repository:KC.optional(),revisionUrl:d.string().min(1).optional()}).passthrough(),kXe=d.object({name:d.string().min(1),url:d.string().nullable(),versionUrl:d.string().nullable(),notes:d.string().nullable()}).passthrough();var BXe=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function c4(e){let t=o(n=>e.testResults.filter(i=>i.status===n).length,"count");return{passed:t("Pass"),failed:t("Fail"),skipped:t("Skipped")}}o(c4,"statusCounts");function zve(e){let{passed:t,failed:n,skipped:i}=c4(e);return t+n===0?{sufficiency:"insufficient",rationale:i>0?`Every test was skipped (${i}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${t+n} tests ran against the frozen sources: ${t} passed, ${n} failed${i?`, ${i} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}o(zve,"executedTestsValidation");function qve(e,t){let n=e.map(c=>({result:c,repository:c.repository??t,path:c.fileName||c.testType})),i=new Map;for(let c of n){let u=`${c.repository}:${c.result.testType}:${c.path}`;i.set(u,(i.get(u)??0)+1)}let r=n.map(({result:c,repository:u,path:l})=>{let p=(i.get(`${u}:${c.testType}:${l}`)??0)>1;return c.resultId??nS(u,c.testType,l,p&&c.endpoint||void 0)}),s=new Map;for(let c of r)s.set(c,(s.get(c)??0)+1);let a=new Set(r.filter(c=>s.get(c)===1));return n.map(({result:c,repository:u},l)=>{let p=r[l],f=p;if(s.get(p)>1&&a.has(p))for(let A=2;a.has(f)||f===p;A+=1)f=p.includes("#")?`${p}.${A}`:`${p}#${A}`;return a.add(f),{...c,repository:u,resultId:f}})}o(qve,"withResultIds");function Hve({notTranslated:e,...t},n){let i=qve(t.testResults,n);return{...t,testResults:i,...Jve(t,i,n),validation:Zve(Kve(t,Yve(t,t.validation??zve(t)))),traceVersion:1}}o(Hve,"v3Report");function Jve(e,t,n){if(!e.testExecutionContexts)return{};let i=new Set,r=o(c=>{let u=c;for(let l=2;i.has(u);l+=1)u=`${c}#${l}`;return i.add(u),u},"unique"),s=[],a=new Map;for(let{repository:c,...u}of e.testExecutionContexts){let l=u.status==="not_run"?[]:t.filter(p=>p.fileName===u.test&&p.repository===(c?.trim()||n));l.length||s.push(u);for(let{resultId:p}of l){let f=a.get(p),A=f!==void 0&&nm(s[f].cleanup.status)>=Math.max(1,nm(u.cleanup.status))?s[f].cleanup:u.cleanup,h={...u,cleanup:A,test:p,resultId:p};f===void 0?a.set(p,s.push(h)-1):s[f]=h}}for(let c of s)c.resultId&&i.add(c.resultId);return{testExecutionContexts:s.map(c=>c.resultId?c:{...c,test:r(c.test.slice(0,512))}).slice(0,5e3)}}o(Jve,"linkedContexts");function Yve(e,t){let{passed:n,failed:i}=c4(e);return t.sufficiency!=="sufficient"||n+i>0||t.acceptedEvidence.length>0?t:{...t,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}o(Yve,"withEvidence");var Wve={"model-provider-denied":"model_provider_denied","model-provider-unavailable":"model_provider_unavailable"};function Zve(e){return{...e,gaps:Of(e.gaps)}}o(Zve,"boundedGaps");function Kve(e,t){if(t.sufficiency==="sufficient")return t;let n=(e.caveats??[]).map(r=>Wve[r.kind]).filter(r=>r!==void 0),i=[...new Set(n)].filter(r=>!t.actionRequired.includes(r));return i.length?{...t,actionRequired:[...i,...t.actionRequired]}:t}o(Kve,"withModelProviderFailure");function Xve(e,t,n){let{language:i,report:r}=t;if(i==="en")return;let s={language:i,businessCaseAnalysis:r.businessCaseAnalysis},a=o((b,v,I)=>Array.isArray(b)&&Array.isArray(v)&&b.length===v.length?b.map(C=>({[I]:C[I]})):void 0,"rows"),c=e.validation;r.validation&&c&&c.rationale===n.validation.rationale&&JSON.stringify(Of(c.gaps))===JSON.stringify(n.validation.gaps)&&Of(r.validation.gaps).length===n.validation.gaps.length&&(s.validation={rationale:r.validation.rationale,gaps:Of(r.validation.gaps)});let u=new Set((n.changes??[]).map(b=>b.id)),l=(r.changes??[]).filter(b=>u.has(b.id)).map(({id:b,text:v})=>({id:b,text:v}));l.length&&(s.changes=l);let p=new Set((n.requirements??[]).filter(b=>b.statement!==void 0).map(b=>b.id)),f=(r.requirements??[]).flatMap(({id:b,statement:v})=>p.has(b)&&b.length>0&&b.length<=Rp.id&&v?.trim()?[{id:b,statement:v.slice(0,Rp.statement)}]:[]);f.length&&(s.requirements=f.slice(0,Rp.rows));let A=a(r.issuesFound,n.issuesFound,"description");A&&(s.issuesFound=A);let h=a(r.newTestsCreated,n.newTestsCreated,"description");h&&(s.newTestsCreated=h);let m=a(r.testResults,n.testResults,"details");m&&(s.testResults=m);let E=a(r.caveats,n.caveats,"text");return E&&(s.caveats=E),s}o(Xve,"v3Display");async function u4(e,t){let n=Uj([...e.issuedTokens,...t.secrets??[]]),i={...Hve(t.report,t.workingSlug),...t.notTranslated?{notTranslated:t.notTranslated}:{}},r=t.translated&&Xve(t.report,t.translated,i),s=eIe(Aa(t.delivery,n)),a=t.sources.map(({repository:m,revision:E})=>({repository:m,revision:E})),c=Aa(i,n),u=r&&tS.safeParse(Aa(r,n)),l=u?.success?u.data:void 0;if(u&&!u.success){let m=u.error.issues[0]?.path.join(".");e.log(`Testbot V3: omitted the translated display because ${m?`display.${m}`:"it"} did not meet the report field limits.`)}let p=o((m,E)=>gG({manifest:e.manifest,attemptNumber:e.attemptNumber,checkedOut:a,firstQualification:t.firstQualification,generatedTests:m,producer:t.producer,report:E&&l?{...c,display:l}:c,githubWrites:t.githubWrites}),"build"),f=o((m,E)=>i4(JSON.stringify(p(m,E))),"encode"),A=(s.status==="partial"||s.status==="failed")&&s.failures?.some(m=>m.heldBack)?{...s,failures:s.failures.map(({heldBack:m,...E})=>E)}:void 0,h=[{delivery:s,display:!!l}];A&&h.push({delivery:A,display:!!l}),l&&(h.push({delivery:s,display:!1}),A&&h.push({delivery:A,display:!1}));for(let[m,E]of h.entries()){let b;try{b=f(E.delivery,E.display)}catch(v){if(!(v instanceof Sg)||m===h.length-1)throw v;continue}l&&!E.display&&e.log("Testbot V3: omitted the translated display to fit the report upload."),E.delivery===A&&e.log("Testbot V3: omitted structured held-back files to fit the report upload. See held-back.json for the complete list."),await e.sendReport(b);return}}o(u4,"uploadV3Report");async function hD(e,t,n){if(!d.string().uuid().safeParse(t).success)return{refusal:"no_environment"};let i;try{i=cG.parse(await e.send("GET",_1.persistentDataPolicy.replace(":attemptId",e.attemptId),void 0))}catch{return{refusal:"unavailable"}}try{if(!i.environmentAddress||new URL(i.environmentAddress).href!==new URL(n).href)return{refusal:"changed"}}catch{return{refusal:"changed"}}if(i.environmentId!==t)return{refusal:"changed"};let r=i.persistentDataPolicy;return r?r.environmentId===t?{policy:r}:{refusal:"changed"}:{refusal:"denied"}}o(hD,"fetchV3PersistentDataPolicy");async function l4(e,t,n){let{environmentId:i,environmentAddress:r}=t;if(!i||!r)return{allowed:!1,refusal:"no_environment"};let s=t.persistentDataPolicy;if(!s?.allowed||s.environmentId!==i)return{allowed:!1,refusal:"no_recorded_grant"};let a=await hD(e,i,r);return"refusal"in a?{allowed:!1,refusal:a.refusal}:a.policy.allowed?a.policy.revision!==s.revision?{allowed:!1,refusal:"changed"}:sm(t,a.policy,n)?{allowed:!0,policy:a.policy}:{allowed:!1,refusal:"out_of_scope"}:{allowed:!1,refusal:"denied"}}o(l4,"currentV3PersistenceDecision");var KW=o((e,t=hm)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e,"boundDeliveryMessage");function eIe(e){let t=o(n=>n.map(i=>({...i,message:KW(i.message)})),"bound");return e.status==="partial"?{...e,failures:t(e.failures)}:e.status==="failed"?{...e,message:KW(e.message),...e.failures&&{failures:t(e.failures)}}:e}o(eIe,"boundDeliveryMessages");async function d4(e,t){return e4(e.attemptId,"attempt id"),gD(t,"POST",`/api/v1/runner/attempts/${e.attemptId}/end`,AG({reportUploaded:e.reportUploaded,recipeUploaded:e.recipeUploaded,revisionsUploaded:e.revisionsUploaded,cancelled:e.cause==="cancelled",timedOut:e.cause==="timed_out",setupFailed:e.cause==="setup_failed",checkoutFailed:e.cause==="checkout_failed"||e.cause==="merge_conflict"&&!e.conflict,mergeConflict:e.cause==="merge_conflict"?e.conflict:void 0,environmentUnverified:e.cause==="environment_unverified",runnerProviderNotReady:e.cause==="runner_provider_not_ready",credentialMissing:e.cause==="credential_missing",modelProviderDenied:e.cause==="model_provider_denied",modelProviderUnavailable:e.cause==="model_provider_unavailable",githubWrites:e.githubWrites,environmentUnavailable:e.cause==="environment_unavailable",sharedEnvironmentRecords:e.sharedEnvironmentRecords}))}o(d4,"endV3Attempt");0&&(module.exports={AppRefusal,AppUnreachable,AttemptEndReason,DeliveryStatus,GitHubWriteKind,NoReportCause,SourceProvider,TARGET_ENVIRONMENT_KEYS,V3Attempt,ValidationSufficiency,closedV3Attempt,currentV3PersistenceDecision,endV3Attempt,fetchV3PersistentDataPolicy,heartbeatV3Attempt,startV3Attempt,uploadV3Report});
320
320
  /*! Bundled license information:
321
321
 
322
322
  undici/lib/web/fetch/body.js: