agentic-mermaid 0.3.0 → 0.3.2
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/CHANGELOG.md +31 -0
- package/dist/agent-core.d.ts +8 -3
- package/dist/agent-core.js +2 -2
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +4 -4
- package/dist/agentic-mermaid-mcp.js +5 -5
- package/dist/am.js +6 -6
- package/dist/browser-lazy/chunks/architecture-WMSX5L4P.js +31 -0
- package/dist/browser-lazy/chunks/chunk-32FWKUUV.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +1 -0
- package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +143 -0
- package/dist/browser-lazy/chunks/chunk-ANTNEVJC.js +1 -0
- package/dist/browser-lazy/chunks/chunk-AOCFMYYH.js +4 -0
- package/dist/browser-lazy/chunks/chunk-CCTZFX43.js +4 -0
- package/dist/browser-lazy/chunks/chunk-EBPTM2RP.js +1 -0
- package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +1 -0
- package/dist/browser-lazy/chunks/chunk-EX6TP7QM.js +46 -0
- package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +2 -0
- package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +2 -0
- package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
- package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +1 -0
- package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +1 -0
- package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +1 -0
- package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +1 -0
- package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +1 -0
- package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +1 -0
- package/dist/browser-lazy/chunks/chunk-QMZ4Y6I7.js +1 -0
- package/dist/browser-lazy/chunks/chunk-QYJMRNS3.js +11 -0
- package/dist/browser-lazy/chunks/chunk-RLS545DI.js +1 -0
- package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +1 -0
- package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +3 -0
- package/dist/browser-lazy/chunks/chunk-TBZAU7KC.js +7 -0
- package/dist/browser-lazy/chunks/chunk-TDGTBGV3.js +1 -0
- package/dist/browser-lazy/chunks/chunk-TEH2PRKN.js +1 -0
- package/dist/browser-lazy/chunks/chunk-W6Q4PHPC.js +24 -0
- package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +1 -0
- package/dist/browser-lazy/chunks/chunk-WN7SFUCZ.js +1 -0
- package/dist/browser-lazy/chunks/chunk-ZZECLXC3.js +1 -0
- package/dist/browser-lazy/chunks/class-7JRALQIM.js +9 -0
- package/dist/browser-lazy/chunks/er-UDCGHKBX.js +9 -0
- package/dist/browser-lazy/chunks/flowchart-5FP7RRIK.js +4 -0
- package/dist/browser-lazy/chunks/gantt-NTOIC5CW.js +28 -0
- package/dist/browser-lazy/chunks/gitgraph-JYAPXUIJ.js +8 -0
- package/dist/browser-lazy/chunks/journey-646EFIB6.js +40 -0
- package/dist/browser-lazy/chunks/mindmap-2SBTQHQO.js +9 -0
- package/dist/browser-lazy/chunks/pie-7FDXZ24K.js +19 -0
- package/dist/browser-lazy/chunks/quadrant-72UT4XAW.js +24 -0
- package/dist/browser-lazy/chunks/radar-SU7BO56J.js +32 -0
- package/dist/browser-lazy/chunks/render-core-Q2JWXDDL.js +12 -0
- package/dist/browser-lazy/chunks/sequence-5O5ET264.js +12 -0
- package/dist/browser-lazy/chunks/state-IWPLFQ6R.js +4 -0
- package/dist/browser-lazy/chunks/timeline-WJWYHH5Y.js +20 -0
- package/dist/browser-lazy/chunks/xychart-HHQVQA5O.js +36 -0
- package/dist/browser-lazy/index.d.ts +1012 -0
- package/dist/browser-lazy/index.js +1 -0
- package/dist/browser.global.js +322 -321
- package/dist/{chunk-WHYJLDYG.js → chunk-3D4EHVQ4.js} +47784 -47711
- package/dist/{chunk-AVCWKYII.js → chunk-GX7UT56Q.js} +18 -5
- package/dist/{chunk-UJNY65QS.js → chunk-IVN6KP3W.js} +2 -2
- package/dist/{chunk-HFD4MALA.js → chunk-NE6JBHSE.js} +682 -44
- package/dist/{chunk-3QCXO4V6.js → chunk-R5U67OIW.js} +4 -4
- package/dist/{chunk-GILQUGFK.js → chunk-YWKCUBQN.js} +2 -2
- package/dist/{index-CLwYn6Im.d.ts → index-BFg_LoZS.d.ts} +5409 -5391
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-cli-XGZP6CMW.js +17 -0
- package/docs/README.md +1 -1
- package/docs/browser.md +355 -47
- package/docs/mcp-http-transport.md +2 -0
- package/package.json +17 -6
- package/server.json +2 -2
- package/dist/mcp-cli-SJVOGRA6.js +0 -17
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import{c as Yt,d as Ne,e as zt}from"./chunk-FFOHLPDA.js";import{a as In,b as Fn}from"./chunk-FLD63DXE.js";import{c as Ln}from"./chunk-P7HMSKHJ.js";var Nn={};Ln(Nn,{Alias:()=>te,CST:()=>Sn,Composer:()=>we,Document:()=>ie,Lexer:()=>Be,LineCounter:()=>Re,Pair:()=>I,Parser:()=>Se,Scalar:()=>y,Schema:()=>$e,YAMLError:()=>Pe,YAMLMap:()=>F,YAMLParseError:()=>j,YAMLSeq:()=>P,YAMLWarning:()=>_e,isAlias:()=>K,isCollection:()=>T,isDocument:()=>q,isMap:()=>V,isNode:()=>E,isPair:()=>O,isScalar:()=>C,isSeq:()=>U,parse:()=>Ei,parseAllDocuments:()=>Oi,parseDocument:()=>Mn,stringify:()=>Ti,visit:()=>Y,visitAsync:()=>qe});var ot=Symbol.for("yaml.alias"),at=Symbol.for("yaml.document"),J=Symbol.for("yaml.map"),Gt=Symbol.for("yaml.pair"),R=Symbol.for("yaml.scalar"),oe=Symbol.for("yaml.seq"),D=Symbol.for("yaml.node.type"),K=n=>!!n&&typeof n=="object"&&n[D]===ot,q=n=>!!n&&typeof n=="object"&&n[D]===at,V=n=>!!n&&typeof n=="object"&&n[D]===J,O=n=>!!n&&typeof n=="object"&&n[D]===Gt,C=n=>!!n&&typeof n=="object"&&n[D]===R,U=n=>!!n&&typeof n=="object"&&n[D]===oe;function T(n){if(n&&typeof n=="object")switch(n[D]){case J:case oe:return!0}return!1}function E(n){if(n&&typeof n=="object")switch(n[D]){case ot:case J:case R:case oe:return!0}return!1}var lt=n=>(C(n)||T(n))&&!!n.anchor;var B=Symbol("break visit"),vn=Symbol("skip children"),Z=Symbol("remove node");function Y(n,e){let t=$n(e);q(n)?Ae(null,n.contents,t,Object.freeze([n]))===Z&&(n.contents=null):Ae(null,n,t,Object.freeze([]))}Y.BREAK=B;Y.SKIP=vn;Y.REMOVE=Z;function Ae(n,e,t,i){let s=xn(n,e,t,i);if(E(s)||O(s))return Pn(n,i,s),Ae(n,s,t,i);if(typeof s!="symbol"){if(T(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=Ae(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===B)return B;o===Z&&(e.items.splice(r,1),r-=1)}}}else if(O(e)){i=Object.freeze(i.concat(e));let r=Ae("key",e.key,t,i);if(r===B)return B;r===Z&&(e.key=null);let o=Ae("value",e.value,t,i);if(o===B)return B;o===Z&&(e.value=null)}}return s}async function qe(n,e){let t=$n(e);q(n)?await Ce(null,n.contents,t,Object.freeze([n]))===Z&&(n.contents=null):await Ce(null,n,t,Object.freeze([]))}qe.BREAK=B;qe.SKIP=vn;qe.REMOVE=Z;async function Ce(n,e,t,i){let s=await xn(n,e,t,i);if(E(s)||O(s))return Pn(n,i,s),Ce(n,s,t,i);if(typeof s!="symbol"){if(T(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ce(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===B)return B;o===Z&&(e.items.splice(r,1),r-=1)}}}else if(O(e)){i=Object.freeze(i.concat(e));let r=await Ce("key",e.key,t,i);if(r===B)return B;r===Z&&(e.key=null);let o=await Ce("value",e.value,t,i);if(o===B)return B;o===Z&&(e.value=null)}}return s}function $n(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function xn(n,e,t,i){if(typeof t=="function")return t(n,e,i);if(V(e))return t.Map?.(n,e,i);if(U(e))return t.Seq?.(n,e,i);if(O(e))return t.Pair?.(n,e,i);if(C(e))return t.Scalar?.(n,e,i);if(K(e))return t.Alias?.(n,e,i)}function Pn(n,e,t){let i=e[e.length-1];if(T(i))i.items[n]=t;else if(O(i))n==="key"?i.key=t:i.value=t;else if(q(i))i.contents=t;else{let s=K(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}var Ri={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ji=n=>n.replace(/[!,[\]{}]/g,e=>Ri[e]),ee=class n{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},n.defaultYaml,e),this.tags=Object.assign({},n.defaultTags,t)}clone(){let e=new n(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new n(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:n.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},n.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:n.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},n.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),s=i.shift();switch(s){case"%TAG":{if(i.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,o]=i;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${s}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,i,s]=e.match(/^(.*!)([^!]*)$/s);s||t(`The ${e} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(s)}catch(o){return t(String(o)),null}return i==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,i]of Object.entries(this.tags))if(e.startsWith(i))return t+ji(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),s;if(e&&i.length>0&&E(e.contents)){let r={};Y(e.contents,(o,a)=>{E(a)&&a.tag&&(r[a.tag]=!0)}),s=Object.keys(r)}else s=[];for(let[r,o]of i)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||s.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
2
|
+
`)}};ee.defaultYaml={explicit:!1,version:"1.2"};ee.defaultTags={"!!":"tag:yaml.org,2002:"};function ct(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Qt(n){let e=new Set;return Y(n,{Value(t,i){i.anchor&&e.add(i.anchor)}}),e}function Ht(n,e){for(let t=1;;++t){let i=`${n}${t}`;if(!e.has(i))return i}}function _n(n,e){let t=[],i=new Map,s=null;return{onAnchor:r=>{t.push(r),s??(s=Qt(n));let o=Ht(e,s);return s.add(o),o},setAnchors:()=>{for(let r of t){let o=i.get(r);if(typeof o=="object"&&o.anchor&&(C(o.node)||T(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:i}}function ue(n,e,t,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let s=0,r=i.length;s<r;++s){let o=i[s],a=ue(n,i,String(s),o);a===void 0?delete i[s]:a!==o&&(i[s]=a)}else if(i instanceof Map)for(let s of Array.from(i.keys())){let r=i.get(s),o=ue(n,i,s,r);o===void 0?i.delete(s):o!==r&&i.set(s,o)}else if(i instanceof Set)for(let s of Array.from(i)){let r=ue(n,i,s,s);r===void 0?i.delete(s):r!==s&&(i.delete(s),i.add(r))}else for(let[s,r]of Object.entries(i)){let o=ue(n,i,s,r);o===void 0?delete i[s]:o!==r&&(i[s]=o)}return n.call(e,t,i)}function x(n,e,t){if(Array.isArray(n))return n.map((i,s)=>x(i,String(s),t));if(n&&typeof n.toJSON=="function"){if(!t||!lt(n))return n.toJSON(e,t);let i={aliasCount:0,count:1,res:void 0};t.anchors.set(n,i),t.onCreate=r=>{i.res=r,delete t.onCreate};let s=n.toJSON(e,t);return t.onCreate&&t.onCreate(s),s}return typeof n=="bigint"&&!t?.keep?Number(n):n}var me=class{constructor(e){Object.defineProperty(this,D,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:i,onAnchor:s,reviver:r}={}){if(!q(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=x(this,"",o);if(typeof s=="function")for(let{count:l,res:c}of o.anchors.values())s(c,l);return typeof r=="function"?ue(r,{"":a},"",a):a}};var te=class extends me{constructor(e){super(ot),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],Y(e,{Node:(r,o)=>{(K(o)||lt(o))&&i.push(o)}}),t&&(t.aliasResolveCache=i));let s;for(let r of i){if(r===this)break;r.anchor===this.source&&(s=r)}return s}toJSON(e,t){if(!t)return{source:this.source};let{anchors:i,doc:s,maxAliasCount:r}=t,o=this.resolve(s,t);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=i.get(o);if(a||(x(o,null,t),a=i.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ft(s,o,i)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,i){let s=`*${this.source}`;if(e){if(ct(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${s} `}return s}};function ft(n,e,t){if(K(e)){let i=e.resolve(n),s=t&&i&&t.get(i);return s?s.count*s.aliasCount:0}else if(T(e)){let i=0;for(let s of e.items){let r=ft(n,s,t);r>i&&(i=r)}return i}else if(O(e)){let i=ft(n,e.key,t),s=ft(n,e.value,t);return Math.max(i,s)}return 1}var ut=n=>!n||typeof n!="function"&&typeof n!="object",y=class extends me{constructor(e){super(R),this.value=e}toJSON(e,t){return t?.keep?this.value:x(this.value,e,t)}toString(){return String(this.value)}};y.BLOCK_FOLDED="BLOCK_FOLDED";y.BLOCK_LITERAL="BLOCK_LITERAL";y.PLAIN="PLAIN";y.QUOTE_DOUBLE="QUOTE_DOUBLE";y.QUOTE_SINGLE="QUOTE_SINGLE";var Ki="tag:yaml.org,2002:";function qi(n,e,t){if(e){let i=t.filter(r=>r.tag===e),s=i.find(r=>!r.format)??i[0];if(!s)throw new Error(`Tag ${e} not found`);return s}return t.find(i=>i.identify?.(n)&&!i.format)}function ae(n,e,t){if(q(n)&&(n=n.contents),E(n))return n;if(O(n)){let f=t.schema[J].createNode?.(t.schema,null,t);return f.items.push(n),f}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());let{aliasDuplicateObjects:i,onAnchor:s,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(i&&n&&typeof n=="object"){if(l=a.get(n),l)return l.anchor??(l.anchor=s(n)),new te(l.anchor);l={anchor:null,node:null},a.set(n,l)}e?.startsWith("!!")&&(e=Ki+e.slice(2));let c=qi(n,e,o.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let f=new y(n);return l&&(l.node=f),f}c=n instanceof Map?o[J]:Symbol.iterator in Object(n)?o[oe]:o[J]}r&&(r(c),delete t.onTagObj);let d=c?.createNode?c.createNode(t.schema,n,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,n,t):new y(n);return e?d.tag=e:c.default||(d.tag=c.tag),l&&(l.node=d),d}function Ve(n,e,t){let i=t;for(let s=e.length-1;s>=0;--s){let r=e[s];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=i,i=o}else i=new Map([[r,i]])}return ae(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}var Ee=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,Oe=class extends me{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(i=>E(i)||O(i)?i.clone(e):i),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ee(e))this.add(t);else{let[i,...s]=e,r=this.get(i,!0);if(T(r))r.addIn(s,t);else if(r===void 0&&this.schema)this.set(i,Ve(this.schema,s,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${s}`)}}deleteIn(e){let[t,...i]=e;if(i.length===0)return this.delete(t);let s=this.get(t,!0);if(T(s))return s.deleteIn(i);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${i}`)}getIn(e,t){let[i,...s]=e,r=this.get(i,!0);return s.length===0?!t&&C(r)?r.value:r:T(r)?r.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!O(t))return!1;let i=t.value;return i==null||e&&C(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[t,...i]=e;if(i.length===0)return this.has(t);let s=this.get(t,!0);return T(s)?s.hasIn(i):!1}setIn(e,t){let[i,...s]=e;if(s.length===0)this.set(i,t);else{let r=this.get(i,!0);if(T(r))r.setIn(s,t);else if(r===void 0&&this.schema)this.set(i,Ve(this.schema,s,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${s}`)}}};var Dn=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function W(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var ne=(n,e,t)=>n.endsWith(`
|
|
3
|
+
`)?W(t,e):t.includes(`
|
|
4
|
+
`)?`
|
|
5
|
+
`+W(t,e):(n.endsWith(" ")?"":" ")+t;var Xt="flow",mt="block",Ue="quoted";function We(n,e,t="flow",{indentAtStart:i,lineWidth:s=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!s||s<0)return n;s<r&&(r=0);let l=Math.max(1+r,1+s-e.length);if(n.length<=l)return n;let c=[],d={},f=s-e.length;typeof i=="number"&&(i>s-Math.max(2,r)?c.push(0):f=s-i);let u,p,g=!1,m=-1,h=-1,w=-1;t===mt&&(m=Bn(n,m,e.length),m!==-1&&(f=m+l));for(let k;k=n[m+=1];){if(t===Ue&&k==="\\"){switch(h=m,n[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}w=m}if(k===`
|
|
6
|
+
`)t===mt&&(m=Bn(n,m,e.length)),f=m+e.length+l,u=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
|
|
7
|
+
`&&p!==" "){let M=n[m+1];M&&M!==" "&&M!==`
|
|
8
|
+
`&&M!==" "&&(u=m)}if(m>=f)if(u)c.push(u),f=u+l,u=void 0;else if(t===Ue){for(;p===" "||p===" ";)p=k,k=n[m+=1],g=!0;let M=m>w+1?m-2:h-1;if(d[M])return n;c.push(M),d[M]=!0,f=M+l,u=void 0}else g=!0}p=k}if(g&&a&&a(),c.length===0)return n;o&&o();let S=n.slice(0,c[0]);for(let k=0;k<c.length;++k){let M=c[k],N=c[k+1]||n.length;M===0?S=`
|
|
9
|
+
${e}${n.slice(0,N)}`:(t===Ue&&d[M]&&(S+=`${n[M]}\\`),S+=`
|
|
10
|
+
${e}${n.slice(M+1,N)}`)}return S}function Bn(n,e,t){let i=e,s=e+1,r=n[s];for(;r===" "||r===" ";)if(e<s+t)r=n[++e];else{do r=n[++e];while(r&&r!==`
|
|
11
|
+
`);i=e,s=e+1,r=n[s]}return i}var ht=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),pt=n=>/^(%|---|\.\.\.)/m.test(n);function Vi(n,e,t){if(!e||e<0)return!1;let i=e-t,s=n.length;if(s<=i)return!1;for(let r=0,o=0;r<s;++r)if(n[r]===`
|
|
12
|
+
`){if(r-o>i)return!0;if(o=r+1,s-o<=i)return!1}return!0}function Je(n,e){let t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:i}=e,s=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(pt(n)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let d=t.substr(l+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(i||t[l+2]==='"'||t.length<s)l+=1;else{for(o+=t.slice(a,l)+`
|
|
13
|
+
|
|
14
|
+
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
|
|
15
|
+
`,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,i?o:We(o,r,Ue,ht(e,!1))}function Zt(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
|
|
16
|
+
`)||/[ \t]\n|\n[ \t]/.test(n))return Je(n,e);let t=e.indent||(pt(n)?" ":""),i="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
+
${t}`)+"'";return e.implicitKey?i:We(i,t,Xt,ht(e,!1))}function Te(n,e){let{singleQuote:t}=e.options,i;if(t===!1)i=Je;else{let s=n.includes('"'),r=n.includes("'");s&&!r?i=Zt:r&&!s?i=Je:i=t?Zt:Je}return i(n,e)}var en;try{en=new RegExp(`(^|(?<!
|
|
18
|
+
))
|
|
19
|
+
+(?!
|
|
20
|
+
|$)`,"g")}catch{en=/\n+(?!\n|$)/g}function dt({comment:n,type:e,value:t},i,s,r){let{blockQuote:o,commentString:a,lineWidth:l}=i.options;if(!o||/\n[\t ]+$/.test(t))return Te(t,i);let c=i.indent||(i.forceBlockIndent||pt(t)?" ":""),d=o==="literal"?!0:o==="folded"||e===y.BLOCK_FOLDED?!1:e===y.BLOCK_LITERAL?!0:!Vi(t,l,c.length);if(!t)return d?`|
|
|
21
|
+
`:`>
|
|
22
|
+
`;let f,u;for(u=t.length;u>0;--u){let N=t[u-1];if(N!==`
|
|
23
|
+
`&&N!==" "&&N!==" ")break}let p=t.substring(u),g=p.indexOf(`
|
|
24
|
+
`);g===-1?f="-":t===p||g!==p.length-1?(f="+",r&&r()):f="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
|
|
25
|
+
`&&(p=p.slice(0,-1)),p=p.replace(en,`$&${c}`));let m=!1,h,w=-1;for(h=0;h<t.length;++h){let N=t[h];if(N===" ")m=!0;else if(N===`
|
|
26
|
+
`)w=h;else break}let S=t.substring(0,w<h?w+1:h);S&&(t=t.substring(S.length),S=S.replace(/\n+/g,`$&${c}`));let M=(m?c?"2":"1":"")+f;if(n&&(M+=" "+a(n.replace(/ ?[\r\n]+/g," ")),s&&s()),!d){let N=t.replace(/\n+/g,`
|
|
27
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),A=!1,L=ht(i,!0);o!=="folded"&&e!==y.BLOCK_FOLDED&&(L.onOverflow=()=>{A=!0});let b=We(`${S}${N}${p}`,c,mt,L);if(!A)return`>${M}
|
|
28
|
+
${c}${b}`}return t=t.replace(/\n+/g,`$&${c}`),`|${M}
|
|
29
|
+
${c}${S}${t}${p}`}function Ui(n,e,t,i){let{type:s,value:r}=n,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:d}=e;if(a&&r.includes(`
|
|
30
|
+
`)||d&&/[[\]{},]/.test(r))return Te(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||d||!r.includes(`
|
|
31
|
+
`)?Te(r,e):dt(n,e,t,i);if(!a&&!d&&s!==y.PLAIN&&r.includes(`
|
|
32
|
+
`))return dt(n,e,t,i);if(pt(r)){if(l==="")return e.forceBlockIndent=!0,dt(n,e,t,i);if(a&&l===c)return Te(r,e)}let f=r.replace(/\n+/g,`$&
|
|
33
|
+
${l}`);if(o){let u=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:g}=e.doc.schema;if(g.some(u)||p?.some(u))return Te(r,e)}return a?f:We(f,l,Xt,ht(e,!1))}function le(n,e,t,i){let{implicitKey:s,inFlow:r}=e,o=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)}),{type:a}=n;a!==y.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=y.QUOTE_DOUBLE);let l=d=>{switch(d){case y.BLOCK_FOLDED:case y.BLOCK_LITERAL:return s||r?Te(o.value,e):dt(o,e,t,i);case y.QUOTE_DOUBLE:return Je(o.value,e);case y.QUOTE_SINGLE:return Zt(o.value,e);case y.PLAIN:return Ui(o,e,t,i);default:return null}},c=l(a);if(c===null){let{defaultKeyType:d,defaultStringType:f}=e.options,u=s&&d||f;if(c=l(u),c===null)throw new Error(`Unsupported default string type ${u}`)}return c}function gt(n,e){let t=Object.assign({blockQuote:!0,commentString:Dn,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},n.schema.toStringOptions,e),i;switch(t.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:i,options:t}}function Wi(n,e){if(e.tag){let s=n.filter(r=>r.tag===e.tag);if(s.length>0)return s.find(r=>r.format===e.format)??s[0]}let t,i;if(C(e)){i=e.value;let s=n.filter(r=>r.identify?.(i));if(s.length>1){let r=s.filter(o=>o.test);r.length>0&&(s=r)}t=s.find(r=>r.format===e.format)??s.find(r=>!r.format)}else i=e,t=n.find(s=>s.nodeClass&&i instanceof s.nodeClass);if(!t){let s=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${s} value`)}return t}function Ji(n,e,{anchors:t,doc:i}){if(!i.directives)return"";let s=[],r=(C(n)||T(n))&&n.anchor;r&&ct(r)&&(t.add(r),s.push(`&${r}`));let o=n.tag??(e.default?null:e.tag);return o&&s.push(i.directives.tagString(o)),s.join(" ")}function ce(n,e,t,i){if(O(n))return n.toString(e,t,i);if(K(n)){if(e.doc.directives)return n.toString(e);if(e.resolvedAliases?.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let s,r=E(n)?n:e.doc.createNode(n,{onTagObj:l=>s=l});s??(s=Wi(e.doc.schema.tags,r));let o=Ji(r,s,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof s.stringify=="function"?s.stringify(r,e,t,i):C(r)?le(r,e,t,i):r.toString(e,t,i);return o?C(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
34
|
+
${e.indent}${a}`:a}function Rn({key:n,value:e},t,i,s){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:d,simpleKeys:f}}=t,u=E(n)&&n.comment||null;if(f){if(u)throw new Error("With simple keys, key nodes cannot have comments");if(T(n)||!E(n)&&typeof n=="object"){let L="With simple keys, collection cannot be used as a key value";throw new Error(L)}}let p=!f&&(!n||u&&e==null&&!t.inFlow||T(n)||(C(n)?n.type===y.BLOCK_FOLDED||n.type===y.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:a+l});let g=!1,m=!1,h=ce(n,t,()=>g=!0,()=>m=!0);if(!p&&!t.inFlow&&h.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 g&&i&&i(),h===""?"?":p?`? ${h}`:h}else if(r&&!f||e==null&&p)return h=`? ${h}`,u&&!g?h+=ne(h,t.indent,c(u)):m&&s&&s(),h;g&&(u=null),p?(u&&(h+=ne(h,t.indent,c(u))),h=`? ${h}
|
|
35
|
+
${a}:`):(h=`${h}:`,u&&(h+=ne(h,t.indent,c(u))));let w,S,k;E(e)?(w=!!e.spaceBefore,S=e.commentBefore,k=e.comment):(w=!1,S=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!u&&C(e)&&(t.indentAtStart=h.length+1),m=!1,!d&&l.length>=2&&!t.inFlow&&!p&&U(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let M=!1,N=ce(e,t,()=>M=!0,()=>m=!0),A=" ";if(u||w||S){if(A=w?`
|
|
36
|
+
`:"",S){let L=c(S);A+=`
|
|
37
|
+
${W(L,t.indent)}`}N===""&&!t.inFlow?A===`
|
|
38
|
+
`&&k&&(A=`
|
|
39
|
+
|
|
40
|
+
`):A+=`
|
|
41
|
+
${t.indent}`}else if(!p&&T(e)){let L=N[0],b=N.indexOf(`
|
|
42
|
+
`),v=b!==-1,fe=t.inFlow??e.flow??e.items.length===0;if(v||!fe){let Me=!1;if(v&&(L==="&"||L==="!")){let $=N.indexOf(" ");L==="&"&&$!==-1&&$<b&&N[$+1]==="!"&&($=N.indexOf(" ",$+1)),($===-1||b<$)&&(Me=!0)}Me||(A=`
|
|
43
|
+
${t.indent}`)}}else(N===""||N[0]===`
|
|
44
|
+
`)&&(A="");return h+=A+N,t.inFlow?M&&i&&i():k&&!M?h+=ne(h,t.indent,c(k)):m&&s&&s(),h}function yt(n,e){(n==="debug"||n==="warn")&&console.warn(e)}var bt="<<",z={identify:n=>n===bt||typeof n=="symbol"&&n.description===bt,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new y(Symbol(bt)),{addToJSMap:nn}),stringify:()=>bt},jn=(n,e)=>(z.identify(e)||C(e)&&(!e.type||e.type===y.PLAIN)&&z.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===z.tag&&t.default);function nn(n,e,t){let i=Kn(n,t);if(U(i))for(let s of i.items)tn(n,e,s);else if(Array.isArray(i))for(let s of i)tn(n,e,s);else tn(n,e,i)}function tn(n,e,t){let i=Kn(n,t);if(!V(i))throw new Error("Merge sources must be maps or map aliases");let s=i.toJSON(null,n,Map);for(let[r,o]of s)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 Kn(n,e){return n&&K(e)?e.resolve(n.doc,n):e}function wt(n,e,{key:t,value:i}){if(E(t)&&t.addToJSMap)t.addToJSMap(n,e,i);else if(jn(n,t))nn(n,e,i);else{let s=x(t,"",n);if(e instanceof Map)e.set(s,x(i,s,n));else if(e instanceof Set)e.add(s);else{let r=Yi(t,s,n),o=x(i,r,n);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Yi(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(E(n)&&t?.doc){let i=gt(t.doc,{});i.anchors=new Set;for(let r of t.anchors.keys())i.anchors.add(r.anchor);i.inFlow=!0,i.inStringifyKey=!0;let s=n.toString(i);if(!t.mapKeyWarned){let r=JSON.stringify(s);r.length>40&&(r=r.substring(0,36)+'..."'),yt(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 s}return JSON.stringify(e)}function Le(n,e,t){let i=ae(n,void 0,t),s=ae(e,void 0,t);return new I(i,s)}var I=class n{constructor(e,t=null){Object.defineProperty(this,D,{value:Gt}),this.key=e,this.value=t}clone(e){let{key:t,value:i}=this;return E(t)&&(t=t.clone(e)),E(i)&&(i=i.clone(e)),new n(t,i)}toJSON(e,t){let i=t?.mapAsMap?new Map:{};return wt(t,i,this)}toString(e,t,i){return e?.doc?Rn(this,e,t,i):JSON.stringify(this)}};function kt(n,e,t){return(e.inFlow??n.flow?Gi:zi)(n,e,t)}function zi({comment:n,items:e},t,{blockItemPrefix:i,flowChars:s,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,d=Object.assign({},t,{indent:r,type:null}),f=!1,u=[];for(let g=0;g<e.length;++g){let m=e[g],h=null;if(E(m))!f&&m.spaceBefore&&u.push(""),St(t,u,m.commentBefore,f),m.comment&&(h=m.comment);else if(O(m)){let S=E(m.key)?m.key:null;S&&(!f&&S.spaceBefore&&u.push(""),St(t,u,S.commentBefore,f))}f=!1;let w=ce(m,d,()=>h=null,()=>f=!0);h&&(w+=ne(w,r,c(h))),f&&h&&(f=!1),u.push(i+w)}let p;if(u.length===0)p=s.start+s.end;else{p=u[0];for(let g=1;g<u.length;++g){let m=u[g];p+=m?`
|
|
45
|
+
${l}${m}`:`
|
|
46
|
+
`}}return n?(p+=`
|
|
47
|
+
`+W(c(n),l),a&&a()):f&&o&&o(),p}function Gi({items:n},e,{flowChars:t,itemIndent:i}){let{indent:s,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;i+=r;let l=Object.assign({},e,{indent:i,inFlow:!0,type:null}),c=!1,d=0,f=[];for(let g=0;g<n.length;++g){let m=n[g],h=null;if(E(m))m.spaceBefore&&f.push(""),St(e,f,m.commentBefore,!1),m.comment&&(h=m.comment);else if(O(m)){let S=E(m.key)?m.key:null;S&&(S.spaceBefore&&f.push(""),St(e,f,S.commentBefore,!1),S.comment&&(c=!0));let k=E(m.value)?m.value:null;k?(k.comment&&(h=k.comment),k.commentBefore&&(c=!0)):m.value==null&&S?.comment&&(h=S.comment)}h&&(c=!0);let w=ce(m,l,()=>h=null);c||(c=f.length>d||w.includes(`
|
|
48
|
+
`)),g<n.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((S,k)=>S+k.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),h&&(w+=ne(w,i,a(h))),f.push(w),d=f.length}let{start:u,end:p}=t;if(f.length===0)return u+p;if(!c){let g=f.reduce((m,h)=>m+h.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=u;for(let m of f)g+=m?`
|
|
49
|
+
${r}${s}${m}`:`
|
|
50
|
+
`;return`${g}
|
|
51
|
+
${s}${p}`}else return`${u}${o}${f.join(" ")}${o}${p}`}function St({indent:n,options:{commentString:e}},t,i,s){if(i&&s&&(i=i.replace(/^\n+/,"")),i){let r=W(e(i),n);t.push(r.trimStart())}}function de(n,e){let t=C(e)?e.value:e;for(let i of n)if(O(i)&&(i.key===e||i.key===t||C(i.key)&&i.key.value===t))return i}var F=class extends Oe{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(J,e),this.items=[]}static from(e,t,i){let{keepUndefined:s,replacer:r}=i,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(t,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||s)&&o.items.push(Le(l,c,i))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let i;O(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new I(e,e?.value):i=new I(e.key,e.value);let s=de(this.items,i.key),r=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${i.key} already set`);C(s.value)&&ut(i.value)?s.value.value=i.value:s.value=i.value}else if(r){let o=this.items.findIndex(a=>r(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let t=de(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let s=de(this.items,e)?.value;return(!t&&C(s)?s.value:s)??void 0}has(e){return!!de(this.items,e)}set(e,t){this.add(new I(e,t),!0)}toJSON(e,t,i){let s=i?new i:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(s);for(let r of this.items)wt(t,s,r);return s}toString(e,t,i){if(!e)return JSON.stringify(this);for(let s of this.items)if(!O(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),kt(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:t})}};var G={collection:"map",default:!0,nodeClass:F,tag:"tag:yaml.org,2002:map",resolve(n,e){return V(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>F.from(n,e,t)};var P=class extends Oe{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(oe,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Mt(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let i=Mt(e);if(typeof i!="number")return;let s=this.items[i];return!t&&C(s)?s.value:s}has(e){let t=Mt(e);return typeof t=="number"&&t<this.items.length}set(e,t){let i=Mt(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[i];C(s)&&ut(t)?s.value=t:this.items[i]=t}toJSON(e,t){let i=[];t?.onCreate&&t.onCreate(i);let s=0;for(let r of this.items)i.push(x(r,String(s++),t));return i}toString(e,t,i){return e?kt(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:t}):JSON.stringify(this)}static from(e,t,i){let{replacer:s}=i,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof s=="function"){let l=t instanceof Set?a:String(o++);a=s.call(t,l,a)}r.items.push(ae(a,void 0,i))}}return r}};function Mt(n){let e=C(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Q={collection:"seq",default:!0,nodeClass:P,tag:"tag:yaml.org,2002:seq",resolve(n,e){return U(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>P.from(n,e,t)};var he={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,i){return e=Object.assign({actualString:!0},e),le(n,e,t,i)}};var be={identify:n=>n==null,createNode:()=>new y(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new y(null),stringify:({source:n},e)=>typeof n=="string"&&be.test.test(n)?n:e.options.nullStr};var Ye={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new y(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&Ye.test.test(n)){let i=n[0]==="t"||n[0]==="T";if(e===i)return n}return e?t.options.trueStr:t.options.falseStr}};function _({format:n,minFractionDigits:e,tag:t,value:i}){if(typeof i=="bigint")return String(i);let s=typeof i=="number"?i:Number(i);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let r=Object.is(i,-0)?"-0":JSON.stringify(i);if(!n&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}var Nt={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_},At={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():_(n)}},Ct={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){let e=new y(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:_};var Ot=n=>typeof n=="bigint"||Number.isInteger(n),sn=(n,e,t,{intAsBigInt:i})=>i?BigInt(n):parseInt(n.substring(e),t);function qn(n,e,t){let{value:i}=n;return Ot(i)&&i>=0?t+i.toString(e):_(n)}var Et={identify:n=>Ot(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>sn(n,2,8,t),stringify:n=>qn(n,8,"0o")},Tt={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>sn(n,0,10,t),stringify:_},Lt={identify:n=>Ot(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>sn(n,2,16,t),stringify:n=>qn(n,16,"0x")};var Vn=[G,Q,he,be,Ye,Et,Tt,Lt,Nt,At,Ct];function Un(n){return typeof n=="bigint"||Number.isInteger(n)}var It=({value:n})=>JSON.stringify(n),Qi=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:It},{identify:n=>n==null,createNode:()=>new y(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:It},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:It},{identify:Un,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>Un(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:It}],Hi={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},Wn=[G,Q].concat(Qi,Hi);var ze={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof atob=="function"){let t=atob(n.replace(/[\n\r]/g,"")),i=new Uint8Array(t.length);for(let s=0;s<t.length;++s)i[s]=t.charCodeAt(s);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},i,s,r){if(!t)return"";let o=t,a;if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=y.BLOCK_LITERAL),e!==y.QUOTE_DOUBLE){let l=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),c=Math.ceil(a.length/l),d=new Array(c);for(let f=0,u=0;f<c;++f,u+=l)d[f]=a.substr(u,l);a=d.join(e===y.BLOCK_LITERAL?`
|
|
52
|
+
`:" ")}return le({comment:n,type:e,value:a},i,s,r)}};function rn(n,e){if(U(n))for(let t=0;t<n.items.length;++t){let i=n.items[t];if(!O(i)){if(V(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let s=i.items[0]||new I(new y(null));if(i.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${i.commentBefore}
|
|
53
|
+
${s.key.commentBefore}`:i.commentBefore),i.comment){let r=s.value??s.key;r.comment=r.comment?`${i.comment}
|
|
54
|
+
${r.comment}`:i.comment}i=s}n.items[t]=O(i)?i:new I(i)}}else e("Expected a sequence for this tag");return n}function on(n,e,t){let{replacer:i}=t,s=new P(n);s.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;s.items.push(Le(a,l,t))}return s}var Ge={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:rn,createNode:on};var Ie=class n extends P{constructor(){super(),this.add=F.prototype.add.bind(this),this.delete=F.prototype.delete.bind(this),this.get=F.prototype.get.bind(this),this.has=F.prototype.has.bind(this),this.set=F.prototype.set.bind(this),this.tag=n.tag}toJSON(e,t){if(!t)return super.toJSON(e);let i=new Map;t?.onCreate&&t.onCreate(i);for(let s of this.items){let r,o;if(O(s)?(r=x(s.key,"",t),o=x(s.value,r,t)):r=x(s,"",t),i.has(r))throw new Error("Ordered maps must not include duplicate keys");i.set(r,o)}return i}static from(e,t,i){let s=on(e,t,i),r=new this;return r.items=s.items,r}};Ie.tag="tag:yaml.org,2002:omap";var Qe={collection:"seq",identify:n=>n instanceof Map,nodeClass:Ie,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=rn(n,e),i=[];for(let{key:s}of t.items)C(s)&&(i.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):i.push(s.value));return Object.assign(new Ie,t)},createNode:(n,e,t)=>Ie.from(n,e,t)};function Jn({value:n,source:e},t){return e&&(n?an:ln).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var an={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new y(!0),stringify:Jn},ln={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new y(!1),stringify:Jn};var Yn={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_},zn={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():_(n)}},Gn={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){let e=new y(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){let i=n.substring(t+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:_};var He=n=>typeof n=="bigint"||Number.isInteger(n);function Ft(n,e,t,{intAsBigInt:i}){let s=n[0];if((s==="-"||s==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),i){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}let o=BigInt(n);return s==="-"?BigInt(-1)*o:o}let r=parseInt(n,t);return s==="-"?-1*r:r}function cn(n,e,t){let{value:i}=n;if(He(i)){let s=i.toString(e);return i<0?"-"+t+s.substr(1):t+s}return _(n)}var Qn={identify:He,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>Ft(n,2,2,t),stringify:n=>cn(n,2,"0b")},Hn={identify:He,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>Ft(n,1,8,t),stringify:n=>cn(n,8,"0")},Xn={identify:He,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>Ft(n,0,10,t),stringify:_},Zn={identify:He,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>Ft(n,2,16,t),stringify:n=>cn(n,16,"0x")};var Fe=class n extends F{constructor(e){super(e),this.tag=n.tag}add(e){let t;O(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new I(e.key,null):t=new I(e,null),de(this.items,t.key)||this.items.push(t)}get(e,t){let i=de(this.items,e);return!t&&O(i)?C(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=de(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new I(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,i);throw new Error("Set items must all have null values")}static from(e,t,i){let{replacer:s}=i,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof s=="function"&&(o=s.call(t,o,o)),r.items.push(Le(o,null,i));return r}};Fe.tag="tag:yaml.org,2002:set";var Xe={collection:"map",identify:n=>n instanceof Set,nodeClass:Fe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>Fe.from(n,e,t),resolve(n,e){if(V(n)){if(n.hasAllNullValues(!0))return Object.assign(new Fe,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};function fn(n,e){let t=n[0],i=t==="-"||t==="+"?n.substring(1):n,s=o=>e?BigInt(o):Number(o),r=i.replace(/_/g,"").split(":").reduce((o,a)=>o*s(60)+s(a),s(0));return t==="-"?s(-1)*r:r}function ei(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return _(n);let i="";e<0&&(i="-",e*=t(-1));let s=t(60),r=[e%s];return e<60?r.unshift(0):(e=(e-r[0])/s,r.unshift(e%s),e>=60&&(e=(e-r[0])/s,r.unshift(e))),i+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var vt={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>fn(n,t),stringify:ei},$t={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>fn(n,!1),stringify:ei},ve={identify:n=>n instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(n){let e=n.match(ve.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,i,s,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,i-1,s,r||0,o||0,a||0,l),d=e[8];if(d&&d!=="Z"){let f=fn(d,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var un=[G,Q,he,be,an,ln,Qn,Hn,Xn,Zn,Yn,zn,Gn,ze,z,Qe,Ge,Xe,vt,$t,ve];var ti=new Map([["core",Vn],["failsafe",[G,Q,he]],["json",Wn],["yaml11",un],["yaml-1.1",un]]),ni={binary:ze,bool:Ye,float:Ct,floatExp:At,floatNaN:Nt,floatTime:$t,int:Tt,intHex:Lt,intOct:Et,intTime:vt,map:G,merge:z,null:be,omap:Qe,pairs:Ge,seq:Q,set:Xe,timestamp:ve},ii={"tag:yaml.org,2002:binary":ze,"tag:yaml.org,2002:merge":z,"tag:yaml.org,2002:omap":Qe,"tag:yaml.org,2002:pairs":Ge,"tag:yaml.org,2002:set":Xe,"tag:yaml.org,2002:timestamp":ve};function xt(n,e,t){let i=ti.get(e);if(i&&!n)return t&&!i.includes(z)?i.concat(z):i.slice();let s=i;if(!s)if(Array.isArray(n))s=[];else{let r=Array.from(ti.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(n))for(let r of n)s=s.concat(r);else typeof n=="function"&&(s=n(s.slice()));return t&&(s=s.concat(z)),s.reduce((r,o)=>{let a=typeof o=="string"?ni[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(ni).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}var Xi=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,$e=class n{constructor({compat:e,customTags:t,merge:i,resolveKnownTags:s,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?xt(e,"compat"):e?xt(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=s?ii:{},this.tags=xt(t,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,J,{value:G}),Object.defineProperty(this,R,{value:he}),Object.defineProperty(this,oe,{value:Q}),this.sortMapEntries=typeof o=="function"?o:o===!0?Xi:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function si(n,e){let t=[],i=e.directives===!0;if(e.directives!==!1&&n.directives){let l=n.directives.toString(n);l?(t.push(l),i=!0):n.directives.docStart&&(i=!0)}i&&t.push("---");let s=gt(n,e),{commentString:r}=s.options;if(n.commentBefore){t.length!==1&&t.unshift("");let l=r(n.commentBefore);t.unshift(W(l,""))}let o=!1,a=null;if(n.contents){if(E(n.contents)){if(n.contents.spaceBefore&&i&&t.push(""),n.contents.commentBefore){let d=r(n.contents.commentBefore);t.push(W(d,""))}s.forceBlockIndent=!!n.comment,a=n.contents.comment}let l=a?void 0:()=>o=!0,c=ce(n.contents,s,()=>a=null,l);a&&(c+=ne(c,"",r(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(ce(n.contents,s));if(n.directives?.docEnd)if(n.comment){let l=r(n.comment);l.includes(`
|
|
55
|
+
`)?(t.push("..."),t.push(W(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=n.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(W(r(l),"")))}return t.join(`
|
|
56
|
+
`)+`
|
|
57
|
+
`}var ie=class n{constructor(e,t,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,D,{value:at});let s=null;typeof t=="function"||Array.isArray(t)?s=t:i===void 0&&t&&(i=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=r;let{version:o}=r;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ee({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,s,i)}clone(){let e=Object.create(n.prototype,{[D]:{value:at}});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=E(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){xe(this.contents)&&this.contents.add(e)}addIn(e,t){xe(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let i=Qt(this);e.anchor=!t||i.has(t)?Ht(t||"a",i):t}return new te(e.anchor)}createNode(e,t,i){let s;if(typeof t=="function")e=t.call({"":e},"",e),s=t;else if(Array.isArray(t)){let h=S=>typeof S=="number"||S instanceof String||S instanceof Number,w=t.filter(h).map(String);w.length>0&&(t=t.concat(w)),s=t}else i===void 0&&t&&(i=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:d}=i??{},{onAnchor:f,setAnchors:u,sourceObjects:p}=_n(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:s,schema:this.schema,sourceObjects:p},m=ae(e,d,g);return a&&T(m)&&(m.flow=!0),u(),m}createPair(e,t,i={}){let s=this.createNode(e,null,i),r=this.createNode(t,null,i);return new I(s,r)}delete(e){return xe(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ee(e)?this.contents==null?!1:(this.contents=null,!0):xe(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return T(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ee(e)?!t&&C(this.contents)?this.contents.value:this.contents:T(this.contents)?this.contents.getIn(e,t):void 0}has(e){return T(this.contents)?this.contents.has(e):!1}hasIn(e){return Ee(e)?this.contents!==void 0:T(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ve(this.schema,[e],t):xe(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ee(e)?this.contents=t:this.contents==null?this.contents=Ve(this.schema,Array.from(e),t):xe(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ee({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ee({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let s=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(i)this.schema=new $e(Object.assign(i,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:i,maxAliasCount:s,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},l=x(this.contents,t??"",a);if(typeof r=="function")for(let{count:c,res:d}of a.anchors.values())r(d,c);return typeof o=="function"?ue(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return si(this,e)}};function xe(n){if(T(n))return!0;throw new Error("Expected a YAML collection as document contents")}var Pe=class extends Error{constructor(e,t,i,s){super(),this.name=e,this.code=i,this.message=s,this.pos=t}},j=class extends Pe{constructor(e,t,i){super("YAMLParseError",e,t,i)}},_e=class extends Pe{constructor(e,t,i){super("YAMLWarning",e,t,i)}},Ze=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:i,col:s}=t.linePos[0];t.message+=` at line ${i}, column ${s}`;let r=s-1,o=n.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(o.substring(0,r))){let a=n.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
58
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l?.line===i&&l.col>s&&(a=Math.max(1,Math.min(l.col-s,80-r)));let c=" ".repeat(r)+"^".repeat(a);t.message+=`:
|
|
59
|
+
|
|
60
|
+
${o}
|
|
61
|
+
${c}
|
|
62
|
+
`}};function se(n,{flow:e,indicator:t,next:i,offset:s,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,d=a,f="",u="",p=!1,g=!1,m=null,h=null,w=null,S=null,k=null,M=null,N=null;for(let b of n)switch(g&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&r(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),m&&(c&&b.type!=="comment"&&b.type!=="newline"&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),b.type){case"space":!e&&(t!=="doc-start"||i?.type!=="flow-collection")&&b.source.includes(" ")&&(m=b),d=!0;break;case"comment":{d||r(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let v=b.source.substring(1)||" ";f?f+=u+v:f=v,u="",c=!1;break}case"newline":c?f?f+=b.source:(!M||t!=="seq-item-ind")&&(l=!0):u+=b.source,c=!0,p=!0,(h||w)&&(S=b),d=!0;break;case"anchor":h&&r(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&r(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=b,N??(N=b.offset),c=!1,d=!1,g=!0;break;case"tag":{w&&r(b,"MULTIPLE_TAGS","A node can have at most one tag"),w=b,N??(N=b.offset),c=!1,d=!1,g=!0;break}case t:(h||w)&&r(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),M&&r(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),M=b,c=t==="seq-item-ind"||t==="explicit-key-ind",d=!1;break;case"comma":if(e){k&&r(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=b,c=!1,d=!1;break}default:r(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),c=!1,d=!1}let A=n[n.length-1],L=A?A.offset+A.source.length:s;return g&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:M,spaceBefore:l,comment:f,hasNewline:p,anchor:h,tag:w,newlineAfterProp:S,end:L,start:N??L}}function pe(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
|
|
63
|
+
`))return!0;if(n.end){for(let e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of n.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(pe(e.key)||pe(e.value))return!0}return!1;default:return!0}}function et(n,e,t){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===n&&(i.source==="]"||i.source==="}")&&pe(e)&&t(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Pt(n,e,t){let{uniqueKeys:i}=n.options;if(i===!1)return!1;let s=typeof i=="function"?i:(r,o)=>r===o||C(r)&&C(o)&&r.value===o.value;return e.some(r=>s(r.key,t))}var ri="All mapping items must start at the same column";function oi({composeNode:n,composeEmptyNode:e},t,i,s,r){let o=r?.nodeClass??F,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=i.offset,c=null;for(let d of i.items){let{start:f,key:u,sep:p,value:g}=d,m=se(f,{indicator:"explicit-key-ind",next:u??p?.[0],offset:l,onError:s,parentIndent:i.indent,startOnNewline:!0}),h=!m.found;if(h){if(u&&(u.type==="block-seq"?s(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==i.indent&&s(l,"BAD_INDENT",ri)),!m.anchor&&!m.tag&&!p){c=m.end,m.comment&&(a.comment?a.comment+=`
|
|
64
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||pe(u))&&s(u??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==i.indent&&s(l,"BAD_INDENT",ri);t.atKey=!0;let w=m.end,S=u?n(t,u,m,s):e(t,w,f,null,m,s);t.schema.compat&&et(i.indent,u,s),t.atKey=!1,Pt(t,a.items,S)&&s(w,"DUPLICATE_KEY","Map keys must be unique");let k=se(p??[],{indicator:"map-value-ind",next:g,offset:S.range[2],onError:s,parentIndent:i.indent,startOnNewline:!u||u.type==="block-scalar"});if(l=k.end,k.found){h&&(g?.type==="block-map"&&!k.hasNewline&&s(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&m.start<k.found.offset-1024&&s(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let M=g?n(t,g,k,s):e(t,l,p,null,k,s);t.schema.compat&&et(i.indent,g,s),l=M.range[2];let N=new I(S,M);t.options.keepSourceTokens&&(N.srcToken=d),a.items.push(N)}else{h&&s(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(S.comment?S.comment+=`
|
|
65
|
+
`+k.comment:S.comment=k.comment);let M=new I(S);t.options.keepSourceTokens&&(M.srcToken=d),a.items.push(M)}}return c&&c<l&&s(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,l,c??l],a}function ai({composeNode:n,composeEmptyNode:e},t,i,s,r){let o=r?.nodeClass??P,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=i.offset,c=null;for(let{start:d,value:f}of i.items){let u=se(d,{indicator:"seq-item-ind",next:f,offset:l,onError:s,parentIndent:i.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||f)f?.type==="block-seq"?s(u.end,"BAD_INDENT","All sequence items must start at the same column"):s(l,"MISSING_CHAR","Sequence item without - indicator");else{c=u.end,u.comment&&(a.comment=u.comment);continue}let p=f?n(t,f,u,s):e(t,u.end,d,null,u,s);t.schema.compat&&et(i.indent,f,s),l=p.range[2],a.items.push(p)}return a.range=[i.offset,l,c??l],a}function re(n,e,t,i){let s="";if(n){let r=!1,o="";for(let a of n){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";s?s+=o+d:s=d,o="";break}case"newline":s&&(o+=l),r=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:s,offset:e}}var mn="Block collections are not allowed within flow collections",dn=n=>n&&(n.type==="block-map"||n.type==="block-seq");function li({composeNode:n,composeEmptyNode:e},t,i,s,r){let o=i.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?F:P),c=new l(t.schema);c.flow=!0;let d=t.atRoot;d&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=i.offset+i.start.source.length;for(let h=0;h<i.items.length;++h){let w=i.items[h],{start:S,key:k,sep:M,value:N}=w,A=se(S,{flow:a,indicator:"explicit-key-ind",next:k??M?.[0],offset:f,onError:s,parentIndent:i.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!M&&!N){h===0&&A.comma?s(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<i.items.length-1&&s(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),A.comment&&(c.comment?c.comment+=`
|
|
66
|
+
`+A.comment:c.comment=A.comment),f=A.end;continue}!o&&t.options.strict&&pe(k)&&s(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)A.comma&&s(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(A.comma||s(A.start,"MISSING_CHAR",`Missing , between ${a} items`),A.comment){let L="";e:for(let b of S)switch(b.type){case"comma":case"space":break;case"comment":L=b.source.substring(1);break e;default:break e}if(L){let b=c.items[c.items.length-1];O(b)&&(b=b.value??b.key),b.comment?b.comment+=`
|
|
67
|
+
`+L:b.comment=L,A.comment=A.comment.substring(L.length+1)}}if(!o&&!M&&!A.found){let L=N?n(t,N,A,s):e(t,A.end,M,null,A,s);c.items.push(L),f=L.range[2],dn(N)&&s(L.range,"BLOCK_IN_FLOW",mn)}else{t.atKey=!0;let L=A.end,b=k?n(t,k,A,s):e(t,L,S,null,A,s);dn(k)&&s(b.range,"BLOCK_IN_FLOW",mn),t.atKey=!1;let v=se(M??[],{flow:a,indicator:"map-value-ind",next:N,offset:b.range[2],onError:s,parentIndent:i.indent,startOnNewline:!1});if(v.found){if(!o&&!A.found&&t.options.strict){if(M)for(let $ of M){if($===v.found)break;if($.type==="newline"){s($,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<v.found.offset-1024&&s(v.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else N&&("source"in N&&N.source?.[0]===":"?s(N,"MISSING_CHAR",`Missing space after : in ${a}`):s(v.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let fe=N?n(t,N,v,s):v.found?e(t,v.end,M,null,v,s):null;fe?dn(N)&&s(fe.range,"BLOCK_IN_FLOW",mn):v.comment&&(b.comment?b.comment+=`
|
|
68
|
+
`+v.comment:b.comment=v.comment);let Me=new I(b,fe);if(t.options.keepSourceTokens&&(Me.srcToken=w),o){let $=c;Pt(t,$.items,b)&&s(L,"DUPLICATE_KEY","Map keys must be unique"),$.items.push(Me)}else{let $=new F(t.schema);$.flow=!0,$.items.push(Me);let Tn=(fe??b).range;$.range=[b.range[0],Tn[1],Tn[2]],c.items.push($)}f=fe?fe.range[2]:v.end}}let u=o?"}":"]",[p,...g]=i.end,m=f;if(p?.source===u)m=p.offset+p.source.length;else{let h=a[0].toUpperCase()+a.substring(1),w=d?`${h} must end with a ${u}`:`${h} in block collection must be sufficiently indented and end with a ${u}`;s(f,d?"MISSING_CHAR":"BAD_INDENT",w),p&&p.source.length!==1&&g.unshift(p)}if(g.length>0){let h=re(g,m,t.options.strict,s);h.comment&&(c.comment?c.comment+=`
|
|
69
|
+
`+h.comment:c.comment=h.comment),c.range=[i.offset,m,h.offset]}else c.range=[i.offset,m,m];return c}function hn(n,e,t,i,s,r){let o=t.type==="block-map"?oi(n,e,t,i,r):t.type==="block-seq"?ai(n,e,t,i,r):li(n,e,t,i,r),a=o.constructor;return s==="!"||s===a.tagName?(o.tag=a.tagName,o):(s&&(o.tag=s),o)}function ci(n,e,t,i,s){let r=i.tag,o=r?e.directives.tagName(r.source,u=>s(r,"TAG_RESOLVE_FAILED",u)):null;if(t.type==="block-seq"){let{anchor:u,newlineAfterProp:p}=i,g=u&&r?u.offset>r.offset?u:r:u??r;g&&(!p||p.offset<g.offset)&&s(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===F.tagName&&a==="map"||o===P.tagName&&a==="seq")return hn(n,e,t,s,o);let l=e.schema.tags.find(u=>u.tag===o&&u.collection===a);if(!l){let u=e.schema.knownTags[o];if(u?.collection===a)e.schema.tags.push(Object.assign({},u,{default:!1})),l=u;else return u?s(r,"BAD_COLLECTION_TYPE",`${u.tag} used for ${a} collection, but expects ${u.collection??"scalar"}`,!0):s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),hn(n,e,t,s,o)}let c=hn(n,e,t,s,o,l),d=l.resolve?.(c,u=>s(r,"TAG_RESOLVE_FAILED",u),e.options)??c,f=E(d)?d:new y(d);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}function _t(n,e,t){let i=e.offset,s=Zi(e,n.options.strict,t);if(!s)return{value:"",type:null,comment:"",range:[i,i,i]};let r=s.mode===">"?y.BLOCK_FOLDED:y.BLOCK_LITERAL,o=e.source?es(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let h=o[m][1];if(h===""||h==="\r")a=m;else break}if(a===0){let m=s.chomp==="+"&&o.length>0?`
|
|
70
|
+
`.repeat(Math.max(1,o.length-1)):"",h=i+s.length;return e.source&&(h+=e.source.length),{value:m,type:r,comment:s.comment,range:[i,h,h]}}let l=e.indent+s.indent,c=e.offset+s.length,d=0;for(let m=0;m<a;++m){let[h,w]=o[m];if(w===""||w==="\r")s.indent===0&&h.length>l&&(l=h.length);else{h.length<l&&t(c+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(l=h.length),d=m,l===0&&!n.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=h.length+w.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>l&&(a=m+1);let f="",u="",p=!1;for(let m=0;m<d;++m)f+=o[m][0].slice(l)+`
|
|
71
|
+
`;for(let m=d;m<a;++m){let[h,w]=o[m];c+=h.length+w.length+1;let S=w[w.length-1]==="\r";if(S&&(w=w.slice(0,-1)),w&&h.length<l){let M=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;t(c-w.length-(S?2:1),"BAD_INDENT",M),h=""}r===y.BLOCK_LITERAL?(f+=u+h.slice(l)+w,u=`
|
|
72
|
+
`):h.length>l||w[0]===" "?(u===" "?u=`
|
|
73
|
+
`:!p&&u===`
|
|
74
|
+
`&&(u=`
|
|
75
|
+
|
|
76
|
+
`),f+=u+h.slice(l)+w,u=`
|
|
77
|
+
`,p=!0):w===""?u===`
|
|
78
|
+
`?f+=`
|
|
79
|
+
`:u=`
|
|
80
|
+
`:(f+=u+w,u=" ",p=!1)}switch(s.chomp){case"-":break;case"+":for(let m=a;m<o.length;++m)f+=`
|
|
81
|
+
`+o[m][0].slice(l);f[f.length-1]!==`
|
|
82
|
+
`&&(f+=`
|
|
83
|
+
`);break;default:f+=`
|
|
84
|
+
`}let g=i+s.length+e.source.length;return{value:f,type:r,comment:s.comment,range:[i,g,g]}}function Zi({offset:n,props:e},t,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=e[0],r=s[0],o=0,a="",l=-1;for(let u=1;u<s.length;++u){let p=s[u];if(!a&&(p==="-"||p==="+"))a=p;else{let g=Number(p);!o&&g?o=g:l===-1&&(l=n+u)}}l!==-1&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let c=!1,d="",f=s.length;for(let u=1;u<e.length;++u){let p=e[u];switch(p.type){case"space":c=!0;case"newline":f+=p.source.length;break;case"comment":t&&!c&&i(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,d=p.source.substring(1);break;case"error":i(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let g=`Unexpected token in block scalar header: ${p.type}`;i(p,"UNEXPECTED_TOKEN",g);let m=p.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:r,indent:o,chomp:a,comment:d,length:f}}function es(n){let e=n.split(/\n( *)/),t=e[0],i=t.match(/^( *)/),r=[i?.[1]?[i[1],t.slice(i[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function Dt(n,e,t){let{offset:i,type:s,source:r,end:o}=n,a,l,c=(u,p,g)=>t(i+u,p,g);switch(s){case"scalar":a=y.PLAIN,l=ts(r,c);break;case"single-quoted-scalar":a=y.QUOTE_SINGLE,l=ns(r,c);break;case"double-quoted-scalar":a=y.QUOTE_DOUBLE,l=is(r,c);break;default:return t(n,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}let d=i+r.length,f=re(o,d,e,t);return{value:l,type:a,comment:f.comment,range:[i,d,f.offset]}}function ts(n,e){let t="";switch(n[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),fi(n)}function ns(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),fi(n.slice(1,-1)).replace(/''/g,"'")}function fi(n){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
85
|
+
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
86
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(n);if(!i)return n;let s=i[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;i=t.exec(n);)i[1]===""?r===`
|
|
87
|
+
`?s+=r:r=`
|
|
88
|
+
`:(s+=r+i[1],r=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(n),s+r+(i?.[1]??"")}function is(n,e){let t="";for(let i=1;i<n.length-1;++i){let s=n[i];if(!(s==="\r"&&n[i+1]===`
|
|
89
|
+
`))if(s===`
|
|
90
|
+
`){let{fold:r,offset:o}=ss(n,i);t+=r,i=o}else if(s==="\\"){let r=n[++i],o=rs[r];if(o)t+=o;else if(r===`
|
|
91
|
+
`)for(r=n[i+1];r===" "||r===" ";)r=n[++i+1];else if(r==="\r"&&n[i+1]===`
|
|
92
|
+
`)for(r=n[++i+1];r===" "||r===" ";)r=n[++i+1];else if(r==="x"||r==="u"||r==="U"){let a=r==="x"?2:r==="u"?4:8;t+=os(n,i+1,a,e),i+=a}else{let a=n.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(s===" "||s===" "){let r=i,o=n[i+1];for(;o===" "||o===" ";)o=n[++i+1];o!==`
|
|
93
|
+
`&&!(o==="\r"&&n[i+2]===`
|
|
94
|
+
`)&&(t+=i>r?n.slice(r,i+1):s)}else t+=s}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function ss(n,e){let t="",i=n[e+1];for(;(i===" "||i===" "||i===`
|
|
95
|
+
`||i==="\r")&&!(i==="\r"&&n[e+2]!==`
|
|
96
|
+
`);)i===`
|
|
97
|
+
`&&(t+=`
|
|
98
|
+
`),e+=1,i=n[e+1];return t||(t=" "),{fold:t,offset:e}}var rs={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
99
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function os(n,e,t,i){let s=n.substr(e,t),o=s.length===t&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(o)}catch{let a=n.substr(e-2,t+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function pn(n,e,t,i){let{value:s,type:r,comment:o,range:a}=e.type==="block-scalar"?_t(n,e,i):Dt(e,n.options.strict,i),l=t?n.directives.tagName(t.source,f=>i(t,"TAG_RESOLVE_FAILED",f)):null,c;n.options.stringKeys&&n.atKey?c=n.schema[R]:l?c=as(n.schema,s,l,t,i):e.type==="scalar"?c=ls(n,s,e,i):c=n.schema[R];let d;try{let f=c.resolve(s,u=>i(t??e,"TAG_RESOLVE_FAILED",u),n.options);d=C(f)?f:new y(f)}catch(f){let u=f instanceof Error?f.message:String(f);i(t??e,"TAG_RESOLVE_FAILED",u),d=new y(s)}return d.range=a,d.source=s,r&&(d.type=r),l&&(d.tag=l),c.format&&(d.format=c.format),o&&(d.comment=o),d}function as(n,e,t,i,s){if(t==="!")return n[R];let r=[];for(let a of n.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=n.knownTags[t];return o&&!o.collection?(n.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[R])}function ls({atKey:n,directives:e,schema:t},i,s,r){let o=t.tags.find(a=>(a.default===!0||n&&a.default==="key")&&a.test?.test(i))||t[R];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(i))??t[R];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),d=`Value may be parsed as either ${l} or ${c}`;r(s,"TAG_RESOLVE_FAILED",d,!0)}}return o}function ui(n,e,t){if(e){t??(t=e.length);for(let i=t-1;i>=0;--i){let s=e[i];switch(s.type){case"space":case"comment":case"newline":n-=s.source.length;continue}for(s=e[++i];s?.type==="space";)n+=s.source.length,s=e[++i];break}}return n}var cs={composeNode:gn,composeEmptyNode:Bt};function gn(n,e,t,i){let s=n.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t,c,d=!0;switch(e.type){case"alias":c=fs(n,e,i),(a||l)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=pn(n,e,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=ci(cs,n,e,t,i),a&&(c.anchor=a.source.substring(1))}catch(f){let u=f instanceof Error?f.message:String(f);i(e,"RESOURCE_EXHAUSTION",u)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",f),d=!1}}return c??(c=Bt(n,e.offset,void 0,null,t,i)),a&&c.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&n.options.stringKeys&&(!C(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&i(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),n.options.keepSourceTokens&&d&&(c.srcToken=e),c}function Bt(n,e,t,i,{spaceBefore:s,comment:r,anchor:o,tag:a,end:l},c){let d={type:"scalar",offset:ui(e,t,i),indent:-1,source:""},f=pn(n,d,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=l),f}function fs({options:n},{offset:e,source:t,end:i},s){let r=new te(t.substring(1));r.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&s(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=re(i,o,n.strict,s);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}function mi(n,e,{offset:t,start:i,value:s,end:r},o){let a=Object.assign({_directives:e},n),l=new ie(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=se(i,{indicator:"doc-start",next:s??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=s?gn(c,s,d,o):Bt(c,d.end,i,null,d,o);let f=l.contents.range[2],u=re(r,f,!1,o);return u.comment&&(l.comment=u.comment),l.range=[t,f,u.offset],l}function tt(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];let{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function di(n){let e="",t=!1,i=!1;for(let s=0;s<n.length;++s){let r=n[s];switch(r[0]){case"#":e+=(e===""?"":i?`
|
|
100
|
+
|
|
101
|
+
`:`
|
|
102
|
+
`)+(r.substring(1)||" "),t=!0,i=!1;break;case"%":n[s+1]?.[0]!=="#"&&(s+=1),t=!1;break;default:t||(i=!0),t=!1}}return{comment:e,afterEmptyLine:i}}var we=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,i,s,r)=>{let o=tt(t);r?this.warnings.push(new _e(o,i,s)):this.errors.push(new j(o,i,s))},this.directives=new ee({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:i,afterEmptyLine:s}=di(this.prelude);if(i){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
103
|
+
${i}`:i;else if(s||e.directives.docStart||!r)e.commentBefore=i;else if(T(r)&&!r.flow&&r.items.length>0){let o=r.items[0];O(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
|
|
104
|
+
${a}`:i}else{let o=r.commentBefore;r.commentBefore=o?`${i}
|
|
105
|
+
${o}`:i}}if(t){for(let r=0;r<this.errors.length;++r)e.errors.push(this.errors[r]);for(let r=0;r<this.warnings.length;++r)e.warnings.push(this.warnings[r])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:di(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,i=-1){for(let s of e)yield*this.next(s);yield*this.end(t,i)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,i,s)=>{let r=tt(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",i,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=mi(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new j(tt(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new j(tt(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let t=re(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
|
|
106
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new j(tt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),s=new ie(void 0,i);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,t,t],this.decorate(s,!1),yield s}}};var Sn={};Ln(Sn,{BOM:()=>nt,DOCUMENT:()=>it,FLOW_END:()=>st,SCALAR:()=>De,createScalarToken:()=>pi,isCollection:()=>ds,isScalar:()=>hs,prettyToken:()=>ps,resolveAsScalar:()=>hi,setScalarValue:()=>gi,stringify:()=>bi,tokenType:()=>wn,visit:()=>ge});function hi(n,e=!0,t){if(n){let i=(s,r,o)=>{let a=typeof s=="number"?s:Array.isArray(s)?s[0]:s.offset;if(t)t(a,r,o);else throw new j([a,a+1],r,o)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Dt(n,e,i);case"block-scalar":return _t({options:{strict:e}},n,i)}}return null}function pi(n,e){let{implicitKey:t=!1,indent:i,inFlow:s=!1,offset:r=-1,type:o="PLAIN"}=e,a=le({type:o,value:n},{implicitKey:t,indent:i>0?" ".repeat(i):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:i,source:`
|
|
107
|
+
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
108
|
+
`),d=a.substring(0,c),f=a.substring(c+1)+`
|
|
109
|
+
`,u=[{type:"block-scalar-header",offset:r,indent:i,source:d}];return yi(u,l)||u.push({type:"newline",offset:-1,indent:i,source:`
|
|
110
|
+
`}),{type:"block-scalar",offset:r,indent:i,props:u,source:f}}case'"':return{type:"double-quoted-scalar",offset:r,indent:i,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:i,source:a,end:l};default:return{type:"scalar",offset:r,indent:i,source:a,end:l}}}function gi(n,e,t={}){let{afterKey:i=!1,implicitKey:s=!1,inFlow:r=!1,type:o}=t,a="indent"in n?n.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(n.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=n.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=le({type:o,value:e},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":us(n,l);break;case'"':yn(n,l,"double-quoted-scalar");break;case"'":yn(n,l,"single-quoted-scalar");break;default:yn(n,l,"scalar")}}function us(n,e){let t=e.indexOf(`
|
|
111
|
+
`),i=e.substring(0,t),s=e.substring(t+1)+`
|
|
112
|
+
`;if(n.type==="block-scalar"){let r=n.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=i,n.source=s}else{let{offset:r}=n,o="indent"in n?n.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:i}];yi(a,"end"in n?n.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
113
|
+
`});for(let l of Object.keys(n))l!=="type"&&l!=="offset"&&delete n[l];Object.assign(n,{type:"block-scalar",indent:o,props:a,source:s})}}function yi(n,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":n.push(t);break;case"newline":return n.push(t),!0}return!1}function yn(n,e,t){switch(n.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":n.type=t,n.source=e;break;case"block-scalar":{let i=n.props.slice(1),s=e.length;n.props[0].type==="block-scalar-header"&&(s-=n.props[0].source.length);for(let r of i)r.offset+=s;delete n.props,Object.assign(n,{type:t,source:e,end:i});break}case"block-map":case"block-seq":{let s={type:"newline",offset:n.offset+e.length,indent:n.indent,source:`
|
|
114
|
+
`};delete n.items,Object.assign(n,{type:t,source:e,end:[s]});break}default:{let i="indent"in n?n.indent:-1,s="end"in n&&Array.isArray(n.end)?n.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(n))r!=="type"&&r!=="offset"&&delete n[r];Object.assign(n,{type:t,indent:i,source:e,end:s})}}}var bi=n=>"type"in n?jt(n):Rt(n);function jt(n){switch(n.type){case"block-scalar":{let e="";for(let t of n.props)e+=jt(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(let t of n.items)e+=Rt(t);return e}case"flow-collection":{let e=n.start.source;for(let t of n.items)e+=Rt(t);for(let t of n.end)e+=t.source;return e}case"document":{let e=Rt(n);if(n.end)for(let t of n.end)e+=t.source;return e}default:{let e=n.source;if("end"in n&&n.end)for(let t of n.end)e+=t.source;return e}}}function Rt({start:n,key:e,sep:t,value:i}){let s="";for(let r of n)s+=r.source;if(e&&(s+=jt(e)),t)for(let r of t)s+=r.source;return i&&(s+=jt(i)),s}var bn=Symbol("break visit"),ms=Symbol("skip children"),wi=Symbol("remove item");function ge(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),Si(Object.freeze([]),n,e)}ge.BREAK=bn;ge.SKIP=ms;ge.REMOVE=wi;ge.itemAtPath=(n,e)=>{let t=n;for(let[i,s]of e){let r=t?.[i];if(r&&"items"in r)t=r.items[s];else return}return t};ge.parentCollection=(n,e)=>{let t=ge.itemAtPath(n,e.slice(0,-1)),i=e[e.length-1][0],s=t?.[i];if(s&&"items"in s)return s;throw new Error("Parent collection not found")};function Si(n,e,t){let i=t(e,n);if(typeof i=="symbol")return i;for(let s of["key","value"]){let r=e[s];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=Si(Object.freeze(n.concat([[s,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===bn)return bn;a===wi&&(r.items.splice(o,1),o-=1)}}typeof i=="function"&&s==="key"&&(i=i(e,n))}}return typeof i=="function"?i(e,n):i}var nt="\uFEFF",it="",st="",De="",ds=n=>!!n&&"items"in n,hs=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function ps(n){switch(n){case nt:return"<BOM>";case it:return"<DOC>";case st:return"<FLOW_END>";case De:return"<SCALAR>";default:return JSON.stringify(n)}}function wn(n){switch(n){case nt:return"byte-order-mark";case it:return"doc-mode";case st:return"flow-error-end";case De:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
115
|
+
`:case`\r
|
|
116
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(n[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function H(n){switch(n){case void 0:case" ":case`
|
|
117
|
+
`:case"\r":case" ":return!0;default:return!1}}var ki=new Set("0123456789ABCDEFabcdef"),gs=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Kt=new Set(",[]{}"),ys=new Set(` ,[]{}
|
|
118
|
+
\r `),kn=n=>!n||ys.has(n),Be=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let i=this.next??"stream";for(;i&&(t||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
119
|
+
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
120
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let i=0;for(;t===" ";)t=this.buffer[++i+e];if(t==="\r"){let s=this.buffer[i+e+1];if(s===`
|
|
121
|
+
`||!s&&!this.atEnd)return e+i+1}return t===`
|
|
122
|
+
`||i>=this.indentNext||!t&&!this.atEnd?e+i:-1}if(t==="-"||t==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&H(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
123
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===nt&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,i=e.indexOf("#");for(;i!==-1;){let r=e[i-1];if(r===" "||r===" "){t=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let s=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield it,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&H(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!H(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&H(t)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(kn),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,i=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=i=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&s[0]!=="#"||i===0&&(s.startsWith("---")||s.startsWith("..."))&&H(s[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield st,yield*this.parseLineStart();let r=0;for(;s[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),s[r]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(kn),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||H(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}let i=this.buffer.substring(0,t),s=i.indexOf(`
|
|
124
|
+
`,this.pos);if(s!==-1){for(;s!==-1;){let r=this.continueScalar(s+1);if(r===-1)break;s=i.indexOf(`
|
|
125
|
+
`,r)}s!==-1&&(t=s-(i[s-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>H(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,i;e:for(let r=this.pos;i=this.buffer[r];++r)switch(i){case" ":t+=1;break;case`
|
|
126
|
+
`:e=r,t=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
127
|
+
`)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
|
|
128
|
+
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(i=this.buffer[s];i===" ";)i=this.buffer[++s];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
|
|
129
|
+
`;)i=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
130
|
+
`&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield De,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,i=this.pos-1,s;for(;s=this.buffer[++i];)if(s===":"){let r=this.buffer[i+1];if(H(r)||e&&Kt.has(r))break;t=i}else if(H(s)){let r=this.buffer[i+1];if(s==="\r"&&(r===`
|
|
131
|
+
`?(i+=1,s=`
|
|
132
|
+
`,r=this.buffer[i+1]):t=i),r==="#"||e&&Kt.has(r))break;if(s===`
|
|
133
|
+
`){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&Kt.has(s))break;t=i}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield De,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(t&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(kn),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let t=this.flowLevel>0,i=this.charAt(1);if(H(i)||t&&Kt.has(i)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!H(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(gs.has(t))t=this.buffer[++e];else if(t==="%"&&ki.has(this.buffer[e+1])&&ki.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
134
|
+
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
135
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,i;do i=this.buffer[++t];while(i===" "||e&&i===" ");let s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,i=this.buffer[t];for(;!e(i);)i=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var Re=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,i=this.lineStarts.length;for(;t<i;){let r=t+i>>1;this.lineStarts[r]<e?t=r+1:i=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let s=this.lineStarts[t-1];return{line:t,col:e-s+1}}}};function ye(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function Mi(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Ai(n){switch(n?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function qt(n){switch(n.type){case"document":return n.start;case"block-map":{let e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function je(n){if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;n[++e]?.type==="space";);return n.splice(e,n.length)}function Vt(n,e){if(e.length<1e5)Array.prototype.push.apply(n,e);else for(let t=0;t<e.length;++t)n.push(e[t])}function Ni(n){if(n.start.type==="flow-seq-start")for(let e of n.items)e.sep&&!e.value&&!ye(e.start,"explicit-key-ind")&&!ye(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Ai(e.value)?e.value.end?Vt(e.value.end,e.sep):e.value.end=e.sep:Vt(e.start,e.sep),delete e.sep)}var Se=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Be,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,t))yield*this.next(i);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=wn(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let i=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in i?i.indent:0:t.type==="flow-collection"&&i.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Ni(t),i.type){case"document":i.value=t;break;case"block-scalar":i.props.push(t);break;case"block-map":{let s=i.items[i.items.length-1];if(s.value){i.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=t;else{Object.assign(s,{key:t,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=i.items[i.items.length-1];s.value?i.items.push({start:[],value:t}):s.value=t;break}case"flow-collection":{let s=i.items[i.items.length-1];!s||s.value?i.items.push({start:[],key:t,sep:[]}):s.sep?s.value=t:Object.assign(s,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let s=t.items[t.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&Mi(s.start)===-1&&(t.indent===0||s.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(i.type==="document"?i.end=s.start:i.items.push({start:s.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Mi(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=qt(this.peek(2)),i=je(t),s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
136
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
137
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let i="end"in t.value?t.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Vt(s,t.start),s.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,s=i&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(s&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ye(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Ai(t.key)&&!ye(t.sep,"newline")){let o=je(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(ye(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=je(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||s?e.items.push({start:r,key:null,sep:[this.sourceToken]}):ye(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);s||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!ye(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let i="end"in t.value?t.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Vt(s,t.start),s.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||ye(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:s,sep:[]}):t.sep?this.stack.push(s):Object.assign(t,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let s=qt(i),r=je(s);Ni(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
138
|
+
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
139
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=qt(e),i=je(t);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=qt(e),i=je(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Ci(n){let e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new Re||null,prettyErrors:e}}function Oi(n,e={}){let{lineCounter:t,prettyErrors:i}=Ci(e),s=new Se(t?.addNewLine),r=new we(e),o=Array.from(r.compose(s.parse(n)));if(i&&t)for(let a of o)a.errors.forEach(Ze(n,t)),a.warnings.forEach(Ze(n,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Mn(n,e={}){let{lineCounter:t,prettyErrors:i}=Ci(e),s=new Se(t?.addNewLine),r=new we(e),o=null;for(let a of r.compose(s.parse(n),!0,n.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new j(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&t&&(o.errors.forEach(Ze(n,t)),o.warnings.forEach(Ze(n,t))),o}function Ei(n,e,t){let i;typeof e=="function"?i=e:t===void 0&&e&&typeof e=="object"&&(t=e);let s=Mn(n,t);if(!s)return null;if(s.warnings.forEach(r=>yt(s.options.logLevel,r)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:i},t))}function Ti(n,e,t){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let s=Math.round(t);t=s<1?void 0:s>8?{indent:8}:{indent:s}}if(n===void 0){let{keepUndefined:s}=t??e??{};if(!s)return}return q(n)&&!i?n.toString(t):new ie(n,i,t).toString(t)}var An=Nn;var Cn=/^\uFEFF?\s*---\s*\r?\n([\s\S]*?)\r?\n\s*---\s*(?:\r?\n|$)/,Wt=/^[^\S\r\n]*%%\{\s*(?:init|initialize)\s*:\s*([\s\S]*?)\}\s*%%[^\S\r\n]*(?:\r?\n|$)?/gm,Li=/^\s*%%(?!\{)\s*(.*)\r?$/;function bs(n){let e=[],t=new RegExp(Wt.source,"gm"),i;for(;(i=t.exec(n))!==null;)e.push({raw:i[0],parsed:Ke(Pi((i[1]??"").trim())??{})});return e}function ws(n,e={}){let t=ks(n,$i(e)),i=Fn(t.body.split(/\r?\n/)),s=Ss(n,i.accessibility),r=i.familyLines.join(`
|
|
140
|
+
`),o=Fi(r);return{originalText:n,text:t.lines.join(`
|
|
141
|
+
`),body:t.body,lines:t.lines,familyBody:r,familyText:o.join(`
|
|
142
|
+
`),familyLines:o,firstLine:t.lines[0]?.toLowerCase()??"",config:xi(t.frontmatter),frontmatter:t.frontmatter,...s.wrapperSource!==void 0?{wrapperSource:s.wrapperSource}:{},initDirectives:s.initDirectives,comments:s.comments,accessibility:s.accessibility}}function pf(n,e={}){let t=ws(n);if(Object.keys(e).length===0)return t;let i=rt(t.frontmatter,$i(e));return{...t,frontmatter:i,config:xi(i)}}function Ss(n,e){let i=n.match(Cn)?.[0].length??(n.startsWith("\uFEFF")?1:0),s=bs(n.slice(i)),r=n.replace(Cn,"").replace(new RegExp(Wt.source,"gm"),""),o=[],a=r.split(/\r?\n/);for(let d=0;d<a.length;d++){let f=In(a,d);if(f===void 0)break;if(f!==null){d=f.endIndex;continue}let p=a[d].match(Li);p&&o.push({text:p[1],line:d+1})}let l=i,c=new RegExp(Wt.source);for(;;){let d=n.slice(l);if(d.length===0)break;let f=d.match(c);if(f?.index===0&&f[0].length>0){l+=f[0].length;continue}let u=d.indexOf(`
|
|
143
|
+
`),p=u===-1?d:d.slice(0,u);if(/^\s*$/.test(p)||Li.test(p)){l+=u===-1?d.length:u+1;continue}break}return{...l>0?{wrapperSource:n.slice(0,l)}:{},initDirectives:s,comments:o,accessibility:e}}function ks(n,e={}){let t=n.match(Cn),i=t?Ke(As(t[1])):{},s=t?n.slice(t[0].length):n,{body:r,frontmatter:o}=Cs(s),a=rt(rt(Ke(e),i),Ke(o));return{body:r,lines:Fi(r),frontmatter:a}}function Fi(n){return n.replace(/^\uFEFF/,"").split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith("%%"))}function rt(n,e){return vi(n,e)}function vi(n,e){let t=ke(n);for(let[i,s]of Object.entries(e)){if(s===void 0)continue;let r=t[i];if(X(r)&&X(s)){t[i]=vi(r,s);continue}t[i]=On(s)}return t}function gf(n,e){let t=n;for(let i of e){if(!X(t))return;t=t[i]}return X(t)?t:void 0}function yf(n,e){let t=n;for(let i of e){if(!X(t))return;t=t[i]}return t!==void 0&&!Array.isArray(t)&&(typeof t!="object"||t===null)?t:void 0}function bf(n,e){let t=n;for(let i of e){if(!X(t))return;t=t[i]}return Array.isArray(t)?t:void 0}function $i(n){return Ne(n,"Mermaid runtime configuration"),Ke(Jt(n)??{})}function xi(n){let e=ke(n);return X(e.themeVariables)&&(e.themeVariables=ke(e.themeVariables)),X(e.timeline)&&(e.timeline=Ms(e.timeline)),X(e.journey)&&(e.journey=Ns(e.journey)),e}function Ms(n){let e=ke(n);typeof e.disableMulticolor!="boolean"&&delete e.disableMulticolor;let t=Ut(e.sectionFills);t.length>0?e.sectionFills=t:delete e.sectionFills;let i=Ut(e.sectionColours),s=Ut(e.sectionColors);return i.length>0?e.sectionColours=i:s.length>0?e.sectionColours=s:delete e.sectionColours,delete e.sectionColors,e}function Ns(n){let e=ke(n);for(let s of["diagramMarginX","diagramMarginY","leftMargin","maxLabelWidth","width","height","boxMargin","boxTextMargin","noteMargin","messageMargin","bottomMarginAdj","taskMargin","activationWidth"]){let r=e[s];(typeof r!="number"||!Number.isFinite(r)||r<0)&&delete e[s]}typeof e.useMaxWidth!="boolean"&&delete e.useMaxWidth,typeof e.rightAngles!="boolean"&&delete e.rightAngles,e.messageAlign!=="left"&&e.messageAlign!=="center"&&e.messageAlign!=="right"&&delete e.messageAlign;let t=Ii(e.taskFontSize);t!==void 0?e.taskFontSize=t:delete e.taskFontSize;for(let s of["taskFontFamily","textPlacement","titleColor","titleFontFamily"])(typeof e[s]!="string"||e[s].trim().length===0)&&delete e[s];let i=Ii(e.titleFontSize);i!==void 0?e.titleFontSize=i:delete e.titleFontSize;for(let s of["actorColours","sectionFills","sectionColours"]){let r=Ut(e[s]);r.length>0?e[s]=r:delete e[s]}return e}function Ii(n){if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n;if(typeof n=="string"&&n.trim().length>0)return n.trim()}function Ut(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"):[]}function Ke(n){Ne(n,"Mermaid configuration");let e=ke(n),t=X(e.config)?e.config:void 0;return delete e.config,t?rt(t,e):e}function As(n){zt(n,"Mermaid frontmatter");try{let e=An.parse(n);return Ne(e,"Mermaid frontmatter"),Jt(e)??{}}catch(e){if(e instanceof Yt)throw e;return{}}}function Cs(n){let e={};return{body:n.replace(new RegExp(Wt.source,"gm"),(i,s)=>{let r=Pi(s);return r&&(e=rt(e,Ke(r))),""}),frontmatter:e}}function Pi(n){zt(n,"Mermaid init directive",{trackFlowDepth:!0});try{let e=An.parse(n);return Ne(e,"Mermaid init directive"),Jt(e)}catch(e){if(e instanceof Yt)throw e;let t=Ts(n);return t!==void 0&&Ne(t,"Mermaid init directive"),t}}function Jt(n){if(!Os(n))return;let e={};for(let[t,i]of Object.entries(n)){let s=_i(i);s!==void 0&&(e[t]=s)}return e}function _i(n){if(n===null)return null;if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return n;if(Array.isArray(n)){let e=[];for(let t of n){let i=_i(t);if(i===void 0)return;e.push(i)}return e}return Jt(n)}function ke(n){let e={};for(let[t,i]of Object.entries(n))e[t]=On(i);return e}function On(n){return n==null||typeof n=="string"||typeof n=="number"||typeof n=="boolean"?n:Array.isArray(n)?n.map(e=>On(e)):ke(n)}function X(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Os(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function Es(n){return n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?Bi(n):n==="true"?!0:n==="false"?!1:n==="null"?null:/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)$/.test(n)?Number(n):n}function Ts(n){let e=En(n.trim());return X(e)?e:void 0}function En(n){let e=n.trim();if(e.length!==0)return e.startsWith("{")&&e.endsWith("}")?Ls(e.slice(1,-1)):e.startsWith("[")&&e.endsWith("]")?Is(e.slice(1,-1)):Es(e)}function Ls(n){let e={};for(let t of Di(n)){let i=vs(t,":");if(i===-1)return;let s=t.slice(0,i).trim(),r=t.slice(i+1).trim(),o=Fs(s);if(!o)return;let a=En(r);if(a===void 0)return;e[o]=a}return e}function Is(n){let e=[];for(let t of Di(n)){let i=En(t);if(i===void 0)return;e.push(i)}return e}function Fs(n){let e=n.trim();if(e)return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?Bi(e):e}function Di(n){let e=[],t="",i=null,s=0,r=0;for(let a=0;a<n.length;a++){let l=n[a];if(i){t+=l,l===i&&n[a-1]!=="\\"&&(i=null);continue}if(l==='"'||l==="'"){i=l,t+=l;continue}if(l==="{"){s++,t+=l;continue}if(l==="}"){s--,t+=l;continue}if(l==="["){r++,t+=l;continue}if(l==="]"){r--,t+=l;continue}if(l===","&&s===0&&r===0){let c=t.trim();c&&e.push(c),t="";continue}t+=l}let o=t.trim();return o&&e.push(o),e}function vs(n,e){let t=null,i=0,s=0;for(let r=0;r<n.length;r++){let o=n[r];if(t){o===t&&n[r-1]!=="\\"&&(t=null);continue}if(o==='"'||o==="'"){t=o;continue}if(o==="{"){i++;continue}if(o==="}"){i--;continue}if(o==="["){s++;continue}if(o==="]"){s--;continue}if(o===e&&i===0&&s===0)return r}return-1}function Bi(n){try{return n.startsWith("'")?n.slice(1,-1).replace(/\\\\/g,"\\").replace(/\\'/g,"'"):JSON.parse(n)}catch{return n.slice(1,-1)}}export{ws as a,pf as b,gf as c,yf as d,bf as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{O as i}from"./chunk-EX6TP7QM.js";var t=r=>Math.round(r*1e3)/1e3,n=r=>`fill="${i(r.fill)}" stroke="${i(r.stroke)}" stroke-width="${i(r.strokeWidth)}"`;function l(r,s){let e=n(s);switch(r.kind){case"rect":return`<rect x="${t(r.x)}" y="${t(r.y)}" width="${t(r.width)}" height="${t(r.height)}" rx="${r.rx??0}" ry="${r.ry??0}" ${e} />`;case"circle":return`<circle cx="${t(r.cx)}" cy="${t(r.cy)}" r="${t(r.r)}" ${e} />`;case"ellipse":return`<ellipse cx="${t(r.cx)}" cy="${t(r.cy)}" rx="${t(r.rx)}" ry="${t(r.ry)}" ${e} />`;case"polygon":return`<polygon points="${r.points.map(c=>`${t(c.x)},${t(c.y)}`).join(" ")}" ${e} />`}}export{l as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as y,b as w,c as m,d as j,h as p}from"./chunk-EX6TP7QM.js";function C(o,t,r,u,i=0){if(!Number.isFinite(t)||t<=0||p(o,r,u,i)<=t)return o;let e=[];for(let l of o.split(/\r?\n/)){if(y.test(l)){e.push(..._(l,t,r,u,i));continue}let c=l.split(/\s+/).filter(Boolean),n="";for(let s of c){let d=n?`${n} ${s}`:s;if(p(d,r,u,i)<=t){n=d;continue}n&&e.push(n),n=k(s,t,r,u,i)}n&&e.push(n)}return e.join(`
|
|
2
|
+
`)}function $(o){let t=[],r=[];for(let u of w(o))for(let i of u.text.split(/(\s+)/))i&&(/^\s+$/.test(i)?r.length>0&&(t.push(r),r=[]):r.push({...u,text:i}));return r.length>0&&t.push(r),t}function I(o){return o.map(m).join("")}function _(o,t,r,u,i){let e=[],l=[];for(let c of $(o)){let n=I(c),s=[...l,n].join(" ");if(p(s,r,u,i)<=t){l.push(n);continue}if(l.length>0&&e.push(l.join(" ")),l=[],c.length===1&&p(n,r,u,i)>t){let d=c[0],a=k(d.text,t,r,d.bold?Math.max(700,u):u,i).split(`
|
|
3
|
+
`);e.push(...a.slice(0,-1).map(f=>m({...d,text:f}))),l=[m({...d,text:a.at(-1)})]}else l=[n]}return l.length>0&&e.push(l.join(" ")),e}function k(o,t,r,u,i=0){if(p(o,r,u,i)<=t)return o;let e=j(o),l=[],c=0;for(;c<e.length;){let n="",s=c;for(;s<e.length;){let b=e[s],g=n+b,F=s<e.length-1,A=e[s+1]??"",T=F&&h(b)&&h(A),M=g+(F&&!T?"-":"");if(n&&p(M,r,u,i)>t)break;n=g,s++}s===c&&(n=e[s],s++);let d=s<e.length,a=d&&h(e[s-1])&&h(e[s]),f=`${n}-`;l.push(d&&!a&&p(f,r,u,i)<=t?f:n),c=s}return l.join(`
|
|
4
|
+
`)}function h(o){return/[ᄀ-ᅟ⺀-가-힣豈-︰-﹏-⦆¢-₩\u{1F300}-\u{1FAFF}\u{20000}-\u{2FA1F}]|\p{Extended_Pictographic}|\uFE0F|\u200D/u.test(o)}export{C as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as V}from"./chunk-T7IJ6V4B.js";import{a as R}from"./chunk-WEUWIFG3.js";import{a as q}from"./chunk-KJVNXJ5Y.js";import{L as T}from"./chunk-EX6TP7QM.js";var U={rect:{aliases:["proc","process","rectangle"],geometry:"rectangle",exact:!0,description:"Process"},rounded:{aliases:["event"],geometry:"rounded",exact:!0,description:"Event"},stadium:{aliases:["pill","terminal"],geometry:"stadium",exact:!0,description:"Terminal point"},cyl:{aliases:["cylinder","database","db"],geometry:"cylinder",exact:!0,description:"Database"},diam:{aliases:["decision","diamond","question"],geometry:"diamond",exact:!0,description:"Decision"},hex:{aliases:["hexagon","prepare"],geometry:"hexagon",exact:!0,description:"Prepare conditional"},"lean-r":{aliases:["in-out","lean-right"],geometry:"lean-r",exact:!0,description:"Data input/output"},"lean-l":{aliases:["lean-left","out-in"],geometry:"lean-l",exact:!0,description:"Data output/input"},"trap-b":{aliases:["priority","trapezoid","trapezoid-bottom"],geometry:"trapezoid",exact:!0,description:"Priority action"},"trap-t":{aliases:["inv-trapezoid","manual","trapezoid-top"],geometry:"trapezoid-alt",exact:!0,description:"Manual operation"},circle:{aliases:["circ"],geometry:"circle",exact:!0,description:"Start"},"dbl-circ":{aliases:["double-circle"],geometry:"doublecircle",exact:!0,description:"Stop"},"fr-rect":{aliases:["framed-rectangle","subproc","subprocess","subroutine"],geometry:"subroutine",exact:!0,description:"Subprocess"},odd:{aliases:[],geometry:"asymmetric",exact:!0,description:"Odd"},bang:{aliases:[],geometry:"circle",exact:!0,description:"Bang"},"notch-rect":{aliases:["card","notched-rectangle"],geometry:"rectangle",exact:!0,description:"Card"},cloud:{aliases:[],geometry:"rounded",exact:!0,description:"Cloud"},hourglass:{aliases:["collate"],geometry:"diamond",exact:!0,description:"Collate"},bolt:{aliases:["com-link","lightning-bolt"],geometry:"rectangle",exact:!0,description:"Com link"},brace:{aliases:["brace-l","comment"],geometry:"rectangle",exact:!0,description:"Comment"},"brace-r":{aliases:[],geometry:"rectangle",exact:!0,description:"Comment right"},braces:{aliases:[],geometry:"rectangle",exact:!0,description:"Comment both"},datastore:{aliases:["data-store"],geometry:"cylinder",exact:!0,description:"Data store"},delay:{aliases:["half-rounded-rectangle"],geometry:"rounded",exact:!0,description:"Delay"},"h-cyl":{aliases:["das","horizontal-cylinder"],geometry:"cylinder",exact:!0,description:"Direct access storage"},"lin-cyl":{aliases:["disk","lined-cylinder"],geometry:"cylinder",exact:!0,description:"Disk storage"},"curv-trap":{aliases:["curved-trapezoid","display"],geometry:"rounded",exact:!0,description:"Display"},"div-rect":{aliases:["div-proc","divided-process","divided-rectangle"],geometry:"rectangle",exact:!0,description:"Divided process"},doc:{aliases:["document"],geometry:"rectangle",exact:!0,description:"Document"},tri:{aliases:["extract","triangle"],geometry:"trapezoid",exact:!0,description:"Extract"},fork:{aliases:["join"],geometry:"rectangle",exact:!0,description:"Fork/join"},"win-pane":{aliases:["internal-storage","window-pane"],geometry:"rectangle",exact:!0,description:"Internal storage"},"f-circ":{aliases:["filled-circle","junction"],geometry:"circle",exact:!0,description:"Junction"},"lin-doc":{aliases:["lined-document"],geometry:"rectangle",exact:!0,description:"Lined document"},"lin-rect":{aliases:["lin-proc","lined-process","lined-rectangle","shaded-process"],geometry:"subroutine",exact:!0,description:"Lined/shaded process"},"notch-pent":{aliases:["loop-limit","notched-pentagon"],geometry:"hexagon",exact:!0,description:"Loop limit"},"flip-tri":{aliases:["flipped-triangle","manual-file"],geometry:"trapezoid-alt",exact:!0,description:"Manual file"},"sl-rect":{aliases:["manual-input","sloped-rectangle"],geometry:"lean-r",exact:!0,description:"Manual input"},docs:{aliases:["documents","st-doc","stacked-document"],geometry:"rectangle",exact:!0,description:"Multi-document"},"st-rect":{aliases:["processes","procs","stacked-rectangle"],geometry:"rectangle",exact:!0,description:"Multi-process"},flag:{aliases:["paper-tape"],geometry:"rectangle",exact:!0,description:"Paper tape"},"sm-circ":{aliases:["small-circle","start"],geometry:"circle",exact:!0,description:"Start (small)"},"fr-circ":{aliases:["framed-circle","stop"],geometry:"doublecircle",exact:!0,description:"Stop (framed)"},"bow-rect":{aliases:["bow-tie-rectangle","stored-data"],geometry:"cylinder",exact:!0,description:"Stored data"},"cross-circ":{aliases:["crossed-circle","summary"],geometry:"circle",exact:!0,description:"Summary"},"tag-doc":{aliases:["tagged-document"],geometry:"rectangle",exact:!0,description:"Tagged document"},"tag-rect":{aliases:["tag-proc","tagged-process","tagged-rectangle"],geometry:"rectangle",exact:!0,description:"Tagged process"},text:{aliases:[],geometry:"rectangle",exact:!0,description:"Text block"}},Se=(()=>{let t=new Map;for(let[e,n]of Object.entries(U)){t.set(e,e);for(let r of n.aliases)t.set(r,e)}return t})();function X(t){let e=Se.get(t.trim().toLowerCase());if(!e)return null;let n=U[e];return{canonical:e,geometry:n.geometry,exact:n.exact,description:n.description}}var we=/^note\s+(left|right)\s+of\s+([\w\p{L}-]+)\s*:\s*(.+)$/iu,xe=/^note\s+(left|right)\s+of\s+([\w\p{L}-]+)\s*$/iu,Me=/^end\s+note$/i,Ee=/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}-]+)\s*<<\s*(fork|join|choice|history|deephistory|H\*|H)\s*>>$/u,Ne=/^-{2,}$/,Le=/^([\w\p{L}-]*)\[(H\*?)\]$/u,Re=/^[\w\p{L}-]+$/u;function Y(t){return Re.test(t)}function J(t){let e=t.match(we);return e?{side:e[1].toLowerCase(),target:e[2],text:e[3].trim()}:null}function K(t){let e=t.match(xe);return e?{side:e[1].toLowerCase(),target:e[2]}:null}function Z(t){return Me.test(t)}function ee(t){let e=t.match(Ee);if(!e)return null;let n=e[3],r=n==="H"||n==="history"?"history":n==="H*"||n==="deephistory"?"deep-history":n;return{id:e[2],stereotype:r,...e[1]!==void 0?{label:e[1]}:{}}}function te(t){return Ne.test(t)}function ne(t){let e=t.match(Le);return e?{base:e[1],deep:e[2]==="H*"}:null}function W(t){return t?"H*":"H"}var Q=String.raw`\[\*\]|[\w\p{L}-]+\[H\*?\]|\[H\*?\]|[\w\p{L}-]+`,ke=new RegExp(`^(${Q})(?::::([\\w-]+))?\\s*-->\\s*(${Q})(?::::([\\w-]+))?(?:\\s*:\\s*(.+))?$`,"u");function re(t){let e=t.match(ke);if(!e)return null;let n=e[5]?.trim();return{from:e[1],...e[2]?{fromClass:e[2]}:{},to:e[3],...e[4]?{toClass:e[4]}:{},...n?{label:n}:{}}}var D=String.raw`[\p{L}\p{N}_-]+`,ft=new RegExp(`^${D}$`,"u"),Ie=new RegExp(`^(${D})`,"u"),Te=/^[\w-]+/;function F(t){let e=t.match(Ie);return e?{id:e[1],length:e[1].length}:null}function P(t){if(!t.startsWith(":::"))return null;let e=t.slice(3).match(Te);return e?{className:e[0],length:3+e[0].length}:null}function se(t){let e=F(t);if(!e)return null;let n=P(t.slice(e.length));return!n||e.length+n.length!==t.length?null:{id:e.id,className:n.className}}function Ae(t){let e=Array(t.length).fill(" "),n=0,r,s=!1,o=!1;for(let i=0;i<t.length;i++){let a=t[i];if(r){o?o=!1:a==="\\"?o=!0:a===r&&(r=void 0);continue}if(a==='"'||a==="'"||a==="`"){r=a;continue}if(a==="|"&&n===0){s=!s;continue}if(!s){if(a==="["||a==="("||a==="{"){n++;continue}if(a==="]"||a===")"||a==="}"){n=Math.max(0,n-1);continue}n===0&&(e[i]=a)}}return e.join("")}function $e(t,e){if(e<=0||t[e-1]!=="@")return!1;let n=e-2;for(;n>=0&&/[\p{L}\p{N}_-]/u.test(t[n]);)n--;return n<e-2&&(n<0||/\s/.test(t[n]))}function Ce(t,e){if(e>0&&!/\s/.test(t[e-1])&&!$e(t,e))return-1;let n=e;if(t[n]==="<"&&n++,t[n]==="-")if(t[n+1]==="-")for(n+=2;t[n]==="-";)n++;else if(t[n+1]===".")for(n+=2;t[n]===".";)n++;else return-1;else if(t[n]==="="&&t[n+1]==="=")for(n+=2;t[n]==="=";)n++;else return-1;return/\s/.test(t[n]??"")?n:-1}function De(t,e){if(e>0&&!/\s/.test(t[e-1]))return-1;if(t[e]==="."){let n=e;for(;t[n]===".";)n++;return t[n]==="-"&&t[n+1]===">"?n+2:-1}if(t[e]==="-"){if(t[e+1]==="."){let s=e+1;for(;t[s]===".";)s++;return t[s]!=="-"?-1:t[s+1]===">"?s+2:s+1}let n=e;for(;t[n]==="-";)n++;let r=n-e;return r<2?-1:t[n]===">"||t[n]==="o"||t[n]==="x"?n+1:r>=3?n:-1}if(t[e]==="="){let n=e;for(;t[n]==="=";)n++;let r=n-e;return r<2?-1:t[n]===">"?n+1:r>=3?n:-1}return-1}function ie(t){let e=Ae(t),n=[],r=-1;for(let s=0;s<e.length;s++){if(r<0){let u=Ce(e,s);u>=0&&(r=u,s=u-1);continue}let o=De(e,s);if(o<0)continue;let i=t.slice(r,s),a=i.length-i.trimStart().length,l=i.trim();if(l){let u=r+a;n.push({start:u,end:u+l.length})}r=-1,s=o-1}return n}function Nt(t){let e=_e(Oe(Fe(t.split(`
|
|
2
|
+
`))).map(i=>i.trim()).filter(i=>i.length>0&&!i.startsWith("%%")));if(e.length===0)throw new Error("Empty mermaid diagram");let n=e[0],r=V(n,"strict"),s=r.kind==="registered"?r.familyId:q(n);if(s==="state")return qe(e);if(s==="flowchart")return He(e);if(r.kind==="unknown")throw new Error(`Unknown Mermaid diagram header: ${n}`);let o=r.kind==="registered"?r.familyId:r.match.family.id;throw new Error(`Mermaid family "${o}" is not a graph family; use the family-neutral agent parser`)}function _e(t){return t.length===0||!t[0].includes(";")||!/^(?:graph|flowchart|swimlane|stateDiagram(?:-v2)?)(?:\b|\s)/i.test(t[0])?t:[...H(t[0]),...t.slice(1)]}function Oe(t){let e=[],n=null,r=0;for(let s of t){if(n){n.push(s.trim()),r+=oe(s),r<=0&&(e.push(n.join(" ")),n=null,r=0);continue}if(/@\s*\{/.test(s)){r=oe(s),r>0?n=[s.trim()]:e.push(s);continue}e.push(s)}return n&&e.push(n.join(" ")),e}function oe(t){let e=0,n=null,r=!1;for(let s of t){if(r){r=!1;continue}if(s==="\\"){r=!0;continue}if(n){s===n&&(n=null);continue}if(s==='"'||s==="'"){n=s;continue}s==="{"?e++:s==="}"&&e--}return e}function Fe(t){let e=[],n=null;for(let r of t){if(n){n.push(r.trim()),ae(r)%2===1&&(e.push(n.join("<br>")),n=null);continue}if(r.trim().startsWith("%%")){e.push(r);continue}if(ae(r)%2===1){n=[r];continue}e.push(r)}return n&&e.push(n.join("<br>")),e}function ae(t){let e=0,n=!1;for(let r of t){if(n){n=!1;continue}if(r==="\\"){n=!0;continue}r==="`"&&e++}return e}function ve(t){return T(t)}function $(t,e=!1){let n=!e&&t.length>=2&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t;return(e||n!==t)&&n.length>=2&&n.startsWith("`")&&n.endsWith("`")?{text:ve(n.slice(1,-1)),markdown:!0}:{text:T(t),markdown:!1}}function H(t){let e=[],n=ie(t),r=0,s=0,o=0,i=null,a=!1,l=!1;for(let d=0;d<t.length;d++){let c=t[d];if(a){a=!1;continue}if(c==="\\"){a=!0;continue}if(i){c===i&&(i=null);continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="|"&&o===0){l=!l;continue}if(!l){if(c==="["||c==="("||c==="{")o++;else if(c==="]"||c===")"||c==="}")o=Math.max(0,o-1);else if(c===";"&&o===0){for(;n[r]&&n[r].end<=d;)r++;let f=n[r];if(!f||d<f.start||d>=f.end){let y=t.slice(s,d).trim();y&&e.push(y),s=d+1}}}}let u=t.slice(s).trim();return u&&e.push(u),e}function Ge(t){return/^(?:click|href)\s+/i.test(t.trim())}function We(t,e){let n=e.trim().match(/^(?:click\s+)?([\w-]+)\s+(?:href\s+)?(?:"((?:\\.|[^"])*)"|(https?:\/\/\S+|mailto:\S+))/i);if(!n)return;let r=(n[2]??n[3]??"").replace(/\\(["\\])/g,"$1");if(!/^(?:https?:|mailto:)/i.test(r))return;let s=t.nodes.get(n[1]);s&&(s.href=r)}function C(t){if(t===void 0)return;let e=t.trim();return(e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))?e.slice(1,-1).replace(/\\(["'\\])/g,"$1"):e)||void 0}function Pe(t,e){let n=e.trim().match(/^([\w-]+)@\s*\{([\s\S]*)\}\s*$/);if(!n)return;let r=t.edges.find(l=>l.id===n[1]);if(!r)return;let s=B(n[2]),o=C(s.get("curve"));o&&/^[a-z][a-z0-9-]*$/i.test(o)&&(r.curve=o);let i=C(s.get("animate"))?.toLowerCase(),a=C(s.get("animation"))?.toLowerCase();if(i==="true"||i==="fast"||i==="slow"||a==="fast"||a==="slow"){r.animate=!0;let l=i==="fast"||i==="slow"?i:a;(l==="fast"||l==="slow")&&(r.animation=l)}}function je(t,e){let n=e.trim().match(/^([\w-]+)@\s*\{([\s\S]*)\}\s*$/);if(!n)return!1;if(t.edges.some(s=>s.id===n[1]))return!0;let r=B(n[2]);return!r.has("shape")&&!r.has("label")&&!r.has("icon")&&!r.has("img")}function He(t){let e=t[0].match(/^(?:(?:graph|swimlane)\s+(TD|TB|LR|BT|RL|[<>^v])|flowchart(?:\s+(TD|TB|LR|BT|RL|[<>^v]))?)\s*$/i);if(!e)throw new Error(`Invalid mermaid header: "${t[0]}". Expected "graph TD", "flowchart LR", "stateDiagram-v2", etc.`);let r={direction:Be(e[1]??e[2]??"TD"),nodes:new Map,edges:[],subgraphs:[],classDefs:new Map,classAssignments:new Map,nodeStyles:new Map,linkStyles:new Map},s=[],o=ze(t.slice(1));for(let i=1;i<t.length;i++)for(let a of H(t[i])){if(Ge(a)){We(r,a);continue}if(je(r,a)){Pe(r,a);continue}let l=a.match(/^classDef\s+([\w,-]+)\s+(.+)$/);if(l){let p=l[1].split(",").map(m=>m.trim()).filter(Boolean),S=R(l[2]);if(Object.keys(S).length===0)continue;for(let m of p)r.classDefs.set(m,S);continue}let u=a.match(/^class\s+([\w,-]+)\s+([\w-]+)\s*;?$/);if(u){let p=u[1].split(",").map(m=>m.trim()),S=u[2];for(let m of p)r.classAssignments.set(m,S);continue}let d=a.match(/^style\s+([\w,-]+)\s+(.+)$/);if(d){let p=d[1].split(",").map(m=>m.trim()),S=R(d[2]);if(Object.keys(S).length===0)continue;for(let m of p)r.nodeStyles.set(m,{...r.nodeStyles.get(m),...S});continue}let c=a.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);if(c){let p=c[1].trim(),S=R(c[2]);if(Object.keys(S).length===0)continue;if(p==="default")r.linkStyles.set("default",{...r.linkStyles.get("default"),...S});else{let m=p.split(",").map(h=>parseInt(h.trim(),10));for(let h of m)isNaN(h)||r.linkStyles.set(h,{...r.linkStyles.get(h),...S})}continue}let f=a.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);if(f){let p=f[1].toUpperCase();s.length>0?s[s.length-1].direction=p:r.direction=p;continue}let y=a.match(/^subgraph\s+(.+)$/);if(y){let p=y[1].trim(),S=p.match(/^([\w-]+)\s*\[(.+)\]$/),m,h;S?(m=S[1],h=$(S[2]).text):(h=$(p).text,m=p.replace(/\s+/g,"_").replace(/[^\w]/g,""));let M={id:m,label:h,nodeIds:[],children:[]};s.push(M);continue}if(a==="end"){let p=s.pop();p&&(s.length>0?s[s.length-1].children.push(p):r.subgraphs.push(p));continue}let w=nt(a,r,s,o);if(!w.ok)throw new Error(`Invalid flowchart statement "${a}": could not fully consume ${w.reason}; remaining input: "${w.remaining}"`)}return r}function ze(t){let e=new Set;for(let n of t)for(let r of H(n)){let s=r.match(/^subgraph\s+(.+)$/);if(!s)continue;let o=s[1].trim(),i=o.match(/^([\w-]+)\s*\[(.+)\]$/);e.add(i?i[1]:o.replace(/\s+/g,"_").replace(/[^\w]/g,""))}return e}function Be(t){let e=t.toUpperCase();return e===">"?"LR":e==="<"?"RL":e==="^"?"BT":e==="V"?"TB":e}function qe(t){let e={direction:"TD",nodes:new Map,edges:[],subgraphs:[],classDefs:new Map,classAssignments:new Map,nodeStyles:new Map,linkStyles:new Map},n=[],r=new Set,s=0,o=0,i=new Map,a=null,l=(d,c,f)=>{e.stateNotes||(e.stateNotes=[]),e.stateNotes.push({id:`note#${e.stateNotes.length}`,target:d,side:c,text:f}),r.has(d)||_(e,n,d)},u=(d,c)=>{if(d==="[*]"){if(c==="source"){s++;let w=`_start${s>1?s:""}`;return A(e,n,{id:w,label:"",shape:"state-start"}),w}o++;let y=`_end${o>1?o:""}`;return A(e,n,{id:y,label:"",shape:"state-end"}),y}let f=ne(d);if(f){let y=[...n].reverse().find(S=>!S.concurrencyRegion),p=`${f.base!==""?f.base:y?.id??""}[H${f.deep?"*":""}]`;return A(e,n,{id:p,label:W(f.deep),shape:"state-history"}),p}return r.has(d)||_(e,n,d),d};for(let d=1;d<t.length;d++){let c=t[d];if(a){Z(c)?(l(a.target,a.side,a.lines.join(`
|
|
3
|
+
`)),a=null):a.lines.push(c);continue}let f=J(c);if(f){l(f.target,f.side,T(f.text));continue}let y=K(c);if(y){a={target:y.target,side:y.side,lines:[]};continue}let w=c.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);if(w){n.length>0?n[n.length-1].direction=w[1].toUpperCase():e.direction=w[1].toUpperCase();continue}let p=c.match(/^classDef\s+([\w,-]+)\s+(.+)$/);if(p){let b=p[1].split(",").map(x=>x.trim()).filter(Boolean),g=R(p[2]);for(let x of b)e.classDefs.set(x,g);continue}let S=c.match(/^(?:class|cssClass)\s+([\w\p{L},-]+)\s+([\w-]+)$/u);if(S){let b=S[1].split(",").map(g=>g.trim()).filter(Boolean);for(let g of b)_(e,n,g),e.classAssignments.set(g,S[2]);continue}let m=c.match(/^style\s+([\w\p{L},-]+)\s+(.+)$/u);if(m){let b=m[1].split(",").map(x=>x.trim()).filter(Boolean),g=R(m[2]);for(let x of b)_(e,n,x),e.nodeStyles.set(x,{...e.nodeStyles.get(x),...g});continue}let h=c.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);if(h){let b=h[1].trim(),g=R(h[2]);if(Object.keys(g).length===0)continue;if(b==="default")e.linkStyles.set("default",{...e.linkStyles.get("default"),...g});else{let x=b.split(",").map(I=>parseInt(I.trim(),10));for(let I of x)isNaN(I)||e.linkStyles.set(I,{...e.linkStyles.get(I),...g})}continue}let M=ee(c);if(M){let b=M.stereotype==="fork"?"state-fork":M.stereotype==="join"?"state-join":M.stereotype==="choice"?"state-choice":"state-history",g=b==="state-history"?W(M.stereotype==="deep-history"):"";e.nodes.set(M.id,{id:M.id,label:g,shape:b}),Ve(n,M.id);continue}if(te(c)&&n.length>0){let b=n[n.length-1],g;if(b.concurrencyRegion)n.pop(),g=n[n.length-1];else{g=b;let I={id:`${g.id}__r${ce(i,g.id)}`,label:"",nodeIds:g.nodeIds.splice(0),children:g.children.splice(0),concurrencyRegion:!0};g.children.push(I)}let x={id:`${g.id}__r${ce(i,g.id)}`,label:"",nodeIds:[],children:[],concurrencyRegion:!0};g.children.push(x),n.push(x);continue}let L=c.match(/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}-]+)\s*\{$/u);if(L){let b=L[1]??L[2],g=L[2],x={id:g,label:b,nodeIds:[],children:[]};n.push(x),r.add(g),e.nodes.delete(g);continue}if(c==="}"){n.length>0&&n[n.length-1].concurrencyRegion&&n.pop();let b=n.pop();b&&(n.length>0?n[n.length-1].children.push(b):e.subgraphs.push(b));continue}let k=c.match(/^state\s+"([^"]+)"\s+as\s+([\w\p{L}-]+)\s*$/u);if(k){let b=T(k[1]),g=k[2];A(e,n,{id:g,label:b,shape:"rounded"});continue}let N=re(c);if(N){let b=u(N.from,"source"),g=u(N.to,"target");N.fromClass&&e.classAssignments.set(b,N.fromClass),N.toClass&&e.classAssignments.set(g,N.toClass);let x=N.label?T(N.label):void 0;e.edges.push({source:b,target:g,label:x,style:"solid",hasArrowStart:!1,hasArrowEnd:!0});continue}let O=se(c);if(O){_(e,n,O.id),e.classAssignments.set(O.id,O.className);continue}let G=c.match(/^([\w\p{L}-]+)\s*:\s*(.+)$/u);if(G){let b=G[1],g=T(G[2].trim());A(e,n,{id:b,label:g,shape:"rounded"});continue}if(Y(c)){A(e,n,{id:c,label:c,shape:"rounded"});continue}}return a&&l(a.target,a.side,a.lines.join(`
|
|
4
|
+
`)),e}function ce(t,e){let n=(t.get(e)??0)+1;return t.set(e,n),n}function Ve(t,e){if(t.length>0){let n=t[t.length-1];n.nodeIds.includes(e)||n.nodeIds.push(e)}}function A(t,e,n){if(!t.nodes.has(n.id)&&t.nodes.set(n.id,n),e.length>0){let s=e[e.length-1];s.nodeIds.includes(n.id)||s.nodeIds.push(n.id)}}function _(t,e,n){if(!t.nodes.has(n))A(t,e,{id:n,label:n,shape:"rounded"});else if(e.length>0){let r=e[e.length-1];r.nodeIds.includes(n)||r.nodeIds.push(n)}}var fe=/^(<)?(~{3,}|-\.+->|-\.+-|={2,}>|={3,}|o-{2,}o|o-{2,}x|x-{2,}o|x-{2,}x|-{2,}[ox]|-{2,}>|-{3,})/;function Ue(t){let e=t.slice(1).search(/\S/)+1;if(e<1||t[e]!=='"')return-1;let n=!1;for(let r=e+1;r<t.length;r++){let s=t[r];if(n){n=!1;continue}if(s==="\\"){n=!0;continue}if(s==='"'&&/^\s*\|/.test(t.slice(r+1)))return r}return-1}function Xe(t){if(!t.startsWith("|"))return null;let e=Ue(t);for(let n=1;n<t.length;n++)if(!(e>=0&&n<e&&t[n]==="|")&&t[n]==="|")return{rawLabel:t.slice(1,n),consumed:n+1};return null}var Qe=/^(<)?(-{2,}|-\.+|={2,})/,Ye=/^(-{2,}[>ox]|-{3,}|\.+->|-\.+-|={2,}>|={3,})/;function Je(t,e){let n=t.slice(e).search(/\S/),r=n<0?-1:e+n;if(r<e||t[r]!=='"')return-1;let s=!1;for(let o=r+1;o<t.length;o++){let i=t[o];if(s){s=!1;continue}if(i==="\\"){s=!0;continue}if(i==='"'&&/^\s*(?:-{2,}[>ox]|-{3,}|\.+->|-\.+-|={2,}>|={3,})/.test(t.slice(o+1)))return o}return-1}function pe(t){let e=t.match(Qe);if(!e)return null;let n=Je(t,e[0].length);for(let r=e[0].length;r<t.length;r++){if(n>=0&&r<n)continue;let s=t.slice(r).match(Ye);if(!s)continue;let o=t.slice(e[0].length,r).trim();if(o.length!==0)return{hasArrowStart:!!e[1],openOp:e[2],rawLabel:o,closeOp:s[1],consumed:r+s[0].length}}return null}var E=t=>new RegExp(`^(${D})${t}`,"u"),Ke=[{regex:E(String.raw`\(\(\((.+?)\)\)\)`),shape:"doublecircle"},{regex:E(String.raw`\(\[(.+?)\]\)`),shape:"stadium"},{regex:E(String.raw`\(\((.+?)\)\)`),shape:"circle"},{regex:E(String.raw`\[\[(.+?)\]\]`),shape:"subroutine"},{regex:E(String.raw`\[\((.+?)\)\]`),shape:"cylinder"},{regex:E(String.raw`\[\/([^\]]+?)\\\]`),shape:"trapezoid"},{regex:E(String.raw`\[\\([^\]]+?)\/\]`),shape:"trapezoid-alt"},{regex:E(String.raw`\[\/([^\]]+?)\/\]`),shape:"lean-r"},{regex:E(String.raw`\[\\([^\]]+?)\\\]`),shape:"lean-l"},{regex:E(String.raw`>(.+?)\]`),shape:"asymmetric"},{regex:E(String.raw`\{\{(.+?)\}\}`),shape:"hexagon"},{regex:E(String.raw`\[(.+?)\]`),shape:"rectangle"},{regex:E(String.raw`\((.+?)\)`),shape:"rounded"},{regex:E(String.raw`\{(.+?)\}`),shape:"diamond"}];function Ze(t){let e=F(t);if(!e)return null;let n=e.length,r=0;for(let s=0;s<n&&!(s>0&&z(t.slice(s)));s++)r=s+1;return r>0?{id:t.slice(0,r),length:r}:null}function z(t){return fe.test(t)||pe(t)!==null}function et(t,e){for(let n=1;n<e;n++)if(z(t.slice(n)))return!0;return!1}var tt=/^([\w-]+)@\s*(?=(?:<)?(?:~{3,}|-\.+->|-\.+-|={2,}>|={3,}|o-{2,}[ox]|x-{2,}[ox]|-{2,}[ox]|-{2,}>|-{3,}|(?:-{2,}|-\.+|={2,})\s+))/;function j(t){let e=P(t);if(!e)return null;let n=t.slice(3),r=e.className.length,s=r;for(let o=1;o<r;o++)if(z(n.slice(o))){s=o;break}return{className:n.slice(0,s),length:3+s}}function nt(t,e,n,r=new Set){let s=t.trim().replace(/;\s*$/,"").trim(),o=le(s,e,n,r);if(!o||o.ids.length===0)return{ok:!1,remaining:s,reason:"expected node"};s=o.remaining.trim();let i=o.ids;for(;s.length>0;){let a,l,u,d,c,f,y,w=s.match(tt),p=w?.[1];w&&(s=s.slice(w[0].length).trim());let S=s.match(fe);if(S){let h=S[2],M=S[0].length,L=s.slice(M);if(L.startsWith("|")){let k=Xe(L);if(!k)return{ok:!1,remaining:L,reason:"expected edge target"};let N=k.rawLabel.trim();f=N?$(N).text:void 0,M+=k.consumed}s=s.slice(M).trim(),l=at(h),y=ct(h),d=dt(h,!!S[1]),c=ge(h),a=d!==void 0,u=c!==void 0}else{let h=pe(s);if(!h)return{ok:!1,remaining:s,reason:"expected edge operator"};a=h.hasArrowStart,f=$(h.rawLabel).text,s=s.slice(h.consumed).trim(),l=be(h.openOp,h.closeOp),y=lt(h.openOp,h.closeOp),d=a?"arrow":void 0,c=ge(h.closeOp),u=c!==void 0}let m=le(s,e,n,r);if(!m||m.ids.length===0)return{ok:!1,remaining:s,reason:"expected edge target"};s=m.remaining.trim();for(let h of i)for(let M of m.ids)e.edges.push({source:h,target:M,...p!==void 0?{id:p}:{},label:f,style:l,hasArrowStart:a,hasArrowEnd:u,startMarker:d,endMarker:c,...y!==void 0?{length:y}:{}});i=m.ids}return{ok:!0}}function le(t,e,n,r){let s=ue(t,e,n,r);if(!s)return null;let o=[s.id],i=s.remaining.trim();for(;i.startsWith("&");){i=i.slice(1).trim();let a=ue(i,e,n,r);if(!a)break;o.push(a.id),i=a.remaining.trim()}return{ids:o,remaining:i}}function rt(t,e,n){let r=t.match(new RegExp(`^(${D})@\\s*\\{`,"u"));if(!r)return null;let s=r[1],o=t.indexOf("{",r[0].indexOf("@")),i=me(t,o);return i<0?null:(he(s,t.slice(o+1,i),e,n),{id:s,remaining:t.slice(i+1)})}function he(t,e,n,r){let s=B(e),o=s.get("label"),i=o!==void 0?$(o,!0):void 0,a=s.get("shape"),l=a!==void 0?X(a):null,u=C(s.get("icon")),d=C(s.get("img")),c=C(s.get("form")),f=c==="circle"||c==="rounded"||c==="square"?c:void 0,y=l?{shape:l.geometry,semanticShape:l.canonical,authoredShape:a.trim()}:u||d?{shape:f==="circle"?"circle":f==="rounded"?"rounded":"rectangle",semanticShape:u?"icon":"image"}:{},w={...u?{icon:u}:{},...d?{image:d}:{},...f?{iconForm:f}:{}},p=n.nodes.get(t);p?(n.nodes.set(t,{...p,...i!==void 0?{label:i.text,...i.markdown?{markdownLabel:!0}:{}}:{},...y,...w}),ye(r,t)):v(n,r,{id:t,label:i?.text??t,shape:"rectangle",...i?.markdown?{markdownLabel:!0}:{},...y,...w})}function de(t,e,n,r){if(!e.match(/^@\s*\{/))return null;let o=e.indexOf("{"),i=me(e,o);return i<0?null:(he(t,e.slice(o+1,i),n,r),e.slice(i+1))}function me(t,e){if(e<0||t[e]!=="{")return-1;let n=0,r=null,s=!1;for(let o=e;o<t.length;o++){let i=t[o];if(s){s=!1;continue}if(i==="\\"){s=!0;continue}if(r){i===r&&(r=null);continue}if(i==='"'||i==="'"){r=i;continue}if(i==="{")n++;else if(i==="}"&&(n--,n===0))return o}return-1}function B(t){let e="",n=null,r=!1;for(let l of t){if(r){r=!1,e+=" ";continue}if(l==="\\"){e+=" ",r=!0;continue}if(n){l===n&&(n=null),e+=" ";continue}if(l==='"'||l==="'"){n=l,e+=" ";continue}e+=l}let s=/(^|[,\s])([\w-]+)\s*:/g,o=[],i;for(;(i=s.exec(e))!==null;)o.push({key:i[2].toLowerCase(),keyStart:i.index+i[1].length,valueStart:i.index+i[0].length});let a=new Map;for(let l=0;l<o.length;l++){let u=l+1<o.length?o[l+1].keyStart:t.length,d=t.slice(o[l].valueStart,u).trim().replace(/,\s*$/,"").trim();a.set(o[l].key,st(d))}return a}function st(t){return t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))?t.slice(1,-1).replace(/\\([\\"'])/g,"$1"):t}var it=[{open:"(((",close:")))",shape:"doublecircle"},{open:"([",close:"])",shape:"stadium"},{open:"((",close:"))",shape:"circle"},{open:"[[",close:"]]",shape:"subroutine"},{open:"[(",close:")]",shape:"cylinder"},{open:"[/",close:"\\]",shape:"trapezoid"},{open:"[\\",close:"/]",shape:"trapezoid-alt"},{open:"[/",close:"/]",shape:"lean-r"},{open:"[\\",close:"\\]",shape:"lean-l"},{open:">",close:"]",shape:"asymmetric"},{open:"{{",close:"}}",shape:"hexagon"},{open:"[",close:"]",shape:"rectangle"},{open:"(",close:")",shape:"rounded"},{open:"{",close:"}",shape:"diamond"}];function ot(t,e,n){let r=F(t);if(!r)return null;let s=t.slice(r.length);for(let o of it){if(!s.startsWith(`${o.open}"`))continue;let i=o.open.length,a=-1,l=!1;for(let f=i+1;f<s.length;f++){let y=s[f];if(l){l=!1;continue}if(y==="\\"){l=!0;continue}if(y==='"'){a=f;break}}if(a<0||!s.startsWith(o.close,a+1))continue;let u=s.slice(i+1,a).replace(/\\(["\\])/g,"$1"),d=$(u,!0);v(e,n,{id:r.id,label:d.text,shape:o.shape,...d.markdown?{markdownLabel:!0}:{}});let c=r.length+a+1+o.close.length;return{id:r.id,remaining:t.slice(c)}}return null}function ue(t,e,n,r){let s=rt(t,e,n);if(s){let u=s.remaining,d=j(u);return d&&(e.classAssignments.set(s.id,d.className),u=u.slice(d.length)),{id:s.id,remaining:u}}let o=ot(t,e,n);if(o){let u=de(o.id,o.remaining,e,n)??o.remaining,d=j(u);return d&&(e.classAssignments.set(o.id,d.className),u=u.slice(d.length)),{id:o.id,remaining:u}}let i=null,a=t;for(let{regex:u,shape:d}of Ke){let c=t.match(u);if(c){if(et(t,c[1].length))continue;i=c[1];let{text:f,markdown:y}=$(c[2]);v(e,n,{id:i,label:f,shape:d,...y?{markdownLabel:!0}:{}}),a=t.slice(c[0].length);break}}if(i===null){let u=Ze(t);u&&(i=u.id,!e.nodes.has(i)&&!r.has(i)&&v(e,n,{id:i,label:i,shape:"rectangle"}),a=t.slice(u.length))}if(i===null)return null;a=de(i,a,e,n)??a;let l=j(a);return l&&(e.classAssignments.set(i,l.className),a=a.slice(l.length)),{id:i,remaining:a}}function v(t,e,n){!t.nodes.has(n.id)&&t.nodes.set(n.id,n),ye(e,n.id)}function ye(t,e){if(t.length>0){let n=t[t.length-1];n.nodeIds.includes(e)||n.nodeIds.push(e)}}function at(t){return t[0]==="~"?"invisible":t.includes(".")?"dotted":t.includes("=")?"thick":"solid"}function ct(t){let e;if(t[0]==="~")e=t.length-3;else if(t.includes("."))e=(t.match(/\./g)?.length??1)-1;else if(t.includes("=")){let n=t.match(/=/g)?.length??2;e=t.endsWith(">")?n-2:n-3}else{let n=t.match(/-/g)?.length??2;e=/[>ox]$/.test(t)||/^[ox]/.test(t)?n-2:n-3}return e>0?e+1:void 0}function be(t,e){return t.includes(".")||e.includes(".")?"dotted":t.includes("=")||e.includes("=")?"thick":"solid"}function lt(t,e){let n=be(t,e),r=(a,l)=>(a.match(new RegExp(`\\${l}`,"g"))??[]).length,s=0,o=0;n==="dotted"?(s=Math.max(0,r(t,".")-1),o=Math.max(0,r(e,".")-1)):n==="thick"?(s=Math.max(0,r(t,"=")-2),o=Math.max(0,r(e,"=")-(e.endsWith(">")?2:3))):(s=Math.max(0,r(t,"-")-2),o=Math.max(0,r(e,"-")-(e.endsWith(">")?2:3)));let i=Math.max(s,o);return i>0?i+1:void 0}function dt(t,e){if(e)return"arrow";if(t.startsWith("o"))return"circle";if(t.startsWith("x"))return"cross"}function ge(t){let e=t[t.length-1];if(e===">")return"arrow";if(e==="o")return"circle";if(e==="x")return"cross"}export{Nt as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as l,F as i,l as u,r as g}from"./chunk-EX6TP7QM.js";var m={default:{bg:i.bg,fg:i.fg},base:{bg:i.bg,fg:i.fg},neutral:{bg:"#ffffff",fg:"#1f2937",line:"#9ca3af",accent:"#6b7280",muted:"#6b7280"},dark:{bg:"#18181B",fg:"#FAFAFA"},forest:{bg:"#f0fdf4",fg:"#14532d",line:"#4d7c0f",accent:"#15803d",muted:"#65a30d",border:"#86efac"}},d={bg:["background","mainBkg"],fg:["primaryTextColor","textColor","nodeTextColor"],line:["lineColor","defaultLinkColor"],accent:["arrowheadColor","primaryColor"],muted:["secondaryTextColor","tertiaryTextColor"],surface:["primaryColor","nodeBkg","mainBkg"],border:["primaryBorderColor","secondaryBorderColor"]};function F(e,r,n,o=!1){let t=b(r.theme),a=r.themeVariables,s=(...c)=>{let f=C(a,...c);return o?f:l(f)};return{bg:e.bg??s(...d.bg)??t?.bg??i.bg,fg:e.fg??s(...d.fg)??t?.fg??i.fg,line:e.line??s(...d.line)??t?.line,accent:e.accent??s(...d.accent)??t?.accent,muted:e.muted??s(...d.muted)??t?.muted,surface:e.surface??s(...d.surface)??t?.surface,border:e.border??s(...d.border)??t?.border,shadow:e.shadow??t?.shadow,font:n,embedFontImport:e.embedFontImport}}function b(e){if(e)return m[e.toLowerCase()]}function C(e,...r){if(e)for(let n of r){let o=e[n];if(typeof o=="string"&&o.length>0)return o}}function M(e,r){let n,o=r.classAssignments.get(e);if(o){let a=r.classDefs.get(o);a&&(n={...a})}let t=r.nodeStyles.get(e);return t&&(n=n?{...n,...t}:{...t}),n}function v(e,r){let n,o=r.linkStyles.get("default");o&&(n={...o});let t=r.linkStyles.get(e);return t&&(n=n?{...n,...t}:{...t}),n}function p(e){let r=u(e);return r?{r:r[0],g:r[1],b:r[2]}:null}function y(e){let r=e.match(/^rgba?\(\s*(\d{1,3})(?:\s*,\s*|\s+)(\d{1,3})(?:\s*,\s*|\s+)(\d{1,3})/i);if(!r)return null;let n={r:Number.parseInt(r[1],10),g:Number.parseInt(r[2],10),b:Number.parseInt(r[3],10)};return Object.values(n).every(o=>o>=0&&o<=255)?n:null}function x(e){let r=p(e)??y(e);return r?g(r.r,r.g,r.b)>140?"#000000":"#FFFFFF":void 0}function D(e,r="var(--_text)"){return e?.color?e.color:e?.fill?x(e.fill)??r:r}export{d as a,F as b,C as c,M as d,v as e,x as f,D as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(e){return o=>e(o)}function i(e,o={}){return{positioned:e,...o}}function r(e,o){return Object.freeze({...e,...o,contractVersion:2,capabilityEvidence:Object.freeze([])})}export{t as a,i as b,r as c};
|