@intentius/chant 0.124.35 → 0.124.36

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.35 wave-job runtime (#3896): run wave, run resume, approve, workspace points.
2
+ // @intentius/chant 0.124.36 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 Uie=Object.create;var BS=Object.defineProperty;var Vie=Object.getOwnPropertyDescriptor;var Hie=Object.getOwnPropertyNames;var qie=Object.getPrototypeOf,Kie=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}},_e=(e,t)=>{for(var n in t)BS(e,n,{get:t[n],enumerable:!0})},Jie=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Hie(t))!Kie.call(e,r)&&r!==n&&BS(e,r,{get:()=>t[r],enumerable:!(i=Vie(t,r))||i.enumerable});return e};var Ye=(e,t,n)=>(n=e!=null?Uie(qie(e)):{},Jie(t||!e||!e.__esModule?BS(n,"default",{value:e,enumerable:!0}):n,e));function lW(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 zS,US=v(()=>{"use strict";zS=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 Xie(){return!process.env.NO_COLOR&&process.stdout.isTTY!==!1}function Qs(e,t){return Xie()?`${t}${e}${ps.reset}`:e}function we(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(Qs(n,ps.cyan)),t.push(" - ")}return t.push(Qs("error",ps.red)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
6
6
  `),t.push(Qs(e.hint,ps.gray))),t.join("")}function si(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(Qs(n,ps.cyan)),t.push(" - ")}return t.push(Qs("warning",ps.yellow)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
7
- `),t.push(Qs(e.hint,ps.gray))),t.join("")}function Sf(e){return Qs(e,ps.green)}function Qn(e){return Qs(e,ps.gray)}var ps,ur=v(()=>{"use strict";ps={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var yw,HS=v(()=>{"use strict";yw="0.124.35"});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(Ef,e),Ef}var qS,ww,Ni,ea,Ef,vu=v(()=>{qS=Object.freeze({status:"aborted"});ww=Symbol("zod_brand"),Ni=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ea=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Ef={}});var fe={};_e(fe,{BIGINT_FORMAT_RANGES:()=>rE,Class:()=>JS,NUMBER_FORMAT_RANGES:()=>nE,aborted:()=>ia,allowsEval:()=>XS,assert:()=>ioe,assertEqual:()=>eoe,assertIs:()=>noe,assertNever:()=>roe,assertNotEqual:()=>toe,assignProp:()=>na,base64ToUint8Array:()=>hW,base64urlToUint8Array:()=>koe,cached:()=>xu,captureStackTrace:()=>vw,cleanEnum:()=>voe,cleanRegex:()=>Pf,clone:()=>dr,cloneDef:()=>soe,createTransparentProxy:()=>poe,defineLazy:()=>st,esc:()=>bw,escapeRegex:()=>ai,extend:()=>goe,finalizeIssue:()=>Or,floatSafeRemainder:()=>ZS,getElementAtPath:()=>aoe,getEnumValues:()=>Af,getLengthableOrigin:()=>Tf,getParsedType:()=>doe,getSizableOrigin:()=>_f,hexToUint8Array:()=>$oe,isObject:()=>Gc,isPlainObject:()=>ra,issue:()=>$u,joinValues:()=>J,jsonStringifyReplacer:()=>ku,merge:()=>yoe,mergeDefs:()=>fs,normalizeParams:()=>me,nullish:()=>ta,numKeys:()=>uoe,objectClone:()=>ooe,omit:()=>moe,optionalKeys:()=>tE,parsedType:()=>pe,partial:()=>woe,pick:()=>foe,prefixIssues:()=>qr,primitiveTypes:()=>eE,promiseAllObject:()=>coe,propertyKeyTypes:()=>Cf,randomString:()=>loe,required:()=>boe,safeExtend:()=>hoe,shallowClone:()=>QS,slugify:()=>YS,stringifyPrimitive:()=>le,uint8ArrayToBase64:()=>yW,uint8ArrayToBase64url:()=>xoe,uint8ArrayToHex:()=>Roe,unwrapMessage:()=>Of});function eoe(e){return e}function toe(e){return e}function noe(e){}function roe(e){throw new Error("Unexpected value in exhaustive check")}function ioe(e){}function Af(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 J(e,t="|"){return e.map(n=>le(n)).join(t)}function ku(e,t){return typeof t=="bigint"?t.toString():t}function xu(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function ta(e){return e==null}function Pf(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ZS(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!==gW)return i===void 0&&(i=gW,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ooe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function na(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fs(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function soe(e){return fs(e._zod.def)}function aoe(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function coe(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 loe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function bw(e){return JSON.stringify(e)}function YS(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Gc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ra(e){if(Gc(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Gc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function QS(e){return ra(e)?{...e}:Array.isArray(e)?[...e]:e}function uoe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function ai(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 me(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 poe(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 le(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function tE(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function foe(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=fs(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 na(this,"shape",s),s},checks:[]});return dr(e,o)}function moe(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=fs(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 na(this,"shape",s),s},checks:[]});return dr(e,o)}function goe(e,t){if(!ra(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=fs(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return na(this,"shape",o),o}});return dr(e,r)}function hoe(e,t){if(!ra(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=fs(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return na(this,"shape",i),i}});return dr(e,n)}function yoe(e,t){let n=fs(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return na(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return dr(e,n)}function woe(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=fs(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 na(this,"shape",c),c},checks:[]});return dr(t,s)}function boe(e,t,n){let i=fs(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 na(this,"shape",o),o}});return dr(t,i)}function ia(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 qr(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Of(e){return typeof e=="string"?e:e?.message}function Or(e,t,n){let i={...e,path:e.path??[]};if(!e.message){let r=Of(e.inst?._zod.def?.error?.(e))??Of(t?.error?.(e))??Of(n.customError?.(e))??Of(n.localeError?.(e))??"Invalid input";i.message=r}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function _f(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Tf(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pe(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 $u(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function voe(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 yW(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function koe(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return hW(t+n)}function xoe(e){return yW(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $oe(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 Roe(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var gW,vw,XS,doe,Cf,eE,nE,rE,JS,Me=v(()=>{gW=Symbol("evaluating");vw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};XS=xu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});doe=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}`)}},Cf=new Set(["string","number","symbol"]),eE=new Set(["string","number","bigint","boolean","symbol","undefined"]);nE={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]},rE={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};JS=class{constructor(...t){}}});function Df(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 jf(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 iE(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 bW(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 oE(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 ${bW(i.path)}`);return t.join(`
7
+ `),t.push(Qs(e.hint,ps.gray))),t.join("")}function Sf(e){return Qs(e,ps.green)}function Qn(e){return Qs(e,ps.gray)}var ps,ur=v(()=>{"use strict";ps={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var yw,HS=v(()=>{"use strict";yw="0.124.36"});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(Ef,e),Ef}var qS,ww,Ni,ea,Ef,vu=v(()=>{qS=Object.freeze({status:"aborted"});ww=Symbol("zod_brand"),Ni=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ea=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Ef={}});var fe={};_e(fe,{BIGINT_FORMAT_RANGES:()=>rE,Class:()=>JS,NUMBER_FORMAT_RANGES:()=>nE,aborted:()=>ia,allowsEval:()=>XS,assert:()=>ioe,assertEqual:()=>eoe,assertIs:()=>noe,assertNever:()=>roe,assertNotEqual:()=>toe,assignProp:()=>na,base64ToUint8Array:()=>hW,base64urlToUint8Array:()=>koe,cached:()=>xu,captureStackTrace:()=>vw,cleanEnum:()=>voe,cleanRegex:()=>Pf,clone:()=>dr,cloneDef:()=>soe,createTransparentProxy:()=>poe,defineLazy:()=>st,esc:()=>bw,escapeRegex:()=>ai,extend:()=>goe,finalizeIssue:()=>Or,floatSafeRemainder:()=>ZS,getElementAtPath:()=>aoe,getEnumValues:()=>Af,getLengthableOrigin:()=>Tf,getParsedType:()=>doe,getSizableOrigin:()=>_f,hexToUint8Array:()=>$oe,isObject:()=>Gc,isPlainObject:()=>ra,issue:()=>$u,joinValues:()=>J,jsonStringifyReplacer:()=>ku,merge:()=>yoe,mergeDefs:()=>fs,normalizeParams:()=>me,nullish:()=>ta,numKeys:()=>uoe,objectClone:()=>ooe,omit:()=>moe,optionalKeys:()=>tE,parsedType:()=>pe,partial:()=>woe,pick:()=>foe,prefixIssues:()=>qr,primitiveTypes:()=>eE,promiseAllObject:()=>coe,propertyKeyTypes:()=>Cf,randomString:()=>loe,required:()=>boe,safeExtend:()=>hoe,shallowClone:()=>QS,slugify:()=>YS,stringifyPrimitive:()=>le,uint8ArrayToBase64:()=>yW,uint8ArrayToBase64url:()=>xoe,uint8ArrayToHex:()=>Roe,unwrapMessage:()=>Of});function eoe(e){return e}function toe(e){return e}function noe(e){}function roe(e){throw new Error("Unexpected value in exhaustive check")}function ioe(e){}function Af(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 J(e,t="|"){return e.map(n=>le(n)).join(t)}function ku(e,t){return typeof t=="bigint"?t.toString():t}function xu(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function ta(e){return e==null}function Pf(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ZS(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!==gW)return i===void 0&&(i=gW,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ooe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function na(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fs(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function soe(e){return fs(e._zod.def)}function aoe(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function coe(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 loe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function bw(e){return JSON.stringify(e)}function YS(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Gc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ra(e){if(Gc(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Gc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function QS(e){return ra(e)?{...e}:Array.isArray(e)?[...e]:e}function uoe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function ai(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 me(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 poe(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 le(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function tE(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function foe(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=fs(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 na(this,"shape",s),s},checks:[]});return dr(e,o)}function moe(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=fs(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 na(this,"shape",s),s},checks:[]});return dr(e,o)}function goe(e,t){if(!ra(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=fs(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return na(this,"shape",o),o}});return dr(e,r)}function hoe(e,t){if(!ra(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=fs(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return na(this,"shape",i),i}});return dr(e,n)}function yoe(e,t){let n=fs(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return na(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return dr(e,n)}function woe(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=fs(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 na(this,"shape",c),c},checks:[]});return dr(t,s)}function boe(e,t,n){let i=fs(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 na(this,"shape",o),o}});return dr(t,i)}function ia(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 qr(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Of(e){return typeof e=="string"?e:e?.message}function Or(e,t,n){let i={...e,path:e.path??[]};if(!e.message){let r=Of(e.inst?._zod.def?.error?.(e))??Of(t?.error?.(e))??Of(n.customError?.(e))??Of(n.localeError?.(e))??"Invalid input";i.message=r}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function _f(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Tf(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pe(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 $u(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function voe(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 yW(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function koe(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return hW(t+n)}function xoe(e){return yW(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $oe(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 Roe(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var gW,vw,XS,doe,Cf,eE,nE,rE,JS,Me=v(()=>{gW=Symbol("evaluating");vw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};XS=xu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});doe=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}`)}},Cf=new Set(["string","number","symbol"]),eE=new Set(["string","number","bigint","boolean","symbol","undefined"]);nE={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]},rE={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};JS=class{constructor(...t){}}});function Df(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 jf(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 iE(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 bW(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 oE(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 ${bW(i.path)}`);return t.join(`
8
8
  `)}var wW,If,Ar,sE=v(()=>{vu();Me();wW=(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,ku,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},If=F("$ZodError",wW),Ar=F("$ZodError",wW,{Parent:Error})});var Ru,kw,Su,xw,Eu,aE,Ou,cE,$w,Eoe,Rw,Ooe,Sw,Aoe,Ew,Poe,Ow,Coe,Aw,_oe,Pw,Toe,Cw,Ioe,lE=v(()=>{vu();sE();Me();Ru=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 Ni;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map(c=>Or(c,o,sn())));throw vw(a,r?.callee),a}return s.value},kw=Ru(Ar),Su=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 vw(a,r?.callee),a}return s.value},xw=Su(Ar),Eu=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 Ni;return o.issues.length?{success:!1,error:new(e??If)(o.issues.map(s=>Or(s,r,sn())))}:{success:!0,data:o.value}},aE=Eu(Ar),Ou=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}},cE=Ou(Ar),$w=e=>(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ru(e)(t,n,r)},Eoe=$w(Ar),Rw=e=>(t,n,i)=>Ru(e)(t,n,i),Ooe=Rw(Ar),Sw=e=>async(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Su(e)(t,n,r)},Aoe=Sw(Ar),Ew=e=>async(t,n,i)=>Su(e)(t,n,i),Poe=Ew(Ar),Ow=e=>(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Eu(e)(t,n,r)},Coe=Ow(Ar),Aw=e=>(t,n,i)=>Eu(e)(t,n,i),_oe=Aw(Ar),Pw=e=>async(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ou(e)(t,n,r)},Toe=Pw(Ar),Cw=e=>async(t,n,i)=>Ou(e)(t,n,i),Ioe=Cw(Ar)});var ci={};_e(ci,{base64:()=>SE,base64url:()=>_w,bigint:()=>_E,boolean:()=>IE,browserEmail:()=>Woe,cidrv4:()=>$E,cidrv6:()=>RE,cuid:()=>uE,cuid2:()=>dE,date:()=>OE,datetime:()=>PE,domain:()=>Uoe,duration:()=>hE,e164:()=>EE,email:()=>wE,emoji:()=>bE,extendedDuration:()=>Doe,guid:()=>yE,hex:()=>Voe,hostname:()=>zoe,html5Email:()=>Moe,idnEmail:()=>Goe,integer:()=>TE,ipv4:()=>vE,ipv6:()=>kE,ksuid:()=>mE,lowercase:()=>NE,mac:()=>xE,md5_base64:()=>qoe,md5_base64url:()=>Koe,md5_hex:()=>Hoe,nanoid:()=>gE,null:()=>DE,number:()=>Tw,rfc5322Email:()=>Foe,sha1_base64:()=>Zoe,sha1_base64url:()=>Yoe,sha1_hex:()=>Joe,sha256_base64:()=>Qoe,sha256_base64url:()=>ese,sha256_hex:()=>Xoe,sha384_base64:()=>nse,sha384_base64url:()=>rse,sha384_hex:()=>tse,sha512_base64:()=>ose,sha512_base64url:()=>sse,sha512_hex:()=>ise,string:()=>CE,time:()=>AE,ulid:()=>pE,undefined:()=>jE,unicodeEmail:()=>vW,uppercase:()=>LE,uuid:()=>Wc,uuid4:()=>joe,uuid6:()=>Noe,uuid7:()=>Loe,xid:()=>fE});function bE(){return new RegExp(Boe,"u")}function xW(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 AE(e){return new RegExp(`^${xW(e)}$`)}function PE(e){let t=xW({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(`^${kW}T(?:${i})$`)}function Nf(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Lf(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var uE,dE,pE,fE,mE,gE,hE,Doe,yE,Wc,joe,Noe,Loe,wE,Moe,Foe,vW,Goe,Woe,Boe,vE,kE,xE,$E,RE,SE,_w,zoe,Uoe,EE,kW,OE,CE,_E,TE,Tw,IE,DE,jE,NE,LE,Voe,Hoe,qoe,Koe,Joe,Zoe,Yoe,Xoe,Qoe,ese,tse,nse,rse,ise,ose,sse,Iw=v(()=>{Me();uE=/^[cC][^\s-]{8,}$/,dE=/^[0-9a-z]+$/,pE=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fE=/^[0-9a-vA-V]{20}$/,mE=/^[A-Za-z0-9]{27}$/,gE=/^[a-zA-Z0-9_-]{21}$/,hE=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Doe=/^[-+]?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)?)??$/,yE=/^([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})$/,Wc=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)$/,joe=Wc(4),Noe=Wc(6),Loe=Wc(7),wE=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Moe=/^[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])?)*$/,Foe=/^(([^<>()\[\]\\.,;:\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,}))$/,vW=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Goe=vW,Woe=/^[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])?)*$/,Boe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";vE=/^(?:(?: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])$/,kE=/^(([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}|:))$/,xE=e=>{let t=ai(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},$E=/^((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])$/,RE=/^(([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])$/,SE=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_w=/^[A-Za-z0-9_-]*$/,zoe=/^(?=.{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])?)*\.?$/,Uoe=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,EE=/^\+[1-9]\d{6,14}$/,kW="(?:(?:\\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])))",OE=new RegExp(`^${kW}$`);CE=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},_E=/^-?\d+n?$/,TE=/^-?\d+$/,Tw=/^-?\d+(?:\.\d+)?$/,IE=/^(?:true|false)$/i,DE=/^null$/i,jE=/^undefined$/i,NE=/^[^A-Z]*$/,LE=/^[^a-z]*$/,Voe=/^[0-9a-fA-F]*$/;Hoe=/^[0-9a-fA-F]{32}$/,qoe=Nf(22,"=="),Koe=Lf(22),Joe=/^[0-9a-fA-F]{40}$/,Zoe=Nf(27,"="),Yoe=Lf(27),Xoe=/^[0-9a-fA-F]{64}$/,Qoe=Nf(43,"="),ese=Lf(43),tse=/^[0-9a-fA-F]{96}$/,nse=Nf(64,""),rse=Lf(64),ise=/^[0-9a-fA-F]{128}$/,ose=Nf(86,"=="),sse=Lf(86)});function $W(e,t,n){e.issues.length&&t.issues.push(...qr(n,e.issues))}var Ft,RW,Dw,jw,ME,FE,GE,WE,BE,zE,UE,VE,HE,Au,qE,KE,JE,ZE,YE,XE,QE,eO,tO,Nw=v(()=>{vu();Iw();Me();Ft=F("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),RW={number:"number",bigint:"bigint",object:"date"},Dw=F("$ZodCheckLessThan",(e,t)=>{Ft.init(e,t);let n=RW[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)=>{Ft.init(e,t);let n=RW[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})}}),ME=F("$ZodCheckMultipleOf",(e,t)=>{Ft.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):ZS(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})}}),FE=F("$ZodCheckNumberFormat",(e,t)=>{Ft.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=nE[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=TE)}),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})}}),GE=F("$ZodCheckBigIntFormat",(e,t)=>{Ft.init(e,t);let[n,i]=rE[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})}}),WE=F("$ZodCheckMaxSize",(e,t)=>{var n;Ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ta(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:_f(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),BE=F("$ZodCheckMinSize",(e,t)=>{var n;Ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ta(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:_f(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),zE=F("$ZodCheckSizeEquals",(e,t)=>{var n;Ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ta(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:_f(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})}}),UE=F("$ZodCheckMaxLength",(e,t)=>{var n;Ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ta(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=Tf(r);i.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),VE=F("$ZodCheckMinLength",(e,t)=>{var n;Ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ta(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=Tf(r);i.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),HE=F("$ZodCheckLengthEquals",(e,t)=>{var n;Ft.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!ta(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=Tf(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})}}),Au=F("$ZodCheckStringFormat",(e,t)=>{var n,i;Ft.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=()=>{})}),qE=F("$ZodCheckRegex",(e,t)=>{Au.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})}}),KE=F("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=NE),Au.init(e,t)}),JE=F("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=LE),Au.init(e,t)}),ZE=F("$ZodCheckIncludes",(e,t)=>{Ft.init(e,t);let n=ai(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})}}),YE=F("$ZodCheckStartsWith",(e,t)=>{Ft.init(e,t);let n=new RegExp(`^${ai(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})}}),XE=F("$ZodCheckEndsWith",(e,t)=>{Ft.init(e,t);let n=new RegExp(`.*${ai(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})}});QE=F("$ZodCheckProperty",(e,t)=>{Ft.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=>$W(r,n,t.property));$W(i,n,t.property)}}),eO=F("$ZodCheckMimeType",(e,t)=>{Ft.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})}}),tO=F("$ZodCheckOverwrite",(e,t)=>{Ft.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}})});var Mf,nO=v(()=>{Mf=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 rO,iO=v(()=>{rO={major:4,minor:3,patch:6}});function EO(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function LW(e){if(!_w.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return EO(n)}function MW(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 EW(e,t,n){e.issues.length&&t.issues.push(...qr(n,e.issues)),t.value[n]=e.value}function Ww(e,t,n,i,r){if(e.issues.length){if(r&&!(n in i))return;t.issues.push(...qr(n,e.issues))}e.value===void 0?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function FW(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=tE(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function GW(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=>Ww(f,n,d,t,u))):Ww(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 OW(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=>!ia(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 AW(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 oO(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(ra(e)&&ra(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=oO(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=oO(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 PW(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}),ia(e))return e;let s=oO(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 Lw(e,t,n){e.issues.length&&t.issues.push(...qr(n,e.issues)),t.value[n]=e.value}function CW(e,t,n,i,r,o,s){e.issues.length&&(Cf.has(typeof i)?n.issues.push(...qr(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&&(Cf.has(typeof i)?n.issues.push(...qr(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 _W(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function TW(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}function IW(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function DW(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 Mw(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}function Fw(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=>Gw(e,o,t.out,n)):Gw(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(o=>Gw(e,o,t.in,n)):Gw(e,r,t.in,n)}}function Gw(e,t,n,i){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},i)}function jW(e){return e.value=Object.freeze(e.value),e}function NW(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($u(r))}}var Je,Bc,It,sO,aO,cO,lO,uO,dO,pO,fO,mO,gO,hO,yO,wO,bO,vO,kO,xO,$O,RO,SO,OO,AO,PO,CO,_O,Bw,TO,Ff,zw,IO,DO,jO,NO,LO,MO,FO,GO,WO,BO,WW,zO,Gf,UO,VO,HO,Uw,qO,KO,JO,ZO,YO,XO,QO,Vw,eA,tA,nA,rA,iA,oA,sA,aA,cA,Wf,lA,uA,dA,pA,fA,mA,gA=v(()=>{Nw();vu();nO();lE();Iw();Me();iO();Me();Je=F("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rO;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=ia(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 Ni;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(l||(l=ia(s,p)))});else{if(s.issues.length===p)continue;l||(l=ia(s,p))}}return u?u.then(()=>s):s},o=(s,a,c)=>{if(ia(s))return s.aborted=!0,s;let l=r(a,i,c);if(l instanceof Promise){if(c.async===!1)throw new Ni;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 Ni;return c.then(l=>r(l,i,a))}return r(c,i,a)}}st(e,"~standard",()=>({validate:r=>{try{let o=aE(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return cE(e,r).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Bc=F("$ZodString",(e,t)=>{Je.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??CE(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)=>{Au.init(e,t),Bc.init(e,t)}),sO=F("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=yE),It.init(e,t)}),aO=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=Wc(i))}else t.pattern??(t.pattern=Wc());It.init(e,t)}),cO=F("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wE),It.init(e,t)}),lO=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})}}}),uO=F("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=bE()),It.init(e,t)}),dO=F("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=gE),It.init(e,t)}),pO=F("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=uE),It.init(e,t)}),fO=F("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=dE),It.init(e,t)}),mO=F("$ZodULID",(e,t)=>{t.pattern??(t.pattern=pE),It.init(e,t)}),gO=F("$ZodXID",(e,t)=>{t.pattern??(t.pattern=fE),It.init(e,t)}),hO=F("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=mE),It.init(e,t)}),yO=F("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=PE(t)),It.init(e,t)}),wO=F("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=OE),It.init(e,t)}),bO=F("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=AE(t)),It.init(e,t)}),vO=F("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=hE),It.init(e,t)}),kO=F("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vE),It.init(e,t),e._zod.bag.format="ipv4"}),xO=F("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=kE),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})}}}),$O=F("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=xE(t.delimiter)),It.init(e,t),e._zod.bag.format="mac"}),RO=F("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$E),It.init(e,t)}),SO=F("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=RE),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})}}});OO=F("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=SE),It.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{EO(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});AO=F("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_w),It.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{LW(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),PO=F("$ZodE164",(e,t)=>{t.pattern??(t.pattern=EE),It.init(e,t)});CO=F("$ZodJWT",(e,t)=>{It.init(e,t),e._zod.check=n=>{MW(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),_O=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})}}),Bw=F("$ZodNumber",(e,t)=>{Je.init(e,t),e._zod.pattern=e._zod.bag.pattern??Tw,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}}),TO=F("$ZodNumberFormat",(e,t)=>{FE.init(e,t),Bw.init(e,t)}),Ff=F("$ZodBoolean",(e,t)=>{Je.init(e,t),e._zod.pattern=IE,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}}),zw=F("$ZodBigInt",(e,t)=>{Je.init(e,t),e._zod.pattern=_E,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}}),IO=F("$ZodBigIntFormat",(e,t)=>{GE.init(e,t),zw.init(e,t)}),DO=F("$ZodSymbol",(e,t)=>{Je.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}}),jO=F("$ZodUndefined",(e,t)=>{Je.init(e,t),e._zod.pattern=jE,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}}),NO=F("$ZodNull",(e,t)=>{Je.init(e,t),e._zod.pattern=DE,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}}),LO=F("$ZodAny",(e,t)=>{Je.init(e,t),e._zod.parse=n=>n}),MO=F("$ZodUnknown",(e,t)=>{Je.init(e,t),e._zod.parse=n=>n}),FO=F("$ZodNever",(e,t)=>{Je.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),GO=F("$ZodVoid",(e,t)=>{Je.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}}),WO=F("$ZodDate",(e,t)=>{Je.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}});BO=F("$ZodArray",(e,t)=>{Je.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=>EW(l,n,s))):EW(c,n,s)}return o.length?Promise.all(o).then(()=>n):n}});WW=F("$ZodObject",(e,t)=>{if(Je.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=xu(()=>FW(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=Gc,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=>Ww(w,a,p,l,g))):Ww(h,a,p,l,g)}return o?GW(u,l,a,c,i.value,e):u.length?Promise.all(u).then(()=>a):a}}),zO=F("$ZodObjectJIT",(e,t)=>{WW.init(e,t);let n=e._zod.parse,i=xu(()=>FW(t)),r=p=>{let f=new Mf(["shape","payload","ctx"]),g=i.value,h=$=>{let x=bw($);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=bw($),I=p[$]?._zod?.optout==="optional";f.write(`const ${x} = ${h($)};`),I?f.write(`
@@ -48,7 +48,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48
48
  `)}var C2=v(()=>{"use strict"});import{fork as $ce}from"node:child_process";function _2(e){let t="";return{push(n){t+=n.toString();let i=t.indexOf(`
49
49
  `);for(;i!==-1;)e(t.slice(0,i)),t=t.slice(i+1),i=t.indexOf(`
50
50
  `)},flush(){t.length>0&&(e(t),t="")}}}function Rce(e,t,n,i,r){let o=i.trim(),s=`${e}: child exited before reporting results (code ${t}, signal ${n})`;if(r.length>0){let a=r.map(c=>c&&typeof c=="object"?`{${Object.keys(c).join(", ")}}`:typeof c).join(", ");return`${s}. It sent ${r.length} message(s) the parent did not recognise (${a}), so the payload shape and the parent's check disagree`+(o?`: ${o}`:"")}return o?`${s}: ${o}`:t!==0||n!==null?s:`${s}. It exited cleanly with nothing on stderr, and no message arrived even after its IPC channel closed, so it never sent one: something it awaited never settled. On the run path the usual cause is a project file with a top-level \`await\` that does not settle. Module scope is arbitrary project source, an import of such a file never completes, and a promise that never settles is not a rejection, so the driver's own \`main().catch\` does not see it either. The config driver has nothing to await that can hang, and a failed send exits non-zero with a reason on stderr, so on the config path this has no known cause: please report it with the command that produced it (chant#2461).`}function Ece(e,t,n=Sce){e.on("exit",(i,r)=>{let o=!1,s,a=()=>{o||(o=!0,s!==void 0&&clearTimeout(s),t(i,r))};if(!e.connected){a();return}e.once("disconnect",a),s=setTimeout(a,n)})}function T2(e,t){let{bundlePath:n,bundleDir:i,projectRealpath:r,externalReadPaths:o,env:s,timeoutMs:a,label:c,send:l,outputPrefix:u}=e;return new Promise((d,p)=>{let f=[i,r,...o].map(P=>`--allow-fs-read=${P}`),g=$ce(n,[],{execArgv:["--permission",...f],env:s,stdio:["ignore","pipe","pipe","ipc"]}),h=!1,w="",b=[],k=setTimeout(()=>{h||(h=!0,g.kill(),p(new Error(`${c} timed out after ${a}ms`)))},a);l!==void 0&&g.send(l,P=>{h||!P||(h=!0,clearTimeout(k),g.kill(),p(new Error(`${c}: failed to send the child its input: ${P.message}`)))});let $=P=>{process.stderr.write(`${u} ${P}
51
- `)},x=_2($),R=_2($);g.stdout?.on("data",P=>{x.push(P)}),g.stdout?.on("end",()=>x.flush()),g.stderr?.on("data",P=>{w+=P.toString(),R.push(P)}),g.stderr?.on("end",()=>R.flush()),g.on("message",P=>{if(!h){if(!t(P)){b.push(P);return}h=!0,clearTimeout(k),g.kill(),d(P)}}),g.on("error",P=>{h||(h=!0,clearTimeout(k),p(P))}),Ece(g,(P,I)=>{h||(h=!0,clearTimeout(k),p(new Error(Rce(c,P,I,w,b))))})})}var Sce,I2=v(()=>{"use strict";Sce=2e3});var j2={};_e(j2,{evaluateConfigSandboxed:()=>_ce});import{realpathSync as Oce,rmSync as Ace}from"node:fs";import{resolve as D2}from"node:path";function Cce(e){return typeof e=="object"&&e!==null&&e.kind==="chant-config"&&typeof e.ok=="boolean"}async function _ce(e,t){let n=O2(e),{bundlePath:i,bundleDir:r,externalReadPaths:o,durationMs:s,bytes:a}=await S2(n);try{let c;try{c=Oce(D2(t))}catch{c=D2(t)}let l={PATH:process.env.PATH??""},u=process.env[Xu];u&&(l[Xu]=u);let d=await T2({bundlePath:i,bundleDir:r,projectRealpath:c,externalReadPaths:o,env:l,timeoutMs:Pce,label:`sandboxed evaluation of ${e}`,outputPrefix:"[sandbox:config]"},Cce);if(!d.ok)throw d.offenders&&d.offenders.length>0?new Error(P2(e,d.offenders)):new Error(d.error?.message?`Failed to evaluate ${e} inside the --sandbox boundary: ${d.error.message}`:`Failed to evaluate ${e} inside the --sandbox boundary`);return{config:d.config??{},bundleMs:s,bundleBytes:a}}finally{Ace(r,{recursive:!0,force:!0})}}var Pce,N2=v(()=>{"use strict";E2();A2();C2();I2();fm();Pce=6e4});import{dirname as Tce}from"node:path";function Dce(e){let t=Jr(e);return t.default??t.config??t}async function L2(e,t=Tce(e)){if(!Ice)return Dce(await y2(e));if(p_.has(e))return p_.get(e);let{evaluateConfigSandboxed:n}=await Promise.resolve().then(()=>(N2(),j2)),{config:i}=await n(e,t);return p_.set(e,i),i}var Ice,p_,f_=v(()=>{"use strict";w2();Zc();Ice=!1,p_=new Map});var y_={};_e(y_,{importLexiconModule:()=>el,importLexiconPackage:()=>Eo,lexiconDeclarationName:()=>B2,lexiconModulePath:()=>ys,lexiconModuleRoot:()=>h_,lexiconNames:()=>Gi,lexiconPackagesToInstall:()=>Bce,lexiconSourceLabel:()=>Wce,packageNameOf:()=>U2,pathLexiconMap:()=>Mce,pathLexiconRoot:()=>gv,recordedLexiconModules:()=>Fce,registerLexiconDeclarations:()=>da,resetLexiconModules:()=>Gce,resolveFromProject:()=>hv});import{createRequire as G2}from"node:module";import{dirname as jce,isAbsolute as Qc,join as Nce,relative as W2,resolve as Qu,sep as Lce}from"node:path";import{pathToFileURL as g_}from"node:url";function B2(e){return typeof e=="string"?e:e.name}function Gi(e){return e?.map(B2)}function m_(e,t){let n=W2(t,e);return n===""||!n.startsWith("..")&&!Qc(n)}function gv(e,t,n="."){let i=Qc(e.module)?e.module:Qu(t,e.module),r=e.root!==void 0,o=r?Qc(e.root)?Qu(e.root):Qu(t,e.root):jce(i),s=Qu(t),a=Qu(t,n),c;return m_(o,s)?m_(a,o)?c=`${o} contains the project's source directory (${a})`:m_(i,o)||(c=`the module ${i} is not inside ${o}`):c=`${o} is outside the project (${s})`,c===void 0?{root:o}:r?{problem:c}:{}}function da(e,t,n){let i={};for(let r of e??[]){if(typeof r=="string"){ua.delete(r),mm.delete(r);continue}let o=z2(r,t);ua.set(r.name,o),i[r.name]=o;let{root:s}=gv(r,t,n);s===void 0?mm.delete(r.name):mm.set(r.name,s)}return i}function z2(e,t){return Qc(e.module)?e.module:Qu(t,e.module)}function Mce(e,t){let n=new Map;for(let i of e)typeof i!="string"&&n.set(i.name,z2(i,t));return n}function Fce(){return new Map(ua)}function ys(e){return ua.get(e)}function h_(e){return mm.get(e)}function Gce(){ua.clear(),mm.clear()}async function el(e,t={}){let n=ua.get(e);if(n!==void 0)try{return(t.typeScript??!dv(n))&&mr(),Jr(await import(n))}catch(i){throw new Error(`lexicon "${e}" is declared with module ${n}, which could not be loaded: `+(i instanceof Error?i.message:String(i)))}}function Wce(e,t=process.cwd(),n=ua){let i=n.get(e);if(i===void 0)return`@intentius/chant-lexicon-${e}`;let r=W2(t,i);return r===""||r.startsWith("..")||Qc(r)?i:`./${r.split(Lce).join("/")}`}function Bce(e,t=ua){return e.filter(n=>!t.has(n)).map(n=>`@intentius/chant-lexicon-${n}`)}function U2(e){if(e.startsWith(".")||Qc(e)||e.startsWith("file:"))return;let t=e.split("/");return e.startsWith("@")?t.slice(0,2).join("/"):t[0]}function M2(e,t){let n=e?.code;if(n!=="ERR_MODULE_NOT_FOUND"&&n!=="MODULE_NOT_FOUND")return!1;let i=e instanceof Error?e.message:String(e);return i.includes(`'${t}'`)||i.includes(`"${t}"`)||i.includes(`${t}/`)}function hv(e,t=process.cwd()){try{return G2(Nce(t,"package.json")).resolve(e)}catch{return}}function zce(e){if(Qc(e))return g_(e).href;let t=import.meta.resolve;return typeof t=="function"?t(e):g_(G2(import.meta.url).resolve(e)).href}async function Eo(e,t=process.cwd()){let n=U2(e);if(g2()){let i;try{i=zce(e)}catch(r){if(n===void 0||!M2(r,n))mr();else return F2(e,t,r)}i!==void 0&&pv(i)}try{return Jr(await import(e))}catch(i){if(n===void 0||!M2(i,n))throw i;return F2(e,t,i)}}async function F2(e,t,n){let i=hv(e,t);if(i===void 0)throw n;return pv(i),Jr(await import(g_(i).href))}var ua,mm,nr=v(()=>{"use strict";So();Zc();Jc();ua=new Map,mm=new Map});var Uce,Vce,Hce,ed,V2,yv=v(()=>{"use strict";Rn();Uce=m.strictObject({env:m.string().min(1)}),Vce=m.strictObject({capability:m.string().min(1),member:m.string().min(1).optional(),env:m.string().min(1).optional()}),Hce=m.union([Uce,Vce]),ed=m.strictObject({url:m.string().min(1),key:Hce.optional(),timeoutMs:m.number().int().positive().optional()}),V2=m.strictObject({backends:m.record(m.string(),ed).optional()})});var wv,w_,qce,Kce,Jce,H2,q2=v(()=>{"use strict";Rn();wv=m.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"an environment variable name"),w_=m.union([m.string().min(1),m.literal(!1)]),qce=m.object({type:m.literal("npm"),packages:m.array(m.string().min(1)).min(1),registry:m.string().url().optional(),access:m.enum(["public","restricted"]).optional(),sbom:w_.optional(),stage:m.boolean().optional(),tokenEnv:wv.optional()}).strict(),Kce=m.object({type:m.literal("oci"),image:m.string().min(1),repository:m.string().min(1),tags:m.array(m.string().min(1)).optional(),usernameEnv:wv.optional(),passwordEnv:wv.optional(),sbom:w_.optional()}).strict(),Jce=m.object({type:m.literal("forge"),forge:m.enum(["github","gitlab","forgejo"]),repo:m.string().min(1),api:m.string().url().optional(),assets:m.array(m.string().min(1)).min(1),tag:m.string().min(1).optional(),tokenEnv:wv.optional(),sbom:w_.optional()}).strict(),H2=m.discriminatedUnion("type",[qce,Kce,Jce])});var E_={};_e(E_,{ChantConfigSchema:()=>hm,DEFAULT_CHANT_CONFIG:()=>$_,InvalidChantConfigError:()=>td,environmentEndpoint:()=>Q2,environmentName:()=>pa,environmentNames:()=>k_,findProjectConfigPastFragments:()=>ym,isEnvironmentPattern:()=>nd,isLintOnlyFragment:()=>vv,isOwnershipParamRef:()=>tV,loadChantConfig:()=>rd,loadChantConfigUpward:()=>bv,matchesDeclaredEnvironment:()=>gm,matchesEnvironmentPattern:()=>x_,ownershipEnvDisagreement:()=>Qce,resolveAutoReleaseDisabled:()=>ele,resolveDiscoveryGlobs:()=>wm,resolveFoldEnabled:()=>rV,resolveKnowledgeDir:()=>ile,resolveOwnershipEnv:()=>S_,resolveOwnershipMarker:()=>nV,resolveOwnershipStack:()=>R_,resolveSandboxEnabled:()=>iV,resolveSbomFormat:()=>tle,resolveSigningDefaults:()=>nle,resolveVulnPolicy:()=>rle});import{existsSync as K2,readFileSync as Y2}from"fs";import{dirname as X2,join as b_}from"path";function pa(e){return typeof e=="string"?e:e.name}function k_(e){return e?.map(pa)}function nd(e){return e.includes("*")}function x_(e,t){let n=e.split("*");if(n.length===1)return e===t;let i=n[0],r=n[n.length-1];if(!t.startsWith(i))return!1;let o=i.length;for(let s=1;s<n.length-1;s++){let a=n[s];if(a==="")continue;let c=t.indexOf(a,o);if(c===-1)return!1;o=c+a.length}return t.length-o>=r.length&&t.endsWith(r)}function gm(e,t){let n=k_(e)??[];return n.includes(t)?!0:n.some(i=>nd(i)&&x_(i,t))}function Q2(e,t){let n=e?.find(i=>pa(i)===t)??e?.find(i=>nd(pa(i))&&x_(pa(i),t));return n&&typeof n!="string"?n.endpoint:void 0}async function rd(e){let t=b_(e,"chant.config.ts");if(K2(t)){let i=await L2(t,e);return{config:Z2(i,t),configPath:t}}let n=b_(e,"chant.config.json");if(K2(n)){let{readFileSync:i}=await import("fs"),r=i(n,"utf-8"),o=JSON.parse(r);return{config:Z2(o,n),configPath:n}}return{config:$_}}async function bv(e){let{dir:t,configPath:n}=ym(e);return n&&Xce(n),rd(t)}function ym(e){let{dir:t,configPath:n}=um(e);for(;n&&vv(n);){let i=X2(t);if(i===t)break;({dir:t,configPath:n}=um(i))}return{dir:t,configPath:n}}async function wm(e){let{dir:t,configPath:n}=ym(e);if(!n)return;let i;try{({config:i}=await rd(t))}catch(s){if(s instanceof td&&(s.key==="exclude"||s.key==="include"))throw s;return}let r=i.exclude??[],o=i.include??[];if(!(r.length===0&&o.length===0))return{root:t,exclude:r,include:o}}function vv(e){if(!e.endsWith("chant.config.json"))return!1;try{let t=JSON.parse(Y2(e,"utf-8"));if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.keys(t).filter(i=>!eV(i));return n.length>0&&n.every(i=>v_.has(i))}catch{return!1}}function Xce(e){if(e.endsWith("chant.config.json"))try{let t=JSON.parse(Y2(e,"utf-8"));if(typeof t!="object"||t===null||Array.isArray(t))return;let n=Object.keys(t).filter(i=>!eV(i));if(n.some(i=>!v_.has(i))&&!n.some(i=>J2.has(i))){let i=n.filter(r=>!v_.has(r));console.error(`warning: ${e} is being used as the project config, but declares no project-level key (${[...J2].slice(0,4).join(", ")}, \u2026). ${i.length===1?"The key":"The keys"} ${i.map(r=>`"${r}"`).join(", ")} stopped the walk to the real one \u2014 any config above this file is being ignored. Prefix a comment key with "_", or move the key to the project config. (chant #1711)`)}}catch{}}function tV(e){return typeof e=="object"&&e!==null&&typeof e.param=="string"}function R_(e){let t=e.ownership;if(!(!t||!t.stack||t.enabled===!1))return t.stack}function S_(e,t){let n=e.ownership?.env;if(!tV(n))return n;let i=n.param,r=e.buildParams?.[i];if(!r)throw new Error(`ownership.env references build parameter "${i}", which chant.config.ts's buildParams does not declare`);let o=t?.find(s=>s.name===i);if(!o)throw new Error(`ownership.env references build parameter "${i}", which resolved to no value for this build \u2014 pass --param ${i}=<value>${r.env?`, set ${r.env}`:""}, or give it a default`);return String(o.value)}function nV(e,t){let n=R_(e);if(n!==void 0)return{stack:n,env:S_(e,t)}}function Qce(e,t){let n=e.ownership?.env;if(typeof n!="string"||R_(e)===void 0)return;let i=t?.find(r=>r.name==="env");if(!(!i||String(i.value)===n))return`ownership.env is "${n}" but the env build parameter resolved to ${JSON.stringify(i.value)} (${i.source}) \u2014 the ownership marker and params.env disagree about which environment this build is for. Use ownership: { env: { param: "env" } } so the marker follows the parameter.`}function ele(e,t){return t?!0:e.release?.autoRecord===!1}function rV(e,t){return t!==void 0?t:e.build?.fold!==void 0?e.build.fold:!0}function iV(e,t){return t?!0:e.build?.sandbox===!0}function tle(e,t){return t??e.sbom?.format??li}function nle(e){let t=e.signing,n=t?.keyless!==!1;return{keyless:n,...!n&&t?.key?{key:{key:t.key}}:{},identityPolicyDefaults:{expectedIssuer:t?.oidcIssuer,expectedIdentity:t?.identity,identityIsRegexp:t?.identityIsRegexp,key:t?.keyless===!1?t?.key:void 0}}}function rle(e){let t=e.vulnPolicy;if(!t)return{};let n={};return t.failSeverity&&(n.failSeverity=t.failSeverity),t.fixableOnly!==void 0&&(n.fixableOnly=t.fixableOnly),t.warnSeverity&&(n.warnSeverity=t.warnSeverity),t.failOnLicense!==void 0&&(n.failOnLicense=t.failOnLicense),t.failOnUnknownSeverity!==void 0&&(n.failOnUnknownSeverity=t.failOnUnknownSeverity),t.failOnKev!==void 0&&(n.failOnKev=t.failOnKev),t.failEpssAtOrAbove!==void 0&&(n.failEpssAtOrAbove=t.failEpssAtOrAbove),t.warnEpssAtOrAbove!==void 0&&(n.warnEpssAtOrAbove=t.warnEpssAtOrAbove),t.exploitabilityFixableOnly!==void 0&&(n.exploitabilityFixableOnly=t.exploitabilityFixableOnly),t.license&&(n.license=t.license),n}function ile(e,t){return b_(t,e.knowledge?.dir??"knowledge")}function Z2(e,t){if(typeof e!="object"||e===null)return $_;let n=hm.safeParse(e);if(!n.success){let a=n.error.issues[0],c=a.path.length>0?a.path.join("."):void 0,l=t?` in ${t}`:"";throw new td(`Invalid chant config${l}: ${c?`${c}: `:""}${a.message}`,a.path.length>0?String(a.path[0]):void 0)}let i=e.lexicons,r=t!==void 0?X2(t):process.cwd(),o=e.sourceDir;for(let[a,c]of(i??[]).entries()){if(typeof c=="string"||c.root===void 0)continue;let{problem:l}=gv(c,r,o);if(l!==void 0){let u=t?` in ${t}`:"";throw new td(`Invalid chant config${u}: lexicons.${a}.root: ${l}`,"lexicons")}}let s=da(i,r,o);return Object.keys(s).length>0?{...e,lexicons:Gi(i),lexiconModules:s}:e}var Zce,Yce,hm,$_,v_,eV,J2,td,zn=v(()=>{"use strict";Rn();hs();Mi();f_();nr();yv();q2();Zce=m.union([m.string().min(1),m.object({name:m.string().min(1),endpoint:m.string().min(1).optional(),canary:m.boolean().optional()})]),Yce=m.union([m.string().min(1),m.object({name:m.string().min(1),module:m.string().min(1),root:m.string().min(1).optional()}).strict()]),hm=m.object({lexicons:m.array(Yce).optional(),capabilities:m.array(m.string().min(1)).optional(),environments:m.array(Zce).optional(),sourceDir:m.string().min(1).optional(),lint:m.record(m.string(),m.unknown()).optional(),ownership:m.object({stack:m.string().min(1).optional(),env:m.union([m.string().min(1),m.object({param:m.string().min(1)})]).optional(),enabled:m.boolean().optional()}).optional(),build:m.object({fold:m.boolean().optional()}).optional(),buildParams:m.record(m.string(),m.object({type:m.enum(["string","number","boolean"]),default:m.union([m.string(),m.number(),m.boolean()]).optional(),enum:m.array(m.union([m.string(),m.number(),m.boolean()])).optional(),env:m.string().min(1).optional(),required:m.boolean().optional(),description:m.string().optional()})).optional(),release:m.object({autoRecord:m.boolean().optional(),publish:m.array(H2).optional()}).optional(),run:m.object({on:m.string().min(1).optional()}).strict().optional(),sbom:m.object({format:m.enum(["spdx","cyclonedx"]).optional(),enabled:m.boolean().optional()}).optional(),signing:m.object({keyless:m.boolean().optional(),oidcIssuer:m.string().min(1).optional(),identity:m.string().min(1).optional(),identityIsRegexp:m.boolean().optional(),key:m.string().min(1).optional()}).optional(),vulnPolicy:m.object({failSeverity:m.enum(["critical","high","medium","low","negligible","unknown"]).optional(),fixableOnly:m.boolean().optional(),warnSeverity:m.enum(["critical","high","medium","low","negligible","unknown"]).optional(),failOnLicense:m.boolean().optional(),failOnUnknownSeverity:m.boolean().optional(),failOnKev:m.boolean().optional(),failEpssAtOrAbove:m.number().min(0).max(1).optional(),warnEpssAtOrAbove:m.number().min(0).max(1).optional(),exploitabilityFixableOnly:m.boolean().optional(),license:m.object({allow:m.array(m.string()).optional(),deny:m.array(m.string()).optional()}).optional(),scanner:m.enum(["grype","trivy"]).optional(),vexSources:m.array(m.string()).optional()}).optional(),knowledge:m.object({dir:m.string().min(1).optional()}).optional(),codegen:m.object({outDir:m.string().min(1).optional()}).strict().optional(),decide:V2.optional(),exclude:m.array(m.string().min(1)).optional(),include:m.array(m.string().min(1)).optional(),rootOnly:m.boolean().optional()}).passthrough(),$_={};v_=new Set(["$schema","extends","rules","overrides","plugins","policies"]),eV=e=>e.startsWith("_");J2=new Set(Object.keys(hm.shape).filter(e=>e!=="lint"));td=class extends Error{constructor(n,i){super(n);this.key=i}}});var Xu,fm=v(()=>{"use strict";zn();Xu="CHANT_ENV"});var bm=ae((PWe,lV)=>{"use strict";var oV="[^\\\\/]",ole="(?=.)",sV="[^/]",O_="(?:\\/|$)",aV="(?:^|\\/)",A_=`\\.{1,2}${O_}`,sle="(?!\\.)",ale=`(?!${aV}${A_})`,cle=`(?!\\.{0,1}${O_})`,lle=`(?!${A_})`,ule="[^.\\/]",dle=`${sV}*?`,ple="/",cV={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:ole,QMARK:sV,END_ANCHOR:O_,DOTS_SLASH:A_,NO_DOT:sle,NO_DOTS:ale,NO_DOT_SLASH:cle,NO_DOTS_SLASH:lle,QMARK_NO_DOT:ule,STAR:dle,START_ANCHOR:aV,SEP:ple},fle={...cV,SLASH_LITERAL:"[\\\\/]",QMARK:oV,STAR:`${oV}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},mle={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};lV.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:mle,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?fle:cV}}});var vm=ae(_r=>{"use strict";var{REGEX_BACKSLASH:gle,REGEX_REMOVE_BACKSLASH:hle,REGEX_SPECIAL_CHARS:yle,REGEX_SPECIAL_CHARS_GLOBAL:wle}=bm();_r.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);_r.hasRegexChars=e=>yle.test(e);_r.isRegexChar=e=>e.length===1&&_r.hasRegexChars(e);_r.escapeRegex=e=>e.replace(wle,"\\$1");_r.toPosixSlashes=e=>e.replace(gle,"/");_r.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let e=navigator.platform.toLowerCase();return e==="win32"||e==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};_r.removeBackslashes=e=>e.replace(hle,t=>t==="\\"?"":t);_r.escapeLast=(e,t,n)=>{let i=e.lastIndexOf(t,n);return i===-1?e:e[i-1]==="\\"?_r.escapeLast(e,t,i-1):`${e.slice(0,i)}\\${e.slice(i)}`};_r.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n};_r.wrapOutput=(e,t={},n={})=>{let i=n.contains?"":"^",r=n.contains?"":"$",o=`${i}(?:${e})${r}`;return t.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};_r.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:"/"),i=n[n.length-1];return i===""?n[n.length-2]:i}});var yV=ae((_We,hV)=>{"use strict";var uV=vm(),{CHAR_ASTERISK:P_,CHAR_AT:ble,CHAR_BACKWARD_SLASH:km,CHAR_COMMA:vle,CHAR_DOT:C_,CHAR_EXCLAMATION_MARK:__,CHAR_FORWARD_SLASH:gV,CHAR_LEFT_CURLY_BRACE:T_,CHAR_LEFT_PARENTHESES:I_,CHAR_LEFT_SQUARE_BRACKET:kle,CHAR_PLUS:xle,CHAR_QUESTION_MARK:dV,CHAR_RIGHT_CURLY_BRACE:$le,CHAR_RIGHT_PARENTHESES:pV,CHAR_RIGHT_SQUARE_BRACKET:Rle}=bm(),fV=e=>e===gV||e===km,mV=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},Sle=(e,t)=>{let n=t||{},i=e.length-1,r=n.parts===!0||n.scanToEnd===!0,o=[],s=[],a=[],c=e,l=-1,u=0,d=0,p=!1,f=!1,g=!1,h=!1,w=!1,b=!1,k=!1,$=!1,x=!1,R=!1,P=0,I,A,W={value:"",depth:0,isGlob:!1},_=()=>l>=i,re=()=>c.charCodeAt(l+1),j=()=>(I=A,c.charCodeAt(++l));for(;l<i;){A=j();let ke;if(A===km){k=W.backslashes=!0,A=j(),A===T_&&(b=!0);continue}if(b===!0||A===T_){for(P++;_()!==!0&&(A=j());){if(A===km){k=W.backslashes=!0,j();continue}if(A===T_){P++;continue}if(b!==!0&&A===C_&&(A=j())===C_){if(p=W.isBrace=!0,g=W.isGlob=!0,R=!0,r===!0)continue;break}if(b!==!0&&A===vle){if(p=W.isBrace=!0,g=W.isGlob=!0,R=!0,r===!0)continue;break}if(A===$le&&(P--,P===0)){b=!1,p=W.isBrace=!0,R=!0;break}}if(r===!0)continue;break}if(A===gV){if(o.push(l),s.push(W),W={value:"",depth:0,isGlob:!1},R===!0)continue;if(I===C_&&l===u+1){u+=2;continue}d=l+1;continue}if(n.noext!==!0&&(A===xle||A===ble||A===P_||A===dV||A===__)===!0&&re()===I_){if(g=W.isGlob=!0,h=W.isExtglob=!0,R=!0,A===__&&l===u&&(x=!0),r===!0){for(;_()!==!0&&(A=j());){if(A===km){k=W.backslashes=!0,A=j();continue}if(A===pV){g=W.isGlob=!0,R=!0;break}}continue}break}if(A===P_){if(I===P_&&(w=W.isGlobstar=!0),g=W.isGlob=!0,R=!0,r===!0)continue;break}if(A===dV){if(g=W.isGlob=!0,R=!0,r===!0)continue;break}if(A===kle){for(;_()!==!0&&(ke=j());){if(ke===km){k=W.backslashes=!0,j();continue}if(ke===Rle){f=W.isBracket=!0,g=W.isGlob=!0,R=!0;break}}if(r===!0)continue;break}if(n.nonegate!==!0&&A===__&&l===u){$=W.negated=!0,u++;continue}if(n.noparen!==!0&&A===I_){if(g=W.isGlob=!0,r===!0){for(;_()!==!0&&(A=j());){if(A===I_){k=W.backslashes=!0,A=j();continue}if(A===pV){R=!0;break}}continue}break}if(g===!0){if(R=!0,r===!0)continue;break}}n.noext===!0&&(h=!1,g=!1);let N=c,C="",T="";u>0&&(C=c.slice(0,u),c=c.slice(u),d-=u),N&&g===!0&&d>0?(N=c.slice(0,d),T=c.slice(d)):g===!0?(N="",T=c):N=c,N&&N!==""&&N!=="/"&&N!==c&&fV(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),n.unescape===!0&&(T&&(T=uV.removeBackslashes(T)),N&&k===!0&&(N=uV.removeBackslashes(N)));let G={prefix:C,input:e,start:u,base:N,glob:T,isBrace:p,isBracket:f,isGlob:g,isExtglob:h,isGlobstar:w,negated:$,negatedExtglob:x};if(n.tokens===!0&&(G.maxDepth=0,fV(A)||s.push(W),G.tokens=s),n.parts===!0||n.tokens===!0){let ke;for(let ne=0;ne<o.length;ne++){let be=ke?ke+1:u,Be=o[ne],dt=e.slice(be,Be);n.tokens&&(ne===0&&u!==0?(s[ne].isPrefix=!0,s[ne].value=C):s[ne].value=dt,mV(s[ne]),G.maxDepth+=s[ne].depth),(ne!==0||dt!=="")&&a.push(dt),ke=Be}if(ke&&ke+1<e.length){let ne=e.slice(ke+1);a.push(ne),n.tokens&&(s[s.length-1].value=ne,mV(s[s.length-1]),G.maxDepth+=s[s.length-1].depth)}G.slashes=o,G.parts=a}return G};hV.exports=Sle});var xV=ae((TWe,kV)=>{"use strict";var xm=bm(),Zr=vm(),{MAX_LENGTH:kv,POSIX_REGEX_SOURCE:Ele,REGEX_NON_SPECIAL_CHARS:Ole,REGEX_SPECIAL_CHARS_BACKREF:Ale,REPLACEMENTS:wV}=xm,Ple=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let n=`[${e.join("-")}]`;try{new RegExp(n)}catch{return e.map(r=>Zr.escapeRegex(r)).join("..")}return n},id=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,bV=e=>{let t=[],n=0,i=0,r=0,o="",s=!1;for(let a of e){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){r=r===1?0:1,o+=a;continue}if(r===0){if(a==="[")n++;else if(a==="]"&&n>0)n--;else if(n===0){if(a==="(")i++;else if(a===")"&&i>0)i--;else if(a==="|"&&i===0){t.push(o),o="";continue}}}o+=a}return t.push(o),t},Cle=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n==="\\"){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},vV=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(Cle(t))return t.replace(/\\(.)/g,"$1")},_le=e=>{let t=e.map(vV).filter(Boolean);for(let n=0;n<t.length;n++)for(let i=n+1;i<t.length;i++){let r=t[n],o=t[i],s=r[0];if(!(!s||r!==s.repeat(r.length)||o!==s.repeat(o.length))&&(r===o||r.startsWith(o)||o.startsWith(r)))return!0}return!1},D_=(e,t=!0)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let n=0,i=0,r=0,o=!1;for(let s=1;s<e.length;s++){let a=e[s];if(o===!0){o=!1;continue}if(a==="\\"){o=!0;continue}if(a==='"'){r=r===1?0:1;continue}if(r!==1){if(a==="["){n++;continue}if(a==="]"&&n>0){n--;continue}if(!(n>0)){if(a==="("){i++;continue}if(a===")"&&(i--,i===0))return t===!0&&s!==e.length-1?void 0:{type:e[0],body:e.slice(2,s),end:s}}}}},Tle=e=>{let t=0,n=[];for(;t<e.length;){let r=D_(e.slice(t),!1);if(!r||r.type!=="*")return;let o=bV(r.body).map(a=>a.trim());if(o.length!==1)return;let s=vV(o[0]);if(!s||s.length!==1)return;n.push(s),t+=r.end+1}return n.length<1?void 0:`${n.length===1?Zr.escapeRegex(n[0]):`[${n.map(r=>Zr.escapeRegex(r)).join("")}]`}*`},Ile=e=>{let t=0,n=e.trim(),i=D_(n);for(;i;)t++,n=i.body.trim(),i=D_(n);return t},Dle=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let n=typeof t.maxExtglobRecursion=="number"?t.maxExtglobRecursion:xm.DEFAULT_MAX_EXTGLOB_RECURSION,i=bV(e).map(r=>r.trim());if(i.length>1&&(i.some(r=>r==="")||i.some(r=>/^[*?]+$/.test(r))||_le(i)))return{risky:!0};for(let r of i){let o=Tle(r);if(o)return{risky:!0,safeOutput:o};if(Ile(r)>n)return{risky:!0}}return{risky:!1}},j_=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=wV[e]||e;let n={...t},i=typeof n.maxLength=="number"?Math.min(kv,n.maxLength):kv,r=e.length;if(r>i)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${i}`);let o={type:"bos",value:"",output:n.prepend||""},s=[o],a=n.capture?"":"?:",c=xm.globChars(n.windows),l=xm.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:p,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:h,NO_DOT_SLASH:w,NO_DOTS_SLASH:b,QMARK:k,QMARK_NO_DOT:$,STAR:x,START_ANCHOR:R}=c,P=ee=>`(${a}(?:(?!${R}${ee.dot?g:u}).)*?)`,I=n.dot?"":h,A=n.dot?k:$,W=n.bash===!0?P(n):x;n.capture&&(W=`(${W})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let _={input:e,index:-1,start:0,dot:n.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};e=Zr.removePrefix(e,_),r=e.length;let re=[],j=[],N=[],C=o,T,G=()=>_.index===r-1,ke=_.peek=(ee=1)=>e[_.index+ee],ne=_.advance=()=>e[++_.index]||"",be=()=>e.slice(_.index+1),Be=(ee="",Ve=0)=>{_.consumed+=ee,_.index+=Ve},dt=ee=>{_.output+=ee.output!=null?ee.output:ee.value,Be(ee.value)},te=()=>{let ee=1;for(;ke()==="!"&&(ke(2)!=="("||ke(3)==="?");)ne(),_.start++,ee++;return ee%2===0?!1:(_.negated=!0,_.start++,!0)},ye=ee=>{_[ee]++,N.push(ee)},ge=ee=>{_[ee]--,N.pop()},oe=ee=>{if(C.type==="globstar"){let Ve=_.braces>0&&(ee.type==="comma"||ee.type==="brace"),z=ee.extglob===!0||re.length&&(ee.type==="pipe"||ee.type==="paren");ee.type!=="slash"&&ee.type!=="paren"&&!Ve&&!z&&(_.output=_.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=W,_.output+=C.output)}if(re.length&&ee.type!=="paren"&&(re[re.length-1].inner+=ee.value),(ee.value||ee.output)&&dt(ee),C&&C.type==="text"&&ee.type==="text"){C.output=(C.output||C.value)+ee.value,C.value+=ee.value;return}ee.prev=C,s.push(ee),C=ee},Se=(ee,Ve)=>{let z={...l[Ve],conditions:1,inner:""};z.prev=C,z.parens=_.parens,z.output=_.output,z.startIndex=_.index,z.tokensIndex=s.length;let $e=(n.capture?"(":"")+z.open;ye("parens"),oe({type:ee,value:Ve,output:_.output?"":f}),oe({type:"paren",extglob:!0,value:ne(),output:$e}),re.push(z)},Ne=ee=>{let Ve=e.slice(ee.startIndex,_.index+1),z=e.slice(ee.startIndex+2,_.index),$e=Dle(z,n);if((ee.type==="plus"||ee.type==="star")&&$e.risky){let ct=$e.safeOutput?(ee.output?"":f)+(n.capture?`(${$e.safeOutput})`:$e.safeOutput):void 0,Vt=s[ee.tokensIndex];Vt.type="text",Vt.value=Ve,Vt.output=ct||Zr.escapeRegex(Ve);for(let U=ee.tokensIndex+1;U<s.length;U++)s[U].value="",s[U].output="",delete s[U].suffix;_.output=ee.output+Vt.output,_.backtrack=!0,oe({type:"paren",extglob:!0,value:T,output:""}),ge("parens");return}let Ie=ee.close+(n.capture?")":""),et;if(ee.type==="negate"){let ct=W;if(ee.inner&&ee.inner.length>1&&ee.inner.includes("/")&&(ct=P(n)),(ct!==W||G()||/^\)+$/.test(be()))&&(Ie=ee.close=`)$))${ct}`),ee.inner.includes("*")&&(et=be())&&/^\.[^\\/.]+$/.test(et)){let Vt=j_(et,{...t,fastpaths:!1}).output;Ie=ee.close=`)${Vt})${ct})`}ee.prev.type==="bos"&&(_.negatedExtglob=!0)}oe({type:"paren",extglob:!0,value:T,output:Ie}),ge("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let ee=!1,Ve=e.replace(Ale,(z,$e,Ie,et,ct,Vt)=>et==="\\"?(ee=!0,z):et==="?"?$e?$e+et+(ct?k.repeat(ct.length):""):Vt===0?A+(ct?k.repeat(ct.length):""):k.repeat(Ie.length):et==="."?u.repeat(Ie.length):et==="*"?$e?$e+et+(ct?W:""):W:$e?z:`\\${z}`);return ee===!0&&(n.unescape===!0?Ve=Ve.replace(/\\/g,""):Ve=Ve.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),Ve===e&&n.contains===!0?(_.output=e,_):(_.output=Zr.wrapOutput(Ve,_,t),_)}for(;!G();){if(T=ne(),T==="\0")continue;if(T==="\\"){let z=ke();if(z==="/"&&n.bash!==!0||z==="."||z===";")continue;if(!z){T+="\\",oe({type:"text",value:T});continue}let $e=/^\\+/.exec(be()),Ie=0;if($e&&$e[0].length>2&&(Ie=$e[0].length,_.index+=Ie,Ie%2!==0&&(T+="\\")),n.unescape===!0?T=ne():T+=ne(),_.brackets===0){oe({type:"text",value:T});continue}}if(_.brackets>0&&(T!=="]"||C.value==="["||C.value==="[^")){if(n.posix!==!1&&T===":"){let z=C.value.slice(1);if(z.includes("[")&&(C.posix=!0,z.includes(":"))){let $e=C.value.lastIndexOf("["),Ie=C.value.slice(0,$e),et=C.value.slice($e+2),ct=Ele[et];if(ct){C.value=Ie+ct,_.backtrack=!0,ne(),!o.output&&s.indexOf(C)===1&&(o.output=f);continue}}}(T==="["&&ke()!==":"||T==="-"&&ke()==="]")&&(T=`\\${T}`),T==="]"&&(C.value==="["||C.value==="[^")&&(T=`\\${T}`),n.posix===!0&&T==="!"&&C.value==="["&&(T="^"),C.value+=T,dt({value:T});continue}if(_.quotes===1&&T!=='"'){T=Zr.escapeRegex(T),C.value+=T,dt({value:T});continue}if(T==='"'){_.quotes=_.quotes===1?0:1,n.keepQuotes===!0&&oe({type:"text",value:T});continue}if(T==="("){ye("parens"),oe({type:"paren",value:T});continue}if(T===")"){if(_.parens===0&&n.strictBrackets===!0)throw new SyntaxError(id("opening","("));let z=re[re.length-1];if(z&&_.parens===z.parens+1){Ne(re.pop());continue}oe({type:"paren",value:T,output:_.parens?")":"\\)"}),ge("parens");continue}if(T==="["){if(n.nobracket===!0||!be().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(id("closing","]"));T=`\\${T}`}else ye("brackets");oe({type:"bracket",value:T});continue}if(T==="]"){if(n.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){oe({type:"text",value:T,output:`\\${T}`});continue}if(_.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(id("opening","["));oe({type:"text",value:T,output:`\\${T}`});continue}ge("brackets");let z=C.value.slice(1);if(C.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(T=`/${T}`),C.value+=T,dt({value:T}),n.literalBrackets===!1||Zr.hasRegexChars(z))continue;let $e=Zr.escapeRegex(C.value);if(_.output=_.output.slice(0,-C.value.length),n.literalBrackets===!0){_.output+=$e,C.value=$e;continue}C.value=`(${a}${$e}|${C.value})`,_.output+=C.value;continue}if(T==="{"&&n.nobrace!==!0){ye("braces");let z={type:"brace",value:T,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};j.push(z),oe(z);continue}if(T==="}"){let z=j[j.length-1];if(n.nobrace===!0||!z){oe({type:"text",value:T,output:T});continue}let $e=")";if(z.dots===!0){let Ie=s.slice(),et=[];for(let ct=Ie.length-1;ct>=0&&(s.pop(),Ie[ct].type!=="brace");ct--)Ie[ct].type!=="dots"&&et.unshift(Ie[ct].value);$e=Ple(et,n),_.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let Ie=_.output.slice(0,z.outputIndex),et=_.tokens.slice(z.tokensIndex);z.value=z.output="\\{",T=$e="\\}",_.output=Ie;for(let ct of et)_.output+=ct.output||ct.value}oe({type:"brace",value:T,output:$e}),ge("braces"),j.pop();continue}if(T==="|"){re.length>0&&re[re.length-1].conditions++,oe({type:"text",value:T});continue}if(T===","){let z=T,$e=j[j.length-1];$e&&N[N.length-1]==="braces"&&($e.comma=!0,z="|"),oe({type:"comma",value:T,output:z});continue}if(T==="/"){if(C.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),C=o;continue}oe({type:"slash",value:T,output:p});continue}if(T==="."){if(_.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let z=j[j.length-1];C.type="dots",C.output+=T,C.value+=T,z.dots=!0;continue}if(_.braces+_.parens===0&&C.type!=="bos"&&C.type!=="slash"){oe({type:"text",value:T,output:u});continue}oe({type:"dot",value:T,output:u});continue}if(T==="?"){if(!(C&&C.value==="(")&&n.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){Se("qmark",T);continue}if(C&&C.type==="paren"){let $e=ke(),Ie=T;(C.value==="("&&!/[!=<:]/.test($e)||$e==="<"&&!/<([!=]|\w+>)/.test(be()))&&(Ie=`\\${T}`),oe({type:"text",value:T,output:Ie});continue}if(n.dot!==!0&&(C.type==="slash"||C.type==="bos")){oe({type:"qmark",value:T,output:$});continue}oe({type:"qmark",value:T,output:k});continue}if(T==="!"){if(n.noextglob!==!0&&ke()==="("&&(ke(2)!=="?"||!/[!=<:]/.test(ke(3)))){Se("negate",T);continue}if(n.nonegate!==!0&&_.index===0){te();continue}}if(T==="+"){if(n.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){Se("plus",T);continue}if(C&&C.value==="("||n.regex===!1){oe({type:"plus",value:T,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||_.parens>0){oe({type:"plus",value:T});continue}oe({type:"plus",value:d});continue}if(T==="@"){if(n.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){oe({type:"at",extglob:!0,value:T,output:""});continue}oe({type:"text",value:T});continue}if(T!=="*"){(T==="$"||T==="^")&&(T=`\\${T}`);let z=Ole.exec(be());z&&(T+=z[0],_.index+=z[0].length),oe({type:"text",value:T});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=T,C.output=W,_.backtrack=!0,_.globstar=!0,Be(T);continue}let ee=be();if(n.noextglob!==!0&&/^\([^?]/.test(ee)){Se("star",T);continue}if(C.type==="star"){if(n.noglobstar===!0){Be(T);continue}let z=C.prev,$e=z.prev,Ie=z.type==="slash"||z.type==="bos",et=$e&&($e.type==="star"||$e.type==="globstar");if(n.bash===!0&&(!Ie||ee[0]&&ee[0]!=="/")){oe({type:"star",value:T,output:""});continue}let ct=_.braces>0&&(z.type==="comma"||z.type==="brace"),Vt=re.length&&(z.type==="pipe"||z.type==="paren");if(!Ie&&z.type!=="paren"&&!ct&&!Vt){oe({type:"star",value:T,output:""});continue}for(;ee.slice(0,3)==="/**";){let U=e[_.index+4];if(U&&U!=="/")break;ee=ee.slice(3),Be("/**",3)}if(z.type==="bos"&&G()){C.type="globstar",C.value+=T,C.output=P(n),_.output=C.output,_.globstar=!0,Be(T);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!et&&G()){_.output=_.output.slice(0,-(z.output+C.output).length),z.output=`(?:${z.output}`,C.type="globstar",C.output=P(n)+(n.strictSlashes?")":"|$)"),C.value+=T,_.globstar=!0,_.output+=z.output+C.output,Be(T);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&ee[0]==="/"){let U=ee[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(z.output+C.output).length),z.output=`(?:${z.output}`,C.type="globstar",C.output=`${P(n)}${p}|${p}${U})`,C.value+=T,_.output+=z.output+C.output,_.globstar=!0,Be(T+ne()),oe({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&ee[0]==="/"){C.type="globstar",C.value+=T,C.output=`(?:^|${p}|${P(n)}${p})`,_.output=C.output,_.globstar=!0,Be(T+ne()),oe({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-C.output.length),C.type="globstar",C.output=P(n),C.value+=T,_.output+=C.output,_.globstar=!0,Be(T);continue}let Ve={type:"star",value:T,output:W};if(n.bash===!0){Ve.output=".*?",(C.type==="bos"||C.type==="slash")&&(Ve.output=I+Ve.output),oe(Ve);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&n.regex===!0){Ve.output=T,oe(Ve);continue}(_.index===_.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?(_.output+=w,C.output+=w):n.dot===!0?(_.output+=b,C.output+=b):(_.output+=I,C.output+=I),ke()!=="*"&&(_.output+=f,C.output+=f)),oe(Ve)}for(;_.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(id("closing","]"));_.output=Zr.escapeLast(_.output,"["),ge("brackets")}for(;_.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(id("closing",")"));_.output=Zr.escapeLast(_.output,"("),ge("parens")}for(;_.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(id("closing","}"));_.output=Zr.escapeLast(_.output,"{"),ge("braces")}if(n.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&oe({type:"maybe_slash",value:"",output:`${p}?`}),_.backtrack===!0){_.output="";for(let ee of _.tokens)_.output+=ee.output!=null?ee.output:ee.value,ee.suffix&&(_.output+=ee.suffix)}return _};j_.fastpaths=(e,t)=>{let n={...t},i=typeof n.maxLength=="number"?Math.min(kv,n.maxLength):kv,r=e.length;if(r>i)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${i}`);e=wV[e]||e;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:p,START_ANCHOR:f}=xm.globChars(n.windows),g=n.dot?u:l,h=n.dot?d:l,w=n.capture?"":"?:",b={negated:!1,prefix:""},k=n.bash===!0?".*?":p;n.capture&&(k=`(${k})`);let $=I=>I.noglobstar===!0?k:`(${w}(?:(?!${f}${I.dot?c:o}).)*?)`,x=I=>{switch(I){case"*":return`${g}${a}${k}`;case".*":return`${o}${a}${k}`;case"*.*":return`${g}${k}${o}${a}${k}`;case"*/*":return`${g}${k}${s}${a}${h}${k}`;case"**":return g+$(n);case"**/*":return`(?:${g}${$(n)}${s})?${h}${a}${k}`;case"**/*.*":return`(?:${g}${$(n)}${s})?${h}${k}${o}${a}${k}`;case"**/.*":return`(?:${g}${$(n)}${s})?${o}${a}${k}`;default:{let A=/^(.*?)\.(\w+)$/.exec(I);if(!A)return;let W=x(A[1]);return W?W+o+A[2]:void 0}}},R=Zr.removePrefix(e,b),P=x(R);return P&&n.strictSlashes!==!0&&(P+=`${s}?`),P};kV.exports=j_});var SV=ae((IWe,RV)=>{"use strict";var jle=yV(),N_=xV(),$V=vm(),Nle=bm(),Lle=e=>e&&typeof e=="object"&&!Array.isArray(e),cn=(e,t,n=!1)=>{if(Array.isArray(e)){let u=e.map(p=>cn(p,t,n));return p=>{for(let f of u){let g=f(p);if(g)return g}return!1}}let i=Lle(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!i)throw new TypeError("Expected pattern to be a non-empty string");let r=t||{},o=r.windows,s=i?cn.compileRe(e,t):cn.makeRe(e,t,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(r.ignore){let u={...t,ignore:null,onMatch:null,onResult:null};c=cn(r.ignore,u,n)}let l=(u,d=!1)=>{let{isMatch:p,match:f,output:g}=cn.test(u,s,t,{glob:e,posix:o}),h={glob:e,state:a,regex:s,posix:o,input:u,output:g,match:f,isMatch:p};return typeof r.onResult=="function"&&r.onResult(h),p===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof r.onIgnore=="function"&&r.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof r.onMatch=="function"&&r.onMatch(h),d?h:!0)};return n&&(l.state=a),l};cn.test=(e,t,n,{glob:i,posix:r}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let o=n||{},s=o.format||(r?$V.toPosixSlashes:null),a=e===i,c=a&&s?s(e):e;return a===!1&&(c=s?s(e):e,a=c===i),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=cn.matchBase(e,t,n,r):a=t.exec(c)),{isMatch:!!a,match:a,output:c}};cn.matchBase=(e,t,n)=>(t instanceof RegExp?t:cn.makeRe(t,n)).test($V.basename(e));cn.isMatch=(e,t,n)=>cn(t,n)(e);cn.parse=(e,t)=>Array.isArray(e)?e.map(n=>cn.parse(n,t)):N_(e,{...t,fastpaths:!1});cn.scan=(e,t)=>jle(e,t);cn.compileRe=(e,t,n=!1,i=!1)=>{if(n===!0)return e.output;let r=t||{},o=r.contains?"":"^",s=r.contains?"":"$",a=`${o}(?:${e.output})${s}`;e&&e.negated===!0&&(a=`^(?!${a}).*$`);let c=cn.toRegex(a,t);return i===!0&&(c.state=e),c};cn.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let r={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(r.output=N_.fastpaths(e,t)),r.output||(r=N_(e,t)),cn.compileRe(r,t,n,i)};cn.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(n){if(t&&t.debug===!0)throw n;return/$^/}};cn.constants=Nle;RV.exports=cn});var $m=ae((DWe,AV)=>{"use strict";var EV=SV(),Mle=vm();function OV(e,t,n=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:Mle.isWindows()}),EV(e,t,n)}Object.assign(OV,EV);AV.exports=OV});import{dirname as Fle}from"path";import{fileURLToPath as Gle}from"url";import{createHash as Wle}from"crypto";import{execFile as Ble}from"child_process";function M_(){return xv=new L_,xv}function bt(){return xv||M_()}function F_(e){return Fle(Gle(e))}var PV,L_,xv,Oo=v(()=>{"use strict";PV=Ye($m(),1),L_=class{constructor(){this.name="node";this.hashAlgorithm="sha256";this.commands={runner:"node",exec:"npx",packCmd:["npm","pack"]}}hash(t){return Wle("sha256").update(t).digest("hex")}globMatch(t,n){return(0,PV.default)(t)(n)}async spawn(t,n){return new Promise(i=>{let r=Ble(t[0],t.slice(1),{cwd:n?.cwd,maxBuffer:10485760,...n?.env?{env:{...process.env,...n.env}}:{}},(o,s,a)=>{i({stdout:s??"",stderr:a??"",exitCode:o?o.code??1:0})});r.stdin&&(r.stdin.on("error",()=>{}),r.stdin.end(n?.stdin??""))})}}});import{createHmac as zle,timingSafeEqual as WWe}from"node:crypto";function G_(e=$v){let t=e.toLowerCase();return{signature:`${t}-signature`,timestamp:`${t}-timestamp`,event:`${t}-event`,delivery:`${t}-delivery`}}function W_(e,t,n){return`sha256=${zle("sha256",e).update(`${String(t)}.${n}`,"utf8").digest("hex")}`}var $v,B_=v(()=>{"use strict";$v="x-chant"});import{createHash as Ule,randomUUID as Vle}from"node:crypto";function qle(e){let t={};e.CI_JOB_URL?t.url=e.CI_JOB_URL:e.GITHUB_SERVER_URL&&e.GITHUB_REPOSITORY&&e.GITHUB_RUN_ID?t.url=`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`:e.CI_PIPELINE_URL&&(t.url=e.CI_PIPELINE_URL),e.GITLAB_CI==="true"?t.forge="gitlab":e.GITEA_ACTIONS==="true"||e.FORGEJO_ACTIONS==="true"?t.forge="forgejo":e.GITHUB_ACTIONS==="true"&&(t.forge="github");let n=e.GITHUB_REPOSITORY||e.CI_PROJECT_PATH;n&&(t.repository=n);let i=e.GITHUB_SHA||e.CI_COMMIT_SHA;return i&&(t.commit=i),t}function TV(e,t={}){let n=t.env??process.env,{id:i,project:r,targets:o,run:s,...a}=e,c={...qle(n),...s??{}},l=r??c.repository??"this project",u=e.digest??e.drift?.fingerprint??c.commit,d=i??(u?Ule("sha256").update(JSON.stringify([e.source,l,e.event,e.wave?.number??null,e.environment??null,u])).digest("hex"):Vle());return{schema:Hle,id:d,at:(t.now??new Date).toISOString(),...a,project:l,targets:o??[],...Object.keys(c).length>0?{run:c}:{}}}function IV(e){if(e.summary)return`${e.source}: ${e.summary}`;let t=e.wave?`wave ${e.wave.number}${e.wave.name?` (${e.wave.name})`:""} of ${e.project}`:e.environment?`${e.environment} in ${e.project}`:e.project;return`${e.source}: ${t} ${Kle[e.event]}`}function DV(e){let t=[];return e.approve?.review&&t.push({title:"Review and approve",value:`pull request ${e.approve.review.pr}, then run it again`,link:e.approve.review.url}),e.drift?(e.drift.changed.length>0&&t.push({title:"Drifted",value:e.drift.changed.join(", ")}),e.drift.missing?.length&&t.push({title:"Missing",value:e.drift.missing.join(", ")}),e.drift.failed?.length&&t.push({title:"Not refreshed",value:e.drift.failed.join(", ")})):e.targets.length>0&&t.push({title:"Targets",value:e.targets.join(", ")}),e.digest&&t.push({title:"Digest",value:e.digest}),e.approve&&t.push({title:e.approve.review?"Or approve":"Approve",value:e.approve.command}),e.reason&&t.push({title:"Reason",value:e.reason}),e.run?.url&&t.push({title:"Run",value:e.run.url,link:e.run.url}),e.reportUrl&&t.push({title:"Report",value:e.reportUrl,link:e.reportUrl}),t}function Jle(e){let t=[`*${IV(e)}*`];for(let n of DV(e))n.title==="Review and approve"?t.push(`${n.title}: <${n.link}|pull request ${e.approve.review.pr}>, then run it again`):n.title==="Approve"||n.title==="Or approve"||n.title==="Digest"?t.push(`${n.title}: \`${n.value}\``):n.link?t.push(`${n.title}: <${n.link}>`):t.push(`${n.title}: ${n.value}`);return{text:t.join(`
51
+ `)},x=_2($),R=_2($);g.stdout?.on("data",P=>{x.push(P)}),g.stdout?.on("end",()=>x.flush()),g.stderr?.on("data",P=>{w+=P.toString(),R.push(P)}),g.stderr?.on("end",()=>R.flush()),g.on("message",P=>{if(!h){if(!t(P)){b.push(P);return}h=!0,clearTimeout(k),g.kill(),d(P)}}),g.on("error",P=>{h||(h=!0,clearTimeout(k),p(P))}),Ece(g,(P,I)=>{h||(h=!0,clearTimeout(k),p(new Error(Rce(c,P,I,w,b))))})})}var Sce,I2=v(()=>{"use strict";Sce=2e3});var j2={};_e(j2,{evaluateConfigSandboxed:()=>_ce});import{realpathSync as Oce,rmSync as Ace}from"node:fs";import{resolve as D2}from"node:path";function Cce(e){return typeof e=="object"&&e!==null&&e.kind==="chant-config"&&typeof e.ok=="boolean"}async function _ce(e,t){let n=O2(e),{bundlePath:i,bundleDir:r,externalReadPaths:o,durationMs:s,bytes:a}=await S2(n);try{let c;try{c=Oce(D2(t))}catch{c=D2(t)}let l={PATH:process.env.PATH??""},u=process.env[Xu];u&&(l[Xu]=u);let d=await T2({bundlePath:i,bundleDir:r,projectRealpath:c,externalReadPaths:o,env:l,timeoutMs:Pce,label:`sandboxed evaluation of ${e}`,outputPrefix:"[sandbox:config]"},Cce);if(!d.ok)throw d.offenders&&d.offenders.length>0?new Error(P2(e,d.offenders)):new Error(d.error?.message?`Failed to evaluate ${e} inside the --sandbox boundary: ${d.error.message}`:`Failed to evaluate ${e} inside the --sandbox boundary`);return{config:d.config??{},bundleMs:s,bundleBytes:a}}finally{Ace(r,{recursive:!0,force:!0})}}var Pce,N2=v(()=>{"use strict";E2();A2();C2();I2();fm();Pce=6e4});import{dirname as Tce}from"node:path";function Dce(e){let t=Jr(e);return t.default??t.config??t}async function L2(e,t=Tce(e)){if(!Ice)return Dce(await y2(e));if(p_.has(e))return p_.get(e);let{evaluateConfigSandboxed:n}=await Promise.resolve().then(()=>(N2(),j2)),{config:i}=await n(e,t);return p_.set(e,i),i}var Ice,p_,f_=v(()=>{"use strict";w2();Zc();Ice=!1,p_=new Map});var y_={};_e(y_,{importLexiconModule:()=>el,importLexiconPackage:()=>Eo,lexiconDeclarationName:()=>B2,lexiconModulePath:()=>ys,lexiconModuleRoot:()=>h_,lexiconNames:()=>Gi,lexiconPackagesToInstall:()=>Bce,lexiconSourceLabel:()=>Wce,packageNameOf:()=>U2,pathLexiconMap:()=>Mce,pathLexiconRoot:()=>gv,recordedLexiconModules:()=>Fce,registerLexiconDeclarations:()=>da,resetLexiconModules:()=>Gce,resolveFromProject:()=>hv});import{createRequire as G2}from"node:module";import{dirname as jce,isAbsolute as Qc,join as Nce,relative as W2,resolve as Qu,sep as Lce}from"node:path";import{pathToFileURL as g_}from"node:url";function B2(e){return typeof e=="string"?e:e.name}function Gi(e){return e?.map(B2)}function m_(e,t){let n=W2(t,e);return n===""||!n.startsWith("..")&&!Qc(n)}function gv(e,t,n="."){let i=Qc(e.module)?e.module:Qu(t,e.module),r=e.root!==void 0,o=r?Qc(e.root)?Qu(e.root):Qu(t,e.root):jce(i),s=Qu(t),a=Qu(t,n),c;return m_(o,s)?m_(a,o)?c=`${o} contains the project's source directory (${a})`:m_(i,o)||(c=`the module ${i} is not inside ${o}`):c=`${o} is outside the project (${s})`,c===void 0?{root:o}:r?{problem:c}:{}}function da(e,t,n){let i={};for(let r of e??[]){if(typeof r=="string"){ua.delete(r),mm.delete(r);continue}let o=z2(r,t);ua.set(r.name,o),i[r.name]=o;let{root:s}=gv(r,t,n);s===void 0?mm.delete(r.name):mm.set(r.name,s)}return i}function z2(e,t){return Qc(e.module)?e.module:Qu(t,e.module)}function Mce(e,t){let n=new Map;for(let i of e)typeof i!="string"&&n.set(i.name,z2(i,t));return n}function Fce(){return new Map(ua)}function ys(e){return ua.get(e)}function h_(e){return mm.get(e)}function Gce(){ua.clear(),mm.clear()}async function el(e,t={}){let n=ua.get(e);if(n!==void 0)try{return(t.typeScript??!dv(n))&&mr(),Jr(await import(n))}catch(i){throw new Error(`lexicon "${e}" is declared with module ${n}, which could not be loaded: `+(i instanceof Error?i.message:String(i)))}}function Wce(e,t=process.cwd(),n=ua){let i=n.get(e);if(i===void 0)return`@intentius/chant-lexicon-${e}`;let r=W2(t,i);return r===""||r.startsWith("..")||Qc(r)?i:`./${r.split(Lce).join("/")}`}function Bce(e,t=ua){return e.filter(n=>!t.has(n)).map(n=>`@intentius/chant-lexicon-${n}`)}function U2(e){if(e.startsWith(".")||Qc(e)||e.startsWith("file:"))return;let t=e.split("/");return e.startsWith("@")?t.slice(0,2).join("/"):t[0]}function M2(e,t){let n=e?.code;if(n!=="ERR_MODULE_NOT_FOUND"&&n!=="MODULE_NOT_FOUND")return!1;let i=e instanceof Error?e.message:String(e);return i.includes(`'${t}'`)||i.includes(`"${t}"`)||i.includes(`${t}/`)}function hv(e,t=process.cwd()){try{return G2(Nce(t,"package.json")).resolve(e)}catch{return}}function zce(e){if(Qc(e))return g_(e).href;let t=import.meta.resolve;return typeof t=="function"?t(e):g_(G2(import.meta.url).resolve(e)).href}async function Eo(e,t=process.cwd()){let n=U2(e);if(g2()){let i;try{i=zce(e)}catch(r){if(n===void 0||!M2(r,n))mr();else return F2(e,t,r)}i!==void 0&&pv(i)}try{return Jr(await import(e))}catch(i){if(n===void 0||!M2(i,n))throw i;return F2(e,t,i)}}async function F2(e,t,n){let i=hv(e,t);if(i===void 0)throw n;return pv(i),Jr(await import(g_(i).href))}var ua,mm,nr=v(()=>{"use strict";So();Zc();Jc();ua=new Map,mm=new Map});var Uce,Vce,Hce,ed,V2,yv=v(()=>{"use strict";Rn();Uce=m.strictObject({env:m.string().min(1)}),Vce=m.strictObject({capability:m.string().min(1),member:m.string().min(1).optional(),env:m.string().min(1).optional()}),Hce=m.union([Uce,Vce]),ed=m.strictObject({url:m.string().min(1),key:Hce.optional(),timeoutMs:m.number().int().positive().optional()}),V2=m.strictObject({backends:m.record(m.string(),ed).optional()})});var wv,w_,qce,Kce,Jce,H2,q2=v(()=>{"use strict";Rn();wv=m.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/,"an environment variable name"),w_=m.union([m.string().min(1),m.literal(!1)]),qce=m.object({type:m.literal("npm"),packages:m.array(m.string().min(1)).min(1),registry:m.string().url().optional(),access:m.enum(["public","restricted"]).optional(),sbom:w_.optional(),stage:m.boolean().optional(),tokenEnv:wv.optional(),registryWait:m.number().int().min(0).optional()}).strict(),Kce=m.object({type:m.literal("oci"),image:m.string().min(1),repository:m.string().min(1),tags:m.array(m.string().min(1)).optional(),usernameEnv:wv.optional(),passwordEnv:wv.optional(),sbom:w_.optional()}).strict(),Jce=m.object({type:m.literal("forge"),forge:m.enum(["github","gitlab","forgejo"]),repo:m.string().min(1),api:m.string().url().optional(),assets:m.array(m.string().min(1)).min(1),tag:m.string().min(1).optional(),tokenEnv:wv.optional(),sbom:w_.optional()}).strict(),H2=m.discriminatedUnion("type",[qce,Kce,Jce])});var E_={};_e(E_,{ChantConfigSchema:()=>hm,DEFAULT_CHANT_CONFIG:()=>$_,InvalidChantConfigError:()=>td,environmentEndpoint:()=>Q2,environmentName:()=>pa,environmentNames:()=>k_,findProjectConfigPastFragments:()=>ym,isEnvironmentPattern:()=>nd,isLintOnlyFragment:()=>vv,isOwnershipParamRef:()=>tV,loadChantConfig:()=>rd,loadChantConfigUpward:()=>bv,matchesDeclaredEnvironment:()=>gm,matchesEnvironmentPattern:()=>x_,ownershipEnvDisagreement:()=>Qce,resolveAutoReleaseDisabled:()=>ele,resolveDiscoveryGlobs:()=>wm,resolveFoldEnabled:()=>rV,resolveKnowledgeDir:()=>ile,resolveOwnershipEnv:()=>S_,resolveOwnershipMarker:()=>nV,resolveOwnershipStack:()=>R_,resolveSandboxEnabled:()=>iV,resolveSbomFormat:()=>tle,resolveSigningDefaults:()=>nle,resolveVulnPolicy:()=>rle});import{existsSync as K2,readFileSync as Y2}from"fs";import{dirname as X2,join as b_}from"path";function pa(e){return typeof e=="string"?e:e.name}function k_(e){return e?.map(pa)}function nd(e){return e.includes("*")}function x_(e,t){let n=e.split("*");if(n.length===1)return e===t;let i=n[0],r=n[n.length-1];if(!t.startsWith(i))return!1;let o=i.length;for(let s=1;s<n.length-1;s++){let a=n[s];if(a==="")continue;let c=t.indexOf(a,o);if(c===-1)return!1;o=c+a.length}return t.length-o>=r.length&&t.endsWith(r)}function gm(e,t){let n=k_(e)??[];return n.includes(t)?!0:n.some(i=>nd(i)&&x_(i,t))}function Q2(e,t){let n=e?.find(i=>pa(i)===t)??e?.find(i=>nd(pa(i))&&x_(pa(i),t));return n&&typeof n!="string"?n.endpoint:void 0}async function rd(e){let t=b_(e,"chant.config.ts");if(K2(t)){let i=await L2(t,e);return{config:Z2(i,t),configPath:t}}let n=b_(e,"chant.config.json");if(K2(n)){let{readFileSync:i}=await import("fs"),r=i(n,"utf-8"),o=JSON.parse(r);return{config:Z2(o,n),configPath:n}}return{config:$_}}async function bv(e){let{dir:t,configPath:n}=ym(e);return n&&Xce(n),rd(t)}function ym(e){let{dir:t,configPath:n}=um(e);for(;n&&vv(n);){let i=X2(t);if(i===t)break;({dir:t,configPath:n}=um(i))}return{dir:t,configPath:n}}async function wm(e){let{dir:t,configPath:n}=ym(e);if(!n)return;let i;try{({config:i}=await rd(t))}catch(s){if(s instanceof td&&(s.key==="exclude"||s.key==="include"))throw s;return}let r=i.exclude??[],o=i.include??[];if(!(r.length===0&&o.length===0))return{root:t,exclude:r,include:o}}function vv(e){if(!e.endsWith("chant.config.json"))return!1;try{let t=JSON.parse(Y2(e,"utf-8"));if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.keys(t).filter(i=>!eV(i));return n.length>0&&n.every(i=>v_.has(i))}catch{return!1}}function Xce(e){if(e.endsWith("chant.config.json"))try{let t=JSON.parse(Y2(e,"utf-8"));if(typeof t!="object"||t===null||Array.isArray(t))return;let n=Object.keys(t).filter(i=>!eV(i));if(n.some(i=>!v_.has(i))&&!n.some(i=>J2.has(i))){let i=n.filter(r=>!v_.has(r));console.error(`warning: ${e} is being used as the project config, but declares no project-level key (${[...J2].slice(0,4).join(", ")}, \u2026). ${i.length===1?"The key":"The keys"} ${i.map(r=>`"${r}"`).join(", ")} stopped the walk to the real one \u2014 any config above this file is being ignored. Prefix a comment key with "_", or move the key to the project config. (chant #1711)`)}}catch{}}function tV(e){return typeof e=="object"&&e!==null&&typeof e.param=="string"}function R_(e){let t=e.ownership;if(!(!t||!t.stack||t.enabled===!1))return t.stack}function S_(e,t){let n=e.ownership?.env;if(!tV(n))return n;let i=n.param,r=e.buildParams?.[i];if(!r)throw new Error(`ownership.env references build parameter "${i}", which chant.config.ts's buildParams does not declare`);let o=t?.find(s=>s.name===i);if(!o)throw new Error(`ownership.env references build parameter "${i}", which resolved to no value for this build \u2014 pass --param ${i}=<value>${r.env?`, set ${r.env}`:""}, or give it a default`);return String(o.value)}function nV(e,t){let n=R_(e);if(n!==void 0)return{stack:n,env:S_(e,t)}}function Qce(e,t){let n=e.ownership?.env;if(typeof n!="string"||R_(e)===void 0)return;let i=t?.find(r=>r.name==="env");if(!(!i||String(i.value)===n))return`ownership.env is "${n}" but the env build parameter resolved to ${JSON.stringify(i.value)} (${i.source}) \u2014 the ownership marker and params.env disagree about which environment this build is for. Use ownership: { env: { param: "env" } } so the marker follows the parameter.`}function ele(e,t){return t?!0:e.release?.autoRecord===!1}function rV(e,t){return t!==void 0?t:e.build?.fold!==void 0?e.build.fold:!0}function iV(e,t){return t?!0:e.build?.sandbox===!0}function tle(e,t){return t??e.sbom?.format??li}function nle(e){let t=e.signing,n=t?.keyless!==!1;return{keyless:n,...!n&&t?.key?{key:{key:t.key}}:{},identityPolicyDefaults:{expectedIssuer:t?.oidcIssuer,expectedIdentity:t?.identity,identityIsRegexp:t?.identityIsRegexp,key:t?.keyless===!1?t?.key:void 0}}}function rle(e){let t=e.vulnPolicy;if(!t)return{};let n={};return t.failSeverity&&(n.failSeverity=t.failSeverity),t.fixableOnly!==void 0&&(n.fixableOnly=t.fixableOnly),t.warnSeverity&&(n.warnSeverity=t.warnSeverity),t.failOnLicense!==void 0&&(n.failOnLicense=t.failOnLicense),t.failOnUnknownSeverity!==void 0&&(n.failOnUnknownSeverity=t.failOnUnknownSeverity),t.failOnKev!==void 0&&(n.failOnKev=t.failOnKev),t.failEpssAtOrAbove!==void 0&&(n.failEpssAtOrAbove=t.failEpssAtOrAbove),t.warnEpssAtOrAbove!==void 0&&(n.warnEpssAtOrAbove=t.warnEpssAtOrAbove),t.exploitabilityFixableOnly!==void 0&&(n.exploitabilityFixableOnly=t.exploitabilityFixableOnly),t.license&&(n.license=t.license),n}function ile(e,t){return b_(t,e.knowledge?.dir??"knowledge")}function Z2(e,t){if(typeof e!="object"||e===null)return $_;let n=hm.safeParse(e);if(!n.success){let a=n.error.issues[0],c=a.path.length>0?a.path.join("."):void 0,l=t?` in ${t}`:"";throw new td(`Invalid chant config${l}: ${c?`${c}: `:""}${a.message}`,a.path.length>0?String(a.path[0]):void 0)}let i=e.lexicons,r=t!==void 0?X2(t):process.cwd(),o=e.sourceDir;for(let[a,c]of(i??[]).entries()){if(typeof c=="string"||c.root===void 0)continue;let{problem:l}=gv(c,r,o);if(l!==void 0){let u=t?` in ${t}`:"";throw new td(`Invalid chant config${u}: lexicons.${a}.root: ${l}`,"lexicons")}}let s=da(i,r,o);return Object.keys(s).length>0?{...e,lexicons:Gi(i),lexiconModules:s}:e}var Zce,Yce,hm,$_,v_,eV,J2,td,zn=v(()=>{"use strict";Rn();hs();Mi();f_();nr();yv();q2();Zce=m.union([m.string().min(1),m.object({name:m.string().min(1),endpoint:m.string().min(1).optional(),canary:m.boolean().optional()})]),Yce=m.union([m.string().min(1),m.object({name:m.string().min(1),module:m.string().min(1),root:m.string().min(1).optional()}).strict()]),hm=m.object({lexicons:m.array(Yce).optional(),capabilities:m.array(m.string().min(1)).optional(),environments:m.array(Zce).optional(),sourceDir:m.string().min(1).optional(),lint:m.record(m.string(),m.unknown()).optional(),ownership:m.object({stack:m.string().min(1).optional(),env:m.union([m.string().min(1),m.object({param:m.string().min(1)})]).optional(),enabled:m.boolean().optional()}).optional(),build:m.object({fold:m.boolean().optional()}).optional(),buildParams:m.record(m.string(),m.object({type:m.enum(["string","number","boolean"]),default:m.union([m.string(),m.number(),m.boolean()]).optional(),enum:m.array(m.union([m.string(),m.number(),m.boolean()])).optional(),env:m.string().min(1).optional(),required:m.boolean().optional(),description:m.string().optional()})).optional(),release:m.object({autoRecord:m.boolean().optional(),publish:m.array(H2).optional()}).optional(),run:m.object({on:m.string().min(1).optional()}).strict().optional(),sbom:m.object({format:m.enum(["spdx","cyclonedx"]).optional(),enabled:m.boolean().optional()}).optional(),signing:m.object({keyless:m.boolean().optional(),oidcIssuer:m.string().min(1).optional(),identity:m.string().min(1).optional(),identityIsRegexp:m.boolean().optional(),key:m.string().min(1).optional()}).optional(),vulnPolicy:m.object({failSeverity:m.enum(["critical","high","medium","low","negligible","unknown"]).optional(),fixableOnly:m.boolean().optional(),warnSeverity:m.enum(["critical","high","medium","low","negligible","unknown"]).optional(),failOnLicense:m.boolean().optional(),failOnUnknownSeverity:m.boolean().optional(),failOnKev:m.boolean().optional(),failEpssAtOrAbove:m.number().min(0).max(1).optional(),warnEpssAtOrAbove:m.number().min(0).max(1).optional(),exploitabilityFixableOnly:m.boolean().optional(),license:m.object({allow:m.array(m.string()).optional(),deny:m.array(m.string()).optional()}).optional(),scanner:m.enum(["grype","trivy"]).optional(),vexSources:m.array(m.string()).optional()}).optional(),knowledge:m.object({dir:m.string().min(1).optional()}).optional(),codegen:m.object({outDir:m.string().min(1).optional()}).strict().optional(),decide:V2.optional(),exclude:m.array(m.string().min(1)).optional(),include:m.array(m.string().min(1)).optional(),rootOnly:m.boolean().optional()}).passthrough(),$_={};v_=new Set(["$schema","extends","rules","overrides","plugins","policies"]),eV=e=>e.startsWith("_");J2=new Set(Object.keys(hm.shape).filter(e=>e!=="lint"));td=class extends Error{constructor(n,i){super(n);this.key=i}}});var Xu,fm=v(()=>{"use strict";zn();Xu="CHANT_ENV"});var bm=ae((PWe,lV)=>{"use strict";var oV="[^\\\\/]",ole="(?=.)",sV="[^/]",O_="(?:\\/|$)",aV="(?:^|\\/)",A_=`\\.{1,2}${O_}`,sle="(?!\\.)",ale=`(?!${aV}${A_})`,cle=`(?!\\.{0,1}${O_})`,lle=`(?!${A_})`,ule="[^.\\/]",dle=`${sV}*?`,ple="/",cV={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:ole,QMARK:sV,END_ANCHOR:O_,DOTS_SLASH:A_,NO_DOT:sle,NO_DOTS:ale,NO_DOT_SLASH:cle,NO_DOTS_SLASH:lle,QMARK_NO_DOT:ule,STAR:dle,START_ANCHOR:aV,SEP:ple},fle={...cV,SLASH_LITERAL:"[\\\\/]",QMARK:oV,STAR:`${oV}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},mle={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};lV.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:mle,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?fle:cV}}});var vm=ae(_r=>{"use strict";var{REGEX_BACKSLASH:gle,REGEX_REMOVE_BACKSLASH:hle,REGEX_SPECIAL_CHARS:yle,REGEX_SPECIAL_CHARS_GLOBAL:wle}=bm();_r.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);_r.hasRegexChars=e=>yle.test(e);_r.isRegexChar=e=>e.length===1&&_r.hasRegexChars(e);_r.escapeRegex=e=>e.replace(wle,"\\$1");_r.toPosixSlashes=e=>e.replace(gle,"/");_r.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let e=navigator.platform.toLowerCase();return e==="win32"||e==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};_r.removeBackslashes=e=>e.replace(hle,t=>t==="\\"?"":t);_r.escapeLast=(e,t,n)=>{let i=e.lastIndexOf(t,n);return i===-1?e:e[i-1]==="\\"?_r.escapeLast(e,t,i-1):`${e.slice(0,i)}\\${e.slice(i)}`};_r.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n};_r.wrapOutput=(e,t={},n={})=>{let i=n.contains?"":"^",r=n.contains?"":"$",o=`${i}(?:${e})${r}`;return t.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};_r.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:"/"),i=n[n.length-1];return i===""?n[n.length-2]:i}});var yV=ae((_We,hV)=>{"use strict";var uV=vm(),{CHAR_ASTERISK:P_,CHAR_AT:ble,CHAR_BACKWARD_SLASH:km,CHAR_COMMA:vle,CHAR_DOT:C_,CHAR_EXCLAMATION_MARK:__,CHAR_FORWARD_SLASH:gV,CHAR_LEFT_CURLY_BRACE:T_,CHAR_LEFT_PARENTHESES:I_,CHAR_LEFT_SQUARE_BRACKET:kle,CHAR_PLUS:xle,CHAR_QUESTION_MARK:dV,CHAR_RIGHT_CURLY_BRACE:$le,CHAR_RIGHT_PARENTHESES:pV,CHAR_RIGHT_SQUARE_BRACKET:Rle}=bm(),fV=e=>e===gV||e===km,mV=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},Sle=(e,t)=>{let n=t||{},i=e.length-1,r=n.parts===!0||n.scanToEnd===!0,o=[],s=[],a=[],c=e,l=-1,u=0,d=0,p=!1,f=!1,g=!1,h=!1,w=!1,b=!1,k=!1,$=!1,x=!1,R=!1,P=0,I,A,W={value:"",depth:0,isGlob:!1},_=()=>l>=i,re=()=>c.charCodeAt(l+1),j=()=>(I=A,c.charCodeAt(++l));for(;l<i;){A=j();let ke;if(A===km){k=W.backslashes=!0,A=j(),A===T_&&(b=!0);continue}if(b===!0||A===T_){for(P++;_()!==!0&&(A=j());){if(A===km){k=W.backslashes=!0,j();continue}if(A===T_){P++;continue}if(b!==!0&&A===C_&&(A=j())===C_){if(p=W.isBrace=!0,g=W.isGlob=!0,R=!0,r===!0)continue;break}if(b!==!0&&A===vle){if(p=W.isBrace=!0,g=W.isGlob=!0,R=!0,r===!0)continue;break}if(A===$le&&(P--,P===0)){b=!1,p=W.isBrace=!0,R=!0;break}}if(r===!0)continue;break}if(A===gV){if(o.push(l),s.push(W),W={value:"",depth:0,isGlob:!1},R===!0)continue;if(I===C_&&l===u+1){u+=2;continue}d=l+1;continue}if(n.noext!==!0&&(A===xle||A===ble||A===P_||A===dV||A===__)===!0&&re()===I_){if(g=W.isGlob=!0,h=W.isExtglob=!0,R=!0,A===__&&l===u&&(x=!0),r===!0){for(;_()!==!0&&(A=j());){if(A===km){k=W.backslashes=!0,A=j();continue}if(A===pV){g=W.isGlob=!0,R=!0;break}}continue}break}if(A===P_){if(I===P_&&(w=W.isGlobstar=!0),g=W.isGlob=!0,R=!0,r===!0)continue;break}if(A===dV){if(g=W.isGlob=!0,R=!0,r===!0)continue;break}if(A===kle){for(;_()!==!0&&(ke=j());){if(ke===km){k=W.backslashes=!0,j();continue}if(ke===Rle){f=W.isBracket=!0,g=W.isGlob=!0,R=!0;break}}if(r===!0)continue;break}if(n.nonegate!==!0&&A===__&&l===u){$=W.negated=!0,u++;continue}if(n.noparen!==!0&&A===I_){if(g=W.isGlob=!0,r===!0){for(;_()!==!0&&(A=j());){if(A===I_){k=W.backslashes=!0,A=j();continue}if(A===pV){R=!0;break}}continue}break}if(g===!0){if(R=!0,r===!0)continue;break}}n.noext===!0&&(h=!1,g=!1);let N=c,C="",T="";u>0&&(C=c.slice(0,u),c=c.slice(u),d-=u),N&&g===!0&&d>0?(N=c.slice(0,d),T=c.slice(d)):g===!0?(N="",T=c):N=c,N&&N!==""&&N!=="/"&&N!==c&&fV(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),n.unescape===!0&&(T&&(T=uV.removeBackslashes(T)),N&&k===!0&&(N=uV.removeBackslashes(N)));let G={prefix:C,input:e,start:u,base:N,glob:T,isBrace:p,isBracket:f,isGlob:g,isExtglob:h,isGlobstar:w,negated:$,negatedExtglob:x};if(n.tokens===!0&&(G.maxDepth=0,fV(A)||s.push(W),G.tokens=s),n.parts===!0||n.tokens===!0){let ke;for(let ne=0;ne<o.length;ne++){let be=ke?ke+1:u,Be=o[ne],dt=e.slice(be,Be);n.tokens&&(ne===0&&u!==0?(s[ne].isPrefix=!0,s[ne].value=C):s[ne].value=dt,mV(s[ne]),G.maxDepth+=s[ne].depth),(ne!==0||dt!=="")&&a.push(dt),ke=Be}if(ke&&ke+1<e.length){let ne=e.slice(ke+1);a.push(ne),n.tokens&&(s[s.length-1].value=ne,mV(s[s.length-1]),G.maxDepth+=s[s.length-1].depth)}G.slashes=o,G.parts=a}return G};hV.exports=Sle});var xV=ae((TWe,kV)=>{"use strict";var xm=bm(),Zr=vm(),{MAX_LENGTH:kv,POSIX_REGEX_SOURCE:Ele,REGEX_NON_SPECIAL_CHARS:Ole,REGEX_SPECIAL_CHARS_BACKREF:Ale,REPLACEMENTS:wV}=xm,Ple=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let n=`[${e.join("-")}]`;try{new RegExp(n)}catch{return e.map(r=>Zr.escapeRegex(r)).join("..")}return n},id=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,bV=e=>{let t=[],n=0,i=0,r=0,o="",s=!1;for(let a of e){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){r=r===1?0:1,o+=a;continue}if(r===0){if(a==="[")n++;else if(a==="]"&&n>0)n--;else if(n===0){if(a==="(")i++;else if(a===")"&&i>0)i--;else if(a==="|"&&i===0){t.push(o),o="";continue}}}o+=a}return t.push(o),t},Cle=e=>{let t=!1;for(let n of e){if(t===!0){t=!1;continue}if(n==="\\"){t=!0;continue}if(/[?*+@!()[\]{}]/.test(n))return!1}return!0},vV=e=>{let t=e.trim(),n=!0;for(;n===!0;)n=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),n=!0);if(Cle(t))return t.replace(/\\(.)/g,"$1")},_le=e=>{let t=e.map(vV).filter(Boolean);for(let n=0;n<t.length;n++)for(let i=n+1;i<t.length;i++){let r=t[n],o=t[i],s=r[0];if(!(!s||r!==s.repeat(r.length)||o!==s.repeat(o.length))&&(r===o||r.startsWith(o)||o.startsWith(r)))return!0}return!1},D_=(e,t=!0)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let n=0,i=0,r=0,o=!1;for(let s=1;s<e.length;s++){let a=e[s];if(o===!0){o=!1;continue}if(a==="\\"){o=!0;continue}if(a==='"'){r=r===1?0:1;continue}if(r!==1){if(a==="["){n++;continue}if(a==="]"&&n>0){n--;continue}if(!(n>0)){if(a==="("){i++;continue}if(a===")"&&(i--,i===0))return t===!0&&s!==e.length-1?void 0:{type:e[0],body:e.slice(2,s),end:s}}}}},Tle=e=>{let t=0,n=[];for(;t<e.length;){let r=D_(e.slice(t),!1);if(!r||r.type!=="*")return;let o=bV(r.body).map(a=>a.trim());if(o.length!==1)return;let s=vV(o[0]);if(!s||s.length!==1)return;n.push(s),t+=r.end+1}return n.length<1?void 0:`${n.length===1?Zr.escapeRegex(n[0]):`[${n.map(r=>Zr.escapeRegex(r)).join("")}]`}*`},Ile=e=>{let t=0,n=e.trim(),i=D_(n);for(;i;)t++,n=i.body.trim(),i=D_(n);return t},Dle=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let n=typeof t.maxExtglobRecursion=="number"?t.maxExtglobRecursion:xm.DEFAULT_MAX_EXTGLOB_RECURSION,i=bV(e).map(r=>r.trim());if(i.length>1&&(i.some(r=>r==="")||i.some(r=>/^[*?]+$/.test(r))||_le(i)))return{risky:!0};for(let r of i){let o=Tle(r);if(o)return{risky:!0,safeOutput:o};if(Ile(r)>n)return{risky:!0}}return{risky:!1}},j_=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=wV[e]||e;let n={...t},i=typeof n.maxLength=="number"?Math.min(kv,n.maxLength):kv,r=e.length;if(r>i)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${i}`);let o={type:"bos",value:"",output:n.prepend||""},s=[o],a=n.capture?"":"?:",c=xm.globChars(n.windows),l=xm.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:p,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:h,NO_DOT_SLASH:w,NO_DOTS_SLASH:b,QMARK:k,QMARK_NO_DOT:$,STAR:x,START_ANCHOR:R}=c,P=ee=>`(${a}(?:(?!${R}${ee.dot?g:u}).)*?)`,I=n.dot?"":h,A=n.dot?k:$,W=n.bash===!0?P(n):x;n.capture&&(W=`(${W})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let _={input:e,index:-1,start:0,dot:n.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};e=Zr.removePrefix(e,_),r=e.length;let re=[],j=[],N=[],C=o,T,G=()=>_.index===r-1,ke=_.peek=(ee=1)=>e[_.index+ee],ne=_.advance=()=>e[++_.index]||"",be=()=>e.slice(_.index+1),Be=(ee="",Ve=0)=>{_.consumed+=ee,_.index+=Ve},dt=ee=>{_.output+=ee.output!=null?ee.output:ee.value,Be(ee.value)},te=()=>{let ee=1;for(;ke()==="!"&&(ke(2)!=="("||ke(3)==="?");)ne(),_.start++,ee++;return ee%2===0?!1:(_.negated=!0,_.start++,!0)},ye=ee=>{_[ee]++,N.push(ee)},ge=ee=>{_[ee]--,N.pop()},oe=ee=>{if(C.type==="globstar"){let Ve=_.braces>0&&(ee.type==="comma"||ee.type==="brace"),z=ee.extglob===!0||re.length&&(ee.type==="pipe"||ee.type==="paren");ee.type!=="slash"&&ee.type!=="paren"&&!Ve&&!z&&(_.output=_.output.slice(0,-C.output.length),C.type="star",C.value="*",C.output=W,_.output+=C.output)}if(re.length&&ee.type!=="paren"&&(re[re.length-1].inner+=ee.value),(ee.value||ee.output)&&dt(ee),C&&C.type==="text"&&ee.type==="text"){C.output=(C.output||C.value)+ee.value,C.value+=ee.value;return}ee.prev=C,s.push(ee),C=ee},Se=(ee,Ve)=>{let z={...l[Ve],conditions:1,inner:""};z.prev=C,z.parens=_.parens,z.output=_.output,z.startIndex=_.index,z.tokensIndex=s.length;let $e=(n.capture?"(":"")+z.open;ye("parens"),oe({type:ee,value:Ve,output:_.output?"":f}),oe({type:"paren",extglob:!0,value:ne(),output:$e}),re.push(z)},Ne=ee=>{let Ve=e.slice(ee.startIndex,_.index+1),z=e.slice(ee.startIndex+2,_.index),$e=Dle(z,n);if((ee.type==="plus"||ee.type==="star")&&$e.risky){let ct=$e.safeOutput?(ee.output?"":f)+(n.capture?`(${$e.safeOutput})`:$e.safeOutput):void 0,Vt=s[ee.tokensIndex];Vt.type="text",Vt.value=Ve,Vt.output=ct||Zr.escapeRegex(Ve);for(let U=ee.tokensIndex+1;U<s.length;U++)s[U].value="",s[U].output="",delete s[U].suffix;_.output=ee.output+Vt.output,_.backtrack=!0,oe({type:"paren",extglob:!0,value:T,output:""}),ge("parens");return}let Ie=ee.close+(n.capture?")":""),et;if(ee.type==="negate"){let ct=W;if(ee.inner&&ee.inner.length>1&&ee.inner.includes("/")&&(ct=P(n)),(ct!==W||G()||/^\)+$/.test(be()))&&(Ie=ee.close=`)$))${ct}`),ee.inner.includes("*")&&(et=be())&&/^\.[^\\/.]+$/.test(et)){let Vt=j_(et,{...t,fastpaths:!1}).output;Ie=ee.close=`)${Vt})${ct})`}ee.prev.type==="bos"&&(_.negatedExtglob=!0)}oe({type:"paren",extglob:!0,value:T,output:Ie}),ge("parens")};if(n.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let ee=!1,Ve=e.replace(Ale,(z,$e,Ie,et,ct,Vt)=>et==="\\"?(ee=!0,z):et==="?"?$e?$e+et+(ct?k.repeat(ct.length):""):Vt===0?A+(ct?k.repeat(ct.length):""):k.repeat(Ie.length):et==="."?u.repeat(Ie.length):et==="*"?$e?$e+et+(ct?W:""):W:$e?z:`\\${z}`);return ee===!0&&(n.unescape===!0?Ve=Ve.replace(/\\/g,""):Ve=Ve.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),Ve===e&&n.contains===!0?(_.output=e,_):(_.output=Zr.wrapOutput(Ve,_,t),_)}for(;!G();){if(T=ne(),T==="\0")continue;if(T==="\\"){let z=ke();if(z==="/"&&n.bash!==!0||z==="."||z===";")continue;if(!z){T+="\\",oe({type:"text",value:T});continue}let $e=/^\\+/.exec(be()),Ie=0;if($e&&$e[0].length>2&&(Ie=$e[0].length,_.index+=Ie,Ie%2!==0&&(T+="\\")),n.unescape===!0?T=ne():T+=ne(),_.brackets===0){oe({type:"text",value:T});continue}}if(_.brackets>0&&(T!=="]"||C.value==="["||C.value==="[^")){if(n.posix!==!1&&T===":"){let z=C.value.slice(1);if(z.includes("[")&&(C.posix=!0,z.includes(":"))){let $e=C.value.lastIndexOf("["),Ie=C.value.slice(0,$e),et=C.value.slice($e+2),ct=Ele[et];if(ct){C.value=Ie+ct,_.backtrack=!0,ne(),!o.output&&s.indexOf(C)===1&&(o.output=f);continue}}}(T==="["&&ke()!==":"||T==="-"&&ke()==="]")&&(T=`\\${T}`),T==="]"&&(C.value==="["||C.value==="[^")&&(T=`\\${T}`),n.posix===!0&&T==="!"&&C.value==="["&&(T="^"),C.value+=T,dt({value:T});continue}if(_.quotes===1&&T!=='"'){T=Zr.escapeRegex(T),C.value+=T,dt({value:T});continue}if(T==='"'){_.quotes=_.quotes===1?0:1,n.keepQuotes===!0&&oe({type:"text",value:T});continue}if(T==="("){ye("parens"),oe({type:"paren",value:T});continue}if(T===")"){if(_.parens===0&&n.strictBrackets===!0)throw new SyntaxError(id("opening","("));let z=re[re.length-1];if(z&&_.parens===z.parens+1){Ne(re.pop());continue}oe({type:"paren",value:T,output:_.parens?")":"\\)"}),ge("parens");continue}if(T==="["){if(n.nobracket===!0||!be().includes("]")){if(n.nobracket!==!0&&n.strictBrackets===!0)throw new SyntaxError(id("closing","]"));T=`\\${T}`}else ye("brackets");oe({type:"bracket",value:T});continue}if(T==="]"){if(n.nobracket===!0||C&&C.type==="bracket"&&C.value.length===1){oe({type:"text",value:T,output:`\\${T}`});continue}if(_.brackets===0){if(n.strictBrackets===!0)throw new SyntaxError(id("opening","["));oe({type:"text",value:T,output:`\\${T}`});continue}ge("brackets");let z=C.value.slice(1);if(C.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(T=`/${T}`),C.value+=T,dt({value:T}),n.literalBrackets===!1||Zr.hasRegexChars(z))continue;let $e=Zr.escapeRegex(C.value);if(_.output=_.output.slice(0,-C.value.length),n.literalBrackets===!0){_.output+=$e,C.value=$e;continue}C.value=`(${a}${$e}|${C.value})`,_.output+=C.value;continue}if(T==="{"&&n.nobrace!==!0){ye("braces");let z={type:"brace",value:T,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};j.push(z),oe(z);continue}if(T==="}"){let z=j[j.length-1];if(n.nobrace===!0||!z){oe({type:"text",value:T,output:T});continue}let $e=")";if(z.dots===!0){let Ie=s.slice(),et=[];for(let ct=Ie.length-1;ct>=0&&(s.pop(),Ie[ct].type!=="brace");ct--)Ie[ct].type!=="dots"&&et.unshift(Ie[ct].value);$e=Ple(et,n),_.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let Ie=_.output.slice(0,z.outputIndex),et=_.tokens.slice(z.tokensIndex);z.value=z.output="\\{",T=$e="\\}",_.output=Ie;for(let ct of et)_.output+=ct.output||ct.value}oe({type:"brace",value:T,output:$e}),ge("braces"),j.pop();continue}if(T==="|"){re.length>0&&re[re.length-1].conditions++,oe({type:"text",value:T});continue}if(T===","){let z=T,$e=j[j.length-1];$e&&N[N.length-1]==="braces"&&($e.comma=!0,z="|"),oe({type:"comma",value:T,output:z});continue}if(T==="/"){if(C.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),C=o;continue}oe({type:"slash",value:T,output:p});continue}if(T==="."){if(_.braces>0&&C.type==="dot"){C.value==="."&&(C.output=u);let z=j[j.length-1];C.type="dots",C.output+=T,C.value+=T,z.dots=!0;continue}if(_.braces+_.parens===0&&C.type!=="bos"&&C.type!=="slash"){oe({type:"text",value:T,output:u});continue}oe({type:"dot",value:T,output:u});continue}if(T==="?"){if(!(C&&C.value==="(")&&n.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){Se("qmark",T);continue}if(C&&C.type==="paren"){let $e=ke(),Ie=T;(C.value==="("&&!/[!=<:]/.test($e)||$e==="<"&&!/<([!=]|\w+>)/.test(be()))&&(Ie=`\\${T}`),oe({type:"text",value:T,output:Ie});continue}if(n.dot!==!0&&(C.type==="slash"||C.type==="bos")){oe({type:"qmark",value:T,output:$});continue}oe({type:"qmark",value:T,output:k});continue}if(T==="!"){if(n.noextglob!==!0&&ke()==="("&&(ke(2)!=="?"||!/[!=<:]/.test(ke(3)))){Se("negate",T);continue}if(n.nonegate!==!0&&_.index===0){te();continue}}if(T==="+"){if(n.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){Se("plus",T);continue}if(C&&C.value==="("||n.regex===!1){oe({type:"plus",value:T,output:d});continue}if(C&&(C.type==="bracket"||C.type==="paren"||C.type==="brace")||_.parens>0){oe({type:"plus",value:T});continue}oe({type:"plus",value:d});continue}if(T==="@"){if(n.noextglob!==!0&&ke()==="("&&ke(2)!=="?"){oe({type:"at",extglob:!0,value:T,output:""});continue}oe({type:"text",value:T});continue}if(T!=="*"){(T==="$"||T==="^")&&(T=`\\${T}`);let z=Ole.exec(be());z&&(T+=z[0],_.index+=z[0].length),oe({type:"text",value:T});continue}if(C&&(C.type==="globstar"||C.star===!0)){C.type="star",C.star=!0,C.value+=T,C.output=W,_.backtrack=!0,_.globstar=!0,Be(T);continue}let ee=be();if(n.noextglob!==!0&&/^\([^?]/.test(ee)){Se("star",T);continue}if(C.type==="star"){if(n.noglobstar===!0){Be(T);continue}let z=C.prev,$e=z.prev,Ie=z.type==="slash"||z.type==="bos",et=$e&&($e.type==="star"||$e.type==="globstar");if(n.bash===!0&&(!Ie||ee[0]&&ee[0]!=="/")){oe({type:"star",value:T,output:""});continue}let ct=_.braces>0&&(z.type==="comma"||z.type==="brace"),Vt=re.length&&(z.type==="pipe"||z.type==="paren");if(!Ie&&z.type!=="paren"&&!ct&&!Vt){oe({type:"star",value:T,output:""});continue}for(;ee.slice(0,3)==="/**";){let U=e[_.index+4];if(U&&U!=="/")break;ee=ee.slice(3),Be("/**",3)}if(z.type==="bos"&&G()){C.type="globstar",C.value+=T,C.output=P(n),_.output=C.output,_.globstar=!0,Be(T);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!et&&G()){_.output=_.output.slice(0,-(z.output+C.output).length),z.output=`(?:${z.output}`,C.type="globstar",C.output=P(n)+(n.strictSlashes?")":"|$)"),C.value+=T,_.globstar=!0,_.output+=z.output+C.output,Be(T);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&ee[0]==="/"){let U=ee[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(z.output+C.output).length),z.output=`(?:${z.output}`,C.type="globstar",C.output=`${P(n)}${p}|${p}${U})`,C.value+=T,_.output+=z.output+C.output,_.globstar=!0,Be(T+ne()),oe({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&ee[0]==="/"){C.type="globstar",C.value+=T,C.output=`(?:^|${p}|${P(n)}${p})`,_.output=C.output,_.globstar=!0,Be(T+ne()),oe({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-C.output.length),C.type="globstar",C.output=P(n),C.value+=T,_.output+=C.output,_.globstar=!0,Be(T);continue}let Ve={type:"star",value:T,output:W};if(n.bash===!0){Ve.output=".*?",(C.type==="bos"||C.type==="slash")&&(Ve.output=I+Ve.output),oe(Ve);continue}if(C&&(C.type==="bracket"||C.type==="paren")&&n.regex===!0){Ve.output=T,oe(Ve);continue}(_.index===_.start||C.type==="slash"||C.type==="dot")&&(C.type==="dot"?(_.output+=w,C.output+=w):n.dot===!0?(_.output+=b,C.output+=b):(_.output+=I,C.output+=I),ke()!=="*"&&(_.output+=f,C.output+=f)),oe(Ve)}for(;_.brackets>0;){if(n.strictBrackets===!0)throw new SyntaxError(id("closing","]"));_.output=Zr.escapeLast(_.output,"["),ge("brackets")}for(;_.parens>0;){if(n.strictBrackets===!0)throw new SyntaxError(id("closing",")"));_.output=Zr.escapeLast(_.output,"("),ge("parens")}for(;_.braces>0;){if(n.strictBrackets===!0)throw new SyntaxError(id("closing","}"));_.output=Zr.escapeLast(_.output,"{"),ge("braces")}if(n.strictSlashes!==!0&&(C.type==="star"||C.type==="bracket")&&oe({type:"maybe_slash",value:"",output:`${p}?`}),_.backtrack===!0){_.output="";for(let ee of _.tokens)_.output+=ee.output!=null?ee.output:ee.value,ee.suffix&&(_.output+=ee.suffix)}return _};j_.fastpaths=(e,t)=>{let n={...t},i=typeof n.maxLength=="number"?Math.min(kv,n.maxLength):kv,r=e.length;if(r>i)throw new SyntaxError(`Input length: ${r}, exceeds maximum allowed length: ${i}`);e=wV[e]||e;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:p,START_ANCHOR:f}=xm.globChars(n.windows),g=n.dot?u:l,h=n.dot?d:l,w=n.capture?"":"?:",b={negated:!1,prefix:""},k=n.bash===!0?".*?":p;n.capture&&(k=`(${k})`);let $=I=>I.noglobstar===!0?k:`(${w}(?:(?!${f}${I.dot?c:o}).)*?)`,x=I=>{switch(I){case"*":return`${g}${a}${k}`;case".*":return`${o}${a}${k}`;case"*.*":return`${g}${k}${o}${a}${k}`;case"*/*":return`${g}${k}${s}${a}${h}${k}`;case"**":return g+$(n);case"**/*":return`(?:${g}${$(n)}${s})?${h}${a}${k}`;case"**/*.*":return`(?:${g}${$(n)}${s})?${h}${k}${o}${a}${k}`;case"**/.*":return`(?:${g}${$(n)}${s})?${o}${a}${k}`;default:{let A=/^(.*?)\.(\w+)$/.exec(I);if(!A)return;let W=x(A[1]);return W?W+o+A[2]:void 0}}},R=Zr.removePrefix(e,b),P=x(R);return P&&n.strictSlashes!==!0&&(P+=`${s}?`),P};kV.exports=j_});var SV=ae((IWe,RV)=>{"use strict";var jle=yV(),N_=xV(),$V=vm(),Nle=bm(),Lle=e=>e&&typeof e=="object"&&!Array.isArray(e),cn=(e,t,n=!1)=>{if(Array.isArray(e)){let u=e.map(p=>cn(p,t,n));return p=>{for(let f of u){let g=f(p);if(g)return g}return!1}}let i=Lle(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!i)throw new TypeError("Expected pattern to be a non-empty string");let r=t||{},o=r.windows,s=i?cn.compileRe(e,t):cn.makeRe(e,t,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(r.ignore){let u={...t,ignore:null,onMatch:null,onResult:null};c=cn(r.ignore,u,n)}let l=(u,d=!1)=>{let{isMatch:p,match:f,output:g}=cn.test(u,s,t,{glob:e,posix:o}),h={glob:e,state:a,regex:s,posix:o,input:u,output:g,match:f,isMatch:p};return typeof r.onResult=="function"&&r.onResult(h),p===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof r.onIgnore=="function"&&r.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof r.onMatch=="function"&&r.onMatch(h),d?h:!0)};return n&&(l.state=a),l};cn.test=(e,t,n,{glob:i,posix:r}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let o=n||{},s=o.format||(r?$V.toPosixSlashes:null),a=e===i,c=a&&s?s(e):e;return a===!1&&(c=s?s(e):e,a=c===i),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=cn.matchBase(e,t,n,r):a=t.exec(c)),{isMatch:!!a,match:a,output:c}};cn.matchBase=(e,t,n)=>(t instanceof RegExp?t:cn.makeRe(t,n)).test($V.basename(e));cn.isMatch=(e,t,n)=>cn(t,n)(e);cn.parse=(e,t)=>Array.isArray(e)?e.map(n=>cn.parse(n,t)):N_(e,{...t,fastpaths:!1});cn.scan=(e,t)=>jle(e,t);cn.compileRe=(e,t,n=!1,i=!1)=>{if(n===!0)return e.output;let r=t||{},o=r.contains?"":"^",s=r.contains?"":"$",a=`${o}(?:${e.output})${s}`;e&&e.negated===!0&&(a=`^(?!${a}).*$`);let c=cn.toRegex(a,t);return i===!0&&(c.state=e),c};cn.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let r={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(r.output=N_.fastpaths(e,t)),r.output||(r=N_(e,t)),cn.compileRe(r,t,n,i)};cn.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(n){if(t&&t.debug===!0)throw n;return/$^/}};cn.constants=Nle;RV.exports=cn});var $m=ae((DWe,AV)=>{"use strict";var EV=SV(),Mle=vm();function OV(e,t,n=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:Mle.isWindows()}),EV(e,t,n)}Object.assign(OV,EV);AV.exports=OV});import{dirname as Fle}from"path";import{fileURLToPath as Gle}from"url";import{createHash as Wle}from"crypto";import{execFile as Ble}from"child_process";function M_(){return xv=new L_,xv}function bt(){return xv||M_()}function F_(e){return Fle(Gle(e))}var PV,L_,xv,Oo=v(()=>{"use strict";PV=Ye($m(),1),L_=class{constructor(){this.name="node";this.hashAlgorithm="sha256";this.commands={runner:"node",exec:"npx",packCmd:["npm","pack"]}}hash(t){return Wle("sha256").update(t).digest("hex")}globMatch(t,n){return(0,PV.default)(t)(n)}async spawn(t,n){return new Promise(i=>{let r=Ble(t[0],t.slice(1),{cwd:n?.cwd,maxBuffer:10485760,...n?.env?{env:{...process.env,...n.env}}:{}},(o,s,a)=>{i({stdout:s??"",stderr:a??"",exitCode:o?o.code??1:0})});r.stdin&&(r.stdin.on("error",()=>{}),r.stdin.end(n?.stdin??""))})}}});import{createHmac as zle,timingSafeEqual as WWe}from"node:crypto";function G_(e=$v){let t=e.toLowerCase();return{signature:`${t}-signature`,timestamp:`${t}-timestamp`,event:`${t}-event`,delivery:`${t}-delivery`}}function W_(e,t,n){return`sha256=${zle("sha256",e).update(`${String(t)}.${n}`,"utf8").digest("hex")}`}var $v,B_=v(()=>{"use strict";$v="x-chant"});import{createHash as Ule,randomUUID as Vle}from"node:crypto";function qle(e){let t={};e.CI_JOB_URL?t.url=e.CI_JOB_URL:e.GITHUB_SERVER_URL&&e.GITHUB_REPOSITORY&&e.GITHUB_RUN_ID?t.url=`${e.GITHUB_SERVER_URL}/${e.GITHUB_REPOSITORY}/actions/runs/${e.GITHUB_RUN_ID}`:e.CI_PIPELINE_URL&&(t.url=e.CI_PIPELINE_URL),e.GITLAB_CI==="true"?t.forge="gitlab":e.GITEA_ACTIONS==="true"||e.FORGEJO_ACTIONS==="true"?t.forge="forgejo":e.GITHUB_ACTIONS==="true"&&(t.forge="github");let n=e.GITHUB_REPOSITORY||e.CI_PROJECT_PATH;n&&(t.repository=n);let i=e.GITHUB_SHA||e.CI_COMMIT_SHA;return i&&(t.commit=i),t}function TV(e,t={}){let n=t.env??process.env,{id:i,project:r,targets:o,run:s,...a}=e,c={...qle(n),...s??{}},l=r??c.repository??"this project",u=e.digest??e.drift?.fingerprint??c.commit,d=i??(u?Ule("sha256").update(JSON.stringify([e.source,l,e.event,e.wave?.number??null,e.environment??null,u])).digest("hex"):Vle());return{schema:Hle,id:d,at:(t.now??new Date).toISOString(),...a,project:l,targets:o??[],...Object.keys(c).length>0?{run:c}:{}}}function IV(e){if(e.summary)return`${e.source}: ${e.summary}`;let t=e.wave?`wave ${e.wave.number}${e.wave.name?` (${e.wave.name})`:""} of ${e.project}`:e.environment?`${e.environment} in ${e.project}`:e.project;return`${e.source}: ${t} ${Kle[e.event]}`}function DV(e){let t=[];return e.approve?.review&&t.push({title:"Review and approve",value:`pull request ${e.approve.review.pr}, then run it again`,link:e.approve.review.url}),e.drift?(e.drift.changed.length>0&&t.push({title:"Drifted",value:e.drift.changed.join(", ")}),e.drift.missing?.length&&t.push({title:"Missing",value:e.drift.missing.join(", ")}),e.drift.failed?.length&&t.push({title:"Not refreshed",value:e.drift.failed.join(", ")})):e.targets.length>0&&t.push({title:"Targets",value:e.targets.join(", ")}),e.digest&&t.push({title:"Digest",value:e.digest}),e.approve&&t.push({title:e.approve.review?"Or approve":"Approve",value:e.approve.command}),e.reason&&t.push({title:"Reason",value:e.reason}),e.run?.url&&t.push({title:"Run",value:e.run.url,link:e.run.url}),e.reportUrl&&t.push({title:"Report",value:e.reportUrl,link:e.reportUrl}),t}function Jle(e){let t=[`*${IV(e)}*`];for(let n of DV(e))n.title==="Review and approve"?t.push(`${n.title}: <${n.link}|pull request ${e.approve.review.pr}>, then run it again`):n.title==="Approve"||n.title==="Or approve"||n.title==="Digest"?t.push(`${n.title}: \`${n.value}\``):n.link?t.push(`${n.title}: <${n.link}>`):t.push(`${n.title}: ${n.value}`);return{text:t.join(`
52
52
  `)}}function Zle(e){let t=DV(e),n=[...e.approve?.review?[{type:"Action.OpenUrl",title:"Review and approve",url:e.approve.review.url}]:[],...e.run?.url?[{type:"Action.OpenUrl",title:"Open the run",url:e.run.url}]:[]];return{type:"message",attachments:[{contentType:"application/vnd.microsoft.card.adaptive",contentUrl:null,content:{$schema:"http://adaptivecards.io/schemas/adaptive-card.json",type:"AdaptiveCard",version:"1.4",body:[{type:"TextBlock",text:IV(e),weight:"Bolder",wrap:!0},{type:"FactSet",facts:t.map(i=>({title:i.title,value:i.link&&i.title==="Review and approve"?`${i.value}: ${i.link}`:i.value}))}],...n.length>0?{actions:n}:{}}}]}}function Rv(e,t="notify"){if(typeof e!="object"||e===null||Array.isArray(e))return`${t}: expected { webhook, key, slack, teams, events }`;let n=e;for(let i of Object.keys(n))if(!_V.includes(i))return`${t}.${i}: unknown setting (expected ${_V.join(", ")})`;for(let i of["webhook","key","slack","teams"]){let r=n[i];if(r!==void 0&&(typeof r!="string"||!Yle.test(r)))return`${t}.${i}: the name of the environment variable that holds the ${i==="key"?"signing key":"URL"}, never the ${i==="key"?"key":"URL"} itself`}if(n.webhook!==void 0&&n.key===void 0)return`${t}.key: a webhook needs a signing key; name the variable that holds it`;if(n.key!==void 0&&n.webhook===void 0)return`${t}.webhook: a key is for a webhook; name the variable that holds its URL`;if(n.webhook===void 0&&n.slack===void 0&&n.teams===void 0)return`${t}: name a webhook (with its key), a slack or a teams URL variable`;if(n.events!==void 0&&!(Array.isArray(n.events)&&n.events.every(i=>CV.includes(i))))return`${t}.events: a list of ${CV.join(", ")}`}function Xle(e,t,n={}){let i=JSON.stringify(e),r=n.now??Math.floor(Date.now()/1e3),o=G_(n.prefix??$v);return{body:i,headers:{"content-type":"application/json","user-agent":n.userAgent??e.source,[o.event]:e.event,[o.delivery]:e.id,[o.timestamp]:String(r),[o.signature]:W_(t,r,i)}}}function jV(e,t){let n=e;for(let i of t)i&&(n=n.split(i).join("<url>"));return n.replace(/https?:\/\/\S+/g,"<url>")}async function Qle(e,t,n,i,r){let o="not attempted";for(let s=0;s<i;s++){s>0&&await r(500*s);try{let a=await e(t,{method:"POST",...n,signal:AbortSignal.timeout(1e4)});if(a.ok)return;if(o=`HTTP ${String(a.status)}`,a.status<500)return o}catch(a){o=jV(a instanceof Error?a.message:String(a),[t])}}return o}async function NV(e,t,n={}){if(!e||!t)return[];if(e.events&&!e.events.includes(t.event))return[];let i=n.env??process.env,r=n.fetch??((d,p)=>globalThis.fetch(d,p)),o=Math.max(1,n.attempts??3),s=n.sleep??(d=>new Promise(p=>setTimeout(p,d))),a=n.log??(d=>process.stderr.write(d+`
53
53
  `)),c=[],l=async(d,p,f)=>{let g;try{let h=i[p];if(!h)g={target:d,ok:!1,detail:`${p} is not set`};else{let w=f();if(typeof w=="string")g={target:d,ok:!1,detail:w};else{let b=await Qle(r,h,w,o,s);g={target:d,ok:b===void 0,detail:b??"delivered"}}}}catch(h){g={target:d,ok:!1,detail:jV(h instanceof Error?h.message:String(h),[i[p]??""])}}g.ok||a(`notify: the ${t.event} event was not delivered to ${eue[d]}: ${g.detail}`),c.push(g)},u=d=>({headers:{"content-type":"application/json"},body:JSON.stringify(d)});return e.webhook&&await l("webhook",e.webhook,()=>{let d=e.key?i[e.key]:void 0;return d?Xle(t,d,{...n.now!==void 0?{now:n.now}:{},...n.prefix?{prefix:n.prefix}:{},...n.userAgent?{userAgent:n.userAgent}:{}}):`${e.key??"the key variable"} is not set, and an event is never sent unsigned`}),e.slack&&await l("slack",e.slack,()=>u((n.render?.slack??Jle)(t))),e.teams&&await l("teams",e.teams,()=>u((n.render?.teams??Zle)(t))),c}var Hle,CV,Kle,Yle,_V,eue,Sv=v(()=>{"use strict";B_();B_();Hle="chant.notify/v1",CV=["waiting","refused","failed","drift"];Kle={waiting:"waits for an approval",refused:"was refused",failed:"failed",drift:"drifted"};Yle=/^[A-Za-z_][A-Za-z0-9_]*$/,_V=["webhook","key","slack","teams","events"];eue={webhook:"the webhook",slack:"Slack",teams:"Teams"}});function LV(e,t,n,i={}){let o=e.waves[t-1]?.name,s=`wave ${t}${o?` (${o})`:""} of ${e.name}`;if(n.error!==void 0)return{source:"chant",event:"failed",summary:`${s} failed`,wave:{number:t,...o?{name:o}:{}},targets:[],reason:n.error,exitCode:1};let{result:a}=n,c=a.decision,l={source:"chant",wave:{number:t,...o?{name:o}:{},...c?.gate?{gate:c.gate}:{}},...c?.digest?{digest:c.digest}:{},exitCode:a.exitCode};if(a.exitCode===3){if(!c)return;let u=a.hooks.filter(p=>p.outcome==="held");if((i.share!==void 0||i.group!==void 0)&&u.length===0)return;let d=c.review?.pr!==void 0&&c.review.url?{review:{pr:c.review.pr,url:c.review.url}}:{};return{...l,event:"waiting",status:"waiting",summary:`${s} waits for an approval`,targets:c.members.map(p=>p.member),approve:{command:c.approve??`chant approve ${c.op} ${c.gate} --plan ${c.digest}`,...d},...c.heldOn?{reason:`held on ${c.heldOn.op} / ${c.heldOn.gate} by ${c.heldOn.hook}`}:c.heldBy?.length?{reason:`held by ${c.heldBy.join(", ")}`}:c.review?.reason?{reason:c.review.reason}:{}}}if(a.exitCode===8&&c?.refused?.reason==="point")return{...l,event:"refused",status:"point",summary:`${s} refused: decision point ${c.point?.name??""} answered ${JSON.stringify(c.point?.answer?.answer??null)}`,targets:c.refused.runs,...c.refused.message?{reason:c.refused.message}:{}};if(a.exitCode===7&&c?.refused)return{...l,event:"refused",status:c.refused.reason==="override-moved"?"override-moved":"denied",summary:`${s} refused: the policy denied ${c.refused.runs.join(", ")}`,targets:c.refused.runs,reason:c.refused.reason==="override-moved"?"an override stands for an earlier plan or other rules, so it counts for nothing":"the policy denied these runs, and no override counts for them"};if(!(a.exitCode===6&&a.outcome?.outcome==="stood-down")){if(a.exitCode===5&&a.outcome?.outcome==="held"){let u=a.outcome.holder;return{...l,event:"refused",status:"held",summary:`${s} applied nothing: another run${u?` (${u.run})`:""} holds what it changes`,targets:c?.members.map(d=>d.member)??[],reason:a.outcome.reason??`another run${u?`, ${u.run},`:""} holds what the apply changes; apply again once it is done`}}if(a.exitCode===4)return{...l,event:"refused",status:"moved",summary:`${s}${tue(i)} refused ${a.moved.length} run${a.moved.length===1?"":"s"} whose plan moved since the wave was decided`,targets:a.moved,reason:"their plans moved since the wave was decided, so they were not applied"};if(a.exitCode!==0){let u=a.hooks.filter(d=>d.outcome==="failed").map(d=>`${d.moment} hook ${d.name}${d.target?` (${d.target})`:""}`);return a.failed.length===0&&u.length>0?{...l,event:"failed",status:"failed",summary:`${s} failed: ${u.join(", ")} failed`,targets:[],reason:`${u.join(", ")} exited non-zero`}:{...l,event:"failed",status:"failed",summary:`${s} failed: ${a.failed.length>0?`${a.failed.join(", ")} did not apply`:`exit ${a.exitCode}`}`,targets:a.failed,...a.failed.length>0?{reason:`the apply command failed for ${a.failed.join(", ")}`}:{}}}}}function tue(e){return e.group!==void 0?`, ${e.share!==void 0?`share ${e.share} of `:""}job group ${e.group},`:e.share!==void 0?`, share ${e.share},`:""}async function Ev(e,t,n,i={},r={}){if(!e.notify||Rv(e.notify)!==void 0)return[];try{let o=LV(e,t,n,i);return o?await NV(e.notify,TV(o,{...r.env?{env:r.env}:{}}),r):[]}catch(o){return(r.log??(s=>process.stderr.write(s+`
54
54
  `)))(`notify: nothing was sent: ${o instanceof Error?o.message:String(o)}`),[]}}var z_=v(()=>{"use strict";Sv()});var FV={};_e(FV,{DEPRECATED_GATE_KEY_WARNING:()=>MV,FAN_OUT_GATE_OP:()=>od,OVERRIDE_GATE_OP:()=>fa,RELEASE_GATE_OP:()=>ui,WORKSPACE_UPGRADE_GATE_OP:()=>sd,gateName:()=>ma,isNeverOverMcpGateOp:()=>U_,opUsesDeprecatedGateKey:()=>rue,usesDeprecatedGateKey:()=>V_});function U_(e){return e===od||e===sd||e===fa||e===ui||nue.test(e)}function ma(e){return e.gate??e.signalName??""}function V_(e){return e.gate===void 0&&typeof e.signalName=="string"}function rue(e){let t=i=>i.kind==="gate"?V_(i):i.kind==="effect"?i.steps.some(t):!1,n=i=>(i??[]).some(r=>r.steps.some(t));return n(e.phases)||n(e.onFailure)}var od,sd,fa,ui,nue,MV,Yr=v(()=>{"use strict";od="fan-out",sd="workspace-upgrade",fa="policy-override",ui="release",nue=/^pr-\d+(?:-[a-z0-9][a-z0-9-]*)?$/;MV='Gate steps still using "signalName": the key is now "gate" (chant #2202). "signalName" is accepted through 0.59.0 and removed in 0.60.0.'});function ad(e){return typeof e=="object"&&e!==null&&ga in e&&e[ga]===!0}var ga,ws=v(()=>{"use strict";ga=Symbol.for("chant.intrinsic")});var GV,ha,cd=v(()=>{"use strict";ws();ha=class{constructor(t,n){this[GV]=!0;this.parent=new WeakRef(t),this.attribute=n}_setLogicalName(t){this.logicalName=t}getLogicalName(){return this.logicalName}toString(){let t=this.logicalName?`${this.logicalName}.${this.attribute}`:`.${this.attribute}`;throw new Error(`A resource attribute reference (${t}) has no string form: it stands for a value the build resolves later, and interpolating it into a plain template literal would produce "[object Object]". Use the lexicon's own intrinsic, whose interior handles references \u2014 \`Sub\`\${\u2026}\`\` for CloudFormation \u2014 or move the reference out of the template.`)}[(GV=ga,Symbol.toPrimitive)](){return this.toString()}toJSON(){if(!this.logicalName)throw new Error(`Cannot serialize AttrRef for attribute "${this.attribute}": logical name not set`);return{__attrRef:{entity:this.logicalName,attribute:this.attribute}}}}});function Wi(e){return e instanceof ha?!0:typeof e=="object"&&e!==null&&"parent"in e&&"attribute"in e&&"_setLogicalName"in e&&typeof e.parent=="object"&&typeof e.attribute=="string"}function Gt(e,t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([n],[i])=>n.localeCompare(i))):t}var Wt=v(()=>{"use strict";cd()});function di(e){return e!==void 0&&iue.has(e)}function bs(){if(H_!=="cli")return H_;let e=process.env[oue];return e==="mcp"||e==="acp"?e:H_}function WV(e,t){if(di(t)&&e===t)return`the gate was reached over ${t} and this resolution arrived over ${t} too, so the same caller wrote both halves`}var iue,Ov,H_,oue,tl=v(()=>{"use strict";iue=new Set(["mcp","acp"]);Ov="unattested",H_="cli",oue="CHANT_GATE_ORIGIN"});var BV,q_=v(()=>{"use strict";BV=["changeSets","releases","runEvents"]});import{dirname as oBe,isAbsolute as sue,join as sBe}from"node:path";import{fileURLToPath as aue}from"node:url";function zV(e,t="--report-url"){let n=e.trim();if(n.startsWith("file://")){let r;try{r=aue(n)}catch(o){return{error:`${t} ${n}: ${o instanceof Error?o.message:String(o)}`}}return sue(r)?{scheme:"file",url:n.replace(/\/+$/,""),dir:r}:{error:`${t} ${n}: a file URL names an absolute directory`}}let i=/^s3:\/\/([^/]+)\/?(.*)$/.exec(n);if(i){let r=i[2].replace(/\/+$/,"");return{scheme:"s3",url:`s3://${i[1]}${r?`/${r}`:""}`,bucket:i[1],prefix:r}}return{error:`${t} ${n}: takes an s3://<bucket>/<prefix> or file://<directory> URL`}}var UV=v(()=>{"use strict"});var K_,VV=v(()=>{K_={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://intentius.io/chant/schemas/workspace/declaration/v1/chant.workspace.schema.json",title:"chant.workspace.json",description:"A workspace declaration, schema 1 (#2524 D1, D2; ws-051). Only this file makes a directory a workspace. It may also be named chant.workspace.jsonc, which allows comments and trailing commas; having both is an error. Unknown fields are refused, except fields whose names start with x-. A field added later within schema 1 is optional, and a declaration that uses one sets minReader to the first chant that knows it, so an older chant says so instead of misreading the file. Uniqueness of names and the placement rules are checked in code, since JSON Schema cannot say them.",type:"object",required:["name","schema","members"],properties:{$schema:{type:"string",description:"An editor hint. chant ignores it."},$comment:{type:"string",description:"A note for people. chant ignores it."},name:{$ref:"#/$defs/name",description:"The workspace's name. With a git revision it identifies the workspace to readers (#2524 D15)."},schema:{const:1,description:"The declaration format version."},minReader:{$ref:"#/$defs/version",description:"The oldest chant that may read this declaration. An older chant refuses it with reader-too-old."},members:{type:"array",description:"Members and example groups, in the order readers list them.",items:{$ref:"#/$defs/entry"}},pins:{type:"array",description:"The toolchain and plugins that read this workspace, pinned (#2524 D3, threat model). Member kinds come only from pinned packages, read as data from their ./workspace-kinds subpath (#2535).",items:{$ref:"#/$defs/pin"}},quorum:{type:"integer",minimum:0,description:"How many agree verdicts besides the decider's a record needs, for every record kind with a reviews list (#2671). chant workspace records reports each record's quorum against it. Two when absent. Added in schema 1 by chant 0.86.0, so a declaration that sets it sets minReader to 0.86.0 or newer. A per-kind quorum comes later (#2650 C14)."},records:{type:"array",description:"The workspace's own record kinds, each a kind file relative to the workspace root (#2680): the kinds whose records belong to no one member, such as a decisions directory at the root. A member names its own in its records. chant workspace ls lists them, and chant workspace records and graph --intent read every declared kind when --kind is not given. Added in schema 1 by chant 0.86.0, so a declaration that uses it sets minReader to 0.86.0 or newer.",items:{$ref:"#/$defs/recordKind"}},hosts:{type:"array",description:"The hosts boxes run on (#2727). A host is one machine reached under one hostname: boxes on it share its ports, its state root and, in a browser, its cookie jar, so chant workspace check compares the boxes on one host and never boxes on different hosts. A member's box block names its host. Added in schema 1 by chant 0.91.0, so a declaration that uses it sets minReader to 0.91.0 or newer.",items:{$ref:"#/$defs/host"}},diagrams:{type:"array",description:"The workspace's own diagram artifacts (#2764): the diagrams that belong to no one member, such as a diagrams directory at the root. A member names its own in its diagrams. chant workspace ls lists every declared diagram, and chant workspace check reports one whose render is stale for its source when the entry records a sourceHash. Added in schema 1 by chant 0.91.0, so a declaration that uses it sets minReader to 0.91.0 or newer.",items:{$ref:"#/$defs/diagram"}},checks:{type:"object",description:"Severity for the declaration checks that allow it, keyed by WSP id (#2535, ws-028): error, warning, info or off. chant workspace check refuses an id it does not know, and one whose severity is fixed.",propertyNames:{pattern:"^WSP[0-9]{3}$"},additionalProperties:{$ref:"#/$defs/severity"}},changes:{type:"object",additionalProperties:!1,description:"The forward coverage check, chant workspace check --changes <base>..<head> (#2773): each path a diff changes is mapped to the current records whose constrains cover it. severity says what a finding does: off reports none, warn (the default) reports them and passes, fail reports them and fails. ignore lists globs over files whose changes need no record, such as lockfiles and generated output. Added in schema 1 by chant 0.92.0, so a declaration that uses it sets minReader to 0.92.0 or newer.",properties:{severity:{enum:["off","warn","fail"],description:"What a change-uncovered or change-out-of-scope finding does. warn when absent."},ignore:{type:"array",description:"Globs over file paths from the workspace root: * and ? within one segment, ** across segments. A changed path one matches is listed as ignored and never reported.",items:{$ref:"#/$defs/fileGlob"}}}},writeScope:{type:"object",propertyNames:{$ref:"#/$defs/className"},additionalProperties:{$ref:"#/$defs/classScope",description:"A domain class a pinned package supplies at its ./workspace-principals subpath (#3080, ws-079): principals holding the role the class names in the trust policy at base, and none of the agent, runner and service roles. A key no pinned package supplies fails chant workspace check with WSP003, and a writer judged human is refused with write-scope-class-unknown, since it may be in that class. Added in schema 1 by chant 0.102.0, so a declaration that uses one sets minReader to 0.102.0 or newer."},description:"Who may write what (#2524 D5, #2548, ws-067): for each principal class, the members whose files it may write and the record kinds it may write, with which verbs. A class is human, agent, runner or service, or a domain class a pinned package supplies (#3080). A class with no entry is not restricted. An agent is always bound to its session's member (agents); its entry can only narrow the record kinds and verbs. chant workspace records new, amend, review and close and the MCP record tools refuse a write outside the writer's scope with write-scope-member or write-scope-kind, and chant workspace check --changes reports each commit that writes outside its author's scope, read from the declaration and the trust policy at the range's base, and a write to a path the class's protected list covers with write-scope-protected (#3146). Added in schema 1 by chant 0.101.0, so a declaration that uses it sets minReader to 0.101.0 or newer.",properties:{human:{$ref:"#/$defs/classScope",description:"Principals holding none of the agent, runner and service roles, and none of the roles a domain class names, in the trust policy at base."},agent:{$ref:"#/$defs/agentScope",description:"An agent session (agents), or a principal holding the agent role in the trust policy at base."},runner:{$ref:"#/$defs/classScope",description:"Principals holding the runner role in the trust policy at base, such as a CI job's signing identity."},service:{$ref:"#/$defs/classScope",description:"Principals holding the service role in the trust policy at base."}}},agents:{type:"array",description:"The agent sessions the workspace declares (#2524 D20, #2548, ws-067, ws-101). Each is bound to the members it names, one with member or several with members: it writes the files of any of them and the records of kinds any of them or the workspace declares, as writeScope.agent allows. A session resumes from chant workspace agent <name> --json, which prints its member, its scope and the spec, read from the repository alone. A write names its session with the CHANT_AGENT environment variable, or a commit with a Chant-Agent trailer. Added in schema 1 by chant 0.101.0, so a declaration that uses it sets minReader to 0.101.0 or newer.",items:{$ref:"#/$defs/agent"}},identity:{type:"object",additionalProperties:!1,description:"Who a person-attributed record or gate approval may name, and which gates need a signed approval (#3163, ws-080). Read from the declaration at base, like writeScope, so a change can't loosen its own rule. A person is named by a forge identity (github:<login>, gitlab:<login>, or <forge>@<host>:<login> for forgejo, gitea or a self-hosted github or gitlab) that the surface which signed them in maps their session to, or by a principal .chant/allowed_signers lists at base. chant never authenticates a person: a forge identity is recorded as the surface gives it, and only a seal verified against the signers at base attests it. Added in schema 1 by chant 0.102.0, so a declaration that uses it sets minReader to 0.102.0 or newer.",properties:{attribution:{enum:["any","identified"],description:"any (the default): a record's by, decided_by, reviewer or answerer and a gate approval's actor may be any name, such as a roster name. identified: each must be a forge identity, a principal the signers file at base lists, or a principal holding the agent, runner or service role at base or listed by a declared agent session; chant workspace records new and review, points answer and chant approve refuse any other name with principal-unidentified."},gates:{type:"object",description:"Gates, by name, that pass only on a signed approval: chant approve --sign with a key the signers file at base lists for the approver. The rule applies to a gate of that name in every member, Op and component. An unsigned approval, or one whose signer is not in class, is recorded nowhere and never counts toward the gate.",propertyNames:{type:"string",minLength:1},additionalProperties:{type:"object",additionalProperties:!1,properties:{class:{$ref:"#/$defs/className",description:"The principal class the signer must be in, read from the role grants at base (#3080, ws-079): human, runner, service, or a domain class a pinned package supplies. A class no pinned package supplies lets no approval through (fail closed). Absent: any signer the signers file lists."}}}}}},ci:{type:"object",additionalProperties:!1,patternProperties:{"^x-":!0},description:"What the workspace's CI decides about its commits (#3573, ws-103). Added in schema 1 by chant 0.108.0, so a declaration that uses it sets minReader to 0.108.0 or newer.",properties:{green:{$ref:"#/$defs/ciGreen"},workflow:{$ref:"#/$defs/ciWorkflow"},reportUrl:{type:"string",minLength:1,description:"Where the pull-request jobs copy their reports and events, and where chant ci run keeps the run index, <reportUrl>/runs/index.json (#4160): an s3://<bucket>/<prefix> or file://<directory> URL, as --report-url takes. chant build --pr-loop, chant ci run, chant ci serve and chant ci runs use it when --report-url is not given, and the flag wins. Readers find it in chant workspace ls --json as ci.reportUrl. Added in schema 1 by chant 0.124.32, so a declaration that uses it sets minReader to 0.124.32 or newer."}}},retention:{type:"object",additionalProperties:!1,patternProperties:{"^x-":!0},description:"How long chant lifecycle gc keeps each kind of stored record (#4036). A kind or field left out keeps its default: changeSets 14 days; releases 14 days and the newest 10 of each member; runEvents 14 days and the newest 100. Whatever the policy, gc never prunes a release an environment runs, what a pending gate binds, or a change set a gate names with a kept release. Read from the declaration at base. Added in schema 1 by chant 0.124.29, so a declaration that uses it sets minReader to 0.124.29 or newer.",properties:{changeSets:{type:"object",additionalProperties:!1,description:"Stored change sets, _change-sets/<digest>.json on chant/lifecycle.",properties:{days:{$ref:"#/$defs/retentionDays"}}},releases:{type:"object",additionalProperties:!1,description:"Releases, _releases/<digest>.json on chant/lifecycle, with the template bytes only they name. A release stays promotable for days after its newest cut, and the newest keep releases of each member stay promotable at any age, unless their commit is revoked.",properties:{days:{$ref:"#/$defs/retentionDays"},keep:{$ref:"#/$defs/retentionKeep"}}},runEvents:{type:"object",additionalProperties:!1,description:"Run event files, <git-common-dir>/chant/run-events/<run>.jsonl on each host. A file is kept for days after its last write, and the newest keep files at any age.",properties:{days:{$ref:"#/$defs/retentionDays"},keep:{$ref:"#/$defs/retentionKeep"}}}}},metrics:{type:"object",additionalProperties:!1,patternProperties:{"^x-":!0},description:"How chant workspace metrics counts the DORA metrics (#4039). Added in schema 1 by chant 0.124.29, so a declaration that uses it sets minReader to 0.124.29 or newer.",properties:{failureWindowDays:{type:"integer",minimum:1,maximum:365,description:"A deploy counts as failed when, within this many days after it, the commit it deployed is revoked or the environment is rolled back from it. The default is 7."}}},security:{type:"array",uniqueItems:!0,description:"The security groups the workspace opts into (#4168), for every member; a member's own security adds to them. With none, a security feature the workspace has not turned on never refuses, warns or hides anything. verified-releases: release publish and promote --release take only a verified release. supply-chain: a publish without OIDC provenance warns, and a target with no SBOM source is refused. who-ran-it: ci tick needs a runner key. review-rules: pr-apply requires a forge review. isolated-runners: an apply job requires a runner-start statement. workspace check reports what a declared group lacks (WSP161 to WSP165). Added in schema 1 by chant 0.124.33, so a declaration that uses it sets minReader to 0.124.33 or newer.",items:{enum:["verified-releases","supply-chain","who-ran-it","review-rules","isolated-runners"]}}},patternProperties:{"^x-":!0},additionalProperties:!1,$defs:{retentionDays:{type:"integer",minimum:0,maximum:36500,description:"Days a record is kept past its last write or use. 0 lets every record go that no never-prune rule keeps."},retentionKeep:{type:"integer",minimum:0,maximum:1e5,description:"How many of the newest are kept at any age."},name:{type:"string",pattern:"^[a-z0-9][a-z0-9-]{0,39}$",description:"Lowercase letters, digits and hyphens, starting with a letter or digit, at most 40 characters. _workspace and _members are reserved; the pattern already rules them out."},kindName:{type:"string",pattern:"^[a-z][a-z0-9-]{0,39}$"},className:{type:"string",pattern:"^(?!x-)[a-z][a-z0-9-]{0,39}$",description:"A principal class: human, agent, runner, service, or a domain class a pinned package supplies (#3080)."},version:{type:"string",pattern:"^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z.-]+)?$"},dir:{type:"string",description:'A directory relative to the workspace root, with / separators: "." for the root itself, otherwise no leading /, no . or .. segments and no trailing /.',pattern:"^(\\.|(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*)$"},glob:{type:"string",description:"A glob over directories, relative to the workspace root: * and ? within one segment, ** across segments, [...] classes. No leading /, no . or .. segments.",pattern:"^(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*$"},severity:{enum:["error","warning","info","off"]},suppress:{type:"array",description:"Declaration checks suppressed for this entry (#2535). Each names a WSP id and says why. A suppressed finding is still reported, as suppressed, and never fails check.",items:{type:"object",required:["check","because"],properties:{check:{type:"string",pattern:"^WSP[0-9]{3}$"},because:{type:"string",minLength:1}},patternProperties:{"^x-":!0},additionalProperties:!1}},outputName:{type:"string",minLength:1,maxLength:255,pattern:"^[^\\u0000-\\u001f]+$",description:"An output's name, compared exactly."},link:{type:"object",description:"A member link: this member reads output of member (#2539), or sends its telemetry to a pipeline of its collector (#2558).",required:["member","output"],properties:{member:{$ref:"#/$defs/name",description:"The producer: another member of this workspace."},output:{$ref:"#/$defs/outputName",description:"The producer's output, matched exactly. It must be one the producer's kind exposes. For a telemetry link, the id of a pipeline or an exporter in the producer's collector."},kind:{$ref:"#/$defs/kindName",description:"The link kind. output, the default: the consumer reads the named output. telemetry (#2558): the consumer sends its telemetry to the named pipeline or exporter of the producer's collector, and chant workspace graph checks that it exists and, when protocol is given, that it speaks it. A declaration that uses telemetry sets minReader to 0.101.0 or newer."},protocol:{enum:["grpc","http/protobuf","http/json"],description:"For a telemetry link, the OTLP protocol the consumer sends, as OTEL_EXPORTER_OTLP_PROTOCOL names it. Refused on any other kind. Added in schema 1 by chant 0.101.0."}},patternProperties:{"^x-":!0},additionalProperties:!1},entry:{description:"A member, or an example group when kind is examples (ws-051).",type:"object",required:["kind"],properties:{kind:{$ref:"#/$defs/kindName"}},if:{type:"object",properties:{kind:{const:"examples"}},required:["kind"]},then:{$ref:"#/$defs/group"},else:{$ref:"#/$defs/member"}},member:{type:"object",description:"A member (#2524 D2). Its directory leaves the root project, and it gets its own build, lint and ledger.",required:["name","dir","kind"],properties:{name:{$ref:"#/$defs/name",description:"Frozen once the member deploys; a rename is an alias record."},dir:{$ref:"#/$defs/dir"},kind:{$ref:"#/$defs/kindName",description:"How to read the member: chant, workspace, other, or a kind a pinned plugin supplies (#2535)."},roles:{type:"array",description:"Roles the member plays. A role may point at a path inside the member.",items:{oneOf:[{$ref:"#/$defs/kindName"},{type:"object",required:["name"],properties:{name:{$ref:"#/$defs/kindName"},path:{$ref:"#/$defs/dir",description:"Relative to the member's directory."}},patternProperties:{"^x-":!0},additionalProperties:!1}]}},generated:{type:"array",description:"Files in the member's directory that a command writes (#2524 D14, #2541). chant workspace check fails when one differs from what its generator writes, unless the entry is marked handWritten with a reason. The lineage lock classes the same files as generated. skills/*/SKILL.md, which chant update writes, is listed implicitly for a chant member.",items:{$ref:"#/$defs/generatedFile"}},outputs:{type:"array",uniqueItems:!0,description:"The outputs this member exposes as link targets (#2539), for a member whose kind takes them from the entry: other, or a kind a pinned package supplies. A chant member's outputs are read from its source, and a nested workspace exposes none.",items:{$ref:"#/$defs/outputName"}},fields:{$ref:"#/$defs/memberFields"},links:{type:"array",description:"Member links (#2524 D6, #2539): the outputs of other members this member reads. A link is stated once, here on the consumer, and matched exactly against the producer's outputs. chant workspace check resolves it in source.",items:{$ref:"#/$defs/link"}},records:{type:"array",description:"The record kinds this member holds, each a kind file relative to the member's directory (#2680). chant workspace ls lists them, and chant workspace records and graph --intent read every declared kind when --kind is not given. Added in schema 1 by chant 0.86.0, so a declaration that uses it sets minReader to 0.86.0 or newer.",items:{$ref:"#/$defs/recordKind"}},diagrams:{type:"array",description:"The diagram artifacts this member holds (#2764). chant workspace ls lists every declared diagram, and chant workspace check reports one whose render is stale for its source when the entry records a sourceHash. Added in schema 1 by chant 0.91.0, so a declaration that uses it sets minReader to 0.91.0 or newer.",items:{$ref:"#/$defs/diagram"}},box:{$ref:"#/$defs/box"},upstream:{type:"string",minLength:1,description:"Where an embedded member's files come from. Versions live in the lock."},ci:{type:"object",additionalProperties:!1,patternProperties:{"^x-":!0},description:"This member's own CI settings (#4168 step 6). Added in schema 1 by chant 0.124.34, so a declaration that uses it sets minReader to 0.124.34 or newer.",properties:{workflow:{$ref:"#/$defs/ciWorkflow"}}},travel:{type:"boolean",description:"Whether the member goes with an export (#2524 D10, #2552). chant workspace export writes only members that set travel to true into the export member, and refuses to name one that does not. Added in schema 1 by chant 0.101.0, so a declaration that uses it sets minReader to 0.101.0 or newer."},security:{type:"array",uniqueItems:!0,description:"The security groups this member opts into, added to the declaration's top-level security (#4168). A release, publish or pull-request job of this member runs under both lists. Added in schema 1 by chant 0.124.33, so a declaration that uses it sets minReader to 0.124.33 or newer.",items:{enum:["verified-releases","supply-chain","who-ran-it","review-rules","isolated-runners"]}},because:{type:"string",minLength:1,description:"Why the member is there. Required for kind other."},suppress:{$ref:"#/$defs/suppress"}},patternProperties:{"^x-":!0},additionalProperties:!1,if:{type:"object",properties:{kind:{const:"other"}},required:["kind"]},then:{type:"object",properties:{because:{type:"string"}},required:["because"]}},memberFields:{type:"object",description:"Values for the fields the member's kind declares (#3151), such as an app member's scripts, env and health. Each is a string, integer or boolean, or an object of those for a field the kind declares as an object. chant workspace check fails when the kind declares no such field or a value is of the wrong type (WSP005), and chant workspace status --json prints every field the kind declares with its defaults filled in. Added in schema 1 by chant 0.103.0, so a declaration that uses it sets minReader to 0.103.0 or newer.",propertyNames:{pattern:"^[a-z][A-Za-z0-9]{0,39}$"},additionalProperties:{oneOf:[{type:"string"},{type:"integer"},{type:"boolean"},{type:"object",propertyNames:{pattern:"^[a-z][A-Za-z0-9]{0,39}$"},additionalProperties:{oneOf:[{type:"string"},{type:"integer"},{type:"boolean"}]}}]}},group:{type:"object",description:"An example group (ws-051): every directory the glob matches that holds a chant project is built and linted. A group has no ledger, releases or links, and its matches are never members. A match may sit inside a member's directory; that member leaves it to the group.",required:["name","kind","glob"],properties:{name:{$ref:"#/$defs/name"},kind:{const:"examples"},glob:{oneOf:[{$ref:"#/$defs/glob"},{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/$defs/glob"}}]},suppress:{$ref:"#/$defs/suppress"}},patternProperties:{"^x-":!0},additionalProperties:!1},path:{type:"string",description:"A file or directory path with / separators: no leading /, no . or .. segments and no trailing /.",pattern:"^(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*$"},box:{type:"object",description:"The member is a box, or holds a box's declarations (#2726). A box holds no credential: each capability it needs outside itself is reached through a broker, a runtime such as a lobby or a door, which holds the credential and enforces the scope. chant workspace check fails when a file in the member's directory carries a literal secret (WSP121) and when a capability names no broker (WSP122). chant workspace status --json lists the capabilities, so a broker can read the scopes. Its host, slot, ports, state and cookies state the box's isolation (#2727): chant derives each value from the box's identity, its host, the member's name and its slot, and prints them in chant workspace status --json, so a runtime reads them instead of choosing its own. chant workspace check fails when two boxes on a host resolve to the same value (WSP123) and when a box hard-codes a machine path (WSP124). A member that builds the fountain lexicon's Box declares the callback token fountain gives its sandbox as the capability fountain-callback, brokered by fountain, with scope owner, or chant workspace check fails (WSP125, #2780). Its intent names the decision record that says what the box is for (#2850): chant workspace status --json reports the record's state and answer, and chant workspace check fails when no decision record has the id (WSP126) and warns when the record constrains no member or path of this workspace (WSP127, #2857). Its services list what the box runs under its supervisor (#2880), which the fly lexicon observes, restarts and applies through sprite-env, and which chant workspace status --json prints. Its factory declares what the box builds, how a build is checked, which member declares the builder agents and where a finished build is published (#3146, ws-077), its listing what the box shows of itself (#3146), and its replicate where the box's work in progress is pushed so a lost box loses none of it (#3172, ws-085). Added in schema 1 by chant 0.91.0, so a declaration that uses it sets minReader to 0.91.0 or newer.",properties:{intent:{type:"string",minLength:1,description:"The id of the decision record that says what the box is for (#2850), a record of a declared kind named decision. A new box starts as a question: the record is proposed with a null choice until the person who answers it decides it. The record constrains a member or path of this workspace, with member:<a member's name> or a path: entry at, above or inside a member's directory. It need not be this member: the intent can constrain the app the box runs when that app is another member (#2857). When it constrains this member, chant workspace graph --intent shows it for the box's files. Added by chant 0.94.0, so a declaration that uses it sets minReader to 0.94.0 or newer."},services:{type:"array",description:"The services the box runs under its supervisor, sprite-env on a sprite (#2880). Each name is given once, every needs entry names a service of this list, the needs form no cycle, and at most one service sets httpPort; a declaration that breaks one of these can't be read (declaration-invalid). The fly lexicon's spriteServicesObserve and spriteServiceRestart read the list with box: true, and spriteApplyServices with box: true creates and replaces the services through sprite-env. None when omitted. Added by chant 0.95.0, so a declaration that uses it sets minReader to 0.95.0 or newer.",items:{$ref:"#/$defs/boxService"}},factory:{$ref:"#/$defs/boxFactory"},listing:{$ref:"#/$defs/boxListing"},publisher:{type:"string",minLength:1,pattern:"\\S",description:"The command that publishes the box's work (#3165, ws-088): it applies a built work item to the box's checkout and, when factory.publish names a target, pushes it and opens the pull request, and it sends the records a person kept uncommitted. It is run from the workspace root by chant workspace box publish, split into words as a shell splits plain words (quotes group, a backslash escapes) but never given to a shell, with a JSON request on stdin; box-publish.schema.json says what it reads and prints. An orchestrator such as studio supplies it. chant workspace status --json prints it under the member's box, so a surface offers a publish only when a box names one. Added in schema 1 by chant 0.103.0, so a declaration that uses it sets minReader to 0.103.0 or newer."},replicate:{$ref:"#/$defs/boxReplicate"},ship:{$ref:"#/$defs/boxShip"},capabilities:{type:"array",description:"Each capability the box reaches outside itself, named once. None when omitted.",items:{$ref:"#/$defs/capability"}},host:{$ref:"#/$defs/name",description:"The host the box runs on, one of the top-level hosts (#2727). The box's name is the member's name."},slot:{type:"integer",minimum:0,description:"The box's number on its host (#2727). Its ports come from the slot's block of the host's range."},ports:{type:"object",description:"The ports the box listens on, each a name and its offset in the box's block (#2727). The port is the block's first port plus the offset.",propertyNames:{$ref:"#/$defs/kindName"},additionalProperties:{type:"integer",minimum:0,maximum:65534}},state:{type:"object",description:"State the box keeps outside its checkout, such as hud's identity and database, each a name and a path relative to the box's state directory (#2727). The name is usually the environment variable the runtime sets, such as HUD_IDENTITY_PATH. A path that is absolute, starts with ~ or an environment reference, or has a .. segment is a WSP124 finding.",propertyNames:{type:"string",pattern:"^[A-Za-z_][A-Za-z0-9_-]{0,63}$"},additionalProperties:{type:"string",minLength:1}},cookies:{type:"array",description:"Session cookie names the box's runtimes set, such as hud_session (#2727). A browser scopes a cookie to a host, not a port, so each resolves to <cookie>_<member name>.",uniqueItems:!0,items:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]{0,63}$"}}},dependentRequired:{host:["slot"],slot:["host"],ports:["host"],state:["host"],cookies:["host"]},patternProperties:{"^x-":!0},additionalProperties:!1},boxFactory:{type:"object",description:"What the box builds and how (#3146, ws-077), replacing studio's x-factory. Opt-in: a box block without it declares no factory, and nothing here is required of a workspace that doesn't build with agents (#3174). At most one box block in a declaration declares a factory. builds and builders name declared members, or the declaration can't be read (declaration-invalid). chant workspace status --json and chant workspace graph --json print it under the member's box. The factory need not build an app: builds may name any member kind, such as chant or terraform, and the check may be a plan, a lint or a conformance run. Added in schema 1 by chant 0.102.0, so a declaration that uses it sets minReader to 0.102.0 or newer.",required:["builds"],properties:{builds:{type:"array",minItems:1,uniqueItems:!0,description:"The members the factory builds, each a declared member of any kind. A work item a person asks for here constrains member:<the first>.",items:{$ref:"#/$defs/name"}},check:{description:"The command whose exit code is a build's verdict, run from the workspace root after the work item's own checks: a command, or { run, kind } saying what it is. kind is test when omitted.",oneOf:[{type:"string",minLength:1},{type:"object",required:["run"],properties:{run:{type:"string",minLength:1,description:"The command, run from the workspace root."},kind:{enum:["test","build","lint","plan","conformance"],description:"What the command is: an app's tests, a build, a lint, a lifecycle plan or a conformance run. test when omitted."}},patternProperties:{"^x-":!0},additionalProperties:!1}]},checks:{$ref:"#/$defs/path",description:"The directory, from the workspace root, where a work item's builder writes the check for its item. When omitted the orchestrator chooses, such as <the first member of builds>/checks."},builders:{$ref:"#/$defs/name",description:"The member that declares the builder agents, such as the one whose agents/ holds them. tiers says which of them builds at which tier (#3152)."},tiers:{type:"array",minItems:1,description:"Which builder agent builds at which tier (#3152, ws-094), replacing studio's studio/role and studio/tier Agent metadata. Each entry names a tier, in the vocabulary of the work kind's work.tier.tiers (#3147), and an agent the builders member declares, by its name. An entry with kinds builds only members of those kinds, so an infra builder and an app builder can share a tier; an entry without kinds builds the tier for every other kind. A tier has at most one entry without kinds and at most one per kind, tiers needs builders, and a session names a declared agent session, or the declaration can't be read (declaration-invalid). chant workspace status --json prints builderFor, the agent for each built member and tier. Added in schema 1 by chant 0.103.0, so a declaration that uses it sets minReader to 0.103.0 or newer.",items:{type:"object",required:["tier","agent"],properties:{tier:{$ref:"#/$defs/kindName",description:"The tier, such as small, medium or large: a word of the work kind's work.tier.tiers, which a work item's tier or the slice-tier decision point answers."},agent:{type:"string",minLength:1,pattern:"^[^\\u0000-\\u001f]+$",description:"The builder agent's name, as the builders member declares it (such as an Agent of the fountain lexicon in its agents/)."},kinds:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/$defs/kindName"},description:"The member kinds this agent builds at the tier, such as app or terraform. Without it, every kind no other entry of the tier names."},session:{$ref:"#/$defs/name",description:"The declared agent session (agents) the builder writes as, so its write scope is that session's. Optional: without it the orchestrator chooses."}},patternProperties:{"^x-":!0},additionalProperties:!1}},publish:{type:"object",description:"Where a finished build is published: its branch is pushed and a pull request opened against repo's base. The repo is the record, so an orchestrator reads this instead of being told the target in its environment.",required:["repo"],properties:{forge:{enum:["github"],description:"The forge repo is on. github when omitted."},repo:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9-]{0,38}/[A-Za-z0-9._-]{1,100}$",description:"The repository the pull request is opened on, as owner/name."},base:{type:"string",minLength:1,description:"The branch the pull request targets. The repository's default branch when omitted."},branchPrefix:{type:"string",minLength:1,pattern:"^[A-Za-z0-9._/-]+$",description:"What the published branch's name starts with; the work item's id follows, as in box/ and then box/work-012. chant/work/ when omitted, the work lease's own branch."},head:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9-]{0,38}/[A-Za-z0-9._-]{1,100}$",description:"The repository the branch is pushed to when it isn't repo, as owner/name: a fork, so the pull request comes from <head owner>:<branch>. A runtime that publishes for one contributor's fork supplies that per contributor instead (arugula-salad/studio#242); this names a fork the whole workspace publishes from."}},patternProperties:{"^x-":!0},additionalProperties:!1}},patternProperties:{"^x-":!0},additionalProperties:!1},boxListing:{type:"object",description:"What the box shows of itself on a home site that lists boxes (#3146, #3154): whether it is listed, its title and one line, and a cover image kept as a file in the repo. A box's listing is configuration, so changing it is a reviewed change (ws-074). chant workspace status --json and chant workspace graph --json print it under the member's box, with the cover's sha256. Added in schema 1 by chant 0.102.0, so a declaration that uses it sets minReader to 0.102.0 or newer.",properties:{published:{type:"boolean",description:"Whether the box is listed. true when omitted: a box is listed unless its owner takes it out."},title:{type:"string",maxLength:60,pattern:"^[^\\u0000-\\u001f\\u007f-\\u009f]*$",description:"The box's title, one line of at most 60 characters. Empty when omitted, and a reader then shows a name of its own."},line:{type:"string",maxLength:140,pattern:"^[^\\u0000-\\u001f\\u007f-\\u009f]*$",description:"One line saying what the box is, at most 140 characters. Empty when omitted."},cover:{$ref:"#/$defs/path",description:"A PNG, JPEG or WebP picture of the box, as a file from the workspace root. None when omitted."}},patternProperties:{"^x-":!0},additionalProperties:!1},boxReplicate:{type:"object",description:"Where the box's work in progress is replicated, so a box that is lost, reclaimed or corrupted before anyone commits loses nothing (#3172, ws-085). Work in progress is the work branches (chant/work/...), the kept attempts (refs/chant/kept/..., #3147), the snapshots chant workspace wip save takes of each branch's working tree, uncommitted records included (refs/chant/wip/<branch>), and the ledger branch, chant/lifecycle. chant pushes them to remote under their own names and never forces a push. Opt-in: a box block without it replicates nothing. At most one box block in a declaration declares one, or the declaration can't be read (declaration-invalid). chant workspace status --json prints it under the member's box, with every default filled in, and reports in replication how far each ref is from the remote. Added in schema 1 by chant 0.103.0, so a declaration that uses it sets minReader to 0.103.0 or newer.",properties:{remote:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",description:"The git remote to push to, by name: the repository's own remote, such as origin, or a mirror the host adds to the box's checkout with its credential, since a box holds none (#2726). origin when omitted."},refs:{type:"array",minItems:1,uniqueItems:!0,description:"What is replicated: work (the branches under chant/work/), kept (the kept attempts under refs/chant/kept/), wip (the snapshots under refs/chant/wip/) and ledger (the chant/lifecycle branch). All four when omitted.",items:{enum:["work","kept","wip","ledger"]}},on:{type:"array",uniqueItems:!0,description:"When chant pushes on its own: save, after each chant workspace wip save, and release, after a work lease is released (chant workspace work release, or a run of an Op under a work lease ending, which is when a kept attempt is written). Both when omitted; an empty list leaves every push to chant workspace wip push. A record write never pushes, because chant's record writes never run git (ws-074).",items:{enum:["save","release"]}},every:{type:"string",pattern:"^[1-9][0-9]*(s|m|h)$",description:"How often the host runs chant workspace wip push on a schedule of its own, such as 10m, beside the pushes on save and release. chant runs no scheduler; it only states the interval. None when omitted."}},patternProperties:{"^x-":!0},additionalProperties:!1},boxShip:{type:"object",description:"How the box ships its staged work to its own site (ws-100): the people working on a box see the working tree at once, everyone else sees the last release, and a person ships. op is the Op in the box member that does it: its own steps commit the staged tree as one commit by the person shipping (named to it in CHANT_SHIP_BY) with a Chant-Record trailer for each work item it lands, then release that commit to the box's site, stopping at gate, and record the release in env's release ledger. chant runs none of it; a surface runs chant run <op> in the member's directory and approves the gate as for any Op. chant workspace status --json prints it under the member's box with the commit the site serves (the latest release in env's ledger) and what is waiting to ship (the files changed between that commit and the working tree, bookkeeping left out). Added in schema 1 by chant 0.104.0, so a declaration that uses it sets minReader to 0.104.0 or newer.",required:["op"],properties:{op:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",description:"The name of the Op in the box member that ships, as chant run takes it."},gate:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",description:"The gate the Op stops at for a person's approval. ship when omitted."},env:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",description:"The environment whose release ledger, under the box member, the Op records each release in. box when omitted."},bookkeeping:{type:"array",uniqueItems:!0,description:"Path prefixes from the workspace root whose changes are bookkeeping, such as the record directories, and never count as waiting to ship. None when omitted.",items:{type:"string",minLength:1,pattern:"^(?!/)(?!.*(^|/)\\.\\.(/|$))[^\\n]+$"}}},patternProperties:{"^x-":!0},additionalProperties:!1},boxService:{type:"object",description:"A service a box runs under its supervisor (#2880).",required:["name","cmd"],properties:{name:{$ref:"#/$defs/kindName",description:"The service's name in the supervisor. Unique within the box."},cmd:{type:"string",minLength:1,description:"The command the supervisor runs (sprite-env services create --cmd). ${HOME} and other ${VAR} references are expanded from the environment of the process that applies the list, so the declaration holds no machine path."},needs:{type:"array",uniqueItems:!0,description:"Names of services of the same box that start before this one (sprite-env services create --needs).",items:{$ref:"#/$defs/kindName"}},httpPort:{$ref:"#/$defs/port",description:"The port the supervisor routes the sprite's URL to (sprite-env services create --http-port). At most one service of a box sets it."},duration:{type:"string",pattern:"^[0-9]+(\\.[0-9]+)?(ms|s|m)$",description:"How long the service must stay up after it is created or started, such as 3s (sprite-env services create --duration)."},health:{type:"string",pattern:"^https?://",description:"A URL that answers 200 while the service works. spriteServicesObserve probes it, and spriteServiceRestart waits for it after a restart. Without it, the supervisor's state decides."},optional:{type:"boolean",description:"True for a service something else creates by name, such as a site a release Op makes: spriteApplyServices creates it only when its only names it, and spriteServicesObserve skips it while the supervisor has no such service."}},patternProperties:{"^x-":!0},additionalProperties:!1},capability:{type:"object",description:"A capability a box needs and does not hold the credential for, such as inference, fountain or a third-party API (#2726).",required:["name"],properties:{name:{$ref:"#/$defs/kindName",description:"The capability, such as inference or fountain. Unique within the box."},broker:{type:"string",minLength:1,description:"What brokers the capability: the runtime that holds the credential and swaps the box's own token for it, such as lobby or door. It may name a member of this workspace, or a runtime outside it. Without it the capability is unbrokered, and chant workspace check fails with WSP122."},scope:{type:"array",uniqueItems:!0,description:"What of the box's own the broker lets it reach, which the broker enforces. For Fountain: agent (start conversations with its own agent), vault (attach its own vault), conversations and sandboxes (its own). The words are the broker's; chant records them.",items:{type:"string",minLength:1,pattern:"^[^\\u0000-\\u001f]+$"}}},patternProperties:{"^x-":!0},additionalProperties:!1},recordKind:{type:"object",description:"A record kind the workspace declares (#2680): a kind file that exports recordKind. chant workspace check fails (WSP115) when the file is missing or does not load as a record kind.",required:["kind"],properties:{kind:{$ref:"#/$defs/path",description:"The kind file, relative to the member's directory, or to the workspace root for the workspace's own records. A path is listed once across the declaration."},name:{$ref:"#/$defs/kindName",description:"The name readers show for the kind. Without it, the kind file's own recordKind.name. Unique across the declaration."}},patternProperties:{"^x-":!0},additionalProperties:!1},diagram:{type:"object",description:"A diagram artifact the workspace declares (#2764): a rendered image with a source, pinned to the renderer that made it. A mermaid or excalidraw diagram may name no render: a reader draws it from its source. chant never runs the renderer.",required:["name","title","renderer"],if:{type:"object",properties:{renderer:{type:"object",properties:{tool:{enum:["mermaid","excalidraw"]}},required:["tool"]}},required:["renderer"]},then:{type:"object",properties:{source:{$ref:"#/$defs/path"}},required:["source"]},else:{type:"object",properties:{render:{$ref:"#/$defs/path"}},required:["render"]},properties:{name:{$ref:"#/$defs/name",description:"Unique across the declaration."},title:{type:"string",minLength:1,description:"Shown above the diagram."},source:{oneOf:[{$ref:"#/$defs/path"},{type:"null"}],description:"The source file, from the workspace root, with / separators. Null for an SVG with no source. Default null."},render:{oneOf:[{$ref:"#/$defs/path"},{type:"null"}],description:"The rendered image, from the workspace root, with / separators. Required for d2 and graphviz. A mermaid or excalidraw diagram needs a source instead and may leave render out or null, from chant 0.96.0: a reader such as hud draws it from the source (an excalidraw diagram may still commit an exported SVG for docs)."},renderer:{$ref:"#/$defs/diagramRenderer"},sourceHash:{type:["string","null"],pattern:"^[0-9a-f]{64}$",description:"sha256 hex of the source's bytes when render was last produced from it, or for a mermaid or excalidraw diagram without a render, when the source was last pinned. chant workspace check compares this against the source in the tree read and reports drift (WSP133) on a mismatch; without it, or without a source, the render is never checked for drift. Default null."}},patternProperties:{"^x-":!0},additionalProperties:!1},diagramRenderer:{type:"object",description:"The renderer a diagram's render was made with. chant records the pin; it never installs or runs the renderer (ws-052).",required:["tool","version"],properties:{tool:{enum:["d2","mermaid","graphviz","excalidraw"]},version:{$ref:"#/$defs/version",description:"The exact release the render was made with, such as 0.9.0. For mermaid or excalidraw, the release of the library a reader draws the source with, such as 11.4.1."},args:{type:"array",description:'Passed before the input and output paths, in order, such as ["--layout=elk", "--theme=0", "--pad=40", "--omit-version"]. Empty when absent.',items:{type:"string"}}},patternProperties:{"^x-":!0},additionalProperties:!1},generatedFile:{type:"object",description:"One generated file of a member (#2524 D14, #2541).",required:["path","generator"],properties:{path:{$ref:"#/$defs/path",description:"The file, relative to the member's directory."},generator:{type:"string",minLength:1,description:"The command line that writes the file, run in the member's directory with the member's own node_modules/.bin first on PATH, such as chant build ci --lexicon github -o ci.yml. When it passes -o or --output with this file's path, chant workspace check --generated points that flag at a temporary file. Otherwise the generator writes in place and check restores the tree afterwards."},sources:{type:"array",description:"The files or directories the generator reads, relative to the workspace root, since a generator often reads other members.",items:{$ref:"#/$defs/path"}},handWritten:{type:"object",description:"The file is kept by hand instead of regenerated. chant workspace check reports it with the reason and never runs its generator, and the lock classes it owned.",required:["because"],properties:{because:{type:"string",minLength:1}},patternProperties:{"^x-":!0},additionalProperties:!1}},patternProperties:{"^x-":!0},additionalProperties:!1},pin:{description:"An npm package at an exact version, or a local plugin by path. integrity is a Subresource Integrity digest.",oneOf:[{type:"object",required:["package","version"],properties:{package:{type:"string",pattern:"^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$"},version:{$ref:"#/$defs/version"},integrity:{type:"string",pattern:"^sha(256|384|512)-[A-Za-z0-9+/]+={0,2}$"}},patternProperties:{"^x-":!0},additionalProperties:!1},{type:"object",required:["path"],properties:{path:{$ref:"#/$defs/dir"},integrity:{type:"string",pattern:"^sha(256|384|512)-[A-Za-z0-9+/]+={0,2}$"}},patternProperties:{"^x-":!0},additionalProperties:!1}]},host:{type:"object",description:"A host boxes run on (#2727).",required:["name","ports"],properties:{name:{$ref:"#/$defs/name",description:"The host's name, unique among hosts. A box block names it in host."},ports:{type:"object",description:"The TCP ports boxes on this host take theirs from. Slot n owns the block from + n * perBox to from + (n + 1) * perBox - 1, which must end at or before to.",required:["from","to","perBox"],properties:{from:{$ref:"#/$defs/port",description:"The first port of the range."},to:{$ref:"#/$defs/port",description:"The last port of the range, inclusive."},perBox:{type:"integer",minimum:1,maximum:65535,description:"How many ports each box's block holds. A box's port offsets are below it."}},additionalProperties:!1},stateRoot:{type:"string",minLength:1,description:"Where boxes on this host keep state, as an environment reference such as ${XDG_STATE_HOME}/chant/boxes, which the runtime expands on the machine. A box's state directory is <stateRoot>/<member name>. A literal machine path, such as /Users/... or anything under $HOME, is a WSP124 finding. Default ${XDG_STATE_HOME}/chant/boxes."}},patternProperties:{"^x-":!0},additionalProperties:!1},port:{type:"integer",minimum:1,maximum:65535},fileGlob:{type:"string",description:"A glob over file paths, relative to the workspace root: * and ? within one segment, ** across segments, [...] classes and {a,b} alternatives. No leading /, no . or .. segments.",pattern:"^(?!\\.\\.?(/|$))[^/\\\\]+(/(?!\\.\\.?(/|$))[^/\\\\]+)*$"},recordScope:{type:"object",description:"Record kind names, as the kind file's recordKind.name or the name the declaration gives it, each with the verbs the class may write it with: new, amend, review and close (a review session). A kind left out may not be written at all. A record file a commit deletes is never in scope.",propertyNames:{$ref:"#/$defs/kindName"},additionalProperties:{type:"array",uniqueItems:!0,items:{enum:["new","amend","review","close"]}}},protectedPath:{description:"A protected path: a glob from the workspace root, or { path, except } for a JSON file whose listed top-level keys, or the values JSON Pointers name, may still change.",oneOf:[{$ref:"#/$defs/fileGlob"},{type:"object",required:["path"],properties:{path:{$ref:"#/$defs/fileGlob"},except:{type:"array",minItems:1,uniqueItems:!0,description:"What a write may change in the JSON file: a top-level key, or, for an entry starting with /, the values a JSON Pointer matches, where a * token matches every key or array index at its level, such as /members/*/box/listing for every box's listing (#3308). A change anywhere else in the file, or to a file that doesn't parse as a JSON object before and after, is still outside the scope.",items:{type:"string",minLength:1}}},patternProperties:{"^x-":!0},additionalProperties:!1}]},classScope:{type:"object",description:"A principal class's write scope.",properties:{members:{description:"The members whose files the class may write, by name, or * for every path. Without it, every path. A path in no member is in scope only under *.",oneOf:[{const:"*"},{type:"array",uniqueItems:!0,items:{$ref:"#/$defs/name"}}]},protected:{type:"array",description:"Paths the class may not write, even inside a member it may (#3146, ws-077): each a glob from the workspace root, or { path, except } for a JSON file the class may change only in the top-level keys except names. An entry protects the files it matches and everything under a directory it matches. A record file is judged by records, not here. Added in schema 1 by chant 0.102.0, so a declaration that uses it sets minReader to 0.102.0 or newer.",items:{$ref:"#/$defs/protectedPath"}},records:{$ref:"#/$defs/recordScope",description:"The record kinds the class may write, and how. Without it, every kind in reach, with every verb. A kind a member declares is in reach when that member is; the workspace's own kinds always are."}},patternProperties:{"^x-":!0},additionalProperties:!1},agentScope:{type:"object",description:"The agent class's write scope. Its members are always the members its session is bound to, so only the record kinds and the protected paths can be set.",properties:{protected:{type:"array",description:"Paths the class may not write, even inside a member it may (#3146, ws-077): each a glob from the workspace root, or { path, except } for a JSON file the class may change only in the top-level keys except names. An entry protects the files it matches and everything under a directory it matches. A record file is judged by records, not here. Added in schema 1 by chant 0.102.0, so a declaration that uses it sets minReader to 0.102.0 or newer.",items:{$ref:"#/$defs/protectedPath"}},records:{$ref:"#/$defs/recordScope",description:"The record kinds an agent may write, and how. Without it, every kind in reach of its member, with every verb."}},patternProperties:{"^x-":!0},additionalProperties:!1},agent:{type:"object",description:"An agent session (#2548). It names its members with exactly one of member and members (ws-101).",required:["name"],oneOf:[{properties:{member:!0},required:["member"]},{properties:{members:!0},required:["members"]}],properties:{name:{$ref:"#/$defs/name",description:"The session's name, unique among agents: what CHANT_AGENT and a Chant-Agent trailer give."},member:{$ref:"#/$defs/name",description:"The one member the session is bound to. It must be a declared member, not an example group. A session bound to several names them with members instead."},members:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/$defs/name"},description:"The members the session is bound to, when it writes in more than one, such as a factory that builds an app and writes its evidence records in a design member (ws-101, arugula-salad/studio#402). Each must be a declared member, not an example group. The session may write the files of any of them and the records of kinds any of them or the workspace declares, and the write scope is judged against all of them together. Added in schema 1 by chant 0.105.0, so a declaration that uses it sets minReader to 0.105.0 or newer."},principals:{type:"array",uniqueItems:!0,items:{type:"string",minLength:1},description:"Principals that write only as this session: a commit attested by one, or a write whose by names one, is judged as the session. A principal is listed by one session at most."}},patternProperties:{"^x-":!0},additionalProperties:!1},ciGreen:{type:"object",description:"Which commits passed CI (#3573, ws-103). chant ci tick tags each first-parent commit of branch, within window, whose required phases all passed with ci/green/<sha>, and a green commit that later fails a required phase with ci/revoked/<sha>. Both are annotated tags made once and never moved or deleted by chant. chant ci last-green prints the newest commit with a green tag and no revoked tag.",required:["branch","phases","require"],properties:{branch:{type:"string",minLength:1,pattern:"^[^\\s~^:?*\\[\\\\]+$",description:"The branch whose commits are tagged, such as main. Only its first-parent commits count."},window:{type:"string",pattern:"^[1-9][0-9]*(m|h|d)$",description:"How far back a tick looks, by committer time, such as 24h, 90m or 7d. 24h when absent."},phases:{type:"object",minProperties:1,description:"The phases, by name. Each is a list of check-run name patterns, or { runs, skipped }. A pattern matches a check run's whole name, with * standing for any run of characters. A phase passes when every check run its patterns match finished with success, judged by each run's latest attempt.",propertyNames:{$ref:"#/$defs/ciPhaseName"},additionalProperties:{$ref:"#/$defs/ciPhase"}},require:{type:"array",minItems:1,uniqueItems:!0,description:"The phases a commit must pass to be tagged green, by name. Each must be a declared phase.",items:{$ref:"#/$defs/ciPhaseName"}},preMerge:{type:"array",uniqueItems:!0,description:"The phases that must pass before the branch moves (#4168 4.4), by name: the quick checks a pull request's checks, a merge queue, chant ci serve landing a branch, or chant ci run --local give before a change lands. Each must be a declared phase. The trunk-curated workflow needs at least one. Added in schema 1 by chant 0.124.34, so a declaration that uses it sets minReader to 0.124.34 or newer.",items:{$ref:"#/$defs/ciPhaseName"}},signedSince:{type:"string",pattern:"^[0-9a-f]{40}([0-9a-f]{24})?$",description:"Added by #4031, read by chant 0.124.28 and newer. The full sha of the first commit on branch whose ci/green and ci/revoked tags must carry a DSSE statement in their annotation, signed by a key .chant/trust.json at base lists under runners for a principal holding the runner role. A tag on a strict first-parent ancestor of this commit counts unsigned, so existing tags keep working; a tag on any other commit, this one included, needs a statement. Position in history decides, never a date, which whoever makes a commit or a tag sets. A reader refuses a sha that names no commit in its clone with declaration-invalid. Absent, no tag needs a statement. Since chant 0.124.32 (#4156) it covers Op run records the same way, when ci.green.source is runs: an unsigned run counts on a strict first-parent ancestor of this commit and needs a statement on any other, ci serve refuses to start without a runner key trusted at the target's head, and ci run and chant run warn about a run they leave unsigned. Absent, an unsigned run counts and nothing asks for a key."},source:{enum:["checks","runs"],description:"Added by #4044, read by chant 0.124.28 and newer, so a declaration that sets it sets minReader to 0.124.28 or newer. Where chant ci tick reads each phase's results. checks (the default): the forge's check runs, whose names the phases' patterns match. runs: chant's own Op runs, read from the run ledger on chant/lifecycle, for a project whose pipelines run as chant Ops, such as one on GitLab or Forgejo. A phase's patterns then match Op names, a run counts for the commit its record names as gitSha, and the latest run of each Op decides. A run counts only when its record carries a statement signed by a key .chant/trust.json at base lists under runners for a principal holding the runner role; the tick ignores and reports any other. A tick from runs signs every tag it makes, so it needs a runner key."}},patternProperties:{"^x-":!0},additionalProperties:!1},ciWorkflow:{enum:["trunk-curated","trunk-curated+apply-on-merge"],description:"A prescribed delivery workflow (#4168). trunk-curated: a merge records the plan and deploys nothing; releases are cut from green commits and promoted through each member's environments, gated in the last. trunk-curated+apply-on-merge: the same, with the apply on merge turned back on. chant workspace check reports what a member under one still lacks (WSP151), and chant ci init writes it. At the top level for every member, or on a member, which wins. Added in schema 1 by chant 0.124.34, so a declaration that uses it sets minReader to 0.124.34 or newer."},ciPhaseName:{type:"string",pattern:"^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$"},ciPhase:{oneOf:[{$ref:"#/$defs/ciRunPatterns"},{type:"object",required:["runs"],properties:{runs:{$ref:"#/$defs/ciRunPatterns"},skipped:{enum:["pass","fail"],description:"What a check run that finished as skipped counts as. fail (the default): it never passes. pass: it passes, for a job a path filter runs only on some commits."},build:{enum:["every","newest"],description:"Added by #4169, read by chant 0.124.33 and newer. Which first-parent commits of the branch the phase runs on. every (the default): each one. newest: only the newest commit when a runner frees. Under either, a run that was cancelled leaves the commit unbuilt rather than red. Under newest, a commit a newer run superseded is unbuilt too, and a red commit starts a bisect over the unbuilt commits back to the last one the phase passed on. chant ci workflow writes the triggers and concurrency of the workflows holding a phase that sets build, and leaves them alone for a phase that does not."}},patternProperties:{"^x-":!0},additionalProperties:!1}]},ciRunPatterns:{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",minLength:1,description:"A check run's name, such as lint, or a pattern with *, such as e2e (*)."}}}}});var Z_={};_e(Z_,{gitTop:()=>vs,gitTree:()=>ld,joinPath:()=>qe,resolveCommit:()=>J_,skippedDir:()=>Bi,workingTree:()=>Sn});import{execFileSync as KV}from"node:child_process";import{readdirSync as lue,readFileSync as HV,statSync as qV}from"node:fs";import{join as Rm}from"node:path";function qe(...e){return e.filter(t=>t!==""&&t!==".").join("/")}function Sn(e){return{label:"",stat(t){try{let n=qV(Rm(e,t));return n.isDirectory()?"dir":n.isFile()?"file":void 0}catch{return}},list(t){let n;try{n=lue(Rm(e,t),{withFileTypes:!0})}catch{return}let i=[];for(let r of n){let o=r.isDirectory()?"dir":r.isFile()?"file":void 0;if(!o&&r.isSymbolicLink())try{let s=qV(Rm(e,t,r.name));o=s.isDirectory()?"dir":s.isFile()?"file":void 0}catch{}o&&i.push({name:r.name,type:o})}return i},read(t){return HV(Rm(e,t),"utf-8")},bytes(t){return HV(Rm(e,t))}}}function Av(e,t){return KV("git",t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","pipe"],maxBuffer:512*1024*1024})}function vs(e){try{return Av(e,["rev-parse","--show-toplevel"]).trim()}catch{return}}function J_(e,t){if(!t.startsWith("-"))try{return Av(e,["rev-parse","--verify","--quiet",`${t}^{commit}`]).trim()}catch{return}}function ld(e,t,n=""){let i=new Map([["","dir"]]),r=new Map([["",[]]]),o=Av(e,["ls-tree","-r","-t","-z","--full-tree",t]);for(let s of o.split("\0")){if(!s)continue;let a=s.indexOf(" "),c=s.slice(0,a).split(" ")[1],l=s.slice(a+1),u;if(n==="")u=l;else if(l.startsWith(`${n}/`))u=l.slice(n.length+1);else continue;let d=c==="tree"?"dir":c==="blob"?"file":void 0;if(!d)continue;i.set(u,d);let p=u.lastIndexOf("/"),f=p<0?"":u.slice(0,p);r.has(f)||r.set(f,[]),r.get(f).push({name:u.slice(p+1),type:d}),d==="dir"&&!r.has(u)&&r.set(u,[])}return{label:` at ${t.slice(0,8)}`,stat:s=>i.get(s),list:s=>i.get(s)==="dir"?[...r.get(s)??[]]:void 0,read(s){if(i.get(s)!=="file")throw new Error(`${s} is not a file${` at ${t.slice(0,8)}`}`);return Av(e,["cat-file","blob",`${t}:${qe(n,s)}`])},bytes(s){if(i.get(s)!=="file")throw new Error(`${s} is not a file${` at ${t.slice(0,8)}`}`);return KV("git",["cat-file","blob",`${t}:${qe(n,s)}`],{cwd:e,stdio:["ignore","pipe","pipe"],maxBuffer:512*1024*1024})}}}function Bi(e){return e==="node_modules"||e.startsWith(".")}var on=v(()=>{"use strict"});function ZV(e,t){let i=t.split("/").map(a=>a==="**"?"**":uue(a)?a:(0,JV.default)(a,{dot:!1})),r=new Set,o=a=>(e.list(a)??[]).filter(c=>c.type==="dir"&&!Bi(c.name)).map(c=>c.name),s=(a,c)=>{if(c===i.length){a!==""&&r.add(a);return}let l=i[c];if(l==="**"){s(a,c+1);for(let u of o(a))s(qe(a,u),c);return}if(typeof l=="string"){let u=qe(a,l);e.stat(u)==="dir"&&s(u,c+1);return}for(let u of o(a))l(u)&&s(qe(a,u),c+1)};return s("",0),[...r].sort()}var JV,uue,YV=v(()=>{"use strict";JV=Ye($m(),1);on();uue=e=>!/[*?[\]{}()!+@]/.test(e)});var Y_,XV=v(()=>{Y_={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://intentius.io/chant/schemas/workspace/kinds/v1/workspace-kinds.schema.json",title:"workspace-kinds.json",description:"Member kinds a plugin supplies (#2524 D3, #2535, ws-031). A package publishes this file as data at its ./workspace-kinds subpath. chant reads it with the file system and never imports the package, so reading kinds never loads a lexicon.",type:"object",required:["schema","kinds"],properties:{$schema:{type:"string",description:"An editor hint. chant ignores it."},$comment:{type:"string",description:"A note for people. chant ignores it."},schema:{const:1,description:"The kinds format version."},kinds:{type:"array",minItems:1,items:{$ref:"#/$defs/kind"}}},patternProperties:{"^x-":!0},additionalProperties:!1,$defs:{kind:{type:"object",required:["name","description","precedence","probe"],properties:{name:{type:"string",pattern:"^[a-z][a-z0-9-]{0,39}$",description:"The kind's name, as a member's kind field names it. chant, workspace, other and examples are built in and can't be supplied."},description:{type:"string",minLength:1,description:"One line saying what the member's directory holds, for listings and error messages."},precedence:{type:"integer",minimum:1,maximum:999,description:"When the probes of several kinds claim one directory, the highest precedence decides. Two claiming kinds with the same highest precedence are a tie, and a tie fails. The built-in chant kind has 500 and workspace has 1000."},probe:{$ref:"#/$defs/probe"},outputs:{type:"array",uniqueItems:!0,description:"The outputs every member of this kind exposes as link targets (#2524 D6, #2539). A member entry of the kind may list more in its own outputs field. Without this field the kind exposes only what each entry lists.",items:{type:"string",minLength:1,maxLength:255,pattern:"^[^\\u0000-\\u001f]+$"}},graph:{$ref:"#/$defs/graph"},fields:{$ref:"#/$defs/fields"},reader:{type:"string",pattern:"^[a-z][a-z0-9-]{0,39}$",description:"A link reader chant ships, by name, that derives a member's links from the member's own files (#3932): dbt-project reads a dbt project's sources. The reader is chant's code and runs offline, parsing files as data; the package supplies only the name. A name this chant doesn't have keeps the kind without a reader, and the load reports it. A chant older than this field fails a kinds file that uses it."}},patternProperties:{"^x-":!0},additionalProperties:!1},probe:{type:"object",description:"What the probe checks in a member's directory. It runs no code. It passes when any of its clauses does, and it needs at least one.",minProperties:1,properties:{anyFile:{type:"array",minItems:1,uniqueItems:!0,description:"The directory passes when a file matching one of these names sits directly in it. A * in a name matches any run of characters, so *.tf matches every Terraform file.",items:{$ref:"#/$defs/fileName"}},anyBlock:{type:"object",description:"The directory passes when a file directly in it, whose name matches one of in, has a line opening an unlabelled block named in blocks: leading space, the name, optional space, then {. No file is parsed.",required:["in","blocks"],properties:{in:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/$defs/fileName"}},blocks:{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",pattern:"^[A-Za-z_][A-Za-z0-9_-]{0,63}$"}}},additionalProperties:!1},anyJsonKey:{type:"object",description:"The directory passes when a file directly in it, whose name matches one of in, parses as JSON and has a value at one of pointers, each a JSON Pointer such as /scripts/start (#3151). A file that is not JSON is no evidence either way. Added by chant 0.103.0.",required:["in","pointers"],properties:{in:{type:"array",minItems:1,uniqueItems:!0,items:{$ref:"#/$defs/fileName"}},pointers:{type:"array",minItems:1,uniqueItems:!0,items:{type:"string",pattern:"^(/[^/]+)+$"}}},additionalProperties:!1}},additionalProperties:!1},fileName:{type:"string",description:"A file name, with no directory part. A * matches any run of characters.",pattern:"^(?!\\.\\.?$)[^/\\\\]+$"},graph:{type:"object",description:"How chant workspace graph reads a member of this kind (#2874). chant writes a reader project of its own outside the workspace, with a chant.config.json that declares lexicon and puts config under that lexicon's key, and runs the member's chant graph there. In every string key and value of config, {member} becomes the member's name, {dir} its absolute directory and {workspace} the absolute workspace root. Without this field a member of the kind is listed with kind-not-run.",required:["lexicon","config"],properties:{lexicon:{type:"string",pattern:"^[a-z][a-z0-9-]{0,39}$",description:"The lexicon that reads the member, by name. The package that supplies the kind must be @intentius/chant-lexicon-<lexicon>, so the lexicon chant loads is the one the declaration pins."},config:{type:"object",description:"The lexicon's config namespace for the reader project, such as terraform's roots. Placeholders are substituted; nothing else is interpreted."}},patternProperties:{"^x-":!0},additionalProperties:!1},fields:{type:"object",description:"The fields a member entry of this kind may set under its own fields block, each with a type and, optionally, a default (#3151). chant workspace check fails a member whose fields name one the kind doesn't declare or give a value of the wrong type (WSP005), and chant workspace status --json prints every declared field with the defaults filled in. Added by chant 0.103.0; an older chant can't read a kinds file that uses it.",minProperties:1,propertyNames:{$ref:"#/$defs/fieldName"},additionalProperties:{oneOf:[{$ref:"#/$defs/scalarField"},{$ref:"#/$defs/objectField"}]}},fieldName:{type:"string",pattern:"^[a-z][A-Za-z0-9]{0,39}$"},scalarField:{type:"object",required:["type","description"],properties:{type:{enum:["string","integer","boolean"]},description:{type:"string",minLength:1},default:{oneOf:[{type:"string"},{type:"integer"},{type:"boolean"}],description:"The value a member that doesn't set the field gets. Its type is the field's. Without it the field reads as null when unset."},pattern:{type:"string",minLength:1,description:"For a string field: a regular expression the value must match."}},additionalProperties:!1},objectField:{type:"object",required:["type","description","properties"],properties:{type:{const:"object"},description:{type:"string",minLength:1},properties:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/fieldName"},additionalProperties:{$ref:"#/$defs/scalarField"},description:"The object's own fields, each a string, integer or boolean field. A member sets any of them; the rest take their defaults."}},additionalProperties:!1}}}});function QV(e){return e===Pv||e.endsWith(`/${Pv}`)}var Pv,hBe,X_=v(()=>{"use strict";Pv=".chant/work",hBe=`/${Pv}/`});import{createHash as Q_}from"node:crypto";import{lstatSync as pue,readdirSync as fue,readFileSync as eH}from"node:fs";import{join as tH}from"node:path";function gue(e){let t=mue.exec(e);return t?{algorithm:t[1],digest:t[2]}:void 0}function nH(e,t,n){for(let i of fue(e,{withFileTypes:!0})){let r=t===""?i.name:`${t}/${i.name}`;if(i.isSymbolicLink())throw new ud(`${r} is a symbolic link, which a pinned plugin may not contain`);i.isDirectory()?!hue.has(i.name)&&!QV(r)&&nH(tH(e,i.name),r,n):i.isFile()&&n.push(r)}}function yue(e){let t=[];return nH(e,"",t),t.sort((n,i)=>n<i?-1:n>i?1:0)}function wue(e,t="sha256"){let n;try{n=pue(e)}catch{throw new ud("it does not exist")}if(n.isSymbolicLink())throw new ud("it is a symbolic link, which a pinned plugin may not be");if(n.isFile())return{integrity:`${t}-${Q_(t).update(eH(e)).digest("base64")}`,files:1};let i=yue(e),r=i.map(o=>`${Q_(t).update(eH(tH(e,...o.split("/")))).digest("hex")} ${o}
@@ -71,7 +71,7 @@ ${e.timestamp}`,"utf-8")}function Rue(e,t,n){let i=`the approval of gate ${n.gat
71
71
  depsCount: ${t},
72
72
  deps: ${n}}`};var uge={keyword:"dependencies",type:"object",schemaType:"object",error:To.error,code(e){let[t,n]=dge(e);oK(e,t),sK(e,n)}};function dge({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 oK(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,sg.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,sg.checkReportMissingProp)(e,l)}):(n.if((0,_T._)`${c} && (${(0,sg.checkMissingProp)(e,a,o)})`),(0,sg.reportMissingProp)(e,o),n.else())}}To.validatePropertyDeps=oK;function sK(e,t=e.schema){let{gen:n,data:i,keyword:r,it:o}=e,s=n.name("valid");for(let a in t)(0,lge.alwaysValidSchema)(o,t[a])||(n.if((0,sg.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))}To.validateSchemaDeps=sK;To.default=uge});var cK=ae(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});var aK=tt(),pge=ft(),fge={message:"property name must be valid",params:({params:e})=>(0,aK._)`{propertyName: ${e.propertyName}}`},mge={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:fge,code(e){let{gen:t,schema:n,data:i,it:r}=e;if((0,pge.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,aK.not)(o),()=>{e.error(!0),r.allErrors||t.break()})}),e.ok(o)}};TT.default=mge});var DT=ae(IT=>{"use strict";Object.defineProperty(IT,"__esModule",{value:!0});var lk=mi(),Hi=tt(),gge=fi(),uk=ft(),hge={message:"must NOT have additional properties",params:({params:e})=>(0,Hi._)`{additionalProperty: ${e.additionalProperty}}`},yge={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:hge,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,uk.alwaysValidSchema)(s,n))return;let l=(0,lk.allSchemaProperties)(i.properties),u=(0,lk.allSchemaProperties)(i.patternProperties);d(),e.ok((0,Hi._)`${o} === ${gge.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,uk.schemaRefOrVal)(s,i.properties,"properties");b=(0,lk.isOwnProperty)(t,k,w)}else l.length?b=(0,Hi.or)(...l.map(k=>(0,Hi._)`${w} === ${k}`)):b=Hi.nil;return u.length&&(b=(0,Hi.or)(b,...u.map(k=>(0,Hi._)`${(0,lk.usePattern)(e,k)}.test(${w})`))),(0,Hi.not)(b)}function f(w){t.code((0,Hi._)`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,uk.alwaysValidSchema)(s,n)){let b=t.name("valid");c.removeAdditional==="failing"?(h(w,b,!1),t.if((0,Hi.not)(b),()=>{e.reset(),f(w)})):(h(w,b),a||t.if((0,Hi.not)(b),()=>t.break()))}}function h(w,b,k){let $={keyword:"additionalProperties",dataProp:w,dataPropType:uk.Type.Str};k===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema($,b)}}};IT.default=yge});var dK=ae(NT=>{"use strict";Object.defineProperty(NT,"__esModule",{value:!0});var wge=kd(),lK=mi(),jT=ft(),uK=DT(),bge={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 wge.KeywordCxt(o,uK.default,"additionalProperties"));let s=(0,lK.allSchemaProperties)(n);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=jT.mergeEvaluated.props(t,(0,jT.toHash)(s),o.props));let a=s.filter(d=>!(0,jT.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,lK.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)}}};NT.default=bge});var gK=ae(LT=>{"use strict";Object.defineProperty(LT,"__esModule",{value:!0});var pK=mi(),dk=tt(),fK=ft(),mK=ft(),vge={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,pK.allSchemaProperties)(n),c=a.filter(h=>(0,fK.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 dk.Name)&&(o.props=(0,mK.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,fK.checkStrictMode)(o,`property ${w} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",i,w=>{t.if((0,dk._)`${(0,pK.usePattern)(e,h)}.test(${w})`,()=>{let b=c.includes(h);b||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:w,dataPropType:mK.Type.Str},u),o.opts.unevaluated&&d!==!0?t.assign((0,dk._)`${d}[${w}]`,!0):!b&&!o.allErrors&&t.if((0,dk.not)(u),()=>t.break())})})}}};LT.default=vge});var hK=ae(MT=>{"use strict";Object.defineProperty(MT,"__esModule",{value:!0});var kge=ft(),xge={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:i}=e;if((0,kge.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"}};MT.default=xge});var yK=ae(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0});var $ge=mi(),Rge={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:$ge.validateUnion,error:{message:"must match a schema in anyOf"}};FT.default=Rge});var wK=ae(GT=>{"use strict";Object.defineProperty(GT,"__esModule",{value:!0});var pk=tt(),Sge=ft(),Ege={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,pk._)`{passingSchemas: ${e.passing}}`},Oge={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Ege,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,Sge.alwaysValidSchema)(r,u)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,pk._)`${c} && ${s}`).assign(s,!1).assign(a,(0,pk._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,d),p&&e.mergeEvaluated(p,pk.Name)})})}}};GT.default=Oge});var bK=ae(WT=>{"use strict";Object.defineProperty(WT,"__esModule",{value:!0});var Age=ft(),Pge={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,Age.alwaysValidSchema)(i,o))return;let a=e.subschema({keyword:"allOf",schemaProp:s},r);e.ok(r),e.mergeEvaluated(a)})}};WT.default=Pge});var xK=ae(BT=>{"use strict";Object.defineProperty(BT,"__esModule",{value:!0});var fk=tt(),kK=ft(),Cge={message:({params:e})=>(0,fk.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,fk._)`{failingKeyword: ${e.ifClause}}`},_ge={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Cge,code(e){let{gen:t,parentSchema:n,it:i}=e;n.then===void 0&&n.else===void 0&&(0,kK.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let r=vK(i,"then"),o=vK(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,fk.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,fk._)`${u}`):e.setParams({ifClause:u})}}}};function vK(e,t){let n=e.schema[t];return n!==void 0&&!(0,kK.alwaysValidSchema)(e,n)}BT.default=_ge});var $K=ae(zT=>{"use strict";Object.defineProperty(zT,"__esModule",{value:!0});var Tge=ft(),Ige={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,Tge.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};zT.default=Ige});var VT=ae(UT=>{"use strict";Object.defineProperty(UT,"__esModule",{value:!0});var Dge=ET(),jge=tK(),Nge=OT(),Lge=rK(),Mge=iK(),Fge=ck(),Gge=cK(),Wge=DT(),Bge=dK(),zge=gK(),Uge=hK(),Vge=yK(),Hge=wK(),qge=bK(),Kge=xK(),Jge=$K();function Zge(e=!1){let t=[Uge.default,Vge.default,Hge.default,qge.default,Kge.default,Jge.default,Gge.default,Wge.default,Fge.default,Bge.default,zge.default];return e?t.push(jge.default,Lge.default):t.push(Dge.default,Nge.default),t.push(Mge.default),t}UT.default=Zge});var qT=ae(ag=>{"use strict";Object.defineProperty(ag,"__esModule",{value:!0});ag.dynamicAnchor=void 0;var HT=tt(),Yge=fi(),RK=qm(),Xge=nk(),Qge={keyword:"$dynamicAnchor",schemaType:"string",code:e=>SK(e,e.schema)};function SK(e,t){let{gen:n,it:i}=e;i.schemaEnv.root.dynamicAnchors[t]=!0;let r=(0,HT._)`${Yge.default.dynamicAnchors}${(0,HT.getProperty)(t)}`,o=i.errSchemaPath==="#"?i.validateName:ehe(e);n.if((0,HT._)`!${r}`,()=>n.assign(r,o))}ag.dynamicAnchor=SK;function ehe(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 RK.SchemaEnv({schema:n,schemaId:c,root:r,baseId:o,localRefs:s,meta:a});return RK.compileSchema.call(i,l),(0,Xge.getValidate)(e,l)}ag.default=Qge});var KT=ae(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});cg.dynamicRef=void 0;var EK=tt(),the=fi(),OK=nk(),nhe={keyword:"$dynamicRef",schemaType:"string",code:e=>AK(e,e.schema)};function AK(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,EK._)`${the.default.dynamicAnchors}${(0,EK.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,OK.callRef)(e,c),n.let(l,!0)}):()=>(0,OK.callRef)(e,c)}}cg.dynamicRef=AK;cg.default=nhe});var PK=ae(JT=>{"use strict";Object.defineProperty(JT,"__esModule",{value:!0});var rhe=qT(),ihe=ft(),ohe={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,rhe.dynamicAnchor)(e,""):(0,ihe.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};JT.default=ohe});var CK=ae(ZT=>{"use strict";Object.defineProperty(ZT,"__esModule",{value:!0});var she=KT(),ahe={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,she.dynamicRef)(e,e.schema)};ZT.default=ahe});var _K=ae(YT=>{"use strict";Object.defineProperty(YT,"__esModule",{value:!0});var che=qT(),lhe=KT(),uhe=PK(),dhe=CK(),phe=[che.default,lhe.default,uhe.default,dhe.default];YT.default=phe});var IK=ae(XT=>{"use strict";Object.defineProperty(XT,"__esModule",{value:!0});var TK=ck(),fhe={keyword:"dependentRequired",type:"object",schemaType:"object",error:TK.error,code:e=>(0,TK.validatePropertyDeps)(e)};XT.default=fhe});var DK=ae(QT=>{"use strict";Object.defineProperty(QT,"__esModule",{value:!0});var mhe=ck(),ghe={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,mhe.validateSchemaDeps)(e)};QT.default=ghe});var jK=ae(eI=>{"use strict";Object.defineProperty(eI,"__esModule",{value:!0});var hhe=ft(),yhe={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){t.contains===void 0&&(0,hhe.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};eI.default=yhe});var NK=ae(tI=>{"use strict";Object.defineProperty(tI,"__esModule",{value:!0});var whe=IK(),bhe=DK(),vhe=jK(),khe=[whe.default,bhe.default,vhe.default];tI.default=khe});var MK=ae(nI=>{"use strict";Object.defineProperty(nI,"__esModule",{value:!0});var Aa=tt(),LK=ft(),xhe=fi(),$he={message:"must NOT have unevaluated properties",params:({params:e})=>(0,Aa._)`{unevaluatedProperty: ${e.unevaluatedProperty}}`},Rhe={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:$he,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 Aa.Name?t.if((0,Aa._)`${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,Aa._)`${r} === ${xhe.default.errors}`);function c(d){if(n===!1){e.setParams({unevaluatedProperty:d}),e.error(),s||t.break();return}if(!(0,LK.alwaysValidSchema)(o,n)){let p=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:LK.Type.Str},p),s||t.if((0,Aa.not)(p),()=>t.break())}}function l(d,p){return(0,Aa._)`!${d} || !${d}[${p}]`}function u(d,p){let f=[];for(let g in d)d[g]===!0&&f.push((0,Aa._)`${p} !== ${g}`);return(0,Aa.and)(...f)}}};nI.default=Rhe});var GK=ae(rI=>{"use strict";Object.defineProperty(rI,"__esModule",{value:!0});var fl=tt(),FK=ft(),She={message:({params:{len:e}})=>(0,fl.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,fl._)`{limit: ${e}}`},Ehe={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:She,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,fl._)`${i}.length`);if(n===!1)e.setParams({len:o}),e.fail((0,fl._)`${s} > ${o}`);else if(typeof n=="object"&&!(0,FK.alwaysValidSchema)(r,n)){let c=t.var("valid",(0,fl._)`${s} <= ${o}`);t.if((0,fl.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:FK.Type.Num},c),r.allErrors||t.if((0,fl.not)(c),()=>t.break())})}}};rI.default=Ehe});var WK=ae(iI=>{"use strict";Object.defineProperty(iI,"__esModule",{value:!0});var Ohe=MK(),Ahe=GK(),Phe=[Ohe.default,Ahe.default];iI.default=Phe});var BK=ae(oI=>{"use strict";Object.defineProperty(oI,"__esModule",{value:!0});var ln=tt(),Che={message:({schemaCode:e})=>(0,ln.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ln._)`{format: ${e}}`},_he={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Che,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 P=R instanceof RegExp?(0,ln.regexpCode)(R):c.code.formats?(0,ln._)`${c.code.formats}${(0,ln.getProperty)(o)}`:void 0,I=n.scopeValue("formats",{key:o,ref:R,code:P});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,ln._)`${I}.validate`]:["string",R,I]}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=_he});var aI=ae(sI=>{"use strict";Object.defineProperty(sI,"__esModule",{value:!0});var The=BK(),Ihe=[The.default];sI.default=Ihe});var cI=ae(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.contentVocabulary=Ad.metadataVocabulary=void 0;Ad.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ad.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var UK=ae(lI=>{"use strict";Object.defineProperty(lI,"__esModule",{value:!0});var Dhe=cT(),jhe=RT(),Nhe=VT(),Lhe=_K(),Mhe=NK(),Fhe=WK(),Ghe=aI(),zK=cI(),Whe=[Lhe.default,Dhe.default,jhe.default,(0,Nhe.default)(!0),Ghe.default,zK.metadataVocabulary,zK.contentVocabulary,Mhe.default,Fhe.default];lI.default=Whe});var HK=ae(mk=>{"use strict";Object.defineProperty(mk,"__esModule",{value:!0});mk.DiscrError=void 0;var VK;(function(e){e.Tag="tag",e.Mapping="mapping"})(VK||(mk.DiscrError=VK={}))});var pI=ae(dI=>{"use strict";Object.defineProperty(dI,"__esModule",{value:!0});var Pd=tt(),uI=HK(),qK=qm(),Bhe=xd(),zhe=ft(),Uhe={message:({params:{discrError:e,tagName:t}})=>e===uI.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,Pd._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},Vhe={keyword:"discriminator",type:"object",schemaType:"object",error:Uhe,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,Pd._)`${n}${(0,Pd.getProperty)(a)}`);t.if((0,Pd._)`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:uI.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,Pd._)`${l} === ${g}`),t.assign(c,d(f[g]));t.else(),e.error(!1,{discrError:uI.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,Pd.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,zhe.schemaHasRulesButRef)(R,o.self.RULES)){let I=R.$ref;if(R=qK.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,I),R instanceof qK.SchemaEnv&&(R=R.schema),R===void 0)throw new Bhe.default(o.opts.uriResolver,o.baseId,I)}let P=(f=R?.properties)===null||f===void 0?void 0:f[a];if(typeof P!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);w=w&&(h||b(R)),k(P,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 P of x.enum)$(P,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}}}};dI.default=Vhe});var KK=ae((tUe,Hhe)=>{Hhe.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 JK=ae((nUe,qhe)=>{qhe.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 ZK=ae((rUe,Khe)=>{Khe.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 YK=ae((iUe,Jhe)=>{Jhe.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 XK=ae((oUe,Zhe)=>{Zhe.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 QK=ae((sUe,Yhe)=>{Yhe.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 e4=ae((aUe,Xhe)=>{Xhe.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 t4=ae((cUe,Qhe)=>{Qhe.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 n4=ae(fI=>{"use strict";Object.defineProperty(fI,"__esModule",{value:!0});var eye=KK(),tye=JK(),nye=ZK(),rye=YK(),iye=XK(),oye=QK(),sye=e4(),aye=t4(),cye=["/properties"];function lye(e){return[eye,tye,nye,rye,iye,t(this,oye),sye,t(this,aye)].forEach(n=>this.addMetaSchema(n,void 0,!1)),this;function t(n,i){return e?n.$dataMetaSchema(i,cye):i}}fI.default=lye});var r4=ae((Yt,gI)=>{"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 uye=oT(),dye=UK(),pye=pI(),fye=n4(),mI="https://json-schema.org/draft/2020-12/schema",Cd=class extends uye.default{constructor(t={}){super({...t,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),dye.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(pye.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:t,meta:n}=this.opts;n&&(fye.default.call(this,t),this.refs["http://json-schema.org/schema"]=mI)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(mI)?mI:void 0)}};Yt.Ajv2020=Cd;gI.exports=Yt=Cd;gI.exports.Ajv2020=Cd;Object.defineProperty(Yt,"__esModule",{value:!0});Yt.default=Cd;var mye=kd();Object.defineProperty(Yt,"KeywordCxt",{enumerable:!0,get:function(){return mye.KeywordCxt}});var _d=tt();Object.defineProperty(Yt,"_",{enumerable:!0,get:function(){return _d._}});Object.defineProperty(Yt,"str",{enumerable:!0,get:function(){return _d.str}});Object.defineProperty(Yt,"stringify",{enumerable:!0,get:function(){return _d.stringify}});Object.defineProperty(Yt,"nil",{enumerable:!0,get:function(){return _d.nil}});Object.defineProperty(Yt,"Name",{enumerable:!0,get:function(){return _d.Name}});Object.defineProperty(Yt,"CodeGen",{enumerable:!0,get:function(){return _d.CodeGen}});var gye=Hm();Object.defineProperty(Yt,"ValidationError",{enumerable:!0,get:function(){return gye.default}});var hye=xd();Object.defineProperty(Yt,"MissingRefError",{enumerable:!0,get:function(){return hye.default}})});function Pa(){let e=r4();return e.default??e}var lg=v(()=>{"use strict"});import{readFileSync as wI}from"node:fs";import{isAbsolute as yye,join as bI,relative as wye,resolve as bye}from"node:path";function o4(e=[]){let t=new Map;for(let n of[...i4,...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 s4(){return o4()}function a4(e,t,n){if("directory"in e.probe)return!0;if("chantProject"in e.probe)return kI(t,n);let{anyFile:i,anyBlock:r,anyJsonKey:o}=e.probe;if(i&&yI(t,n,i).length>0)return!0;if(o)for(let s of yI(t,n,o.in))try{let a=JSON.parse(t.read(s));if(o.pointers.some(c=>xye(a,c)!==void 0))return!0}catch{}if(r){let s=new RegExp(`^\\s*(?:${r.blocks.map(c4).join("|")})\\s*\\{`,"m");for(let a of yI(t,n,r.in))try{if(s.test(t.read(a)))return!0}catch{}}return!1}function yI(e,t,n){let i=[],r=n.filter(o=>o.includes("*"));for(let o of n)!o.includes("*")&&e.stat(qe(t,o))==="file"&&i.push(qe(t,o));if(r.length>0){let o=r.map(s=>new RegExp(`^${s.split("*").map(c4).join("[^/]*")}$`));for(let s of e.list(t)??[])s.type==="file"&&o.some(a=>a.test(s.name))&&i.push(qe(t,s.name))}return i.sort()}function xye(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 c4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kI(e,t){let n=qe(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(Sye))return!0}}catch{}let i=(r,o)=>{let s=e.list(r)??[];return s.some(a=>a.type==="file"&&$ye.includes(a.name))?!0:o===Rye?!1:s.some(a=>a.type==="dir"&&!Bi(a.name)&&i(qe(r,a.name),o+1))};return i(t,0)}function Sye(e){return e==="@intentius/chant"||e.startsWith("@intentius/chant-lexicon-")}function Eye(){if(gk)return gk;let e=Pa();return gk=new e({allErrors:!0,strict:!0}).compile(Y_),gk}function Oye(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=Eye();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(kye.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&&hI.includes(a.reader)?{reader:a.reader}:{}}),a.reader&&!hI.includes(a.reader)&&r.push(`${t}: kind ${a.name} names link reader ${a.reader}, which this chant does not have (it has ${hI.join(", ")}); the kind is kept, and its members' links are only those their entries state`);for(let c of Cye(a.fields??{}))r.push(`${t}: kind ${a.name} ${c}`)}return{kinds:o,problems:r}}function Aye(e,t=vI){return s0(e,t)}function Pye(e,t){let n=bI(e,"package.json"),i;try{i=JSON.parse(wI(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=Aye(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=bye(e,o),a=wye(e,s);if(a.startsWith("..")||yye(a))return{kinds:[],problems:[`${r}: exports["${vI}"] points outside the package`],file:void 0};let c;try{c=wI(s,"utf-8")}catch{return{kinds:[],problems:[`${r}: exports["${vI}"] names ${o}, which does not exist`],file:s}}let l=Oye(c,r),u=typeof i.name=="string"?i.name:void 0;for(let d of l.kinds)d.packageDir=e,d.graph&&u!==hk(d.graph.lexicon)&&(l.problems.push(`${r}: kind ${d.name} reads its members with lexicon ${d.graph.lexicon}, which is ${hk(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 hk(e){return`@intentius/chant-lexicon-${e}`}function l4(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 xI(e,t){if(e.package){let n=va(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(wI(bI(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=bI(t,...e.path.split("/"));if(e.integrity){let i=rH(n,e.integrity,e.path);if(!i.ok)return{problem:i.message}}return{dir:n,source:e.path}}return null}function Ca(e,t){let n=[],i=[],r=new Map,o=new Set;return e.forEach((s,a)=>{let c=xI(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=Pye(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:o4(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 Cye(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 $I(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 wUe,vI,hI,yk,vye,i4,kye,$ye,Rye,gk,qi=v(()=>{"use strict";XV();on();iH();fd();lg();wUe=Y_.$id,vI="./workspace-kinds",hI=["dbt-project"],yk="examples",vye="design",i4=[{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:vye,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:yk,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"}],kye=i4.map(e=>e.name);$ye=["chant.config.ts","chant.config.json"],Rye=4});function Td(e){return String(e).replace(/~/g,"~0").replace(/\//g,"~1")}function _a(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 wk(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}/${Td(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 wk))throw w;return{ok:!1,message:w.message,location:i(w.offset)}}}var wk,Id=v(()=>{"use strict";wk=class extends Error{constructor(n,i){super(n);this.offset=i}}});function d4(){return"0.124.35"}var p4=v(()=>{"use strict"});var PI={};_e(PI,{CHANT_PACKAGE:()=>jd,DECLARATION_FILES:()=>Dd,DECLARATION_SCHEMA_ID:()=>_ye,DECLARATION_SCHEMA_VERSION:()=>Tye,DEFAULT_CI_WINDOW:()=>y4,DEFAULT_PUBLISH_BRANCH_PREFIX:()=>k4,DEFAULT_REPLICATE_REMOTE:()=>v4,DEFAULT_SHIP_ENV:()=>b4,DEFAULT_SHIP_GATE:()=>w4,DEFAULT_STATE_ROOT:()=>x4,DIAGRAM_TOOLS:()=>Nye,FACTORY_CHECK_KINDS:()=>Lye,NAME_PATTERN:()=>Iye,PRINCIPAL_CLASSES:()=>Dye,REPLICATE_REF_CLASSES:()=>RI,REPLICATE_TRIGGERS:()=>SI,RESERVED_NAMES:()=>h4,WORKSPACE_ERROR_CODES:()=>yi,WRITE_VERBS:()=>jye,WorkspaceReadError:()=>ve,boxServicesProblem:()=>O4,compareVersions:()=>$4,declaredDiagrams:()=>OI,declaredRecordKinds:()=>yr,extensionsAt:()=>ug,findDeclarationDir:()=>AI,isInside:()=>Nr,ownerOf:()=>A4,parseDeclaration:()=>S4,pinnedChant:()=>vk,readDeclaration:()=>_t,readerVersion:()=>en,resolveGroups:()=>Ta,rootExclusions:()=>kk});function en(){return f4??=d4(),f4}function $4(e,t){let n=EI.exec(e),i=EI.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 Mye(){if(bk)return bk;let e=Pa();return bk=new e({allErrors:!0,strict:!0}).compile(K_),bk}function Fye(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"&&h4.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 R4(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 vk(e){if(!Array.isArray(e.pins))return;let t=e.pins.findIndex(n=>n!==null&&typeof n=="object"&&n.package===jd&&typeof n.version=="string");return t<0?void 0:{version:e.pins[t].version,index:t}}function S4(e,t,n=en(),i={}){let r=_a(e,{jsonc:t.endsWith(".jsonc")});if(!r.ok)throw new ve("declaration-unparseable",r.message,{file:t,...r.location});let o=(j,N=!1)=>({file:t,...r.locate(j,N)}),s=r.value;if(s===null||typeof s!="object"||Array.isArray(s))throw new ve("declaration-invalid","the declaration must be a JSON object",o(""));let a=s,c=i.rootChant?vk(a):void 0;if(c&&c.version!==n)throw new ve("root-chant-required",`this declaration pins ${jd} ${c.version}, and this is chant ${n}; the root's chant reads it, so install ${jd}@${c.version} at the workspace root`,o(`/pins/${c.index}/version`));if(typeof a.minReader=="string"&&EI.test(a.minReader)&&$4(n,a.minReader)<0)throw new ve("reader-too-old",`this declaration needs chant ${a.minReader} or newer to read it, and this is chant ${n}`,o("/minReader"));let l=Mye();if(!l(s)){let j=(l.errors??[]).filter(ne=>!Gye.has(ne.keyword));j.sort((ne,be)=>be.instancePath.split("/").length-ne.instancePath.split("/").length);let N=j[0]??l.errors[0],C=N.keyword==="additionalProperties",T=C?`${N.instancePath}/${Td(String(N.params.additionalProperty))}`:N.instancePath,G=N.instancePath===""?"":` (at ${N.instancePath})`,ke=j.length>1?`; ${j.length-1} more problem${j.length>2?"s":""} after this one`:"";throw new ve("declaration-invalid",`${Fye(N,R4(s,N.instancePath))}${G}${ke}`,o(T,C))}let u=a.members.map((j,N)=>{let C=`/members/${N}`,T=(j.suppress??[]).map(te=>({check:te.check,because:te.because}));if(j.kind===yk){let te=j.glob;return{type:"group",name:j.name,kind:yk,globs:typeof te=="string"?[te]:[...te],suppress:T,pointer:C,globLocation:r.locate(`${C}/glob`)}}let G=(j.roles??[]).map(te=>typeof te=="string"?{name:te,path:null}:{name:te.name,path:te.path??null}),ke=(j.generated??[]).map((te,ye)=>({path:te.path,generator:te.generator,sources:[...te.sources??[]],handWritten:te.handWritten?{because:te.handWritten.because}:null,pointer:`${C}/generated/${ye}`})),ne=(j.links??[]).map((te,ye)=>({member:te.member,output:te.output,kind:te.kind??null,protocol:te.protocol??null,pointer:`${C}/links/${ye}`})),be=m4(j.records,j.dir,j.name,`${C}/records`),Be=g4(j.diagrams,j.name,`${C}/diagrams`),dt=Kye(j.box,`${C}/box`);return{type:"member",name:j.name,dir:j.dir,kind:j.kind,roles:G,generated:ke,outputs:j.outputs===void 0?null:[...j.outputs],fields:j.fields===void 0?null:structuredClone(j.fields),links:ne,records:be,diagrams:Be,box:dt,upstream:j.upstream??null,because:j.because??null,travel:j.travel===!0,security:[...j.security??[]],ciWorkflow:j.ci?.workflow??null,suppress:T,pointer:C}}),d=new Map;for(let j of u){let N=d.get(j.name);if(N)throw new ve("declaration-invalid",`the name ${JSON.stringify(j.name)} is already used by the entry at ${N.pointer}`,o(`${j.pointer}/name`));d.set(j.name,j)}let p=u.filter(j=>j.type==="member"),f=new Map;for(let j of p){let N=f.get(j.dir);if(N)throw new ve("placement-invalid",`member ${j.name} has the same directory as member ${N.name} (${j.dir})`,o(`${j.pointer}/dir`));f.set(j.dir,j)}for(let j of p){let N=p.find(C=>C!==j&&C.dir!=="."&&Nr(j.dir,C.dir));if(N)throw new ve("placement-invalid",`member ${j.name} (${j.dir}) sits inside member ${N.name} (${N.dir}); only the root member "." may contain other members`,o(`${j.pointer}/dir`))}for(let j of p){let N=new Map;for(let C of j.generated){let T=N.get(C.path);if(T)throw new ve("declaration-invalid",`member ${j.name} lists the generated file ${C.path} twice; the first is at ${T.pointer}`,o(`${C.pointer}/path`));N.set(C.path,C);let G=j.dir==="."?C.path:`${j.dir}/${C.path}`,ke=p.find(ne=>ne!==j&&ne.dir!=="."&&Nr(ne.dir,j.dir)&&Nr(G,ne.dir));if(ke)throw new ve("placement-invalid",`member ${j.name} lists the generated file ${C.path}, which sits inside member ${ke.name} (${ke.dir}); list it there`,o(`${C.pointer}/path`))}}let g=m4(a.records,".",null,"/records"),h=new Map,w=new Map;for(let j of[...g,...p.flatMap(N=>N.records)]){let N=h.get(j.path);if(N)throw new ve("declaration-invalid",`the record kind ${j.path} is already declared at ${N.pointer}`,o(`${j.pointer}/kind`));if(h.set(j.path,j),j.name===null)continue;let C=w.get(j.name);if(C)throw new ve("declaration-invalid",`the record kind name ${JSON.stringify(j.name)} is already given at ${C.pointer}`,o(`${j.pointer}/name`));w.set(j.name,j)}for(let j of p){let N=new Map;for(let T of j.box?.capabilities??[]){let G=N.get(T.name);if(G)throw new ve("declaration-invalid",`member ${j.name}'s box lists the capability ${T.name} twice; the first is at ${G.pointer}`,o(`${T.pointer}/name`));N.set(T.name,T)}let C=j.box?O4(j.name,j.box.services):null;if(C)throw new ve("declaration-invalid",C.message,o(C.pointer))}let b=Jye(p);if(b)throw new ve("declaration-invalid",b.message,o(b.pointer));let k=p.filter(j=>j.box?.replicate);if(k.length>1)throw new ve("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 $=g4(a.diagrams,null,"/diagrams"),x=new Map;for(let j of[...$,...p.flatMap(N=>N.diagrams)]){let N=x.get(j.name);if(N)throw new ve("declaration-invalid",`the diagram name ${JSON.stringify(j.name)} is already used by the diagram at ${N.pointer}`,o(`${j.pointer}/name`));x.set(j.name,j)}let R=Xye(a,p,o),P=Wye(a.writeScope,p,o),I=Hye(a.agents,p,o),A=Zye(p,I);if(A)throw new ve("declaration-invalid",A.message,o(A.pointer));let W=Vye(a.ci,o),_=(a.pins??[]).map(j=>({package:j.package??null,version:j.version??null,path:j.path??null,integrity:j.integrity??null})),re={name:a.name,schema:a.schema,minReader:a.minReader??null,entries:u,members:p,groups:u.filter(j=>j.type==="group"),pins:_,checks:{...a.checks??{}},quorum:typeof a.quorum=="number"?a.quorum:null,records:g,diagrams:$,hosts:R,changes:qye(a.changes),writeScope:P,agents:I,identity:Bye(a.identity),ci:W,retention:Uye(a.retention),metrics:zye(a.metrics),security:[...a.security??[]],file:t};return E4.set(re,s),re}function ug(e,t){let n=R4(E4.get(e),t);return n===null||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([i])=>i.startsWith("x-")))}function Wye(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 ve("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 Bye(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 zye(e){if(!e||typeof e!="object")return null;let t=e.failureWindowDays;return typeof t=="number"?{failureWindowDays:t}:{}}function Uye(e){if(!e||typeof e!="object")return null;let t={};for(let n of BV){let i=e[n];i&&(t[n]={...typeof i.days=="number"?{days:i.days}:{},...typeof i.keep=="number"?{keep:i.keep}:{}})}return t}function Vye(e,t){if(e===void 0)return null;let n=e,i=n.workflow!==void 0?{workflow:n.workflow}:{},r=null;if(n.reportUrl!==void 0){let a=zV(n.reportUrl,"ci.reportUrl");if("error"in a)throw new ve("declaration-invalid",a.error,t("/ci/reportUrl"));r=a.url}if(n.green===void 0)return{green:null,...i,reportUrl:r};let o=n.green,s=Object.entries(o.phases).map(([a,c])=>({name:a,runs:[...Array.isArray(c)?c:c.runs],skipped:Array.isArray(c)?"fail":c.skipped??"fail",...!Array.isArray(c)&&c.build!==void 0?{build:c.build}:{},pointer:`/ci/green/phases/${Td(a)}`}));for(let[a,c]of o.require.entries())if(!s.some(l=>l.name===c))throw new ve("declaration-invalid",`ci.green.require names the phase ${JSON.stringify(c)}, which ci.green.phases does not declare; declared phases: ${s.map(l=>l.name).join(", ")}`,t(`/ci/green/require/${a}`));for(let[a,c]of(o.preMerge??[]).entries())if(!s.some(l=>l.name===c))throw new ve("declaration-invalid",`ci.green.preMerge names the phase ${JSON.stringify(c)}, which ci.green.phases does not declare; declared phases: ${s.map(l=>l.name).join(", ")}`,t(`/ci/green/preMerge/${a}`));return{green:{branch:o.branch,window:o.window??y4,phases:s,require:[...o.require],...o.preMerge!==void 0?{preMerge:[...o.preMerge]}:{},signedSince:o.signedSince??null,source:o.source??"checks",pointer:"/ci/green"},...i,reportUrl:r}}function Hye(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 ve("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 ve("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 ve("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 qye(e){return e===void 0?null:{severity:e.severity??"warn",ignore:[...e.ignore??[]]}}function m4(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 g4(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 Kye(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??k4,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??w4,env:n.ship.env??b4,bookkeeping:(n.ship.bookkeeping??[]).map(s=>s.replace(/^\.\//,"").replace(/\/+$/,"")),pointer:`${t}/ship`},replicate:o===void 0?null:{remote:o.remote??v4,refs:RI.filter(s=>(o.refs??RI).includes(s)),on:SI.filter(s=>(o.on??SI).includes(s)),every:o.every??null,pointer:`${t}/replicate`},pointer:t}}function Jye(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 Zye(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 O4(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=Yye(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 Yye(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 Xye(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 ve("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/${Td(g)}`)}return i}function yr(e){return[...e.records,...e.members.flatMap(t=>t.records)]}function OI(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=Dd.map(r=>qe(t,r)).filter(r=>e.stat(r)==="file");if(i.length===0)throw new ve("declaration-missing",`no ${Dd.join(" or ")} in ${t||"the workspace root"}${e.label}`);if(i.length>1)throw new ve("declaration-ambiguous",`both ${i.join(" and ")} exist${e.label}; keep one of them`,{file:i[1],line:1,column:1});return S4(e.read(i[0]),i[0],en(),n)}function AI(e,t){for(let n=t;;n=n.includes("/")?n.slice(0,n.lastIndexOf("/")):""){if(Dd.some(i=>e.stat(qe(n,i))==="file"))return n;if(n==="")return}}function Ta(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=>ZV(t,l)))].sort(),a=[],c=[];for(let l of s){if(!kI(t,l)){c.push(l);continue}let u=p=>new ve("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 A4(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 kk(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 _ye,Dd,Tye,h4,Iye,yi,ve,Dye,jye,y4,Nye,w4,b4,RI,SI,v4,Lye,k4,x4,jd,f4,EI,bk,Gye,E4,Tt=v(()=>{"use strict";q_();UV();VV();YV();qi();Id();on();lg();p4();_ye=K_.$id,Dd=["chant.workspace.json","chant.workspace.jsonc"],Tye=1,h4=["_workspace","_members"],Iye=/^[a-z0-9][a-z0-9-]{0,39}$/,yi=["declaration-missing","declaration-ambiguous","declaration-unparseable","declaration-invalid","placement-invalid","reader-too-old","root-chant-required","not-a-git-repository","revision-unknown"],ve=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}},Dye=["human","agent","runner","service"],jye=["new","amend","review","close"],y4="24h",Nye=["d2","mermaid","graphviz","excalidraw"],w4="ship",b4="box",RI=["work","kept","wip","ledger"],SI=["save","release"],v4="origin",Lye=["test","build","lint","plan","conformance"],k4="chant/work/",x4="${XDG_STATE_HOME}/chant/boxes",jd="@intentius/chant";EI=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?$/;Gye=new Set(["if","then","else","oneOf","anyOf"]);E4=new WeakMap});var _4={};_e(_4,{MEMBERS_DIR:()=>Rk,MEMBER_LEDGER_FLOOR:()=>owe,MemberLedgerError:()=>$k,clearMemberLedgerCache:()=>swe,memberLedgerPrefix:()=>Sk,resolveMemberLedger:()=>Xr});import{existsSync as Qye}from"node:fs";import{dirname as ewe,join as twe,relative as nwe,resolve as rwe,sep as iwe}from"node:path";function Sk(e){return e.map(t=>`${Rk}/${t}/`).join("")}function Xr(e){let t=rwe(e),n=xk.get(t);return n||(n=cwe(t),xk.set(t,n),n.catch(()=>xk.delete(t))),n}function swe(){xk.clear()}function awe(e,t){let n=nwe(e,t);return n===""?"":n.split(iwe).join("/")}async function cwe(e){let t=tr(e);return t?C4(t.dir,e):P4}async function C4(e,t){let{readDeclaration:n,resolveGroups:i,ownerOf:r,WorkspaceReadError:o}=await Promise.resolve().then(()=>(Tt(),PI)),{workingTree:s}=await Promise.resolve().then(()=>(on(),Z_)),a;try{let d=s(e),p=n(d),f=r(p,i(p,d),awe(e,t));a=f&&"member"in f&&f.member.dir!=="."?[f.member.name]:[]}catch(d){throw d instanceof o?new $k(`cannot place this project's lifecycle ledger: ${d.describe()}. A project inside a workspace writes under ${Rk}/<member>/ on chant/lifecycle, and chant does not guess the member. Fix the declaration and retry.`):d}let c=P4,l=ewe(e);if(l!==e&&!Qye(twe(e,".git"))){let d=tr(l);d&&(c=await C4(d.dir,e))}let u=[...c.members,...a];return{members:u,prefix:Sk(u)}}var Rk,owe,P4,$k,xk,Io=v(()=>{"use strict";Mi();Rk="_members",owe="0.81.0",P4={members:[],prefix:""};$k=class extends Error{constructor(t){super(t),this.name="MemberLedgerError"}},xk=new Map});function dg(e){return e===Nd}var Nd,pg=v(()=>{"use strict";Nd="recorded locally (no remote for chant/lifecycle)"});function Ki(e=process.env){let t=e[Ek]?.trim().toLowerCase();return t!==void 0&&t!==""&&t!=="0"&&t!=="false"}function fg(e){return CI.get(e)?.tip}function T4(e,t,n,i){let r=CI.get(e)??{tip:null,writes:[]};r.tip=t;for(let o of n)r.writes.push({path:o,message:i});CI.set(e,r)}function Ok(e,t){if(Ki())throw new _I(e,t)}var Ek,TI,CI,_I,Ld=v(()=>{"use strict";Ek="CHANT_NO_RECORD";TI="not recorded (--no-record): chant/lifecycle was not written or pushed",CI=new Map;_I=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 WI={};_e(WI,{LifecycleLedgerUnreadableError:()=>gg,RefCASConflictError:()=>Ot,StaleLifecycleBranchError:()=>mg,StaleLockError:()=>ml,appendLedgerLine:()=>W4,appendReleaseRecordLine:()=>jI,deleteRefCAS:()=>Gd,describeLifecyclePush:()=>MI,fetchLifecycle:()=>ywe,fetchLifecycleStatus:()=>Yi,fetchRef:()=>kwe,fetchRefInto:()=>H4,fetchRefIntoStatus:()=>Ck,getHeadCommit:()=>_k,getRemoteLifecycleBranchSha:()=>B4,gitLedgerReadPort:()=>$we,ledgerDir:()=>qn,ledgerRevision:()=>Wd,listFilesInDir:()=>Zi,listLedgerEnvironments:()=>LI,listLedgerTrees:()=>hg,listSnapshots:()=>hwe,pushLifecycle:()=>Md,pushLifecycleReport:()=>Da,pushLifecycleStatus:()=>Ia,pushRef:()=>vwe,pushRefStatus:()=>yg,readBlobBySha:()=>hn,readBlobFromPath:()=>At,readEnvironmentSnapshots:()=>gwe,readPathSha:()=>gn,readRefSha:()=>ja,readReleaseLedgerLines:()=>NI,readSnapshot:()=>G4,readSnapshotAt:()=>mwe,requireLifecycleLedger:()=>Lr,snapshotStorageKey:()=>M4,updateRefCAS:()=>Fd,writeBlob:()=>FI,writeBlobToPath:()=>mn,writeLedgerFiles:()=>Ji,writeSnapshot:()=>F4});async function qn(e,t){return`${await lwe(t)}${e}`}async function lwe(e){return e?.ledgerPrefix!==void 0?e.ledgerPrefix:e?.member!==void 0?Sk((typeof e.member=="string"?[e.member]:[...e.member]).filter(t=>t!==".")):(await Xr(e?.cwd??process.cwd())).prefix}async function pwe(e){let t=bt();if((await t.spawn(["git","var","GIT_COMMITTER_IDENT"],{cwd:e,env:wi})).exitCode===0)return[];let i=[];for(let[r,o,s]of[["user.name","CHANT_LIFECYCLE_COMMITTER_NAME",uwe],["user.email","CHANT_LIFECYCLE_COMMITTER_EMAIL",dwe]]){let a=await t.spawn(["git","config","--get",r],{cwd:e,env:wi});a.exitCode===0&&a.stdout.trim()!==""||i.push("-c",`${r}=${process.env[o]?.trim()||s}`)}return i}function II(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 Ji([{path:`${o}/${t}`,content:n,...r?.expectPriorPathSha!==void 0?{expectPriorSha:r.expectPriorPathSha}:{}}],i,r)}async function Ji(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(fwe(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 II("git hash-object",u.path,d.stderr);s.push({path:u.path,sha:d.stdout.trim()})}let a=await pwe(r);await gl(r)===null&&await Lr({...r?{cwd:r}:{}});let c=new Map(e.map(u=>[u.path,u.expectPriorSha])),l;for(let u=1;u<=L4;u++){let d=await gl(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 xwe(d,x,r):new Map,p.set(x,R)),R};for(let x of s){let{dir:R,name:P}=D4(x.path),I=(await f(R)).get(P),A=I?.type==="blob"?I.sha:null,W=c.get(x.path);if(W!==void 0&&A!==W)throw l??new Ot(`refs/heads/${Nt}`,W,"target path changed concurrently");c.set(x.path,A)}for(let x of s){let{dir:R,name:P}=D4(x.path);x.sha===null?(await f(R)).delete(P):(await f(R)).set(P,{mode:"100644",type:"blob",sha:x.sha});for(let I=R;I!=="";I=Pk(I))await f(Pk(I))}let g=[...p.keys()].sort((x,R)=>N4(R)-N4(x)||(x<R?-1:1)),h="";for(let x of g){if(x!==""&&p.get(x).size===0){p.get(Pk(x)).delete(j4(x));continue}let R=[...p.get(x)].map(([A,W])=>`${W.mode} ${W.type} ${W.sha} ${A}`).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}/${Td(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 wk))throw w;return{ok:!1,message:w.message,location:i(w.offset)}}}var wk,Id=v(()=>{"use strict";wk=class extends Error{constructor(n,i){super(n);this.offset=i}}});function d4(){return"0.124.36"}var p4=v(()=>{"use strict"});var PI={};_e(PI,{CHANT_PACKAGE:()=>jd,DECLARATION_FILES:()=>Dd,DECLARATION_SCHEMA_ID:()=>_ye,DECLARATION_SCHEMA_VERSION:()=>Tye,DEFAULT_CI_WINDOW:()=>y4,DEFAULT_PUBLISH_BRANCH_PREFIX:()=>k4,DEFAULT_REPLICATE_REMOTE:()=>v4,DEFAULT_SHIP_ENV:()=>b4,DEFAULT_SHIP_GATE:()=>w4,DEFAULT_STATE_ROOT:()=>x4,DIAGRAM_TOOLS:()=>Nye,FACTORY_CHECK_KINDS:()=>Lye,NAME_PATTERN:()=>Iye,PRINCIPAL_CLASSES:()=>Dye,REPLICATE_REF_CLASSES:()=>RI,REPLICATE_TRIGGERS:()=>SI,RESERVED_NAMES:()=>h4,WORKSPACE_ERROR_CODES:()=>yi,WRITE_VERBS:()=>jye,WorkspaceReadError:()=>ve,boxServicesProblem:()=>O4,compareVersions:()=>$4,declaredDiagrams:()=>OI,declaredRecordKinds:()=>yr,extensionsAt:()=>ug,findDeclarationDir:()=>AI,isInside:()=>Nr,ownerOf:()=>A4,parseDeclaration:()=>S4,pinnedChant:()=>vk,readDeclaration:()=>_t,readerVersion:()=>en,resolveGroups:()=>Ta,rootExclusions:()=>kk});function en(){return f4??=d4(),f4}function $4(e,t){let n=EI.exec(e),i=EI.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 Mye(){if(bk)return bk;let e=Pa();return bk=new e({allErrors:!0,strict:!0}).compile(K_),bk}function Fye(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"&&h4.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 R4(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 vk(e){if(!Array.isArray(e.pins))return;let t=e.pins.findIndex(n=>n!==null&&typeof n=="object"&&n.package===jd&&typeof n.version=="string");return t<0?void 0:{version:e.pins[t].version,index:t}}function S4(e,t,n=en(),i={}){let r=_a(e,{jsonc:t.endsWith(".jsonc")});if(!r.ok)throw new ve("declaration-unparseable",r.message,{file:t,...r.location});let o=(j,N=!1)=>({file:t,...r.locate(j,N)}),s=r.value;if(s===null||typeof s!="object"||Array.isArray(s))throw new ve("declaration-invalid","the declaration must be a JSON object",o(""));let a=s,c=i.rootChant?vk(a):void 0;if(c&&c.version!==n)throw new ve("root-chant-required",`this declaration pins ${jd} ${c.version}, and this is chant ${n}; the root's chant reads it, so install ${jd}@${c.version} at the workspace root`,o(`/pins/${c.index}/version`));if(typeof a.minReader=="string"&&EI.test(a.minReader)&&$4(n,a.minReader)<0)throw new ve("reader-too-old",`this declaration needs chant ${a.minReader} or newer to read it, and this is chant ${n}`,o("/minReader"));let l=Mye();if(!l(s)){let j=(l.errors??[]).filter(ne=>!Gye.has(ne.keyword));j.sort((ne,be)=>be.instancePath.split("/").length-ne.instancePath.split("/").length);let N=j[0]??l.errors[0],C=N.keyword==="additionalProperties",T=C?`${N.instancePath}/${Td(String(N.params.additionalProperty))}`:N.instancePath,G=N.instancePath===""?"":` (at ${N.instancePath})`,ke=j.length>1?`; ${j.length-1} more problem${j.length>2?"s":""} after this one`:"";throw new ve("declaration-invalid",`${Fye(N,R4(s,N.instancePath))}${G}${ke}`,o(T,C))}let u=a.members.map((j,N)=>{let C=`/members/${N}`,T=(j.suppress??[]).map(te=>({check:te.check,because:te.because}));if(j.kind===yk){let te=j.glob;return{type:"group",name:j.name,kind:yk,globs:typeof te=="string"?[te]:[...te],suppress:T,pointer:C,globLocation:r.locate(`${C}/glob`)}}let G=(j.roles??[]).map(te=>typeof te=="string"?{name:te,path:null}:{name:te.name,path:te.path??null}),ke=(j.generated??[]).map((te,ye)=>({path:te.path,generator:te.generator,sources:[...te.sources??[]],handWritten:te.handWritten?{because:te.handWritten.because}:null,pointer:`${C}/generated/${ye}`})),ne=(j.links??[]).map((te,ye)=>({member:te.member,output:te.output,kind:te.kind??null,protocol:te.protocol??null,pointer:`${C}/links/${ye}`})),be=m4(j.records,j.dir,j.name,`${C}/records`),Be=g4(j.diagrams,j.name,`${C}/diagrams`),dt=Kye(j.box,`${C}/box`);return{type:"member",name:j.name,dir:j.dir,kind:j.kind,roles:G,generated:ke,outputs:j.outputs===void 0?null:[...j.outputs],fields:j.fields===void 0?null:structuredClone(j.fields),links:ne,records:be,diagrams:Be,box:dt,upstream:j.upstream??null,because:j.because??null,travel:j.travel===!0,security:[...j.security??[]],ciWorkflow:j.ci?.workflow??null,suppress:T,pointer:C}}),d=new Map;for(let j of u){let N=d.get(j.name);if(N)throw new ve("declaration-invalid",`the name ${JSON.stringify(j.name)} is already used by the entry at ${N.pointer}`,o(`${j.pointer}/name`));d.set(j.name,j)}let p=u.filter(j=>j.type==="member"),f=new Map;for(let j of p){let N=f.get(j.dir);if(N)throw new ve("placement-invalid",`member ${j.name} has the same directory as member ${N.name} (${j.dir})`,o(`${j.pointer}/dir`));f.set(j.dir,j)}for(let j of p){let N=p.find(C=>C!==j&&C.dir!=="."&&Nr(j.dir,C.dir));if(N)throw new ve("placement-invalid",`member ${j.name} (${j.dir}) sits inside member ${N.name} (${N.dir}); only the root member "." may contain other members`,o(`${j.pointer}/dir`))}for(let j of p){let N=new Map;for(let C of j.generated){let T=N.get(C.path);if(T)throw new ve("declaration-invalid",`member ${j.name} lists the generated file ${C.path} twice; the first is at ${T.pointer}`,o(`${C.pointer}/path`));N.set(C.path,C);let G=j.dir==="."?C.path:`${j.dir}/${C.path}`,ke=p.find(ne=>ne!==j&&ne.dir!=="."&&Nr(ne.dir,j.dir)&&Nr(G,ne.dir));if(ke)throw new ve("placement-invalid",`member ${j.name} lists the generated file ${C.path}, which sits inside member ${ke.name} (${ke.dir}); list it there`,o(`${C.pointer}/path`))}}let g=m4(a.records,".",null,"/records"),h=new Map,w=new Map;for(let j of[...g,...p.flatMap(N=>N.records)]){let N=h.get(j.path);if(N)throw new ve("declaration-invalid",`the record kind ${j.path} is already declared at ${N.pointer}`,o(`${j.pointer}/kind`));if(h.set(j.path,j),j.name===null)continue;let C=w.get(j.name);if(C)throw new ve("declaration-invalid",`the record kind name ${JSON.stringify(j.name)} is already given at ${C.pointer}`,o(`${j.pointer}/name`));w.set(j.name,j)}for(let j of p){let N=new Map;for(let T of j.box?.capabilities??[]){let G=N.get(T.name);if(G)throw new ve("declaration-invalid",`member ${j.name}'s box lists the capability ${T.name} twice; the first is at ${G.pointer}`,o(`${T.pointer}/name`));N.set(T.name,T)}let C=j.box?O4(j.name,j.box.services):null;if(C)throw new ve("declaration-invalid",C.message,o(C.pointer))}let b=Jye(p);if(b)throw new ve("declaration-invalid",b.message,o(b.pointer));let k=p.filter(j=>j.box?.replicate);if(k.length>1)throw new ve("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 $=g4(a.diagrams,null,"/diagrams"),x=new Map;for(let j of[...$,...p.flatMap(N=>N.diagrams)]){let N=x.get(j.name);if(N)throw new ve("declaration-invalid",`the diagram name ${JSON.stringify(j.name)} is already used by the diagram at ${N.pointer}`,o(`${j.pointer}/name`));x.set(j.name,j)}let R=Xye(a,p,o),P=Wye(a.writeScope,p,o),I=Hye(a.agents,p,o),A=Zye(p,I);if(A)throw new ve("declaration-invalid",A.message,o(A.pointer));let W=Vye(a.ci,o),_=(a.pins??[]).map(j=>({package:j.package??null,version:j.version??null,path:j.path??null,integrity:j.integrity??null})),re={name:a.name,schema:a.schema,minReader:a.minReader??null,entries:u,members:p,groups:u.filter(j=>j.type==="group"),pins:_,checks:{...a.checks??{}},quorum:typeof a.quorum=="number"?a.quorum:null,records:g,diagrams:$,hosts:R,changes:qye(a.changes),writeScope:P,agents:I,identity:Bye(a.identity),ci:W,retention:Uye(a.retention),metrics:zye(a.metrics),security:[...a.security??[]],file:t};return E4.set(re,s),re}function ug(e,t){let n=R4(E4.get(e),t);return n===null||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([i])=>i.startsWith("x-")))}function Wye(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 ve("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 Bye(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 zye(e){if(!e||typeof e!="object")return null;let t=e.failureWindowDays;return typeof t=="number"?{failureWindowDays:t}:{}}function Uye(e){if(!e||typeof e!="object")return null;let t={};for(let n of BV){let i=e[n];i&&(t[n]={...typeof i.days=="number"?{days:i.days}:{},...typeof i.keep=="number"?{keep:i.keep}:{}})}return t}function Vye(e,t){if(e===void 0)return null;let n=e,i=n.workflow!==void 0?{workflow:n.workflow}:{},r=null;if(n.reportUrl!==void 0){let a=zV(n.reportUrl,"ci.reportUrl");if("error"in a)throw new ve("declaration-invalid",a.error,t("/ci/reportUrl"));r=a.url}if(n.green===void 0)return{green:null,...i,reportUrl:r};let o=n.green,s=Object.entries(o.phases).map(([a,c])=>({name:a,runs:[...Array.isArray(c)?c:c.runs],skipped:Array.isArray(c)?"fail":c.skipped??"fail",...!Array.isArray(c)&&c.build!==void 0?{build:c.build}:{},pointer:`/ci/green/phases/${Td(a)}`}));for(let[a,c]of o.require.entries())if(!s.some(l=>l.name===c))throw new ve("declaration-invalid",`ci.green.require names the phase ${JSON.stringify(c)}, which ci.green.phases does not declare; declared phases: ${s.map(l=>l.name).join(", ")}`,t(`/ci/green/require/${a}`));for(let[a,c]of(o.preMerge??[]).entries())if(!s.some(l=>l.name===c))throw new ve("declaration-invalid",`ci.green.preMerge names the phase ${JSON.stringify(c)}, which ci.green.phases does not declare; declared phases: ${s.map(l=>l.name).join(", ")}`,t(`/ci/green/preMerge/${a}`));return{green:{branch:o.branch,window:o.window??y4,phases:s,require:[...o.require],...o.preMerge!==void 0?{preMerge:[...o.preMerge]}:{},signedSince:o.signedSince??null,source:o.source??"checks",pointer:"/ci/green"},...i,reportUrl:r}}function Hye(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 ve("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 ve("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 ve("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 qye(e){return e===void 0?null:{severity:e.severity??"warn",ignore:[...e.ignore??[]]}}function m4(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 g4(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 Kye(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??k4,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??w4,env:n.ship.env??b4,bookkeeping:(n.ship.bookkeeping??[]).map(s=>s.replace(/^\.\//,"").replace(/\/+$/,"")),pointer:`${t}/ship`},replicate:o===void 0?null:{remote:o.remote??v4,refs:RI.filter(s=>(o.refs??RI).includes(s)),on:SI.filter(s=>(o.on??SI).includes(s)),every:o.every??null,pointer:`${t}/replicate`},pointer:t}}function Jye(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 Zye(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 O4(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=Yye(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 Yye(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 Xye(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 ve("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/${Td(g)}`)}return i}function yr(e){return[...e.records,...e.members.flatMap(t=>t.records)]}function OI(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=Dd.map(r=>qe(t,r)).filter(r=>e.stat(r)==="file");if(i.length===0)throw new ve("declaration-missing",`no ${Dd.join(" or ")} in ${t||"the workspace root"}${e.label}`);if(i.length>1)throw new ve("declaration-ambiguous",`both ${i.join(" and ")} exist${e.label}; keep one of them`,{file:i[1],line:1,column:1});return S4(e.read(i[0]),i[0],en(),n)}function AI(e,t){for(let n=t;;n=n.includes("/")?n.slice(0,n.lastIndexOf("/")):""){if(Dd.some(i=>e.stat(qe(n,i))==="file"))return n;if(n==="")return}}function Ta(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=>ZV(t,l)))].sort(),a=[],c=[];for(let l of s){if(!kI(t,l)){c.push(l);continue}let u=p=>new ve("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 A4(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 kk(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 _ye,Dd,Tye,h4,Iye,yi,ve,Dye,jye,y4,Nye,w4,b4,RI,SI,v4,Lye,k4,x4,jd,f4,EI,bk,Gye,E4,Tt=v(()=>{"use strict";q_();UV();VV();YV();qi();Id();on();lg();p4();_ye=K_.$id,Dd=["chant.workspace.json","chant.workspace.jsonc"],Tye=1,h4=["_workspace","_members"],Iye=/^[a-z0-9][a-z0-9-]{0,39}$/,yi=["declaration-missing","declaration-ambiguous","declaration-unparseable","declaration-invalid","placement-invalid","reader-too-old","root-chant-required","not-a-git-repository","revision-unknown"],ve=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}},Dye=["human","agent","runner","service"],jye=["new","amend","review","close"],y4="24h",Nye=["d2","mermaid","graphviz","excalidraw"],w4="ship",b4="box",RI=["work","kept","wip","ledger"],SI=["save","release"],v4="origin",Lye=["test","build","lint","plan","conformance"],k4="chant/work/",x4="${XDG_STATE_HOME}/chant/boxes",jd="@intentius/chant";EI=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?$/;Gye=new Set(["if","then","else","oneOf","anyOf"]);E4=new WeakMap});var _4={};_e(_4,{MEMBERS_DIR:()=>Rk,MEMBER_LEDGER_FLOOR:()=>owe,MemberLedgerError:()=>$k,clearMemberLedgerCache:()=>swe,memberLedgerPrefix:()=>Sk,resolveMemberLedger:()=>Xr});import{existsSync as Qye}from"node:fs";import{dirname as ewe,join as twe,relative as nwe,resolve as rwe,sep as iwe}from"node:path";function Sk(e){return e.map(t=>`${Rk}/${t}/`).join("")}function Xr(e){let t=rwe(e),n=xk.get(t);return n||(n=cwe(t),xk.set(t,n),n.catch(()=>xk.delete(t))),n}function swe(){xk.clear()}function awe(e,t){let n=nwe(e,t);return n===""?"":n.split(iwe).join("/")}async function cwe(e){let t=tr(e);return t?C4(t.dir,e):P4}async function C4(e,t){let{readDeclaration:n,resolveGroups:i,ownerOf:r,WorkspaceReadError:o}=await Promise.resolve().then(()=>(Tt(),PI)),{workingTree:s}=await Promise.resolve().then(()=>(on(),Z_)),a;try{let d=s(e),p=n(d),f=r(p,i(p,d),awe(e,t));a=f&&"member"in f&&f.member.dir!=="."?[f.member.name]:[]}catch(d){throw d instanceof o?new $k(`cannot place this project's lifecycle ledger: ${d.describe()}. A project inside a workspace writes under ${Rk}/<member>/ on chant/lifecycle, and chant does not guess the member. Fix the declaration and retry.`):d}let c=P4,l=ewe(e);if(l!==e&&!Qye(twe(e,".git"))){let d=tr(l);d&&(c=await C4(d.dir,e))}let u=[...c.members,...a];return{members:u,prefix:Sk(u)}}var Rk,owe,P4,$k,xk,Io=v(()=>{"use strict";Mi();Rk="_members",owe="0.81.0",P4={members:[],prefix:""};$k=class extends Error{constructor(t){super(t),this.name="MemberLedgerError"}},xk=new Map});function dg(e){return e===Nd}var Nd,pg=v(()=>{"use strict";Nd="recorded locally (no remote for chant/lifecycle)"});function Ki(e=process.env){let t=e[Ek]?.trim().toLowerCase();return t!==void 0&&t!==""&&t!=="0"&&t!=="false"}function fg(e){return CI.get(e)?.tip}function T4(e,t,n,i){let r=CI.get(e)??{tip:null,writes:[]};r.tip=t;for(let o of n)r.writes.push({path:o,message:i});CI.set(e,r)}function Ok(e,t){if(Ki())throw new _I(e,t)}var Ek,TI,CI,_I,Ld=v(()=>{"use strict";Ek="CHANT_NO_RECORD";TI="not recorded (--no-record): chant/lifecycle was not written or pushed",CI=new Map;_I=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 WI={};_e(WI,{LifecycleLedgerUnreadableError:()=>gg,RefCASConflictError:()=>Ot,StaleLifecycleBranchError:()=>mg,StaleLockError:()=>ml,appendLedgerLine:()=>W4,appendReleaseRecordLine:()=>jI,deleteRefCAS:()=>Gd,describeLifecyclePush:()=>MI,fetchLifecycle:()=>ywe,fetchLifecycleStatus:()=>Yi,fetchRef:()=>kwe,fetchRefInto:()=>H4,fetchRefIntoStatus:()=>Ck,getHeadCommit:()=>_k,getRemoteLifecycleBranchSha:()=>B4,gitLedgerReadPort:()=>$we,ledgerDir:()=>qn,ledgerRevision:()=>Wd,listFilesInDir:()=>Zi,listLedgerEnvironments:()=>LI,listLedgerTrees:()=>hg,listSnapshots:()=>hwe,pushLifecycle:()=>Md,pushLifecycleReport:()=>Da,pushLifecycleStatus:()=>Ia,pushRef:()=>vwe,pushRefStatus:()=>yg,readBlobBySha:()=>hn,readBlobFromPath:()=>At,readEnvironmentSnapshots:()=>gwe,readPathSha:()=>gn,readRefSha:()=>ja,readReleaseLedgerLines:()=>NI,readSnapshot:()=>G4,readSnapshotAt:()=>mwe,requireLifecycleLedger:()=>Lr,snapshotStorageKey:()=>M4,updateRefCAS:()=>Fd,writeBlob:()=>FI,writeBlobToPath:()=>mn,writeLedgerFiles:()=>Ji,writeSnapshot:()=>F4});async function qn(e,t){return`${await lwe(t)}${e}`}async function lwe(e){return e?.ledgerPrefix!==void 0?e.ledgerPrefix:e?.member!==void 0?Sk((typeof e.member=="string"?[e.member]:[...e.member]).filter(t=>t!==".")):(await Xr(e?.cwd??process.cwd())).prefix}async function pwe(e){let t=bt();if((await t.spawn(["git","var","GIT_COMMITTER_IDENT"],{cwd:e,env:wi})).exitCode===0)return[];let i=[];for(let[r,o,s]of[["user.name","CHANT_LIFECYCLE_COMMITTER_NAME",uwe],["user.email","CHANT_LIFECYCLE_COMMITTER_EMAIL",dwe]]){let a=await t.spawn(["git","config","--get",r],{cwd:e,env:wi});a.exitCode===0&&a.stdout.trim()!==""||i.push("-c",`${r}=${process.env[o]?.trim()||s}`)}return i}function II(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 Ji([{path:`${o}/${t}`,content:n,...r?.expectPriorPathSha!==void 0?{expectPriorSha:r.expectPriorPathSha}:{}}],i,r)}async function Ji(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(fwe(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 II("git hash-object",u.path,d.stderr);s.push({path:u.path,sha:d.stdout.trim()})}let a=await pwe(r);await gl(r)===null&&await Lr({...r?{cwd:r}:{}});let c=new Map(e.map(u=>[u.path,u.expectPriorSha])),l;for(let u=1;u<=L4;u++){let d=await gl(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 xwe(d,x,r):new Map,p.set(x,R)),R};for(let x of s){let{dir:R,name:P}=D4(x.path),I=(await f(R)).get(P),A=I?.type==="blob"?I.sha:null,W=c.get(x.path);if(W!==void 0&&A!==W)throw l??new Ot(`refs/heads/${Nt}`,W,"target path changed concurrently");c.set(x.path,A)}for(let x of s){let{dir:R,name:P}=D4(x.path);x.sha===null?(await f(R)).delete(P):(await f(R)).set(P,{mode:"100644",type:"blob",sha:x.sha});for(let I=R;I!=="";I=Pk(I))await f(Pk(I))}let g=[...p.keys()].sort((x,R)=>N4(R)-N4(x)||(x<R?-1:1)),h="";for(let x of g){if(x!==""&&p.get(x).size===0){p.get(Pk(x)).delete(j4(x));continue}let R=[...p.get(x)].map(([A,W])=>`${W.mode} ${W.type} ${W.sha} ${A}`).join(`
75
75
  `),P=await i.spawn(["git","mktree"],{cwd:r,stdin:R===""?"":`${R}
76
76
  `});if(P.exitCode!==0)throw II(`git mktree (${x===""?"root":x})`,o,P.stderr);let I=P.stdout.trim();x===""?h=I:p.get(Pk(x)).set(j4(x),{mode:"040000",type:"tree",sha:I})}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 II("git commit-tree",o,k.stderr);let $=k.stdout.trim();if(Ki()){let x=await GI(r),R=fg(x)===void 0?await ja(`refs/heads/${Nt}`,{cwd:r}):null,P=fg(x),I=P!==void 0?P:R;if(I===w)return T4(x,$,e.map(A=>A.path),t),$;l=new Ot(`refs/heads/${Nt}`,w,`the run's unrecorded tip is ${I??"(none)"}`);continue}try{return await Fd(`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 Wd(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 Wd(n?.cwd)}:${r}/${t}`],{cwd:n?.cwd});return o.exitCode!==0?null:o.stdout.trim()||null}function M4(e,t){return t?`${t}__${e}`:e}async function F4(e,t,n,i){return mn(e,`${t}.json`,n,"State snapshot",i)}async function G4(e,t,n){return At(e,`${t}.json`,n)}async function mwe(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 jI(e,t,n){return W4(e,"releases.jsonl",t,"Release record",n)}async function W4(e,t,n,i,r){let o;for(let s=1;s<=L4;s++)try{let a=await gn(e,t,r),c=a?await hn(a,r):null,l=`${c?`${c.replace(/\n$/,"")}
77
77
  `:""}${n}