@intentius/chant 0.124.43 → 0.124.44

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.
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- // @intentius/chant 0.124.43 wave-job runtime (#3896): run wave, run resume, approve, workspace points.
2
+ // @intentius/chant 0.124.44 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 Coe=Object.create;var cE=Object.defineProperty;var _oe=Object.getOwnPropertyDescriptor;var Toe=Object.getOwnPropertyNames;var Ioe=Object.getPrototypeOf,Doe=Object.prototype.hasOwnProperty;var v=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(i){throw n=[i],i}};var ae=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Te=(e,t)=>{for(var n in t)cE(e,n,{get:t[n],enumerable:!0})},joe=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Toe(t))!Doe.call(e,r)&&r!==n&&cE(e,r,{get:()=>t[r],enumerable:!(i=_oe(t,r))||i.enumerable});return e};var Je=(e,t,n)=>(n=e!=null?Coe(Ioe(e)):{},joe(t||!e||!e.__esModule?cE(n,"default",{value:e,enumerable:!0}):n,e));function MW(e,t=new Set){let n=[];for(let i of e)if(i.startsWith("--")&&i.includes("=")){let r=i.indexOf("="),o=i.slice(0,r),s=i.slice(r+1);if(t.has(o))throw new Error(`${i} \u2014 ${o} is a boolean flag and does not take a value. Pass ${o} on its own.`);n.push(o,s)}else n.push(i);return n}var lE,uE=v(()=>{"use strict";lE=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 Moe(){return!process.env.NO_COLOR&&process.stdout.isTTY!==!1}function ca(e,t){return Moe()?`${t}${e}${hs.reset}`:e}function ve(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(ca(n,hs.cyan)),t.push(" - ")}return t.push(ca("error",hs.red)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
6
6
  `),t.push(ca(e.hint,hs.gray))),t.join("")}function ai(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(ca(n,hs.cyan)),t.push(" - ")}return t.push(ca("warning",hs.yellow)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
7
- `),t.push(ca(e.hint,hs.gray))),t.join("")}function Mf(e){return ca(e,hs.green)}function Xn(e){return ca(e,hs.gray)}var hs,ur=v(()=>{"use strict";hs={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var _w,pE=v(()=>{"use strict";_w="0.124.43"});function F(e,t,n){function i(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 o extends r{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let l=n?.Parent?new o:this;i(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:i}),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 sn(e){return e&&Object.assign(Ff,e),Ff}var fE,Tw,Gi,la,Ff,Tu=v(()=>{fE=Object.freeze({status:"aborted"});Tw=Symbol("zod_brand"),Gi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},la=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Ff={}});var me={};Te(me,{BIGINT_FORMAT_RANGES:()=>$E,Class:()=>gE,NUMBER_FORMAT_RANGES:()=>xE,aborted:()=>fa,allowsEval:()=>wE,assert:()=>zoe,assertEqual:()=>Goe,assertIs:()=>Boe,assertNever:()=>Uoe,assertNotEqual:()=>Woe,assignProp:()=>da,base64ToUint8Array:()=>HW,base64urlToUint8Array:()=>ase,cached:()=>Du,captureStackTrace:()=>Dw,cleanEnum:()=>sse,cleanRegex:()=>Bf,clone:()=>dr,cloneDef:()=>qoe,createTransparentProxy:()=>Qoe,defineLazy:()=>st,esc:()=>Iw,escapeRegex:()=>ci,extend:()=>tse,finalizeIssue:()=>Or,floatSafeRemainder:()=>hE,getElementAtPath:()=>Voe,getEnumValues:()=>Wf,getLengthableOrigin:()=>Hf,getParsedType:()=>Yoe,getSizableOrigin:()=>zf,hexToUint8Array:()=>lse,isObject:()=>Zc,isPlainObject:()=>pa,issue:()=>ju,joinValues:()=>K,jsonStringifyReplacer:()=>Iu,merge:()=>rse,mergeDefs:()=>ys,normalizeParams:()=>ye,nullish:()=>ua,numKeys:()=>Zoe,objectClone:()=>Hoe,omit:()=>ese,optionalKeys:()=>kE,parsedType:()=>fe,partial:()=>ise,pick:()=>Xoe,prefixIssues:()=>Vr,primitiveTypes:()=>vE,promiseAllObject:()=>Koe,propertyKeyTypes:()=>Uf,randomString:()=>Joe,required:()=>ose,safeExtend:()=>nse,shallowClone:()=>bE,slugify:()=>yE,stringifyPrimitive:()=>ue,uint8ArrayToBase64:()=>qW,uint8ArrayToBase64url:()=>cse,uint8ArrayToHex:()=>use,unwrapMessage:()=>Gf});function Goe(e){return e}function Woe(e){return e}function Boe(e){}function Uoe(e){throw new Error("Unexpected value in exhaustive check")}function zoe(e){}function Wf(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function K(e,t="|"){return e.map(n=>ue(n)).join(t)}function Iu(e,t){return typeof t=="bigint"?t.toString():t}function Du(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function ua(e){return e==null}function Bf(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function hE(e,t){let n=(e.toString().split(".")[1]||"").length,i=t.toString(),r=(i.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(i)){let c=i.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]))}let o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}function st(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==zW)return i===void 0&&(i=zW,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Hoe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function da(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ys(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function qoe(e){return ys(e._zod.def)}function Voe(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function Koe(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function Joe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function Iw(e){return JSON.stringify(e)}function yE(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Zc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pa(e){if(Zc(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Zc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function bE(e){return pa(e)?{...e}:Array.isArray(e)?[...e]:e}function Zoe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function ci(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dr(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function ye(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 Qoe(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function ue(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function kE(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Xoe(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=ys(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 da(this,"shape",s),s},checks:[]});return dr(e,o)}function ese(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=ys(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 da(this,"shape",s),s},checks:[]});return dr(e,o)}function tse(e,t){if(!pa(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=ys(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return da(this,"shape",o),o}});return dr(e,r)}function nse(e,t){if(!pa(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=ys(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return da(this,"shape",i),i}});return dr(e,n)}function rse(e,t){let n=ys(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return da(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return dr(e,n)}function ise(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=ys(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 da(this,"shape",c),c},checks:[]});return dr(t,s)}function ose(e,t,n){let i=ys(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(let s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return da(this,"shape",o),o}});return dr(t,i)}function fa(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 Vr(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Gf(e){return typeof e=="string"?e:e?.message}function Or(e,t,n){let i={...e,path:e.path??[]};if(!e.message){let r=Gf(e.inst?._zod.def?.error?.(e))??Gf(t?.error?.(e))??Gf(n.customError?.(e))??Gf(n.localeError?.(e))??"Invalid input";i.message=r}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function zf(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Hf(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fe(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 ju(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function sse(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function HW(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function qW(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function ase(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return HW(t+n)}function cse(e){return qW(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function lse(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function use(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var zW,Dw,wE,Yoe,Uf,vE,xE,$E,gE,Fe=v(()=>{zW=Symbol("evaluating");Dw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};wE=Du(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});Yoe=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}`)}},Uf=new Set(["string","number","symbol"]),vE=new Set(["string","number","bigint","boolean","symbol","undefined"]);xE={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]},$E={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};gE=class{constructor(...t){}}});function Vf(e,t=n=>n.message){let n={},i=[];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))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function Kf(e,t=n=>n.message){let n={_errors:[]},i=r=>{for(let o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let s=n,a=0;for(;a<o.path.length;){let c=o.path[a];a===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return i(e),n}function RE(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var s,a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>i({issues:l},c.path));else if(c.code==="invalid_key")i({issues:c.issues},c.path);else if(c.code==="invalid_element")i({issues:c.issues},c.path);else{let l=[...o,...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 i(e),n}function KW(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function SE(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${KW(i.path)}`);return t.join(`
7
+ `),t.push(ca(e.hint,hs.gray))),t.join("")}function Mf(e){return ca(e,hs.green)}function Xn(e){return ca(e,hs.gray)}var hs,ur=v(()=>{"use strict";hs={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var _w,pE=v(()=>{"use strict";_w="0.124.44"});function F(e,t,n){function i(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 o extends r{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let l=n?.Parent?new o:this;i(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:i}),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 sn(e){return e&&Object.assign(Ff,e),Ff}var fE,Tw,Gi,la,Ff,Tu=v(()=>{fE=Object.freeze({status:"aborted"});Tw=Symbol("zod_brand"),Gi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},la=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Ff={}});var me={};Te(me,{BIGINT_FORMAT_RANGES:()=>$E,Class:()=>gE,NUMBER_FORMAT_RANGES:()=>xE,aborted:()=>fa,allowsEval:()=>wE,assert:()=>zoe,assertEqual:()=>Goe,assertIs:()=>Boe,assertNever:()=>Uoe,assertNotEqual:()=>Woe,assignProp:()=>da,base64ToUint8Array:()=>HW,base64urlToUint8Array:()=>ase,cached:()=>Du,captureStackTrace:()=>Dw,cleanEnum:()=>sse,cleanRegex:()=>Bf,clone:()=>dr,cloneDef:()=>qoe,createTransparentProxy:()=>Qoe,defineLazy:()=>st,esc:()=>Iw,escapeRegex:()=>ci,extend:()=>tse,finalizeIssue:()=>Or,floatSafeRemainder:()=>hE,getElementAtPath:()=>Voe,getEnumValues:()=>Wf,getLengthableOrigin:()=>Hf,getParsedType:()=>Yoe,getSizableOrigin:()=>zf,hexToUint8Array:()=>lse,isObject:()=>Zc,isPlainObject:()=>pa,issue:()=>ju,joinValues:()=>K,jsonStringifyReplacer:()=>Iu,merge:()=>rse,mergeDefs:()=>ys,normalizeParams:()=>ye,nullish:()=>ua,numKeys:()=>Zoe,objectClone:()=>Hoe,omit:()=>ese,optionalKeys:()=>kE,parsedType:()=>fe,partial:()=>ise,pick:()=>Xoe,prefixIssues:()=>Vr,primitiveTypes:()=>vE,promiseAllObject:()=>Koe,propertyKeyTypes:()=>Uf,randomString:()=>Joe,required:()=>ose,safeExtend:()=>nse,shallowClone:()=>bE,slugify:()=>yE,stringifyPrimitive:()=>ue,uint8ArrayToBase64:()=>qW,uint8ArrayToBase64url:()=>cse,uint8ArrayToHex:()=>use,unwrapMessage:()=>Gf});function Goe(e){return e}function Woe(e){return e}function Boe(e){}function Uoe(e){throw new Error("Unexpected value in exhaustive check")}function zoe(e){}function Wf(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function K(e,t="|"){return e.map(n=>ue(n)).join(t)}function Iu(e,t){return typeof t=="bigint"?t.toString():t}function Du(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function ua(e){return e==null}function Bf(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function hE(e,t){let n=(e.toString().split(".")[1]||"").length,i=t.toString(),r=(i.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(i)){let c=i.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]))}let o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}function st(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==zW)return i===void 0&&(i=zW,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Hoe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function da(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ys(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function qoe(e){return ys(e._zod.def)}function Voe(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function Koe(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function Joe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function Iw(e){return JSON.stringify(e)}function yE(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Zc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pa(e){if(Zc(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Zc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function bE(e){return pa(e)?{...e}:Array.isArray(e)?[...e]:e}function Zoe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function ci(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dr(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function ye(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 Qoe(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function ue(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function kE(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Xoe(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=ys(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 da(this,"shape",s),s},checks:[]});return dr(e,o)}function ese(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=ys(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 da(this,"shape",s),s},checks:[]});return dr(e,o)}function tse(e,t){if(!pa(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=ys(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return da(this,"shape",o),o}});return dr(e,r)}function nse(e,t){if(!pa(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=ys(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return da(this,"shape",i),i}});return dr(e,n)}function rse(e,t){let n=ys(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return da(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return dr(e,n)}function ise(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=ys(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 da(this,"shape",c),c},checks:[]});return dr(t,s)}function ose(e,t,n){let i=ys(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(let s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return da(this,"shape",o),o}});return dr(t,i)}function fa(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 Vr(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Gf(e){return typeof e=="string"?e:e?.message}function Or(e,t,n){let i={...e,path:e.path??[]};if(!e.message){let r=Gf(e.inst?._zod.def?.error?.(e))??Gf(t?.error?.(e))??Gf(n.customError?.(e))??Gf(n.localeError?.(e))??"Invalid input";i.message=r}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function zf(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Hf(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fe(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 ju(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function sse(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function HW(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function qW(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function ase(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return HW(t+n)}function cse(e){return qW(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function lse(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function use(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var zW,Dw,wE,Yoe,Uf,vE,xE,$E,gE,Fe=v(()=>{zW=Symbol("evaluating");Dw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};wE=Du(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});Yoe=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}`)}},Uf=new Set(["string","number","symbol"]),vE=new Set(["string","number","bigint","boolean","symbol","undefined"]);xE={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]},$E={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};gE=class{constructor(...t){}}});function Vf(e,t=n=>n.message){let n={},i=[];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))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function Kf(e,t=n=>n.message){let n={_errors:[]},i=r=>{for(let o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let s=n,a=0;for(;a<o.path.length;){let c=o.path[a];a===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return i(e),n}function RE(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var s,a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>i({issues:l},c.path));else if(c.code==="invalid_key")i({issues:c.issues},c.path);else if(c.code==="invalid_element")i({issues:c.issues},c.path);else{let l=[...o,...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 i(e),n}function KW(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function SE(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${KW(i.path)}`);return t.join(`
8
8
  `)}var VW,qf,Ar,EE=v(()=>{Tu();Fe();VW=(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,Iu,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},qf=F("$ZodError",VW),Ar=F("$ZodError",VW,{Parent:Error})});var Nu,jw,Lu,Nw,Mu,OE,Fu,AE,Lw,pse,Mw,fse,Fw,mse,Gw,gse,Ww,hse,Bw,yse,Uw,wse,zw,bse,PE=v(()=>{Tu();EE();Fe();Nu=e=>(t,n,i,r)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Gi;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map(c=>Or(c,o,sn())));throw Dw(a,r?.callee),a}return s.value},jw=Nu(Ar),Lu=e=>async(t,n,i,r)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(r?.Err??e)(s.issues.map(c=>Or(c,o,sn())));throw Dw(a,r?.callee),a}return s.value},Nw=Lu(Ar),Mu=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new Gi;return o.issues.length?{success:!1,error:new(e??qf)(o.issues.map(s=>Or(s,r,sn())))}:{success:!0,data:o.value}},OE=Mu(Ar),Fu=e=>async(t,n,i)=>{let r=i?Object.assign(i,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>Or(s,r,sn())))}:{success:!0,data:o.value}},AE=Fu(Ar),Lw=e=>(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Nu(e)(t,n,r)},pse=Lw(Ar),Mw=e=>(t,n,i)=>Nu(e)(t,n,i),fse=Mw(Ar),Fw=e=>async(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Lu(e)(t,n,r)},mse=Fw(Ar),Gw=e=>async(t,n,i)=>Lu(e)(t,n,i),gse=Gw(Ar),Ww=e=>(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Mu(e)(t,n,r)},hse=Ww(Ar),Bw=e=>(t,n,i)=>Mu(e)(t,n,i),yse=Bw(Ar),Uw=e=>async(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Fu(e)(t,n,r)},wse=Uw(Ar),zw=e=>async(t,n,i)=>Fu(e)(t,n,i),bse=zw(Ar)});var li={};Te(li,{base64:()=>HE,base64url:()=>Hw,bigint:()=>YE,boolean:()=>XE,browserEmail:()=>Ose,cidrv4:()=>UE,cidrv6:()=>zE,cuid:()=>CE,cuid2:()=>_E,date:()=>VE,datetime:()=>JE,domain:()=>Cse,duration:()=>NE,e164:()=>qE,email:()=>ME,emoji:()=>FE,extendedDuration:()=>vse,guid:()=>LE,hex:()=>_se,hostname:()=>Pse,html5Email:()=>Rse,idnEmail:()=>Ese,integer:()=>QE,ipv4:()=>GE,ipv6:()=>WE,ksuid:()=>DE,lowercase:()=>nO,mac:()=>BE,md5_base64:()=>Ise,md5_base64url:()=>Dse,md5_hex:()=>Tse,nanoid:()=>jE,null:()=>eO,number:()=>qw,rfc5322Email:()=>Sse,sha1_base64:()=>Nse,sha1_base64url:()=>Lse,sha1_hex:()=>jse,sha256_base64:()=>Fse,sha256_base64url:()=>Gse,sha256_hex:()=>Mse,sha384_base64:()=>Bse,sha384_base64url:()=>Use,sha384_hex:()=>Wse,sha512_base64:()=>Hse,sha512_base64url:()=>qse,sha512_hex:()=>zse,string:()=>ZE,time:()=>KE,ulid:()=>TE,undefined:()=>tO,unicodeEmail:()=>JW,uppercase:()=>rO,uuid:()=>Yc,uuid4:()=>kse,uuid6:()=>xse,uuid7:()=>$se,xid:()=>IE});function FE(){return new RegExp(Ase,"u")}function YW(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 KE(e){return new RegExp(`^${YW(e)}$`)}function JE(e){let t=YW({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${ZW}T(?:${i})$`)}function Jf(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Zf(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var CE,_E,TE,IE,DE,jE,NE,vse,LE,Yc,kse,xse,$se,ME,Rse,Sse,JW,Ese,Ose,Ase,GE,WE,BE,UE,zE,HE,Hw,Pse,Cse,qE,ZW,VE,ZE,YE,QE,qw,XE,eO,tO,nO,rO,_se,Tse,Ise,Dse,jse,Nse,Lse,Mse,Fse,Gse,Wse,Bse,Use,zse,Hse,qse,Vw=v(()=>{Fe();CE=/^[cC][^\s-]{8,}$/,_E=/^[0-9a-z]+$/,TE=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,IE=/^[0-9a-vA-V]{20}$/,DE=/^[A-Za-z0-9]{27}$/,jE=/^[a-zA-Z0-9_-]{21}$/,NE=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,vse=/^[-+]?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)?)??$/,LE=/^([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})$/,Yc=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)$/,kse=Yc(4),xse=Yc(6),$se=Yc(7),ME=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Rse=/^[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])?)*$/,Sse=/^(([^<>()\[\]\\.,;:\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,}))$/,JW=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ese=JW,Ose=/^[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])?)*$/,Ase="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";GE=/^(?:(?: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])$/,WE=/^(([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}|:))$/,BE=e=>{let t=ci(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},UE=/^((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])$/,zE=/^(([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])$/,HE=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hw=/^[A-Za-z0-9_-]*$/,Pse=/^(?=.{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])?)*\.?$/,Cse=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,qE=/^\+[1-9]\d{6,14}$/,ZW="(?:(?:\\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])))",VE=new RegExp(`^${ZW}$`);ZE=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},YE=/^-?\d+n?$/,QE=/^-?\d+$/,qw=/^-?\d+(?:\.\d+)?$/,XE=/^(?:true|false)$/i,eO=/^null$/i,tO=/^undefined$/i,nO=/^[^A-Z]*$/,rO=/^[^a-z]*$/,_se=/^[0-9a-fA-F]*$/;Tse=/^[0-9a-fA-F]{32}$/,Ise=Jf(22,"=="),Dse=Zf(22),jse=/^[0-9a-fA-F]{40}$/,Nse=Jf(27,"="),Lse=Zf(27),Mse=/^[0-9a-fA-F]{64}$/,Fse=Jf(43,"="),Gse=Zf(43),Wse=/^[0-9a-fA-F]{96}$/,Bse=Jf(64,""),Use=Zf(64),zse=/^[0-9a-fA-F]{128}$/,Hse=Jf(86,"=="),qse=Zf(86)});function QW(e,t,n){e.issues.length&&t.issues.push(...Vr(n,e.issues))}var Gt,XW,Kw,Jw,iO,oO,sO,aO,cO,lO,uO,dO,pO,Gu,fO,mO,gO,hO,yO,wO,bO,vO,kO,Zw=v(()=>{Tu();Vw();Fe();Gt=F("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),XW={number:"number",bigint:"bigint",object:"date"},Kw=F("$ZodCheckLessThan",(e,t)=>{Gt.init(e,t);let n=XW[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jw=F("$ZodCheckGreaterThan",(e,t)=>{Gt.init(e,t);let n=XW[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),iO=F("$ZodCheckMultipleOf",(e,t)=>{Gt.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.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):hE(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})}}),oO=F("$ZodCheckNumberFormat",(e,t)=>{Gt.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=xE[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=r,a.maximum=o,n&&(a.pattern=QE)}),e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:i,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:i,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:i,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>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),sO=F("$ZodCheckBigIntFormat",(e,t)=>{Gt.init(e,t);let[n,i]=$E[t.format];e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),aO=F("$ZodCheckMaxSize",(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ua(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:zf(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),cO=F("$ZodCheckMinSize",(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ua(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:zf(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),lO=F("$ZodCheckSizeEquals",(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ua(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=i=>{let r=i.value,o=r.size;if(o===t.size)return;let s=o>t.size;i.issues.push({origin:zf(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),uO=F("$ZodCheckMaxLength",(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ua(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;if(r.length<=t.maximum)return;let s=Hf(r);i.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dO=F("$ZodCheckMinLength",(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ua(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;if(r.length>=t.minimum)return;let s=Hf(r);i.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pO=F("$ZodCheckLengthEquals",(e,t)=>{var n;Gt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ua(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=i=>{let r=i.value,o=r.length;if(o===t.length)return;let s=Hf(r),a=o>t.length;i.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Gu=F("$ZodCheckStringFormat",(e,t)=>{var n,i;Gt.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.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})}):(i=e._zod).check??(i.check=()=>{})}),fO=F("$ZodCheckRegex",(e,t)=>{Gu.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})}}),mO=F("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=nO),Gu.init(e,t)}),gO=F("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rO),Gu.init(e,t)}),hO=F("$ZodCheckIncludes",(e,t)=>{Gt.init(e,t);let n=ci(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),yO=F("$ZodCheckStartsWith",(e,t)=>{Gt.init(e,t);let n=new RegExp(`^${ci(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),wO=F("$ZodCheckEndsWith",(e,t)=>{Gt.init(e,t);let n=new RegExp(`.*${ci(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});bO=F("$ZodCheckProperty",(e,t)=>{Gt.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>QW(r,n,t.property));QW(i,n,t.property)}}),vO=F("$ZodCheckMimeType",(e,t)=>{Gt.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),kO=F("$ZodCheckOverwrite",(e,t)=>{Gt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}})});var Yf,xO=v(()=>{Yf=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 i=t.split(`
9
9
  `).filter(s=>s),r=Math.min(...i.map(s=>s.length-s.trimStart().length)),o=i.map(s=>s.slice(r)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let t=Function,n=this?.args,r=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,r.join(`
10
10
  `))}}});var $O,RO=v(()=>{$O={major:4,minor:3,patch:6}});function qO(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function pB(e){if(!Hw.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return qO(n)}function fB(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}function tB(e,t,n){e.issues.length&&t.issues.push(...Vr(n,e.issues)),t.value[n]=e.value}function tb(e,t,n,i,r){if(e.issues.length){if(r&&!(n in i))return;t.issues.push(...Vr(n,e.issues))}e.value===void 0?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function mB(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let n=kE(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function gB(e,t,n,i,r,o){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:[]},i);p instanceof Promise?e.push(p.then(f=>tb(f,n,d,t,u))):tb(p,n,d,t,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}function nB(e,t,n,i){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let r=e.filter(o=>!fa(o));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(o=>o.issues.map(s=>Or(s,i,sn())))}),t)}function rB(e,t,n,i){let r=e.filter(o=>o.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(o=>o.issues.map(s=>Or(s,i,sn())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}function SO(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(pa(e)&&pa(t)){let n=Object.keys(t),i=Object.keys(e).filter(o=>n.indexOf(o)!==-1),r={...e,...t};for(let o of i){let s=SO(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r[o]=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 i=0;i<e.length;i++){let r=e[i],o=t[i],s=SO(r,o);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function iB(e,t,n){let i=new Map,r;for(let a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(let c of a.keys)i.has(c)||i.set(c,{}),i.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)i.has(c)||i.set(c,{}),i.get(c).r=!0;else e.issues.push(a);let o=[...i].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&r&&e.issues.push({...r,keys:o}),fa(e))return e;let s=SO(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 Yw(e,t,n){e.issues.length&&t.issues.push(...Vr(n,e.issues)),t.value[n]=e.value}function oB(e,t,n,i,r,o,s){e.issues.length&&(Uf.has(typeof i)?n.issues.push(...Vr(i,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:o,issues:e.issues.map(a=>Or(a,s,sn()))})),t.issues.length&&(Uf.has(typeof i)?n.issues.push(...Vr(i,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:o,key:i,issues:t.issues.map(a=>Or(a,s,sn()))})),n.value.set(e.value,t.value)}function sB(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function aB(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}function cB(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function lB(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 Qw(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}function Xw(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(o=>eb(e,o,t.out,n)):eb(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(o=>eb(e,o,t.in,n)):eb(e,r,t.in,n)}}function eb(e,t,n,i){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},i)}function uB(e){return e.value=Object.freeze(e.value),e}function dB(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(r.params=i._zod.def.params),t.issues.push(ju(r))}}var Ze,Qc,It,EO,OO,AO,PO,CO,_O,TO,IO,DO,jO,NO,LO,MO,FO,GO,WO,BO,UO,zO,HO,VO,KO,JO,ZO,YO,nb,QO,Qf,rb,XO,eA,tA,nA,rA,iA,oA,sA,aA,cA,hB,lA,Xf,uA,dA,pA,ib,fA,mA,gA,hA,yA,wA,bA,ob,vA,kA,xA,$A,RA,SA,EA,OA,AA,em,PA,CA,_A,TA,IA,DA,jA=v(()=>{Zw();Tu();xO();PE();Vw();Fe();RO();Fe();Ze=F("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$O;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let r of i)for(let o of r._zod.onattach)o(e);if(i.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=fa(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 Gi;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(l||(l=fa(s,p)))});else{if(s.issues.length===p)continue;l||(l=fa(s,p))}}return u?u.then(()=>s):s},o=(s,a,c)=>{if(fa(s))return s.aborted=!0,s;let l=r(a,i,c);if(l instanceof Promise){if(c.async===!1)throw new Gi;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=>o(u,s,a)):o(l,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Gi;return c.then(l=>r(l,i,a))}return r(c,i,a)}}st(e,"~standard",()=>({validate:r=>{try{let o=OE(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return AE(e,r).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Qc=F("$ZodString",(e,t)=>{Ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ZE(e._zod.bag),e._zod.parse=(n,i)=>{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}}),It=F("$ZodStringFormat",(e,t)=>{Gu.init(e,t),Qc.init(e,t)}),EO=F("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=LE),It.init(e,t)}),OO=F("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Yc(i))}else t.pattern??(t.pattern=Yc());It.init(e,t)}),AO=F("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ME),It.init(e,t)}),PO=F("$ZodURL",(e,t)=>{It.init(e,t),e._zod.check=n=>{try{let i=n.value.trim(),r=new URL(i);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=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),CO=F("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=FE()),It.init(e,t)}),_O=F("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=jE),It.init(e,t)}),TO=F("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=CE),It.init(e,t)}),IO=F("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_E),It.init(e,t)}),DO=F("$ZodULID",(e,t)=>{t.pattern??(t.pattern=TE),It.init(e,t)}),jO=F("$ZodXID",(e,t)=>{t.pattern??(t.pattern=IE),It.init(e,t)}),NO=F("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=DE),It.init(e,t)}),LO=F("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=JE(t)),It.init(e,t)}),MO=F("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=VE),It.init(e,t)}),FO=F("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=KE(t)),It.init(e,t)}),GO=F("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=NE),It.init(e,t)}),WO=F("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=GE),It.init(e,t),e._zod.bag.format="ipv4"}),BO=F("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=WE),It.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})}}}),UO=F("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=BE(t.delimiter)),It.init(e,t),e._zod.bag.format="mac"}),zO=F("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=UE),It.init(e,t)}),HO=F("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=zE),It.init(e,t),e._zod.check=n=>{let i=n.value.split("/");try{if(i.length!==2)throw new Error;let[r,o]=i;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)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})}}});VO=F("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=HE),It.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{qO(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});KO=F("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Hw),It.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{pB(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),JO=F("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qE),It.init(e,t)});ZO=F("$ZodJWT",(e,t)=>{It.init(e,t),e._zod.check=n=>{fB(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),YO=F("$ZodCustomStringFormat",(e,t)=>{It.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})}}),nb=F("$ZodNumber",(e,t)=>{Ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??qw,e._zod.parse=(n,i)=>{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 o=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,...o?{received:o}:{}}),n}}),QO=F("$ZodNumberFormat",(e,t)=>{oO.init(e,t),nb.init(e,t)}),Qf=F("$ZodBoolean",(e,t)=>{Ze.init(e,t),e._zod.pattern=XE,e._zod.parse=(n,i)=>{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}}),rb=F("$ZodBigInt",(e,t)=>{Ze.init(e,t),e._zod.pattern=YE,e._zod.parse=(n,i)=>{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}}),XO=F("$ZodBigIntFormat",(e,t)=>{sO.init(e,t),rb.init(e,t)}),eA=F("$ZodSymbol",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),tA=F("$ZodUndefined",(e,t)=>{Ze.init(e,t),e._zod.pattern=tO,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),nA=F("$ZodNull",(e,t)=>{Ze.init(e,t),e._zod.pattern=eO,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),rA=F("$ZodAny",(e,t)=>{Ze.init(e,t),e._zod.parse=n=>n}),iA=F("$ZodUnknown",(e,t)=>{Ze.init(e,t),e._zod.parse=n=>n}),oA=F("$ZodNever",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),sA=F("$ZodVoid",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),aA=F("$ZodDate",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,o=r instanceof Date;return o&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:e}),n}});cA=F("$ZodArray",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,i)=>{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 o=[];for(let s=0;s<r.length;s++){let a=r[s],c=t.element._zod.run({value:a,issues:[]},i);c instanceof Promise?o.push(c.then(l=>tB(l,n,s))):tB(c,n,s)}return o.length?Promise.all(o).then(()=>n):n}});hB=F("$ZodObject",(e,t)=>{if(Ze.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 i=Du(()=>mB(t));st(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=Zc,o=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=i.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],g=f._zod.optout==="optional",h=f._zod.run({value:l[p],issues:[]},c);h instanceof Promise?u.push(h.then(w=>tb(w,a,p,l,g))):tb(h,a,p,l,g)}return o?gB(u,l,a,c,i.value,e):u.length?Promise.all(u).then(()=>a):a}}),lA=F("$ZodObjectJIT",(e,t)=>{hB.init(e,t);let n=e._zod.parse,i=Du(()=>mB(t)),r=p=>{let f=new Yf(["shape","payload","ctx"]),g=i.value,h=$=>{let x=Iw($);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};f.write("const input = payload.value;");let w=Object.create(null),b=0;for(let $ of g.keys)w[$]=`key_${b++}`;f.write("const newResult = {};");for(let $ of g.keys){let x=w[$],R=Iw($),D=p[$]?._zod?.optout==="optional";f.write(`const ${x} = ${h($)};`),D?f.write(`
@@ -71,7 +71,7 @@ ${e.timestamp}`,"utf-8")}function fde(e,t,n){let i=`the approval of gate ${n.gat
71
71
  depsCount: ${t},
72
72
  deps: ${n}}`};var Xge={keyword:"dependencies",type:"object",schemaType:"object",error:Lo.error,code(e){let[t,n]=ehe(e);MK(e,t),FK(e,n)}};function ehe({schema:e}){let t={},n={};for(let i in e){if(i==="__proto__")continue;let r=Array.isArray(e[i])?t:n;r[i]=e[i]}return[t,n]}function MK(e,t=e.schema){let{gen:n,data:i,it:r}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,wg.propertyInData)(n,i,s,r.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),r.allErrors?n.if(c,()=>{for(let l of a)(0,wg.checkReportMissingProp)(e,l)}):(n.if((0,XT._)`${c} && (${(0,wg.checkMissingProp)(e,a,o)})`),(0,wg.reportMissingProp)(e,o),n.else())}}Lo.validatePropertyDeps=MK;function FK(e,t=e.schema){let{gen:n,data:i,keyword:r,it:o}=e,s=n.name("valid");for(let a in t)(0,Qge.alwaysValidSchema)(o,t[a])||(n.if((0,wg.propertyInData)(n,i,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:r,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>n.var(s,!0)),e.ok(s))}Lo.validateSchemaDeps=FK;Lo.default=Xge});var WK=ae(eI=>{"use strict";Object.defineProperty(eI,"__esModule",{value:!0});var GK=tt(),the=ft(),nhe={message:"property name must be valid",params:({params:e})=>(0,GK._)`{propertyName: ${e.propertyName}}`},rhe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:nhe,code(e){let{gen:t,schema:n,data:i,it:r}=e;if((0,the.alwaysValidSchema)(r,n))return;let o=t.name("valid");t.forIn("key",i,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,GK.not)(o),()=>{e.error(!0),r.allErrors||t.break()})}),e.ok(o)}};eI.default=rhe});var nI=ae(tI=>{"use strict";Object.defineProperty(tI,"__esModule",{value:!0});var Rk=gi(),Zi=tt(),ihe=mi(),Sk=ft(),ohe={message:"must NOT have additional properties",params:({params:e})=>(0,Zi._)`{additionalProperty: ${e.additionalProperty}}`},she={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ohe,code(e){let{gen:t,schema:n,parentSchema:i,data:r,errsCount:o,it:s}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,Sk.alwaysValidSchema)(s,n))return;let l=(0,Rk.allSchemaProperties)(i.properties),u=(0,Rk.allSchemaProperties)(i.patternProperties);d(),e.ok((0,Zi._)`${o} === ${ihe.default.errors}`);function d(){t.forIn("key",r,w=>{!l.length&&!u.length?g(w):t.if(p(w),()=>g(w))})}function p(w){let b;if(l.length>8){let k=(0,Sk.schemaRefOrVal)(s,i.properties,"properties");b=(0,Rk.isOwnProperty)(t,k,w)}else l.length?b=(0,Zi.or)(...l.map(k=>(0,Zi._)`${w} === ${k}`)):b=Zi.nil;return u.length&&(b=(0,Zi.or)(b,...u.map(k=>(0,Zi._)`${(0,Rk.usePattern)(e,k)}.test(${w})`))),(0,Zi.not)(b)}function f(w){t.code((0,Zi._)`delete ${r}[${w}]`)}function g(w){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){f(w);return}if(n===!1){e.setParams({additionalProperty:w}),e.error(),a||t.break();return}if(typeof n=="object"&&!(0,Sk.alwaysValidSchema)(s,n)){let b=t.name("valid");c.removeAdditional==="failing"?(h(w,b,!1),t.if((0,Zi.not)(b),()=>{e.reset(),f(w)})):(h(w,b),a||t.if((0,Zi.not)(b),()=>t.break()))}}function h(w,b,k){let $={keyword:"additionalProperties",dataProp:w,dataPropType:Sk.Type.Str};k===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema($,b)}}};tI.default=she});var zK=ae(iI=>{"use strict";Object.defineProperty(iI,"__esModule",{value:!0});var ahe=Dd(),BK=gi(),rI=ft(),UK=nI(),che={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:i,data:r,it:o}=e;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&UK.default.code(new ahe.KeywordCxt(o,UK.default,"additionalProperties"));let s=(0,BK.allSchemaProperties)(n);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=rI.mergeEvaluated.props(t,(0,rI.toHash)(s),o.props));let a=s.filter(d=>!(0,rI.alwaysValidSchema)(o,n[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)l(d)?u(d):(t.if((0,BK.propertyInData)(t,r,d,o.opts.ownProperties)),u(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function l(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};iI.default=che});var KK=ae(oI=>{"use strict";Object.defineProperty(oI,"__esModule",{value:!0});var HK=gi(),Ek=tt(),qK=ft(),VK=ft(),lhe={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:i,parentSchema:r,it:o}=e,{opts:s}=o,a=(0,HK.allSchemaProperties)(n),c=a.filter(h=>(0,qK.alwaysValidSchema)(o,n[h]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=s.strictSchema&&!s.allowMatchingProperties&&r.properties,u=t.name("valid");o.props!==!0&&!(o.props instanceof Ek.Name)&&(o.props=(0,VK.evaluatedPropsToName)(t,o.props));let{props:d}=o;p();function p(){for(let h of a)l&&f(h),o.allErrors?g(h):(t.var(u,!0),g(h),t.if(u))}function f(h){for(let w in l)new RegExp(h).test(w)&&(0,qK.checkStrictMode)(o,`property ${w} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",i,w=>{t.if((0,Ek._)`${(0,HK.usePattern)(e,h)}.test(${w})`,()=>{let b=c.includes(h);b||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:w,dataPropType:VK.Type.Str},u),o.opts.unevaluated&&d!==!0?t.assign((0,Ek._)`${d}[${w}]`,!0):!b&&!o.allErrors&&t.if((0,Ek.not)(u),()=>t.break())})})}}};oI.default=lhe});var JK=ae(sI=>{"use strict";Object.defineProperty(sI,"__esModule",{value:!0});var uhe=ft(),dhe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:i}=e;if((0,uhe.alwaysValidSchema)(i,n)){e.fail();return}let r=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),e.failResult(r,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};sI.default=dhe});var ZK=ae(aI=>{"use strict";Object.defineProperty(aI,"__esModule",{value:!0});var phe=gi(),fhe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:phe.validateUnion,error:{message:"must match a schema in anyOf"}};aI.default=fhe});var YK=ae(cI=>{"use strict";Object.defineProperty(cI,"__esModule",{value:!0});var Ok=tt(),mhe=ft(),ghe={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Ok._)`{passingSchemas: ${e.passing}}`},hhe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ghe,code(e){let{gen:t,schema:n,parentSchema:i,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(r.opts.discriminator&&i.discriminator)return;let o=n,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(s,()=>e.reset(),()=>e.error(!0));function l(){o.forEach((u,d)=>{let p;(0,mhe.alwaysValidSchema)(r,u)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Ok._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Ok._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,d),p&&e.mergeEvaluated(p,Ok.Name)})})}}};cI.default=hhe});var QK=ae(lI=>{"use strict";Object.defineProperty(lI,"__esModule",{value:!0});var yhe=ft(),whe={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:i}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");let r=t.name("valid");n.forEach((o,s)=>{if((0,yhe.alwaysValidSchema)(i,o))return;let a=e.subschema({keyword:"allOf",schemaProp:s},r);e.ok(r),e.mergeEvaluated(a)})}};lI.default=whe});var t4=ae(uI=>{"use strict";Object.defineProperty(uI,"__esModule",{value:!0});var Ak=tt(),e4=ft(),bhe={message:({params:e})=>(0,Ak.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Ak._)`{failingKeyword: ${e.ifClause}}`},vhe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:bhe,code(e){let{gen:t,parentSchema:n,it:i}=e;n.then===void 0&&n.else===void 0&&(0,e4.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let r=XK(i,"then"),o=XK(i,"else");if(!r&&!o)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),r&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else r?t.if(a,l("then")):t.if((0,Ak.not)(a),l("else"));e.pass(s,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let p=e.subschema({keyword:u},a);t.assign(s,a),e.mergeValidEvaluated(p,s),d?t.assign(d,(0,Ak._)`${u}`):e.setParams({ifClause:u})}}}};function XK(e,t){let n=e.schema[t];return n!==void 0&&!(0,e4.alwaysValidSchema)(e,n)}uI.default=vhe});var n4=ae(dI=>{"use strict";Object.defineProperty(dI,"__esModule",{value:!0});var khe=ft(),xhe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,khe.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};dI.default=xhe});var fI=ae(pI=>{"use strict";Object.defineProperty(pI,"__esModule",{value:!0});var $he=KT(),Rhe=DK(),She=JT(),Ehe=NK(),Ohe=LK(),Ahe=$k(),Phe=WK(),Che=nI(),_he=zK(),The=KK(),Ihe=JK(),Dhe=ZK(),jhe=YK(),Nhe=QK(),Lhe=t4(),Mhe=n4();function Fhe(e=!1){let t=[Ihe.default,Dhe.default,jhe.default,Nhe.default,Lhe.default,Mhe.default,Phe.default,Che.default,Ahe.default,_he.default,The.default];return e?t.push(Rhe.default,Ehe.default):t.push($he.default,She.default),t.push(Ohe.default),t}pI.default=Fhe});var gI=ae(bg=>{"use strict";Object.defineProperty(bg,"__esModule",{value:!0});bg.dynamicAnchor=void 0;var mI=tt(),Ghe=mi(),r4=og(),Whe=yk(),Bhe={keyword:"$dynamicAnchor",schemaType:"string",code:e=>i4(e,e.schema)};function i4(e,t){let{gen:n,it:i}=e;i.schemaEnv.root.dynamicAnchors[t]=!0;let r=(0,mI._)`${Ghe.default.dynamicAnchors}${(0,mI.getProperty)(t)}`,o=i.errSchemaPath==="#"?i.validateName:Uhe(e);n.if((0,mI._)`!${r}`,()=>n.assign(r,o))}bg.dynamicAnchor=i4;function Uhe(e){let{schemaEnv:t,schema:n,self:i}=e.it,{root:r,baseId:o,localRefs:s,meta:a}=t.root,{schemaId:c}=i.opts,l=new r4.SchemaEnv({schema:n,schemaId:c,root:r,baseId:o,localRefs:s,meta:a});return r4.compileSchema.call(i,l),(0,Whe.getValidate)(e,l)}bg.default=Bhe});var hI=ae(vg=>{"use strict";Object.defineProperty(vg,"__esModule",{value:!0});vg.dynamicRef=void 0;var o4=tt(),zhe=mi(),s4=yk(),Hhe={keyword:"$dynamicRef",schemaType:"string",code:e=>a4(e,e.schema)};function a4(e,t){let{gen:n,keyword:i,it:r}=e;if(t[0]!=="#")throw new Error(`"${i}" only supports hash fragment reference`);let o=t.slice(1);if(r.allErrors)s();else{let c=n.let("valid",!1);s(c),e.ok(c)}function s(c){if(r.schemaEnv.root.dynamicAnchors[o]){let l=n.let("_v",(0,o4._)`${zhe.default.dynamicAnchors}${(0,o4.getProperty)(o)}`);n.if(l,a(l,c),a(r.validateName,c))}else a(r.validateName,c)()}function a(c,l){return l?()=>n.block(()=>{(0,s4.callRef)(e,c),n.let(l,!0)}):()=>(0,s4.callRef)(e,c)}}vg.dynamicRef=a4;vg.default=Hhe});var c4=ae(yI=>{"use strict";Object.defineProperty(yI,"__esModule",{value:!0});var qhe=gI(),Vhe=ft(),Khe={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,qhe.dynamicAnchor)(e,""):(0,Vhe.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};yI.default=Khe});var l4=ae(wI=>{"use strict";Object.defineProperty(wI,"__esModule",{value:!0});var Jhe=hI(),Zhe={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,Jhe.dynamicRef)(e,e.schema)};wI.default=Zhe});var u4=ae(bI=>{"use strict";Object.defineProperty(bI,"__esModule",{value:!0});var Yhe=gI(),Qhe=hI(),Xhe=c4(),eye=l4(),tye=[Yhe.default,Qhe.default,Xhe.default,eye.default];bI.default=tye});var p4=ae(vI=>{"use strict";Object.defineProperty(vI,"__esModule",{value:!0});var d4=$k(),nye={keyword:"dependentRequired",type:"object",schemaType:"object",error:d4.error,code:e=>(0,d4.validatePropertyDeps)(e)};vI.default=nye});var f4=ae(kI=>{"use strict";Object.defineProperty(kI,"__esModule",{value:!0});var rye=$k(),iye={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,rye.validateSchemaDeps)(e)};kI.default=iye});var m4=ae(xI=>{"use strict";Object.defineProperty(xI,"__esModule",{value:!0});var oye=ft(),sye={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){t.contains===void 0&&(0,oye.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};xI.default=sye});var g4=ae($I=>{"use strict";Object.defineProperty($I,"__esModule",{value:!0});var aye=p4(),cye=f4(),lye=m4(),uye=[aye.default,cye.default,lye.default];$I.default=uye});var y4=ae(RI=>{"use strict";Object.defineProperty(RI,"__esModule",{value:!0});var ja=tt(),h4=ft(),dye=mi(),pye={message:"must NOT have unevaluated properties",params:({params:e})=>(0,ja._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},fye={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:pye,code(e){let{gen:t,schema:n,data:i,errsCount:r,it:o}=e;if(!r)throw new Error("ajv implementation error");let{allErrors:s,props:a}=o;a instanceof ja.Name?t.if((0,ja._)`${a} !== true`,()=>t.forIn("key",i,d=>t.if(l(a,d),()=>c(d)))):a!==!0&&t.forIn("key",i,d=>a===void 0?c(d):t.if(u(a,d),()=>c(d))),o.props=!0,e.ok((0,ja._)`${r} === ${dye.default.errors}`);function c(d){if(n===!1){e.setParams({unevaluatedProperty:d}),e.error(),s||t.break();return}if(!(0,h4.alwaysValidSchema)(o,n)){let p=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:h4.Type.Str},p),s||t.if((0,ja.not)(p),()=>t.break())}}function l(d,p){return(0,ja._)`!${d} || !${d}[${p}]`}function u(d,p){let f=[];for(let g in d)d[g]===!0&&f.push((0,ja._)`${p} !== ${g}`);return(0,ja.and)(...f)}}};RI.default=fye});var b4=ae(SI=>{"use strict";Object.defineProperty(SI,"__esModule",{value:!0});var $l=tt(),w4=ft(),mye={message:({params:{len:e}})=>(0,$l.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,$l._)`{limit: ${e}}`},gye={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:mye,code(e){let{gen:t,schema:n,data:i,it:r}=e,o=r.items||0;if(o===!0)return;let s=t.const("len",(0,$l._)`${i}.length`);if(n===!1)e.setParams({len:o}),e.fail((0,$l._)`${s} > ${o}`);else if(typeof n=="object"&&!(0,w4.alwaysValidSchema)(r,n)){let c=t.var("valid",(0,$l._)`${s} <= ${o}`);t.if((0,$l.not)(c),()=>a(c,o)),e.ok(c)}r.items=!0;function a(c,l){t.forRange("i",l,s,u=>{e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:w4.Type.Num},c),r.allErrors||t.if((0,$l.not)(c),()=>t.break())})}}};SI.default=gye});var v4=ae(EI=>{"use strict";Object.defineProperty(EI,"__esModule",{value:!0});var hye=y4(),yye=b4(),wye=[hye.default,yye.default];EI.default=wye});var k4=ae(OI=>{"use strict";Object.defineProperty(OI,"__esModule",{value:!0});var ln=tt(),bye={message:({schemaCode:e})=>(0,ln.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ln._)`{format: ${e}}`},vye={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:bye,code(e,t){let{gen:n,data:i,$data:r,schema:o,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;r?p():f();function p(){let g=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=n.const("fDef",(0,ln._)`${g}[${s}]`),w=n.let("fType"),b=n.let("format");n.if((0,ln._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>n.assign(w,(0,ln._)`${h}.type || "string"`).assign(b,(0,ln._)`${h}.validate`),()=>n.assign(w,(0,ln._)`"string"`).assign(b,h)),e.fail$data((0,ln.or)(k(),$()));function k(){return c.strictSchema===!1?ln.nil:(0,ln._)`${s} && !${b}`}function $(){let x=u.$async?(0,ln._)`(${h}.async ? await ${b}(${i}) : ${b}(${i}))`:(0,ln._)`${b}(${i})`,R=(0,ln._)`(typeof ${b} == "function" ? ${x} : ${b}.test(${i}))`;return(0,ln._)`${b} && ${b} !== true && ${w} === ${t} && !${R}`}}function f(){let g=d.formats[o];if(!g){k();return}if(g===!0)return;let[h,w,b]=$(g);h===t&&e.pass(x());function k(){if(c.strictSchema===!1){d.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function $(R){let O=R instanceof RegExp?(0,ln.regexpCode)(R):c.code.formats?(0,ln._)`${c.code.formats}${(0,ln.getProperty)(o)}`:void 0,D=n.scopeValue("formats",{key:o,ref:R,code:O});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,ln._)`${D}.validate`]:["string",R,D]}function x(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!u.$async)throw new Error("async format in sync schema");return(0,ln._)`await ${b}(${i})`}return typeof w=="function"?(0,ln._)`${b}(${i})`:(0,ln._)`${b}.test(${i})`}}}};OI.default=vye});var PI=ae(AI=>{"use strict";Object.defineProperty(AI,"__esModule",{value:!0});var kye=k4(),xye=[kye.default];AI.default=xye});var CI=ae(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.contentVocabulary=Wd.metadataVocabulary=void 0;Wd.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Wd.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var $4=ae(_I=>{"use strict";Object.defineProperty(_I,"__esModule",{value:!0});var $ye=CT(),Rye=qT(),Sye=fI(),Eye=u4(),Oye=g4(),Aye=v4(),Pye=PI(),x4=CI(),Cye=[Eye.default,$ye.default,Rye.default,(0,Sye.default)(!0),Pye.default,x4.metadataVocabulary,x4.contentVocabulary,Oye.default,Aye.default];_I.default=Cye});var S4=ae(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});Pk.DiscrError=void 0;var R4;(function(e){e.Tag="tag",e.Mapping="mapping"})(R4||(Pk.DiscrError=R4={}))});var DI=ae(II=>{"use strict";Object.defineProperty(II,"__esModule",{value:!0});var Bd=tt(),TI=S4(),E4=og(),_ye=jd(),Tye=ft(),Iye={message:({params:{discrError:e,tagName:t}})=>e===TI.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,Bd._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},Dye={keyword:"discriminator",type:"object",schemaType:"object",error:Iye,code(e){let{gen:t,data:n,schema:i,parentSchema:r,it:o}=e,{oneOf:s}=r;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=i.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",(0,Bd._)`${n}${(0,Bd.getProperty)(a)}`);t.if((0,Bd._)`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:TI.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let f=p();t.if(!1);for(let g in f)t.elseIf((0,Bd._)`${l} === ${g}`),t.assign(c,d(f[g]));t.else(),e.error(!1,{discrError:TI.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(f){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(h,Bd.Name),g}function p(){var f;let g={},h=b(r),w=!0;for(let x=0;x<s.length;x++){let R=s[x];if(R?.$ref&&!(0,Tye.schemaHasRulesButRef)(R,o.self.RULES)){let D=R.$ref;if(R=E4.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,D),R instanceof E4.SchemaEnv&&(R=R.schema),R===void 0)throw new _ye.default(o.opts.uriResolver,o.baseId,D)}let O=(f=R?.properties)===null||f===void 0?void 0:f[a];if(typeof O!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);w=w&&(h||b(R)),k(O,x)}if(!w)throw new Error(`discriminator: "${a}" must be required`);return g;function b({required:x}){return Array.isArray(x)&&x.includes(a)}function k(x,R){if(x.const)$(x.const,R);else if(x.enum)for(let O of x.enum)$(O,R);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function $(x,R){if(typeof x!="string"||x in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[x]=R}}}};II.default=Dye});var O4=ae((a2e,jye)=>{jye.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var A4=ae((c2e,Nye)=>{Nye.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var P4=ae((l2e,Lye)=>{Lye.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var C4=ae((u2e,Mye)=>{Mye.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var _4=ae((d2e,Fye)=>{Fye.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var T4=ae((p2e,Gye)=>{Gye.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var I4=ae((f2e,Wye)=>{Wye.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var D4=ae((m2e,Bye)=>{Bye.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var j4=ae(jI=>{"use strict";Object.defineProperty(jI,"__esModule",{value:!0});var Uye=O4(),zye=A4(),Hye=P4(),qye=C4(),Vye=_4(),Kye=T4(),Jye=I4(),Zye=D4(),Yye=["/properties"];function Qye(e){return[Uye,zye,Hye,qye,Vye,t(this,Kye),Jye,t(this,Zye)].forEach(n=>this.addMetaSchema(n,void 0,!1)),this;function t(n,i){return e?n.$dataMetaSchema(i,Yye):i}}jI.default=Qye});var N4=ae((Yt,LI)=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MissingRefError=Yt.ValidationError=Yt.CodeGen=Yt.Name=Yt.nil=Yt.stringify=Yt.str=Yt._=Yt.KeywordCxt=Yt.Ajv2020=void 0;var Xye=OT(),ewe=$4(),twe=DI(),nwe=j4(),NI="https://json-schema.org/draft/2020-12/schema",Ud=class extends Xye.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),ewe.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(twe.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:n}=this.opts;n&&(nwe.default.call(this,t),this.refs["http://json-schema.org/schema"]=NI)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(NI)?NI:void 0)}};Yt.Ajv2020=Ud;LI.exports=Yt=Ud;LI.exports.Ajv2020=Ud;Object.defineProperty(Yt,"__esModule",{value:!0});Yt.default=Ud;var rwe=Dd();Object.defineProperty(Yt,"KeywordCxt",{enumerable:!0,get:function(){return rwe.KeywordCxt}});var zd=tt();Object.defineProperty(Yt,"_",{enumerable:!0,get:function(){return zd._}});Object.defineProperty(Yt,"str",{enumerable:!0,get:function(){return zd.str}});Object.defineProperty(Yt,"stringify",{enumerable:!0,get:function(){return zd.stringify}});Object.defineProperty(Yt,"nil",{enumerable:!0,get:function(){return zd.nil}});Object.defineProperty(Yt,"Name",{enumerable:!0,get:function(){return zd.Name}});Object.defineProperty(Yt,"CodeGen",{enumerable:!0,get:function(){return zd.CodeGen}});var iwe=ig();Object.defineProperty(Yt,"ValidationError",{enumerable:!0,get:function(){return iwe.default}});var owe=jd();Object.defineProperty(Yt,"MissingRefError",{enumerable:!0,get:function(){return owe.default}})});function Na(){let e=N4();return e.default??e}var kg=v(()=>{"use strict"});import{readFileSync as GI}from"node:fs";import{isAbsolute as swe,join as WI,relative as awe,resolve as cwe}from"node:path";function M4(e=[]){let t=new Map;for(let n of[...L4,...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 F4(){return M4()}function G4(e,t,n){if("directory"in e.probe)return!0;if("chantProject"in e.probe)return UI(t,n);let{anyFile:i,anyBlock:r,anyJsonKey:o}=e.probe;if(i&&FI(t,n,i).length>0)return!0;if(o)for(let s of FI(t,n,o.in))try{let a=JSON.parse(t.read(s));if(o.pointers.some(c=>dwe(a,c)!==void 0))return!0}catch{}if(r){let s=new RegExp(`^\\s*(?:${r.blocks.map(W4).join("|")})\\s*\\{`,"m");for(let a of FI(t,n,r.in))try{if(s.test(t.read(a)))return!0}catch{}}return!1}function FI(e,t,n){let i=[],r=n.filter(o=>o.includes("*"));for(let o of n)!o.includes("*")&&e.stat(Ve(t,o))==="file"&&i.push(Ve(t,o));if(r.length>0){let o=r.map(s=>new RegExp(`^${s.split("*").map(W4).join("[^/]*")}$`));for(let s of e.list(t)??[])s.type==="file"&&o.some(a=>a.test(s.name))&&i.push(Ve(t,s.name))}return i.sort()}function dwe(e,t){let n=e;for(let i of t.split("/").slice(1)){let r=i.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 W4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function UI(e,t){let n=Ve(t,"package.json");if(e.stat(n)==="file")try{let r=JSON.parse(e.read(n));for(let o of["dependencies","devDependencies","peerDependencies"]){let s=r[o];if(s&&typeof s=="object"&&Object.keys(s).some(mwe))return!0}}catch{}let i=(r,o)=>{let s=e.list(r)??[];return s.some(a=>a.type==="file"&&pwe.includes(a.name))?!0:o===fwe?!1:s.some(a=>a.type==="dir"&&!qi(a.name)&&i(Ve(r,a.name),o+1))};return i(t,0)}function mwe(e){return e==="@intentius/chant"||e.startsWith("@intentius/chant-lexicon-")}function gwe(){if(Ck)return Ck;let e=Na();return Ck=new e({allErrors:!0,strict:!0}).compile(b0),Ck}function hwe(e,t){let n;try{n=JSON.parse(e)}catch(a){return{kinds:[],problems:[`${t}: the kinds file is not JSON (${a.message})`]}}let i=gwe();if(!i(n)){let a=(i.errors??[]).map(c=>`${t}: ${c.instancePath||"the kinds file"} ${c.message??"is invalid"}`);return{kinds:[],problems:[...new Set(a)]}}let r=[],o=[],s=new Set;for(let a of n.kinds){if(uwe.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),o.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]}}:{}},precedence:a.precedence,shape:"member",outputs:{from:"declared",names:[...a.outputs??[]]},source:t,...a.graph?{graph:{lexicon:a.graph.lexicon,config:structuredClone(a.graph.config)}}:{},...a.fields?{fields:structuredClone(a.fields)}:{},...a.reader&&MI.includes(a.reader)?{reader:a.reader}:{}}),a.reader&&!MI.includes(a.reader)&&r.push(`${t}: kind ${a.name} names link reader ${a.reader}, which this chant does not have (it has ${MI.join(", ")}); the kind is kept, and its members' links are only those their entries state`);for(let c of bwe(a.fields??{}))r.push(`${t}: kind ${a.name} ${c}`)}return{kinds:o,problems:r}}function ywe(e,t=BI){return A0(e,t)}function wwe(e,t){let n=WI(e,"package.json"),i;try{i=JSON.parse(GI(n,"utf-8"))}catch{return{kinds:[],problems:[`${t??e}: no readable package.json in ${e}`],file:void 0}}let r=t??(typeof i.name=="string"?i.name:e),o=ywe(i);if(o===void 0)return{kinds:[],problems:[],file:void 0};if(typeof o!="string")return{kinds:[],problems:[`${r}: ${o.problem}`],file:void 0};let s=cwe(e,o),a=awe(e,s);if(a.startsWith("..")||swe(a))return{kinds:[],problems:[`${r}: exports["${BI}"] points outside the package`],file:void 0};let c;try{c=GI(s,"utf-8")}catch{return{kinds:[],problems:[`${r}: exports["${BI}"] names ${o}, which does not exist`],file:s}}let l=hwe(c,r),u=typeof i.name=="string"?i.name:void 0;for(let d of l.kinds)d.packageDir=e,d.graph&&u!==_k(d.graph.lexicon)&&(l.problems.push(`${r}: kind ${d.name} reads its members with lexicon ${d.graph.lexicon}, which is ${_k(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 _k(e){return`@intentius/chant-lexicon-${e}`}function B4(e,t){let n=r=>r.replace(/\{(member|dir|workspace)\}/g,(o,s)=>t[s]),i=r=>typeof r=="string"?n(r):Array.isArray(r)?r.map(i):r!==null&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,s])=>[n(o),i(s)])):r;return i(e)}function zI(e,t){if(e.package){let n=Oa(e.package,t);if(!n)return{problem:`pinned package ${e.package} is not installed; install it to read the kinds it supplies`};let i;try{i=JSON.parse(GI(WI(n,"package.json"),"utf-8")).version}catch{i=void 0}return e.version&&i!==e.version?{problem:`${e.package} is pinned at ${e.version}, and ${String(i??"an unknown version")} is installed`}:{dir:n,source:e.package}}if(e.path){let n=WI(t,...e.path.split("/"));if(e.integrity){let i=Nq(n,e.integrity,e.path);if(!i.ok)return{problem:i.message}}return{dir:n,source:e.path}}return null}function La(e,t){let n=[],i=[],r=new Map,o=new Set;return e.forEach((s,a)=>{let c=zI(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=wwe(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){o.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),i.push(p)}}),{registry:M4(i.filter(s=>!o.has(s.name))),problems:n}}function U4(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 i;try{i=new RegExp(e.pattern,"u")}catch{return}if(!i.test(t))return`is ${JSON.stringify(t)}, which does not match ${e.pattern}`}}function bwe(e){let t=[],n=(i,r)=>{if(r.pattern!==void 0)try{new RegExp(r.pattern,"u")}catch{t.push(`declares field ${i} with pattern ${r.pattern}, which is not a regular expression`);return}if(r.default===void 0)return;let o=U4(r,r.default);o&&t.push(`declares field ${i} whose default ${o}`)};for(let[i,r]of Object.entries(e))if(r.type==="object")for(let[o,s]of Object.entries(r.properties))n(`${i}.${o}`,s);else n(i,r);return t}function HI(e,t){if(e===void 0)return{fields:null,problems:[]};let n=e.fields,i=[];if(n===void 0)return t!==null&&i.push({path:"",message:`kind ${e.name} declares no fields, and the entry sets ${Object.keys(t).join(", ")||"an empty fields block"}`}),{fields:null,problems:i};let r=t??{};for(let a of Object.keys(r))a in n||i.push({path:a,message:`kind ${e.name} declares no field ${a}; its fields are ${Object.keys(n).join(", ")}`});let o=(a,c,l)=>{if(l!==void 0){let u=U4(c,l);if(!u)return l;i.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]=o(a,c,r[a]);continue}let l=r[a],u={};l!==void 0&&(l!==null&&typeof l=="object"&&!Array.isArray(l)?u=l:i.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||i.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,o(`${a}/${d}`,p,u[d])]))}return{fields:s,problems:i}}var R2e,BI,MI,Tk,lwe,L4,uwe,pwe,fwe,Ck,Yi=v(()=>{"use strict";_q();on();Lq();Ed();kg();R2e=b0.$id,BI="./workspace-kinds",MI=["dbt-project"],Tk="examples",lwe="design",L4=[{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:"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:lwe,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:Tk,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"}],uwe=L4.map(e=>e.name);pwe=["chant.config.ts","chant.config.json"],fwe=4});function Rl(e){return String(e).replace(/~/g,"~0").replace(/\//g,"~1")}function Ma(e,t){let n=[0];for(let w=0;w<e.length;w++)e.charCodeAt(w)===10&&n.push(w+1);let i=w=>{let b=0,k=n.length-1;for(;b<k;){let $=b+k+1>>1;n[$]<=w?b=$:k=$-1}return{line:b+1,column:w-n[b]+1}},r=new Map,o=new Map,s=new Map,a=e.charCodeAt(0)===65279?1:0,c=(w,b=a)=>{throw new Ik(w,b)},l=w=>w>=e.length?"the end of the file":`${JSON.stringify(e[w])}`;function u(){for(;;){let w=e[a];if(w===" "||w===" "||w===`
73
73
  `||w==="\r")a++;else if(w==="/"&&(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]!==`
74
- `;)a++;else{let b=e.indexOf("*/",a+2);b<0&&c("unterminated /* comment"),a=b+2}else return}}function d(){let w=a;for(a++;;){a>=e.length&&c("unterminated string",w);let b=e.charCodeAt(a);if(b===34)break;b<32&&c("control character in a string; escape it",a),a+=b===92?2:1}a++;try{return JSON.parse(e.slice(w,a))}catch{return c("invalid escape in a string",w)}}function p(w){u(),r.set(w,a);let b=f(w);return o.set(w,a),b}function f(w){let b=e[a];if(b==="{")return g(w);if(b==="[")return h(w);if(b==='"')return d();for(let[$,x]of[["true",!0],["false",!1],["null",null]])if(e.startsWith($,a))return a+=$.length,x;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 g(w){let b={},k=new Set;if(a++,u(),e[a]==="}")return a++,b;for(;;){u(),e[a]!=='"'&&c(`expected a quoted key, found ${l(a)}`);let $=a,x=d();k.has(x)&&c(`duplicate key ${JSON.stringify(x)}`,$),k.add(x);let R=`${w}/${Rl(x)}`;if(s.set(R,$),u(),e[a]!==":"&&c(`expected ":" after key ${JSON.stringify(x)}, found ${l(a)}`),a++,Object.defineProperty(b,x,{value:p(R),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++,b;continue}if(e[a]==="}")return a++,b;c(`expected "," or "}", found ${l(a)}`)}}function h(w){let b=[];if(a++,u(),e[a]==="]")return a++,b;for(;;){if(b.push(p(`${w}/${b.length}`)),u(),e[a]===","){if(a++,u(),e[a]==="]")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,b;continue}if(e[a]==="]")return a++,b;c(`expected "," or "]", found ${l(a)}`)}}try{u(),a>=e.length&&c("the file is empty");let w=p("");return u(),a<e.length&&c(`unexpected ${l(a)} after the value`),{ok:!0,value:w,locate(b,k){if(k&&s.has(b))return i(s.get(b));for(let $=b;;$=$.slice(0,$.lastIndexOf("/"))){let x=r.get($);if(x!==void 0)return i(x);if($==="")return i(0)}},span(b){let k=r.get(b),$=o.get(b);if(!(k===void 0||$===void 0))return{key:s.get(b)??null,start:k,end:$}}}}catch(w){if(!(w instanceof Ik))throw w;return{ok:!1,message:w.message,location:i(w.offset)}}}var Ik,Hd=v(()=>{"use strict";Ik=class extends Error{constructor(n,i){super(n);this.offset=i}}});function z4(){return"0.124.43"}var H4=v(()=>{"use strict"});function qd(e=process.env){let t=e.CI?.trim().toLowerCase();return t&&t!=="false"&&t!=="0"?"ledger":void 0}function Dk(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Sl(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 i=typeof e=="string"?{name:e}:e;if(i===null||typeof i!="object"||Array.isArray(i))return[...n,"`point` is a decision point's name or { name, inputs?, pass?, store? }"];let{name:r,inputs:o,pass:s,store:a,...c}=i;if((typeof r!="string"||!vwe.test(r))&&n.push("`point.name` is a decision point's name: lower case letters, digits and hyphens, starting with a letter"),o!==void 0&&(o===null||typeof o!="object"||Array.isArray(o))&&n.push("`point.inputs` is an object of input name to value"),o&&typeof o=="object"){let u=Object.keys(o).filter(d=>d in xg);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 El(e,t,n,i={}){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[o,s]of Object.entries(xg))t.includes(o)&&n[s]!==null&&(r[o]=n[s]);return{...i,...r}}function $g(e,t,n){return`gate:${e}/${t}${n?`@${n}`:""}`}function jk(e){if(!e||!e.startsWith("gate:"))return;let t=e.slice(5),n=t.lastIndexOf("@"),i=n>0?t.slice(0,n):t,r=i.indexOf("/");if(!(r<=0||r===i.length-1))return{op:i.slice(0,r),gate:i.slice(r+1),...n>0?{env:t.slice(n+1)}:{}}}var Vd,vwe,xg,Cs=v(()=>{"use strict";Vd=[!0];vwe=/^[a-z][a-z0-9-]*$/;xg={"gate.component":"component","gate.name":"name","gate.env":"env","gate.planDigest":"planDigest"}});function wi(e){return e===void 0?[]:Array.isArray(e)?[...e]:[e]}function qI(e,t){let n=e.replace(/\\/g,"/").replace(/\/+$/,""),i="";for(let r=0;r<n.length;r++){let o=n[r];o==="*"&&n[r+1]==="*"?n[r+2]==="/"?(i+="(?:.*/)?",r+=2):(i+=".*",r+=1):o==="*"?i+="[^/]*":o==="?"?i+="[^/]":i+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${i}$`).test(t.replace(/\\/g,"/").replace(/\/+$/,""))}function Kd(e,t){return e.filter(n=>n.targets===void 0||n.targets.some(i=>t.some(r=>qI(i,r))))}function Rg(e){return e.reduce((t,n)=>Math.max(t,n.count),1)}function Fa(e,t,n){let i=Array.isArray(e)?e:[e],r=[];return Array.isArray(e)&&e.length===0&&r.push(`\`${t}\` must name at least one rule`),i.forEach((o,s)=>{let a=Array.isArray(e)?`${t}[${s}]`:t;if(typeof o!="object"||o===null||Array.isArray(o)){r.push(`\`${a}\` must be an object`);return}let c=o;(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 Lk(e,t){return Object.entries(t).filter(([,n])=>n.some(i=>_s(i,e))).map(([n])=>n).sort()}function Sg(e,t){let n=new Set,i=[];for(let s of[...t].sort((a,c)=>Date.parse(a.at)-Date.parse(c.at)))n.has(Nk(s.who))||e.roles?.length&&!(s.judged.proven&&s.judged.roles.some(a=>e.roles.includes(a)))||(n.add(Nk(s.who)),i.push(s));let r=!e.notAuthor||i.some(s=>s.judged.proven&&s.judged.author===!1),o=e.notAuthor===!0&&!r&&i.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:i.map(s=>s.who),met:i.length>=e.count&&r,...o?{authorUnknown:!0}:{}}}function Ga(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 i=e.count-e.approvers.length,r=[];i>0&&r.push(`${i} more${e.roles?.length?` from ${e.roles.join(" or ")}`:""}`),e.notAuthor&&r.push(i>0?"one of them not the author":"an approver who is not the author");let o=e.authorUnknown?" (the change's author is not known, so no approver can show they are someone else)":"";return`${t}: ${n}, needs ${r.join(", ")}${o}`}function Eg(e){return e.filter(t=>!t.met).map(Ga).join("; ")}function bi(e){return t=>{let n=t.seal!==void 0&&t.seal!==null&&Io(e.signers,t)===null,i=e.review!==void 0&&t.review?.head===e.review.head&&e.review.approvers.some(o=>_s(o,t.resolvedBy)),r=n||i;return{proven:r,roles:r?Lk(t.resolvedBy,e.roles):[],...e.authors!==void 0?{author:e.authors.some(o=>_s(o,t.resolvedBy))}:{}}}}var Ts,Nk,_s,Is,Qi=v(()=>{"use strict";Ss();Ts=()=>({proven:!1,roles:[]});Nk=e=>e.normalize("NFKC").trim().toLowerCase(),_s=(e,t)=>Nk(e)===Nk(t);Is=e=>(e.roles?.length??0)>0||e.notAuthor===!0});function VI(e,t,n){return(e??Mk).replaceAll("{gate}",t).replaceAll("{k}",String(n))}function KI(e,t,n,i){let r=[...e].sort((l,u)=>{let d=i(l),p=i(u);return d<p?-1:d>p?1:0}),o=Math.floor(r.length/n),s=r.length%n,a=(t-1)*o+Math.min(t-1,s),c=o+(t<=s?1:0);return r.slice(a,a+c)}var Mk,JI=v(()=>{"use strict";Mk="{gate}-wave-{k}"});function kwe(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Fk(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"timeout"in e){let{timeout:t,...n}=e,i=Sl(n);return(typeof t!="string"||!/^(\d+(ms|s|m|h|d))+$/.test(t))&&i.push('`point.timeout` is a duration such as "48h"'),i}return Sl(e)}function XI(e,t){let n=e.waves.find(i=>i.name===t);return kwe(n?.point??e.point)}function eD(e,t){return VI(e.gateName,e.gate??e.name,t)}function Wk(e,t){return`.chant/op-waves/${e.name}/wave-${t}.json`}function Pg(e){let t=`Op waves "${e.name}"`;if(!YI.test(e.name))throw new Error(`${t}: the name must be lowercase letters, digits, "-" and "_"`);if(!e.op)throw new Error(`${t} names no \`op\`. Name the Op a run runs when it names none.`);if(e.plan!==void 0&&e.planWave!==void 0)throw new Error(`${t} has both \`plan\` and \`planWave\`. A wave is planned one run at a time or all at once; give one.`);if(e.apply!==void 0&&e.applyWave!==void 0)throw new Error(`${t} has both \`apply\` and \`applyWave\`. A wave is applied one run at a time or all at once; give one.`);if(e.planWave!==void 0){if(Og(t,"planWave",e.planWave),!e.planWave.some(i=>i.includes("{plans}")))throw new Error(`${t}: the \`planWave\` command never names {plans}, the file it writes each run's plan digest to.`)}else{if(!Array.isArray(e.plan)||e.plan.length===0)throw new Error(`${t} has no \`plan\` command. Each wave plans its runs to bind its gate to their plan digests; give \`plan\` or \`planWave\`.`);if(Og(t,"plan",e.plan),!e.plan.some(i=>i.includes("{plan}")))throw new Error(`${t}: the \`plan\` command never names {plan}, the file it writes the plan digest to.`)}if(e.apply!==void 0&&Og(t,"apply",e.apply),e.applyWave!==void 0&&(Og(t,"applyWave",e.applyWave),!e.applyWave.some(i=>i.includes("{runs}"))))throw new Error(`${t}: the \`applyWave\` command never names {runs}, the file listing the approved runs it applies.`);if(Ol(t,e.hooks),e.waves.length===0)throw new Error(`${t} has no waves.`);if(e.resume!==void 0&&(typeof e.resume.schedule!="string"||e.resume.schedule.trim().split(/\s+/).length!==5))throw new Error(`${t}: resume.schedule must be a five-field cron expression, such as "*/10 * * * *".`);if(e.approvals!==void 0){let i=e.approvals;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`approvals\` must be { "spend"?: true | false, "quorum"?: [...] }.`);for(let[r,o]of Object.entries(i)){if(r==="quorum"){if(!Array.isArray(o))throw new Error(`${t}: approvals.quorum must be a list of rules, each { "targets"?, "count", "roles"?, "notAuthor"? }.`);let s=Fa(o,"approvals.quorum",{notAuthor:!0});if(s.length>0)throw new Error(`${t}: ${s.join("; ")}.`);continue}if(r!=="spend")throw new Error(`${t}: approvals.${r} is not a setting; the ones there are approvals.spend and approvals.quorum.`);if(typeof o!="boolean")throw new Error(`${t}: approvals.spend must be true or false.`)}if(i.quorum?.length&&(e.point!==void 0||e.waves.some(r=>r.point!==void 0)))throw new Error(`${t}: approvals.quorum and a decision point are both set; a gate that asks a point takes its deciders and quorum from the point, so drop one of them.`)}if(e.gateName!==void 0){if(typeof e.gateName!="string"||!e.gateName.includes("{k}")||/\s/.test(e.gateName))throw new Error(`${t}: gateName must be a pattern with {k}, the wave's number, and no spaces, such as "${V4}" or "wave-{k}".`);let i=e.gateName.replaceAll("{gate}","").replaceAll("{k}","").match(/\{[^}]*\}/);if(i)throw new Error(`${t}: gateName names ${i[0]}; the pattern fills in {gate} and {k} only.`)}if(e.digest!==void 0){let i=e.digest;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`digest\` must be { "over"?: "all" | "changing" }.`);for(let[r,o]of Object.entries(i)){if(r!=="over")throw new Error(`${t}: digest.${r} is not a setting; the one there is digest.over.`);if(!xwe.includes(o))throw new Error(`${t}: digest.over is ${JSON.stringify(o)}; use "all" or "changing".`)}}if(e.override!==void 0){let i=e.override;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`override\` must be { "overriders"?: "<file at base>" }.`);for(let[r,o]of Object.entries(i)){if(r!=="overriders")throw new Error(`${t}: override.${r} is not a setting; the one there is override.overriders.`);if(typeof o!="string"||o.trim()==="")throw new Error(`${t}: override.overriders must be a path, such as ".chant/overriders".`)}}if(e.point!==void 0){let i=Fk(e.point);if(i.length>0)throw new Error(`${t}: ${i.join("; ")}.`)}if(e.neverOverMcp!==void 0&&typeof e.neverOverMcp!="boolean")throw new Error(`${t}: neverOverMcp must be true or false.`);if(e.runner!==void 0&&QI(t,"runner",e.runner),e.notify!==void 0){let i=Mv(e.notify,"notify");if(i)throw new Error(`${t}: ${i}`)}let n=new Set;for(let i of e.waves){if(!YI.test(i.name))throw new Error(`${t}: wave "${i.name}" must be named with lowercase letters, digits, "-" and "_"`);if(n.has(i.name))throw new Error(`${t} names wave "${i.name}" twice.`);if(n.add(i.name),i.gate!==void 0&&!Ag.includes(i.gate))throw new Error(`${t}: wave "${i.name}" has gate "${i.gate}"; use ${Ag.join(", ")}.`);if(i.approval!==void 0&&!Wa.includes(i.approval))throw new Error(`${t}: wave "${i.name}" has approval "${i.approval}"; use ${Wa.join(", ")}.`);if(Ol(`${t}, wave "${i.name}"`,i.hooks),i.point!==void 0){let s=Fk(i.point);if(s.length>0)throw new Error(`${t}: wave "${i.name}": ${s.join("; ")}.`)}if(i.runner!==void 0&&QI(t,`wave "${i.name}" runner`,i.runner),i.idTokens!==void 0&&K4(t,`wave "${i.name}" idTokens`,i.idTokens),i.jobs!==void 0&&Rwe(t,i),i.discover!==void 0&&typeof i.discover!="boolean")throw new Error(`${t}: wave "${i.name}" has discover ${JSON.stringify(i.discover)}; use true or false.`);if(i.rest!==void 0&&typeof i.rest!="boolean")throw new Error(`${t}: wave "${i.name}" has rest ${JSON.stringify(i.rest)}; use true or false.`);if(i.discover){if(e.planWave===void 0)throw new Error(`${t}: wave "${i.name}" discovers its runs, which only \`planWave\` can report. Give planWave.`);if((i.runs??[]).length>0)throw new Error(`${t}: wave "${i.name}" discovers its runs, so it lists none.`)}if(i.rest){if(!i.discover)throw new Error(`${t}: wave "${i.name}" has rest, which follows the waves planWave discovers; set discover too.`);if(i!==e.waves[e.waves.length-1])throw new Error(`${t}: wave "${i.name}" has rest, which only the last wave can have.`);if((i.shares??1)>1)throw new Error(`${t}: wave "${i.name}" has rest and shares; the waves after it run in its one job, so it cannot be split.`)}if(i.discover){let s=i.shares??1;if(!Number.isInteger(s)||s<1)throw new Error(`${t}: wave "${i.name}" has shares ${i.shares}; use a whole number from 1.`);continue}if(!Array.isArray(i.runs)||i.runs.length===0)throw new Error(`${t}: wave "${i.name}" has no runs.`);let r=new Set;for(let s of i.runs){if(!s.target)throw new Error(`${t}: wave "${i.name}" has a run with no target.`);if(r.has(s.target))throw new Error(`${t}: wave "${i.name}" names target "${s.target}" twice.`);r.add(s.target)}let o=i.shares??1;if(!Number.isInteger(o)||o<1)throw new Error(`${t}: wave "${i.name}" has shares ${i.shares}; use a whole number from 1.`);if(o>i.runs.length)throw new Error(`${t}: wave "${i.name}" has ${o} shares for ${i.runs.length} runs, so a share would apply nothing.`);if(i.jobs!==void 0){let s=iD(i,i.runs.map(a=>a.target));if(s)throw new Error(`${t}: ${s}.`)}}}function QI(e,t,n){let i=r=>Array.isArray(r)&&r.length>0&&r.every(o=>typeof o=="string"&&o.trim()!=="");if(!(typeof n=="string"&&n.trim()!=="")&&!i(n)){if(n!==null&&typeof n=="object"&&!Array.isArray(n)){let{group:r,labels:o,...s}=n,a=Object.keys(s)[0];if(a!==void 0)throw new Error(`${e}: ${t}.${a} is not a setting; a runner group is { "group": "<name>", "labels"?: [...] }.`);if(typeof r=="string"&&r.trim()!==""&&(o===void 0||i(o)))return}throw new Error(`${e}: ${t} must be a runner label, a non-empty list of labels, or { "group": "<name>", "labels"?: [...] } (GitHub only).`)}}function K4(e,t,n){if(n===null||typeof n!="object"||Array.isArray(n)||Object.keys(n).length===0)throw new Error(`${e}: ${t} must be { "<variable>": "<audience>" }, with at least one token.`);for(let[i,r]of Object.entries(n)){if(!$we.test(i))throw new Error(`${e}: ${t} names "${i}", which is not a variable name (letters, digits and "_", not starting with a digit).`);if(typeof r!="string"||r.trim()==="")throw new Error(`${e}: ${t}.${i} must be an audience, a non-empty string.`)}}function Rwe(e,t){let n=`wave "${t.name}"`;if(!Array.isArray(t.jobs)||t.jobs.length===0)throw new Error(`${e}: ${n} jobs must be a non-empty list of job groups.`);if((t.shares??1)>1)throw new Error(`${e}: ${n} has jobs and shares; split each job group with its own shares.`);if(t.rest)throw new Error(`${e}: ${n} has jobs and rest; the waves after it run in its one job, so its apply cannot be split into groups.`);let i=new Set;t.jobs.forEach((r,o)=>{if(r===null||typeof r!="object")throw new Error(`${e}: ${n} jobs[${o}] must be { "name", "runs", ... }.`);let s=`${n} jobs[${o}]${typeof r.name=="string"?` (${r.name})`:""}`;if(typeof r.name!="string"||!YI.test(r.name))throw new Error(`${e}: ${s} must be named with lowercase letters, digits, "-" and "_".`);if(r.name==="decide"||/^share-\d+$/.test(r.name))throw new Error(`${e}: ${s} is named like the wave's own jobs (decide, share-<i>); name it another way.`);if(i.has(r.name))throw new Error(`${e}: ${n} names job group "${r.name}" twice.`);i.add(r.name);let a=new Set(["name","runs","shares","runner","environment","variables","setup","idTokens"]),c=Object.keys(r).find(u=>!a.has(u));if(c!==void 0)throw new Error(`${e}: ${s}.${c} is not a setting; a job group takes ${[...a].join(", ")}.`);if(!Array.isArray(r.runs)||r.runs.length===0||!r.runs.every(u=>typeof u=="string"&&u.trim()!==""))throw new Error(`${e}: ${s} runs must be a non-empty list of targets or patterns.`);let l=r.shares??1;if(!Number.isInteger(l)||l<1)throw new Error(`${e}: ${s} has shares ${r.shares}; use a whole number from 1.`);if(r.runner!==void 0&&QI(e,`${s} runner`,r.runner),r.idTokens!==void 0&&K4(e,`${s} idTokens`,r.idTokens),r.variables!==void 0&&(r.variables===null||typeof r.variables!="object"||Array.isArray(r.variables)||!Object.values(r.variables).every(u=>typeof u=="string")))throw new Error(`${e}: ${s} variables must be { "<name>": "<value>" }.`);if(r.setup!==void 0&&!Array.isArray(r.setup))throw new Error(`${e}: ${s} setup must be a list of steps.`);if(r.environment!==void 0&&(r.environment===null||typeof r.environment!="object"||typeof r.environment.name!="string"))throw new Error(`${e}: ${s} environment must be { "name", "url"? }.`)})}function nD(e,t){if(!e.includes("*"))return e===t;let n="";for(let i=0;i<e.length;i++){let r=e[i];r==="*"&&e[i+1]==="*"?(n+=".*",i++):r==="*"?n+="[^/]*":n+=r.replace(/[.+?^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${n}$`).test(t)}function rD(e,t){return e.targets?t.filter(n=>e.targets.some(i=>nD(i,n.target))):[...t]}function J4(e,t){return t.filter(n=>e.runs.some(i=>nD(i,n.target)))}function iD(e,t){for(let n of t){let i=(e.jobs??[]).filter(r=>r.runs.some(o=>nD(o,n))).map(r=>`"${r.name}"`);if(i.length>1)return`wave "${e.name}" jobs: run "${n}" is in job groups ${i.join(" and ")}; each run is in exactly one`;if(i.length===0)return`wave "${e.name}" jobs: run "${n}" is in no job group; each run is in exactly one`}}function Og(e,t,n){if(!Array.isArray(n)||n.length===0||!n.every(i=>typeof i=="string")||n[0]==="")throw new Error(`${e}: \`${t}\` must be a command as argv, a non-empty array of strings.`)}function Ol(e,t){if(t!==void 0){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e}: \`hooks\` must be { "before"?: { "observe"?, "plan"?, "apply"? }, "after"?: { "plan"?, "gate"?, "apply"? } }.`);for(let[n,i]of Object.entries(t)){if(n==="apply"){let r=i?.runBy;if(i===null||typeof i!="object"||Array.isArray(i)||Object.keys(i).some(o=>o!=="runBy"))throw new Error(`${e}: hooks.apply must be { "runBy"?: "chant" | "apply" }.`);if(r!==void 0&&!ZI.includes(r))throw new Error(`${e}: hooks.apply.runBy is ${JSON.stringify(r)}; use ${ZI.map(o=>`"${o}"`).join(" or ")}.`);continue}if(n!=="before"&&n!=="after")throw new Error(`${e}: hooks.${n} is not a moment; use hooks.before or hooks.after (or hooks.apply.runBy).`);if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${e}: hooks.${n} must be { "plan"?: [...], "apply"?: [...] }.`);for(let[r,o]of Object.entries(i)){let s=`hooks.${n}.${r}`;if(r==="gate"&&n==="before")throw new Error(`${e}: ${s} is not a moment; a hook runs after the gate (hooks.after.gate), or before the plan or the apply.`);if(r==="observe"&&n==="after")throw new Error(`${e}: ${s} is not a moment; a hook runs before the observe (hooks.before.observe), or after the plan, which reads what the observe saw.`);if(r!=="observe"&&r!=="plan"&&r!=="apply"&&r!=="gate")throw new Error(`${e}: ${s} is not a stage; a hook runs before the observe, before or after plan or apply, or after the gate.`);if(!Array.isArray(o))throw new Error(`${e}: ${s} must be a list of hooks.`);o.forEach((a,c)=>{let l=`${s}[${c}]${a&&typeof a=="object"&&typeof a.name=="string"?` (${a.name})`:""}`;if(!a||typeof a!="object")throw new Error(`${e}: ${l} must be { "command": [...], "onFailure"?, "perRun"? }.`);if(Og(e,`${l}.command`,a.command),a.onFailure!==void 0&&!q4.includes(a.onFailure))throw new Error(`${e}: ${l} has onFailure "${a.onFailure}"; use ${q4.join(" or ")}.`);if(a.onFailure==="approve"&&n==="after"&&r==="apply")throw new Error(`${e}: ${l} has onFailure "approve", but after the apply there is nothing left to hold. Use "fail".`);if(a.onFailure==="approve"&&r==="gate")throw new Error(`${e}: ${l} has onFailure "approve", but the gate has already decided when it runs. Use "fail", or hold the wave from an after.plan hook.`);if(a.perRun!==void 0&&typeof a.perRun!="boolean")throw new Error(`${e}: ${l}.perRun must be true or false.`);if(a.targets!==void 0&&(!Array.isArray(a.targets)||a.targets.length===0||!a.targets.every(u=>typeof u=="string"&&u!=="")))throw new Error(`${e}: ${l}.targets must be a non-empty list of targets or patterns, such as ["prod/*"].`);if(a.perRun){if(n==="before"&&(r==="plan"||r==="observe")&&a.command.some(u=>u.includes("{plan}")))throw new Error(`${e}: ${l} runs before the plan, so it has no {plan} yet.`)}else{let u=a.command.find(d=>d.includes("{target}")||d.includes("{plan}"));if(u)throw new Error(`${e}: ${l} runs once for the wave, so it has no {target} or {plan} ("${u}"). Set "perRun": true, or read the runs from {runs}.`)}})}}}}function oD(e,t){if(Ol(e,t),t?.after?.gate!==void 0)throw new Error(`${e}: hooks.after.gate runs in an Op waves job only; a pull-request job runs hooks before the observe, before and after the plan, and before and after the apply.`);if(t?.apply!==void 0)throw new Error(`${e}: hooks.apply.runBy is for an Op waves spec; chant runs a pull request's apply, so it runs the apply-stage hooks itself.`)}function Bk(e,t){let n=e.waves.find(r=>r.name===t),i=(r,o)=>{let[s,a]=o.split("-");return r?.[s]?.[a]??[]};return Object.fromEntries(Gk.map(r=>[r,[...i(e.hooks,r),...i(n?.hooks,r)]]))}function Uk(e,t){return e.waves.find(i=>i.name===t)?.hooks?.apply?.runBy??e.hooks?.apply?.runBy??"chant"}function sD(e,t,n){return KI(e,t,n,i=>i.target)}var Ag,Wa,q4,Gk,ZI,xwe,V4,tD,YI,$we,Ba=v(()=>{"use strict";Cs();Qi();Fv();JI();Fv();Ag=["always","on-destructive","never"],Wa=["ledger","pr-review","sealed"];q4=["fail","approve"],Gk=["before-observe","before-plan","after-plan","after-gate","before-apply","after-apply"],ZI=["chant","apply"],xwe=["all","changing"],V4=Mk;tD=["chant","run","{op}","--env","{target}"];YI=/^[a-z0-9][a-z0-9_-]*$/;$we=/^[A-Za-z_][A-Za-z0-9_]*$/});function Y4(e,t){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be { engine?, path?, namespace?, command? }`);for(let[n,i]of Object.entries(t))if(n==="engine"){if(!Z4.includes(i))throw new Error(`${e}.engine must be ${Z4.join(" or ")}, the result shape the command prints`)}else if(n==="path"||n==="namespace"){if(typeof i!="string"||i.trim()==="")throw new Error(`${e}.${n} must be a non-empty string`);if(n==="path"&&(i.startsWith("/")||i.split("/").includes("..")))throw new Error(`${e}.path must be a directory inside the workspace, relative to its declaration`)}else if(n==="command"){if(!Array.isArray(i)||i.length===0||!i.every(r=>typeof r=="string"&&r!==""))throw new Error(`${e}.command must be argv, a non-empty list of strings`);if(!i.some(r=>r.includes("{input}")))throw new Error(`${e}.command must pass the input file as {input}`)}else throw n==="outcomes"||n==="allow_unattended"||n==="allowUnattended"?new Error(`${e}.${n}: chant's policy step denies and holds only; a non-empty plan always waits for a person (ws-104), so there is no unattended outcome`):new Error(`${e}.${n} is not a setting; the settings are engine, path, namespace and command`)}var Z4,Q4=v(()=>{"use strict";Z4=["conftest","opa"]});var pD={};Te(pD,{CHANT_PACKAGE:()=>Zd,DECLARATION_FILES:()=>Jd,DECLARATION_SCHEMA_ID:()=>Swe,DECLARATION_SCHEMA_VERSION:()=>Ewe,DEFAULT_CI_WINDOW:()=>i6,DEFAULT_PR_ENVIRONMENT_TTL:()=>o6,DEFAULT_PUBLISH_BRANCH_PREFIX:()=>l6,DEFAULT_REPLICATE_REMOTE:()=>c6,DEFAULT_SHIP_ENV:()=>a6,DEFAULT_SHIP_GATE:()=>s6,DEFAULT_STATE_ROOT:()=>u6,DIAGRAM_TOOLS:()=>Cwe,FACTORY_CHECK_KINDS:()=>_we,NAME_PATTERN:()=>Owe,PRINCIPAL_CLASSES:()=>Awe,REPLICATE_REF_CLASSES:()=>aD,REPLICATE_TRIGGERS:()=>cD,RESERVED_NAMES:()=>r6,WORKSPACE_ERROR_CODES:()=>vi,WRITE_VERBS:()=>Pwe,WorkspaceReadError:()=>be,boxServicesProblem:()=>h6,compareVersions:()=>d6,declaredDiagrams:()=>uD,declaredRecordKinds:()=>yr,extensionsAt:()=>Cg,findDeclarationDir:()=>dD,isInside:()=>Nr,ownerOf:()=>y6,parseDeclaration:()=>f6,pinnedChant:()=>Hk,readDeclaration:()=>_t,readerVersion:()=>en,resolveGroups:()=>Ua,rootExclusions:()=>qk});function en(){return X4??=z4(),X4}function d6(e,t){let n=lD.exec(e),i=lD.exec(t);if(!n||!i)throw new Error(`not a version: ${n?t:e}`);for(let r=1;r<=3;r++){let o=Number(n[r])-Number(i[r]);if(o!==0)return o}return n[4]===i[4]?0:n[4]===void 0?1:i[4]===void 0||n[4]<i[4]?-1:1}function Twe(){if(zk)return zk;let e=Na();return zk=new e({allErrors:!0,strict:!0}).compile(m0),zk}function Iwe(e,t){let n=/#\/\$defs\/([A-Za-z]+)\//.exec(e.schemaPath)?.[1];if(e.keyword==="pattern"){let i=JSON.stringify(t);return n==="name"&&typeof t=="string"&&r6.includes(t)?`${i} is reserved; pick another name`:n==="name"?`${i} is not a valid name: use lowercase letters, digits and hyphens, starting with a letter or digit, at most 40 characters`:n==="kindName"?`${i} is not a valid kind or role name`:n==="dir"?`${i} is not a directory inside the workspace: use a relative path with / separators, and no . or .. segments`:n==="path"?`${i} is not a path inside the member or workspace: use a relative path with / separators, and no . or .. segments`:n==="glob"?`${i} is not a glob inside the workspace: use a relative pattern with / separators, and no . or .. segments`:n==="version"?`${i} is not a version such as 1.2.3`:`${i} is not allowed here`}if(e.keyword==="additionalProperties")return`unknown field ${JSON.stringify(e.params.additionalProperty)}; only fields named x-... may be added`;if(e.keyword==="required"){let i=String(e.params.missingProperty);return i==="because"&&e.instancePath.endsWith("/handWritten")?'a hand-written generated file needs "because", saying why it is kept by hand':i==="because"?'a member of kind other needs "because", saying why it is there':`missing required field ${JSON.stringify(i)}`}return e.keyword==="const"&&e.instancePath==="/schema"?"schema must be 1, the only declaration format this chant reads":e.message??"is invalid"}function p6(e,t){let n=e;for(let i of t.split("/").slice(1)){let r=i.replace(/~1/g,"/").replace(/~0/g,"~");if(n===null||typeof n!="object")return;n=n[r]}return n}function Hk(e){if(!Array.isArray(e.pins))return;let t=e.pins.findIndex(n=>n!==null&&typeof n=="object"&&n.package===Zd&&typeof n.version=="string");return t<0?void 0:{version:e.pins[t].version,index:t}}function f6(e,t,n=en(),i={}){let r=Ma(e,{jsonc:t.endsWith(".jsonc")});if(!r.ok)throw new be("declaration-unparseable",r.message,{file:t,...r.location});let o=(A,I=!1)=>({file:t,...r.locate(A,I)}),s=r.value;if(s===null||typeof s!="object"||Array.isArray(s))throw new be("declaration-invalid","the declaration must be a JSON object",o(""));let a=s,c=i.rootChant?Hk(a):void 0;if(c&&c.version!==n)throw new be("root-chant-required",`this declaration pins ${Zd} ${c.version}, and this is chant ${n}; the root's chant reads it, so install ${Zd}@${c.version} at the workspace root`,o(`/pins/${c.index}/version`));if(typeof a.minReader=="string"&&lD.test(a.minReader)&&d6(n,a.minReader)<0)throw new be("reader-too-old",`this declaration needs chant ${a.minReader} or newer to read it, and this is chant ${n}`,o("/minReader"));let l=Twe();if(!l(s)){let A=(l.errors??[]).filter(he=>!Dwe.has(he.keyword));A.sort((he,Ee)=>Ee.instancePath.split("/").length-he.instancePath.split("/").length);let I=A[0]??l.errors[0],P=I.keyword==="additionalProperties",G=P?`${I.instancePath}/${Rl(String(I.params.additionalProperty))}`:I.instancePath,xe=I.instancePath===""?"":` (at ${I.instancePath})`,te=A.length>1?`; ${A.length-1} more problem${A.length>2?"s":""} after this one`:"";throw new be("declaration-invalid",`${Iwe(I,p6(s,I.instancePath))}${xe}${te}`,o(G,P))}let u=a.members.map((A,I)=>{let P=`/members/${I}`,G=(A.suppress??[]).map(oe=>({check:oe.check,because:oe.because}));if(A.kind===Tk){let oe=A.glob;return{type:"group",name:A.name,kind:Tk,globs:typeof oe=="string"?[oe]:[...oe],suppress:G,pointer:P,globLocation:r.locate(`${P}/glob`)}}let xe=(A.roles??[]).map(oe=>typeof oe=="string"?{name:oe,path:null}:{name:oe.name,path:oe.path??null}),te=(A.generated??[]).map((oe,ge)=>({path:oe.path,generator:oe.generator,sources:[...oe.sources??[]],handWritten:oe.handWritten?{because:oe.handWritten.because}:null,pointer:`${P}/generated/${ge}`})),he=(A.links??[]).map((oe,ge)=>({member:oe.member,output:oe.output,kind:oe.kind??null,protocol:oe.protocol??null,pointer:`${P}/links/${ge}`})),Ee=t6(A.records,A.dir,A.name,`${P}/records`),ht=n6(A.diagrams,A.name,`${P}/diagrams`),ce=zwe(A.box,`${P}/box`);return{type:"member",name:A.name,dir:A.dir,kind:A.kind,roles:xe,generated:te,outputs:A.outputs===void 0?null:[...A.outputs],fields:A.fields===void 0?null:structuredClone(A.fields),links:he,records:Ee,diagrams:ht,box:ce,upstream:A.upstream??null,because:A.because??null,travel:A.travel===!0,security:[...A.security??[]],ciWorkflow:A.ci?.workflow??null,ciHooks:g6(A.ci?.hooks,`${P}/ci/hooks`,o),suppress:G,pointer:P}}),d=new Map;for(let A of u){let I=d.get(A.name);if(I)throw new be("declaration-invalid",`the name ${JSON.stringify(A.name)} is already used by the entry at ${I.pointer}`,o(`${A.pointer}/name`));d.set(A.name,A)}let p=u.filter(A=>A.type==="member"),f=new Map;for(let A of p){let I=f.get(A.dir);if(I)throw new be("placement-invalid",`member ${A.name} has the same directory as member ${I.name} (${A.dir})`,o(`${A.pointer}/dir`));f.set(A.dir,A)}for(let A of p){let I=p.find(P=>P!==A&&P.dir!=="."&&Nr(A.dir,P.dir));if(I)throw new be("placement-invalid",`member ${A.name} (${A.dir}) sits inside member ${I.name} (${I.dir}); only the root member "." may contain other members`,o(`${A.pointer}/dir`))}for(let A of p){let I=new Map;for(let P of A.generated){let G=I.get(P.path);if(G)throw new be("declaration-invalid",`member ${A.name} lists the generated file ${P.path} twice; the first is at ${G.pointer}`,o(`${P.pointer}/path`));I.set(P.path,P);let xe=A.dir==="."?P.path:`${A.dir}/${P.path}`,te=p.find(he=>he!==A&&he.dir!=="."&&Nr(he.dir,A.dir)&&Nr(xe,he.dir));if(te)throw new be("placement-invalid",`member ${A.name} lists the generated file ${P.path}, which sits inside member ${te.name} (${te.dir}); list it there`,o(`${P.pointer}/path`))}}let g=t6(a.records,".",null,"/records"),h=new Map,w=new Map;for(let A of[...g,...p.flatMap(I=>I.records)]){let I=h.get(A.path);if(I)throw new be("declaration-invalid",`the record kind ${A.path} is already declared at ${I.pointer}`,o(`${A.pointer}/kind`));if(h.set(A.path,A),A.name===null)continue;let P=w.get(A.name);if(P)throw new be("declaration-invalid",`the record kind name ${JSON.stringify(A.name)} is already given at ${P.pointer}`,o(`${A.pointer}/name`));w.set(A.name,A)}for(let A of p){let I=new Map;for(let G of A.box?.capabilities??[]){let xe=I.get(G.name);if(xe)throw new be("declaration-invalid",`member ${A.name}'s box lists the capability ${G.name} twice; the first is at ${xe.pointer}`,o(`${G.pointer}/name`));I.set(G.name,G)}let P=A.box?h6(A.name,A.box.services):null;if(P)throw new be("declaration-invalid",P.message,o(P.pointer))}let b=Hwe(p);if(b)throw new be("declaration-invalid",b.message,o(b.pointer));let k=p.filter(A=>A.box?.replicate);if(k.length>1)throw new be("declaration-invalid",`members ${k[0].name} and ${k[1].name} both declare replicate in their box block; a checkout's work in progress goes to one remote, so a workspace has one replicate policy`,o(k[1].box.replicate.pointer));let $=n6(a.diagrams,null,"/diagrams"),x=new Map;for(let A of[...$,...p.flatMap(I=>I.diagrams)]){let I=x.get(A.name);if(I)throw new be("declaration-invalid",`the diagram name ${JSON.stringify(A.name)} is already used by the diagram at ${I.pointer}`,o(`${A.pointer}/name`));x.set(A.name,A)}let R=Kwe(a,p,o),O=jwe(a.writeScope,p,o),D=Bwe(a.agents,p,o),_=qwe(p,D);if(_)throw new be("declaration-invalid",_.message,o(_.pointer));let M=Wwe(a.ci,o),[T]=xq(M?.branches,p.map(A=>A.name));if(T)throw new be("declaration-invalid",`ci.branches routes member ${T.member} to both ${T.branches.join(" and ")}; a member applies from one branch`,o(`/ci/branches/${Rl(T.branches[1])}`));let ne=(a.pins??[]).map(A=>({package:A.package??null,version:A.version??null,path:A.path??null,integrity:A.integrity??null})),X={name:a.name,schema:a.schema,minReader:a.minReader??null,entries:u,members:p,groups:u.filter(A=>A.type==="group"),pins:ne,checks:{...a.checks??{}},quorum:typeof a.quorum=="number"?a.quorum:null,records:g,diagrams:$,hosts:R,changes:Uwe(a.changes),writeScope:O,agents:D,identity:Nwe(a.identity),ci:M,retention:Mwe(a.retention),metrics:Lwe(a.metrics),security:[...a.security??[]],file:t};return m6.set(X,s),X}function Cg(e,t){let n=p6(m6.get(e),t);return n===null||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([i])=>i.startsWith("x-")))}function jwe(e,t,n){if(e===void 0)return null;let i=e,r={};for(let[o,s]of Object.entries(i)){let a=`/writeScope/${o}`,c=s.members===void 0||s.members==="*"?null:[...s.members];for(let[d,p]of(c??[]).entries())if(!t.some(f=>f.name===p))throw new be("declaration-invalid",`writeScope.${o} names the member ${JSON.stringify(p)}, which the declaration does not declare; declared members: ${t.map(f=>f.name).join(", ")||"none"}`,n(`${a}/members/${d}`));let l=s.records===void 0?null:Object.fromEntries(Object.entries(s.records).map(([d,p])=>[d,[...p]])),u=(s.protected??[]).map(d=>typeof d=="string"?{path:d,except:[]}:{path:d.path,except:[...d.except??[]]});r[o]={members:c,records:l,protected:u,pointer:a}}return r}function Nwe(e){if(e===void 0)return null;let t=e,n={};for(let[i,r]of Object.entries(t.gates??{}))n[i]={gate:i,class:r.class??null,pointer:`/identity/gates/${i.replace(/~/g,"~0").replace(/\//g,"~1")}`};return{attribution:t.attribution??"any",gates:n}}function Lwe(e){if(!e||typeof e!="object")return null;let t=e.failureWindowDays;return typeof t=="number"?{failureWindowDays:t}:{}}function Mwe(e){if(!e||typeof e!="object")return null;let t={};for(let n of yq){let i=e[n];i&&(t[n]={...typeof i.days=="number"?{days:i.days}:{},...typeof i.keep=="number"?{keep:i.keep}:{}})}return t}function g6(e,t,n){if(e===void 0)return null;try{oD(t.slice(1).replace(/\//g,"."),e)}catch(i){throw new be("declaration-invalid",i instanceof Error?i.message:String(i),n(t))}return structuredClone(e)}function e6(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!t.startsWith("x-")).map(([t,n])=>[t,[...n]]))}function Fwe(e,t){if(e===void 0)return null;try{Y4("ci.policy",e)}catch(n){throw new be("declaration-invalid",n instanceof Error?n.message:String(n),t("/ci/policy"))}return structuredClone(e)}function Gwe(e,t){let n={};for(let r of Bv){let o=e[r];if(o===void 0)continue;let s=Object.fromEntries(Object.entries(o).filter(([c])=>!c.startsWith("x-"))),a=o.rules.map(c=>Object.fromEntries(Object.entries(c).filter(([l])=>!l.startsWith("x-")).map(([l,u])=>[l,Array.isArray(u)?[...u]:u])));n[r]={...s,rules:a}}let[i]=$q(n);if(i)throw new be("declaration-invalid",i.message,t(i.pointer));return n}function Wwe(e,t){if(e===void 0)return null;let n=e,i=g6(n.hooks,"/ci/hooks",t),r=Fwe(n.policy,t),o={...n.workflow!==void 0?{workflow:n.workflow}:{},...i?{hooks:i}:{},...n.branches!==void 0?{branches:e6(n.branches)}:{},...n.labels!==void 0?{labels:e6(n.labels)}:{},...n.locks!==void 0?{locks:n.locks}:{},...r?{policy:r}:{},...n.identity?.cloud!==void 0?{identity:{cloud:Gwe(n.identity.cloud,t)}}:{},...n.prEnvironment!==void 0?{prEnvironment:{template:n.prEnvironment.template,ttl:n.prEnvironment.ttl??o6}}:{}},s=null;if(n.reportUrl!==void 0){let l=wq(n.reportUrl,"ci.reportUrl");if("error"in l)throw new be("declaration-invalid",l.error,t("/ci/reportUrl"));s=l.url}if(n.green===void 0)return{green:null,...o,reportUrl:s};let a=n.green,c=Object.entries(a.phases).map(([l,u])=>({name:l,runs:[...Array.isArray(u)?u:u.runs],skipped:Array.isArray(u)?"fail":u.skipped??"fail",...!Array.isArray(u)&&u.build!==void 0?{build:u.build}:{},pointer:`/ci/green/phases/${Rl(l)}`}));for(let[l,u]of a.require.entries())if(!c.some(d=>d.name===u))throw new be("declaration-invalid",`ci.green.require names the phase ${JSON.stringify(u)}, which ci.green.phases does not declare; declared phases: ${c.map(d=>d.name).join(", ")}`,t(`/ci/green/require/${l}`));for(let[l,u]of(a.preMerge??[]).entries())if(!c.some(d=>d.name===u))throw new be("declaration-invalid",`ci.green.preMerge names the phase ${JSON.stringify(u)}, which ci.green.phases does not declare; declared phases: ${c.map(d=>d.name).join(", ")}`,t(`/ci/green/preMerge/${l}`));return{green:{branch:a.branch,window:a.window??i6,phases:c,require:[...a.require],...a.preMerge!==void 0?{preMerge:[...a.preMerge]}:{},signedSince:a.signedSince??null,source:a.source??"checks",pointer:"/ci/green"},...o,reportUrl:s}}function Bwe(e,t,n){let i=(e??[]).map((s,a)=>{let c=s.members!==void 0?[...s.members]:[s.member];return{name:s.name,members:c,member:c[0],principals:[...s.principals??[]],pointer:`/agents/${a}`,listed:s.members!==void 0}}),r=new Map,o=new Map;for(let{listed:s,...a}of i){let c=r.get(a.name);if(c)throw new be("declaration-invalid",`the agent name ${JSON.stringify(a.name)} is already used by the agent at ${c.pointer}`,n(`${a.pointer}/name`));r.set(a.name,a);for(let[l,u]of a.members.entries())if(!t.some(d=>d.name===u))throw new be("declaration-invalid",`agent ${a.name} is bound to ${JSON.stringify(u)}, which is not a declared member; an agent session is bound to members, not an example group`,n(s?`${a.pointer}/members/${l}`:`${a.pointer}/member`));for(let[l,u]of a.principals.entries()){let d=o.get(u);if(d)throw new be("declaration-invalid",`the principal ${JSON.stringify(u)} is already listed by agent ${d.name}`,n(`${a.pointer}/principals/${l}`));o.set(u,a)}}return[...r.values()]}function Uwe(e){return e===void 0?null:{severity:e.severity??"warn",ignore:[...e.ignore??[]]}}function t6(e,t,n,i){return(e??[]).map((r,o)=>({kind:r.kind,path:t==="."?r.kind:`${t}/${r.kind}`,name:r.name??null,member:n,pointer:`${i}/${o}`}))}function n6(e,t,n){return(e??[]).map((i,r)=>({name:i.name,title:i.title,source:i.source??null,render:i.render??null,renderer:{tool:i.renderer.tool,version:i.renderer.version,args:[...i.renderer.args??[]]},sourceHash:i.sourceHash??null,member:t,pointer:`${n}/${r}`}))}function zwe(e,t){if(e===void 0)return null;let n=e,i=n.factory,r=n.listing,o=n.replicate;return{capabilities:(n.capabilities??[]).map((s,a)=>({name:s.name,broker:s.broker??null,scope:[...s.scope??[]],pointer:`${t}/capabilities/${a}`})),isolation:n.host===void 0?null:{host:n.host,slot:n.slot,ports:{...n.ports??{}},state:{...n.state??{}},cookies:[...n.cookies??[]]},intent:n.intent??null,services:(n.services??[]).map((s,a)=>({name:s.name,cmd:s.cmd,needs:[...s.needs??[]],httpPort:s.httpPort??null,duration:s.duration??null,health:s.health??null,optional:s.optional??!1,pointer:`${t}/services/${a}`})),factory:i===void 0?null:{builds:[...i.builds],check:i.check===void 0?null:typeof i.check=="string"?{run:i.check,kind:"test"}:{run:i.check.run,kind:i.check.kind??"test"},checks:i.checks??null,builders:i.builders??null,tiers:(i.tiers??[]).map(s=>({tier:s.tier,agent:s.agent,kinds:s.kinds===void 0?null:[...s.kinds],session:s.session??null})),publish:i.publish===void 0?null:{forge:i.publish.forge??"github",repo:i.publish.repo,base:i.publish.base??null,branchPrefix:i.publish.branchPrefix??l6,head:i.publish.head??null},pointer:`${t}/factory`},listing:r===void 0?null:{published:r.published??!0,title:r.title??"",line:r.line??"",cover:r.cover??null},publisher:n.publisher??null,ship:n.ship===void 0?null:{op:n.ship.op,gate:n.ship.gate??s6,env:n.ship.env??a6,bookkeeping:(n.ship.bookkeeping??[]).map(s=>s.replace(/^\.\//,"").replace(/\/+$/,"")),pointer:`${t}/ship`},replicate:o===void 0?null:{remote:o.remote??c6,refs:aD.filter(s=>(o.refs??aD).includes(s)),on:cD.filter(s=>(o.on??cD).includes(s)),every:o.every??null,pointer:`${t}/replicate`},pointer:t}}function Hwe(e){let t=e.filter(s=>s.box?.factory);if(t.length>1)return{message:`members ${t[0].name} and ${t[1].name} both declare a factory in their box block; a workspace has one factory, so an orchestrator reads one`,pointer:t[1].box.factory.pointer};let n=t[0]?.box?.factory;if(!n)return null;let i=()=>e.map(s=>s.name).join(", "),r=n.builds.findIndex(s=>!e.some(a=>a.name===s));if(r>=0)return{message:`the factory builds ${JSON.stringify(n.builds[r])}, which is not a declared member; declared members: ${i()}`,pointer:`${n.pointer}/builds/${r}`};if(n.builders!==null&&!e.some(s=>s.name===n.builders))return{message:`the factory's builders names ${JSON.stringify(n.builders)}, which is not a declared member; declared members: ${i()}`,pointer:`${n.pointer}/builders`};if(n.tiers.length>0&&n.builders===null)return{message:"the factory declares tiers and no builders; tiers name agents the builders member declares, so name it",pointer:`${n.pointer}/tiers`};let o=new Map;for(let[s,a]of n.tiers.entries())for(let c of a.kinds??[null]){let l=`${a.tier}\0${c??""}`,u=o.get(l);if(u!==void 0){let d=c===null?"with no kinds":`for kind ${c}`;return{message:`tiers/${u} and tiers/${s} both name a builder at tier ${a.tier} ${d}; a tier has one builder per kind, so one entry answers it`,pointer:`${n.pointer}/tiers/${s}`}}o.set(l,s)}return null}function qwe(e,t){let n=e.find(i=>i.box?.factory)?.box?.factory;if(!n)return null;for(let[i,r]of n.tiers.entries())if(r.session!==null&&!t.some(o=>o.name===r.session)){let o=t.map(s=>s.name).join(", ")||"none";return{message:`tiers/${i} names the session ${JSON.stringify(r.session)}, which is not a declared agent session; declared sessions: ${o}`,pointer:`${n.pointer}/tiers/${i}/session`}}return null}function h6(e,t){let n=new Map;for(let o of t){let s=n.get(o.name);if(s)return{message:`member ${e}'s box declares the service ${o.name} twice; the first is at ${s.pointer}`,pointer:`${o.pointer}/name`};n.set(o.name,o)}let i;for(let o of t)if(o.httpPort!==null){if(i)return{message:`member ${e}'s box gives both ${i.name} (port ${i.httpPort}) and ${o.name} (port ${o.httpPort}) an httpPort, and the supervisor routes the sprite's URL to one service`,pointer:`${o.pointer}/httpPort`};i=o}for(let o of t){let s=o.needs.findIndex(a=>!n.has(a));if(s>=0){let a=t.map(c=>c.name).join(", ");return{message:`member ${e}'s box service ${o.name} needs ${JSON.stringify(o.needs[s])}, which the block does not declare; declared services: ${a}`,pointer:`${o.pointer}/needs/${s}`}}}let r=Vwe(t);if(r){let o=n.get(r[0]);return{message:`member ${e}'s box services need each other in a cycle: ${r.join(" -> ")}`,pointer:`${o.pointer}/needs`}}return null}function Vwe(e){let t=new Map(e.map(r=>[r.name,r])),n=new Map,i=(r,o)=>{let s=n.get(r);if(s==="done")return null;if(s==="visiting")return[...o.slice(o.indexOf(r)),r];n.set(r,"visiting");for(let a of t.get(r)?.needs??[]){let c=i(a,[...o,r]);if(c)return c}return n.set(r,"done"),null};for(let r of e){let o=i(r.name,[]);if(o)return o}return null}function Kwe(e,t,n){let i=(e.hosts??[]).map((s,a)=>({name:s.name,ports:{...s.ports},stateRoot:s.stateRoot??null,pointer:`/hosts/${a}`})),r=(s,a)=>new be("declaration-invalid",s,n(a)),o=new Map;for(let s of i){let a=o.get(s.name);if(a)throw r(`the host name ${JSON.stringify(s.name)} is already used by the host at ${a.pointer}`,`${s.pointer}/name`);if(o.set(s.name,s),s.ports.from>s.ports.to)throw r(`host ${s.name}'s port range starts at ${s.ports.from}, after its end ${s.ports.to}`,`${s.pointer}/ports`)}for(let s of t){let a=s.box?.isolation;if(!a)continue;let c=s.box.pointer,l=o.get(a.host);if(!l){let g=i.map(h=>h.name).join(", ")||"none are declared";throw r(`member ${s.name}'s box names the host ${JSON.stringify(a.host)}, which hosts does not declare; declared hosts: ${g}`,`${c}/host`)}let{from:u,to:d,perBox:p}=l.ports,f=u+(a.slot+1)*p-1;if(f>d){let g=Math.floor((d-u+1)/p);throw r(`member ${s.name}'s box has slot ${a.slot} on host ${l.name}, which needs ports ${u+a.slot*p} to ${f}, past the end of the host's range (${d}); the range holds ${g} slot${g===1?"":"s"}`,`${c}/slot`)}for(let[g,h]of Object.entries(a.ports))if(h>=p)throw r(`member ${s.name}'s box gives port ${g} offset ${h}, and host ${l.name} gives each box ${p} port${p===1?"":"s"} (offsets 0 to ${p-1})`,`${c}/ports/${Rl(g)}`)}return i}function yr(e){return[...e.records,...e.members.flatMap(t=>t.records)]}function uD(e){return[...e.diagrams,...e.members.flatMap(t=>t.diagrams)]}function Nr(e,t){return t==="."?!0:e===t||e.startsWith(`${t}/`)}function _t(e,t="",n={}){let i=Jd.map(r=>Ve(t,r)).filter(r=>e.stat(r)==="file");if(i.length===0)throw new be("declaration-missing",`no ${Jd.join(" or ")} in ${t||"the workspace root"}${e.label}`);if(i.length>1)throw new be("declaration-ambiguous",`both ${i.join(" and ")} exist${e.label}; keep one of them`,{file:i[1],line:1,column:1});return f6(e.read(i[0]),i[0],en(),n)}function dD(e,t){for(let n=t;;n=n.includes("/")?n.slice(0,n.lastIndexOf("/")):""){if(Jd.some(i=>e.stat(Ve(n,i))==="file"))return n;if(n==="")return}}function Ua(e,t){let n=o=>({file:e.file,...o.globLocation}),i=new Map,r=[];for(let o of e.groups){let s=[...new Set(o.globs.flatMap(l=>Pq(t,l)))].sort(),a=[],c=[];for(let l of s){if(!UI(t,l)){c.push(l);continue}let u=p=>new be("placement-invalid",`group ${o.name} matches ${l}, ${p}`,n(o));for(let p of e.members)if(p.dir!=="."){if(p.dir===l)throw u(`which is member ${p.name}'s directory; a match is never a member`);if(Nr(p.dir,l))throw u(`which contains member ${p.name} (${p.dir})`);if(p.kind==="workspace"&&Nr(l,p.dir))throw u(`which sits inside the nested workspace ${p.name}; that workspace declares its own examples`)}let d=i.get(l);if(d)throw u(`which group ${d.name} also matches`);i.set(l,o),a.push(l)}r.push({group:o,matches:a,skipped:c})}return r}function y6(e,t,n){for(let r of t){let o=r.matches.find(s=>Nr(n,s));if(o)return{group:r.group,match:o}}let i;for(let r of e.members)Nr(n,r.dir)&&(!i||i.dir==="."||r.dir!=="."&&r.dir.length>i.dir.length)&&(i=r);return i?{member:i}:void 0}function qk(e,t){let n=[];for(let i of e.members)i.dir!=="."&&n.push({dir:i.dir,owner:i.name});for(let i of t)for(let r of i.matches)e.members.some(o=>o.dir!=="."&&Nr(r,o.dir))||n.push({dir:r,owner:i.group.name});return n.sort((i,r)=>i.dir<r.dir?-1:i.dir>r.dir?1:0)}var Swe,Jd,Ewe,r6,Owe,vi,be,Awe,Pwe,i6,o6,Cwe,s6,a6,aD,cD,c6,_we,l6,u6,Zd,X4,lD,zk,Dwe,m6,Tt=v(()=>{"use strict";f0();bq();vq();g0();Rq();Cq();Yi();Hd();on();kg();H4();Ba();Q4();Swe=m0.$id,Jd=["chant.workspace.json","chant.workspace.jsonc"],Ewe=1,r6=["_workspace","_members"],Owe=/^[a-z0-9][a-z0-9-]{0,39}$/,vi=["declaration-missing","declaration-ambiguous","declaration-unparseable","declaration-invalid","placement-invalid","reader-too-old","root-chant-required","not-a-git-repository","revision-unknown"],be=class extends Error{constructor(n,i,r){super(i);this.code=n;this.location=r;this.name="WorkspaceReadError"}describe(){let n=this.location;return n?`${n.file}:${n.line}:${n.column}: ${this.message}`:this.message}},Awe=["human","agent","runner","service"],Pwe=["new","amend","review","close"],i6="24h",o6="72h",Cwe=["d2","mermaid","graphviz","excalidraw"],s6="ship",a6="box",aD=["work","kept","wip","ledger"],cD=["save","release"],c6="origin",_we=["test","build","lint","plan","conformance"],l6="chant/work/",u6="${XDG_STATE_HOME}/chant/boxes",Zd="@intentius/chant";lD=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?$/;Dwe=new Set(["if","then","else","oneOf","anyOf"]);m6=new WeakMap});var v6={};Te(v6,{MEMBERS_DIR:()=>Jk,MEMBER_LEDGER_FLOOR:()=>tbe,MemberLedgerError:()=>Kk,clearMemberLedgerCache:()=>nbe,memberLedgerPrefix:()=>Zk,resolveMemberLedger:()=>Qr});import{existsSync as Jwe}from"node:fs";import{dirname as Zwe,join as Ywe,relative as Qwe,resolve as Xwe,sep as ebe}from"node:path";function Zk(e){return e.map(t=>`${Jk}/${t}/`).join("")}function Qr(e){let t=Xwe(e),n=Vk.get(t);return n||(n=ibe(t),Vk.set(t,n),n.catch(()=>Vk.delete(t))),n}function nbe(){Vk.clear()}function rbe(e,t){let n=Qwe(e,t);return n===""?"":n.split(ebe).join("/")}async function ibe(e){let t=tr(e);return t?b6(t.dir,e):w6}async function b6(e,t){let{readDeclaration:n,resolveGroups:i,ownerOf:r,WorkspaceReadError:o}=await Promise.resolve().then(()=>(Tt(),pD)),{workingTree:s}=await Promise.resolve().then(()=>(on(),w0)),a;try{let d=s(e),p=n(d),f=r(p,i(p,d),rbe(e,t));a=f&&"member"in f&&f.member.dir!=="."?[f.member.name]:[]}catch(d){throw d instanceof o?new Kk(`cannot place this project's lifecycle ledger: ${d.describe()}. A project inside a workspace writes under ${Jk}/<member>/ on chant/lifecycle, and chant does not guess the member. Fix the declaration and retry.`):d}let c=w6,l=Zwe(e);if(l!==e&&!Jwe(Ywe(e,".git"))){let d=tr(l);d&&(c=await b6(d.dir,e))}let u=[...c.members,...a];return{members:u,prefix:Zk(u)}}var Jk,tbe,w6,Kk,Vk,Mo=v(()=>{"use strict";Bi();Jk="_members",tbe="0.81.0",w6={members:[],prefix:""};Kk=class extends Error{constructor(t){super(t),this.name="MemberLedgerError"}},Vk=new Map});function _g(e){return e===Yd}var Yd,Tg=v(()=>{"use strict";Yd="recorded locally (no remote for chant/lifecycle)"});function Xi(e=process.env){let t=e[Yk]?.trim().toLowerCase();return t!==void 0&&t!==""&&t!=="0"&&t!=="false"}function Ig(e){return fD.get(e)?.tip}function k6(e,t,n,i){let r=fD.get(e)??{tip:null,writes:[]};r.tip=t;for(let o of n)r.writes.push({path:o,message:i});fD.set(e,r)}function Qk(e,t){if(Xi())throw new mD(e,t)}var Yk,gD,fD,mD,Qd=v(()=>{"use strict";Yk="CHANT_NO_RECORD";gD="not recorded (--no-record): chant/lifecycle was not written or pushed",fD=new Map;mD=class extends Error{constructor(n,i){super(`gate "${i}" of "${n}" cannot be passed under --no-record: a gate is decided and approved on chant/lifecycle, which this run does not write. Run without --no-record (and without CHANT_NO_RECORD) to stop at the gate for approval.`);this.op=n;this.gate=i;this.name="GateNotRecordableError"}}});var RD={};Te(RD,{LifecycleLedgerUnreadableError:()=>jg,RefCASConflictError:()=>Ot,StaleLifecycleBranchError:()=>Dg,StaleLockError:()=>Al,appendLedgerLine:()=>C6,appendReleaseRecordLine:()=>wD,deleteRefCAS:()=>tp,describeLifecyclePush:()=>kD,fetchLifecycle:()=>fbe,fetchLifecycleStatus:()=>no,fetchRef:()=>ybe,fetchRefInto:()=>j6,fetchRefIntoStatus:()=>tx,getHeadCommit:()=>nx,getRemoteLifecycleBranchSha:()=>_6,gitLedgerReadPort:()=>bbe,ledgerDir:()=>qn,ledgerRevision:()=>np,listFilesInDir:()=>to,listLedgerEnvironments:()=>vD,listLedgerTrees:()=>Ng,listSnapshots:()=>pbe,pushLifecycle:()=>Xd,pushLifecycleReport:()=>Ha,pushLifecycleStatus:()=>za,pushRef:()=>hbe,pushRefStatus:()=>Lg,readBlobBySha:()=>hn,readBlobFromPath:()=>At,readEnvironmentSnapshots:()=>dbe,readPathSha:()=>gn,readRefSha:()=>qa,readReleaseLedgerLines:()=>bD,readSnapshot:()=>P6,readSnapshotAt:()=>ube,requireLifecycleLedger:()=>Lr,snapshotStorageKey:()=>O6,updateRefCAS:()=>ep,writeBlob:()=>xD,writeBlobToPath:()=>mn,writeLedgerFiles:()=>eo,writeSnapshot:()=>A6});async function qn(e,t){return`${await obe(t)}${e}`}async function obe(e){return e?.ledgerPrefix!==void 0?e.ledgerPrefix:e?.member!==void 0?Zk((typeof e.member=="string"?[e.member]:[...e.member]).filter(t=>t!==".")):(await Qr(e?.cwd??process.cwd())).prefix}async function cbe(e){let t=bt();if((await t.spawn(["git","var","GIT_COMMITTER_IDENT"],{cwd:e,env:ki})).exitCode===0)return[];let i=[];for(let[r,o,s]of[["user.name","CHANT_LIFECYCLE_COMMITTER_NAME",sbe],["user.email","CHANT_LIFECYCLE_COMMITTER_EMAIL",abe]]){let a=await t.spawn(["git","config","--get",r],{cwd:e,env:ki});a.exitCode===0&&a.stdout.trim()!==""||i.push("-c",`${r}=${process.env[o]?.trim()||s}`)}return i}function hD(e,t,n){return new Error(`cannot write ${t} on the ${Nt} branch: ${e} failed: ${(n??"").trim()}`)}async function mn(e,t,n,i,r){let o=await qn(e,r);return eo([{path:`${o}/${t}`,content:n,...r?.expectPriorPathSha!==void 0?{expectPriorSha:r.expectPriorPathSha}:{}}],i,r)}async function eo(e,t,n){let i=bt(),r=n?.cwd;if(e.length===0)throw new Error("writeLedgerFiles needs at least one file");let o=e[0].path;for(let u of e){let d=u.path.split("/");if(d.length<2||d.some(p=>p===""))throw new Error(`cannot write ${u.path} on the ${Nt} branch: a ledger path is <dir>/<file>`)}let s=[];for(let u of e){if(lbe(u)){s.push({path:u.path,sha:null});continue}let d=await i.spawn(["git","hash-object","-w","--stdin"],{cwd:r,stdin:u.content});if(d.exitCode!==0)throw hD("git hash-object",u.path,d.stderr);s.push({path:u.path,sha:d.stdout.trim()})}let a=await cbe(r);await Pl(r)===null&&await Lr({...r?{cwd:r}:{}});let c=new Map(e.map(u=>[u.path,u.expectPriorSha])),l;for(let u=1;u<=E6;u++){let d=await Pl(r);if(n?.expectTip!==void 0&&d!==n.expectTip)throw new Ot(`refs/heads/${Nt}`,n.expectTip,`the branch moved to ${d??"(none)"} since it was read`);let p=new Map,f=async x=>{let R=p.get(x);return R||(R=d?await wbe(d,x,r):new Map,p.set(x,R)),R};for(let x of s){let{dir:R,name:O}=$6(x.path),D=(await f(R)).get(O),_=D?.type==="blob"?D.sha:null,M=c.get(x.path);if(M!==void 0&&_!==M)throw l??new Ot(`refs/heads/${Nt}`,M,"target path changed concurrently");c.set(x.path,_)}for(let x of s){let{dir:R,name:O}=$6(x.path);x.sha===null?(await f(R)).delete(O):(await f(R)).set(O,{mode:"100644",type:"blob",sha:x.sha});for(let D=R;D!=="";D=ex(D))await f(ex(D))}let g=[...p.keys()].sort((x,R)=>S6(R)-S6(x)||(x<R?-1:1)),h="";for(let x of g){if(x!==""&&p.get(x).size===0){p.get(ex(x)).delete(R6(x));continue}let R=[...p.get(x)].map(([_,M])=>`${M.mode} ${M.type} ${M.sha} ${_}`).join(`
74
+ `;)a++;else{let b=e.indexOf("*/",a+2);b<0&&c("unterminated /* comment"),a=b+2}else return}}function d(){let w=a;for(a++;;){a>=e.length&&c("unterminated string",w);let b=e.charCodeAt(a);if(b===34)break;b<32&&c("control character in a string; escape it",a),a+=b===92?2:1}a++;try{return JSON.parse(e.slice(w,a))}catch{return c("invalid escape in a string",w)}}function p(w){u(),r.set(w,a);let b=f(w);return o.set(w,a),b}function f(w){let b=e[a];if(b==="{")return g(w);if(b==="[")return h(w);if(b==='"')return d();for(let[$,x]of[["true",!0],["false",!1],["null",null]])if(e.startsWith($,a))return a+=$.length,x;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 g(w){let b={},k=new Set;if(a++,u(),e[a]==="}")return a++,b;for(;;){u(),e[a]!=='"'&&c(`expected a quoted key, found ${l(a)}`);let $=a,x=d();k.has(x)&&c(`duplicate key ${JSON.stringify(x)}`,$),k.add(x);let R=`${w}/${Rl(x)}`;if(s.set(R,$),u(),e[a]!==":"&&c(`expected ":" after key ${JSON.stringify(x)}, found ${l(a)}`),a++,Object.defineProperty(b,x,{value:p(R),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++,b;continue}if(e[a]==="}")return a++,b;c(`expected "," or "}", found ${l(a)}`)}}function h(w){let b=[];if(a++,u(),e[a]==="]")return a++,b;for(;;){if(b.push(p(`${w}/${b.length}`)),u(),e[a]===","){if(a++,u(),e[a]==="]")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,b;continue}if(e[a]==="]")return a++,b;c(`expected "," or "]", found ${l(a)}`)}}try{u(),a>=e.length&&c("the file is empty");let w=p("");return u(),a<e.length&&c(`unexpected ${l(a)} after the value`),{ok:!0,value:w,locate(b,k){if(k&&s.has(b))return i(s.get(b));for(let $=b;;$=$.slice(0,$.lastIndexOf("/"))){let x=r.get($);if(x!==void 0)return i(x);if($==="")return i(0)}},span(b){let k=r.get(b),$=o.get(b);if(!(k===void 0||$===void 0))return{key:s.get(b)??null,start:k,end:$}}}}catch(w){if(!(w instanceof Ik))throw w;return{ok:!1,message:w.message,location:i(w.offset)}}}var Ik,Hd=v(()=>{"use strict";Ik=class extends Error{constructor(n,i){super(n);this.offset=i}}});function z4(){return"0.124.44"}var H4=v(()=>{"use strict"});function qd(e=process.env){let t=e.CI?.trim().toLowerCase();return t&&t!=="false"&&t!=="0"?"ledger":void 0}function Dk(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Sl(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 i=typeof e=="string"?{name:e}:e;if(i===null||typeof i!="object"||Array.isArray(i))return[...n,"`point` is a decision point's name or { name, inputs?, pass?, store? }"];let{name:r,inputs:o,pass:s,store:a,...c}=i;if((typeof r!="string"||!vwe.test(r))&&n.push("`point.name` is a decision point's name: lower case letters, digits and hyphens, starting with a letter"),o!==void 0&&(o===null||typeof o!="object"||Array.isArray(o))&&n.push("`point.inputs` is an object of input name to value"),o&&typeof o=="object"){let u=Object.keys(o).filter(d=>d in xg);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 El(e,t,n,i={}){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[o,s]of Object.entries(xg))t.includes(o)&&n[s]!==null&&(r[o]=n[s]);return{...i,...r}}function $g(e,t,n){return`gate:${e}/${t}${n?`@${n}`:""}`}function jk(e){if(!e||!e.startsWith("gate:"))return;let t=e.slice(5),n=t.lastIndexOf("@"),i=n>0?t.slice(0,n):t,r=i.indexOf("/");if(!(r<=0||r===i.length-1))return{op:i.slice(0,r),gate:i.slice(r+1),...n>0?{env:t.slice(n+1)}:{}}}var Vd,vwe,xg,Cs=v(()=>{"use strict";Vd=[!0];vwe=/^[a-z][a-z0-9-]*$/;xg={"gate.component":"component","gate.name":"name","gate.env":"env","gate.planDigest":"planDigest"}});function wi(e){return e===void 0?[]:Array.isArray(e)?[...e]:[e]}function qI(e,t){let n=e.replace(/\\/g,"/").replace(/\/+$/,""),i="";for(let r=0;r<n.length;r++){let o=n[r];o==="*"&&n[r+1]==="*"?n[r+2]==="/"?(i+="(?:.*/)?",r+=2):(i+=".*",r+=1):o==="*"?i+="[^/]*":o==="?"?i+="[^/]":i+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${i}$`).test(t.replace(/\\/g,"/").replace(/\/+$/,""))}function Kd(e,t){return e.filter(n=>n.targets===void 0||n.targets.some(i=>t.some(r=>qI(i,r))))}function Rg(e){return e.reduce((t,n)=>Math.max(t,n.count),1)}function Fa(e,t,n){let i=Array.isArray(e)?e:[e],r=[];return Array.isArray(e)&&e.length===0&&r.push(`\`${t}\` must name at least one rule`),i.forEach((o,s)=>{let a=Array.isArray(e)?`${t}[${s}]`:t;if(typeof o!="object"||o===null||Array.isArray(o)){r.push(`\`${a}\` must be an object`);return}let c=o;(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 Lk(e,t){return Object.entries(t).filter(([,n])=>n.some(i=>_s(i,e))).map(([n])=>n).sort()}function Sg(e,t){let n=new Set,i=[];for(let s of[...t].sort((a,c)=>Date.parse(a.at)-Date.parse(c.at)))n.has(Nk(s.who))||e.roles?.length&&!(s.judged.proven&&s.judged.roles.some(a=>e.roles.includes(a)))||(n.add(Nk(s.who)),i.push(s));let r=!e.notAuthor||i.some(s=>s.judged.proven&&s.judged.author===!1),o=e.notAuthor===!0&&!r&&i.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:i.map(s=>s.who),met:i.length>=e.count&&r,...o?{authorUnknown:!0}:{}}}function Ga(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 i=e.count-e.approvers.length,r=[];i>0&&r.push(`${i} more${e.roles?.length?` from ${e.roles.join(" or ")}`:""}`),e.notAuthor&&r.push(i>0?"one of them not the author":"an approver who is not the author");let o=e.authorUnknown?" (the change's author is not known, so no approver can show they are someone else)":"";return`${t}: ${n}, needs ${r.join(", ")}${o}`}function Eg(e){return e.filter(t=>!t.met).map(Ga).join("; ")}function bi(e){return t=>{let n=t.seal!==void 0&&t.seal!==null&&Io(e.signers,t)===null,i=e.review!==void 0&&t.review?.head===e.review.head&&e.review.approvers.some(o=>_s(o,t.resolvedBy)),r=n||i;return{proven:r,roles:r?Lk(t.resolvedBy,e.roles):[],...e.authors!==void 0?{author:e.authors.some(o=>_s(o,t.resolvedBy))}:{}}}}var Ts,Nk,_s,Is,Qi=v(()=>{"use strict";Ss();Ts=()=>({proven:!1,roles:[]});Nk=e=>e.normalize("NFKC").trim().toLowerCase(),_s=(e,t)=>Nk(e)===Nk(t);Is=e=>(e.roles?.length??0)>0||e.notAuthor===!0});function VI(e,t,n){return(e??Mk).replaceAll("{gate}",t).replaceAll("{k}",String(n))}function KI(e,t,n,i){let r=[...e].sort((l,u)=>{let d=i(l),p=i(u);return d<p?-1:d>p?1:0}),o=Math.floor(r.length/n),s=r.length%n,a=(t-1)*o+Math.min(t-1,s),c=o+(t<=s?1:0);return r.slice(a,a+c)}var Mk,JI=v(()=>{"use strict";Mk="{gate}-wave-{k}"});function kwe(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Fk(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"timeout"in e){let{timeout:t,...n}=e,i=Sl(n);return(typeof t!="string"||!/^(\d+(ms|s|m|h|d))+$/.test(t))&&i.push('`point.timeout` is a duration such as "48h"'),i}return Sl(e)}function XI(e,t){let n=e.waves.find(i=>i.name===t);return kwe(n?.point??e.point)}function eD(e,t){return VI(e.gateName,e.gate??e.name,t)}function Wk(e,t){return`.chant/op-waves/${e.name}/wave-${t}.json`}function Pg(e){let t=`Op waves "${e.name}"`;if(!YI.test(e.name))throw new Error(`${t}: the name must be lowercase letters, digits, "-" and "_"`);if(!e.op)throw new Error(`${t} names no \`op\`. Name the Op a run runs when it names none.`);if(e.plan!==void 0&&e.planWave!==void 0)throw new Error(`${t} has both \`plan\` and \`planWave\`. A wave is planned one run at a time or all at once; give one.`);if(e.apply!==void 0&&e.applyWave!==void 0)throw new Error(`${t} has both \`apply\` and \`applyWave\`. A wave is applied one run at a time or all at once; give one.`);if(e.planWave!==void 0){if(Og(t,"planWave",e.planWave),!e.planWave.some(i=>i.includes("{plans}")))throw new Error(`${t}: the \`planWave\` command never names {plans}, the file it writes each run's plan digest to.`)}else{if(!Array.isArray(e.plan)||e.plan.length===0)throw new Error(`${t} has no \`plan\` command. Each wave plans its runs to bind its gate to their plan digests; give \`plan\` or \`planWave\`.`);if(Og(t,"plan",e.plan),!e.plan.some(i=>i.includes("{plan}")))throw new Error(`${t}: the \`plan\` command never names {plan}, the file it writes the plan digest to.`)}if(e.apply!==void 0&&Og(t,"apply",e.apply),e.applyWave!==void 0&&(Og(t,"applyWave",e.applyWave),!e.applyWave.some(i=>i.includes("{runs}"))))throw new Error(`${t}: the \`applyWave\` command never names {runs}, the file listing the approved runs it applies.`);if(Ol(t,e.hooks),e.waves.length===0)throw new Error(`${t} has no waves.`);if(e.resume!==void 0&&(typeof e.resume.schedule!="string"||e.resume.schedule.trim().split(/\s+/).length!==5))throw new Error(`${t}: resume.schedule must be a five-field cron expression, such as "*/10 * * * *".`);if(e.approvals!==void 0){let i=e.approvals;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`approvals\` must be { "spend"?: true | false, "quorum"?: [...] }.`);for(let[r,o]of Object.entries(i)){if(r==="quorum"){if(!Array.isArray(o))throw new Error(`${t}: approvals.quorum must be a list of rules, each { "targets"?, "count", "roles"?, "notAuthor"? }.`);let s=Fa(o,"approvals.quorum",{notAuthor:!0});if(s.length>0)throw new Error(`${t}: ${s.join("; ")}.`);continue}if(r!=="spend")throw new Error(`${t}: approvals.${r} is not a setting; the ones there are approvals.spend and approvals.quorum.`);if(typeof o!="boolean")throw new Error(`${t}: approvals.spend must be true or false.`)}if(i.quorum?.length&&(e.point!==void 0||e.waves.some(r=>r.point!==void 0)))throw new Error(`${t}: approvals.quorum and a decision point are both set; a gate that asks a point takes its deciders and quorum from the point, so drop one of them.`)}if(e.gateName!==void 0){if(typeof e.gateName!="string"||!e.gateName.includes("{k}")||/\s/.test(e.gateName))throw new Error(`${t}: gateName must be a pattern with {k}, the wave's number, and no spaces, such as "${V4}" or "wave-{k}".`);let i=e.gateName.replaceAll("{gate}","").replaceAll("{k}","").match(/\{[^}]*\}/);if(i)throw new Error(`${t}: gateName names ${i[0]}; the pattern fills in {gate} and {k} only.`)}if(e.digest!==void 0){let i=e.digest;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`digest\` must be { "over"?: "all" | "changing" }.`);for(let[r,o]of Object.entries(i)){if(r!=="over")throw new Error(`${t}: digest.${r} is not a setting; the one there is digest.over.`);if(!xwe.includes(o))throw new Error(`${t}: digest.over is ${JSON.stringify(o)}; use "all" or "changing".`)}}if(e.override!==void 0){let i=e.override;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`override\` must be { "overriders"?: "<file at base>" }.`);for(let[r,o]of Object.entries(i)){if(r!=="overriders")throw new Error(`${t}: override.${r} is not a setting; the one there is override.overriders.`);if(typeof o!="string"||o.trim()==="")throw new Error(`${t}: override.overriders must be a path, such as ".chant/overriders".`)}}if(e.point!==void 0){let i=Fk(e.point);if(i.length>0)throw new Error(`${t}: ${i.join("; ")}.`)}if(e.neverOverMcp!==void 0&&typeof e.neverOverMcp!="boolean")throw new Error(`${t}: neverOverMcp must be true or false.`);if(e.runner!==void 0&&QI(t,"runner",e.runner),e.notify!==void 0){let i=Mv(e.notify,"notify");if(i)throw new Error(`${t}: ${i}`)}let n=new Set;for(let i of e.waves){if(!YI.test(i.name))throw new Error(`${t}: wave "${i.name}" must be named with lowercase letters, digits, "-" and "_"`);if(n.has(i.name))throw new Error(`${t} names wave "${i.name}" twice.`);if(n.add(i.name),i.gate!==void 0&&!Ag.includes(i.gate))throw new Error(`${t}: wave "${i.name}" has gate "${i.gate}"; use ${Ag.join(", ")}.`);if(i.approval!==void 0&&!Wa.includes(i.approval))throw new Error(`${t}: wave "${i.name}" has approval "${i.approval}"; use ${Wa.join(", ")}.`);if(Ol(`${t}, wave "${i.name}"`,i.hooks),i.point!==void 0){let s=Fk(i.point);if(s.length>0)throw new Error(`${t}: wave "${i.name}": ${s.join("; ")}.`)}if(i.runner!==void 0&&QI(t,`wave "${i.name}" runner`,i.runner),i.idTokens!==void 0&&K4(t,`wave "${i.name}" idTokens`,i.idTokens),i.jobs!==void 0&&Rwe(t,i),i.discover!==void 0&&typeof i.discover!="boolean")throw new Error(`${t}: wave "${i.name}" has discover ${JSON.stringify(i.discover)}; use true or false.`);if(i.rest!==void 0&&typeof i.rest!="boolean")throw new Error(`${t}: wave "${i.name}" has rest ${JSON.stringify(i.rest)}; use true or false.`);if(i.discover){if(e.planWave===void 0)throw new Error(`${t}: wave "${i.name}" discovers its runs, which only \`planWave\` can report. Give planWave.`);if((i.runs??[]).length>0)throw new Error(`${t}: wave "${i.name}" discovers its runs, so it lists none.`)}if(i.rest){if(!i.discover)throw new Error(`${t}: wave "${i.name}" has rest, which follows the waves planWave discovers; set discover too.`);if(i!==e.waves[e.waves.length-1])throw new Error(`${t}: wave "${i.name}" has rest, which only the last wave can have.`);if((i.shares??1)>1)throw new Error(`${t}: wave "${i.name}" has rest and shares; the waves after it run in its one job, so it cannot be split.`)}if(i.discover){let s=i.shares??1;if(!Number.isInteger(s)||s<1)throw new Error(`${t}: wave "${i.name}" has shares ${i.shares}; use a whole number from 1.`);continue}if(!Array.isArray(i.runs)||i.runs.length===0)throw new Error(`${t}: wave "${i.name}" has no runs.`);let r=new Set;for(let s of i.runs){if(!s.target)throw new Error(`${t}: wave "${i.name}" has a run with no target.`);if(r.has(s.target))throw new Error(`${t}: wave "${i.name}" names target "${s.target}" twice.`);r.add(s.target)}let o=i.shares??1;if(!Number.isInteger(o)||o<1)throw new Error(`${t}: wave "${i.name}" has shares ${i.shares}; use a whole number from 1.`);if(o>i.runs.length)throw new Error(`${t}: wave "${i.name}" has ${o} shares for ${i.runs.length} runs, so a share would apply nothing.`);if(i.jobs!==void 0){let s=iD(i,i.runs.map(a=>a.target));if(s)throw new Error(`${t}: ${s}.`)}}}function QI(e,t,n){let i=r=>Array.isArray(r)&&r.length>0&&r.every(o=>typeof o=="string"&&o.trim()!=="");if(!(typeof n=="string"&&n.trim()!=="")&&!i(n)){if(n!==null&&typeof n=="object"&&!Array.isArray(n)){let{group:r,labels:o,...s}=n,a=Object.keys(s)[0];if(a!==void 0)throw new Error(`${e}: ${t}.${a} is not a setting; a runner group is { "group": "<name>", "labels"?: [...] }.`);if(typeof r=="string"&&r.trim()!==""&&(o===void 0||i(o)))return}throw new Error(`${e}: ${t} must be a runner label, a non-empty list of labels, or { "group": "<name>", "labels"?: [...] } (GitHub only).`)}}function K4(e,t,n){if(n===null||typeof n!="object"||Array.isArray(n)||Object.keys(n).length===0)throw new Error(`${e}: ${t} must be { "<variable>": "<audience>" }, with at least one token.`);for(let[i,r]of Object.entries(n)){if(!$we.test(i))throw new Error(`${e}: ${t} names "${i}", which is not a variable name (letters, digits and "_", not starting with a digit).`);if(typeof r!="string"||r.trim()==="")throw new Error(`${e}: ${t}.${i} must be an audience, a non-empty string.`)}}function Rwe(e,t){let n=`wave "${t.name}"`;if(!Array.isArray(t.jobs)||t.jobs.length===0)throw new Error(`${e}: ${n} jobs must be a non-empty list of job groups.`);if((t.shares??1)>1)throw new Error(`${e}: ${n} has jobs and shares; split each job group with its own shares.`);if(t.rest)throw new Error(`${e}: ${n} has jobs and rest; the waves after it run in its one job, so its apply cannot be split into groups.`);let i=new Set;t.jobs.forEach((r,o)=>{if(r===null||typeof r!="object")throw new Error(`${e}: ${n} jobs[${o}] must be { "name", "runs", ... }.`);let s=`${n} jobs[${o}]${typeof r.name=="string"?` (${r.name})`:""}`;if(typeof r.name!="string"||!YI.test(r.name))throw new Error(`${e}: ${s} must be named with lowercase letters, digits, "-" and "_".`);if(r.name==="decide"||/^share-\d+$/.test(r.name))throw new Error(`${e}: ${s} is named like the wave's own jobs (decide, share-<i>); name it another way.`);if(i.has(r.name))throw new Error(`${e}: ${n} names job group "${r.name}" twice.`);i.add(r.name);let a=new Set(["name","runs","shares","runner","environment","variables","setup","idTokens"]),c=Object.keys(r).find(u=>!a.has(u));if(c!==void 0)throw new Error(`${e}: ${s}.${c} is not a setting; a job group takes ${[...a].join(", ")}.`);if(!Array.isArray(r.runs)||r.runs.length===0||!r.runs.every(u=>typeof u=="string"&&u.trim()!==""))throw new Error(`${e}: ${s} runs must be a non-empty list of targets or patterns.`);let l=r.shares??1;if(!Number.isInteger(l)||l<1)throw new Error(`${e}: ${s} has shares ${r.shares}; use a whole number from 1.`);if(r.runner!==void 0&&QI(e,`${s} runner`,r.runner),r.idTokens!==void 0&&K4(e,`${s} idTokens`,r.idTokens),r.variables!==void 0&&(r.variables===null||typeof r.variables!="object"||Array.isArray(r.variables)||!Object.values(r.variables).every(u=>typeof u=="string")))throw new Error(`${e}: ${s} variables must be { "<name>": "<value>" }.`);if(r.setup!==void 0&&!Array.isArray(r.setup))throw new Error(`${e}: ${s} setup must be a list of steps.`);if(r.environment!==void 0&&(r.environment===null||typeof r.environment!="object"||typeof r.environment.name!="string"))throw new Error(`${e}: ${s} environment must be { "name", "url"? }.`)})}function nD(e,t){if(!e.includes("*"))return e===t;let n="";for(let i=0;i<e.length;i++){let r=e[i];r==="*"&&e[i+1]==="*"?(n+=".*",i++):r==="*"?n+="[^/]*":n+=r.replace(/[.+?^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${n}$`).test(t)}function rD(e,t){return e.targets?t.filter(n=>e.targets.some(i=>nD(i,n.target))):[...t]}function J4(e,t){return t.filter(n=>e.runs.some(i=>nD(i,n.target)))}function iD(e,t){for(let n of t){let i=(e.jobs??[]).filter(r=>r.runs.some(o=>nD(o,n))).map(r=>`"${r.name}"`);if(i.length>1)return`wave "${e.name}" jobs: run "${n}" is in job groups ${i.join(" and ")}; each run is in exactly one`;if(i.length===0)return`wave "${e.name}" jobs: run "${n}" is in no job group; each run is in exactly one`}}function Og(e,t,n){if(!Array.isArray(n)||n.length===0||!n.every(i=>typeof i=="string")||n[0]==="")throw new Error(`${e}: \`${t}\` must be a command as argv, a non-empty array of strings.`)}function Ol(e,t){if(t!==void 0){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e}: \`hooks\` must be { "before"?: { "observe"?, "plan"?, "apply"? }, "after"?: { "plan"?, "gate"?, "apply"? } }.`);for(let[n,i]of Object.entries(t)){if(n==="apply"){let r=i?.runBy;if(i===null||typeof i!="object"||Array.isArray(i)||Object.keys(i).some(o=>o!=="runBy"))throw new Error(`${e}: hooks.apply must be { "runBy"?: "chant" | "apply" }.`);if(r!==void 0&&!ZI.includes(r))throw new Error(`${e}: hooks.apply.runBy is ${JSON.stringify(r)}; use ${ZI.map(o=>`"${o}"`).join(" or ")}.`);continue}if(n!=="before"&&n!=="after")throw new Error(`${e}: hooks.${n} is not a moment; use hooks.before or hooks.after (or hooks.apply.runBy).`);if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${e}: hooks.${n} must be { "plan"?: [...], "apply"?: [...] }.`);for(let[r,o]of Object.entries(i)){let s=`hooks.${n}.${r}`;if(r==="gate"&&n==="before")throw new Error(`${e}: ${s} is not a moment; a hook runs after the gate (hooks.after.gate), or before the plan or the apply.`);if(r==="observe"&&n==="after")throw new Error(`${e}: ${s} is not a moment; a hook runs before the observe (hooks.before.observe), or after the plan, which reads what the observe saw.`);if(r!=="observe"&&r!=="plan"&&r!=="apply"&&r!=="gate")throw new Error(`${e}: ${s} is not a stage; a hook runs before the observe, before or after plan or apply, or after the gate.`);if(!Array.isArray(o))throw new Error(`${e}: ${s} must be a list of hooks.`);o.forEach((a,c)=>{let l=`${s}[${c}]${a&&typeof a=="object"&&typeof a.name=="string"?` (${a.name})`:""}`;if(!a||typeof a!="object")throw new Error(`${e}: ${l} must be { "command": [...], "onFailure"?, "perRun"? }.`);if(Og(e,`${l}.command`,a.command),a.onFailure!==void 0&&!q4.includes(a.onFailure))throw new Error(`${e}: ${l} has onFailure "${a.onFailure}"; use ${q4.join(" or ")}.`);if(a.onFailure==="approve"&&n==="after"&&r==="apply")throw new Error(`${e}: ${l} has onFailure "approve", but after the apply there is nothing left to hold. Use "fail".`);if(a.onFailure==="approve"&&r==="gate")throw new Error(`${e}: ${l} has onFailure "approve", but the gate has already decided when it runs. Use "fail", or hold the wave from an after.plan hook.`);if(a.perRun!==void 0&&typeof a.perRun!="boolean")throw new Error(`${e}: ${l}.perRun must be true or false.`);if(a.targets!==void 0&&(!Array.isArray(a.targets)||a.targets.length===0||!a.targets.every(u=>typeof u=="string"&&u!=="")))throw new Error(`${e}: ${l}.targets must be a non-empty list of targets or patterns, such as ["prod/*"].`);if(a.perRun){if(n==="before"&&(r==="plan"||r==="observe")&&a.command.some(u=>u.includes("{plan}")))throw new Error(`${e}: ${l} runs before the plan, so it has no {plan} yet.`)}else{let u=a.command.find(d=>d.includes("{target}")||d.includes("{plan}"));if(u)throw new Error(`${e}: ${l} runs once for the wave, so it has no {target} or {plan} ("${u}"). Set "perRun": true, or read the runs from {runs}.`)}})}}}}function oD(e,t){if(Ol(e,t),t?.after?.gate!==void 0)throw new Error(`${e}: hooks.after.gate runs in an Op waves job only; a pull-request job runs hooks before the observe, before and after the plan, and before and after the apply.`);if(t?.apply!==void 0)throw new Error(`${e}: hooks.apply.runBy is for an Op waves spec; chant runs a pull request's apply, so it runs the apply-stage hooks itself.`)}function Bk(e,t){let n=e.waves.find(r=>r.name===t),i=(r,o)=>{let[s,a]=o.split("-");return r?.[s]?.[a]??[]};return Object.fromEntries(Gk.map(r=>[r,[...i(e.hooks,r),...i(n?.hooks,r)]]))}function Uk(e,t){return e.waves.find(i=>i.name===t)?.hooks?.apply?.runBy??e.hooks?.apply?.runBy??"chant"}function sD(e,t,n){return KI(e,t,n,i=>i.target)}var Ag,Wa,q4,Gk,ZI,xwe,V4,tD,YI,$we,Ba=v(()=>{"use strict";Cs();Qi();Fv();JI();Fv();Ag=["always","on-destructive","never"],Wa=["ledger","pr-review","sealed"];q4=["fail","approve"],Gk=["before-observe","before-plan","after-plan","after-gate","before-apply","after-apply"],ZI=["chant","apply"],xwe=["all","changing"],V4=Mk;tD=["chant","run","{op}","--env","{target}"];YI=/^[a-z0-9][a-z0-9_-]*$/;$we=/^[A-Za-z_][A-Za-z0-9_]*$/});function Y4(e,t){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be { engine?, path?, namespace?, command? }`);for(let[n,i]of Object.entries(t))if(n==="engine"){if(!Z4.includes(i))throw new Error(`${e}.engine must be ${Z4.join(" or ")}, the result shape the command prints`)}else if(n==="path"||n==="namespace"){if(typeof i!="string"||i.trim()==="")throw new Error(`${e}.${n} must be a non-empty string`);if(n==="path"&&(i.startsWith("/")||i.split("/").includes("..")))throw new Error(`${e}.path must be a directory inside the workspace, relative to its declaration`)}else if(n==="command"){if(!Array.isArray(i)||i.length===0||!i.every(r=>typeof r=="string"&&r!==""))throw new Error(`${e}.command must be argv, a non-empty list of strings`);if(!i.some(r=>r.includes("{input}")))throw new Error(`${e}.command must pass the input file as {input}`)}else throw n==="outcomes"||n==="allow_unattended"||n==="allowUnattended"?new Error(`${e}.${n}: chant's policy step denies and holds only; a non-empty plan always waits for a person (ws-104), so there is no unattended outcome`):new Error(`${e}.${n} is not a setting; the settings are engine, path, namespace and command`)}var Z4,Q4=v(()=>{"use strict";Z4=["conftest","opa"]});var pD={};Te(pD,{CHANT_PACKAGE:()=>Zd,DECLARATION_FILES:()=>Jd,DECLARATION_SCHEMA_ID:()=>Swe,DECLARATION_SCHEMA_VERSION:()=>Ewe,DEFAULT_CI_WINDOW:()=>i6,DEFAULT_PR_ENVIRONMENT_TTL:()=>o6,DEFAULT_PUBLISH_BRANCH_PREFIX:()=>l6,DEFAULT_REPLICATE_REMOTE:()=>c6,DEFAULT_SHIP_ENV:()=>a6,DEFAULT_SHIP_GATE:()=>s6,DEFAULT_STATE_ROOT:()=>u6,DIAGRAM_TOOLS:()=>Cwe,FACTORY_CHECK_KINDS:()=>_we,NAME_PATTERN:()=>Owe,PRINCIPAL_CLASSES:()=>Awe,REPLICATE_REF_CLASSES:()=>aD,REPLICATE_TRIGGERS:()=>cD,RESERVED_NAMES:()=>r6,WORKSPACE_ERROR_CODES:()=>vi,WRITE_VERBS:()=>Pwe,WorkspaceReadError:()=>be,boxServicesProblem:()=>h6,compareVersions:()=>d6,declaredDiagrams:()=>uD,declaredRecordKinds:()=>yr,extensionsAt:()=>Cg,findDeclarationDir:()=>dD,isInside:()=>Nr,ownerOf:()=>y6,parseDeclaration:()=>f6,pinnedChant:()=>Hk,readDeclaration:()=>_t,readerVersion:()=>en,resolveGroups:()=>Ua,rootExclusions:()=>qk});function en(){return X4??=z4(),X4}function d6(e,t){let n=lD.exec(e),i=lD.exec(t);if(!n||!i)throw new Error(`not a version: ${n?t:e}`);for(let r=1;r<=3;r++){let o=Number(n[r])-Number(i[r]);if(o!==0)return o}return n[4]===i[4]?0:n[4]===void 0?1:i[4]===void 0||n[4]<i[4]?-1:1}function Twe(){if(zk)return zk;let e=Na();return zk=new e({allErrors:!0,strict:!0}).compile(m0),zk}function Iwe(e,t){let n=/#\/\$defs\/([A-Za-z]+)\//.exec(e.schemaPath)?.[1];if(e.keyword==="pattern"){let i=JSON.stringify(t);return n==="name"&&typeof t=="string"&&r6.includes(t)?`${i} is reserved; pick another name`:n==="name"?`${i} is not a valid name: use lowercase letters, digits and hyphens, starting with a letter or digit, at most 40 characters`:n==="kindName"?`${i} is not a valid kind or role name`:n==="dir"?`${i} is not a directory inside the workspace: use a relative path with / separators, and no . or .. segments`:n==="path"?`${i} is not a path inside the member or workspace: use a relative path with / separators, and no . or .. segments`:n==="glob"?`${i} is not a glob inside the workspace: use a relative pattern with / separators, and no . or .. segments`:n==="version"?`${i} is not a version such as 1.2.3`:`${i} is not allowed here`}if(e.keyword==="additionalProperties")return`unknown field ${JSON.stringify(e.params.additionalProperty)}; only fields named x-... may be added`;if(e.keyword==="required"){let i=String(e.params.missingProperty);return i==="because"&&e.instancePath.endsWith("/handWritten")?'a hand-written generated file needs "because", saying why it is kept by hand':i==="because"?'a member of kind other needs "because", saying why it is there':`missing required field ${JSON.stringify(i)}`}return e.keyword==="const"&&e.instancePath==="/schema"?"schema must be 1, the only declaration format this chant reads":e.message??"is invalid"}function p6(e,t){let n=e;for(let i of t.split("/").slice(1)){let r=i.replace(/~1/g,"/").replace(/~0/g,"~");if(n===null||typeof n!="object")return;n=n[r]}return n}function Hk(e){if(!Array.isArray(e.pins))return;let t=e.pins.findIndex(n=>n!==null&&typeof n=="object"&&n.package===Zd&&typeof n.version=="string");return t<0?void 0:{version:e.pins[t].version,index:t}}function f6(e,t,n=en(),i={}){let r=Ma(e,{jsonc:t.endsWith(".jsonc")});if(!r.ok)throw new be("declaration-unparseable",r.message,{file:t,...r.location});let o=(A,I=!1)=>({file:t,...r.locate(A,I)}),s=r.value;if(s===null||typeof s!="object"||Array.isArray(s))throw new be("declaration-invalid","the declaration must be a JSON object",o(""));let a=s,c=i.rootChant?Hk(a):void 0;if(c&&c.version!==n)throw new be("root-chant-required",`this declaration pins ${Zd} ${c.version}, and this is chant ${n}; the root's chant reads it, so install ${Zd}@${c.version} at the workspace root`,o(`/pins/${c.index}/version`));if(typeof a.minReader=="string"&&lD.test(a.minReader)&&d6(n,a.minReader)<0)throw new be("reader-too-old",`this declaration needs chant ${a.minReader} or newer to read it, and this is chant ${n}`,o("/minReader"));let l=Twe();if(!l(s)){let A=(l.errors??[]).filter(he=>!Dwe.has(he.keyword));A.sort((he,Ee)=>Ee.instancePath.split("/").length-he.instancePath.split("/").length);let I=A[0]??l.errors[0],P=I.keyword==="additionalProperties",G=P?`${I.instancePath}/${Rl(String(I.params.additionalProperty))}`:I.instancePath,xe=I.instancePath===""?"":` (at ${I.instancePath})`,te=A.length>1?`; ${A.length-1} more problem${A.length>2?"s":""} after this one`:"";throw new be("declaration-invalid",`${Iwe(I,p6(s,I.instancePath))}${xe}${te}`,o(G,P))}let u=a.members.map((A,I)=>{let P=`/members/${I}`,G=(A.suppress??[]).map(oe=>({check:oe.check,because:oe.because}));if(A.kind===Tk){let oe=A.glob;return{type:"group",name:A.name,kind:Tk,globs:typeof oe=="string"?[oe]:[...oe],suppress:G,pointer:P,globLocation:r.locate(`${P}/glob`)}}let xe=(A.roles??[]).map(oe=>typeof oe=="string"?{name:oe,path:null}:{name:oe.name,path:oe.path??null}),te=(A.generated??[]).map((oe,ge)=>({path:oe.path,generator:oe.generator,sources:[...oe.sources??[]],handWritten:oe.handWritten?{because:oe.handWritten.because}:null,pointer:`${P}/generated/${ge}`})),he=(A.links??[]).map((oe,ge)=>({member:oe.member,output:oe.output,kind:oe.kind??null,protocol:oe.protocol??null,pointer:`${P}/links/${ge}`})),Ee=t6(A.records,A.dir,A.name,`${P}/records`),ht=n6(A.diagrams,A.name,`${P}/diagrams`),ce=zwe(A.box,`${P}/box`);return{type:"member",name:A.name,dir:A.dir,kind:A.kind,roles:xe,generated:te,outputs:A.outputs===void 0?null:[...A.outputs],fields:A.fields===void 0?null:structuredClone(A.fields),links:he,records:Ee,diagrams:ht,box:ce,upstream:A.upstream??null,because:A.because??null,travel:A.travel===!0,security:[...A.security??[]],ciWorkflow:A.ci?.workflow??null,ciHooks:g6(A.ci?.hooks,`${P}/ci/hooks`,o),suppress:G,pointer:P}}),d=new Map;for(let A of u){let I=d.get(A.name);if(I)throw new be("declaration-invalid",`the name ${JSON.stringify(A.name)} is already used by the entry at ${I.pointer}`,o(`${A.pointer}/name`));d.set(A.name,A)}let p=u.filter(A=>A.type==="member"),f=new Map;for(let A of p){let I=f.get(A.dir);if(I)throw new be("placement-invalid",`member ${A.name} has the same directory as member ${I.name} (${A.dir})`,o(`${A.pointer}/dir`));f.set(A.dir,A)}for(let A of p){let I=p.find(P=>P!==A&&P.dir!=="."&&Nr(A.dir,P.dir));if(I)throw new be("placement-invalid",`member ${A.name} (${A.dir}) sits inside member ${I.name} (${I.dir}); only the root member "." may contain other members`,o(`${A.pointer}/dir`))}for(let A of p){let I=new Map;for(let P of A.generated){let G=I.get(P.path);if(G)throw new be("declaration-invalid",`member ${A.name} lists the generated file ${P.path} twice; the first is at ${G.pointer}`,o(`${P.pointer}/path`));I.set(P.path,P);let xe=A.dir==="."?P.path:`${A.dir}/${P.path}`,te=p.find(he=>he!==A&&he.dir!=="."&&Nr(he.dir,A.dir)&&Nr(xe,he.dir));if(te)throw new be("placement-invalid",`member ${A.name} lists the generated file ${P.path}, which sits inside member ${te.name} (${te.dir}); list it there`,o(`${P.pointer}/path`))}}let g=t6(a.records,".",null,"/records"),h=new Map,w=new Map;for(let A of[...g,...p.flatMap(I=>I.records)]){let I=h.get(A.path);if(I)throw new be("declaration-invalid",`the record kind ${A.path} is already declared at ${I.pointer}`,o(`${A.pointer}/kind`));if(h.set(A.path,A),A.name===null)continue;let P=w.get(A.name);if(P)throw new be("declaration-invalid",`the record kind name ${JSON.stringify(A.name)} is already given at ${P.pointer}`,o(`${A.pointer}/name`));w.set(A.name,A)}for(let A of p){let I=new Map;for(let G of A.box?.capabilities??[]){let xe=I.get(G.name);if(xe)throw new be("declaration-invalid",`member ${A.name}'s box lists the capability ${G.name} twice; the first is at ${xe.pointer}`,o(`${G.pointer}/name`));I.set(G.name,G)}let P=A.box?h6(A.name,A.box.services):null;if(P)throw new be("declaration-invalid",P.message,o(P.pointer))}let b=Hwe(p);if(b)throw new be("declaration-invalid",b.message,o(b.pointer));let k=p.filter(A=>A.box?.replicate);if(k.length>1)throw new be("declaration-invalid",`members ${k[0].name} and ${k[1].name} both declare replicate in their box block; a checkout's work in progress goes to one remote, so a workspace has one replicate policy`,o(k[1].box.replicate.pointer));let $=n6(a.diagrams,null,"/diagrams"),x=new Map;for(let A of[...$,...p.flatMap(I=>I.diagrams)]){let I=x.get(A.name);if(I)throw new be("declaration-invalid",`the diagram name ${JSON.stringify(A.name)} is already used by the diagram at ${I.pointer}`,o(`${A.pointer}/name`));x.set(A.name,A)}let R=Kwe(a,p,o),O=jwe(a.writeScope,p,o),D=Bwe(a.agents,p,o),_=qwe(p,D);if(_)throw new be("declaration-invalid",_.message,o(_.pointer));let M=Wwe(a.ci,o),[T]=xq(M?.branches,p.map(A=>A.name));if(T)throw new be("declaration-invalid",`ci.branches routes member ${T.member} to both ${T.branches.join(" and ")}; a member applies from one branch`,o(`/ci/branches/${Rl(T.branches[1])}`));let ne=(a.pins??[]).map(A=>({package:A.package??null,version:A.version??null,path:A.path??null,integrity:A.integrity??null})),X={name:a.name,schema:a.schema,minReader:a.minReader??null,entries:u,members:p,groups:u.filter(A=>A.type==="group"),pins:ne,checks:{...a.checks??{}},quorum:typeof a.quorum=="number"?a.quorum:null,records:g,diagrams:$,hosts:R,changes:Uwe(a.changes),writeScope:O,agents:D,identity:Nwe(a.identity),ci:M,retention:Mwe(a.retention),metrics:Lwe(a.metrics),security:[...a.security??[]],file:t};return m6.set(X,s),X}function Cg(e,t){let n=p6(m6.get(e),t);return n===null||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([i])=>i.startsWith("x-")))}function jwe(e,t,n){if(e===void 0)return null;let i=e,r={};for(let[o,s]of Object.entries(i)){let a=`/writeScope/${o}`,c=s.members===void 0||s.members==="*"?null:[...s.members];for(let[d,p]of(c??[]).entries())if(!t.some(f=>f.name===p))throw new be("declaration-invalid",`writeScope.${o} names the member ${JSON.stringify(p)}, which the declaration does not declare; declared members: ${t.map(f=>f.name).join(", ")||"none"}`,n(`${a}/members/${d}`));let l=s.records===void 0?null:Object.fromEntries(Object.entries(s.records).map(([d,p])=>[d,[...p]])),u=(s.protected??[]).map(d=>typeof d=="string"?{path:d,except:[]}:{path:d.path,except:[...d.except??[]]});r[o]={members:c,records:l,protected:u,pointer:a}}return r}function Nwe(e){if(e===void 0)return null;let t=e,n={};for(let[i,r]of Object.entries(t.gates??{}))n[i]={gate:i,class:r.class??null,pointer:`/identity/gates/${i.replace(/~/g,"~0").replace(/\//g,"~1")}`};return{attribution:t.attribution??"any",gates:n}}function Lwe(e){if(!e||typeof e!="object")return null;let t=e.failureWindowDays;return typeof t=="number"?{failureWindowDays:t}:{}}function Mwe(e){if(!e||typeof e!="object")return null;let t={};for(let n of yq){let i=e[n];i&&(t[n]={...typeof i.days=="number"?{days:i.days}:{},...typeof i.keep=="number"?{keep:i.keep}:{}})}return t}function g6(e,t,n){if(e===void 0)return null;try{oD(t.slice(1).replace(/\//g,"."),e)}catch(i){throw new be("declaration-invalid",i instanceof Error?i.message:String(i),n(t))}return structuredClone(e)}function e6(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!t.startsWith("x-")).map(([t,n])=>[t,[...n]]))}function Fwe(e,t){if(e===void 0)return null;try{Y4("ci.policy",e)}catch(n){throw new be("declaration-invalid",n instanceof Error?n.message:String(n),t("/ci/policy"))}return structuredClone(e)}function Gwe(e,t){let n={};for(let r of Bv){let o=e[r];if(o===void 0)continue;let s=Object.fromEntries(Object.entries(o).filter(([c])=>!c.startsWith("x-"))),a=o.rules.map(c=>Object.fromEntries(Object.entries(c).filter(([l])=>!l.startsWith("x-")).map(([l,u])=>[l,Array.isArray(u)?[...u]:u])));n[r]={...s,rules:a}}let[i]=$q(n);if(i)throw new be("declaration-invalid",i.message,t(i.pointer));return n}function Wwe(e,t){if(e===void 0)return null;let n=e,i=g6(n.hooks,"/ci/hooks",t),r=Fwe(n.policy,t),o={...n.workflow!==void 0?{workflow:n.workflow}:{},...i?{hooks:i}:{},...n.branches!==void 0?{branches:e6(n.branches)}:{},...n.labels!==void 0?{labels:e6(n.labels)}:{},...n.locks!==void 0?{locks:n.locks}:{},...r?{policy:r}:{},...n.identity?.cloud!==void 0?{identity:{cloud:Gwe(n.identity.cloud,t)}}:{},...n.prEnvironment!==void 0?{prEnvironment:{template:n.prEnvironment.template,ttl:n.prEnvironment.ttl??o6}}:{}},s=null;if(n.reportUrl!==void 0){let l=wq(n.reportUrl,"ci.reportUrl");if("error"in l)throw new be("declaration-invalid",l.error,t("/ci/reportUrl"));s=l.url}if(n.green===void 0)return{green:null,...o,reportUrl:s};let a=n.green,c=Object.entries(a.phases).map(([l,u])=>({name:l,runs:[...Array.isArray(u)?u:u.runs],skipped:Array.isArray(u)?"fail":u.skipped??"fail",...!Array.isArray(u)&&u.build!==void 0?{build:u.build}:{},pointer:`/ci/green/phases/${Rl(l)}`}));for(let[l,u]of a.require.entries())if(!c.some(d=>d.name===u))throw new be("declaration-invalid",`ci.green.require names the phase ${JSON.stringify(u)}, which ci.green.phases does not declare; declared phases: ${c.map(d=>d.name).join(", ")}`,t(`/ci/green/require/${l}`));for(let[l,u]of(a.preMerge??[]).entries())if(!c.some(d=>d.name===u))throw new be("declaration-invalid",`ci.green.preMerge names the phase ${JSON.stringify(u)}, which ci.green.phases does not declare; declared phases: ${c.map(d=>d.name).join(", ")}`,t(`/ci/green/preMerge/${l}`));return{green:{branch:a.branch,window:a.window??i6,phases:c,require:[...a.require],...a.preMerge!==void 0?{preMerge:[...a.preMerge]}:{},signedSince:a.signedSince??null,source:a.source??"checks",pointer:"/ci/green"},...o,reportUrl:s}}function Bwe(e,t,n){let i=(e??[]).map((s,a)=>{let c=s.members!==void 0?[...s.members]:[s.member];return{name:s.name,members:c,member:c[0],principals:[...s.principals??[]],pointer:`/agents/${a}`,listed:s.members!==void 0}}),r=new Map,o=new Map;for(let{listed:s,...a}of i){let c=r.get(a.name);if(c)throw new be("declaration-invalid",`the agent name ${JSON.stringify(a.name)} is already used by the agent at ${c.pointer}`,n(`${a.pointer}/name`));r.set(a.name,a);for(let[l,u]of a.members.entries())if(!t.some(d=>d.name===u))throw new be("declaration-invalid",`agent ${a.name} is bound to ${JSON.stringify(u)}, which is not a declared member; an agent session is bound to members, not an example group`,n(s?`${a.pointer}/members/${l}`:`${a.pointer}/member`));for(let[l,u]of a.principals.entries()){let d=o.get(u);if(d)throw new be("declaration-invalid",`the principal ${JSON.stringify(u)} is already listed by agent ${d.name}`,n(`${a.pointer}/principals/${l}`));o.set(u,a)}}return[...r.values()]}function Uwe(e){return e===void 0?null:{severity:e.severity??"warn",ignore:[...e.ignore??[]]}}function t6(e,t,n,i){return(e??[]).map((r,o)=>({kind:r.kind,path:t==="."?r.kind:`${t}/${r.kind}`,name:r.name??null,member:n,pointer:`${i}/${o}`}))}function n6(e,t,n){return(e??[]).map((i,r)=>({name:i.name,title:i.title,source:i.source??null,render:i.render??null,renderer:{tool:i.renderer.tool,version:i.renderer.version,args:[...i.renderer.args??[]]},sourceHash:i.sourceHash??null,member:t,pointer:`${n}/${r}`}))}function zwe(e,t){if(e===void 0)return null;let n=e,i=n.factory,r=n.listing,o=n.replicate;return{capabilities:(n.capabilities??[]).map((s,a)=>({name:s.name,broker:s.broker??null,scope:[...s.scope??[]],pointer:`${t}/capabilities/${a}`})),isolation:n.host===void 0?null:{host:n.host,slot:n.slot,ports:{...n.ports??{}},state:{...n.state??{}},cookies:[...n.cookies??[]]},intent:n.intent??null,services:(n.services??[]).map((s,a)=>({name:s.name,cmd:s.cmd,needs:[...s.needs??[]],httpPort:s.httpPort??null,duration:s.duration??null,health:s.health??null,optional:s.optional??!1,pointer:`${t}/services/${a}`})),factory:i===void 0?null:{builds:[...i.builds],check:i.check===void 0?null:typeof i.check=="string"?{run:i.check,kind:"test"}:{run:i.check.run,kind:i.check.kind??"test"},checks:i.checks??null,builders:i.builders??null,tiers:(i.tiers??[]).map(s=>({tier:s.tier,agent:s.agent,kinds:s.kinds===void 0?null:[...s.kinds],session:s.session??null})),publish:i.publish===void 0?null:{forge:i.publish.forge??"github",repo:i.publish.repo,base:i.publish.base??null,branchPrefix:i.publish.branchPrefix??l6,head:i.publish.head??null},pointer:`${t}/factory`},listing:r===void 0?null:{published:r.published??!0,title:r.title??"",line:r.line??"",cover:r.cover??null},publisher:n.publisher??null,ship:n.ship===void 0?null:{op:n.ship.op,gate:n.ship.gate??s6,env:n.ship.env??a6,bookkeeping:(n.ship.bookkeeping??[]).map(s=>s.replace(/^\.\//,"").replace(/\/+$/,"")),pointer:`${t}/ship`},replicate:o===void 0?null:{remote:o.remote??c6,refs:aD.filter(s=>(o.refs??aD).includes(s)),on:cD.filter(s=>(o.on??cD).includes(s)),every:o.every??null,pointer:`${t}/replicate`},pointer:t}}function Hwe(e){let t=e.filter(s=>s.box?.factory);if(t.length>1)return{message:`members ${t[0].name} and ${t[1].name} both declare a factory in their box block; a workspace has one factory, so an orchestrator reads one`,pointer:t[1].box.factory.pointer};let n=t[0]?.box?.factory;if(!n)return null;let i=()=>e.map(s=>s.name).join(", "),r=n.builds.findIndex(s=>!e.some(a=>a.name===s));if(r>=0)return{message:`the factory builds ${JSON.stringify(n.builds[r])}, which is not a declared member; declared members: ${i()}`,pointer:`${n.pointer}/builds/${r}`};if(n.builders!==null&&!e.some(s=>s.name===n.builders))return{message:`the factory's builders names ${JSON.stringify(n.builders)}, which is not a declared member; declared members: ${i()}`,pointer:`${n.pointer}/builders`};if(n.tiers.length>0&&n.builders===null)return{message:"the factory declares tiers and no builders; tiers name agents the builders member declares, so name it",pointer:`${n.pointer}/tiers`};let o=new Map;for(let[s,a]of n.tiers.entries())for(let c of a.kinds??[null]){let l=`${a.tier}\0${c??""}`,u=o.get(l);if(u!==void 0){let d=c===null?"with no kinds":`for kind ${c}`;return{message:`tiers/${u} and tiers/${s} both name a builder at tier ${a.tier} ${d}; a tier has one builder per kind, so one entry answers it`,pointer:`${n.pointer}/tiers/${s}`}}o.set(l,s)}return null}function qwe(e,t){let n=e.find(i=>i.box?.factory)?.box?.factory;if(!n)return null;for(let[i,r]of n.tiers.entries())if(r.session!==null&&!t.some(o=>o.name===r.session)){let o=t.map(s=>s.name).join(", ")||"none";return{message:`tiers/${i} names the session ${JSON.stringify(r.session)}, which is not a declared agent session; declared sessions: ${o}`,pointer:`${n.pointer}/tiers/${i}/session`}}return null}function h6(e,t){let n=new Map;for(let o of t){let s=n.get(o.name);if(s)return{message:`member ${e}'s box declares the service ${o.name} twice; the first is at ${s.pointer}`,pointer:`${o.pointer}/name`};n.set(o.name,o)}let i;for(let o of t)if(o.httpPort!==null){if(i)return{message:`member ${e}'s box gives both ${i.name} (port ${i.httpPort}) and ${o.name} (port ${o.httpPort}) an httpPort, and the supervisor routes the sprite's URL to one service`,pointer:`${o.pointer}/httpPort`};i=o}for(let o of t){let s=o.needs.findIndex(a=>!n.has(a));if(s>=0){let a=t.map(c=>c.name).join(", ");return{message:`member ${e}'s box service ${o.name} needs ${JSON.stringify(o.needs[s])}, which the block does not declare; declared services: ${a}`,pointer:`${o.pointer}/needs/${s}`}}}let r=Vwe(t);if(r){let o=n.get(r[0]);return{message:`member ${e}'s box services need each other in a cycle: ${r.join(" -> ")}`,pointer:`${o.pointer}/needs`}}return null}function Vwe(e){let t=new Map(e.map(r=>[r.name,r])),n=new Map,i=(r,o)=>{let s=n.get(r);if(s==="done")return null;if(s==="visiting")return[...o.slice(o.indexOf(r)),r];n.set(r,"visiting");for(let a of t.get(r)?.needs??[]){let c=i(a,[...o,r]);if(c)return c}return n.set(r,"done"),null};for(let r of e){let o=i(r.name,[]);if(o)return o}return null}function Kwe(e,t,n){let i=(e.hosts??[]).map((s,a)=>({name:s.name,ports:{...s.ports},stateRoot:s.stateRoot??null,pointer:`/hosts/${a}`})),r=(s,a)=>new be("declaration-invalid",s,n(a)),o=new Map;for(let s of i){let a=o.get(s.name);if(a)throw r(`the host name ${JSON.stringify(s.name)} is already used by the host at ${a.pointer}`,`${s.pointer}/name`);if(o.set(s.name,s),s.ports.from>s.ports.to)throw r(`host ${s.name}'s port range starts at ${s.ports.from}, after its end ${s.ports.to}`,`${s.pointer}/ports`)}for(let s of t){let a=s.box?.isolation;if(!a)continue;let c=s.box.pointer,l=o.get(a.host);if(!l){let g=i.map(h=>h.name).join(", ")||"none are declared";throw r(`member ${s.name}'s box names the host ${JSON.stringify(a.host)}, which hosts does not declare; declared hosts: ${g}`,`${c}/host`)}let{from:u,to:d,perBox:p}=l.ports,f=u+(a.slot+1)*p-1;if(f>d){let g=Math.floor((d-u+1)/p);throw r(`member ${s.name}'s box has slot ${a.slot} on host ${l.name}, which needs ports ${u+a.slot*p} to ${f}, past the end of the host's range (${d}); the range holds ${g} slot${g===1?"":"s"}`,`${c}/slot`)}for(let[g,h]of Object.entries(a.ports))if(h>=p)throw r(`member ${s.name}'s box gives port ${g} offset ${h}, and host ${l.name} gives each box ${p} port${p===1?"":"s"} (offsets 0 to ${p-1})`,`${c}/ports/${Rl(g)}`)}return i}function yr(e){return[...e.records,...e.members.flatMap(t=>t.records)]}function uD(e){return[...e.diagrams,...e.members.flatMap(t=>t.diagrams)]}function Nr(e,t){return t==="."?!0:e===t||e.startsWith(`${t}/`)}function _t(e,t="",n={}){let i=Jd.map(r=>Ve(t,r)).filter(r=>e.stat(r)==="file");if(i.length===0)throw new be("declaration-missing",`no ${Jd.join(" or ")} in ${t||"the workspace root"}${e.label}`);if(i.length>1)throw new be("declaration-ambiguous",`both ${i.join(" and ")} exist${e.label}; keep one of them`,{file:i[1],line:1,column:1});return f6(e.read(i[0]),i[0],en(),n)}function dD(e,t){for(let n=t;;n=n.includes("/")?n.slice(0,n.lastIndexOf("/")):""){if(Jd.some(i=>e.stat(Ve(n,i))==="file"))return n;if(n==="")return}}function Ua(e,t){let n=o=>({file:e.file,...o.globLocation}),i=new Map,r=[];for(let o of e.groups){let s=[...new Set(o.globs.flatMap(l=>Pq(t,l)))].sort(),a=[],c=[];for(let l of s){if(!UI(t,l)){c.push(l);continue}let u=p=>new be("placement-invalid",`group ${o.name} matches ${l}, ${p}`,n(o));for(let p of e.members)if(p.dir!=="."){if(p.dir===l)throw u(`which is member ${p.name}'s directory; a match is never a member`);if(Nr(p.dir,l))throw u(`which contains member ${p.name} (${p.dir})`);if(p.kind==="workspace"&&Nr(l,p.dir))throw u(`which sits inside the nested workspace ${p.name}; that workspace declares its own examples`)}let d=i.get(l);if(d)throw u(`which group ${d.name} also matches`);i.set(l,o),a.push(l)}r.push({group:o,matches:a,skipped:c})}return r}function y6(e,t,n){for(let r of t){let o=r.matches.find(s=>Nr(n,s));if(o)return{group:r.group,match:o}}let i;for(let r of e.members)Nr(n,r.dir)&&(!i||i.dir==="."||r.dir!=="."&&r.dir.length>i.dir.length)&&(i=r);return i?{member:i}:void 0}function qk(e,t){let n=[];for(let i of e.members)i.dir!=="."&&n.push({dir:i.dir,owner:i.name});for(let i of t)for(let r of i.matches)e.members.some(o=>o.dir!=="."&&Nr(r,o.dir))||n.push({dir:r,owner:i.group.name});return n.sort((i,r)=>i.dir<r.dir?-1:i.dir>r.dir?1:0)}var Swe,Jd,Ewe,r6,Owe,vi,be,Awe,Pwe,i6,o6,Cwe,s6,a6,aD,cD,c6,_we,l6,u6,Zd,X4,lD,zk,Dwe,m6,Tt=v(()=>{"use strict";f0();bq();vq();g0();Rq();Cq();Yi();Hd();on();kg();H4();Ba();Q4();Swe=m0.$id,Jd=["chant.workspace.json","chant.workspace.jsonc"],Ewe=1,r6=["_workspace","_members"],Owe=/^[a-z0-9][a-z0-9-]{0,39}$/,vi=["declaration-missing","declaration-ambiguous","declaration-unparseable","declaration-invalid","placement-invalid","reader-too-old","root-chant-required","not-a-git-repository","revision-unknown"],be=class extends Error{constructor(n,i,r){super(i);this.code=n;this.location=r;this.name="WorkspaceReadError"}describe(){let n=this.location;return n?`${n.file}:${n.line}:${n.column}: ${this.message}`:this.message}},Awe=["human","agent","runner","service"],Pwe=["new","amend","review","close"],i6="24h",o6="72h",Cwe=["d2","mermaid","graphviz","excalidraw"],s6="ship",a6="box",aD=["work","kept","wip","ledger"],cD=["save","release"],c6="origin",_we=["test","build","lint","plan","conformance"],l6="chant/work/",u6="${XDG_STATE_HOME}/chant/boxes",Zd="@intentius/chant";lD=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?$/;Dwe=new Set(["if","then","else","oneOf","anyOf"]);m6=new WeakMap});var v6={};Te(v6,{MEMBERS_DIR:()=>Jk,MEMBER_LEDGER_FLOOR:()=>tbe,MemberLedgerError:()=>Kk,clearMemberLedgerCache:()=>nbe,memberLedgerPrefix:()=>Zk,resolveMemberLedger:()=>Qr});import{existsSync as Jwe}from"node:fs";import{dirname as Zwe,join as Ywe,relative as Qwe,resolve as Xwe,sep as ebe}from"node:path";function Zk(e){return e.map(t=>`${Jk}/${t}/`).join("")}function Qr(e){let t=Xwe(e),n=Vk.get(t);return n||(n=ibe(t),Vk.set(t,n),n.catch(()=>Vk.delete(t))),n}function nbe(){Vk.clear()}function rbe(e,t){let n=Qwe(e,t);return n===""?"":n.split(ebe).join("/")}async function ibe(e){let t=tr(e);return t?b6(t.dir,e):w6}async function b6(e,t){let{readDeclaration:n,resolveGroups:i,ownerOf:r,WorkspaceReadError:o}=await Promise.resolve().then(()=>(Tt(),pD)),{workingTree:s}=await Promise.resolve().then(()=>(on(),w0)),a;try{let d=s(e),p=n(d),f=r(p,i(p,d),rbe(e,t));a=f&&"member"in f&&f.member.dir!=="."?[f.member.name]:[]}catch(d){throw d instanceof o?new Kk(`cannot place this project's lifecycle ledger: ${d.describe()}. A project inside a workspace writes under ${Jk}/<member>/ on chant/lifecycle, and chant does not guess the member. Fix the declaration and retry.`):d}let c=w6,l=Zwe(e);if(l!==e&&!Jwe(Ywe(e,".git"))){let d=tr(l);d&&(c=await b6(d.dir,e))}let u=[...c.members,...a];return{members:u,prefix:Zk(u)}}var Jk,tbe,w6,Kk,Vk,Mo=v(()=>{"use strict";Bi();Jk="_members",tbe="0.81.0",w6={members:[],prefix:""};Kk=class extends Error{constructor(t){super(t),this.name="MemberLedgerError"}},Vk=new Map});function _g(e){return e===Yd}var Yd,Tg=v(()=>{"use strict";Yd="recorded locally (no remote for chant/lifecycle)"});function Xi(e=process.env){let t=e[Yk]?.trim().toLowerCase();return t!==void 0&&t!==""&&t!=="0"&&t!=="false"}function Ig(e){return fD.get(e)?.tip}function k6(e,t,n,i){let r=fD.get(e)??{tip:null,writes:[]};r.tip=t;for(let o of n)r.writes.push({path:o,message:i});fD.set(e,r)}function Qk(e,t){if(Xi())throw new mD(e,t)}var Yk,gD,fD,mD,Qd=v(()=>{"use strict";Yk="CHANT_NO_RECORD";gD="not recorded (--no-record): chant/lifecycle was not written or pushed",fD=new Map;mD=class extends Error{constructor(n,i){super(`gate "${i}" of "${n}" cannot be passed under --no-record: a gate is decided and approved on chant/lifecycle, which this run does not write. Run without --no-record (and without CHANT_NO_RECORD) to stop at the gate for approval.`);this.op=n;this.gate=i;this.name="GateNotRecordableError"}}});var RD={};Te(RD,{LifecycleLedgerUnreadableError:()=>jg,RefCASConflictError:()=>Ot,StaleLifecycleBranchError:()=>Dg,StaleLockError:()=>Al,appendLedgerLine:()=>C6,appendReleaseRecordLine:()=>wD,deleteRefCAS:()=>tp,describeLifecyclePush:()=>kD,fetchLifecycle:()=>fbe,fetchLifecycleStatus:()=>no,fetchRef:()=>ybe,fetchRefInto:()=>j6,fetchRefIntoStatus:()=>tx,getHeadCommit:()=>nx,getRemoteLifecycleBranchSha:()=>_6,gitLedgerReadPort:()=>bbe,ledgerDir:()=>qn,ledgerRevision:()=>np,listFilesInDir:()=>to,listLedgerEnvironments:()=>vD,listLedgerTrees:()=>Ng,listSnapshots:()=>pbe,pushLifecycle:()=>Xd,pushLifecycleReport:()=>Ha,pushLifecycleStatus:()=>za,pushRef:()=>hbe,pushRefStatus:()=>Lg,readBlobBySha:()=>hn,readBlobFromPath:()=>At,readEnvironmentSnapshots:()=>dbe,readPathSha:()=>gn,readRefSha:()=>qa,readReleaseLedgerLines:()=>bD,readSnapshot:()=>P6,readSnapshotAt:()=>ube,requireLifecycleLedger:()=>Lr,snapshotStorageKey:()=>O6,updateRefCAS:()=>ep,writeBlob:()=>xD,writeBlobToPath:()=>mn,writeLedgerFiles:()=>eo,writeSnapshot:()=>A6});async function qn(e,t){return`${await obe(t)}${e}`}async function obe(e){return e?.ledgerPrefix!==void 0?e.ledgerPrefix:e?.member!==void 0?Zk((typeof e.member=="string"?[e.member]:[...e.member]).filter(t=>t!==".")):(await Qr(e?.cwd??process.cwd())).prefix}async function cbe(e){let t=bt();if((await t.spawn(["git","var","GIT_COMMITTER_IDENT"],{cwd:e,env:ki})).exitCode===0)return[];let i=[];for(let[r,o,s]of[["user.name","CHANT_LIFECYCLE_COMMITTER_NAME",sbe],["user.email","CHANT_LIFECYCLE_COMMITTER_EMAIL",abe]]){let a=await t.spawn(["git","config","--get",r],{cwd:e,env:ki});a.exitCode===0&&a.stdout.trim()!==""||i.push("-c",`${r}=${process.env[o]?.trim()||s}`)}return i}function hD(e,t,n){return new Error(`cannot write ${t} on the ${Nt} branch: ${e} failed: ${(n??"").trim()}`)}async function mn(e,t,n,i,r){let o=await qn(e,r);return eo([{path:`${o}/${t}`,content:n,...r?.expectPriorPathSha!==void 0?{expectPriorSha:r.expectPriorPathSha}:{}}],i,r)}async function eo(e,t,n){let i=bt(),r=n?.cwd;if(e.length===0)throw new Error("writeLedgerFiles needs at least one file");let o=e[0].path;for(let u of e){let d=u.path.split("/");if(d.length<2||d.some(p=>p===""))throw new Error(`cannot write ${u.path} on the ${Nt} branch: a ledger path is <dir>/<file>`)}let s=[];for(let u of e){if(lbe(u)){s.push({path:u.path,sha:null});continue}let d=await i.spawn(["git","hash-object","-w","--stdin"],{cwd:r,stdin:u.content});if(d.exitCode!==0)throw hD("git hash-object",u.path,d.stderr);s.push({path:u.path,sha:d.stdout.trim()})}let a=await cbe(r);await Pl(r)===null&&await Lr({...r?{cwd:r}:{}});let c=new Map(e.map(u=>[u.path,u.expectPriorSha])),l;for(let u=1;u<=E6;u++){let d=await Pl(r);if(n?.expectTip!==void 0&&d!==n.expectTip)throw new Ot(`refs/heads/${Nt}`,n.expectTip,`the branch moved to ${d??"(none)"} since it was read`);let p=new Map,f=async x=>{let R=p.get(x);return R||(R=d?await wbe(d,x,r):new Map,p.set(x,R)),R};for(let x of s){let{dir:R,name:O}=$6(x.path),D=(await f(R)).get(O),_=D?.type==="blob"?D.sha:null,M=c.get(x.path);if(M!==void 0&&_!==M)throw l??new Ot(`refs/heads/${Nt}`,M,"target path changed concurrently");c.set(x.path,_)}for(let x of s){let{dir:R,name:O}=$6(x.path);x.sha===null?(await f(R)).delete(O):(await f(R)).set(O,{mode:"100644",type:"blob",sha:x.sha});for(let D=R;D!=="";D=ex(D))await f(ex(D))}let g=[...p.keys()].sort((x,R)=>S6(R)-S6(x)||(x<R?-1:1)),h="";for(let x of g){if(x!==""&&p.get(x).size===0){p.get(ex(x)).delete(R6(x));continue}let R=[...p.get(x)].map(([_,M])=>`${M.mode} ${M.type} ${M.sha} ${_}`).join(`
75
75
  `),O=await i.spawn(["git","mktree"],{cwd:r,stdin:R===""?"":`${R}
76
76
  `});if(O.exitCode!==0)throw hD(`git mktree (${x===""?"root":x})`,o,O.stderr);let D=O.stdout.trim();x===""?h=D:p.get(ex(x)).set(R6(x),{mode:"040000",type:"tree",sha:D})}let w=d,b=w?["-p",w]:[],k=await i.spawn(["git",...a,"commit-tree",...b,"-m",t,h],{cwd:r});if(k.exitCode!==0)throw hD("git commit-tree",o,k.stderr);let $=k.stdout.trim();if(Xi()){let x=await $D(r),R=Ig(x)===void 0?await qa(`refs/heads/${Nt}`,{cwd:r}):null,O=Ig(x),D=O!==void 0?O:R;if(D===w)return k6(x,$,e.map(_=>_.path),t),$;l=new Ot(`refs/heads/${Nt}`,w,`the run's unrecorded tip is ${D??"(none)"}`);continue}try{return await ep(`refs/heads/${Nt}`,$,w,{cwd:r}),$}catch(x){if(!(x instanceof Ot))throw x;l=x}}throw l}async function At(e,t,n){let i=bt(),r=await qn(e,n),o=await i.spawn(["git","show",`${await np(n?.cwd)}:${r}/${t}`],{cwd:n?.cwd});return o.exitCode!==0?null:o.stdout}async function gn(e,t,n){let i=bt(),r=await qn(e,n),o=await i.spawn(["git","rev-parse","--verify",`${await np(n?.cwd)}:${r}/${t}`],{cwd:n?.cwd});return o.exitCode!==0?null:o.stdout.trim()||null}function O6(e,t){return t?`${t}__${e}`:e}async function A6(e,t,n,i){return mn(e,`${t}.json`,n,"State snapshot",i)}async function P6(e,t,n){return At(e,`${t}.json`,n)}async function ube(e,t,n,i){let r=bt(),o=await qn(e,i),s=await r.spawn(["git","show",`${n}:${o}/${t}.json`],{cwd:i?.cwd});return s.exitCode!==0?null:s.stdout}async function wD(e,t,n){return C6(e,"releases.jsonl",t,"Release record",n)}async function C6(e,t,n,i,r){let o;for(let s=1;s<=E6;s++)try{let a=await gn(e,t,r),c=a?await hn(a,r):null,l=`${c?`${c.replace(/\n$/,"")}
77
77
  `:""}${n}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant",
3
- "version": "0.124.43",
3
+ "version": "0.124.44",
4
4
  "description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",