@specbook/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-viewer/assets/Host-Cq-4gDuM.js +41 -0
- package/dist-viewer/assets/index-BBlFcQUE.js +1 -0
- package/dist-viewer/assets/main-CSkB-O_8.js +14 -0
- package/dist-viewer/assets/{mount-CGL2tOpN.js → mount-DfwluJy4.js} +2 -2
- package/dist-viewer/assets/{panel-C8Ve3LeS.js → panel-9eYU7Gz6.js} +1 -1
- package/dist-viewer/assets/panel-hNOojwiM.css +1 -0
- package/dist-viewer/assets/registry-DIHX11uY.js +2 -0
- package/dist-viewer/assets/worker-BmvGpsJS.js +181 -0
- package/dist-viewer/index.html +4 -4
- package/dist-viewer/specbook.js +1 -1
- package/package.json +6 -5
- package/src/app.tsx +65 -12
- package/src/branding.ts +12 -4
- package/src/components/Catalog.tsx +128 -51
- package/src/components/EnvBadge.tsx +21 -3
- package/src/components/EnvironmentMenu.tsx +237 -127
- package/src/components/Fields.tsx +18 -1
- package/src/components/NewEnvironmentDialog.tsx +118 -0
- package/src/components/Palette.tsx +7 -2
- package/src/custom-environments.ts +63 -0
- package/src/embed/panel.tsx +286 -44
- package/src/embed/styles.ts +2 -0
- package/src/embed/target.ts +82 -0
- package/src/embed/theme.ts +75 -0
- package/src/embed.ts +44 -15
- package/src/engine.ts +274 -32
- package/src/environment-list.ts +16 -0
- package/src/main.tsx +7 -2
- package/src/nav.ts +12 -1
- package/src/oauth.ts +9 -8
- package/src/panel/Body.tsx +27 -4
- package/src/panel/Checks.tsx +79 -0
- package/src/panel/CodeSample.tsx +16 -9
- package/src/panel/Combo.tsx +52 -13
- package/src/panel/ControlsGrid.tsx +54 -9
- package/src/panel/ErrorBoundary.tsx +36 -0
- package/src/panel/Host.tsx +14 -2
- package/src/panel/OAuthSignIn.tsx +6 -2
- package/src/panel/Panel.tsx +43 -10
- package/src/panel/ParamGrid.tsx +15 -8
- package/src/panel/RequestPanel.tsx +91 -36
- package/src/panel/RequestView.tsx +2 -1
- package/src/panel/ResponseView.tsx +25 -14
- package/src/panel/SecretsBar.tsx +10 -9
- package/src/panel/SequenceDocs.tsx +7 -6
- package/src/panel/SequencePanel.tsx +124 -32
- package/src/panel/announce.ts +17 -0
- package/src/panel/icons.tsx +9 -0
- package/src/panel/short.ts +24 -0
- package/src/routing.ts +0 -9
- package/src/runtime.ts +19 -1
- package/src/secrets.ts +4 -2
- package/src/storage.ts +58 -0
- package/src/store.ts +8 -0
- package/src/styles/app.css +69 -6
- package/src/styles/embed.css +116 -0
- package/src/styles/panel.css +233 -0
- package/src/viewer/manifests.ts +2 -0
- package/src/viewer/protocol.ts +6 -0
- package/src/viewer/registry.ts +46 -10
- package/src/viewer/worker.ts +9 -1
- package/src/virtual.d.ts +8 -0
- package/dist-viewer/assets/Host-CSrM9wY1.js +0 -37
- package/dist-viewer/assets/index-ez9c20v3.js +0 -1
- package/dist-viewer/assets/main-38QGGpNT.js +0 -14
- package/dist-viewer/assets/panel-C-vBZrep.css +0 -1
- package/dist-viewer/assets/registry-ChKCFBt1.js +0 -2
- package/dist-viewer/assets/worker-ClGb0tE1.js +0 -181
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,o)=>(o=n==null?{}:e(i(n)),l(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var p={},m={},h={},g;function _(){if(g)return h;g=1;function e(e){return e==null}function t(e){return typeof e==`object`&&!!e}function n(t){return Array.isArray(t)?t:e(t)?[]:[t]}function r(e,t){if(t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r+=1){let i=n[r];e[i]=t[i]}}return e}function i(e,t){let n=``;for(let r=0;r<t;r+=1)n+=e;return n}function a(e){return e===0&&1/e==-1/0}return h.isNothing=e,h.isObject=t,h.toArray=n,h.repeat=i,h.isNegativeZero=a,h.extend=r,h}var v,y;function b(){if(y)return v;y=1;function e(e,t){let n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
|
|
2
|
+
|
|
3
|
+
`+e.mark.snippet),r+` `+n):r}function t(t,n){Error.call(this),this.name=`YAMLException`,this.reason=t,this.mark=n,this.message=e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(/* @__PURE__ */ Error()).stack||``}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.prototype.toString=function(t){return this.name+`: `+e(this,t)},v=t,v}var x,S;function C(){if(S)return x;S=1;let e=_();function t(e,t,n,r,i){let a=``,o=``,s=Math.floor(i/2)-1;return r-t>s&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function n(t,n){return e.repeat(` `,n-t.length)+t}function r(r,i){if(i=Object.create(i||null),!r.buffer)return null;i.maxLength||(i.maxLength=79),typeof i.indent!=`number`&&(i.indent=1),typeof i.linesBefore!=`number`&&(i.linesBefore=3),typeof i.linesAfter!=`number`&&(i.linesAfter=2);let a=/\r?\n|\r|\0/g,o=[0],s=[],c,l=-1;for(;c=a.exec(r.buffer);)s.push(c.index),o.push(c.index+c[0].length),r.position<=c.index&&l<0&&(l=o.length-2);l<0&&(l=o.length-1);let u=``,d=Math.min(r.line+i.linesAfter,s.length).toString().length,f=i.maxLength-(i.indent+d+3);for(let a=1;a<=i.linesBefore&&!(l-a<0);a++){let c=t(r.buffer,o[l-a],s[l-a],r.position-(o[l]-o[l-a]),f);u=e.repeat(` `,i.indent)+n((r.line-a+1).toString(),d)+` | `+c.str+`
|
|
4
|
+
`+u}let p=t(r.buffer,o[l],s[l],r.position,f);u+=e.repeat(` `,i.indent)+n((r.line+1).toString(),d)+` | `+p.str+`
|
|
5
|
+
`,u+=e.repeat(`-`,i.indent+d+3+p.pos)+`^
|
|
6
|
+
`;for(let a=1;a<=i.linesAfter&&!(l+a>=s.length);a++){let c=t(r.buffer,o[l+a],s[l+a],r.position-(o[l]-o[l+a]),f);u+=e.repeat(` `,i.indent)+n((r.line+a+1).toString(),d)+` | `+c.str+`
|
|
7
|
+
`}return u.replace(/\n$/,``)}return x=r,x}var w,ee;function T(){if(ee)return w;ee=1;let e=b(),t=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],n=[`scalar`,`sequence`,`mapping`];function r(e){let t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function i(i,a){if(a||={},Object.keys(a).forEach(function(n){if(t.indexOf(n)===-1)throw new e(`Unknown option "`+n+`" is met in definition of "`+i+`" YAML type.`)}),this.options=a,this.tag=i,this.kind=a.kind||null,this.resolve=a.resolve||function(){return!0},this.construct=a.construct||function(e){return e},this.instanceOf=a.instanceOf||null,this.predicate=a.predicate||null,this.represent=a.represent||null,this.representName=a.representName||null,this.defaultStyle=a.defaultStyle||null,this.multi=a.multi||!1,this.styleAliases=r(a.styleAliases||null),n.indexOf(this.kind)===-1)throw new e(`Unknown kind "`+this.kind+`" is specified for "`+i+`" YAML type.`)}return w=i,w}var te,E;function D(){if(E)return te;E=1;let e=b(),t=T();function n(e,t){let n=[];return e[t].forEach(function(e){let t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function r(){let e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function t(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(let e=0,n=arguments.length;e<n;e+=1)arguments[e].forEach(t);return e}function i(e){return this.extend(e)}return i.prototype.extend=function(a){let o=[],s=[];if(a instanceof t)s.push(a);else if(Array.isArray(a))s=s.concat(a);else if(a&&(Array.isArray(a.implicit)||Array.isArray(a.explicit)))a.implicit&&(o=o.concat(a.implicit)),a.explicit&&(s=s.concat(a.explicit));else throw new e(`Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })`);o.forEach(function(n){if(!(n instanceof t))throw new e(`Specified list of YAML types (or a single Type object) contains a non-Type object.`);if(n.loadKind&&n.loadKind!==`scalar`)throw new e(`There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.`);if(n.multi)throw new e(`There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.`)}),s.forEach(function(n){if(!(n instanceof t))throw new e(`Specified list of YAML types (or a single Type object) contains a non-Type object.`)});let c=Object.create(i.prototype);return c.implicit=(this.implicit||[]).concat(o),c.explicit=(this.explicit||[]).concat(s),c.compiledImplicit=n(c,`implicit`),c.compiledExplicit=n(c,`explicit`),c.compiledTypeMap=r(c.compiledImplicit,c.compiledExplicit),c},te=i,te}var O,k;function ne(){return k||(k=1,O=new(T())(`tag:yaml.org,2002:str`,{kind:`scalar`,construct:function(e){return e===null?``:e}})),O}var re,ie;function A(){return ie||(ie=1,re=new(T())(`tag:yaml.org,2002:seq`,{kind:`sequence`,construct:function(e){return e===null?[]:e}})),re}var j,M;function N(){return M||(M=1,j=new(T())(`tag:yaml.org,2002:map`,{kind:`mapping`,construct:function(e){return e===null?{}:e}})),j}var P,F;function I(){return F||(F=1,P=new(D())({explicit:[ne(),A(),N()]})),P}var L,R;function ae(){if(R)return L;R=1;let e=T();function t(e){if(e===null)return!0;let t=e.length;return t===1&&e===`~`||t===4&&(e===`null`||e===`Null`||e===`NULL`)}function n(){return null}function r(e){return e===null}return L=new e(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:t,construct:n,predicate:r,represent:{canonical:function(){return`~`},lowercase:function(){return`null`},uppercase:function(){return`NULL`},camelcase:function(){return`Null`},empty:function(){return``}},defaultStyle:`lowercase`}),L}var z,oe;function se(){if(oe)return z;oe=1;let e=T();function t(e){if(e===null)return!1;let t=e.length;return t===4&&(e===`true`||e===`True`||e===`TRUE`)||t===5&&(e===`false`||e===`False`||e===`FALSE`)}function n(e){return e===`true`||e===`True`||e===`TRUE`}function r(e){return Object.prototype.toString.call(e)===`[object Boolean]`}return z=new e(`tag:yaml.org,2002:bool`,{kind:`scalar`,resolve:t,construct:n,predicate:r,represent:{lowercase:function(e){return e?`true`:`false`},uppercase:function(e){return e?`TRUE`:`FALSE`},camelcase:function(e){return e?`True`:`False`}},defaultStyle:`lowercase`}),z}var ce,le;function ue(){if(le)return ce;le=1;let e=_(),t=T();function n(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function r(e){return e>=48&&e<=55}function i(e){return e>=48&&e<=57}function a(e){if(e===null)return!1;let t=e.length,a=0,s=!1;if(!t)return!1;let c=e[a];if((c===`-`||c===`+`)&&(c=e[++a]),c===`0`){if(a+1===t)return!0;if(c=e[++a],c===`b`){for(a++;a<t;a++){if(c=e[a],c!==`0`&&c!==`1`)return!1;s=!0}return s&&isFinite(o(e))}if(c===`x`){for(a++;a<t;a++){if(!n(e.charCodeAt(a)))return!1;s=!0}return s&&isFinite(o(e))}if(c===`o`){for(a++;a<t;a++){if(!r(e.charCodeAt(a)))return!1;s=!0}return s&&isFinite(o(e))}}for(;a<t;a++){if(!i(e.charCodeAt(a)))return!1;s=!0}return s?isFinite(o(e)):!1}function o(e){let t=e,n=1,r=t[0];if((r===`-`||r===`+`)&&(r===`-`&&(n=-1),t=t.slice(1),r=t[0]),t===`0`)return 0;if(r===`0`){if(t[1]===`b`)return n*parseInt(t.slice(2),2);if(t[1]===`x`)return n*parseInt(t.slice(2),16);if(t[1]===`o`)return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function s(e){return o(e)}function c(t){return Object.prototype.toString.call(t)===`[object Number]`&&t%1==0&&!e.isNegativeZero(t)}return ce=new t(`tag:yaml.org,2002:int`,{kind:`scalar`,resolve:a,construct:s,predicate:c,represent:{binary:function(e){return e>=0?`0b`+e.toString(2):`-0b`+e.toString(2).slice(1)},octal:function(e){return e>=0?`0o`+e.toString(8):`-0o`+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?`0x`+e.toString(16).toUpperCase():`-0x`+e.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}}),ce}var de,fe;function pe(){if(fe)return de;fe=1;let e=_(),t=T(),n=/* @__PURE__ */ RegExp(`^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),r=/* @__PURE__ */ RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function i(e){return e===null||!n.test(e)?!1:isFinite(parseFloat(e,10))?!0:r.test(e)}function a(e){let t=e.toLowerCase(),n=t[0]===`-`?-1:1;return`+-`.indexOf(t[0])>=0&&(t=t.slice(1)),t===`.inf`?n===1?1/0:-1/0:t===`.nan`?NaN:n*parseFloat(t,10)}let o=/^[-+]?[0-9]+e/;function s(t,n){if(isNaN(t))switch(n){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(t===1/0)switch(n){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(t===-1/0)switch(n){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(e.isNegativeZero(t))return`-0.0`;let r=t.toString(10);return o.test(r)?r.replace(`e`,`.e`):r}function c(t){return Object.prototype.toString.call(t)===`[object Number]`&&(t%1!=0||e.isNegativeZero(t))}return de=new t(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:i,construct:a,predicate:c,represent:s,defaultStyle:`lowercase`}),de}var me,he;function ge(){return he||(he=1,me=I().extend({implicit:[ae(),se(),ue(),pe()]})),me}var _e,ve;function ye(){return ve||(ve=1,_e=ge()),_e}var be,xe;function Se(){if(xe)return be;xe=1;let e=T(),t=/* @__PURE__ */ RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),n=/* @__PURE__ */ RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function r(e){return e===null?!1:t.exec(e)!==null||n.exec(e)!==null}function i(e){let r=0,i=null,a=t.exec(e);if(a===null&&(a=n.exec(e)),a===null)throw Error(`Date resolve error`);let o=+a[1],s=a[2]-1,c=+a[3];if(!a[4])return new Date(Date.UTC(o,s,c));let l=+a[4],u=+a[5],d=+a[6];if(a[7]){for(r=a[7].slice(0,3);r.length<3;)r+=`0`;r=+r}if(a[9]){let e=+a[10],t=+(a[11]||0);i=(e*60+t)*6e4,a[9]===`-`&&(i=-i)}let f=new Date(Date.UTC(o,s,c,l,u,d,r));return i&&f.setTime(f.getTime()-i),f}function a(e){return e.toISOString()}return be=new e(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:r,construct:i,instanceOf:Date,represent:a}),be}var Ce,we;function Te(){if(we)return Ce;we=1;let e=T();function t(e){return e===`<<`||e===null}return Ce=new e(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:t}),Ce}var Ee,De;function Oe(){if(De)return Ee;De=1;let e=T();function t(e){if(e===null)return!1;let t=0,n=e.length;for(let r=0;r<n;r++){let n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
8
|
+
\r`.indexOf(e.charAt(r));if(!(n>64)){if(n<0)return!1;t+=6}}return t%8==0}function n(e){let t=e.replace(/[\r\n=]/g,``),n=t.length,r=0,i=[];for(let e=0;e<n;e++)e%4==0&&e&&(i.push(r>>16&255),i.push(r>>8&255),i.push(r&255)),r=r<<6|`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
9
|
+
\r`.indexOf(t.charAt(e));let a=n%4*6;return a===0?(i.push(r>>16&255),i.push(r>>8&255),i.push(r&255)):a===18?(i.push(r>>10&255),i.push(r>>2&255)):a===12&&i.push(r>>4&255),new Uint8Array(i)}function r(e){let t=``,n=0,r=e.length,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
10
|
+
\r`;for(let a=0;a<r;a++)a%3==0&&a&&(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]),n=(n<<8)+e[a];let a=r%3;return a===0?(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]):a===2?(t+=i[n>>10&63],t+=i[n>>4&63],t+=i[n<<2&63],t+=i[64]):a===1&&(t+=i[n>>2&63],t+=i[n<<4&63],t+=i[64],t+=i[64]),t}function i(e){return Object.prototype.toString.call(e)===`[object Uint8Array]`}return Ee=new e(`tag:yaml.org,2002:binary`,{kind:`scalar`,resolve:t,construct:n,predicate:i,represent:r}),Ee}var ke,Ae;function je(){if(Ae)return ke;Ae=1;let e=T(),t=Object.prototype.hasOwnProperty,n=Object.prototype.toString;function r(e){if(e===null)return!0;let r={},i=e;for(let e=0,a=i.length;e<a;e+=1){let a=i[e],o=!1;if(n.call(a)!==`[object Object]`)return!1;let s;for(s in a)if(t.call(a,s)){if(!o)o=!0;else return!1}if(!o||t.call(r,s))return!1;Object.defineProperty(r,s,{value:!0})}return!0}function i(e){return e===null?[]:e}return ke=new e(`tag:yaml.org,2002:omap`,{kind:`sequence`,resolve:r,construct:i}),ke}var Me,Ne;function Pe(){if(Ne)return Me;Ne=1;let e=T(),t=Object.prototype.toString;function n(e){if(e===null)return!0;let n=e,r=Array(n.length);for(let e=0,i=n.length;e<i;e+=1){let i=n[e];if(t.call(i)!==`[object Object]`)return!1;let a=Object.keys(i);if(a.length!==1)return!1;r[e]=[a[0],i[a[0]]]}return!0}function r(e){if(e===null)return[];let t=e,n=Array(t.length);for(let e=0,r=t.length;e<r;e+=1){let r=t[e],i=Object.keys(r);n[e]=[i[0],r[i[0]]]}return n}return Me=new e(`tag:yaml.org,2002:pairs`,{kind:`sequence`,resolve:n,construct:r}),Me}var Fe,Ie;function Le(){if(Ie)return Fe;Ie=1;let e=T(),t=Object.prototype.hasOwnProperty;function n(e){if(e===null)return!0;let n=e;for(let e in n)if(t.call(n,e)&&n[e]!==null)return!1;return!0}function r(e){return e===null?{}:e}return Fe=new e(`tag:yaml.org,2002:set`,{kind:`mapping`,resolve:n,construct:r}),Fe}var Re,ze;function Be(){return ze||(ze=1,Re=ye().extend({implicit:[Se(),Te()],explicit:[Oe(),je(),Pe(),Le()]})),Re}var Ve;function He(){if(Ve)return m;Ve=1;let e=_(),t=b(),n=C(),r=Be(),i=Object.prototype.hasOwnProperty,a=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=/[\x85\u2028\u2029]/,s=/[,\[\]{}]/,c=/^(?:!|!!|![0-9A-Za-z-]+!)$/,l=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function u(e){return Object.prototype.toString.call(e)}function d(e){return e===10||e===13}function f(e){return e===9||e===32}function p(e){return e===9||e===32||e===10||e===13}function h(e){return e===44||e===91||e===93||e===123||e===125}function g(e){if(e>=48&&e<=57)return e-48;let t=e|32;return t>=97&&t<=102?t-97+10:-1}function v(e){return e===120?2:e===117?4:e===85?8:0}function y(e){return e>=48&&e<=57?e-48:-1}function x(e){switch(e){case 48:return`\0`;case 97:return`\x07`;case 98:return`\b`;case 116:return` `;case 9:return` `;case 110:return`
|
|
11
|
+
`;case 118:return`\v`;case 102:return`\f`;case 114:return`\r`;case 101:return`\x1B`;case 32:return` `;case 34:return`"`;case 47:return`/`;case 92:return`\\`;case 78:return`
`;case 95:return`\xA0`;case 76:return`\u2028`;case 80:return`\u2029`;default:return``}}function S(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function w(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}let ee=Array(256),T=Array(256);for(let e=0;e<256;e++)ee[e]=+!!x(e),T[e]=x(e);function te(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||r,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:100,this.maxTotalMergeKeys=typeof t.maxTotalMergeKeys==`number`?t.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function E(e,r){let i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=n(i),new t(r,i)}function D(e,t){throw E(e,t)}function O(e,t){e.onWarning&&e.onWarning.call(null,E(e,t))}function k(e,t,n){let r=e.anchorMapTransactions;if(r.length!==0){let n=r[r.length-1];i.call(n,t)||(n[t]={existed:i.call(e.anchorMap,t),value:e.anchorMap[t]})}e.anchorMap[t]=n}function ne(e){e.anchorMapTransactions.push(/* @__PURE__ */ Object.create(null))}function re(e){let t=e.anchorMapTransactions.pop(),n=e.anchorMapTransactions;if(n.length===0)return;let r=n[n.length-1],a=Object.keys(t);for(let e=0,n=a.length;e<n;e+=1){let n=a[e];i.call(r,n)||(r[n]=t[n])}}function ie(e){let t=e.anchorMapTransactions.pop(),n=Object.keys(t);for(let r=n.length-1;r>=0;--r){let i=t[n[r]];i.existed?e.anchorMap[n[r]]=i.value:delete e.anchorMap[n[r]]}}function A(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function j(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.tag=t.tag,e.anchor=t.anchor,e.kind=t.kind,e.result=t.result}let M={YAML:function(e,t,n){e.version!==null&&D(e,`duplication of %YAML directive`),n.length!==1&&D(e,`YAML directive accepts exactly one argument`);let r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);r===null&&D(e,`ill-formed argument of the YAML directive`);let i=parseInt(r[1],10),a=parseInt(r[2],10);i!==1&&D(e,`unacceptable YAML version of the document`),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&O(e,`unsupported YAML version of the document`)},TAG:function(e,t,n){let r;n.length!==2&&D(e,`TAG directive accepts exactly two arguments`);let a=n[0];r=n[1],c.test(a)||D(e,`ill-formed tag handle (first argument) of the TAG directive`),i.call(e.tagMap,a)&&D(e,`there is a previously declared suffix for "`+a+`" tag handle`),l.test(r)||D(e,`ill-formed tag prefix (second argument) of the TAG directive`);try{r=decodeURIComponent(r)}catch{D(e,`tag prefix is malformed: `+r)}e.tagMap[a]=r}};function N(e,t,n,r){if(t<n){let i=e.input.slice(t,n);if(r)for(let t=0,n=i.length;t<n;t+=1){let n=i.charCodeAt(t);n===9||n>=32&&n<=1114111||D(e,`expected valid JSON character`)}else a.test(i)&&D(e,`the stream contains non-printable characters`);e.result+=i}}function P(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&D(e,`merge keys exceeded maxTotalMergeKeys (`+e.maxTotalMergeKeys+`)`)}function F(t,n,r,a){e.isObject(r)||D(t,`cannot merge mappings; the provided source object is unacceptable`),P(t);let o=Object.keys(r);for(let e=0,s=o.length;e<s;e+=1){let s=o[e];P(t),i.call(n,s)||(w(n,s,r[s]),a[s]=!0)}}function I(e,t,n,r,a,o,s,c,l){if(Array.isArray(a)){a=Array.prototype.slice.call(a);for(let t=0,n=a.length;t<n;t+=1)Array.isArray(a[t])&&D(e,`nested arrays are not supported inside keys`),typeof a==`object`&&u(a[t])===`[object Object]`&&(a[t]=`[object Object]`)}if(typeof a==`object`&&u(a)===`[object Object]`&&(a=`[object Object]`),a=String(a),t===null&&(t={}),r===`tag:yaml.org,2002:merge`){if(Array.isArray(o)){o.length>100&&D(e,`abnormal merge sequence size`);for(let r=0,i=o.length;r<i;r+=1)F(e,t,o[r],n)}else F(e,t,o,n)}else!e.json&&!i.call(n,a)&&i.call(t,a)&&(e.line=s||e.line,e.lineStart=c||e.lineStart,e.position=l||e.position,D(e,`duplicated mapping key`)),w(t,a,o),delete n[a];return t}function L(e){let t=e.input.charCodeAt(e.position);t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):D(e,`a line break is expected`),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function R(e,t,n){let r=0,i=e.input.charCodeAt(e.position);for(;i!==0;){for(;f(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(d(i))for(L(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&O(e,`deficient indentation`),r}function ae(e){let t=e.position,n=e.input.charCodeAt(t);return!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||p(n)))}function z(t,n){n===1?t.result+=` `:n>1&&(t.result+=e.repeat(`
|
|
12
|
+
`,n-1))}function oe(e,t,n){let r,i,a,o,s,c,l=e.kind,u=e.result,m=e.input.charCodeAt(e.position);if(p(m)||h(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96)return!1;if(m===63||m===45){let t=e.input.charCodeAt(e.position+1);if(p(t)||n&&h(t))return!1}for(e.kind=`scalar`,e.result=``,r=i=e.position,a=!1;m!==0;){if(m===58){let t=e.input.charCodeAt(e.position+1);if(p(t)||n&&h(t))break}else if(m===35){if(p(e.input.charCodeAt(e.position-1)))break}else if(e.position===e.lineStart&&ae(e)||n&&h(m))break;else if(d(m)){if(o=e.line,s=e.lineStart,c=e.lineIndent,R(e,!1,-1),e.lineIndent>=t){a=!0,m=e.input.charCodeAt(e.position);continue}e.position=i,e.line=o,e.lineStart=s,e.lineIndent=c;break}a&&=(N(e,r,i,!1),z(e,e.line-o),r=i=e.position,!1),f(m)||(i=e.position+1),m=e.input.charCodeAt(++e.position)}return N(e,r,i,!1),e.result?!0:(e.kind=l,e.result=u,!1)}function se(e,t){let n,r,i=e.input.charCodeAt(e.position);if(i!==39)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39){if(N(e,n,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)n=e.position,e.position++,r=e.position;else return!0}else d(i)?(N(e,n,r,!0),z(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&ae(e)?D(e,`unexpected end of the document within a single quoted scalar`):(e.position++,f(i)||(r=e.position));D(e,`unexpected end of the stream within a single quoted scalar`)}function ce(e,t){let n,r,i,a=e.input.charCodeAt(e.position);if(a!==34)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(a=e.input.charCodeAt(e.position))!==0;)if(a===34)return N(e,n,e.position,!0),e.position++,!0;else if(a===92){if(N(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),d(a))R(e,!1,t);else if(a<256&&ee[a])e.result+=T[a],e.position++;else if((i=v(a))>0){let t=i,n=0;for(;t>0;t--)a=e.input.charCodeAt(++e.position),(i=g(a))>=0?n=(n<<4)+i:D(e,`expected hexadecimal character`);e.result+=S(n),e.position++}else D(e,`unknown escape sequence`);n=r=e.position}else d(a)?(N(e,n,r,!0),z(e,R(e,!1,t)),n=r=e.position):e.position===e.lineStart&&ae(e)?D(e,`unexpected end of the document within a double quoted scalar`):(e.position++,f(a)||(r=e.position));D(e,`unexpected end of the stream within a double quoted scalar`)}function le(e,t){let n=!0,r,i,a,o=e.tag,s,c=e.anchor,l,u,d,f,m=/* @__PURE__ */ Object.create(null),h,g,_,v=e.input.charCodeAt(e.position);if(v===91)l=93,f=!1,s=[];else if(v===123)l=125,f=!0,s={};else return!1;for(e.anchor!==null&&k(e,e.anchor,s),v=e.input.charCodeAt(++e.position);v!==0;){if(R(e,!0,t),v=e.input.charCodeAt(e.position),v===l)return e.position++,e.tag=o,e.anchor=c,e.kind=f?`mapping`:`sequence`,e.result=s,!0;n?v===44&&D(e,`expected the node content, but found ','`):D(e,`missed comma between flow collection entries`),g=h=_=null,u=d=!1,v===63&&p(e.input.charCodeAt(e.position+1))&&(u=d=!0,e.position++,R(e,!0,t)),r=e.line,i=e.lineStart,a=e.position,_e(e,t,1,!1,!0),g=e.tag,h=e.result,R(e,!0,t),v=e.input.charCodeAt(e.position),(d||e.line===r)&&v===58&&(u=!0,v=e.input.charCodeAt(++e.position),R(e,!0,t),_e(e,t,1,!1,!0),_=e.result),f?I(e,s,m,g,h,_,r,i,a):u?s.push(I(e,null,m,g,h,_,r,i,a)):s.push(h),R(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}D(e,`unexpected end of the stream within a flow collection`)}function ue(t,n){let r,i=1,a=!1,o=!1,s=n,c=0,l=!1,u,p=t.input.charCodeAt(t.position);if(p===124)r=!1;else if(p===62)r=!0;else return!1;for(t.kind=`scalar`,t.result=``;p!==0;)if(p=t.input.charCodeAt(++t.position),p===43||p===45)i===1?i=p===43?3:2:D(t,`repeat of a chomping mode identifier`);else if((u=y(p))>=0)u===0?D(t,`bad explicit indentation width of a block scalar; it cannot be less than one`):o?D(t,`repeat of an indentation width identifier`):(s=n+u-1,o=!0);else break;if(f(p)){do p=t.input.charCodeAt(++t.position);while(f(p));if(p===35)do p=t.input.charCodeAt(++t.position);while(!d(p)&&p!==0)}for(;p!==0;){for(L(t),t.lineIndent=0,p=t.input.charCodeAt(t.position);(!o||t.lineIndent<s)&&p===32;)t.lineIndent++,p=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>s&&(s=t.lineIndent),d(p)){c++;continue}if(!o&&s===0&&D(t,`missing indentation for block scalar`),t.lineIndent<s){i===3?t.result+=e.repeat(`
|
|
13
|
+
`,a?1+c:c):i===1&&a&&(t.result+=`
|
|
14
|
+
`);break}r?f(p)?(l=!0,t.result+=e.repeat(`
|
|
15
|
+
`,a?1+c:c)):l?(l=!1,t.result+=e.repeat(`
|
|
16
|
+
`,c+1)):c===0?a&&(t.result+=` `):t.result+=e.repeat(`
|
|
17
|
+
`,c):t.result+=e.repeat(`
|
|
18
|
+
`,a?1+c:c),a=!0,o=!0,c=0;let n=t.position;for(;!d(p)&&p!==0;)p=t.input.charCodeAt(++t.position);N(t,n,t.position,!1)}return!0}function de(e,t){let n=e.tag,r=e.anchor,i=[],a=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&k(e,e.anchor,i);let o=e.input.charCodeAt(e.position);for(;o!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,D(e,`tab characters must not be used in indentation`)),o===45&&p(e.input.charCodeAt(e.position+1)));){if(a=!0,e.position++,R(e,!0,-1)&&e.lineIndent<=t){i.push(null),o=e.input.charCodeAt(e.position);continue}let n=e.line;if(_e(e,t,3,!1,!0),i.push(e.result),R(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&o!==0)D(e,`bad indentation of a sequence entry`);else if(e.lineIndent<t)break}return a?(e.tag=n,e.anchor=r,e.kind=`sequence`,e.result=i,!0):!1}function fe(e,t,n){let r,i,a,o,s=e.tag,c=e.anchor,l={},u=/* @__PURE__ */ Object.create(null),d=null,m=null,h=null,g=!1,_=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&k(e,e.anchor,l);let v=e.input.charCodeAt(e.position);for(;v!==0;){!g&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,D(e,`tab characters must not be used in indentation`));let y=e.input.charCodeAt(e.position+1),b=e.line;if((v===63||v===58)&&p(y))v===63?(g&&(I(e,l,u,d,m,null,i,a,o),d=m=h=null),_=!0,g=!0,r=!0):g?(g=!1,r=!0):D(e,`incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line`),e.position+=1,v=y;else{if(i=e.line,a=e.lineStart,o=e.position,!_e(e,n,2,!1,!0))break;if(e.line===b){for(v=e.input.charCodeAt(e.position);f(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),p(v)||D(e,`a whitespace character is expected after the key-value separator within a block mapping`),g&&(I(e,l,u,d,m,null,i,a,o),d=m=h=null),_=!0,g=!1,r=!1,d=e.tag,m=e.result;else if(_)D(e,`can not read an implicit mapping pair; a colon is missed`);else return e.tag=s,e.anchor=c,!0}else if(_)D(e,`can not read a block mapping entry; a multiline key may not be an implicit key`);else return e.tag=s,e.anchor=c,!0}if((e.line===b||e.lineIndent>t)&&(g&&(i=e.line,a=e.lineStart,o=e.position),_e(e,t,4,!0,r)&&(g?m=e.result:h=e.result),g||(I(e,l,u,d,m,h,i,a,o),d=m=h=null),R(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===b||e.lineIndent>t)&&v!==0)D(e,`bad indentation of a mapping entry`);else if(e.lineIndent<t)break}return g&&I(e,l,u,d,m,null,i,a,o),_&&(e.tag=s,e.anchor=c,e.kind=`mapping`,e.result=l),_}function pe(e){let t=!1,n=!1,r,a,o=e.input.charCodeAt(e.position);if(o!==33)return!1;e.tag!==null&&D(e,`duplication of a tag property`),o=e.input.charCodeAt(++e.position),o===60?(t=!0,o=e.input.charCodeAt(++e.position)):o===33?(n=!0,r=`!!`,o=e.input.charCodeAt(++e.position)):r=`!`;let u=e.position;if(t){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(a=e.input.slice(u,e.position),o=e.input.charCodeAt(++e.position)):D(e,`unexpected end of the stream within a verbatim tag`)}else{for(;o!==0&&!p(o);)o===33&&(n?D(e,`tag suffix cannot contain exclamation marks`):(r=e.input.slice(u-1,e.position+1),c.test(r)||D(e,`named tag handle cannot contain such characters`),n=!0,u=e.position+1)),o=e.input.charCodeAt(++e.position);a=e.input.slice(u,e.position),s.test(a)&&D(e,`tag suffix cannot contain flow indicator characters`)}a&&!l.test(a)&&D(e,`tag name cannot contain such characters: `+a);try{a=decodeURIComponent(a)}catch{D(e,`tag name is malformed: `+a)}return t?e.tag=a:i.call(e.tagMap,r)?e.tag=e.tagMap[r]+a:r===`!`?e.tag=`!`+a:r===`!!`?e.tag=`tag:yaml.org,2002:`+a:D(e,`undeclared tag handle "`+r+`"`),!0}function me(e){let t=e.input.charCodeAt(e.position);if(t!==38)return!1;e.anchor!==null&&D(e,`duplication of an anchor property`),t=e.input.charCodeAt(++e.position);let n=e.position;for(;t!==0&&!p(t)&&!h(t);)t=e.input.charCodeAt(++e.position);return e.position===n&&D(e,`name of an anchor node must contain at least one character`),e.anchor=e.input.slice(n,e.position),!0}function he(e){let t=e.input.charCodeAt(e.position);if(t!==42)return!1;t=e.input.charCodeAt(++e.position);let n=e.position;for(;t!==0&&!p(t)&&!h(t);)t=e.input.charCodeAt(++e.position);e.position===n&&D(e,`name of an alias node must contain at least one character`);let r=e.input.slice(n,e.position);return i.call(e.anchorMap,r)||D(e,`unidentified alias "`+r+`"`),e.result=e.anchorMap[r],R(e,!0,-1),!0}function ge(e,t,n,r){let i=A(e);return ne(e),j(e,t),e.tag=null,e.anchor=null,e.kind=null,e.result=null,fe(e,n,r)&&e.kind===`mapping`?(re(e),!0):(ie(e),j(e,i),!1)}function _e(e,t,n,r,a){let o,s,c=1,l=!1,u=!1,d=null,f,p,m;e.depth>=e.maxDepth&&D(e,`nesting exceeded maxDepth (`+e.maxDepth+`)`),e.depth+=1,e.listener!==null&&e.listener(`open`,e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;let h=o=s=n===4||n===3;if(r&&R(e,!0,-1)&&(l=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;;){let n=e.input.charCodeAt(e.position),r=A(e);if(l&&(n===33&&e.tag!==null||n===38&&e.anchor!==null)||!pe(e)&&!me(e))break;d===null&&(d=r),R(e,!0,-1)?(l=!0,s=h,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):s=!1}if(s&&=l||a,c===1||n===4){if(p=n===1||n===2?t:t+1,m=e.position-e.lineStart,c===1){if(s&&(de(e,m)||fe(e,m,p))||le(e,p))u=!0;else{let t=e.input.charCodeAt(e.position);d!==null&&h&&!s&&t!==124&&t!==62&&ge(e,d,d.position-d.lineStart,p)||o&&ue(e,p)||se(e,p)||ce(e,p)?u=!0:he(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&D(e,`alias node should not have any properties`)):oe(e,p,n===1)&&(u=!0,e.tag===null&&(e.tag=`?`)),e.anchor!==null&&k(e,e.anchor,e.result)}}else c===0&&(u=s&&de(e,m))}if(e.tag===null)e.anchor!==null&&k(e,e.anchor,e.result);else if(e.tag===`?`){e.result!==null&&e.kind!==`scalar`&&D(e,`unacceptable node kind for !<?> tag; it should be "scalar", not "`+e.kind+`"`);for(let t=0,n=e.implicitTypes.length;t<n;t+=1)if(f=e.implicitTypes[t],f.resolve(e.result)){e.result=f.construct(e.result),e.tag=f.tag,e.anchor!==null&&k(e,e.anchor,e.result);break}}else if(e.tag!==`!`){if(i.call(e.typeMap[e.kind||`fallback`],e.tag))f=e.typeMap[e.kind||`fallback`][e.tag];else{f=null;let t=e.typeMap.multi[e.kind||`fallback`];for(let n=0,r=t.length;n<r;n+=1)if(e.tag.slice(0,t[n].tag.length)===t[n].tag){f=t[n];break}}f||D(e,`unknown tag !<`+e.tag+`>`),e.result!==null&&f.kind!==e.kind&&D(e,`unacceptable node kind for !<`+e.tag+`> tag; it should be "`+f.kind+`", not "`+e.kind+`"`),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),e.anchor!==null&&k(e,e.anchor,e.result)):D(e,`cannot resolve a node with !<`+e.tag+`> explicit tag`)}return e.listener!==null&&e.listener(`close`,e),--e.depth,e.tag!==null||e.anchor!==null||u}function ve(e){let t=e.position,n=!1,r;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=/* @__PURE__ */ Object.create(null),e.anchorMap=/* @__PURE__ */ Object.create(null);(r=e.input.charCodeAt(e.position))!==0&&(R(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||r!==37));){n=!0,r=e.input.charCodeAt(++e.position);let t=e.position;for(;r!==0&&!p(r);)r=e.input.charCodeAt(++e.position);let a=e.input.slice(t,e.position),o=[];for(a.length<1&&D(e,`directive name must not be less than one character in length`);r!==0;){for(;f(r);)r=e.input.charCodeAt(++e.position);if(r===35){do r=e.input.charCodeAt(++e.position);while(r!==0&&!d(r));break}if(d(r))break;for(t=e.position;r!==0&&!p(r);)r=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}r!==0&&L(e),i.call(M,a)?M[a](e,a,o):O(e,`unknown document directive "`+a+`"`)}R(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,R(e,!0,-1)):n&&D(e,`directives end mark is expected`),_e(e,e.lineIndent-1,4,!1,!0),R(e,!0,-1),e.checkLineBreaks&&o.test(e.input.slice(t,e.position))&&O(e,`non-ASCII line breaks are interpreted as content`),e.documents.push(e.result),e.position===e.lineStart&&ae(e)?e.input.charCodeAt(e.position)===46&&(e.position+=3,R(e,!0,-1)):e.position<e.length-1&&D(e,`end of the stream or a document separator is expected`)}function ye(e,t){e=String(e),t||={},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
19
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));let n=new te(e,t),r=e.indexOf(`\0`);for(r!==-1&&(n.position=r,D(n,`null byte is not allowed in input`)),n.input+=`\0`;n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)ve(n);return n.documents}function be(e,t,n){typeof t==`object`&&t&&n===void 0&&(n=t,t=null);let r=ye(e,n);if(typeof t!=`function`)return r;for(let e=0,n=r.length;e<n;e+=1)t(r[e])}function xe(e,n){let r=ye(e,n);if(r.length!==0){if(r.length===1)return r[0];throw new t(`expected a single document in the stream, but found more`)}}return m.loadAll=be,m.load=xe,m}var Ue={},We;function Ge(){if(We)return Ue;We=1;let e=_(),t=b(),n=Be(),r=Object.prototype.toString,i=Object.prototype.hasOwnProperty,a=65279,o={};o[0]=`\\0`,o[7]=`\\a`,o[8]=`\\b`,o[9]=`\\t`,o[10]=`\\n`,o[11]=`\\v`,o[12]=`\\f`,o[13]=`\\r`,o[27]=`\\e`,o[34]=`\\"`,o[92]=`\\\\`,o[133]=`\\N`,o[160]=`\\_`,o[8232]=`\\L`,o[8233]=`\\P`;let s=[`y`,`Y`,`yes`,`Yes`,`YES`,`on`,`On`,`ON`,`n`,`N`,`no`,`No`,`NO`,`off`,`Off`,`OFF`],c=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function l(e,t){if(t===null)return{};let n={},r=Object.keys(t);for(let a=0,o=r.length;a<o;a+=1){let o=r[a],s=String(t[o]);o.slice(0,2)===`!!`&&(o=`tag:yaml.org,2002:`+o.slice(2));let c=e.compiledTypeMap.fallback[o];c&&i.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[o]=s}return n}function u(n){let r,i,a=n.toString(16).toUpperCase();if(n<=255)r=`x`,i=2;else if(n<=65535)r=`u`,i=4;else if(n<=4294967295)r=`U`,i=8;else throw new t(`code point within a string may not be greater than 0xFFFFFFFF`);return`\\`+r+e.repeat(`0`,i-a.length)+a}function d(t){this.schema=t.schema||n,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=e.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=l(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType===`"`?2:1,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer==`function`?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result=``,this.duplicates=[],this.usedDuplicates=null}function f(t,n){let r=e.repeat(` `,n),i=0,a=``,o=t.length;for(;i<o;){let e,n=t.indexOf(`
|
|
20
|
+
`,i);n===-1?(e=t.slice(i),i=o):(e=t.slice(i,n+1),i=n+1),e.length&&e!==`
|
|
21
|
+
`&&(a+=r),a+=e}return a}function p(t,n){return`
|
|
22
|
+
`+e.repeat(` `,t.indent*n)}function m(e,t){for(let n=0,r=e.implicitTypes.length;n<r;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}function h(e){return e===32||e===9}function g(e){return e>=32&&e<=126||e>=161&&e<=55295&&e!==8232&&e!==8233||e>=57344&&e<=65533&&e!==a||e>=65536&&e<=1114111}function v(e){return g(e)&&e!==a&&e!==13&&e!==10}function y(e,t,n){let r=v(e),i=r&&!h(e);return(n?r:r&&e!==44&&e!==91&&e!==93&&e!==123&&e!==125)&&e!==35&&!(t===58&&!i)||v(t)&&!h(t)&&e===35||t===58&&i}function x(e){return g(e)&&e!==a&&!h(e)&&e!==45&&e!==63&&e!==58&&e!==44&&e!==91&&e!==93&&e!==123&&e!==125&&e!==35&&e!==38&&e!==42&&e!==33&&e!==124&&e!==61&&e!==62&&e!==39&&e!==34&&e!==37&&e!==64&&e!==96}function S(e){return!h(e)&&e!==58}function C(e,t){let n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function w(e){return/^\n* /.test(e)}function ee(e,t,n,r,i,a,o,s){let c,l=0,u=null,d=!1,f=!1,p=r!==-1,m=-1,h=x(C(e,0))&&S(C(e,e.length-1));if(t||o)for(c=0;c<e.length;l>=65536?c+=2:c++){if(l=C(e,c),!g(l))return 5;h&&=y(l,u,s),u=l}else{for(c=0;c<e.length;l>=65536?c+=2:c++){if(l=C(e,c),l===10)d=!0,p&&(f||=c-m-1>r&&e[m+1]!==` `,m=c);else if(!g(l))return 5;h&&=y(l,u,s),u=l}f||=p&&c-m-1>r&&e[m+1]!==` `}return!d&&!f?h&&!o&&!i(e)?1:a===2?5:2:n>9&&w(e)?5:o?a===2?5:2:f?4:3}function T(e,n,r,i,a){e.dump=(function(){if(n.length===0)return e.quotingType===2?`""`:`''`;if(!e.noCompatMode&&(s.indexOf(n)!==-1||c.test(n)))return e.quotingType===2?`"`+n+`"`:`'`+n+`'`;let o=e.indent*Math.max(1,r),l=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),u=i||e.flowLevel>-1&&r>=e.flowLevel;function d(t){return m(e,t)}switch(ee(n,u,e.indent,l,d,e.quotingType,e.forceQuotes&&!i,a)){case 1:return n;case 2:return`'`+n.replace(/'/g,`''`)+`'`;case 3:return`|`+te(n,e.indent)+E(f(n,o));case 4:return`>`+te(n,e.indent)+E(f(D(n,l),o));case 5:return`"`+k(n)+`"`;default:throw new t(`impossible error: invalid scalar style`)}})()}function te(e,t){let n=w(e)?String(t):``,r=e[e.length-1]===`
|
|
23
|
+
`;return n+(r&&(e[e.length-2]===`
|
|
24
|
+
`||e===`
|
|
25
|
+
`)?`+`:r?``:`-`)+`
|
|
26
|
+
`}function E(e){return e[e.length-1]===`
|
|
27
|
+
`?e.slice(0,-1):e}function D(e,t){let n=/(\n+)([^\n]*)/g,r=(function(){let r=e.indexOf(`
|
|
28
|
+
`);return r=r===-1?e.length:r,n.lastIndex=r,O(e.slice(0,r),t)})(),i=e[0]===`
|
|
29
|
+
`||e[0]===` `,a,o;for(;o=n.exec(e);){let e=o[1],n=o[2];a=n[0]===` `,r+=e+(!i&&!a&&n!==``?`
|
|
30
|
+
`:``)+O(n,t),i=a}return r}function O(e,t){if(e===``||e[0]===` `)return e;let n=/ [^ ]/g,r,i=0,a,o=0,s=0,c=``;for(;r=n.exec(e);)s=r.index,s-i>t&&(a=o>i?o:s,c+=`
|
|
31
|
+
`+e.slice(i,a),i=a+1),o=s;return c+=`
|
|
32
|
+
`,e.length-i>t&&o>i?c+=e.slice(i,o)+`
|
|
33
|
+
`+e.slice(o+1):c+=e.slice(i),c.slice(1)}function k(e){let t=``,n=0;for(let r=0;r<e.length;n>=65536?r+=2:r++){n=C(e,r);let i=o[n];!i&&g(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||u(n)}return t}function ne(e,t,n){let r=``,i=e.tag;for(let i=0,a=n.length;i<a;i+=1){let a=n[i];e.replacer&&(a=e.replacer.call(n,String(i),a)),(M(e,t,a,!1,!1)||a===void 0&&M(e,t,null,!1,!1))&&(r!==``&&(r+=`,`+(e.condenseFlow?``:` `)),r+=e.dump)}e.tag=i,e.dump=`[`+r+`]`}function re(e,t,n,r){let i=``,a=e.tag;for(let a=0,o=n.length;a<o;a+=1){let o=n[a];e.replacer&&(o=e.replacer.call(n,String(a),o)),(M(e,t+1,o,!0,!0,!1,!0)||o===void 0&&M(e,t+1,null,!0,!0,!1,!0))&&((!r||i!==``)&&(i+=p(e,t)),e.dump&&e.dump.charCodeAt(0)===10?i+=`-`:i+=`- `,i+=e.dump)}e.tag=a,e.dump=i||`[]`}function ie(e,t,n){let r=``,i=e.tag,a=Object.keys(n);for(let i=0,o=a.length;i<o;i+=1){let o=``;r!==``&&(o+=`, `),e.condenseFlow&&(o+=`"`);let s=a[i],c=n[s];e.replacer&&(c=e.replacer.call(n,s,c)),M(e,t,s,!1,!1)&&(e.dump.length>1024&&(o+=`? `),o+=e.dump+(e.condenseFlow?`"`:``)+`:`+(e.condenseFlow?``:` `),M(e,t,c,!1,!1)&&(o+=e.dump,r+=o))}e.tag=i,e.dump=`{`+r+`}`}function A(e,n,r,i){let a=``,o=e.tag,s=Object.keys(r);if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys==`function`)s.sort(e.sortKeys);else if(e.sortKeys)throw new t(`sortKeys must be a boolean or a function`);for(let t=0,o=s.length;t<o;t+=1){let o=``;(!i||a!==``)&&(o+=p(e,n));let c=s[t],l=r[c];if(e.replacer&&(l=e.replacer.call(r,c,l)),!M(e,n+1,c,!0,!0,!0))continue;let u=e.tag!==null&&e.tag!==`?`||e.dump&&e.dump.length>1024;u&&(e.dump&&e.dump.charCodeAt(0)===10?o+=`?`:o+=`? `),o+=e.dump,u&&(o+=p(e,n)),M(e,n+1,l,!0,u)&&(e.dump&&e.dump.charCodeAt(0)===10?o+=`:`:o+=`: `,o+=e.dump,a+=o)}e.tag=o,e.dump=a||`{}`}function j(e,n,a){let o=a?e.explicitTypes:e.implicitTypes;for(let s=0,c=o.length;s<c;s+=1){let c=o[s];if((c.instanceOf||c.predicate)&&(!c.instanceOf||typeof n==`object`&&n instanceof c.instanceOf)&&(!c.predicate||c.predicate(n))){if(e.tag=a?c.multi&&c.representName?c.representName(n):c.tag:`?`,c.represent){let a=e.styleMap[c.tag]||c.defaultStyle,o;if(r.call(c.represent)===`[object Function]`)o=c.represent(n,a);else if(i.call(c.represent,a))o=c.represent[a](n,a);else throw new t(`!<`+c.tag+`> tag resolver accepts not "`+a+`" style`);e.dump=o}return!0}}return!1}function M(e,n,i,a,o,s,c){e.tag=null,e.dump=i,j(e,i,!1)||j(e,i,!0);let l=r.call(e.dump),u=a;a&&=e.flowLevel<0||e.flowLevel>n;let d=l===`[object Object]`||l===`[object Array]`,f,p;if(d&&(f=e.duplicates.indexOf(i),p=f!==-1),(e.tag!==null&&e.tag!==`?`||p||e.indent!==2&&n>0)&&(o=!1),p&&e.usedDuplicates[f])e.dump=`*ref_`+f;else{if(d&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),l===`[object Object]`)a&&Object.keys(e.dump).length!==0?(A(e,n,e.dump,o),p&&(e.dump=`&ref_`+f+e.dump)):(ie(e,n,e.dump),p&&(e.dump=`&ref_`+f+` `+e.dump));else if(l===`[object Array]`)a&&e.dump.length!==0?(e.noArrayIndent&&!c&&n>0?re(e,n-1,e.dump,o):re(e,n,e.dump,o),p&&(e.dump=`&ref_`+f+e.dump)):(ne(e,n,e.dump),p&&(e.dump=`&ref_`+f+` `+e.dump));else if(l===`[object String]`)e.tag!==`?`&&T(e,e.dump,n,s,u);else if(l===`[object Undefined]`)return!1;else{if(e.skipInvalid)return!1;throw new t(`unacceptable kind of an object to dump `+l)}if(e.tag!==null&&e.tag!==`?`){let t=encodeURI(e.tag[0]===`!`?e.tag.slice(1):e.tag).replace(/!/g,`%21`);t=e.tag[0]===`!`?`!`+t:t.slice(0,18)===`tag:yaml.org,2002:`?`!!`+t.slice(18):`!<`+t+`>`,e.dump=t+` `+e.dump}}return!0}function N(e,t){let n=[],r=[];P(e,n,r);let i=r.length;for(let e=0;e<i;e+=1)t.duplicates.push(n[r[e]]);t.usedDuplicates=Array(i)}function P(e,t,n){if(typeof e==`object`&&e){let r=t.indexOf(e);if(r!==-1)n.indexOf(r)===-1&&n.push(r);else if(t.push(e),Array.isArray(e))for(let r=0,i=e.length;r<i;r+=1)P(e[r],t,n);else{let r=Object.keys(e);for(let i=0,a=r.length;i<a;i+=1)P(e[r[i]],t,n)}}}function F(e,t){t||={};let n=new d(t);n.noRefs||N(e,n);let r=e;return n.replacer&&(r=n.replacer.call({"":r},``,r)),M(n,0,r,!0,!0)?n.dump+`
|
|
34
|
+
`:``}return Ue.dump=F,Ue}var Ke;function qe(){if(Ke)return p;Ke=1;let e=He(),t=Ge();function n(e,t){return function(){throw Error(`Function yaml.`+e+` is removed in js-yaml 4. Use yaml.`+t+` instead, which is now safe by default.`)}}return p.Type=T(),p.Schema=D(),p.FAILSAFE_SCHEMA=I(),p.JSON_SCHEMA=ge(),p.CORE_SCHEMA=ye(),p.DEFAULT_SCHEMA=Be(),p.load=e.load,p.loadAll=e.loadAll,p.dump=t.dump,p.YAMLException=b(),p.types={binary:Oe(),float:pe(),map:N(),null:ae(),pairs:Pe(),set:Le(),timestamp:Se(),bool:se(),int:ue(),merge:Te(),omap:je(),seq:A(),str:ne()},p.safeLoad=n(`safeLoad`,`load`),p.safeLoadAll=n(`safeLoadAll`,`loadAll`),p.safeDump=n(`safeDump`,`dump`),p}const{Type:Je,Schema:Ye,FAILSAFE_SCHEMA:Xe,JSON_SCHEMA:Ze,CORE_SCHEMA:Qe,DEFAULT_SCHEMA:$e,load:et,loadAll:tt,dump:nt,YAMLException:rt,types:it,safeLoad:at,safeLoadAll:ot,safeDump:st}=/* @__PURE__ */ f(qe());var ct=/* @__PURE__ */ c({default:()=>ut,dirname:()=>mt,fileURLToPath:()=>_t,join:()=>ht,parse:()=>gt,pathToFileURL:()=>vt,promises:()=>ft,readFileSync:()=>dt,resolve:()=>pt}),lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt=o((()=>{lt=()=>{throw Error(`not available in the browser`)},ut={},dt=lt,ft={},pt=(...e)=>e.join(`/`),mt=e=>e,ht=(...e)=>e.join(`/`),gt=e=>({protocol:``,host:``,pathname:e}),_t=e=>e,vt=e=>e})),bt=/* @__PURE__ */ s(((e,t)=>{function n(){return typeof process==`object`&&typeof process.nextTick==`function`?process.nextTick:typeof setImmediate==`function`?setImmediate:function(e){setTimeout(e,0)}}t.exports=n()})),xt=/* @__PURE__ */ s(((e,t)=>{var n=bt();t.exports=function(e,t){if(e)t.then(function(t){n(function(){e(null,t)})},function(t){n(function(){e(t)})});else return t}}));function St(e){let t=[0],n=e.indexOf(`
|
|
35
|
+
`);for(;n!==-1;)n+=1,t.push(n),n=e.indexOf(`
|
|
36
|
+
`,n);return t}function Ct(e){let t,n;return typeof e==`string`?(t=St(e),n=e):(Array.isArray(e)&&(e=e[0]),e&&e.context&&(e.lineStarts||(e.lineStarts=St(e.context.src)),t=e.lineStarts,n=e.context.src)),{lineStarts:t,src:n}}function wt(e,t){if(typeof e!=`number`||e<0)return null;let{lineStarts:n,src:r}=Ct(t);if(!n||!r||e>r.length)return null;for(let t=0;t<n.length;++t){let r=n[t];if(e<r)return{line:t,col:e-n[t-1]+1};if(e===r)return{line:t+1,col:1}}let i=n.length;return{line:i,col:e-n[i-1]+1}}function Tt(e,t){let{lineStarts:n,src:r}=Ct(t);if(!n||!(e>=1)||e>n.length)return null;let i=n[e-1],a=n[e];for(;a&&a>i&&r[a-1]===`
|
|
37
|
+
`;)--a;return r.slice(i,a)}function Et({start:e,end:t},n,r=80){let i=Tt(e.line,n);if(!i)return null;let{col:a}=e;if(i.length>r){if(a<=r-10)i=i.substr(0,r-1)+`…`;else{let e=Math.round(r/2);i.length>a+e&&(i=i.substr(0,a+e-1)+`…`),a-=i.length-r,i=`…`+i.substr(1-r)}}let o=1,s=``;t&&(t.line===e.line&&a+(t.col-e.col)<=r+1?o=t.col-e.col:(o=Math.min(i.length+1,r)-a,s=`…`));let c=a>1?` `.repeat(a-1):``,l=`^`.repeat(o);return`${i}\n${c}${l}${s}`}function B(e,t,n){return(t=Ot(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dt(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ot(e){var t=Dt(e,`string`);return typeof t==`symbol`?t:t+``}var V,H,kt,At,U,W,jt,Mt,G,K,Nt,Pt,Ft=o((()=>{V={ANCHOR:`&`,COMMENT:`#`,TAG:`!`,DIRECTIVES_END:`-`,DOCUMENT_END:`.`},H={ALIAS:`ALIAS`,BLANK_LINE:`BLANK_LINE`,BLOCK_FOLDED:`BLOCK_FOLDED`,BLOCK_LITERAL:`BLOCK_LITERAL`,COMMENT:`COMMENT`,DIRECTIVE:`DIRECTIVE`,DOCUMENT:`DOCUMENT`,FLOW_MAP:`FLOW_MAP`,FLOW_SEQ:`FLOW_SEQ`,MAP:`MAP`,MAP_KEY:`MAP_KEY`,MAP_VALUE:`MAP_VALUE`,PLAIN:`PLAIN`,QUOTE_DOUBLE:`QUOTE_DOUBLE`,QUOTE_SINGLE:`QUOTE_SINGLE`,SEQ:`SEQ`,SEQ_ITEM:`SEQ_ITEM`},kt=`tag:yaml.org,2002:`,At={MAP:`tag:yaml.org,2002:map`,SEQ:`tag:yaml.org,2002:seq`,STR:`tag:yaml.org,2002:str`},U=class e{static copy(t){return new e(t.start,t.end)}constructor(e,t){this.start=e,this.end=t||e}isEmpty(){return typeof this.start!=`number`||!this.end||this.end<=this.start}setOrigRange(e,t){let{start:n,end:r}=this;if(e.length===0||r<=e[0])return this.origStart=n,this.origEnd=r,t;let i=t;for(;i<e.length&&!(e[i]>n);)++i;this.origStart=n+i;let a=i;for(;i<e.length&&!(e[i]>=r);)++i;return this.origEnd=r+i,a}},W=class e{static addStringTerminator(t,n,r){if(r[r.length-1]===`
|
|
38
|
+
`)return r;let i=e.endOfWhiteSpace(t,n);return i>=t.length||t[i]===`
|
|
39
|
+
`?r+`
|
|
40
|
+
`:r}static atDocumentBoundary(e,t,n){let r=e[t];if(!r)return!0;let i=e[t-1];if(i&&i!==`
|
|
41
|
+
`)return!1;if(n){if(r!==n)return!1}else if(r!==V.DIRECTIVES_END&&r!==V.DOCUMENT_END)return!1;let a=e[t+1],o=e[t+2];if(a!==r||o!==r)return!1;let s=e[t+3];return!s||s===`
|
|
42
|
+
`||s===` `||s===` `}static endOfIdentifier(e,t){let n=e[t],r=n===`<`,i=r?[`
|
|
43
|
+
`,` `,` `,`>`]:[`
|
|
44
|
+
`,` `,` `,`[`,`]`,`{`,`}`,`,`];for(;n&&i.indexOf(n)===-1;)n=e[t+=1];return r&&n===`>`&&(t+=1),t}static endOfIndent(e,t){let n=e[t];for(;n===` `;)n=e[t+=1];return t}static endOfLine(e,t){let n=e[t];for(;n&&n!==`
|
|
45
|
+
`;)n=e[t+=1];return t}static endOfWhiteSpace(e,t){let n=e[t];for(;n===` `||n===` `;)n=e[t+=1];return t}static startOfLine(e,t){let n=e[t-1];if(n===`
|
|
46
|
+
`)return t;for(;n&&n!==`
|
|
47
|
+
`;)n=e[--t];return t+1}static endOfBlockIndent(t,n,r){let i=e.endOfIndent(t,r);if(i>r+n)return i;{let n=e.endOfWhiteSpace(t,i),r=t[n];if(!r||r===`
|
|
48
|
+
`)return n}return null}static atBlank(e,t,n){let r=e[t];return r===`
|
|
49
|
+
`||r===` `||r===` `||n&&!r}static nextNodeIsIndented(e,t,n){return!e||t<0?!1:t>0||n&&e===`-`}static normalizeOffset(t,n){let r=t[n];return r?r!==`
|
|
50
|
+
`&&t[n-1]===`
|
|
51
|
+
`?n-1:e.endOfWhiteSpace(t,n):n}static foldNewline(t,n,r){let i=0,a=!1,o=``,s=t[n+1];for(;s===` `||s===` `||s===`
|
|
52
|
+
`;){switch(s){case`
|
|
53
|
+
`:i=0,n+=1,o+=`
|
|
54
|
+
`;break;case` `:i<=r&&(a=!0),n=e.endOfWhiteSpace(t,n+2)-1;break;case` `:i+=1,n+=1}s=t[n+1]}return o||=` `,s&&i<=r&&(a=!0),{fold:o,offset:n,error:a}}constructor(e,t,n){Object.defineProperty(this,"context",{value:n||null,writable:!0}),this.error=null,this.range=null,this.valueRange=null,this.props=t||[],this.type=e,this.value=null}getPropValue(e,t,n){if(!this.context)return null;let{src:r}=this.context,i=this.props[e];return i&&r[i.start]===t?r.slice(i.start+ +!!n,i.end):null}get anchor(){for(let e=0;e<this.props.length;++e){let t=this.getPropValue(e,V.ANCHOR,!0);if(t!=null)return t}return null}get comment(){let e=[];for(let t=0;t<this.props.length;++t){let n=this.getPropValue(t,V.COMMENT,!0);n!=null&&e.push(n)}return e.length>0?e.join(`
|
|
55
|
+
`):null}commentHasRequiredWhitespace(t){let{src:n}=this.context;if(this.header&&t===this.header.end||!this.valueRange)return!1;let{end:r}=this.valueRange;return t!==r||e.atBlank(n,r-1)}get hasComment(){if(this.context){let{src:e}=this.context;for(let t=0;t<this.props.length;++t)if(e[this.props[t].start]===V.COMMENT)return!0}return!1}get hasProps(){if(this.context){let{src:e}=this.context;for(let t=0;t<this.props.length;++t)if(e[this.props[t].start]!==V.COMMENT)return!0}return!1}get includesTrailingLines(){return!1}get jsonLike(){return[H.FLOW_MAP,H.FLOW_SEQ,H.QUOTE_DOUBLE,H.QUOTE_SINGLE].indexOf(this.type)!==-1}get rangeAsLinePos(){if(!this.range||!this.context)return;let e=wt(this.range.start,this.context.root);if(e)return{start:e,end:wt(this.range.end,this.context.root)}}get rawValue(){if(!this.valueRange||!this.context)return null;let{start:e,end:t}=this.valueRange;return this.context.src.slice(e,t)}get tag(){for(let e=0;e<this.props.length;++e){let t=this.getPropValue(e,V.TAG,!1);if(t!=null){if(t[1]===`<`)return{verbatim:t.slice(2,-1)};{let[e,n,r]=t.match(/^(.*!)([^!]*)$/);return{handle:n,suffix:r}}}}return null}get valueRangeContainsNewline(){if(!this.valueRange||!this.context)return!1;let{start:e,end:t}=this.valueRange,{src:n}=this.context;for(let r=e;r<t;++r)if(n[r]===`
|
|
56
|
+
`)return!0;return!1}parseComment(t){let{src:n}=this.context;if(n[t]===V.COMMENT){let r=e.endOfLine(n,t+1),i=new U(t,r);return this.props.push(i),r}return t}setOrigRanges(e,t){return this.range&&(t=this.range.setOrigRange(e,t)),this.valueRange&&this.valueRange.setOrigRange(e,t),this.props.forEach(n=>n.setOrigRange(e,t)),t}toString(){let{context:{src:t},range:n,value:r}=this;if(r!=null)return r;let i=t.slice(n.start,n.end);return e.addStringTerminator(t,n.end,i)}},jt=class extends Error{constructor(e,t,n){if(!n||!(t instanceof W))throw Error(`Invalid arguments for new ${e}`);super(),this.name=e,this.message=n,this.source=t}makePretty(){if(!this.source)return;this.nodeType=this.source.type;let e=this.source.context&&this.source.context.root;if(typeof this.offset==`number`){this.range=new U(this.offset,this.offset+1);let t=e&&wt(this.offset,e);if(t){let e={line:t.line,col:t.col+1};this.linePos={start:t,end:e}}delete this.offset}else this.range=this.source.range,this.linePos=this.source.rangeAsLinePos;if(this.linePos){let{line:t,col:n}=this.linePos.start;this.message+=` at line ${t}, column ${n}`;let r=e&&Et(this.linePos,e);r&&(this.message+=`:\n\n${r}\n`)}delete this.source}},Mt=class extends jt{constructor(e,t){super(`YAMLReferenceError`,e,t)}},G=class extends jt{constructor(e,t){super(`YAMLSemanticError`,e,t)}},K=class extends jt{constructor(e,t){super(`YAMLSyntaxError`,e,t)}},Nt=class extends jt{constructor(e,t){super(`YAMLWarning`,e,t)}},Pt=class e extends W{static endOfLine(e,t,n){let r=e[t],i=t;for(;r&&r!==`
|
|
57
|
+
`&&(!n||r!==`[`&&r!==`]`&&r!==`{`&&r!==`}`&&r!==`,`);){let t=e[i+1];if(r===`:`&&(!t||t===`
|
|
58
|
+
`||t===` `||t===` `||n&&t===`,`)||(r===` `||r===` `)&&t===`#`)break;i+=1,r=t}return i}get strValue(){if(!this.valueRange||!this.context)return null;let{start:e,end:t}=this.valueRange,{src:n}=this.context,r=n[t-1];for(;e<t&&(r===`
|
|
59
|
+
`||r===` `||r===` `);)r=n[--t-1];let i=``;for(let r=e;r<t;++r){let e=n[r];if(e===`
|
|
60
|
+
`){let{fold:e,offset:t}=W.foldNewline(n,r,-1);i+=e,r=t}else if(e===` `||e===` `){let a=r,o=n[r+1];for(;r<t&&(o===` `||o===` `);)r+=1,o=n[r+1];o!==`
|
|
61
|
+
`&&(i+=r>a?n.slice(a,r+1):e)}else i+=e}let a=n[e];switch(a){case` `:return{errors:[new G(this,`Plain value cannot start with a tab character`)],str:i};case`@`:case"`":{let e=`Plain value cannot start with reserved character ${a}`;return{errors:[new G(this,e)],str:i}}default:return i}}parseBlockValue(t){let{indent:n,inFlow:r,src:i}=this.context,a=t,o=t;for(let t=i[a];t===`
|
|
62
|
+
`&&!W.atDocumentBoundary(i,a+1);t=i[a]){let t=W.endOfBlockIndent(i,n,a+1);if(t===null||i[t]===`#`)break;i[t]===`
|
|
63
|
+
`?a=t:(o=e.endOfLine(i,t,r),a=o)}return this.valueRange.isEmpty()&&(this.valueRange.start=t),this.valueRange.end=o,o}parse(t,n){this.context=t;let{inFlow:r,src:i}=t,a=n,o=i[a];return o&&o!==`#`&&o!==`
|
|
64
|
+
`&&(a=e.endOfLine(i,n,r)),this.valueRange=new U(n,a),a=W.endOfWhiteSpace(i,a),a=this.parseComment(a),(!this.hasComment||this.valueRange.isEmpty())&&(a=this.parseBlockValue(a)),a}}}));function It(e){let t=e;for(;t instanceof Bt;)t=t.node;if(!(t instanceof Ht))return null;let n=t.items.length,r=-1;for(let e=n-1;e>=0;--e){let n=t.items[e];if(n.type===H.COMMENT){let{indent:t,lineStart:i}=n.context;if(t>0&&n.range.start>=i+t)break;r=e}else if(n.type===H.BLANK_LINE)r=e;else break}if(r===-1)return null;let i=t.items.splice(r,n-r),a=i[0].range.start;for(;t.range.end=a,t.valueRange&&t.valueRange.end>a&&(t.valueRange.end=a),t!==e;)t=t.context.parent;return i}function Lt(e,t){switch(e){case H.ALIAS:return new Gt(e,t);case H.BLOCK_FOLDED:case H.BLOCK_LITERAL:return new qt(e,t);case H.FLOW_MAP:case H.FLOW_SEQ:return new Jt(e,t);case H.MAP_KEY:case H.MAP_VALUE:case H.SEQ_ITEM:return new Bt(e,t);case H.COMMENT:case H.PLAIN:return new Pt(e,t);case H.QUOTE_DOUBLE:return new Yt(e,t);case H.QUOTE_SINGLE:return new Xt(e,t);
|
|
65
|
+
/* istanbul ignore next */
|
|
66
|
+
default:return null}}function Rt(e){let t=[];e.indexOf(`\r`)!==-1&&(e=e.replace(/\r\n?/g,(e,n)=>(e.length>1&&t.push(n),`
|
|
67
|
+
`)));let n=[],r=0;do{let t=new Wt,i=new Zt({src:e});r=t.parse(i,r),n.push(t)}while(r<e.length);return n.setOrigRanges=()=>{if(t.length===0)return!1;for(let e=1;e<t.length;++e)t[e]-=e;let e=0;for(let r=0;r<n.length;++r)e=n[r].setOrigRanges(t,e);return t.splice(0,t.length),!0},n.toString=()=>n.join(`...
|
|
68
|
+
`),n}var zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt=o((()=>{Ft(),zt=class extends W{constructor(){super(H.BLANK_LINE)}
|
|
69
|
+
/* istanbul ignore next */
|
|
70
|
+
get includesTrailingLines(){return!0}parse(e,t){return this.context=e,this.range=new U(t,t+1),t+1}},Bt=class extends W{constructor(e,t){super(e,t),this.node=null}get includesTrailingLines(){return!!this.node&&this.node.includesTrailingLines}parse(e,t){this.context=e;let{parseNode:n,src:r}=e,{atLineStart:i,lineStart:a}=e;!i&&this.type===H.SEQ_ITEM&&(this.error=new G(this,`Sequence items must not have preceding content on the same line`));let o=i?t-a:e.indent,s=W.endOfWhiteSpace(r,t+1),c=r[s],l=c===`#`,u=[],d=null;for(;c===`
|
|
71
|
+
`||c===`#`;){if(c===`#`){let e=W.endOfLine(r,s+1);u.push(new U(s,e)),s=e}else i=!0,a=s+1,r[W.endOfWhiteSpace(r,a)]===`
|
|
72
|
+
`&&u.length===0&&(d=new zt,a=d.parse({src:r},a)),s=W.endOfIndent(r,a);c=r[s]}if(W.nextNodeIsIndented(c,s-(a+o),this.type!==H.SEQ_ITEM)?this.node=n({atLineStart:i,inCollection:!1,indent:o,lineStart:a,parent:this},s):c&&a>t+1&&(s=a-1),this.node){if(d){let t=e.parent.items||e.parent.contents;t&&t.push(d)}u.length&&Array.prototype.push.apply(this.props,u),s=this.node.range.end}else if(l){let e=u[0];this.props.push(e),s=e.end}else s=W.endOfLine(r,t+1);let f=this.node?this.node.valueRange.end:s;return this.valueRange=new U(t,f),s}setOrigRanges(e,t){return t=super.setOrigRanges(e,t),this.node?this.node.setOrigRanges(e,t):t}toString(){let{context:{src:e},node:t,range:n,value:r}=this;if(r!=null)return r;let i=t?e.slice(n.start,t.range.start)+String(t):e.slice(n.start,n.end);return W.addStringTerminator(e,n.end,i)}},Vt=class extends W{constructor(){super(H.COMMENT)}parse(e,t){this.context=e;let n=this.parseComment(t);return this.range=new U(t,n),n}},Ht=class e extends W{static nextContentHasIndent(t,n,r){let i=W.endOfLine(t,n)+1;n=W.endOfWhiteSpace(t,i);let a=t[n];return a?n>=i+r?!0:a!==`#`&&a!==`
|
|
73
|
+
`?!1:e.nextContentHasIndent(t,n,r):!1}constructor(e){super(e.type===H.SEQ_ITEM?H.SEQ:H.MAP);for(let t=e.props.length-1;t>=0;--t)if(e.props[t].start<e.context.lineStart){this.props=e.props.slice(0,t+1),e.props=e.props.slice(t+1);let n=e.props[0]||e.valueRange;e.range.start=n.start;break}this.items=[e];let t=It(e);t&&Array.prototype.push.apply(this.items,t)}get includesTrailingLines(){return this.items.length>0}parse(t,n){this.context=t;let{parseNode:r,src:i}=t,a=W.startOfLine(i,n),o=this.items[0];o.context.parent=this,this.valueRange=U.copy(o.valueRange);let s=o.range.start-o.context.lineStart,c=n;c=W.normalizeOffset(i,c);let l=i[c],u=W.endOfWhiteSpace(i,a)===c,d=!1;for(;l;){for(;l===`
|
|
74
|
+
`||l===`#`;){if(u&&l===`
|
|
75
|
+
`&&!d){let e=new zt;if(c=e.parse({src:i},c),this.valueRange.end=c,c>=i.length){l=null;break}this.items.push(e),--c}else if(l===`#`){if(c<a+s&&!e.nextContentHasIndent(i,c,s))return c;let t=new Vt;if(c=t.parse({indent:s,lineStart:a,src:i},c),this.items.push(t),this.valueRange.end=c,c>=i.length){l=null;break}}if(a=c+1,c=W.endOfIndent(i,a),W.atBlank(i,c)){let e=W.endOfWhiteSpace(i,c),t=i[e];(!t||t===`
|
|
76
|
+
`||t===`#`)&&(c=e)}l=i[c],u=!0}if(!l)break;if(c!==a+s&&(u||l!==`:`)){if(c<a+s){a>n&&(c=a);break}this.error||=new K(this,`All collection items must start at the same column`)}if(o.type===H.SEQ_ITEM){if(l!==`-`){a>n&&(c=a);break}}else if(l===`-`&&!this.error){let e=i[c+1];(!e||e===`
|
|
77
|
+
`||e===` `||e===` `)&&(this.error=new K(this,`A collection cannot be both a mapping and a sequence`))}let t=r({atLineStart:u,inCollection:!0,indent:s,lineStart:a,parent:this},c);if(!t)return c;if(this.items.push(t),this.valueRange.end=t.valueRange.end,c=W.normalizeOffset(i,t.range.end),l=i[c],u=!1,d=t.includesTrailingLines,l){let e=c-1,t=i[e];for(;t===` `||t===` `;)t=i[--e];t===`
|
|
78
|
+
`&&(a=e+1,u=!0)}let f=It(t);f&&Array.prototype.push.apply(this.items,f)}return c}setOrigRanges(e,t){return t=super.setOrigRanges(e,t),this.items.forEach(n=>{t=n.setOrigRanges(e,t)}),t}toString(){let{context:{src:e},items:t,range:n,value:r}=this;if(r!=null)return r;let i=e.slice(n.start,t[0].range.start)+String(t[0]);for(let e=1;e<t.length;++e){let n=t[e],{atLineStart:r,indent:a}=n.context;if(r)for(let e=0;e<a;++e)i+=` `;i+=String(n)}return W.addStringTerminator(e,n.end,i)}},Ut=class extends W{constructor(){super(H.DIRECTIVE),this.name=null}get parameters(){let e=this.rawValue;return e?e.trim().split(/[ \t]+/):[]}parseName(e){let{src:t}=this.context,n=e,r=t[n];for(;r&&r!==`
|
|
79
|
+
`&&r!==` `&&r!==` `;)r=t[n+=1];return this.name=t.slice(e,n),n}parseParameters(e){let{src:t}=this.context,n=e,r=t[n];for(;r&&r!==`
|
|
80
|
+
`&&r!==`#`;)r=t[n+=1];return this.valueRange=new U(e,n),n}parse(e,t){this.context=e;let n=this.parseName(t+1);return n=this.parseParameters(n),n=this.parseComment(n),this.range=new U(t,n),n}},Wt=class e extends W{static startCommentOrEndBlankLine(e,t){let n=W.endOfWhiteSpace(e,t),r=e[n];return r===`#`||r===`
|
|
81
|
+
`?n:t}constructor(){super(H.DOCUMENT),this.directives=null,this.contents=null,this.directivesEndMarker=null,this.documentEndMarker=null}parseDirectives(t){let{src:n}=this.context;this.directives=[];let r=!0,i=!1,a=t;for(;!W.atDocumentBoundary(n,a,V.DIRECTIVES_END);)switch(a=e.startCommentOrEndBlankLine(n,a),n[a]){case`
|
|
82
|
+
`:if(r){let e=new zt;a=e.parse({src:n},a),a<n.length&&this.directives.push(e)}else a+=1,r=!0;break;case`#`:{let e=new Vt;a=e.parse({src:n},a),this.directives.push(e),r=!1}break;case`%`:{let e=new Ut;a=e.parse({parent:this,src:n},a),this.directives.push(e),i=!0,r=!1}break;default:return i?this.error=new G(this,`Missing directives-end indicator line`):this.directives.length>0&&(this.contents=this.directives,this.directives=[]),a}return n[a]?(this.directivesEndMarker=new U(a,a+3),a+3):(i?this.error=new G(this,`Missing directives-end indicator line`):this.directives.length>0&&(this.contents=this.directives,this.directives=[]),a)}parseContents(t){let{parseNode:n,src:r}=this.context;this.contents||=[];let i=t;for(;r[i-1]===`-`;)--i;let a=W.endOfWhiteSpace(r,t),o=i===t;for(this.valueRange=new U(a);!W.atDocumentBoundary(r,a,V.DOCUMENT_END);){switch(r[a]){case`
|
|
83
|
+
`:if(o){let e=new zt;a=e.parse({src:r},a),a<r.length&&this.contents.push(e)}else a+=1,o=!0;i=a;break;case`#`:{let e=new Vt;a=e.parse({src:r},a),this.contents.push(e),o=!1}break;default:{let e=W.endOfIndent(r,a),t=n({atLineStart:o,indent:-1,inFlow:!1,inCollection:!1,lineStart:i,parent:this},e);if(!t)return this.valueRange.end=e;this.contents.push(t),a=t.range.end,o=!1;let s=It(t);s&&Array.prototype.push.apply(this.contents,s)}}a=e.startCommentOrEndBlankLine(r,a)}if(this.valueRange.end=a,r[a]&&(this.documentEndMarker=new U(a,a+3),a+=3,r[a])){if(a=W.endOfWhiteSpace(r,a),r[a]===`#`){let e=new Vt;a=e.parse({src:r},a),this.contents.push(e)}switch(r[a]){case`
|
|
84
|
+
`:a+=1;break;case void 0:break;default:this.error=new K(this,`Document end marker line cannot have a non-comment suffix`)}}return a}parse(e,t){e.root=this,this.context=e;let{src:n}=e,r=n.charCodeAt(t)===65279?t+1:t;return r=this.parseDirectives(r),r=this.parseContents(r),r}setOrigRanges(e,t){return t=super.setOrigRanges(e,t),this.directives.forEach(n=>{t=n.setOrigRanges(e,t)}),this.directivesEndMarker&&(t=this.directivesEndMarker.setOrigRange(e,t)),this.contents.forEach(n=>{t=n.setOrigRanges(e,t)}),this.documentEndMarker&&(t=this.documentEndMarker.setOrigRange(e,t)),t}toString(){let{contents:e,directives:t,value:n}=this;if(n!=null)return n;let r=t.join(``);return e.length>0&&((t.length>0||e[0].type===H.COMMENT)&&(r+=`---
|
|
85
|
+
`),r+=e.join(``)),r[r.length-1]!==`
|
|
86
|
+
`&&(r+=`
|
|
87
|
+
`),r}},Gt=class extends W{parse(e,t){this.context=e;let{src:n}=e,r=W.endOfIdentifier(n,t+1);return this.valueRange=new U(t+1,r),r=W.endOfWhiteSpace(n,r),r=this.parseComment(r),r}},Kt={CLIP:`CLIP`,KEEP:`KEEP`,STRIP:`STRIP`},qt=class extends W{constructor(e,t){super(e,t),this.blockIndent=null,this.chomping=Kt.CLIP,this.header=null}get includesTrailingLines(){return this.chomping===Kt.KEEP}get strValue(){if(!this.valueRange||!this.context)return null;let{start:e,end:t}=this.valueRange,{indent:n,src:r}=this.context;if(this.valueRange.isEmpty())return``;let i=null,a=r[t-1];for(;a===`
|
|
88
|
+
`||a===` `||a===` `;){if(--t,t<=e){if(this.chomping===Kt.KEEP)break;return``}a===`
|
|
89
|
+
`&&(i=t),a=r[t-1]}let o=t+1;i&&(this.chomping===Kt.KEEP?(o=i,t=this.valueRange.end):t=i);let s=n+this.blockIndent,c=this.type===H.BLOCK_FOLDED,l=!0,u=``,d=``,f=!1;for(let n=e;n<t;++n){for(let e=0;e<s&&r[n]===` `;++e)n+=1;let e=r[n];if(e===`
|
|
90
|
+
`)d===`
|
|
91
|
+
`?u+=`
|
|
92
|
+
`:d=`
|
|
93
|
+
`;else{let i=W.endOfLine(r,n),a=r.slice(n,i);n=i,c&&(e===` `||e===` `)&&n<o?(d===` `?d=`
|
|
94
|
+
`:!f&&!l&&d===`
|
|
95
|
+
`&&(d=`
|
|
96
|
+
|
|
97
|
+
`),u+=d+a,d=i<t&&r[i]||``,f=!0):(u+=d+a,d=c&&n<o?` `:`
|
|
98
|
+
`,f=!1),l&&a!==``&&(l=!1)}}return this.chomping===Kt.STRIP?u:u+`
|
|
99
|
+
`}parseBlockHeader(e){let{src:t}=this.context,n=e+1,r=``;for(;;){let i=t[n];switch(i){case`-`:this.chomping=Kt.STRIP;break;case`+`:this.chomping=Kt.KEEP;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:r+=i;break;default:return this.blockIndent=Number(r)||null,this.header=new U(e,n),n}n+=1}}parseBlockValue(e){let{indent:t,src:n}=this.context,r=!!this.blockIndent,i=e,a=e,o=1;for(let e=n[i];e===`
|
|
100
|
+
`&&(i+=1,!W.atDocumentBoundary(n,i));e=n[i]){let e=W.endOfBlockIndent(n,t,i);if(e===null)break;let s=n[e],c=e-(i+t);if(!this.blockIndent)n[e]===`
|
|
101
|
+
`?c>o&&(o=c):(c<o&&(this.error=new G(this,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`)),this.blockIndent=c);else if(s&&s!==`
|
|
102
|
+
`&&c<this.blockIndent){if(n[e]===`#`)break;if(!this.error){let e=`Block scalars must not be less indented than their ${r?`explicit indentation indicator`:`first line`}`;this.error=new G(this,e)}}i=n[e]===`
|
|
103
|
+
`?e:a=W.endOfLine(n,e)}return this.chomping!==Kt.KEEP&&(i=n[a]?a+1:a),this.valueRange=new U(e+1,i),i}parse(e,t){this.context=e;let{src:n}=e,r=this.parseBlockHeader(t);return r=W.endOfWhiteSpace(n,r),r=this.parseComment(r),r=this.parseBlockValue(r),r}setOrigRanges(e,t){return t=super.setOrigRanges(e,t),this.header?this.header.setOrigRange(e,t):t}},Jt=class extends W{constructor(e,t){super(e,t),this.items=null}prevNodeIsJsonLike(e=this.items.length){let t=this.items[e-1];return!!t&&(t.jsonLike||t.type===H.COMMENT&&this.prevNodeIsJsonLike(e-1))}parse(e,t){this.context=e;let{parseNode:n,src:r}=e,{indent:i,lineStart:a}=e,o=r[t];this.items=[{char:o,offset:t}];let s=W.endOfWhiteSpace(r,t+1);for(o=r[s];o&&o!==`]`&&o!==`}`;){switch(o){case`
|
|
104
|
+
`:if(a=s+1,r[W.endOfWhiteSpace(r,a)]===`
|
|
105
|
+
`){let e=new zt;a=e.parse({src:r},a),this.items.push(e)}s=W.endOfIndent(r,a),s<=a+i&&(o=r[s],s<a+i||o!==`]`&&o!==`}`)&&(this.error=new G(this,`Insufficient indentation in flow collection`));break;case`,`:this.items.push({char:o,offset:s}),s+=1;break;case`#`:{let e=new Vt;s=e.parse({src:r},s),this.items.push(e)}break;case`?`:case`:`:{let e=r[s+1];if(e===`
|
|
106
|
+
`||e===` `||e===` `||e===`,`||o===`:`&&this.prevNodeIsJsonLike()){this.items.push({char:o,offset:s}),s+=1;break}}default:{let e=n({atLineStart:!1,inCollection:!1,inFlow:!0,indent:-1,lineStart:a,parent:this},s);if(!e)return this.valueRange=new U(t,s),s;this.items.push(e),s=W.normalizeOffset(r,e.range.end)}}s=W.endOfWhiteSpace(r,s),o=r[s]}return this.valueRange=new U(t,s+1),o&&(this.items.push({char:o,offset:s}),s=W.endOfWhiteSpace(r,s+1),s=this.parseComment(s)),s}setOrigRanges(e,t){return t=super.setOrigRanges(e,t),this.items.forEach(n=>{if(n instanceof W)t=n.setOrigRanges(e,t);else if(e.length===0)n.origOffset=n.offset;else{let r=t;for(;r<e.length&&!(e[r]>n.offset);)++r;n.origOffset=n.offset+r,t=r}}),t}toString(){let{context:{src:e},items:t,range:n,value:r}=this;if(r!=null)return r;let i=t.filter(e=>e instanceof W),a=``,o=n.start;return i.forEach(t=>{let n=e.slice(o,t.range.start);o=t.range.end,a+=n+String(t),a[a.length-1]===`
|
|
107
|
+
`&&e[o-1]!==`
|
|
108
|
+
`&&e[o]===`
|
|
109
|
+
`&&(o+=1)}),a+=e.slice(o,n.end),W.addStringTerminator(e,n.end,a)}},Yt=class e extends W{static endOfQuote(e,t){let n=e[t];for(;n&&n!==`"`;)t+=n===`\\`?2:1,n=e[t];return t+1}get strValue(){if(!this.valueRange||!this.context)return null;let e=[],{start:t,end:n}=this.valueRange,{indent:r,src:i}=this.context;i[n-1]!==`"`&&e.push(new K(this,`Missing closing "quote`));let a=``;for(let o=t+1;o<n-1;++o){let t=i[o];if(t===`
|
|
110
|
+
`){W.atDocumentBoundary(i,o+1)&&e.push(new G(this,`Document boundary indicators are not allowed within string values`));let{fold:t,offset:n,error:s}=W.foldNewline(i,o,r);a+=t,o=n,s&&e.push(new G(this,`Multi-line double-quoted string needs to be sufficiently indented`))}else if(t===`\\`)switch(o+=1,i[o]){case`0`:a+=`\0`;break;case`a`:a+=`\x07`;break;case`b`:a+=`\b`;break;case`e`:a+=`\x1B`;break;case`f`:a+=`\f`;break;case`n`:a+=`
|
|
111
|
+
`;break;case`r`:a+=`\r`;break;case`t`:a+=` `;break;case`v`:a+=`\v`;break;case`N`:a+=`
`;break;case`_`:a+=`\xA0`;break;case`L`:a+=`\u2028`;break;case`P`:a+=`\u2029`;break;case` `:a+=` `;break;case`"`:a+=`"`;break;case`/`:a+=`/`;break;case`\\`:a+=`\\`;break;case` `:a+=` `;break;case`x`:a+=this.parseCharCode(o+1,2,e),o+=2;break;case`u`:a+=this.parseCharCode(o+1,4,e),o+=4;break;case`U`:a+=this.parseCharCode(o+1,8,e),o+=8;break;case`
|
|
112
|
+
`:for(;i[o+1]===` `||i[o+1]===` `;)o+=1;break;default:e.push(new K(this,`Invalid escape sequence ${i.substr(o-1,2)}`)),a+=`\\`+i[o]}else if(t===` `||t===` `){let e=o,n=i[o+1];for(;n===` `||n===` `;)o+=1,n=i[o+1];n!==`
|
|
113
|
+
`&&(a+=o>e?i.slice(e,o+1):t)}else a+=t}return e.length>0?{errors:e,str:a}:a}parseCharCode(e,t,n){let{src:r}=this.context,i=r.substr(e,t),a=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;return isNaN(a)?(n.push(new K(this,`Invalid escape sequence ${r.substr(e-2,t+2)}`)),r.substr(e-2,t+2)):String.fromCodePoint(a)}parse(t,n){this.context=t;let{src:r}=t,i=e.endOfQuote(r,n+1);return this.valueRange=new U(n,i),i=W.endOfWhiteSpace(r,i),i=this.parseComment(i),i}},Xt=class e extends W{static endOfQuote(e,t){let n=e[t];for(;n;)if(n===`'`){if(e[t+1]!==`'`)break;n=e[t+=2]}else n=e[t+=1];return t+1}get strValue(){if(!this.valueRange||!this.context)return null;let e=[],{start:t,end:n}=this.valueRange,{indent:r,src:i}=this.context;i[n-1]!==`'`&&e.push(new K(this,`Missing closing 'quote`));let a=``;for(let o=t+1;o<n-1;++o){let t=i[o];if(t===`
|
|
114
|
+
`){W.atDocumentBoundary(i,o+1)&&e.push(new G(this,`Document boundary indicators are not allowed within string values`));let{fold:t,offset:n,error:s}=W.foldNewline(i,o,r);a+=t,o=n,s&&e.push(new G(this,`Multi-line single-quoted string needs to be sufficiently indented`))}else if(t===`'`)a+=t,o+=1,i[o]!==`'`&&e.push(new K(this,`Unescaped single quote? This should not happen.`));else if(t===` `||t===` `){let e=o,n=i[o+1];for(;n===` `||n===` `;)o+=1,n=i[o+1];n!==`
|
|
115
|
+
`&&(a+=o>e?i.slice(e,o+1):t)}else a+=t}return e.length>0?{errors:e,str:a}:a}parse(t,n){this.context=t;let{src:r}=t,i=e.endOfQuote(r,n+1);return this.valueRange=new U(n,i),i=W.endOfWhiteSpace(r,i),i=this.parseComment(i),i}},Zt=class e{static parseType(e,t,n){switch(e[t]){case`*`:return H.ALIAS;case`>`:return H.BLOCK_FOLDED;case`|`:return H.BLOCK_LITERAL;case`{`:return H.FLOW_MAP;case`[`:return H.FLOW_SEQ;case`?`:return!n&&W.atBlank(e,t+1,!0)?H.MAP_KEY:H.PLAIN;case`:`:return!n&&W.atBlank(e,t+1,!0)?H.MAP_VALUE:H.PLAIN;case`-`:return!n&&W.atBlank(e,t+1,!0)?H.SEQ_ITEM:H.PLAIN;case`"`:return H.QUOTE_DOUBLE;case`'`:return H.QUOTE_SINGLE;default:return H.PLAIN}}constructor(t={},{atLineStart:n,inCollection:r,inFlow:i,indent:a,lineStart:o,parent:s}={}){B(this,`parseNode`,(t,n)=>{if(W.atDocumentBoundary(this.src,n))return null;let r=new e(this,t),{props:i,type:a,valueStart:o}=r.parseProps(n),s=Lt(a,i),c=n;try{c=s.parse(r,o)}catch(e){let t=e instanceof Error?e.message:String(e);s.error||=new K(s,t)}if(s.range=new U(n,c),c<=n&&(s.error||=/* @__PURE__ */ Error(`Node#parse consumed no characters`),s.error.parseEnd=c,s.error.source=s,s.range.end=n+1),r.nodeStartsCollection(s)){!s.error&&!r.atLineStart&&r.parent.type===H.DOCUMENT&&(s.error=new K(s,`Block collection must not have preceding content here (e.g. directives-end indicator)`));let t=new Ht(s);return c=t.parse(new e(r),c),t.range=new U(n,c),t}return s}),this.atLineStart=n??(t.atLineStart||!1),this.inCollection=r??(t.inCollection||!1),this.inFlow=i??(t.inFlow||!1),this.indent=a??t.indent,this.lineStart=o??t.lineStart,this.parent=s??(t.parent||{}),this.root=t.root,this.src=t.src}nodeStartsCollection(e){let{inCollection:t,inFlow:n,src:r}=this;if(t||n)return!1;if(e instanceof Bt)return!0;let i=e.range.end;return r[i]===`
|
|
116
|
+
`||r[i-1]===`
|
|
117
|
+
`?!1:(i=W.endOfWhiteSpace(r,i),r[i]===`:`)}parseProps(t){let{inFlow:n,parent:r,src:i}=this,a=[],o=!1;t=this.atLineStart?W.endOfIndent(i,t):W.endOfWhiteSpace(i,t);let s=i[t];for(;s===V.ANCHOR||s===V.COMMENT||s===V.TAG||s===`
|
|
118
|
+
`;){if(s===`
|
|
119
|
+
`){let e=t,n;do n=e+1,e=W.endOfIndent(i,n);while(i[e]===`
|
|
120
|
+
`);let a=e-(n+this.indent),s=r.type===H.SEQ_ITEM&&r.context.atLineStart;if(i[e]!==`#`&&!W.nextNodeIsIndented(i[e],a,!s))break;this.atLineStart=!0,this.lineStart=n,o=!1,t=e}else if(s===V.COMMENT){let e=W.endOfLine(i,t+1);a.push(new U(t,e)),t=e}else{let e=W.endOfIdentifier(i,t+1);s===V.TAG&&i[e]===`,`&&/^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(i.slice(t+1,e+13))&&(e=W.endOfIdentifier(i,e+5)),a.push(new U(t,e)),o=!0,t=W.endOfWhiteSpace(i,e)}s=i[t]}return o&&s===`:`&&W.atBlank(i,t+1,!0)&&--t,{props:a,type:e.parseType(i,t,n),valueStart:t}}}}));function $t(e,t,n){return n?`#${n.replace(/[\s\S]^/gm,`$&${t}#`)}\n${t}${e}`:e}function en(e,t,n){return n?n.indexOf(`
|
|
121
|
+
`)===-1?`${e} #${n}`:`${e}\n`+n.replace(/^/gm,`${t||``}#`):e}function q(e,t,n){if(Array.isArray(e))return e.map((e,t)=>q(e,String(t),n));if(e&&typeof e.toJSON==`function`){let r=n&&n.anchors&&n.anchors.get(e);r&&(n.onCreate=e=>{r.res=e,delete n.onCreate});let i=e.toJSON(t,n);return r&&n.onCreate&&n.onCreate(i),i}return(!n||!n.keep)&&typeof e==`bigint`?Number(e):e}function tn(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else{let e={};Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!0,configurable:!0}),r=e}}return e.createNode(r,!1)}function nn(e){let t=e instanceof Y?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),Number.isInteger(t)&&t>=0?t:null}function rn(e,t){let n=t instanceof Y?t.value:t;for(let r of e)if(r instanceof Q&&(r.key===t||r.key===n||r.key&&r.key.value===n))return r}function an(e,t,n){for(let{format:n,test:r,resolve:i}of t)if(r){let t=e.match(r);if(t){let e=i.apply(null,t);return e instanceof Y||(e=new Y(e)),n&&(e.format=n),e}}return n&&(e=n(e)),new Y(e)}function on(e,t,n,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}){if(!i||i<0)return e;let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===Kn&&(h=Jn(e,h),h!==-1&&(d=h+c));for(let t;t=e[h+=1];){if(n===qn&&t===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(t===`
|
|
122
|
+
`)n===Kn&&(h=Jn(e,h)),d=h+c,f=void 0;else{if(t===` `&&p&&p!==` `&&p!==`
|
|
123
|
+
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
124
|
+
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===qn){for(;p===` `||p===` `;)p=t,t=e[h+=1],m=!0;let n=h>_+1?h-2:g-1;if(u[n])return e;l.push(n),u[n]=!0,d=n+c,f=void 0}else m=!0}}p=t}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===qn&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function sn(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
125
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function cn(e,t){let{implicitKey:n}=t,{jsonEncoding:r,minMultiLineLength:i}=Wn.doubleQuoted,a=JSON.stringify(e);if(r)return a;let o=t.indent||(Xn(e)?` `:``),s=``,c=0;for(let e=0,t=a[e];t;t=a[++e])if(t===` `&&a[e+1]===`\\`&&a[e+2]===`n`&&(s+=a.slice(c,e)+`\\ `,e+=1,c=e,t=`\\`),t===`\\`)switch(a[e+1]){case`u`:{s+=a.slice(c,e);let t=a.substr(e+2,4);switch(t){case`0000`:s+=`\\0`;break;case`0007`:s+=`\\a`;break;case`000b`:s+=`\\v`;break;case`001b`:s+=`\\e`;break;case`0085`:s+=`\\N`;break;case`00a0`:s+=`\\_`;break;case`2028`:s+=`\\L`;break;case`2029`:s+=`\\P`;break;default:t.substr(0,2)===`00`?s+=`\\x`+t.substr(2):s+=a.substr(e,6)}e+=5,c=e+1}break;case`n`:if(n||a[e+2]===`"`||a.length<i)e+=1;else{for(s+=a.slice(c,e)+`
|
|
126
|
+
|
|
127
|
+
`;a[e+2]===`\\`&&a[e+3]===`n`&&a[e+4]!==`"`;)s+=`
|
|
128
|
+
`,e+=2;s+=o,a[e+2]===` `&&(s+=`\\`),e+=1,c=e+1}break;default:e+=1}return s=c?s+a.slice(c):a,n?s:on(s,o,qn,Yn(t))}function ln(e,t){if(t.implicitKey){if(/\n/.test(e))return cn(e,t)}else if(/[ \t]\n|\n[ \t]/.test(e))return cn(e,t);let n=t.indent||(Xn(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:on(r,n,Gn,Yn(t))}function un({comment:e,type:t,value:n},r,i,a){if(/\n[\t ]+$/.test(n)||/^\s*$/.test(n))return cn(n,r);let o=r.indent||(r.forceBlockIndent||Xn(n)?` `:``),s=o?`2`:`1`,c=t===H.BLOCK_FOLDED?!1:t===H.BLOCK_LITERAL||!sn(n,Wn.fold.lineWidth,o.length),l=c?`|`:`>`;if(!n)return l+`
|
|
129
|
+
`;let u=``,d=``;if(n=n.replace(/[\n\t ]*$/,e=>{let t=e.indexOf(`
|
|
130
|
+
`);return t===-1?l+=`-`:(n===e||t!==e.length-1)&&(l+=`+`,a&&a()),d=e.replace(/\n$/,``),``}).replace(/^[\n ]*/,e=>{e.indexOf(` `)!==-1&&(l+=s);let t=e.match(/ +$/);return t?(u=e.slice(0,-t[0].length),t[0]):(u=e,``)}),d&&=d.replace(/\n+(?!\n|$)/g,`$&${o}`),u&&=u.replace(/\n+/g,`$&${o}`),e&&(l+=` #`+e.replace(/ ?[\r\n]+/g,` `),i&&i()),!n)return`${l}${s}\n${o}${d}`;if(c)return n=n.replace(/\n+/g,`$&${o}`),`${l}\n${o}${u}${n}${d}`;n=n.replace(/\n+/g,`
|
|
131
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${o}`);let f=on(`${u}${n}${d}`,o,Kn,Wn.fold);return`${l}\n${o}${f}`}function dn(e,t,n,r){let{comment:i,type:a,value:o}=e,{actualString:s,implicitKey:c,indent:l,inFlow:u}=t;if(c&&/[\n[\]{},]/.test(o)||u&&/[[\]{},]/.test(o))return cn(o,t);if(!o||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return c||u||o.indexOf(`
|
|
132
|
+
`)===-1?o.indexOf(`"`)!==-1&&o.indexOf(`'`)===-1?ln(o,t):cn(o,t):un(e,t,n,r);if(!c&&!u&&a!==H.PLAIN&&o.indexOf(`
|
|
133
|
+
`)!==-1)return un(e,t,n,r);if(l===``&&Xn(o))return t.forceBlockIndent=!0,un(e,t,n,r);let d=o.replace(/\n+/g,`$&\n${l}`);if(s){let{tags:e}=t.doc.schema;if(typeof an(d,e,e.scalarFallback).value!=`string`)return cn(o,t)}let f=c?d:on(d,l,Gn,Yn(t));return i&&!u&&(f.indexOf(`
|
|
134
|
+
`)!==-1||i.indexOf(`
|
|
135
|
+
`)!==-1)?(n&&n(),$t(f,l,i)):f}function fn(e,t,n,r){let{defaultType:i}=Wn,{implicitKey:a,inFlow:o}=t,{type:s,value:c}=e;typeof c!=`string`&&(c=String(c),e=Object.assign({},e,{value:c}));let l=i=>{switch(i){case H.BLOCK_FOLDED:case H.BLOCK_LITERAL:return un(e,t,n,r);case H.QUOTE_DOUBLE:return cn(c,t);case H.QUOTE_SINGLE:return ln(c,t);case H.PLAIN:return dn(e,t,n,r);default:return null}};(s!==H.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(c)||(a||o)&&(s===H.BLOCK_FOLDED||s===H.BLOCK_LITERAL))&&(s=H.QUOTE_DOUBLE);let u=l(s);if(u===null&&(u=l(i),u===null))throw Error(`Unsupported default string type ${i}`);return u}function pn({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);if(!isFinite(r))return isNaN(r)?`.nan`:r<0?`-.inf`:`.inf`;let i=JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^\d/.test(i)){let e=i.indexOf(`.`);e<0&&(e=i.length,i+=`.`);let n=t-(i.length-e-1);for(;n-->0;)i+=`0`}return i}function mn(e,t){let n,r;switch(t.type){case H.FLOW_MAP:n=`}`,r=`flow map`;break;case H.FLOW_SEQ:n=`]`,r=`flow sequence`;break;default:e.push(new G(t,`Not a flow collection!?`));return}let i;for(let e=t.items.length-1;e>=0;--e){let n=t.items[e];if(!n||n.type!==H.COMMENT){i=n;break}}if(i&&i.char!==n){let a=`Expected ${r} to end with ${n}`,o;typeof i.offset==`number`?(o=new G(t,a),o.offset=i.offset+1):(o=new G(i,a),i.range&&i.range.end&&(o.offset=i.range.end-i.range.start)),e.push(o)}}function hn(e,t){let n=t.context.src[t.range.start-1];n!==`
|
|
136
|
+
`&&n!==` `&&n!==` `&&e.push(new G(t,`Comments must be separated from other tokens by white space characters`))}function gn(e,t){let n=String(t),r=n.substr(0,8)+`...`+n.substr(-8);return new G(e,`The "${r}" key is too long`)}function _n(e,t){for(let{afterKey:n,before:r,comment:i}of t){let t=e.items[r];t?(n&&t.value&&(t=t.value),i===void 0?(n||!t.commentBefore)&&(t.spaceBefore=!0):t.commentBefore?t.commentBefore+=`
|
|
137
|
+
`+i:t.commentBefore=i):i!==void 0&&(e.comment?e.comment+=`
|
|
138
|
+
`+i:e.comment=i)}}function vn(e,t){let n=t.strValue;return n?typeof n==`string`?n:(n.errors.forEach(n=>{n.source||=t,e.errors.push(n)}),n.str):``}function yn(e,t){let{handle:n,suffix:r}=t.tag,i=e.tagPrefixes.find(e=>e.handle===n);if(!i){let r=e.getDefaults().tagPrefixes;if(r&&(i=r.find(e=>e.handle===n)),!i)throw new G(t,`The ${n} tag handle is non-default and was not declared.`)}if(!r)throw new G(t,`The ${n} tag has no suffix.`);if(n===`!`&&(e.version||e.options.version)===`1.0`){if(r[0]===`^`)return e.warnings.push(new Nt(t,`YAML 1.0 ^ tag expansion is not supported`)),r;if(/[:/]/.test(r)){let e=r.match(/^([a-z0-9-]+)\/(.*)/i);return e?`tag:${e[1]}.yaml.org,2002:${e[2]}`:`tag:${r}`}}return i.prefix+decodeURIComponent(r)}function bn(e,t){let{tag:n,type:r}=t,i=!1;if(n){let{handle:r,suffix:a,verbatim:o}=n;if(o){if(o!==`!`&&o!==`!!`)return o;let n=`Verbatim tags aren't resolved, so ${o} is invalid.`;e.errors.push(new G(t,n))}else if(r===`!`&&!a)i=!0;else try{return yn(e,t)}catch(t){e.errors.push(t)}}switch(r){case H.BLOCK_FOLDED:case H.BLOCK_LITERAL:case H.QUOTE_DOUBLE:case H.QUOTE_SINGLE:return At.STR;case H.FLOW_MAP:case H.MAP:return At.MAP;case H.FLOW_SEQ:case H.SEQ:return At.SEQ;case H.PLAIN:return i?At.STR:null;default:return null}}function xn(e,t,n){let{tags:r}=e.schema,i=[];for(let a of r)if(a.tag===n){if(a.test)i.push(a);else{let n=a.resolve(e,t);return n instanceof X?n:new Y(n)}}let a=vn(e,t);return typeof a==`string`&&i.length>0?an(a,i,r.scalarFallback):null}function Sn({type:e}){switch(e){case H.FLOW_MAP:case H.MAP:return At.MAP;case H.FLOW_SEQ:case H.SEQ:return At.SEQ;default:return At.STR}}function Cn(e,t,n){try{let r=xn(e,t,n);if(r)return n&&t.tag&&(r.tag=n),r}catch(n){if(n instanceof jt)n.source||=t,e.errors.push(n);else{let r=n instanceof Error?n.message:String(n);e.errors.push(new G(t,r))}return null}try{let r=Sn(t);if(!r)throw Error(`The tag ${n} is unavailable`);let i=`The tag ${n} is unavailable, falling back to ${r}`;e.warnings.push(new Nt(t,i));let a=xn(e,t,r);return a.tag=n,a}catch(n){let r=new Mt(t,n.message);return r.stack=n.stack,e.errors.push(r),null}}function wn(e,t){let n={before:[],after:[]},r=!1,i=!1,a=Zn(t.context.parent)?t.context.parent.props.concat(t.props):t.props;for(let{start:o,end:s}of a)switch(t.context.src[o]){case V.COMMENT:{t.commentHasRequiredWhitespace(o)||e.push(new G(t,`Comments must be separated from other tokens by white space characters`));let{header:r,valueRange:i}=t;(i&&(o>i.start||r&&o>r.start)?n.after:n.before).push(t.context.src.slice(o+1,s));break}case V.ANCHOR:r&&e.push(new G(t,`A node can have at most one anchor`)),r=!0;break;case V.TAG:i&&e.push(new G(t,`A node can have at most one tag`)),i=!0}return{comments:n,hasAnchor:r,hasTag:i}}function Tn(e,t){let{anchors:n,errors:r,schema:i}=e;if(t.type===H.ALIAS){let e=t.rawValue,i=n.getNode(e);if(!i){let n=`Aliased anchor not found: ${e}`;return r.push(new Mt(t,n)),null}let a=new Ln(i);return n._cstAliases.push(a),a}let a=bn(e,t);if(a)return Cn(e,t,a);if(t.type!==H.PLAIN){let e=`Failed to resolve ${t.type} node here`;return r.push(new K(t,e)),null}try{return an(vn(e,t),i.tags,i.tags.scalarFallback)}catch(e){return e.source||=t,r.push(e),null}}function En(e,t){if(!t)return null;t.error&&e.errors.push(t.error);let{comments:n,hasAnchor:r,hasTag:i}=wn(e.errors,t);if(r){let{anchors:n}=e,r=t.anchor,i=n.getNode(r);i&&(n.map[n.newName(r)]=i),n.map[r]=t}t.type===H.ALIAS&&(r||i)&&e.errors.push(new G(t,`An alias node must not specify any properties`));let a=Tn(e,t);if(a){a.range=[t.range.start,t.range.end],e.options.keepCstNodes&&(a.cstNode=t),e.options.keepNodeTypes&&(a.type=t.type);let r=n.before.join(`
|
|
139
|
+
`);r&&(a.commentBefore=a.commentBefore?`${a.commentBefore}\n${r}`:r);let i=n.after.join(`
|
|
140
|
+
`);i&&(a.comment=a.comment?`${a.comment}\n${i}`:i)}return t.resolved=a}function Dn(e,t){if(t.type!==H.MAP&&t.type!==H.FLOW_MAP){let n=`A ${t.type} node cannot be resolved as a mapping`;return e.errors.push(new K(t,n)),null}let{comments:n,items:r}=t.type===H.FLOW_MAP?An(e,t):kn(e,t),i=new $;i.items=r,_n(i,n);let a=!1;for(let n=0;n<r.length;++n){let{key:i}=r[n];if(i instanceof X&&(a=!0),e.schema.merge&&i&&i.value===Rn){r[n]=new zn(r[n]);let i=r[n].value.items,a=null;i.some(e=>{if(e instanceof Ln){let{type:t}=e.source;return t===H.MAP||t===H.FLOW_MAP?!1:a=`Merge nodes aliases can only point to maps`}return a=`Merge nodes can only have Alias nodes as values`}),a&&e.errors.push(new G(t,a))}else for(let a=n+1;a<r.length;++a){let{key:n}=r[a];if(i===n||i&&n&&Object.prototype.hasOwnProperty.call(i,`value`)&&i.value===n.value){let n=`Map keys must be unique; "${i}" is repeated`;e.errors.push(new G(t,n));break}}}return a&&!e.options.mapAsMap&&e.warnings.push(new Nt(t,`Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.`)),t.resolved=i,i}function On(e,t){if(!Qn(e))return;let n=e.getPropValue(0,V.COMMENT,!0),r=!1,i=t.value.commentBefore;if(i&&i.startsWith(n))t.value.commentBefore=i.substr(n.length+1),r=!0;else{let i=t.value.comment;!e.node&&i&&i.startsWith(n)&&(t.value.comment=i.substr(n.length+1),r=!0)}r&&(t.comment=n)}function kn(e,t){let n=[],r=[],i,a=null;for(let o=0;o<t.items.length;++o){let s=t.items[o];switch(s.type){case H.BLANK_LINE:n.push({afterKey:!!i,before:r.length});break;case H.COMMENT:n.push({afterKey:!!i,before:r.length,comment:s.comment});break;case H.MAP_KEY:i!==void 0&&r.push(new Q(i)),s.error&&e.errors.push(s.error),i=En(e,s.node),a=null;break;case H.MAP_VALUE:{i===void 0&&(i=null),s.error&&e.errors.push(s.error),!s.context.atLineStart&&s.node&&s.node.type===H.MAP&&!s.node.context.atLineStart&&e.errors.push(new G(s.node,`Nested mappings are not allowed in compact mappings`));let n=s.node;if(!n&&s.props.length>0){n=new Pt(H.PLAIN,[]),n.context={parent:s,src:s.context.src};let e=s.range.start+1;if(n.range={start:e,end:e},n.valueRange={start:e,end:e},typeof s.range.origStart==`number`){let e=s.range.origStart+1;n.range.origStart=n.range.origEnd=e,n.valueRange.origStart=n.valueRange.origEnd=e}}let o=new Q(i,En(e,n));On(s,o),r.push(o),i&&typeof a==`number`&&s.range.start>a+1024&&e.errors.push(gn(t,i)),i=void 0,a=null}break;default:i!==void 0&&r.push(new Q(i)),i=En(e,s),a=s.range.start,s.error&&e.errors.push(s.error);next:for(let n=o+1;;++n){let r=t.items[n];switch(r&&r.type){case H.BLANK_LINE:case H.COMMENT:continue next;case H.MAP_VALUE:break next;default:e.errors.push(new G(s,`Implicit map keys need to be followed by map values`));break next}}s.valueRangeContainsNewline&&e.errors.push(new G(s,`Implicit map keys need to be on a single line`))}}return i!==void 0&&r.push(new Q(i)),{comments:n,items:r}}function An(e,t){let n=[],r=[],i,a=!1,o=`{`;for(let s=0;s<t.items.length;++s){let c=t.items[s];if(typeof c.char==`string`){let{char:n,offset:l}=c;if(n===`?`&&i===void 0&&!a){a=!0,o=`:`;continue}if(n===`:`){if(i===void 0&&(i=null),o===`:`){o=`,`;continue}}else if(a&&=(i===void 0&&n!==`,`&&(i=null),!1),i!==void 0&&(r.push(new Q(i)),i=void 0,n===`,`)){o=`:`;continue}if(n===`}`){if(s===t.items.length-1)continue}else if(n===o){o=`:`;continue}let u=`Flow map contains an unexpected ${n}`,d=new K(t,u);d.offset=l,e.errors.push(d)}else c.type===H.BLANK_LINE?n.push({afterKey:!!i,before:r.length}):c.type===H.COMMENT?(hn(e.errors,c),n.push({afterKey:!!i,before:r.length,comment:c.comment})):i===void 0?(o===`,`&&e.errors.push(new G(c,`Separator , missing in flow map`)),i=En(e,c)):(o!==`,`&&e.errors.push(new G(c,`Indicator : missing in flow map entry`)),r.push(new Q(i,En(e,c))),i=void 0,a=!1)}return mn(e.errors,t),i!==void 0&&r.push(new Q(i)),{comments:n,items:r}}function jn(e,t){if(t.type!==H.SEQ&&t.type!==H.FLOW_SEQ){let n=`A ${t.type} node cannot be resolved as a sequence`;return e.errors.push(new K(t,n)),null}let{comments:n,items:r}=t.type===H.FLOW_SEQ?Nn(e,t):Mn(e,t),i=new Z;return i.items=r,_n(i,n),!e.options.mapAsMap&&r.some(e=>e instanceof Q&&e.key instanceof X)&&e.warnings.push(new Nt(t,`Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.`)),t.resolved=i,i}function Mn(e,t){let n=[],r=[];for(let i=0;i<t.items.length;++i){let a=t.items[i];switch(a.type){case H.BLANK_LINE:n.push({before:r.length});break;case H.COMMENT:n.push({comment:a.comment,before:r.length});break;case H.SEQ_ITEM:a.error&&e.errors.push(a.error),r.push(En(e,a.node)),a.hasProps&&e.errors.push(new G(a,`Sequence items cannot have tags or anchors before the - indicator`));break;default:a.error&&e.errors.push(a.error),e.errors.push(new K(a,`Unexpected ${a.type} node in sequence`))}}return{comments:n,items:r}}function Nn(e,t){let n=[],r=[],i=!1,a,o=null,s=`[`,c=null;for(let l=0;l<t.items.length;++l){let u=t.items[l];if(typeof u.char==`string`){let{char:n,offset:d}=u;if(n!==`:`&&(i||a!==void 0)&&(i&&a===void 0&&(a=s?r.pop():null),r.push(new Q(a)),i=!1,a=void 0,o=null),n===s)s=null;else if(!s&&n===`?`)i=!0;else if(s!==`[`&&n===`:`&&a===void 0){if(s===`,`){if(a=r.pop(),a instanceof Q){let n=new G(t,`Chaining flow sequence pairs is invalid`);n.offset=d,e.errors.push(n)}if(!i&&typeof o==`number`){let n=u.range?u.range.start:u.offset;n>o+1024&&e.errors.push(gn(t,a));let{src:r}=c.context;for(let t=o;t<n;++t)if(r[t]===`
|
|
141
|
+
`){e.errors.push(new G(c,`Implicit keys of flow sequence pairs need to be on a single line`));break}}}else a=null;o=null,i=!1,s=null}else if(s===`[`||n!==`]`||l<t.items.length-1){let r=`Flow sequence contains an unexpected ${n}`,i=new K(t,r);i.offset=d,e.errors.push(i)}}else if(u.type===H.BLANK_LINE)n.push({before:r.length});else if(u.type===H.COMMENT)hn(e.errors,u),n.push({comment:u.comment,before:r.length});else{if(s){let t=`Expected a ${s} in flow sequence`;e.errors.push(new G(u,t))}let t=En(e,u);a===void 0?(r.push(t),c=u):(r.push(new Q(a,t)),a=void 0),o=u.range.start,s=`,`}}return mn(e.errors,t),a!==void 0&&r.push(new Q(a)),{comments:n,items:r}}var J,Y,Pn,X,Z,Fn,Q,In,Ln,$,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n=o((()=>{Ft(),J=class{},Y=class extends J{constructor(e){super(),this.value=e}toJSON(e,t){return t&&t.keep?this.value:q(this.value,e,t)}toString(){return String(this.value)}},Pn=e=>e==null||typeof e==`object`&&e[Symbol.iterator]().next().done,X=class e extends J{constructor(e){super(),B(this,`items`,[]),this.schema=e}addIn(t,n){if(Pn(t))this.add(n);else{let[r,...i]=t,a=this.get(r,!0);if(a instanceof e)a.addIn(i,n);else if(a===void 0&&this.schema)this.set(r,tn(this.schema,i,n));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn([t,...n]){if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(r instanceof e)return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn([t,...n],r){let i=this.get(t,!0);return n.length===0?!r&&i instanceof Y?i.value:i:i instanceof e?i.getIn(n,r):void 0}hasAllNullValues(){return this.items.every(e=>{if(!e||e.type!==`PAIR`)return!1;let t=e.value;return t==null||t instanceof Y&&t.value==null&&!t.commentBefore&&!t.comment&&!t.tag})}hasIn([t,...n]){if(n.length===0)return this.has(t);let r=this.get(t,!0);return r instanceof e&&r.hasIn(n)}setIn([t,...n],r){if(n.length===0)this.set(t,r);else{let i=this.get(t,!0);if(i instanceof e)i.setIn(n,r);else if(i===void 0&&this.schema)this.set(t,tn(this.schema,n,r));else throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}}
|
|
142
|
+
/* istanbul ignore next */
|
|
143
|
+
toJSON(){return null}toString(t,{blockItem:n,flowChars:r,isMap:i,itemIndent:a},o,s){let{indent:c,indentStep:l,stringify:u}=t,d=this.type===H.FLOW_MAP||this.type===H.FLOW_SEQ||t.inFlow;d&&(a+=l);let f=i&&this.hasAllNullValues();t=Object.assign({},t,{allNullValues:f,indent:a,inFlow:d,type:null});let p=!1,m=!1,h=this.items.reduce((e,n,r)=>{let i;n&&(!p&&n.spaceBefore&&e.push({type:`comment`,str:``}),n.commentBefore&&n.commentBefore.match(/^.*$/gm).forEach(t=>{e.push({type:`comment`,str:`#${t}`})}),n.comment&&(i=n.comment),d&&(!p&&n.spaceBefore||n.commentBefore||n.comment||n.key&&(n.key.commentBefore||n.key.comment)||n.value&&(n.value.commentBefore||n.value.comment))&&(m=!0)),p=!1;let o=u(n,t,()=>i=null,()=>p=!0);return d&&!m&&o.includes(`
|
|
144
|
+
`)&&(m=!0),d&&r<this.items.length-1&&(o+=`,`),o=en(o,a,i),p&&(i||d)&&(p=!1),e.push({type:`item`,str:o}),e},[]),g;if(h.length===0)g=r.start+r.end;else if(d){let{start:t,end:n}=r,i=h.map(e=>e.str);if(m||i.reduce((e,t)=>e+t.length+2,2)>e.maxFlowStringSingleLineLength){g=t;for(let e of i)g+=e?`\n${l}${c}${e}`:`
|
|
145
|
+
`;g+=`\n${c}${n}`}else g=`${t} ${i.join(` `)} ${n}`}else{let e=h.map(n);g=e.shift();for(let t of e)g+=t?`\n${c}${t}`:`
|
|
146
|
+
`}return this.comment?(g+=`
|
|
147
|
+
`+this.comment.replace(/^/gm,`${c}#`),o&&o()):p&&s&&s(),g}},B(X,`maxFlowStringSingleLineLength`,60),Z=class extends X{add(e){this.items.push(e)}delete(e){let t=nn(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=nn(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&r instanceof Y?r.value:r}has(e){let t=nn(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=nn(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);this.items[n]=t}toJSON(e,t){let n=[];t&&t.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(q(e,String(r++),t));return n}toString(e,t,n){return e?super.toString(e,{blockItem:e=>e.type===`comment`?e.str:`- ${e.str}`,flowChars:{start:`[`,end:`]`},isMap:!1,itemIndent:(e.indent||``)+` `},t,n):JSON.stringify(this)}},Fn=(e,t,n)=>t===null?``:typeof t==`object`?e instanceof J&&n&&n.doc?e.toString({anchors:Object.create(null),doc:n.doc,indent:``,indentStep:n.indentStep,inFlow:!0,inStringifyKey:!0,stringify:n.stringify}):JSON.stringify(t):String(t),Q=class e extends J{constructor(t,n=null){super(),this.key=t,this.value=n,this.type=e.Type.PAIR}get commentBefore(){return this.key instanceof J?this.key.commentBefore:void 0}set commentBefore(e){if(this.key??=new Y(null),this.key instanceof J)this.key.commentBefore=e;else throw Error(`Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.`)}addToJSMap(e,t){let n=q(this.key,``,e);if(t instanceof Map){let r=q(this.value,n,e);t.set(n,r)}else if(t instanceof Set)t.add(n);else{let r=Fn(this.key,n,e),i=q(this.value,r,e);r in t?Object.defineProperty(t,r,{value:i,writable:!0,enumerable:!0,configurable:!0}):t[r]=i}return t}toJSON(e,t){let n=t&&t.mapAsMap?/* @__PURE__ */ new Map:{};return this.addToJSMap(t,n)}toString(e,t,n){if(!e||!e.doc)return JSON.stringify(this);let{indent:r,indentSeq:i,simpleKeys:a}=e.doc.options,{key:o,value:s}=this,c=o instanceof J&&o.comment;if(a){if(c)throw Error(`With simple keys, key nodes cannot have comments`);if(o instanceof X)throw Error(`With simple keys, collection cannot be used as a key value`)}let l=!a&&(!o||c||(o instanceof J?o instanceof X||o.type===H.BLOCK_FOLDED||o.type===H.BLOCK_LITERAL:typeof o==`object`)),{doc:u,indent:d,indentStep:f,stringify:p}=e;e=Object.assign({},e,{implicitKey:!l,indent:d+f});let m=!1,h=p(o,e,()=>c=null,()=>m=!0);if(h=en(h,e.indent,c),!l&&h.length>1024){if(a)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);l=!0}if(e.allNullValues&&!a)return this.comment?(h=en(h,e.indent,this.comment),t&&t()):m&&!c&&n&&n(),e.inFlow&&!l?h:`? ${h}`;h=l?`? ${h}\n${d}:`:`${h}:`,this.comment&&(h=en(h,e.indent,this.comment),t&&t());let g=``,_=null;if(s instanceof J){if(s.spaceBefore&&(g=`
|
|
148
|
+
`),s.commentBefore){let t=s.commentBefore.replace(/^/gm,`${e.indent}#`);g+=`\n${t}`}_=s.comment}else s&&typeof s==`object`&&(s=u.schema.createNode(s,!0));e.implicitKey=!1,!l&&!this.comment&&s instanceof Y&&(e.indentAtStart=h.length+1),m=!1,!i&&r>=2&&!e.inFlow&&!l&&s instanceof Z&&s.type!==H.FLOW_SEQ&&!s.tag&&!u.anchors.getName(s)&&(e.indent=e.indent.substr(2));let v=p(s,e,()=>_=null,()=>m=!0),y=` `;return g||this.comment?y=`${g}\n${e.indent}`:!l&&s instanceof X?(v[0]!==`[`&&v[0]!==`{`||v.includes(`
|
|
149
|
+
`))&&(y=`\n${e.indent}`):v[0]===`
|
|
150
|
+
`&&(y=``),m&&!_&&n&&n(),en(h+y+v,e.indent,_)}},B(Q,`Type`,{PAIR:`PAIR`,MERGE_PAIR:`MERGE_PAIR`}),In=(e,t)=>{if(e instanceof Ln){let n=t.get(e.source);return n.count*n.aliasCount}if(e instanceof X){let n=0;for(let r of e.items){let e=In(r,t);e>n&&(n=e)}return n}if(e instanceof Q){let n=In(e.key,t),r=In(e.value,t);return Math.max(n,r)}return 1},Ln=class e extends J{static stringify({range:e,source:t},{anchors:n,doc:r,implicitKey:i,inStringifyKey:a}){let o=Object.keys(n).find(e=>n[e]===t);if(!o&&a&&(o=r.anchors.getName(t)||r.anchors.newName()),o)return`*${o}${i?` `:``}`;let s=r.anchors.getName(t)?`Alias node must be after source node`:`Source node not found for alias node`;throw Error(`${s} [${e}]`)}constructor(e){super(),this.source=e,this.type=H.ALIAS}set tag(e){throw Error(`Alias nodes cannot have tags`)}toJSON(e,t){if(!t)return q(this.source,e,t);let{anchors:n,maxAliasCount:r}=t,i=n.get(this.source);
|
|
151
|
+
/* istanbul ignore if */
|
|
152
|
+
if(!i||i.res===void 0){let e=`This should not happen: Alias anchor was not resolved?`;throw this.cstNode?new Mt(this.cstNode,e):ReferenceError(e)}if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=In(this.source,n)),i.count*i.aliasCount>r)){let e=`Excessive alias count indicates a resource exhaustion attack`;throw this.cstNode?new Mt(this.cstNode,e):ReferenceError(e)}return i.res}toString(t){return e.stringify(this,t)}},B(Ln,`default`,!0),$=class extends X{add(e,t){e?e instanceof Q||(e=new Q(e.key||e,e.value)):e=new Q(e);let n=rn(this.items,e.key),r=this.schema&&this.schema.sortMapEntries;if(n){if(t)n.value=e.value;else throw Error(`Key ${e.key} already set`)}else if(r){let t=this.items.findIndex(t=>r(e,t)<0);t===-1?this.items.push(e):this.items.splice(t,0,e)}else this.items.push(e)}delete(e){let t=rn(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=rn(this.items,e),r=n&&n.value;return!t&&r instanceof Y?r.value:r}has(e){return!!rn(this.items,e)}set(e,t){this.add(new Q(e,t),!0)}toJSON(e,t,n){let r=n?new n:t&&t.mapAsMap?/* @__PURE__ */ new Map:{};t&&t.onCreate&&t.onCreate(r);for(let e of this.items)e.addToJSMap(t,r);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!(e instanceof Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return super.toString(e,{blockItem:e=>e.str,flowChars:{start:`{`,end:`}`},isMap:!0,itemIndent:e.indent||``},t,n)}},Rn=`<<`,zn=class extends Q{constructor(e){if(e instanceof Q){let t=e.value;t instanceof Z||(t=new Z,t.items.push(e.value),t.range=e.value.range),super(e.key,t),this.range=e.range}else super(new Y(Rn),new Z);this.type=Q.Type.MERGE_PAIR}addToJSMap(e,t){for(let{source:n}of this.value.items){if(!(n instanceof $))throw Error(`Merge sources must be maps`);let r=n.toJSON(null,e,Map);for(let[e,n]of r)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}return t}toString(e,t){let n=this.value;if(n.items.length>1)return super.toString(e,t);this.value=n.items[0];let r=super.toString(e,t);return this.value=n,r}},Bn={defaultType:H.BLOCK_LITERAL,lineWidth:76},Vn={trueStr:`true`,falseStr:`false`},Hn={asBigInt:!1},Un={nullStr:`null`},Wn={defaultType:H.PLAIN,doubleQuoted:{jsonEncoding:!1,minMultiLineLength:40},fold:{lineWidth:80,minContentWidth:20}},Gn=`flow`,Kn=`block`,qn=`quoted`,Jn=(e,t)=>{let n=e[t+1];for(;n===` `||n===` `;){do n=e[t+=1];while(n&&n!==`
|
|
153
|
+
`);n=e[t+1]}return t},Yn=({indentAtStart:e})=>e?Object.assign({indentAtStart:e},Wn.fold):Wn.fold,Xn=e=>/^(%|---|\.\.\.)/m.test(e),Zn=e=>{if(!e)return!1;let{type:t}=e;return t===H.MAP_KEY||t===H.MAP_VALUE||t===H.SEQ_ITEM},Qn=({context:{lineStart:e,node:t,src:n},props:r})=>{if(r.length===0)return!1;let{start:i}=r[0];if(t&&i>t.valueRange.start||n[i]!==V.COMMENT)return!1;for(let t=e;t<i;++t)if(n[t]===`
|
|
154
|
+
`)return!1;return!0}}));function er(e,t){let n=jn(e,t);for(let e=0;e<n.items.length;++e){let r=n.items[e];if(!(r instanceof Q)){if(r instanceof $){if(r.items.length>1)throw new G(t,`Each pair must have its own sequence indicator`);let e=r.items[0]||new Q;r.commentBefore&&(e.commentBefore=e.commentBefore?`${r.commentBefore}\n${e.commentBefore}`:r.commentBefore),r.comment&&(e.comment=e.comment?`${r.comment}\n${e.comment}`:r.comment),r=e}n.items[e]=r instanceof Q?r:new Q(r)}}return n}function tr(e,t,n){let r=new Z(e);r.tag=`tag:yaml.org,2002:pairs`;for(let i of t){let t,a;if(Array.isArray(i)){if(i.length===2)t=i[0],a=i[1];else throw TypeError(`Expected [key, value] tuple: ${i}`)}else if(i&&i instanceof Object){let e=Object.keys(i);if(e.length===1)t=e[0],a=i[t];else throw TypeError(`Expected { key: value } tuple: ${i}`)}else t=i;let o=e.createPair(t,a,n);r.items.push(o)}return r}function nr(e,t){let n=er(e,t),r=[];for(let{key:e}of n.items)if(e instanceof Y){if(r.includes(e.value))throw new G(t,`Ordered maps must not include duplicate keys`);r.push(e.value)}return Object.assign(new dr,n)}function rr(e,t,n){let r=tr(e,t,n),i=new dr;return i.items=r.items,i}function ir(e,t){let n=Dn(e,t);if(!n.hasAllNullValues())throw new G(t,`Set items must all have null values`);return Object.assign(new pr,n)}function ar(e,t,n){let r=new pr;for(let i of t)r.items.push(e.createPair(i,null,n));return r}function or(e){let t=typeof process<`u`&&{}||{};return e?typeof YAML_SILENCE_DEPRECATION_WARNINGS<`u`?!YAML_SILENCE_DEPRECATION_WARNINGS:!t.YAML_SILENCE_DEPRECATION_WARNINGS:typeof YAML_SILENCE_WARNINGS<`u`?!YAML_SILENCE_WARNINGS:!t.YAML_SILENCE_WARNINGS}function sr(e,t){if(or(!1)){let n=typeof process<`u`&&process.emitWarning;n?n(e,t):console.warn(t?`${t}: ${e}`:e)}}function cr(e,t){if(!br[e]&&or(!0)){br[e]=!0;let n=`The option '${e}' will be removed in a future release`;n+=t?`, use '${t}' instead.`:`.`,sr(n,`DeprecationWarning`)}}var lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr=o((()=>{Ft(),$n(),lr={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve:(e,t)=>{let n=vn(e,t);if(typeof Buffer==`function`)return Buffer.from(n,`base64`);if(typeof atob==`function`){let e=atob(n.replace(/[\n\r]/g,``)),t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}return e.errors.push(new Mt(t,`This environment does not support reading binary tags; either Buffer or atob is required`)),null},options:Bn,stringify:({comment:e,type:t,value:n},r,i,a)=>{let o;if(typeof Buffer==`function`)o=n instanceof Buffer?n.toString(`base64`):Buffer.from(n.buffer).toString(`base64`);else if(typeof btoa==`function`){let e=``;for(let t=0;t<n.length;++t)e+=String.fromCharCode(n[t]);o=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t||=Bn.defaultType,t===H.QUOTE_DOUBLE)n=o;else{let{lineWidth:e}=Bn,r=Math.ceil(o.length/e),i=Array(r);for(let t=0,n=0;t<r;++t,n+=e)i[t]=o.substr(n,e);n=i.join(t===H.BLOCK_LITERAL?`
|
|
155
|
+
`:` `)}return fn({comment:e,type:t,value:n},r,i,a)}},ur={default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:er,createNode:tr},dr=class e extends Z{constructor(){super(),B(this,`add`,$.prototype.add.bind(this)),B(this,`delete`,$.prototype.delete.bind(this)),B(this,`get`,$.prototype.get.bind(this)),B(this,`has`,$.prototype.has.bind(this)),B(this,`set`,$.prototype.set.bind(this)),this.tag=e.tag}toJSON(e,t){let n=/* @__PURE__ */ new Map;t&&t.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(e instanceof Q?(r=q(e.key,``,t),i=q(e.value,r,t)):r=q(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}},B(dr,`tag`,`tag:yaml.org,2002:omap`),fr={identify:e=>e instanceof Map,nodeClass:dr,default:!1,tag:`tag:yaml.org,2002:omap`,resolve:nr,createNode:rr},pr=class e extends ${constructor(){super(),this.tag=e.tag}add(e){let t=e instanceof Q?e:new Q(e);rn(this.items,t.key)||this.items.push(t)}get(e,t){let n=rn(this.items,e);return!t&&n instanceof Q?n.key instanceof Y?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=rn(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Q(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues())return super.toString(e,t,n);throw Error(`Set items must all have null values`)}},B(pr,`tag`,`tag:yaml.org,2002:set`),mr={identify:e=>e instanceof Set,nodeClass:pr,default:!1,tag:`tag:yaml.org,2002:set`,resolve:ir,createNode:ar},hr=(e,t)=>{let n=t.split(`:`).reduce((e,t)=>e*60+Number(t),0);return e===`-`?-n:n},gr=({value:e})=>{if(isNaN(e)||!isFinite(e))return pn(e);let t=``;e<0&&(t=`-`,e=Math.abs(e));let n=[e%60];return e<60?n.unshift(0):(e=Math.round((e-n[0])/60),n.unshift(e%60),e>=60&&(e=Math.round((e-n[0])/60),n.unshift(e))),t+n.map(e=>e<10?`0`+String(e):String(e)).join(`:`).replace(/000000\d*$/,``)},_r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,resolve:(e,t,n)=>hr(t,n.replace(/_/g,``)),stringify:gr},vr={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,resolve:(e,t,n)=>hr(t,n.replace(/_/g,``)),stringify:gr},yr={identify:e=>e 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:(e,t,n,r,i,a,o,s,c)=>{s&&=(s+`00`).substr(1,3);let l=Date.UTC(t,n-1,r,i||0,a||0,o||0,s||0);if(c&&c!==`Z`){let e=hr(c[0],c.slice(1));Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e.toISOString().replace(/((T00:00)?:00)?\.000Z$/,``)},br={}}));function Sr(e,t,n){let r=new $(e);if(t instanceof Map)for(let[i,a]of t)r.items.push(e.createPair(i,a,n));else if(t&&typeof t==`object`)for(let i of Object.keys(t))r.items.push(e.createPair(i,t[i],n));return typeof e.sortMapEntries==`function`&&r.items.sort(e.sortMapEntries),r}function Cr(e,t,n){let r=new Z(e);if(t&&t[Symbol.iterator])for(let i of t){let t=e.createNode(i,n.wrapScalars,null,n);r.items.push(t)}return r}function wr(e,t,n){let{value:r}=e;return Nr(r)&&r>=0?n+r.toString(t):pn(e)}function Tr(e,t,n){let r=t.replace(/_/g,``);if(Hn.asBigInt){switch(n){case 2:r=`0b${r}`;break;case 8:r=`0o${r}`;break;case 16:r=`0x${r}`}let t=BigInt(r);return e===`-`?BigInt(-1)*t:t}let i=parseInt(r,n);return e===`-`?-1*i:i}function Er(e,t,n){let{value:r}=e;if(Jr(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return pn(e)}function Dr(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)||e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>(t.identify&&t.identify(e)||t.class&&e instanceof t.class)&&!t.format)}function Or(e,t,n){if(e instanceof J)return e;let{defaultPrefix:r,onTagObj:i,prevObjects:a,schema:o,wrapScalars:s}=n;t&&t.startsWith(`!!`)&&(t=r+t.slice(2));let c=Dr(e,t,o.tags);if(!c){if(typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`)return s?new Y(e):e;c=e instanceof Map?Ar:e[Symbol.iterator]?jr:Ar}i&&(i(c),delete n.onTagObj);let l={value:void 0,node:void 0};if(e&&typeof e==`object`&&a){let t=a.get(e);if(t){let e=new Ln(t);return n.aliasNodes.push(e),e}l.value=e,a.set(e,l)}return l.node=c.createNode?c.createNode(n.schema,e,n):s?new Y(e):e,t&&l.node instanceof J&&(l.node.tag=t),l.node}function kr(e,t,n,r){let i=e[r.replace(/\W/g,``)];if(!i){let t=Object.keys(e).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${r}"; use one of ${t}`)}if(Array.isArray(n))for(let e of n)i=i.concat(e);else typeof n==`function`&&(i=n(i.slice()));for(let e=0;e<i.length;++e){let n=i[e];if(typeof n==`string`){let r=t[n];if(!r){let e=Object.keys(t).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag "${n}"; use one of ${e}`)}i[e]=r}}return i}var Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r=o((()=>{Ft(),$n(),xr(),Ar={createNode:Sr,default:!0,nodeClass:$,tag:`tag:yaml.org,2002:map`,resolve:Dn},jr={createNode:Cr,default:!0,nodeClass:Z,tag:`tag:yaml.org,2002:seq`,resolve:jn},Mr=[Ar,jr,{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:vn,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),fn(e,t,n,r)},options:Wn}],Nr=e=>typeof e==`bigint`||Number.isInteger(e),Pr=(e,t,n)=>Hn.asBigInt?BigInt(e):parseInt(t,n),Fr={identify:e=>e==null,createNode:(e,t,n)=>n.wrapScalars?new Y(null):null,default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>null,options:Un,stringify:()=>Un.nullStr},Ir={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>e[0]===`t`||e[0]===`T`,options:Vn,stringify:({value:e})=>e?Vn.trueStr:Vn.falseStr},Lr={identify:e=>Nr(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o([0-7]+)$/,resolve:(e,t)=>Pr(e,t,8),options:Hn,stringify:e=>wr(e,8,`0o`)},Rr={identify:Nr,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:e=>Pr(e,e,10),options:Hn,stringify:pn},zr={identify:e=>Nr(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x([0-9a-fA-F]+)$/,resolve:(e,t)=>Pr(e,t,16),options:Hn,stringify:e=>wr(e,16,`0x`)},Br={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.inf|(\.nan))$/i,resolve:(e,t)=>t?NaN:e[0]===`-`?-1/0:1/0,stringify:pn},Vr={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify:({value:e})=>Number(e).toExponential()},Hr={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,resolve(e,t,n){let r=t||n,i=new Y(parseFloat(e));return r&&r[r.length-1]===`0`&&(i.minFractionDigits=r.length),i},stringify:pn},Ur=Mr.concat([Fr,Ir,Lr,Rr,zr,Br,Vr,Hr]),Wr=e=>typeof e==`bigint`||Number.isInteger(e),Gr=({value:e})=>JSON.stringify(e),Kr=[Ar,jr,{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:vn,stringify:Gr},{identify:e=>e==null,createNode:(e,t,n)=>n.wrapScalars?new Y(null):null,default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Gr},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true|false$/,resolve:e=>e===`true`,stringify:Gr},{identify:Wr,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:e=>Hn.asBigInt?BigInt(e):parseInt(e,10),stringify:({value:e})=>Wr(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Gr}],Kr.scalarFallback=e=>{throw SyntaxError(`Unresolved plain scalar ${JSON.stringify(e)}`)},qr=({value:e})=>e?Vn.trueStr:Vn.falseStr,Jr=e=>typeof e==`bigint`||Number.isInteger(e),Yr={core:Ur,failsafe:Mr,json:Kr,yaml11:Mr.concat([{identify:e=>e==null,createNode:(e,t,n)=>n.wrapScalars?new Y(null):null,default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>null,options:Un,stringify:()=>Un.nullStr},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>!0,options:Vn,stringify:qr},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>!1,options:Vn,stringify:qr},{identify:Jr,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^([-+]?)0b([0-1_]+)$/,resolve:(e,t,n)=>Tr(t,n,2),stringify:e=>Er(e,2,`0b`)},{identify:Jr,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^([-+]?)0([0-7_]+)$/,resolve:(e,t,n)=>Tr(t,n,8),stringify:e=>Er(e,8,`0`)},{identify:Jr,default:!0,tag:`tag:yaml.org,2002:int`,test:/^([-+]?)([0-9][0-9_]*)$/,resolve:(e,t,n)=>Tr(t,n,10),stringify:pn},{identify:Jr,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^([-+]?)0x([0-9a-fA-F_]+)$/,resolve:(e,t,n)=>Tr(t,n,16),stringify:e=>Er(e,16,`0x`)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.inf|(\.nan))$/i,resolve:(e,t)=>t?NaN:e[0]===`-`?-1/0:1/0,stringify:pn},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify:({value:e})=>Number(e).toExponential()},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,resolve(e,t){let n=new Y(parseFloat(e.replace(/_/g,``)));if(t){let e=t.replace(/_/g,``);e[e.length-1]===`0`&&(n.minFractionDigits=e.length)}return n},stringify:pn}],lr,fr,ur,mr,_r,vr,yr)},Xr={binary:lr,bool:Ir,float:Hr,floatExp:Vr,floatNaN:Br,floatTime:vr,int:Rr,intHex:zr,intOct:Lr,intTime:_r,map:Ar,null:Fr,omap:fr,pairs:ur,seq:jr,set:mr,timestamp:yr},Zr=(e,t)=>e.key<t.key?-1:+(e.key>t.key),Qr=class e{constructor({customTags:e,merge:t,schema:n,sortMapEntries:r,tags:i}){this.merge=!!t,this.name=n,this.sortMapEntries=r===!0?Zr:r||null,!e&&i&&cr(`tags`,`customTags`),this.tags=kr(Yr,Xr,e||i,n)}createNode(t,n,r,i){let a={defaultPrefix:e.defaultPrefix,schema:this,wrapScalars:n};return Or(t,r,i?Object.assign(i,a):a)}createPair(e,t,n){n||={wrapScalars:!0};let r=this.createNode(e,n.wrapScalars,null,n),i=this.createNode(t,n.wrapScalars,null,n);return new Q(r,i)}},B(Qr,`defaultPrefix`,kt),B(Qr,`defaultTags`,At)})),ei=/* @__PURE__ */ c({YAML:()=>Ci});function ti(e,t){if((e.version||e.options.version)===`1.0`){let e=t.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);if(e)return`!`+e[1];let n=t.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);return n?`!${n[1]}/${n[2]}`:`!${t.replace(/^tag:/,``)}`}let n=e.tagPrefixes.find(e=>t.indexOf(e.prefix)===0);if(!n){let r=e.getDefaults().tagPrefixes;n=r&&r.find(e=>t.indexOf(e.prefix)===0)}if(!n)return t[0]===`!`?t:`!<${t}>`;let r=t.substr(n.prefix.length).replace(/[!,[\]{}]/g,e=>({"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`})[e]);return n.handle+r}function ni(e,t){if(t instanceof Ln)return Ln;if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)||n[0]}let n,r;if(t instanceof Y){r=t.value;let i=e.filter(e=>e.identify&&e.identify(r)||e.class&&r instanceof e.class);n=i.find(e=>e.format===t.format)||i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r&&r.constructor?r.constructor.name:typeof r;throw Error(`Tag not resolved for ${e} value`)}return n}function ri(e,t,{anchors:n,doc:r}){let i=[],a=r.anchors.getName(e);return a&&(n[a]=e,i.push(`&${a}`)),e.tag?i.push(ti(r,e.tag)):t.default||i.push(ti(r,t.tag)),i.join(` `)}function ii(e,t,n,r){let{anchors:i,schema:a}=t.doc,o;if(!(e instanceof J)){let t={aliasNodes:[],onTagObj:e=>o=e,prevObjects:/* @__PURE__ */ new Map};e=a.createNode(e,!0,null,t);for(let e of t.aliasNodes){e.source=e.source.node;let t=i.getName(e.source);t||(t=i.newName(),i.map[t]=e.source)}}if(e instanceof Q)return e.toString(t,n,r);o||=ni(a.tags,e);let s=ri(e,o,t);s.length>0&&(t.indentAtStart=(t.indentAtStart||0)+s.length+1);let c=typeof o.stringify==`function`?o.stringify(e,t,n,r):e instanceof Y?fn(e,t,n,r):e.toString(t,n,r);return s?e instanceof Y||c[0]===`{`||c[0]===`[`?`${s} ${c}`:`${s}\n${t.indent}${c}`:c}function ai(e,t){let n={before:[],after:[]},r,i=!1;for(let a of t)if(a.valueRange){if(r!==void 0){e.errors.push(new K(a,`Document contains trailing content not separated by a ... or --- line`));break}let t=En(e,a);i&&=(t.spaceBefore=!0,!1),r=t}else a.comment===null?a.type===H.BLANK_LINE&&(i=!0,r===void 0&&n.before.length>0&&!e.commentBefore&&(e.commentBefore=n.before.join(`
|
|
156
|
+
`),n.before=[])):(r===void 0?n.before:n.after).push(a.comment);if(e.contents=r||null,!r)e.comment=n.before.concat(n.after).join(`
|
|
157
|
+
`)||null;else{let t=n.before.join(`
|
|
158
|
+
`);if(t){let e=r instanceof X&&r.items[0]?r.items[0]:r;e.commentBefore=e.commentBefore?`${t}\n${e.commentBefore}`:t}e.comment=n.after.join(`
|
|
159
|
+
`)||null}}function oi({tagPrefixes:e},t){let[n,r]=t.parameters;if(!n||!r)throw new G(t,`Insufficient parameters given for %TAG directive`);if(e.some(e=>e.handle===n))throw new G(t,`The %TAG directive must only be given at most once per handle in the same document.`);return{handle:n,prefix:r}}function si(e,t){let[n]=t.parameters;if(t.name===`YAML:1.0`&&(n=`1.0`),!n)throw new G(t,`Insufficient parameters given for %YAML directive`);if(!_i[n]){let r=`Document will be parsed as YAML ${e.version||e.options.version} rather than YAML ${n}`;e.warnings.push(new Nt(t,r))}return n}function ci(e,t,n){let r=[],i=!1;for(let n of t){let{comment:t,name:a}=n;switch(a){case`TAG`:try{e.tagPrefixes.push(oi(e,n))}catch(t){e.errors.push(t)}i=!0;break;case`YAML`:case`YAML:1.0`:e.version&&e.errors.push(new G(n,`The %YAML directive must only be given at most once per document.`));try{e.version=si(e,n)}catch(t){e.errors.push(t)}i=!0;break;default:if(a){let t=`YAML only supports %TAG and %YAML directives, and not %${a}`;e.warnings.push(new Nt(n,t))}}t&&r.push(t)}n&&!i&&(e.version||n.version||e.options.version)===`1.1`&&(e.tagPrefixes=n.tagPrefixes.map(({handle:e,prefix:t})=>({handle:e,prefix:t})),e.version=n.version),e.commentBefore=r.join(`
|
|
160
|
+
`)||null}function li(e){if(e instanceof X)return!0;throw Error(`Expected a YAML collection as document contents`)}function ui(e,t=!0,n){n===void 0&&typeof t==`string`&&(n=t,t=!0);let r=Object.assign({},xi.defaults[hi.version],hi);return new Qr(r).createNode(e,t,n)}function di(e,t){let n=[],r;for(let i of Rt(e)){let e=new Si(t);e.parse(i,r),n.push(e),r=e}return n}function fi(e,t){let n=Rt(e),r=new Si(t).parse(n[0]);return n.length>1&&r.errors.unshift(new G(n[1],`Source contains multiple documents; please use YAML.parseAllDocuments()`)),r}function pi(e,t){let n=fi(e,t);if(n.warnings.forEach(e=>sr(e)),n.errors.length>0)throw n.errors[0];return n.toJSON()}function mi(e,t){let n=new Si(t);return n.contents=e,String(n)}var hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi=o((()=>{Qt(),Ft(),$n(),$r(),xr(),hi={anchorPrefix:`a`,customTags:null,indent:2,indentSeq:!0,keepCstNodes:!1,keepNodeTypes:!0,keepBlobsInJSON:!0,mapAsMap:!1,maxAliasCount:100,prettyErrors:!1,simpleKeys:!1,version:`1.2`},gi={get binary(){return Bn},set binary(e){Object.assign(Bn,e)},get bool(){return Vn},set bool(e){Object.assign(Vn,e)},get int(){return Hn},set int(e){Object.assign(Hn,e)},get null(){return Un},set null(e){Object.assign(Un,e)},get str(){return Wn},set str(e){Object.assign(Wn,e)}},_i={"1.0":{schema:`yaml-1.1`,merge:!0,tagPrefixes:[{handle:`!`,prefix:kt},{handle:`!!`,prefix:`tag:private.yaml.org,2002:`}]},1.1:{schema:`yaml-1.1`,merge:!0,tagPrefixes:[{handle:`!`,prefix:`!`},{handle:`!!`,prefix:kt}]},1.2:{schema:`core`,merge:!1,tagPrefixes:[{handle:`!`,prefix:`!`},{handle:`!!`,prefix:kt}]}},vi=class e{static validAnchorNode(e){return e instanceof Y||e instanceof Z||e instanceof $}constructor(e){B(this,`map`,Object.create(null)),this.prefix=e}createAlias(e,t){return this.setAnchor(e,t),new Ln(e)}createMergePair(...e){let t=new zn;return t.value.items=e.map(e=>{if(e instanceof Ln){if(e.source instanceof $)return e}else if(e instanceof $)return this.createAlias(e);throw Error(`Merge sources must be Map nodes or their Aliases`)}),t}getName(e){let{map:t}=this;return Object.keys(t).find(n=>t[n]===e)}getNames(){return Object.keys(this.map)}getNode(e){return this.map[e]}newName(e){e||=this.prefix;let t=Object.keys(this.map);for(let n=1;;++n){let r=`${e}${n}`;if(!t.includes(r))return r}}resolveNodes(){let{map:e,_cstAliases:t}=this;Object.keys(e).forEach(t=>{e[t]=e[t].resolved}),t.forEach(e=>{e.source=e.source.resolved}),delete this._cstAliases}setAnchor(t,n){if(t!=null&&!e.validAnchorNode(t))throw Error(`Anchors may only be set for Scalar, Seq and Map nodes`);if(n&&/[\x00-\x19\s,[\]{}]/.test(n))throw Error(`Anchor names must not contain whitespace or control characters`);let{map:r}=this,i=t&&Object.keys(r).find(e=>r[e]===t);if(i){if(n)i!==n&&(delete r[i],r[n]=t);else return i}else{if(!n){if(!t)return null;n=this.newName()}r[n]=t}return n}},yi=(e,t)=>{if(e&&typeof e==`object`){let{tag:n}=e;e instanceof X?(n&&(t[n]=!0),e.items.forEach(e=>yi(e,t))):e instanceof Q?(yi(e.key,t),yi(e.value,t)):e instanceof Y&&n&&(t[n]=!0)}return t},bi=e=>Object.keys(yi(e,{})),xi=class e{constructor(e){this.anchors=new vi(e.anchorPrefix),this.commentBefore=null,this.comment=null,this.contents=null,this.directivesEndMarker=null,this.errors=[],this.options=e,this.schema=null,this.tagPrefixes=[],this.version=null,this.warnings=[]}add(e){return li(this.contents),this.contents.add(e)}addIn(e,t){li(this.contents),this.contents.addIn(e,t)}delete(e){return li(this.contents),this.contents.delete(e)}deleteIn(e){return Pn(e)?this.contents!=null&&(this.contents=null,!0):(li(this.contents),this.contents.deleteIn(e))}getDefaults(){return e.defaults[this.version]||e.defaults[this.options.version]||{}}get(e,t){return this.contents instanceof X?this.contents.get(e,t):void 0}getIn(e,t){return Pn(e)?!t&&this.contents instanceof Y?this.contents.value:this.contents:this.contents instanceof X?this.contents.getIn(e,t):void 0}has(e){return this.contents instanceof X&&this.contents.has(e)}hasIn(e){return Pn(e)?this.contents!==void 0:this.contents instanceof X&&this.contents.hasIn(e)}set(e,t){li(this.contents),this.contents.set(e,t)}setIn(e,t){Pn(e)?this.contents=t:(li(this.contents),this.contents.setIn(e,t))}setSchema(e,t){if(!e&&!t&&this.schema)return;typeof e==`number`&&(e=e.toFixed(1)),e===`1.0`||e===`1.1`||e===`1.2`?(this.version?this.version=e:this.options.version=e,delete this.options.schema):e&&typeof e==`string`&&(this.options.schema=e),Array.isArray(t)&&(this.options.customTags=t);let n=Object.assign({},this.getDefaults(),this.options);this.schema=new Qr(n)}parse(e,t){this.options.keepCstNodes&&(this.cstNode=e),this.options.keepNodeTypes&&(this.type=`DOCUMENT`);let{directives:n=[],contents:r=[],directivesEndMarker:i,error:a,valueRange:o}=e;if(a&&(a.source||=this,this.errors.push(a)),ci(this,n,t),i&&(this.directivesEndMarker=!0),this.range=o?[o.start,o.end]:null,this.setSchema(),this.anchors._cstAliases=[],ai(this,r),this.anchors.resolveNodes(),this.options.prettyErrors){for(let e of this.errors)e instanceof jt&&e.makePretty();for(let e of this.warnings)e instanceof jt&&e.makePretty()}return this}listNonDefaultTags(){return bi(this.contents).filter(e=>e.indexOf(Qr.defaultPrefix)!==0)}setTagPrefix(e,t){if(e[0]!==`!`||e[e.length-1]!==`!`)throw Error(`Handle must start and end with !`);if(t){let n=this.tagPrefixes.find(t=>t.handle===e);n?n.prefix=t:this.tagPrefixes.push({handle:e,prefix:t})}else this.tagPrefixes=this.tagPrefixes.filter(t=>t.handle!==e)}toJSON(e,t){let{keepBlobsInJSON:n,mapAsMap:r,maxAliasCount:i}=this.options,a=n&&(typeof e!=`string`||!(this.contents instanceof Y)),o={doc:this,indentStep:` `,keep:a,mapAsMap:a&&!!r,maxAliasCount:i,stringify:ii},s=Object.keys(this.anchors.map);s.length>0&&(o.anchors=new Map(s.map(e=>[this.anchors.map[e],{alias:[],aliasCount:0,count:1}])));let c=q(this.contents,e,o);if(typeof t==`function`&&o.anchors)for(let{count:e,res:n}of o.anchors.values())t(n,e);return c}toString(){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);let e=this.options.indent;if(!Number.isInteger(e)||e<=0){let t=JSON.stringify(e);throw Error(`"indent" option must be a positive integer, not ${t}`)}this.setSchema();let t=[],n=!1;if(this.version){let e=`%YAML 1.2`;this.schema.name===`yaml-1.1`&&(this.version===`1.0`?e=`%YAML:1.0`:this.version===`1.1`&&(e=`%YAML 1.1`)),t.push(e),n=!0}let r=this.listNonDefaultTags();this.tagPrefixes.forEach(({handle:e,prefix:i})=>{r.some(e=>e.indexOf(i)===0)&&(t.push(`%TAG ${e} ${i}`),n=!0)}),(n||this.directivesEndMarker)&&t.push(`---`),this.commentBefore&&((n||!this.directivesEndMarker)&&t.unshift(``),t.unshift(this.commentBefore.replace(/^/gm,`#`)));let i={anchors:Object.create(null),doc:this,indent:``,indentStep:` `.repeat(e),stringify:ii},a=!1,o=null;if(this.contents){this.contents instanceof J&&(this.contents.spaceBefore&&(n||this.directivesEndMarker)&&t.push(``),this.contents.commentBefore&&t.push(this.contents.commentBefore.replace(/^/gm,`#`)),i.forceBlockIndent=!!this.comment,o=this.contents.comment);let e=o?null:()=>a=!0,r=ii(this.contents,i,()=>o=null,e);t.push(en(r,``,o))}else this.contents!==void 0&&t.push(ii(this.contents,i));return this.comment&&((!a||o)&&t[t.length-1]!==``&&t.push(``),t.push(this.comment.replace(/^/gm,`#`))),t.join(`
|
|
161
|
+
`)+`
|
|
162
|
+
`}},B(xi,`defaults`,_i),Si=class extends xi{constructor(e){super(Object.assign({},hi,e))}},Ci={createNode:ui,defaultOptions:hi,Document:Si,parse:pi,parseAllDocuments:di,parseCST:Rt,parseDocument:fi,scalarOptions:gi,stringify:mi}})),Ti=/* @__PURE__ */ s(((e,t)=>{t.exports=(wi(),d(ei)).YAML})),Ei=/* @__PURE__ */ s(((e,t)=>{function n(e){return e.replace(/\~/g,`~0`).replace(/\//g,`~1`)}function r(e){return e.replace(/\~1/g,`/`).replace(/~0/g,`~`)}function i(e,t,n){if(e===void 0)return!1;if(!t||typeof t!=`string`||t===`#`)return n===void 0?e:n;if(t.indexOf(`#`)>=0){let e=t.split(`#`);if(e[0])return!1;t=e[1],t=decodeURIComponent(t.slice(1).split(`+`).join(` `))}t.startsWith(`/`)&&(t=t.slice(1));let i=t.split(`/`);for(let t=0;t<i.length;t++){i[t]=r(i[t]);let a=n!==void 0&&t==i.length-1,o=parseInt(i[t],10);if(!Array.isArray(e)||isNaN(o)||o.toString()!==i[t]?o=Array.isArray(e)&&i[t]===`-`?-2:-1:i[t]=t>0?i[t-1]:``,o!=-1||e&&e.hasOwnProperty(i[t])){if(o>=0)a&&(e[o]=n),e=e[o];else if(o===-2)return a?(Array.isArray(e)&&e.push(n),n):void 0;else a&&(e[i[t]]=n),e=e[i[t]]}else if(n!==void 0&&typeof e==`object`&&!Array.isArray(e))e[i[t]]=a?n:i[t+1]===`0`||i[t+1]===`-`?[]:{},e=e[i[t]];else return!1}return e}t.exports={jptr:i,jpescape:n,jpunescape:r}})),Di=/* @__PURE__ */ s(((e,t)=>{function n(e,t){return t===`$ref`&&!!e&&typeof e[t]==`string`}t.exports={isRef:n}})),Oi=/* @__PURE__ */ s(((e,t)=>{function n(e){return e}function r(e){return JSON.parse(JSON.stringify(e))}function i(e){let t={};for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function a(e){let t=Array.isArray(e)?[]:{};for(let n in e)(e.hasOwnProperty(n)||Array.isArray(e))&&(t[n]=typeof e[n]==`object`?a(e[n]):e[n]);return t}function o(e){return Object.assign({},e)}function s(e,t){if(t||=/* @__PURE__ */ new WeakMap,Object(e)!==e||e instanceof Function)return e;if(t.has(e))return t.get(e);try{var n=new e.constructor}catch{n=Object.create(Object.getPrototypeOf(e))}return t.set(e,n),Object.assign(n,...Object.keys(e).map(n=>({[n]:s(e[n],t)})))}t.exports={nop:n,clone:r,shallowClone:i,deepClone:a,fastClone:o,circularClone:s}})),ki=/* @__PURE__ */ s(((e,t)=>{let n=Ei().jpescape;function r(){return{path:`#`,depth:0,pkey:``,parent:{},payload:{},seen:/* @__PURE__ */ new WeakMap,identity:!1,identityDetection:!1}}function i(e,t,a){if(t||={depth:0},t.depth||(t=Object.assign({},r(),t)),typeof e!=`object`)return;let o=t.path;for(let r in e){if(t.key=r,t.path=t.path+`/`+encodeURIComponent(n(r)),t.identityPath=t.seen.get(e[r]),t.identity=t.identityPath!==void 0,e.hasOwnProperty(r)&&a(e,r,t),typeof e[r]==`object`&&!t.identity){t.identityDetection&&!Array.isArray(e[r])&&e[r]!==null&&t.seen.set(e[r],t.path);let n={};n.parent=e,n.path=t.path,n.depth=t.depth?t.depth+1:1,n.pkey=r,n.payload=t.payload,n.seen=t.seen,n.identity=!1,n.identityDetection=t.identityDetection,i(e[r],n,a)}t.path=o}}t.exports={recurse:i}})),Ai=/* @__PURE__ */ s(((e,t)=>{let n=ki().recurse,r=Oi().shallowClone,i=Ei().jptr,a=Di().isRef;var o=function(e){return e&&e.verbose?{warn:function(){var e=Array.prototype.slice.call(arguments);console.warn.apply(console,e)}}:{warn:function(){}}};function s(e,t,c){c||={},c.cache||(c.cache={}),c.state||(c.state={}),c.state.identityDetection=!0,c.depth=c.depth?c.depth+1:1;let l=c.depth>1?e:r(e),u={data:l},d=c.depth>1?t:r(t);c.master||(c.master=l);let f=o(c),p=1;for(;p>0;)p=0,n(u,c.state,function(e,t,n){if(a(e,t)){let r=e[t];if(p++,c.cache[r]){let e=c.cache[r];if(e.resolved)f.warn(`Patching %s for %s`,r,e.path),n.parent[n.pkey]=e.data,c.$ref&&typeof n.parent[n.pkey]==`object`&&n.parent[n.pkey]!==null&&(n.parent[n.pkey][c.$ref]=r);else if(r===e.path)throw Error(`Tight circle at ${e.path}`);else f.warn(`Unresolved ref`),n.parent[n.pkey]=i(e.source,e.path),n.parent[n.pkey]===!1&&(n.parent[n.pkey]=i(e.source,e.key)),c.$ref&&typeof n.parent[n.pkey]==`object`&&n.parent[n.pkey]!==null&&(n.parent[c.$ref]=r)}else{let e={};e.path=n.path.split(`/$ref`)[0],e.key=r,f.warn(`Dereffing %s at %s`,r,e.path),e.source=d,e.data=i(e.source,e.key),e.data===!1&&(e.data=i(c.master,e.key),e.source=c.master),e.data===!1&&f.warn(`Missing $ref target`,e.key),c.cache[r]=e,e.data=n.parent[n.pkey]=s(i(e.source,e.key),e.source,c),c.$ref&&typeof n.parent[n.pkey]==`object`&&n.parent[n.pkey]!==null&&(n.parent[n.pkey][c.$ref]=r),e.resolved=!0}}});return u.data}t.exports={dereference:s}})),ji=/* @__PURE__ */ s(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit||u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:+(e>t)}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit||d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}})),Mi=/* @__PURE__ */ s(((e,t)=>{let n=ji(),r={}.NODE_DISABLE_COLORS?{red:``,yellow:``,green:``,normal:``}:{red:`\x1B[31m`,yellow:`\x1B[33;1m`,green:`\x1B[32m`,normal:`\x1B[0m`};function i(e,t,n){return n.indexOf(e)===t}function a(e){return new Set(e).size!==e.length}function o(e){return new Set(e).size<=1}function s(e,t){function r(e,t){return n.stringify(e)===n.stringify(Object.assign({},e,t))}return r(e,t)&&r(t,e)}function c(e){let t=[];for(let n of e)t.find(function(e,t,r){return s(e,n)})||t.push(n);return t}function l(e){return e.length===c(e).length}function u(e){return e.find(function(t,n,r){return e.indexOf(t)<n})}function d(e){let t=0,n;if(e.length===0)return t;for(let r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t}String.prototype.toCamelCase=function(){return this.toLowerCase().replace(/[-_ \/\.](.)/g,function(e,t){return t.toUpperCase()})};let f=[`format`,`minimum`,`maximum`,`exclusiveMinimum`,`exclusiveMaximum`,`minLength`,`maxLength`,`multipleOf`,`minItems`,`maxItems`,`uniqueItems`,`minProperties`,`maxProperties`,`additionalProperties`,`pattern`,`enum`,`default`],p=[`items`,`minItems`,`maxItems`,`uniqueItems`],m=[`get`,`post`,`put`,`delete`,`patch`,`head`,`options`,`trace`];function h(e){e=e.replace(`[]`,`Array`);let t=e.split(`/`);return t[0]=t[0].replace(/[^A-Za-z0-9_\-\.]+|\s+/gm,`_`),t.join(`/`)}function g(e){return h(e.split(`/`).join(`_`))}t.exports={colour:r,uniqueOnly:i,hasDuplicates:a,allSame:o,distinctArray:l,firstDupe:u,hash:d,parameterTypeProperties:f,arrayProperties:p,httpMethods:m,sanitise:h,sanitiseAll:g}})),Ni=/* @__PURE__ */ s(((e,t)=>{let n=(yt(),d(ct)),r=(yt(),d(ct)),i=(yt(),d(ct)),a=(yt(),d(ct)),o=Ti(),s=Ei().jptr,c=ki().recurse,l=Oi().clone,u=Ai().dereference,f=Di().isRef,p=Mi();function m(e){return[...new Set(e)]}function h(e,t,r,i,a){return new Promise(function(o,s){n.readFile(e,t,function(e,t){e?r.ignoreIOErrors&&a?(r.verbose&&console.warn(`FAILED`,i),r.externalRefs[i].failed=!0,o(a)):s(e):o(t)})})}function g(e,t,n,r,a,o){let u=o.externalRefs[n+r].paths[0],d=i.parse(a),m={},h=1;for(;h;)h=0,c(e,{identityDetection:!0},function(e,n,r){if(f(e,n)){if(e[n].startsWith(`#`)){if(!m[e[n]]&&!e.$fixed){let i=l(s(t,e[n]));if(o.verbose>1&&console.warn((i===!1?p.colour.red:p.colour.green)+`Fragment resolution`,e[n],p.colour.normal),i===!1){if(r.parent[r.pkey]={},o.fatal){let t=/* @__PURE__ */ Error(`Fragment $ref resolution failed `+e[n]);if(o.promise)o.promise.reject(t);else throw t}}else h++,r.parent[r.pkey]=i,m[e[n]]=r.path.replace(`/%24ref`,``)}else if(!e.$fixed){let t=(u+`/`+m[e[n]]).split(`/#/`).join(`/`);r.parent[r.pkey]={$ref:t,"x-miro":e[n],$fixed:!0},o.verbose>1&&console.warn(`Replacing with`,t),h++}}else if(d.protocol){let t=i.resolve(a,e[n]).toString();o.verbose>1&&console.warn(p.colour.yellow+`Rewriting external url ref`,e[n],`as`,t,p.colour.normal),e[`x-miro`]=e[n],o.externalRefs[e[n]]&&(o.externalRefs[t]||(o.externalRefs[t]=o.externalRefs[e[n]]),o.externalRefs[t].failed=o.externalRefs[e[n]].failed),e[n]=t}else if(!e[`x-miro`]){let t=i.resolve(a,e[n]).toString(),r=!1;o.externalRefs[e[n]]&&(r=o.externalRefs[e[n]].failed),r||(o.verbose>1&&console.warn(p.colour.yellow+`Rewriting external ref`,e[n],`as`,t,p.colour.normal),e[`x-miro`]=e[n],e[n]=t)}}});return c(e,{},function(e,t,n){f(e,t)&&e.$fixed!==void 0&&delete e.$fixed}),o.verbose>1&&console.warn(`Finished fragment resolution`),e}function _(e,t){if(!t.filters||!t.filters.length)return e;for(let n of t.filters)e=n(e,t);return e}function v(e,t){return e&&e.length>2?e:t&&t.length>2?t:`file:`}function y(e,t,n,a){var c=i.parse(n.source),u=n.source.split(`\\`).join(`/`).split(`/`);u.pop()||u.pop();let d=``,f=t.split(`#`);f.length>1&&(d=`#`+f[1],t=f[0]),u=u.join(`/`);let p=v(i.parse(t).protocol,c.protocol),m;if(m=p===`file:`?r.resolve(u?u+`/`:``,t):i.resolve(u?u+`/`:``,t),n.cache[m]){n.verbose&&console.warn(`CACHED`,m,d);let e=l(n.cache[m]),r=n.externalRef=e;if(d&&(r=s(r,d),r===!1&&(r={},n.fatal))){let e=/* @__PURE__ */ Error(`Cached $ref resolution failed `+m+d);if(n.promise)n.promise.reject(e);else throw e}return r=g(r,e,t,d,m,n),r=_(r,n),a(l(r),m,n),Promise.resolve(r)}if(n.verbose&&console.warn(`GET`,m,d),n.handlers&&n.handlers[p])return n.handlers[p](u,t,d,n).then(function(e){return n.externalRef=e,e=_(e,n),n.cache[m]=e,a(e,m,n),e}).catch(function(e){throw n.verbose&&console.warn(e),e});if(p&&p.startsWith(`http`)){let e=Object.assign({},n.fetchOptions,{agent:n.agent});return n.fetch(m,e).then(function(e){if(e.status!==200){if(n.ignoreIOErrors)return n.verbose&&console.warn(`FAILED`,t),n.externalRefs[t].failed=!0,`{"$ref":"`+t+`"}`;throw Error(`Received status code ${e.status}: ${m}`)}return e.text()}).then(function(e){try{let r=o.parse(e,{schema:`core`,prettyErrors:!0});if(e=n.externalRef=r,n.cache[m]=l(e),d&&(e=s(e,d),e===!1&&(e={},n.fatal))){let e=/* @__PURE__ */ Error(`Remote $ref resolution failed `+m+d);if(n.promise)n.promise.reject(e);else throw e}e=g(e,r,t,d,m,n),e=_(e,n)}catch(e){if(n.verbose&&console.warn(e),n.promise&&n.fatal)n.promise.reject(e);else throw e}return a(e,m,n),e}).catch(function(e){if(n.verbose&&console.warn(e),n.cache[m]={},n.promise&&n.fatal)n.promise.reject(e);else throw e})}{let e=`{"$ref":"`+t+`"}`;return h(m,n.encoding||`utf8`,n,t,e).then(function(e){try{let r=o.parse(e,{schema:`core`,prettyErrors:!0});if(e=n.externalRef=r,n.cache[m]=l(e),d&&(e=s(e,d),e===!1&&(e={},n.fatal))){let e=/* @__PURE__ */ Error(`File $ref resolution failed `+m+d);if(n.promise)n.promise.reject(e);else throw e}e=g(e,r,t,d,m,n),e=_(e,n)}catch(e){if(n.verbose&&console.warn(e),n.promise&&n.fatal)n.promise.reject(e);else throw e}return a(e,m,n),e}).catch(function(e){if(n.verbose&&console.warn(e),n.promise&&n.fatal)n.promise.reject(e);else throw e})}}function b(e){return new Promise(function(t,n){function r(t,n,r){if(t[n]&&f(t[n],`$ref`)){let a=t[n].$ref;if(!a.startsWith(`#`)){let o=``;if(!i[a]){let t=Object.keys(i).find(function(e,t,n){return a.startsWith(e+`/`)});t&&(e.verbose&&console.warn(`Found potential subschema at`,t),o=`/`+(a.split(`#`)[1]||``).replace(t.split(`#`)[1]||``),o=o.split(`/undefined`).join(``),a=t)}if(i[a]||(i[a]={resolved:!1,paths:[],extras:{},description:t[n].description}),i[a].resolved){if(!i[a].failed){if(e.rewriteRefs){let r=i[a].resolvedAt;e.verbose>1&&console.warn(`Rewriting ref`,a,r),t[n][`x-miro`]=a,t[n].$ref=r+o}else t[n]=l(i[a].data)}}else i[a].paths.push(r.path),i[a].extras[r.path]=o}}}let i=e.externalRefs;if(e.resolver.depth>0&&e.source===e.resolver.base)return t(i);c(e.openapi.definitions,{identityDetection:!0,path:`#/definitions`},r),c(e.openapi.components,{identityDetection:!0,path:`#/components`},r),c(e.openapi,{identityDetection:!0},r),t(i)})}function x(e){return new Promise(function(t,n){b(e).then(function(t){for(let n in t)if(!t[n].resolved){let r=e.resolver.depth;r>0&&r++,e.resolver.actions[r].push(function(){return y(e.openapi,n,e,function(e,r,i){if(!t[n].resolved){let a={};a.context=t[n],a.$ref=n,a.original=l(e),a.updated=e,a.source=r,i.externals.push(a),t[n].resolved=!0}let a=Object.assign({},i,{source:``,resolver:{actions:i.resolver.actions,depth:i.resolver.actions.length-1,base:i.resolver.base}});i.patch&&t[n].description&&!e.description&&typeof e==`object`&&(e.description=t[n].description),t[n].data=e;let o=m(t[n].paths);o=o.sort(function(e,t){let n=e.startsWith(`#/components/`)||e.startsWith(`#/definitions/`),r=t.startsWith(`#/components/`)||t.startsWith(`#/definitions/`);return n&&!r?-1:r&&!n?1:0});for(let r of o)if(t[n].resolvedAt&&r!==t[n].resolvedAt&&r.indexOf(`x-ms-examples/`)<0)i.verbose>1&&console.warn(`Creating pointer to data at`,r),s(i.openapi,r,{$ref:t[n].resolvedAt+t[n].extras[r],"x-miro":n+t[n].extras[r]});else{t[n].resolvedAt?i.verbose>1&&console.warn(`Avoiding circular reference`):(t[n].resolvedAt=r,i.verbose>1&&console.warn(`Creating initial clone of data at`,r));let a=l(e);s(i.openapi,r,a)}i.resolver.actions[a.resolver.depth].length===0&&i.resolver.actions[a.resolver.depth].push(function(){return x(a)})})})}}).catch(function(t){e.verbose&&console.warn(t),n(t)});let r={options:e};r.actions=e.resolver.actions[e.resolver.depth],t(r)})}let S=e=>e.reduce((e,t)=>e.then(e=>t().then(Array.prototype.concat.bind(e))),Promise.resolve([]));function C(e,t,n){e.resolver.actions.push([]),x(e).then(function(r){S(r.actions).then(function(){if(e.resolver.depth>=e.resolver.actions.length)return console.warn(`Ran off the end of resolver actions`),t(!0);e.resolver.depth++,e.resolver.actions[e.resolver.depth].length?setTimeout(function(){C(r.options,t,n)},0):(e.verbose>1&&console.warn(p.colour.yellow+`Finished external resolution!`,p.colour.normal),e.resolveInternal&&(e.verbose>1&&console.warn(p.colour.yellow+`Starting internal resolution!`,p.colour.normal),e.openapi=u(e.openapi,e.original,{verbose:e.verbose-1}),e.verbose>1&&console.warn(p.colour.yellow+`Finished internal resolution!`,p.colour.normal)),c(e.openapi,{},function(t,n,r){f(t,n)&&(e.preserveMiro||delete t[`x-miro`])}),t(e))}).catch(function(t){e.verbose&&console.warn(t),n(t)})}).catch(function(t){e.verbose&&console.warn(t),n(t)})}function w(e){if(e.cache||={},e.fetch||=a,e.source){let t=i.parse(e.source);(!t.protocol||t.protocol.length<=2)&&(e.source=r.resolve(e.source))}e.externals=[],e.externalRefs={},e.rewriteRefs=!0,e.resolver={},e.resolver.depth=0,e.resolver.base=e.source,e.resolver.actions=[[]]}function ee(e){return w(e),new Promise(function(t,n){e.resolve?C(e,t,n):t(e)})}function T(e,t,n){return n||={},n.openapi=e,n.source=t,n.resolve=!0,w(n),new Promise(function(e,t){C(n,e,t)})}t.exports={optionalResolve:ee,resolve:T}})),Pi=/* @__PURE__ */ s(((e,t)=>{function n(){return{depth:0,seen:/* @__PURE__ */ new WeakMap,top:!0,combine:!1,allowRefSiblings:!1}}function r(e,t,i,a){if(i.depth===void 0&&(i=n()),e==null)return e;if(e.$ref!==void 0){let n={$ref:e.$ref};return i.allowRefSiblings&&e.description&&(n.description=e.description),a(n,t,i),n}if(i.combine&&(e.allOf&&Array.isArray(e.allOf)&&e.allOf.length===1&&(e=Object.assign({},e.allOf[0],e),delete e.allOf),e.anyOf&&Array.isArray(e.anyOf)&&e.anyOf.length===1&&(e=Object.assign({},e.anyOf[0],e),delete e.anyOf),e.oneOf&&Array.isArray(e.oneOf)&&e.oneOf.length===1&&(e=Object.assign({},e.oneOf[0],e),delete e.oneOf)),a(e,t,i),i.seen.has(e))return e;if(typeof e==`object`&&e&&i.seen.set(e,!0),i.top=!1,i.depth++,e.items!==void 0&&(i.property=`items`,r(e.items,e,i,a)),e.additionalItems&&typeof e.additionalItems==`object`&&(i.property=`additionalItems`,r(e.additionalItems,e,i,a)),e.additionalProperties&&typeof e.additionalProperties==`object`&&(i.property=`additionalProperties`,r(e.additionalProperties,e,i,a)),e.properties)for(let t in e.properties){let n=e.properties[t];i.property=`properties/`+t,r(n,e,i,a)}if(e.patternProperties)for(let t in e.patternProperties){let n=e.patternProperties[t];i.property=`patternProperties/`+t,r(n,e,i,a)}if(e.allOf)for(let t in e.allOf){let n=e.allOf[t];i.property=`allOf/`+t,r(n,e,i,a)}if(e.anyOf)for(let t in e.anyOf){let n=e.anyOf[t];i.property=`anyOf/`+t,r(n,e,i,a)}if(e.oneOf)for(let t in e.oneOf){let n=e.oneOf[t];i.property=`oneOf/`+t,r(n,e,i,a)}return e.not&&(i.property=`not`,r(e.not,e,i,a)),i.depth--,e}t.exports={getDefaultState:n,walkSchema:r}})),Fi=/* @__PURE__ */ s(((e,t)=>{let n=(yt(),d(ct));t.exports={statusCodes:Object.assign({},{default:`Default response`,"1XX":`Informational`,103:`Early hints`,"2XX":`Successful`,"3XX":`Redirection`,"4XX":`Client Error`,"5XX":`Server Error`,"7XX":`Developer Error`},n.STATUS_CODES)}})),Ii=/* @__PURE__ */ c({author:()=>qi,bin:()=>Vi,browserify:()=>Wi,bugs:()=>Ki,default:()=>Qi,dependencies:()=>Yi,description:()=>zi,funding:()=>Hi,gitHead:()=>Zi,keywords:()=>Xi,license:()=>Ji,main:()=>Bi,name:()=>Li,repository:()=>Gi,scripts:()=>Ui,version:()=>Ri}),Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i=o((()=>{Li=`swagger2openapi`,Ri=`7.0.8`,zi=`Convert Swagger 2.0 definitions to OpenApi 3.0 and validate`,Bi=`index.js`,Vi={swagger2openapi:`./swagger2openapi.js`,"oas-validate":`./oas-validate.js`,boast:`./boast.js`},Hi=`https://github.com/Mermade/oas-kit?sponsor=1`,Ui={test:`mocha`},Wi={transform:[[`babelify`,{presets:[`es2015`]}]]},Gi={url:`https://github.com/Mermade/oas-kit.git`,type:`git`},Ki={url:`https://github.com/mermade/oas-kit/issues`},qi=`Mike Ralphson <mike.ralphson@gmail.com>`,Ji=`BSD-3-Clause`,Yi={"call-me-maybe":`^1.0.1`,"node-fetch":`^2.6.1`,"node-fetch-h2":`^2.3.0`,"node-readfiles":`^0.2.0`,"oas-kit-common":`^1.0.8`,"oas-resolver":`^2.5.6`,"oas-schema-walker":`^1.1.5`,"oas-validator":`^5.0.8`,reftools:`^1.1.9`,yaml:`^1.10.0`,yargs:`^17.0.1`},Xi=[`swagger`,`openapi`,`openapi2`,`openapi3`,`converter`,`conversion`,`validator`,`validation`,`resolver`,`lint`,`linter`],Zi=`b1bba3fc5007e96a991bf2a015cf0534ac36b88b`,Qi={name:Li,version:Ri,description:zi,main:Bi,bin:Vi,funding:Hi,scripts:Ui,browserify:Wi,repository:Gi,bugs:Ki,author:qi,license:Ji,dependencies:Yi,keywords:Xi,gitHead:Zi}})),ea=/* @__PURE__ */ u((/* @__PURE__ */ s(((e,t)=>{let n=(yt(),d(ct)),r=(yt(),d(ct));yt();let i=xt(),a=(yt(),d(ct)),o=Ti(),s=Ei(),c=s.jptr,l=Di().isRef,u=Oi().clone,f=Oi().circularClone,p=ki().recurse,m=Ni(),h=Pi(),g=Mi(),_=Fi().statusCodes,v=($i(),d(Ii).default).version,y=`3.0.0`,b;var x=class extends Error{constructor(e){super(e),this.name=`S2OError`}};function S(e,t){let n=new x(e);if(n.options=t,t.promise)t.promise.reject(n);else throw n}function C(e,t,n){n.warnOnly?t[n.warnProperty||`x-s2o-warning`]=e:S(e,n)}function w(e,t,n){if(e.nullable&&n.patches++,e.discriminator&&typeof e.discriminator==`string`&&(e.discriminator={propertyName:e.discriminator}),e.items&&Array.isArray(e.items)&&(e.items=e.items.length===0?{}:e.items.length===1?e.items[0]:{anyOf:e.items}),e.type&&Array.isArray(e.type)){if(n.patch){if(n.patches++,e.type.length===0)delete e.type;else{e.oneOf||=[];for(let t of e.type){let n={};if(t===`null`)e.nullable=!0;else{n.type=t;for(let t of g.arrayProperties)e.prop!==void 0&&(n[t]=e[t],delete e[t])}n.type&&e.oneOf.push(n)}delete e.type,e.oneOf.length===0?delete e.oneOf:e.oneOf.length<2&&(e.type=e.oneOf[0].type,Object.keys(e.oneOf[0]).length>1&&C(`Lost properties from oneOf`,e,n),delete e.oneOf)}e.type&&Array.isArray(e.type)&&e.type.length===1&&(e.type=e.type[0])}else S(`(Patchable) schema type must not be an array`,n)}e.type&&e.type===`null`&&(delete e.type,e.nullable=!0),e.type===`array`&&!e.items&&(e.items={}),e.type===`file`&&(e.type=`string`,e.format=`binary`),typeof e.required==`boolean`&&(e.required&&e.name&&(t.required===void 0&&(t.required=[]),Array.isArray(t.required)&&t.required.push(e.name)),delete e.required),e.xml&&typeof e.xml.namespace==`string`&&(e.xml.namespace||delete e.xml.namespace),e.allowEmptyValue!==void 0&&(n.patches++,delete e.allowEmptyValue)}function ee(e,t){if(e[`x-required`]&&Array.isArray(e[`x-required`])&&(e.required||=[],e.required=e.required.concat(e[`x-required`]),delete e[`x-required`]),e[`x-anyOf`]&&(e.anyOf=e[`x-anyOf`],delete e[`x-anyOf`]),e[`x-oneOf`]&&(e.oneOf=e[`x-oneOf`],delete e[`x-oneOf`]),e[`x-not`]&&(e.not=e[`x-not`],delete e[`x-not`]),typeof e[`x-nullable`]==`boolean`&&(e.nullable=e[`x-nullable`],delete e[`x-nullable`]),typeof e[`x-discriminator`]==`object`&&typeof e[`x-discriminator`].propertyName==`string`){e.discriminator=e[`x-discriminator`],delete e[`x-discriminator`];for(let t in e.discriminator.mapping){let n=e.discriminator.mapping[t];n.startsWith(`#/definitions/`)&&(e.discriminator.mapping[t]=n.replace(`#/definitions/`,`#/components/schemas/`))}}}function T(e,t){h.walkSchema(e,{},{},function(e,n,r){ee(e,n),w(e,n,t)})}function te(e){return e=e.indexOf(`#`)>=0?e.split(`#`)[1].split(`/`).pop():e.split(`/`).pop().split(`.`)[0],encodeURIComponent(g.sanitise(e))}function E(e,t,n){let r=n.payload.options;if(l(e,t)){if(!e[t].startsWith(`#/components/`)){if(e[t]===`#/consumes`)delete e[t],n.parent[n.pkey]=u(r.openapi.consumes);else if(e[t]===`#/produces`)delete e[t],n.parent[n.pkey]=u(r.openapi.produces);else if(e[t].startsWith(`#/definitions/`)){let n=e[t].replace(`#/definitions/`,``).split(`/`),i=s.jpunescape(n[0]),a=b.schemas[decodeURIComponent(i)];a?n[0]=a:C(`Could not resolve reference `+e[t],e,r),e[t]=`#/components/schemas/`+n.join(`/`)}else if(e[t].startsWith(`#/parameters/`))e[t]=`#/components/parameters/`+g.sanitise(e[t].replace(`#/parameters/`,``));else if(e[t].startsWith(`#/responses/`))e[t]=`#/components/responses/`+g.sanitise(e[t].replace(`#/responses/`,``));else if(e[t].startsWith(`#`)){let n=u(s.jptr(r.openapi,e[t]));if(n===!1)C(`direct $ref not found `+e[t],e,r);else if(r.refmap[e[t]])e[t]=r.refmap[e[t]];else{let i=e[t];i=i.replace(`/properties/headers/`,``),i=i.replace(`/properties/responses/`,``),i=i.replace(`/properties/parameters/`,``),i=i.replace(`/properties/schemas/`,``);let a=`schemas`,o=i.lastIndexOf(`/schema`);if(a=i.indexOf(`/headers/`)>o?`headers`:i.indexOf(`/responses/`)>o?`responses`:i.indexOf(`/example`)>o?`examples`:i.indexOf(`/x-`)>o?`extensions`:i.indexOf(`/parameters/`)>o?`parameters`:`schemas`,a===`schemas`&&T(n,r),a!==`responses`&&a!==`extensions`){let i=a.substr(0,a.length-1);i===`parameter`&&n.name&&n.name===g.sanitise(n.name)&&(i=encodeURIComponent(n.name));let o=1;for(e[`x-miro`]&&(i=te(e[`x-miro`]),o=``);s.jptr(r.openapi,`#/components/`+a+`/`+i+o);)o=o===``?2:++o;let c=`#/components/`+a+`/`+i+o,l=``;a===`examples`&&(n={value:n},l=`/value`),s.jptr(r.openapi,c,n),r.refmap[e[t]]=c+l,e[t]=c+l}}}}if(delete e[`x-miro`],Object.keys(e).length>1){let i=e[t],a=n.path.indexOf(`/schema`)>=0;r.refSiblings===`preserve`||(a&&r.refSiblings===`allOf`?(delete e.$ref,n.parent[n.pkey]={allOf:[{$ref:i},e]}):n.parent[n.pkey]={$ref:i})}}if(t===`x-ms-odata`&&typeof e[t]==`string`&&e[t].startsWith(`#/`)){let n=e[t].replace(`#/definitions/`,``).replace(`#/components/schemas/`,``).split(`/`),i=b.schemas[decodeURIComponent(n[0])];i?n[0]=i:C(`Could not resolve reference `+e[t],e,r),e[t]=`#/components/schemas/`+n.join(`/`)}}function D(e,t){for(let n in t.refmap)s.jptr(e,n,{$ref:t.refmap[n]})}function O(e){for(let t in e)for(let n in e[t]){let r=g.sanitise(n);n!==r&&(e[t][r]=e[t][n],delete e[t][n])}}function k(e,t){if(e.type===`basic`&&(e.type=`http`,e.scheme=`basic`),e.type===`oauth2`){let n={},r=e.flow;e.flow===`application`&&(r=`clientCredentials`),e.flow===`accessCode`&&(r=`authorizationCode`),e.authorizationUrl!==void 0&&(n.authorizationUrl=e.authorizationUrl.split(`?`)[0].trim()||`/`),typeof e.tokenUrl==`string`&&(n.tokenUrl=e.tokenUrl.split(`?`)[0].trim()||`/`),n.scopes=e.scopes||{},e.flows={},e.flows[r]=n,delete e.flow,delete e.authorizationUrl,delete e.tokenUrl,delete e.scopes,e.name!==void 0&&(t.patch?(t.patches++,delete e.name):S(`(Patchable) oauth2 securitySchemes should not have name property`,t))}}function ne(e){return e&&!e[`x-s2o-delete`]}function re(e,t){if(e.$ref)e.$ref=e.$ref.replace(`#/responses/`,`#/components/responses/`);else{e.type&&!e.schema&&(e.schema={}),e.type&&(e.schema.type=e.type),e.items&&e.items.type!==`array`&&(e.items.collectionFormat!==e.collectionFormat&&C(`Nested collectionFormats are not supported`,e,t),delete e.items.collectionFormat),e.type===`array`?(e.collectionFormat===`ssv`?C(`collectionFormat:ssv is no longer supported for headers`,e,t):e.collectionFormat===`pipes`?C(`collectionFormat:pipes is no longer supported for headers`,e,t):e.collectionFormat===`multi`?e.explode=!0:e.collectionFormat===`tsv`?(C(`collectionFormat:tsv is no longer supported`,e,t),e[`x-collectionFormat`]=`tsv`):e.style=`simple`,delete e.collectionFormat):e.collectionFormat&&(t.patch?(t.patches++,delete e.collectionFormat):S(`(Patchable) collectionFormat is only applicable to header.type array`,t)),delete e.type;for(let t of g.parameterTypeProperties)e[t]!==void 0&&(e.schema[t]=e[t],delete e[t]);for(let t of g.arrayProperties)e[t]!==void 0&&(e.schema[t]=e[t],delete e[t])}}function ie(e,t){if(e.$ref.indexOf(`#/parameters/`)>=0){let t=e.$ref.split(`#/parameters/`);e.$ref=t[0]+`#/components/parameters/`+g.sanitise(t[1])}e.$ref.indexOf(`#/definitions/`)>=0&&C(`Definition used as parameter`,e,t)}function A(e,t){let n={};for(let r of Object.keys(e))n[r]=e[r],r===`parameters`&&(n.requestBody={},t.rbname&&(n[t.rbname]=``));return n.requestBody={},n}function j(e,t,n,r,i,a,o){let s={},l=!0,d;if(t&&t.consumes&&typeof t.consumes==`string`){if(o.patch)o.patches++,t.consumes=[t.consumes];else return S(`(Patchable) operation.consumes must be an array`,o)}Array.isArray(a.consumes)||delete a.consumes;let f=((t?t.consumes:null)||a.consumes||[]).filter(g.uniqueOnly);if(e&&e.$ref&&typeof e.$ref==`string`){ie(e,o);let t=decodeURIComponent(e.$ref.replace(`#/components/parameters/`,``)),n=!1,r=a.components.parameters[t];if((!r||r[`x-s2o-delete`])&&e.$ref.startsWith(`#/`)&&(e[`x-s2o-delete`]=!0,n=!0),n){let t=e.$ref,n=c(a,e.$ref);!n&&t.startsWith(`#/`)?C(`Could not resolve reference `+t,e,o):n&&(e=n)}}if(e&&(e.name||e.in)){typeof e[`x-deprecated`]==`boolean`&&(e.deprecated=e[`x-deprecated`],delete e[`x-deprecated`]),e[`x-example`]!==void 0&&(e.example=e[`x-example`],delete e[`x-example`]),e.in!==`body`&&!e.type&&(o.patch?(o.patches++,e.type=`string`):S(`(Patchable) parameter.type is mandatory for non-body parameters`,o)),e.type&&typeof e.type==`object`&&e.type.$ref&&(e.type=c(a,e.type.$ref)),e.type===`file`&&(e[`x-s2o-originalType`]=e.type,d=e.type),e.description&&typeof e.description==`object`&&e.description.$ref&&(e.description=c(a,e.description.$ref)),e.description===null&&delete e.description;let t=e.collectionFormat;if(e.type===`array`&&!t&&(t=`csv`),t&&(e.type!==`array`&&(o.patch?(o.patches++,delete e.collectionFormat):S(`(Patchable) collectionFormat is only applicable to param.type array`,o)),t===`csv`&&(e.in===`query`||e.in===`cookie`)&&(e.style=`form`,e.explode=!1),t===`csv`&&(e.in===`path`||e.in===`header`)&&(e.style=`simple`),t===`ssv`&&(e.in===`query`?e.style=`spaceDelimited`:C(`collectionFormat:ssv is no longer supported except for in:query parameters`,e,o)),t===`pipes`&&(e.in===`query`?e.style=`pipeDelimited`:C(`collectionFormat:pipes is no longer supported except for in:query parameters`,e,o)),t===`multi`&&(e.explode=!0),t===`tsv`&&(C(`collectionFormat:tsv is no longer supported`,e,o),e[`x-collectionFormat`]=`tsv`),delete e.collectionFormat),e.type&&e.type!==`body`&&e.in!==`formData`){if(e.items&&e.schema)C(`parameter has array,items and schema`,e,o);else{e.schema&&o.patches++,(!e.schema||typeof e.schema!=`object`)&&(e.schema={}),e.schema.type=e.type,e.items&&(e.schema.items=e.items,delete e.items,p(e.schema.items,null,function(n,r,i){r===`collectionFormat`&&typeof n[r]==`string`&&(t&&n[r]!==t&&C(`Nested collectionFormats are not supported`,e,o),delete n[r])}));for(let t of g.parameterTypeProperties)e[t]!==void 0&&(e.schema[t]=e[t]),delete e[t]}}e.schema&&T(e.schema,o),e[`x-ms-skip-url-encoding`]&&e.in===`query`&&(e.allowReserved=!0,delete e[`x-ms-skip-url-encoding`])}if(e&&e.in===`formData`){l=!1,s.content={};let t=`application/x-www-form-urlencoded`;if(f.length&&f.indexOf(`multipart/form-data`)>=0&&(t=`multipart/form-data`),s.content[t]={},e.schema)s.content[t].schema=e.schema,e.schema.$ref&&(s[`x-s2o-name`]=decodeURIComponent(e.schema.$ref.replace(`#/components/schemas/`,``)));else{s.content[t].schema={},s.content[t].schema.type=`object`,s.content[t].schema.properties={},s.content[t].schema.properties[e.name]={};let n=s.content[t].schema,r=s.content[t].schema.properties[e.name];e.description&&(r.description=e.description),e.example&&(r.example=e.example),e.type&&(r.type=e.type);for(let t of g.parameterTypeProperties)e[t]!==void 0&&(r[t]=e[t]);e.required===!0&&(n.required||=[],n.required.push(e.name),s.required=!0),e.default!==void 0&&(r.default=e.default),r.properties&&=e.properties,e.allOf&&(r.allOf=e.allOf),e.type===`array`&&e.items&&(r.items=e.items,r.items.collectionFormat&&delete r.items.collectionFormat),(d===`file`||e[`x-s2o-originalType`]===`file`)&&(r.type=`string`,r.format=`binary`),M(e,r)}}else e&&e.type===`file`&&(e.required&&(s.required=e.required),s.content={},s.content[`application/octet-stream`]={},s.content[`application/octet-stream`].schema={},s.content[`application/octet-stream`].schema.type=`string`,s.content[`application/octet-stream`].schema.format=`binary`,M(e,s));if(e&&e.in===`body`){s.content={},e.name&&(s[`x-s2o-name`]=(t&&t.operationId?g.sanitiseAll(t.operationId):``)+(`_`+e.name).toCamelCase()),e.description&&(s.description=e.description),e.required&&(s.required=e.required),t&&o.rbname&&e.name&&(t[o.rbname]=e.name),e.schema&&e.schema.$ref?s[`x-s2o-name`]=decodeURIComponent(e.schema.$ref.replace(`#/components/schemas/`,``)):e.schema&&e.schema.type===`array`&&e.schema.items&&e.schema.items.$ref&&(s[`x-s2o-name`]=decodeURIComponent(e.schema.items.$ref.replace(`#/components/schemas/`,``))+`Array`),f.length||f.push(`application/json`);for(let t of f)s.content[t]={},s.content[t].schema=u(e.schema||{}),T(s.content[t].schema,o);M(e,s)}if(Object.keys(s).length>0&&(e[`x-s2o-delete`]=!0,t&&(t.requestBody&&l?(t.requestBody[`x-s2o-overloaded`]=!0,C(`Operation `+(t.operationId||i)+` has multiple requestBodies`,t,o)):(t.requestBody||(t=n[r]=A(t,o)),t.requestBody.content&&t.requestBody.content[`multipart/form-data`]&&t.requestBody.content[`multipart/form-data`].schema&&t.requestBody.content[`multipart/form-data`].schema.properties&&s.content[`multipart/form-data`]&&s.content[`multipart/form-data`].schema&&s.content[`multipart/form-data`].schema.properties?(t.requestBody.content[`multipart/form-data`].schema.properties=Object.assign(t.requestBody.content[`multipart/form-data`].schema.properties,s.content[`multipart/form-data`].schema.properties),t.requestBody.content[`multipart/form-data`].schema.required=(t.requestBody.content[`multipart/form-data`].schema.required||[]).concat(s.content[`multipart/form-data`].schema.required||[]),t.requestBody.content[`multipart/form-data`].schema.required.length||delete t.requestBody.content[`multipart/form-data`].schema.required):t.requestBody.content&&t.requestBody.content[`application/x-www-form-urlencoded`]&&t.requestBody.content[`application/x-www-form-urlencoded`].schema&&t.requestBody.content[`application/x-www-form-urlencoded`].schema.properties&&s.content[`application/x-www-form-urlencoded`]&&s.content[`application/x-www-form-urlencoded`].schema&&s.content[`application/x-www-form-urlencoded`].schema.properties?(t.requestBody.content[`application/x-www-form-urlencoded`].schema.properties=Object.assign(t.requestBody.content[`application/x-www-form-urlencoded`].schema.properties,s.content[`application/x-www-form-urlencoded`].schema.properties),t.requestBody.content[`application/x-www-form-urlencoded`].schema.required=(t.requestBody.content[`application/x-www-form-urlencoded`].schema.required||[]).concat(s.content[`application/x-www-form-urlencoded`].schema.required||[]),t.requestBody.content[`application/x-www-form-urlencoded`].schema.required.length||delete t.requestBody.content[`application/x-www-form-urlencoded`].schema.required):(t.requestBody=Object.assign(t.requestBody,s),t.requestBody[`x-s2o-name`]||(t.requestBody.schema&&t.requestBody.schema.$ref?t.requestBody[`x-s2o-name`]=decodeURIComponent(t.requestBody.schema.$ref.replace(`#/components/schemas/`,``)).split(`/`).join(``):t.operationId&&(t.requestBody[`x-s2o-name`]=g.sanitiseAll(t.operationId))))))),e&&!e[`x-s2o-delete`]){delete e.type;for(let t of g.parameterTypeProperties)delete e[t];e.in===`path`&&(e.required===void 0||e.required!==!0)&&(o.patch?(o.patches++,e.required=!0):S(`(Patchable) path parameters must be required:true [`+e.name+` in `+i+`]`,o))}return t}function M(e,t){for(let n in e)n.startsWith(`x-`)&&!n.startsWith(`x-s2o`)&&(t[n]=e[n])}function N(e,t,n,r,i){if(!e)return!1;if(e.$ref&&typeof e.$ref==`string`)e.$ref.indexOf(`#/definitions/`)>=0?C(`definition used as response: `+e.$ref,e,i):e.$ref.startsWith(`#/responses/`)&&(e.$ref=`#/components/responses/`+g.sanitise(decodeURIComponent(e.$ref.replace(`#/responses/`,``))));else{if((e.description===void 0||e.description===null||e.description===``&&i.patch)&&(i.patch?typeof e==`object`&&!Array.isArray(e)&&(i.patches++,e.description=_[e]||``):S(`(Patchable) response.description is mandatory`,i)),e.schema!==void 0){if(T(e.schema,i),e.schema.$ref&&typeof e.schema.$ref==`string`&&e.schema.$ref.startsWith(`#/responses/`)&&(e.schema.$ref=`#/components/responses/`+g.sanitise(decodeURIComponent(e.schema.$ref.replace(`#/responses/`,``)))),n&&n.produces&&typeof n.produces==`string`){if(i.patch)i.patches++,n.produces=[n.produces];else return S(`(Patchable) operation.produces must be an array`,i)}r.produces&&!Array.isArray(r.produces)&&delete r.produces;let t=((n?n.produces:null)||r.produces||[]).filter(g.uniqueOnly);t.length||t.push(`*/*`),e.content={};for(let n of t){if(e.content[n]={},e.content[n].schema=u(e.schema),e.examples&&e.examples[n]){let t={};t.value=e.examples[n],e.content[n].examples={},e.content[n].examples.response=t,delete e.examples[n]}e.content[n].schema.type===`file`&&(e.content[n].schema={type:`string`,format:`binary`})}delete e.schema}for(let t in e.examples)e.content||={},e.content[t]||(e.content[t]={}),e.content[t].examples={},e.content[t].examples.response={},e.content[t].examples.response.value=e.examples[t];if(delete e.examples,e.headers)for(let t in e.headers)t.toLowerCase()===`status code`?i.patch?(i.patches++,delete e.headers[t]):S(`(Patchable) "Status Code" is not a valid header`,i):re(e.headers[t],i)}}function P(e,t,n,i,a){for(let o in e){let l=e[o];l&&l[`x-trace`]&&typeof l[`x-trace`]==`object`&&(l.trace=l[`x-trace`],delete l[`x-trace`]),l&&l[`x-summary`]&&typeof l[`x-summary`]==`string`&&(l.summary=l[`x-summary`],delete l[`x-summary`]),l&&l[`x-description`]&&typeof l[`x-description`]==`string`&&(l.description=l[`x-description`],delete l[`x-description`]),l&&l[`x-servers`]&&Array.isArray(l[`x-servers`])&&(l.servers=l[`x-servers`],delete l[`x-servers`]);for(let e in l)if(g.httpMethods.indexOf(e)>=0||e===`x-amazon-apigateway-any-method`){let d=l[e];if(d&&d.parameters&&Array.isArray(d.parameters)){if(l.parameters)for(let t of l.parameters)typeof t.$ref==`string`&&(ie(t,n),t=c(a,t.$ref)),!d.parameters.find(function(e,n,r){return e.name===t.name&&e.in===t.in})&&(t.in===`formData`||t.in===`body`||t.type===`file`)&&(d=j(t,d,l,e,o,a,n),n.rbname&&d[n.rbname]===``&&delete d[n.rbname]);for(let t of d.parameters)d=j(t,d,l,e,e+`:`+o,a,n);n.rbname&&d[n.rbname]===``&&delete d[n.rbname],n.debug||d.parameters&&(d.parameters=d.parameters.filter(ne))}if(d&&d.security&&O(d.security),typeof d==`object`){if(!d.responses){let e={};e.description=`Default response`,d.responses={default:e}}for(let e in d.responses){let t=d.responses[e];N(t,e,d,a,n)}}if(d&&d[`x-servers`]&&Array.isArray(d[`x-servers`]))d.servers=d[`x-servers`],delete d[`x-servers`];else if(d&&d.schemes&&d.schemes.length){for(let e of d.schemes)if((!a.schemes||a.schemes.indexOf(e)<0)&&(d.servers||(d.servers=[]),Array.isArray(a.servers)))for(let t of a.servers){let n=u(t),i=r.parse(n.url);i.protocol=e,n.url=i.format(),d.servers.push(n)}}if(n.debug&&(d[`x-s2o-consumes`]=d.consumes||[],d[`x-s2o-produces`]=d.produces||[]),d){if(delete d.consumes,delete d.produces,delete d.schemes,d[`x-ms-examples`]){for(let e in d[`x-ms-examples`]){let t=d[`x-ms-examples`][e],n=g.sanitiseAll(e);if(t.parameters)for(let n in t.parameters){let r=t.parameters[n];for(let t of(d.parameters||[]).concat(l.parameters||[]))t.$ref&&(t=s.jptr(a,t.$ref)),t.name===n&&!t.example&&(t.examples||(t.examples={}),t.examples[e]={value:r})}if(t.responses)for(let r in t.responses){if(t.responses[r].headers)for(let e in t.responses[r].headers){let n=t.responses[r].headers[e];for(let t in d.responses[r].headers)if(t===e){let e=d.responses[r].headers[t];e.example=n}}if(t.responses[r].body&&(a.components.examples[n]={value:u(t.responses[r].body)},d.responses[r]&&d.responses[r].content))for(let t in d.responses[r].content){let i=d.responses[r].content[t];i.examples||={},i.examples[e]={$ref:`#/components/examples/`+n}}}}delete d[`x-ms-examples`]}if(d.parameters&&d.parameters.length===0&&delete d.parameters,d.requestBody){let n=d.operationId?g.sanitiseAll(d.operationId):g.sanitiseAll(e+o).toCamelCase(),r=g.sanitise(d.requestBody[`x-s2o-name`]||n||``);delete d.requestBody[`x-s2o-name`];let a=JSON.stringify(d.requestBody),c=g.hash(a);if(!i[c]){let e={};e.name=r,e.body=d.requestBody,e.refs=[],i[c]=e}let l=`#/`+t+`/`+encodeURIComponent(s.jpescape(o))+`/`+e+`/requestBody`;i[c].refs.push(l)}}}if(l&&l.parameters){for(let e in l.parameters){let t=l.parameters[e];j(t,null,l,null,o,a,n)}!n.debug&&Array.isArray(l.parameters)&&(l.parameters=l.parameters.filter(ne))}}}function F(e,t){let n={};b={schemas:{}},e.security&&O(e.security);for(let n in e.components.securitySchemes){let r=g.sanitise(n);n!==r&&(e.components.securitySchemes[r]&&S(`Duplicate sanitised securityScheme name `+r,t),e.components.securitySchemes[r]=e.components.securitySchemes[n],delete e.components.securitySchemes[n]),k(e.components.securitySchemes[r],t)}for(let n in e.components.schemas){let r=g.sanitiseAll(n),i=``;if(n!==r){for(;e.components.schemas[r+i];)i=i?++i:2;e.components.schemas[r+i]=e.components.schemas[n],delete e.components.schemas[n]}b.schemas[n]=r+i,T(e.components.schemas[r+i],t)}t.refmap={},p(e,{payload:{options:t}},E),D(e,t);for(let n in e.components.parameters){let r=g.sanitise(n);n!==r&&(e.components.parameters[r]&&S(`Duplicate sanitised parameter name `+r,t),e.components.parameters[r]=e.components.parameters[n],delete e.components.parameters[n]);let i=e.components.parameters[r];j(i,null,null,null,r,e,t)}for(let n in e.components.responses){let r=g.sanitise(n);n!==r&&(e.components.responses[r]&&S(`Duplicate sanitised response name `+r,t),e.components.responses[r]=e.components.responses[n],delete e.components.responses[n]);let i=e.components.responses[r];if(N(i,r,null,e,t),i.headers)for(let e in i.headers)e.toLowerCase()===`status code`?t.patch?(t.patches++,delete i.headers[e]):S(`(Patchable) "Status Code" is not a valid header`,t):re(i.headers[e],t)}for(let t in e.components.requestBodies){let r=e.components.requestBodies[t],i=JSON.stringify(r),a=g.hash(i),o={};o.name=t,o.body=r,o.refs=[],n[a]=o}if(P(e.paths,`paths`,t,n,e),e[`x-ms-paths`]&&P(e[`x-ms-paths`],`x-ms-paths`,t,n,e),!t.debug)for(let t in e.components.parameters)e.components.parameters[t][`x-s2o-delete`]&&delete e.components.parameters[t];t.debug&&(e[`x-s2o-consumes`]=e.consumes||[],e[`x-s2o-produces`]=e.produces||[]),delete e.consumes,delete e.produces,delete e.schemes;let r=[];if(e.components.requestBodies={},!t.resolveInternal){let t=1;for(let i in n){let a=n[i];if(a.refs.length>1){let n=``;for(a.name||(a.name=`requestBody`,n=t++);r.indexOf(a.name+n)>=0;)n=n?++n:2;a.name+=n,r.push(a.name),e.components.requestBodies[a.name]=u(a.body);for(let t in a.refs){let n={};n.$ref=`#/components/requestBodies/`+a.name,s.jptr(e,a.refs[t],n)}}}}return e.components.responses&&Object.keys(e.components.responses).length===0&&delete e.components.responses,e.components.parameters&&Object.keys(e.components.parameters).length===0&&delete e.components.parameters,e.components.examples&&Object.keys(e.components.examples).length===0&&delete e.components.examples,e.components.requestBodies&&Object.keys(e.components.requestBodies).length===0&&delete e.components.requestBodies,e.components.securitySchemes&&Object.keys(e.components.securitySchemes).length===0&&delete e.components.securitySchemes,e.components.headers&&Object.keys(e.components.headers).length===0&&delete e.components.headers,e.components.schemas&&Object.keys(e.components.schemas).length===0&&delete e.components.schemas,e.components&&Object.keys(e.components).length===0&&delete e.components,e}function I(e){return!e||!e.url||typeof e.url!=`string`||(e.url=e.url.split(`{{`).join(`{`),e.url=e.url.split(`}}`).join(`}`),e.url.replace(/\{(.+?)\}/g,function(t,n){e.variables||={},e.variables[n]={default:`unknown`}})),e}function L(e,t,n){if(e.info===void 0||e.info===null){if(t.patch)t.patches++,e.info={version:``,title:``};else return n(new x(`(Patchable) info object is mandatory`))}if(typeof e.info!=`object`||Array.isArray(e.info))return n(new x(`info must be an object`));if(e.info.title===void 0||e.info.title===null){if(t.patch)t.patches++,e.info.title=``;else return n(new x(`(Patchable) info.title cannot be null`))}if(e.info.version===void 0||e.info.version===null){if(t.patch)t.patches++,e.info.version=``;else return n(new x(`(Patchable) info.version cannot be null`))}if(typeof e.info.version!=`string`){if(t.patch)t.patches++,e.info.version=e.info.version.toString();else return n(new x(`(Patchable) info.version must be a string`))}if(e.info.logo!==void 0){if(t.patch)t.patches++,e.info[`x-logo`]=e.info.logo,delete e.info.logo;else return n(new x(`(Patchable) info should not have logo property`))}if(e.info.termsOfService!==void 0){if(e.info.termsOfService===null){if(t.patch)t.patches++,e.info.termsOfService=``;else return n(new x(`(Patchable) info.termsOfService cannot be null`))}try{new URL(e.info.termsOfService)}catch{if(t.patch)t.patches++,delete e.info.termsOfService;else return n(new x(`(Patchable) info.termsOfService must be a URL`))}}}function R(e,t,n){if(e.paths===void 0){if(t.patch)t.patches++,e.paths={};else return n(new x(`(Patchable) paths object is mandatory`))}}function ae(e,t){let n=/* @__PURE__ */ new WeakSet;p(e,{identityDetection:!0},function(e,r,i){typeof e[r]==`object`&&e[r]!==null&&(n.has(e[r])?t.anchors?e[r]=u(e[r]):S(`YAML anchor or merge key at `+i.path,t):n.add(e[r]))})}function z(e,t,n){return i(n,new Promise(function(n,r){if(e||={},t.original=e,t.text||=o.stringify(e),t.externals=[],t.externalRefs={},t.rewriteRefs=!0,t.preserveMiro=!0,t.promise={},t.promise.resolve=n,t.promise.reject=r,t.patches=0,t.cache||={},t.source&&(t.cache[t.source]=t.original),ae(e,t),e.openapi&&typeof e.openapi==`string`&&e.openapi.startsWith(`3.`)){t.openapi=f(e),L(t.openapi,t,r),R(t.openapi,t,r),m.optionalResolve(t).then(function(){return t.direct?n(t.openapi):n(t)}).catch(function(e){console.warn(e),r(e)});return}if(!e.swagger||e.swagger!=`2.0`)return r(new x(`Unsupported swagger/OpenAPI version: `+(e.openapi?e.openapi:e.swagger)));let i=t.openapi={};if(i.openapi=typeof t.targetVersion==`string`&&t.targetVersion.startsWith(`3.`)?t.targetVersion:y,t.origin){i[`x-origin`]||(i[`x-origin`]=[]);let n={};n.url=t.source||t.origin,n.format=`swagger`,n.version=e.swagger,n.converter={},n.converter.url=`https://github.com/mermade/oas-kit`,n.converter.version=v,i[`x-origin`].push(n)}if(i=Object.assign(i,f(e)),delete i.swagger,p(i,{},function(e,t,n){e[t]===null&&!t.startsWith(`x-`)&&t!=="default"&&n.path.indexOf(`/example`)<0&&delete e[t]}),e.host)for(let t of Array.isArray(e.schemes)?e.schemes:[``]){let n={},r=(e.basePath||``).replace(/\/$/,``);n.url=(t?t+`:`:``)+`//`+e.host+r,I(n),i.servers||(i.servers=[]),i.servers.push(n)}else if(e.basePath){let t={};t.url=e.basePath,I(t),i.servers||(i.servers=[]),i.servers.push(t)}if(delete i.host,delete i.basePath,i[`x-servers`]&&Array.isArray(i[`x-servers`])&&(i.servers=i[`x-servers`],delete i[`x-servers`]),e[`x-ms-parameterized-host`]){let t=e[`x-ms-parameterized-host`],n={};n.url=t.hostTemplate+(e.basePath?e.basePath:``),n.variables={};let r=n.url.match(/\{\w+\}/g);for(let e in t.parameters){let a=t.parameters[e];a.$ref&&(a=u(c(i,a.$ref))),e.startsWith(`x-`)||(delete a.required,delete a.type,delete a.in,a.default===void 0&&(a.enum?a.default=a.enum[0]:a.default=`none`),a.name||(a.name=r[e].replace(`{`,``).replace(`}`,``)),n.variables[a.name]=a,delete a.name)}i.servers||(i.servers=[]),t.useSchemePrefix===!1?i.servers.push(n):e.schemes.forEach(e=>{i.servers.push(Object.assign({},n,{url:e+`://`+n.url}))}),delete i[`x-ms-parameterized-host`]}L(i,t,r),R(i,t,r),typeof i.consumes==`string`&&(i.consumes=[i.consumes]),typeof i.produces==`string`&&(i.produces=[i.produces]),i.components={},i[`x-callbacks`]&&(i.components.callbacks=i[`x-callbacks`],delete i[`x-callbacks`]),i.components.examples={},i.components.headers={},i[`x-links`]&&(i.components.links=i[`x-links`],delete i[`x-links`]),i.components.parameters=i.parameters||{},i.components.responses=i.responses||{},i.components.requestBodies={},i.components.securitySchemes=i.securityDefinitions||{},i.components.schemas=i.definitions||{},delete i.definitions,delete i.responses,delete i.parameters,delete i.securityDefinitions,m.optionalResolve(t).then(function(){F(t.openapi,t),t.direct?n(t.openapi):n(t)}).catch(function(e){console.warn(e),r(e)})}))}function oe(e,t,n){return i(n,new Promise(function(n,r){let i=null,a=null;try{i=JSON.parse(e),t.text=JSON.stringify(i,null,2)}catch(n){a=n;try{i=o.parse(e,{schema:`core`,prettyErrors:!0}),t.sourceYaml=!0,t.text=e}catch(e){a=e}}i?z(i,t).then(e=>n(e)).catch(e=>r(e)):r(new x(a?a.message:`Could not parse string`))}))}function se(e,t,n){return i(n,new Promise(function(n,r){t.origin=!0,t.source||=e,t.verbose&&console.warn(`GET `+e),t.fetch||=a;let i=Object.assign({},t.fetchOptions,{agent:t.agent});t.fetch(e,i).then(function(t){if(t.status!==200)throw new x(`Received status code ${t.status}: ${e}`);return t.text()}).then(function(e){oe(e,t).then(e=>n(e)).catch(e=>r(e))}).catch(function(e){r(e)})}))}function ce(e,t,r){return i(r,new Promise(function(r,i){n.readFile(e,t.encoding||`utf8`,function(n,a){n?i(n):(t.sourceFile=e,oe(a,t).then(e=>r(e)).catch(e=>i(e)))})}))}function le(e,t,n){return i(n,new Promise(function(n,r){let i=``;e.on(`data`,function(e){i+=e}).on(`end`,function(){oe(i,t).then(e=>n(e)).catch(e=>r(e))})}))}t.exports={S2OError:x,targetVersion:y,convert:z,convertObj:z,convertUrl:se,convertStr:oe,convertFile:ce,convertStream:le}})))(),1);const ta=/^[A-Za-z_$][\w$]*$/;function na(e){let t=e.replace(/[^\w$]+(.)?/g,(e,t)=>t?t.toUpperCase():``);return(/^[0-9]/.test(t)?`_${t}`:t)||`_`}function ra(e){let t=na(e);return t.charAt(0).toUpperCase()+t.slice(1)}function ia(e){return ta.test(e)?e:JSON.stringify(e)}function aa(e,t=``){if(!e)return``;let n=[];if(e.title&&e.title!==e.description&&n.push(e.title),e.description&&n.push(...String(e.description).trim().split(`
|
|
163
|
+
`)),e.format&&n.push(`@format ${e.format}`),e.example!==void 0&&n.push(`@example ${JSON.stringify(e.example)}`),e.default!==void 0&&n.push(`@default ${JSON.stringify(e.default)}`),e.minimum!==void 0&&n.push(`@minimum ${e.minimum}`),e.maximum!==void 0&&n.push(`@maximum ${e.maximum}`),e.deprecated&&n.push(`@deprecated`),n.length===0)return``;let r=n.map(e=>e.replace(/\*\//g,`*\\/`));return r.length===1?`${t}/** ${r[0]} */\n`:`${t}/**\n${r.map(e=>`${t} * ${e}`).join(`
|
|
164
|
+
`)}\n${t} */\n`}function oa(e){return ra(e.split(`/`).pop())}function sa(e){return/[|&]/.test(e)&&!/^[([{]/.test(e)?`(${e})`:e}function ca(e,t=``,n=``){if(!e||typeof e!=`object`)return`unknown`;if(e.$ref)return`${n}${oa(e.$ref)}`;let r;if(e.enum)r=e.enum.map(e=>JSON.stringify(e)).join(` | `)||`never`;else if(e.allOf)r=e.allOf.map(e=>sa(ca(e,t,n))).join(` & `);else if(e.oneOf||e.anyOf)r=(e.oneOf??e.anyOf).map(e=>sa(ca(e,t,n))).join(` | `);else{let i=(Array.isArray(e.type)?e.type:[e.type]).map(r=>la({...e,type:r},t,n));r=[...new Set(i)].join(` | `)}return e.nullable&&!/\bnull\b/.test(r)&&(r+=` | null`),r}function la(e,t,n){switch(e.type){case`string`:return`string`;case`integer`:case`number`:return`number`;case`boolean`:return`boolean`;case`null`:return`null`;case`array`:return`${sa(ca(e.items,t,n))}[]`;case`object`:case void 0:return ua(e,t,n);default:return`unknown`}}function ua(e,t=``,n=``){let r=e.properties,i=e.additionalProperties;if(!r&&i===void 0&&e.type===void 0)return`unknown`;if(!r&&(i===void 0||i===!0))return`Record<string, unknown>`;let a=new Set(e.required??[]),o=`${t} `,s=[];for(let[e,t]of Object.entries(r??{}))s.push(`${aa(t,o)}${o}${ia(e)}${a.has(e)?``:`?`}: ${ca(t,o,n)}`);if(i&&i!==!0){let e=r&&Object.keys(r).length>0?`unknown`:ca(i,o,n);s.push(`${o}[key: string]: ${e}`)}return s.length===0?`Record<string, never>`:`{\n${s.join(`
|
|
165
|
+
`)}\n${t}}`}const da=e=>e.replace(/[_-]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).trim().toLowerCase(),fa=e=>e.endsWith(`ies`)?`${e.slice(0,-3)}y`:e.endsWith(`s`)?e.slice(0,-1):e,pa={400:`Bad request`,401:`Requires authentication`,402:`Payment required`,403:`Forbidden`,404:`Not found`,405:`Method not allowed`,409:`Conflict`,410:`Gone`,412:`Precondition failed`,422:`Validation failed`,429:`Rate limit exceeded`,500:`Internal server error`,502:`Bad gateway`,503:`Service unavailable`};function ma(e,t,n){switch(t){case`date-time`:return`2024-05-14T09:30:00Z`;case`date`:return`2024-05-14`;case`time`:return`09:30:00`;case`email`:return`jane.doe@example.com`;case`uuid`:return`3f2b1c9e-6c1a-4f55-9a43-1d2e8b7a4c10`;case`uri`:case`url`:return`https://example.com/resource`;case`hostname`:return`api.example.com`;case`ipv4`:return`192.0.2.10`;case`ipv6`:return`2001:db8::1`;case`byte`:return`ZXhhbXBsZQ==`;case`binary`:return`example`}let r=e.toLowerCase();if(n!==void 0&&(n===-1||n>=400)){if(/^(message|detail|reason|error_?description|title)$/.test(r))return n&&n>0?pa[n]??`Request failed`:`The request could not be completed`;if(r===`status`)return n&&n>0?String(n):`error`;if(/^(error|code)$/.test(r))return n&&pa[n]?pa[n].toLowerCase().replace(/\s+/g,`_`):`request_failed`;if(/^(documentation_?url)$/.test(r))return`https://docs.example.com/errors`}if(/(^|_)(url|uri|href|link)$/.test(r)||r.endsWith(`url`)){let e=r.replace(/_?(html_)?(url|uri|href|link)$/,``).replace(/_/g,`/`);return`https://${r.includes(`html`)?`example.com`:`api.example.com`}${e?`/${e}`:``}`}for(let[e,t]of[[/e-?mail/,`jane.doe@example.com`],[/^(login|username|user_name|handle)$/,`octocat`],[/^first_?name$|^given_?name$/,`Jane`],[/^last_?name$|^family_?name|^surname$/,`Doe`],[/^(full_?name|display_?name|customer_?name)$/,`Jane Doe`],[/^name$/,`Example name`],[/^title$/,`Example title`],[/^(description|summary|bio|about)$/,`A short description of this item.`],[/^(body|content|text|comment|note|notes)$/,`Example text content.`],[/^(message|detail|reason)$/,`The operation completed successfully.`],[/^(error|error_?description)$/,`Something went wrong.`],[/node_?id$/,`MDQ6VXNlcjE=`],[/(^|_)sha$|commit_?id$|^oid$/,`a3f5c1e9b7d24c68f0e1a2b3c4d5e6f708192a3b`],[/^ref$/,`refs/heads/main`],[/^(branch|default_branch)$/,`main`],[/^(color|colour)$/,`0e8a16`],[/^language$/,`TypeScript`],[/^(phone|phone_?number|mobile)$/,`+1-555-0100`],[/^(city|town)$/,`Seattle`],[/^(state|province|region)$/,`WA`],[/^(country|country_?code)$/,`US`],[/^(postal_?code|zip|zip_?code)$/,`98101`],[/^(line1|address|street|address_?line_?1)$/,`123 Main Street`],[/^line2$/,`Suite 400`],[/^currency$/,`usd`],[/^(company|organization|org)$/,`Example Inc.`],[/^(token|access_?token|api_?key|secret)$/,`example_token_8f3a2b`],[/^(version|api_?version)$/,`1.0.0`],[/^(locale|lang)$/,`en-US`],[/^(timezone|time_?zone)$/,`America/Los_Angeles`],[/^(type|kind|category)$/,`standard`],[/^(status|state)$/,`active`],[/^object$/,`object`],[/(^|_)id$/,`a1b2c3d4`],[/(^|_)(at|date|time|timestamp)$/,`2024-05-14T09:30:00Z`]])if(e.test(r))return t;return r?`Example ${da(e)}`:`Example text`}function ha(e,t,n){let r=e.toLowerCase();return/(^|_)(created|updated|deleted|expires|arrival|paid|canceled)(_at)?$|_at$|timestamp$/.test(r)?1715679e3:/^(amount|total|subtotal|price|balance)(_.*)?$/.test(r)?t?2e3:19.99:/(^|_)(count|total_count|number)$/.test(r)||r.endsWith(`_count`)?3:r===`quantity`||r===`qty`?1:/^(per_?page|limit|page_?size)$/.test(r)?30:/^(page|offset)$/.test(r)?1:/(^|_)(size|bytes|length)$/.test(r)?1024:/(^|_)(lat|latitude)$/.test(r)?47.6062:/(^|_)(lng|lon|longitude)$/.test(r)?-122.3321:/(^|_)id$/.test(r)?n??1001:n??(t?1:1.5)}function ga(e){return!/^(private|draft|archived|disabled|deleted|fork|locked|livemode|prerelease|site_admin|hireable|mergeable|merged|has_.*|is_.*(deleted|private|draft)|.*_(disabled|archived))$/.test(e.toLowerCase())}const _a={email:`internet.email`,uuid:`string.uuid`,uri:`internet.url`,url:`internet.url`,hostname:`internet.domainName`,ipv4:`internet.ipv4`},va=[[/^(first_?name|given_?name)$/,`person.firstName`],[/^(last_?name|family_?name|surname)$/,`person.lastName`],[/^(full_?name|display_?name)$/,`person.fullName`],[/^name$/,`word.noun`],[/^(user_?name|login|handle)$/,`internet.username`],[/^e?-?mail(_?address)?$/,`internet.email`],[/^(phone|phone_?number|mobile)$/,`phone.number`],[/^(city|town)$/,`location.city`],[/^country$/,`location.country`],[/^(postal_?code|zip|zip_?code)$/,`location.zipCode`],[/^(line1|address|street|address_?line_?1)$/,`location.streetAddress`],[/^(company|organization|org)$/,`company.name`],[/^(title|subject)$/,`lorem.sentence`],[/^(description|summary|bio|about|body|comment|note|notes|message)$/,`lorem.sentence`],[/^(url|website|homepage)$/,`internet.url`]];function ya(e,t){let n=t&&_a[t]||va.find(([t])=>t.test(e.toLowerCase()))?.[1];return n?`{{faker.${n}}}`:void 0}const ba=/^(string|str|<string>|\{string\}|string\d+|null)$/i;function xa(e,t=``,n,r){if(typeof e==`string`){let i=e.trim();return i===``||ba.test(i)?ma(t,n,r):e}return Array.isArray(e)?e.map(e=>xa(e,fa(t),n,r)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,xa(t,e,void 0,r)])):e}function Sa(e,t){if(Array.isArray(e.enum)&&t!==null&&!e.enum.includes(t))return!1;let n=Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type;if(t===null)return!0;switch(n){case`string`:return typeof t==`string`;case`integer`:case`number`:return typeof t==`number`;case`boolean`:return typeof t==`boolean`;case`array`:return Array.isArray(t);case`object`:return typeof t==`object`&&!Array.isArray(t);default:return!0}}function Ca(e,t,n=0,r=[],i=``,a,o=!1,s=!1){if(!e)return null;let c=(e,c=i,l=n,u=r)=>Ca(e,t,l,u,c,a,o,s);if(e.$ref){let a=t(e.$ref);return r.includes(e.$ref)?c(a,i,Math.max(n,6),[]):c(a,i,n,[...r,e.$ref])}if(o&&e.type===`string`&&!e.enum){let t=ya(i,e.format);if(t)return t}if(e.example!==void 0&&Sa(e,e.example))return e.enum?e.example:xa(e.example,i,e.format,a);if(e.default!==void 0&&Sa(e,e.default))return e.default;if(e.enum?.length)return e.enum.find(e=>e!==``)??e.enum[0];if(e.allOf){let t={};for(let n of e.allOf){let e=c(n);e&&typeof e==`object`&&!Array.isArray(e)&&Object.assign(t,e)}return t}let l=e.oneOf?.[0]??e.anyOf?.[0];if(l)return c(l);let u=Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type;switch(u){case`string`:return ma(i,e.format,a);case`integer`:return ha(i,!0,e.minimum);case`number`:return ha(i,!1,e.minimum);case`boolean`:return ga(i);case`array`:return n>=6?[]:[c(e.items,fa(i),n+1)];default:if(e.properties||u===`object`){let r={},i=e.properties??{};if(n>=6){if(n>=14)return r;for(let t of e.required??[])i[t]&&(r[t]=c(i[t],t,n+1));return r}let a=[`email`,`first_name`,`firstName`,`last_name`,`lastName`,`username`].some(e=>e in i),o=s?Ta(e,i,t):void 0;for(let[e,t]of Object.entries(i))(!o||o.has(e))&&(r[e]=c(t,a&&e===`name`?`full_name`:e,n+1));return r}return null}}const wa=[`name`,`email`,`description`,`title`,`type`,`amount`,`currency`,`customer`,`status`];function Ta(e,t,n){let r=new Set(e.required??[]);for(let[e,i]of Object.entries(t)){let t=i.$ref?n(i.$ref):i;(t?.example!==void 0||t?.default!==void 0||i.example!==void 0||t?.enum?.length)&&r.add(e)}let i=Object.keys(t),a=e=>{let r=t[e],i=(r.$ref?n(r.$ref):r)??{};return!i.properties&&i.type!==`object`&&i.type!==`array`},o=[...wa.filter(e=>i.includes(e)),...i.filter(e=>!wa.includes(e))].filter(a);for(let e of o){if(r.size>=4)break;r.add(e)}return r}const Ea={type:`string`,pattern:`^\\s*\\{\\{[^}]+\\}\\}\\s*$`};function Da(e,t){let n=Oa(e,t);return e&&typeof e==`object`&&e.nullable===!0&&(e.$ref||e.allOf||e.oneOf||e.anyOf)?{anyOf:[n,{type:`null`}]}:n}function Oa(e,t){if(!e||typeof e!=`object`)return{};if(e.$ref){let n={$ref:`${t}${oa(e.$ref)}`};return e.description&&(n.description=e.description),n}let n={};e.title&&(n.title=e.title),e.description&&(n.description=String(e.description)),e.deprecated&&(n.deprecated=!0),e.default!==void 0&&(n.default=e.default),e.example!==void 0&&(n.examples=[e.example]);let r=e=>Da(e,t),i=e=>({...n,anyOf:[e,Ea]});if(e.allOf)return{...n,allOf:e.allOf.map(r)};if(e.oneOf)return{...n,oneOf:e.oneOf.map(r)};if(e.anyOf)return{...n,anyOf:e.anyOf.map(r)};if(e.enum){let t=Array.isArray(e.type)?e.type[0]:e.type,r={...t&&t!==`string`?{type:t}:{},enum:e.nullable?[...e.enum,null]:e.enum};return e.enum.every(e=>typeof e==`string`)?i(r):{...n,...r}}let a=Array.isArray(e.type)?e.type[0]:e.type,o=e.nullable||Array.isArray(e.type)&&e.type.includes(`null`),s=e=>o?[e,`null`]:e;switch(a){case`string`:return{...n,type:s(`string`),...e.format?{format:e.format}:{},...e.maxLength===void 0?{}:{maxLength:e.maxLength}};case`integer`:case`number`:case`boolean`:{let t={type:s(a)};return e.minimum!==void 0&&(t.minimum=e.minimum),e.maximum!==void 0&&(t.maximum=e.maximum),i(t)}case`array`:return{...n,type:s(`array`),items:r(e.items??{})};default:{if(!e.properties&&e.additionalProperties===void 0&&a!==`object`)return n;let t=Object.fromEntries(Object.entries(e.properties??{}).map(([e,t])=>[e,r(t)])),i={...n,type:s(`object`),properties:t};return e.required?.length&&(i.required=e.required),e.additionalProperties&&e.additionalProperties!==!0?i.additionalProperties=r(e.additionalProperties):e.additionalProperties===!0&&(i.additionalProperties=!0),i}}}function ka(e){let t=e=>(e??``).replace(/<[^>]*>/g,` `).replace(/ /g,` `).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/&/g,`&`),n=e=>t(e).split(/\r?\n/).map(e=>e.replace(/\s+/g,` `).trim()).find(Boolean),r=n(e.summary)??n(e.description);if(!r)return;if(r.length<=120)return r;let i=r.slice(0,120);return`${i.slice(0,Math.max(i.lastIndexOf(` `),60))}…`}function Aa(e){let t=e?.[`x-logo`];if(t&&typeof t.url==`string`&&/^(https?:\/\/|data:image\/)/i.test(t.url))return{url:t.url,...typeof t.altText==`string`?{altText:t.altText}:{},...typeof t.backgroundColor==`string`?{backgroundColor:t.backgroundColor}:{}}}const ja=[400,401,402,403,404,409,422,429,500],Ma=[`get`,`put`,`post`,`delete`,`options`,`head`,`patch`],Na=[[`application/json`,`json`],[`application/x-www-form-urlencoded`,`form`],[`multipart/form-data`,`multipart`],[`application/graphql`,`graphql`],[`text/plain`,`text`]],Pa=/^(application\/(octet-stream|pdf|zip|gzip)|(image|audio|video)\/)/;function Fa(e){if(!e)return;for(let[t,n]of Na)if(e[t])return{schema:e[t].schema,encoding:n,media:e[t]};let t=Object.keys(e).find(e=>/json/.test(e));if(t)return{schema:e[t].schema,encoding:`json`,media:e[t]};let n=Object.keys(e).find(e=>Pa.test(e));if(n)return{schema:e[n].schema,encoding:`binary`,media:e[n],mediaType:n}}function Ia(e){let t={};for(let[n,r]of Object.entries(e?.encoding??{}))r?.style!==`deepObject`&&(r?.style===`spaceDelimited`?t[n]=`space`:r?.style===`pipeDelimited`?t[n]=`pipe`:r?.explode===!1?t[n]=`comma`:(r?.explode===!0||r?.style===`form`)&&(t[n]=`repeat`));return t}const La=`sample.txt`,Ra=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`example`,za=e=>e?.type===`string`&&(e.format===`binary`||e.contentEncoding===`binary`||e.contentMediaType);function Ba(e,t,n=``,r=0){if(!e||r>4)return[];let i=e.$ref?t(e.$ref):e;return i?za(i)?n?[n]:[]:i.type===`array`?Ba(i.items,t,n,r+1):Object.entries(i.properties??{}).flatMap(([e,i])=>Ba(i,t,n?`${n}.${e}`:e,r+1)):[]}function Va(e,t,n){let r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,t));if(t.length===0)return n;let[i,...a]=t;return typeof e==`object`&&e&&i in e?{...e,[i]:r(e[i],a)}:e};return t.reduce((e,t)=>r(e,t.split(`.`)),e)}function Ha(e,t,n){if(n)return ra(n);let r=t.split(`/`).filter(Boolean).map(e=>e.startsWith(`{`)?`By${ra(e.slice(1,-1))}`:ra(e));return ra(e)+r.join(``)}function Ua(e,t,n={}){let r=t.corePackage??`@specbook/core`,i=!n.dataOnly,a={},o=e.components?.schemas??{},s=Object.keys(e.components?.securitySchemes??{}).length>0,c=e=>{let t=/^#\/components\/schemas\/(.+)$/.exec(e);return t?o[t[1]]:void 0},l=t=>t?.$ref?String(t.$ref).replace(/^#\//,``).split(`/`).reduce((e,t)=>e?.[t],e):t,u=e=>l(Object.values(e??{})[0])?.value,d=[],f=[],p=[];for(let[e,t]of i?Object.entries(o):[]){let n=ra(e),r=!t.$ref&&!t.enum&&!t.allOf&&!t.oneOf&&!t.anyOf&&(t.type===`object`||!t.type&&t.properties)&&t.properties?ua(t):void 0;p.push(r?.startsWith(`{`)?`${aa(t)}export interface ${n} ${r}`:`${aa(t)}export type ${n} = ${r??ca(t)}`)}i&&d.push({path:`types.ts`,content:`// Generated by specbook codegen from the "${t.service}" spec. Do not edit.\n\n${p.join(`
|
|
166
|
+
|
|
167
|
+
`)||`export {}`}\n`});let m=`specbook://${t.service}/defs`;d.push({path:`schemas/definitions.schema.json`,content:`${JSON.stringify({$id:m,$defs:Object.fromEntries(Object.entries(o).map(([e,t])=>[ra(e),Da(t,`#/$defs/`)]))})}\n`});let h=/* @__PURE__ */ new Set,g=/* @__PURE__ */ new Map;for(let[n,o]of Object.entries(e.paths??{}))for(let p of Ma){let _=o[p];if(!_)continue;let v=Ha(p,n,_.operationId);for(;h.has(v);)v+=`_`;h.add(v);let y=[...o.parameters??[],..._.parameters??[]].map(e=>l(e)),b=e=>y.filter(t=>t.in===e).map(t=>({name:t.name,required:e===`path`||!!t.required,example:t.example??u(t.examples),schema:{...t.schema??{},description:t.schema?.description??t.description}})),x=e=>{if(!i)return;let t=b(e);return t.length?ua({type:`object`,properties:Object.fromEntries(t.map(e=>[e.name,e.schema])),required:t.filter(e=>e.required).map(e=>e.name)},` `,`T.`):void 0},S=x(`path`),C=x(`query`),w=x(`header`),ee=[S&&`path: ${S}`,C&&`query: ${C}`,w&&`headers: ${w}`].filter(Boolean).join(`; `),T=Fa(l(_.requestBody)?.content),te=i&&T?.schema?ca(T.schema,` `,`T.`):`never`,E=[],D=[],O=[],k,ne=!1,re,ie={};for(let[e,t]of Object.entries(_.responses??{})){if(e==="default"){let e=Fa(l(t)?.content);if(e?.schema){ne=!0,i&&(k=ca(e.schema,` `,`T.`)),re=Da(e.schema,`${m}#/$defs/`);let t=e.media?.example?xa(e.media.example,``,void 0,-1):Ca(e.schema,c,0,[],``,-1);O.push({path:`examples/${v}/default.response.json`,content:`${JSON.stringify(t,null,2)}\n`})}continue}if(!/^\d{3}$/.test(e))continue;let n=Fa(l(t)?.content);if(D.push(Number(e)),n?.schema&&(ie[e]=Da(n.schema,`${m}#/$defs/`)),i&&E.push(`${e}: ${n?.schema?ca(n.schema,` `,`T.`):`unknown`}`),n?.schema){let t=n.media?.example?xa(n.media.example,``,void 0,Number(e)):Ca(n.schema,c,0,[],``,Number(e));O.push({path:`examples/${v}/${e}.response.json`,content:`${JSON.stringify(t,null,2)}\n`})}}if(ne)for(let e of ja)D.includes(e)||(D.push(e),re&&(ie[String(e)]=re),k&&E.push(`${e}: ${k}`));let A=T?.encoding===`multipart`?Ba(T.schema,c):[],j=T?.encoding===`binary`,M=`./${La}`,N=e=>{let t=t=>{let n={};for(let r of b(t))r.example===void 0?r.required&&(n[r.name]=Ca(r.schema,c,0,[],r.name,void 0,e)):n[r.name]=r.example;return Object.keys(n).length?n:void 0};return{path:t(`path`),query:t(`query`),headers:t(`header`)}},P=e=>j?M:A.length?Va(e,A,M):e,F=[],I=e=>{let t=Ra(e);for(;F.some(e=>e.name===t);)t+=`-2`;return t};for(let[e,t]of Object.entries(T?.media?.examples??{})){let n=l(t);n?.value!==void 0&&F.push({name:I(e),title:n.summary??e,summary:n.description,source:`spec`,...N(!1),body:P(xa(n.value))})}T?.media?.example!==void 0&&F.push({name:I(`example`),title:`Example`,source:`spec`,...N(!1),body:P(xa(T.media.example))});let L={...N(!1),body:T?.schema?P(Ca(T.schema,c,0,[],``,void 0,!1,!0)):void 0},R={...N(!0),body:T?.schema?P(Ca(T.schema,c,0,[],``,void 0,!0,!0)):void 0};F.push({name:I(`default`),title:`Default`,source:`generated`,...L}),JSON.stringify(R)!==JSON.stringify(L)&&F.push({name:I(`dynamic`),title:`Dynamic`,summary:`Generated values, fresh on every play.`,source:`generated`,...R});for(let e of F)O.push({path:`examples/${v}/${e.name}.example.json`,content:`${JSON.stringify(e,null,2)}\n`});(j||A.length)&&O.push({path:`examples/${v}/${La}`,content:`specbook sample file
|
|
168
|
+
`}),d.push(...O);let ae=`${m}#/$defs/`,z=e=>{let t=b(e);if(t.length)return{type:`object`,properties:Object.fromEntries(t.map(e=>[e.name,Da(e.schema,ae)])),required:t.filter(e=>e.required).map(e=>e.name)}},oe={$id:`specbook://${t.service}/${v}.request`,type:`object`,description:[_.summary,_.description].filter(Boolean).join(`
|
|
169
|
+
|
|
170
|
+
`)||void 0,properties:{...z(`path`)?{path:z(`path`)}:{},...z(`query`)?{query:z(`query`)}:{},...z(`header`)?{headers:z(`header`)}:{},...T?.schema?{data:Da(T.schema,ae)}:{}},additionalProperties:!1};d.push({path:`schemas/${v}.responses.schema.json`,content:`${JSON.stringify(ie)}\n`}),d.push({path:`schemas/${v}.request.schema.json`,content:`${JSON.stringify(oe)}\n`});let se=_.security??e.security,ce=s&&Array.isArray(se)&&se.length>0,le=s?`, security: ${Array.isArray(se)&&se.length>0?`true`:`false`}`:``,ue=T&&`mediaType`in T&&typeof T.mediaType==`string`&&!T.mediaType.includes(`*`)?T.mediaType:void 0,de=(T?`, encoding: '${T.encoding}'`:``)+(ue?`, mediaType: ${JSON.stringify(ue)}`:``),fe=T?.encoding===`form`?Ia(T.media):{},pe=Object.keys(fe).length?`, formArrays: ${JSON.stringify(fe)}`:``,me=A.length?`, files: ${JSON.stringify(A)}`:``,he=ka(_);a[v]={service:t.service,id:v,method:p.toUpperCase(),path:n,...T?{encoding:T.encoding}:{},...ue?{mediaType:ue}:{},...A.length?{files:A}:{},...Object.keys(fe).length?{formArrays:fe}:{},...s?{security:Array.isArray(se)&&se.length>0}:{}},i&&d.push({path:`operations/${v}.ts`,content:`import { defineOperation } from '${r}'
|
|
171
|
+
import type * as T from '../types'
|
|
172
|
+
|
|
173
|
+
${aa({description:[...new Set([_.summary,_.description].filter(Boolean))].join(`
|
|
174
|
+
|
|
175
|
+
`),deprecated:_.deprecated})}export const ${v} = /* @__PURE__ */ defineOperation<{
|
|
176
|
+
params: { ${ee} }
|
|
177
|
+
body: ${te}
|
|
178
|
+
responses: { ${E.join(`; `)} }
|
|
179
|
+
}>({ service: ${JSON.stringify(t.service)}, id: ${JSON.stringify(v)}, method: '${p.toUpperCase()}', path: ${JSON.stringify(n)}${de}${me}${pe}${le} })
|
|
180
|
+
`});let ge=_.tags?.length?_.tags:[`default`];for(let e of ge)g.set(e,[...g.get(e)??[],v]);d.push({path:`docs/${v}.json`,content:`${JSON.stringify({..._.description&&_.description!==he?{description:_.description}:{},examples:F.map(e=>({name:e.name,title:e.title,source:e.source}))})}\n`}),f.push({id:v,method:p.toUpperCase(),path:n,summary:he,..._.description&&_.description!==he?{description:_.description}:{},tags:ge,statuses:D,examples:F.map(e=>({name:e.name,title:e.title,source:e.source})),...ce?{secured:!0}:{},file:`operations/${v}.ts`})}let _=e=>e.sort().map(e=>`export { ${e} } from './operations/${e}'`).join(`
|
|
181
|
+
`);i&&d.push({path:`index.ts`,content:`${_([...h])}\nexport type * from './types'\n`});for(let[e,t]of i?g:[])d.push({path:`tags/${na(e)}.ts`,content:`${_(t).replace(/'\.\/operations/g,`'../operations`)}\n`});return i&&d.push({path:`opmeta.json`,content:`${JSON.stringify(a,null,2)}\n`}),d.push({path:`manifest.json`,content:`${JSON.stringify({service:t.service,title:e.info?.title,version:e.info?.version,...Aa(e.info)?{logo:Aa(e.info)}:{},servers:(e.servers??[]).map(e=>e.url),tags:[...g.keys()],operations:f},null,2)}\n`}),{files:d,operations:f,metas:a}}function Wa(e){let t=e.replace(/^/,``).trimStart();if(t.startsWith(`{`))try{return JSON.parse(t)}catch{}let n=et(t);if(typeof n!=`object`||!n)throw Error(`The file is not an OpenAPI document`);return n}function Ga(e){let t=/* @__PURE__ */ new Set,n=(e,r)=>{if(!(r>60||typeof e!=`object`||!e)){if(Array.isArray(e))for(let t of e)n(t,r+1);else for(let[i,a]of Object.entries(e))i===`$ref`&&typeof a==`string`&&!a.startsWith(`#`)?t.add(a):n(a,r+1)}};return n(e,0),[...t]}async function Ka(e){let t=Wa(e),n=[],r=t,i=!1;if(typeof t.swagger==`string`&&t.swagger.startsWith(`2`)){let e=await ea.default.convertObj(t,{patch:!0,warnOnly:!0,resolve:!1,direct:!0});r=typeof e.openapi==`object`?e.openapi:e,i=!0}else if(typeof t.openapi!=`string`||!t.openapi.startsWith(`3`))throw Error(`This is not an OpenAPI 3 or Swagger 2 document (no "openapi" or "swagger" field)`);(!r.paths||Object.keys(r.paths).length===0)&&n.push(`The document has no paths.`);let a=Ga(r);return a.length&&n.push(`${a.length} reference${a.length>1?`s`:``} to other files were not loaded (for example ${a[0]}).`),{doc:r,converted:i,warnings:n}}function qa(e,t,n={}){return Ua(e,t,{...n,dataOnly:!0})}const Ja=e=>/^https?:\/\//i.test(e);function Ya(e,t){if(typeof e.openIdConnectUrl==`string`&&e.openIdConnectUrl!==``)try{return{openIdConnectUrl:t(`openIdConnectUrl`,e.openIdConnectUrl)}}catch{return}}function Xa(e,t){let n=e.flows?.authorizationCode??(e.flow===`accessCode`?e:void 0);if(!n?.authorizationUrl||!n?.tokenUrl)return;let r=(e,n)=>{try{return t(e,n)}catch{return n}};return{authorizationUrl:r(`authorizationUrl`,n.authorizationUrl),tokenUrl:r(`tokenUrl`,n.tokenUrl),...n.scopes&&Object.keys(n.scopes).length?{scopes:n.scopes}:{}}}const Za=e=>e.replace(/[^A-Za-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).toUpperCase()||`API_KEY`;function Qa(e,t,n){let r=e.components?.securitySchemes??e.securityDefinitions??{},i={auth:{},secrets:{},vars:{},environmentVars:{}},a=t&&Ja(t)?t:void 0,o=(e,t)=>new URL(e,t).toString(),s=e=>(t,r)=>{if(!n?.length||Ja(r))return o(r,a);let s=`${Za(e).toLowerCase().replace(/_(.)/g,(e,t)=>t.toUpperCase())}${t[0]?.toUpperCase()}${t.slice(1)}`,c=!1;for(let e of n)try{let t=o(r,e.url.endsWith(`/`)?e.url:`${e.url}/`);e.name===`live`?i.vars[s]=t:i.environmentVars[e.name]={...i.environmentVars[e.name],[s]:t},c=!0}catch{}if(!c)return o(r,a);if(i.vars[s]===void 0)try{i.vars[s]=o(r,a)}catch{i.vars[s]=r}return`{{${s}}}`};for(let[e,t]of Object.entries(r)){let n=Za(e),r=`{{secrets.${n}}}`,a,o=e,c;if(t.type===`apiKey`){let n=t.name;t.in===`header`?a={headers:{[n]:r}}:t.in===`query`?a={query:{[n]:r}}:t.in===`cookie`&&(a={headers:{cookie:`${n}=${r}`}}),o=`${e} (API key, ${t.in} "${n}")`}else if(t.type===`http`&&/^bearer$/i.test(t.scheme))a={headers:{authorization:`Bearer ${r}`}},o=`${e} (bearer token)`;else if(t.type===`http`&&/^basic$/i.test(t.scheme))a={headers:{authorization:`Basic ${r}`}},o=`${e} (basic auth, paste base64 of user:password)`;else if(t.type===`basic`)a={headers:{authorization:`Basic ${r}`}},o=`${e} (basic auth, paste base64 of user:password)`;else if(t.type===`oauth2`||t.type===`openIdConnect`){a={headers:{authorization:`Bearer ${r}`}};let n=s(e);c=t.type===`oauth2`?Xa(t,n):Ya(t,n),o=`${e} (OAuth, ${c?`sign in or `:``}paste an access token)`}a&&(i.auth[e]={title:o,apply:a,...c?{oauth:c}:{}},i.secrets[n]={})}return i.defaultProfile=(e.security?.flatMap(e=>Object.keys(e)))?.find(e=>i.auth[e])??Object.keys(i.auth)[0],i}const $a=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,24).replace(/-+$/,``);function eo(e,t){if(typeof e?.url!=`string`)return;let n=e.url.replace(/\{([^}]+)\}/g,(t,n)=>{let r=e.variables?.[n]?.default;return r==null?t:String(r)}).trim();if(!/\{[^}]*\}/.test(n)){if(Ja(n))return n.replace(/\/+$/,``);if(t)try{return new URL(n,t).toString().replace(/\/+$/,``)}catch{}}}function to(e,t){let n=Ja(t)?t:void 0,r=Array.isArray(e.servers)?e.servers:[],i=[],a=e=>typeof e?.description==`string`&&e.description.trim()!==``?{description:e.description.trim()}:{};if(r.length===0)return e.host?i.push({name:`live`,url:`${e.schemes?.[0]??`https`}://${e.host}${e.basePath??``}`.replace(/\/+$/,``)}):n&&i.push({name:`live`,url:new URL(n).origin}),{servers:i,needsBaseUrl:!1,omitted:0};let o=eo(r[0],n);o&&i.push({name:`live`,url:o,...a(r[0])});let s=!o&&typeof r[0]?.url==`string`&&!/^https?:\/\//i.test(r[0].url),c=/* @__PURE__ */ new Set([`mock`,`live`]),l=new Set(i.map(e=>e.url)),u=0;for(let e of r.slice(1)){let t=eo(e,n);if(!t||l.has(t))continue;if(i.length>=20){u++;continue}l.add(t);let r=(()=>{try{return new URL(t).host}catch{return``}})(),o=$a(a(e).description??``)||$a(r)||`server`,s=o;for(let e=2;c.has(s);e++)s=`${o}-${e}`;c.add(s),i.push({name:s,url:t,...a(e)})}return{servers:i,needsBaseUrl:s,omitted:u}}const no=e=>e.trimEnd();function ro(e){let t=/* @__PURE__ */ new Map,n=e=>{let n=t.get(e);if(n)return n;let r={examples:{},mock:{}};return t.set(e,r),r},r=`{}`,i=`{}`;for(let t of e){let e=t.path.split(`/`);if(t.path===`schemas/definitions.schema.json`)r=no(t.content);else if(t.path===`manifest.json`)i=t.content;else if(e[0]===`schemas`&&e[1]?.endsWith(`.request.schema.json`))n(e[1].replace(/\.request\.schema\.json$/,``)).schema=no(t.content);else if(e[0]===`schemas`&&e[1]?.endsWith(`.responses.schema.json`))n(e[1].replace(/\.responses\.schema\.json$/,``)).responses=no(t.content);else if(e[0]===`docs`&&e[1]?.endsWith(`.json`)){let r=JSON.parse(t.content);(r.description||(r.examples?.length??0)>2)&&(n(e[1].replace(/\.json$/,``)).docs=no(t.content))}else if(e[0]===`examples`&&e.length===3){let[,r,i]=e;i.endsWith(`.example.json`)?n(r).examples[i.replace(/\.example\.json$/,``)]=no(t.content):i.endsWith(`.response.json`)&&(n(r).mock[i.replace(/\.response\.json$/,``)]=no(t.content))}}return{ops:t,definitions:r,manifest:i}}const io=e=>`{${Object.entries(e).map(([e,t])=>`${JSON.stringify(e)}:${t}`).join(`,`)}}`;function ao(e){if(!e)return`{}`;let t=[];return e.schema&&t.push(`"schema":${e.schema}`),e.responses&&t.push(`"responses":${e.responses}`),e.docs&&t.push(`"docs":${e.docs}`),Object.keys(e.examples).length&&t.push(`"examples":${io(e.examples)}`),Object.keys(e.mock).length&&t.push(`"mock":${io(e.mock)}`),`{${t.join(`,`)}}`}const oo=26214400,so=e=>self.postMessage(e);let co;const lo=/* @__PURE__ */ new Map;var uo=class extends Error{code;constructor(e,t){super(e),this.code=t}};const fo=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`api`;async function po(e,t){let n;try{n=await fetch(e,{signal:t,redirect:`follow`,credentials:`omit`})}catch{throw t.aborted?new uo(`The server took too long to answer.`,`timeout`):new uo(`The browser could not read that address. The server may not allow requests from other sites (CORS), or the address is not reachable from here.`,`cors`)}if(!n.ok)throw new uo(`The server answered ${n.status} for that address.`,`http`);if(Number(n.headers.get(`content-length`)??0)>oo)throw new uo(`That document is larger than 25 MB.`,`too-large`);let r=n.body?.getReader();if(!r)return n.text();let i=[],a=0;for(;;){let{done:e,value:t}=await r.read();if(e)break;if(a+=t.length,a>oo)throw await r.cancel(),new uo(`That document is larger than 25 MB.`,`too-large`);i.push(t)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return new TextDecoder().decode(o)}async function mo(e,t,n){let r=performance.now(),i,a,o;if(t.kind===`url`){so({id:e,progress:`Fetching the document…`});let r=performance.now();i=await po(t.url,n),a=performance.now()-r,o=t.url}else i=t.text,o=t.name;so({id:e,progress:`Reading the document…`});let s=performance.now(),c;try{c=await Ka(i)}catch(e){throw new uo(e instanceof Error?e.message:String(e),`parse`)}let l=performance.now()-s,{doc:u,warnings:d}=c;so({id:e,progress:`Preparing operations…`});let f=u.info?.title??`API`,p=fo(f),m=performance.now(),h=qa(u,{service:p}),g=performance.now()-m;co=ro(h.files);let _=JSON.parse(co.manifest),v={..._,operations:_.operations.map(({description:e,examples:t,file:n,...r})=>r)},y=Object.fromEntries(_.operations.map(e=>[e.id,e.examples.map(e=>e.name)])),b=t.kind===`url`?t.url:void 0,{servers:x,needsBaseUrl:S,omitted:C}=to(u,b??o??``),{auth:w,secrets:ee,defaultProfile:T,vars:te,environmentVars:E}=Qa(u,b,x),D=x.find(e=>e.name===`live`)?.url;return{service:p,title:f,manifest:v,metas:h.metas,exampleNames:y,auth:w,secrets:ee,defaultProfile:T,authVars:te,authEnvironmentVars:E,baseUrl:D,servers:x,needsBaseUrl:S,warnings:C?[...d,`This document lists ${x.length+C} servers. The first 20 are offered as environments.`]:d,timings:{...a===void 0?{}:{fetch:Math.round(a)},parse:Math.round(l),generate:Math.round(g),total:Math.round(performance.now()-r)},bytes:{spec:i.length,definitions:co.definitions.length}}}self.addEventListener(`message`,async e=>{let t=e.data;try{if(t.type===`cancel`){lo.get(t.id)?.abort();return}if(t.type===`bundle`)return so({id:t.id,ok:!0,result:ao(co?.ops.get(t.opId))});if(t.type===`definitions`)return so({id:t.id,ok:!0,result:co?.definitions??`{}`});let e=new AbortController;lo.set(t.id,e);let n=setTimeout(()=>e.abort(),3e4);try{let n=await mo(t.id,t.source,e.signal);so({id:t.id,ok:!0,result:n})}finally{clearTimeout(n),lo.delete(t.id)}}catch(e){e instanceof uo?so({id:t.id,ok:!1,error:e.message,code:e.code}):so({id:t.id,ok:!1,error:e instanceof Error?e.message:String(e)})}});
|