buildkeel 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES +3 -3
- package/antigravity/THIRD-PARTY-NOTICES +3 -3
- package/antigravity/agents/bk-break-it-flash.md +25 -0
- package/antigravity/agents/bk-break-it.md +25 -0
- package/antigravity/agents/bk-designer-flash.md +20 -0
- package/antigravity/agents/bk-designer.md +20 -0
- package/antigravity/agents/bk-edge-cases-flash.md +31 -0
- package/antigravity/agents/bk-edge-cases.md +31 -0
- package/antigravity/agents/bk-final-quality-reviewer-flash.md +47 -0
- package/antigravity/agents/bk-final-quality-reviewer.md +47 -0
- package/antigravity/agents/bk-final-spec-reviewer-flash.md +37 -0
- package/antigravity/agents/bk-final-spec-reviewer.md +37 -0
- package/antigravity/agents/bk-implementer-flash.md +40 -0
- package/antigravity/agents/bk-implementer.md +40 -0
- package/antigravity/agents/bk-note-checker-flash.md +26 -0
- package/antigravity/agents/bk-note-checker.md +26 -0
- package/antigravity/agents/bk-quality-reviewer-flash.md +47 -0
- package/antigravity/agents/bk-quality-reviewer.md +47 -0
- package/antigravity/agents/bk-readiness-reader-flash.md +28 -0
- package/antigravity/agents/bk-readiness-reader.md +28 -0
- package/antigravity/agents/bk-spec-reviewer-flash.md +37 -0
- package/antigravity/agents/bk-spec-reviewer.md +37 -0
- package/antigravity/bin/bk-launch.cmd +6 -11
- package/antigravity/bin/bk-start.cjs +4 -1
- package/antigravity/dist/hooks/main.js +127 -118
- package/antigravity/dist/server/main.js +677 -398
- package/antigravity/package.json +1 -1
- package/antigravity/plugin.json +1 -1
- package/antigravity/practices/P-01.md +7 -0
- package/antigravity/practices/P-02.md +7 -0
- package/antigravity/practices/P-03.md +7 -0
- package/antigravity/practices/P-04.md +7 -0
- package/antigravity/practices/P-05.md +7 -0
- package/antigravity/practices/P-06.md +7 -0
- package/antigravity/practices/P-07.md +7 -0
- package/antigravity/practices/P-08.md +7 -0
- package/antigravity/practices/P-09.md +7 -0
- package/antigravity/practices/P-10.md +7 -0
- package/antigravity/practices/P-11.md +7 -0
- package/antigravity/practices/P-12.md +7 -0
- package/antigravity/practices/P-13.md +7 -0
- package/antigravity/practices/P-14.md +7 -0
- package/antigravity/practices/P-15.md +7 -0
- package/antigravity/rules/buildkeel.md +9 -9
- package/antigravity/skills/bk-approve/SKILL.md +2 -2
- package/antigravity/skills/bk-build/SKILL.md +137 -21
- package/antigravity/skills/bk-capture/SKILL.md +45 -12
- package/antigravity/skills/bk-done/SKILL.md +52 -11
- package/antigravity/skills/bk-impact/SKILL.md +1 -1
- package/antigravity/skills/bk-init/SKILL.md +19 -15
- package/antigravity/skills/bk-migrate/SKILL.md +12 -4
- package/antigravity/skills/bk-new/SKILL.md +3 -3
- package/antigravity/skills/bk-onboard/SKILL.md +4 -2
- package/antigravity/skills/bk-pause/SKILL.md +56 -0
- package/antigravity/skills/bk-resume/SKILL.md +35 -0
- package/antigravity/skills/bk-review/SKILL.md +56 -0
- package/antigravity/skills/bk-settings/SKILL.md +2 -2
- package/antigravity/templates/adr.md +31 -0
- package/antigravity/templates/design.md +2 -1
- package/antigravity/templates/spec-driven/proposal.md +2 -1
- package/antigravity/templates/spec-driven/tasks.md +13 -5
- package/antigravity/templates/task.md +23 -2
- package/antigravity/templates/thread.md +41 -0
- package/cli.mjs +85 -85
- package/package.json +1 -1
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
import { createRequire as __bkCreateRequire } from 'node:module'; const require = __bkCreateRequire(import.meta.url);
|
|
2
|
-
var
|
|
3
|
-
`)}};
|
|
4
|
-
`)?
|
|
2
|
+
var Tl=Object.create;var Ai=Object.defineProperty;var $l=Object.getOwnPropertyDescriptor;var Il=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,ql=Object.prototype.hasOwnProperty;var ut=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var y=(n,e)=>()=>{try{return e||n((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var _l=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Il(e))!ql.call(n,i)&&i!==t&&Ai(n,i,{get:()=>e[i],enumerable:!(s=$l(e,i))||s.enumerable});return n};var Le=(n,e,t)=>(t=n!=null?Tl(Ll(n)):{},_l(e||!n||!n.__esModule?Ai(t,"default",{value:n,enumerable:!0}):t,n));var E=y(x=>{"use strict";var Tn=Symbol.for("yaml.alias"),Xi=Symbol.for("yaml.document"),yt=Symbol.for("yaml.map"),Zi=Symbol.for("yaml.pair"),$n=Symbol.for("yaml.scalar"),wt=Symbol.for("yaml.seq"),Y=Symbol.for("yaml.node.type"),Cc=n=>!!n&&typeof n=="object"&&n[Y]===Tn,Oc=n=>!!n&&typeof n=="object"&&n[Y]===Xi,Tc=n=>!!n&&typeof n=="object"&&n[Y]===yt,$c=n=>!!n&&typeof n=="object"&&n[Y]===Zi,er=n=>!!n&&typeof n=="object"&&n[Y]===$n,Ic=n=>!!n&&typeof n=="object"&&n[Y]===wt;function tr(n){if(n&&typeof n=="object")switch(n[Y]){case yt:case wt:return!0}return!1}function Lc(n){if(n&&typeof n=="object")switch(n[Y]){case Tn:case yt:case $n:case wt:return!0}return!1}var qc=n=>(er(n)||tr(n))&&!!n.anchor;x.ALIAS=Tn;x.DOC=Xi;x.MAP=yt;x.NODE_TYPE=Y;x.PAIR=Zi;x.SCALAR=$n;x.SEQ=wt;x.hasAnchor=qc;x.isAlias=Cc;x.isCollection=tr;x.isDocument=Oc;x.isMap=Tc;x.isNode=Lc;x.isPair=$c;x.isScalar=er;x.isSeq=Ic});var _e=y(In=>{"use strict";var _=E(),M=Symbol("break visit"),nr=Symbol("skip children"),H=Symbol("remove node");function bt(n,e){let t=sr(e);_.isDocument(n)?be(null,n.contents,t,Object.freeze([n]))===H&&(n.contents=null):be(null,n,t,Object.freeze([]))}bt.BREAK=M;bt.SKIP=nr;bt.REMOVE=H;function be(n,e,t,s){let i=ir(n,e,t,s);if(_.isNode(i)||_.isPair(i))return rr(n,s,i),be(n,i,t,s);if(typeof i!="symbol"){if(_.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let o=be(r,e.items[r],t,s);if(typeof o=="number")r=o-1;else{if(o===M)return M;o===H&&(e.items.splice(r,1),r-=1)}}}else if(_.isPair(e)){s=Object.freeze(s.concat(e));let r=be("key",e.key,t,s);if(r===M)return M;r===H&&(e.key=null);let o=be("value",e.value,t,s);if(o===M)return M;o===H&&(e.value=null)}}return i}async function kt(n,e){let t=sr(e);_.isDocument(n)?await ke(null,n.contents,t,Object.freeze([n]))===H&&(n.contents=null):await ke(null,n,t,Object.freeze([]))}kt.BREAK=M;kt.SKIP=nr;kt.REMOVE=H;async function ke(n,e,t,s){let i=await ir(n,e,t,s);if(_.isNode(i)||_.isPair(i))return rr(n,s,i),ke(n,i,t,s);if(typeof i!="symbol"){if(_.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let o=await ke(r,e.items[r],t,s);if(typeof o=="number")r=o-1;else{if(o===M)return M;o===H&&(e.items.splice(r,1),r-=1)}}}else if(_.isPair(e)){s=Object.freeze(s.concat(e));let r=await ke("key",e.key,t,s);if(r===M)return M;r===H&&(e.key=null);let o=await ke("value",e.value,t,s);if(o===M)return M;o===H&&(e.value=null)}}return i}function sr(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function ir(n,e,t,s){if(typeof t=="function")return t(n,e,s);if(_.isMap(e))return t.Map?.(n,e,s);if(_.isSeq(e))return t.Seq?.(n,e,s);if(_.isPair(e))return t.Pair?.(n,e,s);if(_.isScalar(e))return t.Scalar?.(n,e,s);if(_.isAlias(e))return t.Alias?.(n,e,s)}function rr(n,e,t){let s=e[e.length-1];if(_.isCollection(s))s.items[n]=t;else if(_.isPair(s))n==="key"?s.key=t:s.value=t;else if(_.isDocument(s))s.contents=t;else{let i=_.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}In.visit=bt;In.visitAsync=kt});var Ln=y(ar=>{"use strict";var or=E(),_c=_e(),xc={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Pc=n=>n.replace(/[!,[\]{}]/g,e=>xc[e]),xe=class n{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},n.defaultYaml,e),this.tags=Object.assign({},n.defaultTags,t)}clone(){let e=new n(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new n(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:n.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},n.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:n.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},n.defaultTags),this.atNextDocument=!1);let s=e.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,s,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return s==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,s]of Object.entries(this.tags))if(e.startsWith(s))return t+Pc(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),i;if(e&&s.length>0&&or.isNode(e.contents)){let r={};_c.visit(e.contents,(o,a)=>{or.isNode(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
3
|
+
`)}};xe.defaultYaml={explicit:!1,version:"1.2"};xe.defaultTags={"!!":"tag:yaml.org,2002:"};ar.Directives=xe});var St=y(Pe=>{"use strict";var lr=E(),Dc=_e();function Mc(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function cr(n){let e=new Set;return Dc.visit(n,{Value(t,s){s.anchor&&e.add(s.anchor)}}),e}function ur(n,e){for(let t=1;;++t){let s=`${n}${t}`;if(!e.has(s))return s}}function Bc(n,e){let t=[],s=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=cr(n));let o=ur(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(lr.isScalar(o.node)||lr.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:s}}Pe.anchorIsValid=Mc;Pe.anchorNames=cr;Pe.createNodeAnchors=Bc;Pe.findNewAnchor=ur});var qn=y(fr=>{"use strict";function De(n,e,t,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;i<r;++i){let o=s[i],a=De(n,s,String(i),o);a===void 0?delete s[i]:a!==o&&(s[i]=a)}else if(s instanceof Map)for(let i of Array.from(s.keys())){let r=s.get(i),o=De(n,s,i,r);o===void 0?s.delete(i):o!==r&&s.set(i,o)}else if(s instanceof Set)for(let i of Array.from(s)){let r=De(n,s,i,i);r===void 0?s.delete(i):r!==i&&(s.delete(i),s.add(r))}else for(let[i,r]of Object.entries(s)){let o=De(n,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return n.call(e,t,s)}fr.applyReviver=De});var G=y(hr=>{"use strict";var Rc=E();function dr(n,e,t){if(Array.isArray(n))return n.map((s,i)=>dr(s,String(i),t));if(n&&typeof n.toJSON=="function"){if(!t||!Rc.hasAnchor(n))return n.toJSON(e,t);let s={aliasCount:0,count:1,res:void 0};t.anchors.set(n,s),t.onCreate=r=>{s.res=r,delete t.onCreate};let i=n.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof n=="bigint"&&!t?.keep?Number(n):n}hr.toJS=dr});var vt=y(mr=>{"use strict";var jc=qn(),pr=E(),Kc=G(),_n=class{constructor(e){Object.defineProperty(this,pr.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!pr.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=Kc.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?jc.applyReviver(r,{"":a},"",a):a}};mr.NodeBase=_n});var Me=y(gr=>{"use strict";var Fc=St(),Hc=_e(),Se=E(),Uc=vt(),Jc=G(),xn=class extends Uc.NodeBase{constructor(e){super(Se.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let s;t?.aliasResolveCache?s=t.aliasResolveCache:(s=[],Hc.visit(e,{Node:(r,o)=>{(Se.isAlias(o)||Se.hasAnchor(o))&&s.push(o)}}),t&&(t.aliasResolveCache=s));let i;for(let r of s){if(r===this)break;r.anchor===this.source&&(i=r)}if(i&&t){let{anchors:r,doc:o,maxAliasCount:a}=t,l=r.get(i);if(l||(Jc.toJS(i,null,t),l=r.get(i)),l?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=At(o,i,r)),l.count*l.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}}return i}toJSON(e,t){if(!t)return{source:this.source};let s=this.resolve(t.doc,t);if(!s){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return t.anchors.get(s).res}toString(e,t,s){let i=`*${this.source}`;if(e){if(Fc.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function At(n,e,t){if(Se.isAlias(e)){let s=e.resolve(n),i=t&&s&&t.get(s);return i?i.count*i.aliasCount:0}else if(Se.isCollection(e)){let s=0;for(let i of e.items){let r=At(n,i,t);r>s&&(s=r)}return s}else if(Se.isPair(e)){let s=At(n,e.key,t),i=At(n,e.value,t);return Math.max(s,i)}return 1}gr.Alias=xn});var I=y(Pn=>{"use strict";var Yc=E(),Vc=vt(),Wc=G(),Gc=n=>!n||typeof n!="function"&&typeof n!="object",Q=class extends Vc.NodeBase{constructor(e){super(Yc.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:Wc.toJS(this.value,e,t)}toString(){return String(this.value)}};Q.BLOCK_FOLDED="BLOCK_FOLDED";Q.BLOCK_LITERAL="BLOCK_LITERAL";Q.PLAIN="PLAIN";Q.QUOTE_DOUBLE="QUOTE_DOUBLE";Q.QUOTE_SINGLE="QUOTE_SINGLE";Pn.Scalar=Q;Pn.isScalarValue=Gc});var Be=y(wr=>{"use strict";var Qc=Me(),le=E(),yr=I(),zc="tag:yaml.org,2002:";function Xc(n,e,t){if(e){let s=t.filter(r=>r.tag===e),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(s=>s.identify?.(n)&&!s.format)}function Zc(n,e,t){if(le.isDocument(n)&&(n=n.contents),le.isNode(n))return n;if(le.isPair(n)){let u=t.schema[le.MAP].createNode?.(t.schema,null,t);return u.items.push(n),u}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(s&&n&&typeof n=="object"){if(l=a.get(n),l)return l.anchor??(l.anchor=i(n)),new Qc.Alias(l.anchor);l={anchor:null,node:null},a.set(n,l)}e?.startsWith("!!")&&(e=zc+e.slice(2));let c=Xc(n,e,o.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let u=new yr.Scalar(n);return l&&(l.node=u),u}c=n instanceof Map?o[le.MAP]:Symbol.iterator in Object(n)?o[le.SEQ]:o[le.MAP]}r&&(r(c),delete t.onTagObj);let d=c?.createNode?c.createNode(t.schema,n,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,n,t):new yr.Scalar(n);return e?d.tag=e:c.default||(d.tag=c.tag),l&&(l.node=d),d}wr.createNode=Zc});var Et=y(Nt=>{"use strict";var eu=Be(),U=E(),tu=vt();function Dn(n,e,t){let s=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return eu.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}var br=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,Mn=class extends tu.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(s=>U.isNode(s)||U.isPair(s)?s.clone(e):s),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(br(e))this.add(t);else{let[s,...i]=e,r=this.get(s,!0);if(U.isCollection(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(s,Dn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(e){let[t,...s]=e;if(s.length===0)return this.delete(t);let i=this.get(t,!0);if(U.isCollection(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`)}getIn(e,t){let[s,...i]=e,r=this.get(s,!0);return i.length===0?!t&&U.isScalar(r)?r.value:r:U.isCollection(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!U.isPair(t))return!1;let s=t.value;return s==null||e&&U.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){let[t,...s]=e;if(s.length===0)return this.has(t);let i=this.get(t,!0);return U.isCollection(i)?i.hasIn(s):!1}setIn(e,t){let[s,...i]=e;if(i.length===0)this.set(s,t);else{let r=this.get(s,!0);if(U.isCollection(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(s,Dn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};Nt.Collection=Mn;Nt.collectionFromPath=Dn;Nt.isEmptyPath=br});var Re=y(Ct=>{"use strict";var nu=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function Bn(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var su=(n,e,t)=>n.endsWith(`
|
|
4
|
+
`)?Bn(t,e):t.includes(`
|
|
5
5
|
`)?`
|
|
6
|
-
`+
|
|
7
|
-
`)t===
|
|
8
|
-
`&&p!==" "){let v=
|
|
9
|
-
`&&v!==" "&&(f=
|
|
10
|
-
${e}${
|
|
11
|
-
${e}${
|
|
12
|
-
`);
|
|
13
|
-
`){if(r-o>
|
|
6
|
+
`+Bn(t,e):(n.endsWith(" ")?"":" ")+t;Ct.indentComment=Bn;Ct.lineComment=su;Ct.stringifyComment=nu});var Sr=y(je=>{"use strict";var iu="flow",Rn="block",Ot="quoted";function ru(n,e,t="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return n;i<r&&(r=0);let l=Math.max(1+r,1+i-e.length);if(n.length<=l)return n;let c=[],d={},u=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):u=i-s);let f,p,g=!1,h=-1,m=-1,w=-1;t===Rn&&(h=kr(n,h,e.length),h!==-1&&(u=h+l));for(let S;S=n[h+=1];){if(t===Ot&&S==="\\"){switch(m=h,n[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}w=h}if(S===`
|
|
7
|
+
`)t===Rn&&(h=kr(n,h,e.length)),u=h+e.length+l,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==`
|
|
8
|
+
`&&p!==" "){let v=n[h+1];v&&v!==" "&&v!==`
|
|
9
|
+
`&&v!==" "&&(f=h)}if(h>=u)if(f)c.push(f),u=f+l,f=void 0;else if(t===Ot){for(;p===" "||p===" ";)p=S,S=n[h+=1],g=!0;let v=h>w+1?h-2:m-1;if(d[v])return n;c.push(v),d[v]=!0,u=v+l,f=void 0}else g=!0}p=S}if(g&&a&&a(),c.length===0)return n;o&&o();let k=n.slice(0,c[0]);for(let S=0;S<c.length;++S){let v=c[S],A=c[S+1]||n.length;v===0?k=`
|
|
10
|
+
${e}${n.slice(0,A)}`:(t===Ot&&d[v]&&(k+=`${n[v]}\\`),k+=`
|
|
11
|
+
${e}${n.slice(v+1,A)}`)}return k}function kr(n,e,t){let s=e,i=e+1,r=n[i];for(;r===" "||r===" ";)if(e<i+t)r=n[++e];else{do r=n[++e];while(r&&r!==`
|
|
12
|
+
`);s=e,i=e+1,r=n[i]}return s}je.FOLD_BLOCK=Rn;je.FOLD_FLOW=iu;je.FOLD_QUOTED=Ot;je.foldFlowLines=ru});var Fe=y(vr=>{"use strict";var K=I(),z=Sr(),$t=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),It=n=>/^(%|---|\.\.\.)/m.test(n);function ou(n,e,t){if(!e||e<0)return!1;let s=e-t,i=n.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(n[r]===`
|
|
13
|
+
`){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function Ke(n,e){let t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(It(n)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let d=t.substr(l+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||t[l+2]==='"'||t.length<i)l+=1;else{for(o+=t.slice(a,l)+`
|
|
14
14
|
|
|
15
15
|
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
|
|
16
|
-
`,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,
|
|
17
|
-
`)||/[ \t]\n|\n[ \t]/.test(
|
|
18
|
-
${t}`)+"'";return e.implicitKey?
|
|
16
|
+
`,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,s?o:z.foldFlowLines(o,r,z.FOLD_QUOTED,$t(e,!1))}function jn(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(n))return Ke(n,e);let t=e.indent||(It(n)?" ":""),s="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${t}`)+"'";return e.implicitKey?s:z.foldFlowLines(s,t,z.FOLD_FLOW,$t(e,!1))}function ve(n,e){let{singleQuote:t}=e.options,s;if(t===!1)s=Ke;else{let i=n.includes('"'),r=n.includes("'");i&&!r?s=jn:r&&!i?s=Ke:s=t?jn:Ke}return s(n,e)}var Kn;try{Kn=new RegExp(`(^|(?<!
|
|
19
19
|
))
|
|
20
20
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{
|
|
21
|
+
|$)`,"g")}catch{Kn=/\n+(?!\n|$)/g}function Tt({comment:n,type:e,value:t},s,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=s.options;if(!o||/\n[\t ]+$/.test(t))return ve(t,s);let c=s.indent||(s.forceBlockIndent||It(t)?" ":""),d=o==="literal"?!0:o==="folded"||e===K.Scalar.BLOCK_FOLDED?!1:e===K.Scalar.BLOCK_LITERAL?!0:!ou(t,l,c.length);if(!t)return d?`|
|
|
22
22
|
`:`>
|
|
23
|
-
`;let u,f;for(f=t.length;f>0;--f){let
|
|
24
|
-
`&&
|
|
25
|
-
`);
|
|
26
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
27
|
-
`)w=m;else break}let
|
|
28
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),
|
|
23
|
+
`;let u,f;for(f=t.length;f>0;--f){let A=t[f-1];if(A!==`
|
|
24
|
+
`&&A!==" "&&A!==" ")break}let p=t.substring(f),g=p.indexOf(`
|
|
25
|
+
`);g===-1?u="-":t===p||g!==p.length-1?(u="+",r&&r()):u="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
|
|
26
|
+
`&&(p=p.slice(0,-1)),p=p.replace(Kn,`$&${c}`));let h=!1,m,w=-1;for(m=0;m<t.length;++m){let A=t[m];if(A===" ")h=!0;else if(A===`
|
|
27
|
+
`)w=m;else break}let k=t.substring(0,w<m?w+1:m);k&&(t=t.substring(k.length),k=k.replace(/\n+/g,`$&${c}`));let v=(h?c?"2":"1":"")+u;if(n&&(v+=" "+a(n.replace(/ ?[\r\n]+/g," ")),i&&i()),!d){let A=t.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),N=!1,O=$t(s,!0);o!=="folded"&&e!==K.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{N=!0});let b=z.foldFlowLines(`${k}${A}${p}`,c,z.FOLD_BLOCK,O);if(!N)return`>${v}
|
|
29
29
|
${c}${b}`}return t=t.replace(/\n+/g,`$&${c}`),`|${v}
|
|
30
|
-
${c}${
|
|
31
|
-
`)||
|
|
32
|
-
`)?
|
|
33
|
-
`))return
|
|
34
|
-
${l}`);if(o){let f=
|
|
35
|
-
${e.indent}${a}`:a}
|
|
36
|
-
${a}:`):(m=`${m}:`,f&&(m+=
|
|
37
|
-
`:"",
|
|
38
|
-
${
|
|
39
|
-
`&&
|
|
30
|
+
${c}${k}${t}${p}`}function au(n,e,t,s){let{type:i,value:r}=n,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:d}=e;if(a&&r.includes(`
|
|
31
|
+
`)||d&&/[[\]{},]/.test(r))return ve(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||d||!r.includes(`
|
|
32
|
+
`)?ve(r,e):Tt(n,e,t,s);if(!a&&!d&&i!==K.Scalar.PLAIN&&r.includes(`
|
|
33
|
+
`))return Tt(n,e,t,s);if(It(r)){if(l==="")return e.forceBlockIndent=!0,Tt(n,e,t,s);if(a&&l===c)return ve(r,e)}let u=r.replace(/\n+/g,`$&
|
|
34
|
+
${l}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:p,tags:g}=e.doc.schema;if(g.some(f)||p?.some(f))return ve(r,e)}return a?u:z.foldFlowLines(u,l,z.FOLD_FLOW,$t(e,!1))}function lu(n,e,t,s){let{implicitKey:i,inFlow:r}=e,o=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)}),{type:a}=n;a!==K.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=K.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case K.Scalar.BLOCK_FOLDED:case K.Scalar.BLOCK_LITERAL:return i||r?ve(o.value,e):Tt(o,e,t,s);case K.Scalar.QUOTE_DOUBLE:return Ke(o.value,e);case K.Scalar.QUOTE_SINGLE:return jn(o.value,e);case K.Scalar.PLAIN:return au(o,e,t,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:d,defaultStringType:u}=e.options,f=i&&d||u;if(c=l(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}vr.stringifyString=lu});var He=y(Fn=>{"use strict";var cu=St(),X=E(),uu=Re(),fu=Fe();function du(n,e){let t=Object.assign({blockQuote:!0,commentString:uu.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},n.schema.toStringOptions,e),s;switch(t.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:s,options:t}}function hu(n,e){if(e.tag){let i=n.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,s;if(X.isScalar(e)){s=e.value;let i=n.filter(r=>r.identify?.(s));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else s=e,t=n.find(i=>i.nodeClass&&s instanceof i.nodeClass);if(!t){let i=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${i} value`)}return t}function pu(n,e,{anchors:t,doc:s}){if(!s.directives)return"";let i=[],r=(X.isScalar(n)||X.isCollection(n))&&n.anchor;r&&cu.anchorIsValid(r)&&(t.add(r),i.push(`&${r}`));let o=n.tag??(e.default?null:e.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function mu(n,e,t,s){if(X.isPair(n))return n.toString(e,t,s);if(X.isAlias(n)){if(e.doc.directives)return n.toString(e);if(e.resolvedAliases?.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let i,r=X.isNode(n)?n:e.doc.createNode(n,{onTagObj:l=>i=l});i??(i=hu(e.doc.schema.tags,r));let o=pu(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,e,t,s):X.isScalar(r)?fu.stringifyString(r,e,t,s):r.toString(e,t,s);return o?X.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
35
|
+
${e.indent}${a}`:a}Fn.createStringifyContext=du;Fn.stringify=mu});var Cr=y(Er=>{"use strict";var V=E(),Ar=I(),Nr=He(),Ue=Re();function gu({key:n,value:e},t,s,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:d,simpleKeys:u}}=t,f=V.isNode(n)&&n.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(V.isCollection(n)||!V.isNode(n)&&typeof n=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let p=!u&&(!n||f&&e==null&&!t.inFlow||V.isCollection(n)||(V.isScalar(n)?n.type===Ar.Scalar.BLOCK_FOLDED||n.type===Ar.Scalar.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(u||!r),indent:a+l});let g=!1,h=!1,m=Nr.stringify(n,t,()=>g=!0,()=>h=!0);if(!p&&!t.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return g&&s&&s(),m===""?"?":p?`? ${m}`:m}else if(r&&!u||e==null&&p)return m=`? ${m}`,f&&!g?m+=Ue.lineComment(m,t.indent,c(f)):h&&i&&i(),m;g&&(f=null),p?(f&&(m+=Ue.lineComment(m,t.indent,c(f))),m=`? ${m}
|
|
36
|
+
${a}:`):(m=`${m}:`,f&&(m+=Ue.lineComment(m,t.indent,c(f))));let w,k,S;V.isNode(e)?(w=!!e.spaceBefore,k=e.commentBefore,S=e.comment):(w=!1,k=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!f&&V.isScalar(e)&&(t.indentAtStart=m.length+1),h=!1,!d&&l.length>=2&&!t.inFlow&&!p&&V.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let v=!1,A=Nr.stringify(e,t,()=>v=!0,()=>h=!0),N=" ";if(f||w||k){if(N=w?`
|
|
37
|
+
`:"",k){let O=c(k);N+=`
|
|
38
|
+
${Ue.indentComment(O,t.indent)}`}A===""&&!t.inFlow?N===`
|
|
39
|
+
`&&S&&(N=`
|
|
40
40
|
|
|
41
|
-
`):
|
|
42
|
-
${t.indent}`}else if(!p&&
|
|
43
|
-
`),L=b!==-1,
|
|
44
|
-
${t.indent}`)}}else(
|
|
45
|
-
`)&&(
|
|
46
|
-
${l}${
|
|
47
|
-
`}}return
|
|
48
|
-
`+
|
|
49
|
-
`)),
|
|
50
|
-
${r}${i}${
|
|
51
|
-
`;return`${
|
|
52
|
-
${i}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function
|
|
53
|
-
`:" ")}return
|
|
54
|
-
${i.key.commentBefore}`:
|
|
55
|
-
${r.comment}`:n.comment}n=i}s.items[t]=$t.isPair(n)?n:new Rs.Pair(n)}}else e("Expected a sequence for this tag");return s}function Sr(s,e,t){let{replacer:n}=t,i=new Fc.YAMLSeq(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(Rs.createPair(a,l,t))}return i}var Hc={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:wr,createNode:Sr};_t.createPairs=Sr;_t.pairs=Hc;_t.resolvePairs=wr});var Hs=g(Fs=>{"use strict";var kr=O(),js=J(),Be=X(),Uc=Z(),vr=Pt(),ie=class s extends Uc.YAMLSeq{constructor(){super(),this.add=Be.YAMLMap.prototype.add.bind(this),this.delete=Be.YAMLMap.prototype.delete.bind(this),this.get=Be.YAMLMap.prototype.get.bind(this),this.has=Be.YAMLMap.prototype.has.bind(this),this.set=Be.YAMLMap.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(kr.isPair(i)?(r=js.toJS(i.key,"",t),o=js.toJS(i.value,r,t)):r=js.toJS(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}static from(e,t,n){let i=vr.createPairs(e,t,n),r=new this;return r.items=i.items,r}};ie.tag="tag:yaml.org,2002:omap";var Yc={collection:"seq",identify:s=>s instanceof Map,nodeClass:ie,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=vr.resolvePairs(s,e),n=[];for(let{key:i}of t.items)kr.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ie,t)},createNode:(s,e,t)=>ie.from(s,e,t)};Fs.YAMLOMap=ie;Fs.omap=Yc});var Cr=g(Us=>{"use strict";var Nr=q();function Ar({value:s,source:e},t){return e&&(s?Or:Er).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var Or={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Nr.Scalar(!0),stringify:Ar},Er={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Nr.Scalar(!1),stringify:Ar};Us.falseTag=Er;Us.trueTag=Or});var Tr=g(Dt=>{"use strict";var Jc=q(),Ys=ye(),Vc={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ys.stringifyNumber},Wc={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():Ys.stringifyNumber(s)}},Gc={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new Jc.Scalar(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Ys.stringifyNumber};Dt.float=Gc;Dt.floatExp=Wc;Dt.floatNaN=Vc});var Lr=g(Ke=>{"use strict";var qr=ye(),xe=s=>typeof s=="bigint"||Number.isInteger(s);function Mt(s,e,t,{intAsBigInt:n}){let i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i==="-"?BigInt(-1)*o:o}let r=parseInt(s,t);return i==="-"?-1*r:r}function Js(s,e,t){let{value:n}=s;if(xe(n)){let i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return qr.stringifyNumber(s)}var Qc={identify:xe,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Mt(s,2,2,t),stringify:s=>Js(s,2,"0b")},zc={identify:xe,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Mt(s,1,8,t),stringify:s=>Js(s,8,"0")},Xc={identify:xe,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Mt(s,0,10,t),stringify:qr.stringifyNumber},Zc={identify:xe,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Mt(s,2,16,t),stringify:s=>Js(s,16,"0x")};Ke.int=Xc;Ke.intBin=Qc;Ke.intHex=Zc;Ke.intOct=zc});var Ws=g(Vs=>{"use strict";var Kt=O(),Bt=Q(),xt=X(),re=class s extends xt.YAMLMap{constructor(e){super(e),this.tag=s.tag}add(e){let t;Kt.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Bt.Pair(e.key,null):t=new Bt.Pair(e,null),xt.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let n=xt.findPair(this.items,e);return!t&&Kt.isPair(n)?Kt.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=xt.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Bt.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(Bt.createPair(o,null,n));return r}};re.tag="tag:yaml.org,2002:set";var eu={collection:"map",identify:s=>s instanceof Set,nodeClass:re,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>re.from(s,e,t),resolve(s,e){if(Kt.isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new re,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};Vs.YAMLSet=re;Vs.set=eu});var Qs=g(Rt=>{"use strict";var tu=ye();function Gs(s,e){let t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return t==="-"?i(-1)*r:r}function Ir(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return tu.stringifyNumber(s);let n="";e<0&&(n="-",e*=t(-1));let i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var su={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Gs(s,t),stringify:Ir},nu={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>Gs(s,!1),stringify:Ir},$r={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){let e=s.match($r.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,n-1,i,r||0,o||0,a||0,l),h=e[8];if(h&&h!=="Z"){let u=Gs(h,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Rt.floatTime=nu;Rt.intTime=su;Rt.timestamp=$r});var Dr=g(Pr=>{"use strict";var iu=me(),ru=Ct(),ou=ge(),au=De(),lu=Ks(),_r=Cr(),zs=Tr(),jt=Lr(),cu=wt(),uu=Hs(),fu=Pt(),du=Ws(),Xs=Qs(),hu=[iu.map,ou.seq,au.string,ru.nullTag,_r.trueTag,_r.falseTag,jt.intBin,jt.intOct,jt.int,jt.intHex,zs.floatNaN,zs.floatExp,zs.float,lu.binary,cu.merge,uu.omap,fu.pairs,du.set,Xs.intTime,Xs.floatTime,Xs.timestamp];Pr.schema=hu});var Yr=g(tn=>{"use strict";var Kr=me(),pu=Ct(),Rr=ge(),mu=De(),gu=Is(),Zs=_s(),en=Ds(),yu=pr(),bu=yr(),jr=Ks(),Re=wt(),Fr=Hs(),Hr=Pt(),Mr=Dr(),Ur=Ws(),Ft=Qs(),Br=new Map([["core",yu.schema],["failsafe",[Kr.map,Rr.seq,mu.string]],["json",bu.schema],["yaml11",Mr.schema],["yaml-1.1",Mr.schema]]),xr={binary:jr.binary,bool:gu.boolTag,float:Zs.float,floatExp:Zs.floatExp,floatNaN:Zs.floatNaN,floatTime:Ft.floatTime,int:en.int,intHex:en.intHex,intOct:en.intOct,intTime:Ft.intTime,map:Kr.map,merge:Re.merge,null:pu.nullTag,omap:Fr.omap,pairs:Hr.pairs,seq:Rr.seq,set:Ur.set,timestamp:Ft.timestamp},wu={"tag:yaml.org,2002:binary":jr.binary,"tag:yaml.org,2002:merge":Re.merge,"tag:yaml.org,2002:omap":Fr.omap,"tag:yaml.org,2002:pairs":Hr.pairs,"tag:yaml.org,2002:set":Ur.set,"tag:yaml.org,2002:timestamp":Ft.timestamp};function Su(s,e,t){let n=Br.get(e);if(n&&!s)return t&&!n.includes(Re.merge)?n.concat(Re.merge):n.slice();let i=n;if(!i)if(Array.isArray(s))i=[];else{let r=Array.from(Br.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(s))for(let r of s)i=i.concat(r);else typeof s=="function"&&(i=s(i.slice()));return t&&(i=i.concat(Re.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?xr[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(xr).map(h=>JSON.stringify(h)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}tn.coreKnownTags=wu;tn.getTags=Su});var rn=g(Jr=>{"use strict";var sn=O(),ku=me(),vu=ge(),Nu=De(),Ht=Yr(),Au=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,nn=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Ht.getTags(e,"compat"):e?Ht.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?Ht.coreKnownTags:{},this.tags=Ht.getTags(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,sn.MAP,{value:ku.map}),Object.defineProperty(this,sn.SCALAR,{value:Nu.string}),Object.defineProperty(this,sn.SEQ,{value:vu.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Au:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Jr.Schema=nn});var Wr=g(Vr=>{"use strict";var Ou=O(),on=$e(),je=Te();function Eu(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");let i=on.createStringifyContext(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");let l=r(s.commentBefore);t.unshift(je.indentComment(l,""))}let o=!1,a=null;if(s.contents){if(Ou.isNode(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){let h=r(s.contents.commentBefore);t.push(je.indentComment(h,""))}i.forceBlockIndent=!!s.comment,a=s.contents.comment}let l=a?void 0:()=>o=!0,c=on.stringify(s.contents,i,()=>a=null,l);a&&(c+=je.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(on.stringify(s.contents,i));if(s.directives?.docEnd)if(s.comment){let l=r(s.comment);l.includes(`
|
|
56
|
-
`)?(t.push("..."),t.push(
|
|
41
|
+
`):N+=`
|
|
42
|
+
${t.indent}`}else if(!p&&V.isCollection(e)){let O=A[0],b=A.indexOf(`
|
|
43
|
+
`),L=b!==-1,W=t.inFlow??e.flow??e.items.length===0;if(L||!W){let ge=!1;if(L&&(O==="&"||O==="!")){let q=A.indexOf(" ");O==="&"&&q!==-1&&q<b&&A[q+1]==="!"&&(q=A.indexOf(" ",q+1)),(q===-1||b<q)&&(ge=!0)}ge||(N=`
|
|
44
|
+
${t.indent}`)}}else(A===""||A[0]===`
|
|
45
|
+
`)&&(N="");return m+=N+A,t.inFlow?v&&s&&s():S&&!v?m+=Ue.lineComment(m,t.indent,c(S)):h&&i&&i(),m}Er.stringifyPair=gu});var Un=y(Hn=>{"use strict";var Or=ut("process");function yu(n,...e){n==="debug"&&console.log(...e)}function wu(n,e){(n==="debug"||n==="warn")&&(typeof Or.emitWarning=="function"?Or.emitWarning(e):console.warn(e))}Hn.debug=yu;Hn.warn=wu});var Pt=y(xt=>{"use strict";var _t=E(),Tr=I(),Lt="<<",qt={identify:n=>n===Lt||typeof n=="symbol"&&n.description===Lt,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Tr.Scalar(Symbol(Lt)),{addToJSMap:$r}),stringify:()=>Lt},bu=(n,e)=>(qt.identify(e)||_t.isScalar(e)&&(!e.type||e.type===Tr.Scalar.PLAIN)&&qt.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===qt.tag&&t.default);function $r(n,e,t){let s=Ir(n,t);if(_t.isSeq(s))for(let i of s.items)Jn(n,e,i);else if(Array.isArray(s))for(let i of s)Jn(n,e,i);else Jn(n,e,s)}function Jn(n,e,t){let s=Ir(n,t);if(!_t.isMap(s))throw new Error("Merge sources must be maps or map aliases");let i=s.toJSON(null,n,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Ir(n,e){return n&&_t.isAlias(e)?e.resolve(n.doc,n):e}xt.addMergeToJSMap=$r;xt.isMergeKey=bu;xt.merge=qt});var Vn=y(_r=>{"use strict";var ku=Un(),Lr=Pt(),Su=He(),qr=E(),Yn=G();function vu(n,e,{key:t,value:s}){if(qr.isNode(t)&&t.addToJSMap)t.addToJSMap(n,e,s);else if(Lr.isMergeKey(n,t))Lr.addMergeToJSMap(n,e,s);else{let i=Yn.toJS(t,"",n);if(e instanceof Map)e.set(i,Yn.toJS(s,i,n));else if(e instanceof Set)e.add(i);else{let r=Au(t,i,n),o=Yn.toJS(s,r,n);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Au(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(qr.isNode(n)&&t?.doc){let s=Su.createStringifyContext(t.doc,{});s.anchors=new Set;for(let r of t.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let i=n.toString(s);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),ku.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}_r.addPairToJSMap=vu});var Z=y(Wn=>{"use strict";var xr=Be(),Nu=Cr(),Eu=Vn(),Dt=E();function Cu(n,e,t){let s=xr.createNode(n,void 0,t),i=xr.createNode(e,void 0,t);return new Mt(s,i)}var Mt=class n{constructor(e,t=null){Object.defineProperty(this,Dt.NODE_TYPE,{value:Dt.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:s}=this;return Dt.isNode(t)&&(t=t.clone(e)),Dt.isNode(s)&&(s=s.clone(e)),new n(t,s)}toJSON(e,t){let s=t?.mapAsMap?new Map:{};return Eu.addPairToJSMap(t,s,this)}toString(e,t,s){return e?.doc?Nu.stringifyPair(this,e,t,s):JSON.stringify(this)}};Wn.Pair=Mt;Wn.createPair=Cu});var Gn=y(Dr=>{"use strict";var ce=E(),Pr=He(),Bt=Re();function Ou(n,e,t){return(e.inFlow??n.flow?$u:Tu)(n,e,t)}function Tu({comment:n,items:e},t,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,d=Object.assign({},t,{indent:r,type:null}),u=!1,f=[];for(let g=0;g<e.length;++g){let h=e[g],m=null;if(ce.isNode(h))!u&&h.spaceBefore&&f.push(""),Rt(t,f,h.commentBefore,u),h.comment&&(m=h.comment);else if(ce.isPair(h)){let k=ce.isNode(h.key)?h.key:null;k&&(!u&&k.spaceBefore&&f.push(""),Rt(t,f,k.commentBefore,u))}u=!1;let w=Pr.stringify(h,d,()=>m=null,()=>u=!0);m&&(w+=Bt.lineComment(w,r,c(m))),u&&m&&(u=!1),f.push(s+w)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let g=1;g<f.length;++g){let h=f[g];p+=h?`
|
|
46
|
+
${l}${h}`:`
|
|
47
|
+
`}}return n?(p+=`
|
|
48
|
+
`+Bt.indentComment(c(n),l),a&&a()):u&&o&&o(),p}function $u({items:n},e,{flowChars:t,itemIndent:s}){let{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;s+=r;let l=Object.assign({},e,{indent:s,inFlow:!0,type:null}),c=!1,d=0,u=[];for(let g=0;g<n.length;++g){let h=n[g],m=null;if(ce.isNode(h))h.spaceBefore&&u.push(""),Rt(e,u,h.commentBefore,!1),h.comment&&(m=h.comment);else if(ce.isPair(h)){let k=ce.isNode(h.key)?h.key:null;k&&(k.spaceBefore&&u.push(""),Rt(e,u,k.commentBefore,!1),k.comment&&(c=!0));let S=ce.isNode(h.value)?h.value:null;S?(S.comment&&(m=S.comment),S.commentBefore&&(c=!0)):h.value==null&&k?.comment&&(m=k.comment)}m&&(c=!0);let w=Pr.stringify(h,l,()=>m=null);c||(c=u.length>d||w.includes(`
|
|
49
|
+
`)),g<n.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=u.reduce((k,S)=>k+S.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),m&&(w+=Bt.lineComment(w,s,a(m))),u.push(w),d=u.length}let{start:f,end:p}=t;if(u.length===0)return f+p;if(!c){let g=u.reduce((h,m)=>h+m.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=f;for(let h of u)g+=h?`
|
|
50
|
+
${r}${i}${h}`:`
|
|
51
|
+
`;return`${g}
|
|
52
|
+
${i}${p}`}else return`${f}${o}${u.join(" ")}${o}${p}`}function Rt({indent:n,options:{commentString:e}},t,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=Bt.indentComment(e(s),n);t.push(r.trimStart())}}Dr.stringifyCollection=Ou});var te=y(zn=>{"use strict";var Iu=Gn(),Lu=Vn(),qu=Et(),ee=E(),jt=Z(),_u=I();function Je(n,e){let t=ee.isScalar(e)?e.value:e;for(let s of n)if(ee.isPair(s)&&(s.key===e||s.key===t||ee.isScalar(s.key)&&s.key.value===t))return s}var Qn=class extends qu.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ee.MAP,e),this.items=[]}static from(e,t,s){let{keepUndefined:i,replacer:r}=s,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(t,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||i)&&o.items.push(jt.createPair(l,c,s))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let s;ee.isPair(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new jt.Pair(e,e?.value):s=new jt.Pair(e.key,e.value);let i=Je(this.items,s.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${s.key} already set`);ee.isScalar(i.value)&&_u.isScalarValue(s.value)?i.value.value=s.value:i.value=s.value}else if(r){let o=this.items.findIndex(a=>r(s,a)<0);o===-1?this.items.push(s):this.items.splice(o,0,s)}else this.items.push(s)}delete(e){let t=Je(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let i=Je(this.items,e)?.value;return(!t&&ee.isScalar(i)?i.value:i)??void 0}has(e){return!!Je(this.items,e)}set(e,t){this.add(new jt.Pair(e,t),!0)}toJSON(e,t,s){let i=s?new s:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(let r of this.items)Lu.addPairToJSMap(t,i,r);return i}toString(e,t,s){if(!e)return JSON.stringify(this);for(let i of this.items)if(!ee.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Iu.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:t})}};zn.YAMLMap=Qn;zn.findPair=Je});var Ae=y(Br=>{"use strict";var xu=E(),Mr=te(),Pu={collection:"map",default:!0,nodeClass:Mr.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(n,e){return xu.isMap(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>Mr.YAMLMap.from(n,e,t)};Br.map=Pu});var ne=y(Rr=>{"use strict";var Du=Be(),Mu=Gn(),Bu=Et(),Ft=E(),Ru=I(),ju=G(),Xn=class extends Bu.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ft.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Kt(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let s=Kt(e);if(typeof s!="number")return;let i=this.items[s];return!t&&Ft.isScalar(i)?i.value:i}has(e){let t=Kt(e);return typeof t=="number"&&t<this.items.length}set(e,t){let s=Kt(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[s];Ft.isScalar(i)&&Ru.isScalarValue(t)?i.value=t:this.items[s]=t}toJSON(e,t){let s=[];t?.onCreate&&t.onCreate(s);let i=0;for(let r of this.items)s.push(ju.toJS(r,String(i++),t));return s}toString(e,t,s){return e?Mu.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:s,onComment:t}):JSON.stringify(this)}static from(e,t,s){let{replacer:i}=s,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof i=="function"){let l=t instanceof Set?a:String(o++);a=i.call(t,l,a)}r.items.push(Du.createNode(a,void 0,s))}}return r}};function Kt(n){let e=Ft.isScalar(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Rr.YAMLSeq=Xn});var Ne=y(Kr=>{"use strict";var Ku=E(),jr=ne(),Fu={collection:"seq",default:!0,nodeClass:jr.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(n,e){return Ku.isSeq(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>jr.YAMLSeq.from(n,e,t)};Kr.seq=Fu});var Ye=y(Fr=>{"use strict";var Hu=Fe(),Uu={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,s){return e=Object.assign({actualString:!0},e),Hu.stringifyString(n,e,t,s)}};Fr.string=Uu});var Ht=y(Jr=>{"use strict";var Hr=I(),Ur={identify:n=>n==null,createNode:()=>new Hr.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Hr.Scalar(null),stringify:({source:n},e)=>typeof n=="string"&&Ur.test.test(n)?n:e.options.nullStr};Jr.nullTag=Ur});var Zn=y(Vr=>{"use strict";var Ju=I(),Yr={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new Ju.Scalar(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&Yr.test.test(n)){let s=n[0]==="t"||n[0]==="T";if(e===s)return n}return e?t.options.trueStr:t.options.falseStr}};Vr.boolTag=Yr});var Ee=y(Wr=>{"use strict";function Yu({format:n,minFractionDigits:e,tag:t,value:s}){if(typeof s=="bigint")return String(s);let i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!n&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}Wr.stringifyNumber=Yu});var ts=y(Ut=>{"use strict";var Vu=I(),es=Ee(),Wu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:es.stringifyNumber},Gu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():es.stringifyNumber(n)}},Qu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){let e=new Vu.Scalar(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:es.stringifyNumber};Ut.float=Qu;Ut.floatExp=Gu;Ut.floatNaN=Wu});var ss=y(Yt=>{"use strict";var Gr=Ee(),Jt=n=>typeof n=="bigint"||Number.isInteger(n),ns=(n,e,t,{intAsBigInt:s})=>s?BigInt(n):parseInt(n.substring(e),t);function Qr(n,e,t){let{value:s}=n;return Jt(s)&&s>=0?t+s.toString(e):Gr.stringifyNumber(n)}var zu={identify:n=>Jt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>ns(n,2,8,t),stringify:n=>Qr(n,8,"0o")},Xu={identify:Jt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>ns(n,0,10,t),stringify:Gr.stringifyNumber},Zu={identify:n=>Jt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>ns(n,2,16,t),stringify:n=>Qr(n,16,"0x")};Yt.int=Xu;Yt.intHex=Zu;Yt.intOct=zu});var Xr=y(zr=>{"use strict";var ef=Ae(),tf=Ht(),nf=Ne(),sf=Ye(),rf=Zn(),is=ts(),rs=ss(),of=[ef.map,nf.seq,sf.string,tf.nullTag,rf.boolTag,rs.intOct,rs.int,rs.intHex,is.floatNaN,is.floatExp,is.float];zr.schema=of});var to=y(eo=>{"use strict";var af=I(),lf=Ae(),cf=Ne();function Zr(n){return typeof n=="bigint"||Number.isInteger(n)}var Vt=({value:n})=>JSON.stringify(n),uf=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:Vt},{identify:n=>n==null,createNode:()=>new af.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Vt},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:Vt},{identify:Zr,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>Zr(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:Vt}],ff={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},df=[lf.map,cf.seq].concat(uf,ff);eo.schema=df});var as=y(no=>{"use strict";var Ve=ut("buffer"),os=I(),hf=Fe(),pf={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof Ve.Buffer=="function")return Ve.Buffer.from(n,"base64");if(typeof atob=="function"){let t=atob(n.replace(/[\n\r]/g,"")),s=new Uint8Array(t.length);for(let i=0;i<t.length;++i)s[i]=t.charCodeAt(i);return s}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},s,i,r){if(!t)return"";let o=t,a;if(typeof Ve.Buffer=="function")a=o instanceof Ve.Buffer?o.toString("base64"):Ve.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=os.Scalar.BLOCK_LITERAL),e!==os.Scalar.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(a.length/l),d=new Array(c);for(let u=0,f=0;u<c;++u,f+=l)d[u]=a.substr(f,l);a=d.join(e===os.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return hf.stringifyString({comment:n,type:e,value:a},s,i,r)}};no.binary=pf});var Qt=y(Gt=>{"use strict";var Wt=E(),ls=Z(),mf=I(),gf=ne();function so(n,e){if(Wt.isSeq(n))for(let t=0;t<n.items.length;++t){let s=n.items[t];if(!Wt.isPair(s)){if(Wt.isMap(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let i=s.items[0]||new ls.Pair(new mf.Scalar(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
|
|
54
|
+
${i.key.commentBefore}`:s.commentBefore),s.comment){let r=i.value??i.key;r.comment=r.comment?`${s.comment}
|
|
55
|
+
${r.comment}`:s.comment}s=i}n.items[t]=Wt.isPair(s)?s:new ls.Pair(s)}}else e("Expected a sequence for this tag");return n}function io(n,e,t){let{replacer:s}=t,i=new gf.YAMLSeq(n);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof s=="function"&&(o=s.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(ls.createPair(a,l,t))}return i}var yf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:so,createNode:io};Gt.createPairs=io;Gt.pairs=yf;Gt.resolvePairs=so});var fs=y(us=>{"use strict";var ro=E(),cs=G(),We=te(),wf=ne(),oo=Qt(),ue=class n extends wf.YAMLSeq{constructor(){super(),this.add=We.YAMLMap.prototype.add.bind(this),this.delete=We.YAMLMap.prototype.delete.bind(this),this.get=We.YAMLMap.prototype.get.bind(this),this.has=We.YAMLMap.prototype.has.bind(this),this.set=We.YAMLMap.prototype.set.bind(this),this.tag=n.tag}toJSON(e,t){if(!t)return super.toJSON(e);let s=new Map;t?.onCreate&&t.onCreate(s);for(let i of this.items){let r,o;if(ro.isPair(i)?(r=cs.toJS(i.key,"",t),o=cs.toJS(i.value,r,t)):r=cs.toJS(i,"",t),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(e,t,s){let i=oo.createPairs(e,t,s),r=new this;return r.items=i.items,r}};ue.tag="tag:yaml.org,2002:omap";var bf={collection:"seq",identify:n=>n instanceof Map,nodeClass:ue,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=oo.resolvePairs(n,e),s=[];for(let{key:i}of t.items)ro.isScalar(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new ue,t)},createNode:(n,e,t)=>ue.from(n,e,t)};us.YAMLOMap=ue;us.omap=bf});var fo=y(ds=>{"use strict";var ao=I();function lo({value:n,source:e},t){return e&&(n?co:uo).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var co={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ao.Scalar(!0),stringify:lo},uo={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ao.Scalar(!1),stringify:lo};ds.falseTag=uo;ds.trueTag=co});var ho=y(zt=>{"use strict";var kf=I(),hs=Ee(),Sf={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:hs.stringifyNumber},vf={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():hs.stringifyNumber(n)}},Af={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){let e=new kf.Scalar(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){let s=n.substring(t+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:hs.stringifyNumber};zt.float=Af;zt.floatExp=vf;zt.floatNaN=Sf});var mo=y(Qe=>{"use strict";var po=Ee(),Ge=n=>typeof n=="bigint"||Number.isInteger(n);function Xt(n,e,t,{intAsBigInt:s}){let i=n[0];if((i==="-"||i==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),s){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}let o=BigInt(n);return i==="-"?BigInt(-1)*o:o}let r=parseInt(n,t);return i==="-"?-1*r:r}function ps(n,e,t){let{value:s}=n;if(Ge(s)){let i=s.toString(e);return s<0?"-"+t+i.substr(1):t+i}return po.stringifyNumber(n)}var Nf={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>Xt(n,2,2,t),stringify:n=>ps(n,2,"0b")},Ef={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>Xt(n,1,8,t),stringify:n=>ps(n,8,"0")},Cf={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>Xt(n,0,10,t),stringify:po.stringifyNumber},Of={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>Xt(n,2,16,t),stringify:n=>ps(n,16,"0x")};Qe.int=Cf;Qe.intBin=Nf;Qe.intHex=Of;Qe.intOct=Ef});var gs=y(ms=>{"use strict";var tn=E(),Zt=Z(),en=te(),fe=class n extends en.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;tn.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Zt.Pair(e.key,null):t=new Zt.Pair(e,null),en.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let s=en.findPair(this.items,e);return!t&&tn.isPair(s)?tn.isScalar(s.key)?s.key.value:s.key:s}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let s=en.findPair(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new Zt.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,s);throw new Error("Set items must all have null values")}static from(e,t,s){let{replacer:i}=s,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(Zt.createPair(o,null,s));return r}};fe.tag="tag:yaml.org,2002:set";var Tf={collection:"map",identify:n=>n instanceof Set,nodeClass:fe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>fe.from(n,e,t),resolve(n,e){if(tn.isMap(n)){if(n.hasAllNullValues(!0))return Object.assign(new fe,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};ms.YAMLSet=fe;ms.set=Tf});var ws=y(nn=>{"use strict";var $f=Ee();function ys(n,e){let t=n[0],s=t==="-"||t==="+"?n.substring(1):n,i=o=>e?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return t==="-"?i(-1)*r:r}function go(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return $f.stringifyNumber(n);let s="";e<0&&(s="-",e*=t(-1));let i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var If={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>ys(n,t),stringify:go},Lf={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>ys(n,!1),stringify:go},yo={identify:n=>n instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(n){let e=n.match(yo.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,s,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,s-1,i,r||0,o||0,a||0,l),d=e[8];if(d&&d!=="Z"){let u=ys(d,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};nn.floatTime=Lf;nn.intTime=If;nn.timestamp=yo});var ko=y(bo=>{"use strict";var qf=Ae(),_f=Ht(),xf=Ne(),Pf=Ye(),Df=as(),wo=fo(),bs=ho(),sn=mo(),Mf=Pt(),Bf=fs(),Rf=Qt(),jf=gs(),ks=ws(),Kf=[qf.map,xf.seq,Pf.string,_f.nullTag,wo.trueTag,wo.falseTag,sn.intBin,sn.intOct,sn.int,sn.intHex,bs.floatNaN,bs.floatExp,bs.float,Df.binary,Mf.merge,Bf.omap,Rf.pairs,jf.set,ks.intTime,ks.floatTime,ks.timestamp];bo.schema=Kf});var Io=y(As=>{"use strict";var No=Ae(),Ff=Ht(),Eo=Ne(),Hf=Ye(),Uf=Zn(),Ss=ts(),vs=ss(),Jf=Xr(),Yf=to(),Co=as(),ze=Pt(),Oo=fs(),To=Qt(),So=ko(),$o=gs(),rn=ws(),vo=new Map([["core",Jf.schema],["failsafe",[No.map,Eo.seq,Hf.string]],["json",Yf.schema],["yaml11",So.schema],["yaml-1.1",So.schema]]),Ao={binary:Co.binary,bool:Uf.boolTag,float:Ss.float,floatExp:Ss.floatExp,floatNaN:Ss.floatNaN,floatTime:rn.floatTime,int:vs.int,intHex:vs.intHex,intOct:vs.intOct,intTime:rn.intTime,map:No.map,merge:ze.merge,null:Ff.nullTag,omap:Oo.omap,pairs:To.pairs,seq:Eo.seq,set:$o.set,timestamp:rn.timestamp},Vf={"tag:yaml.org,2002:binary":Co.binary,"tag:yaml.org,2002:merge":ze.merge,"tag:yaml.org,2002:omap":Oo.omap,"tag:yaml.org,2002:pairs":To.pairs,"tag:yaml.org,2002:set":$o.set,"tag:yaml.org,2002:timestamp":rn.timestamp};function Wf(n,e,t){let s=vo.get(e);if(s&&!n)return t&&!s.includes(ze.merge)?s.concat(ze.merge):s.slice();let i=s;if(!i)if(Array.isArray(n))i=[];else{let r=Array.from(vo.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(n))for(let r of n)i=i.concat(r);else typeof n=="function"&&(i=n(i.slice()));return t&&(i=i.concat(ze.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Ao[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Ao).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}As.coreKnownTags=Vf;As.getTags=Wf});var Cs=y(Lo=>{"use strict";var Ns=E(),Gf=Ae(),Qf=Ne(),zf=Ye(),on=Io(),Xf=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,Es=class n{constructor({compat:e,customTags:t,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?on.getTags(e,"compat"):e?on.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?on.coreKnownTags:{},this.tags=on.getTags(t,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,Ns.MAP,{value:Gf.map}),Object.defineProperty(this,Ns.SCALAR,{value:zf.string}),Object.defineProperty(this,Ns.SEQ,{value:Qf.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Xf:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Lo.Schema=Es});var _o=y(qo=>{"use strict";var Zf=E(),Os=He(),Xe=Re();function ed(n,e){let t=[],s=e.directives===!0;if(e.directives!==!1&&n.directives){let l=n.directives.toString(n);l?(t.push(l),s=!0):n.directives.docStart&&(s=!0)}s&&t.push("---");let i=Os.createStringifyContext(n,e),{commentString:r}=i.options;if(n.commentBefore){t.length!==1&&t.unshift("");let l=r(n.commentBefore);t.unshift(Xe.indentComment(l,""))}let o=!1,a=null;if(n.contents){if(Zf.isNode(n.contents)){if(n.contents.spaceBefore&&s&&t.push(""),n.contents.commentBefore){let d=r(n.contents.commentBefore);t.push(Xe.indentComment(d,""))}i.forceBlockIndent=!!n.comment,a=n.contents.comment}let l=a?void 0:()=>o=!0,c=Os.stringify(n.contents,i,()=>a=null,l);a&&(c+=Xe.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(Os.stringify(n.contents,i));if(n.directives?.docEnd)if(n.comment){let l=r(n.comment);l.includes(`
|
|
56
|
+
`)?(t.push("..."),t.push(Xe.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=n.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(Xe.indentComment(r(l),"")))}return t.join(`
|
|
57
57
|
`)+`
|
|
58
|
-
`}
|
|
59
|
-
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l?.line===
|
|
58
|
+
`}qo.stringifyDocument=ed});var Ze=y(xo=>{"use strict";var td=Me(),Ce=Et(),j=E(),nd=Z(),sd=G(),id=Cs(),rd=_o(),Ts=St(),od=qn(),ad=Be(),$s=Ln(),Is=class n{constructor(e,t,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,j.NODE_TYPE,{value:j.DOC});let i=null;typeof t=="function"||Array.isArray(t)?i=t:s===void 0&&t&&(s=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new $s.Directives({version:o}),this.setSchema(o,s),this.contents=e===void 0?null:this.createNode(e,i,s)}clone(){let e=Object.create(n.prototype,{[j.NODE_TYPE]:{value:j.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=j.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Oe(this.contents)&&this.contents.add(e)}addIn(e,t){Oe(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let s=Ts.anchorNames(this);e.anchor=!t||s.has(t)?Ts.findNewAnchor(t||"a",s):t}return new td.Alias(e.anchor)}createNode(e,t,s){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){let m=k=>typeof k=="number"||k instanceof String||k instanceof Number,w=t.filter(m).map(String);w.length>0&&(t=t.concat(w)),i=t}else s===void 0&&t&&(s=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:d}=s??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=Ts.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},h=ad.createNode(e,d,g);return a&&j.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,t,s={}){let i=this.createNode(e,null,s),r=this.createNode(t,null,s);return new nd.Pair(i,r)}delete(e){return Oe(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ce.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Oe(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return j.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ce.isEmptyPath(e)?!t&&j.isScalar(this.contents)?this.contents.value:this.contents:j.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return j.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ce.isEmptyPath(e)?this.contents!==void 0:j.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ce.collectionFromPath(this.schema,[e],t):Oe(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ce.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Ce.collectionFromPath(this.schema,Array.from(e),t):Oe(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new $s.Directives({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new $s.Directives({version:e}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(s)this.schema=new id.Schema(Object.assign(s,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=sd.toJS(this.contents,t??"",a);if(typeof r=="function")for(let{count:c,res:d}of a.anchors.values())r(d,c);return typeof o=="function"?od.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return rd.stringifyDocument(this,e)}};function Oe(n){if(j.isCollection(n))return!0;throw new Error("Expected a YAML collection as document contents")}xo.Document=Is});var nt=y(tt=>{"use strict";var et=class extends Error{constructor(e,t,s,i){super(),this.name=e,this.code=s,this.message=i,this.pos=t}},Ls=class extends et{constructor(e,t,s){super("YAMLParseError",e,t,s)}},qs=class extends et{constructor(e,t,s){super("YAMLWarning",e,t,s)}},ld=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:s,col:i}=t.linePos[0];t.message+=` at line ${s}, column ${i}`;let r=i-1,o=n.substring(e.lineStarts[s-1],e.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,r))){let a=n.substring(e.lineStarts[s-2],e.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
59
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l?.line===s&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-r)));let c=" ".repeat(r)+"^".repeat(a);t.message+=`:
|
|
60
60
|
|
|
61
61
|
${o}
|
|
62
62
|
${c}
|
|
63
|
-
`}};
|
|
64
|
-
`))return!0;if(
|
|
65
|
-
`+
|
|
66
|
-
`+
|
|
67
|
-
`+
|
|
68
|
-
`+
|
|
69
|
-
`+L.comment:b.comment=L.comment);let
|
|
70
|
-
`+m.comment:c.comment=m.comment),c.range=[
|
|
71
|
-
`.repeat(Math.max(1,o.length-1)):"",m=
|
|
72
|
-
`;for(let d
|
|
63
|
+
`}};tt.YAMLError=et;tt.YAMLParseError=Ls;tt.YAMLWarning=qs;tt.prettifyError=ld});var st=y(Po=>{"use strict";function cd(n,{flow:e,indicator:t,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,d=a,u="",f="",p=!1,g=!1,h=null,m=null,w=null,k=null,S=null,v=null,A=null;for(let b of n)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&r(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),h&&(c&&b.type!=="comment"&&b.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),b.type){case"space":!e&&(t!=="doc-start"||s?.type!=="flow-collection")&&b.source.includes(" ")&&(h=b),d=!0;break;case"comment":{d||r(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=b.source.substring(1)||" ";u?u+=f+L:u=L,f="",c=!1;break}case"newline":c?u?u+=b.source:(!v||t!=="seq-item-ind")&&(l=!0):f+=b.source,c=!0,p=!0,(m||w)&&(k=b),d=!0;break;case"anchor":m&&r(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&r(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=b,A??(A=b.offset),c=!1,d=!1,g=!0;break;case"tag":{w&&r(b,"MULTIPLE_TAGS","A node can have at most one tag"),w=b,A??(A=b.offset),c=!1,d=!1,g=!0;break}case t:(m||w)&&r(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),v&&r(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),v=b,c=t==="seq-item-ind"||t==="explicit-key-ind",d=!1;break;case"comma":if(e){S&&r(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=b,c=!1,d=!1;break}default:r(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),c=!1,d=!1}let N=n[n.length-1],O=N?N.offset+N.source.length:i;return g&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(c&&h.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:v,spaceBefore:l,comment:u,hasNewline:p,anchor:m,tag:w,newlineAfterProp:k,end:O,start:A??O}}Po.resolveProps=cd});var an=y(Do=>{"use strict";function _s(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
|
|
64
|
+
`))return!0;if(n.end){for(let e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of n.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(_s(e.key)||_s(e.value))return!0}return!1;default:return!0}}Do.containsNewline=_s});var xs=y(Mo=>{"use strict";var ud=an();function fd(n,e,t){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===n&&(s.source==="]"||s.source==="}")&&ud.containsNewline(e)&&t(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Mo.flowIndentCheck=fd});var Ps=y(Ro=>{"use strict";var Bo=E();function dd(n,e,t){let{uniqueKeys:s}=n.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||Bo.isScalar(r)&&Bo.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}Ro.mapIncludes=dd});var Jo=y(Uo=>{"use strict";var jo=Z(),hd=te(),Ko=st(),pd=an(),Fo=xs(),md=Ps(),Ho="All mapping items must start at the same column";function gd({composeNode:n,composeEmptyNode:e},t,s,i,r){let o=r?.nodeClass??hd.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=s.offset,c=null;for(let d of s.items){let{start:u,key:f,sep:p,value:g}=d,h=Ko.resolveProps(u,{indicator:"explicit-key-ind",next:f??p?.[0],offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0}),m=!h.found;if(m){if(f&&(f.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==s.indent&&i(l,"BAD_INDENT",Ho)),!h.anchor&&!h.tag&&!p){c=h.end,h.comment&&(a.comment?a.comment+=`
|
|
65
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||pd.containsNewline(f))&&i(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==s.indent&&i(l,"BAD_INDENT",Ho);t.atKey=!0;let w=h.end,k=f?n(t,f,h,i):e(t,w,u,null,h,i);t.schema.compat&&Fo.flowIndentCheck(s.indent,f,i),t.atKey=!1,md.mapIncludes(t,a.items,k)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let S=Ko.resolveProps(p??[],{indicator:"map-value-ind",next:g,offset:k.range[2],onError:i,parentIndent:s.indent,startOnNewline:!f||f.type==="block-scalar"});if(l=S.end,S.found){m&&(g?.type==="block-map"&&!S.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&h.start<S.found.offset-1024&&i(k.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let v=g?n(t,g,S,i):e(t,l,p,null,S,i);t.schema.compat&&Fo.flowIndentCheck(s.indent,g,i),l=v.range[2];let A=new jo.Pair(k,v);t.options.keepSourceTokens&&(A.srcToken=d),a.items.push(A)}else{m&&i(k.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(k.comment?k.comment+=`
|
|
66
|
+
`+S.comment:k.comment=S.comment);let v=new jo.Pair(k);t.options.keepSourceTokens&&(v.srcToken=d),a.items.push(v)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}Uo.resolveBlockMap=gd});var Vo=y(Yo=>{"use strict";var yd=ne(),wd=st(),bd=xs();function kd({composeNode:n,composeEmptyNode:e},t,s,i,r){let o=r?.nodeClass??yd.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=s.offset,c=null;for(let{start:d,value:u}of s.items){let f=wd.resolveProps(d,{indicator:"seq-item-ind",next:u,offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(a.comment=f.comment);continue}let p=u?n(t,u,f,i):e(t,f.end,d,null,f,i);t.schema.compat&&bd.flowIndentCheck(s.indent,u,i),l=p.range[2],a.items.push(p)}return a.range=[s.offset,l,c??l],a}Yo.resolveBlockSeq=kd});var Te=y(Wo=>{"use strict";function Sd(n,e,t,s){let i="";if(n){let r=!1,o="";for(let a of n){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";i?i+=o+d:i=d,o="";break}case"newline":i&&(o+=l),r=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}Wo.resolveEnd=Sd});var Xo=y(zo=>{"use strict";var vd=E(),Ad=Z(),Go=te(),Nd=ne(),Ed=Te(),Qo=st(),Cd=an(),Od=Ps(),Ds="Block collections are not allowed within flow collections",Ms=n=>n&&(n.type==="block-map"||n.type==="block-seq");function Td({composeNode:n,composeEmptyNode:e},t,s,i,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?Go.YAMLMap:Nd.YAMLSeq),c=new l(t.schema);c.flow=!0;let d=t.atRoot;d&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=s.offset+s.start.source.length;for(let m=0;m<s.items.length;++m){let w=s.items[m],{start:k,key:S,sep:v,value:A}=w,N=Qo.resolveProps(k,{flow:a,indicator:"explicit-key-ind",next:S??v?.[0],offset:u,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!v&&!A){m===0&&N.comma?i(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<s.items.length-1&&i(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),N.comment&&(c.comment?c.comment+=`
|
|
67
|
+
`+N.comment:c.comment=N.comment),u=N.end;continue}!o&&t.options.strict&&Cd.containsNewline(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)N.comma&&i(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(N.comma||i(N.start,"MISSING_CHAR",`Missing , between ${a} items`),N.comment){let O="";e:for(let b of k)switch(b.type){case"comma":case"space":break;case"comment":O=b.source.substring(1);break e;default:break e}if(O){let b=c.items[c.items.length-1];vd.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
|
|
68
|
+
`+O:b.comment=O,N.comment=N.comment.substring(O.length+1)}}if(!o&&!v&&!N.found){let O=A?n(t,A,N,i):e(t,N.end,v,null,N,i);c.items.push(O),u=O.range[2],Ms(A)&&i(O.range,"BLOCK_IN_FLOW",Ds)}else{t.atKey=!0;let O=N.end,b=S?n(t,S,N,i):e(t,O,k,null,N,i);Ms(S)&&i(b.range,"BLOCK_IN_FLOW",Ds),t.atKey=!1;let L=Qo.resolveProps(v??[],{flow:a,indicator:"map-value-ind",next:A,offset:b.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(L.found){if(!o&&!N.found&&t.options.strict){if(v)for(let q of v){if(q===L.found)break;if(q.type==="newline"){i(q,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}N.start<L.found.offset-1024&&i(L.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else A&&("source"in A&&A.source?.[0]===":"?i(A,"MISSING_CHAR",`Missing space after : in ${a}`):i(L.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let W=A?n(t,A,L,i):L.found?e(t,L.end,v,null,L,i):null;W?Ms(A)&&i(W.range,"BLOCK_IN_FLOW",Ds):L.comment&&(b.comment?b.comment+=`
|
|
69
|
+
`+L.comment:b.comment=L.comment);let ge=new Ad.Pair(b,W);if(t.options.keepSourceTokens&&(ge.srcToken=w),o){let q=c;Od.mapIncludes(t,q.items,b)&&i(O,"DUPLICATE_KEY","Map keys must be unique"),q.items.push(ge)}else{let q=new Go.YAMLMap(t.schema);q.flow=!0,q.items.push(ge);let vi=(W??b).range;q.range=[b.range[0],vi[1],vi[2]],c.items.push(q)}u=W?W.range[2]:L.end}}let f=o?"}":"]",[p,...g]=s.end,h=u;if(p?.source===f)h=p.offset+p.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=d?`${m} must end with a ${f}`:`${m} in block collection must be sufficiently indented and end with a ${f}`;i(u,d?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let m=Ed.resolveEnd(g,h,t.options.strict,i);m.comment&&(c.comment?c.comment+=`
|
|
70
|
+
`+m.comment:c.comment=m.comment),c.range=[s.offset,h,m.offset]}else c.range=[s.offset,h,h];return c}zo.resolveFlowCollection=Td});var ea=y(Zo=>{"use strict";var $d=E(),Id=I(),Ld=te(),qd=ne(),_d=Jo(),xd=Vo(),Pd=Xo();function Bs(n,e,t,s,i,r){let o=t.type==="block-map"?_d.resolveBlockMap(n,e,t,s,r):t.type==="block-seq"?xd.resolveBlockSeq(n,e,t,s,r):Pd.resolveFlowCollection(n,e,t,s,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function Dd(n,e,t,s,i){let r=s.tag,o=r?e.directives.tagName(r.source,f=>i(r,"TAG_RESOLVE_FAILED",f)):null;if(t.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=s,g=f&&r?f.offset>r.offset?f:r:f??r;g&&(!p||p.offset<g.offset)&&i(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===Ld.YAMLMap.tagName&&a==="map"||o===qd.YAMLSeq.tagName&&a==="seq")return Bs(n,e,t,i,o);let l=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!l){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),l=f;else return f?i(r,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Bs(n,e,t,i,o)}let c=Bs(n,e,t,i,o,l),d=l.resolve?.(c,f=>i(r,"TAG_RESOLVE_FAILED",f),e.options)??c,u=$d.isNode(d)?d:new Id.Scalar(d);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}Zo.composeCollection=Dd});var js=y(ta=>{"use strict";var Rs=I();function Md(n,e,t){let s=e.offset,i=Bd(e,n.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?Rs.Scalar.BLOCK_FOLDED:Rs.Scalar.BLOCK_LITERAL,o=e.source?Rd(e.source):[],a=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===""||m==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&o.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,o.length-1)):"",m=s+i.length;return e.source&&(m+=e.source.length),{value:h,type:r,comment:i.comment,range:[s,m,m]}}let l=e.indent+i.indent,c=e.offset+i.length,d=0;for(let h=0;h<a;++h){let[m,w]=o[h];if(w===""||w==="\r")i.indent===0&&m.length>l&&(l=m.length);else{m.length<l&&t(c+m.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=m.length),d=h,l===0&&!n.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=m.length+w.length+1}for(let h=o.length-1;h>=a;--h)o[h][0].length>l&&(a=h+1);let u="",f="",p=!1;for(let h=0;h<d;++h)u+=o[h][0].slice(l)+`
|
|
72
|
+
`;for(let h=d;h<a;++h){let[m,w]=o[h];c+=m.length+w.length+1;let k=w[w.length-1]==="\r";if(k&&(w=w.slice(0,-1)),w&&m.length<l){let v=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-w.length-(k?2:1),"BAD_INDENT",v),m=""}r===Rs.Scalar.BLOCK_LITERAL?(u+=f+m.slice(l)+w,f=`
|
|
73
73
|
`):m.length>l||w[0]===" "?(f===" "?f=`
|
|
74
74
|
`:!p&&f===`
|
|
75
75
|
`&&(f=`
|
|
@@ -78,81 +78,90 @@ ${c}
|
|
|
78
78
|
`,p=!0):w===""?f===`
|
|
79
79
|
`?u+=`
|
|
80
80
|
`:f=`
|
|
81
|
-
`:(u+=f+w,f=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let
|
|
82
|
-
`+o[
|
|
81
|
+
`:(u+=f+w,f=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h<o.length;++h)u+=`
|
|
82
|
+
`+o[h][0].slice(l);u[u.length-1]!==`
|
|
83
83
|
`&&(u+=`
|
|
84
84
|
`);break;default:u+=`
|
|
85
|
-
`}let
|
|
85
|
+
`}let g=s+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[s,g,g]}}function Bd({offset:n,props:e},t,s){if(e[0].type!=="block-scalar-header")return s(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],r=i[0],o=0,a="",l=-1;for(let f=1;f<i.length;++f){let p=i[f];if(!a&&(p==="-"||p==="+"))a=p;else{let g=Number(p);!o&&g?o=g:l===-1&&(l=n+f)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,d="",u=i.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":c=!0;case"newline":u+=p.source.length;break;case"comment":t&&!c&&s(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,d=p.source.substring(1);break;case"error":s(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;s(p,"UNEXPECTED_TOKEN",g);let h=p.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:r,indent:o,chomp:a,comment:d,length:u}}function Rd(n){let e=n.split(/\n( *)/),t=e[0],s=t.match(/^( *)/),r=[s?.[1]?[s[1],t.slice(s[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}ta.resolveBlockScalar=Md});var Fs=y(sa=>{"use strict";var Ks=I(),jd=Te();function Kd(n,e,t){let{offset:s,type:i,source:r,end:o}=n,a,l,c=(f,p,g)=>t(s+f,p,g);switch(i){case"scalar":a=Ks.Scalar.PLAIN,l=Fd(r,c);break;case"single-quoted-scalar":a=Ks.Scalar.QUOTE_SINGLE,l=Hd(r,c);break;case"double-quoted-scalar":a=Ks.Scalar.QUOTE_DOUBLE,l=Ud(r,c);break;default:return t(n,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let d=s+r.length,u=jd.resolveEnd(o,d,e,t);return{value:l,type:a,comment:u.comment,range:[s,d,u.offset]}}function Fd(n,e){let t="";switch(n[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),na(n)}function Hd(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),na(n.slice(1,-1)).replace(/''/g,"'")}function na(n){let e=/(.*?)\r?\n/sy,t=e.exec(n);if(!t)return n;let s,i;try{s=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{s=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let r=t[1].replace(s,""),o=" ",a=e.lastIndex;for(;t=e.exec(n);){let c=t[1].replace(i,"");c===""?o===`
|
|
86
86
|
`?r+=o:o=`
|
|
87
|
-
`:(r+=o+c,o=" "),a=e.lastIndex}let l=/[ \t]*(.*)/sy;return l.lastIndex=a,t=l.exec(
|
|
87
|
+
`:(r+=o+c,o=" "),a=e.lastIndex}let l=/[ \t]*(.*)/sy;return l.lastIndex=a,t=l.exec(n),r+o+(t?.[1]??"")}function Ud(n,e){let t="";for(let s=1;s<n.length-1;++s){let i=n[s];if(!(i==="\r"&&n[s+1]===`
|
|
88
88
|
`))if(i===`
|
|
89
|
-
`){let{fold:r,offset:o}=
|
|
90
|
-
`)for(r=s
|
|
91
|
-
`)for(r=
|
|
92
|
-
`&&!(o==="\r"&&s
|
|
93
|
-
`)&&(t+=
|
|
94
|
-
`||
|
|
95
|
-
`);)
|
|
89
|
+
`){let{fold:r,offset:o}=Jd(n,s);t+=r,s=o}else if(i==="\\"){let r=n[++s],o=Yd[r];if(o)t+=o;else if(r===`
|
|
90
|
+
`)for(r=n[s+1];r===" "||r===" ";)r=n[++s+1];else if(r==="\r"&&n[s+1]===`
|
|
91
|
+
`)for(r=n[++s+1];r===" "||r===" ";)r=n[++s+1];else if(r==="x"||r==="u"||r==="U"){let a=r==="x"?2:r==="u"?4:8;t+=Vd(n,s+1,a,e),s+=a}else{let a=n.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(i===" "||i===" "){let r=s,o=n[s+1];for(;o===" "||o===" ";)o=n[++s+1];o!==`
|
|
92
|
+
`&&!(o==="\r"&&n[s+2]===`
|
|
93
|
+
`)&&(t+=s>r?n.slice(r,s+1):i)}else t+=i}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function Jd(n,e){let t="",s=n[e+1];for(;(s===" "||s===" "||s===`
|
|
94
|
+
`||s==="\r")&&!(s==="\r"&&n[e+2]!==`
|
|
95
|
+
`);)s===`
|
|
96
96
|
`&&(t+=`
|
|
97
|
-
`),e+=1,n
|
|
98
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
97
|
+
`),e+=1,s=n[e+1];return t||(t=" "),{fold:t,offset:e}}var Yd={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
98
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Vd(n,e,t,s){let i=n.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(o)}catch{let a=n.substr(e-2,t+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}sa.resolveFlowScalar=Kd});var oa=y(ra=>{"use strict";var de=E(),ia=I(),Wd=js(),Gd=Fs();function Qd(n,e,t,s){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?Wd.resolveBlockScalar(n,e,s):Gd.resolveFlowScalar(e,n.options.strict,s),l=t?n.directives.tagName(t.source,u=>s(t,"TAG_RESOLVE_FAILED",u)):null,c;n.options.stringKeys&&n.atKey?c=n.schema[de.SCALAR]:l?c=zd(n.schema,i,l,t,s):e.type==="scalar"?c=Xd(n,i,e,s):c=n.schema[de.SCALAR];let d;try{let u=c.resolve(i,f=>s(t??e,"TAG_RESOLVE_FAILED",f),n.options);d=de.isScalar(u)?u:new ia.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);s(t??e,"TAG_RESOLVE_FAILED",f),d=new ia.Scalar(i)}return d.range=a,d.source=i,r&&(d.type=r),l&&(d.tag=l),c.format&&(d.format=c.format),o&&(d.comment=o),d}function zd(n,e,t,s,i){if(t==="!")return n[de.SCALAR];let r=[];for(let a of n.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=n.knownTags[t];return o&&!o.collection?(n.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[de.SCALAR])}function Xd({atKey:n,directives:e,schema:t},s,i,r){let o=t.tags.find(a=>(a.default===!0||n&&a.default==="key")&&a.test?.test(s))||t[de.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(s))??t[de.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),d=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",d,!0)}}return o}ra.composeScalar=Qd});var la=y(aa=>{"use strict";function Zd(n,e,t){if(e){t??(t=e.length);for(let s=t-1;s>=0;--s){let i=e[s];switch(i.type){case"space":case"comment":case"newline":n-=i.source.length;continue}for(i=e[++s];i?.type==="space";)n+=i.source.length,i=e[++s];break}}return n}aa.emptyScalarPosition=Zd});var fa=y(Us=>{"use strict";var eh=Me(),th=E(),nh=ea(),ca=oa(),sh=Te(),ih=la(),rh={composeNode:ua,composeEmptyNode:Hs};function ua(n,e,t,s){let i=n.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t,c,d=!0;switch(e.type){case"alias":c=oh(n,e,s),(a||l)&&s(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=ca.composeScalar(n,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=nh.composeCollection(rh,n,e,t,s),a&&(c.anchor=a.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);s(e,"RESOURCE_EXHAUSTION",f)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",u),d=!1}}return c??(c=Hs(n,e.offset,void 0,null,t,s)),a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&n.options.stringKeys&&(!th.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),n.options.keepSourceTokens&&d&&(c.srcToken=e),c}function Hs(n,e,t,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let d={type:"scalar",offset:ih.emptyScalarPosition(e,t,s),indent:-1,source:""},u=ca.composeScalar(n,d,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function oh({options:n},{offset:e,source:t,end:s},i){let r=new eh.Alias(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=sh.resolveEnd(s,o,n.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}Us.composeEmptyNode=Hs;Us.composeNode=ua});var pa=y(ha=>{"use strict";var ah=Ze(),da=fa(),lh=Te(),ch=st();function uh(n,e,{offset:t,start:s,value:i,end:r},o){let a=Object.assign({_directives:e},n),l=new ah.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=ch.resolveProps(s,{indicator:"doc-start",next:i??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?da.composeNode(c,i,d,o):da.composeEmptyNode(c,d.end,s,null,d,o);let u=l.contents.range[2],f=lh.resolveEnd(r,u,!1,o);return f.comment&&(l.comment=f.comment),l.range=[t,u,f.offset],l}ha.composeDoc=uh});var Ys=y(ya=>{"use strict";var fh=ut("process"),dh=Ln(),hh=Ze(),it=nt(),ma=E(),ph=pa(),mh=Te();function rt(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];let{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function ga(n){let e="",t=!1,s=!1;for(let i=0;i<n.length;++i){let r=n[i];switch(r[0]){case"#":e+=(e===""?"":s?`
|
|
99
99
|
|
|
100
100
|
`:`
|
|
101
|
-
`)+(r.substring(1)||" "),t=!0,
|
|
102
|
-
${
|
|
103
|
-
${a}`:
|
|
104
|
-
${o}`:
|
|
105
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new
|
|
101
|
+
`)+(r.substring(1)||" "),t=!0,s=!1;break;case"%":n[i+1]?.[0]!=="#"&&(i+=1),t=!1;break;default:t||(s=!0),t=!1}}return{comment:e,afterEmptyLine:s}}var Js=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,s,i,r)=>{let o=rt(t);r?this.warnings.push(new it.YAMLWarning(o,s,i)):this.errors.push(new it.YAMLParseError(o,s,i))},this.directives=new dh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:s,afterEmptyLine:i}=ga(this.prelude);if(s){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
102
|
+
${s}`:s;else if(i||e.directives.docStart||!r)e.commentBefore=s;else if(ma.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];ma.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
|
|
103
|
+
${a}`:s}else{let o=r.commentBefore;r.commentBefore=o?`${s}
|
|
104
|
+
${o}`:s}}if(t){for(let r=0;r<this.errors.length;++r)e.errors.push(this.errors[r]);for(let r=0;r<this.warnings.length;++r)e.warnings.push(this.warnings[r])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:ga(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,s=-1){for(let i of e)yield*this.next(i);yield*this.end(t,s)}*next(e){switch(fh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,s,i)=>{let r=rt(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=ph.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new it.YAMLParseError(rt(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){let s="Unexpected doc-end without preceding document";this.errors.push(new it.YAMLParseError(rt(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let t=mh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
|
|
105
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new it.YAMLParseError(rt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let s=Object.assign({_directives:this.directives},this.options),i=new hh.Document(void 0,s);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};ya.Composer=Js});var ka=y(ln=>{"use strict";var gh=js(),yh=Fs(),wh=nt(),wa=Fe();function bh(n,e=!0,t){if(n){let s=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(a,r,o);else throw new wh.YAMLParseError([a,a+1],r,o)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yh.resolveFlowScalar(n,e,s);case"block-scalar":return gh.resolveBlockScalar({options:{strict:e}},n,s)}}return null}function kh(n,e){let{implicitKey:t=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=wa.stringifyString({type:o,value:n},{implicitKey:t,indent:s>0?" ".repeat(s):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:s,source:`
|
|
106
106
|
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
107
|
-
`),
|
|
108
|
-
`,f=[{type:"block-scalar-header",offset:r,indent:
|
|
109
|
-
`}),{type:"block-scalar",offset:r,indent:
|
|
110
|
-
`),
|
|
111
|
-
`;if(
|
|
112
|
-
`});for(let l of Object.keys(
|
|
113
|
-
`};delete
|
|
107
|
+
`),d=a.substring(0,c),u=a.substring(c+1)+`
|
|
108
|
+
`,f=[{type:"block-scalar-header",offset:r,indent:s,source:d}];return ba(f,l)||f.push({type:"newline",offset:-1,indent:s,source:`
|
|
109
|
+
`}),{type:"block-scalar",offset:r,indent:s,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:r,indent:s,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:s,source:a,end:l};default:return{type:"scalar",offset:r,indent:s,source:a,end:l}}}function Sh(n,e,t={}){let{afterKey:s=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,a="indent"in n?n.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(n.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=n.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=wa.stringifyString({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":vh(n,l);break;case'"':Vs(n,l,"double-quoted-scalar");break;case"'":Vs(n,l,"single-quoted-scalar");break;default:Vs(n,l,"scalar")}}function vh(n,e){let t=e.indexOf(`
|
|
110
|
+
`),s=e.substring(0,t),i=e.substring(t+1)+`
|
|
111
|
+
`;if(n.type==="block-scalar"){let r=n.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,n.source=i}else{let{offset:r}=n,o="indent"in n?n.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];ba(a,"end"in n?n.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
112
|
+
`});for(let l of Object.keys(n))l!=="type"&&l!=="offset"&&delete n[l];Object.assign(n,{type:"block-scalar",indent:o,props:a,source:i})}}function ba(n,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":n.push(t);break;case"newline":return n.push(t),!0}return!1}function Vs(n,e,t){switch(n.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":n.type=t,n.source=e;break;case"block-scalar":{let s=n.props.slice(1),i=e.length;n.props[0].type==="block-scalar-header"&&(i-=n.props[0].source.length);for(let r of s)r.offset+=i;delete n.props,Object.assign(n,{type:t,source:e,end:s});break}case"block-map":case"block-seq":{let i={type:"newline",offset:n.offset+e.length,indent:n.indent,source:`
|
|
113
|
+
`};delete n.items,Object.assign(n,{type:t,source:e,end:[i]});break}default:{let s="indent"in n?n.indent:-1,i="end"in n&&Array.isArray(n.end)?n.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(n))r!=="type"&&r!=="offset"&&delete n[r];Object.assign(n,{type:t,indent:s,source:e,end:i})}}}ln.createScalarToken=kh;ln.resolveAsScalar=bh;ln.setScalarValue=Sh});var va=y(Sa=>{"use strict";var Ah=n=>"type"in n?un(n):cn(n);function un(n){switch(n.type){case"block-scalar":{let e="";for(let t of n.props)e+=un(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(let t of n.items)e+=cn(t);return e}case"flow-collection":{let e=n.start.source;for(let t of n.items)e+=cn(t);for(let t of n.end)e+=t.source;return e}case"document":{let e=cn(n);if(n.end)for(let t of n.end)e+=t.source;return e}default:{let e=n.source;if("end"in n&&n.end)for(let t of n.end)e+=t.source;return e}}}function cn({start:n,key:e,sep:t,value:s}){let i="";for(let r of n)i+=r.source;if(e&&(i+=un(e)),t)for(let r of t)i+=r.source;return s&&(i+=un(s)),i}Sa.stringify=Ah});var Ca=y(Ea=>{"use strict";var Ws=Symbol("break visit"),Nh=Symbol("skip children"),Aa=Symbol("remove item");function he(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),Na(Object.freeze([]),n,e)}he.BREAK=Ws;he.SKIP=Nh;he.REMOVE=Aa;he.itemAtPath=(n,e)=>{let t=n;for(let[s,i]of e){let r=t?.[s];if(r&&"items"in r)t=r.items[i];else return}return t};he.parentCollection=(n,e)=>{let t=he.itemAtPath(n,e.slice(0,-1)),s=e[e.length-1][0],i=t?.[s];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Na(n,e,t){let s=t(e,n);if(typeof s=="symbol")return s;for(let i of["key","value"]){let r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=Na(Object.freeze(n.concat([[i,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Ws)return Ws;a===Aa&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(e,n))}}return typeof s=="function"?s(e,n):s}Ea.visit=he});var fn=y(B=>{"use strict";var Gs=ka(),Eh=va(),Ch=Ca(),Qs="\uFEFF",zs="",Xs="",Zs="",Oh=n=>!!n&&"items"in n,Th=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function $h(n){switch(n){case Qs:return"<BOM>";case zs:return"<DOC>";case Xs:return"<FLOW_END>";case Zs:return"<SCALAR>";default:return JSON.stringify(n)}}function Ih(n){switch(n){case Qs:return"byte-order-mark";case zs:return"doc-mode";case Xs:return"flow-error-end";case Zs:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
114
114
|
`:case`\r
|
|
115
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(
|
|
116
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
117
|
-
\r `),
|
|
115
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(n[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}B.createScalarToken=Gs.createScalarToken;B.resolveAsScalar=Gs.resolveAsScalar;B.setScalarValue=Gs.setScalarValue;B.stringify=Eh.stringify;B.visit=Ch.visit;B.BOM=Qs;B.DOCUMENT=zs;B.FLOW_END=Xs;B.SCALAR=Zs;B.isCollection=Oh;B.isScalar=Th;B.prettyToken=$h;B.tokenType=Ih});var ni=y(Ta=>{"use strict";var ot=fn();function F(n){switch(n){case void 0:case" ":case`
|
|
116
|
+
`:case"\r":case" ":return!0;default:return!1}}var Oa=new Set("0123456789ABCDEFabcdef"),Lh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),dn=new Set(",[]{}"),qh=new Set(` ,[]{}
|
|
117
|
+
\r `),ei=n=>!n||qh.has(n),ti=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let s=this.next??"stream";for(;s&&(t||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
118
118
|
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
119
|
-
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let
|
|
120
|
-
`||!i&&!this.atEnd)return e+
|
|
121
|
-
`||
|
|
122
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
123
|
-
`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=
|
|
124
|
-
`,r)}i!==-1&&(t=i-(
|
|
119
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let s=0;for(;t===" ";)t=this.buffer[++s+e];if(t==="\r"){let i=this.buffer[s+e+1];if(i===`
|
|
120
|
+
`||!i&&!this.atEnd)return e+s+1}return t===`
|
|
121
|
+
`||s>=this.indentNext||!t&&!this.atEnd?e+s:-1}if(t==="-"||t==="."){let s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&F(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
122
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===ot.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,s=e.indexOf("#");for(;s!==-1;){let r=e[s-1];if(r===" "||r===" "){t=s-1;break}else s=e.indexOf("#",s+1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield ot.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&F(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!F(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&F(t)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(ei),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,s=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=s=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&i[0]!=="#"||s===0&&(i.startsWith("---")||i.startsWith("..."))&&F(i[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield ot.FLOW_END,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(ei),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||F(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}let s=this.buffer.substring(0,t),i=s.indexOf(`
|
|
123
|
+
`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=s.indexOf(`
|
|
124
|
+
`,r)}i!==-1&&(t=i-(s[i-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>F(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":t+=1;break;case`
|
|
125
125
|
`:e=r,t=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
126
|
-
`)break}default:break e}if(!
|
|
127
|
-
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(
|
|
128
|
-
`;)
|
|
129
|
-
`&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield
|
|
130
|
-
`?(
|
|
131
|
-
`,r=this.buffer[
|
|
132
|
-
`){let o=this.continueScalar(
|
|
126
|
+
`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
|
|
127
|
+
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(s=this.buffer[i];s===" ";)s=this.buffer[++i];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
|
|
128
|
+
`;)s=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
129
|
+
`&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield ot.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){let r=this.buffer[s+1];if(F(r)||e&&dn.has(r))break;t=s}else if(F(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===`
|
|
130
|
+
`?(s+=1,i=`
|
|
131
|
+
`,r=this.buffer[s+1]):t=s),r==="#"||e&&dn.has(r))break;if(i===`
|
|
132
|
+
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&dn.has(i))break;t=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield ot.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(ei),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,s=this.charAt(1);if(F(s)||t&&dn.has(s)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!F(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Lh.has(t))t=this.buffer[++e];else if(t==="%"&&Oa.has(this.buffer[e+1])&&Oa.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
133
133
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
134
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,
|
|
134
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,s;do s=this.buffer[++t];while(s===" "||e&&s===" ");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,s=this.buffer[t];for(;!e(s);)s=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};Ta.Lexer=ti});var ii=y($a=>{"use strict";var si=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,s=this.lineStarts.length;for(;t<s;){let r=t+s>>1;this.lineStarts[r]<e?t=r+1:s=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}};$a.LineCounter=si});var oi=y(xa=>{"use strict";var _h=ut("process"),Ia=fn(),xh=ni();function se(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function La(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function _a(n){switch(n?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function hn(n){switch(n.type){case"document":return n.start;case"block-map":{let e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function $e(n){if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;n[++e]?.type==="space";);return n.splice(e,n.length)}function pn(n,e){if(e.length<1e5)Array.prototype.push.apply(n,e);else for(let t=0;t<e.length;++t)n.push(e[t])}function qa(n){if(n.start.type==="flow-seq-start")for(let e of n.items)e.sep&&!e.value&&!se(e.start,"explicit-key-ind")&&!se(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,_a(e.value)?e.value.end?pn(e.value.end,e.sep):e.value.end=e.sep:pn(e.start,e.sep),delete e.sep)}var ri=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new xh.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(e,t))yield*this.next(s);t||(yield*this.end())}*next(e){if(this.source=e,_h.env.LOG_TOKENS&&console.log("|",Ia.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Ia.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let s=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in s?s.indent:0:t.type==="flow-collection"&&s.type==="document"&&(t.indent=0),t.type==="flow-collection"&&qa(t),s.type){case"document":s.value=t;break;case"block-scalar":s.props.push(t);break;case"block-map":{let i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=s.items[s.items.length-1];i.value?s.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{let i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&La(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(s.type==="document"?s.end=i.start:s.items.push({start:i.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{La(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=hn(this.peek(2)),s=$e(t),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
135
135
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
136
|
-
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let
|
|
136
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){pn(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let s=!this.onKeyLine&&this.indent===e.indent,i=s&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(se(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(_a(t.key)&&!se(t.sep,"newline")){let o=$e(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(se(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=$e(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):se(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!se(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){pn(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||se(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){let i=hn(s),r=$e(i);qa(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
137
137
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
138
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Qt(e),n=ke(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Qt(e),n=ke(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Qo.Parser=xn});var ta=g(ze=>{"use strict";var zo=On(),ld=Fe(),Qe=Ye(),cd=vs(),ud=O(),fd=Bn(),Xo=Kn();function Zo(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new fd.LineCounter||null,prettyErrors:e}}function dd(s,e={}){let{lineCounter:t,prettyErrors:n}=Zo(e),i=new Xo.Parser(t?.addNewLine),r=new zo.Composer(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(let a of o)a.errors.forEach(Qe.prettifyError(s,t)),a.warnings.forEach(Qe.prettifyError(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function ea(s,e={}){let{lineCounter:t,prettyErrors:n}=Zo(e),i=new Xo.Parser(t?.addNewLine),r=new zo.Composer(e),o=null;for(let a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Qe.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(Qe.prettifyError(s,t)),o.warnings.forEach(Qe.prettifyError(s,t))),o}function hd(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=ea(s,t);if(!i)return null;if(i.warnings.forEach(r=>cd.warn(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function pd(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return ud.isDocument(s)&&!n?s.toString(t):new ld.Document(s,n,t).toString(t)}ze.parse=hd;ze.parseAllDocuments=dd;ze.parseDocument=ea;ze.stringify=pd});var jn=g(E=>{"use strict";var md=On(),gd=Fe(),yd=rn(),Rn=Ye(),bd=Ee(),te=O(),wd=Q(),Sd=q(),kd=X(),vd=Z(),Nd=Wt(),Ad=Dn(),Od=Bn(),Ed=Kn(),Xt=ta(),sa=ve();E.Composer=md.Composer;E.Document=gd.Document;E.Schema=yd.Schema;E.YAMLError=Rn.YAMLError;E.YAMLParseError=Rn.YAMLParseError;E.YAMLWarning=Rn.YAMLWarning;E.Alias=bd.Alias;E.isAlias=te.isAlias;E.isCollection=te.isCollection;E.isDocument=te.isDocument;E.isMap=te.isMap;E.isNode=te.isNode;E.isPair=te.isPair;E.isScalar=te.isScalar;E.isSeq=te.isSeq;E.Pair=wd.Pair;E.Scalar=Sd.Scalar;E.YAMLMap=kd.YAMLMap;E.YAMLSeq=vd.YAMLSeq;E.CST=Nd;E.Lexer=Ad.Lexer;E.LineCounter=Od.LineCounter;E.Parser=Ed.Parser;E.parse=Xt.parse;E.parseAllDocuments=Xt.parseAllDocuments;E.parseDocument=Xt.parseDocument;E.stringify=Xt.stringify;E.visit=sa.visit;E.visitAsync=sa.visitAsync});import{appendFileSync as dh,readFileSync as hh}from"node:fs";var Ba=["claude-code","antigravity"],ei=s=>Ba.includes(s);function R(s,e){return s==="antigravity"?`/bk-${e}`:`/bk:${e}`}function ti(s,e){return s.replace(/\{\{bk:([a-z][a-z-]*)\}\}/g,(t,n)=>R(e,n))}import{isAbsolute as ns,relative as ja,resolve as ii}from"node:path";import{existsSync as si}from"node:fs";import{dirname as xa,join as ni,resolve as Ka}from"node:path";var Ra=".buildkeel.yaml";function et(s){let e=Ka(s);for(;;){if(si(ni(e,Ra)))return e;if(si(ni(e,".git")))return null;let t=xa(e);if(t===e)return null;e=t}}var oi=["write_to_file","replace_file_content","multi_replace_file_content"],Nh=oi.join("|");var Fa={decision:"allow"},ri={decision:"ask"},is=(s,e)=>{let t=ja(s,e);return t===""||!t.startsWith("..")&&!ns(t)};function ss(s,e){let t=(s.workspacePaths??[]).filter(i=>typeof i=="string"&&i!==""),n=e?[...t.filter(i=>is(i,e)),...t.filter(i=>!is(i,e))]:t;return n.find(i=>et(i)!==null)??n[0]??process.cwd()}var ai={parse(s,e){let t=s??{};switch(e[0]){case"PreInvocation":return t.conversationId?{kind:"prompt",cwd:ss(t),conversation:t.conversationId,newMessage:t.invocationNum===0,transcript:t.transcriptPath??null}:{kind:"ignored"};case"PreToolUse":case"PostToolUse":{let n=t.toolCall?.name??"",i=t.toolCall?.args?.TargetFile,r=oi.includes(n)&&typeof i=="string"&&i!==""?i:null;if(e[0]==="PostToolUse"){if(!r||t.error)return{kind:"ignored"};let l=ss(t,ns(r)?r:void 0);return{kind:"after-edit",cwd:l,tool:n,files:[ii(l,r)],...t.conversationId?{deferTo:t.conversationId}:{}}}let o=ss(t,r&&ns(r)?r:void 0),a=[...t.workspacePaths??[],...t.artifactDirectoryPath?[t.artifactDirectoryPath]:[]].filter(l=>typeof l=="string"&&l!=="");return{kind:"before-edit",cwd:o,tool:n,files:r?[ii(o,r)]:[],folders:a}}default:return{kind:"ignored"}}},render(s,e){if(e.kind==="prompt"){let t=s.context?{injectSteps:[{ephemeralMessage:s.context}]}:{};return{stdout:JSON.stringify(t),exitCode:0}}if(e.kind==="before-edit"){let t=e.files.length>0&&e.files.every(i=>(e.folders??[]).some(r=>is(r,i))),n=s.block?{decision:"deny",reason:s.block}:t?Fa:ri;return{stdout:JSON.stringify(n),exitCode:0}}return{stdout:"{}",exitCode:0}},failed:s=>({stdout:JSON.stringify(s[0]==="PreToolUse"?ri:{}),exitCode:0})};var li={Edit:"file_path",Write:"file_path",MultiEdit:"file_path",NotebookEdit:"notebook_path"},Oh=Object.keys(li).join("|"),Ha=["Bash","PowerShell"],Ua={startup:"startup",resume:"resume",clear:"clear",compact:"compact",fork:"resume"},ci={parse(s){let e=s??{},t=e.cwd??process.cwd();switch(e.hook_event_name){case"SessionStart":{let n=Ua[e.source??"startup"]??"startup";return{kind:"session-start",cwd:t,reason:n}}case"PreToolUse":case"PostToolUse":{let n=e.tool_name??"";if(e.hook_event_name==="PreToolUse"&&Ha.includes(n)){let o=e.tool_input?.command;return typeof o=="string"?{kind:"before-shell",cwd:t,tool:n,command:o}:{kind:"ignored"}}let i=li[n],r=i?e.tool_input?.[i]:void 0;return typeof r!="string"?{kind:"ignored"}:{kind:e.hook_event_name==="PreToolUse"?"before-edit":"after-edit",cwd:t,tool:n,files:[r]}}default:return{kind:"ignored"}}},render(s,e){if(e.kind==="session-start")return{stdout:s.context??"",exitCode:0};if(e.kind==="before-shell"&&s.context)return{stdout:JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",additionalContext:s.context}}),exitCode:0};if(e.kind==="before-edit"&&(s.block||s.context)){let t={hookSpecificOutput:{hookEventName:"PreToolUse",...s.block?{permissionDecision:"deny",permissionDecisionReason:s.block}:{},...s.context?{additionalContext:s.context}:{}}};return{stdout:JSON.stringify(t),exitCode:0}}return e.kind==="after-edit"&&s.context?{stdout:JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:s.context}}),exitCode:0}:{stdout:"",exitCode:0}},failed:()=>({stdout:"",exitCode:1})};import{existsSync as Th,readFileSync as Ya,writeFileSync as qh}from"node:fs";import{join as rs}from"node:path";var P=".buildkeel",Ja="hook-cache.json",Va="context.md",ui=s=>rs(s,P,Va),Wa="context-short.md",fi=s=>rs(s,P,Wa);function Ga(s){return rs(s,P,Ja)}function di(s){try{let e=JSON.parse(Ya(Ga(s),"utf8"));return e?.version===1?e:null}catch{return null}}var Ih=`${P}/`;import{appendFileSync as Id,closeSync as $d,fstatSync as _d,mkdirSync as la,openSync as Pd,readFileSync as ca,readSync as Dd,renameSync as ua,rmSync as Md,statSync as Bd,writeFileSync as xd}from"node:fs";import{homedir as Kd}from"node:os";import{join as ts}from"node:path";import{randomBytes as Qa}from"node:crypto";import{dirname as za,join as Xa}from"node:path";var hi=s=>Xa(za(s),`.${Qa(6).toString("hex")}.bk-tmp`);import{readFileSync as Td}from"node:fs";var Fn=Zn(jn(),1);var Cd=Zn(jn(),1);var Hn={type:"test-plan",dir:"test-plan",file:"plan.md",idSuffix:"-TP"},Un={type:"design",dir:"design",file:"design.md",idSuffix:"-DD"},om=[{type:Hn.type,dir:Hn.dir,file:Hn.file,suffix:"TP"},{type:Un.type,dir:Un.dir,file:Un.file,suffix:"DD"}];function na(s){return/^([A-Z][A-Z0-9]*-[A-Za-z0-9]+)(?:-|$)/.exec(s)?.[1]??null}var Zt=(s,e)=>e?`${s} "${e}"`:s;function Yn(s,e){let t=[{key:"setup",text:`BuildKeel is set up in this repository. Until the user runs a BuildKeel command, or you are about to change a file, converse as you would without it, and leave BuildKeel's artifacts, IDs and commands out of it. Be a thinking partner: check facts in the code and docs before asking; for a design choice, lay out the options, trade-offs, risks and pitfalls, then ask one question in prose and say why it matters. Recommend only when the evidence supports it, and say what it rests on; never assume the user's intent, priorities or constraints, and ask when only they know. When you look something up, say what you found and give the sources. Keep what was decided apart from what is still open. Take the space the reasoning needs; do not cut it short or push toward a conclusion or a plan. Use your question tool only for a closed choice between comparable options, and let several answers be picked when more than one can apply. Until the user signals the discussion has reached a point, end your replies without mentioning BuildKeel, the spec tree or its artifacts, and without offering to draft, record, plan or build anything; settling the last open question is not that signal, so wait for the user to say it. When they signal it, such as with "sounds good" or "I think that's it", ask once, in prose, whether there is more to explore or they are ready to capture it with ${R(e,"capture")}; if they keep talking or say no, do not offer again until something new is settled. Never start it yourself.`,fingerprint:""}];if(s.activeUnit){let n=s.activeBranch?` on branch ${s.activeBranch}`:"";t.push({key:"unit",text:`Active unit: ${Zt(s.activeUnit,s.activeTitle)}${n}.`,fingerprint:`${s.activeUnit}${n}`})}else s.untrackedSince?t.push({key:"unit",text:`No active unit in this working tree: the user chose to work without one here since ${s.untrackedSince}, so changes made now belong to no unit. Starting a unit with ${R(e,"build")} <ID> ends this.`,fingerprint:`untracked:${s.untrackedSince}`}):t.push({key:"unit",text:"No unit is active in this working tree.",fingerprint:""});if(t.push({key:"rules",text:"Read and change the spec tree only through the BuildKeel tools, never by editing its files.",fingerprint:""}),t.push({key:"review",text:"Before you save anything to the spec tree, show what changes, in full, in your reply, and ask in plain text. Agreement saves it; anything else is feedback: discuss it, then list each point with how it was addressed, show the final version, and save only once the user agrees. When work would change a document the user agreed, say which, what and why, and take it through the same review. Never add, change or remove a requirement, criterion, scenario or task on your own initiative. Check a reported problem against the spec and its code first: propose, as your reading, a defect, a change in behavior, a gap or code no spec covers; record nothing until the user confirms. If agreed behavior looks wrong while building, stop and ask, naming the requirement, criterion or scenario and why; never build something else or edit the spec without the answer. Kept, build it as agreed; changed, update the spec first, then the code."+(s.mode==="spec-driven"?" Report each tick in a line; do not ask about ticks. Tick with save_draft tick, change one requirement with save_draft requirement, and read one file of a change with query file, rather than resending or rereading whole files.":""),fingerprint:s.mode==="spec-driven"?"spec-driven":""}),s.mode==="spec-driven")t.push({key:"stages",text:"This spec tree is Spec-driven: its capability specs say how the system behaves now, and each change says how it will change; nothing in it is approved. Before discussing how the system behaves, look up the capability specs with the BuildKeel query tool. Each BuildKeel command follows its part for a Spec-driven tree.",fingerprint:"spec-driven"},{key:"consistency",text:"When you edit one file of an open change (its proposal, a spec change, its design or its tasks), check the others against the edit, in any direction, and name the follow-on edits in the same reply; then take each through the review, one edit at a time, with what changes and why. Never edit code as part of this.",fingerprint:"spec-driven"},{key:"build",text:`While a change is open, commit each task's work as it is done, adding "BuildKeel-Task: <number>" to a commit that does exactly that one task, and tick each task once its verification passes. Name a change with its title, never by its ID alone, such as CH-001 "Download historical market data". When the user asks in words to build a change's tasks, suggest ${R(e,"build")} once; if they say to go ahead without it, build the tasks anyway by the same rules, and if they say not now, build nothing. A specific edit they ask for needs no suggestion. While building, stop and ask when a test fails and you cannot fix it, or a requirement is unclear. Before adding a requirement to a change with more than half its tasks ticked, ask once whether it belongs in that change or a new one, and draft nothing until they answer.`,fingerprint:`spec-driven|${e}`},{key:"tests",text:"Put the ID of the scenario a test checks in square brackets in the test's name, one ID per bracket.",fingerprint:"spec-driven"}),s.guide==="on"&&t.push({key:"guide",text:"This person chose to be guided through their first change: at each step of it, from drafting to finishing, add one or two plain lines on what just happened and what comes next, as BuildKeel's tool results say. If they ask you to stop explaining, turn it off with the BuildKeel manage tool (action guide, guide off).",fingerprint:"on"});else if(s.stages){let n=(s.stageExamples??[]).map(r=>`\`${r}\``),i=n.length>1?`${n.slice(0,-1).join(", ")} or ${n.at(-1)}`:n[0]??"";t.push({key:"stages",text:`This spec tree's stages, as the team names them: ${s.stages}. Use these names with the user, in each command's help, questions and output; BuildKeel's tools accept them as types, and the usual names too.`+(i?` Examples of what to draft, in the team's words: ${i}; use these in place of a command's usual examples.`:""),fingerprint:`${s.stages}|${n.join(",")}`})}return t}var qd=8e3;function ra(s,e){try{return ti(Td(s,"utf8").trimEnd(),e)}catch{return null}}function Ld(s,e,t){return e.activeUnit?ra(ui(s),t):null}function es(s,e,t,n){let i=ia(Ld(s,e,t),e,t,n);if(i.length<=qd||!e.activeUnit)return i;let r=ra(fi(s),t);return r?ia(r,e,t,n):i}function ia(s,e,t,n){let i=["BuildKeel:"];for(let r of Yn(e,t)){let o=r.key==="unit"&&e.activeUnit?s?n?" Its context is loaded again below.":" Its context follows.":" BuildKeel has no context for it; call the BuildKeel get_context tool to see why.":"";i.push(`- ${r.text}${o}`)}return s&&i.push("",s),i.join(`
|
|
139
|
-
`)}
|
|
140
|
-
`)}function
|
|
141
|
-
`)
|
|
142
|
-
`)
|
|
143
|
-
`))if(
|
|
138
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=hn(e),s=$e(t);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=hn(e),s=$e(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};xa.Parser=ri});var Ra=y(lt=>{"use strict";var Pa=Ys(),Ph=Ze(),at=nt(),Dh=Un(),Mh=E(),Bh=ii(),Da=oi();function Ma(n){let e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new Bh.LineCounter||null,prettyErrors:e}}function Rh(n,e={}){let{lineCounter:t,prettyErrors:s}=Ma(e),i=new Da.Parser(t?.addNewLine),r=new Pa.Composer(e),o=Array.from(r.compose(i.parse(n)));if(s&&t)for(let a of o)a.errors.forEach(at.prettifyError(n,t)),a.warnings.forEach(at.prettifyError(n,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Ba(n,e={}){let{lineCounter:t,prettyErrors:s}=Ma(e),i=new Da.Parser(t?.addNewLine),r=new Pa.Composer(e),o=null;for(let a of r.compose(i.parse(n),!0,n.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new at.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&t&&(o.errors.forEach(at.prettifyError(n,t)),o.warnings.forEach(at.prettifyError(n,t))),o}function jh(n,e,t){let s;typeof e=="function"?s=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=Ba(n,t);if(!i)return null;if(i.warnings.forEach(r=>Dh.warn(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},t))}function Kh(n,e,t){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(n===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return Mh.isDocument(n)&&!s?n.toString(t):new Ph.Document(n,s,t).toString(t)}lt.parse=jh;lt.parseAllDocuments=Rh;lt.parseDocument=Ba;lt.stringify=Kh});var Ie=y(C=>{"use strict";var Fh=Ys(),Hh=Ze(),Uh=Cs(),ai=nt(),Jh=Me(),ie=E(),Yh=Z(),Vh=I(),Wh=te(),Gh=ne(),Qh=fn(),zh=ni(),Xh=ii(),Zh=oi(),mn=Ra(),ja=_e();C.Composer=Fh.Composer;C.Document=Hh.Document;C.Schema=Uh.Schema;C.YAMLError=ai.YAMLError;C.YAMLParseError=ai.YAMLParseError;C.YAMLWarning=ai.YAMLWarning;C.Alias=Jh.Alias;C.isAlias=ie.isAlias;C.isCollection=ie.isCollection;C.isDocument=ie.isDocument;C.isMap=ie.isMap;C.isNode=ie.isNode;C.isPair=ie.isPair;C.isScalar=ie.isScalar;C.isSeq=ie.isSeq;C.Pair=Yh.Pair;C.Scalar=Vh.Scalar;C.YAMLMap=Wh.YAMLMap;C.YAMLSeq=Gh.YAMLSeq;C.CST=Qh;C.Lexer=zh.Lexer;C.LineCounter=Xh.LineCounter;C.Parser=Zh.Parser;C.parse=mn.parse;C.parseAllDocuments=mn.parseAllDocuments;C.parseDocument=mn.parseDocument;C.stringify=mn.stringify;C.visit=ja.visit;C.visitAsync=ja.visitAsync});import{appendFileSync as Fm,readFileSync as Hm}from"node:fs";var xl=["claude-code","antigravity"],Ni=n=>xl.includes(n);function $(n,e){return n==="antigravity"?`/bk-${e}`:`/bk:${e}`}var Pl=n=>n==="antigravity"?"the agent":"Claude";function Ei(n,e){let t=Pl(e);return n.replace(/\{\{bk:([a-z][a-z-]*)\}\}/g,(s,i)=>$(e,i)).replaceAll("{{agent}}",t).replaceAll("{{Agent}}",t.charAt(0).toUpperCase()+t.slice(1))}import{isAbsolute as vn,relative as jl,resolve as Li}from"node:path";import{existsSync as ae,readFileSync as Ci,statSync as Dl}from"node:fs";import{dirname as Ml,isAbsolute as Oi,join as J,resolve as Sn}from"node:path";var Ti=".buildkeel.yaml",$i="buildkeel.yaml",R=".buildkeel",Bl="buildkeel";function ft(n){let e=J(n,".git");if(!ae(e))return null;try{if(Dl(e).isDirectory())return e;let t=/^gitdir:\s*(.+)$/m.exec(Ci(e,"utf8"))?.[1]?.trim();return t?Oi(t)?t:Sn(n,t):null}catch{return null}}function Ii(n){let e=ft(n);if(!e)return null;try{let t=J(e,"commondir");if(!ae(t))return e;let s=Ci(t,"utf8").trim();return Oi(s)?s:Sn(e,s)}catch{return e}}function Rl(n){if(ae(J(n,Ti)))return!1;let e=Ii(n);return e!==null&&ae(J(e,$i))}function P(n){if(Rl(n)){let e=ft(n);if(e)return J(e,Bl)}return J(n,R)}function qe(n){let e=Sn(n);for(;;){if(ae(J(e,Ti)))return e;if(ae(J(e,".git"))){let s=Ii(e);return s!==null&&ae(J(s,$i))?e:null}let t=Ml(e);if(t===e)return null;e=t}}var Nn=["write_to_file","replace_file_content","multi_replace_file_content","edit_file","write_file"],Kl=["TargetFile","Path"],_i=["run_command"],Zm=Nn.join("|"),eg=[...Nn,..._i].join("|"),Fl=n=>{for(let e of Kl){let t=n?.[e];if(typeof t=="string"&&t!=="")return t}return null};var Hl={decision:"allow"},qi={decision:"ask"},An=(n,e)=>{let t=jl(n,e);return t===""||!t.startsWith("..")&&!vn(t)};function dt(n,e){let t=(n.workspacePaths??[]).filter(i=>typeof i=="string"&&i!==""),s=e?[...t.filter(i=>An(i,e)),...t.filter(i=>!An(i,e))]:t;return s.find(i=>qe(i)!==null)??s[0]??process.cwd()}var xi={parse(n,e){let t=n??{};switch(e[0]){case"PreInvocation":return t.conversationId?{kind:"prompt",cwd:dt(t),conversation:t.conversationId,newMessage:t.invocationNum===0,transcript:t.transcriptPath??null}:{kind:"ignored"};case"PreToolUse":case"PostToolUse":{let s=t.toolCall?.name??"",i=Nn.includes(s)?Fl(t.toolCall?.args):null;if(e[0]==="PostToolUse"&&_i.includes(s)){let a=t.toolCall?.args?.CommandLine;return typeof a!="string"||t.error?{kind:"ignored"}:{kind:"after-shell",cwd:dt(t),tool:s,command:a,...t.conversationId?{deferTo:t.conversationId}:{}}}if(e[0]==="PostToolUse"){if(!i||t.error)return{kind:"ignored"};let a=dt(t,vn(i)?i:void 0);return{kind:"after-edit",cwd:a,tool:s,files:[Li(a,i)],...t.conversationId?{deferTo:t.conversationId}:{}}}let r=dt(t,i&&vn(i)?i:void 0),o=[...t.workspacePaths??[],...t.artifactDirectoryPath?[t.artifactDirectoryPath]:[]].filter(a=>typeof a=="string"&&a!=="");return{kind:"before-edit",cwd:r,tool:s,files:i?[Li(r,i)]:[],folders:o,...t.conversationId?{conversation:t.conversationId,deferTo:t.conversationId}:{}}}default:return{kind:"ignored"}}},render(n,e){if(e.kind==="prompt"){let t=n.context?{injectSteps:[{ephemeralMessage:n.context}]}:{};return{stdout:JSON.stringify(t),exitCode:0}}if(e.kind==="before-edit"){let t=e.files.length>0&&e.files.every(i=>(e.folders??[]).some(r=>An(r,i))),s=n.block?{decision:"deny",reason:n.block}:t?Hl:qi;return{stdout:JSON.stringify(s),exitCode:0}}return{stdout:"{}",exitCode:0}},failed:n=>({stdout:JSON.stringify(n[0]==="PreToolUse"?qi:{}),exitCode:0})};var Pi={Edit:"file_path",Write:"file_path",MultiEdit:"file_path",NotebookEdit:"notebook_path"},ng=Object.keys(Pi).join("|"),Ul=["Bash","PowerShell"],Jl={startup:"startup",resume:"resume",clear:"clear",compact:"compact",fork:"resume"},Di={parse(n){let e=n??{},t=e.cwd??process.cwd();switch(e.hook_event_name){case"SessionStart":{let s=Jl[e.source??"startup"]??"startup",i=e.session_id?{conversation:e.session_id,transcript:e.transcript_path??null}:{};return{kind:"session-start",cwd:t,reason:s,...i}}case"UserPromptSubmit":return{kind:"message",cwd:t,...e.session_id?{conversation:e.session_id}:{}};case"PreToolUse":case"PostToolUse":{let s=e.tool_name??"";if(e.hook_event_name==="PreToolUse"&&Ul.includes(s)){let o=e.tool_input?.command;return typeof o=="string"?{kind:"before-shell",cwd:t,tool:s,command:o}:{kind:"ignored"}}let i=Pi[s],r=i?e.tool_input?.[i]:void 0;return typeof r!="string"?{kind:"ignored"}:e.hook_event_name==="PreToolUse"?{kind:"before-edit",cwd:t,tool:s,files:[r],...e.session_id?{conversation:e.session_id}:{}}:{kind:"after-edit",cwd:t,tool:s,files:[r]}}default:return{kind:"ignored"}}},render(n,e){if(e.kind==="session-start")return{stdout:n.context??"",exitCode:0};if(e.kind==="before-shell"&&n.context)return{stdout:JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",additionalContext:n.context}}),exitCode:0};if(e.kind==="before-edit"&&(n.block||n.context)){let t={hookSpecificOutput:{hookEventName:"PreToolUse",...n.block?{permissionDecision:"deny",permissionDecisionReason:n.block}:{},...n.context?{additionalContext:n.context}:{}}};return{stdout:JSON.stringify(t),exitCode:0}}return e.kind==="after-edit"&&n.context?{stdout:JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",additionalContext:n.context}}),exitCode:0}:{stdout:"",exitCode:0}},failed:()=>({stdout:"",exitCode:1})};import{existsSync as Pm}from"node:fs";import{dirname as Dm,join as Mm,resolve as Bm}from"node:path";import{existsSync as Mi,readdirSync as Yl,readFileSync as Bi}from"node:fs";import{basename as Vl,dirname as Wl,join as ht,relative as Gl}from"node:path";function Ql(n){let e=ft(n);if(!e||!Mi(ht(e,"config")))return null;let t=Bi(ht(e,"config"),"utf8"),s=/\[remote "origin"\][^[]*?\n\s*url\s*=\s*(.+?)\s*$/m.exec(t)?.[1]??null;return s===null?null:s.replace(/^"(.*)"$/,"$1").replaceAll("\\\\","\\")}function zl(n,e){let t=s=>{let i=s.replace(/^["']|["']$/g,"").replaceAll("\\","/").replace(/(?<!^[a-z][a-z0-9+.-]+:)\/{2,}/gi,"/").replace(/\/+$/,"");return process.platform==="win32"?i.toLowerCase():i};return t(n)===t(e)}var Xl=200;function Ri(n){let e=Wl(n),t=Ql(n),s=Vl(n),i;try{i=Yl(e).slice(0,Xl)}catch{return null}for(let r of i){let o=ht(e,r,"buildkeel.yaml");if(r===s||!Mi(o))continue;let a;try{a=Bi(o,"utf8")}catch{continue}if(!/^repos:/m.test(a))continue;let l=[...a.matchAll(/^\s*-?\s*name:\s*["']?([^"'\n]+?)["']?\s*$/gm)].map(d=>d[1]),c=[...a.matchAll(/^\s*-?\s*remote:\s*["']?([^"'\n]+?)["']?\s*$/gm)].map(d=>d[1]);if(t&&c.some(d=>d!==void 0&&zl(d,t))||l.includes(s))return ht(e,r)}return null}var ji=(n,e)=>Gl(n,e).split("\\").join("/");import{existsSync as ug,readFileSync as Zl,writeFileSync as fg}from"node:fs";import{join as En}from"node:path";var Ki="break-",ec="hook-cache.json",tc="context.md",Fi=n=>En(P(n),tc),nc="context-short.md",Hi=n=>En(P(n),nc);function sc(n){return En(P(n),ec)}function Ui(n){try{let e=JSON.parse(Zl(sc(n),"utf8"));return e?.version===1?e:null}catch{return null}}var hg=`${R}/`;import{appendFileSync as _p,closeSync as xp,fstatSync as Pp,mkdirSync as Dp,openSync as Mp,readFileSync as Bp,readSync as Rp,renameSync as jp,rmSync as Kp,statSync as Fp}from"node:fs";import{join as Hp}from"node:path";import{closeSync as ic,existsSync as rc,fstatSync as oc,mkdirSync as ac,openSync as lc,readdirSync as cc,readFileSync as uc,readSync as fc,renameSync as dc,writeFileSync as hc}from"node:fs";import{homedir as pc}from"node:os";import{join as ye}from"node:path";var mc="conversations",gc=(n,e)=>`${n.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,100)}.${e}`,Ji=n=>ye(P(n),mc),pt=(n,e,t)=>ye(Ji(n),gc(e,t));function we(n){try{let e=JSON.parse(uc(n,"utf8"));return e.version===1?e:null}catch{return null}}function mt(n,e){ac(ye(n,".."),{recursive:!0});let t=`${n}.${process.pid}.tmp`;hc(t,`${JSON.stringify(e,null,2)}
|
|
139
|
+
`),dc(t,n)}function Yi(n,e,t,s=new Date,i){let r=pt(n,e,"json"),o=we(r)??{version:1,startedAt:s.toISOString()},a={...o,conversation:e,...t?{transcriptPath:t}:{},lastSeen:s.toISOString(),...i!==void 0?{activeUnit:i}:{}};JSON.stringify(a)!==JSON.stringify(o)&&mt(r,a)}function Cn(n){let e=Ji(n);return rc(e)?cc(e).filter(t=>t.endsWith(".json")).flatMap(t=>{let s=we(ye(e,t));return s?[{...s,file:ye(e,t)}]:[]}).sort((t,s)=>(s.lastSeen??s.startedAt).localeCompare(t.lastSeen??t.startedAt)):[]}var gt=n=>n==="~"||n.startsWith("~/")?ye(pc(),n.slice(1)):n;function yc(n){let e;try{e=lc(gt(n),"r")}catch{return[]}try{let t=Buffer.alloc(oc(e).size),s=t.length>0?fc(e,t,0,t.length,0):0;return t.subarray(0,s).toString("utf8").split(`
|
|
140
|
+
`).filter(i=>i.trim())}catch{return[]}finally{ic(e)}}function wc(n){let e=[];for(let t of n){let s;try{s=JSON.parse(t)}catch{continue}if(s.type==="USER_INPUT"&&typeof s.content=="string"){let a=/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/.exec(s.content)?.[1]??s.content;e.push({text:a.trim(),...typeof s.created_at=="string"?{at:s.created_at}:{}});continue}if(s.type!=="user"||s.isMeta===!0)continue;let i=s.message,r=typeof s.timestamp=="string"?{at:s.timestamp}:{};if(typeof i?.content=="string"){e.push({text:i.content,...r});continue}if(!Array.isArray(i?.content))continue;let o=[];for(let a of i.content)if(a.type==="text"&&typeof a.text=="string")o.push(a.text);else if(a.type==="tool_result"){let l=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(c=>typeof c.text=="string"?c.text:"").join(`
|
|
141
|
+
`):"";/^User has answered your questions?/.test(l)&&o.push(l)}o.length>0&&e.push({text:o.join(`
|
|
142
|
+
`),...r})}return e}function Vi(n){let e=we(n);e&&mt(n,{...e,recoveryOffered:!0})}function On(n,e){let t=wc(yc(n));return e?t.filter(s=>s.at===void 0||s.at>e):t}import{randomBytes as bc}from"node:crypto";import{dirname as kc,join as Sc}from"node:path";var Wi=n=>Sc(kc(n),`.${bc(6).toString("hex")}.bk-tmp`);import{existsSync as vc,readFileSync as Ac}from"node:fs";import{dirname as Gi,join as Qi}from"node:path";import{fileURLToPath as Nc}from"node:url";function Ec(n=Nc(import.meta.url)){let e=Gi(n);for(;;){if(vc(Qi(e,"package.json")))return e;let t=Gi(e);if(t===e)throw new Error(`No package.json above ${n}`);e=t}}function zi(){return JSON.parse(Ac(Qi(Ec(),"package.json"),"utf8")).version??"0.0.0"}import{mkdirSync as lp,readFileSync as cp,renameSync as up,writeFileSync as fp}from"node:fs";import{join as Ja}from"node:path";var Ka=Le(Ie(),1);import{readFileSync as ep,statSync as tp}from"node:fs";import{homedir as np}from"node:os";import{join as ci,resolve as sp}from"node:path";var Fa="settings.yaml",D={codeEdits:"code-edits",updateCheck:"update-check"},li="BUILDKEEL_NO_UPDATE_CHECK";function re(n=process.env){return n.BUILDKEEL_HOME?sp(n.BUILDKEEL_HOME):ci(np(),".buildkeel")}function ip(n){return n==="spec-driven"?"warn":"hold"}var Ha=n=>n==="hold"||n==="warn"?n:void 0,rp=n=>n===!0||n==="on"?!0:n===!1||n==="off"?!1:void 0;function op(n=re()){let e;try{e=ep(ci(n,Fa),"utf8")}catch{return{problems:[]}}let t;try{t=(0,Ka.parse)(e)}catch(l){return{problems:[{path:"",message:`cannot be read: ${l instanceof Error?l.message.split(`
|
|
143
|
+
`)[0]:String(l)}`}]}}if(t==null)return{problems:[]};if(typeof t!="object"||Array.isArray(t))return{problems:[{path:"",message:`must hold ${Object.values(D).join(" and ")}`}]};let s=t,i=[],r=Object.values(D);for(let l of Object.keys(s))r.includes(l)||i.push({path:l,message:`is not a personal switch. They are ${r.join(" and ")}`});let o=Ha(s[D.codeEdits]);s[D.codeEdits]!==void 0&&!o&&i.push({path:D.codeEdits,message:"must be hold or warn"});let a=rp(s[D.updateCheck]);return s[D.updateCheck]!==void 0&&a===void 0&&i.push({path:D.updateCheck,message:"must be on or off"}),{...o?{codeEdits:o}:{},...a===void 0?{}:{updateCheck:a},problems:i}}function ap(n){let e=n&&typeof n=="object"&&!Array.isArray(n)?n.personal:void 0;if(e==null)return{problems:[]};if(typeof e!="object"||Array.isArray(e))return{problems:[{path:"personal",message:`must be a section holding ${D.codeEdits}`}]};let t=e,s=[];for(let r of Object.keys(t))r===D.updateCheck?s.push({path:`personal.${r}`,message:"cannot be locked: the version check is each person's own choice"}):r!==D.codeEdits&&s.push({path:`personal.${r}`,message:`is not a personal switch a team can lock. It can lock ${D.codeEdits}`});let i=Ha(t[D.codeEdits]);return t[D.codeEdits]!==void 0&&!i&&s.push({path:`personal.${D.codeEdits}`,message:"must be hold or warn"}),{...i?{codeEdits:i}:{},problems:s}}function pe(n,e,t=re(),s=process.env){let i=op(t),r=ap(e),o=r.codeEdits?{value:r.codeEdits,from:"team"}:i.codeEdits?{value:i.codeEdits,from:"you"}:{value:ip(n),from:"default"},l=s[li]!==void 0&&s[li]!==""&&s[li]!=="0"?{value:!1,from:"environment"}:i.updateCheck===void 0?{value:!0,from:"default"}:{value:i.updateCheck,from:"you"};return{codeEdits:o,updateCheck:l}}function Ua(n=re()){try{return tp(ci(n,Fa)).mtimeMs}catch{return 0}}var Ya="update-check.json",Xy=1440*60*1e3;function dp(n=re()){try{let e=JSON.parse(cp(Ja(n,Ya),"utf8"));return typeof e.checkedAt=="string"?e:null}catch{return null}}function hp(n,e){try{lp(n,{recursive:!0});let t=Ja(n,Ya),s=`${t}.${process.pid}.tmp`;fp(s,`${JSON.stringify(e,null,2)}
|
|
144
|
+
`),up(s,t)}catch{}}function pp(n,e){let t=r=>/^\d+\.\d+\.\d+$/.test(r)?r.split(".").map(Number):null,s=t(n),i=t(e);if(!s||!i)return!1;for(let r=0;r<3;r++)if(s[r]!==i[r])return s[r]>i[r];return!1}function mp(n){return n==="claude-code"?"/plugin update bk@buildkeel":"npx buildkeel@latest update"}function Va(n,e,t=re(),s=process.env){if(!pe(void 0,{},t,s).updateCheck.value)return null;let i=dp(t);return!i?.latest||!pp(i.latest,n)||i.shown===i.latest?null:(hp(t,{...i,shown:i.latest}),`BuildKeel ${i.latest} is available (this is ${n}). Tell the user in one line, with the command to update: ${mp(e)}. Turn this notice off with update-check: off in ~/.buildkeel/settings.yaml.`)}import{existsSync as gp,readFileSync as yp,rmSync as wp}from"node:fs";import{join as bp}from"node:path";var kp="migrated.json",Sp=n=>bp(P(n),kp);function Wa(n,e){let t=Sp(n);if(!gp(t))return null;let s;try{s=JSON.parse(yp(t,"utf8"))}catch{s={from:4,to:5,renamed:0,reason:"its outcome could not be read"}}return wp(t,{force:!0}),vp(s,e)}function vp(n,e){let{from:t,to:s}=n;if(n.reason!==void 0||n.commit===void 0)return`BuildKeel could not move this spec tree from format ${t} to format ${s}: ${n.reason??"the step did not finish"}. The tree stays in format ${t}, read-only, until ${$(e,"migrate")} retries it. Tell the user in one line.`;let i=n.renamed===0?"":` ${n.renamed} runs/ folder${n.renamed===1?"":"s"} of open work became test-runs/;`;return`BuildKeel moved this spec tree from format ${t} to format ${s}, the one this version uses:${i} the analytics files were added with their merge rule, and finished work was left as it is. Committed on its own as "migrate: format ${t} to ${s}" (${n.commit.slice(0,7)}), pushed with the tree's other commits. Anyone still on an older BuildKeel needs to update to change the tree. Tell the user in one line.`}import{readFileSync as $p}from"node:fs";var ui=Le(Ie(),1);var Ap=Le(Ie(),1);var fi={type:"test-plan",dir:"test-plan",file:"plan.md",idSuffix:"-TP"},di={type:"design",dir:"design",file:"design.md",idSuffix:"-DD"},gw=[{type:fi.type,dir:fi.dir,file:fi.file,suffix:"TP"},{type:di.type,dir:di.dir,file:di.file,suffix:"DD"}];var Ga={notes:"notes",pauses:"pauses",testRuns:"test-runs",reviews:"reviews",answers:"answers",switches:"switches",handoffs:"handoffs",executions:"executions",asBuilt:"as-built"},Qa=["runs"],yw=[...Object.values(Ga),...Qa],ww=["versions","approvals","completions","repins",...Object.values(Ga),...Qa];function za(n){return/^([A-Z][A-Z0-9]*-[A-Za-z0-9]+)(?:-|$)/.exec(n)?.[1]??null}var gn=(n,e)=>e?`${n} "${e}"`:n;var Np=3;function yn(n,e,t,s){if(e.activeUnit||e.threads==="off")return null;let i=Cn(n).find(a=>a.conversation!==s&&a.transcriptPath);if(!i?.transcriptPath||i.recoveryOffered||i.activeUnit)return null;let r=On(i.transcriptPath,i.savedAt);return r.length<Np?null:(Vi(i.file),`The previous conversation in this repository on this machine (started ${(i.startedAt??"").slice(0,10)}, ${r.length} messages from the user) ended with no unit, and was not paused or captured. Offer once, in one line, to recover it as a thread with ${$(t,"pause")}, built from its whole transcript at ${i.transcriptPath}, which stays on this machine. If the user declines or says nothing of it, do not offer again.`)}function wn(n,e,t,s,i){if(e.activeUnit||!i)return null;let r=Cn(n).find(o=>o.conversation===s);return On(i,r?.savedAt).length===0?null:`This conversation was compacted, and the exploration in it is not saved. If the user pauses with ${$(t,"pause")}, build the thread from the whole transcript at ${i}, not from the summary.`}var Xa=Le(Ie(),1);import{readFileSync as Ep,statSync as Cp}from"node:fs";import{join as Op}from"node:path";var Tp="buildkeel.yaml";function bn(n,e=re()){let t=Op(n.specRoot,Tp),s=Date.parse(n.updatedAt),i=0;try{i=Cp(t).mtimeMs}catch{}if(i<=s&&Ua(e)<=s)return n;let r;try{r=(0,Xa.parse)(Ep(t,"utf8"))}catch{return n}let o=r?.process,a=pe(n.mode,o,e).codeEdits.value;if(i<=s)return{...n,codeEdits:a};let l=(u,f)=>{let p=o&&typeof o=="object"?o[u]:void 0;return p&&typeof p=="object"?p[f]:void 0},c=u=>u!==!1&&u!=="off",d=l("continuity","threads");return{...n,threads:d===!1?"off":d==="off"||d==="auto"?d:"ask",exploring:c(l("planning","exploring")),spikes:c(l("planning","spikes")),codeEdits:a}}function hi(n,e){let t=n.exploring!==!1,s=[{key:"setup",text:"BuildKeel is set up in this repository. Until the user runs a BuildKeel command, or you are about to change a file, converse as you would without it, and leave BuildKeel's artifacts, IDs and commands out of it. "+(t?"Be a thinking partner: check facts in the code and docs before asking; for an idea or a design choice, play back your understanding, lay out two or three options with their trade-offs, risks and pitfalls, then ask one question in prose and say why it matters. ":"Check facts in the code and docs before asking. ")+"Recommend only when the evidence supports it, and say what it rests on; never assume the user's intent, priorities or constraints, and ask when only they know. When you look something up, say what you found and give the sources. "+(t?"Keep what was decided apart from what is still open, and the user's own words apart from your proposals. ":"")+`Take the space the reasoning needs; do not cut it short or push toward a conclusion or a plan. Use your question tool only for a closed choice between comparable options, and let several answers be picked when more than one can apply. Until the user signals the discussion has reached a point, end your replies without mentioning BuildKeel, the spec tree or its artifacts, and without offering to draft, record, plan or build anything; settling the last open question is not that signal, so wait for the user to say it. When they signal it, such as with "sounds good" or "I think that's it", ask once, in prose, whether there is more to explore or they are ready to capture it with ${$(e,"capture")}; if they keep talking or say no, do not offer again until something new is settled. Never start it yourself. When the user says words such as "let's stop here" or "I'm switching machines", pause as ${$(e,"pause")} does.`,fingerprint:t?"":"no-exploring"}];if(n.activeUnit){let i=n.activeBranch?` on branch ${n.activeBranch}`:"";s.push({key:"unit",text:`Active unit: ${gn(n.activeUnit,n.activeTitle)}${i}.`,fingerprint:`${n.activeUnit}${i}`})}else n.spike?s.push({key:"unit",text:`No active unit in this working tree: the spike "${n.spike.name}" is under way on ${n.spike.branch} since ${n.spike.since}, untracked, throwaway work whose commits carry no unit line. End it with the BuildKeel manage tool (action spike, end true) to offer its findings as working notes.`,fingerprint:`spike:${n.spike.branch}`}):n.untrackedSince?s.push({key:"unit",text:`No active unit in this working tree: the user chose to work without one here since ${n.untrackedSince}, so changes made now belong to no unit. Starting a unit with ${$(e,"build")} <ID> ends this.`,fingerprint:`untracked:${n.untrackedSince}`}):n.untrackedFiles?s.push({key:"unit",text:`No active unit in this working tree: the user chose to change ${n.untrackedFiles.paths.join(", ")} without one since ${n.untrackedFiles.since}, so those changes belong to no unit; edits elsewhere are treated as usual. Starting a unit with ${$(e,"build")} <ID> ends this.`,fingerprint:`untracked-files:${n.untrackedFiles.since}:${n.untrackedFiles.paths.join(",")}`}):s.push({key:"unit",text:"No unit is active in this working tree.",fingerprint:""});if(n.paused&&n.paused.length>0){let i=(n.pausedCount??n.paused.length)-n.paused.length,r=n.paused.map(o=>`${o.id}${o.title?` "${o.title}"`:""} (paused by ${o.by} on ${o.at.slice(0,10)}${o.next?`; next: ${o.next}`:""})`);s.push({key:"paused",text:`Paused work in this spec tree: ${r.join("; ")}${i>0?`; and ${i} more`:""}. Offer it once, in one line, when the user's first message does not take the conversation elsewhere: ${$(e,"resume")} with its ID resumes it. Do not offer it again in this conversation.`,fingerprint:n.paused.map(o=>`${o.id}@${o.at}`).join(",")})}if(n.publishWaiting&&n.publishWaiting.count>0){let{shown:i,count:r}=n.publishWaiting;s.push({key:"publish",text:`Waiting to publish to the team's other tools: ${i.join("; ")}${r>i.length?`; and ${r-i.length} more`:""}. Offer once, in one line, to send ${r===1?"it":"them"}, when the user's first message does not take the conversation elsewhere; on a yes, query view publish prepares ${r===1?"it":"them"}. Do not offer it again in this conversation.`,fingerprint:`publish:${r}:${i.join(",")}`})}if(n.freshness?.status==="behind"&&s.push({key:"behind",text:"The spec tree was behind its remote at the last fetch, so work paused on another machine may not be here yet. Only when the user turns to work (resuming, building, or asking what is paused), offer once, in one line, to pull it first; do not raise it otherwise.",fingerprint:"behind"}),n.keptOut&&s.push({key:"traces",text:'BuildKeel is kept out of this repository: in commit messages, branch names, pull requests, code, comments and files here, name the work only by its ID, such as "Refs: TK-001", and never write "BuildKeel", "bk/" or a BuildKeel command. The plan and its records live in the spec repository.'+(n.localDir?` Write test reports under ${n.localDir}, not .buildkeel/, such as ${n.localDir}/junit.xml.`:""),fingerprint:"kept-out"}),s.push(Ip(n)),s.push({key:"knowledge",text:'When the user states a rule for how the team designs, tests or reviews code, such as "from now on we always...", it is a team practice: offer it in full, saved with save_draft type practice once the user agrees, never in your own memory. When a decision is hard to reverse, surprising without its context, and chosen over a real alternative, offer an ADR for it in one line; draft it with save_draft type adr only if the user agrees.'+(n.spikes===!1?"":` When the user asks for a spike, throwaway work to find something out, such as "let's spike the SMS provider", start it with manage action spike and a short name before writing any file, even a scratch one, and end it with manage action spike and end: true when they say so.`),fingerprint:n.spikes===!1?"no-spikes":""}),s.push({key:"rules",text:"Read and change the spec tree only through the BuildKeel tools, never by editing its files.",fingerprint:""}),s.push({key:"review",text:"Before you save anything to the spec tree, show what changes, in full, in your reply, and ask in plain text. Agreement saves it; anything else is feedback: discuss it, then list each point with how it was addressed, show the final version, and save only once the user agrees. When work would change a document the user agreed, say which, what and why, and take it through the same review. Never add, change or remove a requirement, criterion, scenario or task on your own initiative. Check a reported problem against the spec and its code first: propose, as your reading, a defect, a change in behavior, a gap or code no spec covers; record nothing until the user confirms. If agreed behavior looks wrong while building, stop and ask, naming the requirement, criterion or scenario and why; never build something else or edit the spec without the answer. Kept, build it as agreed; changed, update the spec first, then the code."+(n.mode==="spec-driven"?" Report each tick in a line; do not ask about ticks. Tick with save_draft tick, change one requirement with save_draft requirement, and read one file of a change with query file, rather than resending or rereading whole files.":""),fingerprint:n.mode==="spec-driven"?"spec-driven":""}),n.mode==="spec-driven")s.push({key:"stages",text:"This spec tree is Spec-driven: its capability specs say how the system behaves now, and each change says how it will change; nothing in it is approved. Before discussing how the system behaves, look up the capability specs with the BuildKeel query tool. Each BuildKeel command follows its part for a Spec-driven tree.",fingerprint:"spec-driven"},{key:"consistency",text:"When you edit one file of an open change (its proposal, a spec change, its design or its tasks), check the others against the edit, in any direction, and name the follow-on edits in the same reply; then take each through the review, one edit at a time, with what changes and why. Never edit code as part of this.",fingerprint:"spec-driven"},{key:"build",text:(n.keptOut?`While a change is open, commit each task's work as it is done, writing its unit line as "Refs: <change ID> task <number>" in a commit that does exactly that one task, and tick each task once its verification passes. `:`While a change is open, commit each task's work as it is done, adding "BuildKeel-Task: <number>" to a commit that does exactly that one task, and tick each task once its verification passes. `)+`Name a change with its title, never by its ID alone, such as CH-001 "Download historical market data". When the user asks in words to build a change's tasks, start ${$(e,"build")} for it, saying so in a line (D139); if they say to build here without it, build the tasks by the same rules, and if they say not now, build nothing. A specific edit they ask for needs no build. While building, stop and ask when a test fails and you cannot fix it, or a requirement is unclear. Before adding a requirement to a change with more than half its tasks ticked, ask once whether it belongs in that change or a new one, and draft nothing until they answer.`,fingerprint:`spec-driven|${e}`},{key:"tests",text:"Put the ID of the scenario a test checks in square brackets in the test's name, one ID per bracket.",fingerprint:"spec-driven"}),n.guide==="on"&&s.push({key:"guide",text:"This person chose to be guided through their first change: at each step of it, from drafting to finishing, add one or two plain lines on what just happened and what comes next, as BuildKeel's tool results say. If they ask you to stop explaining, turn it off with the BuildKeel manage tool (action guide, guide off).",fingerprint:"on"});else if(n.stages){let i=(n.stageExamples??[]).map(o=>`\`${o}\``),r=i.length>1?`${i.slice(0,-1).join(", ")} or ${i.at(-1)}`:i[0]??"";s.push({key:"stages",text:`This spec tree's stages, as the team names them: ${n.stages}. Use these names with the user, in each command's help, questions and output; BuildKeel's tools accept them as types, and the usual names too.`+(r?` Examples of what to draft, in the team's words: ${r}; use these in place of a command's usual examples.`:""),fingerprint:`${n.stages}|${i.join(",")}`})}return s}var Za=25;function Ip(n){let e=n.glossary??[],t=e.slice(0,Za).map(r=>`${r.term} (${r.definition}${r.avoid.length>0?`; not: ${r.avoid.join(", ")}`:""})`),s=e.slice(Za).map(r=>r.term);return{key:"terms",text:"Hold to precise words: when the user uses a term against the glossary, or against how the code uses it, say so and ask which meaning is meant, before anything else; when a term is vague or means two things, propose one precise term for each, with a concrete example at the boundary if it helps; once a term is settled, offer its glossary entry in full, saved with save_draft type glossary only once the user agrees."+(e.length>0?` The team's glossary: ${t.join("; ")}${s.length>0?`; and ${s.join(", ")} (query view glossary)`:""}.`:""),fingerprint:e.map(r=>`${r.term}:${r.definition}:${r.avoid.join(",")}`).join("|")}}var Lp=8e3;function tl(n,e){try{return Ei($p(n,"utf8").trimEnd(),e)}catch{return null}}function qp(n,e,t){return e.activeUnit?tl(Fi(n),t):null}function kn(n,e,t,s,i=[]){let r=el(qp(n,e,t),e,t,s,i);if(r.length<=Lp||!e.activeUnit)return r;let o=tl(Hi(n),t);return o?el(o,e,t,s,i):r}function el(n,e,t,s,i){let r=["BuildKeel:"];for(let o of hi(e,t)){let a=o.key==="unit"&&e.activeUnit?n?s?" Its context is loaded again below.":" Its context follows.":" BuildKeel has no context for it; call the BuildKeel get_context tool to see why.":"";r.push(`- ${o.text}${a}`)}return r.push(...i.map(o=>`- ${o}`)),n&&r.push("",n),r.join(`
|
|
145
|
+
`)}var nl=({event:n,codeRoot:e,cache:t,host:s})=>{if(n.kind!=="session-start")return null;let i=bn(t),r=n.reason==="compact"?[wn(e,i,s,n.conversation,n.transcript)]:n.reason==="resume"?[]:[pi(e,s),yn(e,i,s,n.conversation),mi(s)];return{context:kn(e,i,s,n.reason==="compact",r.filter(o=>o!==null))}};function pi(n,e){try{return Wa(n,e)}catch{return null}}function mi(n){try{return Va(zi(),n)}catch{return null}}var Up=(n,e)=>pt(n,e,"json"),il=(n,e)=>pt(n,e,"notices");function rl(n,e,t){let s=il(n,e);Dp(Hp(s,".."),{recursive:!0}),_p(s,`${JSON.stringify(t)}
|
|
146
|
+
`)}function Jp(n,e){let t=il(n,e),s=Wi(t),i;try{jp(t,s),i=Bp(s,"utf8")}catch{return[]}finally{Kp(s,{force:!0})}return i.split(`
|
|
147
|
+
`).filter(Boolean).flatMap(r=>{try{return[String(JSON.parse(r))]}catch{return[]}})}var Yp=n=>{let e=we(n);return e?.reported&&e.transcript?e:null},sl=mt;function Vp(n,e){let t;try{t=Mp(gt(n),"r")}catch{return{ok:!1,offset:e,checkpoint:null}}try{let s=Pp(t).size,i=s<e?0:e,r=Buffer.alloc(s-i),o=r.length>0?Rp(t,r,0,r.length,i):0,a=r.subarray(0,o).lastIndexOf(10);if(a<0)return{ok:!0,offset:i,checkpoint:null};let l=!0,c=null;for(let d of r.subarray(0,a).toString("utf8").split(`
|
|
148
|
+
`))if(d.trim())try{let u=JSON.parse(d);typeof u.step_index!="number"||typeof u.type!="string"?l=!1:u.type==="CHECKPOINT"&&(c=Math.max(c??-1,u.step_index))}catch{l=!1}return{ok:l,offset:i+a+1,checkpoint:c}}catch{return{ok:!1,offset:e,checkpoint:null}}finally{xp(t)}}function Wp(n){if(!n)return 0;try{return Fp(gt(n)).size}catch{return 0}}var ol=n=>{if(n.event.kind!=="prompt")return null;let e=Jp(n.codeRoot,n.event.conversation),s=[Gp(n)?.context,...e].filter(Boolean).join(`
|
|
144
149
|
|
|
145
|
-
`);return
|
|
146
|
-
`)),
|
|
150
|
+
`);return s?{context:s}:null},Gp=({event:n,codeRoot:e,cache:t,host:s})=>{if(n.kind!=="prompt")return null;let i=bn(t),r=Up(e,n.conversation),o=hi(i,s),a=Object.fromEntries(o.map(p=>[p.key,p.fingerprint])),l=Yp(r);if(!l){let p=new Date().toISOString(),g=we(r),h={...g,version:1,startedAt:g?.startedAt??p,conversation:n.conversation,...n.transcript?{transcriptPath:n.transcript}:{},lastSeen:p,activeUnit:i.activeUnit,reported:a,transcript:{offset:Wp(n.transcript),checkpoint:null}};sl(r,h);let m=yn(e,i,s,n.conversation),w=mi(s),k=pi(e,s);return{context:kn(e,i,s,!1,[k,m,w].filter(S=>S!==null))}}let c=n.transcript?Vp(n.transcript,l.transcript.offset):{ok:!1,offset:l.transcript.offset,checkpoint:null},d=c.checkpoint!==null&&(l.transcript.checkpoint===null||c.checkpoint>l.transcript.checkpoint),u={...l,conversation:n.conversation,...n.transcript?{transcriptPath:n.transcript}:{},...n.newMessage?{lastSeen:new Date().toISOString(),activeUnit:i.activeUnit}:{},transcript:{offset:c.offset,checkpoint:d?c.checkpoint:l.transcript.checkpoint}},f=null;if(d){let p=wn(e,i,s,n.conversation,n.transcript);f=kn(e,i,s,!0,p?[p]:[]),u.reported=a}else if(n.newMessage){let p=o.filter(g=>g.key!=="behind"&&l.reported[g.key]!==g.fingerprint).map(g=>`- ${g.text}`);if(!c.ok&&i.activeUnit){let g=`- Active unit: ${i.activeUnit}. If its requirements and test cases are no longer in view, call the BuildKeel get_context tool.`,h=p.findIndex(m=>m.startsWith("- Active unit:"));h>=0?p[h]=`${p[h]} If its requirements and test cases are no longer in view, call the BuildKeel get_context tool.`:p.unshift(g)}p.length>0&&(f=["BuildKeel:",...p].join(`
|
|
151
|
+
`)),u.reported=a}return JSON.stringify(u)!==JSON.stringify(l)&&sl(r,u),f?{context:f}:null},al=({event:n,codeRoot:e,cache:t})=>{if(n.kind!=="session-start"||!n.conversation)return null;try{Yi(e,n.conversation,n.transcript??null,new Date,t.activeUnit)}catch{}return null};import{appendFileSync as om,mkdirSync as am}from"node:fs";import{dirname as lm,join as cm,resolve as um}from"node:path";import{existsSync as Qp,realpathSync as ll}from"node:fs";import{basename as ml,dirname as cl,isAbsolute as zp,join as Xp,relative as gl,resolve as ul,sep as Zp}from"node:path";var gi={versions:"the frozen copy",approvals:"an approval record",completions:"a completion record",repins:"a re-pin decision record",notes:"a record of working notes",pauses:"a pause record",runs:"a test-run summary","test-runs":"a test-run summary",executions:"an execution record",reviews:"a record of review findings",answers:"the answer to a review finding"},em={glossary:"a version of a glossary entry",practices:"a version of a practice",adrs:"an architecture decision record",threads:"a record of a thread","code-notes":"a version of a note on the code",patterns:"a record of a declined pattern"},tm={"test-plan":"TP",design:"DD"},nm=()=>process.platform==="win32"||process.platform==="darwin",T=n=>nm()?n.toLowerCase():n;function oe(n,e){let t=fl(n,e);if(t!==null)return t;try{let s=e;for(;!Qp(s)&&cl(s)!==s;)s=cl(s);let i=Xp(ll(s),gl(s,e));return fl(ll(n),i)}catch{return null}}var me=(n,e)=>oe(n,e);function fl(n,e){let t=gl(n,e);return t===""||t.startsWith("..")||zp(t)?null:t.split(Zp).join("/")}var dl="Make the change you want through a new change, drafted with the BuildKeel save_draft tool (type change): finishing it writes the next versions.",sm="It is kept, read-only, as the history of how the system came to be before this spec tree moved to Full SDLC. Change behavior through the team's stages, as a new version of the artifact it became.";function hl(n,e){if(n.conversion!=="finished")return im(n,e);if(T(e)===T("onboarding/conversion.yaml"))return`BuildKeel: ${e} records how this spec tree moved to Full SDLC, and where each scenario went. It was finished when the tree switched, and is never edited.`;let[t]=e.split("/").map(T);return t!==T("capabilities")&&t!==T("changes")?null:`BuildKeel: ${e} is part of the capability specs and changes this spec tree had before it moved to Full SDLC. ${sm}`}function im(n,e){let t=e.split("/"),[s,,i]=t.map(T);if(s===T("capabilities")&&t.length>=3){let a=/^v(0|[1-9][0-9]*)\.(md|yaml)$/.exec(ml(e)),l=a?`${t[1]} v${a[1]}`:t[1]??"",c=a?.[2]==="yaml"?`the record of ${l}`:a?`${l}, a capability spec version`:`part of capability ${l}`;return`BuildKeel: ${e} is ${c}, written when a change was archived. Capability specs are never edited directly. ${dl}`}if(s!==T("changes")||t.length<3)return null;let r=za((t[1]??"").toUpperCase()),o=r??t[1]??"";return t.length===3&&i===T("discarded.yaml")?`BuildKeel: ${e} is the discard record of ${o}. BuildKeel writes it once when a change is discarded, and it is never edited.`:t.length===3&&i===T("archive.yaml")?`BuildKeel: ${e} is the archive record of ${o}, written once when it was archived. It is never edited.`:t.length===4&&i!==void 0&&Object.hasOwn(gi,i)?`BuildKeel: ${e} is ${gi[i]} of ${o}. BuildKeel writes these records once and they are never edited, by hand or by the agent.`:r&&(n.archivedChanges??[]).some(a=>T(a)===T(r))?`BuildKeel: ${e} belongs to ${o}, which is archived: its files are its record and are never edited. ${dl}`:null}function ct(n,e){let t=me(n.specRoot,e);if(t===null)return null;if(/^defects\/[^/]+\/closed\.yaml$/.test(T(t)))return`BuildKeel: ${t} is the closing record of ${t.split("/")[1]}. BuildKeel writes it once when the defect is closed, and it is never edited. A defect that returns is a new defect.`;let s=em[T(t.split("/")[0]??"")];return s&&t.includes("/")?`BuildKeel: ${t} is ${s}. BuildKeel writes these records through its tools, a new file for each change, and they are never edited, by hand or by the agent: save the change with the BuildKeel save_draft tool.`:n.mode==="spec-driven"?hl(n,t)??(n.conversion?pl(n,t):null):(n.conversion==="finished"?hl(n,t):null)??pl(n,t)}function pl(n,e){let t=e.split("/"),s=n.documents??tm,i=t.length>=4&&t[2]!==void 0&&Object.hasOwn(s,t[2])?s[t[2]]:void 0,r=i!==void 0,o=t[r?3:2],a=`${t[1]??""}${r?`-${i}`:""}`,l=r?5:4;if(o&&t.length===l&&n.lockedDirs.map(T).includes(T(o))){if(T(o)==="versions"){let u=/^v(0|[1-9][0-9]*)\.md$/.exec(ml(e))?.[1],f=u?`${a} v${u}`:a;return`BuildKeel: ${e} is the frozen copy of ${f}, which is approved and cannot be changed. To change ${a}, call the BuildKeel save_draft tool with id ${a} and the whole changed file: that opens the next version as a draft, and the approved version stays in force until the new one is approved.`}let d=gi[o.toLowerCase()]??"a record";return`BuildKeel: ${e} is ${d} of ${a}. BuildKeel writes these records once and they are never edited, by hand or by the agent.`+(T(o)==="approvals"?" To approve a new version, use the BuildKeel approve tool.":"")}if((n.lockedSources??[]).find(d=>T(e).startsWith(`${T(d)}/`))){let d=`${t[1]??""}${r?`-${i}`:""}`;return`BuildKeel: ${e} is a source kept with ${d} v0, frozen when version 0 was approved: sources stay exactly as they were read. To change what ${d} says, call the BuildKeel save_draft tool with id ${d} and the whole changed file: that opens its next version as a draft.`}return n.lockedFiles.some(d=>T(d)===T(e))?`BuildKeel: ${e} is the working file of ${a}, which is approved and has no new version open, so it is not edited directly. To change ${a}, call the BuildKeel save_draft tool with id ${a} and the whole changed file: that opens the next version as a draft, and the approved version stays in force until the new one is approved.`:null}function rm(n,e,t){let s=oe(e,t);return s===null?null:(n.copy??[]).some(r=>r.endsWith("/")?T(s).startsWith(T(r)):T(s)===T(r))?`BuildKeel: ${s} is the read-only copy of the spec tree's glossary, practices or ADRs, which BuildKeel writes. Change the glossary, a practice or an ADR through BuildKeel (save_draft with type glossary, practice or adr), and the copy is written again.`:null}var yl=({event:n,cache:e,codeRoot:t})=>{if(n.kind!=="before-edit"&&n.kind!=="after-edit")return null;let s=e.lockMode??"block";if(!(s==="block"?n.kind==="before-edit":s==="warn"&&n.kind==="after-edit"))return null;let r=n.files.map(o=>ct(e,ul(n.cwd,o))??rm(e,t,ul(n.cwd,o))).filter(o=>o!==null);return r.length===0?null:n.kind==="before-edit"?{block:[...new Set(r)].join(`
|
|
147
152
|
|
|
148
|
-
`)}:{context:
|
|
153
|
+
`)}:{context:r.map(o=>`BuildKeel: this tree's lock gate is set to warn, so the edit went ahead. ${o.replace(/^BuildKeel: /,"")} Validation and the status overview report the change. Tell the user, and undo it unless they asked for it.`).join(`
|
|
149
154
|
|
|
150
|
-
`)}};var
|
|
155
|
+
`)}};var yi=(n,e)=>cm(P(n),"journal",`${e}.jsonl`),wl=({event:n,codeRoot:e,cache:t})=>{if(n.kind!=="after-edit"||!t.activeUnit)return null;let s=new Date().toISOString(),i=[];for(let o of n.files){let a=um(n.cwd,o);if(ct(t,a)||me(t.specRoot,a)!==null)continue;let l=oe(e,a);if(l===null||l===R||l.startsWith(`${R}/`))continue;let c={at:s,tool:n.tool,file:l};i.push(JSON.stringify(c))}if(i.length===0)return null;let r=yi(e,t.activeUnit);return am(lm(r),{recursive:!0}),om(r,`${i.join(`
|
|
151
156
|
`)}
|
|
152
|
-
`),null};var
|
|
153
|
-
`)
|
|
157
|
+
`),null};var fm=/\bgit(?:\s+-{1,2}[^\s;&|]+(?:\s+(?!push\b)[^\s;&|-][^\s;&|]*)?)*\s+push\b|\bgh\s+pr\s+(?:create|merge)\b/,dm=n=>fm.test(n),bl=({event:n,cache:e,host:t})=>{if(n.kind!=="before-shell"&&n.kind!=="after-shell"||!e.activeUnit||!dm(n.command))return null;let s=n.kind==="after-shell"?` The command \`${n.command}\` has run.`:" The command goes ahead.";return{context:`BuildKeel: ${gn(e.activeUnit,e.activeTitle)} is not finished: tell the user to run ${$(t,"done")} before merging.${s}`}};import{mkdirSync as hm,writeFileSync as pm}from"node:fs";import{join as mm}from"node:path";var gm="last-message",kl=({event:n,codeRoot:e})=>{if(!(n.kind==="message"||n.kind==="prompt"&&n.newMessage))return null;try{hm(P(e),{recursive:!0}),pm(mm(P(e),gm),`${new Date().toISOString()}
|
|
158
|
+
`)}catch{}return null};var Sl=Le(Ie(),1);import{spawnSync as ym}from"node:child_process";import{existsSync as wm,mkdirSync as bm,readFileSync as km,writeFileSync as Sm}from"node:fs";import{join as wi,resolve as vm}from"node:path";var vl=({event:n,codeRoot:e,cache:t,host:s})=>{if(n.kind!=="before-edit"||t.activeUnit||t.untrackedSince||$m(e))return null;let i=n.files.flatMap(d=>{let u=vm(n.cwd,d);if(me(t.specRoot,u)!==null)return[];let f=oe(e,u);return f===null||f===R||f.startsWith(`${R}/`)?[]:[f]});if(i.length===0||t.merging&&i.every(d=>t.merging?.files.includes(d)))return null;let r=t.untrackedFiles?.paths??[],o=i.filter(d=>!r.some(u=>Em(d,u)));if(o.length===0)return null;let a=Lm(t)==="warn";if(a&&n.conversation&&Om(e,n.conversation))return null;let l=Cm(e,o),c=o.filter(d=>!l.has(d));return c.length===0?null:a?(n.conversation&&Tm(e,n.conversation),{context:Nm(c,t,s)}):{block:Am(c,t,s)}};function Al(n,e,t=""){return`capture what you discussed, which the user starts by running ${$(e,"capture")} or by asking for it, turning it into ${n.mode==="spec-driven"?"a change to build":"the artifacts the team's process needs, to approve and then build"}; start the unit it belongs to with ${$(e,"build")} <ID>; ${t}record it as an ad-hoc unit, with a short title you propose (create it with the BuildKeel save_draft tool, type adhoc, then start it with start_work)`}function Am(n,e,t){return`BuildKeel: there is no active unit in this working tree, so a change to ${n.join(", ")} would belong to no unit of work. Before changing it, ask the user how to go on, recommending the choice that fits: ${Al(e,t)}; or go ahead without a unit, which only the user can choose, either for just these files (offer this first: call the BuildKeel manage tool with action untracked, scope files and files ${JSON.stringify(n)}, or the folders the user names) or for the whole working tree (action untracked, scope tree). Make the change once one of these is done.`}function Nm(n,e,t){return`BuildKeel: no unit is active in this working tree, so this change to ${n.join(", ")} belongs to no unit of work, and its commits will be listed by the status overview as having no unit. It goes ahead, as this person's code-edits setting is warn. Tell the user once, in a line, and offer to give the work a unit: ${Al(e,t,"or ")}. This is said once in this conversation; later edits go ahead without it.`}function Em(n,e){let t=e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"");return t===""||t==="."||n===t||n.startsWith(`${t}/`)}function Cm(n,e){try{let t=ym("git",["check-ignore","--stdin"],{cwd:n,input:`${e.join(`
|
|
159
|
+
`)}
|
|
160
|
+
`,encoding:"utf8",timeout:1e3,windowsHide:!0});return t.status!==0||t.error?new Set:new Set(t.stdout.split(/\r?\n/).filter(Boolean).map(s=>s.replaceAll("\\","/")))}catch{return new Set}}var Nl=(n,e)=>wi(P(n),"conversations",`${e.replace(/[^A-Za-z0-9._-]/g,"_")}.no-unit-warned`);function Om(n,e){return wm(Nl(n,e))}function Tm(n,e){try{let t=Nl(n,e);bm(wi(t,".."),{recursive:!0}),Sm(t,`${new Date().toISOString()}
|
|
161
|
+
`)}catch{}}var $m=n=>{let e=n.replaceAll("\\","/").replace(/\/$/,"").split("/");return(e.at(-3)===R||e.at(-3)==="buildkeel"&&e.at(-4)===".git")&&e.at(-2)==="worktrees"&&(e.at(-1)??"").startsWith(Ki)},Im="buildkeel.yaml";function Lm(n){let e;try{e=(0,Sl.parse)(km(wi(n.specRoot,Im),"utf8"))?.process}catch{return n.codeEdits??pe(n.mode,void 0).codeEdits.value}return pe(n.mode,e).codeEdits.value}import{readFileSync as qm}from"node:fs";import{resolve as _m}from"node:path";function bi(n,e){return e.some(t=>t.endsWith("/")?n.startsWith(t):n===t||n.startsWith(`${t}/`))}function ki(n){let e=n.split("/"),t=e.at(-1)??"";return e.slice(0,-1).some(s=>["test","tests","__tests__","spec"].includes(s))||/[._-](test|spec)\.[^.]+$/.test(t)||/^test_.*\.py$/.test(t)}var Si=8;function xm(n,e){try{let t=qm(yi(n,e),"utf8").split(`
|
|
162
|
+
`).filter(Boolean);return new Set(t.map(s=>JSON.parse(s).file))}catch{return new Set}}var El=({event:n,codeRoot:e,cache:t})=>{if(n.kind!=="after-edit"||!t.activeUnit||t.scope.length===0)return null;let s=xm(e,t.activeUnit),i=[];for(let a of n.files){let l=_m(n.cwd,a);if(ct(t,l)||me(t.specRoot,l)!==null)continue;let c=oe(e,l);c===null||c===R||c.startsWith(`${R}/`)||!bi(c,t.scope)&&!ki(c)&&!s.has(c)&&!i.includes(c)&&i.push(c)}if(i.length===0)return null;let r=t.activeUnit,o=t.scope.slice(0,Si).join(", ")+(t.scope.length>Si?`, and ${t.scope.length-Si} more`:"");return{context:`BuildKeel: ${i.join(", ")} ${i.length===1?"is":"are"} outside the areas ${r} relates to so far (${o}): its scope and its story's, and what its own work and the other work on its story changed. If the change belongs to ${r}, carry on and tell the user it widens what ${r} touches. If it belongs to other work, stop and ask the user which unit it belongs to.`}};function Cl(n,e,t="claude-code"){if(n.kind==="ignored")return{};let s=Km(n)??qe(n.cwd);if(!s)return n.kind==="session-start"&&n.reason==="startup"?Rm(n.cwd,t):{};let i=Ui(s);if(!i)return{};let r=e.map(l=>l({event:n,codeRoot:s,cache:i,host:t})).filter(l=>l!==null),o=r.find(l=>l.block)?.block,a=r.map(l=>l.context).filter(Boolean).join(`
|
|
154
163
|
|
|
155
|
-
`);return a&&
|
|
156
|
-
`),1;let i=
|
|
157
|
-
`);let o=
|
|
158
|
-
`);let{stdout:o,exitCode:a}=
|
|
164
|
+
`);return a&&(n.kind==="after-edit"||n.kind==="after-shell"||n.kind==="before-edit")&&n.deferTo?(rl(s,n.deferTo,a),o?{block:o}:{}):{...o?{block:o}:{},...a?{context:a}:{}}}function Rm(n,e){let t=jm(n),s=t?Ri(t):null;return!t||!s?{}:{context:`BuildKeel is not set up in this clone, and the spec repository beside it, ${ji(t,s)}, registers this repository: the team keeps BuildKeel out of the repository, so each clone is pointed at it once. Offer once, in one line, to point this clone at it with ${$(e,"init")}: it keeps BuildKeel out of this clone too.`}}function jm(n){let e=Bm(n);for(;;){if(Pm(Mm(e,".git")))return e;let t=Dm(e);if(t===e)return null;e=t}}function Km(n){if(n.kind!=="before-edit"&&n.kind!=="after-edit")return null;let e=n.files[0],t=e?/^(.*[\\/](?:\.buildkeel|\.git[\\/]buildkeel)[\\/]worktrees[\\/][^\\/]+)[\\/]/.exec(e)?.[1]:void 0;return t?qe(t):null}var Ol=[yl,vl,El,wl,al,nl,ol,bl,kl];var Um={"claude-code":Di,antigravity:xi};function Jm(n){let e=n.indexOf("--host"),t=e>=0?n[e+1]:void 0,s=t&&Ni(t)?Um[t]:void 0;if(!s)return process.stderr.write(`BuildKeel hook: unsupported host "${t??""}".
|
|
165
|
+
`),1;let i=n.filter((r,o)=>o!==e&&o!==e+1);try{let r=Hm(0,"utf8");process.env.BUILDKEEL_HOOK_LOG&&Fm(process.env.BUILDKEEL_HOOK_LOG,`${JSON.stringify({host:t,args:i,input:r.trim()?JSON.parse(r):null})}
|
|
166
|
+
`);let o=s.parse(r.trim()?JSON.parse(r):{},i),a=Cl(o,Ol,t),{stdout:l,exitCode:c}=s.render(a,o);return l&&process.stdout.write(l),c}catch(r){process.stderr.write(`BuildKeel hook failed: ${r instanceof Error?r.message:String(r)}
|
|
167
|
+
`);let{stdout:o,exitCode:a}=s.failed(i);return o&&process.stdout.write(o),a}}process.exitCode=Jm(process.argv.slice(2));
|