@skyramp/testbot-core 0.13.0-v3.221 → 0.13.0-v3.224
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION.json +1 -1
- package/dist/main.js +6 -6
- package/dist/post.js +1 -1
- package/dist/runner-client.cjs +1 -1
- package/package.json +1 -1
package/dist/post.js
CHANGED
|
@@ -113,7 +113,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}fun
|
|
|
113
113
|
`+d.slice(b,k),b=k+1),I=R;return N+=`
|
|
114
114
|
`,d.length-b>m&&I>b?N+=d.slice(b,I)+`
|
|
115
115
|
`+d.slice(I+1):N+=d.slice(b),N.slice(1)}function dt(d){let m="",y=0;for(let Q=0;Q<d.length;y>=65536?Q+=2:Q++){y=ze(d,Q);let b=fe[y];!b&&At(y)?(m+=d[Q],y>=65536&&(m+=d[Q+1])):m+=b||st(y)}return m}function Ks(d,m,y){let Q="",b=d.tag;for(let k=0,I=y.length;k<I;k+=1){let R=y[k];d.replacer&&(R=d.replacer.call(y,String(k),R)),(f(d,m,R,!1,!1)||typeof R>"u"&&f(d,m,null,!1,!1))&&(Q!==""&&(Q+=","+(d.condenseFlow?"":" ")),Q+=d.dump)}d.tag=b,d.dump="["+Q+"]"}function Mn(d,m,y,Q){let b="",k=d.tag;for(let I=0,R=y.length;I<R;I+=1){let N=y[I];d.replacer&&(N=d.replacer.call(y,String(I),N)),(f(d,m+1,N,!0,!0,!1,!0)||typeof N>"u"&&f(d,m+1,null,!0,!0,!1,!0))&&((!Q||b!=="")&&(b+=Xt(d,m)),d.dump&&c===d.dump.charCodeAt(0)?b+="-":b+="- ",b+=d.dump)}d.tag=k,d.dump=b||"[]"}function Zs(d,m,y){let Q="",b=d.tag,k=Object.keys(y);for(let I=0,R=k.length;I<R;I+=1){let N="";Q!==""&&(N+=", "),d.condenseFlow&&(N+='"');let M=k[I],_=y[M];d.replacer&&(_=d.replacer.call(y,M,_)),f(d,m,M,!1,!1)&&(d.dump.length>1024&&(N+="? "),N+=d.dump+(d.condenseFlow?'"':"")+":"+(d.condenseFlow?"":" "),f(d,m,_,!1,!1)&&(N+=d.dump,Q+=N))}d.tag=b,d.dump="{"+Q+"}"}function Xs(d,m,y,Q){let b="",k=d.tag,I=Object.keys(y);if(d.sortKeys===!0)I.sort();else if(typeof d.sortKeys=="function")I.sort(d.sortKeys);else if(d.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let R=0,N=I.length;R<N;R+=1){let M="";(!Q||b!=="")&&(M+=Xt(d,m));let _=I[R],G=y[_];if(d.replacer&&(G=d.replacer.call(y,_,G)),!f(d,m+1,_,!0,!0,!0))continue;let q=d.tag!==null&&d.tag!=="?"||d.dump&&d.dump.length>1024;q&&(d.dump&&c===d.dump.charCodeAt(0)?M+="?":M+="? "),M+=d.dump,q&&(M+=Xt(d,m)),f(d,m+1,G,!0,q)&&(d.dump&&c===d.dump.charCodeAt(0)?M+=":":M+=": ",M+=d.dump,b+=M)}d.tag=k,d.dump=b||"{}"}function o(d,m,y){let Q=y?d.explicitTypes:d.implicitTypes;for(let b=0,k=Q.length;b<k;b+=1){let I=Q[b];if((I.instanceOf||I.predicate)&&(!I.instanceOf||typeof m=="object"&&m instanceof I.instanceOf)&&(!I.predicate||I.predicate(m))){if(y?I.multi&&I.representName?d.tag=I.representName(m):d.tag=I.tag:d.tag="?",I.represent){let R=d.styleMap[I.tag]||I.defaultStyle,N;if(r.call(I.represent)==="[object Function]")N=I.represent(m,R);else if(s.call(I.represent,R))N=I.represent[R](m,R);else throw new e("!<"+I.tag+'> tag resolver accepts not "'+R+'" style');d.dump=N}return!0}}return!1}function f(d,m,y,Q,b,k,I){d.tag=null,d.dump=y,o(d,y,!1)||o(d,y,!0);let R=r.call(d.dump),N=Q;Q&&(Q=d.flowLevel<0||d.flowLevel>m);let M=R==="[object Object]"||R==="[object Array]",_,G;if(M&&(_=d.duplicates.indexOf(y),G=_!==-1),(d.tag!==null&&d.tag!=="?"||G||d.indent!==2&&m>0)&&(b=!1),G&&d.usedDuplicates[_])d.dump="*ref_"+_;else{if(M&&G&&!d.usedDuplicates[_]&&(d.usedDuplicates[_]=!0),R==="[object Object]")Q&&Object.keys(d.dump).length!==0?(Xs(d,m,d.dump,b),G&&(d.dump="&ref_"+_+d.dump)):(Zs(d,m,d.dump),G&&(d.dump="&ref_"+_+" "+d.dump));else if(R==="[object Array]")Q&&d.dump.length!==0?(d.noArrayIndent&&!I&&m>0?Mn(d,m-1,d.dump,b):Mn(d,m,d.dump,b),G&&(d.dump="&ref_"+_+d.dump)):(Ks(d,m,d.dump),G&&(d.dump="&ref_"+_+" "+d.dump));else if(R==="[object String]")d.tag!=="?"&&Sr(d,d.dump,m,k,N);else{if(R==="[object Undefined]")return!1;if(d.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+R)}if(d.tag!==null&&d.tag!=="?"){let q=encodeURI(d.tag[0]==="!"?d.tag.slice(1):d.tag).replace(/!/g,"%21");d.tag[0]==="!"?q="!"+q:q.slice(0,18)==="tag:yaml.org,2002:"?q="!!"+q.slice(18):q="!<"+q+">",d.dump=q+" "+d.dump}}return!0}function B(d,m){let y=[],Q=[];w(d,y,Q);let b=Q.length;for(let k=0;k<b;k+=1)m.duplicates.push(y[Q[k]]);m.usedDuplicates=new Array(b)}function w(d,m,y){if(d!==null&&typeof d=="object"){let Q=m.indexOf(d);if(Q!==-1)y.indexOf(Q)===-1&&y.push(Q);else if(m.push(d),Array.isArray(d))for(let b=0,k=d.length;b<k;b+=1)w(d[b],m,y);else{let b=Object.keys(d);for(let k=0,I=b.length;k<I;k+=1)w(d[b[k]],m,y)}}}function E(d,m){m=m||{};let y=new Ws(m);y.noRefs||B(d,y);let Q=d;return y.replacer&&(Q=y.replacer.call({"":Q},"",Q)),f(y,0,Q,!0,!0)?y.dump+`
|
|
116
|
-
`:""}return ry.dump=E,ry}var Ax;function OY(){if(Ax)return wt;Ax=1;let t=LY(),e=PY();function n(r,s){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return wt.Type=Ft(),wt.Schema=lx(),wt.FAILSAFE_SCHEMA=fx(),wt.JSON_SCHEMA=Cx(),wt.CORE_SCHEMA=Ix(),wt.DEFAULT_SCHEMA=sy(),wt.load=t.load,wt.loadAll=t.loadAll,wt.dump=e.dump,wt.YAMLException=fu(),wt.types={binary:Qx(),float:Ex(),map:hx(),null:gx(),pairs:Sx(),set:kx(),timestamp:Bx(),bool:mx(),int:yx(),merge:wx(),omap:bx(),seq:px(),str:dx()},wt.safeLoad=n("safeLoad","load"),wt.safeLoadAll=n("safeLoadAll","loadAll"),wt.safeDump=n("safeDump","dump"),wt}var $Y=OY(),VY=_Y($Y),{Type:A4,Schema:l4,FAILSAFE_SCHEMA:d4,JSON_SCHEMA:vx,CORE_SCHEMA:p4,DEFAULT_SCHEMA:h4,load:gu,loadAll:GY,dump:f4,YAMLException:g4,types:m4,safeLoad:y4,safeLoadAll:E4,safeDump:C4}=VY;var Wr=t=>typeof t=="string"?t:void 0;function xx(t){let e={services:[]},n;try{let A=Rx.readFileSync(t,"utf8");n=gu(A,{schema:vx})}catch(A){return Pe(`Lenient parse: failed to read/parse ${t}: ${A.message}`),e}if(!n||typeof n!="object"||Array.isArray(n))return Pe(`Lenient parse: ${t} did not contain a YAML object`),e;let r=n,s=r.metadata&&typeof r.metadata=="object"?r.metadata:void 0,i=s?{executorVersion:Wr(s.executorVersion),mcpVersion:Wr(s.mcpVersion)}:void 0,c=(Array.isArray(r.services)?r.services:[]).reduce((A,l,p)=>{if(!l||typeof l!="object"||Array.isArray(l))return Pe(`Lenient parse: services[${p}] is not an object \u2014 skipping`),A;let h=l,g=Wr(h.serviceName);if(!g)return Pe(`Lenient parse: services[${p}] missing or non-string serviceName \u2014 skipping`),A;let C=h.api&&typeof h.api=="object"?h.api:void 0,S=h.runtimeDetails&&typeof h.runtimeDetails=="object"?h.runtimeDetails:void 0;return A.push({serviceName:g,language:Wr(h.language),framework:Wr(h.framework),testDirectory:Wr(h.testDirectory),api:C?{baseUrl:Wr(C.baseUrl)}:void 0,runtimeDetails:S?{serverStartCommand:Wr(S.serverStartCommand),serverTeardownCommand:Wr(S.serverTeardownCommand)}:void 0}),A},[]);return{metadata:i,services:c}}async function Dx(t){let e=Tx.resolve(t.workingDirectory),n=new fd(e),r=[],s=t.targetSetupCommand,i=t.targetTeardownCommand,a=t.skyrampExecutorVersion,c=t.skyrampMcpVersion;if(await n.exists()){In(`Found ${n.getConfigPath()}, loading workspace configuration...`);try{let l;try{l=await n.read()}catch(h){Pe(`${n.getConfigPath()} failed strict validation: ${h.message}. Re-reading with per-field lenient parse \u2014 invalid fields will fall back to action input defaults.`),l=xx(n.getConfigPath())}l.metadata&&(!a&&l.metadata.executorVersion&&(a=l.metadata.executorVersion),!c&&l.metadata.mcpVersion&&(c=l.metadata.mcpVersion));for(let h of l.services??[])r.push({serviceName:h.serviceName,language:h.language,framework:h.framework,baseUrl:h.api?.baseUrl,testDirectory:h.testDirectory});let p=(l.services??[])[0];if(p){!s&&p.runtimeDetails?.serverStartCommand&&(s=p.runtimeDetails.serverStartCommand);let h=p.runtimeDetails?.serverTeardownCommand;!i&&typeof h=="string"&&(i=h)}}catch(l){Pe(`Failed to parse ${n.getConfigPath()}: ${l.message} \u2014 falling back to action input defaults`)}}else ou("No .skyramp/workspace.yml found, using action input defaults");a||(a="v1.3.54"),c||(c="latest"),s||(s="docker compose up -d --build");let A={targetSetupCommand:s,authTokenCommand:t.authTokenCommand,targetTeardownCommand:i,skipTargetTeardown:t.skipTargetTeardown,skyrampExecutorVersion:a,skyrampMcpVersion:c,skyrampMcpSource:t.skyrampMcpSource,skyrampMcpGithubRef:t.skyrampMcpGithubRef,nodeVersion:t.nodeVersion,skipTargetSetup:t.skipTargetSetup,targetReadyCheckCommand:t.targetReadyCheckCommand,targetReadyCheckTimeout:t.targetReadyCheckTimeout,targetReadyCheckInterval:t.targetReadyCheckInterval,targetReadyCheckDiagnosticsCommand:t.targetReadyCheckDiagnosticsCommand,autoCommit:t.autoCommit,commitMessage:t.commitMessage,generatedTestsMode:t.generatedTestsMode,postPrComment:t.postPrComment,testExecutionTimeout:t.testExecutionTimeout,maxRecommendations:t.maxRecommendations,maxGenerate:t.maxGenerate,perTestMaxFixAttempts:t.perTestMaxFixAttempts,testbotMaxRetries:t.testbotMaxRetries,testbotRetryDelay:t.testbotRetryDelay,testbotTimeout:t.testbotTimeout,targetSetupRetries:t.targetSetupRetries,targetSetupRetryDelay:t.targetSetupRetryDelay,authTokenRetries:t.authTokenRetries,authTokenRetryDelay:t.authTokenRetryDelay,reportCollapsed:t.reportCollapsed,language:t.language,enableDebug:t.enableDebug,testRepoPath:t.testRepoPath,relatedRepoPaths:t.relatedRepoPaths,services:r};Zl("Resolved configuration");for(let[l,p]of Object.entries(A))l==="authTokenCommand"?In(` ${l}: [REDACTED]`):l==="services"?In(` ${l}: ${JSON.stringify(p)}`):In(` ${l}: ${p}`);return Xl(),A}Dt();Dt();zg();var Fx=Re(require("child_process")),iy=class extends Error{constructor(e){super(e),this.name="ExecTimeoutError"}},yd=class extends Error{constructor(e){super(e),this.name="ExecAbortedError"}};function Nx(t,e){if(!(!t||t.destroyed||t.writableEnded))try{t.write(e)}catch(n){Pe(`stream write failed: ${n instanceof Error?n.message:String(n)}`)}}async function Mx(t,e=[],n={}){let r="",s="",i={cwd:n.cwd,silent:n.silent??!1,ignoreReturnCode:n.ignoreReturnCode??!1,env:n.env?{...process.env,...n.env}:void 0,input:n.input,listeners:{stdout:c=>{r+=c.toString(),Nx(n.stdoutStream,c)},stderr:c=>{s+=c.toString()}}};if(n.timeout||n.signal){let c=n.signal;return c?.aborted?Promise.reject(new yd(`Command aborted before start: ${t}`)):new Promise((A,l)=>{let p=Fx.spawn(t,e,{cwd:n.cwd,env:n.env?{...process.env,...n.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});p.stdout?.on("data",v=>{r+=v.toString(),n.silent||process.stdout.write(v),Nx(n.stdoutStream,v)}),p.stderr?.on("data",v=>{s+=v.toString(),n.silent||process.stderr.write(v)}),n.input&&p.stdin?.end(n.input);let h=()=>{S&&clearTimeout(S),c?.removeEventListener("abort",C)},g=v=>{h();try{p.kill("SIGTERM")}catch{}l(v)},C=()=>g(new yd(`Command aborted: ${t}`)),S=n.timeout?setTimeout(()=>g(new iy(`Command timed out after ${Math.round(n.timeout/6e4)}m: ${t}`)),n.timeout):void 0;c?.addEventListener("abort",C,{once:!0}),p.on("close",v=>{h();let T=v??1;T!==0&&!n.ignoreReturnCode?l(new Error(`The process '${t}' failed with exit code ${T}`)):A({exitCode:T,stdout:r,stderr:s})}),p.on("error",v=>{h(),l(v)})})}return{exitCode:await pv(t,e,i),stdout:r,stderr:s}}async function _x(t,e){Zl(t);try{return await e()}finally{Xl()}}async function Ux(t,e){await _x("Tearing down services",async()=>{if(t.skipTargetTeardown){ou("Skipping service teardown (skipTargetTeardown=true)");return}if(!t.targetTeardownCommand){In("No targetTeardownCommand configured, skipping teardown");return}In(`Running teardown command: ${t.targetTeardownCommand}`);try{await Mx("bash",["-c",t.targetTeardownCommand],{cwd:e}),ou("Services torn down successfully")}catch(n){let r=n instanceof Error?n.message:String(n);Pe(`Service teardown command failed (non-fatal): ${r}`)}})}Dt();Dt();var qi=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(qi||{});var oy=t=>`${t.source}:${t.site??""}:${t.key}`;var Ed=/^pasted-[0-9a-f]{16}$/,mu=/^file-[0-9a-f]{16}$/,yu=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(yu||{});var ay=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(ay||{}),Sa=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(Sa||{}),ka=(T=>(T.RelatedChangeConflict="related_change_conflict",T.ReferenceOutsideTarget="reference_outside_target",T.SourceAccessLost="source_access_lost",T.ConfigurationIncomplete="configuration_incomplete",T.CredentialUnavailable="credential_unavailable",T.WorkflowBindingUnverified="workflow_binding_unverified",T.WorkflowRefUnprotected="workflow_ref_unprotected",T.BedrockWorkflowRequired="bedrock_workflow_required",T.DeploymentReview="deployment_review",T.SutRevisionMismatch="sut_revision_mismatch",T.IsolationUnavailable="isolation_unavailable",T.EvidenceInsufficient="evidence_insufficient",T.ConfigurationUnresolved="configuration_unresolved",T.ModelProviderDenied="model_provider_denied",T.ModelProviderUnavailable="model_provider_unavailable",T.RunnerProviderNotReady="runner_provider_not_ready",T))(ka||{}),_s=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(_s||{}),cy=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(cy||{}),uy=(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))(uy||{});var Cd=(n=>(n.Probe="probe",n.Agent="agent",n))(Cd||{}),Id=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(Id||{}),Bd=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(Bd||{});var YY=["generate-unit","native-run"],T4=["preflight","plan","write",...YY,"report","deliver"];var Qd=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(Qd||{});var bd="\xABredacted\xBB";function zr(t,e){if(!t||e.length===0)return t;let n=t;for(let r of e)!r||!n.includes(r)||(n=n.split(r).join(bd));return n}var L4=new TextDecoder("utf-8",{fatal:!0});function jt(t,e=[]){let n=t.trim();if(!n)return{error:"session produced no output"};let r=A=>{try{let l=JSON.parse(A);return typeof l=="object"&&l!==null&&!Array.isArray(l)?l:void 0}catch{return}},s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(A){i=A instanceof Error?A.message:String(A)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let A=a.length-1;A>=0;A--){let l=r(a[A][1].trim());if(l!==void 0)return{value:l}}let c;for(let A=n.indexOf("{");A!==-1;A=n.indexOf("{",A+1)){let l=0,p=!1,h=!1;for(let g=A;g<n.length;g++){let C=n[g];if(h){h=!1;continue}if(C==="\\"){h=p;continue}if(C==='"'){p=!p;continue}if(!p){if(C==="{")l++;else if(C==="}"&&(l--,l===0)){let S=r(n.slice(A,g+1));S!==void 0&&Object.keys(S).length>0&&(c=S,A=g);break}}}}return i&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:c!==void 0?{value:c}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${qY(zr(n,e))}"`}}var Px=240;function qY(t){let e=t.replace(/\s+/g," ").trim();return e.length<=Px?e:`\u2026${e.slice(-Px)}`}var Eu=Re(require("fs")),Cu=Re(require("path"));var jY=8;function Mt(t,e,n={}){let r=e.slice(0,jY),s=e.length-r.length;return{name:t,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}function va(t){if(Eu.existsSync(t))try{return JSON.parse(Eu.readFileSync(t,"utf-8"))}catch{return}}function bn(t,e){return va(Cu.join(t.outputsDir,e))}function Us(t,e){return{name:t,verify(n,r){let{errors:s}=e(n,r);return s.length===0?{name:this.name,passed:!0}:Mt(this.name,s,{fatal:!0})}}}function Iu(t){return t.replace(/\s+/g," ").trim()}var Sd=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var u={};ip(u,{BRAND:()=>Eq,DIRTY:()=>ji,EMPTY_PATH:()=>KY,INVALID:()=>ie,NEVER:()=>rj,OK:()=>Qt,ParseStatus:()=>mt,Schema:()=>Ce,ZodAny:()=>Os,ZodArray:()=>es,ZodBigInt:()=>Wi,ZodBoolean:()=>zi,ZodBranded:()=>wu,ZodCatch:()=>ao,ZodDate:()=>Ki,ZodDefault:()=>oo,ZodDiscriminatedUnion:()=>Rd,ZodEffects:()=>vn,ZodEnum:()=>so,ZodError:()=>Jt,ZodFirstPartyTypeKind:()=>Ae,ZodFunction:()=>Td,ZodIntersection:()=>to,ZodIssueCode:()=>O,ZodLazy:()=>no,ZodLiteral:()=>ro,ZodMap:()=>Fa,ZodNaN:()=>_a,ZodNativeEnum:()=>io,ZodNever:()=>Wn,ZodNull:()=>Xi,ZodNullable:()=>Er,ZodNumber:()=>Ji,ZodObject:()=>Wt,ZodOptional:()=>Sn,ZodParsedType:()=>z,ZodPipeline:()=>Qu,ZodPromise:()=>$s,ZodReadonly:()=>co,ZodRecord:()=>xd,ZodSchema:()=>Ce,ZodSet:()=>Ma,ZodString:()=>Ps,ZodSymbol:()=>Da,ZodTransformer:()=>vn,ZodTuple:()=>yr,ZodType:()=>Ce,ZodUndefined:()=>Zi,ZodUnion:()=>eo,ZodUnknown:()=>Xr,ZodVoid:()=>Na,addIssueToContext:()=>J,any:()=>vq,array:()=>Dq,bigint:()=>wq,boolean:()=>zx,coerce:()=>nj,custom:()=>jx,date:()=>Qq,datetimeRegex:()=>Yx,defaultErrorMap:()=>Kr,discriminatedUnion:()=>_q,effect:()=>Jq,enum:()=>Yq,function:()=>Vq,getErrorMap:()=>Ra,getParsedType:()=>mr,instanceof:()=>Iq,intersection:()=>Uq,isAborted:()=>kd,isAsync:()=>xa,isDirty:()=>vd,isValid:()=>Ls,late:()=>Cq,lazy:()=>Gq,literal:()=>Hq,makeIssue:()=>Bu,map:()=>Oq,nan:()=>Bq,nativeEnum:()=>qq,never:()=>xq,null:()=>kq,nullable:()=>zq,number:()=>Wx,object:()=>Nq,objectUtil:()=>Ay,oboolean:()=>tj,onumber:()=>ej,optional:()=>Wq,ostring:()=>Xq,pipeline:()=>Zq,preprocess:()=>Kq,promise:()=>jq,quotelessJson:()=>JY,record:()=>Pq,set:()=>$q,setErrorMap:()=>zY,strictObject:()=>Fq,string:()=>Jx,symbol:()=>bq,transformer:()=>Jq,tuple:()=>Lq,undefined:()=>Sq,union:()=>Mq,unknown:()=>Rq,util:()=>Qe,void:()=>Tq});var Qe;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let a of s)i[a]=a;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),a={};for(let c of i)a[c]=s[c];return t.objectValues(a)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},t.find=(s,i)=>{for(let a of s)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Qe||(Qe={}));var Ay;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ay||(Ay={}));var z=Qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mr=t=>{switch(typeof t){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(t)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};var O=Qe.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"]),JY=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Jt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let c=r,A=0;for(;A<a.path.length;){let l=a.path[A],p=A===a.path.length-1;if(l==="_errors"){p&&c._errors.push(n(a)),A++;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)),A++}}};return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Jt.create=t=>new Jt(t);var WY=(t,e)=>{let n;switch(t.code){case O.invalid_type:t.received===z.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Qe.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qe.joinValues(t.keys,", ")}`;break;case O.invalid_union:n="Invalid input";break;case O.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qe.joinValues(t.options)}`;break;case O.invalid_enum_value:n=`Invalid enum value. Expected ${Qe.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:n="Invalid function arguments";break;case O.invalid_return_type:n="Invalid function return type";break;case O.invalid_date:n="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Qe.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case O.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case O.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case O.custom:n="Invalid input";break;case O.invalid_intersection_types:n="Intersection results could not be merged";break;case O.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:n="Number must be finite";break;default:n=e.defaultError,Qe.assertNever(t)}return{message:n}},Kr=WY;var Ox=Kr;function zY(t){Ox=t}function Ra(){return Ox}var Bu=t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let c="",A=r.filter(l=>!!l).slice().reverse();for(let l of A)c=l(a,{data:e,defaultError:c}).message;return{...s,path:i,message:c}},KY=[];function J(t,e){let n=Ra(),r=Bu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Kr?void 0:Kr].filter(s=>!!s)});t.common.issues.push(r)}var mt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return ie;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,a=await s.value;r.push({key:i,value:a})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return ie;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}},ie=Object.freeze({status:"aborted"}),ji=t=>({status:"dirty",value:t}),Qt=t=>({status:"valid",value:t}),kd=t=>t.status==="aborted",vd=t=>t.status==="dirty",Ls=t=>t.status==="valid",xa=t=>typeof Promise<"u"&&t instanceof Promise;var Z;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Z||(Z={}));var kn=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},$x=(t,e)=>{if(Ls(e))return{success:!0,data:e.value};if(!t.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 Jt(t.common.issues);return this._error=n,this._error}}};function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,c)=>{let{message:A}=t;return a.code==="invalid_enum_value"?{message:A??c.defaultError}:typeof c.data>"u"?{message:A??r??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:A??n??c.defaultError}},description:s}}var Ce=class{get description(){return this._def.description}_getType(e){return mr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:mr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new mt,ctx:{common:e.parent.common,data:e.data,parsedType:mr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(xa(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mr(e)},s=this._parseSync({data:e,path:r.path,parent:r});return $x(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mr(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Ls(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Ls(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mr(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(xa(s)?s:Promise.resolve(s));return $x(r,i)}refine(e,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{let a=e(s),c=()=>i.addIssue({code:O.custom,...r(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(A=>A?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new vn({schema:this,typeName:Ae.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Sn.create(this,this._def)}nullable(){return Er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return es.create(this)}promise(){return $s.create(this,this._def)}or(e){return eo.create([this,e],this._def)}and(e){return to.create(this,e,this._def)}transform(e){return new vn({...me(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new oo({...me(this._def),innerType:this,defaultValue:n,typeName:Ae.ZodDefault})}brand(){return new wu({typeName:Ae.ZodBranded,type:this,...me(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ao({...me(this._def),innerType:this,catchValue:n,typeName:Ae.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Qu.create(this,e)}readonly(){return co.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ZY=/^c[^\s-]{8,}$/i,XY=/^[0-9a-z]+$/,eq=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tq=/^[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,nq=/^[a-z0-9_-]{21}$/i,rq=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sq=/^[-+]?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)?)??$/,iq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oq="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",ly,aq=/^(?:(?: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])$/,cq=/^(?:(?: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])$/,uq=/^(([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]))$/,Aq=/^(([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])$/,lq=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dq=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gx="((\\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])))",pq=new RegExp(`^${Gx}$`);function Hx(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function hq(t){return new RegExp(`^${Hx(t)}$`)}function Yx(t){let e=`${Gx}T${Hx(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function fq(t,e){return!!((e==="v4"||!e)&&aq.test(t)||(e==="v6"||!e)&&uq.test(t))}function gq(t,e){if(!rq.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function mq(t,e){return!!((e==="v4"||!e)&&cq.test(t)||(e==="v6"||!e)&&Aq.test(t))}var Ps=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let i=this._getOrReturnCtx(e);return J(i,{code:O.invalid_type,expected:z.string,received:i.parsedType}),ie}let r=new mt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:O.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:O.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,c=e.data.length<i.value;(a||c)&&(s=this._getOrReturnCtx(e,s),a?J(s,{code:O.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&J(s,{code:O.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")iq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"email",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")ly||(ly=new RegExp(oq,"u")),ly.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"emoji",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")tq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"uuid",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")nq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"nanoid",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")ZY.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cuid",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")XY.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cuid2",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")eq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"ulid",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),J(s,{validation:"url",code:O.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"regex",code:O.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Yx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?pq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?hq(i).test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?sq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"duration",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?fq(e.data,i.version)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"ip",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?gq(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"jwt",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?mq(e.data,i.version)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cidr",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?lq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"base64",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?dq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"base64url",code:O.invalid_string,message:i.message}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:O.invalid_string,...Z.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Z.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Z.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Z.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Z.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Z.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Z.errToObj(n)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ps.create=t=>new Ps({checks:[],typeName:Ae.ZodString,coerce:t?.coerce??!1,...me(t)});function yq(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return i%a/10**s}var Ji=class t extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==z.number){let i=this._getOrReturnCtx(e);return J(i,{code:O.invalid_type,expected:z.number,received:i.parsedType}),ie}let r,s=new mt;for(let i of this._def.checks)i.kind==="int"?Qe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:O.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?yq(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:O.not_finite,message:i.message}),s.dirty()):Qe.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Z.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Z.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Qe.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Ji.create=t=>new Ji({checks:[],typeName:Ae.ZodNumber,coerce:t?.coerce||!1,...me(t)});var Wi=class t extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==z.bigint)return this._getInvalidInput(e);let r,s=new mt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Qe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return J(n,{code:O.invalid_type,expected:z.bigint,received:n.parsedType}),ie}gte(e,n){return this.setLimit("min",e,!0,Z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Z.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Z.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Wi.create=t=>new Wi({checks:[],typeName:Ae.ZodBigInt,coerce:t?.coerce??!1,...me(t)});var zi=class extends Ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.boolean,received:r.parsedType}),ie}return Qt(e.data)}};zi.create=t=>new zi({typeName:Ae.ZodBoolean,coerce:t?.coerce||!1,...me(t)});var Ki=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let i=this._getOrReturnCtx(e);return J(i,{code:O.invalid_type,expected:z.date,received:i.parsedType}),ie}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return J(i,{code:O.invalid_date}),ie}let r=new mt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:O.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:O.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Z.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Ki.create=t=>new Ki({checks:[],coerce:t?.coerce||!1,typeName:Ae.ZodDate,...me(t)});var Da=class extends Ce{_parse(e){if(this._getType(e)!==z.symbol){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.symbol,received:r.parsedType}),ie}return Qt(e.data)}};Da.create=t=>new Da({typeName:Ae.ZodSymbol,...me(t)});var Zi=class extends Ce{_parse(e){if(this._getType(e)!==z.undefined){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.undefined,received:r.parsedType}),ie}return Qt(e.data)}};Zi.create=t=>new Zi({typeName:Ae.ZodUndefined,...me(t)});var Xi=class extends Ce{_parse(e){if(this._getType(e)!==z.null){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.null,received:r.parsedType}),ie}return Qt(e.data)}};Xi.create=t=>new Xi({typeName:Ae.ZodNull,...me(t)});var Os=class extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Qt(e.data)}};Os.create=t=>new Os({typeName:Ae.ZodAny,...me(t)});var Xr=class extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Qt(e.data)}};Xr.create=t=>new Xr({typeName:Ae.ZodUnknown,...me(t)});var Wn=class extends Ce{_parse(e){let n=this._getOrReturnCtx(e);return J(n,{code:O.invalid_type,expected:z.never,received:n.parsedType}),ie}};Wn.create=t=>new Wn({typeName:Ae.ZodNever,...me(t)});var Na=class extends Ce{_parse(e){if(this._getType(e)!==z.undefined){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.void,received:r.parsedType}),ie}return Qt(e.data)}};Na.create=t=>new Na({typeName:Ae.ZodVoid,...me(t)});var es=class t extends Ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==z.array)return J(n,{code:O.invalid_type,expected:z.array,received:n.parsedType}),ie;if(s.exactLength!==null){let a=n.data.length>s.exactLength.value,c=n.data.length<s.exactLength.value;(a||c)&&(J(n,{code:a?O.too_big:O.too_small,minimum:c?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(J(n,{code:O.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(J(n,{code:O.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>s.type._parseAsync(new kn(n,a,n.path,c)))).then(a=>mt.mergeArray(r,a));let i=[...n.data].map((a,c)=>s.type._parseSync(new kn(n,a,n.path,c)));return mt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:Z.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:Z.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:Z.toString(n)}})}nonempty(e){return this.min(1,e)}};es.create=(t,e)=>new es({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...me(e)});function Ta(t){if(t instanceof Wt){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Sn.create(Ta(r))}return new Wt({...t._def,shape:()=>e})}else return t instanceof es?new es({...t._def,type:Ta(t.element)}):t instanceof Sn?Sn.create(Ta(t.unwrap())):t instanceof Er?Er.create(Ta(t.unwrap())):t instanceof yr?yr.create(t.items.map(e=>Ta(e))):t}var Wt=class t extends Ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=Qe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==z.object){let l=this._getOrReturnCtx(e);return J(l,{code:O.invalid_type,expected:z.object,received:l.parsedType}),ie}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof Wn&&this._def.unknownKeys==="strip"))for(let l in s.data)a.includes(l)||c.push(l);let A=[];for(let l of a){let p=i[l],h=s.data[l];A.push({key:{status:"valid",value:l},value:p._parse(new kn(s,h,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof Wn){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of c)A.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(l==="strict")c.length>0&&(J(s,{code:O.unrecognized_keys,keys:c}),r.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 h=s.data[p];A.push({key:{status:"valid",value:p},value:l._parse(new kn(s,h,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of A){let h=await p.key,g=await p.value;l.push({key:h,value:g,alwaysSet:p.alwaysSet})}return l}).then(l=>mt.mergeObjectSync(r,l)):mt.mergeObjectSync(r,A)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Z.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ae.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of Qe.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of Qe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Ta(this)}partial(e){let n={};for(let r of Qe.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of Qe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Sn;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return qx(Qe.objectKeys(this.shape))}};Wt.create=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strip",catchall:Wn.create(),typeName:Ae.ZodObject,...me(e)});Wt.strictCreate=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strict",catchall:Wn.create(),typeName:Ae.ZodObject,...me(e)});Wt.lazycreate=(t,e)=>new Wt({shape:t,unknownKeys:"strip",catchall:Wn.create(),typeName:Ae.ZodObject,...me(e)});var eo=class extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let c of i)if(c.result.status==="valid")return c.result;for(let c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=i.map(c=>new Jt(c.ctx.common.issues));return J(n,{code:O.invalid_union,unionErrors:a}),ie}if(n.common.async)return Promise.all(r.map(async i=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(s);{let i,a=[];for(let A of r){let l={...n,common:{...n.common,issues:[]},parent:null},p=A._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let c=a.map(A=>new Jt(A));return J(n,{code:O.invalid_union,unionErrors:c}),ie}}get options(){return this._def.options}};eo.create=(t,e)=>new eo({options:t,typeName:Ae.ZodUnion,...me(e)});var Zr=t=>t instanceof no?Zr(t.schema):t instanceof vn?Zr(t.innerType()):t instanceof ro?[t.value]:t instanceof so?t.options:t instanceof io?Qe.objectValues(t.enum):t instanceof oo?Zr(t._def.innerType):t instanceof Zi?[void 0]:t instanceof Xi?[null]:t instanceof Sn?[void 0,...Zr(t.unwrap())]:t instanceof Er?[null,...Zr(t.unwrap())]:t instanceof wu||t instanceof co?Zr(t.unwrap()):t instanceof ao?Zr(t._def.innerType):[],Rd=class t extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return J(n,{code:O.invalid_type,expected:z.object,received:n.parsedType}),ie;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(J(n,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let a=Zr(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(s.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);s.set(c,i)}}return new t({typeName:Ae.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...me(r)})}};function dy(t,e){let n=mr(t),r=mr(e);if(t===e)return{valid:!0,data:t};if(n===z.object&&r===z.object){let s=Qe.objectKeys(e),i=Qe.objectKeys(t).filter(c=>s.indexOf(c)!==-1),a={...t,...e};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let c of i){if(c==="__proto__")continue;let A=dy(t[c],e[c]);if(!A.valid)return{valid:!1};a[c]=A.data}return{valid:!0,data:a}}else if(n===z.array&&r===z.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let a=t[i],c=e[i],A=dy(a,c);if(!A.valid)return{valid:!1};s.push(A.data)}return{valid:!0,data:s}}else return n===z.date&&r===z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var to=class extends Ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=(i,a)=>{if(kd(i)||kd(a))return ie;let c=dy(i.value,a.value);return c.valid?((vd(i)||vd(a))&&n.dirty(),{status:n.value,value:c.data}):(J(r,{code:O.invalid_intersection_types}),ie)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};to.create=(t,e,n)=>new to({left:t,right:e,typeName:Ae.ZodIntersection,...me(n)});var yr=class t extends Ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==z.array)return J(r,{code:O.invalid_type,expected:z.array,received:r.parsedType}),ie;if(r.data.length<this._def.items.length)return J(r,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&r.data.length>this._def.items.length&&(J(r,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((a,c)=>{let A=this._def.items[c]||this._def.rest;return A?A._parse(new kn(r,a,r.path,c)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>mt.mergeArray(n,a)):mt.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};yr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yr({items:t,typeName:Ae.ZodTuple,rest:null,...me(e)})};var xd=class t extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return J(r,{code:O.invalid_type,expected:z.object,received:r.parsedType}),ie;let s=[],i=this._def.keyType,a=this._def.valueType;for(let c in r.data)s.push({key:i._parse(new kn(r,c,r.path,c)),value:a._parse(new kn(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?mt.mergeObjectAsync(n,s):mt.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ce?new t({keyType:e,valueType:n,typeName:Ae.ZodRecord,...me(r)}):new t({keyType:Ps.create(),valueType:e,typeName:Ae.ZodRecord,...me(n)})}},Fa=class extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==z.map)return J(r,{code:O.invalid_type,expected:z.map,received:r.parsedType}),ie;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([c,A],l)=>({key:s._parse(new kn(r,c,r.path,[l,"key"])),value:i._parse(new kn(r,A,r.path,[l,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let A of a){let l=await A.key,p=await A.value;if(l.status==="aborted"||p.status==="aborted")return ie;(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 A of a){let l=A.key,p=A.value;if(l.status==="aborted"||p.status==="aborted")return ie;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}}}};Fa.create=(t,e,n)=>new Fa({valueType:e,keyType:t,typeName:Ae.ZodMap,...me(n)});var Ma=class t extends Ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==z.set)return J(r,{code:O.invalid_type,expected:z.set,received:r.parsedType}),ie;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(J(r,{code:O.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(J(r,{code:O.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function a(A){let l=new Set;for(let p of A){if(p.status==="aborted")return ie;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}let c=[...r.data.values()].map((A,l)=>i._parse(new kn(r,A,r.path,l)));return r.common.async?Promise.all(c).then(A=>a(A)):a(c)}min(e,n){return new t({...this._def,minSize:{value:e,message:Z.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:Z.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Ma.create=(t,e)=>new Ma({valueType:t,minSize:null,maxSize:null,typeName:Ae.ZodSet,...me(e)});var Td=class t extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==z.function)return J(n,{code:O.invalid_type,expected:z.function,received:n.parsedType}),ie;function r(c,A){return Bu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ra(),Kr].filter(l=>!!l),issueData:{code:O.invalid_arguments,argumentsError:A}})}function s(c,A){return Bu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ra(),Kr].filter(l=>!!l),issueData:{code:O.invalid_return_type,returnTypeError:A}})}let i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof $s){let c=this;return Qt(async function(...A){let l=new Jt([]),p=await c._def.args.parseAsync(A,i).catch(C=>{throw l.addIssue(r(A,C)),l}),h=await Reflect.apply(a,this,p);return await c._def.returns._def.type.parseAsync(h,i).catch(C=>{throw l.addIssue(s(h,C)),l})})}else{let c=this;return Qt(function(...A){let l=c._def.args.safeParse(A,i);if(!l.success)throw new Jt([r(A,l.error)]);let p=Reflect.apply(a,this,l.data),h=c._def.returns.safeParse(p,i);if(!h.success)throw new Jt([s(p,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:yr.create(e).rest(Xr.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||yr.create([]).rest(Xr.create()),returns:n||Xr.create(),typeName:Ae.ZodFunction,...me(r)})}},no=class extends Ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};no.create=(t,e)=>new no({getter:t,typeName:Ae.ZodLazy,...me(e)});var ro=class extends Ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return J(n,{received:n.data,code:O.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:e.data}}get value(){return this._def.value}};ro.create=(t,e)=>new ro({value:t,typeName:Ae.ZodLiteral,...me(e)});function qx(t,e){return new so({values:t,typeName:Ae.ZodEnum,...me(e)})}var so=class t extends Ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return J(n,{expected:Qe.joinValues(r),received:n.parsedType,code:O.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return J(n,{received:n.data,code:O.invalid_enum_value,options:r}),ie}return Qt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};so.create=qx;var io=class extends Ce{_parse(e){let n=Qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==z.string&&r.parsedType!==z.number){let s=Qe.objectValues(n);return J(r,{expected:Qe.joinValues(s),received:r.parsedType,code:O.invalid_type}),ie}if(this._cache||(this._cache=new Set(Qe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=Qe.objectValues(n);return J(r,{received:r.data,code:O.invalid_enum_value,options:s}),ie}return Qt(e.data)}get enum(){return this._def.values}};io.create=(t,e)=>new io({values:t,typeName:Ae.ZodNativeEnum,...me(e)});var $s=class extends Ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==z.promise&&n.common.async===!1)return J(n,{code:O.invalid_type,expected:z.promise,received:n.parsedType}),ie;let r=n.parsedType===z.promise?n.data:Promise.resolve(n.data);return Qt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};$s.create=(t,e)=>new $s({type:t,typeName:Ae.ZodPromise,...me(e)});var vn=class extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:a=>{J(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return ie;let A=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return A.status==="aborted"?ie:A.status==="dirty"?ji(A.value):n.value==="dirty"?ji(A.value):A});{if(n.value==="aborted")return ie;let c=this._def.schema._parseSync({data:a,path:r.path,parent:r});return c.status==="aborted"?ie:c.status==="dirty"?ji(c.value):n.value==="dirty"?ji(c.value):c}}if(s.type==="refinement"){let a=c=>{let A=s.refinement(c,i);if(r.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?ie:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?ie:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(s.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ls(a))return ie;let c=s.transform(a.value,i);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:r.data,path:r.path,parent:r}).then(a=>Ls(a)?Promise.resolve(s.transform(a.value,i)).then(c=>({status:n.value,value:c})):ie);Qe.assertNever(s)}};vn.create=(t,e,n)=>new vn({schema:t,typeName:Ae.ZodEffects,effect:e,...me(n)});vn.createWithPreprocess=(t,e,n)=>new vn({schema:e,effect:{type:"preprocess",transform:t},typeName:Ae.ZodEffects,...me(n)});var Sn=class extends Ce{_parse(e){return this._getType(e)===z.undefined?Qt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Sn.create=(t,e)=>new Sn({innerType:t,typeName:Ae.ZodOptional,...me(e)});var Er=class extends Ce{_parse(e){return this._getType(e)===z.null?Qt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Er.create=(t,e)=>new Er({innerType:t,typeName:Ae.ZodNullable,...me(e)});var oo=class extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===z.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};oo.create=(t,e)=>new oo({innerType:t,typeName:Ae.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...me(e)});var ao=class extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return xa(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Jt(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Jt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ao.create=(t,e)=>new ao({innerType:t,typeName:Ae.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...me(e)});var _a=class extends Ce{_parse(e){if(this._getType(e)!==z.nan){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.nan,received:r.parsedType}),ie}return{status:"valid",value:e.data}}};_a.create=t=>new _a({typeName:Ae.ZodNaN,...me(t)});var Eq=Symbol("zod_brand"),wu=class extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Qu=class t extends Ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ie:i.status==="dirty"?(n.dirty(),ji(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ie:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Ae.ZodPipeline})}},co=class extends Ce{_parse(e){let n=this._def.innerType._parse(e),r=s=>(Ls(s)&&(s.value=Object.freeze(s.value)),s);return xa(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};co.create=(t,e)=>new co({innerType:t,typeName:Ae.ZodReadonly,...me(e)});function Vx(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function jx(t,e={},n){return t?Os.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(a=>{if(!a){let c=Vx(e,r),A=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:A})}});if(!i){let a=Vx(e,r),c=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:c})}}):Os.create()}var Cq={object:Wt.lazycreate},Ae;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ae||(Ae={}));var Iq=(t,e={message:`Input not instance of ${t.name}`})=>jx(n=>n instanceof t,e),Jx=Ps.create,Wx=Ji.create,Bq=_a.create,wq=Wi.create,zx=zi.create,Qq=Ki.create,bq=Da.create,Sq=Zi.create,kq=Xi.create,vq=Os.create,Rq=Xr.create,xq=Wn.create,Tq=Na.create,Dq=es.create,Nq=Wt.create,Fq=Wt.strictCreate,Mq=eo.create,_q=Rd.create,Uq=to.create,Lq=yr.create,Pq=xd.create,Oq=Fa.create,$q=Ma.create,Vq=Td.create,Gq=no.create,Hq=ro.create,Yq=so.create,qq=io.create,jq=$s.create,Jq=vn.create,Wq=Sn.create,zq=Er.create,Kq=vn.createWithPreprocess,Zq=Qu.create,Xq=()=>Jx().optional(),ej=()=>Wx().optional(),tj=()=>zx().optional(),nj={string:(t=>Ps.create({...t,coerce:!0})),number:(t=>Ji.create({...t,coerce:!0})),boolean:(t=>zi.create({...t,coerce:!0})),bigint:(t=>Wi.create({...t,coerce:!0})),date:(t=>Ki.create({...t,coerce:!0}))};var rj=ie;function sj(t){return t.issues.map(e=>{let n=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${r} ${e.message}`;switch(e.code){case"invalid_type":return n?e.expected==="object"?`${r} must be an object`:e.received==="undefined"?`${r} is required`:`${r} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(c=>typeof c=="string"&&typeof e.received=="string"&&e.received.startsWith(c)),a=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${e.options.join(", ")}${a}`}case"invalid_literal":return`${r} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${e.keys.join(", ")}`;default:return`${r}: ${e.message}`}})}function ts(t,e){let n=t.safeParse(e);if(n.success)return{value:n.data,errors:[]};let r=(i,a)=>a.reduce((c,A)=>c&&typeof c=="object"?c[A]:void 0,i),s=n.error.issues.filter(i=>i.path.length&&r(e,i.path)===null);if(s.length===n.error.issues.length)try{let i=t.safeParse(s.reduce((a,{path:c})=>Kx(a,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:sj(n.error)}}function Kx(t,e){if(!e.length||!t||typeof t!="object")return t;let[n,...r]=e,s=Array.isArray(t)?t.slice():{...t};return r.length?s[n]=Kx(s[n],r):delete s[n],s}var B8=new Set(Object.values(_s));var w8=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var Dd=["-c","core.fsmonitor=false"],ij=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),oj=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function zn(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&oj.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(ij.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}var Ua=Re(require("path"));var N8=Ua.join(".skyramp","workspace.yml");var aj={py:"python",go:"go",java:"java",kt:"kotlin",rb:"ruby",cs:"csharp",ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",kts:"kotlin",rs:"rust",php:"php",scala:"scala",swift:"swift",ex:"elixir",exs:"elixir",dart:"dart",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",groovy:"groovy"};var F8=new Set(Object.values(aj));var ns=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(ns||{}),Vs=u.string().trim().min(1),uj=u.object({url:u.string().optional().describe("the URL probed, if the check is an HTTP request"),command:u.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:u.record(u.string()).optional(),status:u.union([u.number(),u.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:Vs.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),py=u.array(u.object({component:Vs.describe("a shared component listed above"),url:Vs.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:Vs.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"),Xx=u.object({schemaVersion:u.literal(1),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:uj.optional(),teardown:Vs.describe("command that tears the SUT down"),dependencies:u.record(u.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:u.nativeEnum(ns).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:u.array(u.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:u.object({command:Vs,output:Vs}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:u.array(u.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:u.boolean(),startedAt:Vs.describe("ISO timestamp"),revisions:py.optional()});var bu=(n=>(n.Full="full",n.Static="static",n))(bu||{}),Gs=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(Gs||{}),Su=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(Su||{}),uo=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(uo||{}),Nd=(l=>(l.Equals="equals",l.NotEquals="not_equals",l.GreaterThan="greater_than",l.LessThan="less_than",l.Contains="contains",l.NotContains="not_contains",l.Matches="matches",l.Absent="absent",l.Present="present",l))(Nd||{});var hn=u.string().trim().min(1),lj=u.object({subject:hn.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:u.nativeEnum(Nd),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),dj=u.object({test:hn.describe("existing test path, relative to its repository"),repository:hn.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(uo),evidence:hn.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers")});var pj=u.object({surface:hn.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(Su)}),hj=u.object({id:hn.describe("short-slug, unique across generate[]"),type:u.nativeEnum(Gs),target:hn.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:pj.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:hn.describe("why this test matters"),expected_observable:hn.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:lj.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:hn.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),fj=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((t,e)=>{let n=Array.isArray(t.covered),r=typeof t.abstain=="string";if(n===r)return void e.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&t.covered.length===0&&e.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!t.abstain.trim()&&e.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),gj=u.object({surface:hn.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(Su).map(t=>[t,fj])))}),e0=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(bu),maintenance:u.array(dj),generate:u.array(hj),surfaces:u.array(gj).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:hn}),summary:hn.describe("one paragraph")});var Ao=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Ao||{}),Je=u.string().trim().min(1),mj=u.object({action:u.enum(["start","run","wait"]),text:Je,source:u.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Je.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),yj=/^[A-Za-z_][A-Za-z0-9_]*$/,La=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Pa=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Pa||{}),zt="shared",Ej=Je.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),Oa=u.object({address:Ej,readyWhen:Je.nullable(),credentials:u.array(u.string().regex(La)).max(50),revisionSources:u.array(u.object({method:u.nativeEnum(Pa),detail:Je.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:u.array(Je).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),hy={steps:u.array(mj).max(20).optional().describe("how it starts, in order"),kind:u.enum(["web_app","service","database","external_service"]).optional(),from:u.object({file:Je,service:Je.nullable()}).strict().optional(),credentials:u.array(u.string().max(100).regex(yj)).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")},Cj=u.object({name:Je,repository:Je.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:u.boolean(),...hy,deployed:Je.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),Ij=u.object({component:Je,problem:Je,evidence:Je.describe("the exact command and output that shows it"),fix:Je.describe("what the user must provide, and where")}),Bj=u.object({framework:Je,file:Je.describe("the test file run, relative to its repository root"),result:u.enum(["pass","fail","error"])}),wj=u.object({input:Je.describe("the part of the user's SUT input, as given"),reason:Je}),t0=u.object({schemaVersion:u.literal(1),status:u.nativeEnum(Ao).describe("ready only if every component came up healthy and the recipe is written"),components:u.array(Cj),suites:u.array(Bj).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:u.array(Je).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:u.array(u.object({input:Je.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Je.describe("what the recipe did with it")})).optional(),inputsNotUsed:u.array(wj).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one that names a file, command, port, route or setting that does not exist or does not work (SKYR-5265)"),blockers:u.array(Ij).describe("required (non-empty) when status is blocked"),environment:Oa.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var ku=64*1024,vu=512*1024,fy=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var n0=".skyramp/sut/deployed-revisions.sh",gy=(n=>(n.Running="running",n.Requested="requested",n))(gy||{});var W8=new Set(Object.values(gy));var z8=`Fix ${n0} so it prints the full commit each component runs, then set it up again.`;var my="shared-environment";var c5=64*1024;var u5=new Set(["version_endpoint","api"]);function Md(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}function s0(t){return Md(t).length>0||(t?.dependencies.length??0)>0}function Sj(t){let e=t.inputs?.sharedEnvironment;if(!s0(e))return;let n=bn(t,`${my}.json`);if(n)return{components:kj(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:Md(e).map(s=>i0(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}var i0=(t,e)=>({name:t.name,repository:t.repository,url:t.url,expectedRevision:t.expectedRevision,observedRevision:null,status:"unverifiable",source:t.revisionUrl||t.revisionScript?"probe":"agent",evidence:e});function kj(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=Md(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>i0(s,"Not checked: the run recorded no read of it."))]}function yy(t){return(Sj(t)?.components??[]).filter(e=>e.status!=="verified")}function Ey(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}function By(t){return a0(t)&&yy(t).length===0&&Ey(t.inputs?.sharedEnvironment).length===0}function a0(t){let e=Nj(t);if(!e&&t.state.stages.deploy?.status!=="passed")return!1;let n=bn(t,"deploy.json");return n?n.outcome==="clean"||n.outcome==="recipe-drift":!e}function Nj(t){let e=t.state.stages.plan,n=t.state.stages.deploy;return!(t.inputs?.pipeline?t.inputs.pipeline==="two-step":!n)||e?.status!=="passed"?!1:!n||n.updatedAt<=e.updatedAt}var $a=(a=>(a.Place="place",a.Update="update",a.Regenerate="regenerate",a.Delete="delete",a.Verify="verify",a.None="none",a))($a||{}),Kn=(r=>(r.Pass="pass",r.Fail="fail",r.Skip="skip",r))(Kn||{}),Rn=u.string().trim().min(1),c0=u.object({case:Rn.describe("a covers id \u2014 the recommend case this test realizes"),status:u.nativeEnum(Kn)}),u0=u.object({exit:u.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:u.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:u.array(c0).optional().describe("ONE ENTRY PER CASE the file covers; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one)")}),A0=u.object({from:u.string().optional().describe("staged path \u2014 required for placements"),file:Rn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Rn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum($a),covers:u.array(u.string()).optional().describe("recommend ids a placed test covers"),repro:u.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:u.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:u.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Rn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Rn.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:u0,assertionCount:u.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time")}).refine(t=>t.action!=="place"||typeof t.from=="string"&&t.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),l0=(n=>(n.Junit="junit",n.Converter="converter",n))(l0||{}),Fj=Rn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),Mj=u.object({results:Rn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:u.nativeEnum(l0),run:Rn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:u.array(Rn).min(1).describe("the items[].file paths this run covered"),cases:u.array(u.object({test:Rn.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:Rn.describe("the covers id it realizes"),file:Fj})).describe("map each reported test name to the case it covers")}),_j=u.object({suites:u.array(Mj).min(1)}),wy=u.object({schemaVersion:u.literal(1),items:u.array(A0),runnerResults:_j.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:u.array(u.string()).describe("existing tests assessed and deliberately left untouched"),summary:Rn.describe("one paragraph")});var q5=10*6e4;var po=Re(require("fs"));function p0(t){let e=[];for(let n of Vj(t)){let r=n;r?.type==="tool_use"&&typeof r.name=="string"&&e.push(r.name)}return e}function h0(t){return p0(t).some(e=>/^mcp__skyramp__skyramp_(contract|integration)_test_generation$/.test(e))}function f0(t){return p0(t).some(e=>e==="mcp__skyramp__skyramp_ui_test_generation")}function $j(t){if(!po.existsSync(t))return{};for(let e of po.readFileSync(t,"utf-8").split(`
|
|
116
|
+
`:""}return ry.dump=E,ry}var Ax;function OY(){if(Ax)return wt;Ax=1;let t=LY(),e=PY();function n(r,s){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return wt.Type=Ft(),wt.Schema=lx(),wt.FAILSAFE_SCHEMA=fx(),wt.JSON_SCHEMA=Cx(),wt.CORE_SCHEMA=Ix(),wt.DEFAULT_SCHEMA=sy(),wt.load=t.load,wt.loadAll=t.loadAll,wt.dump=e.dump,wt.YAMLException=fu(),wt.types={binary:Qx(),float:Ex(),map:hx(),null:gx(),pairs:Sx(),set:kx(),timestamp:Bx(),bool:mx(),int:yx(),merge:wx(),omap:bx(),seq:px(),str:dx()},wt.safeLoad=n("safeLoad","load"),wt.safeLoadAll=n("safeLoadAll","loadAll"),wt.safeDump=n("safeDump","dump"),wt}var $Y=OY(),VY=_Y($Y),{Type:A4,Schema:l4,FAILSAFE_SCHEMA:d4,JSON_SCHEMA:vx,CORE_SCHEMA:p4,DEFAULT_SCHEMA:h4,load:gu,loadAll:GY,dump:f4,YAMLException:g4,types:m4,safeLoad:y4,safeLoadAll:E4,safeDump:C4}=VY;var Wr=t=>typeof t=="string"?t:void 0;function xx(t){let e={services:[]},n;try{let A=Rx.readFileSync(t,"utf8");n=gu(A,{schema:vx})}catch(A){return Pe(`Lenient parse: failed to read/parse ${t}: ${A.message}`),e}if(!n||typeof n!="object"||Array.isArray(n))return Pe(`Lenient parse: ${t} did not contain a YAML object`),e;let r=n,s=r.metadata&&typeof r.metadata=="object"?r.metadata:void 0,i=s?{executorVersion:Wr(s.executorVersion),mcpVersion:Wr(s.mcpVersion)}:void 0,c=(Array.isArray(r.services)?r.services:[]).reduce((A,l,p)=>{if(!l||typeof l!="object"||Array.isArray(l))return Pe(`Lenient parse: services[${p}] is not an object \u2014 skipping`),A;let h=l,g=Wr(h.serviceName);if(!g)return Pe(`Lenient parse: services[${p}] missing or non-string serviceName \u2014 skipping`),A;let C=h.api&&typeof h.api=="object"?h.api:void 0,S=h.runtimeDetails&&typeof h.runtimeDetails=="object"?h.runtimeDetails:void 0;return A.push({serviceName:g,language:Wr(h.language),framework:Wr(h.framework),testDirectory:Wr(h.testDirectory),api:C?{baseUrl:Wr(C.baseUrl)}:void 0,runtimeDetails:S?{serverStartCommand:Wr(S.serverStartCommand),serverTeardownCommand:Wr(S.serverTeardownCommand)}:void 0}),A},[]);return{metadata:i,services:c}}async function Dx(t){let e=Tx.resolve(t.workingDirectory),n=new fd(e),r=[],s=t.targetSetupCommand,i=t.targetTeardownCommand,a=t.skyrampExecutorVersion,c=t.skyrampMcpVersion;if(await n.exists()){In(`Found ${n.getConfigPath()}, loading workspace configuration...`);try{let l;try{l=await n.read()}catch(h){Pe(`${n.getConfigPath()} failed strict validation: ${h.message}. Re-reading with per-field lenient parse \u2014 invalid fields will fall back to action input defaults.`),l=xx(n.getConfigPath())}l.metadata&&(!a&&l.metadata.executorVersion&&(a=l.metadata.executorVersion),!c&&l.metadata.mcpVersion&&(c=l.metadata.mcpVersion));for(let h of l.services??[])r.push({serviceName:h.serviceName,language:h.language,framework:h.framework,baseUrl:h.api?.baseUrl,testDirectory:h.testDirectory});let p=(l.services??[])[0];if(p){!s&&p.runtimeDetails?.serverStartCommand&&(s=p.runtimeDetails.serverStartCommand);let h=p.runtimeDetails?.serverTeardownCommand;!i&&typeof h=="string"&&(i=h)}}catch(l){Pe(`Failed to parse ${n.getConfigPath()}: ${l.message} \u2014 falling back to action input defaults`)}}else ou("No .skyramp/workspace.yml found, using action input defaults");a||(a="v1.3.54"),c||(c="latest"),s||(s="docker compose up -d --build");let A={targetSetupCommand:s,authTokenCommand:t.authTokenCommand,targetTeardownCommand:i,skipTargetTeardown:t.skipTargetTeardown,skyrampExecutorVersion:a,skyrampMcpVersion:c,skyrampMcpSource:t.skyrampMcpSource,skyrampMcpGithubRef:t.skyrampMcpGithubRef,nodeVersion:t.nodeVersion,skipTargetSetup:t.skipTargetSetup,targetReadyCheckCommand:t.targetReadyCheckCommand,targetReadyCheckTimeout:t.targetReadyCheckTimeout,targetReadyCheckInterval:t.targetReadyCheckInterval,targetReadyCheckDiagnosticsCommand:t.targetReadyCheckDiagnosticsCommand,autoCommit:t.autoCommit,commitMessage:t.commitMessage,generatedTestsMode:t.generatedTestsMode,postPrComment:t.postPrComment,testExecutionTimeout:t.testExecutionTimeout,maxRecommendations:t.maxRecommendations,maxGenerate:t.maxGenerate,perTestMaxFixAttempts:t.perTestMaxFixAttempts,testbotMaxRetries:t.testbotMaxRetries,testbotRetryDelay:t.testbotRetryDelay,testbotTimeout:t.testbotTimeout,targetSetupRetries:t.targetSetupRetries,targetSetupRetryDelay:t.targetSetupRetryDelay,authTokenRetries:t.authTokenRetries,authTokenRetryDelay:t.authTokenRetryDelay,reportCollapsed:t.reportCollapsed,language:t.language,enableDebug:t.enableDebug,testRepoPath:t.testRepoPath,relatedRepoPaths:t.relatedRepoPaths,services:r};Zl("Resolved configuration");for(let[l,p]of Object.entries(A))l==="authTokenCommand"?In(` ${l}: [REDACTED]`):l==="services"?In(` ${l}: ${JSON.stringify(p)}`):In(` ${l}: ${p}`);return Xl(),A}Dt();Dt();zg();var Fx=Re(require("child_process")),iy=class extends Error{constructor(e){super(e),this.name="ExecTimeoutError"}},yd=class extends Error{constructor(e){super(e),this.name="ExecAbortedError"}};function Nx(t,e){if(!(!t||t.destroyed||t.writableEnded))try{t.write(e)}catch(n){Pe(`stream write failed: ${n instanceof Error?n.message:String(n)}`)}}async function Mx(t,e=[],n={}){let r="",s="",i={cwd:n.cwd,silent:n.silent??!1,ignoreReturnCode:n.ignoreReturnCode??!1,env:n.env?{...process.env,...n.env}:void 0,input:n.input,listeners:{stdout:c=>{r+=c.toString(),Nx(n.stdoutStream,c)},stderr:c=>{s+=c.toString()}}};if(n.timeout||n.signal){let c=n.signal;return c?.aborted?Promise.reject(new yd(`Command aborted before start: ${t}`)):new Promise((A,l)=>{let p=Fx.spawn(t,e,{cwd:n.cwd,env:n.env?{...process.env,...n.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});p.stdout?.on("data",v=>{r+=v.toString(),n.silent||process.stdout.write(v),Nx(n.stdoutStream,v)}),p.stderr?.on("data",v=>{s+=v.toString(),n.silent||process.stderr.write(v)}),n.input&&p.stdin?.end(n.input);let h=()=>{S&&clearTimeout(S),c?.removeEventListener("abort",C)},g=v=>{h();try{p.kill("SIGTERM")}catch{}l(v)},C=()=>g(new yd(`Command aborted: ${t}`)),S=n.timeout?setTimeout(()=>g(new iy(`Command timed out after ${Math.round(n.timeout/6e4)}m: ${t}`)),n.timeout):void 0;c?.addEventListener("abort",C,{once:!0}),p.on("close",v=>{h();let T=v??1;T!==0&&!n.ignoreReturnCode?l(new Error(`The process '${t}' failed with exit code ${T}`)):A({exitCode:T,stdout:r,stderr:s})}),p.on("error",v=>{h(),l(v)})})}return{exitCode:await pv(t,e,i),stdout:r,stderr:s}}async function _x(t,e){Zl(t);try{return await e()}finally{Xl()}}async function Ux(t,e){await _x("Tearing down services",async()=>{if(t.skipTargetTeardown){ou("Skipping service teardown (skipTargetTeardown=true)");return}if(!t.targetTeardownCommand){In("No targetTeardownCommand configured, skipping teardown");return}In(`Running teardown command: ${t.targetTeardownCommand}`);try{await Mx("bash",["-c",t.targetTeardownCommand],{cwd:e}),ou("Services torn down successfully")}catch(n){let r=n instanceof Error?n.message:String(n);Pe(`Service teardown command failed (non-fatal): ${r}`)}})}Dt();Dt();var qi=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(qi||{});var oy=t=>`${t.source}:${t.site??""}:${t.key}`;var Ed=/^pasted-[0-9a-f]{16}$/,mu=/^file-[0-9a-f]{16}$/,yu=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(yu||{});var ay=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(ay||{}),Sa=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(Sa||{}),ka=(T=>(T.RelatedChangeConflict="related_change_conflict",T.ReferenceOutsideTarget="reference_outside_target",T.SourceAccessLost="source_access_lost",T.ConfigurationIncomplete="configuration_incomplete",T.CredentialUnavailable="credential_unavailable",T.WorkflowBindingUnverified="workflow_binding_unverified",T.WorkflowRefUnprotected="workflow_ref_unprotected",T.BedrockWorkflowRequired="bedrock_workflow_required",T.DeploymentReview="deployment_review",T.SutRevisionMismatch="sut_revision_mismatch",T.IsolationUnavailable="isolation_unavailable",T.EvidenceInsufficient="evidence_insufficient",T.ConfigurationUnresolved="configuration_unresolved",T.ModelProviderDenied="model_provider_denied",T.ModelProviderUnavailable="model_provider_unavailable",T.RunnerProviderNotReady="runner_provider_not_ready",T))(ka||{}),_s=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(_s||{}),cy=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(cy||{}),uy=(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))(uy||{});var Cd=(n=>(n.Probe="probe",n.Agent="agent",n))(Cd||{}),Id=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(Id||{}),Bd=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(Bd||{});var YY=["generate-unit","native-run"],T4=["preflight","plan","write",...YY,"report","deliver"];var Qd=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(Qd||{});var bd="\xABredacted\xBB";function zr(t,e){if(!t||e.length===0)return t;let n=t;for(let r of e)!r||!n.includes(r)||(n=n.split(r).join(bd));return n}var L4=new TextDecoder("utf-8",{fatal:!0});function jt(t,e=[]){let n=t.trim();if(!n)return{error:"session produced no output"};let r=A=>{try{let l=JSON.parse(A);return typeof l=="object"&&l!==null&&!Array.isArray(l)?l:void 0}catch{return}},s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(A){i=A instanceof Error?A.message:String(A)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let A=a.length-1;A>=0;A--){let l=r(a[A][1].trim());if(l!==void 0)return{value:l}}let c;for(let A=n.indexOf("{");A!==-1;A=n.indexOf("{",A+1)){let l=0,p=!1,h=!1;for(let g=A;g<n.length;g++){let C=n[g];if(h){h=!1;continue}if(C==="\\"){h=p;continue}if(C==='"'){p=!p;continue}if(!p){if(C==="{")l++;else if(C==="}"&&(l--,l===0)){let S=r(n.slice(A,g+1));S!==void 0&&Object.keys(S).length>0&&(c=S,A=g);break}}}}return i&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:c!==void 0?{value:c}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${qY(zr(n,e))}"`}}var Px=240;function qY(t){let e=t.replace(/\s+/g," ").trim();return e.length<=Px?e:`\u2026${e.slice(-Px)}`}var Eu=Re(require("fs")),Cu=Re(require("path"));var jY=8;function Mt(t,e,n={}){let r=e.slice(0,jY),s=e.length-r.length;return{name:t,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}function va(t){if(Eu.existsSync(t))try{return JSON.parse(Eu.readFileSync(t,"utf-8"))}catch{return}}function bn(t,e){return va(Cu.join(t.outputsDir,e))}function Us(t,e){return{name:t,verify(n,r){let{errors:s}=e(n,r);return s.length===0?{name:this.name,passed:!0}:Mt(this.name,s,{fatal:!0})}}}function Iu(t){return t.replace(/\s+/g," ").trim()}var Sd=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var u={};ip(u,{BRAND:()=>Eq,DIRTY:()=>ji,EMPTY_PATH:()=>KY,INVALID:()=>ie,NEVER:()=>rj,OK:()=>Qt,ParseStatus:()=>mt,Schema:()=>Ce,ZodAny:()=>Os,ZodArray:()=>es,ZodBigInt:()=>Wi,ZodBoolean:()=>zi,ZodBranded:()=>wu,ZodCatch:()=>ao,ZodDate:()=>Ki,ZodDefault:()=>oo,ZodDiscriminatedUnion:()=>Rd,ZodEffects:()=>vn,ZodEnum:()=>so,ZodError:()=>Jt,ZodFirstPartyTypeKind:()=>Ae,ZodFunction:()=>Td,ZodIntersection:()=>to,ZodIssueCode:()=>O,ZodLazy:()=>no,ZodLiteral:()=>ro,ZodMap:()=>Fa,ZodNaN:()=>_a,ZodNativeEnum:()=>io,ZodNever:()=>Wn,ZodNull:()=>Xi,ZodNullable:()=>Er,ZodNumber:()=>Ji,ZodObject:()=>Wt,ZodOptional:()=>Sn,ZodParsedType:()=>z,ZodPipeline:()=>Qu,ZodPromise:()=>$s,ZodReadonly:()=>co,ZodRecord:()=>xd,ZodSchema:()=>Ce,ZodSet:()=>Ma,ZodString:()=>Ps,ZodSymbol:()=>Da,ZodTransformer:()=>vn,ZodTuple:()=>yr,ZodType:()=>Ce,ZodUndefined:()=>Zi,ZodUnion:()=>eo,ZodUnknown:()=>Xr,ZodVoid:()=>Na,addIssueToContext:()=>J,any:()=>vq,array:()=>Dq,bigint:()=>wq,boolean:()=>zx,coerce:()=>nj,custom:()=>jx,date:()=>Qq,datetimeRegex:()=>Yx,defaultErrorMap:()=>Kr,discriminatedUnion:()=>_q,effect:()=>Jq,enum:()=>Yq,function:()=>Vq,getErrorMap:()=>Ra,getParsedType:()=>mr,instanceof:()=>Iq,intersection:()=>Uq,isAborted:()=>kd,isAsync:()=>xa,isDirty:()=>vd,isValid:()=>Ls,late:()=>Cq,lazy:()=>Gq,literal:()=>Hq,makeIssue:()=>Bu,map:()=>Oq,nan:()=>Bq,nativeEnum:()=>qq,never:()=>xq,null:()=>kq,nullable:()=>zq,number:()=>Wx,object:()=>Nq,objectUtil:()=>Ay,oboolean:()=>tj,onumber:()=>ej,optional:()=>Wq,ostring:()=>Xq,pipeline:()=>Zq,preprocess:()=>Kq,promise:()=>jq,quotelessJson:()=>JY,record:()=>Pq,set:()=>$q,setErrorMap:()=>zY,strictObject:()=>Fq,string:()=>Jx,symbol:()=>bq,transformer:()=>Jq,tuple:()=>Lq,undefined:()=>Sq,union:()=>Mq,unknown:()=>Rq,util:()=>Qe,void:()=>Tq});var Qe;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let a of s)i[a]=a;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),a={};for(let c of i)a[c]=s[c];return t.objectValues(a)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},t.find=(s,i)=>{for(let a of s)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Qe||(Qe={}));var Ay;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ay||(Ay={}));var z=Qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mr=t=>{switch(typeof t){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(t)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};var O=Qe.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"]),JY=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Jt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let c=r,A=0;for(;A<a.path.length;){let l=a.path[A],p=A===a.path.length-1;if(l==="_errors"){p&&c._errors.push(n(a)),A++;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)),A++}}};return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Jt.create=t=>new Jt(t);var WY=(t,e)=>{let n;switch(t.code){case O.invalid_type:t.received===z.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case O.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Qe.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qe.joinValues(t.keys,", ")}`;break;case O.invalid_union:n="Invalid input";break;case O.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qe.joinValues(t.options)}`;break;case O.invalid_enum_value:n=`Invalid enum value. Expected ${Qe.joinValues(t.options)}, received '${t.received}'`;break;case O.invalid_arguments:n="Invalid function arguments";break;case O.invalid_return_type:n="Invalid function return type";break;case O.invalid_date:n="Invalid date";break;case O.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Qe.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case O.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case O.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case O.custom:n="Invalid input";break;case O.invalid_intersection_types:n="Intersection results could not be merged";break;case O.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case O.not_finite:n="Number must be finite";break;default:n=e.defaultError,Qe.assertNever(t)}return{message:n}},Kr=WY;var Ox=Kr;function zY(t){Ox=t}function Ra(){return Ox}var Bu=t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let c="",A=r.filter(l=>!!l).slice().reverse();for(let l of A)c=l(a,{data:e,defaultError:c}).message;return{...s,path:i,message:c}},KY=[];function J(t,e){let n=Ra(),r=Bu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Kr?void 0:Kr].filter(s=>!!s)});t.common.issues.push(r)}var mt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return ie;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,a=await s.value;r.push({key:i,value:a})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return ie;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(r[i.value]=a.value)}return{status:e.value,value:r}}},ie=Object.freeze({status:"aborted"}),ji=t=>({status:"dirty",value:t}),Qt=t=>({status:"valid",value:t}),kd=t=>t.status==="aborted",vd=t=>t.status==="dirty",Ls=t=>t.status==="valid",xa=t=>typeof Promise<"u"&&t instanceof Promise;var Z;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Z||(Z={}));var kn=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},$x=(t,e)=>{if(Ls(e))return{success:!0,data:e.value};if(!t.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 Jt(t.common.issues);return this._error=n,this._error}}};function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,c)=>{let{message:A}=t;return a.code==="invalid_enum_value"?{message:A??c.defaultError}:typeof c.data>"u"?{message:A??r??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:A??n??c.defaultError}},description:s}}var Ce=class{get description(){return this._def.description}_getType(e){return mr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:mr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new mt,ctx:{common:e.parent.common,data:e.data,parsedType:mr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(xa(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mr(e)},s=this._parseSync({data:e,path:r.path,parent:r});return $x(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mr(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Ls(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Ls(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mr(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(xa(s)?s:Promise.resolve(s));return $x(r,i)}refine(e,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{let a=e(s),c=()=>i.addIssue({code:O.custom,...r(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(A=>A?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new vn({schema:this,typeName:Ae.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Sn.create(this,this._def)}nullable(){return Er.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return es.create(this)}promise(){return $s.create(this,this._def)}or(e){return eo.create([this,e],this._def)}and(e){return to.create(this,e,this._def)}transform(e){return new vn({...me(this._def),schema:this,typeName:Ae.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new oo({...me(this._def),innerType:this,defaultValue:n,typeName:Ae.ZodDefault})}brand(){return new wu({typeName:Ae.ZodBranded,type:this,...me(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ao({...me(this._def),innerType:this,catchValue:n,typeName:Ae.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Qu.create(this,e)}readonly(){return co.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ZY=/^c[^\s-]{8,}$/i,XY=/^[0-9a-z]+$/,eq=/^[0-9A-HJKMNP-TV-Z]{26}$/i,tq=/^[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,nq=/^[a-z0-9_-]{21}$/i,rq=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sq=/^[-+]?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)?)??$/,iq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oq="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",ly,aq=/^(?:(?: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])$/,cq=/^(?:(?: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])$/,uq=/^(([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]))$/,Aq=/^(([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])$/,lq=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dq=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Gx="((\\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])))",pq=new RegExp(`^${Gx}$`);function Hx(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function hq(t){return new RegExp(`^${Hx(t)}$`)}function Yx(t){let e=`${Gx}T${Hx(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function fq(t,e){return!!((e==="v4"||!e)&&aq.test(t)||(e==="v6"||!e)&&uq.test(t))}function gq(t,e){if(!rq.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function mq(t,e){return!!((e==="v4"||!e)&&cq.test(t)||(e==="v6"||!e)&&Aq.test(t))}var Ps=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let i=this._getOrReturnCtx(e);return J(i,{code:O.invalid_type,expected:z.string,received:i.parsedType}),ie}let r=new mt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:O.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:O.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,c=e.data.length<i.value;(a||c)&&(s=this._getOrReturnCtx(e,s),a?J(s,{code:O.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&J(s,{code:O.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")iq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"email",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")ly||(ly=new RegExp(oq,"u")),ly.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"emoji",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")tq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"uuid",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")nq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"nanoid",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")ZY.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cuid",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")XY.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cuid2",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")eq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"ulid",code:O.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),J(s,{validation:"url",code:O.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"regex",code:O.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Yx(i).test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?pq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?hq(i).test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{code:O.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?sq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"duration",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?fq(e.data,i.version)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"ip",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?gq(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"jwt",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?mq(e.data,i.version)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"cidr",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?lq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"base64",code:O.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?dq.test(e.data)||(s=this._getOrReturnCtx(e,s),J(s,{validation:"base64url",code:O.invalid_string,message:i.message}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:O.invalid_string,...Z.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Z.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Z.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Z.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Z.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Z.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Z.errToObj(n)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Ps.create=t=>new Ps({checks:[],typeName:Ae.ZodString,coerce:t?.coerce??!1,...me(t)});function yq(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return i%a/10**s}var Ji=class t extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==z.number){let i=this._getOrReturnCtx(e);return J(i,{code:O.invalid_type,expected:z.number,received:i.parsedType}),ie}let r,s=new mt;for(let i of this._def.checks)i.kind==="int"?Qe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:O.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?yq(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),J(r,{code:O.not_finite,message:i.message}),s.dirty()):Qe.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Z.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Z.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Qe.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Ji.create=t=>new Ji({checks:[],typeName:Ae.ZodNumber,coerce:t?.coerce||!1,...me(t)});var Wi=class t extends Ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==z.bigint)return this._getInvalidInput(e);let r,s=new mt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),J(r,{code:O.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Qe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return J(n,{code:O.invalid_type,expected:z.bigint,received:n.parsedType}),ie}gte(e,n){return this.setLimit("min",e,!0,Z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Z.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Z.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Wi.create=t=>new Wi({checks:[],typeName:Ae.ZodBigInt,coerce:t?.coerce??!1,...me(t)});var zi=class extends Ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.boolean,received:r.parsedType}),ie}return Qt(e.data)}};zi.create=t=>new zi({typeName:Ae.ZodBoolean,coerce:t?.coerce||!1,...me(t)});var Ki=class t extends Ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let i=this._getOrReturnCtx(e);return J(i,{code:O.invalid_type,expected:z.date,received:i.parsedType}),ie}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return J(i,{code:O.invalid_date}),ie}let r=new mt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:O.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),J(s,{code:O.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Z.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Ki.create=t=>new Ki({checks:[],coerce:t?.coerce||!1,typeName:Ae.ZodDate,...me(t)});var Da=class extends Ce{_parse(e){if(this._getType(e)!==z.symbol){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.symbol,received:r.parsedType}),ie}return Qt(e.data)}};Da.create=t=>new Da({typeName:Ae.ZodSymbol,...me(t)});var Zi=class extends Ce{_parse(e){if(this._getType(e)!==z.undefined){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.undefined,received:r.parsedType}),ie}return Qt(e.data)}};Zi.create=t=>new Zi({typeName:Ae.ZodUndefined,...me(t)});var Xi=class extends Ce{_parse(e){if(this._getType(e)!==z.null){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.null,received:r.parsedType}),ie}return Qt(e.data)}};Xi.create=t=>new Xi({typeName:Ae.ZodNull,...me(t)});var Os=class extends Ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Qt(e.data)}};Os.create=t=>new Os({typeName:Ae.ZodAny,...me(t)});var Xr=class extends Ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Qt(e.data)}};Xr.create=t=>new Xr({typeName:Ae.ZodUnknown,...me(t)});var Wn=class extends Ce{_parse(e){let n=this._getOrReturnCtx(e);return J(n,{code:O.invalid_type,expected:z.never,received:n.parsedType}),ie}};Wn.create=t=>new Wn({typeName:Ae.ZodNever,...me(t)});var Na=class extends Ce{_parse(e){if(this._getType(e)!==z.undefined){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.void,received:r.parsedType}),ie}return Qt(e.data)}};Na.create=t=>new Na({typeName:Ae.ZodVoid,...me(t)});var es=class t extends Ce{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==z.array)return J(n,{code:O.invalid_type,expected:z.array,received:n.parsedType}),ie;if(s.exactLength!==null){let a=n.data.length>s.exactLength.value,c=n.data.length<s.exactLength.value;(a||c)&&(J(n,{code:a?O.too_big:O.too_small,minimum:c?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(J(n,{code:O.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(J(n,{code:O.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>s.type._parseAsync(new kn(n,a,n.path,c)))).then(a=>mt.mergeArray(r,a));let i=[...n.data].map((a,c)=>s.type._parseSync(new kn(n,a,n.path,c)));return mt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:Z.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:Z.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:Z.toString(n)}})}nonempty(e){return this.min(1,e)}};es.create=(t,e)=>new es({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ae.ZodArray,...me(e)});function Ta(t){if(t instanceof Wt){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Sn.create(Ta(r))}return new Wt({...t._def,shape:()=>e})}else return t instanceof es?new es({...t._def,type:Ta(t.element)}):t instanceof Sn?Sn.create(Ta(t.unwrap())):t instanceof Er?Er.create(Ta(t.unwrap())):t instanceof yr?yr.create(t.items.map(e=>Ta(e))):t}var Wt=class t extends Ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=Qe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==z.object){let l=this._getOrReturnCtx(e);return J(l,{code:O.invalid_type,expected:z.object,received:l.parsedType}),ie}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof Wn&&this._def.unknownKeys==="strip"))for(let l in s.data)a.includes(l)||c.push(l);let A=[];for(let l of a){let p=i[l],h=s.data[l];A.push({key:{status:"valid",value:l},value:p._parse(new kn(s,h,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof Wn){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of c)A.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(l==="strict")c.length>0&&(J(s,{code:O.unrecognized_keys,keys:c}),r.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 h=s.data[p];A.push({key:{status:"valid",value:p},value:l._parse(new kn(s,h,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of A){let h=await p.key,g=await p.value;l.push({key:h,value:g,alwaysSet:p.alwaysSet})}return l}).then(l=>mt.mergeObjectSync(r,l)):mt.mergeObjectSync(r,A)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Z.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ae.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of Qe.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of Qe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Ta(this)}partial(e){let n={};for(let r of Qe.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of Qe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Sn;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return qx(Qe.objectKeys(this.shape))}};Wt.create=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strip",catchall:Wn.create(),typeName:Ae.ZodObject,...me(e)});Wt.strictCreate=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strict",catchall:Wn.create(),typeName:Ae.ZodObject,...me(e)});Wt.lazycreate=(t,e)=>new Wt({shape:t,unknownKeys:"strip",catchall:Wn.create(),typeName:Ae.ZodObject,...me(e)});var eo=class extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let c of i)if(c.result.status==="valid")return c.result;for(let c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=i.map(c=>new Jt(c.ctx.common.issues));return J(n,{code:O.invalid_union,unionErrors:a}),ie}if(n.common.async)return Promise.all(r.map(async i=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(s);{let i,a=[];for(let A of r){let l={...n,common:{...n.common,issues:[]},parent:null},p=A._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let c=a.map(A=>new Jt(A));return J(n,{code:O.invalid_union,unionErrors:c}),ie}}get options(){return this._def.options}};eo.create=(t,e)=>new eo({options:t,typeName:Ae.ZodUnion,...me(e)});var Zr=t=>t instanceof no?Zr(t.schema):t instanceof vn?Zr(t.innerType()):t instanceof ro?[t.value]:t instanceof so?t.options:t instanceof io?Qe.objectValues(t.enum):t instanceof oo?Zr(t._def.innerType):t instanceof Zi?[void 0]:t instanceof Xi?[null]:t instanceof Sn?[void 0,...Zr(t.unwrap())]:t instanceof Er?[null,...Zr(t.unwrap())]:t instanceof wu||t instanceof co?Zr(t.unwrap()):t instanceof ao?Zr(t._def.innerType):[],Rd=class t extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return J(n,{code:O.invalid_type,expected:z.object,received:n.parsedType}),ie;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(J(n,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ie)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let a=Zr(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of a){if(s.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);s.set(c,i)}}return new t({typeName:Ae.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...me(r)})}};function dy(t,e){let n=mr(t),r=mr(e);if(t===e)return{valid:!0,data:t};if(n===z.object&&r===z.object){let s=Qe.objectKeys(e),i=Qe.objectKeys(t).filter(c=>s.indexOf(c)!==-1),a={...t,...e};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let c of i){if(c==="__proto__")continue;let A=dy(t[c],e[c]);if(!A.valid)return{valid:!1};a[c]=A.data}return{valid:!0,data:a}}else if(n===z.array&&r===z.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let a=t[i],c=e[i],A=dy(a,c);if(!A.valid)return{valid:!1};s.push(A.data)}return{valid:!0,data:s}}else return n===z.date&&r===z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var to=class extends Ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=(i,a)=>{if(kd(i)||kd(a))return ie;let c=dy(i.value,a.value);return c.valid?((vd(i)||vd(a))&&n.dirty(),{status:n.value,value:c.data}):(J(r,{code:O.invalid_intersection_types}),ie)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};to.create=(t,e,n)=>new to({left:t,right:e,typeName:Ae.ZodIntersection,...me(n)});var yr=class t extends Ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==z.array)return J(r,{code:O.invalid_type,expected:z.array,received:r.parsedType}),ie;if(r.data.length<this._def.items.length)return J(r,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ie;!this._def.rest&&r.data.length>this._def.items.length&&(J(r,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((a,c)=>{let A=this._def.items[c]||this._def.rest;return A?A._parse(new kn(r,a,r.path,c)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>mt.mergeArray(n,a)):mt.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};yr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yr({items:t,typeName:Ae.ZodTuple,rest:null,...me(e)})};var xd=class t extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return J(r,{code:O.invalid_type,expected:z.object,received:r.parsedType}),ie;let s=[],i=this._def.keyType,a=this._def.valueType;for(let c in r.data)s.push({key:i._parse(new kn(r,c,r.path,c)),value:a._parse(new kn(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?mt.mergeObjectAsync(n,s):mt.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Ce?new t({keyType:e,valueType:n,typeName:Ae.ZodRecord,...me(r)}):new t({keyType:Ps.create(),valueType:e,typeName:Ae.ZodRecord,...me(n)})}},Fa=class extends Ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==z.map)return J(r,{code:O.invalid_type,expected:z.map,received:r.parsedType}),ie;let s=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([c,A],l)=>({key:s._parse(new kn(r,c,r.path,[l,"key"])),value:i._parse(new kn(r,A,r.path,[l,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let A of a){let l=await A.key,p=await A.value;if(l.status==="aborted"||p.status==="aborted")return ie;(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 A of a){let l=A.key,p=A.value;if(l.status==="aborted"||p.status==="aborted")return ie;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}}}};Fa.create=(t,e,n)=>new Fa({valueType:e,keyType:t,typeName:Ae.ZodMap,...me(n)});var Ma=class t extends Ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==z.set)return J(r,{code:O.invalid_type,expected:z.set,received:r.parsedType}),ie;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(J(r,{code:O.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(J(r,{code:O.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function a(A){let l=new Set;for(let p of A){if(p.status==="aborted")return ie;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}let c=[...r.data.values()].map((A,l)=>i._parse(new kn(r,A,r.path,l)));return r.common.async?Promise.all(c).then(A=>a(A)):a(c)}min(e,n){return new t({...this._def,minSize:{value:e,message:Z.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:Z.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Ma.create=(t,e)=>new Ma({valueType:t,minSize:null,maxSize:null,typeName:Ae.ZodSet,...me(e)});var Td=class t extends Ce{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==z.function)return J(n,{code:O.invalid_type,expected:z.function,received:n.parsedType}),ie;function r(c,A){return Bu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ra(),Kr].filter(l=>!!l),issueData:{code:O.invalid_arguments,argumentsError:A}})}function s(c,A){return Bu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ra(),Kr].filter(l=>!!l),issueData:{code:O.invalid_return_type,returnTypeError:A}})}let i={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof $s){let c=this;return Qt(async function(...A){let l=new Jt([]),p=await c._def.args.parseAsync(A,i).catch(C=>{throw l.addIssue(r(A,C)),l}),h=await Reflect.apply(a,this,p);return await c._def.returns._def.type.parseAsync(h,i).catch(C=>{throw l.addIssue(s(h,C)),l})})}else{let c=this;return Qt(function(...A){let l=c._def.args.safeParse(A,i);if(!l.success)throw new Jt([r(A,l.error)]);let p=Reflect.apply(a,this,l.data),h=c._def.returns.safeParse(p,i);if(!h.success)throw new Jt([s(p,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:yr.create(e).rest(Xr.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||yr.create([]).rest(Xr.create()),returns:n||Xr.create(),typeName:Ae.ZodFunction,...me(r)})}},no=class extends Ce{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};no.create=(t,e)=>new no({getter:t,typeName:Ae.ZodLazy,...me(e)});var ro=class extends Ce{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return J(n,{received:n.data,code:O.invalid_literal,expected:this._def.value}),ie}return{status:"valid",value:e.data}}get value(){return this._def.value}};ro.create=(t,e)=>new ro({value:t,typeName:Ae.ZodLiteral,...me(e)});function qx(t,e){return new so({values:t,typeName:Ae.ZodEnum,...me(e)})}var so=class t extends Ce{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return J(n,{expected:Qe.joinValues(r),received:n.parsedType,code:O.invalid_type}),ie}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return J(n,{received:n.data,code:O.invalid_enum_value,options:r}),ie}return Qt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};so.create=qx;var io=class extends Ce{_parse(e){let n=Qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==z.string&&r.parsedType!==z.number){let s=Qe.objectValues(n);return J(r,{expected:Qe.joinValues(s),received:r.parsedType,code:O.invalid_type}),ie}if(this._cache||(this._cache=new Set(Qe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=Qe.objectValues(n);return J(r,{received:r.data,code:O.invalid_enum_value,options:s}),ie}return Qt(e.data)}get enum(){return this._def.values}};io.create=(t,e)=>new io({values:t,typeName:Ae.ZodNativeEnum,...me(e)});var $s=class extends Ce{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==z.promise&&n.common.async===!1)return J(n,{code:O.invalid_type,expected:z.promise,received:n.parsedType}),ie;let r=n.parsedType===z.promise?n.data:Promise.resolve(n.data);return Qt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};$s.create=(t,e)=>new $s({type:t,typeName:Ae.ZodPromise,...me(e)});var vn=class extends Ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:a=>{J(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let a=s.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return ie;let A=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return A.status==="aborted"?ie:A.status==="dirty"?ji(A.value):n.value==="dirty"?ji(A.value):A});{if(n.value==="aborted")return ie;let c=this._def.schema._parseSync({data:a,path:r.path,parent:r});return c.status==="aborted"?ie:c.status==="dirty"?ji(c.value):n.value==="dirty"?ji(c.value):c}}if(s.type==="refinement"){let a=c=>{let A=s.refinement(c,i);if(r.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?ie:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?ie:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(s.type==="transform")if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ls(a))return ie;let c=s.transform(a.value,i);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:r.data,path:r.path,parent:r}).then(a=>Ls(a)?Promise.resolve(s.transform(a.value,i)).then(c=>({status:n.value,value:c})):ie);Qe.assertNever(s)}};vn.create=(t,e,n)=>new vn({schema:t,typeName:Ae.ZodEffects,effect:e,...me(n)});vn.createWithPreprocess=(t,e,n)=>new vn({schema:e,effect:{type:"preprocess",transform:t},typeName:Ae.ZodEffects,...me(n)});var Sn=class extends Ce{_parse(e){return this._getType(e)===z.undefined?Qt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Sn.create=(t,e)=>new Sn({innerType:t,typeName:Ae.ZodOptional,...me(e)});var Er=class extends Ce{_parse(e){return this._getType(e)===z.null?Qt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Er.create=(t,e)=>new Er({innerType:t,typeName:Ae.ZodNullable,...me(e)});var oo=class extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===z.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};oo.create=(t,e)=>new oo({innerType:t,typeName:Ae.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...me(e)});var ao=class extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return xa(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Jt(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Jt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ao.create=(t,e)=>new ao({innerType:t,typeName:Ae.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...me(e)});var _a=class extends Ce{_parse(e){if(this._getType(e)!==z.nan){let r=this._getOrReturnCtx(e);return J(r,{code:O.invalid_type,expected:z.nan,received:r.parsedType}),ie}return{status:"valid",value:e.data}}};_a.create=t=>new _a({typeName:Ae.ZodNaN,...me(t)});var Eq=Symbol("zod_brand"),wu=class extends Ce{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Qu=class t extends Ce{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ie:i.status==="dirty"?(n.dirty(),ji(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ie:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:Ae.ZodPipeline})}},co=class extends Ce{_parse(e){let n=this._def.innerType._parse(e),r=s=>(Ls(s)&&(s.value=Object.freeze(s.value)),s);return xa(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};co.create=(t,e)=>new co({innerType:t,typeName:Ae.ZodReadonly,...me(e)});function Vx(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function jx(t,e={},n){return t?Os.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(a=>{if(!a){let c=Vx(e,r),A=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:A})}});if(!i){let a=Vx(e,r),c=a.fatal??n??!0;s.addIssue({code:"custom",...a,fatal:c})}}):Os.create()}var Cq={object:Wt.lazycreate},Ae;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ae||(Ae={}));var Iq=(t,e={message:`Input not instance of ${t.name}`})=>jx(n=>n instanceof t,e),Jx=Ps.create,Wx=Ji.create,Bq=_a.create,wq=Wi.create,zx=zi.create,Qq=Ki.create,bq=Da.create,Sq=Zi.create,kq=Xi.create,vq=Os.create,Rq=Xr.create,xq=Wn.create,Tq=Na.create,Dq=es.create,Nq=Wt.create,Fq=Wt.strictCreate,Mq=eo.create,_q=Rd.create,Uq=to.create,Lq=yr.create,Pq=xd.create,Oq=Fa.create,$q=Ma.create,Vq=Td.create,Gq=no.create,Hq=ro.create,Yq=so.create,qq=io.create,jq=$s.create,Jq=vn.create,Wq=Sn.create,zq=Er.create,Kq=vn.createWithPreprocess,Zq=Qu.create,Xq=()=>Jx().optional(),ej=()=>Wx().optional(),tj=()=>zx().optional(),nj={string:(t=>Ps.create({...t,coerce:!0})),number:(t=>Ji.create({...t,coerce:!0})),boolean:(t=>zi.create({...t,coerce:!0})),bigint:(t=>Wi.create({...t,coerce:!0})),date:(t=>Ki.create({...t,coerce:!0}))};var rj=ie;function sj(t){return t.issues.map(e=>{let n=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${r} ${e.message}`;switch(e.code){case"invalid_type":return n?e.expected==="object"?`${r} must be an object`:e.received==="undefined"?`${r} is required`:`${r} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(c=>typeof c=="string"&&typeof e.received=="string"&&e.received.startsWith(c)),a=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${e.options.join(", ")}${a}`}case"invalid_literal":return`${r} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${e.keys.join(", ")}`;default:return`${r}: ${e.message}`}})}function ts(t,e){let n=t.safeParse(e);if(n.success)return{value:n.data,errors:[]};let r=(i,a)=>a.reduce((c,A)=>c&&typeof c=="object"?c[A]:void 0,i),s=n.error.issues.filter(i=>i.path.length&&r(e,i.path)===null);if(s.length===n.error.issues.length)try{let i=t.safeParse(s.reduce((a,{path:c})=>Kx(a,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:sj(n.error)}}function Kx(t,e){if(!e.length||!t||typeof t!="object")return t;let[n,...r]=e,s=Array.isArray(t)?t.slice():{...t};return r.length?s[n]=Kx(s[n],r):delete s[n],s}var B8=new Set(Object.values(_s));var w8=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var Dd=["-c","core.fsmonitor=false"],ij=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),oj=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function zn(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&oj.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(ij.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}var Ua=Re(require("path"));var N8=Ua.join(".skyramp","workspace.yml");var aj={py:"python",go:"go",java:"java",kt:"kotlin",rb:"ruby",cs:"csharp",ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",kts:"kotlin",rs:"rust",php:"php",scala:"scala",swift:"swift",ex:"elixir",exs:"elixir",dart:"dart",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",groovy:"groovy"};var F8=new Set(Object.values(aj));var ns=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(ns||{}),Vs=u.string().trim().min(1),uj=u.object({url:u.string().optional().describe("the URL probed, if the check is an HTTP request"),command:u.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:u.record(u.string()).optional(),status:u.union([u.number(),u.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:Vs.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),py=u.array(u.object({component:Vs.describe("a shared component listed above"),url:Vs.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:Vs.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"),Xx=u.object({schemaVersion:u.literal(1),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:uj.optional(),teardown:Vs.describe("command that tears the SUT down"),dependencies:u.record(u.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:u.nativeEnum(ns).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:u.array(u.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:u.object({command:Vs,output:Vs}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:u.array(u.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:u.boolean(),startedAt:Vs.describe("ISO timestamp"),revisions:py.optional()});var bu=(n=>(n.Full="full",n.Static="static",n))(bu||{}),Gs=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(Gs||{}),Su=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(Su||{}),uo=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(uo||{}),Nd=(l=>(l.Equals="equals",l.NotEquals="not_equals",l.GreaterThan="greater_than",l.LessThan="less_than",l.Contains="contains",l.NotContains="not_contains",l.Matches="matches",l.Absent="absent",l.Present="present",l))(Nd||{});var hn=u.string().trim().min(1),lj=u.object({subject:hn.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:u.nativeEnum(Nd),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),dj=u.object({test:hn.describe("existing test path, relative to its repository"),repository:hn.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(uo),evidence:hn.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers")});var pj=u.object({surface:hn.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(Su)}),hj=u.object({id:hn.describe("short-slug, unique across generate[]"),type:u.nativeEnum(Gs),target:hn.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:pj.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:hn.describe("why this test matters"),expected_observable:hn.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:lj.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:hn.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),fj=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((t,e)=>{let n=Array.isArray(t.covered),r=typeof t.abstain=="string";if(n===r)return void e.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&t.covered.length===0&&e.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!t.abstain.trim()&&e.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),gj=u.object({surface:hn.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(Su).map(t=>[t,fj])))}),e0=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(bu),maintenance:u.array(dj),generate:u.array(hj),surfaces:u.array(gj).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:hn}),summary:hn.describe("one paragraph")});var Ao=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Ao||{}),Je=u.string().trim().min(1),mj=u.object({action:u.enum(["start","run","wait"]),text:Je,source:u.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Je.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),yj=/^[A-Za-z_][A-Za-z0-9_]*$/,La=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Pa=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(Pa||{}),zt="shared",Ej=Je.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),Oa=u.object({address:Ej,readyWhen:Je.nullable(),credentials:u.array(u.string().regex(La)).max(50),revisionSources:u.array(u.object({method:u.nativeEnum(Pa),detail:Je.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:u.array(Je).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),hy={steps:u.array(mj).max(20).optional().describe("how it starts, in order"),kind:u.enum(["web_app","service","database","external_service"]).optional(),from:u.object({file:Je,service:Je.nullable()}).strict().optional(),credentials:u.array(u.string().max(100).regex(yj)).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")},Cj=u.object({name:Je,repository:Je.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:u.boolean(),...hy,deployed:Je.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),Ij=u.object({component:Je,problem:Je,evidence:Je.describe("the exact command and output that shows it"),fix:Je.describe("what the user must provide, and where")}),Bj=u.object({framework:Je,file:Je.describe("the test file run, relative to its repository root"),result:u.enum(["pass","fail","error"])}),wj=u.object({input:Je.describe("the part of the user's SUT input, as given"),reason:Je}),t0=u.object({schemaVersion:u.literal(1),status:u.nativeEnum(Ao).describe("ready only if every component came up healthy and the recipe is written"),components:u.array(Cj),suites:u.array(Bj).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:u.array(Je).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:u.array(u.object({input:Je.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Je.describe("what the recipe did with it")})).optional(),inputsNotUsed:u.array(wj).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one that names a file, command, port, route or setting that does not exist or does not work"),blockers:u.array(Ij).describe("required (non-empty) when status is blocked"),environment:Oa.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var ku=64*1024,vu=512*1024,fy=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var n0=".skyramp/sut/deployed-revisions.sh",gy=(n=>(n.Running="running",n.Requested="requested",n))(gy||{});var W8=new Set(Object.values(gy));var z8=`Fix ${n0} so it prints the full commit each component runs, then set it up again.`;var my="shared-environment";var c5=64*1024;var u5=new Set(["version_endpoint","api"]);function Md(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}function s0(t){return Md(t).length>0||(t?.dependencies.length??0)>0}function Sj(t){let e=t.inputs?.sharedEnvironment;if(!s0(e))return;let n=bn(t,`${my}.json`);if(n)return{components:kj(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:Md(e).map(s=>i0(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}var i0=(t,e)=>({name:t.name,repository:t.repository,url:t.url,expectedRevision:t.expectedRevision,observedRevision:null,status:"unverifiable",source:t.revisionUrl||t.revisionScript?"probe":"agent",evidence:e});function kj(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=Md(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>i0(s,"Not checked: the run recorded no read of it."))]}function yy(t){return(Sj(t)?.components??[]).filter(e=>e.status!=="verified")}function Ey(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}function By(t){return a0(t)&&yy(t).length===0&&Ey(t.inputs?.sharedEnvironment).length===0}function a0(t){let e=Nj(t);if(!e&&t.state.stages.deploy?.status!=="passed")return!1;let n=bn(t,"deploy.json");return n?n.outcome==="clean"||n.outcome==="recipe-drift":!e}function Nj(t){let e=t.state.stages.plan,n=t.state.stages.deploy;return!(t.inputs?.pipeline?t.inputs.pipeline==="two-step":!n)||e?.status!=="passed"?!1:!n||n.updatedAt<=e.updatedAt}var $a=(a=>(a.Place="place",a.Update="update",a.Regenerate="regenerate",a.Delete="delete",a.Verify="verify",a.None="none",a))($a||{}),Kn=(r=>(r.Pass="pass",r.Fail="fail",r.Skip="skip",r))(Kn||{}),Rn=u.string().trim().min(1),c0=u.object({case:Rn.describe("a covers id \u2014 the recommend case this test realizes"),status:u.nativeEnum(Kn)}),u0=u.object({exit:u.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:u.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:u.array(c0).optional().describe("ONE ENTRY PER CASE the file covers; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one)")}),A0=u.object({from:u.string().optional().describe("staged path \u2014 required for placements"),file:Rn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Rn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum($a),covers:u.array(u.string()).optional().describe("recommend ids a placed test covers"),repro:u.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:u.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:u.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Rn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Rn.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:u0,assertionCount:u.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time")}).refine(t=>t.action!=="place"||typeof t.from=="string"&&t.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),l0=(n=>(n.Junit="junit",n.Converter="converter",n))(l0||{}),Fj=Rn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),Mj=u.object({results:Rn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:u.nativeEnum(l0),run:Rn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:u.array(Rn).min(1).describe("the items[].file paths this run covered"),cases:u.array(u.object({test:Rn.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:Rn.describe("the covers id it realizes"),file:Fj})).describe("map each reported test name to the case it covers")}),_j=u.object({suites:u.array(Mj).min(1)}),wy=u.object({schemaVersion:u.literal(1),items:u.array(A0),runnerResults:_j.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:u.array(u.string()).describe("existing tests assessed and deliberately left untouched"),summary:Rn.describe("one paragraph")});var q5=10*6e4;var po=Re(require("fs"));function p0(t){let e=[];for(let n of Vj(t)){let r=n;r?.type==="tool_use"&&typeof r.name=="string"&&e.push(r.name)}return e}function h0(t){return p0(t).some(e=>/^mcp__skyramp__skyramp_(contract|integration)_test_generation$/.test(e))}function f0(t){return p0(t).some(e=>e==="mcp__skyramp__skyramp_ui_test_generation")}function $j(t){if(!po.existsSync(t))return{};for(let e of po.readFileSync(t,"utf-8").split(`
|
|
117
117
|
`)){let n=e.trim();if(n)try{let r=JSON.parse(n);if(r.type==="system"&&r.subtype==="init"&&Array.isArray(r.mcp_servers))return Object.fromEntries(r.mcp_servers.filter(s=>typeof s.name=="string").map(s=>[s.name,typeof s.status=="string"?s.status:"unknown"]))}catch{}}return{}}function g0(t){let e=$j(t).skyramp;return e===void 0||e==="connected"}function Vj(t){if(!po.existsSync(t))return[];let e=[];for(let n of po.readFileSync(t,"utf-8").split(`
|
|
118
118
|
`)){let r=n.trim();if(!r)continue;let s;try{s=JSON.parse(r)}catch{continue}let i=s.message?.content;Array.isArray(i)&&e.push(...i)}return e}var m0=Re(require("path"));var bt=u.string().trim().min(1),by=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(by||{}),_d=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],Sy=u.object({schemaVersion:u.literal(1),type:u.nativeEnum(by).optional(),status:u.enum(["ready","blocked"]),environment:Oa.optional(),components:u.array(u.object({name:bt,repository:bt.describe(`owner/repo, or "${zt}" for a customer-deployed component no repository builds`),healthy:u.boolean(),url:u.string().min(1).nullable(),...hy,credentials:u.array(u.string().regex(La)).max(50).optional(),deployed:bt.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:u.array(u.object({framework:bt,file:bt,result:u.enum(["pass","fail","error"])}).strict()),inputsUsed:u.array(bt),inputsUsedHow:u.array(u.object({input:bt,how:bt}).strict()).optional(),inputsNotUsed:u.array(u.object({input:bt,reason:bt}).strict()),blockers:u.array(u.object({component:bt,problem:bt,evidence:bt,fix:bt}).strict()),replay:u.object({outcome:bt,durationSeconds:u.number().nonnegative().nullable()}).strict().nullable(),files:u.array(u.object({path:bt,content:u.string()}).strict())}).strict().superRefine((t,e)=>{t.inputsUsedHow?.forEach((s,i)=>{t.inputsUsed.includes(s.input)||e.addIssue({code:u.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),t.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=t.type==="customer_deployed";n!==(t.environment!==void 0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),t.environment&&new Set(t.environment.credentials).size!==t.environment.credentials.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(t.components.map(s=>s.name));if(t.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((a,c)=>{r.has(a)||e.addIssue({code:u.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",c],message:"not one of components"})})}),t.components.forEach((s,i)=>{s.deployed!==void 0!==n&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===zt&&!n&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${zt}`})}),n&&(t.components.forEach((s,i)=>{t.components.findIndex(a=>a.name===s.name)!==i&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),t.replay!==null&&e.addIssue({code:u.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),t.files.forEach((s,i)=>{_d.includes(s.path)&&e.addIssue({code:u.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&t.status==="ready"){let s=new Set(t.environment?.revisionSources.flatMap(i=>i.components));t.components.forEach((i,a)=>{i.repository!==zt&&!s.has(i.name)&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var Z5=["clean","recipe-drift"];function Ru(t){let e=m0.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}var ky=[".skyramp/sut",".skyramp/workspace.yml"];var iX=256*1024*1024;var oX=["--",":/",...ky.map(t=>`:(exclude)${t}`)];var Gj=u.object({route:u.string().describe('the page this step happens on, e.g. "/products/:id"'),action:u.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:u.array(u.string()).optional().describe("the plan clause ids this step exercises"),check:u.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),xu=(n=>(n.InProcess="in-process",n.Browser="browser",n))(xu||{}),y0=(r=>(r.Spec="spec",r.PrDescription="pr-description",r.Inferred="inferred",r))(y0||{}),E0=u.object({id:u.string().describe('e.g. "J1"'),name:u.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:u.string().describe("the route the user starts the flow on: the app's normal starting page for it, never a deep link into its middle"),steps:u.array(Gj).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:u.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:u.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:u.nativeEnum(xu).optional().describe("in-process when the repo's in-process tests (components, app routes) can walk the whole flow and check it; else browser"),source:u.nativeEnum(y0).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:u.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:u.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),Ud=u.object({journey:u.string().describe("the plan's journey id"),file:u.string().describe("the browser test file that walks it"),brokeAt:u.object({step:u.number().int().describe("the 1-based step whose check failed first"),expected:u.string(),actual:u.string().describe("what the app did instead, from the runner's output"),notReached:u.array(u.number().int()).optional().describe("later steps the test could not get to")}).optional().describe("only when the journey's test failed on a check: where"),test:u.string().describe("the title of the one test in that file that walks it end to end")});var Ry=(s=>(s.RestApi="rest-api",s.Frontend="frontend",s.FullStack="full-stack",s.Other="other",s))(Ry||{}),Tu=(s=>(s.Critical="critical",s.High="high",s.Medium="medium",s.Low="low",s))(Tu||{}),Ld=(r=>(r.Suspected="suspected",r.Latent="latent",r.Refuted="refuted",r))(Ld||{}),I0=(r=>(r.Skyramp="skyramp",r.External="external",r.Unknown="unknown",r))(I0||{}),B0=(s=>(s.Cascade="cascade",s.Restrict="restrict",s.Orphan="orphan",s.Unknown="unknown",s))(B0||{}),Va=(s=>(s.RequirementReference="requirement-reference",s.Spec="spec",s.PrDescription="pr-description",s.CouldBreak="could-break",s))(Va||{}),Fe=u.string().trim().min(1),Ga=Fe.describe("file:line"),C0=t=>Fe.refine(e=>e.length<=400,e=>({message:`is ${e.length} characters, over the 400 cap \u2014 ${t}`})),Du=Fe.optional().describe('multi-repo only: the OTHER checkout this lives in \u2014 its "owner/repo" slug, or the directory name if the run discovered it; omit for the working checkout'),vy=u.object({method:Fe,path:Fe,service:u.string().optional(),evidence:Ga,repository:Du}),Hj=u.object({id:Fe.describe("short-slug, e.g. R9"),statement:Fe.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:u.nativeEnum(Va).describe("spec outranks pr-description when both state it"),evidence:Fe.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),Yj=u.object({id:Fe.describe("short-slug"),statement:Fe.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:Fe.describe("METHOD /path, or a component/page name"),evidence:Fe.describe("file:line from the diff that introduces it"),repository:Du,satisfies:u.array(Fe).optional().describe("requirement ids (from `requirements`) this behaviour correctly implements \u2014 a requirement met only in part is ALSO named by the finding that shows the rest (conflictsWith)")}),qj=u.object({id:Fe.describe("short-slug"),file:Fe,line:u.number().optional(),claim:C0("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:u.nativeEnum(Tu),evidence:C0("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:u.nativeEnum(Ld),repository:Du,conflictsWith:u.array(Fe).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),jj=u.object({name:Fe,language:u.string().optional(),framework:u.string().optional(),evidence:Ga,repository:Du}),Jj=u.object({dir:Fe,framework:u.string().optional(),kind:u.nativeEnum(I0),evidence:Ga,repository:Du}),Wj=u.object({from:Fe,to:Fe,onDelete:u.nativeEnum(B0),evidence:Ga}),zj=u.object({entity:Fe,field:Fe,values:u.array(u.string()),evidence:Ga}),Kj=u.object({entities:u.array(u.object({name:Fe,evidence:Ga})),references:u.array(Wj).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:u.array(zj)}),gX=u.object({schemaVersion:u.literal(1),repository:u.object({path:Fe.describe("absolute repo path"),currentBranch:Fe,baseBranch:Fe}),project:u.object({type:u.nativeEnum(Ry),primaryLanguage:Fe,languages:u.array(u.string()),frameworks:u.array(u.string())}),services:u.array(jj),infrastructure:u.object({containerized:u.boolean(),hasDockerCompose:u.boolean(),composeFiles:u.array(u.string()),hasCiCd:u.boolean()}),diff:u.object({changedFiles:u.array(u.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:u.boolean(),summary:Fe.describe("\u2264400 chars")}),endpoints:u.object({new:u.array(vy),modified:u.array(vy),removed:u.array(vy)}),existingTests:u.object({locations:u.array(Jj)}),entityMap:Kj,requirements:u.array(Hj).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:u.array(Yj),findings:u.array(qj),unexamined:u.array(u.string()).describe("files or areas outside this change you did not open"),summary:Fe.describe("one paragraph on what this change does and its test-relevant risk")});var Pd=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(Pd||{}),ss=u.string().trim().min(1),Zj=u.object({case:ss.describe("recommend id this assertion enforces"),evidence:ss.describe("the exact assertion line from the file that checks that case's observable")}),xy=u.object({kind:u.nativeEnum(Id).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:ss.describe("the dependency, endpoint or data it affects"),mechanism:u.nativeEnum(Bd).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:ss.describe("what it sets up"),worker:ss.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:ss.optional().describe("seed: a command, without a shell, that removes the data when the test does not")}),Xj=u.object({file:ss.describe("staged path under .skyramp/staged/"),source:u.nativeEnum(Pd),language:ss,covers:u.array(u.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:u.array(Zj).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:u.array(xy).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")}),Ty=u.object({schemaVersion:u.literal(1),tests:u.array(Xj),deferredUi:u.array(u.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:ss.describe("one paragraph")});var is=u.string().trim().min(1),Nu=72,eJ=u.object({repository:is.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:u.string(),command:u.string().describe("the exact command you ran, scoped to the changed files"),clean:u.boolean(),fixed:u.array(u.string()).optional().describe("files you fixed"),uncovered:u.array(u.string()).describe("changed/new files this linter's own config does not match (wrong extension, wrong directory) \u2014 so `clean` never examined them, even though CI may still execute them. Empty array, not omitted, when every changed/new file IS covered.")}),bX=u.object({schemaVersion:u.literal(1),lint:u.array(eJ).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:u.object({ok:u.boolean(),notes:u.string().optional()}),ciReadiness:u.object({covered:u.boolean().describe("will the repo's CI run these tests?"),notes:u.string().optional()}),dependencies:u.object({added:u.array(u.object({package:u.string(),manifest:u.string(),repository:is.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:is.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).describe("every package added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own")}),support:u.array(u.object({file:is,repository:is.optional().describe("owner/repo of the file's checkout; omit for the working checkout")})).optional().describe("the files the tests need besides themselves (helper modules, page objects, fixtures, snapshots), delivered with them"),commit:u.object({message:is.refine(t=>t.split(`
|
|
119
119
|
`)[0].length<=Nu,{message:`subject line must be <= ${Nu} chars`})}),pr:u.object({title:is.max(Nu,`must be <= ${Nu} chars`),body:is}),ready:u.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:u.array(u.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:is.describe("one paragraph")});var qs=Re(require("fs")),qa=Re(require("path")),v0=require("child_process");var Zn="{junit}",Q0=(r=>(r.Junit="junit",r.Trx="trx",r.GoTestJson="go-test-json",r))(Q0||{}),b0=(e=>(e.Minitest="minitest",e))(b0||{}),w0=u.string().trim().min(1),Ha=u.object({cwd:w0.describe('repo-relative directory the command starts in ("." for the root)'),argv:u.array(w0).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report an argument or env value holds ${Zn}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:u.record(u.string(),u.string()).optional().describe("plain test or reporter settings beyond the repository's CI test job (RAILS_ENV=test, PLAYWRIGHT_JUNIT_OUTPUT_FILE={junit}); never a credential, PATH, or a tool's install path"),report:u.object({format:u.nativeEnum(Q0).describe(`junit (JUnit XML to ${Zn}), trx (to ${Zn}), or go-test-json (go test -json on the command's output)`),reporter:u.nativeEnum(b0).optional().describe("a reporter Testbot loads for a runner that writes no report: minitest")}).optional().describe("the report the command writes; junit when omitted")});var Ya="a framework other than pytest, jest, vitest and node --test (go test, rails test, mvn, dotnet test), or one the repository's test script runs through another command (ng test, nx test)",RX=`pytest, Jest, Vitest and node --test tests run as the run already knows them, unless the repository's test script runs them through another command (ng test, nx test), which may be the only one that compiles them. A test in any other framework, or one run that way, also gives "run": the repository's own command for only those tests, from the directory the repository runs it in, as separate arguments without a shell. Its "report" says what the runner writes: junit (JUnit XML to ${Zn} in the reporter's argument or env setting), trx (a TRX file to ${Zn}, which every dotnet test writes with its built-in logger), or go-test-json (go test -json, read from the command's output). A Maven or Gradle command names no ${Zn}: its build writes JUnit XML to its own report directory, which the run reads. Use a reporter the repository already has, or one of those; a reporter or converter the command fetches is the version the repository pins, or else its latest release (an older one may not build with the repository's toolchain). For minitest, which writes none, give report.reporter "minitest" and the run fills ${Zn} itself. A setting the tests or reporter read goes in "env" (RAILS_ENV=test, or PLAYWRIGHT_JUNIT_OUTPUT_FILE=${Zn} with playwright test --reporter=junit): the run sets it, so never wrap the command in a shell to set one. The run replaces ${Zn} in argv and env with its report path, executes the command, and reads that report.`;var ho=(s=>(s.ExistingEvidenceSufficient="existing_evidence_sufficient",s.TargetedUnit="targeted_unit",s.RuntimeRequired="runtime_required",s.BlockedPreflight="blocked_preflight",s))(ho||{}),Ys=(i=>(i.ExistingEvidence="existing_evidence",i.Unaffected="unaffected",i.ExistingUnit="existing_unit",i.NewUnit="new_unit",i.Runtime="runtime",i))(Ys||{}),Ny=(n=>(n.Repository="repository",n.Testbot="testbot",n))(Ny||{}),Fy=(r=>(r.Identified="identified",r.Passed="passed",r.Failed="failed",r))(Fy||{}),Kt=u.string().trim().min(1),tJ=u.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var nJ=u.object({id:tJ,source:u.nativeEnum(Ny),kind:u.nativeEnum(_s),outcome:u.nativeEnum(Fy),summary:Kt.max(400).describe("one line: what it shows"),tests:u.array(Kt).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:Kt.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:Kt.optional().describe("source testbot: the exact command you ran, as you ran it"),run:Ha.optional().describe(`source repository, for tests in ${Ya}: how the run executes only these tests, all of them in one command, with the repository's own runner writing JUnit XML to {junit}. Name each test (path::test-name): a test is credited to a file only by its name or by a report that names the file`)}),rJ=u.object({behaviorId:Kt.describe("an id from analyze's behaviors"),mechanism:u.nativeEnum(Ys),evidenceIds:u.array(Kt).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:u.string().trim().optional().describe('new_unit / runtime: the missing evidence this obtains, e.g. "the boundary the change moved"; unaffected: why the change cannot reach it, citing path:line')}),sJ=u.object({behaviorId:u.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:Kt.max(600).describe("the evidence that is required and cannot be obtained in this run")}),iJ=u.object({file:Kt.describe("the changed file the failure is in"),repository:Kt.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:Kt.max(300).describe("what prerequisite the change fails"),evidence:Kt.max(400).describe("the error line, quoted")}),oJ=u.object({behaviorId:Kt.describe("an id from analyze's behaviors"),reason:Kt.max(600).describe("\u2264600 characters: why this change leaves the behavior's result as it was, citing the unchanged line that decides it (path:line)")}),Fu=u.object({schemaVersion:u.literal(1),decision:u.nativeEnum(ho),evidence:u.array(nJ).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:u.array(rJ).describe("how each changed behavior's evidence is obtained"),gaps:u.array(sJ),outOfScope:u.array(oJ).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:iJ.optional().describe("only for blocked_preflight"),rationale:Kt.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});function $d(t){let e=bn(t,"recommend.json");if(!e||!Array.isArray(e.generate)||!Array.isArray(e.maintenance))return;let n=e;return{...n,maintenance:n.maintenance.map(({repository:r,...s})=>({...s,test:s.test.trim().replace(/^\.\//,""),...r?.trim()?{repository:r.trim()}:{}}))}}function AJ(t){return ts(Ty,t).errors}function lJ(t,e=[]){let{value:n,error:r}=jt(t,e);if(r)return{errors:[r]};let s=AJ(n);return s.length>0?{errors:s}:{generate:n,errors:[]}}function Vd(t,e=[]){return lJ(t.stdout,e)}function dJ(t){return t.generate.filter(e=>e.type!=="ui").map(e=>e.id)}function R0(t){return t.generate.filter(e=>e.type==="ui").map(e=>e.id)}var Gd={backend:{stage:"generate",cases:dJ,noRecommendCoverage:"recommend.json missing or malformed \u2014 cannot check coverage",noRecommendIntent:"recommend.json missing or malformed \u2014 cannot check intent",uncovered:t=>`recommend case "${t}" is not covered by any generated test`,unknownCovered:t=>`test covers unknown recommend id "${t}"`,unasserted:t=>`case "${t}" has no verified assertion enforcing its expected_observable`,usedCodegen:h0,codegenHint:"These tests were hand-written. Skyramp codegen (skyramp_contract_test_generation / skyramp_integration_test_generation) was available but not used \u2014 it computes valid sample data and response correlations. Prefer scaffolding with it and then refining, especially for the failures above."},ui:{stage:"generate-ui",cases:R0,noRecommendCoverage:"recommend.json not found \u2014 cannot check UI coverage",noRecommendIntent:"recommend.json not found \u2014 cannot check UI intent",uncovered:t=>`UI case "${t}" is not covered by any generated UI test`,unknownCovered:t=>`test covers "${t}" which is not a recommend UI case`,unasserted:t=>`UI case "${t}" has no verified assertion enforcing its expected_observable`,usedCodegen:f0,codegenHint:"This UI test was hand-authored. Skyramp UI codegen (skyramp_ui_test_generation) was available but not used. Prefer scaffolding with it and then refining, especially for the failures above."}},u6=Us("generate-schema",(t,e)=>Vd(e,t.secretValues));function pJ(t){let e=Gd[t];return{name:`${e.stage}-coverage`,verify(n,r){let{generate:s,errors:i}=Vd(r,n.secretValues);if(!s)return Mt(this.name,i);let a=$d(n);if(!a)return Mt(this.name,[e.noRecommendCoverage]);let c=new Set(s.tests.flatMap(h=>h.covers)),A=[],l=e.cases(a);for(let h of l)c.has(h)||A.push(e.uncovered(h));let p=new Set(t==="ui"?l:a.generate.map(h=>h.id));for(let h of c)p.has(h)||A.push(e.unknownCovered(h));if(t==="backend"){let h=new Set(s.deferredUi),g=new Set(R0(a));for(let C of g)!h.has(C)&&!c.has(C)&&A.push(`UI case "${C}" is neither covered nor deferred to the UI stage`);for(let C of h)g.has(C)||A.push(`deferredUi lists "${C}" which is not a UI case`)}return A.length===0?{name:this.name,passed:!0}:Mt(this.name,A)}}}function hJ(t){let e=Gd[t];return{name:`${e.stage}-intent`,verify(n,r){let{generate:s,errors:i}=Vd(r,n.secretValues);if(!s)return Mt(this.name,i);let a=$d(n);if(!a)return Mt(this.name,[e.noRecommendIntent]);let{asserted:c,errors:A,badFiles:l}=IJ(s,n.inputs.repositoryPath),p=A.length;for(let g of e.cases(a))c.has(g)||A.push(e.unasserted(g));if(A.length===0)return{name:this.name,passed:!0};let h=Mt(this.name,A);return p>0&&p===A.length&&l.size>0?{...h,droppable:[...l]}:h}}}function fJ(t){let e=Gd[t];return n=>{if(!n.inputs.skyrampMcp?.command||t==="backend"&&!By(n))return;let r=qa.join(n.outputsDir,`${e.stage}-stream.ndjson`);if(!(!qs.existsSync(r)||e.usedCodegen(r)))return g0(r)?e.codegenHint:"Skyramp codegen tools were configured but the MCP server did not connect this session, so they were not available. Hand-authoring was the only option; this is an environment problem, not yours."}}var A6=pJ("backend"),l6=hJ("backend"),d6=fJ("backend");var k0=t=>t.replace(/\s+/g,"");var My={python:[/\bassert\s*[({\w"'`]/g,/\bpytest\.raises\s*\(/g,/\bself\.assert\w*\s*\(/g],typescript:[/\bexpect\s*\(/g,/\.should\b/g,/\bassert\s*[.(]/g],go:[/\bt\.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)\s*\(/g,/\b(assert|require)\.\w+\s*\(/g],java:[/\bassert\w*\s*\(/g,/\bassertThat\s*\(/g],ruby:[/\bexpect\s*[({]/g,/\bassert\w*\b/g,/\.should\b/g]};for(let[t,e]of[["javascript","typescript"],["kotlin","java"]])My[t]=My[e];function gJ(t,e){if(t.includes(Iu(e))||k0(t).includes(k0(e)))return!0;let n=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!/^(\/\/|#|\*|\/\*)/.test(r));return n.length>0&&n.every(r=>t.includes(Iu(r)))?!0:CJ(t,e)}var mJ=/\bassert\w*\b|\bexpect\s*\(|\.should\b|\brequire\s*\(/i,yJ=12,EJ=/,\s*\(\s*#|,\s*f?["'`]|\s+#\s|\s+\/\/|\s*\((?:line|lines|at line)\b|\s*,\s*$/i;function CJ(t,e){let n=e.split(/\s*;\s*|\s*\.\.\.\s*|\r?\n/),r=0;for(let s of n){let i=mJ.exec(s);if(!i)continue;let a=s.slice(i.index),c=EJ.exec(a);if(c&&(a=a.slice(0,c.index)),a=Iu(a).replace(/[,\s]+$/,""),a.length<yJ||!t.includes(a))return!1;r++}return r>0}function IJ(t,e){let n=new Set,r=[],s=new Set;for(let i of t.tests){let a=qa.resolve(e,i.file);if(!qs.existsSync(a))continue;let c=Iu(qs.readFileSync(a,"utf-8"));for(let A of i.assertions??[]){if(!gJ(c,A.evidence)){r.push(`assertion evidence for "${A.case}" not found in ${i.file} \u2014 cite the real assertion line`),s.add(i.file);continue}i.covers.includes(A.case)?n.add(A.case):(r.push(`assertion cites case "${A.case}" not in that test's covers[]`),s.add(i.file))}}return{asserted:n,errors:r,badFiles:s}}var BJ=/\.(spec|test)\.[cm]?[jt]sx?$/i;function x0(t){let e;try{e=(0,v0.execFileSync)("git",[...Dd,"status","--porcelain","--untracked-files=all"],{env:zn(),cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})}catch{return}let n=s=>/_scaffold/i.test(s)||Sd.test(s),r=[];for(let s of e.split(`
|