@intentius/chant 0.124.75 → 0.124.76
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/cli/handlers/release.d.ts +4 -0
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +18 -2
- package/dist/wave-runtime.mjs +3 -3
- package/package.json +1 -1
- package/src/cli/handlers/release-cut-archives.test.ts +21 -0
- package/src/cli/handlers/release.ts +17 -2
|
@@ -52,6 +52,10 @@ export declare function nextCommands(req: {
|
|
|
52
52
|
}): string[];
|
|
53
53
|
/** The command line that ran, without `--json`, with `--yes` added: what a dry run says to run next. */
|
|
54
54
|
export declare function sameWithYes(argv: readonly string[]): string;
|
|
55
|
+
/** Copy each `release.images` archive from the directory the cut built it in to the same path under `to`. */
|
|
56
|
+
export declare function copyImageArchives(images: ReadonlyArray<{
|
|
57
|
+
archive: string;
|
|
58
|
+
}>, from: string, to: string): void;
|
|
55
59
|
/**
|
|
56
60
|
* `release images <label|digest> [--no-build] [-o <file>] [--json]` (#4657): build the
|
|
57
61
|
* images the release recorded again, from the release's commit checked out
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/release.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAQH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAyBlD,0HAA0H;AAC1H,wBAAgB,YAAY,CAAC,GAAG,EAAE;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uFAAuF;IACvF,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,MAAM,EAAE,CASX;AAED,wGAAwG;AACxG,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAG3D;
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/release.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAQH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAyBlD,0HAA0H;AAC1H,wBAAgB,YAAY,CAAC,GAAG,EAAE;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uFAAuF;IACvF,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,MAAM,EAAE,CASX;AAED,wGAAwG;AACxG,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAG3D;AAyBD,6GAA6G;AAC7G,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAQ5G;AAOD;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsD3E;AAiBD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0TxE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA6G5E;AASD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAwC3E;AAYD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAkD/E;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAmCzE;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAyC3E;AAED,gHAAgH;AAChH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB5E;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAG5E;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsD5E"}
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
* names a `release` gate requires a signed cut by an actor in its class (#4031).
|
|
42
42
|
*/
|
|
43
43
|
import { execFileSync } from "node:child_process";
|
|
44
|
-
import { existsSync } from "node:fs";
|
|
44
|
+
import { cpSync, existsSync, mkdirSync } from "node:fs";
|
|
45
45
|
import { tmpdir } from "node:os";
|
|
46
|
-
import { join, relative, resolve } from "node:path";
|
|
46
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
47
47
|
import { formatBold, formatError, formatSuccess, formatWarning } from "../format.js";
|
|
48
48
|
import { parseParamFlags } from "../build-params-cli.js";
|
|
49
49
|
const USAGE = "chant release cut [<label>] [--at <sha>] [--yes] [--build <command>] [--param <k=v>] [--image <component>=<repository>@sha256:<hex>] [--params-file <file>] [--src <dir>] [-o <file>] [--lexicon <name>] [--actor <name>] [--sign [<key file>]] [--channel <tag>] [--lane <name>] [--override-green] [--json] | release publish <label|digest> [--yes] [--allow-unsigned] [--require-provenance] [--json] | release verify <label|digest> [--json] | release images <label|digest> [--no-build] [-o <file>] [--json] | release candidates [--env <env>] [--lane <name>] [--forge-issues] [--json] | release compose <name> [--base <label|sha>] (--pr <n> | --work <id>)... [--yes] [--json] | release list [--json] | release export <label|digest> --env <env> [-o <dir>] [--json]";
|
|
@@ -102,6 +102,17 @@ async function releaseImagesOf(cwd) {
|
|
|
102
102
|
const { loadChantConfig } = await import("../../config.js");
|
|
103
103
|
return (await loadChantConfig(cwd)).config.release?.images ?? [];
|
|
104
104
|
}
|
|
105
|
+
/** Copy each `release.images` archive from the directory the cut built it in to the same path under `to`. */
|
|
106
|
+
export function copyImageArchives(images, from, to) {
|
|
107
|
+
for (const i of images) {
|
|
108
|
+
const src = resolve(from, i.archive);
|
|
109
|
+
if (!existsSync(src))
|
|
110
|
+
continue;
|
|
111
|
+
const dest = resolve(to, i.archive);
|
|
112
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
113
|
+
cpSync(src, dest, { recursive: true, force: true });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
105
116
|
/** A commit's time in seconds, the `SOURCE_DATE_EPOCH` a release's image builds run with (#4657). */
|
|
106
117
|
function commitTime(cwd, commit) {
|
|
107
118
|
return Number(execFileSync("git", ["show", "-s", "--format=%ct", commit], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim());
|
|
@@ -456,6 +467,11 @@ export async function runReleaseCut(ctx) {
|
|
|
456
467
|
return 0;
|
|
457
468
|
}
|
|
458
469
|
const result = await cutRelease(request);
|
|
470
|
+
// #4657: under --at the images were built in the commit's own checkout, which is removed below; the archives the
|
|
471
|
+
// release records are put where release.images names them here, so the job's next step (the hand-off to the
|
|
472
|
+
// publish job) finds them.
|
|
473
|
+
if (checkout && declaredImages.length > 0)
|
|
474
|
+
copyImageArchives(declaredImages, cutCwd, cwd);
|
|
459
475
|
const push = await pushLifecycleReport({ cwd }).catch(() => ({ pushed: false, pushWarning: undefined }));
|
|
460
476
|
// The tag names the release's label, which a re-cut with no label reads from the earlier cut.
|
|
461
477
|
let tagged = null;
|
package/dist/wave-runtime.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @intentius/chant 0.124.
|
|
2
|
+
// @intentius/chant 0.124.76 wave-job runtime (#3896): run wave, run resume, approve, workspace points.
|
|
3
3
|
import { createRequire as __chantCreateRequire } from "node:module";
|
|
4
4
|
const require = __chantCreateRequire(import.meta.url);
|
|
5
5
|
var $xe=Object.create;var P0=Object.defineProperty;var Sxe=Object.getOwnPropertyDescriptor;var Exe=Object.getOwnPropertyNames;var Oxe=Object.getPrototypeOf,Pxe=Object.prototype.hasOwnProperty;var x=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(o){throw n=[o],o}};var ye=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Re=(e,t)=>{for(var n in t)P0(e,n,{get:t[n],enumerable:!0})},Axe=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Exe(t))!Pxe.call(e,r)&&r!==n&&P0(e,r,{get:()=>t[r],enumerable:!(o=Sxe(t,r))||o.enumerable});return e};var nt=(e,t,n)=>(n=e!=null?$xe(Oxe(e)):{},Axe(t||!e||!e.__esModule?P0(n,"default",{value:e,enumerable:!0}):n,e));function C0(e,t=new Set){let n=[];for(let o of e)if(o.startsWith("--")&&o.includes("=")){let r=o.indexOf("="),i=o.slice(0,r),s=o.slice(r+1);if(t.has(i))throw new Error(`${o} \u2014 ${i} is a boolean flag and does not take a value. Pass ${i} on its own.`);n.push(i,s)}else n.push(o);return n}var A0,_0=x(()=>{"use strict";A0=new Set(["build","lint","list","describe","import","audit","migrate","carve","init","update","doctor","dev","run","graph","vendor","lifecycle","lc","components","emulator","serve","operator","approve","workspace"])});function _xe(){return!process.env.NO_COLOR&&process.stdout.isTTY!==!1}function Ac(e,t){return _xe()?`${t}${e}${ha.reset}`:e}function $e(e){let t=[];if(e.file){let n=e.file;e.line!==void 0&&(n+=`:${e.line}`,e.column!==void 0&&(n+=`:${e.column}`)),t.push(Ac(n,ha.cyan)),t.push(" - ")}return t.push(Ac("error",ha.red)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
|
|
6
6
|
`),t.push(Ac(e.hint,ha.gray))),t.join("")}function ur(e){let t=[];if(e.file){let n=e.file;e.line!==void 0&&(n+=`:${e.line}`,e.column!==void 0&&(n+=`:${e.column}`)),t.push(Ac(n,ha.cyan)),t.push(" - ")}return t.push(Ac("warning",ha.yellow)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
|
|
7
|
-
`),t.push(Ac(e.hint,ha.gray))),t.join("")}function Rh(e){return Ac(e,ha.green)}function In(e){return Ac(e,ha.gray)}var ha,Qn=x(()=>{"use strict";ha={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var LR,I0=x(()=>{"use strict";LR="0.124.75"});function V(e,t,n){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=s.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){let p=u[d];p in a||(a[p]=l[p].bind(a))}}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let l=n?.Parent?new i:this;o(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}function xn(e){return e&&Object.assign(xh,e),xh}var D0,MR,Fi,Cc,xh,Ep=x(()=>{D0=Object.freeze({status:"aborted"});MR=Symbol("zod_brand"),Fi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Cc=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},xh={}});var Se={};Re(Se,{BIGINT_FORMAT_RANGES:()=>z0,Class:()=>j0,NUMBER_FORMAT_RANGES:()=>U0,aborted:()=>Dc,allowsEval:()=>F0,assert:()=>Lxe,assertEqual:()=>Ixe,assertIs:()=>Nxe,assertNever:()=>jxe,assertNotEqual:()=>Dxe,assignProp:()=>Tc,base64ToUint8Array:()=>W6,base64urlToUint8Array:()=>e$e,cached:()=>Pp,captureStackTrace:()=>GR,cleanEnum:()=>Xxe,cleanRegex:()=>Eh,clone:()=>jr,cloneDef:()=>Fxe,createTransparentProxy:()=>Hxe,defineLazy:()=>mt,esc:()=>FR,escapeRegex:()=>Yo,extend:()=>Kxe,finalizeIssue:()=>oo,floatSafeRemainder:()=>L0,getElementAtPath:()=>Gxe,getEnumValues:()=>Sh,getLengthableOrigin:()=>Ah,getParsedType:()=>zxe,getSizableOrigin:()=>Ph,hexToUint8Array:()=>n$e,isObject:()=>Ru,isPlainObject:()=>Ic,issue:()=>Ap,joinValues:()=>se,jsonStringifyReplacer:()=>Op,merge:()=>Zxe,mergeDefs:()=>ya,normalizeParams:()=>Ee,nullish:()=>_c,numKeys:()=>Uxe,objectClone:()=>Mxe,omit:()=>Vxe,optionalKeys:()=>B0,parsedType:()=>xe,partial:()=>Yxe,pick:()=>qxe,prefixIssues:()=>Ao,primitiveTypes:()=>W0,promiseAllObject:()=>Wxe,propertyKeyTypes:()=>Oh,randomString:()=>Bxe,required:()=>Qxe,safeExtend:()=>Jxe,shallowClone:()=>G0,slugify:()=>M0,stringifyPrimitive:()=>be,uint8ArrayToBase64:()=>B6,uint8ArrayToBase64url:()=>t$e,uint8ArrayToHex:()=>r$e,unwrapMessage:()=>$h});function Ixe(e){return e}function Dxe(e){return e}function Nxe(e){}function jxe(e){throw new Error("Unexpected value in exhaustive check")}function Lxe(e){}function Sh(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function se(e,t="|"){return e.map(n=>be(n)).join(t)}function Op(e,t){return typeof t=="bigint"?t.toString():t}function Pp(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function _c(e){return e==null}function Eh(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function L0(e,t){let n=(e.toString().split(".")[1]||"").length,o=t.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let c=o.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]))}let i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}function mt(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==G6)return o===void 0&&(o=G6,o=n()),o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Mxe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Tc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ya(...e){let t={};for(let n of e){let o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function Fxe(e){return ya(e._zod.def)}function Gxe(e,t){return t?t.reduce((n,o)=>n?.[o],e):e}function Wxe(e){let t=Object.keys(e),n=t.map(o=>e[o]);return Promise.all(n).then(o=>{let r={};for(let i=0;i<t.length;i++)r[t[i]]=o[i];return r})}function Bxe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let o=0;o<e;o++)n+=t[Math.floor(Math.random()*t.length)];return n}function FR(e){return JSON.stringify(e)}function M0(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Ru(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ic(e){if(Ru(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Ru(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function G0(e){return Ic(e)?{...e}:Array.isArray(e)?[...e]:e}function Uxe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Yo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jr(e,t,n){let o=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(o._zod.parent=e),o}function Ee(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Hxe(e){let t;return new Proxy({},{get(n,o,r){return t??(t=e()),Reflect.get(t,o,r)},set(n,o,r,i){return t??(t=e()),Reflect.set(t,o,r,i)},has(n,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(n,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(n,o,r){return t??(t=e()),Reflect.defineProperty(t,o,r)}})}function be(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function B0(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function qxe(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=ya(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return Tc(this,"shape",s),s},checks:[]});return jr(e,i)}function Vxe(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=ya(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return Tc(this,"shape",s),s},checks:[]});return jr(e,i)}function Kxe(e,t){if(!Ic(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=ya(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Tc(this,"shape",i),i}});return jr(e,r)}function Jxe(e,t){if(!Ic(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=ya(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Tc(this,"shape",o),o}});return jr(e,n)}function Zxe(e,t){let n=ya(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Tc(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return jr(e,n)}function Yxe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=ya(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(n)for(let l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(c[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return Tc(this,"shape",c),c},checks:[]});return jr(t,s)}function Qxe(e,t,n){let o=ya(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(let s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return Tc(this,"shape",i),i}});return jr(t,o)}function Dc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ao(e,t){return t.map(n=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function $h(e){return typeof e=="string"?e:e?.message}function oo(e,t,n){let o={...e,path:e.path??[]};if(!e.message){let r=$h(e.inst?._zod.def?.error?.(e))??$h(t?.error?.(e))??$h(n.customError?.(e))??$h(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function Ph(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ah(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function xe(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Ap(...e){let[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}function Xxe(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function W6(e){let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}function B6(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function e$e(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return W6(t+n)}function t$e(e){return B6(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function n$e(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)n[o/2]=Number.parseInt(t.slice(o,o+2),16);return n}function r$e(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var G6,GR,F0,zxe,Oh,W0,U0,z0,j0,He=x(()=>{G6=Symbol("evaluating");GR="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};F0=Pp(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});zxe=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Oh=new Set(["string","number","symbol"]),W0=new Set(["string","number","bigint","boolean","symbol","undefined"]);U0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},z0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};j0=class{constructor(...t){}}});function _h(e,t=n=>n.message){let n={},o=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}function Th(e,t=n=>n.message){let n={_errors:[]},o=r=>{for(let i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>o({issues:s}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,a=0;for(;a<i.path.length;){let c=i.path[a];a===i.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return o(e),n}function H0(e,t=n=>n.message){let n={errors:[]},o=(r,i=[])=>{var s,a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>o({issues:l},c.path));else if(c.code==="invalid_key")o({issues:c.issues},c.path);else if(c.code==="invalid_element")o({issues:c.issues},c.path);else{let l=[...i,...c.path];if(l.length===0){n.errors.push(t(c));continue}let u=n,d=0;for(;d<l.length;){let p=l[d],f=d===l.length-1;typeof p=="string"?(u.properties??(u.properties={}),(s=u.properties)[p]??(s[p]={errors:[]}),u=u.properties[p]):(u.items??(u.items=[]),(a=u.items)[p]??(a[p]={errors:[]}),u=u.items[p]),f&&u.errors.push(t(c)),d++}}};return o(e),n}function z6(e){let t=[],n=e.map(o=>typeof o=="object"?o.key:o);for(let o of n)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}function q0(e){let t=[],n=[...e.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${z6(o.path)}`);return t.join(`
|
|
7
|
+
`),t.push(Ac(e.hint,ha.gray))),t.join("")}function Rh(e){return Ac(e,ha.green)}function In(e){return Ac(e,ha.gray)}var ha,Qn=x(()=>{"use strict";ha={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var LR,I0=x(()=>{"use strict";LR="0.124.76"});function V(e,t,n){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=s.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){let p=u[d];p in a||(a[p]=l[p].bind(a))}}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let l=n?.Parent?new i:this;o(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}function xn(e){return e&&Object.assign(xh,e),xh}var D0,MR,Fi,Cc,xh,Ep=x(()=>{D0=Object.freeze({status:"aborted"});MR=Symbol("zod_brand"),Fi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Cc=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},xh={}});var Se={};Re(Se,{BIGINT_FORMAT_RANGES:()=>z0,Class:()=>j0,NUMBER_FORMAT_RANGES:()=>U0,aborted:()=>Dc,allowsEval:()=>F0,assert:()=>Lxe,assertEqual:()=>Ixe,assertIs:()=>Nxe,assertNever:()=>jxe,assertNotEqual:()=>Dxe,assignProp:()=>Tc,base64ToUint8Array:()=>W6,base64urlToUint8Array:()=>e$e,cached:()=>Pp,captureStackTrace:()=>GR,cleanEnum:()=>Xxe,cleanRegex:()=>Eh,clone:()=>jr,cloneDef:()=>Fxe,createTransparentProxy:()=>Hxe,defineLazy:()=>mt,esc:()=>FR,escapeRegex:()=>Yo,extend:()=>Kxe,finalizeIssue:()=>oo,floatSafeRemainder:()=>L0,getElementAtPath:()=>Gxe,getEnumValues:()=>Sh,getLengthableOrigin:()=>Ah,getParsedType:()=>zxe,getSizableOrigin:()=>Ph,hexToUint8Array:()=>n$e,isObject:()=>Ru,isPlainObject:()=>Ic,issue:()=>Ap,joinValues:()=>se,jsonStringifyReplacer:()=>Op,merge:()=>Zxe,mergeDefs:()=>ya,normalizeParams:()=>Ee,nullish:()=>_c,numKeys:()=>Uxe,objectClone:()=>Mxe,omit:()=>Vxe,optionalKeys:()=>B0,parsedType:()=>xe,partial:()=>Yxe,pick:()=>qxe,prefixIssues:()=>Ao,primitiveTypes:()=>W0,promiseAllObject:()=>Wxe,propertyKeyTypes:()=>Oh,randomString:()=>Bxe,required:()=>Qxe,safeExtend:()=>Jxe,shallowClone:()=>G0,slugify:()=>M0,stringifyPrimitive:()=>be,uint8ArrayToBase64:()=>B6,uint8ArrayToBase64url:()=>t$e,uint8ArrayToHex:()=>r$e,unwrapMessage:()=>$h});function Ixe(e){return e}function Dxe(e){return e}function Nxe(e){}function jxe(e){throw new Error("Unexpected value in exhaustive check")}function Lxe(e){}function Sh(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,r])=>t.indexOf(+o)===-1).map(([o,r])=>r)}function se(e,t="|"){return e.map(n=>be(n)).join(t)}function Op(e,t){return typeof t=="bigint"?t.toString():t}function Pp(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function _c(e){return e==null}function Eh(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function L0(e,t){let n=(e.toString().split(".")[1]||"").length,o=t.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let c=o.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]))}let i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}function mt(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==G6)return o===void 0&&(o=G6,o=n()),o},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Mxe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Tc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ya(...e){let t={};for(let n of e){let o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function Fxe(e){return ya(e._zod.def)}function Gxe(e,t){return t?t.reduce((n,o)=>n?.[o],e):e}function Wxe(e){let t=Object.keys(e),n=t.map(o=>e[o]);return Promise.all(n).then(o=>{let r={};for(let i=0;i<t.length;i++)r[t[i]]=o[i];return r})}function Bxe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let o=0;o<e;o++)n+=t[Math.floor(Math.random()*t.length)];return n}function FR(e){return JSON.stringify(e)}function M0(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Ru(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ic(e){if(Ru(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Ru(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function G0(e){return Ic(e)?{...e}:Array.isArray(e)?[...e]:e}function Uxe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Yo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jr(e,t,n){let o=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(o._zod.parent=e),o}function Ee(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Hxe(e){let t;return new Proxy({},{get(n,o,r){return t??(t=e()),Reflect.get(t,o,r)},set(n,o,r,i){return t??(t=e()),Reflect.set(t,o,r,i)},has(n,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(n,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(n,o,r){return t??(t=e()),Reflect.defineProperty(t,o,r)}})}function be(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function B0(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function qxe(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=ya(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return Tc(this,"shape",s),s},checks:[]});return jr(e,i)}function Vxe(e,t){let n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=ya(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return Tc(this,"shape",s),s},checks:[]});return jr(e,i)}function Kxe(e,t){if(!Ic(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=ya(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Tc(this,"shape",i),i}});return jr(e,r)}function Jxe(e,t){if(!Ic(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=ya(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Tc(this,"shape",o),o}});return jr(e,n)}function Zxe(e,t){let n=ya(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Tc(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return jr(e,n)}function Yxe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=ya(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(n)for(let l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(c[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return Tc(this,"shape",c),c},checks:[]});return jr(t,s)}function Qxe(e,t,n){let o=ya(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(let s in r)i[s]=new e({type:"nonoptional",innerType:r[s]});return Tc(this,"shape",i),i}});return jr(t,o)}function Dc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ao(e,t){return t.map(n=>{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function $h(e){return typeof e=="string"?e:e?.message}function oo(e,t,n){let o={...e,path:e.path??[]};if(!e.message){let r=$h(e.inst?._zod.def?.error?.(e))??$h(t?.error?.(e))??$h(n.customError?.(e))??$h(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function Ph(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ah(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function xe(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Ap(...e){let[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}function Xxe(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function W6(e){let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}function B6(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function e$e(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return W6(t+n)}function t$e(e){return B6(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function n$e(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)n[o/2]=Number.parseInt(t.slice(o,o+2),16);return n}function r$e(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var G6,GR,F0,zxe,Oh,W0,U0,z0,j0,He=x(()=>{G6=Symbol("evaluating");GR="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};F0=Pp(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});zxe=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Oh=new Set(["string","number","symbol"]),W0=new Set(["string","number","bigint","boolean","symbol","undefined"]);U0={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},z0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};j0=class{constructor(...t){}}});function _h(e,t=n=>n.message){let n={},o=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}function Th(e,t=n=>n.message){let n={_errors:[]},o=r=>{for(let i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>o({issues:s}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,a=0;for(;a<i.path.length;){let c=i.path[a];a===i.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return o(e),n}function H0(e,t=n=>n.message){let n={errors:[]},o=(r,i=[])=>{var s,a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>o({issues:l},c.path));else if(c.code==="invalid_key")o({issues:c.issues},c.path);else if(c.code==="invalid_element")o({issues:c.issues},c.path);else{let l=[...i,...c.path];if(l.length===0){n.errors.push(t(c));continue}let u=n,d=0;for(;d<l.length;){let p=l[d],f=d===l.length-1;typeof p=="string"?(u.properties??(u.properties={}),(s=u.properties)[p]??(s[p]={errors:[]}),u=u.properties[p]):(u.items??(u.items=[]),(a=u.items)[p]??(a[p]={errors:[]}),u=u.items[p]),f&&u.errors.push(t(c)),d++}}};return o(e),n}function z6(e){let t=[],n=e.map(o=>typeof o=="object"?o.key:o);for(let o of n)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}function q0(e){let t=[],n=[...e.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${z6(o.path)}`);return t.join(`
|
|
8
8
|
`)}var U6,Ch,io,V0=x(()=>{Ep();He();U6=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Op,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ch=V("$ZodError",U6),io=V("$ZodError",U6,{Parent:Error})});var Cp,WR,_p,BR,Tp,K0,Ip,J0,UR,i$e,zR,s$e,HR,a$e,qR,c$e,VR,l$e,KR,u$e,JR,d$e,ZR,p$e,Z0=x(()=>{Ep();V0();He();Cp=e=>(t,n,o,r)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Fi;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map(c=>oo(c,i,xn())));throw GR(a,r?.callee),a}return s.value},WR=Cp(io),_p=e=>async(t,n,o,r)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(r?.Err??e)(s.issues.map(c=>oo(c,i,xn())));throw GR(a,r?.callee),a}return s.value},BR=_p(io),Tp=e=>(t,n,o)=>{let r=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new Fi;return i.issues.length?{success:!1,error:new(e??Ch)(i.issues.map(s=>oo(s,r,xn())))}:{success:!0,data:i.value}},K0=Tp(io),Ip=e=>async(t,n,o)=>{let r=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>oo(s,r,xn())))}:{success:!0,data:i.value}},J0=Ip(io),UR=e=>(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Cp(e)(t,n,r)},i$e=UR(io),zR=e=>(t,n,o)=>Cp(e)(t,n,o),s$e=zR(io),HR=e=>async(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return _p(e)(t,n,r)},a$e=HR(io),qR=e=>async(t,n,o)=>_p(e)(t,n,o),c$e=qR(io),VR=e=>(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Tp(e)(t,n,r)},l$e=VR(io),KR=e=>(t,n,o)=>Tp(e)(t,n,o),u$e=KR(io),JR=e=>async(t,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ip(e)(t,n,r)},d$e=JR(io),ZR=e=>async(t,n,o)=>Ip(e)(t,n,o),p$e=ZR(io)});var Qo={};Re(Qo,{base64:()=>pT,base64url:()=>YR,bigint:()=>wT,boolean:()=>vT,browserEmail:()=>v$e,cidrv4:()=>uT,cidrv6:()=>dT,cuid:()=>Y0,cuid2:()=>Q0,date:()=>mT,datetime:()=>hT,domain:()=>x$e,duration:()=>rT,e164:()=>fT,email:()=>iT,emoji:()=>sT,extendedDuration:()=>f$e,guid:()=>oT,hex:()=>$$e,hostname:()=>R$e,html5Email:()=>y$e,idnEmail:()=>b$e,integer:()=>bT,ipv4:()=>aT,ipv6:()=>cT,ksuid:()=>tT,lowercase:()=>xT,mac:()=>lT,md5_base64:()=>E$e,md5_base64url:()=>O$e,md5_hex:()=>S$e,nanoid:()=>nT,null:()=>kT,number:()=>QR,rfc5322Email:()=>w$e,sha1_base64:()=>A$e,sha1_base64url:()=>C$e,sha1_hex:()=>P$e,sha256_base64:()=>T$e,sha256_base64url:()=>I$e,sha256_hex:()=>_$e,sha384_base64:()=>N$e,sha384_base64url:()=>j$e,sha384_hex:()=>D$e,sha512_base64:()=>M$e,sha512_base64url:()=>F$e,sha512_hex:()=>L$e,string:()=>yT,time:()=>gT,ulid:()=>X0,undefined:()=>RT,unicodeEmail:()=>H6,uppercase:()=>$T,uuid:()=>xu,uuid4:()=>m$e,uuid6:()=>g$e,uuid7:()=>h$e,xid:()=>eT});function sT(){return new RegExp(k$e,"u")}function V6(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gT(e){return new RegExp(`^${V6(e)}$`)}function hT(e){let t=V6({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${n.join("|")})`;return new RegExp(`^${q6}T(?:${o})$`)}function Ih(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Dh(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Y0,Q0,X0,eT,tT,nT,rT,f$e,oT,xu,m$e,g$e,h$e,iT,y$e,w$e,H6,b$e,v$e,k$e,aT,cT,lT,uT,dT,pT,YR,R$e,x$e,fT,q6,mT,yT,wT,bT,QR,vT,kT,RT,xT,$T,$$e,S$e,E$e,O$e,P$e,A$e,C$e,_$e,T$e,I$e,D$e,N$e,j$e,L$e,M$e,F$e,XR=x(()=>{He();Y0=/^[cC][^\s-]{8,}$/,Q0=/^[0-9a-z]+$/,X0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,eT=/^[0-9a-vA-V]{20}$/,tT=/^[A-Za-z0-9]{27}$/,nT=/^[a-zA-Z0-9_-]{21}$/,rT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,f$e=/^[-+]?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)?)??$/,oT=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xu=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,m$e=xu(4),g$e=xu(6),h$e=xu(7),iT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,y$e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,w$e=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,H6=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,b$e=H6,v$e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,k$e="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";aT=/^(?:(?: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])$/,cT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,lT=e=>{let t=Yo(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},uT=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,YR=/^[A-Za-z0-9_-]*$/,R$e=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,x$e=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,fT=/^\+[1-9]\d{6,14}$/,q6="(?:(?:\\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])))",mT=new RegExp(`^${q6}$`);yT=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},wT=/^-?\d+n?$/,bT=/^-?\d+$/,QR=/^-?\d+(?:\.\d+)?$/,vT=/^(?:true|false)$/i,kT=/^null$/i,RT=/^undefined$/i,xT=/^[^A-Z]*$/,$T=/^[^a-z]*$/,$$e=/^[0-9a-fA-F]*$/;S$e=/^[0-9a-fA-F]{32}$/,E$e=Ih(22,"=="),O$e=Dh(22),P$e=/^[0-9a-fA-F]{40}$/,A$e=Ih(27,"="),C$e=Dh(27),_$e=/^[0-9a-fA-F]{64}$/,T$e=Ih(43,"="),I$e=Dh(43),D$e=/^[0-9a-fA-F]{96}$/,N$e=Ih(64,""),j$e=Dh(64),L$e=/^[0-9a-fA-F]{128}$/,M$e=Ih(86,"=="),F$e=Dh(86)});function K6(e,t,n){e.issues.length&&t.issues.push(...Ao(n,e.issues))}var Yt,J6,ex,tx,ST,ET,OT,PT,AT,CT,_T,TT,IT,Dp,DT,NT,jT,LT,MT,FT,GT,WT,BT,nx=x(()=>{Ep();XR();He();Yt=V("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),J6={number:"number",bigint:"bigint",object:"date"},ex=V("$ZodCheckLessThan",(e,t)=>{Yt.init(e,t);let n=J6[typeof t.value];e._zod.onattach.push(o=>{let r=o._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tx=V("$ZodCheckGreaterThan",(e,t)=>{Yt.init(e,t);let n=J6[typeof t.value];e._zod.onattach.push(o=>{let r=o._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ST=V("$ZodCheckMultipleOf",(e,t)=>{Yt.init(e,t),e._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):L0(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ET=V("$ZodCheckNumberFormat",(e,t)=>{Yt.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),o=n?"int":"number",[r,i]=U0[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=r,a.maximum=i,n&&(a.pattern=bT)}),e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<r&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),OT=V("$ZodCheckBigIntFormat",(e,t)=>{Yt.init(e,t);let[n,o]=z0[t.format];e._zod.onattach.push(r=>{let i=r._zod.bag;i.format=t.format,i.minimum=n,i.maximum=o}),e._zod.check=r=>{let i=r.value;i<n&&r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>o&&r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),PT=V("$ZodCheckMaxSize",(e,t)=>{var n;Yt.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!_c(r)&&r.size!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let r=o.value;r.size<=t.maximum||o.issues.push({origin:Ph(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),AT=V("$ZodCheckMinSize",(e,t)=>{var n;Yt.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!_c(r)&&r.size!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let r=o.value;r.size>=t.minimum||o.issues.push({origin:Ph(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),CT=V("$ZodCheckSizeEquals",(e,t)=>{var n;Yt.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!_c(r)&&r.size!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=o=>{let r=o.value,i=r.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:Ph(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),_T=V("$ZodCheckMaxLength",(e,t)=>{var n;Yt.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!_c(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let r=o.value;if(r.length<=t.maximum)return;let s=Ah(r);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),TT=V("$ZodCheckMinLength",(e,t)=>{var n;Yt.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!_c(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let r=o.value;if(r.length>=t.minimum)return;let s=Ah(r);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),IT=V("$ZodCheckLengthEquals",(e,t)=>{var n;Yt.init(e,t),(n=e._zod.def).when??(n.when=o=>{let r=o.value;return!_c(r)&&r.length!==void 0}),e._zod.onattach.push(o=>{let r=o._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=o=>{let r=o.value,i=r.length;if(i===t.length)return;let s=Ah(r),a=i>t.length;o.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Dp=V("$ZodCheckStringFormat",(e,t)=>{var n,o;Yt.init(e,t),e._zod.onattach.push(r=>{let i=r._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),DT=V("$ZodCheckRegex",(e,t)=>{Dp.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),NT=V("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xT),Dp.init(e,t)}),jT=V("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$T),Dp.init(e,t)}),LT=V("$ZodCheckIncludes",(e,t)=>{Yt.init(e,t);let n=Yo(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(r=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),MT=V("$ZodCheckStartsWith",(e,t)=>{Yt.init(e,t);let n=new RegExp(`^${Yo(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),FT=V("$ZodCheckEndsWith",(e,t)=>{Yt.init(e,t);let n=new RegExp(`.*${Yo(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});GT=V("$ZodCheckProperty",(e,t)=>{Yt.init(e,t),e._zod.check=n=>{let o=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(r=>K6(r,n,t.property));K6(o,n,t.property)}}),WT=V("$ZodCheckMimeType",(e,t)=>{Yt.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(o=>{o._zod.bag.mime=t.mime}),e._zod.check=o=>{n.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),BT=V("$ZodCheckOverwrite",(e,t)=>{Yt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}})});var Nh,UT=x(()=>{Nh=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
9
9
|
`).filter(s=>s),r=Math.min(...o.map(s=>s.length-s.trimStart().length)),i=o.map(s=>s.slice(r)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,n=this?.args,r=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,r.join(`
|
|
10
10
|
`))}}});var zT,HT=x(()=>{zT={major:4,minor:3,patch:6}});function fI(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function cJ(e){if(!YR.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return fI(n)}function lJ(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[o]=n;if(!o)return!1;let r=JSON.parse(atob(o));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}function Y6(e,t,n){e.issues.length&&t.issues.push(...Ao(n,e.issues)),t.value[n]=e.value}function ax(e,t,n,o,r){if(e.issues.length){if(r&&!(n in o))return;t.issues.push(...Ao(n,e.issues))}e.value===void 0?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function uJ(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let n=B0(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function dJ(e,t,n,o,r,i){let s=[],a=r.keySet,c=r.catchall._zod,l=c.def.type,u=c.optout==="optional";for(let d in t){if(a.has(d))continue;if(l==="never"){s.push(d);continue}let p=c.run({value:t[d],issues:[]},o);p instanceof Promise?e.push(p.then(f=>ax(f,n,d,t,u))):ax(p,n,d,t,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}function Q6(e,t,n,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let r=e.filter(i=>!Dc(i));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>oo(s,o,xn())))}),t)}function X6(e,t,n,o){let r=e.filter(i=>i.issues.length===0);return r.length===1?(t.value=r[0].value,t):(r.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>oo(s,o,xn())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}function qT(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ic(e)&&Ic(t)){let n=Object.keys(t),o=Object.keys(e).filter(i=>n.indexOf(i)!==-1),r={...e,...t};for(let i of o){let s=qT(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r[i]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t[o],s=qT(r,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function eJ(e,t,n){let o=new Map,r;for(let a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of n.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let i=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&r&&e.issues.push({...r,keys:i}),Dc(e))return e;let s=qT(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}function rx(e,t,n){e.issues.length&&t.issues.push(...Ao(n,e.issues)),t.value[n]=e.value}function tJ(e,t,n,o,r,i,s){e.issues.length&&(Oh.has(typeof o)?n.issues.push(...Ao(o,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:i,issues:e.issues.map(a=>oo(a,s,xn()))})),t.issues.length&&(Oh.has(typeof o)?n.issues.push(...Ao(o,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:i,key:o,issues:t.issues.map(a=>oo(a,s,xn()))})),n.value.set(e.value,t.value)}function nJ(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function rJ(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}function oJ(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function iJ(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function ox(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}function ix(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);return r instanceof Promise?r.then(i=>sx(e,i,t.out,n)):sx(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(i=>sx(e,i,t.in,n)):sx(e,r,t.in,n)}}function sx(e,t,n,o){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},o)}function sJ(e){return e.value=Object.freeze(e.value),e}function aJ(e,t,n,o){if(!e){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(r.params=o._zod.def.params),t.issues.push(Ap(r))}}var rt,$u,Ht,VT,KT,JT,ZT,YT,QT,XT,eI,tI,nI,rI,oI,iI,sI,aI,cI,lI,uI,dI,pI,mI,gI,hI,yI,wI,cx,bI,jh,lx,vI,kI,RI,xI,$I,SI,EI,OI,PI,AI,pJ,CI,Lh,_I,TI,II,ux,DI,NI,jI,LI,MI,FI,GI,dx,WI,BI,UI,zI,HI,qI,VI,KI,JI,Mh,ZI,YI,QI,XI,eD,tD,nD=x(()=>{nx();Ep();UT();Z0();XR();He();HT();He();rt=V("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zT;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let r of o)for(let i of r._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(s,a,c)=>{let l=Dc(s),u;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(l)continue;let p=s.issues.length,f=d._zod.check(s);if(f instanceof Promise&&c?.async===!1)throw new Fi;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(l||(l=Dc(s,p)))});else{if(s.issues.length===p)continue;l||(l=Dc(s,p))}}return u?u.then(()=>s):s},i=(s,a,c)=>{if(Dc(s))return s.aborted=!0,s;let l=r(a,o,c);if(l instanceof Promise){if(c.async===!1)throw new Fi;return l.then(u=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(u=>i(u,s,a)):i(l,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Fi;return c.then(l=>r(l,o,a))}return r(c,o,a)}}mt(e,"~standard",()=>({validate:r=>{try{let i=K0(e,r);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return J0(e,r).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),$u=V("$ZodString",(e,t)=>{rt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yT(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ht=V("$ZodStringFormat",(e,t)=>{Dp.init(e,t),$u.init(e,t)}),VT=V("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=oT),Ht.init(e,t)}),KT=V("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=xu(o))}else t.pattern??(t.pattern=xu());Ht.init(e,t)}),JT=V("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=iT),Ht.init(e,t)}),ZT=V("$ZodURL",(e,t)=>{Ht.init(e,t),e._zod.check=n=>{try{let o=n.value.trim(),r=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=r.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),YT=V("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=sT()),Ht.init(e,t)}),QT=V("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=nT),Ht.init(e,t)}),XT=V("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Y0),Ht.init(e,t)}),eI=V("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Q0),Ht.init(e,t)}),tI=V("$ZodULID",(e,t)=>{t.pattern??(t.pattern=X0),Ht.init(e,t)}),nI=V("$ZodXID",(e,t)=>{t.pattern??(t.pattern=eT),Ht.init(e,t)}),rI=V("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tT),Ht.init(e,t)}),oI=V("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=hT(t)),Ht.init(e,t)}),iI=V("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=mT),Ht.init(e,t)}),sI=V("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gT(t)),Ht.init(e,t)}),aI=V("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=rT),Ht.init(e,t)}),cI=V("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=aT),Ht.init(e,t),e._zod.bag.format="ipv4"}),lI=V("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=cT),Ht.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),uI=V("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=lT(t.delimiter)),Ht.init(e,t),e._zod.bag.format="mac"}),dI=V("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=uT),Ht.init(e,t)}),pI=V("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=dT),Ht.init(e,t),e._zod.check=n=>{let o=n.value.split("/");try{if(o.length!==2)throw new Error;let[r,i]=o;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});mI=V("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=pT),Ht.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{fI(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});gI=V("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=YR),Ht.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{cJ(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),hI=V("$ZodE164",(e,t)=>{t.pattern??(t.pattern=fT),Ht.init(e,t)});yI=V("$ZodJWT",(e,t)=>{Ht.init(e,t),e._zod.check=n=>{lJ(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),wI=V("$ZodCustomStringFormat",(e,t)=>{Ht.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),cx=V("$ZodNumber",(e,t)=>{rt.init(e,t),e._zod.pattern=e._zod.bag.pattern??QR,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let i=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...i?{received:i}:{}}),n}}),bI=V("$ZodNumberFormat",(e,t)=>{ET.init(e,t),cx.init(e,t)}),jh=V("$ZodBoolean",(e,t)=>{rt.init(e,t),e._zod.pattern=vT,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=!!n.value}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),lx=V("$ZodBigInt",(e,t)=>{rt.init(e,t),e._zod.pattern=wT,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),vI=V("$ZodBigIntFormat",(e,t)=>{OT.init(e,t),lx.init(e,t)}),kI=V("$ZodSymbol",(e,t)=>{rt.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),RI=V("$ZodUndefined",(e,t)=>{rt.init(e,t),e._zod.pattern=RT,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,o)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),xI=V("$ZodNull",(e,t)=>{rt.init(e,t),e._zod.pattern=kT,e._zod.values=new Set([null]),e._zod.parse=(n,o)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),$I=V("$ZodAny",(e,t)=>{rt.init(e,t),e._zod.parse=n=>n}),SI=V("$ZodUnknown",(e,t)=>{rt.init(e,t),e._zod.parse=n=>n}),EI=V("$ZodNever",(e,t)=>{rt.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),OI=V("$ZodVoid",(e,t)=>{rt.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),PI=V("$ZodDate",(e,t)=>{rt.init(e,t),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,i=r instanceof Date;return i&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:e}),n}});AI=V("$ZodArray",(e,t)=>{rt.init(e,t),e._zod.parse=(n,o)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let i=[];for(let s=0;s<r.length;s++){let a=r[s],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?i.push(c.then(l=>Y6(l,n,s))):Y6(c,n,s)}return i.length?Promise.all(i).then(()=>n):n}});pJ=V("$ZodObject",(e,t)=>{if(rt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=Pp(()=>uJ(t));mt(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let d of u.values)c[l].add(d)}}return c});let r=Ru,i=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=o.value);let l=a.value;if(!r(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let u=[],d=s.shape;for(let p of s.keys){let f=d[p],m=f._zod.optout==="optional",g=f._zod.run({value:l[p],issues:[]},c);g instanceof Promise?u.push(g.then(h=>ax(h,a,p,l,m))):ax(g,a,p,l,m)}return i?dJ(u,l,a,c,o.value,e):u.length?Promise.all(u).then(()=>a):a}}),CI=V("$ZodObjectJIT",(e,t)=>{pJ.init(e,t);let n=e._zod.parse,o=Pp(()=>uJ(t)),r=p=>{let f=new Nh(["shape","payload","ctx"]),m=o.value,g=v=>{let b=FR(v);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};f.write("const input = payload.value;");let h=Object.create(null),w=0;for(let v of m.keys)h[v]=`key_${w++}`;f.write("const newResult = {};");for(let v of m.keys){let b=h[v],$=FR(v),O=p[v]?._zod?.optout==="optional";f.write(`const ${b} = ${g(v)};`),O?f.write(`
|
|
@@ -102,7 +102,7 @@ ${e.timestamp}`,"utf-8")}function PAe(e,t,n){let o=`the approval of gate ${n.gat
|
|
|
102
102
|
`+A.slice(de+1):Ne+=A.slice(me),Ne.slice(1)}function Tn(A){let Z="",ie=0;for(let fe=0;fe<A.length;ie>=65536?fe+=2:fe++){ie=Ae(A,fe);let me=C[ie];!me&&X(ie)?(Z+=A[fe],ie>=65536&&(Z+=A[fe+1])):Z+=me||Y(ie)}return Z}function ar(A,Z,ie){let fe="",me=A.tag;for(let we=0,de=ie.length;we<de;we+=1){let Oe=ie[we];A.replacer&&(Oe=A.replacer.call(ie,String(we),Oe)),(U(A,Z,Oe,!1,!1)||typeof Oe>"u"&&U(A,Z,null,!1,!1))&&(fe!==""&&(fe+=","+(A.condenseFlow?"":" ")),fe+=A.dump)}A.tag=me,A.dump="["+fe+"]"}function Nr(A,Z,ie,fe){let me="",we=A.tag;for(let de=0,Oe=ie.length;de<Oe;de+=1){let Ne=ie[de];A.replacer&&(Ne=A.replacer.call(ie,String(de),Ne)),(U(A,Z+1,Ne,!0,!0,!1,!0)||typeof Ne>"u"&&U(A,Z+1,null,!0,!0,!1,!0))&&((!fe||me!=="")&&(me+=K(A,Z)),A.dump&&a===A.dump.charCodeAt(0)?me+="-":me+="- ",me+=A.dump)}A.tag=we,A.dump=me||"[]"}function kr(A,Z,ie){let fe="",me=A.tag,we=Object.keys(ie);for(let de=0,Oe=we.length;de<Oe;de+=1){let Ne="";fe!==""&&(Ne+=", "),A.condenseFlow&&(Ne+='"');let Ve=we[de],Je=ie[Ve];A.replacer&&(Je=A.replacer.call(ie,Ve,Je)),U(A,Z,Ve,!1,!1)&&(A.dump.length>1024&&(Ne+="? "),Ne+=A.dump+(A.condenseFlow?'"':"")+":"+(A.condenseFlow?"":" "),U(A,Z,Je,!1,!1)&&(Ne+=A.dump,fe+=Ne))}A.tag=me,A.dump="{"+fe+"}"}function Oc(A,Z,ie,fe){let me="",we=A.tag,de=Object.keys(ie);if(A.sortKeys===!0)de.sort();else if(typeof A.sortKeys=="function")de.sort(A.sortKeys);else if(A.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let Oe=0,Ne=de.length;Oe<Ne;Oe+=1){let Ve="";(!fe||me!=="")&&(Ve+=K(A,Z));let Je=de[Oe],et=ie[Je];if(A.replacer&&(et=A.replacer.call(ie,Je,et)),!U(A,Z+1,Je,!0,!0,!0))continue;let ut=A.tag!==null&&A.tag!=="?"||A.dump&&A.dump.length>1024;ut&&(A.dump&&a===A.dump.charCodeAt(0)?Ve+="?":Ve+="? "),Ve+=A.dump,ut&&(Ve+=K(A,Z)),U(A,Z+1,et,!0,ut)&&(A.dump&&a===A.dump.charCodeAt(0)?Ve+=":":Ve+=": ",Ve+=A.dump,me+=Ve)}A.tag=we,A.dump=me||"{}"}function R(A,Z,ie){let fe=ie?A.explicitTypes:A.implicitTypes;for(let me=0,we=fe.length;me<we;me+=1){let de=fe[me];if((de.instanceOf||de.predicate)&&(!de.instanceOf||typeof Z=="object"&&Z instanceof de.instanceOf)&&(!de.predicate||de.predicate(Z))){if(ie?de.multi&&de.representName?A.tag=de.representName(Z):A.tag=de.tag:A.tag="?",de.represent){let Oe=A.styleMap[de.tag]||de.defaultStyle,Ne;if(o.call(de.represent)==="[object Function]")Ne=de.represent(Z,Oe);else if(r.call(de.represent,Oe))Ne=de.represent[Oe](Z,Oe);else throw new t("!<"+de.tag+'> tag resolver accepts not "'+Oe+'" style');A.dump=Ne}return!0}}return!1}function U(A,Z,ie,fe,me,we,de){A.tag=null,A.dump=ie,R(A,ie,!1)||R(A,ie,!0);let Oe=o.call(A.dump),Ne=fe;fe&&(fe=A.flowLevel<0||A.flowLevel>Z);let Ve=Oe==="[object Object]"||Oe==="[object Array]",Je,et;if(Ve&&(Je=A.duplicates.indexOf(ie),et=Je!==-1),(A.tag!==null&&A.tag!=="?"||et||A.indent!==2&&Z>0)&&(me=!1),et&&A.usedDuplicates[Je])A.dump="*ref_"+Je;else{if(Ve&&et&&!A.usedDuplicates[Je]&&(A.usedDuplicates[Je]=!0),Oe==="[object Object]")fe&&Object.keys(A.dump).length!==0?(Oc(A,Z,A.dump,me),et&&(A.dump="&ref_"+Je+A.dump)):(kr(A,Z,A.dump),et&&(A.dump="&ref_"+Je+" "+A.dump));else if(Oe==="[object Array]")fe&&A.dump.length!==0?(A.noArrayIndent&&!de&&Z>0?Nr(A,Z-1,A.dump,me):Nr(A,Z,A.dump,me),et&&(A.dump="&ref_"+Je+A.dump)):(ar(A,Z,A.dump),et&&(A.dump="&ref_"+Je+" "+A.dump));else if(Oe==="[object String]")A.tag!=="?"&&Dt(A,A.dump,Z,we,Ne);else{if(Oe==="[object Undefined]")return!1;if(A.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+Oe)}if(A.tag!==null&&A.tag!=="?"){let ut=encodeURI(A.tag[0]==="!"?A.tag.slice(1):A.tag).replace(/!/g,"%21");A.tag[0]==="!"?ut="!"+ut:ut.slice(0,18)==="tag:yaml.org,2002:"?ut="!!"+ut.slice(18):ut="!<"+ut+">",A.dump=ut+" "+A.dump}}return!0}function oe(A,Z){let ie=[],fe=[];ue(A,ie,fe);let me=fe.length;for(let we=0;we<me;we+=1)Z.duplicates.push(ie[fe[we]]);Z.usedDuplicates=new Array(me)}function ue(A,Z,ie){if(A!==null&&typeof A=="object"){let fe=Z.indexOf(A);if(fe!==-1)ie.indexOf(fe)===-1&&ie.push(fe);else if(Z.push(A),Array.isArray(A))for(let me=0,we=A.length;me<we;me+=1)ue(A[me],Z,ie);else{let me=Object.keys(A);for(let we=0,de=me.length;we<de;we+=1)ue(A[me[we]],Z,ie)}}}function re(A,Z){Z=Z||{};let ie=new H(Z);ie.noRefs||oe(A,ie);let fe=A;return ie.replacer&&(fe=ie.replacer.call({"":fe},"",fe)),U(ie,0,fe,!0,!0)?ie.dump+`
|
|
103
103
|
`:""}return LF.dump=re,LF}function ENe(){if(u7)return Er;u7=1;let e=$Ne(),t=SNe();function n(o,r){return function(){throw new Error("Function yaml."+o+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}return Er.Type=zr(),Er.Schema=d7(),Er.FAILSAFE_SCHEMA=g7(),Er.JSON_SCHEMA=v7(),Er.CORE_SCHEMA=k7(),Er.DEFAULT_SCHEMA=MF(),Er.load=e.load,Er.loadAll=e.loadAll,Er.dump=t.dump,Er.YAMLException=yw(),Er.types={binary:$7(),float:b7(),map:m7(),null:h7(),pairs:E7(),set:O7(),timestamp:R7(),bool:y7(),int:w7(),merge:x7(),omap:S7(),seq:f7(),str:p7()},Er.safeLoad=n("safeLoad","load"),Er.safeLoadAll=n("safeLoadAll","loadAll"),Er.safeDump=n("safeDump","dump"),Er}var Er,VS,ol,GX,hF,WX,yF,BX,wF,UX,bF,zX,vF,HX,kF,qX,RF,VX,xF,KX,$F,JX,SF,ZX,EF,YX,OF,QX,PF,XX,AF,e7,CF,t7,_F,n7,TF,r7,IF,o7,DF,i7,NF,s7,jF,a7,c7,LF,l7,u7,ONe,Aa,Ndt,jdt,Ldt,Mdt,Fdt,Gdt,Wdt,Bdt,Udt,zdt,Hdt,qdt,Vdt,Kdt,KS=x(()=>{Er={},VS={},ol={};LF={};ONe=ENe(),Aa=RNe(ONe),{Type:Ndt,Schema:jdt,FAILSAFE_SCHEMA:Ldt,JSON_SCHEMA:Mdt,CORE_SCHEMA:Fdt,DEFAULT_SCHEMA:Gdt,load:Wdt,loadAll:Bdt,dump:Udt,YAMLException:zdt,types:Hdt,safeLoad:qdt,safeLoadAll:Vdt,safeDump:Kdt}=Aa});import{existsSync as PNe,readFileSync as ZS}from"node:fs";import{isAbsolute as GF,join as WF,relative as BF,resolve as UF}from"node:path";function A7(e=[]){let t=new Map;for(let n of[...P7,...e]){if(t.has(n.name))throw new Error(`kind ${n.name} is registered twice`);t.set(n.name,n)}return{get:n=>t.get(n),names:()=>[...t.values()].filter(n=>n.shape==="member").map(n=>n.name).sort(),all:()=>[...t.values()]}}function C7(){return A7()}function _7(e,t,n){if("directory"in e.probe)return!0;if("chantProject"in e.probe)return qF(t,n);if("repo"in e.probe)return!0;let{anyFile:o,anyBlock:r,anyJsonKey:i,anyLine:s,anyDocument:a}=e.probe;if(o&&ww(t,n,o).length>0)return!0;if(i)for(let c of ww(t,n,i.in))try{let l=JSON.parse(t.read(c));if(i.pointers.some(u=>T7(l,u)!==void 0))return!0}catch{}if(s){let c=s.starts.map(l=>l.toLowerCase());for(let l of ww(t,n,s.in))try{if(t.read(l).split(/\r?\n/).some(u=>c.some(d=>u.trimStart().toLowerCase().startsWith(d))))return!0}catch{}}if(a)for(let c of ww(t,n,a.in))try{if(_Ne(t.read(c)).some(l=>a.match.some(u=>TNe(l,u))))return!0}catch{}if(r){let c=new RegExp(`^\\s*(?:${r.blocks.map(HF).join("|")})\\s*\\{`,"m");for(let l of ww(t,n,r.in))try{if(c.test(t.read(l)))return!0}catch{}}return!1}function ww(e,t,n){let o=[],r=n.filter(i=>i.includes("*"));for(let i of n)!i.includes("*")&&e.stat(Fe(t,i))==="file"&&o.push(Fe(t,i));if(r.length>0){let i=r.map(s=>new RegExp(`^${s.split("*").map(a=>HF(a).replace(/\\\[0-9\\\]/g,"[0-9]")).join("[^/]*")}$`));for(let s of e.list(t)??[])s.type==="file"&&i.some(a=>a.test(s.name))&&o.push(Fe(t,s.name))}return o.sort()}function _Ne(e){try{return Aa.loadAll(e)}catch{try{return Aa.loadAll(e.replace(/(^|[\s:\-[,{])!(?:[A-Za-z][\w]*:?)+/gm,"$1"))}catch{return[]}}}function TNe(e,t){let n=Object.entries(t);return n.length>0&&n.every(([o,r])=>{let i=T7(e,o);return i===void 0?!1:r.some(s=>new RegExp(`^${s.split("*").map(HF).join(".*")}$`).test(String(i)))})}function T7(e,t){let n=e;for(let o of t.split("/").slice(1)){let r=o.replace(/~1/g,"/").replace(/~0/g,"~");if(n===null||typeof n!="object"||!Object.prototype.hasOwnProperty.call(n,r))return;n=n[r]}return n}function HF(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qF(e,t){let n=Fe(t,"package.json");if(e.stat(n)==="file")try{let r=JSON.parse(e.read(n));for(let i of["dependencies","devDependencies","peerDependencies"]){let s=r[i];if(s&&typeof s=="object"&&Object.keys(s).some(NNe))return!0}}catch{}let o=(r,i)=>{let s=e.list(r)??[];return s.some(a=>a.type==="file"&&INe.includes(a.name))?!0:i===DNe?!1:s.some(a=>a.type==="dir"&&!jo(a.name)&&o(Fe(r,a.name),i+1))};return o(t,0)}function NNe(e){return e==="@intentius/chant"||e.startsWith("@intentius/chant-lexicon-")}function jNe(){if(JS)return JS;let e=Pa();return JS=new e({allErrors:!0,strict:!0}).compile(HL),JS}function LNe(e,t){let n;try{n=JSON.parse(e)}catch(a){return{kinds:[],problems:[`${t}: the kinds file is not JSON (${a.message})`]}}let o=jNe();if(!o(n)){let a=(o.errors??[]).map(c=>`${t}: ${c.instancePath||"the kinds file"} ${c.message??"is invalid"}`);return{kinds:[],problems:[...new Set(a)]}}let r=[],i=[],s=new Set;for(let a of n.kinds){if(CNe.includes(a.name)){r.push(`${t}: kind ${a.name} is built in and can't be supplied by a package`);continue}if(s.has(a.name)){r.push(`${t}: kind ${a.name} is listed twice`);continue}s.add(a.name),i.push({name:a.name,description:a.description,probe:{...a.probe.anyFile?{anyFile:[...a.probe.anyFile]}:{},...a.probe.anyBlock?{anyBlock:{in:[...a.probe.anyBlock.in],blocks:[...a.probe.anyBlock.blocks]}}:{},...a.probe.anyJsonKey?{anyJsonKey:{in:[...a.probe.anyJsonKey.in],pointers:[...a.probe.anyJsonKey.pointers]}}:{},...a.probe.anyLine?{anyLine:{in:[...a.probe.anyLine.in],starts:[...a.probe.anyLine.starts]}}:{},...a.probe.anyDocument?{anyDocument:{in:[...a.probe.anyDocument.in],match:a.probe.anyDocument.match.map(c=>structuredClone(c))}}:{}},precedence:a.precedence,shape:"member",outputs:{from:"declared",names:[...a.outputs??[]]},source:t,...a.graph?{graph:{...a.graph.lexicon?{lexicon:a.graph.lexicon}:{},...a.graph.reader?{reader:a.graph.reader}:{},config:structuredClone(a.graph.config??{})}}:{},...a.fields?{fields:structuredClone(a.fields)}:{},...a.reader&&FF.includes(a.reader)?{reader:a.reader}:{},...a.memberFile?{memberFile:{path:a.memberFile.path,schema:a.memberFile.schema}}:{}}),a.reader&&!FF.includes(a.reader)&&r.push(`${t}: kind ${a.name} names link reader ${a.reader}, which this chant does not have (it has ${FF.join(", ")}); the kind is kept, and its members' links are only those their entries state`);for(let c of WNe(a.fields??{}))r.push(`${t}: kind ${a.name} ${c}`)}return{kinds:i,problems:r}}function MNe(e,t=zF){return sM(e,t)}function FNe(e,t){let n=WF(e,"package.json"),o;try{o=JSON.parse(ZS(n,"utf-8"))}catch{return{kinds:[],problems:[`${t??e}: no readable package.json in ${e}`],file:void 0}}let r=t??(typeof o.name=="string"?o.name:e),i=MNe(o);if(i===void 0)return{kinds:[],problems:[],file:void 0};if(typeof i!="string")return{kinds:[],problems:[`${r}: ${i.problem}`],file:void 0};let s=UF(e,i),a=BF(e,s);if(a.startsWith("..")||GF(a))return{kinds:[],problems:[`${r}: exports["${zF}"] points outside the package`],file:void 0};let c;try{c=ZS(s,"utf-8")}catch{return{kinds:[],problems:[`${r}: exports["${zF}"] names ${i}, which does not exist`],file:s}}let l=LNe(c,r),u=typeof o.name=="string"?o.name:void 0;for(let d of l.kinds){if(d.packageDir=e,d.memberFile){let p=GNe(d.memberFile,e);p&&l.problems.push(`${r}: kind ${d.name} ${p}; members of the kind fail WSP012 until it is fixed`)}if(d.graph?.reader){let p=UF(e,...d.graph.reader.split("/")),f=BF(e,p);f.startsWith("..")||GF(f)?(l.problems.push(`${r}: kind ${d.name} names graph reader ${d.graph.reader}, which is outside the package; the kind is kept, and workspace graph lists its members with kind-not-run`),delete d.graph):PNe(p)?d.graph.readerFile=p:(l.problems.push(`${r}: kind ${d.name} names graph reader ${d.graph.reader}, which does not exist in the package; the kind is kept, and workspace graph lists its members with kind-not-run`),delete d.graph)}else d.graph?.lexicon&&u!==YS(d.graph.lexicon)&&(l.problems.push(`${r}: kind ${d.name} reads its members with lexicon ${d.graph.lexicon}, which is ${YS(d.graph.lexicon)}, and this package is ${u??"unnamed"}; the kind is kept, and workspace graph lists its members with kind-not-run`),delete d.graph)}return{...l,file:s}}function GNe(e,t){let n=UF(t,...e.schema.split("/"));e.schemaFile=n;let o=BF(t,n);if(o.startsWith("..")||GF(o))return`names member-file schema ${e.schema}, which is outside the package`;let r;try{r=JSON.parse(ZS(n,"utf-8"))}catch(i){return i.code==="ENOENT"?`names member-file schema ${e.schema}, which does not exist`:`names member-file schema ${e.schema}, which is not JSON (${i.message})`}if(r===null||typeof r!="object"||Array.isArray(r))return`names member-file schema ${e.schema}, which is not a JSON Schema object`;try{let i=Pa();e.validate=new i({allErrors:!0,strict:!1}).compile(r)}catch(i){return`names member-file schema ${e.schema}, which does not compile as a draft 2020-12 schema (${i.message})`}}function YS(e){return`@intentius/chant-lexicon-${e}`}function VF(e,t){let n=r=>r.replace(/\{(member|dir|workspace)\}/g,(i,s)=>t[s]),o=r=>typeof r=="string"?n(r):Array.isArray(r)?r.map(o):r!==null&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([i,s])=>[n(i),o(s)])):r;return o(e)}function KF(e,t,n=fS){if(e.package){let o=Cs(e.package,t)??Cs(e.package,n);if(!o)return{problem:`pinned package ${e.package} is not installed; install it to read the kinds it supplies`};let r;try{r=JSON.parse(ZS(WF(o,"package.json"),"utf-8")).version}catch{r=void 0}return e.version&&r!==e.version?{problem:`${e.package} is pinned at ${e.version}, and ${String(r??"an unknown version")} is installed`}:{dir:o,source:e.package}}if(e.path){let o=WF(t,...e.path.split("/"));if(e.integrity){let r=M8(o,e.integrity,e.path);if(!r.ok)return{problem:r.message}}return{dir:o,source:e.path}}return null}function il(e,t){let n=[],o=[],r=new Map,i=new Set;return e.forEach((s,a)=>{let c=KF(s,t);if(c===null)return;if("problem"in c){n.push({pin:a,message:c.problem});return}let{dir:l,source:u}=c,d=FNe(l,u);for(let p of d.problems)n.push({pin:a,message:p});for(let p of d.kinds){let f=r.get(p.name);if(f){i.add(p.name),n.push({pin:a,message:`kind ${p.name} is supplied by both ${f} and ${u}; a kind name has one source`});continue}r.set(p.name,u),o.push(p)}}),{registry:A7(o.filter(s=>!i.has(s.name))),problems:n}}function I7(e,t){if(!(e.type==="integer"?typeof t=="number"&&Number.isInteger(t):typeof t===e.type))return`is ${JSON.stringify(t)}, and the field is ${e.type==="integer"?"an integer":`a ${e.type}`}`;if(e.pattern!==void 0&&typeof t=="string"){let o;try{o=new RegExp(e.pattern,"u")}catch{return}if(!o.test(t))return`is ${JSON.stringify(t)}, which does not match ${e.pattern}`}}function WNe(e){let t=[],n=(o,r)=>{if(r.pattern!==void 0)try{new RegExp(r.pattern,"u")}catch{t.push(`declares field ${o} with pattern ${r.pattern}, which is not a regular expression`);return}if(r.default===void 0)return;let i=I7(r,r.default);i&&t.push(`declares field ${o} whose default ${i}`)};for(let[o,r]of Object.entries(e))if(r.type==="object")for(let[i,s]of Object.entries(r.properties))n(`${o}.${i}`,s);else n(o,r);return t}function JF(e,t){if(e===void 0)return{fields:null,problems:[]};let n=e.fields,o=[];if(n===void 0)return t!==null&&o.push({path:"",message:`kind ${e.name} declares no fields, and the entry sets ${Object.keys(t).join(", ")||"an empty fields block"}`}),{fields:null,problems:o};let r=t??{};for(let a of Object.keys(r))a in n||o.push({path:a,message:`kind ${e.name} declares no field ${a}; its fields are ${Object.keys(n).join(", ")}`});let i=(a,c,l)=>{if(l!==void 0){let u=I7(c,l);if(!u)return l;o.push({path:a,message:`field ${a.replace("/",".")} ${u}`})}return c.default??null},s={};for(let[a,c]of Object.entries(n)){if(c.type!=="object"){s[a]=i(a,c,r[a]);continue}let l=r[a],u={};l!==void 0&&(l!==null&&typeof l=="object"&&!Array.isArray(l)?u=l:o.push({path:a,message:`field ${a} is ${JSON.stringify(l)}, and the field is an object`}));for(let d of Object.keys(u))d in c.properties||o.push({path:`${a}/${d}`,message:`kind ${e.name} declares no field ${a}.${d}; ${a} has ${Object.keys(c.properties).join(", ")}`});s[a]=Object.fromEntries(Object.entries(c.properties).map(([d,p])=>[d,i(`${a}/${d}`,p,u[d])]))}return{fields:s,problems:o}}var opt,zF,FF,QS,Ca,ANe,P7,CNe,INe,DNe,JS,li=x(()=>{"use strict";I8();zt();F8();Lu();gw();KS();opt=HL.$id,zF="./workspace-kinds",FF=["dbt-project","goose-dir","golang-migrate-dir","clickhouse-migrations-dir","flyway-dir"],QS="examples",Ca="repo",ANe="design",P7=[{name:"chant",description:"a chant project, with a chant.config.ts or chant.config.json in its directory",probe:{anyFile:["chant.config.ts","chant.config.json"]},precedence:500,shape:"member",outputs:{from:"chant-source"},source:"builtin"},{name:"workspace",description:"a nested workspace, with its own chant.workspace.json; the outer one reads it through its own chant workspace graph and never writes inside it",probe:{anyFile:["chant.workspace.json","chant.workspace.jsonc"]},precedence:1e3,shape:"member",outputs:{from:"none"},source:"builtin"},{name:Ca,description:"another repository's workspace, named by URL and pinned revision; chant reads it through that repository's own chant workspace graph and never writes there",probe:{repo:!0},precedence:0,shape:"member",outputs:{from:"none"},source:"builtin"},{name:"other",description:"a directory chant does not read; the entry says why in `because`",probe:{directory:!0},precedence:0,shape:"member",outputs:{from:"declared",names:[]},source:"builtin"},{name:ANe,description:"a data member holding the design artifacts the workspace owns; chant reads its files for record pins and builds nothing",probe:{directory:!0},precedence:0,shape:"member",outputs:{from:"declared",names:[]},source:"builtin"},{name:QS,description:"an example group: every directory its glob matches that holds a chant project is built and linted",probe:{chantProject:!0},precedence:0,shape:"group",outputs:{from:"none"},source:"builtin"}],CNe=P7.map(e=>e.name);INe=["chant.config.ts","chant.config.json"],DNe=4});function _a(e){return String(e).replace(/~/g,"~0").replace(/\//g,"~1")}function sl(e,t){let n=[0];for(let h=0;h<e.length;h++)e.charCodeAt(h)===10&&n.push(h+1);let o=h=>{let w=0,k=n.length-1;for(;w<k;){let v=w+k+1>>1;n[v]<=h?w=v:k=v-1}return{line:w+1,column:h-n[w]+1}},r=new Map,i=new Map,s=new Map,a=e.charCodeAt(0)===65279?1:0,c=(h,w=a)=>{throw new XS(h,w)},l=h=>h>=e.length?"the end of the file":`${JSON.stringify(e[h])}`;function u(){for(;;){let h=e[a];if(h===" "||h===" "||h===`
|
|
104
104
|
`||h==="\r")a++;else if(h==="/"&&(e[a+1]==="/"||e[a+1]==="*"))if(t.jsonc||c("comments are only allowed in chant.workspace.jsonc"),e[a+1]==="/")for(;a<e.length&&e[a]!==`
|
|
105
|
-
`;)a++;else{let w=e.indexOf("*/",a+2);w<0&&c("unterminated /* comment"),a=w+2}else return}}function d(){let h=a;for(a++;;){a>=e.length&&c("unterminated string",h);let w=e.charCodeAt(a);if(w===34)break;w<32&&c("control character in a string; escape it",a),a+=w===92?2:1}a++;try{return JSON.parse(e.slice(h,a))}catch{return c("invalid escape in a string",h)}}function p(h){u(),r.set(h,a);let w=f(h);return i.set(h,a),w}function f(h){let w=e[a];if(w==="{")return m(h);if(w==="[")return g(h);if(w==='"')return d();for(let[v,b]of[["true",!0],["false",!1],["null",null]])if(e.startsWith(v,a))return a+=v.length,b;let k=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(a,a+64));return k?(a+=k[0].length,Number(k[0])):c(`expected a value, found ${l(a)}`)}function m(h){let w={},k=new Set;if(a++,u(),e[a]==="}")return a++,w;for(;;){u(),e[a]!=='"'&&c(`expected a quoted key, found ${l(a)}`);let v=a,b=d();k.has(b)&&c(`duplicate key ${JSON.stringify(b)}`,v),k.add(b);let $=`${h}/${_a(b)}`;if(s.set($,v),u(),e[a]!==":"&&c(`expected ":" after key ${JSON.stringify(b)}, found ${l(a)}`),a++,Object.defineProperty(w,b,{value:p($),enumerable:!0,writable:!0,configurable:!0}),u(),e[a]===","){if(a++,u(),e[a]==="}")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,w;continue}if(e[a]==="}")return a++,w;c(`expected "," or "}", found ${l(a)}`)}}function g(h){let w=[];if(a++,u(),e[a]==="]")return a++,w;for(;;){if(w.push(p(`${h}/${w.length}`)),u(),e[a]===","){if(a++,u(),e[a]==="]")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,w;continue}if(e[a]==="]")return a++,w;c(`expected "," or "]", found ${l(a)}`)}}try{u(),a>=e.length&&c("the file is empty");let h=p("");return u(),a<e.length&&c(`unexpected ${l(a)} after the value`),{ok:!0,value:h,locate(w,k){if(k&&s.has(w))return o(s.get(w));for(let v=w;;v=v.slice(0,v.lastIndexOf("/"))){let b=r.get(v);if(b!==void 0)return o(b);if(v==="")return o(0)}},span(w){let k=r.get(w),v=i.get(w);if(!(k===void 0||v===void 0))return{key:s.get(w)??null,start:k,end:v}}}}catch(h){if(!(h instanceof XS))throw h;return{ok:!1,message:h.message,location:o(h.offset)}}}var XS,Wf=x(()=>{"use strict";XS=class extends Error{constructor(n,o){super(n);this.offset=o}}});function D7(){return"0.124.
|
|
105
|
+
`;)a++;else{let w=e.indexOf("*/",a+2);w<0&&c("unterminated /* comment"),a=w+2}else return}}function d(){let h=a;for(a++;;){a>=e.length&&c("unterminated string",h);let w=e.charCodeAt(a);if(w===34)break;w<32&&c("control character in a string; escape it",a),a+=w===92?2:1}a++;try{return JSON.parse(e.slice(h,a))}catch{return c("invalid escape in a string",h)}}function p(h){u(),r.set(h,a);let w=f(h);return i.set(h,a),w}function f(h){let w=e[a];if(w==="{")return m(h);if(w==="[")return g(h);if(w==='"')return d();for(let[v,b]of[["true",!0],["false",!1],["null",null]])if(e.startsWith(v,a))return a+=v.length,b;let k=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(a,a+64));return k?(a+=k[0].length,Number(k[0])):c(`expected a value, found ${l(a)}`)}function m(h){let w={},k=new Set;if(a++,u(),e[a]==="}")return a++,w;for(;;){u(),e[a]!=='"'&&c(`expected a quoted key, found ${l(a)}`);let v=a,b=d();k.has(b)&&c(`duplicate key ${JSON.stringify(b)}`,v),k.add(b);let $=`${h}/${_a(b)}`;if(s.set($,v),u(),e[a]!==":"&&c(`expected ":" after key ${JSON.stringify(b)}, found ${l(a)}`),a++,Object.defineProperty(w,b,{value:p($),enumerable:!0,writable:!0,configurable:!0}),u(),e[a]===","){if(a++,u(),e[a]==="}")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,w;continue}if(e[a]==="}")return a++,w;c(`expected "," or "}", found ${l(a)}`)}}function g(h){let w=[];if(a++,u(),e[a]==="]")return a++,w;for(;;){if(w.push(p(`${h}/${w.length}`)),u(),e[a]===","){if(a++,u(),e[a]==="]")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,w;continue}if(e[a]==="]")return a++,w;c(`expected "," or "]", found ${l(a)}`)}}try{u(),a>=e.length&&c("the file is empty");let h=p("");return u(),a<e.length&&c(`unexpected ${l(a)} after the value`),{ok:!0,value:h,locate(w,k){if(k&&s.has(w))return o(s.get(w));for(let v=w;;v=v.slice(0,v.lastIndexOf("/"))){let b=r.get(v);if(b!==void 0)return o(b);if(v==="")return o(0)}},span(w){let k=r.get(w),v=i.get(w);if(!(k===void 0||v===void 0))return{key:s.get(w)??null,start:k,end:v}}}}catch(h){if(!(h instanceof XS))throw h;return{ok:!1,message:h.message,location:o(h.offset)}}}var XS,Wf=x(()=>{"use strict";XS=class extends Error{constructor(n,o){super(n);this.offset=o}}});function D7(){return"0.124.76"}var N7=x(()=>{"use strict"});function Bf(e=process.env){let t=e.CI?.trim().toLowerCase();return t&&t!=="false"&&t!=="0"?"ledger":void 0}function eE(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Zu(e,t=!1){let n=[];t&&n.push("a gate that asks a decision point takes its quorum from the point: give `approval` or `point`, not both");let o=typeof e=="string"?{name:e}:e;if(o===null||typeof o!="object"||Array.isArray(o))return[...n,"`point` is a decision point's name or { name, inputs?, pass?, store? }"];let{name:r,inputs:i,pass:s,store:a,...c}=o;if((typeof r!="string"||!BNe.test(r))&&n.push("`point.name` is a decision point's name: lower case letters, digits and hyphens, starting with a letter"),i!==void 0&&(i===null||typeof i!="object"||Array.isArray(i))&&n.push("`point.inputs` is an object of input name to value"),i&&typeof i=="object"){let u=Object.keys(i).filter(d=>d in bw);u.length>0&&n.push(`\`point.inputs\` gives ${u.join(", ")}, which the gate passes itself`)}s!==void 0&&(!Array.isArray(s)||s.length===0||s.some(u=>typeof u!="string"&&typeof u!="boolean"))&&n.push("`point.pass` is a non-empty list of the answers that pass the gate"),a!==void 0&&a!=="tree"&&a!=="ledger"&&n.push("`point.store` is tree or ledger: where the question is held");let l=Object.keys(c);return l.length>0&&n.push(`\`point\` takes name, inputs, pass and store, not ${l.join(", ")}`),n}function Yu(e,t,n,o={}){if(n.planDigest!==null&&!t.includes("gate.planDigest"))throw new Error(`gate "${n.name}" binds a plan and asks decision point ${e}, which does not declare the input gate.planDigest: declare it in the points file, so each plan is its own question and an answer for one plan never passes another`);let r={};for(let[i,s]of Object.entries(bw))t.includes(i)&&n[s]!==null&&(r[i]=n[s]);return{...o,...r}}function vw(e,t,n){return`gate:${e}/${t}${n?`@${n}`:""}`}function tE(e){if(!e||!e.startsWith("gate:"))return;let t=e.slice(5),n=t.lastIndexOf("@"),o=n>0?t.slice(0,n):t,r=o.indexOf("/");if(!(r<=0||r===o.length-1))return{op:o.slice(0,r),gate:o.slice(r+1),...n>0?{env:t.slice(n+1)}:{}}}var Uf,BNe,bw,Ta=x(()=>{"use strict";Uf=[!0];BNe=/^[a-z][a-z0-9-]*$/;bw={"gate.component":"component","gate.name":"name","gate.env":"env","gate.planDigest":"planDigest"}});function ui(e){return e===void 0?[]:Array.isArray(e)?[...e]:[e]}function ZF(e,t){let n=e.replace(/\\/g,"/").replace(/\/+$/,""),o="";for(let r=0;r<n.length;r++){let i=n[r];i==="*"&&n[r+1]==="*"?n[r+2]==="/"?(o+="(?:.*/)?",r+=2):(o+=".*",r+=1):i==="*"?o+="[^/]*":i==="?"?o+="[^/]":o+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${o}$`).test(t.replace(/\\/g,"/").replace(/\/+$/,""))}function zf(e,t){return e.filter(n=>n.targets===void 0||n.targets.some(o=>t.some(r=>ZF(o,r))))}function Rw(e){return e.reduce((t,n)=>Math.max(t,n.count),1)}function di(e,t,n){let o=Array.isArray(e)?e:[e],r=[];return Array.isArray(e)&&e.length===0&&r.push(`\`${t}\` must name at least one rule`),o.forEach((i,s)=>{let a=Array.isArray(e)?`${t}[${s}]`:t;if(typeof i!="object"||i===null||Array.isArray(i)){r.push(`\`${a}\` must be an object`);return}let c=i;(typeof c.count!="number"||!Number.isInteger(c.count)||c.count<1)&&r.push(`\`${a}.count\` must be an integer of at least 1`),c.roles!==void 0&&(!Array.isArray(c.roles)||c.roles.length===0||c.roles.some(u=>typeof u!="string"||u===""))&&r.push(`\`${a}.roles\` must be a non-empty list of role names`),c.targets!==void 0&&(!Array.isArray(c.targets)||c.targets.length===0||c.targets.some(u=>typeof u!="string"||u===""))&&r.push(`\`${a}.targets\` must be a non-empty list of globs`),c.notAuthor!==void 0&&typeof c.notAuthor!="boolean"&&r.push(`\`${a}.notAuthor\` must be true or false`),c.notAuthor===!0&&!n.notAuthor&&r.push(`\`${a}.notAuthor\` is not read here: an Op gate has no author to judge by. An Op waves spec's \`approvals.quorum\` reads it from the merged pull request`);let l=new Set(["targets","count","roles","notAuthor"]);for(let u of Object.keys(c))l.has(u)||r.push(`\`${a}.${u}\` is not a quorum field; use targets, count, roles or notAuthor`)}),r}function rE(e,t){return Object.entries(t).filter(([,n])=>n.some(o=>Lo(o,e))).map(([n])=>n).sort()}function xw(e,t){let n=new Set,o=[];for(let s of[...t].sort((a,c)=>Date.parse(a.at)-Date.parse(c.at)))n.has(nE(s.who))||s.judged.excluded!==void 0||e.roles?.length&&!(s.judged.proven&&s.judged.roles.some(a=>e.roles.includes(a)))||(n.add(nE(s.who)),o.push(s));let r=!e.notAuthor||o.some(s=>s.judged.proven&&s.judged.author===!1),i=e.notAuthor===!0&&!r&&o.some(s=>s.judged.proven&&s.judged.author===void 0);return{...e.targets?{targets:[...e.targets]}:{},count:e.count,...e.roles?.length?{roles:[...e.roles]}:{},...e.notAuthor?{notAuthor:!0}:{},approvers:o.map(s=>s.who),met:o.length>=e.count&&r,...i?{authorUnknown:!0}:{}}}function al(e){let t=e.targets?e.targets.join(", "):"every target",n=`${e.approvers.length} of ${e.count} approval${e.count===1?"":"s"}${e.approvers.length?` (${e.approvers.join(", ")})`:""}`;if(e.met)return`${t}: ${n}, met`;let o=e.count-e.approvers.length,r=[];o>0&&r.push(`${o} more${e.roles?.length?` from ${e.roles.join(" or ")}`:""}`),e.notAuthor&&r.push(o>0?"one of them not the author":"an approver who is not the author");let i=e.authorUnknown?" (the change's author is not known, so no approver can show they are someone else)":"";return`${t}: ${n}, needs ${r.join(", ")}${i}`}function $w(e){return e.filter(t=>!t.met).map(al).join("; ")}function oE(e){let t=[];for(let n of e.replace(/\r\n/g,`
|
|
106
106
|
`).split(`
|
|
107
107
|
`)){let o=/^requested-by:\s*(\S+)\s*$/i.exec(n.trim());o&&UNe.test(o[1])&&!t.some(r=>Lo(r,o[1]))&&t.push(o[1])}return t}function kw(e){let t=/^(?:github|gitlab|forgejo|gitea|codeberg)(?:@[^:\s]+)?:(.+)$/i.exec(e.trim());return t?[e,t[1]]:[e]}function iE(e,t){let n=kw(t);return e.find(o=>kw(o.who).some(r=>n.some(i=>Lo(r,i))))?.why}function Sw(e){let t=[],n=(o,r)=>{o.trim()&&!t.some(i=>Lo(i.who,o))&&t.push({who:o,why:r})};e.author&&n(e.author,`${e.author} opened the change`);for(let o of e.commits??[])for(let r of oE(o.message))n(e.principal?e.principal(r):r,`${r} asked for ${o.sha.slice(0,7)}`);for(let o of e.agents??[])n(o,`${o} is an account an agent acts as`);return t}function sE(e){let t=e;return t.via!=="pr-review"||typeof t.head!="string"||t.head===""||!Array.isArray(t.reviewers)||t.reviewers.length===0||t.reviewers.some(n=>typeof n!="string"||n==="")?null:{...typeof t.pr=="number"?{pr:t.pr}:{},head:t.head,reviewers:[...t.reviewers]}}function Ew(e,t=n=>n){let n=[],o=[];for(let r of e){let i=sE(r);if(!i){n.push(r);continue}let s=i.reviewers.map(t);o.push({head:i.head,approvers:s});let{seal:a,...c}=r,l=Object.fromEntries(Object.entries(c).filter(([u])=>!["via","reviewers","head","pr","excluded"].includes(u)));for(let u of s)n.push({...l,resolvedBy:u,approver:{kind:"human"},review:{pr:i.pr??0,head:i.head,approvers:s}})}return{records:n,reviews:o}}function pi(e){let t=(n,o)=>n.some(r=>Lo(r,o));return n=>{let o=n.seal!==void 0&&n.seal!==null&&Ps(e.signers,n)===null,r=e.review!==void 0&&n.review?.head===e.review.head&&t(e.review.approvers,n.resolvedBy),i=n.review!==void 0&&(e.recorded??[]).some(l=>l.head===n.review.head&&t(l.approvers,n.resolvedBy)),s=o||r||i,c=e.authors!==void 0&&e.authors.some(l=>Lo(l,n.resolvedBy))?`${n.resolvedBy} wrote the change`:iE(e.involved??[],n.resolvedBy);return{proven:s,roles:s?rE(n.resolvedBy,e.roles):[],...c!==void 0?{author:!0}:e.authors!==void 0?{author:!1}:{},...c!==void 0&&e.excludeInvolved?{excluded:`${c}, so ${n.resolvedBy}'s approval does not count`}:{}}}}var Ia,nE,Lo,Da,UNe,Mo=x(()=>{"use strict";Hi();Ia=()=>({proven:!1,roles:[]});nE=e=>e.normalize("NFKC").trim().toLowerCase(),Lo=(e,t)=>nE(e)===nE(t);Da=e=>(e.roles?.length??0)>0||e.notAuthor===!0,UNe=/^[A-Za-z0-9][A-Za-z0-9._-]*(\[bot\])?$/});function YF(e,t,n){return(e??aE).replaceAll("{gate}",t).replaceAll("{k}",String(n))}function QF(e,t,n,o){let r=[...e].sort((l,u)=>{let d=o(l),p=o(u);return d<p?-1:d>p?1:0}),i=Math.floor(r.length/n),s=r.length%n,a=(t-1)*i+Math.min(t-1,s),c=i+(t<=s?1:0);return r.slice(a,a+c)}var aE,XF=x(()=>{"use strict";aE="{gate}-wave-{k}"});var G7={};Re(G7,{WAVE_OUTCOME_VERSION:()=>cE,blockedMembers:()=>lE,blockedWords:()=>uE,earlierWaveOutcomes:()=>nG,onlyWaiting:()=>ZNe,passesThrough:()=>Hf,readWaveOutcomeFile:()=>rG,runSummary:()=>YNe,settleEarlierWaves:()=>JNe,waveOutcomeFileName:()=>qf,writeWaveOutcomeFile:()=>tG});import{existsSync as zNe,readdirSync as HNe,readFileSync as j7,statSync as qNe,writeFileSync as VNe}from"node:fs";import{basename as KNe,join as L7}from"node:path";function Hf(e){return e!==void 0&&eG.has(e.status)}function lE(e,t,n,o,r){if(r!==void 0)return new Map(e.map(s=>[s,`wave-${r}`]));let i=new Map;for(let s of e){let a=[...t.get(s)??[]].filter(c=>n.has(c)).sort().map(c=>{let l=o.get(c);if(!Hf(l))return l?.status==="blocked"&&l.by?l.by:c}).find(c=>c!==void 0);a!==void 0&&i.set(s,a)}return i}function JNe(e,t,n,o){let r=new Map(o),i=[],s=new Set;for(let a=1;a<t&&a<=e.length;a++){let c=e[a-1],l=c.filter(d=>!r.has(d)),u=lE(l,n,s,r);for(let d of l){let p=u.get(d);p!==void 0?r.set(d,{status:"blocked",by:p}):i.push(d)}for(let d of c)s.add(d)}return{outcomes:r,unsettled:i}}function ZNe(e){let t=!1;for(let n of e.values())if(!eG.has(n.status)&&(t=!0,n.status!=="waiting"&&!(n.status==="blocked"&&n.by!==void 0&&e.get(n.by)?.status==="waiting")))return!1;return t}function uE(e){let t=new Map;for(let[n,o]of[...e].sort(M7))t.set(o,[...t.get(o)??[],n]);return[...t].map(([n,o])=>`${o.join(", ")} (blocked by ${n})`).join("; ")}function YNe(e){let t=new Map;for(let o of e)t.set(o.status,(t.get(o.status)??0)+1);if(![...t.keys()].some(o=>!eG.has(o)))return;let n=[`${t.get("applied")??0} applied`,`${t.get("failed")??0} failed`,`${t.get("blocked")??0} blocked`];for(let o of["waiting","refused","decided","not-applied"])t.get(o)&&n.push(`${t.get(o)} ${o==="decided"?"not reported by their share":o}`);return t.get("unchanged")&&n.push(`${t.get("unchanged")} unchanged`),n.join(", ")}function qf(e,t={}){let n=t.group!==void 0?`-group-${t.group.replace(/[^A-Za-z0-9._-]/g,"_")}`:"",o=t.share!==void 0?`-share-${t.share}`:"";return`outcome-wave-${e}${n}${o}.json`}function tG(e,t,n,o,r=new Date().toISOString(),i=!1){let s=L7(e,qf(t,n)),a={version:cE,wave:t,at:r,members:Object.fromEntries(Object.entries(o).sort(M7)),...i?{holds_all:!0}:{}};return VNe(s,JSON.stringify(a,null,2)+`
|
|
108
108
|
`),s}function F7(e){let t=[],n=(o,r)=>{let i;try{i=HNe(o)}catch{return}for(let s of i){let a=L7(o,s),c=!1;try{c=qNe(a).isDirectory()}catch{continue}c?r<4&&n(a,r+1):/^outcome-wave-\d+.*\.json$/.test(s)&&t.push(a)}};for(let o of e)zNe(o)&&n(o,0);return t.sort()}function nG(e,t){let n=new Map,o=new Map;for(let i of F7(e)){let s;try{s=JSON.parse(j7(i,"utf-8"))}catch{continue}let a=s?.members??s?.roots;if(s?.version!==cE||!Number.isInteger(s.wave)||s.wave>=t||typeof s.at!="string"||typeof a!="object"||a===null)continue;for(let[l,u]of Object.entries(a)){let d=n.get(l);d&&(d.at>s.at||d.at===s.at&&u.status==="decided"&&d.status!=="decided")||n.set(l,{...u,wave:s.wave,at:s.at})}let c=o.get(s.wave);(!c||c.at<=s.at)&&o.set(s.wave,{at:s.at,holdsAll:s.holds_all===!0})}let r=[...o].filter(([,i])=>i.holdsAll).map(([i])=>i).sort((i,s)=>i-s);return{members:n,...r.length?{holdsAll:r[0]}:{}}}function rG(e,t){let n;for(let o of F7(e)){if(KNe(o)!==t)continue;let r;try{r=JSON.parse(j7(o,"utf-8"))}catch{continue}r?.version!==cE||typeof r.at!="string"||typeof r.members!="object"||r.members===null||(!n||n.at<=r.at)&&(n=r)}return n}var cE,eG,M7,Ow=x(()=>{"use strict";cE=1,eG=new Set(["applied","unchanged"]);M7=([e],[t])=>e<t?-1:e>t?1:0});function fE(e){let t=e.step;if(t===void 0)return[];if(t===null||typeof t!="object"||Array.isArray(t))return['`step` must be { "kind": "<capability>", ...input }'];let n=[],o=t.kind;(typeof o!="string"||o.trim()==="")&&n.push('`step.kind` must name a capability, such as "terraform-apply"');for(let r of["plan","apply","planWave","applyWave"])e[r]!==void 0&&n.push(`\`step\` and \`${r}\` are both set; a wave plans and applies through its capability or through commands, so give one`);e.hooks?.apply?.runBy==="apply"&&n.push('`hooks.apply.runBy: "apply"` hands the apply-stage hooks to an apply command, and a `step` has none; leave runBy as chant');for(let r of e.waves){r.discover&&n.push(`wave "${r.name}" discovers its runs, which only \`planWave\` can report; a \`step\` plans the runs the spec lists`),r.hooks?.apply?.runBy==="apply"&&n.push(`wave "${r.name}" hands its apply-stage hooks to an apply command, and a \`step\` has none`);for(let i of r.runs??[]){let s=i.input;s!==void 0&&(s===null||typeof s!="object"||Array.isArray(s))&&n.push(`wave "${r.name}" run "${i.target}": \`input\` must be an object laid over the step's input`),s&&typeof s=="object"&&"kind"in s&&n.push(`wave "${r.name}" run "${i.target}": \`input\` cannot change the step's kind`)}}return n}function W7(e){let t=[];for(let[n,o]of[["parallelism",e.parallelism],...e.waves.map(r=>[`wave "${r.name}" parallelism`,r.parallelism])])o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<1?t.push(`${n} is ${JSON.stringify(o)}; give a whole number of 1 or more, the most that run at once`):o>1&&e.step===void 0&&t.push(`${n} is ${o}, and runs apply at once only through \`step\`; drop it or give step`));return t}function Vf(e){if(e===void 0)return[];if(e===null||typeof e!="object"||Array.isArray(e))return['`holds` must be { "policy"?: true, "cost"?: {...} }'];let t=[];for(let[n,o]of Object.entries(e))n==="policy"?typeof o!="boolean"&&t.push("`holds.policy` must be true or false"):n==="cost"?t.push(...QNe(o)):t.push(`\`holds.${n}\` is not a setting; the ones there are holds.policy and holds.cost`);return t}function QNe(e){if(e===null||typeof e!="object"||Array.isArray(e))return['`holds.cost` must be { "command": [...], "approveAbove": <number>, "format"?, "currency"? }'];let t=e,n=[];(!Array.isArray(t.command)||t.command.length===0||!t.command.every(o=>typeof o=="string"&&o!==""))&&n.push("`holds.cost.command` must be argv, a non-empty list of strings"),(typeof t.approveAbove!="number"||!Number.isFinite(t.approveAbove)||t.approveAbove<0)&&n.push("`holds.cost.approveAbove` must be a monthly amount of 0 or more"),t.format!==void 0&&!dE.includes(t.format)&&n.push(`\`holds.cost.format\` must be ${dE.join(" or ")}`),t.currency!==void 0&&(typeof t.currency!="string"||!/^[A-Z]{3}$/.test(t.currency))&&n.push('`holds.cost.currency` must be a three-letter currency code, such as "USD"');for(let o of Object.keys(t))["command","approveAbove","format","currency"].includes(o)||n.push(`\`holds.cost.${o}\` is not a setting`);return n}function mE(e,t){let n=e?.policy===!0||t?.policy===!0,o=e!==void 0?e.cost:t?.cost;if(!(!n&&!o))return{...n?{policy:!0}:{},...o?{cost:o}:{}}}var dE,pE,gE=x(()=>{"use strict";dE=["infracost","chant"],pE="(monthly cost)"});function oG(e){let t=[],n=(o,r,i)=>{if(o!==void 0&&!(o===!1&&i)){if(o===null||typeof o!="object"||Array.isArray(o)){t.push(`${r} must be { "env"?: "<env>", "component"?: "<name>" }${i?" or false":""}`);return}for(let[s,a]of Object.entries(o))s!=="env"&&s!=="component"?t.push(`${r} has an unknown key "${s}"; it takes env and component`):(typeof a!="string"||a.trim()==="")&&t.push(`${r}.${s} must be a non-empty string`)}};n(e.release,"`release`",!0);for(let o of e.waves)for(let r of o.runs??[])n(r.release,`wave "${o.name}" run "${r.target}": \`release\``,!1);return t}function B7(e,t){return e.replaceAll("{target}",t.target).replaceAll("{op}",t.op).replaceAll("{wave}",t.wave)}function iG(e,t,n){if(!e.step||e.release===!1)return null;let o={target:n.target,op:n.op??e.op,wave:t.name},r=e.release??{},i=n.release?.env??r.env,s=n.release?.component??r.component;return{env:i!==void 0?B7(i,o):e.labels?.Env??t.name,component:s!==void 0?B7(s,o):n.target}}function sG(e,t,n,o){let r=new Map;for(let a of t){let c=r.get(a.releaseDigest);(c===void 0||a.timestamp>c)&&r.set(a.releaseDigest,a.timestamp)}let s=e.filter(a=>a.commit===n.commit).map(a=>({r:a,digest:o(a,n.env,n.component)})).filter(a=>a.digest!==null).sort((a,c)=>(r.get(c.r.releaseDigest)??"").localeCompare(r.get(a.r.releaseDigest)??"")||a.r.releaseDigest.localeCompare(c.r.releaseDigest))[0];return s?{releaseDigest:s.r.releaseDigest,templatesDigest:s.digest}:null}var Pw=x(()=>{"use strict"});function Tw(e){let n=e.replace(/^https?:\/\//,"").replace(/\.git$/,"").replace(/\/+$/,"").split("/");if(n.length<3||n.some(i=>i===""))throw new Cw(`project key "${e}" must be <host>/<owner>/<name>, such as github.com/acme/infra`);let[o,...r]=n;return{key:e,host:o,path:r.join("/"),owner:r.slice(0,-1).join("/"),name:r[r.length-1]}}function q7(e){let t=e.toLowerCase().replace(/:\d+$/,"");if(t==="github.com"||t.startsWith("github."))return"github";if(t==="gitlab.com"||t.startsWith("gitlab.")||t.includes(".gitlab."))return"gitlab";if(t==="codeberg.org"||t.startsWith("forgejo.")||t.startsWith("gitea.")||t.includes("forgejo"))return"forgejo"}function tje(e,t){let n=t.toLowerCase();return e==="github"?n==="github.com"?"https://api.github.com":`https://${t}/api/v3`:e==="gitlab"?`https://${t}/api/v4`:`https://${t}/api/v1`}function uG(e,t="control"){if(typeof e!="object"||e===null||Array.isArray(e))return[`${t} must be a mapping with repo and op`];let n=e,o=[],r;if(typeof n.repo!="string")o.push(`${t}.repo must name the control repo, such as github.com/acme/control`);else try{r=Tw(n.repo).host}catch(i){o.push(`${t}.repo: ${i.message}`)}return typeof n.op=="string"&&Aw.test(n.op)||o.push(`${t}.op must name the Op the control repo runs on this repo's dependents, such as deploy`),n.forge!==void 0&&!z7.includes(n.forge)&&o.push(`${t}.forge must be one of ${z7.join(", ")}`),r!==void 0&&n.forge===void 0&&!q7(r)&&o.push(`${t}.forge is needed: ${n.repo}'s host does not say which forge it is`),n.member!==void 0&&!(typeof n.member=="string"&&Aw.test(n.member))&&o.push(`${t}.member must be this repo's name in the control repo's workspace`),n.tokenSecret!==void 0&&!(typeof n.tokenSecret=="string"&&U7.test(n.tokenSecret))&&o.push(`${t}.tokenSecret must name the secret holding the dispatch token, such as ${aG}`),n.readTokenSecret!==void 0&&!(typeof n.readTokenSecret=="string"&&U7.test(n.readTokenSecret))?o.push(`${t}.readTokenSecret must name the secret holding a read-only token for the control repo, such as ${H7}`):typeof n.readTokenSecret=="string"&&n.readTokenSecret===(n.tokenSecret??aG)&&o.push(`${t}.readTokenSecret must not be the dispatch token's secret (${n.readTokenSecret}): the plan job runs the change's code`),n.ref!==void 0&&!(typeof n.ref=="string"&&XNe.test(n.ref))&&o.push(`${t}.ref must be a branch name`),n.apiBase!==void 0&&!(typeof n.apiBase=="string"&&/^https?:\/\/[^\s'"]+$/.test(n.apiBase))&&o.push(`${t}.apiBase must be an http(s) URL`),o}function V7(e,t){let n=uG(e);if(n.length>0)throw new Cw(n.join("; "),n);let o=Tw(e.repo),r=e.forge??q7(o.host),i=e.member??t;if(!Aw.test(i))throw new Cw(`control.member: "${i}" is not a name the control repo's workspace can hold; set control.member`);return{repo:e.repo,host:o.host,path:o.path,forge:r,apiBase:(e.apiBase??tje(r,o.host)).replace(/\/+$/,""),op:e.op,member:i,ref:e.ref??eje,tokenSecret:e.tokenSecret??aG,readTokenSecret:e.readTokenSecret??H7}}var Aw,XNe,U7,aG,H7,cG,_w,lG,eje,Cw,z7,K7,Iw=x(()=>{"use strict";ri();Aw=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/,XNe=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/,U7=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/,aG="CHANT_CONTROL_TOKEN",H7="CHANT_CONTROL_READ_TOKEN",cG="CHANT_CONTROL_OUTCOME",_w=["applied","partial","unchanged","waiting","failed"],lG=["applied","partial"],eje="main",Cw=class extends Error{constructor(n,o=[n]){super(n);this.problems=o;this.name="ControlConfigError"}};z7=["github","gitlab","forgejo"];K7="control-dispatch"});var ree={};Re(ree,{CHECK_HOOK_MOMENT:()=>nje,CI_CHECK_HOOK_FLOOR:()=>rje,GATE_APPROVAL_SOURCES:()=>Na,OP_LEDGER_NAME:()=>Qf,OP_WAVES_APPROVAL_STATUS_VAR:()=>pje,OP_WAVES_CONTROL_FLOOR:()=>oje,OP_WAVES_CONTROL_JOB:()=>ije,OP_WAVES_DIGEST_OVER:()=>Q7,OP_WAVE_APPLY_HOOKS_RUNNERS:()=>hE,OP_WAVE_DEFAULT_APPLY:()=>bE,OP_WAVE_DEFAULT_GATE_NAME:()=>fG,OP_WAVE_GATE_POLICIES:()=>Zf,OP_WAVE_HOOK_FAILURES:()=>Yf,OP_WAVE_HOOK_MOMENTS:()=>Nw,OP_WAVE_JOB_TIMEOUT_MINUTES:()=>Y7,PR_LOOP_HOOK_MOMENTS:()=>eee,assertCheckHooks:()=>tee,assertOpWaveCloud:()=>mG,assertOpWaveHooks:()=>ja,assertOpWavesSpec:()=>Xu,assertPrLoopHooks:()=>$E,notifyVariables:()=>n8,opWaveApplyHooksRunBy:()=>Mw,opWaveBinArgv:()=>Xf,opWaveGateName:()=>jw,opWaveGroupOf:()=>bje,opWaveGroupRuns:()=>RE,opWaveGroupsProblem:()=>xE,opWaveHookRuns:()=>tm,opWaveHooksAt:()=>Lw,opWaveJobTimeout:()=>lje,opWaveJobs:()=>nee,opWaveOf:()=>vje,opWaveOutcomeDir:()=>vE,opWaveOutcomePath:()=>Kf,opWavePointAt:()=>yE,opWavePointOf:()=>J7,opWavePointProblems:()=>Dw,opWaveRecordPath:()=>em,opWaveRunMatches:()=>kE,opWaveShare:()=>Fw,opWavesApprovalStatusCommand:()=>mje,opWavesControlProblems:()=>Z7,opWavesControlTarget:()=>sje,opWavesInvolvedProblems:()=>wE,opWavesLastJobs:()=>cje,opWavesOutcomeCommand:()=>aje,opWavesPostsApprovalStatus:()=>fje,opWavesRecordPlansCommand:()=>dje,opWavesResumeCommand:()=>uje,waveApproveTarget:()=>Qu});function J7(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Dw(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"timeout"in e){let{timeout:t,...n}=e,o=Zu(n);return(typeof t!="string"||!/^(\d+(ms|s|m|h|d))+$/.test(t))&&o.push('`point.timeout` is a duration such as "48h"'),o}return Zu(e)}function yE(e,t){let n=e.waves.find(o=>o.name===t);return J7(n?.point??e.point)}function Qu(e,t){return t.length===1?t[0]:e}function Z7(e){let t=uG(e,"control");if(t.length>0)return t;let n=e,o=[];typeof n.member=="string"&&Aw.test(n.member)||o.push("control.member must name this repo in the control repo's workspace: an Op waves spec has no repository name to default it to");for(let r of["sentCheck","markSent"])n[r]!==void 0&&!(typeof n[r]=="string"&&n[r]!==""&&!n[r].includes(`
|
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** #4657: a cut with --at builds the images in the commit's own checkout; the archives are put back where release.images names them. */
|
|
2
|
+
import { describe, expect, test } from "vitest";
|
|
3
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { copyImageArchives } from "./release";
|
|
7
|
+
|
|
8
|
+
describe("copyImageArchives", () => {
|
|
9
|
+
test("a tar archive and a layout directory land at the same paths in the caller's directory; a missing one is skipped", () => {
|
|
10
|
+
const from = mkdtempSync(join(tmpdir(), "chant-cut-from-"));
|
|
11
|
+
const to = mkdtempSync(join(tmpdir(), "chant-cut-to-"));
|
|
12
|
+
mkdirSync(join(from, "dist/images"), { recursive: true });
|
|
13
|
+
writeFileSync(join(from, "dist/images/tofu.tar"), "tar bytes");
|
|
14
|
+
mkdirSync(join(from, "out/layout/blobs/sha256"), { recursive: true });
|
|
15
|
+
writeFileSync(join(from, "out/layout/index.json"), "{}");
|
|
16
|
+
copyImageArchives([{ archive: "dist/images/tofu.tar" }, { archive: "out/layout" }, { archive: "dist/images/none.tar" }], from, to);
|
|
17
|
+
expect(readFileSync(join(to, "dist/images/tofu.tar"), "utf8")).toBe("tar bytes");
|
|
18
|
+
expect(readFileSync(join(to, "out/layout/index.json"), "utf8")).toBe("{}");
|
|
19
|
+
expect(existsSync(join(to, "dist/images/none.tar"))).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
44
|
import { execFileSync } from "node:child_process";
|
|
45
|
-
import { existsSync } from "node:fs";
|
|
45
|
+
import { cpSync, existsSync, mkdirSync } from "node:fs";
|
|
46
46
|
import { tmpdir } from "node:os";
|
|
47
|
-
import { join, relative, resolve } from "node:path";
|
|
47
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
48
48
|
import { formatBold, formatError, formatSuccess, formatWarning } from "../format";
|
|
49
49
|
import { parseParamFlags } from "../build-params-cli";
|
|
50
50
|
import type { CommandContext } from "../registry";
|
|
@@ -120,6 +120,17 @@ async function releaseImagesOf(cwd: string): Promise<Array<{ name: string; build
|
|
|
120
120
|
return (await loadChantConfig(cwd)).config.release?.images ?? [];
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/** Copy each `release.images` archive from the directory the cut built it in to the same path under `to`. */
|
|
124
|
+
export function copyImageArchives(images: ReadonlyArray<{ archive: string }>, from: string, to: string): void {
|
|
125
|
+
for (const i of images) {
|
|
126
|
+
const src = resolve(from, i.archive);
|
|
127
|
+
if (!existsSync(src)) continue;
|
|
128
|
+
const dest = resolve(to, i.archive);
|
|
129
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
130
|
+
cpSync(src, dest, { recursive: true, force: true });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
123
134
|
/** A commit's time in seconds, the `SOURCE_DATE_EPOCH` a release's image builds run with (#4657). */
|
|
124
135
|
function commitTime(cwd: string, commit: string): number {
|
|
125
136
|
return Number(execFileSync("git", ["show", "-s", "--format=%ct", commit], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim());
|
|
@@ -459,6 +470,10 @@ export async function runReleaseCut(ctx: CommandContext): Promise<number> {
|
|
|
459
470
|
}
|
|
460
471
|
|
|
461
472
|
const result = await cutRelease(request);
|
|
473
|
+
// #4657: under --at the images were built in the commit's own checkout, which is removed below; the archives the
|
|
474
|
+
// release records are put where release.images names them here, so the job's next step (the hand-off to the
|
|
475
|
+
// publish job) finds them.
|
|
476
|
+
if (checkout && declaredImages.length > 0) copyImageArchives(declaredImages, cutCwd, cwd);
|
|
462
477
|
const push = await pushLifecycleReport({ cwd }).catch(() => ({ pushed: false, pushWarning: undefined }));
|
|
463
478
|
// The tag names the release's label, which a re-cut with no label reads from the earlier cut.
|
|
464
479
|
let tagged: { name: string; created: boolean } | null = null;
|