@caiquecamargo/vite-plugin-netlify-cms 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(A,W){typeof exports=="object"&&typeof module<"u"?W(exports,require("fs/promises"),require("path"),require("vite")):typeof define=="function"&&define.amd?define(["exports","fs/promises","path","vite"],W):(A=typeof globalThis<"u"?globalThis:A||self,W(A["vite-plugin-netlify-cms"]={},A.fs,A.path,A.vite))})(this,function(A,W,Te,_s){"use strict";const et=Symbol.for("yaml.alias"),tt=Symbol.for("yaml.document"),J=Symbol.for("yaml.map"),Lt=Symbol.for("yaml.pair"),U=Symbol.for("yaml.scalar"),se=Symbol.for("yaml.seq"),B=Symbol.for("yaml.node.type"),Q=s=>!!s&&typeof s=="object"&&s[B]===et,ge=s=>!!s&&typeof s=="object"&&s[B]===tt,H=s=>!!s&&typeof s=="object"&&s[B]===J,I=s=>!!s&&typeof s=="object"&&s[B]===Lt,E=s=>!!s&&typeof s=="object"&&s[B]===U,ne=s=>!!s&&typeof s=="object"&&s[B]===se;function L(s){if(s&&typeof s=="object")switch(s[B]){case J:case se:return!0}return!1}function $(s){if(s&&typeof s=="object")switch(s[B]){case et:case J:case U:case se:return!0}return!1}const Bs=s=>(E(s)||L(s))&&!!s.anchor;class st{constructor(e){Object.defineProperty(this,B,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}}const _=Symbol("break visit"),$t=Symbol("skip children"),F=Symbol("remove node");function Y(s,e){const t=Ct(e);ge(s)?ie(null,s.contents,t,Object.freeze([s]))===F&&(s.contents=null):ie(null,s,t,Object.freeze([]))}Y.BREAK=_,Y.SKIP=$t,Y.REMOVE=F;function ie(s,e,t,n){const i=vt(s,e,t,n);if($(i)||I(i))return _t(s,n,i),ie(s,i,t,n);if(typeof i!="symbol"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=ie(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===_)return _;o===F&&(e.items.splice(r,1),r-=1)}}}else if(I(e)){n=Object.freeze(n.concat(e));const r=ie("key",e.key,t,n);if(r===_)return _;r===F&&(e.key=null);const o=ie("value",e.value,t,n);if(o===_)return _;o===F&&(e.value=null)}}return i}async function Le(s,e){const t=Ct(e);ge(s)?await re(null,s.contents,t,Object.freeze([s]))===F&&(s.contents=null):await re(null,s,t,Object.freeze([]))}Le.BREAK=_,Le.SKIP=$t,Le.REMOVE=F;async function re(s,e,t,n){const i=await vt(s,e,t,n);if($(i)||I(i))return _t(s,n,i),re(s,i,t,n);if(typeof i!="symbol"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=await re(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===_)return _;o===F&&(e.items.splice(r,1),r-=1)}}}else if(I(e)){n=Object.freeze(n.concat(e));const r=await re("key",e.key,t,n);if(r===_)return _;r===F&&(e.key=null);const o=await re("value",e.value,t,n);if(o===_)return _;o===F&&(e.value=null)}}return i}function Ct(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function vt(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(H(e))return t.Map?.(s,e,n);if(ne(e))return t.Seq?.(s,e,n);if(I(e))return t.Pair?.(s,e,n);if(E(e))return t.Scalar?.(s,e,n);if(Q(e))return t.Alias?.(s,e,n)}function _t(s,e,t){const n=e[e.length-1];if(L(n))n.items[s]=t;else if(I(n))s==="key"?n.key=t:n.value=t;else if(ge(n))n.contents=t;else{const i=Q(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const js={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ms=s=>s.replace(/[!,[\]{}]/g,e=>js[e]);class v{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},v.defaultYaml,e),this.tags=Object.assign({},v.defaultTags,t)}clone(){const e=new v(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new v(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:v.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},v.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:v.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},v.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];return r?r+decodeURIComponent(i):n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Ms(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&$(e.contents)){const r={};Y(e.contents,(o,l)=>{$(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
1
+ (function(A,V){typeof exports=="object"&&typeof module<"u"?V(exports,require("fs/promises"),require("path"),require("vite")):typeof define=="function"&&define.amd?define(["exports","fs/promises","path","vite"],V):(A=typeof globalThis<"u"?globalThis:A||self,V(A["vite-plugin-netlify-cms"]={},A.fs,A.path,A.vite))})(this,function(A,V,Te,_s){"use strict";const et=Symbol.for("yaml.alias"),tt=Symbol.for("yaml.document"),J=Symbol.for("yaml.map"),Lt=Symbol.for("yaml.pair"),U=Symbol.for("yaml.scalar"),se=Symbol.for("yaml.seq"),B=Symbol.for("yaml.node.type"),Q=s=>!!s&&typeof s=="object"&&s[B]===et,ge=s=>!!s&&typeof s=="object"&&s[B]===tt,H=s=>!!s&&typeof s=="object"&&s[B]===J,I=s=>!!s&&typeof s=="object"&&s[B]===Lt,E=s=>!!s&&typeof s=="object"&&s[B]===U,ne=s=>!!s&&typeof s=="object"&&s[B]===se;function L(s){if(s&&typeof s=="object")switch(s[B]){case J:case se:return!0}return!1}function $(s){if(s&&typeof s=="object")switch(s[B]){case et:case J:case U:case se:return!0}return!1}const Bs=s=>(E(s)||L(s))&&!!s.anchor;class st{constructor(e){Object.defineProperty(this,B,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}}const _=Symbol("break visit"),$t=Symbol("skip children"),F=Symbol("remove node");function Y(s,e){const t=Ct(e);ge(s)?ie(null,s.contents,t,Object.freeze([s]))===F&&(s.contents=null):ie(null,s,t,Object.freeze([]))}Y.BREAK=_,Y.SKIP=$t,Y.REMOVE=F;function ie(s,e,t,n){const i=vt(s,e,t,n);if($(i)||I(i))return _t(s,n,i),ie(s,i,t,n);if(typeof i!="symbol"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=ie(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===_)return _;o===F&&(e.items.splice(r,1),r-=1)}}}else if(I(e)){n=Object.freeze(n.concat(e));const r=ie("key",e.key,t,n);if(r===_)return _;r===F&&(e.key=null);const o=ie("value",e.value,t,n);if(o===_)return _;o===F&&(e.value=null)}}return i}async function Le(s,e){const t=Ct(e);ge(s)?await re(null,s.contents,t,Object.freeze([s]))===F&&(s.contents=null):await re(null,s,t,Object.freeze([]))}Le.BREAK=_,Le.SKIP=$t,Le.REMOVE=F;async function re(s,e,t,n){const i=await vt(s,e,t,n);if($(i)||I(i))return _t(s,n,i),re(s,i,t,n);if(typeof i!="symbol"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=await re(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===_)return _;o===F&&(e.items.splice(r,1),r-=1)}}}else if(I(e)){n=Object.freeze(n.concat(e));const r=await re("key",e.key,t,n);if(r===_)return _;r===F&&(e.key=null);const o=await re("value",e.value,t,n);if(o===_)return _;o===F&&(e.value=null)}}return i}function Ct(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function vt(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(H(e))return t.Map?.(s,e,n);if(ne(e))return t.Seq?.(s,e,n);if(I(e))return t.Pair?.(s,e,n);if(E(e))return t.Scalar?.(s,e,n);if(Q(e))return t.Alias?.(s,e,n)}function _t(s,e,t){const n=e[e.length-1];if(L(n))n.items[s]=t;else if(I(n))s==="key"?n.key=t:n.value=t;else if(ge(n))n.contents=t;else{const i=Q(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const js={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ms=s=>s.replace(/[!,[\]{}]/g,e=>js[e]);class v{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},v.defaultYaml,e),this.tags=Object.assign({},v.defaultTags,t)}clone(){const e=new v(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new v(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:v.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},v.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:v.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},v.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];return r?r+decodeURIComponent(i):n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Ms(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&$(e.contents)){const r={};Y(e.contents,(o,l)=>{$(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
2
2
  `)}}v.defaultYaml={explicit:!1,version:"1.2"},v.defaultTags={"!!":"tag:yaml.org,2002:"};function Bt(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function jt(s){const e=new Set;return Y(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Mt(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function Ps(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i||(i=jt(s));const o=Mt(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(E(o.node)||L(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:n}}class $e extends st{constructor(e){super(et),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return Y(e,{Node:(n,i)=>{if(i===this)return Y.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(a)}const l=n.get(o);if(!l||l.res===void 0){const a="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(a)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Ce(i,o,n)),l.count*l.aliasCount>r)){const a="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(a)}return l.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(Bt(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const 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 Ce(s,e,t){if(Q(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(L(e)){let n=0;for(const i of e.items){const r=Ce(s,i,t);r>n&&(n=r)}return n}else if(I(e)){const n=Ce(s,e.key,t),i=Ce(s,e.value,t);return Math.max(n,i)}return 1}function q(s,e,t){if(Array.isArray(s))return s.map((n,i)=>q(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!Bs(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}const Pt=s=>!s||typeof s!="function"&&typeof s!="object";class N extends st{constructor(e){super(U),this.value=e}toJSON(e,t){return t?.keep?this.value:q(this.value,e,t)}toString(){return String(this.value)}}N.BLOCK_FOLDED="BLOCK_FOLDED",N.BLOCK_LITERAL="BLOCK_LITERAL",N.PLAIN="PLAIN",N.QUOTE_DOUBLE="QUOTE_DOUBLE",N.QUOTE_SINGLE="QUOTE_SINGLE";const Ds="tag:yaml.org,2002:";function Ks(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function ye(s,e,t){if(ge(s)&&(s=s.contents),$(s))return s;if(I(s)){const f=t.schema[J].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t;let a;if(n&&s&&typeof s=="object"){if(a=l.get(s),a)return a.anchor||(a.anchor=i(s)),new $e(a.anchor);a={anchor:null,node:null},l.set(s,a)}e?.startsWith("!!")&&(e=Ds+e.slice(2));let c=Ks(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const f=new N(s);return a&&(a.node=f),f}c=s instanceof Map?o[J]:Symbol.iterator in Object(s)?o[se]:o[J]}r&&(r(c),delete t.onTagObj);const u=c?.createNode?c.createNode(t.schema,s,t):new N(s);return e&&(u.tag=e),a&&(a.node=u),u}function ve(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return ye(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const be=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class _e extends st{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>$(n)||I(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(be(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if(L(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,ve(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if(L(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&E(r)?r.value:r:L(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!I(t))return!1;const n=t.value;return n==null||e&&E(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return L(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if(L(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,ve(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}_e.maxFlowStringSingleLineLength=60;const Fs=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function R(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const G=(s,e,t)=>s.endsWith(`
3
3
  `)?R(t,e):t.includes(`
4
4
  `)?`
@@ -26,28 +26,28 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\
26
26
  ${c}${O}`}function Us(s,e,t,n){const{type:i,value:r}=s,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:u}=e;if(l&&/[\n[\]{},]/.test(r)||u&&/[[\]{},]/.test(r))return oe(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||u||!r.includes(`
27
27
  `)?oe(r,e):De(s,e,t,n);if(!l&&!u&&i!==N.PLAIN&&r.includes(`
28
28
  `))return De(s,e,t,n);if(Pe(r)){if(a==="")return e.forceBlockIndent=!0,De(s,e,t,n);if(l&&a===c)return oe(r,e)}const f=r.replace(/\n+/g,`$&
29
- ${a}`);if(o){const h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(f),{compat:p,tags:y}=e.doc.schema;if(y.some(h)||p?.some(h))return oe(r,e)}return l?f:je(f,a,Dt,Me(e))}function Se(s,e,t,n){const{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)});let{type:l}=s;l!==N.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=N.QUOTE_DOUBLE);const a=u=>{switch(u){case N.BLOCK_FOLDED:case N.BLOCK_LITERAL:return i||r?oe(o.value,e):De(o,e,t,n);case N.QUOTE_DOUBLE:return we(o.value,e);case N.QUOTE_SINGLE:return it(o.value,e);case N.PLAIN:return Us(o,e,t,n);default:return null}};let c=a(l);if(c===null){const{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=a(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function Ft(s,e){const t=Object.assign({blockQuote:!0,commentString:Fs,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,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e);let n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Rs(s,e){if(e.tag){const i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(E(e)){n=e.value;const i=s.filter(r=>r.identify?.(n));t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){const i=n?.constructor?.name??typeof n;throw new Error(`Tag not resolved for ${i} value`)}return t}function Vs(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const i=[],r=(E(s)||L(s))&&s.anchor;r&&Bt(r)&&(t.add(r),i.push(`&${r}`));const o=s.tag?s.tag:e.default?null:e.tag;return o&&i.push(n.directives.tagString(o)),i.join(" ")}function X(s,e,t,n){if(I(s))return s.toString(e,t,n);if(Q(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i;const r=$(s)?s:e.doc.createNode(s,{onTagObj:a=>i=a});i||(i=Rs(e.doc.schema.tags,r));const o=Vs(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const l=typeof i.stringify=="function"?i.stringify(r,e,t,n):E(r)?Se(r,e,t,n):r.toString(e,t,n);return o?E(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
30
- ${e.indent}${l}`:l}function Ws({key:s,value:e},t,n,i){const{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t;let h=$(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(L(s)){const T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!f&&(!s||h&&e==null&&!t.inFlow||L(s)||(E(s)?s.type===N.BLOCK_FOLDED||s.type===N.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+a});let y=!1,d=!1,m=X(s,t,()=>y=!0,()=>d=!0);if(!p&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return y&&n&&n(),m===""?"?":p?`? ${m}`:m}else if(r&&!f||e==null&&p)return m=`? ${m}`,h&&!y?m+=G(m,t.indent,c(h)):d&&i&&i(),m;y&&(h=null),p?(h&&(m+=G(m,t.indent,c(h))),m=`? ${m}
29
+ ${a}`);if(o){const h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(f),{compat:p,tags:y}=e.doc.schema;if(y.some(h)||p?.some(h))return oe(r,e)}return l?f:je(f,a,Dt,Me(e))}function Se(s,e,t,n){const{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)});let{type:l}=s;l!==N.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=N.QUOTE_DOUBLE);const a=u=>{switch(u){case N.BLOCK_FOLDED:case N.BLOCK_LITERAL:return i||r?oe(o.value,e):De(o,e,t,n);case N.QUOTE_DOUBLE:return we(o.value,e);case N.QUOTE_SINGLE:return it(o.value,e);case N.PLAIN:return Us(o,e,t,n);default:return null}};let c=a(l);if(c===null){const{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=a(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function Ft(s,e){const t=Object.assign({blockQuote:!0,commentString:Fs,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,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e);let n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Rs(s,e){if(e.tag){const i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(E(e)){n=e.value;const i=s.filter(r=>r.identify?.(n));t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){const i=n?.constructor?.name??typeof n;throw new Error(`Tag not resolved for ${i} value`)}return t}function Ws(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const i=[],r=(E(s)||L(s))&&s.anchor;r&&Bt(r)&&(t.add(r),i.push(`&${r}`));const o=s.tag?s.tag:e.default?null:e.tag;return o&&i.push(n.directives.tagString(o)),i.join(" ")}function X(s,e,t,n){if(I(s))return s.toString(e,t,n);if(Q(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i;const r=$(s)?s:e.doc.createNode(s,{onTagObj:a=>i=a});i||(i=Rs(e.doc.schema.tags,r));const o=Ws(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const l=typeof i.stringify=="function"?i.stringify(r,e,t,n):E(r)?Se(r,e,t,n):r.toString(e,t,n);return o?E(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
30
+ ${e.indent}${l}`:l}function Vs({key:s,value:e},t,n,i){const{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t;let h=$(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(L(s)){const T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let p=!f&&(!s||h&&e==null&&!t.inFlow||L(s)||(E(s)?s.type===N.BLOCK_FOLDED||s.type===N.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+a});let y=!1,d=!1,m=X(s,t,()=>y=!0,()=>d=!0);if(!p&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return y&&n&&n(),m===""?"?":p?`? ${m}`:m}else if(r&&!f||e==null&&p)return m=`? ${m}`,h&&!y?m+=G(m,t.indent,c(h)):d&&i&&i(),m;y&&(h=null),p?(h&&(m+=G(m,t.indent,c(h))),m=`? ${m}
31
31
  ${l}:`):(m=`${m}:`,h&&(m+=G(m,t.indent,c(h))));let b,w,k;$(e)?(b=!!e.spaceBefore,w=e.commentBefore,k=e.comment):(b=!1,w=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!h&&E(e)&&(t.indentAtStart=m.length+1),d=!1,!u&&a.length>=2&&!t.inFlow&&!p&&ne(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let S=!1;const O=X(e,t,()=>S=!0,()=>d=!0);let g=" ";if(h||b||w){if(g=b?`
32
32
  `:"",w){const T=c(w);g+=`
33
33
  ${R(T,t.indent)}`}O===""&&!t.inFlow?g===`
34
34
  `&&(g=`
35
35
 
36
36
  `):g+=`
37
- ${t.indent}`}else if(!p&&L(e)){const T=O[0],V=O.indexOf(`
38
- `),me=V!==-1,P=t.inFlow??e.flow??e.items.length===0;if(me||!P){let vs=!1;if(me&&(T==="&"||T==="!")){let te=O.indexOf(" ");T==="&"&&te!==-1&&te<V&&O[te+1]==="!"&&(te=O.indexOf(" ",te+1)),(te===-1||V<te)&&(vs=!0)}vs||(g=`
37
+ ${t.indent}`}else if(!p&&L(e)){const T=O[0],W=O.indexOf(`
38
+ `),me=W!==-1,P=t.inFlow??e.flow??e.items.length===0;if(me||!P){let vs=!1;if(me&&(T==="&"||T==="!")){let te=O.indexOf(" ");T==="&"&&te!==-1&&te<W&&O[te+1]==="!"&&(te=O.indexOf(" ",te+1)),(te===-1||W<te)&&(vs=!0)}vs||(g=`
39
39
  ${t.indent}`)}}else(O===""||O[0]===`
40
- `)&&(g="");return m+=g+O,t.inFlow?S&&n&&n():k&&!S?m+=G(m,t.indent,c(k)):d&&i&&i(),m}function qt(s,e){(s==="debug"||s==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}const Ut="<<";function Rt(s,e,{key:t,value:n}){if(s?.doc.schema.merge&&Js(t))if(n=Q(n)?n.resolve(s.doc):n,ne(n))for(const i of n.items)rt(s,e,i);else if(Array.isArray(n))for(const i of n)rt(s,e,i);else rt(s,e,n);else{const i=q(t,"",s);if(e instanceof Map)e.set(i,q(n,i,s));else if(e instanceof Set)e.add(i);else{const r=Ys(t,i,s),o=q(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}const Js=s=>s===Ut||E(s)&&s.value===Ut&&(!s.type||s.type===N.PLAIN);function rt(s,e,t){const n=s&&Q(t)?t.resolve(s.doc):t;if(!H(n))throw new Error("Merge sources must be maps or map aliases");const i=n.toJSON(null,s,Map);for(const[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Ys(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if($(s)&&t&&t.doc){const n=Ft(t.doc,{});n.anchors=new Set;for(const r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;const i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),qt(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function ot(s,e,t){const n=ye(s,void 0,t),i=ye(e,void 0,t);return new C(n,i)}class C{constructor(e,t=null){Object.defineProperty(this,B,{value:Lt}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return $(t)&&(t=t.clone(e)),$(n)&&(n=n.clone(e)),new C(t,n)}toJSON(e,t){const n=t?.mapAsMap?new Map:{};return Rt(t,n,this)}toString(e,t,n){return e?.doc?Ws(this,e,t,n):JSON.stringify(this)}}function Vt(s,e,t){return(e.inFlow??s.flow?Qs:Gs)(s,e,t)}function Gs({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){const{indent:a,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null});let f=!1;const h=[];for(let y=0;y<e.length;++y){const d=e[y];let m=null;if($(d))!f&&d.spaceBefore&&h.push(""),Ke(t,h,d.commentBefore,f),d.comment&&(m=d.comment);else if(I(d)){const w=$(d.key)?d.key:null;w&&(!f&&w.spaceBefore&&h.push(""),Ke(t,h,w.commentBefore,f))}f=!1;let b=X(d,u,()=>m=null,()=>f=!0);m&&(b+=G(b,r,c(m))),f&&m&&(f=!1),h.push(n+b)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let y=1;y<h.length;++y){const d=h[y];p+=d?`
40
+ `)&&(g="");return m+=g+O,t.inFlow?S&&n&&n():k&&!S?m+=G(m,t.indent,c(k)):d&&i&&i(),m}function qt(s,e){(s==="debug"||s==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}const Ut="<<";function Rt(s,e,{key:t,value:n}){if(s?.doc.schema.merge&&Js(t))if(n=Q(n)?n.resolve(s.doc):n,ne(n))for(const i of n.items)rt(s,e,i);else if(Array.isArray(n))for(const i of n)rt(s,e,i);else rt(s,e,n);else{const i=q(t,"",s);if(e instanceof Map)e.set(i,q(n,i,s));else if(e instanceof Set)e.add(i);else{const r=Ys(t,i,s),o=q(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}const Js=s=>s===Ut||E(s)&&s.value===Ut&&(!s.type||s.type===N.PLAIN);function rt(s,e,t){const n=s&&Q(t)?t.resolve(s.doc):t;if(!H(n))throw new Error("Merge sources must be maps or map aliases");const i=n.toJSON(null,s,Map);for(const[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Ys(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if($(s)&&t&&t.doc){const n=Ft(t.doc,{});n.anchors=new Set;for(const r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;const i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),qt(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function ot(s,e,t){const n=ye(s,void 0,t),i=ye(e,void 0,t);return new C(n,i)}class C{constructor(e,t=null){Object.defineProperty(this,B,{value:Lt}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return $(t)&&(t=t.clone(e)),$(n)&&(n=n.clone(e)),new C(t,n)}toJSON(e,t){const n=t?.mapAsMap?new Map:{};return Rt(t,n,this)}toString(e,t,n){return e?.doc?Vs(this,e,t,n):JSON.stringify(this)}}function Wt(s,e,t){return(e.inFlow??s.flow?Qs:Gs)(s,e,t)}function Gs({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){const{indent:a,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null});let f=!1;const h=[];for(let y=0;y<e.length;++y){const d=e[y];let m=null;if($(d))!f&&d.spaceBefore&&h.push(""),Ke(t,h,d.commentBefore,f),d.comment&&(m=d.comment);else if(I(d)){const w=$(d.key)?d.key:null;w&&(!f&&w.spaceBefore&&h.push(""),Ke(t,h,w.commentBefore,f))}f=!1;let b=X(d,u,()=>m=null,()=>f=!0);m&&(b+=G(b,r,c(m))),f&&m&&(f=!1),h.push(n+b)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let y=1;y<h.length;++y){const d=h[y];p+=d?`
41
41
  ${a}${d}`:`
42
42
  `}}return s?(p+=`
43
43
  `+R(c(s),a),l&&l()):f&&o&&o(),p}function Qs({comment:s,items:e},t,{flowChars:n,itemIndent:i,onComment:r}){const{indent:o,indentStep:l,flowCollectionPadding:a,options:{commentString:c}}=t;i+=l;const u=Object.assign({},t,{indent:i,inFlow:!0,type:null});let f=!1,h=0;const p=[];for(let b=0;b<e.length;++b){const w=e[b];let k=null;if($(w))w.spaceBefore&&p.push(""),Ke(t,p,w.commentBefore,!1),w.comment&&(k=w.comment);else if(I(w)){const O=$(w.key)?w.key:null;O&&(O.spaceBefore&&p.push(""),Ke(t,p,O.commentBefore,!1),O.comment&&(f=!0));const g=$(w.value)?w.value:null;g?(g.comment&&(k=g.comment),g.commentBefore&&(f=!0)):w.value==null&&O&&O.comment&&(k=O.comment)}k&&(f=!0);let S=X(w,u,()=>k=null);b<e.length-1&&(S+=","),k&&(S+=G(S,i,c(k))),!f&&(p.length>h||S.includes(`
44
44
  `))&&(f=!0),p.push(S),h=p.length}let y;const{start:d,end:m}=n;if(p.length===0)y=d+m;else if(f||(f=p.reduce((w,k)=>w+k.length+2,2)>_e.maxFlowStringSingleLineLength),f){y=d;for(const b of p)y+=b?`
45
45
  ${l}${o}${b}`:`
46
46
  `;y+=`
47
- ${o}${m}`}else y=`${d}${a}${p.join(" ")}${a}${m}`;return s&&(y+=G(y,c(s),o),r&&r()),y}function Ke({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){const r=R(e(n),s);t.push(r.trimStart())}}function z(s,e){const t=E(e)?e.value:e;for(const n of s)if(I(n)&&(n.key===e||n.key===t||E(n.key)&&n.key.value===t))return n}class j extends _e{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(J,e),this.items=[]}add(e,t){let n;I(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new C(e,e?.value):n=new C(e.key,e.value);const i=z(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);E(i.value)&&Pt(n.value)?i.value.value=n.value:i.value=n.value}else if(r){const o=this.items.findIndex(l=>r(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){const t=z(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const i=z(this.items,e)?.value;return(!t&&E(i)?i.value:i)??void 0}has(e){return!!z(this.items,e)}set(e,t){this.add(new C(e,t),!0)}toJSON(e,t,n){const i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(const r of this.items)Rt(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(const i of this.items)if(!I(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})),Vt(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}function Hs(s,e,t){const{keepUndefined:n,replacer:i}=t,r=new j(s),o=(l,a)=>{if(typeof i=="function")a=i.call(e,l,a);else if(Array.isArray(i)&&!i.includes(l))return;(a!==void 0||n)&&r.items.push(ot(l,a,t))};if(e instanceof Map)for(const[l,a]of e)o(l,a);else if(e&&typeof e=="object")for(const l of Object.keys(e))o(l,e[l]);return typeof s.sortMapEntries=="function"&&r.items.sort(s.sortMapEntries),r}const le={collection:"map",createNode:Hs,default:!0,nodeClass:j,tag:"tag:yaml.org,2002:map",resolve(s,e){return H(s)||e("Expected a mapping for this tag"),s}};class x extends _e{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(se,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Fe(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=Fe(e);if(typeof n!="number")return;const i=this.items[n];return!t&&E(i)?i.value:i}has(e){const t=Fe(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=Fe(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[n];E(i)&&Pt(t)?i.value=t:this.items[n]=t}toJSON(e,t){const n=[];t?.onCreate&&t.onCreate(n);let i=0;for(const r of this.items)n.push(q(r,String(i++),t));return n}toString(e,t,n){return e?Vt(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}}function Fe(s){let e=E(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Xs(s,e,t){const{replacer:n}=t,i=new x(s);if(e&&Symbol.iterator in Object(e)){let r=0;for(let o of e){if(typeof n=="function"){const l=e instanceof Set?o:String(r++);o=n.call(e,l,o)}i.items.push(ye(o,void 0,t))}}return i}const ae={collection:"seq",createNode:Xs,default:!0,nodeClass:x,tag:"tag:yaml.org,2002:seq",resolve(s,e){return ne(s)||e("Expected a sequence for this tag"),s}},qe={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),Se(s,e,t,n)}},Ue={identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new N(null),stringify:({source:s},e)=>typeof s=="string"&&Ue.test.test(s)?s:e.options.nullStr},lt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new N(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&lt.test.test(s)){const n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function D({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);const i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=e-(r.length-o-1);for(;l-- >0;)r+="0"}return r}const Wt={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},Jt={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},Yt={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){const e=new N(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:D},Re=s=>typeof s=="bigint"||Number.isInteger(s),at=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Gt(s,e,t){const{value:n}=s;return Re(n)&&n>=0?t+n.toString(e):D(s)}const Qt={identify:s=>Re(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>at(s,2,8,t),stringify:s=>Gt(s,8,"0o")},Ht={identify:Re,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>at(s,0,10,t),stringify:D},Xt={identify:s=>Re(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>at(s,2,16,t),stringify:s=>Gt(s,16,"0x")},zs=[le,ae,qe,Ue,lt,Qt,Ht,Xt,Wt,Jt,Yt];function zt(s){return typeof s=="bigint"||Number.isInteger(s)}const Ve=({value:s})=>JSON.stringify(s),xs=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Ve},{identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ve},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:Ve},{identify:zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>zt(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Ve}],Zs={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},en=[le,ae].concat(xs,Zs),ct={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Buffer=="function")return Buffer.from(s,"base64");if(typeof atob=="function"){const t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,i,r){const o=t;let l;if(typeof Buffer=="function")l=o instanceof Buffer?o.toString("base64"):Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let a="";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=N.BLOCK_LITERAL),e!==N.QUOTE_DOUBLE){const a=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(l.length/a),u=new Array(c);for(let f=0,h=0;f<c;++f,h+=a)u[f]=l.substr(h,a);l=u.join(e===N.BLOCK_LITERAL?`
47
+ ${o}${m}`}else y=`${d}${a}${p.join(" ")}${a}${m}`;return s&&(y+=G(y,c(s),o),r&&r()),y}function Ke({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){const r=R(e(n),s);t.push(r.trimStart())}}function z(s,e){const t=E(e)?e.value:e;for(const n of s)if(I(n)&&(n.key===e||n.key===t||E(n.key)&&n.key.value===t))return n}class j extends _e{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(J,e),this.items=[]}add(e,t){let n;I(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new C(e,e?.value):n=new C(e.key,e.value);const i=z(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);E(i.value)&&Pt(n.value)?i.value.value=n.value:i.value=n.value}else if(r){const o=this.items.findIndex(l=>r(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){const t=z(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const i=z(this.items,e)?.value;return(!t&&E(i)?i.value:i)??void 0}has(e){return!!z(this.items,e)}set(e,t){this.add(new C(e,t),!0)}toJSON(e,t,n){const i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(const r of this.items)Rt(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(const i of this.items)if(!I(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})),Wt(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}function Hs(s,e,t){const{keepUndefined:n,replacer:i}=t,r=new j(s),o=(l,a)=>{if(typeof i=="function")a=i.call(e,l,a);else if(Array.isArray(i)&&!i.includes(l))return;(a!==void 0||n)&&r.items.push(ot(l,a,t))};if(e instanceof Map)for(const[l,a]of e)o(l,a);else if(e&&typeof e=="object")for(const l of Object.keys(e))o(l,e[l]);return typeof s.sortMapEntries=="function"&&r.items.sort(s.sortMapEntries),r}const le={collection:"map",createNode:Hs,default:!0,nodeClass:j,tag:"tag:yaml.org,2002:map",resolve(s,e){return H(s)||e("Expected a mapping for this tag"),s}};class x extends _e{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(se,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Fe(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=Fe(e);if(typeof n!="number")return;const i=this.items[n];return!t&&E(i)?i.value:i}has(e){const t=Fe(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=Fe(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[n];E(i)&&Pt(t)?i.value=t:this.items[n]=t}toJSON(e,t){const n=[];t?.onCreate&&t.onCreate(n);let i=0;for(const r of this.items)n.push(q(r,String(i++),t));return n}toString(e,t,n){return e?Wt(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}}function Fe(s){let e=E(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Xs(s,e,t){const{replacer:n}=t,i=new x(s);if(e&&Symbol.iterator in Object(e)){let r=0;for(let o of e){if(typeof n=="function"){const l=e instanceof Set?o:String(r++);o=n.call(e,l,o)}i.items.push(ye(o,void 0,t))}}return i}const ae={collection:"seq",createNode:Xs,default:!0,nodeClass:x,tag:"tag:yaml.org,2002:seq",resolve(s,e){return ne(s)||e("Expected a sequence for this tag"),s}},qe={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),Se(s,e,t,n)}},Ue={identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new N(null),stringify:({source:s},e)=>typeof s=="string"&&Ue.test.test(s)?s:e.options.nullStr},lt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new N(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&lt.test.test(s)){const n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function D({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);const i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=e-(r.length-o-1);for(;l-- >0;)r+="0"}return r}const Vt={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},Jt={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},Yt={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){const e=new N(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:D},Re=s=>typeof s=="bigint"||Number.isInteger(s),at=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Gt(s,e,t){const{value:n}=s;return Re(n)&&n>=0?t+n.toString(e):D(s)}const Qt={identify:s=>Re(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>at(s,2,8,t),stringify:s=>Gt(s,8,"0o")},Ht={identify:Re,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>at(s,0,10,t),stringify:D},Xt={identify:s=>Re(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>at(s,2,16,t),stringify:s=>Gt(s,16,"0x")},zs=[le,ae,qe,Ue,lt,Qt,Ht,Xt,Vt,Jt,Yt];function zt(s){return typeof s=="bigint"||Number.isInteger(s)}const We=({value:s})=>JSON.stringify(s),xs=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:We},{identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:We},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:We},{identify:zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>zt(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:We}],Zs={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},en=[le,ae].concat(xs,Zs),ct={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Buffer=="function")return Buffer.from(s,"base64");if(typeof atob=="function"){const t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,i,r){const o=t;let l;if(typeof Buffer=="function")l=o instanceof Buffer?o.toString("base64"):Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let a="";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=N.BLOCK_LITERAL),e!==N.QUOTE_DOUBLE){const a=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(l.length/a),u=new Array(c);for(let f=0,h=0;f<c;++f,h+=a)u[f]=l.substr(h,a);l=u.join(e===N.BLOCK_LITERAL?`
48
48
  `:" ")}return Se({comment:s,type:e,value:l},n,i,r)}};function xt(s,e){if(ne(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!I(n)){if(H(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");const i=n.items[0]||new C(new N(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
49
49
  ${i.key.commentBefore}`:n.commentBefore),n.comment){const r=i.value??i.key;r.comment=r.comment?`${n.comment}
50
- ${r.comment}`:n.comment}n=i}s.items[t]=I(n)?n:new C(n)}}else e("Expected a sequence for this tag");return s}function Zt(s,e,t){const{replacer:n}=t,i=new x(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)l=c[0],a=o[l];else throw new TypeError(`Expected { key: value } tuple: ${o}`)}else l=o;i.items.push(ot(l,a,t))}return i}const ft={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:xt,createNode:Zt};class ce extends x{constructor(){super(),this.add=j.prototype.add.bind(this),this.delete=j.prototype.delete.bind(this),this.get=j.prototype.get.bind(this),this.has=j.prototype.has.bind(this),this.set=j.prototype.set.bind(this),this.tag=ce.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const i of this.items){let r,o;if(I(i)?(r=q(i.key,"",t),o=q(i.value,r,t)):r=q(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}}ce.tag="tag:yaml.org,2002:omap";const ut={collection:"seq",identify:s=>s instanceof Map,nodeClass:ce,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=xt(s,e),n=[];for(const{key:i}of t.items)E(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ce,t)},createNode(s,e,t){const n=Zt(s,e,t),i=new ce;return i.items=n.items,i}};function es({value:s,source:e},t){return e&&(s?ts:ss).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const ts={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new N(!0),stringify:es},ss={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new N(!1),stringify:es},tn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},sn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},nn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){const e=new N(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){const n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:D},ke=s=>typeof s=="bigint"||Number.isInteger(s);function We(s,e,t,{intAsBigInt:n}){const i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}const o=BigInt(s);return i==="-"?BigInt(-1)*o:o}const r=parseInt(s,t);return i==="-"?-1*r:r}function ht(s,e,t){const{value:n}=s;if(ke(n)){const i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return D(s)}const rn={identify:ke,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>We(s,2,2,t),stringify:s=>ht(s,2,"0b")},on={identify:ke,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>We(s,1,8,t),stringify:s=>ht(s,8,"0")},ln={identify:ke,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>We(s,0,10,t),stringify:D},an={identify:ke,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>We(s,2,16,t),stringify:s=>ht(s,16,"0x")};class fe extends j{constructor(e){super(e),this.tag=fe.tag}add(e){let t;I(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new C(e.key,null):t=new C(e,null),z(this.items,t.key)||this.items.push(t)}get(e,t){const n=z(this.items,e);return!t&&I(n)?E(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const n=z(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new C(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}}fe.tag="tag:yaml.org,2002:set";const dt={collection:"map",identify:s=>s instanceof Set,nodeClass:fe,default:!1,tag:"tag:yaml.org,2002:set",resolve(s,e){if(H(s)){if(s.hasAllNullValues(!0))return Object.assign(new fe,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s},createNode(s,e,t){const{replacer:n}=t,i=new fe(s);if(e&&Symbol.iterator in Object(e))for(let r of e)typeof n=="function"&&(r=n.call(e,r,r)),i.items.push(ot(r,null,t));return i}};function pt(s,e){const t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return t==="-"?i(-1)*r:r}function ns(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return D(s);let n="";e<0&&(n="-",e*=t(-1));const i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>o<10?"0"+String(o):String(o)).join(":").replace(/000000\d*$/,"")}const is={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>pt(s,t),stringify:ns},rs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>pt(s,!1),stringify:ns},Je={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){const e=s.match(Je.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,n,i,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,n-1,i,r||0,o||0,l||0,a);const u=e[8];if(u&&u!=="Z"){let f=pt(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},os=[le,ae,qe,Ue,ts,ss,rn,on,ln,an,tn,sn,nn,ct,ut,ft,dt,is,rs,Je],ls=new Map([["core",zs],["failsafe",[le,ae,qe]],["json",en],["yaml11",os],["yaml-1.1",os]]),as={binary:ct,bool:lt,float:Yt,floatExp:Jt,floatNaN:Wt,floatTime:rs,int:Ht,intHex:Xt,intOct:Qt,intTime:is,map:le,null:Ue,omap:ut,pairs:ft,seq:ae,set:dt,timestamp:Je},cn={"tag:yaml.org,2002:binary":ct,"tag:yaml.org,2002:omap":ut,"tag:yaml.org,2002:pairs":ft,"tag:yaml.org,2002:set":dt,"tag:yaml.org,2002:timestamp":Je};function mt(s,e){let t=ls.get(e);if(!t)if(Array.isArray(s))t=[];else{const n=Array.from(ls.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${n} or define customTags array`)}if(Array.isArray(s))for(const n of s)t=t.concat(n);else typeof s=="function"&&(t=s(t.slice()));return t.map(n=>{if(typeof n!="string")return n;const i=as[n];if(i)return i;const r=Object.keys(as).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${r}`)})}const fn=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class Ye{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?mt(e,"compat"):e?mt(null,e):null,this.merge=!!n,this.name=typeof r=="string"&&r||"core",this.knownTags=i?cn:{},this.tags=mt(t,this.name),this.toStringOptions=l??null,Object.defineProperty(this,J,{value:le}),Object.defineProperty(this,U,{value:qe}),Object.defineProperty(this,se,{value:ae}),this.sortMapEntries=typeof o=="function"?o:o===!0?fn:null}clone(){const e=Object.create(Ye.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function un(s,e){const t=[];let n=e.directives===!0;if(e.directives!==!1&&s.directives){const a=s.directives.toString(s);a?(t.push(a),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");const i=Ft(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");const a=r(s.commentBefore);t.unshift(R(a,""))}let o=!1,l=null;if(s.contents){if($(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const u=r(s.contents.commentBefore);t.push(R(u,""))}i.forceBlockIndent=!!s.comment,l=s.contents.comment}const a=l?void 0:()=>o=!0;let c=X(s.contents,i,()=>l=null,a);l&&(c+=G(c,"",r(l))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(X(s.contents,i));if(s.directives?.docEnd)if(s.comment){const a=r(s.comment);a.includes(`
50
+ ${r.comment}`:n.comment}n=i}s.items[t]=I(n)?n:new C(n)}}else e("Expected a sequence for this tag");return s}function Zt(s,e,t){const{replacer:n}=t,i=new x(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)l=c[0],a=o[l];else throw new TypeError(`Expected { key: value } tuple: ${o}`)}else l=o;i.items.push(ot(l,a,t))}return i}const ft={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:xt,createNode:Zt};class ce extends x{constructor(){super(),this.add=j.prototype.add.bind(this),this.delete=j.prototype.delete.bind(this),this.get=j.prototype.get.bind(this),this.has=j.prototype.has.bind(this),this.set=j.prototype.set.bind(this),this.tag=ce.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const i of this.items){let r,o;if(I(i)?(r=q(i.key,"",t),o=q(i.value,r,t)):r=q(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}}ce.tag="tag:yaml.org,2002:omap";const ut={collection:"seq",identify:s=>s instanceof Map,nodeClass:ce,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=xt(s,e),n=[];for(const{key:i}of t.items)E(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ce,t)},createNode(s,e,t){const n=Zt(s,e,t),i=new ce;return i.items=n.items,i}};function es({value:s,source:e},t){return e&&(s?ts:ss).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const ts={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new N(!0),stringify:es},ss={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new N(!1),stringify:es},tn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},sn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},nn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){const e=new N(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){const n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:D},ke=s=>typeof s=="bigint"||Number.isInteger(s);function Ve(s,e,t,{intAsBigInt:n}){const i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}const o=BigInt(s);return i==="-"?BigInt(-1)*o:o}const r=parseInt(s,t);return i==="-"?-1*r:r}function ht(s,e,t){const{value:n}=s;if(ke(n)){const i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return D(s)}const rn={identify:ke,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Ve(s,2,2,t),stringify:s=>ht(s,2,"0b")},on={identify:ke,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Ve(s,1,8,t),stringify:s=>ht(s,8,"0")},ln={identify:ke,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Ve(s,0,10,t),stringify:D},an={identify:ke,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Ve(s,2,16,t),stringify:s=>ht(s,16,"0x")};class fe extends j{constructor(e){super(e),this.tag=fe.tag}add(e){let t;I(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new C(e.key,null):t=new C(e,null),z(this.items,t.key)||this.items.push(t)}get(e,t){const n=z(this.items,e);return!t&&I(n)?E(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const n=z(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new C(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}}fe.tag="tag:yaml.org,2002:set";const dt={collection:"map",identify:s=>s instanceof Set,nodeClass:fe,default:!1,tag:"tag:yaml.org,2002:set",resolve(s,e){if(H(s)){if(s.hasAllNullValues(!0))return Object.assign(new fe,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s},createNode(s,e,t){const{replacer:n}=t,i=new fe(s);if(e&&Symbol.iterator in Object(e))for(let r of e)typeof n=="function"&&(r=n.call(e,r,r)),i.items.push(ot(r,null,t));return i}};function pt(s,e){const t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return t==="-"?i(-1)*r:r}function ns(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return D(s);let n="";e<0&&(n="-",e*=t(-1));const i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>o<10?"0"+String(o):String(o)).join(":").replace(/000000\d*$/,"")}const is={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>pt(s,t),stringify:ns},rs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>pt(s,!1),stringify:ns},Je={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){const e=s.match(Je.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,n,i,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,n-1,i,r||0,o||0,l||0,a);const u=e[8];if(u&&u!=="Z"){let f=pt(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},os=[le,ae,qe,Ue,ts,ss,rn,on,ln,an,tn,sn,nn,ct,ut,ft,dt,is,rs,Je],ls=new Map([["core",zs],["failsafe",[le,ae,qe]],["json",en],["yaml11",os],["yaml-1.1",os]]),as={binary:ct,bool:lt,float:Yt,floatExp:Jt,floatNaN:Vt,floatTime:rs,int:Ht,intHex:Xt,intOct:Qt,intTime:is,map:le,null:Ue,omap:ut,pairs:ft,seq:ae,set:dt,timestamp:Je},cn={"tag:yaml.org,2002:binary":ct,"tag:yaml.org,2002:omap":ut,"tag:yaml.org,2002:pairs":ft,"tag:yaml.org,2002:set":dt,"tag:yaml.org,2002:timestamp":Je};function mt(s,e){let t=ls.get(e);if(!t)if(Array.isArray(s))t=[];else{const n=Array.from(ls.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${n} or define customTags array`)}if(Array.isArray(s))for(const n of s)t=t.concat(n);else typeof s=="function"&&(t=s(t.slice()));return t.map(n=>{if(typeof n!="string")return n;const i=as[n];if(i)return i;const r=Object.keys(as).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${r}`)})}const fn=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class Ye{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?mt(e,"compat"):e?mt(null,e):null,this.merge=!!n,this.name=typeof r=="string"&&r||"core",this.knownTags=i?cn:{},this.tags=mt(t,this.name),this.toStringOptions=l??null,Object.defineProperty(this,J,{value:le}),Object.defineProperty(this,U,{value:qe}),Object.defineProperty(this,se,{value:ae}),this.sortMapEntries=typeof o=="function"?o:o===!0?fn:null}clone(){const e=Object.create(Ye.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function un(s,e){const t=[];let n=e.directives===!0;if(e.directives!==!1&&s.directives){const a=s.directives.toString(s);a?(t.push(a),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");const i=Ft(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");const a=r(s.commentBefore);t.unshift(R(a,""))}let o=!1,l=null;if(s.contents){if($(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const u=r(s.contents.commentBefore);t.push(R(u,""))}i.forceBlockIndent=!!s.comment,l=s.contents.comment}const a=l?void 0:()=>o=!0;let c=X(s.contents,i,()=>l=null,a);l&&(c+=G(c,"",r(l))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(X(s.contents,i));if(s.directives?.docEnd)if(s.comment){const a=r(s.comment);a.includes(`
51
51
  `)?(t.push("..."),t.push(R(a,""))):t.push(`... ${a}`)}else t.push("...");else{let a=s.comment;a&&o&&(a=a.replace(/^\n+/,"")),a&&((!o||l)&&t[t.length-1]!==""&&t.push(""),t.push(R(r(a),"")))}return t.join(`
52
52
  `)+`
53
53
  `}function Ne(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],l=Ne(s,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=Ne(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=Ne(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=Ne(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}class ue{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,B,{value:tt});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new v({version:o}),this.setSchema(o,n),e===void 0?this.contents=null:this.contents=this.createNode(e,i,n)}clone(){const e=Object.create(ue.prototype,{[B]:{value:tt}});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=$(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){he(this.contents)&&this.contents.add(e)}addIn(e,t){he(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=jt(this);e.anchor=!t||n.has(t)?Mt(t||"a",n):t}return new $e(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const m=w=>typeof w=="number"||w instanceof String||w instanceof Number,b=t.filter(m).map(String);b.length>0&&(t=t.concat(b)),i=t}else n===void 0&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:u}=n??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=Ps(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},d=ye(e,u,y);return l&&L(d)&&(d.flow=!0),h(),d}createPair(e,t,n={}){const i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new C(i,r)}delete(e){return he(this.contents)?this.contents.delete(e):!1}deleteIn(e){return be(e)?this.contents==null?!1:(this.contents=null,!0):he(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return L(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return be(e)?!t&&E(this.contents)?this.contents.value:this.contents:L(this.contents)?this.contents.getIn(e,t):void 0}has(e){return L(this.contents)?this.contents.has(e):!1}hasIn(e){return be(e)?this.contents!==void 0:L(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=ve(this.schema,[e],t):he(this.contents)&&this.contents.set(e,t)}setIn(e,t){be(e)?this.contents=t:this.contents==null?this.contents=ve(this.schema,Array.from(e),t):he(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new v({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new v({version:e}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Ye(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100,stringify:X},a=q(this.contents,t??"",l);if(typeof r=="function")for(const{count:c,res:u}of l.anchors.values())r(u,c);return typeof o=="function"?Ne(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return un(this,e)}}function he(s){if(L(s))return!0;throw new Error("Expected a YAML collection as document contents")}class gt extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}}class Z extends gt{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class cs extends gt{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const Ge=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(l=>e.linePos(l));const{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){const l=Math.min(r-39,o.length-79);o="…"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,r))){let l=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);l.length>80&&(l=l.substring(0,79)+`…
@@ -60,8 +60,8 @@ ${c}
60
60
  `+p.comment:r.comment=p.comment);continue}(p.hasNewlineAfterProp||Oe(u))&&i(u??c[c.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==n.indent&&i(o,"BAD_INDENT",us);const d=p.end,m=u?s(t,u,p,i):e(t,d,c,null,p,i);t.schema.compat&&yt(n.indent,u,i),fs(t,r.items,m)&&i(d,"DUPLICATE_KEY","Map keys must be unique");const b=de(f??[],{indicator:"map-value-ind",next:h,offset:m.range[2],onError:i,startOnNewline:!u||u.type==="block-scalar"});if(o=b.end,b.found){y&&(h?.type==="block-map"&&!b.hasNewline&&i(o,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&p.start<b.found.offset-1024&&i(m.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const w=h?s(t,h,b,i):e(t,o,f,null,b,i);t.schema.compat&&yt(n.indent,h,i),o=w.range[2];const k=new C(m,w);t.options.keepSourceTokens&&(k.srcToken=a),r.items.push(k)}else{y&&i(m.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(m.comment?m.comment+=`
61
61
  `+b.comment:m.comment=b.comment);const w=new C(m);t.options.keepSourceTokens&&(w.srcToken=a),r.items.push(w)}}return l&&l<o&&i(l,"IMPOSSIBLE","Map comment with trailing content"),r.range=[n.offset,o,l??o],r}function dn({composeNode:s,composeEmptyNode:e},t,n,i){const r=new x(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset,l=null;for(const{start:a,value:c}of n.items){const u=de(a,{indicator:"seq-item-ind",next:c,offset:o,onError:i,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||c)c&&c.type==="block-seq"?i(u.end,"BAD_INDENT","All sequence items must start at the same column"):i(o,"MISSING_CHAR","Sequence item without - indicator");else{l=u.end,u.comment&&(r.comment=u.comment);continue}const f=c?s(t,c,u,i):e(t,u.end,a,null,u,i);t.schema.compat&&yt(n.indent,c,i),o=f.range[2],r.items.push(f)}return r.range=[n.offset,o,l??o],r}function Ae(s,e,t,n){let i="";if(s){let r=!1,o="";for(const l of s){const{source:a,type:c}=l;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const u=a.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=a),r=!0;break;default:n(l,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=a.length}}return{comment:i,offset:e}}const bt="Block collections are not allowed within flow collections",wt=s=>s&&(s.type==="block-map"||s.type==="block-seq");function pn({composeNode:s,composeEmptyNode:e},t,n,i){const r=n.start.source==="{",o=r?"flow map":"flow sequence",l=r?new j(t.schema):new x(t.schema);l.flow=!0;const a=t.atRoot;a&&(t.atRoot=!1);let c=n.offset+n.start.source.length;for(let y=0;y<n.items.length;++y){const d=n.items[y],{start:m,key:b,sep:w,value:k}=d,S=de(m,{flow:o,indicator:"explicit-key-ind",next:b??w?.[0],offset:c,onError:i,startOnNewline:!1});if(!S.found){if(!S.anchor&&!S.tag&&!w&&!k){y===0&&S.comma?i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):y<n.items.length-1&&i(S.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),S.comment&&(l.comment?l.comment+=`
62
62
  `+S.comment:l.comment=S.comment),c=S.end;continue}!r&&t.options.strict&&Oe(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)S.comma&&i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(S.comma||i(S.start,"MISSING_CHAR",`Missing , between ${o} items`),S.comment){let O="";e:for(const g of m)switch(g.type){case"comma":case"space":break;case"comment":O=g.source.substring(1);break e;default:break e}if(O){let g=l.items[l.items.length-1];I(g)&&(g=g.value??g.key),g.comment?g.comment+=`
63
- `+O:g.comment=O,S.comment=S.comment.substring(O.length+1)}}if(!r&&!w&&!S.found){const O=k?s(t,k,S,i):e(t,S.end,w,null,S,i);l.items.push(O),c=O.range[2],wt(k)&&i(O.range,"BLOCK_IN_FLOW",bt)}else{const O=S.end,g=b?s(t,b,S,i):e(t,O,m,null,S,i);wt(b)&&i(g.range,"BLOCK_IN_FLOW",bt);const T=de(w??[],{flow:o,indicator:"map-value-ind",next:k,offset:g.range[2],onError:i,startOnNewline:!1});if(T.found){if(!r&&!S.found&&t.options.strict){if(w)for(const P of w){if(P===T.found)break;if(P.type==="newline"){i(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}S.start<T.found.offset-1024&&i(T.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source&&k.source[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${o}`):i(T.start,"MISSING_CHAR",`Missing , or : between ${o} items`));const V=k?s(t,k,T,i):T.found?e(t,T.end,w,null,T,i):null;V?wt(k)&&i(V.range,"BLOCK_IN_FLOW",bt):T.comment&&(g.comment?g.comment+=`
64
- `+T.comment:g.comment=T.comment);const me=new C(g,V);if(t.options.keepSourceTokens&&(me.srcToken=d),r){const P=l;fs(t,P.items,g)&&i(O,"DUPLICATE_KEY","Map keys must be unique"),P.items.push(me)}else{const P=new j(t.schema);P.flow=!0,P.items.push(me),l.items.push(P)}c=V?V.range[2]:T.end}}const u=r?"}":"]",[f,...h]=n.end;let p=c;if(f&&f.source===u)p=f.offset+f.source.length;else{const y=o[0].toUpperCase()+o.substring(1),d=a?`${y} must end with a ${u}`:`${y} in block collection must be sufficiently indented and end with a ${u}`;i(c,a?"MISSING_CHAR":"BAD_INDENT",d),f&&f.source.length!==1&&h.unshift(f)}if(h.length>0){const y=Ae(h,p,t.options.strict,i);y.comment&&(l.comment?l.comment+=`
63
+ `+O:g.comment=O,S.comment=S.comment.substring(O.length+1)}}if(!r&&!w&&!S.found){const O=k?s(t,k,S,i):e(t,S.end,w,null,S,i);l.items.push(O),c=O.range[2],wt(k)&&i(O.range,"BLOCK_IN_FLOW",bt)}else{const O=S.end,g=b?s(t,b,S,i):e(t,O,m,null,S,i);wt(b)&&i(g.range,"BLOCK_IN_FLOW",bt);const T=de(w??[],{flow:o,indicator:"map-value-ind",next:k,offset:g.range[2],onError:i,startOnNewline:!1});if(T.found){if(!r&&!S.found&&t.options.strict){if(w)for(const P of w){if(P===T.found)break;if(P.type==="newline"){i(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}S.start<T.found.offset-1024&&i(T.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source&&k.source[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${o}`):i(T.start,"MISSING_CHAR",`Missing , or : between ${o} items`));const W=k?s(t,k,T,i):T.found?e(t,T.end,w,null,T,i):null;W?wt(k)&&i(W.range,"BLOCK_IN_FLOW",bt):T.comment&&(g.comment?g.comment+=`
64
+ `+T.comment:g.comment=T.comment);const me=new C(g,W);if(t.options.keepSourceTokens&&(me.srcToken=d),r){const P=l;fs(t,P.items,g)&&i(O,"DUPLICATE_KEY","Map keys must be unique"),P.items.push(me)}else{const P=new j(t.schema);P.flow=!0,P.items.push(me),l.items.push(P)}c=W?W.range[2]:T.end}}const u=r?"}":"]",[f,...h]=n.end;let p=c;if(f&&f.source===u)p=f.offset+f.source.length;else{const y=o[0].toUpperCase()+o.substring(1),d=a?`${y} must end with a ${u}`:`${y} in block collection must be sufficiently indented and end with a ${u}`;i(c,a?"MISSING_CHAR":"BAD_INDENT",d),f&&f.source.length!==1&&h.unshift(f)}if(h.length>0){const y=Ae(h,p,t.options.strict,i);y.comment&&(l.comment?l.comment+=`
65
65
  `+y.comment:l.comment=y.comment),l.range=[n.offset,p,y.offset]}else l.range=[n.offset,p,p];return l}function mn(s,e,t,n,i){let r;switch(t.type){case"block-map":{r=hn(s,e,t,i);break}case"block-seq":{r=dn(s,e,t,i);break}case"flow-collection":{r=pn(s,e,t,i);break}}if(!n)return r;const o=e.directives.tagName(n.source,h=>i(n,"TAG_RESOLVE_FAILED",h));if(!o)return r;const l=r.constructor;if(o==="!"||o===l.tagName)return r.tag=l.tagName,r;const a=H(r)?"map":"seq";let c=e.schema.tags.find(h=>h.collection===a&&h.tag===o);if(!c){const h=e.schema.knownTags[o];if(h&&h.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),r.tag=o,r}const u=c.resolve(r,h=>i(n,"TAG_RESOLVE_FAILED",h),e.options),f=$(u)?u:new N(u);return f.range=r.range,f.tag=o,c?.format&&(f.format=c.format),f}function hs(s,e,t){const n=s.offset,i=gn(s,e,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};const r=i.mode===">"?N.BLOCK_FOLDED:N.BLOCK_LITERAL,o=s.source?yn(s.source):[];let l=o.length;for(let d=o.length-1;d>=0;--d){const m=o[d][1];if(m===""||m==="\r")l=d;else break}if(l===0){const d=i.chomp==="+"&&o.length>0?`
66
66
  `.repeat(Math.max(1,o.length-1)):"";let m=n+i.length;return s.source&&(m+=s.source.length),{value:d,type:r,comment:i.comment,range:[n,m,m]}}let a=s.indent+i.indent,c=s.offset+i.length,u=0;for(let d=0;d<l;++d){const[m,b]=o[d];if(b===""||b==="\r")i.indent===0&&m.length>a&&(a=m.length);else{if(m.length<a){const w="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";t(c+m.length,"MISSING_CHAR",w)}i.indent===0&&(a=m.length),u=d;break}c+=m.length+b.length+1}for(let d=o.length-1;d>=l;--d)o[d][0].length>a&&(l=d+1);let f="",h="",p=!1;for(let d=0;d<u;++d)f+=o[d][0].slice(a)+`
67
67
  `;for(let d=u;d<l;++d){let[m,b]=o[d];c+=m.length+b.length+1;const w=b[b.length-1]==="\r";if(w&&(b=b.slice(0,-1)),b&&m.length<a){const S=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-b.length-(w?2:1),"BAD_INDENT",S),m=""}r===N.BLOCK_LITERAL?(f+=h+m.slice(a)+b,h=`
@@ -131,5 +131,5 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
131
131
  `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
132
132
  `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const n=!this.onKeyLine&&this.indent===e.indent&&t.sep;let i=[];if(n&&t.sep&&!t.value){const r=[];for(let o=0;o<t.sep.length;++o){const l=t.sep[o];switch(l.type){case"newline":r.push(o);break;case"space":break;case"comment":l.indent>e.indent&&(r.length=0);break;default:r.length=0}}r.length>=2&&(i=t.sep.splice(r[1]))}switch(this.type){case"anchor":case"tag":n||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!K(t.start,"explicit-key-ind")?t.start.push(this.sourceToken):n||t.value?(i.push(this.sourceToken),e.items.push({start:i})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(K(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(K(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Is(t.key)&&!K(t.sep,"newline")){const r=pe(t.start),o=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:o,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(K(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const r=pe(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:i,key:null,sep:[this.sourceToken]}):K(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);n||t.value?(e.items.push({start:i,key:r,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(r):(Object.assign(t,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{const r=this.startBlockValue(e);if(r){n&&r.type!=="block-seq"&&K(t.start,"explicit-key-ind")&&e.items.push({start:i}),this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||K(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const i=Ze(n),r=pe(i);Ts(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const l={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]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
133
133
  `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
134
- `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=Ze(e),n=pe(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Ze(e),n=pe(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Ls(s){const e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new As||null,prettyErrors:e}}function Rn(s,e={}){const{lineCounter:t,prettyErrors:n}=Ls(e),i=new It(t?.addNewLine),r=new kt(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(const l of o)l.errors.forEach(Ge(s,t)),l.warnings.forEach(Ge(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function $s(s,e={}){const{lineCounter:t,prettyErrors:n}=Ls(e),i=new It(t?.addNewLine),r=new kt(e);let o=null;for(const l of r.compose(i.parse(s),!0,s.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new Z(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(Ge(s,t)),o.warnings.forEach(Ge(s,t))),o}function Vn(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);const i=$s(s,t);if(!i)return null;if(i.warnings.forEach(r=>qt(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function Wn(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){const i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){const{keepUndefined:i}=t??e??{};if(!i)return}return new ue(s,n,t).toString(t)}const Jn=Object.freeze(Object.defineProperty({__proto__:null,Alias:$e,CST:Fn,Composer:kt,Document:ue,Lexer:Os,LineCounter:As,Pair:C,Parser:It,Scalar:N,Schema:Ye,YAMLError:gt,YAMLMap:j,YAMLParseError:Z,YAMLSeq:x,YAMLWarning:cs,isAlias:Q,isCollection:L,isDocument:ge,isMap:H,isNode:$,isPair:I,isScalar:E,isSeq:ne,parse:Vn,parseAllDocuments:Rn,parseDocument:$s,stringify:Wn,visit:Y,visitAsync:Le},Symbol.toStringTag,{value:"Module"})),Yn=s=>s,Gn=s=>s,Qn=s=>s,Hn=s=>({widget:"boolean",...s}),Xn=s=>({widget:"code",...s}),zn=s=>({widget:"color",...s}),xn=s=>({widget:"datetime",...s}),Zn=s=>({widget:"hidden",...s}),ei=s=>({widget:"file",...s}),ti=s=>({widget:"image",...s}),si=s=>({widget:"list",...s}),ni=s=>({widget:"map",...s}),ii=s=>({widget:"number",...s}),ri=s=>({widget:"object",...s}),oi=s=>({widget:"relation",...s}),li=s=>({widget:"select",...s}),ai=s=>({widget:"string",...s}),ci=s=>({widget:"text",...s}),fi=async s=>{try{await W.readdir(s)}catch{await W.mkdir(s,{recursive:!0})}},ui=async(s,e)=>{await W.writeFile(e,s)},hi=s=>{const e=s.startsWith(".")?s.slice(2):s;return e?["ts","js","cjs","mjs"].some(t=>e.includes(t))?e.split(".").slice(0,-1).join("."):e:s},Cs=async(s,e)=>{try{const t=await W.readdir(s),n=hi(e);if(n.includes("/")){const[o,l]=n.split("/");return await Cs(Te.join(s,o),l)}const i=t.find(o=>o.startsWith(n));if(!i)throw new Error("Config file not found");const{config:r}=await _s.loadConfigFromFile({command:"build",mode:""},Te.join(s,i))??{};if(!r)throw new Error("Config file not found");return r}catch{throw new Error("Config file not found")}},Tt=async(s,e)=>{const{configFile:t="./netlify.config.ts",config:n,saveFolder:i="./public/admin"}=e??{},r=n??await Cs(s,t);await fi(Te.join(s,i));const o=Jn.stringify(r);await ui(o,Te.join(s,i,"config.yml"))};async function di(s){let e="";return{name:"vite-plugin-netlify-cms",configResolved:t=>{e=t.root},buildStart:async()=>{await Tt(e,s)},handleHotUpdate:async({file:t})=>{t.endsWith("netlify.config.ts")&&await Tt(e,s)}}}A.createConfig=Tt,A.default=di,A.defineBooleanWidget=Hn,A.defineCodeWidget=Xn,A.defineColorWidget=zn,A.defineConfig=Yn,A.defineDateTimeWidget=xn,A.defineFileCollection=Qn,A.defineFileWidget=ei,A.defineFolderCollection=Gn,A.defineHiddenWidget=Zn,A.defineImageWidget=ti,A.defineListWidget=si,A.defineMapWidget=ni,A.defineNumberWidget=ii,A.defineObjectWidget=ri,A.defineRelationWidget=oi,A.defineSelectWidget=li,A.defineStringWidget=ai,A.defineTextWidget=ci,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
134
+ `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=Ze(e),n=pe(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Ze(e),n=pe(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Ls(s){const e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new As||null,prettyErrors:e}}function Rn(s,e={}){const{lineCounter:t,prettyErrors:n}=Ls(e),i=new It(t?.addNewLine),r=new kt(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(const l of o)l.errors.forEach(Ge(s,t)),l.warnings.forEach(Ge(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function $s(s,e={}){const{lineCounter:t,prettyErrors:n}=Ls(e),i=new It(t?.addNewLine),r=new kt(e);let o=null;for(const l of r.compose(i.parse(s),!0,s.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new Z(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(Ge(s,t)),o.warnings.forEach(Ge(s,t))),o}function Wn(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);const i=$s(s,t);if(!i)return null;if(i.warnings.forEach(r=>qt(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function Vn(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){const i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){const{keepUndefined:i}=t??e??{};if(!i)return}return new ue(s,n,t).toString(t)}const Jn=Object.freeze(Object.defineProperty({__proto__:null,Alias:$e,CST:Fn,Composer:kt,Document:ue,Lexer:Os,LineCounter:As,Pair:C,Parser:It,Scalar:N,Schema:Ye,YAMLError:gt,YAMLMap:j,YAMLParseError:Z,YAMLSeq:x,YAMLWarning:cs,isAlias:Q,isCollection:L,isDocument:ge,isMap:H,isNode:$,isPair:I,isScalar:E,isSeq:ne,parse:Wn,parseAllDocuments:Rn,parseDocument:$s,stringify:Vn,visit:Y,visitAsync:Le},Symbol.toStringTag,{value:"Module"})),Yn=s=>s,Gn=s=>s,Qn=s=>s,Hn=s=>s,Xn=s=>({widget:"boolean",...s}),zn=s=>({widget:"code",...s}),xn=s=>({widget:"color",...s}),Zn=s=>({widget:"datetime",...s}),ei=s=>({widget:"hidden",...s}),ti=s=>({widget:"file",...s}),si=s=>({widget:"image",...s}),ni=s=>({widget:"list",...s}),ii=s=>({widget:"map",...s}),ri=s=>({widget:"number",...s}),oi=s=>({widget:"object",...s}),li=s=>({widget:"relation",...s}),ai=s=>({widget:"select",...s}),ci=s=>({widget:"string",...s}),fi=s=>({widget:"text",...s}),ui=s=>({widget:"markdown",...s}),hi=async s=>{try{await V.readdir(s)}catch{await V.mkdir(s,{recursive:!0})}},di=async(s,e)=>{await V.writeFile(e,s)},pi=s=>{const e=s.startsWith(".")?s.slice(2):s;return e?["ts","js","cjs","mjs"].some(t=>e.includes(t))?e.split(".").slice(0,-1).join("."):e:s},Cs=async(s,e)=>{try{const t=await V.readdir(s),n=pi(e);if(n.includes("/")){const[o,l]=n.split("/");return await Cs(Te.join(s,o),l)}const i=t.find(o=>o.startsWith(n));if(!i)throw new Error("Config file not found");const{config:r}=await _s.loadConfigFromFile({command:"build",mode:""},Te.join(s,i))??{};if(!r)throw new Error("Config file not found");return r}catch{throw new Error("Config file not found")}},Tt=async(s,e)=>{const{configFile:t="./netlify.config.ts",config:n,saveFolder:i="./public/admin"}=e??{},r=n??await Cs(s,t);await hi(Te.join(s,i));const o=Jn.stringify(r);await di(o,Te.join(s,i,"config.yml"))};async function mi(s){let e="";return{name:"vite-plugin-netlify-cms",configResolved:t=>{e=t.root},buildStart:async()=>{await Tt(e,s)},handleHotUpdate:async({file:t})=>{t.endsWith("netlify.config.ts")&&await Tt(e,s)}}}A.createConfig=Tt,A.default=mi,A.defineBooleanWidget=Xn,A.defineCodeWidget=zn,A.defineColorWidget=xn,A.defineConfig=Yn,A.defineDateTimeWidget=Zn,A.defineFileCollection=Qn,A.defineFileCollectionEntry=Hn,A.defineFileWidget=ti,A.defineFolderCollection=Gn,A.defineHiddenWidget=ei,A.defineImageWidget=si,A.defineListWidget=ni,A.defineMapWidget=ii,A.defineMarkdownWidget=ui,A.defineNumberWidget=ri,A.defineObjectWidget=oi,A.defineRelationWidget=li,A.defineSelectWidget=ai,A.defineStringWidget=ci,A.defineTextWidget=fi,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
135
135
  //# sourceMappingURL=index.umd.js.map