buildkeel 0.7.0 → 0.7.1

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.
Files changed (89) hide show
  1. package/README.md +11 -1
  2. package/antigravity/agents/bk-break-it-pro.md +25 -0
  3. package/antigravity/agents/bk-designer-pro.md +20 -0
  4. package/antigravity/agents/bk-edge-cases-pro.md +31 -0
  5. package/antigravity/agents/bk-final-quality-reviewer-pro.md +47 -0
  6. package/antigravity/agents/bk-final-spec-reviewer-pro.md +37 -0
  7. package/antigravity/agents/bk-implementer-pro.md +40 -0
  8. package/antigravity/agents/bk-note-checker-pro.md +26 -0
  9. package/antigravity/agents/bk-quality-reviewer-pro.md +47 -0
  10. package/antigravity/agents/bk-readiness-reader-pro.md +28 -0
  11. package/antigravity/agents/bk-spec-reviewer-pro.md +37 -0
  12. package/antigravity/dist/hooks/main.js +91 -91
  13. package/antigravity/dist/server/main.js +567 -555
  14. package/antigravity/package.json +1 -1
  15. package/antigravity/plugin.json +1 -1
  16. package/antigravity/rules/buildkeel.md +1 -1
  17. package/antigravity/skills/bk-build/SKILL.md +3 -3
  18. package/antigravity/skills/bk-done/SKILL.md +1 -1
  19. package/antigravity/skills/bk-init/SKILL.md +4 -0
  20. package/antigravity/skills/bk-models/SKILL.md +16 -0
  21. package/antigravity/skills/bk-review/SKILL.md +1 -1
  22. package/cli.mjs +27 -27
  23. package/package.json +15 -3
  24. package/pi/LICENSE +49 -0
  25. package/pi/THIRD-PARTY-NOTICES +231 -0
  26. package/pi/agents/bk-break-it.md +17 -0
  27. package/pi/agents/bk-designer.md +12 -0
  28. package/pi/agents/bk-edge-cases.md +23 -0
  29. package/pi/agents/bk-final-quality-reviewer.md +39 -0
  30. package/pi/agents/bk-final-spec-reviewer.md +29 -0
  31. package/pi/agents/bk-implementer.md +32 -0
  32. package/pi/agents/bk-note-checker.md +18 -0
  33. package/pi/agents/bk-quality-reviewer.md +39 -0
  34. package/pi/agents/bk-readiness-reader.md +20 -0
  35. package/pi/agents/bk-spec-reviewer.md +29 -0
  36. package/pi/agents/index.json +135 -0
  37. package/pi/bin/bk-launch +34 -0
  38. package/pi/bin/bk-launch.cmd +36 -0
  39. package/pi/bin/bk-start.cjs +28 -0
  40. package/pi/dist/hooks/main.js +167 -0
  41. package/pi/dist/server/main.js +788 -0
  42. package/pi/extension.js +238 -0
  43. package/pi/package.json +8 -0
  44. package/pi/practices/P-01.md +7 -0
  45. package/pi/practices/P-02.md +7 -0
  46. package/pi/practices/P-03.md +7 -0
  47. package/pi/practices/P-04.md +7 -0
  48. package/pi/practices/P-05.md +7 -0
  49. package/pi/practices/P-06.md +7 -0
  50. package/pi/practices/P-07.md +7 -0
  51. package/pi/practices/P-08.md +7 -0
  52. package/pi/practices/P-09.md +7 -0
  53. package/pi/practices/P-10.md +7 -0
  54. package/pi/practices/P-11.md +7 -0
  55. package/pi/practices/P-12.md +7 -0
  56. package/pi/practices/P-13.md +7 -0
  57. package/pi/practices/P-14.md +7 -0
  58. package/pi/practices/P-15.md +7 -0
  59. package/pi/prompts/bk-approve.md +53 -0
  60. package/pi/prompts/bk-build.md +251 -0
  61. package/pi/prompts/bk-capture.md +210 -0
  62. package/pi/prompts/bk-done.md +115 -0
  63. package/pi/prompts/bk-impact.md +51 -0
  64. package/pi/prompts/bk-init.md +95 -0
  65. package/pi/prompts/bk-migrate.md +73 -0
  66. package/pi/prompts/bk-models.md +11 -0
  67. package/pi/prompts/bk-new.md +124 -0
  68. package/pi/prompts/bk-onboard.md +137 -0
  69. package/pi/prompts/bk-pause.md +52 -0
  70. package/pi/prompts/bk-resume.md +31 -0
  71. package/pi/prompts/bk-review.md +52 -0
  72. package/pi/prompts/bk-settings.md +13 -0
  73. package/pi/prompts/bk-stats.md +36 -0
  74. package/pi/prompts/bk-status.md +13 -0
  75. package/pi/skills/buildkeel/SKILL.md +68 -0
  76. package/pi/templates/adhoc.md +15 -0
  77. package/pi/templates/adr.md +31 -0
  78. package/pi/templates/defect.md +35 -0
  79. package/pi/templates/design.md +49 -0
  80. package/pi/templates/epic.md +31 -0
  81. package/pi/templates/idea.md +35 -0
  82. package/pi/templates/spec-driven/capability.md +28 -0
  83. package/pi/templates/spec-driven/proposal.md +41 -0
  84. package/pi/templates/spec-driven/spec-change.md +43 -0
  85. package/pi/templates/spec-driven/tasks.md +25 -0
  86. package/pi/templates/story.md +31 -0
  87. package/pi/templates/task.md +43 -0
  88. package/pi/templates/test-plan.md +29 -0
  89. package/pi/templates/thread.md +41 -0
@@ -0,0 +1,167 @@
1
+ import { createRequire as __bkCreateRequire } from 'node:module'; const require = __bkCreateRequire(import.meta.url);
2
+ var Il=Object.create;var Ni=Object.defineProperty;var Ll=Object.getOwnPropertyDescriptor;var _l=Object.getOwnPropertyNames;var ql=Object.getPrototypeOf,xl=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 Pl=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _l(e))!xl.call(n,i)&&i!==t&&Ni(n,i,{get:()=>e[i],enumerable:!(s=Ll(e,i))||s.enumerable});return n};var Le=(n,e,t)=>(t=n!=null?Il(ql(n)):{},Pl(e||!n||!n.__esModule?Ni(t,"default",{value:n,enumerable:!0}):t,n));var N=y(x=>{"use strict";var In=Symbol.for("yaml.alias"),er=Symbol.for("yaml.document"),wt=Symbol.for("yaml.map"),tr=Symbol.for("yaml.pair"),Ln=Symbol.for("yaml.scalar"),bt=Symbol.for("yaml.seq"),Y=Symbol.for("yaml.node.type"),qc=n=>!!n&&typeof n=="object"&&n[Y]===In,xc=n=>!!n&&typeof n=="object"&&n[Y]===er,Pc=n=>!!n&&typeof n=="object"&&n[Y]===wt,Dc=n=>!!n&&typeof n=="object"&&n[Y]===tr,nr=n=>!!n&&typeof n=="object"&&n[Y]===Ln,Mc=n=>!!n&&typeof n=="object"&&n[Y]===bt;function sr(n){if(n&&typeof n=="object")switch(n[Y]){case wt:case bt:return!0}return!1}function Bc(n){if(n&&typeof n=="object")switch(n[Y]){case In:case wt:case Ln:case bt:return!0}return!1}var Rc=n=>(nr(n)||sr(n))&&!!n.anchor;x.ALIAS=In;x.DOC=er;x.MAP=wt;x.NODE_TYPE=Y;x.PAIR=tr;x.SCALAR=Ln;x.SEQ=bt;x.hasAnchor=Rc;x.isAlias=qc;x.isCollection=sr;x.isDocument=xc;x.isMap=Pc;x.isNode=Bc;x.isPair=Dc;x.isScalar=nr;x.isSeq=Mc});var qe=y(_n=>{"use strict";var q=N(),M=Symbol("break visit"),ir=Symbol("skip children"),H=Symbol("remove node");function kt(n,e){let t=rr(e);q.isDocument(n)?be(null,n.contents,t,Object.freeze([n]))===H&&(n.contents=null):be(null,n,t,Object.freeze([]))}kt.BREAK=M;kt.SKIP=ir;kt.REMOVE=H;function be(n,e,t,s){let i=or(n,e,t,s);if(q.isNode(i)||q.isPair(i))return ar(n,s,i),be(n,i,t,s);if(typeof i!="symbol"){if(q.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(q.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 St(n,e){let t=rr(e);q.isDocument(n)?await ke(null,n.contents,t,Object.freeze([n]))===H&&(n.contents=null):await ke(null,n,t,Object.freeze([]))}St.BREAK=M;St.SKIP=ir;St.REMOVE=H;async function ke(n,e,t,s){let i=await or(n,e,t,s);if(q.isNode(i)||q.isPair(i))return ar(n,s,i),ke(n,i,t,s);if(typeof i!="symbol"){if(q.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(q.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 rr(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 or(n,e,t,s){if(typeof t=="function")return t(n,e,s);if(q.isMap(e))return t.Map?.(n,e,s);if(q.isSeq(e))return t.Seq?.(n,e,s);if(q.isPair(e))return t.Pair?.(n,e,s);if(q.isScalar(e))return t.Scalar?.(n,e,s);if(q.isAlias(e))return t.Alias?.(n,e,s)}function ar(n,e,t){let s=e[e.length-1];if(q.isCollection(s))s.items[n]=t;else if(q.isPair(s))n==="key"?s.key=t:s.value=t;else if(q.isDocument(s))s.contents=t;else{let i=q.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}_n.visit=kt;_n.visitAsync=St});var qn=y(cr=>{"use strict";var lr=N(),jc=qe(),Kc={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Fc=n=>n.replace(/[!,[\]{}]/g,e=>Kc[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+Fc(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&&lr.isNode(e.contents)){let r={};jc.visit(e.contents,(o,a)=>{lr.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:"};cr.Directives=xe});var vt=y(Pe=>{"use strict";var ur=N(),Hc=qe();function Uc(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 fr(n){let e=new Set;return Hc.visit(n,{Value(t,s){s.anchor&&e.add(s.anchor)}}),e}function dr(n,e){for(let t=1;;++t){let s=`${n}${t}`;if(!e.has(s))return s}}function Jc(n,e){let t=[],s=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=fr(n));let o=dr(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(ur.isScalar(o.node)||ur.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=Uc;Pe.anchorNames=fr;Pe.createNodeAnchors=Jc;Pe.findNewAnchor=dr});var xn=y(hr=>{"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)}hr.applyReviver=De});var G=y(mr=>{"use strict";var Yc=N();function pr(n,e,t){if(Array.isArray(n))return n.map((s,i)=>pr(s,String(i),t));if(n&&typeof n.toJSON=="function"){if(!t||!Yc.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}mr.toJS=pr});var At=y(yr=>{"use strict";var Wc=xn(),gr=N(),Vc=G(),Pn=class{constructor(e){Object.defineProperty(this,gr.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(!gr.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=Vc.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?Wc.applyReviver(r,{"":a},"",a):a}};yr.NodeBase=Pn});var Me=y(wr=>{"use strict";var Gc=vt(),Qc=qe(),Se=N(),zc=At(),Xc=G(),Dn=class extends zc.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=[],Qc.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||(Xc.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=Et(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(Gc.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 Et(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=Et(n,i,t);r>s&&(s=r)}return s}else if(Se.isPair(e)){let s=Et(n,e.key,t),i=Et(n,e.value,t);return Math.max(s,i)}return 1}wr.Alias=Dn});var I=y(Mn=>{"use strict";var Zc=N(),eu=At(),tu=G(),nu=n=>!n||typeof n!="function"&&typeof n!="object",Q=class extends eu.NodeBase{constructor(e){super(Zc.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:tu.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";Mn.Scalar=Q;Mn.isScalarValue=nu});var Be=y(kr=>{"use strict";var su=Me(),le=N(),br=I(),iu="tag:yaml.org,2002:";function ru(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 ou(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 su.Alias(l.anchor);l={anchor:null,node:null},a.set(n,l)}e?.startsWith("!!")&&(e=iu+e.slice(2));let c=ru(n,e,o.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let u=new br.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 br.Scalar(n);return e?d.tag=e:c.default||(d.tag=c.tag),l&&(l.node=d),d}kr.createNode=ou});var Ot=y(Nt=>{"use strict";var au=Be(),U=N(),lu=At();function Bn(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 au.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 Sr=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,Rn=class extends lu.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(Sr(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,Bn(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,Bn(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};Nt.Collection=Rn;Nt.collectionFromPath=Bn;Nt.isEmptyPath=Sr});var Re=y(Ct=>{"use strict";var cu=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function jn(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var uu=(n,e,t)=>n.endsWith(`
4
+ `)?jn(t,e):t.includes(`
5
+ `)?`
6
+ `+jn(t,e):(n.endsWith(" ")?"":" ")+t;Ct.indentComment=jn;Ct.lineComment=uu;Ct.stringifyComment=cu});var Ar=y(je=>{"use strict";var fu="flow",Kn="block",Tt="quoted";function du(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===Kn&&(h=vr(n,h,e.length),h!==-1&&(u=h+l));for(let S;S=n[h+=1];){if(t===Tt&&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===Kn&&(h=vr(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===Tt){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===Tt&&d[v]&&(k+=`${n[v]}\\`),k+=`
11
+ ${e}${n.slice(v+1,A)}`)}return k}function vr(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=Kn;je.FOLD_FLOW=fu;je.FOLD_QUOTED=Tt;je.foldFlowLines=du});var Fe=y(Er=>{"use strict";var K=I(),z=Ar(),It=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),Lt=n=>/^(%|---|\.\.\.)/m.test(n);function hu(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||(Lt(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
+
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,s?o:z.foldFlowLines(o,r,z.FOLD_QUOTED,It(e,!1))}function Fn(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||(Lt(n)?" ":""),s="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
18
+ ${t}`)+"'";return e.implicitKey?s:z.foldFlowLines(s,t,z.FOLD_FLOW,It(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=Fn:r&&!i?s=Ke:s=t?Fn:Ke}return s(n,e)}var Hn;try{Hn=new RegExp(`(^|(?<!
19
+ ))
20
+ +(?!
21
+ |$)`,"g")}catch{Hn=/\n+(?!\n|$)/g}function $t({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||Lt(t)?" ":""),d=o==="literal"?!0:o==="folded"||e===K.Scalar.BLOCK_FOLDED?!1:e===K.Scalar.BLOCK_LITERAL?!0:!hu(t,l,c.length);if(!t)return d?`|
22
+ `:`>
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(Hn,`$&${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}`),E=!1,C=It(s,!0);o!=="folded"&&e!==K.Scalar.BLOCK_FOLDED&&(C.onOverflow=()=>{E=!0});let b=z.foldFlowLines(`${k}${A}${p}`,c,z.FOLD_BLOCK,C);if(!E)return`>${v}
29
+ ${c}${b}`}return t=t.replace(/\n+/g,`$&${c}`),`|${v}
30
+ ${c}${k}${t}${p}`}function pu(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):$t(n,e,t,s);if(!a&&!d&&i!==K.Scalar.PLAIN&&r.includes(`
33
+ `))return $t(n,e,t,s);if(Lt(r)){if(l==="")return e.forceBlockIndent=!0,$t(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,It(e,!1))}function mu(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):$t(o,e,t,s);case K.Scalar.QUOTE_DOUBLE:return Ke(o.value,e);case K.Scalar.QUOTE_SINGLE:return Fn(o.value,e);case K.Scalar.PLAIN:return pu(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}Er.stringifyString=mu});var He=y(Un=>{"use strict";var gu=vt(),X=N(),yu=Re(),wu=Fe();function bu(n,e){let t=Object.assign({blockQuote:!0,commentString:yu.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 ku(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 Su(n,e,{anchors:t,doc:s}){if(!s.directives)return"";let i=[],r=(X.isScalar(n)||X.isCollection(n))&&n.anchor;r&&gu.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 vu(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=ku(e.doc.schema.tags,r));let o=Su(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)?wu.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}Un.createStringifyContext=bu;Un.stringify=vu});var Tr=y(Cr=>{"use strict";var W=N(),Nr=I(),Or=He(),Ue=Re();function Au({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=W.isNode(n)&&n.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(W.isCollection(n)||!W.isNode(n)&&typeof n=="object"){let C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!u&&(!n||f&&e==null&&!t.inFlow||W.isCollection(n)||(W.isScalar(n)?n.type===Nr.Scalar.BLOCK_FOLDED||n.type===Nr.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=Or.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;W.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&&W.isScalar(e)&&(t.indentAtStart=m.length+1),h=!1,!d&&l.length>=2&&!t.inFlow&&!p&&W.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let v=!1,A=Or.stringify(e,t,()=>v=!0,()=>h=!0),E=" ";if(f||w||k){if(E=w?`
37
+ `:"",k){let C=c(k);E+=`
38
+ ${Ue.indentComment(C,t.indent)}`}A===""&&!t.inFlow?E===`
39
+ `&&S&&(E=`
40
+
41
+ `):E+=`
42
+ ${t.indent}`}else if(!p&&W.isCollection(e)){let C=A[0],b=A.indexOf(`
43
+ `),L=b!==-1,V=t.inFlow??e.flow??e.items.length===0;if(L||!V){let ge=!1;if(L&&(C==="&"||C==="!")){let _=A.indexOf(" ");C==="&"&&_!==-1&&_<b&&A[_+1]==="!"&&(_=A.indexOf(" ",_+1)),(_===-1||b<_)&&(ge=!0)}ge||(E=`
44
+ ${t.indent}`)}}else(A===""||A[0]===`
45
+ `)&&(E="");return m+=E+A,t.inFlow?v&&s&&s():S&&!v?m+=Ue.lineComment(m,t.indent,c(S)):h&&i&&i(),m}Cr.stringifyPair=Au});var Yn=y(Jn=>{"use strict";var $r=ut("process");function Eu(n,...e){n==="debug"&&console.log(...e)}function Nu(n,e){(n==="debug"||n==="warn")&&(typeof $r.emitWarning=="function"?$r.emitWarning(e):console.warn(e))}Jn.debug=Eu;Jn.warn=Nu});var Dt=y(Pt=>{"use strict";var xt=N(),Ir=I(),_t="<<",qt={identify:n=>n===_t||typeof n=="symbol"&&n.description===_t,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ir.Scalar(Symbol(_t)),{addToJSMap:Lr}),stringify:()=>_t},Ou=(n,e)=>(qt.identify(e)||xt.isScalar(e)&&(!e.type||e.type===Ir.Scalar.PLAIN)&&qt.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===qt.tag&&t.default);function Lr(n,e,t){let s=_r(n,t);if(xt.isSeq(s))for(let i of s.items)Wn(n,e,i);else if(Array.isArray(s))for(let i of s)Wn(n,e,i);else Wn(n,e,s)}function Wn(n,e,t){let s=_r(n,t);if(!xt.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 _r(n,e){return n&&xt.isAlias(e)?e.resolve(n.doc,n):e}Pt.addMergeToJSMap=Lr;Pt.isMergeKey=Ou;Pt.merge=qt});var Gn=y(Pr=>{"use strict";var Cu=Yn(),qr=Dt(),Tu=He(),xr=N(),Vn=G();function $u(n,e,{key:t,value:s}){if(xr.isNode(t)&&t.addToJSMap)t.addToJSMap(n,e,s);else if(qr.isMergeKey(n,t))qr.addMergeToJSMap(n,e,s);else{let i=Vn.toJS(t,"",n);if(e instanceof Map)e.set(i,Vn.toJS(s,i,n));else if(e instanceof Set)e.add(i);else{let r=Iu(t,i,n),o=Vn.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 Iu(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(xr.isNode(n)&&t?.doc){let s=Tu.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)+'..."'),Cu.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)}Pr.addPairToJSMap=$u});var Z=y(Qn=>{"use strict";var Dr=Be(),Lu=Tr(),_u=Gn(),Mt=N();function qu(n,e,t){let s=Dr.createNode(n,void 0,t),i=Dr.createNode(e,void 0,t);return new Bt(s,i)}var Bt=class n{constructor(e,t=null){Object.defineProperty(this,Mt.NODE_TYPE,{value:Mt.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:s}=this;return Mt.isNode(t)&&(t=t.clone(e)),Mt.isNode(s)&&(s=s.clone(e)),new n(t,s)}toJSON(e,t){let s=t?.mapAsMap?new Map:{};return _u.addPairToJSMap(t,s,this)}toString(e,t,s){return e?.doc?Lu.stringifyPair(this,e,t,s):JSON.stringify(this)}};Qn.Pair=Bt;Qn.createPair=qu});var zn=y(Br=>{"use strict";var ce=N(),Mr=He(),Rt=Re();function xu(n,e,t){return(e.inFlow??n.flow?Du:Pu)(n,e,t)}function Pu({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(""),jt(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(""),jt(t,f,k.commentBefore,u))}u=!1;let w=Mr.stringify(h,d,()=>m=null,()=>u=!0);m&&(w+=Rt.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
+ `+Rt.indentComment(c(n),l),a&&a()):u&&o&&o(),p}function Du({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(""),jt(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(""),jt(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=Mr.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+=Rt.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 jt({indent:n,options:{commentString:e}},t,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=Rt.indentComment(e(s),n);t.push(r.trimStart())}}Br.stringifyCollection=xu});var te=y(Zn=>{"use strict";var Mu=zn(),Bu=Gn(),Ru=Ot(),ee=N(),Kt=Z(),ju=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 Xn=class extends Ru.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(Kt.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 Kt.Pair(e,e?.value):s=new Kt.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)&&ju.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 Kt.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)Bu.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})),Mu.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:t})}};Zn.YAMLMap=Xn;Zn.findPair=Je});var Ae=y(jr=>{"use strict";var Ku=N(),Rr=te(),Fu={collection:"map",default:!0,nodeClass:Rr.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(n,e){return Ku.isMap(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>Rr.YAMLMap.from(n,e,t)};jr.map=Fu});var ne=y(Kr=>{"use strict";var Hu=Be(),Uu=zn(),Ju=Ot(),Ht=N(),Yu=I(),Wu=G(),es=class extends Ju.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ht.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Ft(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let s=Ft(e);if(typeof s!="number")return;let i=this.items[s];return!t&&Ht.isScalar(i)?i.value:i}has(e){let t=Ft(e);return typeof t=="number"&&t<this.items.length}set(e,t){let s=Ft(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[s];Ht.isScalar(i)&&Yu.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(Wu.toJS(r,String(i++),t));return s}toString(e,t,s){return e?Uu.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(Hu.createNode(a,void 0,s))}}return r}};function Ft(n){let e=Ht.isScalar(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Kr.YAMLSeq=es});var Ee=y(Hr=>{"use strict";var Vu=N(),Fr=ne(),Gu={collection:"seq",default:!0,nodeClass:Fr.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(n,e){return Vu.isSeq(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>Fr.YAMLSeq.from(n,e,t)};Hr.seq=Gu});var Ye=y(Ur=>{"use strict";var Qu=Fe(),zu={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),Qu.stringifyString(n,e,t,s)}};Ur.string=zu});var Ut=y(Wr=>{"use strict";var Jr=I(),Yr={identify:n=>n==null,createNode:()=>new Jr.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Jr.Scalar(null),stringify:({source:n},e)=>typeof n=="string"&&Yr.test.test(n)?n:e.options.nullStr};Wr.nullTag=Yr});var ts=y(Gr=>{"use strict";var Xu=I(),Vr={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new Xu.Scalar(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&Vr.test.test(n)){let s=n[0]==="t"||n[0]==="T";if(e===s)return n}return e?t.options.trueStr:t.options.falseStr}};Gr.boolTag=Vr});var Ne=y(Qr=>{"use strict";function Zu({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}Qr.stringifyNumber=Zu});var ss=y(Jt=>{"use strict";var ef=I(),ns=Ne(),tf={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:ns.stringifyNumber},nf={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():ns.stringifyNumber(n)}},sf={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 ef.Scalar(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:ns.stringifyNumber};Jt.float=sf;Jt.floatExp=nf;Jt.floatNaN=tf});var rs=y(Wt=>{"use strict";var zr=Ne(),Yt=n=>typeof n=="bigint"||Number.isInteger(n),is=(n,e,t,{intAsBigInt:s})=>s?BigInt(n):parseInt(n.substring(e),t);function Xr(n,e,t){let{value:s}=n;return Yt(s)&&s>=0?t+s.toString(e):zr.stringifyNumber(n)}var rf={identify:n=>Yt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>is(n,2,8,t),stringify:n=>Xr(n,8,"0o")},of={identify:Yt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>is(n,0,10,t),stringify:zr.stringifyNumber},af={identify:n=>Yt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>is(n,2,16,t),stringify:n=>Xr(n,16,"0x")};Wt.int=of;Wt.intHex=af;Wt.intOct=rf});var eo=y(Zr=>{"use strict";var lf=Ae(),cf=Ut(),uf=Ee(),ff=Ye(),df=ts(),os=ss(),as=rs(),hf=[lf.map,uf.seq,ff.string,cf.nullTag,df.boolTag,as.intOct,as.int,as.intHex,os.floatNaN,os.floatExp,os.float];Zr.schema=hf});var so=y(no=>{"use strict";var pf=I(),mf=Ae(),gf=Ee();function to(n){return typeof n=="bigint"||Number.isInteger(n)}var Vt=({value:n})=>JSON.stringify(n),yf=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:Vt},{identify:n=>n==null,createNode:()=>new pf.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:to,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})=>to(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}],wf={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},bf=[mf.map,gf.seq].concat(yf,wf);no.schema=bf});var cs=y(io=>{"use strict";var We=ut("buffer"),ls=I(),kf=Fe(),Sf={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof We.Buffer=="function")return We.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 We.Buffer=="function")a=o instanceof We.Buffer?o.toString("base64"):We.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=ls.Scalar.BLOCK_LITERAL),e!==ls.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===ls.Scalar.BLOCK_LITERAL?`
53
+ `:" ")}return kf.stringifyString({comment:n,type:e,value:a},s,i,r)}};io.binary=Sf});var zt=y(Qt=>{"use strict";var Gt=N(),us=Z(),vf=I(),Af=ne();function ro(n,e){if(Gt.isSeq(n))for(let t=0;t<n.items.length;++t){let s=n.items[t];if(!Gt.isPair(s)){if(Gt.isMap(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let i=s.items[0]||new us.Pair(new vf.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]=Gt.isPair(s)?s:new us.Pair(s)}}else e("Expected a sequence for this tag");return n}function oo(n,e,t){let{replacer:s}=t,i=new Af.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(us.createPair(a,l,t))}return i}var Ef={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ro,createNode:oo};Qt.createPairs=oo;Qt.pairs=Ef;Qt.resolvePairs=ro});var hs=y(ds=>{"use strict";var ao=N(),fs=G(),Ve=te(),Nf=ne(),lo=zt(),ue=class n extends Nf.YAMLSeq{constructor(){super(),this.add=Ve.YAMLMap.prototype.add.bind(this),this.delete=Ve.YAMLMap.prototype.delete.bind(this),this.get=Ve.YAMLMap.prototype.get.bind(this),this.has=Ve.YAMLMap.prototype.has.bind(this),this.set=Ve.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(ao.isPair(i)?(r=fs.toJS(i.key,"",t),o=fs.toJS(i.value,r,t)):r=fs.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=lo.createPairs(e,t,s),r=new this;return r.items=i.items,r}};ue.tag="tag:yaml.org,2002:omap";var Of={collection:"seq",identify:n=>n instanceof Map,nodeClass:ue,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=lo.resolvePairs(n,e),s=[];for(let{key:i}of t.items)ao.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)};ds.YAMLOMap=ue;ds.omap=Of});var po=y(ps=>{"use strict";var co=I();function uo({value:n,source:e},t){return e&&(n?fo:ho).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var fo={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 co.Scalar(!0),stringify:uo},ho={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 co.Scalar(!1),stringify:uo};ps.falseTag=ho;ps.trueTag=fo});var mo=y(Xt=>{"use strict";var Cf=I(),ms=Ne(),Tf={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:ms.stringifyNumber},$f={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():ms.stringifyNumber(n)}},If={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 Cf.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:ms.stringifyNumber};Xt.float=If;Xt.floatExp=$f;Xt.floatNaN=Tf});var yo=y(Qe=>{"use strict";var go=Ne(),Ge=n=>typeof n=="bigint"||Number.isInteger(n);function Zt(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 gs(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 go.stringifyNumber(n)}var Lf={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>Zt(n,2,2,t),stringify:n=>gs(n,2,"0b")},_f={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>Zt(n,1,8,t),stringify:n=>gs(n,8,"0")},qf={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>Zt(n,0,10,t),stringify:go.stringifyNumber},xf={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>Zt(n,2,16,t),stringify:n=>gs(n,16,"0x")};Qe.int=qf;Qe.intBin=Lf;Qe.intHex=xf;Qe.intOct=_f});var ws=y(ys=>{"use strict";var nn=N(),en=Z(),tn=te(),fe=class n extends tn.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;nn.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new en.Pair(e.key,null):t=new en.Pair(e,null),tn.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let s=tn.findPair(this.items,e);return!t&&nn.isPair(s)?nn.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=tn.findPair(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new en.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(en.createPair(o,null,s));return r}};fe.tag="tag:yaml.org,2002:set";var Pf={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(nn.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}};ys.YAMLSet=fe;ys.set=Pf});var ks=y(sn=>{"use strict";var Df=Ne();function bs(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 wo(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Df.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 Mf={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})=>bs(n,t),stringify:wo},Bf={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=>bs(n,!1),stringify:wo},bo={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(bo.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=bs(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$/,"")??""};sn.floatTime=Bf;sn.intTime=Mf;sn.timestamp=bo});var vo=y(So=>{"use strict";var Rf=Ae(),jf=Ut(),Kf=Ee(),Ff=Ye(),Hf=cs(),ko=po(),Ss=mo(),rn=yo(),Uf=Dt(),Jf=hs(),Yf=zt(),Wf=ws(),vs=ks(),Vf=[Rf.map,Kf.seq,Ff.string,jf.nullTag,ko.trueTag,ko.falseTag,rn.intBin,rn.intOct,rn.int,rn.intHex,Ss.floatNaN,Ss.floatExp,Ss.float,Hf.binary,Uf.merge,Jf.omap,Yf.pairs,Wf.set,vs.intTime,vs.floatTime,vs.timestamp];So.schema=Vf});var _o=y(Ns=>{"use strict";var Oo=Ae(),Gf=Ut(),Co=Ee(),Qf=Ye(),zf=ts(),As=ss(),Es=rs(),Xf=eo(),Zf=so(),To=cs(),ze=Dt(),$o=hs(),Io=zt(),Ao=vo(),Lo=ws(),on=ks(),Eo=new Map([["core",Xf.schema],["failsafe",[Oo.map,Co.seq,Qf.string]],["json",Zf.schema],["yaml11",Ao.schema],["yaml-1.1",Ao.schema]]),No={binary:To.binary,bool:zf.boolTag,float:As.float,floatExp:As.floatExp,floatNaN:As.floatNaN,floatTime:on.floatTime,int:Es.int,intHex:Es.intHex,intOct:Es.intOct,intTime:on.intTime,map:Oo.map,merge:ze.merge,null:Gf.nullTag,omap:$o.omap,pairs:Io.pairs,seq:Co.seq,set:Lo.set,timestamp:on.timestamp},ed={"tag:yaml.org,2002:binary":To.binary,"tag:yaml.org,2002:merge":ze.merge,"tag:yaml.org,2002:omap":$o.omap,"tag:yaml.org,2002:pairs":Io.pairs,"tag:yaml.org,2002:set":Lo.set,"tag:yaml.org,2002:timestamp":on.timestamp};function td(n,e,t){let s=Eo.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(Eo.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"?No[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(No).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},[])}Ns.coreKnownTags=ed;Ns.getTags=td});var Ts=y(qo=>{"use strict";var Os=N(),nd=Ae(),sd=Ee(),id=Ye(),an=_o(),rd=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,Cs=class n{constructor({compat:e,customTags:t,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?an.getTags(e,"compat"):e?an.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?an.coreKnownTags:{},this.tags=an.getTags(t,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,Os.MAP,{value:nd.map}),Object.defineProperty(this,Os.SCALAR,{value:id.string}),Object.defineProperty(this,Os.SEQ,{value:sd.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?rd:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};qo.Schema=Cs});var Po=y(xo=>{"use strict";var od=N(),$s=He(),Xe=Re();function ad(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=$s.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(od.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=$s.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($s.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
+ `)+`
58
+ `}xo.stringifyDocument=ad});var Ze=y(Do=>{"use strict";var ld=Me(),Oe=Ot(),j=N(),cd=Z(),ud=G(),fd=Ts(),dd=Po(),Is=vt(),hd=xn(),pd=Be(),Ls=qn(),_s=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 Ls.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){Ce(this.contents)&&this.contents.add(e)}addIn(e,t){Ce(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let s=Is.anchorNames(this);e.anchor=!t||s.has(t)?Is.findNewAnchor(t||"a",s):t}return new ld.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}=Is.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},h=pd.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 cd.Pair(i,r)}delete(e){return Ce(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Oe.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Ce(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 Oe.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 Oe.isEmptyPath(e)?this.contents!==void 0:j.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Oe.collectionFromPath(this.schema,[e],t):Ce(this.contents)&&this.contents.set(e,t)}setIn(e,t){Oe.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Oe.collectionFromPath(this.schema,Array.from(e),t):Ce(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 Ls.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 Ls.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 fd.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=ud.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"?hd.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 dd.stringifyDocument(this,e)}};function Ce(n){if(j.isCollection(n))return!0;throw new Error("Expected a YAML collection as document contents")}Do.Document=_s});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}},qs=class extends et{constructor(e,t,s){super("YAMLParseError",e,t,s)}},xs=class extends et{constructor(e,t,s){super("YAMLWarning",e,t,s)}},md=(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
+
61
+ ${o}
62
+ ${c}
63
+ `}};tt.YAMLError=et;tt.YAMLParseError=qs;tt.YAMLWarning=xs;tt.prettifyError=md});var st=y(Mo=>{"use strict";function gd(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 E=n[n.length-1],C=E?E.offset+E.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:C,start:A??C}}Mo.resolveProps=gd});var ln=y(Bo=>{"use strict";function Ps(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(Ps(e.key)||Ps(e.value))return!0}return!1;default:return!0}}Bo.containsNewline=Ps});var Ds=y(Ro=>{"use strict";var yd=ln();function wd(n,e,t){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===n&&(s.source==="]"||s.source==="}")&&yd.containsNewline(e)&&t(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Ro.flowIndentCheck=wd});var Ms=y(Ko=>{"use strict";var jo=N();function bd(n,e,t){let{uniqueKeys:s}=n.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||jo.isScalar(r)&&jo.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}Ko.mapIncludes=bd});var Wo=y(Yo=>{"use strict";var Fo=Z(),kd=te(),Ho=st(),Sd=ln(),Uo=Ds(),vd=Ms(),Jo="All mapping items must start at the same column";function Ad({composeNode:n,composeEmptyNode:e},t,s,i,r){let o=r?.nodeClass??kd.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=Ho.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",Jo)),!h.anchor&&!h.tag&&!p){c=h.end,h.comment&&(a.comment?a.comment+=`
65
+ `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Sd.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",Jo);t.atKey=!0;let w=h.end,k=f?n(t,f,h,i):e(t,w,u,null,h,i);t.schema.compat&&Uo.flowIndentCheck(s.indent,f,i),t.atKey=!1,vd.mapIncludes(t,a.items,k)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let S=Ho.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&&Uo.flowIndentCheck(s.indent,g,i),l=v.range[2];let A=new Fo.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 Fo.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}Yo.resolveBlockMap=Ad});var Go=y(Vo=>{"use strict";var Ed=ne(),Nd=st(),Od=Ds();function Cd({composeNode:n,composeEmptyNode:e},t,s,i,r){let o=r?.nodeClass??Ed.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=Nd.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&&Od.flowIndentCheck(s.indent,u,i),l=p.range[2],a.items.push(p)}return a.range=[s.offset,l,c??l],a}Vo.resolveBlockSeq=Cd});var Te=y(Qo=>{"use strict";function Td(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}}Qo.resolveEnd=Td});var ea=y(Zo=>{"use strict";var $d=N(),Id=Z(),zo=te(),Ld=ne(),_d=Te(),Xo=st(),qd=ln(),xd=Ms(),Bs="Block collections are not allowed within flow collections",Rs=n=>n&&(n.type==="block-map"||n.type==="block-seq");function Pd({composeNode:n,composeEmptyNode:e},t,s,i,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?zo.YAMLMap:Ld.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,E=Xo.resolveProps(k,{flow:a,indicator:"explicit-key-ind",next:S??v?.[0],offset:u,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!v&&!A){m===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<s.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(c.comment?c.comment+=`
67
+ `+E.comment:c.comment=E.comment),u=E.end;continue}!o&&t.options.strict&&qd.containsNewline(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let C="";e:for(let b of k)switch(b.type){case"comma":case"space":break;case"comment":C=b.source.substring(1);break e;default:break e}if(C){let b=c.items[c.items.length-1];$d.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
68
+ `+C:b.comment=C,E.comment=E.comment.substring(C.length+1)}}if(!o&&!v&&!E.found){let C=A?n(t,A,E,i):e(t,E.end,v,null,E,i);c.items.push(C),u=C.range[2],Rs(A)&&i(C.range,"BLOCK_IN_FLOW",Bs)}else{t.atKey=!0;let C=E.end,b=S?n(t,S,E,i):e(t,C,k,null,E,i);Rs(S)&&i(b.range,"BLOCK_IN_FLOW",Bs),t.atKey=!1;let L=Xo.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&&!E.found&&t.options.strict){if(v)for(let _ of v){if(_===L.found)break;if(_.type==="newline"){i(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.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 V=A?n(t,A,L,i):L.found?e(t,L.end,v,null,L,i):null;V?Rs(A)&&i(V.range,"BLOCK_IN_FLOW",Bs):L.comment&&(b.comment?b.comment+=`
69
+ `+L.comment:b.comment=L.comment);let ge=new Id.Pair(b,V);if(t.options.keepSourceTokens&&(ge.srcToken=w),o){let _=c;xd.mapIncludes(t,_.items,b)&&i(C,"DUPLICATE_KEY","Map keys must be unique"),_.items.push(ge)}else{let _=new zo.YAMLMap(t.schema);_.flow=!0,_.items.push(ge);let Ei=(V??b).range;_.range=[b.range[0],Ei[1],Ei[2]],c.items.push(_)}u=V?V.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=_d.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=Pd});var na=y(ta=>{"use strict";var Dd=N(),Md=I(),Bd=te(),Rd=ne(),jd=Wo(),Kd=Go(),Fd=ea();function js(n,e,t,s,i,r){let o=t.type==="block-map"?jd.resolveBlockMap(n,e,t,s,r):t.type==="block-seq"?Kd.resolveBlockSeq(n,e,t,s,r):Fd.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 Hd(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===Bd.YAMLMap.tagName&&a==="map"||o===Rd.YAMLSeq.tagName&&a==="seq")return js(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),js(n,e,t,i,o)}let c=js(n,e,t,i,o,l),d=l.resolve?.(c,f=>i(r,"TAG_RESOLVE_FAILED",f),e.options)??c,u=Dd.isNode(d)?d:new Md.Scalar(d);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}ta.composeCollection=Hd});var Fs=y(sa=>{"use strict";var Ks=I();function Ud(n,e,t){let s=e.offset,i=Jd(e,n.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?Ks.Scalar.BLOCK_FOLDED:Ks.Scalar.BLOCK_LITERAL,o=e.source?Yd(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===Ks.Scalar.BLOCK_LITERAL?(u+=f+m.slice(l)+w,f=`
73
+ `):m.length>l||w[0]===" "?(f===" "?f=`
74
+ `:!p&&f===`
75
+ `&&(f=`
76
+
77
+ `),u+=f+m.slice(l)+w,f=`
78
+ `,p=!0):w===""?f===`
79
+ `?u+=`
80
+ `:f=`
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
+ `&&(u+=`
84
+ `);break;default:u+=`
85
+ `}let g=s+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[s,g,g]}}function Jd({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 Yd(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}sa.resolveBlockScalar=Ud});var Us=y(ra=>{"use strict";var Hs=I(),Wd=Te();function Vd(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=Hs.Scalar.PLAIN,l=Gd(r,c);break;case"single-quoted-scalar":a=Hs.Scalar.QUOTE_SINGLE,l=Qd(r,c);break;case"double-quoted-scalar":a=Hs.Scalar.QUOTE_DOUBLE,l=zd(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=Wd.resolveEnd(o,d,e,t);return{value:l,type:a,comment:u.comment,range:[s,d,u.offset]}}function Gd(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}`),ia(n)}function Qd(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),ia(n.slice(1,-1)).replace(/''/g,"'")}function ia(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
+ `?r+=o:o=`
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 zd(n,e){let t="";for(let s=1;s<n.length-1;++s){let i=n[s];if(!(i==="\r"&&n[s+1]===`
88
+ `))if(i===`
89
+ `){let{fold:r,offset:o}=Xd(n,s);t+=r,s=o}else if(i==="\\"){let r=n[++s],o=Zd[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+=eh(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 Xd(n,e){let t="",s=n[e+1];for(;(s===" "||s===" "||s===`
94
+ `||s==="\r")&&!(s==="\r"&&n[e+2]!==`
95
+ `);)s===`
96
+ `&&(t+=`
97
+ `),e+=1,s=n[e+1];return t||(t=" "),{fold:t,offset:e}}var Zd={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 eh(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}}ra.resolveFlowScalar=Vd});var la=y(aa=>{"use strict";var de=N(),oa=I(),th=Fs(),nh=Us();function sh(n,e,t,s){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?th.resolveBlockScalar(n,e,s):nh.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=ih(n.schema,i,l,t,s):e.type==="scalar"?c=rh(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 oa.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);s(t??e,"TAG_RESOLVE_FAILED",f),d=new oa.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 ih(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 rh({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}aa.composeScalar=sh});var ua=y(ca=>{"use strict";function oh(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}ca.emptyScalarPosition=oh});var ha=y(Ys=>{"use strict";var ah=Me(),lh=N(),ch=na(),fa=la(),uh=Te(),fh=ua(),dh={composeNode:da,composeEmptyNode:Js};function da(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=hh(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=fa.composeScalar(n,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=ch.composeCollection(dh,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=Js(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&&(!lh.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 Js(n,e,t,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let d={type:"scalar",offset:fh.emptyScalarPosition(e,t,s),indent:-1,source:""},u=fa.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 hh({options:n},{offset:e,source:t,end:s},i){let r=new ah.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=uh.resolveEnd(s,o,n.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}Ys.composeEmptyNode=Js;Ys.composeNode=da});var ga=y(ma=>{"use strict";var ph=Ze(),pa=ha(),mh=Te(),gh=st();function yh(n,e,{offset:t,start:s,value:i,end:r},o){let a=Object.assign({_directives:e},n),l=new ph.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=gh.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?pa.composeNode(c,i,d,o):pa.composeEmptyNode(c,d.end,s,null,d,o);let u=l.contents.range[2],f=mh.resolveEnd(r,u,!1,o);return f.comment&&(l.comment=f.comment),l.range=[t,u,f.offset],l}ma.composeDoc=yh});var Vs=y(ba=>{"use strict";var wh=ut("process"),bh=qn(),kh=Ze(),it=nt(),ya=N(),Sh=ga(),vh=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 wa(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
+
100
+ `:`
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 Ws=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 bh.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:s,afterEmptyLine:i}=wa(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(ya.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];ya.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:wa(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(wh.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=Sh.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=vh.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 kh.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}}};ba.Composer=Ws});var va=y(cn=>{"use strict";var Ah=Fs(),Eh=Us(),Nh=nt(),ka=Fe();function Oh(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 Nh.YAMLParseError([a,a+1],r,o)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Eh.resolveFlowScalar(n,e,s);case"block-scalar":return Ah.resolveBlockScalar({options:{strict:e}},n,s)}}return null}function Ch(n,e){let{implicitKey:t=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=ka.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
+ `}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
107
+ `),d=a.substring(0,c),u=a.substring(c+1)+`
108
+ `,f=[{type:"block-scalar-header",offset:r,indent:s,source:d}];return Sa(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 Th(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=ka.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">":$h(n,l);break;case'"':Gs(n,l,"double-quoted-scalar");break;case"'":Gs(n,l,"single-quoted-scalar");break;default:Gs(n,l,"scalar")}}function $h(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}];Sa(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 Sa(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 Gs(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})}}}cn.createScalarToken=Ch;cn.resolveAsScalar=Oh;cn.setScalarValue=Th});var Ea=y(Aa=>{"use strict";var Ih=n=>"type"in n?fn(n):un(n);function fn(n){switch(n.type){case"block-scalar":{let e="";for(let t of n.props)e+=fn(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(let t of n.items)e+=un(t);return e}case"flow-collection":{let e=n.start.source;for(let t of n.items)e+=un(t);for(let t of n.end)e+=t.source;return e}case"document":{let e=un(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 un({start:n,key:e,sep:t,value:s}){let i="";for(let r of n)i+=r.source;if(e&&(i+=fn(e)),t)for(let r of t)i+=r.source;return s&&(i+=fn(s)),i}Aa.stringify=Ih});var Ta=y(Ca=>{"use strict";var Qs=Symbol("break visit"),Lh=Symbol("skip children"),Na=Symbol("remove item");function he(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),Oa(Object.freeze([]),n,e)}he.BREAK=Qs;he.SKIP=Lh;he.REMOVE=Na;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 Oa(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=Oa(Object.freeze(n.concat([[i,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Qs)return Qs;a===Na&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(e,n))}}return typeof s=="function"?s(e,n):s}Ca.visit=he});var dn=y(B=>{"use strict";var zs=va(),_h=Ea(),qh=Ta(),Xs="\uFEFF",Zs="",ei="",ti="",xh=n=>!!n&&"items"in n,Ph=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function Dh(n){switch(n){case Xs:return"<BOM>";case Zs:return"<DOC>";case ei:return"<FLOW_END>";case ti:return"<SCALAR>";default:return JSON.stringify(n)}}function Mh(n){switch(n){case Xs:return"byte-order-mark";case Zs:return"doc-mode";case ei:return"flow-error-end";case ti:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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(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=zs.createScalarToken;B.resolveAsScalar=zs.resolveAsScalar;B.setScalarValue=zs.setScalarValue;B.stringify=_h.stringify;B.visit=qh.visit;B.BOM=Xs;B.DOCUMENT=Zs;B.FLOW_END=ei;B.SCALAR=ti;B.isCollection=xh;B.isScalar=Ph;B.prettyToken=Dh;B.tokenType=Mh});var ii=y(Ia=>{"use strict";var ot=dn();function F(n){switch(n){case void 0:case" ":case`
116
+ `:case"\r":case" ":return!0;default:return!1}}var $a=new Set("0123456789ABCDEFabcdef"),Bh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),hn=new Set(",[]{}"),Rh=new Set(` ,[]{}
117
+ \r `),ni=n=>!n||Rh.has(n),si=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
+ `?!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 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(ni),"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(ni),"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
+ `: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(!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&&hn.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&&hn.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&&hn.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(ni),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,s=this.charAt(1);if(F(s)||t&&hn.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(Bh.has(t))t=this.buffer[++e];else if(t==="%"&&$a.has(this.buffer[e+1])&&$a.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
+ `?yield*this.pushCount(1):e==="\r"&&this.charAt(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)}};Ia.Lexer=si});var oi=y(La=>{"use strict";var ri=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}}}};La.LineCounter=ri});var li=y(Da=>{"use strict";var jh=ut("process"),_a=dn(),Kh=ii();function se(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function qa(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 Pa(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 pn(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 mn(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 xa(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,Pa(e.value)?e.value.end?mn(e.value.end,e.sep):e.value.end=e.sep:mn(e.start,e.sep),delete e.sep)}var ai=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 Kh.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,jh.env.LOG_TOKENS&&console.log("|",_a.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=_a.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"&&xa(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&&qa(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":{qa(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=pn(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
+ `)+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 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)){mn(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(Pa(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)){mn(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=pn(s),r=$e(i);xa(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
+ `)+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=pn(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=pn(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())}}};Da.Parser=ai});var Ka=y(lt=>{"use strict";var Ma=Vs(),Fh=Ze(),at=nt(),Hh=Yn(),Uh=N(),Jh=oi(),Ba=li();function Ra(n){let e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new Jh.LineCounter||null,prettyErrors:e}}function Yh(n,e={}){let{lineCounter:t,prettyErrors:s}=Ra(e),i=new Ba.Parser(t?.addNewLine),r=new Ma.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 ja(n,e={}){let{lineCounter:t,prettyErrors:s}=Ra(e),i=new Ba.Parser(t?.addNewLine),r=new Ma.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 Wh(n,e,t){let s;typeof e=="function"?s=e:t===void 0&&e&&typeof e=="object"&&(t=e);let i=ja(n,t);if(!i)return null;if(i.warnings.forEach(r=>Hh.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 Vh(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 Uh.isDocument(n)&&!s?n.toString(t):new Fh.Document(n,s,t).toString(t)}lt.parse=Wh;lt.parseAllDocuments=Yh;lt.parseDocument=ja;lt.stringify=Vh});var Ie=y(O=>{"use strict";var Gh=Vs(),Qh=Ze(),zh=Ts(),ci=nt(),Xh=Me(),ie=N(),Zh=Z(),ep=I(),tp=te(),np=ne(),sp=dn(),ip=ii(),rp=oi(),op=li(),gn=Ka(),Fa=qe();O.Composer=Gh.Composer;O.Document=Qh.Document;O.Schema=zh.Schema;O.YAMLError=ci.YAMLError;O.YAMLParseError=ci.YAMLParseError;O.YAMLWarning=ci.YAMLWarning;O.Alias=Xh.Alias;O.isAlias=ie.isAlias;O.isCollection=ie.isCollection;O.isDocument=ie.isDocument;O.isMap=ie.isMap;O.isNode=ie.isNode;O.isPair=ie.isPair;O.isScalar=ie.isScalar;O.isSeq=ie.isSeq;O.Pair=Zh.Pair;O.Scalar=ep.Scalar;O.YAMLMap=tp.YAMLMap;O.YAMLSeq=np.YAMLSeq;O.CST=sp;O.Lexer=ip.Lexer;O.LineCounter=rp.LineCounter;O.Parser=op.Parser;O.parse=gn.parse;O.parseAllDocuments=gn.parseAllDocuments;O.parseDocument=gn.parseDocument;O.stringify=gn.stringify;O.visit=Fa.visit;O.visitAsync=Fa.visitAsync});import{appendFileSync as Gm,readFileSync as Qm}from"node:fs";var Dl=["claude-code","antigravity","pi"],Oi=n=>Dl.includes(n);function ft(n,e){return e[n]}function $(n,e){return ft(n,{"claude-code":`/bk:${e}`,antigravity:`/bk-${e}`,pi:`/bk-${e}`})}var Ml=n=>ft(n,{"claude-code":"Claude",antigravity:"the agent",pi:"the agent"});function Ci(n,e){let t=Ml(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 An,relative as Fl,resolve as qi}from"node:path";import{existsSync as ae,readFileSync as Ti,statSync as Bl}from"node:fs";import{dirname as Rl,isAbsolute as $i,join as J,resolve as vn}from"node:path";var Ii=".buildkeel.yaml",Li="buildkeel.yaml",R=".buildkeel",jl="buildkeel";function dt(n){let e=J(n,".git");if(!ae(e))return null;try{if(Bl(e).isDirectory())return e;let t=/^gitdir:\s*(.+)$/m.exec(Ti(e,"utf8"))?.[1]?.trim();return t?$i(t)?t:vn(n,t):null}catch{return null}}function _i(n){let e=dt(n);if(!e)return null;try{let t=J(e,"commondir");if(!ae(t))return e;let s=Ti(t,"utf8").trim();return $i(s)?s:vn(e,s)}catch{return e}}function Kl(n){if(ae(J(n,Ii)))return!1;let e=_i(n);return e!==null&&ae(J(e,Li))}function P(n){if(Kl(n)){let e=dt(n);if(e)return J(e,jl)}return J(n,R)}function _e(n){let e=vn(n);for(;;){if(ae(J(e,Ii)))return e;if(ae(J(e,".git"))){let s=_i(e);return s!==null&&ae(J(s,Li))?e:null}let t=Rl(e);if(t===e)return null;e=t}}var Nn=["write_to_file","replace_file_content","multi_replace_file_content","edit_file","write_file"],Hl=["TargetFile","Path"],Pi=["run_command"],og=Nn.join("|"),ag=[...Nn,...Pi].join("|"),Ul=n=>{for(let e of Hl){let t=n?.[e];if(typeof t=="string"&&t!=="")return t}return null};var Jl={decision:"allow"},xi={decision:"ask"},En=(n,e)=>{let t=Fl(n,e);return t===""||!t.startsWith("..")&&!An(t)};function ht(n,e){let t=(n.workspacePaths??[]).filter(i=>typeof i=="string"&&i!==""),s=e?[...t.filter(i=>En(i,e)),...t.filter(i=>!En(i,e))]:t;return s.find(i=>_e(i)!==null)??s[0]??process.cwd()}var Di={parse(n,e){let t=n??{};switch(e[0]){case"PreInvocation":return t.conversationId?{kind:"prompt",cwd:ht(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)?Ul(t.toolCall?.args):null;if(e[0]==="PostToolUse"&&Pi.includes(s)){let a=t.toolCall?.args?.CommandLine;return typeof a!="string"||t.error?{kind:"ignored"}:{kind:"after-shell",cwd:ht(t),tool:s,command:a,...t.conversationId?{deferTo:t.conversationId}:{}}}if(e[0]==="PostToolUse"){if(!i||t.error)return{kind:"ignored"};let a=ht(t,An(i)?i:void 0);return{kind:"after-edit",cwd:a,tool:s,files:[qi(a,i)],...t.conversationId?{deferTo:t.conversationId}:{}}}let r=ht(t,i&&An(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?[qi(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=>En(r,i))),s=n.block?{decision:"deny",reason:n.block}:t?Jl:xi;return{stdout:JSON.stringify(s),exitCode:0}}return{stdout:"{}",exitCode:0}},failed:n=>({stdout:JSON.stringify(n[0]==="PreToolUse"?xi:{}),exitCode:0})};var Mi={Edit:"file_path",Write:"file_path",MultiEdit:"file_path",NotebookEdit:"notebook_path"},cg=Object.keys(Mi).join("|"),Yl=["Bash","PowerShell"],Wl={startup:"startup",resume:"resume",clear:"clear",compact:"compact",fork:"resume"},Bi={parse(n){let e=n??{},t=e.cwd??process.cwd();switch(e.hook_event_name){case"SessionStart":{let s=Wl[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"&&Yl.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=Mi[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{isAbsolute as Vl,resolve as Gl}from"node:path";var Ql=["edit","write"],zl=["bash","powershell"],Xl={startup:"startup",new:"startup",reload:"resume",resume:"resume",fork:"resume"},Ri={parse(n){let e=n??{},t=e.cwd??process.cwd(),s=e.session?{conversation:e.session}:{},i=e.contextWindow?{contextWindow:e.contextWindow}:{};switch(e.event){case"session_start":return{kind:"session-start",cwd:t,reason:Xl[e.reason??"startup"]??"startup",...s,transcript:e.sessionFile??null,...i};case"session_compact":return{kind:"session-start",cwd:t,reason:"compact",...s,transcript:e.sessionFile??null,...i};case"input":return{kind:"message",cwd:t,...s,...i};case"tool_call":case"tool_result":{let r=e.toolName??"",o=e.event==="tool_call";if(zl.includes(r)){let c=e.input?.command;return typeof c!="string"?{kind:"ignored"}:o?{kind:"before-shell",cwd:t,tool:r,command:c}:{kind:"after-shell",cwd:t,tool:r,command:c}}if(!Ql.includes(r))return{kind:"ignored"};let a=e.input?.path;if(typeof a!="string")return{kind:"ignored"};let l=[Vl(a)?a:Gl(t,a)];return o?{kind:"before-edit",cwd:t,tool:r,files:l,...s}:e.isError?{kind:"ignored"}:{kind:"after-edit",cwd:t,tool:r,files:l}}default:return{kind:"ignored"}}},render(n,e){return e.kind==="ignored"||!n.block&&!n.context?{stdout:"",exitCode:0}:{stdout:JSON.stringify(n),exitCode:0}},failed:()=>({stdout:"",exitCode:1})};import{existsSync as Fm}from"node:fs";import{dirname as Hm,join as Um,resolve as Jm}from"node:path";import{existsSync as ji,readdirSync as Zl,readFileSync as Ki}from"node:fs";import{basename as ec,dirname as tc,join as pt,relative as nc}from"node:path";function sc(n){let e=dt(n);if(!e||!ji(pt(e,"config")))return null;let t=Ki(pt(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 ic(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 rc=200;function Fi(n){let e=tc(n),t=sc(n),s=ec(n),i;try{i=Zl(e).slice(0,rc)}catch{return null}for(let r of i){let o=pt(e,r,"buildkeel.yaml");if(r===s||!ji(o))continue;let a;try{a=Ki(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&&ic(d,t))||l.includes(s))return pt(e,r)}return null}var Hi=(n,e)=>nc(n,e).split("\\").join("/");import{existsSync as bg,readFileSync as oc,writeFileSync as kg}from"node:fs";import{join as On}from"node:path";var Ui="break-",ac="hook-cache.json",lc="context.md",Ji=n=>On(P(n),lc),cc="context-short.md",Yi=n=>On(P(n),cc);function uc(n){return On(P(n),ac)}function Wi(n){try{let e=JSON.parse(oc(uc(n),"utf8"));return e?.version===1?e:null}catch{return null}}var vg=`${R}/`;import{appendFileSync as jp,closeSync as Kp,fstatSync as Fp,mkdirSync as Hp,openSync as Up,readFileSync as Jp,readSync as Yp,renameSync as Wp,rmSync as Vp,statSync as Gp}from"node:fs";import{join as Qp}from"node:path";import{closeSync as fc,existsSync as dc,fstatSync as hc,mkdirSync as pc,openSync as mc,readdirSync as gc,readFileSync as yc,readSync as wc,renameSync as bc,writeFileSync as kc}from"node:fs";import{homedir as Sc}from"node:os";import{join as ye}from"node:path";var vc="conversations",Ac=(n,e)=>`${n.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,100)}.${e}`,Vi=n=>ye(P(n),vc),mt=(n,e,t)=>ye(Vi(n),Ac(e,t));function we(n){try{let e=JSON.parse(yc(n,"utf8"));return e.version===1?e:null}catch{return null}}function gt(n,e){pc(ye(n,".."),{recursive:!0});let t=`${n}.${process.pid}.tmp`;kc(t,`${JSON.stringify(e,null,2)}
139
+ `),bc(t,n)}function Cn(n,e,t,s=new Date,i,r){let o=mt(n,e,"json"),a=we(o)??{version:1,startedAt:s.toISOString()},l={...a,conversation:e,...t?{transcriptPath:t}:{},lastSeen:s.toISOString(),...i!==void 0?{activeUnit:i}:{},...r?{contextWindow:r}:{}};JSON.stringify(l)!==JSON.stringify(a)&&gt(o,l)}function Tn(n){let e=Vi(n);return dc(e)?gc(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 yt=n=>n==="~"||n.startsWith("~/")?ye(Sc(),n.slice(1)):n;function Ec(n){let e;try{e=mc(yt(n),"r")}catch{return[]}try{let t=Buffer.alloc(hc(e).size),s=t.length>0?wc(e,t,0,t.length,0):0;return t.subarray(0,s).toString("utf8").split(`
140
+ `).filter(i=>i.trim())}catch{return[]}finally{fc(e)}}function Nc(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 Gi(n){let e=we(n);e&&gt(n,{...e,recoveryOffered:!0})}function $n(n,e){let t=Nc(Ec(n));return e?t.filter(s=>s.at===void 0||s.at>e):t}import{randomBytes as Oc}from"node:crypto";import{dirname as Cc,join as Tc}from"node:path";var Qi=n=>Tc(Cc(n),`.${Oc(6).toString("hex")}.bk-tmp`);import{existsSync as $c,readFileSync as Ic}from"node:fs";import{dirname as zi,join as Xi}from"node:path";import{fileURLToPath as Lc}from"node:url";function _c(n=Lc(import.meta.url)){let e=zi(n);for(;;){if($c(Xi(e,"package.json")))return e;let t=zi(e);if(t===e)throw new Error(`No package.json above ${n}`);e=t}}function Zi(){return JSON.parse(Ic(Xi(_c(),"package.json"),"utf8")).version??"0.0.0"}import{mkdirSync as mp,readFileSync as gp,renameSync as yp,writeFileSync as wp}from"node:fs";import{join as Wa}from"node:path";var Ha=Le(Ie(),1);import{readFileSync as ap,statSync as lp}from"node:fs";import{homedir as cp}from"node:os";import{join as fi,resolve as up}from"node:path";var Ua="settings.yaml",D={codeEdits:"code-edits",updateCheck:"update-check"},ui="BUILDKEEL_NO_UPDATE_CHECK";function re(n=process.env){return n.BUILDKEEL_HOME?up(n.BUILDKEEL_HOME):fi(cp(),".buildkeel")}function fp(n){return n==="spec-driven"?"warn":"hold"}var Ja=n=>n==="hold"||n==="warn"?n:void 0,dp=n=>n===!0||n==="on"?!0:n===!1||n==="off"?!1:void 0;function hp(n=re()){let e;try{e=ap(fi(n,Ua),"utf8")}catch{return{problems:[]}}let t;try{t=(0,Ha.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)&&l!=="agents"&&i.push({path:l,message:`is not a personal switch. They are ${r.join(" and ")}`});let o=Ja(s[D.codeEdits]);s[D.codeEdits]!==void 0&&!o&&i.push({path:D.codeEdits,message:"must be hold or warn"});let a=dp(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 pp(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=Ja(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=hp(t),r=pp(e),o=r.codeEdits?{value:r.codeEdits,from:"team"}:i.codeEdits?{value:i.codeEdits,from:"you"}:{value:fp(n),from:"default"},l=s[ui]!==void 0&&s[ui]!==""&&s[ui]!=="0"?{value:!1,from:"environment"}:i.updateCheck===void 0?{value:!0,from:"default"}:{value:i.updateCheck,from:"you"};return{codeEdits:o,updateCheck:l}}function Ya(n=re()){try{return lp(fi(n,Ua)).mtimeMs}catch{return 0}}var Va="update-check.json",lw=1440*60*1e3;function bp(n=re()){try{let e=JSON.parse(gp(Wa(n,Va),"utf8"));return typeof e.checkedAt=="string"?e:null}catch{return null}}function kp(n,e){try{mp(n,{recursive:!0});let t=Wa(n,Va),s=`${t}.${process.pid}.tmp`;wp(s,`${JSON.stringify(e,null,2)}
144
+ `),yp(s,t)}catch{}}function Sp(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 vp(n){return ft(n,{"claude-code":"/plugin update bk@buildkeel",antigravity:"npx buildkeel@latest update",pi:"pi update npm:buildkeel"})}function Ga(n,e,t=re(),s=process.env){if(!pe(void 0,{},t,s).updateCheck.value)return null;let i=bp(t);return!i?.latest||!Sp(i.latest,n)||i.shown===i.latest?null:(kp(t,{...i,shown:i.latest}),`BuildKeel ${i.latest} is available (this is ${n}). Tell the user in one line, with the command to update: ${vp(e)}. Turn this notice off with update-check: off in ~/.buildkeel/settings.yaml.`)}import{existsSync as Ap,readFileSync as Ep,rmSync as Np}from"node:fs";import{join as Op}from"node:path";var Cp="migrated.json",Tp=n=>Op(P(n),Cp);function Qa(n,e){let t=Tp(n);if(!Ap(t))return null;let s;try{s=JSON.parse(Ep(t,"utf8"))}catch{s={from:4,to:5,renamed:0,reason:"its outcome could not be read"}}return Np(t,{force:!0}),$p(s,e)}function $p(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 Dp}from"node:fs";var di=Le(Ie(),1);var Ip=Le(Ie(),1);var hi={type:"test-plan",dir:"test-plan",file:"plan.md",idSuffix:"-TP"},pi={type:"design",dir:"design",file:"design.md",idSuffix:"-DD"},Ow=[{type:hi.type,dir:hi.dir,file:hi.file,suffix:"TP"},{type:pi.type,dir:pi.dir,file:pi.file,suffix:"DD"}];var za={notes:"notes",pauses:"pauses",testRuns:"test-runs",reviews:"reviews",answers:"answers",switches:"switches",handoffs:"handoffs",executions:"executions",asBuilt:"as-built"},Xa=["runs"],Cw=[...Object.values(za),...Xa],Tw=["versions","approvals","completions","repins",...Object.values(za),...Xa];function Za(n){return/^([A-Z][A-Z0-9]*-[A-Za-z0-9]+)(?:-|$)/.exec(n)?.[1]??null}var yn=(n,e)=>e?`${n} "${e}"`:n;var Lp=3;function wn(n,e,t,s){if(e.activeUnit||e.threads==="off")return null;let i=Tn(n).find(a=>a.conversation!==s&&a.transcriptPath);if(!i?.transcriptPath||i.recoveryOffered||i.activeUnit)return null;let r=$n(i.transcriptPath,i.savedAt);return r.length<Lp?null:(Gi(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 bn(n,e,t,s,i){if(e.activeUnit||!i)return null;let r=Tn(n).find(o=>o.conversation===s);return $n(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 el=Le(Ie(),1);import{readFileSync as _p,statSync as qp}from"node:fs";import{join as xp}from"node:path";var Pp="buildkeel.yaml";function kn(n,e=re()){let t=xp(n.specRoot,Pp),s=Date.parse(n.updatedAt),i=0;try{i=qp(t).mtimeMs}catch{}if(i<=s&&Ya(e)<=s)return n;let r;try{r=(0,el.parse)(_p(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 mi(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: ${yn(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(Mp(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 tl=25;function Mp(n){let e=n.glossary??[],t=e.slice(0,tl).map(r=>`${r.term} (${r.definition}${r.avoid.length>0?`; not: ${r.avoid.join(", ")}`:""})`),s=e.slice(tl).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 Bp=8e3;function sl(n,e){try{return Ci(Dp(n,"utf8").trimEnd(),e)}catch{return null}}function Rp(n,e,t){return e.activeUnit?sl(Ji(n),t):null}function Sn(n,e,t,s,i=[]){let r=nl(Rp(n,e,t),e,t,s,i);if(r.length<=Bp||!e.activeUnit)return r;let o=sl(Yi(n),t);return o?nl(o,e,t,s,i):r}function nl(n,e,t,s,i){let r=["BuildKeel:"];for(let o of mi(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 il=({event:n,codeRoot:e,cache:t,host:s})=>{if(n.kind!=="session-start")return null;let i=kn(t),r=n.reason==="compact"?[bn(e,i,s,n.conversation,n.transcript)]:n.reason==="resume"?[]:[gi(e,s),wn(e,i,s,n.conversation),yi(s)];return{context:Sn(e,i,s,n.reason==="compact",r.filter(o=>o!==null))}};function gi(n,e){try{return Qa(n,e)}catch{return null}}function yi(n){try{return Ga(Zi(),n)}catch{return null}}var zp=(n,e)=>mt(n,e,"json"),ol=(n,e)=>mt(n,e,"notices");function al(n,e,t){let s=ol(n,e);Hp(Qp(s,".."),{recursive:!0}),jp(s,`${JSON.stringify(t)}
146
+ `)}function Xp(n,e){let t=ol(n,e),s=Qi(t),i;try{Wp(t,s),i=Jp(s,"utf8")}catch{return[]}finally{Vp(s,{force:!0})}return i.split(`
147
+ `).filter(Boolean).flatMap(r=>{try{return[String(JSON.parse(r))]}catch{return[]}})}var Zp=n=>{let e=we(n);return e?.reported&&e.transcript?e:null},rl=gt;function em(n,e){let t;try{t=Up(yt(n),"r")}catch{return{ok:!1,offset:e,checkpoint:null}}try{let s=Fp(t).size,i=s<e?0:e,r=Buffer.alloc(s-i),o=r.length>0?Yp(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{Kp(t)}}function tm(n){if(!n)return 0;try{return Gp(yt(n)).size}catch{return 0}}var ll=n=>{if(n.event.kind!=="prompt")return null;let e=Xp(n.codeRoot,n.event.conversation),s=[nm(n)?.context,...e].filter(Boolean).join(`
149
+
150
+ `);return s?{context:s}:null},nm=({event:n,codeRoot:e,cache:t,host:s})=>{if(n.kind!=="prompt")return null;let i=kn(t),r=zp(e,n.conversation),o=mi(i,s),a=Object.fromEntries(o.map(p=>[p.key,p.fingerprint])),l=Zp(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:tm(n.transcript),checkpoint:null}};rl(r,h);let m=wn(e,i,s,n.conversation),w=yi(s),k=gi(e,s);return{context:Sn(e,i,s,!1,[k,m,w].filter(S=>S!==null))}}let c=n.transcript?em(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=bn(e,i,s,n.conversation,n.transcript);f=Sn(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)&&rl(r,u),f?{context:f}:null},cl=({event:n,codeRoot:e,cache:t})=>{if(n.kind==="message"&&n.conversation&&n.contextWindow){try{Cn(e,n.conversation,null,new Date,void 0,n.contextWindow)}catch{}return null}if(n.kind!=="session-start"||!n.conversation)return null;try{Cn(e,n.conversation,n.transcript??null,new Date,t.activeUnit,n.contextWindow??void 0)}catch{}return null};import{appendFileSync as hm,mkdirSync as pm}from"node:fs";import{dirname as mm,join as gm,resolve as ym}from"node:path";import{existsSync as sm,realpathSync as ul}from"node:fs";import{basename as yl,dirname as fl,isAbsolute as im,join as rm,relative as wl,resolve as dl,sep as om}from"node:path";var wi={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"},am={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"},lm={"test-plan":"TP",design:"DD"},cm=()=>process.platform==="win32"||process.platform==="darwin",T=n=>cm()?n.toLowerCase():n;function oe(n,e){let t=hl(n,e);if(t!==null)return t;try{let s=e;for(;!sm(s)&&fl(s)!==s;)s=fl(s);let i=rm(ul(s),wl(s,e));return hl(ul(n),i)}catch{return null}}var me=(n,e)=>oe(n,e);function hl(n,e){let t=wl(n,e);return t===""||t.startsWith("..")||im(t)?null:t.split(om).join("/")}var pl="Make the change you want through a new change, drafted with the BuildKeel save_draft tool (type change): finishing it writes the next versions.",um="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 ml(n,e){if(n.conversion!=="finished")return fm(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. ${um}`}function fm(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(yl(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. ${pl}`}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(wi,i)?`BuildKeel: ${e} is ${wi[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. ${pl}`: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=am[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"?ml(n,t)??(n.conversion?gl(n,t):null):(n.conversion==="finished"?ml(n,t):null)??gl(n,t)}function gl(n,e){let t=e.split("/"),s=n.documents??lm,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(yl(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=wi[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 dm(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 bl=({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,dl(n.cwd,o))??dm(e,t,dl(n.cwd,o))).filter(o=>o!==null);return r.length===0?null:n.kind==="before-edit"?{block:[...new Set(r)].join(`
152
+
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(`
154
+
155
+ `)}};var bi=(n,e)=>gm(P(n),"journal",`${e}.jsonl`),kl=({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=ym(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=bi(e,t.activeUnit);return pm(mm(r),{recursive:!0}),hm(r,`${i.join(`
156
+ `)}
157
+ `),null};var wm=/\bgit(?:\s+-{1,2}[^\s;&|]+(?:\s+(?!push\b)[^\s;&|-][^\s;&|]*)?)*\s+push\b|\bgh\s+pr\s+(?:create|merge)\b/,bm=n=>wm.test(n),Sl=({event:n,cache:e,host:t})=>{if(n.kind!=="before-shell"&&n.kind!=="after-shell"||!e.activeUnit||!bm(n.command))return null;let s=n.kind==="after-shell"?` The command \`${n.command}\` has run.`:" The command goes ahead.";return{context:`BuildKeel: ${yn(e.activeUnit,e.activeTitle)} is not finished: tell the user to run ${$(t,"done")} before merging.${s}`}};import{mkdirSync as km,writeFileSync as Sm}from"node:fs";import{join as vm}from"node:path";var Am="last-message",vl=({event:n,codeRoot:e})=>{if(!(n.kind==="message"||n.kind==="prompt"&&n.newMessage))return null;try{km(P(e),{recursive:!0}),Sm(vm(P(e),Am),`${new Date().toISOString()}
158
+ `)}catch{}return null};var Al=Le(Ie(),1);import{spawnSync as Em}from"node:child_process";import{existsSync as Nm,mkdirSync as Om,readFileSync as Cm,writeFileSync as Tm}from"node:fs";import{join as ki,resolve as $m}from"node:path";var El=({event:n,codeRoot:e,cache:t,host:s})=>{if(n.kind!=="before-edit"||t.activeUnit||t.untrackedSince||Dm(e))return null;let i=n.files.flatMap(d=>{let u=$m(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=>_m(d,u)));if(o.length===0)return null;let a=Bm(t)==="warn";if(a&&n.conversation&&xm(e,n.conversation))return null;let l=qm(e,o),c=o.filter(d=>!l.has(d));return c.length===0?null:a?(n.conversation&&Pm(e,n.conversation),{context:Lm(c,t,s)}):{block:Im(c,t,s)}};function Nl(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 Im(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: ${Nl(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 Lm(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: ${Nl(e,t,"or ")}. This is said once in this conversation; later edits go ahead without it.`}function _m(n,e){let t=e.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"");return t===""||t==="."||n===t||n.startsWith(`${t}/`)}function qm(n,e){try{let t=Em("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 Ol=(n,e)=>ki(P(n),"conversations",`${e.replace(/[^A-Za-z0-9._-]/g,"_")}.no-unit-warned`);function xm(n,e){return Nm(Ol(n,e))}function Pm(n,e){try{let t=Ol(n,e);Om(ki(t,".."),{recursive:!0}),Tm(t,`${new Date().toISOString()}
161
+ `)}catch{}}var Dm=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(Ui)},Mm="buildkeel.yaml";function Bm(n){let e;try{e=(0,Al.parse)(Cm(ki(n.specRoot,Mm),"utf8"))?.process}catch{return n.codeEdits??pe(n.mode,void 0).codeEdits.value}return pe(n.mode,e).codeEdits.value}import{readFileSync as Rm}from"node:fs";import{resolve as jm}from"node:path";function Si(n,e){return e.some(t=>t.endsWith("/")?n.startsWith(t):n===t||n.startsWith(`${t}/`))}function vi(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 Ai=8;function Km(n,e){try{let t=Rm(bi(n,e),"utf8").split(`
162
+ `).filter(Boolean);return new Set(t.map(s=>JSON.parse(s).file))}catch{return new Set}}var Cl=({event:n,codeRoot:e,cache:t})=>{if(n.kind!=="after-edit"||!t.activeUnit||t.scope.length===0)return null;let s=Km(e,t.activeUnit),i=[];for(let a of n.files){let l=jm(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}/`)||!Si(c,t.scope)&&!vi(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,Ai).join(", ")+(t.scope.length>Ai?`, and ${t.scope.length-Ai} 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 Tl(n,e,t="claude-code"){if(n.kind==="ignored")return{};let s=Vm(n)??_e(n.cwd);if(!s)return n.kind==="session-start"&&n.reason==="startup"?Ym(n.cwd,t):{};let i=Wi(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(`
163
+
164
+ `);return a&&(n.kind==="after-edit"||n.kind==="after-shell"||n.kind==="before-edit")&&n.deferTo?(al(s,n.deferTo,a),o?{block:o}:{}):{...o?{block:o}:{},...a?{context:a}:{}}}function Ym(n,e){let t=Wm(n),s=t?Fi(t):null;return!t||!s?{}:{context:`BuildKeel is not set up in this clone, and the spec repository beside it, ${Hi(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 Wm(n){let e=Jm(n);for(;;){if(Fm(Um(e,".git")))return e;let t=Hm(e);if(t===e)return null;e=t}}function Vm(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?_e(t):null}var $l=[bl,El,Cl,kl,cl,il,ll,Sl,vl];var zm={"claude-code":Bi,antigravity:Di,pi:Ri};function Xm(n){let e=n.indexOf("--host"),t=e>=0?n[e+1]:void 0,s=t&&Oi(t)?zm[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=Qm(0,"utf8");process.env.BUILDKEEL_HOOK_LOG&&Gm(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=Tl(o,$l,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=Xm(process.argv.slice(2));