@keepur/hive 0.1.2 → 0.1.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/pkg/cli.min.js +123 -120
package/pkg/cli.min.js CHANGED
@@ -1,148 +1,148 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __hiveCreateRequire } from 'module'; const require = __hiveCreateRequire(import.meta.url);
3
- var Mu=Object.create;var vs=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Du=Object.getOwnPropertyNames;var qu=Object.getPrototypeOf,Ru=Object.prototype.hasOwnProperty;var he=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var C=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Q=(t,e)=>{for(var n in e)vs(t,n,{get:e[n],enumerable:!0})},Ku=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Du(e))!Ru.call(t,i)&&i!==n&&vs(t,i,{get:()=>e[i],enumerable:!(s=$u(e,i))||s.enumerable});return t};var me=(t,e,n)=>(n=t!=null?Mu(qu(t)):{},Ku(e||!t||!t.__esModule?vs(n,"default",{value:t,enumerable:!0}):n,t));import{existsSync as Bu}from"node:fs";import{resolve as ge}from"node:path";function Fu(){return process.env.HIVE_HOME?ge(process.env.HIVE_HOME):Bu(ge(process.cwd(),"hive.yaml"))?process.cwd():ge(xu,".hive")}function Br(t){let e=process.env.HIVE_CONFIG||"hive.yaml";return ge(t,e)}function xr(t){let n=(process.env.HIVE_CONFIG||"hive.yaml").match(/^hive-(.+)\.yaml$/)?.[1];return ge(t,n?`.env-${n}`:".env")}var xu,T,j,fy,Fr,ee=C(()=>{"use strict";xu=process.env.HOME??"/tmp";T=Fu(),j=ge(T,"skills"),fy=ge(T,".hive"),Fr=ge(import.meta.dirname,"..","seeds")});import{execFileSync as q}from"node:child_process";import{writeFileSync as Uu,unlinkSync as ju}from"node:fs";import{resolve as Yu}from"node:path";import{tmpdir as Hu}from"node:os";function ks(t){try{return q("which",[t],dt),!0}catch{return!1}}function Ur(t){try{return q("brew",["list",t],dt),!0}catch{return!1}}function Gu(t){try{return q("brew",["services","list"],dt).split(`
4
- `).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function jr(t,e=1500){try{let n=new AbortController,s=setTimeout(()=>n.abort(),e),i=await fetch(t,{signal:n.signal});return clearTimeout(s),i.ok}catch{return!1}}async function Yr(){console.log(`Checking prerequisites...
5
- `);let t=0;for(let e of Vu){let n=e.required?"":" (optional)";if(await e.check()){console.log(` \u2713 ${e.name}${n}`);continue}console.log(` \u2717 ${e.name}${n} \u2014 installing...`);try{e.install(),await e.check()?console.log(` \u2713 ${e.name} \u2014 installed`):e.required&&(console.error(` \u2717 ${e.name} \u2014 install failed`),t++)}catch(s){e.required?(console.error(` \u2717 ${e.name} \u2014 install failed: ${s}`),t++):console.log(` \u25CB ${e.name} \u2014 skipped (install failed)`)}}t>0&&(console.error(`
6
- ${t} required prerequisite(s) failed. Fix and re-run 'hive init'.`),process.exit(1)),console.log(`
7
- All prerequisites ready.`)}var dt,Vu,Hr=C(()=>{"use strict";dt={encoding:"utf-8",stdio:"pipe"};Vu=[{name:"Xcode CLI Tools",required:!0,check:()=>{try{return q("xcode-select",["-p"],dt),!0}catch{return!1}},install:()=>{console.log(" Installing Xcode CLI Tools (this opens a system dialog)..."),q("xcode-select",["--install"],{stdio:"inherit"}),console.log(" Complete the installation dialog, then re-run 'hive init'."),process.exit(0)}},{name:"Homebrew",required:!0,check:()=>ks("brew"),install:()=>{console.log(" Installing Homebrew...");let t=Yu(Hu(),"brew-install.sh"),e=q("curl",["-fsSL","https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"],{encoding:"utf-8"});Uu(t,e,{mode:493}),q("/bin/bash",[t],{stdio:"inherit"}),ju(t)}},{name:"Node.js >= 22",required:!0,check:()=>parseInt(process.versions.node.split(".")[0])>=22,install:()=>{console.log(" Installing Node.js via Homebrew..."),q("brew",["install","node"],{stdio:"inherit"})}},{name:"MongoDB",required:!0,check:()=>Gu("mongodb-community"),install:()=>{Ur("mongodb-community")||(console.log(" Tapping mongodb/brew..."),q("brew",["tap","mongodb/brew"],{stdio:"inherit"}),console.log(" Installing mongodb-community..."),q("brew",["install","mongodb-community"],{stdio:"inherit"})),console.log(" Starting MongoDB..."),q("brew",["services","start","mongodb-community"],{stdio:"inherit"})}},{name:"Ollama",required:!0,check:()=>jr("http://127.0.0.1:11434/api/tags"),install:()=>{console.log(" Installing Ollama..."),q("brew",["install","ollama"],{stdio:"inherit"}),q("brew",["services","start","ollama"],{stdio:"inherit"})}},{name:"Ollama models (bge-large, gemma4:e4b)",required:!0,check:()=>{if(!ks("ollama"))return!1;try{let t=q("ollama",["list"],dt);return t.includes("bge-large")&&t.includes("gemma4:e4b")}catch{return!1}},install:()=>{console.log(" \u26A0 Pulling Ollama models \u2014 ~10 GB total, several minutes on first run."),console.log(" Pulling bge-large (~670 MB)..."),q("ollama",["pull","bge-large"],{stdio:"inherit"}),console.log(" Pulling gemma4:e4b (~9.6 GB)..."),q("ollama",["pull","gemma4:e4b"],{stdio:"inherit"})}},{name:"Qdrant",required:!0,check:()=>jr("http://127.0.0.1:6333/"),install:()=>{Ur("qdrant")||(console.log(" Installing Qdrant..."),q("brew",["install","qdrant/tap/qdrant"],{stdio:"inherit"})),console.log(" Starting Qdrant..."),q("brew",["services","start","qdrant"],{stdio:"inherit"})}},{name:"gh CLI",required:!1,check:()=>ks("gh"),install:()=>{console.log(" Installing gh CLI..."),q("brew",["install","gh"],{stdio:"inherit"})}}]});var I=S(F=>{"use strict";var Es=Symbol.for("yaml.alias"),Gr=Symbol.for("yaml.document"),nn=Symbol.for("yaml.map"),Vr=Symbol.for("yaml.pair"),As=Symbol.for("yaml.scalar"),sn=Symbol.for("yaml.seq"),le=Symbol.for("yaml.node.type"),Wu=t=>!!t&&typeof t=="object"&&t[le]===Es,Ju=t=>!!t&&typeof t=="object"&&t[le]===Gr,Qu=t=>!!t&&typeof t=="object"&&t[le]===nn,zu=t=>!!t&&typeof t=="object"&&t[le]===Vr,Wr=t=>!!t&&typeof t=="object"&&t[le]===As,Xu=t=>!!t&&typeof t=="object"&&t[le]===sn;function Jr(t){if(t&&typeof t=="object")switch(t[le]){case nn:case sn:return!0}return!1}function Zu(t){if(t&&typeof t=="object")switch(t[le]){case Es:case nn:case As:case sn:return!0}return!1}var ef=t=>(Wr(t)||Jr(t))&&!!t.anchor;F.ALIAS=Es;F.DOC=Gr;F.MAP=nn;F.NODE_TYPE=le;F.PAIR=Vr;F.SCALAR=As;F.SEQ=sn;F.hasAnchor=ef;F.isAlias=Wu;F.isCollection=Jr;F.isDocument=Ju;F.isMap=Qu;F.isNode=Zu;F.isPair=zu;F.isScalar=Wr;F.isSeq=Xu});var pt=S(_s=>{"use strict";var R=I(),V=Symbol("break visit"),Qr=Symbol("skip children"),te=Symbol("remove node");function rn(t,e){let n=zr(e);R.isDocument(t)?je(null,t.contents,n,Object.freeze([t]))===te&&(t.contents=null):je(null,t,n,Object.freeze([]))}rn.BREAK=V;rn.SKIP=Qr;rn.REMOVE=te;function je(t,e,n,s){let i=Xr(t,e,n,s);if(R.isNode(i)||R.isPair(i))return Zr(t,s,i),je(t,i,n,s);if(typeof i!="symbol"){if(R.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let o=je(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===V)return V;o===te&&(e.items.splice(r,1),r-=1)}}}else if(R.isPair(e)){s=Object.freeze(s.concat(e));let r=je("key",e.key,n,s);if(r===V)return V;r===te&&(e.key=null);let o=je("value",e.value,n,s);if(o===V)return V;o===te&&(e.value=null)}}return i}async function on(t,e){let n=zr(e);R.isDocument(t)?await Ye(null,t.contents,n,Object.freeze([t]))===te&&(t.contents=null):await Ye(null,t,n,Object.freeze([]))}on.BREAK=V;on.SKIP=Qr;on.REMOVE=te;async function Ye(t,e,n,s){let i=await Xr(t,e,n,s);if(R.isNode(i)||R.isPair(i))return Zr(t,s,i),Ye(t,i,n,s);if(typeof i!="symbol"){if(R.isCollection(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ye(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===V)return V;o===te&&(e.items.splice(r,1),r-=1)}}}else if(R.isPair(e)){s=Object.freeze(s.concat(e));let r=await Ye("key",e.key,n,s);if(r===V)return V;r===te&&(e.key=null);let o=await Ye("value",e.value,n,s);if(o===V)return V;o===te&&(e.value=null)}}return i}function zr(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Xr(t,e,n,s){if(typeof n=="function")return n(t,e,s);if(R.isMap(e))return n.Map?.(t,e,s);if(R.isSeq(e))return n.Seq?.(t,e,s);if(R.isPair(e))return n.Pair?.(t,e,s);if(R.isScalar(e))return n.Scalar?.(t,e,s);if(R.isAlias(e))return n.Alias?.(t,e,s)}function Zr(t,e,n){let s=e[e.length-1];if(R.isCollection(s))s.items[t]=n;else if(R.isPair(s))t==="key"?s.key=n:s.value=n;else if(R.isDocument(s))s.contents=n;else{let i=R.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}_s.visit=rn;_s.visitAsync=on});var Os=S(to=>{"use strict";var eo=I(),tf=pt(),nf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sf=t=>t.replace(/[!,[\]{}]/g,e=>nf[e]),ht=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let s=e.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(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 n(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 n(6,`Unsupported YAML version ${r}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return n(String(o)),null}return s==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,s]of Object.entries(this.tags))if(e.startsWith(s))return n+sf(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),i;if(e&&s.length>0&&eo.isNode(e.contents)){let r={};tf.visit(e.contents,(o,a)=>{eo.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)))&&n.push(`%TAG ${r} ${o}`);return n.join(`
8
- `)}};ht.defaultYaml={explicit:!1,version:"1.2"};ht.defaultTags={"!!":"tag:yaml.org,2002:"};to.Directives=ht});var an=S(mt=>{"use strict";var no=I(),rf=pt();function of(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function so(t){let e=new Set;return rf.visit(t,{Value(n,s){s.anchor&&e.add(s.anchor)}}),e}function io(t,e){for(let n=1;;++n){let s=`${t}${n}`;if(!e.has(s))return s}}function af(t,e){let n=[],s=new Map,i=null;return{onAnchor:r=>{n.push(r),i??(i=so(t));let o=io(e,i);return i.add(o),o},setAnchors:()=>{for(let r of n){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(no.isScalar(o.node)||no.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}}mt.anchorIsValid=of;mt.anchorNames=so;mt.createNodeAnchors=af;mt.findNewAnchor=io});var Is=S(ro=>{"use strict";function gt(t,e,n,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=gt(t,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=gt(t,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=gt(t,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=gt(t,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return t.call(e,n,s)}ro.applyReviver=gt});var ye=S(ao=>{"use strict";var lf=I();function oo(t,e,n){if(Array.isArray(t))return t.map((s,i)=>oo(s,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!lf.hasAnchor(t))return t.toJSON(e,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(t,s),n.onCreate=r=>{s.res=r,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}ao.toJS=oo});var ln=S(co=>{"use strict";var cf=Is(),lo=I(),uf=ye(),Ts=class{constructor(e){Object.defineProperty(this,lo.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:n,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!lo.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=uf.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?cf.applyReviver(r,{"":a},"",a):a}};co.NodeBase=Ts});var yt=S(uo=>{"use strict";var ff=an(),df=pt(),He=I(),pf=ln(),hf=ye(),Ns=class extends pf.NodeBase{constructor(e){super(He.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let s;n?.aliasResolveCache?s=n.aliasResolveCache:(s=[],df.visit(e,{Node:(r,o)=>{(He.isAlias(o)||He.hasAnchor(o))&&s.push(o)}}),n&&(n.aliasResolveCache=s));let i;for(let r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:s,doc:i,maxAliasCount:r}=n,o=this.resolve(i,n);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(o);if(a||(hf.toJS(o,null,n),a=s.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=cn(i,o,s)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,n,s){let i=`*${this.source}`;if(e){if(ff.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 cn(t,e,n){if(He.isAlias(e)){let s=e.resolve(t),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(He.isCollection(e)){let s=0;for(let i of e.items){let r=cn(t,i,n);r>s&&(s=r)}return s}else if(He.isPair(e)){let s=cn(t,e.key,n),i=cn(t,e.value,n);return Math.max(s,i)}return 1}uo.Alias=Ns});var $=S(Ls=>{"use strict";var mf=I(),gf=ln(),yf=ye(),Sf=t=>!t||typeof t!="function"&&typeof t!="object",Se=class extends gf.NodeBase{constructor(e){super(mf.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:yf.toJS(this.value,e,n)}toString(){return String(this.value)}};Se.BLOCK_FOLDED="BLOCK_FOLDED";Se.BLOCK_LITERAL="BLOCK_LITERAL";Se.PLAIN="PLAIN";Se.QUOTE_DOUBLE="QUOTE_DOUBLE";Se.QUOTE_SINGLE="QUOTE_SINGLE";Ls.Scalar=Se;Ls.isScalarValue=Sf});var St=S(po=>{"use strict";var wf=yt(),Ce=I(),fo=$(),bf="tag:yaml.org,2002:";function vf(t,e,n){if(e){let s=n.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 n.find(s=>s.identify?.(t)&&!s.format)}function kf(t,e,n){if(Ce.isDocument(t)&&(t=t.contents),Ce.isNode(t))return t;if(Ce.isPair(t)){let u=n.schema[Ce.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=n,l;if(s&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=i(t)),new wf.Alias(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=bf+e.slice(2));let c=vf(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new fo.Scalar(t);return l&&(l.node=u),u}c=t instanceof Map?o[Ce.MAP]:Symbol.iterator in Object(t)?o[Ce.SEQ]:o[Ce.MAP]}r&&(r(c),delete n.onTagObj);let f=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new fo.Scalar(t);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}po.createNode=kf});var fn=S(un=>{"use strict";var Ef=St(),ne=I(),Af=ln();function Cs(t,e,n){let s=n;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 Ef.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var ho=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Ps=class extends Af.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(s=>ne.isNode(s)||ne.isPair(s)?s.clone(e):s),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(ho(e))this.add(n);else{let[s,...i]=e,r=this.get(s,!0);if(ne.isCollection(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,Cs(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(e){let[n,...s]=e;if(s.length===0)return this.delete(n);let i=this.get(n,!0);if(ne.isCollection(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(e,n){let[s,...i]=e,r=this.get(s,!0);return i.length===0?!n&&ne.isScalar(r)?r.value:r:ne.isCollection(r)?r.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!ne.isPair(n))return!1;let s=n.value;return s==null||e&&ne.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){let[n,...s]=e;if(s.length===0)return this.has(n);let i=this.get(n,!0);return ne.isCollection(i)?i.hasIn(s):!1}setIn(e,n){let[s,...i]=e;if(i.length===0)this.set(s,n);else{let r=this.get(s,!0);if(ne.isCollection(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,Cs(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};un.Collection=Ps;un.collectionFromPath=Cs;un.isEmptyPath=ho});var wt=S(dn=>{"use strict";var _f=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Ms(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Of=(t,e,n)=>t.endsWith(`
9
- `)?Ms(n,e):n.includes(`
3
+ var Bu=Object.create;var _s=Object.defineProperty;var xu=Object.getOwnPropertyDescriptor;var Fu=Object.getOwnPropertyNames;var Uu=Object.getPrototypeOf,ju=Object.prototype.hasOwnProperty;var ge=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var L=(t,e)=>()=>(t&&(e=t(t=0)),e);var w=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Q=(t,e)=>{for(var n in e)_s(t,n,{get:e[n],enumerable:!0})},Yu=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Fu(e))!ju.call(t,i)&&i!==n&&_s(t,i,{get:()=>e[i],enumerable:!(s=xu(e,i))||s.enumerable});return t};var le=(t,e,n)=>(n=t!=null?Bu(Uu(t)):{},Yu(e||!t||!t.__esModule?_s(n,"default",{value:t,enumerable:!0}):n,t));var I=w(F=>{"use strict";var Os=Symbol.for("yaml.alias"),Yr=Symbol.for("yaml.document"),an=Symbol.for("yaml.map"),Hr=Symbol.for("yaml.pair"),Is=Symbol.for("yaml.scalar"),ln=Symbol.for("yaml.seq"),ce=Symbol.for("yaml.node.type"),Hu=t=>!!t&&typeof t=="object"&&t[ce]===Os,Gu=t=>!!t&&typeof t=="object"&&t[ce]===Yr,Vu=t=>!!t&&typeof t=="object"&&t[ce]===an,Wu=t=>!!t&&typeof t=="object"&&t[ce]===Hr,Gr=t=>!!t&&typeof t=="object"&&t[ce]===Is,Ju=t=>!!t&&typeof t=="object"&&t[ce]===ln;function Vr(t){if(t&&typeof t=="object")switch(t[ce]){case an:case ln:return!0}return!1}function Qu(t){if(t&&typeof t=="object")switch(t[ce]){case Os:case an:case Is:case ln:return!0}return!1}var zu=t=>(Gr(t)||Vr(t))&&!!t.anchor;F.ALIAS=Os;F.DOC=Yr;F.MAP=an;F.NODE_TYPE=ce;F.PAIR=Hr;F.SCALAR=Is;F.SEQ=ln;F.hasAnchor=zu;F.isAlias=Hu;F.isCollection=Vr;F.isDocument=Gu;F.isMap=Vu;F.isNode=Qu;F.isPair=Wu;F.isScalar=Gr;F.isSeq=Ju});var ht=w(Ts=>{"use strict";var q=I(),V=Symbol("break visit"),Wr=Symbol("skip children"),ee=Symbol("remove node");function cn(t,e){let n=Jr(e);q.isDocument(t)?He(null,t.contents,n,Object.freeze([t]))===ee&&(t.contents=null):He(null,t,n,Object.freeze([]))}cn.BREAK=V;cn.SKIP=Wr;cn.REMOVE=ee;function He(t,e,n,s){let i=Qr(t,e,n,s);if(q.isNode(i)||q.isPair(i))return zr(t,s,i),He(t,i,n,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=He(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===V)return V;o===ee&&(e.items.splice(r,1),r-=1)}}}else if(q.isPair(e)){s=Object.freeze(s.concat(e));let r=He("key",e.key,n,s);if(r===V)return V;r===ee&&(e.key=null);let o=He("value",e.value,n,s);if(o===V)return V;o===ee&&(e.value=null)}}return i}async function un(t,e){let n=Jr(e);q.isDocument(t)?await Ge(null,t.contents,n,Object.freeze([t]))===ee&&(t.contents=null):await Ge(null,t,n,Object.freeze([]))}un.BREAK=V;un.SKIP=Wr;un.REMOVE=ee;async function Ge(t,e,n,s){let i=await Qr(t,e,n,s);if(q.isNode(i)||q.isPair(i))return zr(t,s,i),Ge(t,i,n,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 Ge(r,e.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===V)return V;o===ee&&(e.items.splice(r,1),r-=1)}}}else if(q.isPair(e)){s=Object.freeze(s.concat(e));let r=await Ge("key",e.key,n,s);if(r===V)return V;r===ee&&(e.key=null);let o=await Ge("value",e.value,n,s);if(o===V)return V;o===ee&&(e.value=null)}}return i}function Jr(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Qr(t,e,n,s){if(typeof n=="function")return n(t,e,s);if(q.isMap(e))return n.Map?.(t,e,s);if(q.isSeq(e))return n.Seq?.(t,e,s);if(q.isPair(e))return n.Pair?.(t,e,s);if(q.isScalar(e))return n.Scalar?.(t,e,s);if(q.isAlias(e))return n.Alias?.(t,e,s)}function zr(t,e,n){let s=e[e.length-1];if(q.isCollection(s))s.items[t]=n;else if(q.isPair(s))t==="key"?s.key=n:s.value=n;else if(q.isDocument(s))s.contents=n;else{let i=q.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Ts.visit=cn;Ts.visitAsync=un});var Ns=w(Zr=>{"use strict";var Xr=I(),Xu=ht(),Zu={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ef=t=>t.replace(/[!,[\]{}]/g,e=>Zu[e]),mt=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let s=e.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(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 n(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 n(6,`Unsupported YAML version ${r}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return n(String(o)),null}return s==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,s]of Object.entries(this.tags))if(e.startsWith(s))return n+ef(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),i;if(e&&s.length>0&&Xr.isNode(e.contents)){let r={};Xu.visit(e.contents,(o,a)=>{Xr.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)))&&n.push(`%TAG ${r} ${o}`);return n.join(`
4
+ `)}};mt.defaultYaml={explicit:!1,version:"1.2"};mt.defaultTags={"!!":"tag:yaml.org,2002:"};Zr.Directives=mt});var fn=w(gt=>{"use strict";var eo=I(),tf=ht();function nf(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function to(t){let e=new Set;return tf.visit(t,{Value(n,s){s.anchor&&e.add(s.anchor)}}),e}function no(t,e){for(let n=1;;++n){let s=`${t}${n}`;if(!e.has(s))return s}}function sf(t,e){let n=[],s=new Map,i=null;return{onAnchor:r=>{n.push(r),i??(i=to(t));let o=no(e,i);return i.add(o),o},setAnchors:()=>{for(let r of n){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(eo.isScalar(o.node)||eo.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}}gt.anchorIsValid=nf;gt.anchorNames=to;gt.createNodeAnchors=sf;gt.findNewAnchor=no});var Ls=w(so=>{"use strict";function yt(t,e,n,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=yt(t,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=yt(t,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=yt(t,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=yt(t,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return t.call(e,n,s)}so.applyReviver=yt});var ye=w(ro=>{"use strict";var rf=I();function io(t,e,n){if(Array.isArray(t))return t.map((s,i)=>io(s,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!rf.hasAnchor(t))return t.toJSON(e,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(t,s),n.onCreate=r=>{s.res=r,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}ro.toJS=io});var dn=w(ao=>{"use strict";var of=Ls(),oo=I(),af=ye(),Cs=class{constructor(e){Object.defineProperty(this,oo.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:n,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!oo.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=af.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?of.applyReviver(r,{"":a},"",a):a}};ao.NodeBase=Cs});var wt=w(lo=>{"use strict";var lf=fn(),cf=ht(),Ve=I(),uf=dn(),ff=ye(),Ps=class extends uf.NodeBase{constructor(e){super(Ve.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let s;n?.aliasResolveCache?s=n.aliasResolveCache:(s=[],cf.visit(e,{Node:(r,o)=>{(Ve.isAlias(o)||Ve.hasAnchor(o))&&s.push(o)}}),n&&(n.aliasResolveCache=s));let i;for(let r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:s,doc:i,maxAliasCount:r}=n,o=this.resolve(i,n);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(o);if(a||(ff.toJS(o,null,n),a=s.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=pn(i,o,s)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,n,s){let i=`*${this.source}`;if(e){if(lf.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 pn(t,e,n){if(Ve.isAlias(e)){let s=e.resolve(t),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(Ve.isCollection(e)){let s=0;for(let i of e.items){let r=pn(t,i,n);r>s&&(s=r)}return s}else if(Ve.isPair(e)){let s=pn(t,e.key,n),i=pn(t,e.value,n);return Math.max(s,i)}return 1}lo.Alias=Ps});var $=w(Ms=>{"use strict";var df=I(),pf=dn(),hf=ye(),mf=t=>!t||typeof t!="function"&&typeof t!="object",we=class extends pf.NodeBase{constructor(e){super(df.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:hf.toJS(this.value,e,n)}toString(){return String(this.value)}};we.BLOCK_FOLDED="BLOCK_FOLDED";we.BLOCK_LITERAL="BLOCK_LITERAL";we.PLAIN="PLAIN";we.QUOTE_DOUBLE="QUOTE_DOUBLE";we.QUOTE_SINGLE="QUOTE_SINGLE";Ms.Scalar=we;Ms.isScalarValue=mf});var St=w(uo=>{"use strict";var gf=wt(),Me=I(),co=$(),yf="tag:yaml.org,2002:";function wf(t,e,n){if(e){let s=n.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 n.find(s=>s.identify?.(t)&&!s.format)}function Sf(t,e,n){if(Me.isDocument(t)&&(t=t.contents),Me.isNode(t))return t;if(Me.isPair(t)){let u=n.schema[Me.MAP].createNode?.(n.schema,null,n);return u.items.push(t),u}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=n,l;if(s&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=i(t)),new gf.Alias(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=yf+e.slice(2));let c=wf(t,e,o.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let u=new co.Scalar(t);return l&&(l.node=u),u}c=t instanceof Map?o[Me.MAP]:Symbol.iterator in Object(t)?o[Me.SEQ]:o[Me.MAP]}r&&(r(c),delete n.onTagObj);let f=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new co.Scalar(t);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}uo.createNode=Sf});var mn=w(hn=>{"use strict";var bf=St(),te=I(),vf=dn();function $s(t,e,n){let s=n;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 bf.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var fo=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Ds=class extends vf.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(s=>te.isNode(s)||te.isPair(s)?s.clone(e):s),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(fo(e))this.add(n);else{let[s,...i]=e,r=this.get(s,!0);if(te.isCollection(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,$s(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(e){let[n,...s]=e;if(s.length===0)return this.delete(n);let i=this.get(n,!0);if(te.isCollection(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(e,n){let[s,...i]=e,r=this.get(s,!0);return i.length===0?!n&&te.isScalar(r)?r.value:r:te.isCollection(r)?r.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!te.isPair(n))return!1;let s=n.value;return s==null||e&&te.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){let[n,...s]=e;if(s.length===0)return this.has(n);let i=this.get(n,!0);return te.isCollection(i)?i.hasIn(s):!1}setIn(e,n){let[s,...i]=e;if(i.length===0)this.set(s,n);else{let r=this.get(s,!0);if(te.isCollection(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,$s(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};hn.Collection=Ds;hn.collectionFromPath=$s;hn.isEmptyPath=fo});var bt=w(gn=>{"use strict";var kf=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function qs(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Ef=(t,e,n)=>t.endsWith(`
5
+ `)?qs(n,e):n.includes(`
10
6
  `)?`
11
- `+Ms(n,e):(t.endsWith(" ")?"":" ")+n;dn.indentComment=Ms;dn.lineComment=Of;dn.stringifyComment=_f});var go=S(bt=>{"use strict";var If="flow",$s="block",pn="quoted";function Tf(t,e,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;i<r&&(r=0);let l=Math.max(1+r,1+i-e.length);if(t.length<=l)return t;let c=[],f={},u=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):u=i-s);let d,h,y=!1,p=-1,m=-1,w=-1;n===$s&&(p=mo(t,p,e.length),p!==-1&&(u=p+l));for(let A;A=t[p+=1];){if(n===pn&&A==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}w=p}if(A===`
12
- `)n===$s&&(p=mo(t,p,e.length)),u=p+e.length+l,d=void 0;else{if(A===" "&&h&&h!==" "&&h!==`
7
+ `+qs(n,e):(t.endsWith(" ")?"":" ")+n;gn.indentComment=qs;gn.lineComment=Ef;gn.stringifyComment=kf});var ho=w(vt=>{"use strict";var Af="flow",Rs="block",yn="quoted";function _f(t,e,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;i<r&&(r=0);let l=Math.max(1+r,1+i-e.length);if(t.length<=l)return t;let c=[],f={},u=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):u=i-s);let d,h,y=!1,p=-1,m=-1,S=-1;n===Rs&&(p=po(t,p,e.length),p!==-1&&(u=p+l));for(let A;A=t[p+=1];){if(n===yn&&A==="\\"){switch(m=p,t[p+1]){case"x":p+=3;break;case"u":p+=5;break;case"U":p+=9;break;default:p+=1}S=p}if(A===`
8
+ `)n===Rs&&(p=po(t,p,e.length)),u=p+e.length+l,d=void 0;else{if(A===" "&&h&&h!==" "&&h!==`
13
9
  `&&h!==" "){let _=t[p+1];_&&_!==" "&&_!==`
14
- `&&_!==" "&&(d=p)}if(p>=u)if(d)c.push(d),u=d+l,d=void 0;else if(n===pn){for(;h===" "||h===" ";)h=A,A=t[p+=1],y=!0;let _=p>w+1?p-2:m-1;if(f[_])return t;c.push(_),f[_]=!0,u=_+l,d=void 0}else y=!0}h=A}if(y&&a&&a(),c.length===0)return t;o&&o();let v=t.slice(0,c[0]);for(let A=0;A<c.length;++A){let _=c[A],E=c[A+1]||t.length;_===0?v=`
15
- ${e}${t.slice(0,E)}`:(n===pn&&f[_]&&(v+=`${t[_]}\\`),v+=`
16
- ${e}${t.slice(_+1,E)}`)}return v}function mo(t,e,n){let s=e,i=e+1,r=t[i];for(;r===" "||r===" ";)if(e<i+n)r=t[++e];else{do r=t[++e];while(r&&r!==`
17
- `);s=e,i=e+1,r=t[i]}return s}bt.FOLD_BLOCK=$s;bt.FOLD_FLOW=If;bt.FOLD_QUOTED=pn;bt.foldFlowLines=Tf});var kt=S(yo=>{"use strict";var z=$(),we=go(),mn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),gn=t=>/^(%|---|\.\.\.)/m.test(t);function Nf(t,e,n){if(!e||e<0)return!1;let s=e-n,i=t.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(t[r]===`
18
- `){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function vt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(gn(t)?" ":""),o="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);let f=n.substr(l+2,4);switch(f){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:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||n[l+2]==='"'||n.length<i)l+=1;else{for(o+=n.slice(a,l)+`
10
+ `&&_!==" "&&(d=p)}if(p>=u)if(d)c.push(d),u=d+l,d=void 0;else if(n===yn){for(;h===" "||h===" ";)h=A,A=t[p+=1],y=!0;let _=p>S+1?p-2:m-1;if(f[_])return t;c.push(_),f[_]=!0,u=_+l,d=void 0}else y=!0}h=A}if(y&&a&&a(),c.length===0)return t;o&&o();let v=t.slice(0,c[0]);for(let A=0;A<c.length;++A){let _=c[A],E=c[A+1]||t.length;_===0?v=`
11
+ ${e}${t.slice(0,E)}`:(n===yn&&f[_]&&(v+=`${t[_]}\\`),v+=`
12
+ ${e}${t.slice(_+1,E)}`)}return v}function po(t,e,n){let s=e,i=e+1,r=t[i];for(;r===" "||r===" ";)if(e<i+n)r=t[++e];else{do r=t[++e];while(r&&r!==`
13
+ `);s=e,i=e+1,r=t[i]}return s}vt.FOLD_BLOCK=Rs;vt.FOLD_FLOW=Af;vt.FOLD_QUOTED=yn;vt.foldFlowLines=_f});var Et=w(mo=>{"use strict";var z=$(),Se=ho(),Sn=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),bn=t=>/^(%|---|\.\.\.)/m.test(t);function Of(t,e,n){if(!e||e<0)return!1;let s=e-n,i=t.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(t[r]===`
14
+ `){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function kt(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(bn(t)?" ":""),o="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);let f=n.substr(l+2,4);switch(f){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:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||n[l+2]==='"'||n.length<i)l+=1;else{for(o+=n.slice(a,l)+`
19
15
 
20
16
  `;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)o+=`
21
- `,l+=2;o+=r,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,s?o:we.foldFlowLines(o,r,we.FOLD_QUOTED,mn(e,!1))}function Ds(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
22
- `)||/[ \t]\n|\n[ \t]/.test(t))return vt(t,e);let n=e.indent||(gn(t)?" ":""),s="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
23
- ${n}`)+"'";return e.implicitKey?s:we.foldFlowLines(s,n,we.FOLD_FLOW,mn(e,!1))}function Ge(t,e){let{singleQuote:n}=e.options,s;if(n===!1)s=vt;else{let i=t.includes('"'),r=t.includes("'");i&&!r?s=Ds:r&&!i?s=vt:s=n?Ds:vt}return s(t,e)}var qs;try{qs=new RegExp(`(^|(?<!
17
+ `,l+=2;o+=r,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,s?o:Se.foldFlowLines(o,r,Se.FOLD_QUOTED,Sn(e,!1))}function Ks(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
18
+ `)||/[ \t]\n|\n[ \t]/.test(t))return kt(t,e);let n=e.indent||(bn(t)?" ":""),s="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
19
+ ${n}`)+"'";return e.implicitKey?s:Se.foldFlowLines(s,n,Se.FOLD_FLOW,Sn(e,!1))}function We(t,e){let{singleQuote:n}=e.options,s;if(n===!1)s=kt;else{let i=t.includes('"'),r=t.includes("'");i&&!r?s=Ks:r&&!i?s=kt:s=n?Ks:kt}return s(t,e)}var Bs;try{Bs=new RegExp(`(^|(?<!
24
20
  ))
25
21
  +(?!
26
- |$)`,"g")}catch{qs=/\n+(?!\n|$)/g}function hn({comment:t,type:e,value:n},s,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=s.options;if(!o||/\n[\t ]+$/.test(n))return Ge(n,s);let c=s.indent||(s.forceBlockIndent||gn(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===z.Scalar.BLOCK_FOLDED?!1:e===z.Scalar.BLOCK_LITERAL?!0:!Nf(n,l,c.length);if(!n)return f?`|
22
+ |$)`,"g")}catch{Bs=/\n+(?!\n|$)/g}function wn({comment:t,type:e,value:n},s,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=s.options;if(!o||/\n[\t ]+$/.test(n))return We(n,s);let c=s.indent||(s.forceBlockIndent||bn(n)?" ":""),f=o==="literal"?!0:o==="folded"||e===z.Scalar.BLOCK_FOLDED?!1:e===z.Scalar.BLOCK_LITERAL?!0:!Of(n,l,c.length);if(!n)return f?`|
27
23
  `:`>
28
24
  `;let u,d;for(d=n.length;d>0;--d){let E=n[d-1];if(E!==`
29
25
  `&&E!==" "&&E!==" ")break}let h=n.substring(d),y=h.indexOf(`
30
26
  `);y===-1?u="-":n===h||y!==h.length-1?(u="+",r&&r()):u="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
31
- `&&(h=h.slice(0,-1)),h=h.replace(qs,`$&${c}`));let p=!1,m,w=-1;for(m=0;m<n.length;++m){let E=n[m];if(E===" ")p=!0;else if(E===`
32
- `)w=m;else break}let v=n.substring(0,w<m?w+1:m);v&&(n=n.substring(v.length),v=v.replace(/\n+/g,`$&${c}`));let _=(p?c?"2":"1":"")+u;if(t&&(_+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!f){let E=n.replace(/\n+/g,`
33
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),O=!1,N=mn(s,!0);o!=="folded"&&e!==z.Scalar.BLOCK_FOLDED&&(N.onOverflow=()=>{O=!0});let k=we.foldFlowLines(`${v}${E}${h}`,c,we.FOLD_BLOCK,N);if(!O)return`>${_}
27
+ `&&(h=h.slice(0,-1)),h=h.replace(Bs,`$&${c}`));let p=!1,m,S=-1;for(m=0;m<n.length;++m){let E=n[m];if(E===" ")p=!0;else if(E===`
28
+ `)S=m;else break}let v=n.substring(0,S<m?S+1:m);v&&(n=n.substring(v.length),v=v.replace(/\n+/g,`$&${c}`));let _=(p?c?"2":"1":"")+u;if(t&&(_+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!f){let E=n.replace(/\n+/g,`
29
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),O=!1,T=Sn(s,!0);o!=="folded"&&e!==z.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{O=!0});let k=Se.foldFlowLines(`${v}${E}${h}`,c,Se.FOLD_BLOCK,T);if(!O)return`>${_}
34
30
  ${c}${k}`}return n=n.replace(/\n+/g,`$&${c}`),`|${_}
35
- ${c}${v}${n}${h}`}function Lf(t,e,n,s){let{type:i,value:r}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&r.includes(`
36
- `)||f&&/[[\]{},]/.test(r))return Ge(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||f||!r.includes(`
37
- `)?Ge(r,e):hn(t,e,n,s);if(!a&&!f&&i!==z.Scalar.PLAIN&&r.includes(`
38
- `))return hn(t,e,n,s);if(gn(r)){if(l==="")return e.forceBlockIndent=!0,hn(t,e,n,s);if(a&&l===c)return Ge(r,e)}let u=r.replace(/\n+/g,`$&
39
- ${l}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:y}=e.doc.schema;if(y.some(d)||h?.some(d))return Ge(r,e)}return a?u:we.foldFlowLines(u,l,we.FOLD_FLOW,mn(e,!1))}function Cf(t,e,n,s){let{implicitKey:i,inFlow:r}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==z.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=z.Scalar.QUOTE_DOUBLE);let l=f=>{switch(f){case z.Scalar.BLOCK_FOLDED:case z.Scalar.BLOCK_LITERAL:return i||r?Ge(o.value,e):hn(o,e,n,s);case z.Scalar.QUOTE_DOUBLE:return vt(o.value,e);case z.Scalar.QUOTE_SINGLE:return Ds(o.value,e);case z.Scalar.PLAIN:return Lf(o,e,n,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=i&&f||u;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}yo.stringifyString=Cf});var Et=S(Rs=>{"use strict";var Pf=an(),be=I(),Mf=wt(),$f=kt();function Df(t,e){let n=Object.assign({blockQuote:!0,commentString:Mf.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},t.schema.toStringOptions,e),s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function qf(t,e){if(e.tag){let i=t.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let n,s;if(be.isScalar(e)){s=e.value;let i=t.filter(r=>r.identify?.(s));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}n=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else s=e,n=t.find(i=>i.nodeClass&&s instanceof i.nodeClass);if(!n){let i=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${i} value`)}return n}function Rf(t,e,{anchors:n,doc:s}){if(!s.directives)return"";let i=[],r=(be.isScalar(t)||be.isCollection(t))&&t.anchor;r&&Pf.anchorIsValid(r)&&(n.add(r),i.push(`&${r}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function Kf(t,e,n,s){if(be.isPair(t))return t.toString(e,n,s);if(be.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,r=be.isNode(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=qf(e.doc.schema.tags,r));let o=Rf(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,e,n,s):be.isScalar(r)?$f.stringifyString(r,e,n,s):r.toString(e,n,s);return o?be.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
40
- ${e.indent}${a}`:a}Rs.createStringifyContext=Df;Rs.stringify=Kf});var vo=S(bo=>{"use strict";var ce=I(),So=$(),wo=Et(),At=wt();function Bf({key:t,value:e},n,s,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=n,d=ce.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ce.isCollection(t)||!ce.isNode(t)&&typeof t=="object"){let N="With simple keys, collection cannot be used as a key value";throw new Error(N)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||ce.isCollection(t)||(ce.isScalar(t)?t.type===So.Scalar.BLOCK_FOLDED||t.type===So.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!r),indent:a+l});let y=!1,p=!1,m=wo.stringify(t,n,()=>y=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(r||e==null)return y&&s&&s(),m===""?"?":h?`? ${m}`:m}else if(r&&!u||e==null&&h)return m=`? ${m}`,d&&!y?m+=At.lineComment(m,n.indent,c(d)):p&&i&&i(),m;y&&(d=null),h?(d&&(m+=At.lineComment(m,n.indent,c(d))),m=`? ${m}
41
- ${a}:`):(m=`${m}:`,d&&(m+=At.lineComment(m,n.indent,c(d))));let w,v,A;ce.isNode(e)?(w=!!e.spaceBefore,v=e.commentBefore,A=e.comment):(w=!1,v=null,A=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!d&&ce.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&l.length>=2&&!n.inFlow&&!h&&ce.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let _=!1,E=wo.stringify(e,n,()=>_=!0,()=>p=!0),O=" ";if(d||w||v){if(O=w?`
42
- `:"",v){let N=c(v);O+=`
43
- ${At.indentComment(N,n.indent)}`}E===""&&!n.inFlow?O===`
31
+ ${c}${v}${n}${h}`}function If(t,e,n,s){let{type:i,value:r}=t,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&r.includes(`
32
+ `)||f&&/[[\]{},]/.test(r))return We(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||f||!r.includes(`
33
+ `)?We(r,e):wn(t,e,n,s);if(!a&&!f&&i!==z.Scalar.PLAIN&&r.includes(`
34
+ `))return wn(t,e,n,s);if(bn(r)){if(l==="")return e.forceBlockIndent=!0,wn(t,e,n,s);if(a&&l===c)return We(r,e)}let u=r.replace(/\n+/g,`$&
35
+ ${l}`);if(o){let d=p=>p.default&&p.tag!=="tag:yaml.org,2002:str"&&p.test?.test(u),{compat:h,tags:y}=e.doc.schema;if(y.some(d)||h?.some(d))return We(r,e)}return a?u:Se.foldFlowLines(u,l,Se.FOLD_FLOW,Sn(e,!1))}function Tf(t,e,n,s){let{implicitKey:i,inFlow:r}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==z.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=z.Scalar.QUOTE_DOUBLE);let l=f=>{switch(f){case z.Scalar.BLOCK_FOLDED:case z.Scalar.BLOCK_LITERAL:return i||r?We(o.value,e):wn(o,e,n,s);case z.Scalar.QUOTE_DOUBLE:return kt(o.value,e);case z.Scalar.QUOTE_SINGLE:return Ks(o.value,e);case z.Scalar.PLAIN:return If(o,e,n,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:f,defaultStringType:u}=e.options,d=i&&f||u;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}mo.stringifyString=Tf});var At=w(xs=>{"use strict";var Nf=fn(),be=I(),Lf=bt(),Cf=Et();function Pf(t,e){let n=Object.assign({blockQuote:!0,commentString:Lf.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},t.schema.toStringOptions,e),s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function Mf(t,e){if(e.tag){let i=t.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let n,s;if(be.isScalar(e)){s=e.value;let i=t.filter(r=>r.identify?.(s));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}n=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else s=e,n=t.find(i=>i.nodeClass&&s instanceof i.nodeClass);if(!n){let i=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${i} value`)}return n}function $f(t,e,{anchors:n,doc:s}){if(!s.directives)return"";let i=[],r=(be.isScalar(t)||be.isCollection(t))&&t.anchor;r&&Nf.anchorIsValid(r)&&(n.add(r),i.push(`&${r}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function Df(t,e,n,s){if(be.isPair(t))return t.toString(e,n,s);if(be.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,r=be.isNode(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=Mf(e.doc.schema.tags,r));let o=$f(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,e,n,s):be.isScalar(r)?Cf.stringifyString(r,e,n,s):r.toString(e,n,s);return o?be.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
36
+ ${e.indent}${a}`:a}xs.createStringifyContext=Pf;xs.stringify=Df});var So=w(wo=>{"use strict";var ue=I(),go=$(),yo=At(),_t=bt();function qf({key:t,value:e},n,s,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=n,d=ue.isNode(t)&&t.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ue.isCollection(t)||!ue.isNode(t)&&typeof t=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let h=!u&&(!t||d&&e==null&&!n.inFlow||ue.isCollection(t)||(ue.isScalar(t)?t.type===go.Scalar.BLOCK_FOLDED||t.type===go.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(u||!r),indent:a+l});let y=!1,p=!1,m=yo.stringify(t,n,()=>y=!0,()=>p=!0);if(!h&&!n.inFlow&&m.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(r||e==null)return y&&s&&s(),m===""?"?":h?`? ${m}`:m}else if(r&&!u||e==null&&h)return m=`? ${m}`,d&&!y?m+=_t.lineComment(m,n.indent,c(d)):p&&i&&i(),m;y&&(d=null),h?(d&&(m+=_t.lineComment(m,n.indent,c(d))),m=`? ${m}
37
+ ${a}:`):(m=`${m}:`,d&&(m+=_t.lineComment(m,n.indent,c(d))));let S,v,A;ue.isNode(e)?(S=!!e.spaceBefore,v=e.commentBefore,A=e.comment):(S=!1,v=null,A=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!h&&!d&&ue.isScalar(e)&&(n.indentAtStart=m.length+1),p=!1,!f&&l.length>=2&&!n.inFlow&&!h&&ue.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let _=!1,E=yo.stringify(e,n,()=>_=!0,()=>p=!0),O=" ";if(d||S||v){if(O=S?`
38
+ `:"",v){let T=c(v);O+=`
39
+ ${_t.indentComment(T,n.indent)}`}E===""&&!n.inFlow?O===`
44
40
  `&&A&&(O=`
45
41
 
46
42
  `):O+=`
47
- ${n.indent}`}else if(!h&&ce.isCollection(e)){let N=E[0],k=E.indexOf(`
48
- `),M=k!==-1,pe=n.inFlow??e.flow??e.items.length===0;if(M||!pe){let Ue=!1;if(M&&(N==="&"||N==="!")){let D=E.indexOf(" ");N==="&"&&D!==-1&&D<k&&E[D+1]==="!"&&(D=E.indexOf(" ",D+1)),(D===-1||k<D)&&(Ue=!0)}Ue||(O=`
43
+ ${n.indent}`}else if(!h&&ue.isCollection(e)){let T=E[0],k=E.indexOf(`
44
+ `),M=k!==-1,me=n.inFlow??e.flow??e.items.length===0;if(M||!me){let Ye=!1;if(M&&(T==="&"||T==="!")){let D=E.indexOf(" ");T==="&"&&D!==-1&&D<k&&E[D+1]==="!"&&(D=E.indexOf(" ",D+1)),(D===-1||k<D)&&(Ye=!0)}Ye||(O=`
49
45
  ${n.indent}`)}}else(E===""||E[0]===`
50
- `)&&(O="");return m+=O+E,n.inFlow?_&&s&&s():A&&!_?m+=At.lineComment(m,n.indent,c(A)):p&&i&&i(),m}bo.stringifyPair=Bf});var Bs=S(Ks=>{"use strict";var ko=he("process");function xf(t,...e){t==="debug"&&console.log(...e)}function Ff(t,e){(t==="debug"||t==="warn")&&(typeof ko.emitWarning=="function"?ko.emitWarning(e):console.warn(e))}Ks.debug=xf;Ks.warn=Ff});var bn=S(wn=>{"use strict";var _t=I(),Eo=$(),yn="<<",Sn={identify:t=>t===yn||typeof t=="symbol"&&t.description===yn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Eo.Scalar(Symbol(yn)),{addToJSMap:Ao}),stringify:()=>yn},Uf=(t,e)=>(Sn.identify(e)||_t.isScalar(e)&&(!e.type||e.type===Eo.Scalar.PLAIN)&&Sn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Sn.tag&&n.default);function Ao(t,e,n){if(n=t&&_t.isAlias(n)?n.resolve(t.doc):n,_t.isSeq(n))for(let s of n.items)xs(t,e,s);else if(Array.isArray(n))for(let s of n)xs(t,e,s);else xs(t,e,n)}function xs(t,e,n){let s=t&&_t.isAlias(n)?n.resolve(t.doc):n;if(!_t.isMap(s))throw new Error("Merge sources must be maps or map aliases");let i=s.toJSON(null,t,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}wn.addMergeToJSMap=Ao;wn.isMergeKey=Uf;wn.merge=Sn});var Us=S(Io=>{"use strict";var jf=Bs(),_o=bn(),Yf=Et(),Oo=I(),Fs=ye();function Hf(t,e,{key:n,value:s}){if(Oo.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,s);else if(_o.isMergeKey(t,n))_o.addMergeToJSMap(t,e,s);else{let i=Fs.toJS(n,"",t);if(e instanceof Map)e.set(i,Fs.toJS(s,i,t));else if(e instanceof Set)e.add(i);else{let r=Gf(n,i,t),o=Fs.toJS(s,r,t);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Gf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Oo.isNode(t)&&n?.doc){let s=Yf.createStringifyContext(n.doc,{});s.anchors=new Set;for(let r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let i=t.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),jf.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}Io.addPairToJSMap=Hf});var ve=S(js=>{"use strict";var To=St(),Vf=vo(),Wf=Us(),vn=I();function Jf(t,e,n){let s=To.createNode(t,void 0,n),i=To.createNode(e,void 0,n);return new kn(s,i)}var kn=class t{constructor(e,n=null){Object.defineProperty(this,vn.NODE_TYPE,{value:vn.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:s}=this;return vn.isNode(n)&&(n=n.clone(e)),vn.isNode(s)&&(s=s.clone(e)),new t(n,s)}toJSON(e,n){let s=n?.mapAsMap?new Map:{};return Wf.addPairToJSMap(n,s,this)}toString(e,n,s){return e?.doc?Vf.stringifyPair(this,e,n,s):JSON.stringify(this)}};js.Pair=kn;js.createPair=Jf});var Ys=S(Lo=>{"use strict";var Pe=I(),No=Et(),En=wt();function Qf(t,e,n){return(e.inFlow??t.flow?Xf:zf)(t,e,n)}function zf({comment:t,items:e},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=n,f=Object.assign({},n,{indent:r,type:null}),u=!1,d=[];for(let y=0;y<e.length;++y){let p=e[y],m=null;if(Pe.isNode(p))!u&&p.spaceBefore&&d.push(""),An(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if(Pe.isPair(p)){let v=Pe.isNode(p.key)?p.key:null;v&&(!u&&v.spaceBefore&&d.push(""),An(n,d,v.commentBefore,u))}u=!1;let w=No.stringify(p,f,()=>m=null,()=>u=!0);m&&(w+=En.lineComment(w,r,c(m))),u&&m&&(u=!1),d.push(s+w)}let h;if(d.length===0)h=i.start+i.end;else{h=d[0];for(let y=1;y<d.length;++y){let p=d[y];h+=p?`
46
+ `)&&(O="");return m+=O+E,n.inFlow?_&&s&&s():A&&!_?m+=_t.lineComment(m,n.indent,c(A)):p&&i&&i(),m}wo.stringifyPair=qf});var Us=w(Fs=>{"use strict";var bo=ge("process");function Rf(t,...e){t==="debug"&&console.log(...e)}function Kf(t,e){(t==="debug"||t==="warn")&&(typeof bo.emitWarning=="function"?bo.emitWarning(e):console.warn(e))}Fs.debug=Rf;Fs.warn=Kf});var An=w(En=>{"use strict";var Ot=I(),vo=$(),vn="<<",kn={identify:t=>t===vn||typeof t=="symbol"&&t.description===vn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new vo.Scalar(Symbol(vn)),{addToJSMap:ko}),stringify:()=>vn},Bf=(t,e)=>(kn.identify(e)||Ot.isScalar(e)&&(!e.type||e.type===vo.Scalar.PLAIN)&&kn.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===kn.tag&&n.default);function ko(t,e,n){if(n=t&&Ot.isAlias(n)?n.resolve(t.doc):n,Ot.isSeq(n))for(let s of n.items)js(t,e,s);else if(Array.isArray(n))for(let s of n)js(t,e,s);else js(t,e,n)}function js(t,e,n){let s=t&&Ot.isAlias(n)?n.resolve(t.doc):n;if(!Ot.isMap(s))throw new Error("Merge sources must be maps or map aliases");let i=s.toJSON(null,t,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}En.addMergeToJSMap=ko;En.isMergeKey=Bf;En.merge=kn});var Hs=w(_o=>{"use strict";var xf=Us(),Eo=An(),Ff=At(),Ao=I(),Ys=ye();function Uf(t,e,{key:n,value:s}){if(Ao.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,s);else if(Eo.isMergeKey(t,n))Eo.addMergeToJSMap(t,e,s);else{let i=Ys.toJS(n,"",t);if(e instanceof Map)e.set(i,Ys.toJS(s,i,t));else if(e instanceof Set)e.add(i);else{let r=jf(n,i,t),o=Ys.toJS(s,r,t);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function jf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Ao.isNode(t)&&n?.doc){let s=Ff.createStringifyContext(n.doc,{});s.anchors=new Set;for(let r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let i=t.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),xf.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}_o.addPairToJSMap=Uf});var ve=w(Gs=>{"use strict";var Oo=St(),Yf=So(),Hf=Hs(),_n=I();function Gf(t,e,n){let s=Oo.createNode(t,void 0,n),i=Oo.createNode(e,void 0,n);return new On(s,i)}var On=class t{constructor(e,n=null){Object.defineProperty(this,_n.NODE_TYPE,{value:_n.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:s}=this;return _n.isNode(n)&&(n=n.clone(e)),_n.isNode(s)&&(s=s.clone(e)),new t(n,s)}toJSON(e,n){let s=n?.mapAsMap?new Map:{};return Hf.addPairToJSMap(n,s,this)}toString(e,n,s){return e?.doc?Yf.stringifyPair(this,e,n,s):JSON.stringify(this)}};Gs.Pair=On;Gs.createPair=Gf});var Vs=w(To=>{"use strict";var $e=I(),Io=At(),In=bt();function Vf(t,e,n){return(e.inFlow??t.flow?Jf:Wf)(t,e,n)}function Wf({comment:t,items:e},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=n,f=Object.assign({},n,{indent:r,type:null}),u=!1,d=[];for(let y=0;y<e.length;++y){let p=e[y],m=null;if($e.isNode(p))!u&&p.spaceBefore&&d.push(""),Tn(n,d,p.commentBefore,u),p.comment&&(m=p.comment);else if($e.isPair(p)){let v=$e.isNode(p.key)?p.key:null;v&&(!u&&v.spaceBefore&&d.push(""),Tn(n,d,v.commentBefore,u))}u=!1;let S=Io.stringify(p,f,()=>m=null,()=>u=!0);m&&(S+=In.lineComment(S,r,c(m))),u&&m&&(u=!1),d.push(s+S)}let h;if(d.length===0)h=i.start+i.end;else{h=d[0];for(let y=1;y<d.length;++y){let p=d[y];h+=p?`
51
47
  ${l}${p}`:`
52
48
  `}}return t?(h+=`
53
- `+En.indentComment(c(t),l),a&&a()):u&&o&&o(),h}function Xf({items:t},e,{flowChars:n,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,f=0,u=[];for(let y=0;y<t.length;++y){let p=t[y],m=null;if(Pe.isNode(p))p.spaceBefore&&u.push(""),An(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if(Pe.isPair(p)){let v=Pe.isNode(p.key)?p.key:null;v&&(v.spaceBefore&&u.push(""),An(e,u,v.commentBefore,!1),v.comment&&(c=!0));let A=Pe.isNode(p.value)?p.value:null;A?(A.comment&&(m=A.comment),A.commentBefore&&(c=!0)):p.value==null&&v?.comment&&(m=v.comment)}m&&(c=!0);let w=No.stringify(p,l,()=>m=null);c||(c=u.length>f||w.includes(`
54
- `)),y<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=u.reduce((v,A)=>v+A.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),m&&(w+=En.lineComment(w,s,a(m))),u.push(w),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!c){let y=u.reduce((p,m)=>p+m.length+2,2);c=e.options.lineWidth>0&&y>e.options.lineWidth}if(c){let y=d;for(let p of u)y+=p?`
49
+ `+In.indentComment(c(t),l),a&&a()):u&&o&&o(),h}function Jf({items:t},e,{flowChars:n,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,f=0,u=[];for(let y=0;y<t.length;++y){let p=t[y],m=null;if($e.isNode(p))p.spaceBefore&&u.push(""),Tn(e,u,p.commentBefore,!1),p.comment&&(m=p.comment);else if($e.isPair(p)){let v=$e.isNode(p.key)?p.key:null;v&&(v.spaceBefore&&u.push(""),Tn(e,u,v.commentBefore,!1),v.comment&&(c=!0));let A=$e.isNode(p.value)?p.value:null;A?(A.comment&&(m=A.comment),A.commentBefore&&(c=!0)):p.value==null&&v?.comment&&(m=v.comment)}m&&(c=!0);let S=Io.stringify(p,l,()=>m=null);c||(c=u.length>f||S.includes(`
50
+ `)),y<t.length-1?S+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=u.reduce((v,A)=>v+A.length+2,2)+(S.length+2)>e.options.lineWidth)),c&&(S+=",")),m&&(S+=In.lineComment(S,s,a(m))),u.push(S),f=u.length}let{start:d,end:h}=n;if(u.length===0)return d+h;if(!c){let y=u.reduce((p,m)=>p+m.length+2,2);c=e.options.lineWidth>0&&y>e.options.lineWidth}if(c){let y=d;for(let p of u)y+=p?`
55
51
  ${r}${i}${p}`:`
56
52
  `;return`${y}
57
- ${i}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function An({indent:t,options:{commentString:e}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=En.indentComment(e(s),t);n.push(r.trimStart())}}Lo.stringifyCollection=Qf});var Ee=S(Gs=>{"use strict";var Zf=Ys(),ed=Us(),td=fn(),ke=I(),_n=ve(),nd=$();function Ot(t,e){let n=ke.isScalar(e)?e.value:e;for(let s of t)if(ke.isPair(s)&&(s.key===e||s.key===n||ke.isScalar(s.key)&&s.key.value===n))return s}var Hs=class extends td.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ke.MAP,e),this.items=[]}static from(e,n,s){let{keepUndefined:i,replacer:r}=s,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(n,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||i)&&o.items.push(_n.createPair(l,c,s))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let s;ke.isPair(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new _n.Pair(e,e?.value):s=new _n.Pair(e.key,e.value);let i=Ot(this.items,s.key),r=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);ke.isScalar(i.value)&&nd.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 n=Ot(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=Ot(this.items,e)?.value;return(!n&&ke.isScalar(i)?i.value:i)??void 0}has(e){return!!Ot(this.items,e)}set(e,n){this.add(new _n.Pair(e,n),!0)}toJSON(e,n,s){let i=s?new s:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let r of this.items)ed.addPairToJSMap(n,i,r);return i}toString(e,n,s){if(!e)return JSON.stringify(this);for(let i of this.items)if(!ke.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})),Zf.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:n})}};Gs.YAMLMap=Hs;Gs.findPair=Ot});var Ve=S(Po=>{"use strict";var sd=I(),Co=Ee(),id={collection:"map",default:!0,nodeClass:Co.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return sd.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Co.YAMLMap.from(t,e,n)};Po.map=id});var Ae=S(Mo=>{"use strict";var rd=St(),od=Ys(),ad=fn(),In=I(),ld=$(),cd=ye(),Vs=class extends ad.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(In.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=On(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let s=On(e);if(typeof s!="number")return;let i=this.items[s];return!n&&In.isScalar(i)?i.value:i}has(e){let n=On(e);return typeof n=="number"&&n<this.items.length}set(e,n){let s=On(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[s];In.isScalar(i)&&ld.isScalarValue(n)?i.value=n:this.items[s]=n}toJSON(e,n){let s=[];n?.onCreate&&n.onCreate(s);let i=0;for(let r of this.items)s.push(cd.toJS(r,String(i++),n));return s}toString(e,n,s){return e?od.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(e,n,s){let{replacer:i}=s,r=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof i=="function"){let l=n instanceof Set?a:String(o++);a=i.call(n,l,a)}r.items.push(rd.createNode(a,void 0,s))}}return r}};function On(t){let e=In.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Mo.YAMLSeq=Vs});var We=S(Do=>{"use strict";var ud=I(),$o=Ae(),fd={collection:"seq",default:!0,nodeClass:$o.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ud.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>$o.YAMLSeq.from(t,e,n)};Do.seq=fd});var It=S(qo=>{"use strict";var dd=kt(),pd={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,s){return e=Object.assign({actualString:!0},e),dd.stringifyString(t,e,n,s)}};qo.string=pd});var Tn=S(Bo=>{"use strict";var Ro=$(),Ko={identify:t=>t==null,createNode:()=>new Ro.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ro.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Ko.test.test(t)?t:e.options.nullStr};Bo.nullTag=Ko});var Ws=S(Fo=>{"use strict";var hd=$(),xo={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new hd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&xo.test.test(t)){let s=t[0]==="t"||t[0]==="T";if(e===s)return t}return e?n.options.trueStr:n.options.falseStr}};Fo.boolTag=xo});var Je=S(Uo=>{"use strict";function md({format:t,minFractionDigits:e,tag:n,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(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}Uo.stringifyNumber=md});var Qs=S(Nn=>{"use strict";var gd=$(),Js=Je(),yd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Js.stringifyNumber},Sd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Js.stringifyNumber(t)}},wd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new gd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Js.stringifyNumber};Nn.float=wd;Nn.floatExp=Sd;Nn.floatNaN=yd});var Xs=S(Cn=>{"use strict";var jo=Je(),Ln=t=>typeof t=="bigint"||Number.isInteger(t),zs=(t,e,n,{intAsBigInt:s})=>s?BigInt(t):parseInt(t.substring(e),n);function Yo(t,e,n){let{value:s}=t;return Ln(s)&&s>=0?n+s.toString(e):jo.stringifyNumber(t)}var bd={identify:t=>Ln(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>zs(t,2,8,n),stringify:t=>Yo(t,8,"0o")},vd={identify:Ln,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>zs(t,0,10,n),stringify:jo.stringifyNumber},kd={identify:t=>Ln(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>zs(t,2,16,n),stringify:t=>Yo(t,16,"0x")};Cn.int=vd;Cn.intHex=kd;Cn.intOct=bd});var Go=S(Ho=>{"use strict";var Ed=Ve(),Ad=Tn(),_d=We(),Od=It(),Id=Ws(),Zs=Qs(),ei=Xs(),Td=[Ed.map,_d.seq,Od.string,Ad.nullTag,Id.boolTag,ei.intOct,ei.int,ei.intHex,Zs.floatNaN,Zs.floatExp,Zs.float];Ho.schema=Td});var Jo=S(Wo=>{"use strict";var Nd=$(),Ld=Ve(),Cd=We();function Vo(t){return typeof t=="bigint"||Number.isInteger(t)}var Pn=({value:t})=>JSON.stringify(t),Pd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Pn},{identify:t=>t==null,createNode:()=>new Nd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Pn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Pn},{identify:Vo,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Vo(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Pn}],Md={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},$d=[Ld.map,Cd.seq].concat(Pd,Md);Wo.schema=$d});var ni=S(Qo=>{"use strict";var Tt=he("buffer"),ti=$(),Dd=kt(),qd={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Tt.Buffer=="function")return Tt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i<n.length;++i)s[i]=n.charCodeAt(i);return s}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},s,i,r){if(!n)return"";let o=n,a;if(typeof Tt.Buffer=="function")a=o instanceof Tt.Buffer?o.toString("base64"):Tt.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=ti.Scalar.BLOCK_LITERAL),e!==ti.Scalar.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(a.length/l),f=new Array(c);for(let u=0,d=0;u<c;++u,d+=l)f[u]=a.substr(d,l);a=f.join(e===ti.Scalar.BLOCK_LITERAL?`
58
- `:" ")}return Dd.stringifyString({comment:t,type:e,value:a},s,i,r)}};Qo.binary=qd});var Dn=S($n=>{"use strict";var Mn=I(),si=ve(),Rd=$(),Kd=Ae();function zo(t,e){if(Mn.isSeq(t))for(let n=0;n<t.items.length;++n){let s=t.items[n];if(!Mn.isPair(s)){if(Mn.isMap(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let i=s.items[0]||new si.Pair(new Rd.Scalar(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
53
+ ${i}${h}`}else return`${d}${o}${u.join(" ")}${o}${h}`}function Tn({indent:t,options:{commentString:e}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=In.indentComment(e(s),t);n.push(r.trimStart())}}To.stringifyCollection=Vf});var Ee=w(Js=>{"use strict";var Qf=Vs(),zf=Hs(),Xf=mn(),ke=I(),Nn=ve(),Zf=$();function It(t,e){let n=ke.isScalar(e)?e.value:e;for(let s of t)if(ke.isPair(s)&&(s.key===e||s.key===n||ke.isScalar(s.key)&&s.key.value===n))return s}var Ws=class extends Xf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ke.MAP,e),this.items=[]}static from(e,n,s){let{keepUndefined:i,replacer:r}=s,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(n,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||i)&&o.items.push(Nn.createPair(l,c,s))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let s;ke.isPair(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new Nn.Pair(e,e?.value):s=new Nn.Pair(e.key,e.value);let i=It(this.items,s.key),r=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);ke.isScalar(i.value)&&Zf.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 n=It(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=It(this.items,e)?.value;return(!n&&ke.isScalar(i)?i.value:i)??void 0}has(e){return!!It(this.items,e)}set(e,n){this.add(new Nn.Pair(e,n),!0)}toJSON(e,n,s){let i=s?new s:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let r of this.items)zf.addPairToJSMap(n,i,r);return i}toString(e,n,s){if(!e)return JSON.stringify(this);for(let i of this.items)if(!ke.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})),Qf.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:n})}};Js.YAMLMap=Ws;Js.findPair=It});var Je=w(Lo=>{"use strict";var ed=I(),No=Ee(),td={collection:"map",default:!0,nodeClass:No.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ed.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>No.YAMLMap.from(t,e,n)};Lo.map=td});var Ae=w(Co=>{"use strict";var nd=St(),sd=Vs(),id=mn(),Cn=I(),rd=$(),od=ye(),Qs=class extends id.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Cn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Ln(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let s=Ln(e);if(typeof s!="number")return;let i=this.items[s];return!n&&Cn.isScalar(i)?i.value:i}has(e){let n=Ln(e);return typeof n=="number"&&n<this.items.length}set(e,n){let s=Ln(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[s];Cn.isScalar(i)&&rd.isScalarValue(n)?i.value=n:this.items[s]=n}toJSON(e,n){let s=[];n?.onCreate&&n.onCreate(s);let i=0;for(let r of this.items)s.push(od.toJS(r,String(i++),n));return s}toString(e,n,s){return e?sd.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(e,n,s){let{replacer:i}=s,r=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof i=="function"){let l=n instanceof Set?a:String(o++);a=i.call(n,l,a)}r.items.push(nd.createNode(a,void 0,s))}}return r}};function Ln(t){let e=Cn.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Co.YAMLSeq=Qs});var Qe=w(Mo=>{"use strict";var ad=I(),Po=Ae(),ld={collection:"seq",default:!0,nodeClass:Po.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ad.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Po.YAMLSeq.from(t,e,n)};Mo.seq=ld});var Tt=w($o=>{"use strict";var cd=Et(),ud={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,s){return e=Object.assign({actualString:!0},e),cd.stringifyString(t,e,n,s)}};$o.string=ud});var Pn=w(Ro=>{"use strict";var Do=$(),qo={identify:t=>t==null,createNode:()=>new Do.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Do.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&qo.test.test(t)?t:e.options.nullStr};Ro.nullTag=qo});var zs=w(Bo=>{"use strict";var fd=$(),Ko={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new fd.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Ko.test.test(t)){let s=t[0]==="t"||t[0]==="T";if(e===s)return t}return e?n.options.trueStr:n.options.falseStr}};Bo.boolTag=Ko});var ze=w(xo=>{"use strict";function dd({format:t,minFractionDigits:e,tag:n,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(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}xo.stringifyNumber=dd});var Zs=w(Mn=>{"use strict";var pd=$(),Xs=ze(),hd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Xs.stringifyNumber},md={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Xs.stringifyNumber(t)}},gd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new pd.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Xs.stringifyNumber};Mn.float=gd;Mn.floatExp=md;Mn.floatNaN=hd});var ti=w(Dn=>{"use strict";var Fo=ze(),$n=t=>typeof t=="bigint"||Number.isInteger(t),ei=(t,e,n,{intAsBigInt:s})=>s?BigInt(t):parseInt(t.substring(e),n);function Uo(t,e,n){let{value:s}=t;return $n(s)&&s>=0?n+s.toString(e):Fo.stringifyNumber(t)}var yd={identify:t=>$n(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>ei(t,2,8,n),stringify:t=>Uo(t,8,"0o")},wd={identify:$n,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>ei(t,0,10,n),stringify:Fo.stringifyNumber},Sd={identify:t=>$n(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>ei(t,2,16,n),stringify:t=>Uo(t,16,"0x")};Dn.int=wd;Dn.intHex=Sd;Dn.intOct=yd});var Yo=w(jo=>{"use strict";var bd=Je(),vd=Pn(),kd=Qe(),Ed=Tt(),Ad=zs(),ni=Zs(),si=ti(),_d=[bd.map,kd.seq,Ed.string,vd.nullTag,Ad.boolTag,si.intOct,si.int,si.intHex,ni.floatNaN,ni.floatExp,ni.float];jo.schema=_d});var Vo=w(Go=>{"use strict";var Od=$(),Id=Je(),Td=Qe();function Ho(t){return typeof t=="bigint"||Number.isInteger(t)}var qn=({value:t})=>JSON.stringify(t),Nd=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:qn},{identify:t=>t==null,createNode:()=>new Od.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:qn},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:qn},{identify:Ho,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ho(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:qn}],Ld={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Cd=[Id.map,Td.seq].concat(Nd,Ld);Go.schema=Cd});var ri=w(Wo=>{"use strict";var Nt=ge("buffer"),ii=$(),Pd=Et(),Md={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Nt.Buffer=="function")return Nt.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i<n.length;++i)s[i]=n.charCodeAt(i);return s}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},s,i,r){if(!n)return"";let o=n,a;if(typeof Nt.Buffer=="function")a=o instanceof Nt.Buffer?o.toString("base64"):Nt.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=ii.Scalar.BLOCK_LITERAL),e!==ii.Scalar.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(a.length/l),f=new Array(c);for(let u=0,d=0;u<c;++u,d+=l)f[u]=a.substr(d,l);a=f.join(e===ii.Scalar.BLOCK_LITERAL?`
54
+ `:" ")}return Pd.stringifyString({comment:t,type:e,value:a},s,i,r)}};Wo.binary=Md});var Bn=w(Kn=>{"use strict";var Rn=I(),oi=ve(),$d=$(),Dd=Ae();function Jo(t,e){if(Rn.isSeq(t))for(let n=0;n<t.items.length;++n){let s=t.items[n];if(!Rn.isPair(s)){if(Rn.isMap(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let i=s.items[0]||new oi.Pair(new $d.Scalar(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
59
55
  ${i.key.commentBefore}`:s.commentBefore),s.comment){let r=i.value??i.key;r.comment=r.comment?`${s.comment}
60
- ${r.comment}`:s.comment}s=i}t.items[n]=Mn.isPair(s)?s:new si.Pair(s)}}else e("Expected a sequence for this tag");return t}function Xo(t,e,n){let{replacer:s}=n,i=new Kd.YAMLSeq(t);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(si.createPair(a,l,n))}return i}var Bd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:zo,createNode:Xo};$n.createPairs=Xo;$n.pairs=Bd;$n.resolvePairs=zo});var oi=S(ri=>{"use strict";var Zo=I(),ii=ye(),Nt=Ee(),xd=Ae(),ea=Dn(),Me=class t extends xd.YAMLSeq{constructor(){super(),this.add=Nt.YAMLMap.prototype.add.bind(this),this.delete=Nt.YAMLMap.prototype.delete.bind(this),this.get=Nt.YAMLMap.prototype.get.bind(this),this.has=Nt.YAMLMap.prototype.has.bind(this),this.set=Nt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let s=new Map;n?.onCreate&&n.onCreate(s);for(let i of this.items){let r,o;if(Zo.isPair(i)?(r=ii.toJS(i.key,"",n),o=ii.toJS(i.value,r,n)):r=ii.toJS(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(e,n,s){let i=ea.createPairs(e,n,s),r=new this;return r.items=i.items,r}};Me.tag="tag:yaml.org,2002:omap";var Fd={collection:"seq",identify:t=>t instanceof Map,nodeClass:Me,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=ea.resolvePairs(t,e),s=[];for(let{key:i}of n.items)Zo.isScalar(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Me,n)},createNode:(t,e,n)=>Me.from(t,e,n)};ri.YAMLOMap=Me;ri.omap=Fd});var ra=S(ai=>{"use strict";var ta=$();function na({value:t,source:e},n){return e&&(t?sa:ia).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var sa={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ta.Scalar(!0),stringify:na},ia={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ta.Scalar(!1),stringify:na};ai.falseTag=ia;ai.trueTag=sa});var oa=S(qn=>{"use strict";var Ud=$(),li=Je(),jd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:li.stringifyNumber},Yd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():li.stringifyNumber(t)}},Hd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Ud.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let s=t.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:li.stringifyNumber};qn.float=Hd;qn.floatExp=Yd;qn.floatNaN=jd});var la=S(Ct=>{"use strict";var aa=Je(),Lt=t=>typeof t=="bigint"||Number.isInteger(t);function Rn(t,e,n,{intAsBigInt:s}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),s){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let r=parseInt(t,n);return i==="-"?-1*r:r}function ci(t,e,n){let{value:s}=t;if(Lt(s)){let i=s.toString(e);return s<0?"-"+n+i.substr(1):n+i}return aa.stringifyNumber(t)}var Gd={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Rn(t,2,2,n),stringify:t=>ci(t,2,"0b")},Vd={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Rn(t,1,8,n),stringify:t=>ci(t,8,"0")},Wd={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Rn(t,0,10,n),stringify:aa.stringifyNumber},Jd={identify:Lt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Rn(t,2,16,n),stringify:t=>ci(t,16,"0x")};Ct.int=Wd;Ct.intBin=Gd;Ct.intHex=Jd;Ct.intOct=Vd});var fi=S(ui=>{"use strict";var xn=I(),Kn=ve(),Bn=Ee(),$e=class t extends Bn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;xn.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Kn.Pair(e.key,null):n=new Kn.Pair(e,null),Bn.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let s=Bn.findPair(this.items,e);return!n&&xn.isPair(s)?xn.isScalar(s.key)?s.key.value:s.key:s}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=Bn.findPair(this.items,e);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Kn.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(e,n,s){let{replacer:i}=s,r=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(Kn.createPair(o,null,s));return r}};$e.tag="tag:yaml.org,2002:set";var Qd={collection:"map",identify:t=>t instanceof Set,nodeClass:$e,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>$e.from(t,e,n),resolve(t,e){if(xn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new $e,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ui.YAMLSet=$e;ui.set=Qd});var pi=S(Fn=>{"use strict";var zd=Je();function di(t,e){let n=t[0],s=n==="-"||n==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*r:r}function ca(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return zd.stringifyNumber(t);let s="";e<0&&(s="-",e*=n(-1));let i=n(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 Xd={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>di(t,n),stringify:ca},Zd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>di(t,!1),stringify:ca},ua={identify:t=>t 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(t){let e=t.match(ua.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,s-1,i,r||0,o||0,a||0,l),f=e[8];if(f&&f!=="Z"){let u=di(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Fn.floatTime=Zd;Fn.intTime=Xd;Fn.timestamp=ua});var pa=S(da=>{"use strict";var ep=Ve(),tp=Tn(),np=We(),sp=It(),ip=ni(),fa=ra(),hi=oa(),Un=la(),rp=bn(),op=oi(),ap=Dn(),lp=fi(),mi=pi(),cp=[ep.map,np.seq,sp.string,tp.nullTag,fa.trueTag,fa.falseTag,Un.intBin,Un.intOct,Un.int,Un.intHex,hi.floatNaN,hi.floatExp,hi.float,ip.binary,rp.merge,op.omap,ap.pairs,lp.set,mi.intTime,mi.floatTime,mi.timestamp];da.schema=cp});var Ea=S(Si=>{"use strict";var ya=Ve(),up=Tn(),Sa=We(),fp=It(),dp=Ws(),gi=Qs(),yi=Xs(),pp=Go(),hp=Jo(),wa=ni(),Pt=bn(),ba=oi(),va=Dn(),ha=pa(),ka=fi(),jn=pi(),ma=new Map([["core",pp.schema],["failsafe",[ya.map,Sa.seq,fp.string]],["json",hp.schema],["yaml11",ha.schema],["yaml-1.1",ha.schema]]),ga={binary:wa.binary,bool:dp.boolTag,float:gi.float,floatExp:gi.floatExp,floatNaN:gi.floatNaN,floatTime:jn.floatTime,int:yi.int,intHex:yi.intHex,intOct:yi.intOct,intTime:jn.intTime,map:ya.map,merge:Pt.merge,null:up.nullTag,omap:ba.omap,pairs:va.pairs,seq:Sa.seq,set:ka.set,timestamp:jn.timestamp},mp={"tag:yaml.org,2002:binary":wa.binary,"tag:yaml.org,2002:merge":Pt.merge,"tag:yaml.org,2002:omap":ba.omap,"tag:yaml.org,2002:pairs":va.pairs,"tag:yaml.org,2002:set":ka.set,"tag:yaml.org,2002:timestamp":jn.timestamp};function gp(t,e,n){let s=ma.get(e);if(s&&!t)return n&&!s.includes(Pt.merge)?s.concat(Pt.merge):s.slice();let i=s;if(!i)if(Array.isArray(t))i=[];else{let r=Array.from(ma.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(t))for(let r of t)i=i.concat(r);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(Pt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?ga[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(ga).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Si.coreKnownTags=mp;Si.getTags=gp});var vi=S(Aa=>{"use strict";var wi=I(),yp=Ve(),Sp=We(),wp=It(),Yn=Ea(),bp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,bi=class t{constructor({compat:e,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Yn.getTags(e,"compat"):e?Yn.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?Yn.coreKnownTags:{},this.tags=Yn.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,wi.MAP,{value:yp.map}),Object.defineProperty(this,wi.SCALAR,{value:wp.string}),Object.defineProperty(this,wi.SEQ,{value:Sp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?bp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Aa.Schema=bi});var Oa=S(_a=>{"use strict";var vp=I(),ki=Et(),Mt=wt();function kp(t,e){let n=[],s=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),s=!0):t.directives.docStart&&(s=!0)}s&&n.push("---");let i=ki.createStringifyContext(t,e),{commentString:r}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=r(t.commentBefore);n.unshift(Mt.indentComment(l,""))}let o=!1,a=null;if(t.contents){if(vp.isNode(t.contents)){if(t.contents.spaceBefore&&s&&n.push(""),t.contents.commentBefore){let f=r(t.contents.commentBefore);n.push(Mt.indentComment(f,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=ki.stringify(t.contents,i,()=>a=null,l);a&&(c+=Mt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(ki.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let l=r(t.comment);l.includes(`
61
- `)?(n.push("..."),n.push(Mt.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=t.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Mt.indentComment(r(l),"")))}return n.join(`
56
+ ${r.comment}`:s.comment}s=i}t.items[n]=Rn.isPair(s)?s:new oi.Pair(s)}}else e("Expected a sequence for this tag");return t}function Qo(t,e,n){let{replacer:s}=n,i=new Dd.YAMLSeq(t);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(oi.createPair(a,l,n))}return i}var qd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Jo,createNode:Qo};Kn.createPairs=Qo;Kn.pairs=qd;Kn.resolvePairs=Jo});var ci=w(li=>{"use strict";var zo=I(),ai=ye(),Lt=Ee(),Rd=Ae(),Xo=Bn(),De=class t extends Rd.YAMLSeq{constructor(){super(),this.add=Lt.YAMLMap.prototype.add.bind(this),this.delete=Lt.YAMLMap.prototype.delete.bind(this),this.get=Lt.YAMLMap.prototype.get.bind(this),this.has=Lt.YAMLMap.prototype.has.bind(this),this.set=Lt.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let s=new Map;n?.onCreate&&n.onCreate(s);for(let i of this.items){let r,o;if(zo.isPair(i)?(r=ai.toJS(i.key,"",n),o=ai.toJS(i.value,r,n)):r=ai.toJS(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(e,n,s){let i=Xo.createPairs(e,n,s),r=new this;return r.items=i.items,r}};De.tag="tag:yaml.org,2002:omap";var Kd={collection:"seq",identify:t=>t instanceof Map,nodeClass:De,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=Xo.resolvePairs(t,e),s=[];for(let{key:i}of n.items)zo.isScalar(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new De,n)},createNode:(t,e,n)=>De.from(t,e,n)};li.YAMLOMap=De;li.omap=Kd});var sa=w(ui=>{"use strict";var Zo=$();function ea({value:t,source:e},n){return e&&(t?ta:na).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var ta={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Zo.Scalar(!0),stringify:ea},na={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Zo.Scalar(!1),stringify:ea};ui.falseTag=na;ui.trueTag=ta});var ia=w(xn=>{"use strict";var Bd=$(),fi=ze(),xd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fi.stringifyNumber},Fd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():fi.stringifyNumber(t)}},Ud={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Bd.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let s=t.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:fi.stringifyNumber};xn.float=Ud;xn.floatExp=Fd;xn.floatNaN=xd});var oa=w(Pt=>{"use strict";var ra=ze(),Ct=t=>typeof t=="bigint"||Number.isInteger(t);function Fn(t,e,n,{intAsBigInt:s}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),s){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let r=parseInt(t,n);return i==="-"?-1*r:r}function di(t,e,n){let{value:s}=t;if(Ct(s)){let i=s.toString(e);return s<0?"-"+n+i.substr(1):n+i}return ra.stringifyNumber(t)}var jd={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Fn(t,2,2,n),stringify:t=>di(t,2,"0b")},Yd={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Fn(t,1,8,n),stringify:t=>di(t,8,"0")},Hd={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Fn(t,0,10,n),stringify:ra.stringifyNumber},Gd={identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Fn(t,2,16,n),stringify:t=>di(t,16,"0x")};Pt.int=Hd;Pt.intBin=jd;Pt.intHex=Gd;Pt.intOct=Yd});var hi=w(pi=>{"use strict";var Yn=I(),Un=ve(),jn=Ee(),qe=class t extends jn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;Yn.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new Un.Pair(e.key,null):n=new Un.Pair(e,null),jn.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let s=jn.findPair(this.items,e);return!n&&Yn.isPair(s)?Yn.isScalar(s.key)?s.key.value:s.key:s}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=jn.findPair(this.items,e);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Un.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(e,n,s){let{replacer:i}=s,r=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(Un.createPair(o,null,s));return r}};qe.tag="tag:yaml.org,2002:set";var Vd={collection:"map",identify:t=>t instanceof Set,nodeClass:qe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>qe.from(t,e,n),resolve(t,e){if(Yn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new qe,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};pi.YAMLSet=qe;pi.set=Vd});var gi=w(Hn=>{"use strict";var Wd=ze();function mi(t,e){let n=t[0],s=n==="-"||n==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*r:r}function aa(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Wd.stringifyNumber(t);let s="";e<0&&(s="-",e*=n(-1));let i=n(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 Jd={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>mi(t,n),stringify:aa},Qd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>mi(t,!1),stringify:aa},la={identify:t=>t 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(t){let e=t.match(la.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,s-1,i,r||0,o||0,a||0,l),f=e[8];if(f&&f!=="Z"){let u=mi(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Hn.floatTime=Qd;Hn.intTime=Jd;Hn.timestamp=la});var fa=w(ua=>{"use strict";var zd=Je(),Xd=Pn(),Zd=Qe(),ep=Tt(),tp=ri(),ca=sa(),yi=ia(),Gn=oa(),np=An(),sp=ci(),ip=Bn(),rp=hi(),wi=gi(),op=[zd.map,Zd.seq,ep.string,Xd.nullTag,ca.trueTag,ca.falseTag,Gn.intBin,Gn.intOct,Gn.int,Gn.intHex,yi.floatNaN,yi.floatExp,yi.float,tp.binary,np.merge,sp.omap,ip.pairs,rp.set,wi.intTime,wi.floatTime,wi.timestamp];ua.schema=op});var va=w(vi=>{"use strict";var ma=Je(),ap=Pn(),ga=Qe(),lp=Tt(),cp=zs(),Si=Zs(),bi=ti(),up=Yo(),fp=Vo(),ya=ri(),Mt=An(),wa=ci(),Sa=Bn(),da=fa(),ba=hi(),Vn=gi(),pa=new Map([["core",up.schema],["failsafe",[ma.map,ga.seq,lp.string]],["json",fp.schema],["yaml11",da.schema],["yaml-1.1",da.schema]]),ha={binary:ya.binary,bool:cp.boolTag,float:Si.float,floatExp:Si.floatExp,floatNaN:Si.floatNaN,floatTime:Vn.floatTime,int:bi.int,intHex:bi.intHex,intOct:bi.intOct,intTime:Vn.intTime,map:ma.map,merge:Mt.merge,null:ap.nullTag,omap:wa.omap,pairs:Sa.pairs,seq:ga.seq,set:ba.set,timestamp:Vn.timestamp},dp={"tag:yaml.org,2002:binary":ya.binary,"tag:yaml.org,2002:merge":Mt.merge,"tag:yaml.org,2002:omap":wa.omap,"tag:yaml.org,2002:pairs":Sa.pairs,"tag:yaml.org,2002:set":ba.set,"tag:yaml.org,2002:timestamp":Vn.timestamp};function pp(t,e,n){let s=pa.get(e);if(s&&!t)return n&&!s.includes(Mt.merge)?s.concat(Mt.merge):s.slice();let i=s;if(!i)if(Array.isArray(t))i=[];else{let r=Array.from(pa.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(t))for(let r of t)i=i.concat(r);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(Mt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?ha[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(ha).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}vi.coreKnownTags=dp;vi.getTags=pp});var Ai=w(ka=>{"use strict";var ki=I(),hp=Je(),mp=Qe(),gp=Tt(),Wn=va(),yp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Ei=class t{constructor({compat:e,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Wn.getTags(e,"compat"):e?Wn.getTags(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?Wn.coreKnownTags:{},this.tags=Wn.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,ki.MAP,{value:hp.map}),Object.defineProperty(this,ki.SCALAR,{value:gp.string}),Object.defineProperty(this,ki.SEQ,{value:mp.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?yp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};ka.Schema=Ei});var Aa=w(Ea=>{"use strict";var wp=I(),_i=At(),$t=bt();function Sp(t,e){let n=[],s=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),s=!0):t.directives.docStart&&(s=!0)}s&&n.push("---");let i=_i.createStringifyContext(t,e),{commentString:r}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=r(t.commentBefore);n.unshift($t.indentComment(l,""))}let o=!1,a=null;if(t.contents){if(wp.isNode(t.contents)){if(t.contents.spaceBefore&&s&&n.push(""),t.contents.commentBefore){let f=r(t.contents.commentBefore);n.push($t.indentComment(f,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>o=!0,c=_i.stringify(t.contents,i,()=>a=null,l);a&&(c+=$t.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(_i.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let l=r(t.comment);l.includes(`
57
+ `)?(n.push("..."),n.push($t.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=t.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push($t.indentComment(r(l),"")))}return n.join(`
62
58
  `)+`
63
- `}_a.stringifyDocument=kp});var $t=S(Ia=>{"use strict";var Ep=yt(),Qe=fn(),J=I(),Ap=ve(),_p=ye(),Op=vi(),Ip=Oa(),Ei=an(),Tp=Is(),Np=St(),Ai=Os(),_i=class t{constructor(e,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,J.NODE_TYPE,{value:J.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=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 Ai.Directives({version:o}),this.setSchema(o,s),this.contents=e===void 0?null:this.createNode(e,i,s)}clone(){let e=Object.create(t.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){ze(this.contents)&&this.contents.add(e)}addIn(e,n){ze(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let s=Ei.anchorNames(this);e.anchor=!n||s.has(n)?Ei.findNewAnchor(n||"a",s):n}return new Ep.Alias(e.anchor)}createNode(e,n,s){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let m=v=>typeof v=="number"||v instanceof String||v instanceof Number,w=n.filter(m).map(String);w.length>0&&(n=n.concat(w)),i=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=s??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=Ei.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:h},p=Np.createNode(e,f,y);return a&&J.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,s={}){let i=this.createNode(e,null,s),r=this.createNode(n,null,s);return new Ap.Pair(i,r)}delete(e){return ze(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Qe.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):ze(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return J.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Qe.isEmptyPath(e)?!n&&J.isScalar(this.contents)?this.contents.value:this.contents:J.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return J.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Qe.isEmptyPath(e)?this.contents!==void 0:J.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Qe.collectionFromPath(this.schema,[e],n):ze(this.contents)&&this.contents.set(e,n)}setIn(e,n){Qe.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=Qe.collectionFromPath(this.schema,Array.from(e),n):ze(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ai.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 Ai.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(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new Op.Schema(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,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=_p.toJS(this.contents,n??"",a);if(typeof r=="function")for(let{count:c,res:f}of a.anchors.values())r(f,c);return typeof o=="function"?Tp.applyReviver(o,{"":l},"",l):l}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Ip.stringifyDocument(this,e)}};function ze(t){if(J.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Ia.Document=_i});var Rt=S(qt=>{"use strict";var Dt=class extends Error{constructor(e,n,s,i){super(),this.name=e,this.code=s,this.message=i,this.pos=n}},Oi=class extends Dt{constructor(e,n,s){super("YAMLParseError",e,n,s)}},Ii=class extends Dt{constructor(e,n,s){super("YAMLWarning",e,n,s)}},Lp=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,o=t.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=t.substring(e.lineStarts[s-2],e.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
59
+ `}Ea.stringifyDocument=Sp});var Dt=w(_a=>{"use strict";var bp=wt(),Xe=mn(),J=I(),vp=ve(),kp=ye(),Ep=Ai(),Ap=Aa(),Oi=fn(),_p=Ls(),Op=St(),Ii=Ns(),Ti=class t{constructor(e,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,J.NODE_TYPE,{value:J.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=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 Ii.Directives({version:o}),this.setSchema(o,s),this.contents=e===void 0?null:this.createNode(e,i,s)}clone(){let e=Object.create(t.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){Ze(this.contents)&&this.contents.add(e)}addIn(e,n){Ze(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let s=Oi.anchorNames(this);e.anchor=!n||s.has(n)?Oi.findNewAnchor(n||"a",s):n}return new bp.Alias(e.anchor)}createNode(e,n,s){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let m=v=>typeof v=="number"||v instanceof String||v instanceof Number,S=n.filter(m).map(String);S.length>0&&(n=n.concat(S)),i=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=s??{},{onAnchor:u,setAnchors:d,sourceObjects:h}=Oi.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:h},p=Op.createNode(e,f,y);return a&&J.isCollection(p)&&(p.flow=!0),d(),p}createPair(e,n,s={}){let i=this.createNode(e,null,s),r=this.createNode(n,null,s);return new vp.Pair(i,r)}delete(e){return Ze(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Xe.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Ze(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return J.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Xe.isEmptyPath(e)?!n&&J.isScalar(this.contents)?this.contents.value:this.contents:J.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return J.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Xe.isEmptyPath(e)?this.contents!==void 0:J.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Xe.collectionFromPath(this.schema,[e],n):Ze(this.contents)&&this.contents.set(e,n)}setIn(e,n){Xe.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=Xe.collectionFromPath(this.schema,Array.from(e),n):Ze(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ii.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 Ii.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(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new Ep.Schema(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,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=kp.toJS(this.contents,n??"",a);if(typeof r=="function")for(let{count:c,res:f}of a.anchors.values())r(f,c);return typeof o=="function"?_p.applyReviver(o,{"":l},"",l):l}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Ap.stringifyDocument(this,e)}};function Ze(t){if(J.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}_a.Document=Ti});var Kt=w(Rt=>{"use strict";var qt=class extends Error{constructor(e,n,s,i){super(),this.name=e,this.code=s,this.message=i,this.pos=n}},Ni=class extends qt{constructor(e,n,s){super("YAMLParseError",e,n,s)}},Li=class extends qt{constructor(e,n,s){super("YAMLWarning",e,n,s)}},Ip=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,o=t.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=t.substring(e.lineStarts[s-2],e.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
64
60
  `),o=a+o}if(/[^ ]/.test(o)){let a=1,l=n.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);n.message+=`:
65
61
 
66
62
  ${o}
67
63
  ${c}
68
- `}};qt.YAMLError=Dt;qt.YAMLParseError=Oi;qt.YAMLWarning=Ii;qt.prettifyError=Lp});var Kt=S(Ta=>{"use strict";function Cp(t,{flow:e,indicator:n,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,u="",d="",h=!1,y=!1,p=null,m=null,w=null,v=null,A=null,_=null,E=null;for(let k of t)switch(y&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&r(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),p&&(c&&k.type!=="comment"&&k.type!=="newline"&&r(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),k.type){case"space":!e&&(n!=="doc-start"||s?.type!=="flow-collection")&&k.source.includes(" ")&&(p=k),f=!0;break;case"comment":{f||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=k.source.substring(1)||" ";u?u+=d+M:u=M,d="",c=!1;break}case"newline":c?u?u+=k.source:(!_||n!=="seq-item-ind")&&(l=!0):d+=k.source,c=!0,h=!0,(m||w)&&(v=k),f=!0;break;case"anchor":m&&r(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&r(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=k,E??(E=k.offset),c=!1,f=!1,y=!0;break;case"tag":{w&&r(k,"MULTIPLE_TAGS","A node can have at most one tag"),w=k,E??(E=k.offset),c=!1,f=!1,y=!0;break}case n:(m||w)&&r(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),_&&r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),_=k,c=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){A&&r(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),A=k,c=!1,f=!1;break}default:r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),c=!1,f=!1}let O=t[t.length-1],N=O?O.offset+O.source.length:i;return y&&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"),p&&(c&&p.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:A,found:_,spaceBefore:l,comment:u,hasNewline:h,anchor:m,tag:w,newlineAfterProp:v,end:N,start:E??N}}Ta.resolveProps=Cp});var Hn=S(Na=>{"use strict";function Ti(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
69
- `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Ti(e.key)||Ti(e.value))return!0}return!1;default:return!0}}Na.containsNewline=Ti});var Ni=S(La=>{"use strict";var Pp=Hn();function Mp(t,e,n){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===t&&(s.source==="]"||s.source==="}")&&Pp.containsNewline(e)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}La.flowIndentCheck=Mp});var Li=S(Pa=>{"use strict";var Ca=I();function $p(t,e,n){let{uniqueKeys:s}=t.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||Ca.isScalar(r)&&Ca.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,n))}Pa.mapIncludes=$p});var Ka=S(Ra=>{"use strict";var Ma=ve(),Dp=Ee(),$a=Kt(),qp=Hn(),Da=Ni(),Rp=Li(),qa="All mapping items must start at the same column";function Kp({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??Dp.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=s.offset,c=null;for(let f of s.items){let{start:u,key:d,sep:h,value:y}=f,p=$a.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==s.indent&&i(l,"BAD_INDENT",qa)),!p.anchor&&!p.tag&&!h){c=p.end,p.comment&&(a.comment?a.comment+=`
70
- `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||qp.containsNewline(d))&&i(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==s.indent&&i(l,"BAD_INDENT",qa);n.atKey=!0;let w=p.end,v=d?t(n,d,p,i):e(n,w,u,null,p,i);n.schema.compat&&Da.flowIndentCheck(s.indent,d,i),n.atKey=!1,Rp.mapIncludes(n,a.items,v)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let A=$a.resolveProps(h??[],{indicator:"map-value-ind",next:y,offset:v.range[2],onError:i,parentIndent:s.indent,startOnNewline:!d||d.type==="block-scalar"});if(l=A.end,A.found){m&&(y?.type==="block-map"&&!A.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<A.found.offset-1024&&i(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=y?t(n,y,A,i):e(n,l,h,null,A,i);n.schema.compat&&Da.flowIndentCheck(s.indent,y,i),l=_.range[2];let E=new Ma.Pair(v,_);n.options.keepSourceTokens&&(E.srcToken=f),a.items.push(E)}else{m&&i(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),A.comment&&(v.comment?v.comment+=`
71
- `+A.comment:v.comment=A.comment);let _=new Ma.Pair(v);n.options.keepSourceTokens&&(_.srcToken=f),a.items.push(_)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}Ra.resolveBlockMap=Kp});var xa=S(Ba=>{"use strict";var Bp=Ae(),xp=Kt(),Fp=Ni();function Up({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??Bp.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=s.offset,c=null;for(let{start:f,value:u}of s.items){let d=xp.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let h=u?t(n,u,d,i):e(n,d.end,f,null,d,i);n.schema.compat&&Fp.flowIndentCheck(s.indent,u,i),l=h.range[2],a.items.push(h)}return a.range=[s.offset,l,c??l],a}Ba.resolveBlockSeq=Up});var Xe=S(Fa=>{"use strict";function jp(t,e,n,s){let i="";if(t){let r=!1,o="";for(let a of t){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{n&&!r&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=l.substring(1)||" ";i?i+=o+f:i=f,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}}Fa.resolveEnd=jp});var Ha=S(Ya=>{"use strict";var Yp=I(),Hp=ve(),Ua=Ee(),Gp=Ae(),Vp=Xe(),ja=Kt(),Wp=Hn(),Jp=Li(),Ci="Block collections are not allowed within flow collections",Pi=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Qp({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?Ua.YAMLMap:Gp.YAMLSeq),c=new l(n.schema);c.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.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:v,key:A,sep:_,value:E}=w,O=ja.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:A??_?.[0],offset:u,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!_&&!E){m===0&&O.comma?i(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<s.items.length-1&&i(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),O.comment&&(c.comment?c.comment+=`
72
- `+O.comment:c.comment=O.comment),u=O.end;continue}!o&&n.options.strict&&Wp.containsNewline(A)&&i(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)O.comma&&i(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(O.comma||i(O.start,"MISSING_CHAR",`Missing , between ${a} items`),O.comment){let N="";e:for(let k of v)switch(k.type){case"comma":case"space":break;case"comment":N=k.source.substring(1);break e;default:break e}if(N){let k=c.items[c.items.length-1];Yp.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
73
- `+N:k.comment=N,O.comment=O.comment.substring(N.length+1)}}if(!o&&!_&&!O.found){let N=E?t(n,E,O,i):e(n,O.end,_,null,O,i);c.items.push(N),u=N.range[2],Pi(E)&&i(N.range,"BLOCK_IN_FLOW",Ci)}else{n.atKey=!0;let N=O.end,k=A?t(n,A,O,i):e(n,N,v,null,O,i);Pi(A)&&i(k.range,"BLOCK_IN_FLOW",Ci),n.atKey=!1;let M=ja.resolveProps(_??[],{flow:a,indicator:"map-value-ind",next:E,offset:k.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(M.found){if(!o&&!O.found&&n.options.strict){if(_)for(let D of _){if(D===M.found)break;if(D.type==="newline"){i(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<M.found.offset-1024&&i(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?i(E,"MISSING_CHAR",`Missing space after : in ${a}`):i(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let pe=E?t(n,E,M,i):M.found?e(n,M.end,_,null,M,i):null;pe?Pi(E)&&i(pe.range,"BLOCK_IN_FLOW",Ci):M.comment&&(k.comment?k.comment+=`
74
- `+M.comment:k.comment=M.comment);let Ue=new Hp.Pair(k,pe);if(n.options.keepSourceTokens&&(Ue.srcToken=w),o){let D=c;Jp.mapIncludes(n,D.items,k)&&i(N,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(Ue)}else{let D=new Ua.YAMLMap(n.schema);D.flow=!0,D.items.push(Ue);let Kr=(pe??k).range;D.range=[k.range[0],Kr[1],Kr[2]],c.items.push(D)}u=pe?pe.range[2]:M.end}}let d=o?"}":"]",[h,...y]=s.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),w=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",w),h&&h.source.length!==1&&y.unshift(h)}if(y.length>0){let m=Vp.resolveEnd(y,p,n.options.strict,i);m.comment&&(c.comment?c.comment+=`
75
- `+m.comment:c.comment=m.comment),c.range=[s.offset,p,m.offset]}else c.range=[s.offset,p,p];return c}Ya.resolveFlowCollection=Qp});var Va=S(Ga=>{"use strict";var zp=I(),Xp=$(),Zp=Ee(),eh=Ae(),th=Ka(),nh=xa(),sh=Ha();function Mi(t,e,n,s,i,r){let o=n.type==="block-map"?th.resolveBlockMap(t,e,n,s,r):n.type==="block-seq"?nh.resolveBlockSeq(t,e,n,s,r):sh.resolveFlowCollection(t,e,n,s,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function ih(t,e,n,s,i){let r=s.tag,o=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=s,y=d&&r?d.offset>r.offset?d:r:d??r;y&&(!h||h.offset<y.offset)&&i(y,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===Zp.YAMLMap.tagName&&a==="map"||o===eh.YAMLSeq.tagName&&a==="seq")return Mi(t,e,n,i,o);let l=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!l){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?i(r,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Mi(t,e,n,i,o)}let c=Mi(t,e,n,i,o,l),f=l.resolve?.(c,d=>i(r,"TAG_RESOLVE_FAILED",d),e.options)??c,u=zp.isNode(f)?f:new Xp.Scalar(f);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}Ga.composeCollection=ih});var Di=S(Wa=>{"use strict";var $i=$();function rh(t,e,n){let s=e.offset,i=oh(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?$i.Scalar.BLOCK_FOLDED:$i.Scalar.BLOCK_LITERAL,o=e.source?ah(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=i.chomp==="+"&&o.length>0?`
76
- `.repeat(Math.max(1,o.length-1)):"",m=s+i.length;return e.source&&(m+=e.source.length),{value:p,type:r,comment:i.comment,range:[s,m,m]}}let l=e.indent+i.indent,c=e.offset+i.length,f=0;for(let p=0;p<a;++p){let[m,w]=o[p];if(w===""||w==="\r")i.indent===0&&m.length>l&&(l=m.length);else{m.length<l&&n(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),f=p,l===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=m.length+w.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>l&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(l)+`
77
- `;for(let p=f;p<a;++p){let[m,w]=o[p];c+=m.length+w.length+1;let v=w[w.length-1]==="\r";if(v&&(w=w.slice(0,-1)),w&&m.length<l){let _=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-w.length-(v?2:1),"BAD_INDENT",_),m=""}r===$i.Scalar.BLOCK_LITERAL?(u+=d+m.slice(l)+w,d=`
78
- `):m.length>l||w[0]===" "?(d===" "?d=`
64
+ `}};Rt.YAMLError=qt;Rt.YAMLParseError=Ni;Rt.YAMLWarning=Li;Rt.prettifyError=Ip});var Bt=w(Oa=>{"use strict";function Tp(t,{flow:e,indicator:n,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,u="",d="",h=!1,y=!1,p=null,m=null,S=null,v=null,A=null,_=null,E=null;for(let k of t)switch(y&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&r(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),p&&(c&&k.type!=="comment"&&k.type!=="newline"&&r(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),p=null),k.type){case"space":!e&&(n!=="doc-start"||s?.type!=="flow-collection")&&k.source.includes(" ")&&(p=k),f=!0;break;case"comment":{f||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=k.source.substring(1)||" ";u?u+=d+M:u=M,d="",c=!1;break}case"newline":c?u?u+=k.source:(!_||n!=="seq-item-ind")&&(l=!0):d+=k.source,c=!0,h=!0,(m||S)&&(v=k),f=!0;break;case"anchor":m&&r(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&r(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),m=k,E??(E=k.offset),c=!1,f=!1,y=!0;break;case"tag":{S&&r(k,"MULTIPLE_TAGS","A node can have at most one tag"),S=k,E??(E=k.offset),c=!1,f=!1,y=!0;break}case n:(m||S)&&r(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),_&&r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),_=k,c=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(e){A&&r(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),A=k,c=!1,f=!1;break}default:r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),c=!1,f=!1}let O=t[t.length-1],T=O?O.offset+O.source.length:i;return y&&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"),p&&(c&&p.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(p,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:A,found:_,spaceBefore:l,comment:u,hasNewline:h,anchor:m,tag:S,newlineAfterProp:v,end:T,start:E??T}}Oa.resolveProps=Tp});var Jn=w(Ia=>{"use strict";function Ci(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
65
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Ci(e.key)||Ci(e.value))return!0}return!1;default:return!0}}Ia.containsNewline=Ci});var Pi=w(Ta=>{"use strict";var Np=Jn();function Lp(t,e,n){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===t&&(s.source==="]"||s.source==="}")&&Np.containsNewline(e)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Ta.flowIndentCheck=Lp});var Mi=w(La=>{"use strict";var Na=I();function Cp(t,e,n){let{uniqueKeys:s}=t.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||Na.isScalar(r)&&Na.isScalar(o)&&r.value===o.value;return e.some(r=>i(r.key,n))}La.mapIncludes=Cp});var qa=w(Da=>{"use strict";var Ca=ve(),Pp=Ee(),Pa=Bt(),Mp=Jn(),Ma=Pi(),$p=Mi(),$a="All mapping items must start at the same column";function Dp({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??Pp.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=s.offset,c=null;for(let f of s.items){let{start:u,key:d,sep:h,value:y}=f,p=Pa.resolveProps(u,{indicator:"explicit-key-ind",next:d??h?.[0],offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0}),m=!p.found;if(m){if(d&&(d.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==s.indent&&i(l,"BAD_INDENT",$a)),!p.anchor&&!p.tag&&!h){c=p.end,p.comment&&(a.comment?a.comment+=`
66
+ `+p.comment:a.comment=p.comment);continue}(p.newlineAfterProp||Mp.containsNewline(d))&&i(d??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==s.indent&&i(l,"BAD_INDENT",$a);n.atKey=!0;let S=p.end,v=d?t(n,d,p,i):e(n,S,u,null,p,i);n.schema.compat&&Ma.flowIndentCheck(s.indent,d,i),n.atKey=!1,$p.mapIncludes(n,a.items,v)&&i(S,"DUPLICATE_KEY","Map keys must be unique");let A=Pa.resolveProps(h??[],{indicator:"map-value-ind",next:y,offset:v.range[2],onError:i,parentIndent:s.indent,startOnNewline:!d||d.type==="block-scalar"});if(l=A.end,A.found){m&&(y?.type==="block-map"&&!A.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&p.start<A.found.offset-1024&&i(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=y?t(n,y,A,i):e(n,l,h,null,A,i);n.schema.compat&&Ma.flowIndentCheck(s.indent,y,i),l=_.range[2];let E=new Ca.Pair(v,_);n.options.keepSourceTokens&&(E.srcToken=f),a.items.push(E)}else{m&&i(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),A.comment&&(v.comment?v.comment+=`
67
+ `+A.comment:v.comment=A.comment);let _=new Ca.Pair(v);n.options.keepSourceTokens&&(_.srcToken=f),a.items.push(_)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}Da.resolveBlockMap=Dp});var Ka=w(Ra=>{"use strict";var qp=Ae(),Rp=Bt(),Kp=Pi();function Bp({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=r?.nodeClass??qp.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=s.offset,c=null;for(let{start:f,value:u}of s.items){let d=Rp.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||u)u?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let h=u?t(n,u,d,i):e(n,d.end,f,null,d,i);n.schema.compat&&Kp.flowIndentCheck(s.indent,u,i),l=h.range[2],a.items.push(h)}return a.range=[s.offset,l,c??l],a}Ra.resolveBlockSeq=Bp});var et=w(Ba=>{"use strict";function xp(t,e,n,s){let i="";if(t){let r=!1,o="";for(let a of t){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{n&&!r&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=l.substring(1)||" ";i?i+=o+f:i=f,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}}Ba.resolveEnd=xp});var ja=w(Ua=>{"use strict";var Fp=I(),Up=ve(),xa=Ee(),jp=Ae(),Yp=et(),Fa=Bt(),Hp=Jn(),Gp=Mi(),$i="Block collections are not allowed within flow collections",Di=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Vp({composeNode:t,composeEmptyNode:e},n,s,i,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?xa.YAMLMap:jp.YAMLSeq),c=new l(n.schema);c.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=s.offset+s.start.source.length;for(let m=0;m<s.items.length;++m){let S=s.items[m],{start:v,key:A,sep:_,value:E}=S,O=Fa.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:A??_?.[0],offset:u,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!_&&!E){m===0&&O.comma?i(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):m<s.items.length-1&&i(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),O.comment&&(c.comment?c.comment+=`
68
+ `+O.comment:c.comment=O.comment),u=O.end;continue}!o&&n.options.strict&&Hp.containsNewline(A)&&i(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(m===0)O.comma&&i(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(O.comma||i(O.start,"MISSING_CHAR",`Missing , between ${a} items`),O.comment){let T="";e:for(let k of v)switch(k.type){case"comma":case"space":break;case"comment":T=k.source.substring(1);break e;default:break e}if(T){let k=c.items[c.items.length-1];Fp.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
69
+ `+T:k.comment=T,O.comment=O.comment.substring(T.length+1)}}if(!o&&!_&&!O.found){let T=E?t(n,E,O,i):e(n,O.end,_,null,O,i);c.items.push(T),u=T.range[2],Di(E)&&i(T.range,"BLOCK_IN_FLOW",$i)}else{n.atKey=!0;let T=O.end,k=A?t(n,A,O,i):e(n,T,v,null,O,i);Di(A)&&i(k.range,"BLOCK_IN_FLOW",$i),n.atKey=!1;let M=Fa.resolveProps(_??[],{flow:a,indicator:"map-value-ind",next:E,offset:k.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(M.found){if(!o&&!O.found&&n.options.strict){if(_)for(let D of _){if(D===M.found)break;if(D.type==="newline"){i(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<M.found.offset-1024&&i(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else E&&("source"in E&&E.source?.[0]===":"?i(E,"MISSING_CHAR",`Missing space after : in ${a}`):i(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let me=E?t(n,E,M,i):M.found?e(n,M.end,_,null,M,i):null;me?Di(E)&&i(me.range,"BLOCK_IN_FLOW",$i):M.comment&&(k.comment?k.comment+=`
70
+ `+M.comment:k.comment=M.comment);let Ye=new Up.Pair(k,me);if(n.options.keepSourceTokens&&(Ye.srcToken=S),o){let D=c;Gp.mapIncludes(n,D.items,k)&&i(T,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(Ye)}else{let D=new xa.YAMLMap(n.schema);D.flow=!0,D.items.push(Ye);let jr=(me??k).range;D.range=[k.range[0],jr[1],jr[2]],c.items.push(D)}u=me?me.range[2]:M.end}}let d=o?"}":"]",[h,...y]=s.end,p=u;if(h?.source===d)p=h.offset+h.source.length;else{let m=a[0].toUpperCase()+a.substring(1),S=f?`${m} must end with a ${d}`:`${m} in block collection must be sufficiently indented and end with a ${d}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",S),h&&h.source.length!==1&&y.unshift(h)}if(y.length>0){let m=Yp.resolveEnd(y,p,n.options.strict,i);m.comment&&(c.comment?c.comment+=`
71
+ `+m.comment:c.comment=m.comment),c.range=[s.offset,p,m.offset]}else c.range=[s.offset,p,p];return c}Ua.resolveFlowCollection=Vp});var Ha=w(Ya=>{"use strict";var Wp=I(),Jp=$(),Qp=Ee(),zp=Ae(),Xp=qa(),Zp=Ka(),eh=ja();function qi(t,e,n,s,i,r){let o=n.type==="block-map"?Xp.resolveBlockMap(t,e,n,s,r):n.type==="block-seq"?Zp.resolveBlockSeq(t,e,n,s,r):eh.resolveFlowCollection(t,e,n,s,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function th(t,e,n,s,i){let r=s.tag,o=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:h}=s,y=d&&r?d.offset>r.offset?d:r:d??r;y&&(!h||h.offset<y.offset)&&i(y,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===Qp.YAMLMap.tagName&&a==="map"||o===zp.YAMLSeq.tagName&&a==="seq")return qi(t,e,n,i,o);let l=e.schema.tags.find(d=>d.tag===o&&d.collection===a);if(!l){let d=e.schema.knownTags[o];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?i(r,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),qi(t,e,n,i,o)}let c=qi(t,e,n,i,o,l),f=l.resolve?.(c,d=>i(r,"TAG_RESOLVE_FAILED",d),e.options)??c,u=Wp.isNode(f)?f:new Jp.Scalar(f);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}Ya.composeCollection=th});var Ki=w(Ga=>{"use strict";var Ri=$();function nh(t,e,n){let s=e.offset,i=sh(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?Ri.Scalar.BLOCK_FOLDED:Ri.Scalar.BLOCK_LITERAL,o=e.source?ih(e.source):[],a=o.length;for(let p=o.length-1;p>=0;--p){let m=o[p][1];if(m===""||m==="\r")a=p;else break}if(a===0){let p=i.chomp==="+"&&o.length>0?`
72
+ `.repeat(Math.max(1,o.length-1)):"",m=s+i.length;return e.source&&(m+=e.source.length),{value:p,type:r,comment:i.comment,range:[s,m,m]}}let l=e.indent+i.indent,c=e.offset+i.length,f=0;for(let p=0;p<a;++p){let[m,S]=o[p];if(S===""||S==="\r")i.indent===0&&m.length>l&&(l=m.length);else{m.length<l&&n(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),f=p,l===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=m.length+S.length+1}for(let p=o.length-1;p>=a;--p)o[p][0].length>l&&(a=p+1);let u="",d="",h=!1;for(let p=0;p<f;++p)u+=o[p][0].slice(l)+`
73
+ `;for(let p=f;p<a;++p){let[m,S]=o[p];c+=m.length+S.length+1;let v=S[S.length-1]==="\r";if(v&&(S=S.slice(0,-1)),S&&m.length<l){let _=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-S.length-(v?2:1),"BAD_INDENT",_),m=""}r===Ri.Scalar.BLOCK_LITERAL?(u+=d+m.slice(l)+S,d=`
74
+ `):m.length>l||S[0]===" "?(d===" "?d=`
79
75
  `:!h&&d===`
80
76
  `&&(d=`
81
77
 
82
- `),u+=d+m.slice(l)+w,d=`
83
- `,h=!0):w===""?d===`
78
+ `),u+=d+m.slice(l)+S,d=`
79
+ `,h=!0):S===""?d===`
84
80
  `?u+=`
85
81
  `:d=`
86
- `:(u+=d+w,d=" ",h=!1)}switch(i.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)u+=`
82
+ `:(u+=d+S,d=" ",h=!1)}switch(i.chomp){case"-":break;case"+":for(let p=a;p<o.length;++p)u+=`
87
83
  `+o[p][0].slice(l);u[u.length-1]!==`
88
84
  `&&(u+=`
89
85
  `);break;default:u+=`
90
- `}let y=s+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[s,y,y]}}function oh({offset:t,props:e},n,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 d=1;d<i.length;++d){let h=i[d];if(!a&&(h==="-"||h==="+"))a=h;else{let y=Number(h);!o&&y?o=y:l===-1&&(l=t+d)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,f="",u=i.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":c=!0;case"newline":u+=h.source.length;break;case"comment":n&&!c&&s(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":s(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let y=`Unexpected token in block scalar header: ${h.type}`;s(h,"UNEXPECTED_TOKEN",y);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:r,indent:o,chomp:a,comment:f,length:u}}function ah(t){let e=t.split(/\n( *)/),n=e[0],s=n.match(/^( *)/),r=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}Wa.resolveBlockScalar=rh});var Ri=S(Qa=>{"use strict";var qi=$(),lh=Xe();function ch(t,e,n){let{offset:s,type:i,source:r,end:o}=t,a,l,c=(d,h,y)=>n(s+d,h,y);switch(i){case"scalar":a=qi.Scalar.PLAIN,l=uh(r,c);break;case"single-quoted-scalar":a=qi.Scalar.QUOTE_SINGLE,l=fh(r,c);break;case"double-quoted-scalar":a=qi.Scalar.QUOTE_DOUBLE,l=dh(r,c);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let f=s+r.length,u=lh.resolveEnd(o,f,e,n);return{value:l,type:a,comment:u.comment,range:[s,f,u.offset]}}function uh(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Ja(t)}function fh(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Ja(t.slice(1,-1)).replace(/''/g,"'")}function Ja(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
86
+ `}let y=s+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[s,y,y]}}function sh({offset:t,props:e},n,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 d=1;d<i.length;++d){let h=i[d];if(!a&&(h==="-"||h==="+"))a=h;else{let y=Number(h);!o&&y?o=y:l===-1&&(l=t+d)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,f="",u=i.length;for(let d=1;d<e.length;++d){let h=e[d];switch(h.type){case"space":c=!0;case"newline":u+=h.source.length;break;case"comment":n&&!c&&s(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=h.source.length,f=h.source.substring(1);break;case"error":s(h,"UNEXPECTED_TOKEN",h.message),u+=h.source.length;break;default:{let y=`Unexpected token in block scalar header: ${h.type}`;s(h,"UNEXPECTED_TOKEN",y);let p=h.source;p&&typeof p=="string"&&(u+=p.length)}}}return{mode:r,indent:o,chomp:a,comment:f,length:u}}function ih(t){let e=t.split(/\n( *)/),n=e[0],s=n.match(/^( *)/),r=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}Ga.resolveBlockScalar=nh});var xi=w(Wa=>{"use strict";var Bi=$(),rh=et();function oh(t,e,n){let{offset:s,type:i,source:r,end:o}=t,a,l,c=(d,h,y)=>n(s+d,h,y);switch(i){case"scalar":a=Bi.Scalar.PLAIN,l=ah(r,c);break;case"single-quoted-scalar":a=Bi.Scalar.QUOTE_SINGLE,l=lh(r,c);break;case"double-quoted-scalar":a=Bi.Scalar.QUOTE_DOUBLE,l=ch(r,c);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let f=s+r.length,u=rh.resolveEnd(o,f,e,n);return{value:l,type:a,comment:u.comment,range:[s,f,u.offset]}}function ah(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Va(t)}function lh(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Va(t.slice(1,-1)).replace(/''/g,"'")}function Va(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
91
87
  `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
92
88
  `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=e.exec(t);if(!s)return t;let i=s[1],r=" ",o=e.lastIndex;for(n.lastIndex=o;s=n.exec(t);)s[1]===""?r===`
93
89
  `?i+=r:r=`
94
- `:(i+=r+s[1],r=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,s=a.exec(t),i+r+(s?.[1]??"")}function dh(t,e){let n="";for(let s=1;s<t.length-1;++s){let i=t[s];if(!(i==="\r"&&t[s+1]===`
90
+ `:(i+=r+s[1],r=" "),o=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,s=a.exec(t),i+r+(s?.[1]??"")}function ch(t,e){let n="";for(let s=1;s<t.length-1;++s){let i=t[s];if(!(i==="\r"&&t[s+1]===`
95
91
  `))if(i===`
96
- `){let{fold:r,offset:o}=ph(t,s);n+=r,s=o}else if(i==="\\"){let r=t[++s],o=hh[r];if(o)n+=o;else if(r===`
92
+ `){let{fold:r,offset:o}=uh(t,s);n+=r,s=o}else if(i==="\\"){let r=t[++s],o=fh[r];if(o)n+=o;else if(r===`
97
93
  `)for(r=t[s+1];r===" "||r===" ";)r=t[++s+1];else if(r==="\r"&&t[s+1]===`
98
- `)for(r=t[++s+1];r===" "||r===" ";)r=t[++s+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];n+=mh(t,s+1,a,e),s+=a}else{let a=t.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let r=s,o=t[s+1];for(;o===" "||o===" ";)o=t[++s+1];o!==`
94
+ `)for(r=t[++s+1];r===" "||r===" ";)r=t[++s+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];n+=dh(t,s+1,a,e),s+=a}else{let a=t.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let r=s,o=t[s+1];for(;o===" "||o===" ";)o=t[++s+1];o!==`
99
95
  `&&!(o==="\r"&&t[s+2]===`
100
- `)&&(n+=s>r?t.slice(r,s+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function ph(t,e){let n="",s=t[e+1];for(;(s===" "||s===" "||s===`
96
+ `)&&(n+=s>r?t.slice(r,s+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function uh(t,e){let n="",s=t[e+1];for(;(s===" "||s===" "||s===`
101
97
  `||s==="\r")&&!(s==="\r"&&t[e+2]!==`
102
98
  `);)s===`
103
99
  `&&(n+=`
104
- `),e+=1,s=t[e+1];return n||(n=" "),{fold:n,offset:e}}var hh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
105
- `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function mh(t,e,n,s){let i=t.substr(e,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=t.substr(e-2,n+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}Qa.resolveFlowScalar=ch});var Za=S(Xa=>{"use strict";var De=I(),za=$(),gh=Di(),yh=Ri();function Sh(t,e,n,s){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?gh.resolveBlockScalar(t,e,s):yh.resolveFlowScalar(e,t.options.strict,s),l=n?t.directives.tagName(n.source,u=>s(n,"TAG_RESOLVE_FAILED",u)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[De.SCALAR]:l?c=wh(t.schema,i,l,n,s):e.type==="scalar"?c=bh(t,i,e,s):c=t.schema[De.SCALAR];let f;try{let u=c.resolve(i,d=>s(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=De.isScalar(u)?u:new za.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);s(n??e,"TAG_RESOLVE_FAILED",d),f=new za.Scalar(i)}return f.range=a,f.source=i,r&&(f.type=r),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function wh(t,e,n,s,i){if(n==="!")return t[De.SCALAR];let r=[];for(let a of t.tags)if(!a.collection&&a.tag===n)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=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[De.SCALAR])}function bh({atKey:t,directives:e,schema:n},s,i,r){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(s))||n[De.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(s))??n[De.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),f=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",f,!0)}}return o}Xa.composeScalar=Sh});var tl=S(el=>{"use strict";function vh(t,e,n){if(e){n??(n=e.length);for(let s=n-1;s>=0;--s){let i=e[s];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++s];i?.type==="space";)t+=i.source.length,i=e[++s];break}}return t}el.emptyScalarPosition=vh});var il=S(Bi=>{"use strict";var kh=yt(),Eh=I(),Ah=Va(),nl=Za(),_h=Xe(),Oh=tl(),Ih={composeNode:sl,composeEmptyNode:Ki};function sl(t,e,n,s){let i=t.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=n,c,f=!0;switch(e.type){case"alias":c=Th(t,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=nl.composeScalar(t,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Ah.composeCollection(Ih,t,e,n,s),a&&(c.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);s(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",u),f=!1}}return c??(c=Ki(t,e.offset,void 0,null,n,s)),a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Eh.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),t.options.keepSourceTokens&&f&&(c.srcToken=e),c}function Ki(t,e,n,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let f={type:"scalar",offset:Oh.emptyScalarPosition(e,n,s),indent:-1,source:""},u=nl.composeScalar(t,f,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 Th({options:t},{offset:e,source:n,end:s},i){let r=new kh.Alias(n.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=_h.resolveEnd(s,o,t.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}Bi.composeEmptyNode=Ki;Bi.composeNode=sl});var al=S(ol=>{"use strict";var Nh=$t(),rl=il(),Lh=Xe(),Ch=Kt();function Ph(t,e,{offset:n,start:s,value:i,end:r},o){let a=Object.assign({_directives:e},t),l=new Nh.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=Ch.resolveProps(s,{indicator:"doc-start",next:i??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?rl.composeNode(c,i,f,o):rl.composeEmptyNode(c,f.end,s,null,f,o);let u=l.contents.range[2],d=Lh.resolveEnd(r,u,!1,o);return d.comment&&(l.comment=d.comment),l.range=[n,u,d.offset],l}ol.composeDoc=Ph});var Fi=S(ul=>{"use strict";var Mh=he("process"),$h=Os(),Dh=$t(),Bt=Rt(),ll=I(),qh=al(),Rh=Xe();function xt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function cl(t){let e="",n=!1,s=!1;for(let i=0;i<t.length;++i){let r=t[i];switch(r[0]){case"#":e+=(e===""?"":s?`
100
+ `),e+=1,s=t[e+1];return n||(n=" "),{fold:n,offset:e}}var fh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
101
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function dh(t,e,n,s){let i=t.substr(e,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){let a=t.substr(e-2,n+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}Wa.resolveFlowScalar=oh});var za=w(Qa=>{"use strict";var Re=I(),Ja=$(),ph=Ki(),hh=xi();function mh(t,e,n,s){let{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?ph.resolveBlockScalar(t,e,s):hh.resolveFlowScalar(e,t.options.strict,s),l=n?t.directives.tagName(n.source,u=>s(n,"TAG_RESOLVE_FAILED",u)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[Re.SCALAR]:l?c=gh(t.schema,i,l,n,s):e.type==="scalar"?c=yh(t,i,e,s):c=t.schema[Re.SCALAR];let f;try{let u=c.resolve(i,d=>s(n??e,"TAG_RESOLVE_FAILED",d),t.options);f=Re.isScalar(u)?u:new Ja.Scalar(u)}catch(u){let d=u instanceof Error?u.message:String(u);s(n??e,"TAG_RESOLVE_FAILED",d),f=new Ja.Scalar(i)}return f.range=a,f.source=i,r&&(f.type=r),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function gh(t,e,n,s,i){if(n==="!")return t[Re.SCALAR];let r=[];for(let a of t.tags)if(!a.collection&&a.tag===n)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=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Re.SCALAR])}function yh({atKey:t,directives:e,schema:n},s,i,r){let o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(s))||n[Re.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(s))??n[Re.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),f=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",f,!0)}}return o}Qa.composeScalar=mh});var Za=w(Xa=>{"use strict";function wh(t,e,n){if(e){n??(n=e.length);for(let s=n-1;s>=0;--s){let i=e[s];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++s];i?.type==="space";)t+=i.source.length,i=e[++s];break}}return t}Xa.emptyScalarPosition=wh});var nl=w(Ui=>{"use strict";var Sh=wt(),bh=I(),vh=Ha(),el=za(),kh=et(),Eh=Za(),Ah={composeNode:tl,composeEmptyNode:Fi};function tl(t,e,n,s){let i=t.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=n,c,f=!0;switch(e.type){case"alias":c=_h(t,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=el.composeScalar(t,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=vh.composeCollection(Ah,t,e,n,s),a&&(c.anchor=a.source.substring(1))}catch(u){let d=u instanceof Error?u.message:String(u);s(e,"RESOURCE_EXHAUSTION",d)}break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",u),f=!1}}return c??(c=Fi(t,e.offset,void 0,null,n,s)),a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!bh.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),t.options.keepSourceTokens&&f&&(c.srcToken=e),c}function Fi(t,e,n,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){let f={type:"scalar",offset:Eh.emptyScalarPosition(e,n,s),indent:-1,source:""},u=el.composeScalar(t,f,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 _h({options:t},{offset:e,source:n,end:s},i){let r=new Sh.Alias(n.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+n.length,a=kh.resolveEnd(s,o,t.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}Ui.composeEmptyNode=Fi;Ui.composeNode=tl});var rl=w(il=>{"use strict";var Oh=Dt(),sl=nl(),Ih=et(),Th=Bt();function Nh(t,e,{offset:n,start:s,value:i,end:r},o){let a=Object.assign({_directives:e},t),l=new Oh.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=Th.resolveProps(s,{indicator:"doc-start",next:i??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?sl.composeNode(c,i,f,o):sl.composeEmptyNode(c,f.end,s,null,f,o);let u=l.contents.range[2],d=Ih.resolveEnd(r,u,!1,o);return d.comment&&(l.comment=d.comment),l.range=[n,u,d.offset],l}il.composeDoc=Nh});var Yi=w(ll=>{"use strict";var Lh=ge("process"),Ch=Ns(),Ph=Dt(),xt=Kt(),ol=I(),Mh=rl(),$h=et();function Ft(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function al(t){let e="",n=!1,s=!1;for(let i=0;i<t.length;++i){let r=t[i];switch(r[0]){case"#":e+=(e===""?"":s?`
106
102
 
107
103
  `:`
108
- `)+(r.substring(1)||" "),n=!0,s=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:e,afterEmptyLine:s}}var xi=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,i,r)=>{let o=xt(n);r?this.warnings.push(new Bt.YAMLWarning(o,s,i)):this.errors.push(new Bt.YAMLParseError(o,s,i))},this.directives=new $h.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:s,afterEmptyLine:i}=cl(this.prelude);if(s){let r=e.contents;if(n)e.comment=e.comment?`${e.comment}
109
- ${s}`:s;else if(i||e.directives.docStart||!r)e.commentBefore=s;else if(ll.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];ll.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
104
+ `)+(r.substring(1)||" "),n=!0,s=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:e,afterEmptyLine:s}}var ji=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,i,r)=>{let o=Ft(n);r?this.warnings.push(new xt.YAMLWarning(o,s,i)):this.errors.push(new xt.YAMLParseError(o,s,i))},this.directives=new Ch.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:s,afterEmptyLine:i}=al(this.prelude);if(s){let r=e.contents;if(n)e.comment=e.comment?`${e.comment}
105
+ ${s}`:s;else if(i||e.directives.docStart||!r)e.commentBefore=s;else if(ol.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];ol.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
110
106
  ${a}`:s}else{let o=r.commentBefore;r.commentBefore=o?`${s}
111
- ${o}`:s}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:cl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,s=-1){for(let i of e)yield*this.next(i);yield*this.end(n,s)}*next(e){switch(Mh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,s,i)=>{let r=xt(e);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=qh.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new Bt.YAMLParseError(xt(e),"UNEXPECTED_TOKEN",n);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 Bt.YAMLParseError(xt(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=Rh.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
112
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Bt.YAMLParseError(xt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-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 Dh.Document(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};ul.Composer=xi});var pl=S(Gn=>{"use strict";var Kh=Di(),Bh=Ri(),xh=Rt(),fl=kt();function Fh(t,e=!0,n){if(t){let s=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,r,o);else throw new xh.YAMLParseError([a,a+1],r,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Bh.resolveFlowScalar(t,e,s);case"block-scalar":return Kh.resolveBlockScalar({options:{strict:e}},t,s)}}return null}function Uh(t,e){let{implicitKey:n=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=fl.stringifyString({type:o,value:t},{implicitKey:n,indent:s>0?" ".repeat(s):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:s,source:`
107
+ ${o}`:s}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:al(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,s=-1){for(let i of e)yield*this.next(i);yield*this.end(n,s)}*next(e){switch(Lh.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,s,i)=>{let r=Ft(e);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Mh.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new xt.YAMLParseError(Ft(e),"UNEXPECTED_TOKEN",n);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 xt.YAMLParseError(Ft(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=$h.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
108
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new xt.YAMLParseError(Ft(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-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 Ph.Document(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};ll.Composer=ji});var fl=w(Qn=>{"use strict";var Dh=Ki(),qh=xi(),Rh=Kt(),cl=Et();function Kh(t,e=!0,n){if(t){let s=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,r,o);else throw new Rh.YAMLParseError([a,a+1],r,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return qh.resolveFlowScalar(t,e,s);case"block-scalar":return Dh.resolveBlockScalar({options:{strict:e}},t,s)}}return null}function Bh(t,e){let{implicitKey:n=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,a=cl.stringifyString({type:o,value:t},{implicitKey:n,indent:s>0?" ".repeat(s):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:s,source:`
113
109
  `}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
114
110
  `),f=a.substring(0,c),u=a.substring(c+1)+`
115
- `,d=[{type:"block-scalar-header",offset:r,indent:s,source:f}];return dl(d,l)||d.push({type:"newline",offset:-1,indent:s,source:`
116
- `}),{type:"block-scalar",offset:r,indent:s,props:d,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 jh(t,e,n={}){let{afterKey:s=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=n,a="indent"in t?t.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=t.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=fl.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">":Yh(t,l);break;case'"':Ui(t,l,"double-quoted-scalar");break;case"'":Ui(t,l,"single-quoted-scalar");break;default:Ui(t,l,"scalar")}}function Yh(t,e){let n=e.indexOf(`
111
+ `,d=[{type:"block-scalar-header",offset:r,indent:s,source:f}];return ul(d,l)||d.push({type:"newline",offset:-1,indent:s,source:`
112
+ `}),{type:"block-scalar",offset:r,indent:s,props:d,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 xh(t,e,n={}){let{afterKey:s=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=n,a="indent"in t?t.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=t.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=cl.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">":Fh(t,l);break;case'"':Hi(t,l,"double-quoted-scalar");break;case"'":Hi(t,l,"single-quoted-scalar");break;default:Hi(t,l,"scalar")}}function Fh(t,e){let n=e.indexOf(`
117
113
  `),s=e.substring(0,n),i=e.substring(n+1)+`
118
- `;if(t.type==="block-scalar"){let r=t.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,t.source=i}else{let{offset:r}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];dl(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
119
- `});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function dl(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Ui(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let s=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let r of s)r.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:s});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
120
- `};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let s="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(t))r!=="type"&&r!=="offset"&&delete t[r];Object.assign(t,{type:n,indent:s,source:e,end:i})}}}Gn.createScalarToken=Uh;Gn.resolveAsScalar=Fh;Gn.setScalarValue=jh});var ml=S(hl=>{"use strict";var Hh=t=>"type"in t?Wn(t):Vn(t);function Wn(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Wn(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Vn(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Vn(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Vn(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Vn({start:t,key:e,sep:n,value:s}){let i="";for(let r of t)i+=r.source;if(e&&(i+=Wn(e)),n)for(let r of n)i+=r.source;return s&&(i+=Wn(s)),i}hl.stringify=Hh});var wl=S(Sl=>{"use strict";var ji=Symbol("break visit"),Gh=Symbol("skip children"),gl=Symbol("remove item");function qe(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),yl(Object.freeze([]),t,e)}qe.BREAK=ji;qe.SKIP=Gh;qe.REMOVE=gl;qe.itemAtPath=(t,e)=>{let n=t;for(let[s,i]of e){let r=n?.[s];if(r&&"items"in r)n=r.items[i];else return}return n};qe.parentCollection=(t,e)=>{let n=qe.itemAtPath(t,e.slice(0,-1)),s=e[e.length-1][0],i=n?.[s];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function yl(t,e,n){let s=n(e,t);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=yl(Object.freeze(t.concat([[i,o]])),r.items[o],n);if(typeof a=="number")o=a-1;else{if(a===ji)return ji;a===gl&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(e,t))}}return typeof s=="function"?s(e,t):s}Sl.visit=qe});var Jn=S(W=>{"use strict";var Yi=pl(),Vh=ml(),Wh=wl(),Hi="\uFEFF",Gi="",Vi="",Wi="",Jh=t=>!!t&&"items"in t,Qh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function zh(t){switch(t){case Hi:return"<BOM>";case Gi:return"<DOC>";case Vi:return"<FLOW_END>";case Wi:return"<SCALAR>";default:return JSON.stringify(t)}}function Xh(t){switch(t){case Hi:return"byte-order-mark";case Gi:return"doc-mode";case Vi:return"flow-error-end";case Wi:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
114
+ `;if(t.type==="block-scalar"){let r=t.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,t.source=i}else{let{offset:r}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];ul(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
115
+ `});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function ul(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function Hi(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let s=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let r of s)r.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:s});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
116
+ `};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let s="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(t))r!=="type"&&r!=="offset"&&delete t[r];Object.assign(t,{type:n,indent:s,source:e,end:i})}}}Qn.createScalarToken=Bh;Qn.resolveAsScalar=Kh;Qn.setScalarValue=xh});var pl=w(dl=>{"use strict";var Uh=t=>"type"in t?Xn(t):zn(t);function Xn(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=Xn(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=zn(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=zn(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=zn(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function zn({start:t,key:e,sep:n,value:s}){let i="";for(let r of t)i+=r.source;if(e&&(i+=Xn(e)),n)for(let r of n)i+=r.source;return s&&(i+=Xn(s)),i}dl.stringify=Uh});var yl=w(gl=>{"use strict";var Gi=Symbol("break visit"),jh=Symbol("skip children"),hl=Symbol("remove item");function Ke(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),ml(Object.freeze([]),t,e)}Ke.BREAK=Gi;Ke.SKIP=jh;Ke.REMOVE=hl;Ke.itemAtPath=(t,e)=>{let n=t;for(let[s,i]of e){let r=n?.[s];if(r&&"items"in r)n=r.items[i];else return}return n};Ke.parentCollection=(t,e)=>{let n=Ke.itemAtPath(t,e.slice(0,-1)),s=e[e.length-1][0],i=n?.[s];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function ml(t,e,n){let s=n(e,t);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=ml(Object.freeze(t.concat([[i,o]])),r.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Gi)return Gi;a===hl&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(e,t))}}return typeof s=="function"?s(e,t):s}gl.visit=Ke});var Zn=w(W=>{"use strict";var Vi=fl(),Yh=pl(),Hh=yl(),Wi="\uFEFF",Ji="",Qi="",zi="",Gh=t=>!!t&&"items"in t,Vh=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Wh(t){switch(t){case Wi:return"<BOM>";case Ji:return"<DOC>";case Qi:return"<FLOW_END>";case zi:return"<SCALAR>";default:return JSON.stringify(t)}}function Jh(t){switch(t){case Wi:return"byte-order-mark";case Ji:return"doc-mode";case Qi:return"flow-error-end";case zi:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
121
117
  `:case`\r
122
- `: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(t[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}W.createScalarToken=Yi.createScalarToken;W.resolveAsScalar=Yi.resolveAsScalar;W.setScalarValue=Yi.setScalarValue;W.stringify=Vh.stringify;W.visit=Wh.visit;W.BOM=Hi;W.DOCUMENT=Gi;W.FLOW_END=Vi;W.SCALAR=Wi;W.isCollection=Jh;W.isScalar=Qh;W.prettyToken=zh;W.tokenType=Xh});var zi=S(vl=>{"use strict";var Ft=Jn();function X(t){switch(t){case void 0:case" ":case`
123
- `:case"\r":case" ":return!0;default:return!1}}var bl=new Set("0123456789ABCDEFabcdef"),Zh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Qn=new Set(",[]{}"),em=new Set(` ,[]{}
124
- \r `),Ji=t=>!t||em.has(t),Qi=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,n=!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=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
118
+ `: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(t[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}W.createScalarToken=Vi.createScalarToken;W.resolveAsScalar=Vi.resolveAsScalar;W.setScalarValue=Vi.setScalarValue;W.stringify=Yh.stringify;W.visit=Hh.visit;W.BOM=Wi;W.DOCUMENT=Ji;W.FLOW_END=Qi;W.SCALAR=zi;W.isCollection=Gh;W.isScalar=Vh;W.prettyToken=Wh;W.tokenType=Jh});var er=w(Sl=>{"use strict";var Ut=Zn();function X(t){switch(t){case void 0:case" ":case`
119
+ `:case"\r":case" ":return!0;default:return!1}}var wl=new Set("0123456789ABCDEFabcdef"),Qh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),es=new Set(",[]{}"),zh=new Set(` ,[]{}
120
+ \r `),Xi=t=>!t||zh.has(t),Zi=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,n=!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=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
125
121
  `?!0:n==="\r"?this.buffer[e+1]===`
126
122
  `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+e];if(n==="\r"){let i=this.buffer[s+e+1];if(i===`
127
123
  `||!i&&!this.atEnd)return e+s+1}return n===`
128
124
  `||s>=this.indentNext||!n&&!this.atEnd?e+s:-1}if(n==="-"||n==="."){let s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&X(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(`
129
- `,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]===Ft.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,s=e.indexOf("#");for(;s!==-1;){let r=e[s-1];if(r===" "||r===" "){n=s-1;break}else s=e.indexOf("#",s+1)}for(;;){let r=e[n-1];if(r===" "||r===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield Ft.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 n=this.peek(3);if((n==="---"||n==="...")&&X(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!X(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&X(n)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);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(Ji),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,s=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>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("..."))&&X(i[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Ft.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(Ji),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||X(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),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let r=0;for(;this.buffer[n-1-r]==="\\";)r+=1;if(r%2===0)break;n=this.buffer.indexOf('"',n+1)}let s=this.buffer.substring(0,n),i=s.indexOf(`
125
+ `,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]===Ut.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,s=e.indexOf("#");for(;s!==-1;){let r=e[s-1];if(r===" "||r===" "){n=s-1;break}else s=e.indexOf("#",s+1)}for(;;){let r=e[n-1];if(r===" "||r===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield Ut.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 n=this.peek(3);if((n==="---"||n==="...")&&X(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!X(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&X(n)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);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(Xi),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,s=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>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("..."))&&X(i[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Ut.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(Xi),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||X(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),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let r=0;for(;this.buffer[n-1-r]==="\\";)r+=1;if(r%2===0)break;n=this.buffer.indexOf('"',n+1)}let s=this.buffer.substring(0,n),i=s.indexOf(`
130
126
  `,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=s.indexOf(`
131
127
  `,r)}i!==-1&&(n=i-(s[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>X(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":n+=1;break;case`
132
128
  `:e=r,n=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
133
129
  `)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n: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(`
134
130
  `,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===`
135
131
  `;)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===`
136
- `&&r>=this.pos&&r+1+n>a)e=r;else break}while(!0);return yield Ft.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){let r=this.buffer[s+1];if(X(r)||e&&Qn.has(r))break;n=s}else if(X(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===`
132
+ `&&r>=this.pos&&r+1+n>a)e=r;else break}while(!0);return yield Ut.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){let r=this.buffer[s+1];if(X(r)||e&&es.has(r))break;n=s}else if(X(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===`
137
133
  `?(s+=1,i=`
138
- `,r=this.buffer[s+1]):n=s),r==="#"||e&&Qn.has(r))break;if(i===`
139
- `){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&Qn.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Ft.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Ji))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,n=this.charAt(1);if(X(n)||e&&Qn.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!X(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Zh.has(n))n=this.buffer[++e];else if(n==="%"&&bl.has(this.buffer[e+1])&&bl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
134
+ `,r=this.buffer[s+1]):n=s),r==="#"||e&&es.has(r))break;if(i===`
135
+ `){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&es.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Ut.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Xi))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,n=this.charAt(1);if(X(n)||e&&es.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!X(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Qh.has(n))n=this.buffer[++e];else if(n==="%"&&wl.has(this.buffer[e+1])&&wl.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
140
136
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
141
- `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||e&&s===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,s=this.buffer[n];for(;!e(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};vl.Lexer=Qi});var Zi=S(kl=>{"use strict";var Xi=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,s=this.lineStarts.length;for(;n<s;){let r=n+s>>1;this.lineStarts[r]<e?n=r+1:s=r}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};kl.LineCounter=Xi});var tr=S(Il=>{"use strict";var tm=he("process"),El=Jn(),nm=zi();function _e(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Al(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Ol(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function zn(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Ze(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function _l(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!_e(e.start,"explicit-key-ind")&&!_e(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Ol(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var er=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 nm.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(e,n))yield*this.next(s);n||(yield*this.end())}*next(e){if(this.source=e,tm.env.LOG_TOKENS&&console.log("|",El.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=El.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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 n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&_l(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{let i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,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:n}):i.value=n;break}case"flow-collection":{let i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Al(i.start)===-1&&(n.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<n.indent))&&(s.type==="document"?s.end=i.start:s.items.push({start:i.start}),n.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":{Al(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 n=this.startBlockValue(e);n?this.stack.push(n):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 n=zn(this.peek(2)),s=Ze(n),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 n=this.source.indexOf(`
137
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||e&&s===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,s=this.buffer[n];for(;!e(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Sl.Lexer=Zi});var nr=w(bl=>{"use strict";var tr=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,s=this.lineStarts.length;for(;n<s;){let r=n+s>>1;this.lineStarts[r]<e?n=r+1:s=r}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};bl.LineCounter=tr});var ir=w(_l=>{"use strict";var Xh=ge("process"),vl=Zn(),Zh=er();function _e(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function kl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Al(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ts(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function tt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function El(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!_e(e.start,"explicit-key-ind")&&!_e(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Al(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var sr=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 Zh.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(e,n))yield*this.next(s);n||(yield*this.end())}*next(e){if(this.source=e,Xh.env.LOG_TOKENS&&console.log("|",vl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=vl.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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 n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&El(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{let i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,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:n}):i.value=n;break}case"flow-collection":{let i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&kl(i.start)===-1&&(n.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<n.indent))&&(s.type==="document"?s.end=i.start:s.items.push({start:i.start}),n.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":{kl(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 n=this.startBlockValue(e);n?this.stack.push(n):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 n=ts(this.peek(2)),s=tt(n),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 n=this.source.indexOf(`
142
138
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
143
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.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 n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let s=!this.onKeyLine&&this.indent===e.indent,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.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=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(_e(n.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(Ol(n.key)&&!_e(n.sep,"newline")){let o=Ze(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?n.sep=n.sep.concat(r,this.sourceToken):n.sep.push(this.sourceToken);else if(_e(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=Ze(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):_e(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{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||n.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!_e(n.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 n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let s="end"in n.value?n.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 n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||_e(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.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 n=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":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{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=zn(s),r=Ze(i);_l(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 n=this.source.indexOf(`
139
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.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 n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let s=!this.onKeyLine&&this.indent===e.indent,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.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=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(_e(n.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(Al(n.key)&&!_e(n.sep,"newline")){let o=tt(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?n.sep=n.sep.concat(r,this.sourceToken):n.sep.push(this.sourceToken);else if(_e(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=tt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):_e(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{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||n.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!_e(n.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 n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let s="end"in n.value?n.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 n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||_e(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.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 n=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":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{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=ts(s),r=tt(i);El(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 n=this.source.indexOf(`
144
140
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
145
- `,n)+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 n=zn(e),s=Ze(n);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 n=zn(e),s=Ze(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!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())}}};Il.Parser=er});var Pl=S(jt=>{"use strict";var Tl=Fi(),sm=$t(),Ut=Rt(),im=Bs(),rm=I(),om=Zi(),Nl=tr();function Ll(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new om.LineCounter||null,prettyErrors:e}}function am(t,e={}){let{lineCounter:n,prettyErrors:s}=Ll(e),i=new Nl.Parser(n?.addNewLine),r=new Tl.Composer(e),o=Array.from(r.compose(i.parse(t)));if(s&&n)for(let a of o)a.errors.forEach(Ut.prettifyError(t,n)),a.warnings.forEach(Ut.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Cl(t,e={}){let{lineCounter:n,prettyErrors:s}=Ll(e),i=new Nl.Parser(n?.addNewLine),r=new Tl.Composer(e),o=null;for(let a of r.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Ut.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Ut.prettifyError(t,n)),o.warnings.forEach(Ut.prettifyError(t,n))),o}function lm(t,e,n){let s;typeof e=="function"?s=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Cl(t,n);if(!i)return null;if(i.warnings.forEach(r=>im.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},n))}function cm(t,e,n){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return rm.isDocument(t)&&!s?t.toString(n):new sm.Document(t,s,n).toString(n)}jt.parse=lm;jt.parseAllDocuments=am;jt.parseDocument=Cl;jt.stringify=cm});var Ie=S(L=>{"use strict";var um=Fi(),fm=$t(),dm=vi(),nr=Rt(),pm=yt(),Oe=I(),hm=ve(),mm=$(),gm=Ee(),ym=Ae(),Sm=Jn(),wm=zi(),bm=Zi(),vm=tr(),Xn=Pl(),Ml=pt();L.Composer=um.Composer;L.Document=fm.Document;L.Schema=dm.Schema;L.YAMLError=nr.YAMLError;L.YAMLParseError=nr.YAMLParseError;L.YAMLWarning=nr.YAMLWarning;L.Alias=pm.Alias;L.isAlias=Oe.isAlias;L.isCollection=Oe.isCollection;L.isDocument=Oe.isDocument;L.isMap=Oe.isMap;L.isNode=Oe.isNode;L.isPair=Oe.isPair;L.isScalar=Oe.isScalar;L.isSeq=Oe.isSeq;L.Pair=hm.Pair;L.Scalar=mm.Scalar;L.YAMLMap=gm.YAMLMap;L.YAMLSeq=ym.YAMLSeq;L.CST=Sm;L.Lexer=wm.Lexer;L.LineCounter=bm.LineCounter;L.Parser=vm.Parser;L.parse=Xn.parse;L.parseAllDocuments=Xn.parseAllDocuments;L.parseDocument=Xn.parseDocument;L.stringify=Xn.stringify;L.visit=Ml.visit;L.visitAsync=Ml.visitAsync});function sr(t,e){let n=e.split("."),s=t;for(let i of n)if(s=s?.[i],s===void 0)return;return s}function $l(t){return t!=null&&t!==""&&t!==!1}function Dl(t,e){let n=!0;for(;n;)n=!1,t=t.replace(/\{\{#([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}([\s\S]*?)\{\{\/\1\}\}/g,(s,i,r)=>i==="sms_section"?s:(n=!0,$l(sr(e,i))?r:"")),t=t.replace(/\{\{\^([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}([\s\S]*?)\{\{\/\1\}\}/g,(s,i,r)=>(n=!0,$l(sr(e,i))?"":r));return t=t.replace(/\{\{([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}/g,(s,i)=>{let r=sr(e,i);return r===void 0?s:String(r)}),t}var ql=C(()=>{"use strict"});var ts={};Q(ts,{startDaemon:()=>rr,stopDaemon:()=>or});import{execFileSync as Zn}from"node:child_process";import{existsSync as Yt,readFileSync as km,writeFileSync as Em,mkdirSync as ir,symlinkSync as Am,unlinkSync as Rl}from"node:fs";import{resolve as ue}from"node:path";function _m(){let t=ue(T,process.env.HIVE_CONFIG??"hive.yaml");return Yt(t)?((0,Kl.parse)(km(t,"utf-8"))??{}).instance?.id??"hive":"hive"}function es(){return`com.hive.${_m()}.agent`}function Om(){return ue(T,"service",`${es()}.plist`)}function Bl(){let t=process.env.HOME??"/tmp";return ue(t,"Library","LaunchAgents",`${es()}.plist`)}async function rr(t){let e=es(),n=Om(),s=Bl(),i=ue(T,"service"),r=ue(T,"logs");ir(i,{recursive:!0}),ir(r,{recursive:!0});let o=Zn("which",["node"],{encoding:"utf-8"}).trim(),a=Yt(ue(t,"pkg","server.min.js"))?ue(t,"pkg","server.min.js"):ue(t,"dist","index.js"),l=process.env.HOME??"/tmp",c=process.env.PATH??"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",f=`<?xml version="1.0" encoding="UTF-8"?>
141
+ `,n)+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 n=ts(e),s=tt(n);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 n=ts(e),s=tt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!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())}}};_l.Parser=sr});var Ll=w(Yt=>{"use strict";var Ol=Yi(),em=Dt(),jt=Kt(),tm=Us(),nm=I(),sm=nr(),Il=ir();function Tl(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new sm.LineCounter||null,prettyErrors:e}}function im(t,e={}){let{lineCounter:n,prettyErrors:s}=Tl(e),i=new Il.Parser(n?.addNewLine),r=new Ol.Composer(e),o=Array.from(r.compose(i.parse(t)));if(s&&n)for(let a of o)a.errors.forEach(jt.prettifyError(t,n)),a.warnings.forEach(jt.prettifyError(t,n));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Nl(t,e={}){let{lineCounter:n,prettyErrors:s}=Tl(e),i=new Il.Parser(n?.addNewLine),r=new Ol.Composer(e),o=null;for(let a of r.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new jt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(jt.prettifyError(t,n)),o.warnings.forEach(jt.prettifyError(t,n))),o}function rm(t,e,n){let s;typeof e=="function"?s=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Nl(t,n);if(!i)return null;if(i.warnings.forEach(r=>tm.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},n))}function om(t,e,n){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return nm.isDocument(t)&&!s?t.toString(n):new em.Document(t,s,n).toString(n)}Yt.parse=rm;Yt.parseAllDocuments=im;Yt.parseDocument=Nl;Yt.stringify=om});var fe=w(N=>{"use strict";var am=Yi(),lm=Dt(),cm=Ai(),rr=Kt(),um=wt(),Oe=I(),fm=ve(),dm=$(),pm=Ee(),hm=Ae(),mm=Zn(),gm=er(),ym=nr(),wm=ir(),ns=Ll(),Cl=ht();N.Composer=am.Composer;N.Document=lm.Document;N.Schema=cm.Schema;N.YAMLError=rr.YAMLError;N.YAMLParseError=rr.YAMLParseError;N.YAMLWarning=rr.YAMLWarning;N.Alias=um.Alias;N.isAlias=Oe.isAlias;N.isCollection=Oe.isCollection;N.isDocument=Oe.isDocument;N.isMap=Oe.isMap;N.isNode=Oe.isNode;N.isPair=Oe.isPair;N.isScalar=Oe.isScalar;N.isSeq=Oe.isSeq;N.Pair=fm.Pair;N.Scalar=dm.Scalar;N.YAMLMap=pm.YAMLMap;N.YAMLSeq=hm.YAMLSeq;N.CST=mm;N.Lexer=gm.Lexer;N.LineCounter=ym.LineCounter;N.Parser=wm.Parser;N.parse=ns.parse;N.parseAllDocuments=ns.parseAllDocuments;N.parseDocument=ns.parseDocument;N.stringify=ns.stringify;N.visit=Cl.visit;N.visitAsync=Cl.visitAsync});import{existsSync as Sm}from"node:fs";import{resolve as Ie}from"node:path";function or(){return process.env.HIVE_HOME?Ie(process.env.HIVE_HOME):Sm(Ie(process.cwd(),"hive.yaml"))?process.cwd():Ie(bm,".hive")}function Pl(t){let e=process.env.HIVE_CONFIG||"hive.yaml";return Ie(t,e)}function Ml(t){let n=(process.env.HIVE_CONFIG||"hive.yaml").match(/^hive-(.+)\.yaml$/)?.[1];return Ie(t,n?`.env-${n}`:".env")}var bm,P,j,xw,$l,ne=L(()=>{"use strict";bm=process.env.HOME??"/tmp";P=or(),j=Ie(P,"skills"),xw=Ie(P,".hive"),$l=Ie(import.meta.dirname,"..","seeds")});import{execFileSync as R}from"node:child_process";import{writeFileSync as vm,unlinkSync as km}from"node:fs";import{resolve as Em}from"node:path";import{tmpdir as Am}from"node:os";function ar(t){try{return R("which",[t],Ht),!0}catch{return!1}}function Dl(t){try{return R("brew",["list",t],Ht),!0}catch{return!1}}function _m(t){try{return R("brew",["services","list"],Ht).split(`
142
+ `).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function ql(t,e=1500){try{let n=new AbortController,s=setTimeout(()=>n.abort(),e),i=await fetch(t,{signal:n.signal});return clearTimeout(s),i.ok}catch{return!1}}async function Rl(){console.log(`Checking prerequisites...
143
+ `);let t=0;for(let e of Om){let n=e.required?"":" (optional)";if(await e.check()){console.log(` \u2713 ${e.name}${n}`);continue}console.log(` \u2717 ${e.name}${n} \u2014 installing...`);try{e.install(),await e.check()?console.log(` \u2713 ${e.name} \u2014 installed`):e.required&&(console.error(` \u2717 ${e.name} \u2014 install failed`),t++)}catch(s){e.required?(console.error(` \u2717 ${e.name} \u2014 install failed: ${s}`),t++):console.log(` \u25CB ${e.name} \u2014 skipped (install failed)`)}}t>0&&(console.error(`
144
+ ${t} required prerequisite(s) failed. Fix and re-run 'hive init'.`),process.exit(1)),console.log(`
145
+ All prerequisites ready.`)}var Ht,Om,Kl=L(()=>{"use strict";Ht={encoding:"utf-8",stdio:"pipe"};Om=[{name:"Xcode CLI Tools",required:!0,check:()=>{try{return R("xcode-select",["-p"],Ht),!0}catch{return!1}},install:()=>{console.log(" Installing Xcode CLI Tools (this opens a system dialog)..."),R("xcode-select",["--install"],{stdio:"inherit"}),console.log(" Complete the installation dialog, then re-run 'hive init'."),process.exit(0)}},{name:"Homebrew",required:!0,check:()=>ar("brew"),install:()=>{console.log(" Installing Homebrew...");let t=Em(Am(),"brew-install.sh"),e=R("curl",["-fsSL","https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"],{encoding:"utf-8"});vm(t,e,{mode:493}),R("/bin/bash",[t],{stdio:"inherit"}),km(t)}},{name:"Node.js >= 22",required:!0,check:()=>parseInt(process.versions.node.split(".")[0])>=22,install:()=>{console.log(" Installing Node.js via Homebrew..."),R("brew",["install","node"],{stdio:"inherit"})}},{name:"MongoDB",required:!0,check:()=>_m("mongodb-community"),install:()=>{Dl("mongodb-community")||(console.log(" Tapping mongodb/brew..."),R("brew",["tap","mongodb/brew"],{stdio:"inherit"}),console.log(" Installing mongodb-community..."),R("brew",["install","mongodb-community"],{stdio:"inherit"})),console.log(" Starting MongoDB..."),R("brew",["services","start","mongodb-community"],{stdio:"inherit"})}},{name:"Ollama",required:!0,check:()=>ql("http://127.0.0.1:11434/api/tags"),install:()=>{console.log(" Installing Ollama..."),R("brew",["install","ollama"],{stdio:"inherit"}),R("brew",["services","start","ollama"],{stdio:"inherit"})}},{name:"Ollama models (bge-large, gemma4:e4b)",required:!0,check:()=>{if(!ar("ollama"))return!1;try{let t=R("ollama",["list"],Ht);return t.includes("bge-large")&&t.includes("gemma4:e4b")}catch{return!1}},install:()=>{console.log(" \u26A0 Pulling Ollama models \u2014 ~10 GB total, several minutes on first run."),console.log(" Pulling bge-large (~670 MB)..."),R("ollama",["pull","bge-large"],{stdio:"inherit"}),console.log(" Pulling gemma4:e4b (~9.6 GB)..."),R("ollama",["pull","gemma4:e4b"],{stdio:"inherit"})}},{name:"Qdrant",required:!0,check:()=>ql("http://127.0.0.1:6333/"),install:()=>{Dl("qdrant")||(console.log(" Installing Qdrant..."),R("brew",["install","qdrant/tap/qdrant"],{stdio:"inherit"})),console.log(" Starting Qdrant..."),R("brew",["services","start","qdrant"],{stdio:"inherit"})}},{name:"gh CLI",required:!1,check:()=>ar("gh"),install:()=>{console.log(" Installing gh CLI..."),R("brew",["install","gh"],{stdio:"inherit"})}}]});function lr(t,e){let n=e.split("."),s=t;for(let i of n)if(s=s?.[i],s===void 0)return;return s}function Bl(t){return t!=null&&t!==""&&t!==!1}function xl(t,e){let n=!0;for(;n;)n=!1,t=t.replace(/\{\{#([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}([\s\S]*?)\{\{\/\1\}\}/g,(s,i,r)=>i==="sms_section"?s:(n=!0,Bl(lr(e,i))?r:"")),t=t.replace(/\{\{\^([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}([\s\S]*?)\{\{\/\1\}\}/g,(s,i,r)=>(n=!0,Bl(lr(e,i))?"":r));return t=t.replace(/\{\{([\w][\w-]*(?:\.[\w][\w-]*)*)\}\}/g,(s,i)=>{let r=lr(e,i);return r===void 0?s:String(r)}),t}var Fl=L(()=>{"use strict"});var rs={};Q(rs,{startDaemon:()=>ur,stopDaemon:()=>fr});import{execFileSync as ss}from"node:child_process";import{existsSync as Gt,readFileSync as Im,writeFileSync as Tm,mkdirSync as cr,symlinkSync as Nm,unlinkSync as Ul}from"node:fs";import{resolve as de}from"node:path";function Lm(){let t=de(P,process.env.HIVE_CONFIG??"hive.yaml");return Gt(t)?((0,jl.parse)(Im(t,"utf-8"))??{}).instance?.id??"hive":"hive"}function is(){return`com.hive.${Lm()}.agent`}function Cm(){return de(P,"service",`${is()}.plist`)}function Yl(){let t=process.env.HOME??"/tmp";return de(t,"Library","LaunchAgents",`${is()}.plist`)}async function ur(t){let e=is(),n=Cm(),s=Yl(),i=de(P,"service"),r=de(P,"logs");cr(i,{recursive:!0}),cr(r,{recursive:!0});let o=ss("which",["node"],{encoding:"utf-8"}).trim(),a=Gt(de(t,"pkg","server.min.js"))?de(t,"pkg","server.min.js"):de(t,"dist","index.js"),l=process.env.HOME??"/tmp",c=process.env.PATH??"/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",f=`<?xml version="1.0" encoding="UTF-8"?>
146
146
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
147
147
  <plist version="1.0">
148
148
  <dict>
@@ -156,12 +156,12 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
156
156
  </array>
157
157
 
158
158
  <key>WorkingDirectory</key>
159
- <string>${T}</string>
159
+ <string>${P}</string>
160
160
 
161
161
  <key>EnvironmentVariables</key>
162
162
  <dict>
163
163
  <key>HIVE_HOME</key>
164
- <string>${T}</string>
164
+ <string>${P}</string>
165
165
  <key>PATH</key>
166
166
  <string>${c}</string>
167
167
  <key>HOME</key>
@@ -186,65 +186,68 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
186
186
  <string>${r}/hive.err</string>
187
187
  </dict>
188
188
  </plist>
189
- `;Em(n,f),console.log(`Generated plist: ${n}`);let u=ue(s,"..");ir(u,{recursive:!0}),Yt(s)&&Rl(s),Am(n,s);try{Zn("launchctl",["unload",s],{stdio:"pipe"})}catch{}try{Zn("launchctl",["load",s],{stdio:"inherit"}),console.log(`Started ${e}`)}catch{throw new Error(`Failed to start ${e}. Check: launchctl list | grep hive`)}}async function or(){let t=Bl(),e=es();if(!Yt(t)){console.log(`No LaunchAgent found for ${e}`);return}try{Zn("launchctl",["unload",t],{stdio:"inherit"}),console.log(`Stopped ${e}`)}catch{console.error(`Failed to stop ${e}`)}try{Yt(t)&&Rl(t),console.log(`Removed ${t}`)}catch{}}var Kl,Ht=C(()=>{"use strict";Kl=me(Ie(),1);ee()});var ec={};Q(ec,{runWizard:()=>Lm});import{createInterface as Im}from"node:readline";import{readFileSync as tt,writeFileSync as Ql,existsSync as H,readdirSync as Tm}from"node:fs";import{execFileSync as Y}from"node:child_process";import{resolve as Te,join as U}from"node:path";import{MongoClient as ar}from"mongodb";function P(t,e=""){let n=e?`${t} [${e}]: `:`${t}: `;return new Promise(s=>{zl.question(n,i=>{s(i.trim()||e)})})}async function B(t,e=!0){return(await P(`${t} (${e?"Y/n":"y/N"})`,e?"y":"n")).toLowerCase().startsWith("y")}function Nm(){console.log(""),console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551 Hive Setup Wizard \u2551"),console.log("\u2551 Multi-Agent Slack Orchestration Framework \u2551"),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.log("")}function Z(t){console.log(""),console.log(`\u2500\u2500 ${t} ${"\u2500".repeat(Math.max(0,44-t.length))}`),console.log("")}function Xl(){if(!H(ns))return{};let t={};for(let e of tt(ns,"utf-8").split(`
190
- `)){let n=e.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s===-1)continue;let i=n.slice(0,s),r=n.slice(s+1);t[i]=r}return t}function Gt(t){let e=["# Hive environment \u2014 generated by setup wizard","# Secrets and API keys. Do not commit this file.",""],n=[{header:"# Slack",keys:["SLACK_APP_TOKEN","SLACK_BOT_TOKEN","SLACK_MCP_TOKEN"]},{header:"# Anthropic",keys:["ANTHROPIC_API_KEY"]},{header:"# SMS (Quo/OpenPhone)",keys:["QUO_API_KEY","QUO_PHONE_NUMBER_ID"]},{header:"# Google",keys:["GOOGLE_ACCOUNT"]},{header:"# Project Management",keys:["LINEAR_API_KEY","CLICKUP_API_TOKEN"]},{header:"# External Communications",keys:["EXTERNAL_COMMS_ENABLED"]}],s=new Set;for(let i of n){let r=[];for(let o of i.keys){s.add(o);let a=t[o];a?r.push(`${o}=${a}`):r.push(`# ${o}=`)}r.some(o=>!o.startsWith("#"))&&(e.push(i.header),e.push(...r),e.push(""))}for(let[i,r]of Object.entries(t))!s.has(i)&&r&&e.push(`${i}=${r}`);Ql(ns,e.join(`
189
+ `;Tm(n,f),console.log(`Generated plist: ${n}`);let u=de(s,"..");cr(u,{recursive:!0}),Gt(s)&&Ul(s),Nm(n,s);try{ss("launchctl",["unload",s],{stdio:"pipe"})}catch{}try{ss("launchctl",["load",s],{stdio:"inherit"}),console.log(`Started ${e}`)}catch{throw new Error(`Failed to start ${e}. Check: launchctl list | grep hive`)}}async function fr(){let t=Yl(),e=is();if(!Gt(t)){console.log(`No LaunchAgent found for ${e}`);return}try{ss("launchctl",["unload",t],{stdio:"inherit"}),console.log(`Stopped ${e}`)}catch{console.error(`Failed to stop ${e}`)}try{Gt(t)&&Ul(t),console.log(`Removed ${t}`)}catch{}}var jl,Vt=L(()=>{"use strict";jl=le(fe(),1);ne()});var rc={};Q(rc,{runWizard:()=>Dm});import{createInterface as Pm}from"node:readline";import{readFileSync as nt,writeFileSync as tc,existsSync as H,readdirSync as Mm}from"node:fs";import{execFileSync as Y}from"node:child_process";import{resolve as Te,join as U}from"node:path";import{MongoClient as dr}from"mongodb";function C(t,e=""){let n=e?`${t} [${e}]: `:`${t}: `;return new Promise(s=>{nc.question(n,i=>{s(i.trim()||e)})})}async function B(t,e=!0){return(await C(`${t} (${e?"Y/n":"y/N"})`,e?"y":"n")).toLowerCase().startsWith("y")}function $m(){console.log(""),console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551 Hive Setup Wizard \u2551"),console.log("\u2551 Multi-Agent Slack Orchestration Framework \u2551"),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.log("")}function Z(t){console.log(""),console.log(`\u2500\u2500 ${t} ${"\u2500".repeat(Math.max(0,44-t.length))}`),console.log("")}function sc(){if(!H(os))return{};let t={};for(let e of nt(os,"utf-8").split(`
190
+ `)){let n=e.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s===-1)continue;let i=n.slice(0,s),r=n.slice(s+1);t[i]=r}return t}function Wt(t){let e=["# Hive environment \u2014 generated by setup wizard","# Secrets and API keys. Do not commit this file.",""],n=[{header:"# Slack",keys:["SLACK_APP_TOKEN","SLACK_BOT_TOKEN","SLACK_MCP_TOKEN"]},{header:"# Anthropic",keys:["ANTHROPIC_API_KEY"]},{header:"# SMS (Quo/OpenPhone)",keys:["QUO_API_KEY","QUO_PHONE_NUMBER_ID"]},{header:"# Google",keys:["GOOGLE_ACCOUNT"]},{header:"# Project Management",keys:["LINEAR_API_KEY","CLICKUP_API_TOKEN"]},{header:"# External Communications",keys:["EXTERNAL_COMMS_ENABLED"]}],s=new Set;for(let i of n){let r=[];for(let o of i.keys){s.add(o);let a=t[o];a?r.push(`${o}=${a}`):r.push(`# ${o}=`)}r.some(o=>!o.startsWith("#"))&&(e.push(i.header),e.push(...r),e.push(""))}for(let[i,r]of Object.entries(t))!s.has(i)&&r&&e.push(`${i}=${r}`);tc(os,e.join(`
191
191
  `)+`
192
- `)}function Zl(){return H(ss)?(0,nt.parse)(tt(ss,"utf-8"))??{}:{}}function et(t){Ql(ss,(0,nt.stringify)(t))}function xl(t){return!!(t.business?.name&&t.business?.owner?.name)}function Fl(t){return!!(t.SLACK_APP_TOKEN&&t.SLACK_BOT_TOKEN)}async function Ul(){let t=process.env.MONGODB_DB;if(!t)return!1;try{let e=new ar(process.env.MONGODB_URI??"mongodb://localhost:27017");await e.connect();let s=await e.db(t).collection("agent_definitions").findOne({_id:"chief-of-staff"});return await e.close(),!!s}catch{return!1}}function jl(t){return H(Te(import.meta.dirname,"..","pkg","server.min.js"))?!0:H(Te(t,"dist","index.js"))}async function Lm(t,e,n){ns=U(t,".env"),ss=U(t,"hive.yaml");let s=H(Te(n,"pkg","server.min.js"));Nm();let i=Xl(),r=Zl();r.instance?.id||(r.instance={id:"hive",type:"business"},r.ports=r.ports??{ws:3200,bgTask:3201},et(r));let o=r.instance?.id??"hive";process.env.MONGODB_DB||(process.env.MONGODB_DB=`hive_${o}`);let a=[];if(xl(r)&&a.push("Business info"),Fl(i)&&a.push("Slack"),await Ul()&&a.push("Agent setup"),jl(t)&&a.push("Build"),a.length>0){console.log("Resuming setup. Already completed:");for(let h of a)console.log(` \u2713 ${h}`);console.log("")}else console.log("This wizard will configure Hive for your business."),console.log("Progress is saved after each section \u2014 you can quit and resume anytime."),console.log(""),await P("Press Enter to begin...");if(xl(r)?(console.log(`Business: ${r.business.name} (${r.business.owner.name}, ${r.business.owner.role})`),await B("Redo business info?",!1)?await Yl(r):console.log(" \u2713 Skipped")):await Yl(r),Fl(i)?(console.log("Slack: \u2713 tokens configured"),await B("Redo Slack setup?",!1)?await Hl(i,n):console.log(" \u2713 Skipped")):await Hl(i,n),Z("Anthropic"),i.ANTHROPIC_API_KEY?(console.log("Anthropic API key: \u2713 configured"),await B("Change it?",!1)?await Gl(i):console.log(" \u2713 Skipped")):(console.log("Your Claude CLI session is already authenticated \u2014 Hive's Agent SDK"),console.log("will use that automatically. No API key needed."),console.log(""),await B("Use a separate API key instead?",!1)?await Gl(i):(console.log(" \u2713 Using existing Claude authentication"),Gt(i))),Z("Optional Integrations"),console.log(`These can be added later. Press Enter to skip any.
193
- `),await B("Enable SMS via Quo (OpenPhone)?",!1)){console.log("Get your API key from: Quo workspace settings \u2192 API tab"),i.QUO_API_KEY=await P("Quo API Key",i.QUO_API_KEY||""),i.QUO_PHONE_NUMBER_ID=await P("Default Phone Number ID (PNxxx)",i.QUO_PHONE_NUMBER_ID||"");let h=[],y={};if(await B("Configure named phone lines?",!1)){let m=!0;for(;m;){let w=await P("Line name (e.g. main, personal)"),v=await P("Phone Number ID (PNxxx)"),A=await P("Phone number (e.g. (555) 123-4567)"),_=await P("Label (e.g. Jane's Line)"),E=await P("Slack channel for incoming SMS",`sms-${w}`);y[w]={id:v,number:A,label:_},h.push({id:v,label:_,number:A,slackChannel:E}),m=await B("Add another line?",!1)}}h.length>0&&(r.sms={lines:h}),Object.keys(y).length>0&&(r.quo={lines:y})}if(await B("Enable Google Gmail/Calendar integration?",!1)){let h=!1;try{Y("which",["gog"],{stdio:"pipe"}),h=!0,console.log(" \u2713 gog CLI found")}catch{console.log(" gog CLI not found. Installing via Homebrew...");try{Y("brew",["install","gog"],{stdio:"inherit"}),h=!0,console.log(" \u2713 gog CLI installed")}catch{console.log(" \u26A0 Failed to install gog. Install manually: brew install gog")}}if(h){try{let p=Y("gog",["auth","list"],{encoding:"utf-8",stdio:"pipe"}).trim();p&&!p.includes("no accounts")&&(console.log(`
192
+ `)}function ic(){return H(as)?(0,st.parse)(nt(as,"utf-8"))??{}:{}}function Jt(t){tc(as,(0,st.stringify)(t))}function Hl(t){return!!(t.business?.name&&t.business?.owner?.name)}function Gl(t){return!!(t.SLACK_APP_TOKEN&&t.SLACK_BOT_TOKEN)}async function Vl(){let t=process.env.MONGODB_DB;if(!t)return!1;try{let e=new dr(process.env.MONGODB_URI??"mongodb://localhost:27017");await e.connect();let s=await e.db(t).collection("agent_definitions").findOne({_id:"chief-of-staff"});return await e.close(),!!s}catch{return!1}}function Wl(t){return H(Te(import.meta.dirname,"..","pkg","server.min.js"))?!0:H(Te(t,"dist","index.js"))}async function Dm(t,e,n){os=U(t,".env"),as=U(t,"hive.yaml");let s=H(Te(n,"pkg","server.min.js"));$m();let i=sc(),r=ic(),o=r.instance?.id;o||(console.error("Error: hive.yaml is missing instance.id. Re-run 'hive init'."),process.exit(1)),process.env.MONGODB_DB||(process.env.MONGODB_DB=`hive_${o}`);let a=[];if(Hl(r)&&a.push("Business info"),Gl(i)&&a.push("Slack"),await Vl()&&a.push("Agent setup"),Wl(t)&&a.push("Build"),a.length>0){console.log("Resuming setup. Already completed:");for(let h of a)console.log(` \u2713 ${h}`);console.log("")}else console.log("This wizard will configure Hive for your business."),console.log("Progress is saved after each section \u2014 you can quit and resume anytime."),console.log(""),await C("Press Enter to begin...");if(Hl(r)?(console.log(`Business: ${r.business.name} (${r.business.owner.name}, ${r.business.owner.role})`),await B("Redo business info?",!1)?await Jl(r):console.log(" \u2713 Skipped")):await Jl(r),Gl(i)?(console.log("Slack: \u2713 tokens configured"),await B("Redo Slack setup?",!1)?await Ql(i,n):console.log(" \u2713 Skipped")):await Ql(i,n),Z("Anthropic"),i.ANTHROPIC_API_KEY?(console.log("Anthropic API key: \u2713 configured"),await B("Change it?",!1)?await zl(i):console.log(" \u2713 Skipped")):(console.log("Your Claude CLI session is already authenticated \u2014 Hive's Agent SDK"),console.log("will use that automatically. No API key needed."),console.log(""),await B("Use a separate API key instead?",!1)?await zl(i):(console.log(" \u2713 Using existing Claude authentication"),Wt(i))),Z("Optional Integrations"),console.log(`These can be added later. Press Enter to skip any.
193
+ `),await B("Enable SMS via Quo (OpenPhone)?",!1)){console.log("Get your API key from: Quo workspace settings \u2192 API tab"),i.QUO_API_KEY=await C("Quo API Key",i.QUO_API_KEY||""),i.QUO_PHONE_NUMBER_ID=await C("Default Phone Number ID (PNxxx)",i.QUO_PHONE_NUMBER_ID||"");let h=[],y={};if(await B("Configure named phone lines?",!1)){let m=!0;for(;m;){let S=await C("Line name (e.g. main, personal)"),v=await C("Phone Number ID (PNxxx)"),A=await C("Phone number (e.g. (555) 123-4567)"),_=await C("Label (e.g. Jane's Line)"),E=await C("Slack channel for incoming SMS",`sms-${S}`);y[S]={id:v,number:A,label:_},h.push({id:v,label:_,number:A,slackChannel:E}),m=await B("Add another line?",!1)}}h.length>0&&(r.sms={lines:h}),Object.keys(y).length>0&&(r.quo={lines:y})}if(await B("Enable Google Gmail/Calendar integration?",!1)){let h=!1;try{Y("which",["gog"],{stdio:"pipe"}),h=!0,console.log(" \u2713 gog CLI found")}catch{console.log(" gog CLI not found. Installing via Homebrew...");try{Y("brew",["install","gog"],{stdio:"inherit"}),h=!0,console.log(" \u2713 gog CLI installed")}catch{console.log(" \u26A0 Failed to install gog. Install manually: brew install gog")}}if(h){try{let p=Y("gog",["auth","list"],{encoding:"utf-8",stdio:"pipe"}).trim();p&&!p.includes("no accounts")&&(console.log(`
194
194
  Authenticated accounts:`),console.log(` ${p.replace(/\n/g,`
195
- `)}`))}catch{}if(console.log(""),await B("Authenticate a Google account now?",!0)){let p=!0;for(;p;){let m=await P("Google account email");console.log(`
195
+ `)}`))}catch{}if(console.log(""),await B("Authenticate a Google account now?",!0)){let p=!0;for(;p;){let m=await C("Google account email");console.log(`
196
196
  Opening browser for ${m}...`),console.log(` Complete the OAuth flow in your browser, then come back here.
197
- `);try{Y("gog",["auth","add",m],{stdio:"inherit"}),console.log(` \u2713 ${m} authenticated`)}catch{console.log(` \u26A0 Authentication failed for ${m}. You can retry later: gog auth add ${m}`)}p=await B("Authenticate another Google account?",!1)}}if(i.GOOGLE_ACCOUNT=await P("Primary Google account for Hive",i.GOOGLE_ACCOUNT||""),i.GOOGLE_ACCOUNT)try{Y("gog",["gmail","search","is:unread","-a",i.GOOGLE_ACCOUNT,"--json","--results-only","--no-input"],{encoding:"utf-8",timeout:15e3}),console.log(` \u2713 Gmail access verified for ${i.GOOGLE_ACCOUNT}`)}catch{console.log(" \u26A0 Could not verify Gmail access \u2014 check authentication later")}}}if(await B("Enable project management integration?",!1)){let h=await P("Which system? (linear / clickup)","");h.toLowerCase().startsWith("l")?(i.LINEAR_API_KEY=await P("Linear API Key",i.LINEAR_API_KEY||""),console.log(" Get it from: Linear \u2192 Settings \u2192 API \u2192 Personal API Keys")):h.toLowerCase().startsWith("c")?(i.CLICKUP_API_TOKEN=await P("ClickUp API Token",i.CLICKUP_API_TOKEN||""),console.log(" Get it from: ClickUp \u2192 Settings \u2192 Apps \u2192 API Token")):console.log(" Skipped \u2014 you can configure this in .env later.")}Gt(i),et(r),console.log(`
198
- \u2713 Configuration saved (.env + hive.yaml)`),Z("Plugins");let u=U(t,"plugins");if(H(u)){let h=Tm(u).filter(y=>H(U(u,y,"plugin.yaml")));if(h.length>0){console.log(`Available plugins:
199
- `);for(let m of h){let w=(0,nt.parse)(tt(U(u,m,"plugin.yaml"),"utf-8"));console.log(` ${m} \u2014 ${w.description??"(no description)"}`)}console.log("");let y=(r.plugins??[]).join(", ")||"none",p=await P("Which plugins to enable? (comma-separated, or 'none')",y);p.toLowerCase()!=="none"?r.plugins=p.split(",").map(m=>m.trim()).filter(Boolean):r.plugins=[]}else console.log("No plugins found in plugins/ directory."),r.plugins=[]}else console.log("No plugins/ directory found."),r.plugins=[];if(et(r),await Ul()?(console.log(`
200
- Chief of Staff agent: \u2713 already set up`),await B("Regenerate agent from template?",!1)?await Vl(r):console.log(" \u2713 Skipped")):await Vl(r),await Cm(r),Z("Memory (MongoDB)"),await Pm(r,e),s||(Z("Build"),jl(t)?(console.log("Build output exists."),await B("Rebuild?",!0)?await Wl(n):console.log(" \u2713 Skipped")):await Wl(n)),!s){Z("Deploy");let h=U(process.env.HOME??"/tmp","services","hive");H(U(h,"package.json"))?(console.log(`Deploy directory exists: ${h}`),await B("Sync latest build and config?",!0)?await Jl(h,n):console.log(" \u2713 Skipped")):(console.log("Hive runs from a separate deploy directory (not this dev repo)."),console.log(` Dev: ${n}`),console.log(` Deploy: ${h}`),console.log(""),await B("Set up the deploy directory now?",!0)&&await Jl(h,n))}if(Z("Service"),await B("Install Hive as a LaunchAgent (starts on login)?"))try{let{startDaemon:h}=await Promise.resolve().then(()=>(Ht(),ts));await h(n)}catch(h){console.log(` \u26A0 Service installation failed: ${h}`),console.log(" You can start manually: hive start")}console.log(""),console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551 Hive is ready! \u2551"),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.log(""),console.log("Quick reference:"),console.log(` Config dir: ${t}`),console.log(" Start: hive start"),console.log(" Daemon: hive start --daemon"),console.log(" Stop: hive stop"),console.log(" Health: hive doctor"),s||console.log(` Dev mode: npm run dev (from ${n})`),console.log(""),console.log("Your chief-of-staff agent is stored in the agent_definitions collection."),console.log("Additional agents can be created through the chief of staff."),console.log(""),zl.close()}async function Yl(t){Z("Your Business");let e=await P("Business name",t.business?.name||""),n=await P("What does your business do? (one sentence)",t.business?.description||""),s=await P("Location (city, state)",t.business?.location||""),i=await P("Timezone (e.g. America/New_York)",t.business?.timezone||""),r=await P("Business hours (e.g. 9 AM - 5 PM)",t.business?.businessHours||"9 AM - 5 PM"),o=await P("Your name",t.business?.owner?.name||""),a=await P("Your role",t.business?.owner?.role||"CEO");t.business={name:e,description:n,...s?{location:s}:{},...i?{timezone:i}:{},businessHours:r,owner:{name:o,role:a}},et(t),console.log(`
201
- \u2713 Business info saved (hive.yaml)`)}async function Hl(t,e){Z("Slack App Setup"),console.log("You need a Slack app with Socket Mode enabled."),console.log(""),console.log("1. Go to: https://api.slack.com/apps");try{Y("open",["https://api.slack.com/apps"],{stdio:"pipe"})}catch{}console.log('2. Click "Create New App" \u2192 "From a manifest"'),console.log("3. Select your workspace"),console.log("4. Choose YAML format and paste this manifest:"),console.log(""),console.log("\u2500\u2500\u2500 Copy everything below this line \u2500\u2500\u2500");let n=H(Te(e,"pkg","setup","slack-manifest.yaml"))?Te(e,"pkg","setup","slack-manifest.yaml"):Te(e,"setup","slack-manifest.yaml");if(console.log(tt(n,"utf-8")),console.log("\u2500\u2500\u2500 Copy everything above this line \u2500\u2500\u2500"),console.log(""),console.log('5. Click "Create"'),console.log('6. Go to "Install App" \u2192 Install to workspace'),console.log(""),await P("Press Enter when your app is created and installed..."),console.log(""),console.log("Now collect your tokens:"),console.log(""),console.log('App-Level Token: Go to "Basic Information" \u2192 "App-Level Tokens"'),console.log(' \u2192 "Generate Token and Scopes" \u2192 add scope "connections:write"'),t.SLACK_APP_TOKEN=await P("App-Level Token (xapp-...)",t.SLACK_APP_TOKEN||""),console.log(""),console.log('Bot Token: Go to "OAuth & Permissions" \u2192 "Bot User OAuth Token"'),t.SLACK_BOT_TOKEN=await P("Bot Token (xoxb-...)",t.SLACK_BOT_TOKEN||""),console.log(""),await B("Do you have a Slack MCP user token (xoxp-...)? (for Slack search)",!1)&&(t.SLACK_MCP_TOKEN=await P("Slack MCP Token (xoxp-...)",t.SLACK_MCP_TOKEN||"")),t.SLACK_APP_TOKEN&&t.SLACK_BOT_TOKEN)try{let r=await(await fetch("https://slack.com/api/auth.test",{headers:{Authorization:`Bearer ${t.SLACK_BOT_TOKEN}`}})).json();r.ok?console.log(`
197
+ `);try{Y("gog",["auth","add",m],{stdio:"inherit"}),console.log(` \u2713 ${m} authenticated`)}catch{console.log(` \u26A0 Authentication failed for ${m}. You can retry later: gog auth add ${m}`)}p=await B("Authenticate another Google account?",!1)}}if(i.GOOGLE_ACCOUNT=await C("Primary Google account for Hive",i.GOOGLE_ACCOUNT||""),i.GOOGLE_ACCOUNT)try{Y("gog",["gmail","search","is:unread","-a",i.GOOGLE_ACCOUNT,"--json","--results-only","--no-input"],{encoding:"utf-8",timeout:15e3}),console.log(` \u2713 Gmail access verified for ${i.GOOGLE_ACCOUNT}`)}catch{console.log(" \u26A0 Could not verify Gmail access \u2014 check authentication later")}}}if(await B("Enable project management integration?",!1)){let h=await C("Which system? (linear / clickup)","");h.toLowerCase().startsWith("l")?(i.LINEAR_API_KEY=await C("Linear API Key",i.LINEAR_API_KEY||""),console.log(" Get it from: Linear \u2192 Settings \u2192 API \u2192 Personal API Keys")):h.toLowerCase().startsWith("c")?(i.CLICKUP_API_TOKEN=await C("ClickUp API Token",i.CLICKUP_API_TOKEN||""),console.log(" Get it from: ClickUp \u2192 Settings \u2192 Apps \u2192 API Token")):console.log(" Skipped \u2014 you can configure this in .env later.")}Wt(i),Jt(r),console.log(`
198
+ \u2713 Configuration saved (.env + hive.yaml)`),Z("Plugins");let u=U(t,"plugins");if(H(u)){let h=Mm(u).filter(y=>H(U(u,y,"plugin.yaml")));if(h.length>0){console.log(`Available plugins:
199
+ `);for(let m of h){let S=(0,st.parse)(nt(U(u,m,"plugin.yaml"),"utf-8"));console.log(` ${m} \u2014 ${S.description??"(no description)"}`)}console.log("");let y=(r.plugins??[]).join(", ")||"none",p=await C("Which plugins to enable? (comma-separated, or 'none')",y);p.toLowerCase()!=="none"?r.plugins=p.split(",").map(m=>m.trim()).filter(Boolean):r.plugins=[]}else console.log("No plugins found in plugins/ directory."),r.plugins=[]}else console.log("No plugins/ directory found."),r.plugins=[];if(Jt(r),await Vl()?(console.log(`
200
+ Chief of Staff agent: \u2713 already set up`),await B("Regenerate agent from template?",!1)?await Xl(r):console.log(" \u2713 Skipped")):await Xl(r),await qm(r),Z("Memory (MongoDB)"),await Rm(r,e),s||(Z("Build"),Wl(t)?(console.log("Build output exists."),await B("Rebuild?",!0)?await Zl(n):console.log(" \u2713 Skipped")):await Zl(n)),!s){Z("Deploy");let h=U(process.env.HOME??"/tmp","services","hive");H(U(h,"package.json"))?(console.log(`Deploy directory exists: ${h}`),await B("Sync latest build and config?",!0)?await ec(h,n):console.log(" \u2713 Skipped")):(console.log("Hive runs from a separate deploy directory (not this dev repo)."),console.log(` Dev: ${n}`),console.log(` Deploy: ${h}`),console.log(""),await B("Set up the deploy directory now?",!0)&&await ec(h,n))}if(Z("Service"),await B("Install Hive as a LaunchAgent (starts on login)?"))try{let{startDaemon:h}=await Promise.resolve().then(()=>(Vt(),rs));await h(n)}catch(h){console.log(` \u26A0 Service installation failed: ${h}`),console.log(" You can start manually: hive start")}console.log(""),console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551 Hive is ready! \u2551"),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.log(""),console.log("Quick reference:"),console.log(` Config dir: ${t}`),console.log(" Start: hive start"),console.log(" Daemon: hive start --daemon"),console.log(" Stop: hive stop"),console.log(" Health: hive doctor"),s||console.log(` Dev mode: npm run dev (from ${n})`),console.log(""),console.log("Your chief-of-staff agent is stored in the agent_definitions collection."),console.log("Additional agents can be created through the chief of staff."),console.log(""),nc.close()}async function Jl(t){Z("Your Business");let e=await C("Business name",t.business?.name||""),n=await C("What does your business do? (one sentence)",t.business?.description||""),s=await C("Location (city, state)",t.business?.location||""),i=await C("Timezone (e.g. America/New_York)",t.business?.timezone||""),r=await C("Business hours (e.g. 9 AM - 5 PM)",t.business?.businessHours||"9 AM - 5 PM"),o=await C("Your name",t.business?.owner?.name||""),a=await C("Your role",t.business?.owner?.role||"CEO");t.business={name:e,description:n,...s?{location:s}:{},...i?{timezone:i}:{},businessHours:r,owner:{name:o,role:a}},Jt(t),console.log(`
201
+ \u2713 Business info saved (hive.yaml)`)}async function Ql(t,e){Z("Slack App Setup"),console.log("You need a Slack app with Socket Mode enabled."),console.log(""),console.log("1. Go to: https://api.slack.com/apps");try{Y("open",["https://api.slack.com/apps"],{stdio:"pipe"})}catch{}console.log('2. Click "Create New App" \u2192 "From a manifest"'),console.log("3. Select your workspace"),console.log("4. Choose YAML format and paste this manifest:"),console.log(""),console.log("\u2500\u2500\u2500 Copy everything below this line \u2500\u2500\u2500");let n=H(Te(e,"pkg","setup","slack-manifest.yaml"))?Te(e,"pkg","setup","slack-manifest.yaml"):Te(e,"setup","slack-manifest.yaml");if(console.log(nt(n,"utf-8")),console.log("\u2500\u2500\u2500 Copy everything above this line \u2500\u2500\u2500"),console.log(""),console.log('5. Click "Create"'),console.log('6. Go to "Install App" \u2192 Install to workspace'),console.log(""),await C("Press Enter when your app is created and installed..."),console.log(""),console.log("Now collect your tokens:"),console.log(""),console.log('App-Level Token: Go to "Basic Information" \u2192 "App-Level Tokens"'),console.log(' \u2192 "Generate Token and Scopes" \u2192 add scope "connections:write"'),t.SLACK_APP_TOKEN=await C("App-Level Token (xapp-...)",t.SLACK_APP_TOKEN||""),console.log(""),console.log('Bot Token: Go to "OAuth & Permissions" \u2192 "Bot User OAuth Token"'),t.SLACK_BOT_TOKEN=await C("Bot Token (xoxb-...)",t.SLACK_BOT_TOKEN||""),console.log(""),await B("Do you have a Slack MCP user token (xoxp-...)? (for Slack search)",!1)&&(t.SLACK_MCP_TOKEN=await C("Slack MCP Token (xoxp-...)",t.SLACK_MCP_TOKEN||"")),t.SLACK_APP_TOKEN&&t.SLACK_BOT_TOKEN)try{let r=await(await fetch("https://slack.com/api/auth.test",{headers:{Authorization:`Bearer ${t.SLACK_BOT_TOKEN}`}})).json();r.ok?console.log(`
202
202
  \u2713 Slack connected as: ${r.user} in ${r.team}`):(console.log(`
203
203
  \u26A0 Slack token test failed: ${r.error}`),console.log(" You can fix this in .env later."))}catch{console.log(`
204
- \u26A0 Could not validate Slack token (no network?)`)}Gt(t);try{t.SLACK_APP_TOKEN&&Y("honeypot",["set","SLACK_APP_TOKEN",t.SLACK_APP_TOKEN],{stdio:["pipe","pipe","pipe"]}),t.SLACK_BOT_TOKEN&&Y("honeypot",["set","SLACK_BOT_TOKEN",t.SLACK_BOT_TOKEN],{stdio:["pipe","pipe","pipe"]})}catch{}console.log(" \u2713 Slack tokens saved (.env)")}async function Gl(t){console.log("Get your API key from: https://console.anthropic.com/settings/keys"),console.log(""),t.ANTHROPIC_API_KEY=await P("Anthropic API Key (sk-ant-...)",t.ANTHROPIC_API_KEY||""),Gt(t);try{t.ANTHROPIC_API_KEY&&Y("honeypot",["set","ANTHROPIC_API_KEY",t.ANTHROPIC_API_KEY],{stdio:["pipe","pipe","pipe"]})}catch{}console.log(" \u2713 Anthropic key saved (.env)")}async function Vl(t){Z("Chief of Staff Agent"),console.log("Hive starts with a Chief of Staff \u2014 your primary agent."),console.log(`Additional agents are created through it as needed.
205
- `);let e=await P("Name your Chief of Staff","Chief"),n=await P("Slack channel for your CoS",`agent-${e.toLowerCase()}`);t.agents||(t.agents={}),t.agents["chief-of-staff"]={name:e},et(t);let s=Te(Fr,"chief-of-staff","agent.yaml");if(!H(s)){console.log(` \u26A0 Seed not found: ${s}`),console.log(" You can seed the agent manually later.");return}let i=(0,nt.parse)(tt(s,"utf-8"));i.name=e,i.channels=[n];let r=process.env.MONGODB_URI||"mongodb://localhost:27017",a=Zl().instance?.id??"hive",l=process.env.MONGODB_DB||`hive_${a}`;try{let c=new ar(r);await c.connect();let u=c.db(l).collection("agent_definitions");if(await u.findOne({_id:i._id}))console.log(` Agent "${i._id}" already exists in DB \u2014 updating name and channel.`),await u.updateOne({_id:i._id},{$set:{name:e,channels:[n],updatedAt:new Date,updatedBy:"setup-wizard"}});else{let h=new Date;await u.insertOne({...i,createdAt:h,updatedAt:h,updatedBy:"setup-wizard"})}await c.close(),console.log(` \u2713 ${e} (Chief of Staff) seeded to MongoDB`)}catch(c){console.log(` \u26A0 Failed to seed agent: ${c}`),console.log(" Make sure MongoDB is running (brew services start mongodb-community)")}}async function Cm(t){Z("Constitution \u2014 Chief of Staff Permissions");let e=t.agents?.["chief-of-staff"]?.name??"Chief of Staff",n=t.business?.owner?.name??"you",s=Object.keys(t.agents??{}).length>1;console.log("The constitution defines what your agents can and can't do."),console.log(`Since ${e} is your only agent right now, we need to decide`),console.log(`what permissions to grant.
204
+ \u26A0 Could not validate Slack token (no network?)`)}Wt(t);try{t.SLACK_APP_TOKEN&&Y("honeypot",["set","SLACK_APP_TOKEN",t.SLACK_APP_TOKEN],{stdio:["pipe","pipe","pipe"]}),t.SLACK_BOT_TOKEN&&Y("honeypot",["set","SLACK_BOT_TOKEN",t.SLACK_BOT_TOKEN],{stdio:["pipe","pipe","pipe"]})}catch{}console.log(" \u2713 Slack tokens saved (.env)")}async function zl(t){console.log("Get your API key from: https://console.anthropic.com/settings/keys"),console.log(""),t.ANTHROPIC_API_KEY=await C("Anthropic API Key (sk-ant-...)",t.ANTHROPIC_API_KEY||""),Wt(t);try{t.ANTHROPIC_API_KEY&&Y("honeypot",["set","ANTHROPIC_API_KEY",t.ANTHROPIC_API_KEY],{stdio:["pipe","pipe","pipe"]})}catch{}console.log(" \u2713 Anthropic key saved (.env)")}async function Xl(t){Z("Chief of Staff Agent"),console.log("Hive starts with a Chief of Staff \u2014 your primary agent."),console.log(`Additional agents are created through it as needed.
205
+ `);let e=await C("Name your Chief of Staff","Chief"),n=await C("Slack channel for your CoS",`agent-${e.toLowerCase()}`);t.agents||(t.agents={}),t.agents["chief-of-staff"]={name:e},Jt(t);let s=Te($l,"chief-of-staff","agent.yaml");if(!H(s)){console.log(` \u26A0 Seed not found: ${s}`),console.log(" You can seed the agent manually later.");return}let i=(0,st.parse)(nt(s,"utf-8"));i.name=e,i.channels=[n];let r=process.env.MONGODB_URI||"mongodb://localhost:27017",a=ic().instance?.id??"hive",l=process.env.MONGODB_DB||`hive_${a}`;try{let c=new dr(r);await c.connect();let u=c.db(l).collection("agent_definitions");if(await u.findOne({_id:i._id}))console.log(` Agent "${i._id}" already exists in DB \u2014 updating name and channel.`),await u.updateOne({_id:i._id},{$set:{name:e,channels:[n],updatedAt:new Date,updatedBy:"setup-wizard"}});else{let h=new Date;await u.insertOne({...i,createdAt:h,updatedAt:h,updatedBy:"setup-wizard"})}await c.close(),console.log(` \u2713 ${e} (Chief of Staff) seeded to MongoDB`)}catch(c){console.log(` \u26A0 Failed to seed agent: ${c}`),console.log(" Make sure MongoDB is running (brew services start mongodb-community)")}}async function qm(t){Z("Constitution \u2014 Chief of Staff Permissions");let e=t.agents?.["chief-of-staff"]?.name??"Chief of Staff",n=t.business?.owner?.name??"you",s=Object.keys(t.agents??{}).length>1;console.log("The constitution defines what your agents can and can't do."),console.log(`Since ${e} is your only agent right now, we need to decide`),console.log(`what permissions to grant.
206
206
  `),t.constitution||(t.constitution={}),console.log("\u2500\u2500 Agent definitions (agent_definitions collection)"),console.log(`${e} can create new agents, edit their personality and config,`),console.log(`and manage the team roster.
207
207
  `),t.constitution.cosCanManageAgents=!0,console.log(` \u2713 ${e} can manage agent definitions
208
208
  `),console.log(`
209
209
  \u2500\u2500 External communications (email, SMS)`),console.log("This is a hard gate \u2014 when off, email and SMS tools are completely"),console.log(`removed from all agents. Not just a policy, they literally can't send.
210
210
  `),console.log("Default: OFF. You can enable later by setting EXTERNAL_COMMS_ENABLED=true"),console.log(`in .env and restarting Hive.
211
- `),t.constitution.cosCanContactExternal=await B("Enable external communications now?",!1);let i=Xl();t.constitution.cosCanContactExternal?(i.EXTERNAL_COMMS_ENABLED="true",console.log(" \u2713 External comms enabled \u2014 email/SMS tools available"),console.log(` (sensitive topics still escalate to ${n} per constitution)`)):(i.EXTERNAL_COMMS_ENABLED="",console.log(" \u2717 External comms disabled \u2014 no agent can send email or SMS"),console.log(" To enable later: set EXTERNAL_COMMS_ENABLED=true in .env")),Gt(i),console.log(`
212
- \u2500\u2500 Summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(" Agent management: \u2713 yes"),console.log(` External communications: ${t.constitution.cosCanContactExternal?"\u2713 yes":"\u2717 no"}`),console.log(" Hive build & deploy: \u2717 no (external provisioning only)"),console.log(" Hive source code: \u2717 no (external provisioning only)"),et(t),console.log(`
213
- \u2713 Constitution preferences saved (hive.yaml)`)}async function Pm(t,e){let n=process.env.MONGODB_URI||"mongodb://localhost:27017",s=process.env.MONGODB_DB;console.log("Seeding shared memory to MongoDB...");try{let i=new ar(n);await i.connect();let o=i.db(s).collection("memory");await o.createIndex({path:1},{unique:!0});let a=t.business??{},l=[`# Business Context
211
+ `),t.constitution.cosCanContactExternal=await B("Enable external communications now?",!1);let i=sc();t.constitution.cosCanContactExternal?(i.EXTERNAL_COMMS_ENABLED="true",console.log(" \u2713 External comms enabled \u2014 email/SMS tools available"),console.log(` (sensitive topics still escalate to ${n} per constitution)`)):(i.EXTERNAL_COMMS_ENABLED="",console.log(" \u2717 External comms disabled \u2014 no agent can send email or SMS"),console.log(" To enable later: set EXTERNAL_COMMS_ENABLED=true in .env")),Wt(i),console.log(`
212
+ \u2500\u2500 Summary \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(" Agent management: \u2713 yes"),console.log(` External communications: ${t.constitution.cosCanContactExternal?"\u2713 yes":"\u2717 no"}`),console.log(" Hive build & deploy: \u2717 no (external provisioning only)"),console.log(" Hive source code: \u2717 no (external provisioning only)"),Jt(t),console.log(`
213
+ \u2713 Constitution preferences saved (hive.yaml)`)}async function Rm(t,e){let n=process.env.MONGODB_URI||"mongodb://localhost:27017",s=process.env.MONGODB_DB;console.log("Seeding shared memory to MongoDB...");try{let i=new dr(n);await i.connect();let o=i.db(s).collection("memory");await o.createIndex({path:1},{unique:!0});let a=t.business??{},l=[`# Business Context
214
214
  `,`**Company:** ${a.name??""}`,`**About:** ${a.description??""}`,a.location?`**Location:** ${a.location}`:"",a.timezone?`**Timezone:** ${a.timezone}`:"",a.businessHours?`**Business Hours:** ${a.businessHours}${a.timezone?` (${a.timezone})`:""}`:"",`**Owner:** ${a.owner?.name??""} (${a.owner?.role??""})`,"","## Additional Context","(Add more details about your business here \u2014 products, services, team, etc.)"].filter(Boolean).join(`
215
- `);await o.updateOne({path:"shared/business-context.md"},{$set:{content:l,updatedAt:new Date,updatedBy:"setup-wizard"}},{upsert:!0}),console.log(" \u2713 shared/business-context.md");let c=U(e,"constitution.md.tpl");if(H(c)){let f=tt(c,"utf-8"),u={};for(let[y,p]of Object.entries(t.agents??{}))u[y]=p.name??y;let h=Dl(f,{business:a,team:u});await o.updateOne({path:"shared/constitution.md"},{$set:{content:h,updatedAt:new Date,updatedBy:"setup-wizard"}},{upsert:!0}),console.log(" \u2713 shared/constitution.md")}await i.close(),console.log(" \u2713 Memory seeded to MongoDB")}catch(i){console.log(` \u26A0 Failed to seed memory: ${i}`),console.log(" Make sure MongoDB is running (brew services start mongodb-community)")}}async function Wl(t){console.log(" Compiling TypeScript...");try{Y("npm",["run","build"],{cwd:t,stdio:"pipe"}),console.log(" \u2713 Build complete")}catch(e){console.log(" \u26A0 Build failed:"),console.log(String(e))}}async function Jl(t,e){let{mkdirSync:n}=await import("node:fs");if(H(U(t,"package.json"))){console.log(" Pulling latest...");try{Y("git",["pull","--ff-only"],{cwd:t,stdio:"inherit"})}catch{console.log(" \u26A0 git pull failed \u2014 continuing with existing code")}}else{console.log(" Cloning repository...");let o=Te(t,"..");n(o,{recursive:!0});let a=Y("git",["remote","get-url","origin"],{cwd:e,encoding:"utf-8"}).trim();Y("git",["clone",a,t],{stdio:"inherit"}),console.log(" \u2713 Repository cloned")}console.log(" Installing production dependencies..."),Y("npm",["install","--omit=dev"],{cwd:t,stdio:"pipe"}),console.log(" \u2713 Dependencies installed"),console.log(" Syncing config and build output...");let s=U(e,".env");if(H(s)){let{copyFileSync:o}=await import("node:fs");o(s,U(t,".env")),console.log(" \u2713 .env")}let i=U(e,"hive.yaml");if(H(i)){let{copyFileSync:o}=await import("node:fs");o(i,U(t,"hive.yaml")),console.log(" \u2713 hive.yaml")}let r=U(e,"dist");H(r)&&(Y("rsync",["-a","--delete",`${r}/`,`${U(t,"dist")}/`],{stdio:"pipe"}),console.log(" \u2713 dist/")),n(U(t,"logs"),{recursive:!0}),console.log(`
216
- \u2713 Deploy directory ready: ${t}`)}var nt,ns,ss,zl,tc=C(()=>{"use strict";nt=me(Ie(),1);ql();ee();ns="",ss="",zl=Im({input:process.stdin,output:process.stdout})});var nc={};Q(nc,{runSetupWizard:()=>Dm});import{mkdirSync as Mm,existsSync as $m}from"node:fs";import{resolve as lr}from"node:path";async function Dm(t){console.log(`
217
- Hive Setup Wizard`),console.log(`Home directory: ${T}
218
- `),Mm(T,{recursive:!0}),await Yr();let e=$m(lr(t,"templates"))?lr(t,"templates"):lr(t,"setup","templates");console.log(`
219
- Setup will write config to: ${T}`),console.log(`Templates from: ${e}
220
- `),process.env.HIVE_HOME=T;let{runWizard:n}=await Promise.resolve().then(()=>(tc(),ec));await n(T,e,t)}var sc=C(()=>{"use strict";ee();Hr()});var oc={};Q(oc,{showStatus:()=>Bm});import{execFileSync as ic}from"node:child_process";import{existsSync as qm,readFileSync as Rm}from"node:fs";import{resolve as Km}from"node:path";async function Bm(){console.log(`Hive home: ${T}`);let t=Km(T,process.env.HIVE_CONFIG??"hive.yaml");if(!qm(t)){console.log("Status: not initialized (run 'hive init')");return}let n=((0,rc.parse)(Rm(t,"utf-8"))??{}).instance?.id??"hive",s=`com.hive.${n}.agent`;console.log(`Instance: ${n}`);try{let r=ic("launchctl",["list"],{encoding:"utf-8"}).split(`
221
- `).find(o=>o.includes(s));if(r){let o=r.trim().split(/\s+/),a=o[0],l=o[1];console.log(`Service: running (PID ${a}, last exit ${l})`)}else console.log("Service: not running")}catch{console.log("Service: unknown (could not query launchctl)")}try{ic("mongosh",["--eval","db.runCommand({ping:1})","--quiet"],{encoding:"utf-8",timeout:5e3}),console.log("MongoDB: connected")}catch{console.log("MongoDB: not reachable")}}var rc,ac=C(()=>{"use strict";rc=me(Ie(),1);ee()});var cc={};Q(cc,{runUpdate:()=>Fm});import{execFileSync as lc}from"node:child_process";import{resolve as xm}from"node:path";async function Fm(){console.log("Stopping Hive..."),await or(),console.log("Updating @keepur/hive...");try{lc("npm",["update","-g","@keepur/hive"],{stdio:"inherit"}),console.log("Update complete.")}catch{console.error("Update failed."),process.exit(1)}let t=lc("npm",["root","-g"],{encoding:"utf-8"}).trim(),e=xm(t,"@keepur","hive");console.log("Restarting Hive..."),await rr(e)}var uc=C(()=>{"use strict";Ht()});import{execFileSync as cr}from"node:child_process";import{existsSync as Um,readFileSync as dc}from"node:fs";import{resolve as jm}from"node:path";function Vt(t){try{return cr("which",[t],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function pc(t){try{return cr("brew",["services","list"],{encoding:"utf-8"}).split(`
222
- `).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function ur(t,e=1500){try{let n=new AbortController,s=setTimeout(()=>n.abort(),e),i=await fetch(t,{signal:n.signal});return clearTimeout(s),i.ok}catch{return!1}}function hc(t){let e=dc(t,"utf-8"),n=new Set;for(let s of e.matchAll(/\brequired\(\s*"([A-Z0-9_]+)"\s*\)/g))n.add(s[1]);return[...n].sort()}function mc(t){let e=process.getuid?.();if(e===void 0)return{loaded:!1,state:"unknown",pid:null};try{let n=cr("launchctl",["print",`gui/${e}/${t}`],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),s=n.match(/state\s*=\s*([^\n]+?)\s*$/m),i=n.match(/pid\s*=\s*(\d+)/),r=s?.[1];return{loaded:!0,state:r==="running"?"running":r==="not running"?"not running":"unknown",pid:i?parseInt(i[1],10):null}}catch{return{loaded:!1,state:"unknown",pid:null}}}function gc(t){try{return process.kill(t,0),!0}catch{return!1}}async function yc(t,e,n=2e3){let{MongoClient:s}=await import("mongodb"),i=new s(t,{serverSelectionTimeoutMS:n});try{return await i.connect(),await i.db(e).command({ping:1}),!0}catch{return!1}finally{await i.close().catch(()=>{})}}async function Sc(t,e){let{MongoClient:n}=await import("mongodb"),s=new n(t,{serverSelectionTimeoutMS:2e3});try{return await s.connect(),await s.db(e).collection("agent_definitions").estimatedDocumentCount()>0}catch{return!1}finally{await s.close().catch(()=>{})}}async function wc(t,e,n){let{MongoClient:s}=await import("mongodb"),i=new s(t,{serverSelectionTimeoutMS:2e3});try{return await i.connect(),await i.db(e).collection("agent_definitions").findOne({id:n})!==null}catch{return!1}finally{await i.close().catch(()=>{})}}async function bc(t){if(!t)return!1;let{WebClient:e}=await import("@slack/web-api");try{return(await new e(t).auth.test()).ok===!0}catch{return!1}}function fc(t){return t.replace(/^~(?=$|\/)/,process.env.HOME??"")}function vc(t="com.hive.agent"){let e=fc(`~/Library/LaunchAgents/${t}.plist`);if(!Um(e))return null;let s=dc(e,"utf-8").match(/<key>WorkingDirectory<\/key>\s*<string>([^<]+)<\/string>/);return s?jm(fc(s[1])):null}var kc=C(()=>{"use strict"});var Tc=S((cw,fe)=>{var fr=he("fs"),is=he("path"),Ym=he("os"),Hm=he("crypto"),Ec=["\u25C8 encrypted .env [www.dotenvx.com]","\u25C8 secrets for agents [www.dotenvx.com]","\u2301 auth for agents [www.vestauth.com]","\u2318 custom filepath { path: '/custom/path/.env' }","\u2318 enable debugging { debug: true }","\u2318 override existing { override: true }","\u2318 suppress logs { quiet: true }","\u2318 multiple files { path: ['.env.local', '.env'] }"];function Gm(){return Ec[Math.floor(Math.random()*Ec.length)]}function st(t){return typeof t=="string"?!["false","0","no","off",""].includes(t.toLowerCase()):!!t}function Vm(){return process.stdout.isTTY}function Wm(t){return Vm()?`\x1B[2m${t}\x1B[0m`:t}var Jm=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Qm(t){let e={},n=t.toString();n=n.replace(/\r\n?/mg,`
223
- `);let s;for(;(s=Jm.exec(n))!=null;){let i=s[1],r=s[2]||"";r=r.trim();let o=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(r=r.replace(/\\n/g,`
224
- `),r=r.replace(/\\r/g,"\r")),e[i]=r}return e}function zm(t){t=t||{};let e=Ic(t);t.path=e;let n=K.configDotenv(t);if(!n.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw o.code="MISSING_DATA",o}let s=Oc(t).split(","),i=s.length,r;for(let o=0;o<i;o++)try{let a=s[o].trim(),l=Zm(n,a);r=K.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return K.parse(r)}function Xm(t){console.error(`\u26A0 ${t}`)}function Wt(t){console.log(`\u2506 ${t}`)}function _c(t){console.log(`\u25C7 ${t}`)}function Oc(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Zm(t,e){let n;try{n=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let s=n.password;if(!s){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=n.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let r=`DOTENV_VAULT_${i.toUpperCase()}`,o=t.parsed[r];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${r} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:s}}function Ic(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let n of t.path)fr.existsSync(n)&&(e=n.endsWith(".vault")?n:`${n}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=is.resolve(process.cwd(),".env.vault");return fr.existsSync(e)?e:null}function Ac(t){return t[0]==="~"?is.join(Ym.homedir(),t.slice(1)):t}function eg(t){let e=st(process.env.DOTENV_CONFIG_DEBUG||t&&t.debug),n=st(process.env.DOTENV_CONFIG_QUIET||t&&t.quiet);(e||!n)&&_c("loading env from encrypted .env.vault");let s=K._parseVault(t),i=process.env;return t&&t.processEnv!=null&&(i=t.processEnv),K.populate(i,s,t),{parsed:s}}function tg(t){let e=is.resolve(process.cwd(),".env"),n="utf8",s=process.env;t&&t.processEnv!=null&&(s=t.processEnv);let i=st(s.DOTENV_CONFIG_DEBUG||t&&t.debug),r=st(s.DOTENV_CONFIG_QUIET||t&&t.quiet);t&&t.encoding?n=t.encoding:i&&Wt("no encoding is specified (UTF-8 is used by default)");let o=[e];if(t&&t.path)if(!Array.isArray(t.path))o=[Ac(t.path)];else{o=[];for(let f of t.path)o.push(Ac(f))}let a,l={};for(let f of o)try{let u=K.parse(fr.readFileSync(f,{encoding:n}));K.populate(l,u,t)}catch(u){i&&Wt(`failed to load ${f} ${u.message}`),a=u}let c=K.populate(s,l,t);if(i=st(s.DOTENV_CONFIG_DEBUG||i),r=st(s.DOTENV_CONFIG_QUIET||r),i||!r){let f=Object.keys(c).length,u=[];for(let d of o)try{let h=is.relative(process.cwd(),d);u.push(h)}catch(h){i&&Wt(`failed to load ${d} ${h.message}`),a=h}_c(`injected env (${f}) from ${u.join(",")} ${Wm(`// tip: ${Gm()}`)}`)}return a?{parsed:l,error:a}:{parsed:l}}function ng(t){if(Oc(t).length===0)return K.configDotenv(t);let e=Ic(t);return e?K._configVault(t):(Xm(`you set DOTENV_KEY but you are missing a .env.vault file at ${e}`),K.configDotenv(t))}function sg(t,e){let n=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),i=s.subarray(0,12),r=s.subarray(-16);s=s.subarray(12,-16);try{let o=Hm.createDecipheriv("aes-256-gcm",n,i);return o.setAuthTag(r),`${o.update(s)}${o.final()}`}catch(o){let a=o instanceof RangeError,l=o.message==="Invalid key length",c=o.message==="Unsupported state or unable to authenticate data";if(a||l){let f=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw f.code="INVALID_DOTENV_KEY",f}else if(c){let f=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw f.code="DECRYPTION_FAILED",f}else throw o}}function ig(t,e,n={}){let s=!!(n&&n.debug),i=!!(n&&n.override),r={};if(typeof e!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(e))Object.prototype.hasOwnProperty.call(t,o)?(i===!0&&(t[o]=e[o],r[o]=e[o]),s&&Wt(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(t[o]=e[o],r[o]=e[o]);return r}var K={configDotenv:tg,_configVault:eg,_parseVault:zm,config:ng,decrypt:sg,parse:Qm,populate:ig};fe.exports.configDotenv=K.configDotenv;fe.exports._configVault=K._configVault;fe.exports._parseVault=K._parseVault;fe.exports.config=K.config;fe.exports.decrypt=K.decrypt;fe.exports.parse=K.parse;fe.exports.populate=K.populate;fe.exports=K});var rs,Nc=C(()=>{"use strict";rs={externalComms:!0,codeTask:!1,codeAccess:!1}});var os={};Q(os,{config:()=>fg});import{readFileSync as rg,existsSync as $c,readdirSync as og,statSync as ag}from"node:fs";import{resolve as dr}from"node:path";import{randomUUID as Lc}from"node:crypto";import{execFileSync as lg}from"node:child_process";function Cc(t){let e=process.env[t]||qc(t);if(!e)throw new Error(`Missing required env var: ${t}`);return e}function g(t,e){return process.env[t]||qc(t)||e}function ug(t){if(t?.length)return t.map(n=>dr(n.replace(/^~/,process.env.HOME??"/tmp")));let e=dr(T,"plugins/claude-code");return $c(e)?og(e).map(n=>dr(e,n)).filter(n=>ag(n).isDirectory()):[]}function qc(t){if(process.platform!=="darwin")return"";try{return lg("security",["find-generic-password","-s",`hive/${Jt}/${t}`,"-w"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch{return""}}var Mc,Dc,cg,Pc,b,yw,Jt,Re,it,fg,as=C(()=>{"use strict";Mc=me(Tc(),1),Dc=me(Ie(),1);Nc();ee();cg=xr(T);Mc.default.config({path:cg});Pc=Br(T),b={};$c(Pc)&&(b=(0,Dc.parse)(rg(Pc,"utf-8"))??{});yw=process.env.HOME??"/tmp",Jt=b.instance?.id??"hive";Re=b.instance?.portBase??3100,it=b.instance?.ports??{},fg={instance:{id:Jt,portBase:Re},business:{name:b.business?.name??g("BUSINESS_NAME",""),description:b.business?.description??"",location:b.business?.location??"",ownerName:b.business?.owner?.name??"",ownerRole:b.business?.owner?.role??""},slack:{appToken:Cc("SLACK_APP_TOKEN"),botToken:Cc("SLACK_BOT_TOKEN"),mcpToken:g("SLACK_MCP_TOKEN",""),auditChannel:g("SLACK_AUDIT_CHANNEL",b.slack?.auditChannel??"")},slackJasper:{appToken:g("SLACK_JASPER_APP_TOKEN",""),botToken:g("SLACK_JASPER_BOT_TOKEN",""),mcpToken:g("SLACK_JASPER_MCP_TOKEN","")},anthropic:{apiKey:g("ANTHROPIC_API_KEY","")},linear:{apiKey:g("LINEAR_API_KEY",""),teamId:g("LINEAR_TEAM_ID","")},clickup:{apiToken:g("CLICKUP_API_TOKEN","")},github:{repo:g("GITHUB_REPO",""),token:g("GH_TOKEN","")},brave:{apiKey:g("BRAVE_API_KEY","")},taskLedger:{apiUrl:g("TASK_LEDGER_API_URL","http://localhost:3002"),agentKeys:Object.fromEntries(Object.entries(process.env).filter(([t])=>t.startsWith("TASK_LEDGER_KEY_")).map(([t,e])=>[t.replace("TASK_LEDGER_KEY_","").toLowerCase().replace(/_/g,"-"),e])),apiKey:g("TASK_LEDGER_API_KEY","")},mongo:{uri:g("MONGODB_URI","mongodb://localhost:27017"),dbName:g("MONGODB_DB",`hive_${Jt}`)},defaultAgent:g("DEFAULT_AGENT","chief-of-staff"),google:{account:g("GOOGLE_ACCOUNT",b.google?.account??""),client:g("GOG_CLIENT",b.google?.client??""),accounts:b.google?.accounts??{},sharedFolder:g("DRIVE_SHARED_FOLDER",b.google?.sharedFolder??b.googleWorkspace?.sharedFolder??"")},googleWorkspace:{account:g("GWS_ACCOUNT",b.googleWorkspace?.account??""),gwsPath:g("GWS_PATH",""),sharedFolder:g("GWS_SHARED_FOLDER",b.googleWorkspace?.sharedFolder??"")},quo:{apiKey:g("QUO_API_KEY",""),phoneNumberId:g("QUO_PHONE_NUMBER_ID",""),lines:b.quo?.lines??{}},sms:{lines:b.sms?.lines??[]},imessage:{enabled:b.imessage?.enabled??!1,slackChannel:b.imessage?.slackChannel??"imessage",hotWindowMs:b.imessage?.hotWindowMs??3e5,coldIntervalMs:b.imessage?.coldIntervalMs??3e5,hotIntervalMs:b.imessage?.hotIntervalMs??1e4},resend:{apiKey:g("RESEND_API_KEY",""),fromAddress:g("RESEND_FROM_ADDRESS",""),defaultCc:g("RESEND_DEFAULT_CC",""),defaultBcc:g("RESEND_DEFAULT_BCC",""),emailDomain:g("RESEND_EMAIL_DOMAIN",b.resend?.emailDomain??""),businessName:g("RESEND_BUSINESS_NAME",b.resend?.businessName??"")},plugins:b.plugins??[],skillRegistries:b.skillRegistries??[{name:"keepur-default",url:"https://github.com/keepur/hive-skills",default:!0}],gemini:{apiKey:g("GEMINI_API_KEY",""),visionModel:g("GEMINI_VISION_MODEL","gemini-2.5-flash")},permits:{mongoUri:g("PERMITS_MONGO_URI","mongodb://localhost:27017/permits")},recall:{apiKey:g("RECALL_API_KEY",""),region:g("RECALL_API_REGION","us-west-2"),monitorPort:parseInt(g("MEETING_MONITOR_PORT",String(it.recall??Re+1)),10),monitorPublicUrl:g("MEETING_MONITOR_PUBLIC_URL",""),webhookSecret:g("RECALL_WEBHOOK_SECRET","")},scheduler:{heartbeatIntervalMs:parseInt(g("HEARTBEAT_INTERVAL_MS","120000"),10)},background:{port:parseInt(g("BG_TASK_PORT",String(it.background??Re)),10),authToken:g("BG_TASK_AUTH_TOKEN","")||Lc()},codeTask:{port:parseInt(g("CODE_TASK_PORT",String(it.codeTask??Re+2)),10),authToken:g("CODE_TASK_AUTH_TOKEN","")||Lc(),pluginDirs:ug(b.codeTask?.pluginDirs),defaultModel:g("CODE_TASK_MODEL","claude-sonnet-4-6"),defaultMaxTurns:parseInt(g("CODE_TASK_MAX_TURNS","100"),10),defaultMaxBudget:parseFloat(g("CODE_TASK_MAX_BUDGET","5.00")),maxConcurrent:parseInt(g("CODE_TASK_MAX_CONCURRENT","2"),10),maxLifetimeMs:parseInt(g("CODE_TASK_MAX_LIFETIME_MS",String(480*60*1e3)),10),staleGraceMs:parseInt(g("CODE_TASK_STALE_GRACE_MS",String(1800*1e3)),10)},ws:{enabled:g("WS_ENABLED","false")==="true",port:parseInt(g("WS_PORT",String(it.ws??Re+3)),10)},beekeeper:{port:parseInt(g("BEEKEEPER_PORT",String(b.beekeeper?.port??8420)),10)},workflow:{enabled:g("WORKFLOW_ENABLED","false")==="true"},adminApi:{port:parseInt(g("ADMIN_API_PORT",String(it.adminApi??Re+4)),10),token:g("ADMIN_API_TOKEN","")},voice:{enabled:!!b.voice?.provider,provider:b.voice?.provider??"",publicUrl:b.voice?.publicUrl??"",phoneNumberId:b.voice?.phoneNumberId??"",assistants:b.voice?.assistants??{},apiKey:g("VAPI_API_KEY",""),serverSecret:g("VAPI_SERVER_SECRET",""),port:parseInt(g("VOICE_PORT",String(it.voice??Re+5)),10)},autonomy:{externalComms:b.autonomy?.externalComms??rs.externalComms,codeTask:b.autonomy?.codeTask??rs.codeTask,codeAccess:b.autonomy?.codeAccess??rs.codeAccess},modelRouter:{enabled:g("MODEL_ROUTER_ENABLED","true")==="true",model:g("MODEL_ROUTER_MODEL","claude-haiku-4-5-20251001"),timeoutMs:parseInt(g("MODEL_ROUTER_TIMEOUT_MS","8000"),10)},sweeper:{intervalMs:parseInt(g("SWEEPER_INTERVAL_MS","300000"),10),threadTtlMs:parseInt(g("SWEEPER_THREAD_TTL_MS","86400000"),10),taskFileTtlMs:parseInt(g("SWEEPER_TASK_FILE_TTL_MS","604800000"),10),meetingSessionTtlMs:parseInt(g("SWEEPER_MEETING_TTL_MS","3600000"),10),cacheTtlMs:parseInt(g("SWEEPER_CACHE_TTL_MS","3600000"),10),retryMaxAttempts:parseInt(g("SWEEPER_RETRY_MAX_ATTEMPTS","3"),10),retryBaseDelayMs:parseInt(g("SWEEPER_RETRY_BASE_DELAY_MS","30000"),10)},memory:{hotBudgetTokens:parseInt(g("MEMORY_HOT_BUDGET_TOKENS",String(b.memory?.hotBudgetTokens??3e3)),10),sweepIntervalHours:parseFloat(g("MEMORY_SWEEP_INTERVAL_HOURS",String(b.memory?.sweepIntervalHours??6))),hotThreshold:parseFloat(g("MEMORY_HOT_THRESHOLD",String(b.memory?.hotThreshold??.6))),warmThreshold:parseFloat(g("MEMORY_WARM_THRESHOLD",String(b.memory?.warmThreshold??.3))),recencyHalfLifeDays:parseFloat(g("MEMORY_RECENCY_HALF_LIFE_DAYS",String(b.memory?.recencyHalfLifeDays??7))),coldSummaryMinRecords:parseInt(g("MEMORY_COLD_SUMMARY_MIN",String(b.memory?.coldSummaryMinRecords??5)),10),coldRetentionDays:parseInt(g("MEMORY_COLD_RETENTION_DAYS",String(b.memory?.coldRetentionDays??90)),10),purgeRetentionDays:parseInt(g("MEMORY_PURGE_RETENTION_DAYS",String(b.memory?.purgeRetentionDays??7)),10),reflectionMinTurns:parseInt(g("MEMORY_REFLECTION_MIN_TURNS",String(b.memory?.reflectionMinTurns??3)),10)},codeIndex:{enabled:b.codeIndex?.enabled===!0||process.env.CODE_INDEX_ENABLED==="true",scoreThreshold:parseFloat(g("CODE_INDEX_SCORE_THRESHOLD",String(b.codeIndex?.scoreThreshold??.65))),prefetchLimit:parseInt(g("CODE_INDEX_PREFETCH_LIMIT",String(b.codeIndex?.prefetchLimit??8)),10),sessionKnowledge:{enabled:(b.codeIndex?.sessionKnowledge?.enabled??!0)&&process.env.CODE_INDEX_SESSION_KNOWLEDGE!=="false"},repos:b.codeIndex?.repos??{}},events:{retentionDays:parseInt(g("EVENT_RETENTION_DAYS",String(b.events?.retentionDays??30)),10)},activity:{enabled:(b.activity?.enabled??!0)&&process.env.ACTIVITY_LOG_ENABLED!=="false",bufferSize:parseInt(g("ACTIVITY_BUFFER_SIZE",String(b.activity?.bufferSize??200)),10),flushIntervalMs:parseInt(g("ACTIVITY_FLUSH_INTERVAL_MS",String(b.activity?.flushIntervalMs??3e4)),10),retentionDays:parseInt(g("ACTIVITY_RETENTION_DAYS",String(b.activity?.retentionDays??90)),10)},autoDream:{enabled:b.autoDream?.enabled??!0,idleThresholdMinutes:parseInt(g("AUTODREAM_IDLE_THRESHOLD_MINUTES",String(b.autoDream?.idleThresholdMinutes??30)),10),cooldownMinutes:parseInt(g("AUTODREAM_COOLDOWN_MINUTES",String(b.autoDream?.cooldownMinutes??60)),10),similarityThreshold:parseFloat(g("AUTODREAM_SIMILARITY_THRESHOLD",String(b.autoDream?.similarityThreshold??.85))),patternMinCount:parseInt(g("AUTODREAM_PATTERN_MIN_COUNT",String(b.autoDream?.patternMinCount??3)),10),maxClustersPerRun:parseInt(g("AUTODREAM_MAX_CLUSTERS",String(b.autoDream?.maxClustersPerRun??20)),10),maxContradictionPairsPerRun:parseInt(g("AUTODREAM_MAX_CONTRADICTIONS",String(b.autoDream?.maxContradictionPairsPerRun??30)),10),maxPromotionsPerRun:parseInt(g("AUTODREAM_MAX_PROMOTIONS",String(b.autoDream?.maxPromotionsPerRun??10)),10)},browser:{cdpEndpoint:g("BROWSER_CDP_ENDPOINT","")},tasksDir:{code:g("CODE_TASKS_DIR",`/tmp/${Jt}-code-tasks`),background:g("BG_TASKS_DIR",`/tmp/${Jt}-bg-tasks`)}}});var Kc={};Q(Kc,{runDoctor:()=>mg});import{resolve as dg}from"node:path";import{execFileSync as Rc}from"node:child_process";async function pg(){try{return{config:(await Promise.resolve().then(()=>(as(),os))).config,error:null}}catch(t){return{config:null,error:t instanceof Error?t.message:String(t)}}}async function mg(t={}){let e=!!t.verbose,n=vc("com.hive.agent");console.log("hive doctor"),console.log(` cwd: ${process.cwd()}`),console.log(` hive home: ${T}`),console.log(` service path: ${n??"(LaunchAgent plist not found)"}`),console.log("");let s=hc(dg(import.meta.dirname,"../../src/config.ts")),{config:i,error:r}=await pg(),o=[{name:"Node.js >= 22",group:"prereq",required:!0,test:()=>parseInt(process.versions.node.split(".")[0])>=22,remedy:"Install Node 22+: brew install node@22 && brew link --overwrite node@22"},{name:"Homebrew",group:"prereq",required:!0,test:()=>Vt("brew"),remedy:'Install: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'},{name:"MongoDB (brew services)",group:"prereq",required:!0,test:()=>pc("mongodb-community"),remedy:"brew services start mongodb-community # informational; live reachability is checked under Agents"},{name:"Ollama",group:"prereq",required:!0,test:()=>ur("http://127.0.0.1:11434/api/tags"),remedy:"brew install ollama && brew services start ollama"},{name:"Ollama models (bge-large, gemma4:e4b)",group:"prereq",required:!0,test:()=>{if(!Vt("ollama"))return!1;try{let c=Rc("ollama",["list"],{encoding:"utf-8"});return c.includes("bge-large")&&c.includes("gemma4:e4b")}catch{return!1}},remedy:"ollama pull bge-large && ollama pull gemma4:e4b"},{name:"Qdrant",group:"prereq",required:!0,test:()=>ur("http://127.0.0.1:6333/"),remedy:"brew install qdrant && brew services start qdrant"},{name:"gh CLI",group:"prereq",required:!1,test:()=>Vt("gh")},{name:"gog CLI",group:"prereq",required:!1,test:()=>Vt("gog")},{name:"Xcode CLI Tools",group:"prereq",required:!0,test:()=>{try{return Rc("xcode-select",["-p"],{encoding:"utf-8"}),!0}catch{return!1}},remedy:"xcode-select --install"},{name:"config loads (hive.yaml + required env)",group:"config",required:!0,test:()=>i!==null,remedy:r?`config.ts threw: ${r}. Set missing env vars in ~/.hive/.env and ensure hive.yaml exists.`:"Check hive.yaml at the hive home and run `hive init` if missing."},...s.map(c=>({name:`env: ${c}`,group:"config",required:!0,test:()=>!!process.env[c],remedy:`Set ${c} in ~/.hive/.env`})),{name:"MongoDB reachable",group:"agents",required:!0,test:()=>i?yc(i.mongo.uri,i.mongo.dbName):!1,remedy:"Start Mongo (`brew services start mongodb-community`) and verify MONGODB_URI."},{name:"At least one agent exists",group:"agents",required:!0,test:()=>i?Sc(i.mongo.uri,i.mongo.dbName):!1,remedy:"Run `npm run setup:seeds` to import plugin agent seeds."},{name:`default agent exists${i?` (${i.defaultAgent})`:""}`,group:"agents",required:!0,test:()=>i?wc(i.mongo.uri,i.mongo.dbName,i.defaultAgent):!1,remedy:i?`Set DEFAULT_AGENT to an existing agent id or seed '${i.defaultAgent}'.`:"Config failed to load \u2014 see Config group."},{name:"LaunchAgent com.hive.agent running",group:"services",required:!0,test:()=>{let c=mc("com.hive.agent");return c.loaded&&c.state==="running"&&c.pid!==null&&gc(c.pid)},remedy:(()=>{let c=process.getuid?.()??0;return`launchctl bootstrap gui/${c} ~/Library/LaunchAgents/com.hive.agent.plist && launchctl kickstart -k gui/${c}/com.hive.agent`})()},{name:"Slack auth.test",group:"services",required:!0,test:()=>i?bc(i.slack.botToken):!1,remedy:"Verify SLACK_BOT_TOKEN in .env and that the token still has the expected scopes."}],a=!0,l=null;for(let c of o){c.group!==l&&(console.log(`
225
- ${hg[c.group]}`),l=c.group);let f=await c.test(),u=f?"\u2713":c.required?"\u2717":"\u25CB",d=c.required?"":" (optional)";console.log(` ${u} ${c.name}${d}`),!f&&e&&c.remedy&&console.log(` \u2192 ${c.remedy}`),!f&&c.required&&(a=!1)}a||(console.log(`
215
+ `);await o.updateOne({path:"shared/business-context.md"},{$set:{content:l,updatedAt:new Date,updatedBy:"setup-wizard"}},{upsert:!0}),console.log(" \u2713 shared/business-context.md");let c=U(e,"constitution.md.tpl");if(H(c)){let f=nt(c,"utf-8"),u={};for(let[y,p]of Object.entries(t.agents??{}))u[y]=p.name??y;let h=xl(f,{business:a,team:u});await o.updateOne({path:"shared/constitution.md"},{$set:{content:h,updatedAt:new Date,updatedBy:"setup-wizard"}},{upsert:!0}),console.log(" \u2713 shared/constitution.md")}await i.close(),console.log(" \u2713 Memory seeded to MongoDB")}catch(i){console.log(` \u26A0 Failed to seed memory: ${i}`),console.log(" Make sure MongoDB is running (brew services start mongodb-community)")}}async function Zl(t){console.log(" Compiling TypeScript...");try{Y("npm",["run","build"],{cwd:t,stdio:"pipe"}),console.log(" \u2713 Build complete")}catch(e){console.log(" \u26A0 Build failed:"),console.log(String(e))}}async function ec(t,e){let{mkdirSync:n}=await import("node:fs");if(H(U(t,"package.json"))){console.log(" Pulling latest...");try{Y("git",["pull","--ff-only"],{cwd:t,stdio:"inherit"})}catch{console.log(" \u26A0 git pull failed \u2014 continuing with existing code")}}else{console.log(" Cloning repository...");let o=Te(t,"..");n(o,{recursive:!0});let a=Y("git",["remote","get-url","origin"],{cwd:e,encoding:"utf-8"}).trim();Y("git",["clone",a,t],{stdio:"inherit"}),console.log(" \u2713 Repository cloned")}console.log(" Installing production dependencies..."),Y("npm",["install","--omit=dev"],{cwd:t,stdio:"pipe"}),console.log(" \u2713 Dependencies installed"),console.log(" Syncing config and build output...");let s=U(e,".env");if(H(s)){let{copyFileSync:o}=await import("node:fs");o(s,U(t,".env")),console.log(" \u2713 .env")}let i=U(e,"hive.yaml");if(H(i)){let{copyFileSync:o}=await import("node:fs");o(i,U(t,"hive.yaml")),console.log(" \u2713 hive.yaml")}let r=U(e,"dist");H(r)&&(Y("rsync",["-a","--delete",`${r}/`,`${U(t,"dist")}/`],{stdio:"pipe"}),console.log(" \u2713 dist/")),n(U(t,"logs"),{recursive:!0}),console.log(`
216
+ \u2713 Deploy directory ready: ${t}`)}var st,os,as,nc,oc=L(()=>{"use strict";st=le(fe(),1);Fl();ne();os="",as="",nc=Pm({input:process.stdin,output:process.stdout})});var lc={};Q(lc,{runSetupWizard:()=>Gm});import{mkdirSync as Km,existsSync as Ne,readFileSync as ac,writeFileSync as Bm,readdirSync as xm}from"node:fs";import{resolve as Le,join as it}from"node:path";import{createInterface as Fm}from"node:readline";function Um(t){let e=new Set,n=Le(t,"services","hive");if(Ne(n))for(let s of xm(n)){let i=it(n,s,"hive.yaml");if(Ne(i))try{let o=((0,Qt.parse)(ac(i,"utf-8"))??{})?.instance?.portBase;e.add(typeof o=="number"?o:3100)}catch{}}for(let s=3100;s<3900;s+=100)if(!e.has(s))return s;return 3100}function jm(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function pr(t,e,n=""){let s=n?`${e} [${n}]: `:`${e}: `;return new Promise(i=>t.question(s,r=>i(r.trim()||n)))}async function Ym(t){let e=Fm({input:process.stdin,output:process.stdout});try{console.log(`\u2500\u2500 Where to install \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
217
+ `);let n=await pr(e,"Business name (e.g. your company)");n||(console.error("Business name is required."),process.exit(1));let s=jm(n)||"hive",i=await pr(e,"Instance ID (short slug, used for the mongo db name)",s),r=Le(t,"services","hive",i),o=Le(await pr(e,"Install location",r));Ne(it(o,"hive.yaml"))&&(console.error(`
218
+ An existing hive install was found at ${o}. Aborting to avoid clobbering.`),console.error(`If you want to reconfigure that instance, run: hive init --config ${o}/hive.yaml`),process.exit(1)),Km(o,{recursive:!0});let a=Um(t),l={instance:{id:i,type:"business",portBase:a},business:{name:n}};return Bm(it(o,"hive.yaml"),(0,Qt.stringify)(l)),console.log(`
219
+ \u2713 Created ${o}/hive.yaml (instance.id: ${i}, portBase: ${a})
220
+ `),o}finally{e.close()}}function Hm(){if(process.env.HIVE_HOME){let e=Le(process.env.HIVE_HOME);return Ne(it(e,"hive.yaml")),e}if(Ne(Le(process.cwd(),"hive.yaml")))return process.cwd();let t=or();return Ne(it(t,"hive.yaml"))?t:null}async function Gm(t){console.log(`
221
+ Hive Setup Wizard
222
+ `),await Rl(),console.log("");let e=Hm(),n=process.env.HOME??"/tmp",s=e??await Ym(n),i=Ne(Le(t,"templates"))?Le(t,"templates"):Le(t,"setup","templates");console.log(`Setup will write config to: ${s}`),console.log(`Templates from: ${i}
223
+ `);let r=it(s,"hive.yaml");Ne(r)&&(((0,Qt.parse)(ac(r,"utf-8"))??{}).instance?.id||(console.error(`Error: ${r} is missing instance.id. Delete it and run 'hive init' again.`),process.exit(1))),process.env.HIVE_HOME=s;let{runWizard:o}=await Promise.resolve().then(()=>(oc(),rc));await o(s,i,t)}var Qt,cc=L(()=>{"use strict";Qt=le(fe(),1);ne();Kl()});var dc={};Q(dc,{showStatus:()=>Qm});import{execFileSync as uc}from"node:child_process";import{existsSync as Vm,readFileSync as Wm}from"node:fs";import{resolve as Jm}from"node:path";async function Qm(){console.log(`Hive home: ${P}`);let t=Jm(P,process.env.HIVE_CONFIG??"hive.yaml");if(!Vm(t)){console.log("Status: not initialized (run 'hive init')");return}let n=((0,fc.parse)(Wm(t,"utf-8"))??{}).instance?.id??"hive",s=`com.hive.${n}.agent`;console.log(`Instance: ${n}`);try{let r=uc("launchctl",["list"],{encoding:"utf-8"}).split(`
224
+ `).find(o=>o.includes(s));if(r){let o=r.trim().split(/\s+/),a=o[0],l=o[1];console.log(`Service: running (PID ${a}, last exit ${l})`)}else console.log("Service: not running")}catch{console.log("Service: unknown (could not query launchctl)")}try{uc("mongosh",["--eval","db.runCommand({ping:1})","--quiet"],{encoding:"utf-8",timeout:5e3}),console.log("MongoDB: connected")}catch{console.log("MongoDB: not reachable")}}var fc,pc=L(()=>{"use strict";fc=le(fe(),1);ne()});var mc={};Q(mc,{runUpdate:()=>Xm});import{execFileSync as hc}from"node:child_process";import{resolve as zm}from"node:path";async function Xm(){console.log("Stopping Hive..."),await fr(),console.log("Updating @keepur/hive...");try{hc("npm",["update","-g","@keepur/hive"],{stdio:"inherit"}),console.log("Update complete.")}catch{console.error("Update failed."),process.exit(1)}let t=hc("npm",["root","-g"],{encoding:"utf-8"}).trim(),e=zm(t,"@keepur","hive");console.log("Restarting Hive..."),await ur(e)}var gc=L(()=>{"use strict";Vt()});import{execFileSync as hr}from"node:child_process";import{existsSync as Zm,readFileSync as wc}from"node:fs";import{resolve as eg}from"node:path";function zt(t){try{return hr("which",[t],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function Sc(t){try{return hr("brew",["services","list"],{encoding:"utf-8"}).split(`
225
+ `).some(n=>n.startsWith(t)&&n.includes("started"))}catch{return!1}}async function mr(t,e=1500){try{let n=new AbortController,s=setTimeout(()=>n.abort(),e),i=await fetch(t,{signal:n.signal});return clearTimeout(s),i.ok}catch{return!1}}function bc(t){let e=wc(t,"utf-8"),n=new Set;for(let s of e.matchAll(/\brequired\(\s*"([A-Z0-9_]+)"\s*\)/g))n.add(s[1]);return[...n].sort()}function vc(t){let e=process.getuid?.();if(e===void 0)return{loaded:!1,state:"unknown",pid:null};try{let n=hr("launchctl",["print",`gui/${e}/${t}`],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),s=n.match(/state\s*=\s*([^\n]+?)\s*$/m),i=n.match(/pid\s*=\s*(\d+)/),r=s?.[1];return{loaded:!0,state:r==="running"?"running":r==="not running"?"not running":"unknown",pid:i?parseInt(i[1],10):null}}catch{return{loaded:!1,state:"unknown",pid:null}}}function kc(t){try{return process.kill(t,0),!0}catch{return!1}}async function Ec(t,e,n=2e3){let{MongoClient:s}=await import("mongodb"),i=new s(t,{serverSelectionTimeoutMS:n});try{return await i.connect(),await i.db(e).command({ping:1}),!0}catch{return!1}finally{await i.close().catch(()=>{})}}async function Ac(t,e){let{MongoClient:n}=await import("mongodb"),s=new n(t,{serverSelectionTimeoutMS:2e3});try{return await s.connect(),await s.db(e).collection("agent_definitions").estimatedDocumentCount()>0}catch{return!1}finally{await s.close().catch(()=>{})}}async function _c(t,e,n){let{MongoClient:s}=await import("mongodb"),i=new s(t,{serverSelectionTimeoutMS:2e3});try{return await i.connect(),await i.db(e).collection("agent_definitions").findOne({id:n})!==null}catch{return!1}finally{await i.close().catch(()=>{})}}async function Oc(t){if(!t)return!1;let{WebClient:e}=await import("@slack/web-api");try{return(await new e(t).auth.test()).ok===!0}catch{return!1}}function yc(t){return t.replace(/^~(?=$|\/)/,process.env.HOME??"")}function Ic(t="com.hive.agent"){let e=yc(`~/Library/LaunchAgents/${t}.plist`);if(!Zm(e))return null;let s=wc(e,"utf-8").match(/<key>WorkingDirectory<\/key>\s*<string>([^<]+)<\/string>/);return s?eg(yc(s[1])):null}var Tc=L(()=>{"use strict"});var $c=w((vS,pe)=>{var gr=ge("fs"),ls=ge("path"),tg=ge("os"),ng=ge("crypto"),Nc=["\u25C8 encrypted .env [www.dotenvx.com]","\u25C8 secrets for agents [www.dotenvx.com]","\u2301 auth for agents [www.vestauth.com]","\u2318 custom filepath { path: '/custom/path/.env' }","\u2318 enable debugging { debug: true }","\u2318 override existing { override: true }","\u2318 suppress logs { quiet: true }","\u2318 multiple files { path: ['.env.local', '.env'] }"];function sg(){return Nc[Math.floor(Math.random()*Nc.length)]}function rt(t){return typeof t=="string"?!["false","0","no","off",""].includes(t.toLowerCase()):!!t}function ig(){return process.stdout.isTTY}function rg(t){return ig()?`\x1B[2m${t}\x1B[0m`:t}var og=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function ag(t){let e={},n=t.toString();n=n.replace(/\r\n?/mg,`
226
+ `);let s;for(;(s=og.exec(n))!=null;){let i=s[1],r=s[2]||"";r=r.trim();let o=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(r=r.replace(/\\n/g,`
227
+ `),r=r.replace(/\\r/g,"\r")),e[i]=r}return e}function lg(t){t=t||{};let e=Mc(t);t.path=e;let n=K.configDotenv(t);if(!n.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw o.code="MISSING_DATA",o}let s=Pc(t).split(","),i=s.length,r;for(let o=0;o<i;o++)try{let a=s[o].trim(),l=ug(n,a);r=K.decrypt(l.ciphertext,l.key);break}catch(a){if(o+1>=i)throw a}return K.parse(r)}function cg(t){console.error(`\u26A0 ${t}`)}function Xt(t){console.log(`\u2506 ${t}`)}function Cc(t){console.log(`\u25C7 ${t}`)}function Pc(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function ug(t,e){let n;try{n=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let l=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw l.code="INVALID_DOTENV_KEY",l}throw a}let s=n.password;if(!s){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let i=n.searchParams.get("environment");if(!i){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let r=`DOTENV_VAULT_${i.toUpperCase()}`,o=t.parsed[r];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${r} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:s}}function Mc(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let n of t.path)gr.existsSync(n)&&(e=n.endsWith(".vault")?n:`${n}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=ls.resolve(process.cwd(),".env.vault");return gr.existsSync(e)?e:null}function Lc(t){return t[0]==="~"?ls.join(tg.homedir(),t.slice(1)):t}function fg(t){let e=rt(process.env.DOTENV_CONFIG_DEBUG||t&&t.debug),n=rt(process.env.DOTENV_CONFIG_QUIET||t&&t.quiet);(e||!n)&&Cc("loading env from encrypted .env.vault");let s=K._parseVault(t),i=process.env;return t&&t.processEnv!=null&&(i=t.processEnv),K.populate(i,s,t),{parsed:s}}function dg(t){let e=ls.resolve(process.cwd(),".env"),n="utf8",s=process.env;t&&t.processEnv!=null&&(s=t.processEnv);let i=rt(s.DOTENV_CONFIG_DEBUG||t&&t.debug),r=rt(s.DOTENV_CONFIG_QUIET||t&&t.quiet);t&&t.encoding?n=t.encoding:i&&Xt("no encoding is specified (UTF-8 is used by default)");let o=[e];if(t&&t.path)if(!Array.isArray(t.path))o=[Lc(t.path)];else{o=[];for(let f of t.path)o.push(Lc(f))}let a,l={};for(let f of o)try{let u=K.parse(gr.readFileSync(f,{encoding:n}));K.populate(l,u,t)}catch(u){i&&Xt(`failed to load ${f} ${u.message}`),a=u}let c=K.populate(s,l,t);if(i=rt(s.DOTENV_CONFIG_DEBUG||i),r=rt(s.DOTENV_CONFIG_QUIET||r),i||!r){let f=Object.keys(c).length,u=[];for(let d of o)try{let h=ls.relative(process.cwd(),d);u.push(h)}catch(h){i&&Xt(`failed to load ${d} ${h.message}`),a=h}Cc(`injected env (${f}) from ${u.join(",")} ${rg(`// tip: ${sg()}`)}`)}return a?{parsed:l,error:a}:{parsed:l}}function pg(t){if(Pc(t).length===0)return K.configDotenv(t);let e=Mc(t);return e?K._configVault(t):(cg(`you set DOTENV_KEY but you are missing a .env.vault file at ${e}`),K.configDotenv(t))}function hg(t,e){let n=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),i=s.subarray(0,12),r=s.subarray(-16);s=s.subarray(12,-16);try{let o=ng.createDecipheriv("aes-256-gcm",n,i);return o.setAuthTag(r),`${o.update(s)}${o.final()}`}catch(o){let a=o instanceof RangeError,l=o.message==="Invalid key length",c=o.message==="Unsupported state or unable to authenticate data";if(a||l){let f=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw f.code="INVALID_DOTENV_KEY",f}else if(c){let f=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw f.code="DECRYPTION_FAILED",f}else throw o}}function mg(t,e,n={}){let s=!!(n&&n.debug),i=!!(n&&n.override),r={};if(typeof e!="object"){let o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(let o of Object.keys(e))Object.prototype.hasOwnProperty.call(t,o)?(i===!0&&(t[o]=e[o],r[o]=e[o]),s&&Xt(i===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(t[o]=e[o],r[o]=e[o]);return r}var K={configDotenv:dg,_configVault:fg,_parseVault:lg,config:pg,decrypt:hg,parse:ag,populate:mg};pe.exports.configDotenv=K.configDotenv;pe.exports._configVault=K._configVault;pe.exports._parseVault=K._parseVault;pe.exports.config=K.config;pe.exports.decrypt=K.decrypt;pe.exports.parse=K.parse;pe.exports.populate=K.populate;pe.exports=K});var cs,Dc=L(()=>{"use strict";cs={externalComms:!0,codeTask:!1,codeAccess:!1}});var us={};Q(us,{config:()=>kg});import{readFileSync as gg,existsSync as xc,readdirSync as yg,statSync as wg}from"node:fs";import{resolve as yr}from"node:path";import{randomUUID as qc}from"node:crypto";import{execFileSync as Sg}from"node:child_process";function Rc(t){let e=process.env[t]||Uc(t);if(!e)throw new Error(`Missing required env var: ${t}`);return e}function g(t,e){return process.env[t]||Uc(t)||e}function vg(t){if(t?.length)return t.map(n=>yr(n.replace(/^~/,process.env.HOME??"/tmp")));let e=yr(P,"plugins/claude-code");return xc(e)?yg(e).map(n=>yr(e,n)).filter(n=>wg(n).isDirectory()):[]}function Uc(t){if(process.platform!=="darwin")return"";try{return Sg("security",["find-generic-password","-s",`hive/${Zt}/${t}`,"-w"],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch{return""}}var Bc,Fc,bg,Kc,b,NS,Zt,Be,ot,kg,fs=L(()=>{"use strict";Bc=le($c(),1),Fc=le(fe(),1);Dc();ne();bg=Ml(P);Bc.default.config({path:bg});Kc=Pl(P),b={};xc(Kc)&&(b=(0,Fc.parse)(gg(Kc,"utf-8"))??{});NS=process.env.HOME??"/tmp",Zt=b.instance?.id??"hive";Be=b.instance?.portBase??3100,ot=b.instance?.ports??{},kg={instance:{id:Zt,portBase:Be},business:{name:b.business?.name??g("BUSINESS_NAME",""),description:b.business?.description??"",location:b.business?.location??"",ownerName:b.business?.owner?.name??"",ownerRole:b.business?.owner?.role??""},slack:{appToken:Rc("SLACK_APP_TOKEN"),botToken:Rc("SLACK_BOT_TOKEN"),mcpToken:g("SLACK_MCP_TOKEN",""),auditChannel:g("SLACK_AUDIT_CHANNEL",b.slack?.auditChannel??"")},slackJasper:{appToken:g("SLACK_JASPER_APP_TOKEN",""),botToken:g("SLACK_JASPER_BOT_TOKEN",""),mcpToken:g("SLACK_JASPER_MCP_TOKEN","")},anthropic:{apiKey:g("ANTHROPIC_API_KEY","")},linear:{apiKey:g("LINEAR_API_KEY",""),teamId:g("LINEAR_TEAM_ID","")},clickup:{apiToken:g("CLICKUP_API_TOKEN","")},github:{repo:g("GITHUB_REPO",""),token:g("GH_TOKEN","")},brave:{apiKey:g("BRAVE_API_KEY","")},taskLedger:{apiUrl:g("TASK_LEDGER_API_URL","http://localhost:3002"),agentKeys:Object.fromEntries(Object.entries(process.env).filter(([t])=>t.startsWith("TASK_LEDGER_KEY_")).map(([t,e])=>[t.replace("TASK_LEDGER_KEY_","").toLowerCase().replace(/_/g,"-"),e])),apiKey:g("TASK_LEDGER_API_KEY","")},mongo:{uri:g("MONGODB_URI","mongodb://localhost:27017"),dbName:g("MONGODB_DB",`hive_${Zt}`)},defaultAgent:g("DEFAULT_AGENT","chief-of-staff"),google:{account:g("GOOGLE_ACCOUNT",b.google?.account??""),client:g("GOG_CLIENT",b.google?.client??""),accounts:b.google?.accounts??{},sharedFolder:g("DRIVE_SHARED_FOLDER",b.google?.sharedFolder??b.googleWorkspace?.sharedFolder??"")},googleWorkspace:{account:g("GWS_ACCOUNT",b.googleWorkspace?.account??""),gwsPath:g("GWS_PATH",""),sharedFolder:g("GWS_SHARED_FOLDER",b.googleWorkspace?.sharedFolder??"")},quo:{apiKey:g("QUO_API_KEY",""),phoneNumberId:g("QUO_PHONE_NUMBER_ID",""),lines:b.quo?.lines??{}},sms:{lines:b.sms?.lines??[]},imessage:{enabled:b.imessage?.enabled??!1,slackChannel:b.imessage?.slackChannel??"imessage",hotWindowMs:b.imessage?.hotWindowMs??3e5,coldIntervalMs:b.imessage?.coldIntervalMs??3e5,hotIntervalMs:b.imessage?.hotIntervalMs??1e4},resend:{apiKey:g("RESEND_API_KEY",""),fromAddress:g("RESEND_FROM_ADDRESS",""),defaultCc:g("RESEND_DEFAULT_CC",""),defaultBcc:g("RESEND_DEFAULT_BCC",""),emailDomain:g("RESEND_EMAIL_DOMAIN",b.resend?.emailDomain??""),businessName:g("RESEND_BUSINESS_NAME",b.resend?.businessName??"")},plugins:b.plugins??[],skillRegistries:b.skillRegistries??[{name:"keepur-default",url:"https://github.com/keepur/hive-skills",default:!0}],gemini:{apiKey:g("GEMINI_API_KEY",""),visionModel:g("GEMINI_VISION_MODEL","gemini-2.5-flash")},permits:{mongoUri:g("PERMITS_MONGO_URI","mongodb://localhost:27017/permits")},recall:{apiKey:g("RECALL_API_KEY",""),region:g("RECALL_API_REGION","us-west-2"),monitorPort:parseInt(g("MEETING_MONITOR_PORT",String(ot.recall??Be+1)),10),monitorPublicUrl:g("MEETING_MONITOR_PUBLIC_URL",""),webhookSecret:g("RECALL_WEBHOOK_SECRET","")},scheduler:{heartbeatIntervalMs:parseInt(g("HEARTBEAT_INTERVAL_MS","120000"),10)},background:{port:parseInt(g("BG_TASK_PORT",String(ot.background??Be)),10),authToken:g("BG_TASK_AUTH_TOKEN","")||qc()},codeTask:{port:parseInt(g("CODE_TASK_PORT",String(ot.codeTask??Be+2)),10),authToken:g("CODE_TASK_AUTH_TOKEN","")||qc(),pluginDirs:vg(b.codeTask?.pluginDirs),defaultModel:g("CODE_TASK_MODEL","claude-sonnet-4-6"),defaultMaxTurns:parseInt(g("CODE_TASK_MAX_TURNS","100"),10),defaultMaxBudget:parseFloat(g("CODE_TASK_MAX_BUDGET","5.00")),maxConcurrent:parseInt(g("CODE_TASK_MAX_CONCURRENT","2"),10),maxLifetimeMs:parseInt(g("CODE_TASK_MAX_LIFETIME_MS",String(480*60*1e3)),10),staleGraceMs:parseInt(g("CODE_TASK_STALE_GRACE_MS",String(1800*1e3)),10)},ws:{enabled:g("WS_ENABLED","false")==="true",port:parseInt(g("WS_PORT",String(ot.ws??Be+3)),10)},beekeeper:{port:parseInt(g("BEEKEEPER_PORT",String(b.beekeeper?.port??8420)),10)},workflow:{enabled:g("WORKFLOW_ENABLED","false")==="true"},adminApi:{port:parseInt(g("ADMIN_API_PORT",String(ot.adminApi??Be+4)),10),token:g("ADMIN_API_TOKEN","")},voice:{enabled:!!b.voice?.provider,provider:b.voice?.provider??"",publicUrl:b.voice?.publicUrl??"",phoneNumberId:b.voice?.phoneNumberId??"",assistants:b.voice?.assistants??{},apiKey:g("VAPI_API_KEY",""),serverSecret:g("VAPI_SERVER_SECRET",""),port:parseInt(g("VOICE_PORT",String(ot.voice??Be+5)),10)},autonomy:{externalComms:b.autonomy?.externalComms??cs.externalComms,codeTask:b.autonomy?.codeTask??cs.codeTask,codeAccess:b.autonomy?.codeAccess??cs.codeAccess},modelRouter:{enabled:g("MODEL_ROUTER_ENABLED","true")==="true",model:g("MODEL_ROUTER_MODEL","claude-haiku-4-5-20251001"),timeoutMs:parseInt(g("MODEL_ROUTER_TIMEOUT_MS","8000"),10)},sweeper:{intervalMs:parseInt(g("SWEEPER_INTERVAL_MS","300000"),10),threadTtlMs:parseInt(g("SWEEPER_THREAD_TTL_MS","86400000"),10),taskFileTtlMs:parseInt(g("SWEEPER_TASK_FILE_TTL_MS","604800000"),10),meetingSessionTtlMs:parseInt(g("SWEEPER_MEETING_TTL_MS","3600000"),10),cacheTtlMs:parseInt(g("SWEEPER_CACHE_TTL_MS","3600000"),10),retryMaxAttempts:parseInt(g("SWEEPER_RETRY_MAX_ATTEMPTS","3"),10),retryBaseDelayMs:parseInt(g("SWEEPER_RETRY_BASE_DELAY_MS","30000"),10)},memory:{hotBudgetTokens:parseInt(g("MEMORY_HOT_BUDGET_TOKENS",String(b.memory?.hotBudgetTokens??3e3)),10),sweepIntervalHours:parseFloat(g("MEMORY_SWEEP_INTERVAL_HOURS",String(b.memory?.sweepIntervalHours??6))),hotThreshold:parseFloat(g("MEMORY_HOT_THRESHOLD",String(b.memory?.hotThreshold??.6))),warmThreshold:parseFloat(g("MEMORY_WARM_THRESHOLD",String(b.memory?.warmThreshold??.3))),recencyHalfLifeDays:parseFloat(g("MEMORY_RECENCY_HALF_LIFE_DAYS",String(b.memory?.recencyHalfLifeDays??7))),coldSummaryMinRecords:parseInt(g("MEMORY_COLD_SUMMARY_MIN",String(b.memory?.coldSummaryMinRecords??5)),10),coldRetentionDays:parseInt(g("MEMORY_COLD_RETENTION_DAYS",String(b.memory?.coldRetentionDays??90)),10),purgeRetentionDays:parseInt(g("MEMORY_PURGE_RETENTION_DAYS",String(b.memory?.purgeRetentionDays??7)),10),reflectionMinTurns:parseInt(g("MEMORY_REFLECTION_MIN_TURNS",String(b.memory?.reflectionMinTurns??3)),10)},codeIndex:{enabled:b.codeIndex?.enabled===!0||process.env.CODE_INDEX_ENABLED==="true",scoreThreshold:parseFloat(g("CODE_INDEX_SCORE_THRESHOLD",String(b.codeIndex?.scoreThreshold??.65))),prefetchLimit:parseInt(g("CODE_INDEX_PREFETCH_LIMIT",String(b.codeIndex?.prefetchLimit??8)),10),sessionKnowledge:{enabled:(b.codeIndex?.sessionKnowledge?.enabled??!0)&&process.env.CODE_INDEX_SESSION_KNOWLEDGE!=="false"},repos:b.codeIndex?.repos??{}},events:{retentionDays:parseInt(g("EVENT_RETENTION_DAYS",String(b.events?.retentionDays??30)),10)},activity:{enabled:(b.activity?.enabled??!0)&&process.env.ACTIVITY_LOG_ENABLED!=="false",bufferSize:parseInt(g("ACTIVITY_BUFFER_SIZE",String(b.activity?.bufferSize??200)),10),flushIntervalMs:parseInt(g("ACTIVITY_FLUSH_INTERVAL_MS",String(b.activity?.flushIntervalMs??3e4)),10),retentionDays:parseInt(g("ACTIVITY_RETENTION_DAYS",String(b.activity?.retentionDays??90)),10)},autoDream:{enabled:b.autoDream?.enabled??!0,idleThresholdMinutes:parseInt(g("AUTODREAM_IDLE_THRESHOLD_MINUTES",String(b.autoDream?.idleThresholdMinutes??30)),10),cooldownMinutes:parseInt(g("AUTODREAM_COOLDOWN_MINUTES",String(b.autoDream?.cooldownMinutes??60)),10),similarityThreshold:parseFloat(g("AUTODREAM_SIMILARITY_THRESHOLD",String(b.autoDream?.similarityThreshold??.85))),patternMinCount:parseInt(g("AUTODREAM_PATTERN_MIN_COUNT",String(b.autoDream?.patternMinCount??3)),10),maxClustersPerRun:parseInt(g("AUTODREAM_MAX_CLUSTERS",String(b.autoDream?.maxClustersPerRun??20)),10),maxContradictionPairsPerRun:parseInt(g("AUTODREAM_MAX_CONTRADICTIONS",String(b.autoDream?.maxContradictionPairsPerRun??30)),10),maxPromotionsPerRun:parseInt(g("AUTODREAM_MAX_PROMOTIONS",String(b.autoDream?.maxPromotionsPerRun??10)),10)},browser:{cdpEndpoint:g("BROWSER_CDP_ENDPOINT","")},tasksDir:{code:g("CODE_TASKS_DIR",`/tmp/${Zt}-code-tasks`),background:g("BG_TASKS_DIR",`/tmp/${Zt}-bg-tasks`)}}});var Yc={};Q(Yc,{runDoctor:()=>Og});import{resolve as Eg}from"node:path";import{execFileSync as jc}from"node:child_process";async function Ag(){try{return{config:(await Promise.resolve().then(()=>(fs(),us))).config,error:null}}catch(t){return{config:null,error:t instanceof Error?t.message:String(t)}}}async function Og(t={}){let e=!!t.verbose,n=Ic("com.hive.agent");console.log("hive doctor"),console.log(` cwd: ${process.cwd()}`),console.log(` hive home: ${P}`),console.log(` service path: ${n??"(LaunchAgent plist not found)"}`),console.log("");let s=bc(Eg(import.meta.dirname,"../../src/config.ts")),{config:i,error:r}=await Ag(),o=[{name:"Node.js >= 22",group:"prereq",required:!0,test:()=>parseInt(process.versions.node.split(".")[0])>=22,remedy:"Install Node 22+: brew install node@22 && brew link --overwrite node@22"},{name:"Homebrew",group:"prereq",required:!0,test:()=>zt("brew"),remedy:'Install: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'},{name:"MongoDB (brew services)",group:"prereq",required:!0,test:()=>Sc("mongodb-community"),remedy:"brew services start mongodb-community # informational; live reachability is checked under Agents"},{name:"Ollama",group:"prereq",required:!0,test:()=>mr("http://127.0.0.1:11434/api/tags"),remedy:"brew install ollama && brew services start ollama"},{name:"Ollama models (bge-large, gemma4:e4b)",group:"prereq",required:!0,test:()=>{if(!zt("ollama"))return!1;try{let c=jc("ollama",["list"],{encoding:"utf-8"});return c.includes("bge-large")&&c.includes("gemma4:e4b")}catch{return!1}},remedy:"ollama pull bge-large && ollama pull gemma4:e4b"},{name:"Qdrant",group:"prereq",required:!0,test:()=>mr("http://127.0.0.1:6333/"),remedy:"brew install qdrant && brew services start qdrant"},{name:"gh CLI",group:"prereq",required:!1,test:()=>zt("gh")},{name:"gog CLI",group:"prereq",required:!1,test:()=>zt("gog")},{name:"Xcode CLI Tools",group:"prereq",required:!0,test:()=>{try{return jc("xcode-select",["-p"],{encoding:"utf-8"}),!0}catch{return!1}},remedy:"xcode-select --install"},{name:"config loads (hive.yaml + required env)",group:"config",required:!0,test:()=>i!==null,remedy:r?`config.ts threw: ${r}. Set missing env vars in ~/.hive/.env and ensure hive.yaml exists.`:"Check hive.yaml at the hive home and run `hive init` if missing."},...s.map(c=>({name:`env: ${c}`,group:"config",required:!0,test:()=>!!process.env[c],remedy:`Set ${c} in ~/.hive/.env`})),{name:"MongoDB reachable",group:"agents",required:!0,test:()=>i?Ec(i.mongo.uri,i.mongo.dbName):!1,remedy:"Start Mongo (`brew services start mongodb-community`) and verify MONGODB_URI."},{name:"At least one agent exists",group:"agents",required:!0,test:()=>i?Ac(i.mongo.uri,i.mongo.dbName):!1,remedy:"Run `npm run setup:seeds` to import plugin agent seeds."},{name:`default agent exists${i?` (${i.defaultAgent})`:""}`,group:"agents",required:!0,test:()=>i?_c(i.mongo.uri,i.mongo.dbName,i.defaultAgent):!1,remedy:i?`Set DEFAULT_AGENT to an existing agent id or seed '${i.defaultAgent}'.`:"Config failed to load \u2014 see Config group."},{name:"LaunchAgent com.hive.agent running",group:"services",required:!0,test:()=>{let c=vc("com.hive.agent");return c.loaded&&c.state==="running"&&c.pid!==null&&kc(c.pid)},remedy:(()=>{let c=process.getuid?.()??0;return`launchctl bootstrap gui/${c} ~/Library/LaunchAgents/com.hive.agent.plist && launchctl kickstart -k gui/${c}/com.hive.agent`})()},{name:"Slack auth.test",group:"services",required:!0,test:()=>i?Oc(i.slack.botToken):!1,remedy:"Verify SLACK_BOT_TOKEN in .env and that the token still has the expected scopes."}],a=!0,l=null;for(let c of o){c.group!==l&&(console.log(`
228
+ ${_g[c.group]}`),l=c.group);let f=await c.test(),u=f?"\u2713":c.required?"\u2717":"\u25CB",d=c.required?"":" (optional)";console.log(` ${u} ${c.name}${d}`),!f&&e&&c.remedy&&console.log(` \u2192 ${c.remedy}`),!f&&c.required&&(a=!1)}a||(console.log(`
226
229
  Some required checks failed. Run with --verbose for remedy hints.`),process.exit(1)),console.log(`
227
- All checks passed.`)}var hg,Bc=C(()=>{"use strict";kc();ee();hg={prereq:"Prereqs",config:"Config",agents:"Agents",services:"Services"}});import{readFileSync as gg,writeFileSync as yg,existsSync as Sg}from"node:fs";import{resolve as wg}from"node:path";function Ne(){return wg(T,process.env.HIVE_CONFIG||"hive.yaml")}function se(t){let e=t??Ne();return Sg(e)?(0,ls.parse)(gg(e,"utf-8"))??{}:{}}function rt(t,e){let n=e??Ne();yg(n,(0,ls.stringify)(t,{lineWidth:0}))}var ls,cs=C(()=>{"use strict";ls=me(Ie(),1);ee()});function us(t,e,n,s){if(xc[t]<xc[bg])return;let i={ts:new Date().toISOString(),level:t,component:e,msg:n,...s};(t==="error"?process.stderr:process.stdout).write(JSON.stringify(i)+`
228
- `)}function x(t){return{debug:(e,n)=>us("debug",t,e,n),info:(e,n)=>us("info",t,e,n),warn:(e,n)=>us("warn",t,e,n),error:(e,n)=>us("error",t,e,n)}}var xc,bg,ie=C(()=>{"use strict";xc={debug:0,info:1,warn:2,error:3},bg=process.env.LOG_LEVEL||"info"});import{execFileSync as pr}from"node:child_process";function hr(){let t=se(),n=`com.hive.${t.instanceId??t.id??"hive"}.agent`;try{pr("launchctl",["list",n],{stdio:"pipe"})}catch{return!1}let s=pr("id",["-u"],{stdio:"pipe",encoding:"utf-8"}).trim();try{return pr("launchctl",["kickstart","-k",`gui/${s}/${n}`],{stdio:"pipe"}),Fc.info("Hive service restarted",{label:n}),!0}catch(i){return Fc.warn("Failed to restart hive service",{label:n,error:String(i)}),!1}}var Fc,Uc=C(()=>{"use strict";cs();ie();Fc=x("hive-restart")});import{readFileSync as vg}from"node:fs";import{resolve as jc}from"node:path";function Eg(){let t=[jc(import.meta.dirname,"..","..","package.json"),jc(import.meta.dirname,"..","package.json")];for(let e of t)try{let n=JSON.parse(vg(e,"utf-8"));if(n?.name==="@keepur/hive"&&typeof n.hiveApi=="string")return n.hiveApi}catch{continue}return null}var kg,Yc,fs,mr=C(()=>{"use strict";ie();kg=x("api-version");Yc=Eg();Yc||kg.warn("Could not read hiveApi from package.json; falling back to 1.0.0");fs=Yc??"1.0.0"});function Hc(t,e){let n=t.trim();if(n===e)return!0;if(n.startsWith("^")){let s=n.slice(1).split(".").map(Number),i=e.split(".").map(Number);return!(s.length<1||i.length<1||s[0]!==i[0]||(i[1]??0)<(s[1]??0)||(i[1]??0)===(s[1]??0)&&(i[2]??0)<(s[2]??0))}return _g.warn("Unrecognized hiveApi range syntax, accepting",{range:t}),!0}var Ag,_g,Gc=C(()=>{"use strict";Ag=me(Ie(),1);ie();mr();_g=x("plugin-loader")});var Wc={};Q(Wc,{runPlugin:()=>Ig});import{execFileSync as ds}from"node:child_process";import{existsSync as ot,mkdirSync as Og,readFileSync as yr}from"node:fs";import{resolve as Qt,join as ps}from"node:path";function Vc(t,e){let n=ps(t,"..","package.json");if(ot(n))try{let i=JSON.parse(yr(n,"utf-8"));if(typeof i?.version=="string")return i.version}catch{}let s=e;return typeof s?.version=="string"?s.version:"unknown"}async function Ig(t,e){switch(t){case"add":return Tg(e);case"remove":return Ng(e);case"list":return Lg();default:console.error("Usage: hive plugin <add|list|remove> [package]"),process.exit(1)}}function Tg(t){t||(console.error("Usage: hive plugin add <package-name>"),process.exit(1)),Og(re,{recursive:!0});let e=Qt(re,"package.json");ot(e)||ds("npm",["init","-y"],{cwd:re,stdio:"pipe"}),console.log(`Installing ${t}...`);try{ds("npm",["install",t],{cwd:re,stdio:"pipe"})}catch(f){console.error(`Failed to install ${t}: ${String(f)}`),process.exit(1)}let n=Qt(re,"node_modules",t),s=ps(n,"plugin.yaml");ot(s)||(console.error(`Not a valid hive plugin \u2014 no plugin.yaml found in ${t}.`),gr(t),process.exit(1));let i=(0,Sr.parse)(yr(s,"utf-8")),r=i?.hiveApi??i?.["hive-api"];r&&!Hc(r,fs)&&(console.error(`Plugin requires hiveApi ${r} but this hive is ${fs}.`),gr(t),process.exit(1));let o=Vc(s,i),a=Ne(),l=se(a);if(l.plugins||(l.plugins=[]),!l.plugins.includes(t)){l.plugins.push(t);try{rt(l,a)}catch(f){console.error(`Failed to update hive.yaml: ${String(f)}`),gr(t),process.exit(1)}console.log("\u2713 Updated hive.yaml")}let c=hr();console.log(c?"\u2713 Restarting hive... done":"Start hive to activate the plugin."),console.log(`\u2713 Installed ${t} (v${o}${r?`, hiveApi ${r}`:""})`)}function Ng(t){t||(console.error("Usage: hive plugin remove <package-name>"),process.exit(1)),ot(re)||(console.error("No plugins directory found."),process.exit(1)),console.log(`Removing ${t}...`);try{ds("npm",["uninstall",t],{cwd:re,stdio:"pipe"})}catch(i){console.error(`Failed to uninstall ${t}: ${String(i)}`),process.exit(1)}let e=Ne(),n=se(e);if(Array.isArray(n.plugins)){let i=n.plugins.indexOf(t);i>=0&&(n.plugins.splice(i,1),rt(n,e),console.log("\u2713 Updated hive.yaml"))}let s=hr();console.log(s?"\u2713 Restarting hive... done":"Restart hive to complete removal."),console.log(`Removed ${t}`)}function Lg(){let t=Ne(),n=se(t).plugins??[];if(n.length===0){console.log("No plugins configured in hive.yaml.");return}console.log(`Installed plugins:
229
- `);for(let s of n){let i=Qt(re,"node_modules",s),r=Qt(re,s),o=ps(i,"plugin.yaml"),a=ps(r,"plugin.yaml"),l=null,c=!1;if(ot(o)?l=o:ot(a)&&(l=a,c=!0),!l){console.log(` ${s} \u26A0 not found on disk`);continue}try{let f=(0,Sr.parse)(yr(l,"utf-8")),u=Vc(l,f),d=f?.hiveApi??f?.["hive-api"]??"",h=c?" [in-tree]":"";console.log(` ${s} v${u}${d?` (hiveApi ${d})`:""}${h}`)}catch{console.log(` ${s} \u26A0 failed to read plugin.yaml`)}}}function gr(t){try{ds("npm",["uninstall",t],{cwd:re,stdio:"pipe"})}catch{}}var Sr,re,Jc=C(()=>{"use strict";Sr=me(Ie(),1);ee();cs();Uc();mr();Gc();re=Qt(T,"plugins")});var Zc={};Q(Zc,{checkoutSha:()=>_r,findTagForSha:()=>at,listSkillsInClone:()=>Ar,lsRemoteHead:()=>Er,partialClone:()=>kr,shallowClone:()=>vr,verifyGitAvailable:()=>zt});import{execFileSync as oe}from"node:child_process";import{existsSync as Qc,readdirSync as Cg,statSync as Pg,rmSync as wr,mkdtempSync as zc}from"node:fs";import{join as Ke}from"node:path";import{tmpdir as Xc}from"node:os";function zt(){try{oe("git",["--version"],{stdio:"pipe"})}catch{throw new Error("git is required for skill installation but was not found. Install git and retry.")}}function vr(t){let e=zc(Ke(Xc(),"hive-skill-install-")),n=Ke(e,"repo"),s=()=>{try{wr(e,{recursive:!0,force:!0})}catch{}};try{oe("git",["clone","--depth","1",t,n],{stdio:"pipe",timeout:6e4});let i=oe("git",["rev-parse","HEAD"],{cwd:n,stdio:"pipe",encoding:"utf-8"}).trim();return br.debug("Shallow clone complete",{url:t,headSha:i}),{dir:n,headSha:i,cleanup:s}}catch(i){throw s(),new Error(`registry fetch failed: ${String(i)}`)}}function kr(t){let e=zc(Ke(Xc(),"hive-skill-upgrade-")),n=Ke(e,"repo"),s=()=>{try{wr(e,{recursive:!0,force:!0})}catch{}};try{try{oe("git",["clone","--filter=blob:none","--no-checkout",t,n],{stdio:"pipe",timeout:12e4}),oe("git",["checkout","HEAD"],{cwd:n,stdio:"pipe"})}catch(r){br.debug("Blobless clone failed, falling back to full clone",{error:String(r)}),wr(n,{recursive:!0,force:!0}),oe("git",["clone",t,n],{stdio:"pipe",timeout:12e4})}let i=oe("git",["rev-parse","HEAD"],{cwd:n,stdio:"pipe",encoding:"utf-8"}).trim();return br.debug("Partial clone complete",{url:t,headSha:i}),{dir:n,headSha:i,cleanup:s}}catch(i){throw s(),new Error(`registry fetch failed: ${String(i)}`)}}function Er(t){let n=oe("git",["ls-remote",t,"HEAD"],{stdio:"pipe",encoding:"utf-8",timeout:3e4}).trim().split(" ")[0];if(!n)throw new Error(`Could not determine HEAD for ${t}`);return n}function Ar(t){let e=Ke(t,"skills");return Qc(e)?Cg(e).filter(n=>{try{let s=Ke(e,n);return Pg(s).isDirectory()&&Qc(Ke(s,"SKILL.md"))}catch{return!1}}):[]}function _r(t,e){oe("git",["checkout",e],{cwd:t,stdio:"pipe"})}function at(t,e){try{return oe("git",["describe","--tags","--exact-match",e],{cwd:t,stdio:"pipe",encoding:"utf-8"}).trim()||void 0}catch{return}}var br,Xt=C(()=>{"use strict";ie();br=x("registry-fetch")});function eu(t){if(t.includes("#skills/")){let n=t.indexOf("#skills/"),s=t.slice(0,n);return{name:t.slice(n+8),inlineUrl:s}}let e=t.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/(?:tree|blob)\/[^/]+\/skills\/([^/]+)/);if(e)return{name:e[3],inlineUrl:`https://github.com/${e[1]}/${e[2]}`};if(t.includes(":")&&!t.includes("://")){let n=t.indexOf(":"),s=t.slice(0,n);return{name:t.slice(n+1),registryName:s}}return{name:t}}function tu(t,e){if(t.inlineUrl){let i=Mg(t.inlineUrl);return Or.debug("resolved inline registry",{inlineUrl:t.inlineUrl,name:i}),{name:i,url:t.inlineUrl}}if(t.registryName){let i=e.find(r=>r.name===t.registryName);if(!i)throw new Error(`Unknown registry: "${t.registryName}". Configured registries: ${e.map(r=>r.name).join(", ")}`);return Or.debug("resolved named registry",{registryName:t.registryName,url:i.url}),{name:i.name,url:i.url}}let n={name:"keepur-default",url:"https://github.com/keepur/hive-skills"},s=e.find(i=>i.default)??e[0]??n;return Or.debug("resolved default registry",{registryName:s.name,url:s.url}),{name:s.name,url:s.url}}function Mg(t){try{return t.replace(/\.git$/,"").split("/").filter(Boolean).slice(-2).join("-")}catch{return"inline"}}var Or,nu=C(()=>{"use strict";ie();Or=x("registry-resolver")});import{join as $g}from"node:path";import{readFileSync as Dg}from"node:fs";function su(t,e){let s=Dg(t,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(!s)return e;let i=s[1].match(/^workflow:\s*(.+)$/m);return i?i[1].trim():e}function iu(t,e,n){return $g(t,e,"skills",n)}var ru=C(()=>{"use strict"});import{readFileSync as qg,writeFileSync as Rg}from"node:fs";function Ir(t){let e=t.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!e)throw new Error("No YAML frontmatter found");let n=e[1],s=e[2],i={name:"",description:"",agents:[]},r=n.split(`
230
- `),o=0;for(;o<r.length;){let a=r[o];if(a.trim()===""){o++;continue}let l=a.match(/^(\w[\w-]*):\s*(.*)/);if(!l){o++;continue}let c=l[1],f=l[2].trim();if(c==="name")i.name=Be(f);else if(c==="description")i.description=Be(f);else if(c==="workflow")i.workflow=Be(f);else if(c==="agents"){let u=f.match(/^\[([^\]]*)\]$/);if(u)i.agents=u[1].split(",").map(d=>Be(d.trim())).filter(d=>d.length>0);else if(f==="")for(i.agents=[];o+1<r.length&&r[o+1].match(/^\s+-\s+/);){o++;let d=r[o].replace(/^\s+-\s+/,"").trim();i.agents.push(Be(d))}else i.agents=[Be(f)]}else if(c==="origin")for(i.origin=ou(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;else if(c==="author")for(i.author=ou(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;o++}return{frontmatter:i,body:s}}function ou(t,e){let n={},s=e+1;for(;s<t.length&&t[s].match(/^\s+\S/);){let i=t[s].match(/^\s+([\w][\w-]*):\s*(.*)/);if(i){let r=i[2].trim();r==="true"?n[i[1]]=!0:r==="false"?n[i[1]]=!1:n[i[1]]=Be(r)}s++}return n}function Be(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"):t}function Tr(t,e){let n=[];n.push(`name: ${hs(t.name)}`),n.push(`description: ${hs(t.description)}`);let s=t.agents.join(", ");return n.push(`agents: [${s}]`),t.workflow&&n.push(`workflow: ${hs(t.workflow)}`),t.origin&&(n.push("origin:"),au(n,t.origin)),t.author&&(n.push("author:"),au(n,t.author)),`---
230
+ All checks passed.`)}var _g,Hc=L(()=>{"use strict";Tc();ne();_g={prereq:"Prereqs",config:"Config",agents:"Agents",services:"Services"}});import{readFileSync as Ig,writeFileSync as Tg,existsSync as Ng}from"node:fs";import{resolve as Lg}from"node:path";function Ce(){return Lg(P,process.env.HIVE_CONFIG||"hive.yaml")}function se(t){let e=t??Ce();return Ng(e)?(0,ds.parse)(Ig(e,"utf-8"))??{}:{}}function at(t,e){let n=e??Ce();Tg(n,(0,ds.stringify)(t,{lineWidth:0}))}var ds,ps=L(()=>{"use strict";ds=le(fe(),1);ne()});function hs(t,e,n,s){if(Gc[t]<Gc[Cg])return;let i={ts:new Date().toISOString(),level:t,component:e,msg:n,...s};(t==="error"?process.stderr:process.stdout).write(JSON.stringify(i)+`
231
+ `)}function x(t){return{debug:(e,n)=>hs("debug",t,e,n),info:(e,n)=>hs("info",t,e,n),warn:(e,n)=>hs("warn",t,e,n),error:(e,n)=>hs("error",t,e,n)}}var Gc,Cg,ie=L(()=>{"use strict";Gc={debug:0,info:1,warn:2,error:3},Cg=process.env.LOG_LEVEL||"info"});import{execFileSync as wr}from"node:child_process";function Sr(){let t=se(),n=`com.hive.${t.instanceId??t.id??"hive"}.agent`;try{wr("launchctl",["list",n],{stdio:"pipe"})}catch{return!1}let s=wr("id",["-u"],{stdio:"pipe",encoding:"utf-8"}).trim();try{return wr("launchctl",["kickstart","-k",`gui/${s}/${n}`],{stdio:"pipe"}),Vc.info("Hive service restarted",{label:n}),!0}catch(i){return Vc.warn("Failed to restart hive service",{label:n,error:String(i)}),!1}}var Vc,Wc=L(()=>{"use strict";ps();ie();Vc=x("hive-restart")});import{readFileSync as Pg}from"node:fs";import{resolve as Jc}from"node:path";function $g(){let t=[Jc(import.meta.dirname,"..","..","package.json"),Jc(import.meta.dirname,"..","package.json")];for(let e of t)try{let n=JSON.parse(Pg(e,"utf-8"));if(n?.name==="@keepur/hive"&&typeof n.hiveApi=="string")return n.hiveApi}catch{continue}return null}var Mg,Qc,ms,br=L(()=>{"use strict";ie();Mg=x("api-version");Qc=$g();Qc||Mg.warn("Could not read hiveApi from package.json; falling back to 1.0.0");ms=Qc??"1.0.0"});function zc(t,e){let n=t.trim();if(n===e)return!0;if(n.startsWith("^")){let s=n.slice(1).split(".").map(Number),i=e.split(".").map(Number);return!(s.length<1||i.length<1||s[0]!==i[0]||(i[1]??0)<(s[1]??0)||(i[1]??0)===(s[1]??0)&&(i[2]??0)<(s[2]??0))}return qg.warn("Unrecognized hiveApi range syntax, accepting",{range:t}),!0}var Dg,qg,Xc=L(()=>{"use strict";Dg=le(fe(),1);ie();br();qg=x("plugin-loader")});var eu={};Q(eu,{runPlugin:()=>Kg});import{execFileSync as gs}from"node:child_process";import{existsSync as lt,mkdirSync as Rg,readFileSync as kr}from"node:fs";import{resolve as en,join as ys}from"node:path";function Zc(t,e){let n=ys(t,"..","package.json");if(lt(n))try{let i=JSON.parse(kr(n,"utf-8"));if(typeof i?.version=="string")return i.version}catch{}let s=e;return typeof s?.version=="string"?s.version:"unknown"}async function Kg(t,e){switch(t){case"add":return Bg(e);case"remove":return xg(e);case"list":return Fg();default:console.error("Usage: hive plugin <add|list|remove> [package]"),process.exit(1)}}function Bg(t){t||(console.error("Usage: hive plugin add <package-name>"),process.exit(1)),Rg(re,{recursive:!0});let e=en(re,"package.json");lt(e)||gs("npm",["init","-y"],{cwd:re,stdio:"pipe"}),console.log(`Installing ${t}...`);try{gs("npm",["install",t],{cwd:re,stdio:"pipe"})}catch(f){console.error(`Failed to install ${t}: ${String(f)}`),process.exit(1)}let n=en(re,"node_modules",t),s=ys(n,"plugin.yaml");lt(s)||(console.error(`Not a valid hive plugin \u2014 no plugin.yaml found in ${t}.`),vr(t),process.exit(1));let i=(0,Er.parse)(kr(s,"utf-8")),r=i?.hiveApi??i?.["hive-api"];r&&!zc(r,ms)&&(console.error(`Plugin requires hiveApi ${r} but this hive is ${ms}.`),vr(t),process.exit(1));let o=Zc(s,i),a=Ce(),l=se(a);if(l.plugins||(l.plugins=[]),!l.plugins.includes(t)){l.plugins.push(t);try{at(l,a)}catch(f){console.error(`Failed to update hive.yaml: ${String(f)}`),vr(t),process.exit(1)}console.log("\u2713 Updated hive.yaml")}let c=Sr();console.log(c?"\u2713 Restarting hive... done":"Start hive to activate the plugin."),console.log(`\u2713 Installed ${t} (v${o}${r?`, hiveApi ${r}`:""})`)}function xg(t){t||(console.error("Usage: hive plugin remove <package-name>"),process.exit(1)),lt(re)||(console.error("No plugins directory found."),process.exit(1)),console.log(`Removing ${t}...`);try{gs("npm",["uninstall",t],{cwd:re,stdio:"pipe"})}catch(i){console.error(`Failed to uninstall ${t}: ${String(i)}`),process.exit(1)}let e=Ce(),n=se(e);if(Array.isArray(n.plugins)){let i=n.plugins.indexOf(t);i>=0&&(n.plugins.splice(i,1),at(n,e),console.log("\u2713 Updated hive.yaml"))}let s=Sr();console.log(s?"\u2713 Restarting hive... done":"Restart hive to complete removal."),console.log(`Removed ${t}`)}function Fg(){let t=Ce(),n=se(t).plugins??[];if(n.length===0){console.log("No plugins configured in hive.yaml.");return}console.log(`Installed plugins:
232
+ `);for(let s of n){let i=en(re,"node_modules",s),r=en(re,s),o=ys(i,"plugin.yaml"),a=ys(r,"plugin.yaml"),l=null,c=!1;if(lt(o)?l=o:lt(a)&&(l=a,c=!0),!l){console.log(` ${s} \u26A0 not found on disk`);continue}try{let f=(0,Er.parse)(kr(l,"utf-8")),u=Zc(l,f),d=f?.hiveApi??f?.["hive-api"]??"",h=c?" [in-tree]":"";console.log(` ${s} v${u}${d?` (hiveApi ${d})`:""}${h}`)}catch{console.log(` ${s} \u26A0 failed to read plugin.yaml`)}}}function vr(t){try{gs("npm",["uninstall",t],{cwd:re,stdio:"pipe"})}catch{}}var Er,re,tu=L(()=>{"use strict";Er=le(fe(),1);ne();ps();Wc();br();Xc();re=en(P,"plugins")});var ru={};Q(ru,{checkoutSha:()=>Lr,findTagForSha:()=>ct,listSkillsInClone:()=>Nr,lsRemoteHead:()=>Tr,partialClone:()=>Ir,shallowClone:()=>Or,verifyGitAvailable:()=>tn});import{execFileSync as oe}from"node:child_process";import{existsSync as nu,readdirSync as Ug,statSync as jg,rmSync as Ar,mkdtempSync as su}from"node:fs";import{join as xe}from"node:path";import{tmpdir as iu}from"node:os";function tn(){try{oe("git",["--version"],{stdio:"pipe"})}catch{throw new Error("git is required for skill installation but was not found. Install git and retry.")}}function Or(t){let e=su(xe(iu(),"hive-skill-install-")),n=xe(e,"repo"),s=()=>{try{Ar(e,{recursive:!0,force:!0})}catch{}};try{oe("git",["clone","--depth","1",t,n],{stdio:"pipe",timeout:6e4});let i=oe("git",["rev-parse","HEAD"],{cwd:n,stdio:"pipe",encoding:"utf-8"}).trim();return _r.debug("Shallow clone complete",{url:t,headSha:i}),{dir:n,headSha:i,cleanup:s}}catch(i){throw s(),new Error(`registry fetch failed: ${String(i)}`)}}function Ir(t){let e=su(xe(iu(),"hive-skill-upgrade-")),n=xe(e,"repo"),s=()=>{try{Ar(e,{recursive:!0,force:!0})}catch{}};try{try{oe("git",["clone","--filter=blob:none","--no-checkout",t,n],{stdio:"pipe",timeout:12e4}),oe("git",["checkout","HEAD"],{cwd:n,stdio:"pipe"})}catch(r){_r.debug("Blobless clone failed, falling back to full clone",{error:String(r)}),Ar(n,{recursive:!0,force:!0}),oe("git",["clone",t,n],{stdio:"pipe",timeout:12e4})}let i=oe("git",["rev-parse","HEAD"],{cwd:n,stdio:"pipe",encoding:"utf-8"}).trim();return _r.debug("Partial clone complete",{url:t,headSha:i}),{dir:n,headSha:i,cleanup:s}}catch(i){throw s(),new Error(`registry fetch failed: ${String(i)}`)}}function Tr(t){let n=oe("git",["ls-remote",t,"HEAD"],{stdio:"pipe",encoding:"utf-8",timeout:3e4}).trim().split(" ")[0];if(!n)throw new Error(`Could not determine HEAD for ${t}`);return n}function Nr(t){let e=xe(t,"skills");return nu(e)?Ug(e).filter(n=>{try{let s=xe(e,n);return jg(s).isDirectory()&&nu(xe(s,"SKILL.md"))}catch{return!1}}):[]}function Lr(t,e){oe("git",["checkout",e],{cwd:t,stdio:"pipe"})}function ct(t,e){try{return oe("git",["describe","--tags","--exact-match",e],{cwd:t,stdio:"pipe",encoding:"utf-8"}).trim()||void 0}catch{return}}var _r,nn=L(()=>{"use strict";ie();_r=x("registry-fetch")});function ou(t){if(t.includes("#skills/")){let n=t.indexOf("#skills/"),s=t.slice(0,n);return{name:t.slice(n+8),inlineUrl:s}}let e=t.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/(?:tree|blob)\/[^/]+\/skills\/([^/]+)/);if(e)return{name:e[3],inlineUrl:`https://github.com/${e[1]}/${e[2]}`};if(t.includes(":")&&!t.includes("://")){let n=t.indexOf(":"),s=t.slice(0,n);return{name:t.slice(n+1),registryName:s}}return{name:t}}function au(t,e){if(t.inlineUrl){let i=Yg(t.inlineUrl);return Cr.debug("resolved inline registry",{inlineUrl:t.inlineUrl,name:i}),{name:i,url:t.inlineUrl}}if(t.registryName){let i=e.find(r=>r.name===t.registryName);if(!i)throw new Error(`Unknown registry: "${t.registryName}". Configured registries: ${e.map(r=>r.name).join(", ")}`);return Cr.debug("resolved named registry",{registryName:t.registryName,url:i.url}),{name:i.name,url:i.url}}let n={name:"keepur-default",url:"https://github.com/keepur/hive-skills"},s=e.find(i=>i.default)??e[0]??n;return Cr.debug("resolved default registry",{registryName:s.name,url:s.url}),{name:s.name,url:s.url}}function Yg(t){try{return t.replace(/\.git$/,"").split("/").filter(Boolean).slice(-2).join("-")}catch{return"inline"}}var Cr,lu=L(()=>{"use strict";ie();Cr=x("registry-resolver")});import{join as Hg}from"node:path";import{readFileSync as Gg}from"node:fs";function cu(t,e){let s=Gg(t,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(!s)return e;let i=s[1].match(/^workflow:\s*(.+)$/m);return i?i[1].trim():e}function uu(t,e,n){return Hg(t,e,"skills",n)}var fu=L(()=>{"use strict"});import{readFileSync as Vg,writeFileSync as Wg}from"node:fs";function Pr(t){let e=t.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!e)throw new Error("No YAML frontmatter found");let n=e[1],s=e[2],i={name:"",description:"",agents:[]},r=n.split(`
233
+ `),o=0;for(;o<r.length;){let a=r[o];if(a.trim()===""){o++;continue}let l=a.match(/^(\w[\w-]*):\s*(.*)/);if(!l){o++;continue}let c=l[1],f=l[2].trim();if(c==="name")i.name=Fe(f);else if(c==="description")i.description=Fe(f);else if(c==="workflow")i.workflow=Fe(f);else if(c==="agents"){let u=f.match(/^\[([^\]]*)\]$/);if(u)i.agents=u[1].split(",").map(d=>Fe(d.trim())).filter(d=>d.length>0);else if(f==="")for(i.agents=[];o+1<r.length&&r[o+1].match(/^\s+-\s+/);){o++;let d=r[o].replace(/^\s+-\s+/,"").trim();i.agents.push(Fe(d))}else i.agents=[Fe(f)]}else if(c==="origin")for(i.origin=du(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;else if(c==="author")for(i.author=du(r,o);o+1<r.length&&r[o+1].match(/^\s+\S/);)o++;o++}return{frontmatter:i,body:s}}function du(t,e){let n={},s=e+1;for(;s<t.length&&t[s].match(/^\s+\S/);){let i=t[s].match(/^\s+([\w][\w-]*):\s*(.*)/);if(i){let r=i[2].trim();r==="true"?n[i[1]]=!0:r==="false"?n[i[1]]=!1:n[i[1]]=Fe(r)}s++}return n}function Fe(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"):t}function Mr(t,e){let n=[];n.push(`name: ${ws(t.name)}`),n.push(`description: ${ws(t.description)}`);let s=t.agents.join(", ");return n.push(`agents: [${s}]`),t.workflow&&n.push(`workflow: ${ws(t.workflow)}`),t.origin&&(n.push("origin:"),pu(n,t.origin)),t.author&&(n.push("author:"),pu(n,t.author)),`---
231
234
  ${n.join(`
232
235
  `)}
233
236
  ---
234
- ${e}`}function au(t,e){for(let[n,s]of Object.entries(e))s!==void 0&&t.push(` ${n}: ${hs(String(s))}`)}function hs(t){return t.includes(":")||t.includes("#")||t.includes('"')?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t}function ae(t){let e=qg(t,"utf-8");return Ir(e)}function Nr(t,e,n){Rg(t,Tr(e,n),"utf-8")}function lu(t){let e=t.match(/^(---\n)([\s\S]*?)(\n---\n?)([\s\S]*)$/);if(!e)return t;let n=e[1],s=e[2],i=e[3],r=e[4],o=s.split(`
237
+ ${e}`}function pu(t,e){for(let[n,s]of Object.entries(e))s!==void 0&&t.push(` ${n}: ${ws(String(s))}`)}function ws(t){return t.includes(":")||t.includes("#")||t.includes('"')?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t}function ae(t){let e=Vg(t,"utf-8");return Pr(e)}function $r(t,e,n){Wg(t,Mr(e,n),"utf-8")}function hu(t){let e=t.match(/^(---\n)([\s\S]*?)(\n---\n?)([\s\S]*)$/);if(!e)return t;let n=e[1],s=e[2],i=e[3],r=e[4],o=s.split(`
235
238
  `),a=[],l=!1;for(let c of o){if(l){if(c.match(/^\s+\S/))continue;l=!1}if(c.match(/^origin:\s*$/)){l=!0;continue}c.match(/^origin:\s+\S/)||a.push(c)}return n+a.join(`
236
- `)+i+r}var lt=C(()=>{"use strict"});import{createHash as Kg}from"node:crypto";import{readdirSync as Bg,readFileSync as xg,statSync as Fg}from"node:fs";import{join as cu}from"node:path";function Zt(t){let e=uu(t).sort(),n=Kg("sha256");for(let s=0;s<e.length;s++){s>0&&n.update("\0");let i=cu(t,e[s]),r=xg(i,"utf-8");e[s]==="SKILL.md"?n.update(lu(r)):n.update(r)}return n.digest("hex")}function uu(t,e=""){let n=Bg(t),s=[];for(let i of n){let r=cu(t,i),o=e?`${e}/${i}`:i;Fg(r).isDirectory()?s.push(...uu(r,o)):s.push(o)}return s}var Lr=C(()=>{"use strict";lt()});import{execFileSync as ms}from"node:child_process";import{existsSync as gs,mkdirSync as fb,unlinkSync as fu}from"node:fs";import{resolve as du,join as pu}from"node:path";function ct(t,e,n,s){let i=du(t,".hive","git");if(!gs(i)){en.warn("Instance git not initialized \u2014 skipping state commit");return}let r=pu(i,"state-index.tmp"),o={...process.env,GIT_DIR:i,GIT_WORK_TREE:t,GIT_INDEX_FILE:r},a=(...l)=>ms("git",[...l],{cwd:t,env:o,stdio:"pipe",encoding:"utf-8"}).trim();try{a("read-tree","state");for(let h of e)a("add","--force","--",h);try{a("rm","--cached","--ignore-unmatch","-r","--","**/.DS_Store")}catch{}let l=a("write-tree"),c=a("rev-parse","state"),f=a("rev-parse","state^{tree}");if(l===f)return;let u=s?{GIT_AUTHOR_NAME:s,GIT_AUTHOR_EMAIL:`${s}@hive`,GIT_COMMITTER_NAME:s,GIT_COMMITTER_EMAIL:`${s}@hive`}:{GIT_AUTHOR_NAME:"hive",GIT_AUTHOR_EMAIL:"hive@localhost",GIT_COMMITTER_NAME:"hive",GIT_COMMITTER_EMAIL:"hive@localhost"},d=ms("git",["commit-tree",l,"-p",c,"-m",n],{env:{...o,...u},encoding:"utf-8"}).trim();a("update-ref","refs/heads/state",d),en.debug("State branch commit",{message:n,files:e.length})}catch(l){en.warn("Failed to commit to state branch",{error:String(l),message:n})}finally{try{gs(r)&&fu(r)}catch{}}}function hu(t,e,n){let s=du(t,".hive","git");if(!gs(s))return;let i=pu(s,"state-index.tmp"),r={...process.env,GIT_DIR:s,GIT_WORK_TREE:t,GIT_INDEX_FILE:i},o=(...a)=>ms("git",[...a],{cwd:t,env:r,stdio:"pipe",encoding:"utf-8"}).trim();try{o("read-tree","state");for(let u of e)try{o("rm","-r","--cached","--",u)}catch{}let a=o("write-tree"),l=o("rev-parse","state"),c=o("rev-parse","state^{tree}");if(a===c)return;let f=ms("git",["commit-tree",a,"-p",l,"-m",n],{env:{...r,GIT_AUTHOR_NAME:"hive",GIT_AUTHOR_EMAIL:"hive@localhost",GIT_COMMITTER_NAME:"hive",GIT_COMMITTER_EMAIL:"hive@localhost"},encoding:"utf-8"}).trim();o("update-ref","refs/heads/state",f),en.debug("State branch removal commit",{message:n})}catch(a){en.warn("Failed to commit removal to state branch",{error:String(a)})}finally{try{gs(i)&&fu(i)}catch{}}}var en,ys=C(()=>{"use strict";ie();en=x("instance-git")});import{cpSync as Ug,existsSync as mu,mkdirSync as jg,readFileSync as gu,writeFileSync as Yg}from"node:fs";import{join as Ss,relative as Hg}from"node:path";function Su(t,e,n,s){let i=vr(t);try{let r=Ss(i.dir,"skills",e);if(!mu(r)){let m=Ar(i.dir);throw new Error(`Skill "${e}" not found in registry ${t}. Available skills: ${m.join(", ")||"(none)"}`)}let o=Ss(r,"SKILL.md"),a=su(o,e),c=gu(o,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(c){let m=c[1].match(/^name:\s*(.+)$/m);m&&m[1].trim()!==e&&yu.warn("Registry skill name mismatch \u2014 using directory name",{dirName:e,frontmatterName:m[1].trim()})}let f=iu(n,a,e);if(mu(f))throw new Error(`Skill "${e}" is already installed at ${f}. Use "hive skill upgrade ${e}" to update, or "hive skill remove ${e}" first.`);jg(f,{recursive:!0}),Ug(r,f,{recursive:!0});let u=Zt(f),d=at(i.dir,i.headSha),{frontmatter:h,body:y}=Ir(gu(Ss(f,"SKILL.md"),"utf-8"));h.origin={type:"registry",source:t,"base-version":i.headSha,...d?{"base-tag":d}:{},"base-content-hash":u,"installed-at":new Date().toISOString(),modified:!1},Yg(Ss(f,"SKILL.md"),Tr(h,y));let p=Hg(s,f);return ct(s,[p],`install: ${a}/${e} from ${t}@${i.headSha.slice(0,8)}`),yu.info("Skill installed",{name:e,workflow:a,version:i.headSha.slice(0,8)}),{name:e,workflow:a,targetPath:f,version:i.headSha}}finally{i.cleanup()}}var yu,wu=C(()=>{"use strict";Xt();ru();lt();Lr();ys();ie();yu=x("skill-install")});import{existsSync as bs,readFileSync as Cr,cpSync as ws,mkdirSync as bu,readdirSync as Gg,statSync as Vg}from"node:fs";import{join as G,relative as Pr}from"node:path";function Mr(t,e){if(!bs(e))return null;for(let n of Gg(e)){let s=G(e,n);try{if(!Vg(s).isDirectory())continue}catch{continue}let i=G(s,"skills",t);if(bs(G(i,"SKILL.md")))return{path:i,workflow:n}}return null}async function $r(t,e,n,s){let i=Mr(t,e);if(!i)throw new Error(`Skill "${t}" is not installed or is not registry-sourced.`);let{frontmatter:r}=ae(G(i.path,"SKILL.md")),o=r.origin;if(!o||o.type!=="registry"||!o.source||!o["base-version"])throw new Error(`Skill "${t}" has no registry origin metadata.`);let a=Er(o.source),l=o["base-version"];if(a===l)return{name:t,action:"up-to-date",oldVersion:l};let c=kr(o.source);try{let f=G(c.dir,"skills",t);if(!bs(G(f,"SKILL.md")))return vu.warn("Skill removed from registry \u2014 keeping installed copy",{name:t,source:o.source}),ct(n,[Pr(n,i.path)],`upgrade-check: ${i.workflow}/${t} removed from upstream registry`),{name:t,action:"removed-upstream",oldVersion:l};if(!o.modified){ws(f,i.path,{recursive:!0});let E=Zt(i.path),O=at(c.dir,a),{frontmatter:N,body:k}=ae(G(i.path,"SKILL.md"));N.origin={...N.origin,"base-version":a,"base-content-hash":E,"installed-at":new Date().toISOString(),modified:!1,...O?{"base-tag":O}:{}},Nr(G(i.path,"SKILL.md"),N,k);let M=Pr(n,i.path);return ct(n,[M],`upgrade: ${t} ${l.slice(0,8)} \u2192 ${a.slice(0,8)}`),{name:t,action:"applied",oldVersion:l,newVersion:a}}let u=Cr(G(i.path,"SKILL.md"),"utf-8"),d=Cr(G(f,"SKILL.md"),"utf-8"),h=G(c.dir,".hive-theirs-copy",t);bu(h,{recursive:!0}),ws(f,h,{recursive:!0});let y;try{_r(c.dir,l);let E=G(c.dir,"skills",t,"SKILL.md");bs(E)&&(y=Cr(E,"utf-8"))}catch{}if(await s(u,d,y)==="keep")return{name:t,action:"kept",oldVersion:l};if(!y){let E=G(n,".hive","skill-backups",`${t}-${Date.now()}`);bu(E,{recursive:!0}),ws(i.path,E,{recursive:!0}),vu.info("Backed up modified skill before upgrade",{backup:E})}ws(h,i.path,{recursive:!0});let m=Zt(i.path),w=at(c.dir,a),{frontmatter:v,body:A}=ae(G(i.path,"SKILL.md"));v.origin={...v.origin,"base-version":a,"base-content-hash":m,"installed-at":new Date().toISOString(),modified:!1,...w?{"base-tag":w}:{}},Nr(G(i.path,"SKILL.md"),v,A);let _=Pr(n,i.path);return ct(n,[_],`upgrade: ${t} ${l.slice(0,8)} \u2192 ${a.slice(0,8)} (took upstream)`),{name:t,action:"taken",oldVersion:l,newVersion:a}}finally{c.cleanup()}}var vu,Dr=C(()=>{"use strict";Xt();lt();Lr();ys();ie();vu=x("skill-upgrade")});import{existsSync as ku,rmSync as Eu,readdirSync as Wg}from"node:fs";import{join as qr,relative as Jg}from"node:path";async function _u(t,e,n,s={}){let i=Mr(t,e);if(!i)throw new Error(`Skill "${t}" is not installed.`);let r=qr(i.path,"SKILL.md");if(ku(r))try{let{frontmatter:l}=ae(r);if((l.origin?.modified===!0||l.origin?.type==="agent-authored")&&!s.force){let f=`Warning: ${i.workflow}/${t} has local modifications that will be removed. Your changes are preserved in git history on the 'state' branch. Proceed?`;if(s.confirmFn){if(!await s.confirmFn(f))return Au.info("Skill removal aborted by user",{name:t}),!1}else return console.log(f),console.log("Use --force to skip this prompt."),!1}}catch{}let o=Jg(n,i.path);Eu(i.path,{recursive:!0,force:!0});let a=qr(e,i.workflow,"skills");return ku(a)&&Wg(a).length===0&&Eu(qr(e,i.workflow),{recursive:!0,force:!0}),hu(n,[o],`remove: ${i.workflow}/${t}`),Au.info("Skill removed",{name:t,workflow:i.workflow}),!0}var Au,Ou=C(()=>{"use strict";lt();ys();Dr();ie();Au=x("skill-remove")});var Tu={};Q(Tu,{runSkill:()=>Xg});import{existsSync as de,readdirSync as ut,readFileSync as Qg,statSync as zg}from"node:fs";import{join as Le}from"node:path";import{createInterface as Iu}from"node:readline";async function Xg(t,...e){switch(t){case"add":{zt();let n=e[0];n||(console.error("Usage: hive skill add <name|registry:name|url#skills/name>"),process.exit(1));let{config:s}=await Promise.resolve().then(()=>(as(),os)),i=eu(n),r=tu(i,s.skillRegistries),o=Su(r.url,i.name,j,T);console.log(`Installed ${o.workflow}/${o.name} (${o.version.slice(0,8)})`);break}case"list":{e.includes("--available")?(zt(),await ey(e)):Zg();break}case"upgrade":{zt();let n=e[0];n||(console.error("Usage: hive skill upgrade <name|--all>"),process.exit(1));let s=async(i,r,o)=>{console.log(`
239
+ `)+i+r}var ut=L(()=>{"use strict"});import{createHash as Jg}from"node:crypto";import{readdirSync as Qg,readFileSync as zg,statSync as Xg}from"node:fs";import{join as mu}from"node:path";function sn(t){let e=gu(t).sort(),n=Jg("sha256");for(let s=0;s<e.length;s++){s>0&&n.update("\0");let i=mu(t,e[s]),r=zg(i,"utf-8");e[s]==="SKILL.md"?n.update(hu(r)):n.update(r)}return n.digest("hex")}function gu(t,e=""){let n=Qg(t),s=[];for(let i of n){let r=mu(t,i),o=e?`${e}/${i}`:i;Xg(r).isDirectory()?s.push(...gu(r,o)):s.push(o)}return s}var Dr=L(()=>{"use strict";ut()});import{execFileSync as Ss}from"node:child_process";import{existsSync as bs,mkdirSync as Eb,unlinkSync as yu}from"node:fs";import{resolve as wu,join as Su}from"node:path";function ft(t,e,n,s){let i=wu(t,".hive","git");if(!bs(i)){rn.warn("Instance git not initialized \u2014 skipping state commit");return}let r=Su(i,"state-index.tmp"),o={...process.env,GIT_DIR:i,GIT_WORK_TREE:t,GIT_INDEX_FILE:r},a=(...l)=>Ss("git",[...l],{cwd:t,env:o,stdio:"pipe",encoding:"utf-8"}).trim();try{a("read-tree","state");for(let h of e)a("add","--force","--",h);try{a("rm","--cached","--ignore-unmatch","-r","--","**/.DS_Store")}catch{}let l=a("write-tree"),c=a("rev-parse","state"),f=a("rev-parse","state^{tree}");if(l===f)return;let u=s?{GIT_AUTHOR_NAME:s,GIT_AUTHOR_EMAIL:`${s}@hive`,GIT_COMMITTER_NAME:s,GIT_COMMITTER_EMAIL:`${s}@hive`}:{GIT_AUTHOR_NAME:"hive",GIT_AUTHOR_EMAIL:"hive@localhost",GIT_COMMITTER_NAME:"hive",GIT_COMMITTER_EMAIL:"hive@localhost"},d=Ss("git",["commit-tree",l,"-p",c,"-m",n],{env:{...o,...u},encoding:"utf-8"}).trim();a("update-ref","refs/heads/state",d),rn.debug("State branch commit",{message:n,files:e.length})}catch(l){rn.warn("Failed to commit to state branch",{error:String(l),message:n})}finally{try{bs(r)&&yu(r)}catch{}}}function bu(t,e,n){let s=wu(t,".hive","git");if(!bs(s))return;let i=Su(s,"state-index.tmp"),r={...process.env,GIT_DIR:s,GIT_WORK_TREE:t,GIT_INDEX_FILE:i},o=(...a)=>Ss("git",[...a],{cwd:t,env:r,stdio:"pipe",encoding:"utf-8"}).trim();try{o("read-tree","state");for(let u of e)try{o("rm","-r","--cached","--",u)}catch{}let a=o("write-tree"),l=o("rev-parse","state"),c=o("rev-parse","state^{tree}");if(a===c)return;let f=Ss("git",["commit-tree",a,"-p",l,"-m",n],{env:{...r,GIT_AUTHOR_NAME:"hive",GIT_AUTHOR_EMAIL:"hive@localhost",GIT_COMMITTER_NAME:"hive",GIT_COMMITTER_EMAIL:"hive@localhost"},encoding:"utf-8"}).trim();o("update-ref","refs/heads/state",f),rn.debug("State branch removal commit",{message:n})}catch(a){rn.warn("Failed to commit removal to state branch",{error:String(a)})}finally{try{bs(i)&&yu(i)}catch{}}}var rn,vs=L(()=>{"use strict";ie();rn=x("instance-git")});import{cpSync as Zg,existsSync as vu,mkdirSync as ey,readFileSync as ku,writeFileSync as ty}from"node:fs";import{join as ks,relative as ny}from"node:path";function Au(t,e,n,s){let i=Or(t);try{let r=ks(i.dir,"skills",e);if(!vu(r)){let m=Nr(i.dir);throw new Error(`Skill "${e}" not found in registry ${t}. Available skills: ${m.join(", ")||"(none)"}`)}let o=ks(r,"SKILL.md"),a=cu(o,e),c=ku(o,"utf-8").match(/^---\n([\s\S]*?)\n---/);if(c){let m=c[1].match(/^name:\s*(.+)$/m);m&&m[1].trim()!==e&&Eu.warn("Registry skill name mismatch \u2014 using directory name",{dirName:e,frontmatterName:m[1].trim()})}let f=uu(n,a,e);if(vu(f))throw new Error(`Skill "${e}" is already installed at ${f}. Use "hive skill upgrade ${e}" to update, or "hive skill remove ${e}" first.`);ey(f,{recursive:!0}),Zg(r,f,{recursive:!0});let u=sn(f),d=ct(i.dir,i.headSha),{frontmatter:h,body:y}=Pr(ku(ks(f,"SKILL.md"),"utf-8"));h.origin={type:"registry",source:t,"base-version":i.headSha,...d?{"base-tag":d}:{},"base-content-hash":u,"installed-at":new Date().toISOString(),modified:!1},ty(ks(f,"SKILL.md"),Mr(h,y));let p=ny(s,f);return ft(s,[p],`install: ${a}/${e} from ${t}@${i.headSha.slice(0,8)}`),Eu.info("Skill installed",{name:e,workflow:a,version:i.headSha.slice(0,8)}),{name:e,workflow:a,targetPath:f,version:i.headSha}}finally{i.cleanup()}}var Eu,_u=L(()=>{"use strict";nn();fu();ut();Dr();vs();ie();Eu=x("skill-install")});import{existsSync as As,readFileSync as qr,cpSync as Es,mkdirSync as Ou,readdirSync as sy,statSync as iy}from"node:fs";import{join as G,relative as Rr}from"node:path";function Kr(t,e){if(!As(e))return null;for(let n of sy(e)){let s=G(e,n);try{if(!iy(s).isDirectory())continue}catch{continue}let i=G(s,"skills",t);if(As(G(i,"SKILL.md")))return{path:i,workflow:n}}return null}async function Br(t,e,n,s){let i=Kr(t,e);if(!i)throw new Error(`Skill "${t}" is not installed or is not registry-sourced.`);let{frontmatter:r}=ae(G(i.path,"SKILL.md")),o=r.origin;if(!o||o.type!=="registry"||!o.source||!o["base-version"])throw new Error(`Skill "${t}" has no registry origin metadata.`);let a=Tr(o.source),l=o["base-version"];if(a===l)return{name:t,action:"up-to-date",oldVersion:l};let c=Ir(o.source);try{let f=G(c.dir,"skills",t);if(!As(G(f,"SKILL.md")))return Iu.warn("Skill removed from registry \u2014 keeping installed copy",{name:t,source:o.source}),ft(n,[Rr(n,i.path)],`upgrade-check: ${i.workflow}/${t} removed from upstream registry`),{name:t,action:"removed-upstream",oldVersion:l};if(!o.modified){Es(f,i.path,{recursive:!0});let E=sn(i.path),O=ct(c.dir,a),{frontmatter:T,body:k}=ae(G(i.path,"SKILL.md"));T.origin={...T.origin,"base-version":a,"base-content-hash":E,"installed-at":new Date().toISOString(),modified:!1,...O?{"base-tag":O}:{}},$r(G(i.path,"SKILL.md"),T,k);let M=Rr(n,i.path);return ft(n,[M],`upgrade: ${t} ${l.slice(0,8)} \u2192 ${a.slice(0,8)}`),{name:t,action:"applied",oldVersion:l,newVersion:a}}let u=qr(G(i.path,"SKILL.md"),"utf-8"),d=qr(G(f,"SKILL.md"),"utf-8"),h=G(c.dir,".hive-theirs-copy",t);Ou(h,{recursive:!0}),Es(f,h,{recursive:!0});let y;try{Lr(c.dir,l);let E=G(c.dir,"skills",t,"SKILL.md");As(E)&&(y=qr(E,"utf-8"))}catch{}if(await s(u,d,y)==="keep")return{name:t,action:"kept",oldVersion:l};if(!y){let E=G(n,".hive","skill-backups",`${t}-${Date.now()}`);Ou(E,{recursive:!0}),Es(i.path,E,{recursive:!0}),Iu.info("Backed up modified skill before upgrade",{backup:E})}Es(h,i.path,{recursive:!0});let m=sn(i.path),S=ct(c.dir,a),{frontmatter:v,body:A}=ae(G(i.path,"SKILL.md"));v.origin={...v.origin,"base-version":a,"base-content-hash":m,"installed-at":new Date().toISOString(),modified:!1,...S?{"base-tag":S}:{}},$r(G(i.path,"SKILL.md"),v,A);let _=Rr(n,i.path);return ft(n,[_],`upgrade: ${t} ${l.slice(0,8)} \u2192 ${a.slice(0,8)} (took upstream)`),{name:t,action:"taken",oldVersion:l,newVersion:a}}finally{c.cleanup()}}var Iu,xr=L(()=>{"use strict";nn();ut();Dr();vs();ie();Iu=x("skill-upgrade")});import{existsSync as Tu,rmSync as Nu,readdirSync as ry}from"node:fs";import{join as Fr,relative as oy}from"node:path";async function Cu(t,e,n,s={}){let i=Kr(t,e);if(!i)throw new Error(`Skill "${t}" is not installed.`);let r=Fr(i.path,"SKILL.md");if(Tu(r))try{let{frontmatter:l}=ae(r);if((l.origin?.modified===!0||l.origin?.type==="agent-authored")&&!s.force){let f=`Warning: ${i.workflow}/${t} has local modifications that will be removed. Your changes are preserved in git history on the 'state' branch. Proceed?`;if(s.confirmFn){if(!await s.confirmFn(f))return Lu.info("Skill removal aborted by user",{name:t}),!1}else return console.log(f),console.log("Use --force to skip this prompt."),!1}}catch{}let o=oy(n,i.path);Nu(i.path,{recursive:!0,force:!0});let a=Fr(e,i.workflow,"skills");return Tu(a)&&ry(a).length===0&&Nu(Fr(e,i.workflow),{recursive:!0,force:!0}),bu(n,[o],`remove: ${i.workflow}/${t}`),Lu.info("Skill removed",{name:t,workflow:i.workflow}),!0}var Lu,Pu=L(()=>{"use strict";ut();vs();xr();ie();Lu=x("skill-remove")});var $u={};Q($u,{runSkill:()=>cy});import{existsSync as he,readdirSync as dt,readFileSync as ay,statSync as ly}from"node:fs";import{join as Pe}from"node:path";import{createInterface as Mu}from"node:readline";async function cy(t,...e){switch(t){case"add":{tn();let n=e[0];n||(console.error("Usage: hive skill add <name|registry:name|url#skills/name>"),process.exit(1));let{config:s}=await Promise.resolve().then(()=>(fs(),us)),i=ou(n),r=au(i,s.skillRegistries),o=Au(r.url,i.name,j,P);console.log(`Installed ${o.workflow}/${o.name} (${o.version.slice(0,8)})`);break}case"list":{e.includes("--available")?(tn(),await fy(e)):uy();break}case"upgrade":{tn();let n=e[0];n||(console.error("Usage: hive skill upgrade <name|--all>"),process.exit(1));let s=async(i,r,o)=>{console.log(`
237
240
  --- Your version (installed) ---`),console.log(i.slice(0,500)+(i.length>500?`
238
241
  ...`:"")),console.log(`
239
242
  --- Upstream version (registry) ---`),console.log(r.slice(0,500)+(r.length>500?`
240
243
  ...`:"")),console.log(o?`
241
244
  (Three-way diff available)`:`
242
- (Two-way comparison \u2014 base version unreachable)`);let a=Iu({input:process.stdin,output:process.stdout}),l=await new Promise(c=>{a.question(`
243
- [k]eep your version or [t]ake upstream? `,c)});return a.close(),l.toLowerCase().startsWith("t")?"take":"keep"};if(n==="--all")await ny(s);else{let i=await $r(n,j,T,s);console.log(`${i.name}: ${i.action}`)}break}case"remove":{let n=e[0];n||(console.error("Usage: hive skill remove <name> [--force]"),process.exit(1));let s=e.includes("--force");await _u(n,j,T,{force:s,confirmFn:async o=>{let a=Iu({input:process.stdin,output:process.stdout}),l=await new Promise(c=>{a.question(`${o} [y/N] `,c)});return a.close(),l.toLowerCase()==="y"}})&&console.log(`Removed ${n}`);break}case"search":{let n=e[0];n||(console.error("Usage: hive skill search <query>"),process.exit(1)),ty(n);break}default:console.error("Usage: hive skill <add|list|upgrade|remove|search> [args]"),process.exit(1)}}function Zg(){if(!de(j)){console.log("No skills installed.");return}let t=ut(j).filter(e=>{try{return zg(Le(j,e)).isDirectory()}catch{return!1}});if(t.length===0){console.log("No skills installed.");return}console.log(`Installed skills:
244
- `);for(let e of t.sort()){let n=Le(j,e,"skills");if(de(n))for(let s of ut(n).sort()){let i=Le(n,s,"SKILL.md");if(de(i))try{let{frontmatter:r}=ae(i),o=r.origin?.type??"unknown",a=r.origin?.modified!==void 0?String(r.origin.modified):"-";console.log(` ${s.padEnd(25)} ${e.padEnd(20)} ${o.padEnd(15)} ${a}`)}catch{console.log(` ${s.padEnd(25)} ${e.padEnd(20)} ${"?".padEnd(15)} ?`)}}}}async function ey(t){let{shallowClone:e,listSkillsInClone:n}=await Promise.resolve().then(()=>(Xt(),Zc)),{config:s}=await Promise.resolve().then(()=>(as(),os)),i=t.indexOf("--from"),r=i>=0?t[i+1]:void 0,o=r?[{name:r,url:s.skillRegistries.find(a=>a.name===r)?.url??r}]:s.skillRegistries;for(let a of o){console.log(`
245
+ (Two-way comparison \u2014 base version unreachable)`);let a=Mu({input:process.stdin,output:process.stdout}),l=await new Promise(c=>{a.question(`
246
+ [k]eep your version or [t]ake upstream? `,c)});return a.close(),l.toLowerCase().startsWith("t")?"take":"keep"};if(n==="--all")await py(s);else{let i=await Br(n,j,P,s);console.log(`${i.name}: ${i.action}`)}break}case"remove":{let n=e[0];n||(console.error("Usage: hive skill remove <name> [--force]"),process.exit(1));let s=e.includes("--force");await Cu(n,j,P,{force:s,confirmFn:async o=>{let a=Mu({input:process.stdin,output:process.stdout}),l=await new Promise(c=>{a.question(`${o} [y/N] `,c)});return a.close(),l.toLowerCase()==="y"}})&&console.log(`Removed ${n}`);break}case"search":{let n=e[0];n||(console.error("Usage: hive skill search <query>"),process.exit(1)),dy(n);break}default:console.error("Usage: hive skill <add|list|upgrade|remove|search> [args]"),process.exit(1)}}function uy(){if(!he(j)){console.log("No skills installed.");return}let t=dt(j).filter(e=>{try{return ly(Pe(j,e)).isDirectory()}catch{return!1}});if(t.length===0){console.log("No skills installed.");return}console.log(`Installed skills:
247
+ `);for(let e of t.sort()){let n=Pe(j,e,"skills");if(he(n))for(let s of dt(n).sort()){let i=Pe(n,s,"SKILL.md");if(he(i))try{let{frontmatter:r}=ae(i),o=r.origin?.type??"unknown",a=r.origin?.modified!==void 0?String(r.origin.modified):"-";console.log(` ${s.padEnd(25)} ${e.padEnd(20)} ${o.padEnd(15)} ${a}`)}catch{console.log(` ${s.padEnd(25)} ${e.padEnd(20)} ${"?".padEnd(15)} ?`)}}}}async function fy(t){let{shallowClone:e,listSkillsInClone:n}=await Promise.resolve().then(()=>(nn(),ru)),{config:s}=await Promise.resolve().then(()=>(fs(),us)),i=t.indexOf("--from"),r=i>=0?t[i+1]:void 0,o=r?[{name:r,url:s.skillRegistries.find(a=>a.name===r)?.url??r}]:s.skillRegistries;for(let a of o){console.log(`
245
248
  Registry: ${a.name} (${a.url})
246
- `);let l=e(a.url);try{let c=n(l.dir);if(c.length===0){console.log(" (no skills)");continue}for(let f of c.sort()){let u=Le(l.dir,"skills",f,"SKILL.md"),y=Qg(u,"utf-8").match(/^description:\s*(.+)$/m)?.[1]?.trim()??"";console.log(` ${f.padEnd(30)} ${y}`)}}finally{l.cleanup()}}}function ty(t){let e=t.toLowerCase(),n=!1;if(de(j))for(let s of ut(j)){let i=Le(j,s,"skills");if(de(i))for(let r of ut(i)){let o=Le(i,r,"SKILL.md");if(de(o))try{let{frontmatter:a}=ae(o);(r.toLowerCase().includes(e)||(a.description??"").toLowerCase().includes(e))&&(console.log(` ${r} (${s}) \u2014 ${a.description??""}`),n=!0)}catch{}}}n||console.log("No matching skills found.")}async function ny(t){if(!de(j)){console.log("No skills installed.");return}let e=[];for(let n of ut(j)){let s=Le(j,n,"skills");if(de(s))for(let i of ut(s).sort()){let r=Le(s,i,"SKILL.md");if(de(r))try{let{frontmatter:o}=ae(r);o.origin?.type==="registry"&&e.push(i)}catch{}}}if(e.length===0){console.log("No registry-sourced skills to upgrade.");return}for(let n of e)try{let s=await $r(n,j,T,t);console.log(`${s.name}: ${s.action}`)}catch(s){console.error(`${n}: failed \u2014 ${String(s)}`)}}var Nu=C(()=>{"use strict";Xt();nu();wu();Dr();Ou();lt();ee()});var Lu={};Q(Lu,{runRegistry:()=>sy});async function sy(t,...e){let n=Ne();switch(t){case"add":{let s=e[0];s||(console.error("Usage: hive registry add <url> [--as <name>] [--default]"),process.exit(1));let i=e.indexOf("--as"),r=i>=0&&e[i+1]?e[i+1]:iy(s),o=e.includes("--default"),a=se(n);if(a.skillRegistries||(a.skillRegistries=[]),a.skillRegistries.some(l=>l.name===r)&&(console.error(`Registry "${r}" already exists.`),process.exit(1)),o)for(let l of a.skillRegistries)delete l.default;a.skillRegistries.push({name:r,url:s,...o?{default:!0}:{}}),rt(a,n),console.log(`Added registry "${r}" (${s})${o?" [default]":""}`);break}case"list":{let i=se(n).skillRegistries??[];if(i.length===0){console.log("No registries configured. Using built-in default: https://github.com/keepur/hive-skills");return}console.log(`Configured registries:
247
- `);for(let r of i){let o=r.default?" (default)":"";console.log(` ${r.name}${o}`),console.log(` ${r.url}`)}break}case"remove":{let s=e[0];s||(console.error("Usage: hive registry remove <name>"),process.exit(1));let i=se(n);i.skillRegistries||(console.error("No registries configured."),process.exit(1));let r=i.skillRegistries.findIndex(o=>o.name===s);r<0&&(console.error(`Registry "${s}" not found.`),process.exit(1)),i.skillRegistries.splice(r,1),rt(i,n),console.log(`Removed registry "${s}". Installed skills from this registry are unaffected.`);break}default:console.error("Usage: hive registry <add|list|remove>"),process.exit(1)}}function iy(t){return t.replace(/\.git$/,"").replace(/\/$/,"").split("/").filter(Boolean).slice(-2).join("-").replace(/^github\.com-/,"")}var Cu=C(()=>{"use strict";cs()});import{parseArgs as ry}from"node:util";import{resolve as Fe}from"node:path";import{existsSync as Pu,readFileSync as oy,statSync as ay}from"node:fs";var{positionals:xe,values:ft}=ry({allowPositionals:!0,options:{help:{type:"boolean",short:"h",default:!1},daemon:{type:"boolean",default:!1},config:{type:"string"},version:{type:"boolean",short:"v",default:!1},verbose:{type:"boolean",default:!1}}}),Rr=xe[0];if(ft.version){let t=JSON.parse(oy(Fe(import.meta.dirname,"..","package.json"),"utf-8"));console.log(`hive v${t.version}`),process.exit(0)}(ft.help||!Rr)&&(console.log(`
249
+ `);let l=e(a.url);try{let c=n(l.dir);if(c.length===0){console.log(" (no skills)");continue}for(let f of c.sort()){let u=Pe(l.dir,"skills",f,"SKILL.md"),y=ay(u,"utf-8").match(/^description:\s*(.+)$/m)?.[1]?.trim()??"";console.log(` ${f.padEnd(30)} ${y}`)}}finally{l.cleanup()}}}function dy(t){let e=t.toLowerCase(),n=!1;if(he(j))for(let s of dt(j)){let i=Pe(j,s,"skills");if(he(i))for(let r of dt(i)){let o=Pe(i,r,"SKILL.md");if(he(o))try{let{frontmatter:a}=ae(o);(r.toLowerCase().includes(e)||(a.description??"").toLowerCase().includes(e))&&(console.log(` ${r} (${s}) \u2014 ${a.description??""}`),n=!0)}catch{}}}n||console.log("No matching skills found.")}async function py(t){if(!he(j)){console.log("No skills installed.");return}let e=[];for(let n of dt(j)){let s=Pe(j,n,"skills");if(he(s))for(let i of dt(s).sort()){let r=Pe(s,i,"SKILL.md");if(he(r))try{let{frontmatter:o}=ae(r);o.origin?.type==="registry"&&e.push(i)}catch{}}}if(e.length===0){console.log("No registry-sourced skills to upgrade.");return}for(let n of e)try{let s=await Br(n,j,P,t);console.log(`${s.name}: ${s.action}`)}catch(s){console.error(`${n}: failed \u2014 ${String(s)}`)}}var Du=L(()=>{"use strict";nn();lu();_u();xr();Pu();ut();ne()});var qu={};Q(qu,{runRegistry:()=>hy});async function hy(t,...e){let n=Ce();switch(t){case"add":{let s=e[0];s||(console.error("Usage: hive registry add <url> [--as <name>] [--default]"),process.exit(1));let i=e.indexOf("--as"),r=i>=0&&e[i+1]?e[i+1]:my(s),o=e.includes("--default"),a=se(n);if(a.skillRegistries||(a.skillRegistries=[]),a.skillRegistries.some(l=>l.name===r)&&(console.error(`Registry "${r}" already exists.`),process.exit(1)),o)for(let l of a.skillRegistries)delete l.default;a.skillRegistries.push({name:r,url:s,...o?{default:!0}:{}}),at(a,n),console.log(`Added registry "${r}" (${s})${o?" [default]":""}`);break}case"list":{let i=se(n).skillRegistries??[];if(i.length===0){console.log("No registries configured. Using built-in default: https://github.com/keepur/hive-skills");return}console.log(`Configured registries:
250
+ `);for(let r of i){let o=r.default?" (default)":"";console.log(` ${r.name}${o}`),console.log(` ${r.url}`)}break}case"remove":{let s=e[0];s||(console.error("Usage: hive registry remove <name>"),process.exit(1));let i=se(n);i.skillRegistries||(console.error("No registries configured."),process.exit(1));let r=i.skillRegistries.findIndex(o=>o.name===s);r<0&&(console.error(`Registry "${s}" not found.`),process.exit(1)),i.skillRegistries.splice(r,1),at(i,n),console.log(`Removed registry "${s}". Installed skills from this registry are unaffected.`);break}default:console.error("Usage: hive registry <add|list|remove>"),process.exit(1)}}function my(t){return t.replace(/\.git$/,"").replace(/\/$/,"").split("/").filter(Boolean).slice(-2).join("-").replace(/^github\.com-/,"")}var Ru=L(()=>{"use strict";ps()});import{parseArgs as gy}from"node:util";import{resolve as je}from"node:path";import{existsSync as Ku,readFileSync as yy,statSync as wy}from"node:fs";var{positionals:Ue,values:pt}=gy({allowPositionals:!0,options:{help:{type:"boolean",short:"h",default:!1},daemon:{type:"boolean",default:!1},config:{type:"string"},version:{type:"boolean",short:"v",default:!1},verbose:{type:"boolean",default:!1}}}),Ur=Ue[0];if(pt.version){let t=JSON.parse(yy(je(import.meta.dirname,"..","package.json"),"utf-8"));console.log(`hive v${t.version}`),process.exit(0)}(pt.help||!Ur)&&(console.log(`
248
251
  hive \u2014 AI agent platform
249
252
 
250
253
  Usage:
@@ -274,4 +277,4 @@ Options:
274
277
  --config <path> Path to hive.yaml
275
278
  -v, --version Show version
276
279
  -h, --help Show this help
277
- `),process.exit(0));var tn=Fe(import.meta.dirname,"..");if(ft.config){let t=Fe(ft.config);if(Pu(t)){let e=ay(t);process.env.HIVE_HOME=e.isDirectory()?t:Fe(t,"..")}else console.error(`Config not found: ${t}`),process.exit(1)}switch(Rr){case"init":{let{runSetupWizard:t}=await Promise.resolve().then(()=>(sc(),nc));await t(tn);break}case"start":{if(ft.daemon){let{startDaemon:t}=await Promise.resolve().then(()=>(Ht(),ts));await t(tn)}else{let{execFileSync:t}=await import("node:child_process"),e=Pu(Fe(tn,"pkg","server.min.js"))?Fe(tn,"pkg","server.min.js"):Fe(tn,"dist","index.js");t(process.execPath,[e],{stdio:"inherit",env:{...process.env,HIVE_HOME:process.env.HIVE_HOME??""}})}break}case"stop":{let{stopDaemon:t}=await Promise.resolve().then(()=>(Ht(),ts));await t();break}case"status":{let{showStatus:t}=await Promise.resolve().then(()=>(ac(),oc));await t();break}case"update":{let{runUpdate:t}=await Promise.resolve().then(()=>(uc(),cc));await t();break}case"doctor":{let{runDoctor:t}=await Promise.resolve().then(()=>(Bc(),Kc));await t({verbose:!!ft.verbose});break}case"plugin":{let t=xe[1],e=xe[2],{runPlugin:n}=await Promise.resolve().then(()=>(Jc(),Wc));await n(t,e);break}case"skill":{let t=xe[1],e=xe.slice(2),{runSkill:n}=await Promise.resolve().then(()=>(Nu(),Tu));await n(t,...e);break}case"registry":{let t=xe[1],e=xe.slice(2),{runRegistry:n}=await Promise.resolve().then(()=>(Cu(),Lu));await n(t,...e);break}default:console.error(`Unknown command: ${Rr}`),console.error('Run "hive --help" for usage.'),process.exit(1)}
280
+ `),process.exit(0));var on=je(import.meta.dirname,"..");if(pt.config){let t=je(pt.config);if(Ku(t)){let e=wy(t);process.env.HIVE_HOME=e.isDirectory()?t:je(t,"..")}else console.error(`Config not found: ${t}`),process.exit(1)}switch(Ur){case"init":{let{runSetupWizard:t}=await Promise.resolve().then(()=>(cc(),lc));await t(on);break}case"start":{if(pt.daemon){let{startDaemon:t}=await Promise.resolve().then(()=>(Vt(),rs));await t(on)}else{let{execFileSync:t}=await import("node:child_process"),e=Ku(je(on,"pkg","server.min.js"))?je(on,"pkg","server.min.js"):je(on,"dist","index.js");t(process.execPath,[e],{stdio:"inherit",env:{...process.env,HIVE_HOME:process.env.HIVE_HOME??""}})}break}case"stop":{let{stopDaemon:t}=await Promise.resolve().then(()=>(Vt(),rs));await t();break}case"status":{let{showStatus:t}=await Promise.resolve().then(()=>(pc(),dc));await t();break}case"update":{let{runUpdate:t}=await Promise.resolve().then(()=>(gc(),mc));await t();break}case"doctor":{let{runDoctor:t}=await Promise.resolve().then(()=>(Hc(),Yc));await t({verbose:!!pt.verbose});break}case"plugin":{let t=Ue[1],e=Ue[2],{runPlugin:n}=await Promise.resolve().then(()=>(tu(),eu));await n(t,e);break}case"skill":{let t=Ue[1],e=Ue.slice(2),{runSkill:n}=await Promise.resolve().then(()=>(Du(),$u));await n(t,...e);break}case"registry":{let t=Ue[1],e=Ue.slice(2),{runRegistry:n}=await Promise.resolve().then(()=>(Ru(),qu));await n(t,...e);break}default:console.error(`Unknown command: ${Ur}`),console.error('Run "hive --help" for usage.'),process.exit(1)}