@specbook/ui 0.1.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.
Files changed (75) hide show
  1. package/dist-viewer/THIRD-PARTY-NOTICES.txt +581 -0
  2. package/dist-viewer/assets/Host-Cq-4gDuM.js +41 -0
  3. package/dist-viewer/assets/index-BBlFcQUE.js +1 -0
  4. package/dist-viewer/assets/main-CSkB-O_8.js +14 -0
  5. package/dist-viewer/assets/mount-DfwluJy4.js +2 -0
  6. package/dist-viewer/assets/panel-9eYU7Gz6.js +1 -0
  7. package/dist-viewer/assets/panel-hNOojwiM.css +1 -0
  8. package/dist-viewer/assets/registry-DIHX11uY.js +2 -0
  9. package/dist-viewer/assets/worker-BmvGpsJS.js +181 -0
  10. package/dist-viewer/index.html +4 -4
  11. package/dist-viewer/specbook.js +1 -1
  12. package/package.json +7 -5
  13. package/src/app.tsx +71 -13
  14. package/src/branding.ts +12 -4
  15. package/src/components/Catalog.tsx +128 -51
  16. package/src/components/EnvBadge.tsx +24 -4
  17. package/src/components/EnvironmentMenu.tsx +237 -127
  18. package/src/components/Fields.tsx +18 -1
  19. package/src/components/NewEnvironmentDialog.tsx +118 -0
  20. package/src/components/Palette.tsx +7 -2
  21. package/src/custom-environments.ts +63 -0
  22. package/src/embed/panel.tsx +287 -44
  23. package/src/embed/styles.ts +2 -0
  24. package/src/embed/target.ts +82 -0
  25. package/src/embed/theme.ts +75 -0
  26. package/src/embed.ts +44 -15
  27. package/src/engine.ts +416 -32
  28. package/src/environment-list.ts +16 -0
  29. package/src/main.tsx +14 -1
  30. package/src/nav.ts +12 -1
  31. package/src/oauth-callback.ts +87 -0
  32. package/src/oauth.ts +195 -0
  33. package/src/panel/Body.tsx +27 -4
  34. package/src/panel/Checks.tsx +79 -0
  35. package/src/panel/CodeSample.tsx +16 -8
  36. package/src/panel/Combo.tsx +52 -13
  37. package/src/panel/ControlsGrid.tsx +54 -9
  38. package/src/panel/ErrorBoundary.tsx +36 -0
  39. package/src/panel/Host.tsx +14 -2
  40. package/src/panel/OAuthSignIn.tsx +167 -0
  41. package/src/panel/Panel.tsx +50 -13
  42. package/src/panel/ParamGrid.tsx +15 -8
  43. package/src/panel/RequestPanel.tsx +93 -36
  44. package/src/panel/RequestView.tsx +2 -1
  45. package/src/panel/ResponseView.tsx +25 -14
  46. package/src/panel/SecretsBar.tsx +43 -9
  47. package/src/panel/SequenceDocs.tsx +7 -6
  48. package/src/panel/SequencePanel.tsx +124 -32
  49. package/src/panel/announce.ts +17 -0
  50. package/src/panel/icons.tsx +9 -0
  51. package/src/panel/short.ts +24 -0
  52. package/src/routing.ts +0 -9
  53. package/src/runtime.ts +19 -1
  54. package/src/secrets.ts +4 -2
  55. package/src/storage.ts +58 -0
  56. package/src/store.ts +10 -0
  57. package/src/styles/app.css +69 -6
  58. package/src/styles/embed.css +116 -0
  59. package/src/styles/panel.css +277 -2
  60. package/src/viewer/embed.ts +5 -0
  61. package/src/viewer/main.tsx +5 -1
  62. package/src/viewer/manifests.ts +2 -0
  63. package/src/viewer/protocol.ts +9 -0
  64. package/src/viewer/registry-data.ts +4 -0
  65. package/src/viewer/registry.ts +48 -3
  66. package/src/viewer/worker.ts +20 -7
  67. package/src/virtual.d.ts +8 -0
  68. package/dist-viewer/assets/Host-DdTTHeXU.js +0 -37
  69. package/dist-viewer/assets/index-DnYdlDXQ.js +0 -1
  70. package/dist-viewer/assets/main-uV4JzQPd.js +0 -14
  71. package/dist-viewer/assets/mount-B-qFOcWp.js +0 -2
  72. package/dist-viewer/assets/panel-CoQ6iQpX.js +0 -1
  73. package/dist-viewer/assets/panel-Coi9H1nv.css +0 -1
  74. package/dist-viewer/assets/registry-DI74Wtj8.js +0 -2
  75. package/dist-viewer/assets/worker-Dw3Ps3hk.js +0 -181
@@ -1,181 +0,0 @@
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,ne;function E(){if(ne)return te;ne=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 D,O;function re(){return O||(O=1,D=new(T())(`tag:yaml.org,2002:str`,{kind:`scalar`,construct:function(e){return e===null?``:e}})),D}var ie,ae;function k(){return ae||(ae=1,ie=new(T())(`tag:yaml.org,2002:seq`,{kind:`sequence`,construct:function(e){return e===null?[]:e}})),ie}var A,j;function M(){return j||(j=1,A=new(T())(`tag:yaml.org,2002:map`,{kind:`mapping`,construct:function(e){return e===null?{}:e}})),A}var N,P;function F(){return P||(P=1,N=new(E())({explicit:[re(),k(),M()]})),N}var I,L;function oe(){if(L)return I;L=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 I=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`}),I}var R,se;function ce(){if(se)return R;se=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 R=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`}),R}var le,ue;function de(){if(ue)return le;ue=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 le=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`]}}),le}var fe,pe;function me(){if(pe)return fe;pe=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 fe=new t(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:i,construct:a,predicate:c,represent:s,defaultStyle:`lowercase`}),fe}var he,ge;function _e(){return ge||(ge=1,he=F().extend({implicit:[oe(),ce(),de(),me()]})),he}var ve,ye;function be(){return ye||(ye=1,ve=_e()),ve}var xe,Se;function Ce(){if(Se)return xe;Se=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 xe=new e(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:r,construct:i,instanceOf:Date,represent:a}),xe}var we,Te;function Ee(){if(Te)return we;Te=1;let e=T();function t(e){return e===`<<`||e===null}return we=new e(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:t}),we}var De,Oe;function ke(){if(Oe)return De;Oe=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 De=new e(`tag:yaml.org,2002:binary`,{kind:`scalar`,resolve:t,construct:n,predicate:i,represent:r}),De}var Ae,je;function Me(){if(je)return Ae;je=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 Ae=new e(`tag:yaml.org,2002:omap`,{kind:`sequence`,resolve:r,construct:i}),Ae}var Ne,Pe;function Fe(){if(Pe)return Ne;Pe=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 Ne=new e(`tag:yaml.org,2002:pairs`,{kind:`sequence`,resolve:n,construct:r}),Ne}var Ie,Le;function Re(){if(Le)return Ie;Le=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 Ie=new e(`tag:yaml.org,2002:set`,{kind:`mapping`,resolve:n,construct:r}),Ie}var ze,Be;function Ve(){return Be||(Be=1,ze=be().extend({implicit:[Ce(),Ee()],explicit:[ke(),Me(),Fe(),Re()]})),ze}var He;function Ue(){if(He)return m;He=1;let e=_(),t=b(),n=C(),r=Ve(),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 ne(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 E(e,t){throw ne(e,t)}function D(e,t){e.onWarning&&e.onWarning.call(null,ne(e,t))}function O(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 re(e){e.anchorMapTransactions.push(/* @__PURE__ */ Object.create(null))}function ie(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 ae(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 k(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 A(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 j={YAML:function(e,t,n){e.version!==null&&E(e,`duplication of %YAML directive`),n.length!==1&&E(e,`YAML directive accepts exactly one argument`);let r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);r===null&&E(e,`ill-formed argument of the YAML directive`);let i=parseInt(r[1],10),a=parseInt(r[2],10);i!==1&&E(e,`unacceptable YAML version of the document`),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&D(e,`unsupported YAML version of the document`)},TAG:function(e,t,n){let r;n.length!==2&&E(e,`TAG directive accepts exactly two arguments`);let a=n[0];r=n[1],c.test(a)||E(e,`ill-formed tag handle (first argument) of the TAG directive`),i.call(e.tagMap,a)&&E(e,`there is a previously declared suffix for "`+a+`" tag handle`),l.test(r)||E(e,`ill-formed tag prefix (second argument) of the TAG directive`);try{r=decodeURIComponent(r)}catch{E(e,`tag prefix is malformed: `+r)}e.tagMap[a]=r}};function M(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||E(e,`expected valid JSON character`)}else a.test(i)&&E(e,`the stream contains non-printable characters`);e.result+=i}}function N(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&E(e,`merge keys exceeded maxTotalMergeKeys (`+e.maxTotalMergeKeys+`)`)}function P(t,n,r,a){e.isObject(r)||E(t,`cannot merge mappings; the provided source object is unacceptable`),N(t);let o=Object.keys(r);for(let e=0,s=o.length;e<s;e+=1){let s=o[e];N(t),i.call(n,s)||(w(n,s,r[s]),a[s]=!0)}}function F(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])&&E(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&&E(e,`abnormal merge sequence size`);for(let r=0,i=o.length;r<i;r+=1)P(e,t,o[r],n)}else P(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,E(e,`duplicated mapping key`)),w(t,a,o),delete n[a];return t}function I(e){let t=e.input.charCodeAt(e.position);t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):E(e,`a line break is expected`),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function L(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(I(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&&D(e,`deficient indentation`),r}function oe(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 R(t,n){n===1?t.result+=` `:n>1&&(t.result+=e.repeat(`
12
- `,n-1))}function se(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&&oe(e)||n&&h(m))break;else if(d(m)){if(o=e.line,s=e.lineStart,c=e.lineIndent,L(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&&=(M(e,r,i,!1),R(e,e.line-o),r=i=e.position,!1),f(m)||(i=e.position+1),m=e.input.charCodeAt(++e.position)}return M(e,r,i,!1),e.result?!0:(e.kind=l,e.result=u,!1)}function ce(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(M(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)?(M(e,n,r,!0),R(e,L(e,!1,t)),n=r=e.position):e.position===e.lineStart&&oe(e)?E(e,`unexpected end of the document within a single quoted scalar`):(e.position++,f(i)||(r=e.position));E(e,`unexpected end of the stream within a single quoted scalar`)}function le(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 M(e,n,e.position,!0),e.position++,!0;else if(a===92){if(M(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),d(a))L(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:E(e,`expected hexadecimal character`);e.result+=S(n),e.position++}else E(e,`unknown escape sequence`);n=r=e.position}else d(a)?(M(e,n,r,!0),R(e,L(e,!1,t)),n=r=e.position):e.position===e.lineStart&&oe(e)?E(e,`unexpected end of the document within a double quoted scalar`):(e.position++,f(a)||(r=e.position));E(e,`unexpected end of the stream within a double quoted scalar`)}function ue(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&&O(e,e.anchor,s),v=e.input.charCodeAt(++e.position);v!==0;){if(L(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&&E(e,`expected the node content, but found ','`):E(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++,L(e,!0,t)),r=e.line,i=e.lineStart,a=e.position,ve(e,t,1,!1,!0),g=e.tag,h=e.result,L(e,!0,t),v=e.input.charCodeAt(e.position),(d||e.line===r)&&v===58&&(u=!0,v=e.input.charCodeAt(++e.position),L(e,!0,t),ve(e,t,1,!1,!0),_=e.result),f?F(e,s,m,g,h,_,r,i,a):u?s.push(F(e,null,m,g,h,_,r,i,a)):s.push(h),L(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}E(e,`unexpected end of the stream within a flow collection`)}function de(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:E(t,`repeat of a chomping mode identifier`);else if((u=y(p))>=0)u===0?E(t,`bad explicit indentation width of a block scalar; it cannot be less than one`):o?E(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(I(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&&E(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);M(t,n,t.position,!1)}return!0}function fe(e,t){let n=e.tag,r=e.anchor,i=[],a=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&O(e,e.anchor,i);let o=e.input.charCodeAt(e.position);for(;o!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,E(e,`tab characters must not be used in indentation`)),o===45&&p(e.input.charCodeAt(e.position+1)));){if(a=!0,e.position++,L(e,!0,-1)&&e.lineIndent<=t){i.push(null),o=e.input.charCodeAt(e.position);continue}let n=e.line;if(ve(e,t,3,!1,!0),i.push(e.result),L(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&o!==0)E(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 pe(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&&O(e,e.anchor,l);let v=e.input.charCodeAt(e.position);for(;v!==0;){!g&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,E(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&&(F(e,l,u,d,m,null,i,a,o),d=m=h=null),_=!0,g=!0,r=!0):g?(g=!1,r=!0):E(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,!ve(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)||E(e,`a whitespace character is expected after the key-value separator within a block mapping`),g&&(F(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(_)E(e,`can not read an implicit mapping pair; a colon is missed`);else return e.tag=s,e.anchor=c,!0}else if(_)E(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),ve(e,t,4,!0,r)&&(g?m=e.result:h=e.result),g||(F(e,l,u,d,m,h,i,a,o),d=m=h=null),L(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===b||e.lineIndent>t)&&v!==0)E(e,`bad indentation of a mapping entry`);else if(e.lineIndent<t)break}return g&&F(e,l,u,d,m,null,i,a,o),_&&(e.tag=s,e.anchor=c,e.kind=`mapping`,e.result=l),_}function me(e){let t=!1,n=!1,r,a,o=e.input.charCodeAt(e.position);if(o!==33)return!1;e.tag!==null&&E(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)):E(e,`unexpected end of the stream within a verbatim tag`)}else{for(;o!==0&&!p(o);)o===33&&(n?E(e,`tag suffix cannot contain exclamation marks`):(r=e.input.slice(u-1,e.position+1),c.test(r)||E(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)&&E(e,`tag suffix cannot contain flow indicator characters`)}a&&!l.test(a)&&E(e,`tag name cannot contain such characters: `+a);try{a=decodeURIComponent(a)}catch{E(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:E(e,`undeclared tag handle "`+r+`"`),!0}function he(e){let t=e.input.charCodeAt(e.position);if(t!==38)return!1;e.anchor!==null&&E(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&&E(e,`name of an anchor node must contain at least one character`),e.anchor=e.input.slice(n,e.position),!0}function ge(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&&E(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)||E(e,`unidentified alias "`+r+`"`),e.result=e.anchorMap[r],L(e,!0,-1),!0}function _e(e,t,n,r){let i=k(e);return re(e),A(e,t),e.tag=null,e.anchor=null,e.kind=null,e.result=null,pe(e,n,r)&&e.kind===`mapping`?(ie(e),!0):(ae(e),A(e,i),!1)}function ve(e,t,n,r,a){let o,s,c=1,l=!1,u=!1,d=null,f,p,m;e.depth>=e.maxDepth&&E(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&&L(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=k(e);if(l&&(n===33&&e.tag!==null||n===38&&e.anchor!==null)||!me(e)&&!he(e))break;d===null&&(d=r),L(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&&(fe(e,m)||pe(e,m,p))||ue(e,p))u=!0;else{let t=e.input.charCodeAt(e.position);d!==null&&h&&!s&&t!==124&&t!==62&&_e(e,d,d.position-d.lineStart,p)||o&&de(e,p)||ce(e,p)||le(e,p)?u=!0:ge(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&E(e,`alias node should not have any properties`)):se(e,p,n===1)&&(u=!0,e.tag===null&&(e.tag=`?`)),e.anchor!==null&&O(e,e.anchor,e.result)}}else c===0&&(u=s&&fe(e,m))}if(e.tag===null)e.anchor!==null&&O(e,e.anchor,e.result);else if(e.tag===`?`){e.result!==null&&e.kind!==`scalar`&&E(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&&O(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||E(e,`unknown tag !<`+e.tag+`>`),e.result!==null&&f.kind!==e.kind&&E(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&&O(e,e.anchor,e.result)):E(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 ye(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&&(L(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&&E(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&&I(e),i.call(j,a)?j[a](e,a,o):D(e,`unknown document directive "`+a+`"`)}L(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,L(e,!0,-1)):n&&E(e,`directives end mark is expected`),ve(e,e.lineIndent-1,4,!1,!0),L(e,!0,-1),e.checkLineBreaks&&o.test(e.input.slice(t,e.position))&&D(e,`non-ASCII line breaks are interpreted as content`),e.documents.push(e.result),e.position===e.lineStart&&oe(e)?e.input.charCodeAt(e.position)===46&&(e.position+=3,L(e,!0,-1)):e.position<e.length-1&&E(e,`end of the stream or a document separator is expected`)}function be(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,E(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;)ye(n);return n.documents}function xe(e,t,n){typeof t==`object`&&t&&n===void 0&&(n=t,t=null);let r=be(e,n);if(typeof t!=`function`)return r;for(let e=0,n=r.length;e<n;e+=1)t(r[e])}function Se(e,n){let r=be(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=xe,m.load=Se,m}var We={},Ge;function Ke(){if(Ge)return We;Ge=1;let e=_(),t=b(),n=Ve(),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)+ne(f(n,o));case 4:return`>`+te(n,e.indent)+ne(f(E(n,l),o));case 5:return`"`+O(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 ne(e){return e[e.length-1]===`
27
- `?e.slice(0,-1):e}function E(e,t){let n=/(\n+)([^\n]*)/g,r=(function(){let r=e.indexOf(`
28
- `);return r=r===-1?e.length:r,n.lastIndex=r,D(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
- `:``)+D(n,t),i=a}return r}function D(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 O(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 re(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)),(j(e,t,a,!1,!1)||a===void 0&&j(e,t,null,!1,!1))&&(r!==``&&(r+=`,`+(e.condenseFlow?``:` `)),r+=e.dump)}e.tag=i,e.dump=`[`+r+`]`}function ie(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)),(j(e,t+1,o,!0,!0,!1,!0)||o===void 0&&j(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 ae(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)),j(e,t,s,!1,!1)&&(e.dump.length>1024&&(o+=`? `),o+=e.dump+(e.condenseFlow?`"`:``)+`:`+(e.condenseFlow?``:` `),j(e,t,c,!1,!1)&&(o+=e.dump,r+=o))}e.tag=i,e.dump=`{`+r+`}`}function k(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)),!j(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)),j(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 A(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 j(e,n,i,a,o,s,c){e.tag=null,e.dump=i,A(e,i,!1)||A(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?(k(e,n,e.dump,o),p&&(e.dump=`&ref_`+f+e.dump)):(ae(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?ie(e,n-1,e.dump,o):ie(e,n,e.dump,o),p&&(e.dump=`&ref_`+f+e.dump)):(re(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 M(e,t){let n=[],r=[];N(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 N(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)N(e[r],t,n);else{let r=Object.keys(e);for(let i=0,a=r.length;i<a;i+=1)N(e[r[i]],t,n)}}}function P(e,t){t||={};let n=new d(t);n.noRefs||M(e,n);let r=e;return n.replacer&&(r=n.replacer.call({"":r},``,r)),j(n,0,r,!0,!0)?n.dump+`
34
- `:``}return We.dump=P,We}var qe;function Je(){if(qe)return p;qe=1;let e=Ue(),t=Ke();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=E(),p.FAILSAFE_SCHEMA=F(),p.JSON_SCHEMA=_e(),p.CORE_SCHEMA=be(),p.DEFAULT_SCHEMA=Ve(),p.load=e.load,p.loadAll=e.loadAll,p.dump=t.dump,p.YAMLException=b(),p.types={binary:ke(),float:me(),map:M(),null:oe(),pairs:Fe(),set:Re(),timestamp:Ce(),bool:ce(),int:de(),merge:Ee(),omap:Me(),seq:k(),str:re()},p.safeLoad=n(`safeLoad`,`load`),p.safeLoadAll=n(`safeLoadAll`,`loadAll`),p.safeDump=n(`safeDump`,`dump`),p}const{Type:Ye,Schema:Xe,FAILSAFE_SCHEMA:Ze,JSON_SCHEMA:Qe,CORE_SCHEMA:$e,DEFAULT_SCHEMA:et,load:tt,loadAll:nt,dump:rt,YAMLException:it,types:at,safeLoad:ot,safeLoadAll:st,safeDump:ct}=/* @__PURE__ */ f(Je());var lt=/* @__PURE__ */ c({default:()=>dt,dirname:()=>ht,fileURLToPath:()=>vt,join:()=>gt,parse:()=>_t,pathToFileURL:()=>yt,promises:()=>pt,readFileSync:()=>ft,resolve:()=>mt}),ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt=o((()=>{ut=()=>{throw Error(`not available in the browser`)},dt={},ft=ut,pt={},mt=(...e)=>e.join(`/`),ht=e=>e,gt=(...e)=>e.join(`/`),_t=e=>({protocol:``,host:``,pathname:e}),vt=e=>e,yt=e=>e})),xt=/* @__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()})),St=/* @__PURE__ */ s(((e,t)=>{var n=xt();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 Ct(e){let t=[0],n=e.indexOf(`
35
- `);for(;n!==-1;)n+=1,t.push(n),n=e.indexOf(`
36
- `,n);return t}function wt(e){let t,n;return typeof e==`string`?(t=Ct(e),n=e):(Array.isArray(e)&&(e=e[0]),e&&e.context&&(e.lineStarts||(e.lineStarts=Ct(e.context.src)),t=e.lineStarts,n=e.context.src)),{lineStarts:t,src:n}}function Tt(e,t){if(typeof e!=`number`||e<0)return null;let{lineStarts:n,src:r}=wt(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 Et(e,t){let{lineStarts:n,src:r}=wt(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 Dt({start:e,end:t},n,r=80){let i=Et(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 z(e,t,n){return(t=kt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ot(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 kt(e){var t=Ot(e,`string`);return typeof t==`symbol`?t:t+``}var B,V,At,jt,H,U,Mt,Nt,W,G,Pt,Ft,It=o((()=>{B={ANCHOR:`&`,COMMENT:`#`,TAG:`!`,DIRECTIVES_END:`-`,DOCUMENT_END:`.`},V={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`},At=`tag:yaml.org,2002:`,jt={MAP:`tag:yaml.org,2002:map`,SEQ:`tag:yaml.org,2002:seq`,STR:`tag:yaml.org,2002:str`},H=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}},U=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!==B.DIRECTIVES_END&&r!==B.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,B.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,B.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]===B.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]!==B.COMMENT)return!0}return!1}get includesTrailingLines(){return!1}get jsonLike(){return[V.FLOW_MAP,V.FLOW_SEQ,V.QUOTE_DOUBLE,V.QUOTE_SINGLE].indexOf(this.type)!==-1}get rangeAsLinePos(){if(!this.range||!this.context)return;let e=Tt(this.range.start,this.context.root);if(e)return{start:e,end:Tt(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,B.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]===B.COMMENT){let r=e.endOfLine(n,t+1),i=new H(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)}},Mt=class extends Error{constructor(e,t,n){if(!n||!(t instanceof U))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 H(this.offset,this.offset+1);let t=e&&Tt(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&&Dt(this.linePos,e);r&&(this.message+=`:\n\n${r}\n`)}delete this.source}},Nt=class extends Mt{constructor(e,t){super(`YAMLReferenceError`,e,t)}},W=class extends Mt{constructor(e,t){super(`YAMLSemanticError`,e,t)}},G=class extends Mt{constructor(e,t){super(`YAMLSyntaxError`,e,t)}},Pt=class extends Mt{constructor(e,t){super(`YAMLWarning`,e,t)}},Ft=class e extends U{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}=U.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 W(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 W(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
- `&&!U.atDocumentBoundary(i,a+1);t=i[a]){let t=U.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 H(n,a),a=U.endOfWhiteSpace(i,a),a=this.parseComment(a),(!this.hasComment||this.valueRange.isEmpty())&&(a=this.parseBlockValue(a)),a}}}));function Lt(e){let t=e;for(;t instanceof Vt;)t=t.node;if(!(t instanceof Ut))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===V.COMMENT){let{indent:t,lineStart:i}=n.context;if(t>0&&n.range.start>=i+t)break;r=e}else if(n.type===V.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 Rt(e,t){switch(e){case V.ALIAS:return new Kt(e,t);case V.BLOCK_FOLDED:case V.BLOCK_LITERAL:return new Jt(e,t);case V.FLOW_MAP:case V.FLOW_SEQ:return new Yt(e,t);case V.MAP_KEY:case V.MAP_VALUE:case V.SEQ_ITEM:return new Vt(e,t);case V.COMMENT:case V.PLAIN:return new Ft(e,t);case V.QUOTE_DOUBLE:return new Xt(e,t);case V.QUOTE_SINGLE:return new Zt(e,t);
65
- /* istanbul ignore next */
66
- default:return null}}function zt(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 Gt,i=new Qt({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 Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t=o((()=>{It(),Bt=class extends U{constructor(){super(V.BLANK_LINE)}
69
- /* istanbul ignore next */
70
- get includesTrailingLines(){return!0}parse(e,t){return this.context=e,this.range=new H(t,t+1),t+1}},Vt=class extends U{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===V.SEQ_ITEM&&(this.error=new W(this,`Sequence items must not have preceding content on the same line`));let o=i?t-a:e.indent,s=U.endOfWhiteSpace(r,t+1),c=r[s],l=c===`#`,u=[],d=null;for(;c===`
71
- `||c===`#`;){if(c===`#`){let e=U.endOfLine(r,s+1);u.push(new H(s,e)),s=e}else i=!0,a=s+1,r[U.endOfWhiteSpace(r,a)]===`
72
- `&&u.length===0&&(d=new Bt,a=d.parse({src:r},a)),s=U.endOfIndent(r,a);c=r[s]}if(U.nextNodeIsIndented(c,s-(a+o),this.type!==V.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=U.endOfLine(r,t+1);let f=this.node?this.node.valueRange.end:s;return this.valueRange=new H(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 U.addStringTerminator(e,n.end,i)}},Ht=class extends U{constructor(){super(V.COMMENT)}parse(e,t){this.context=e;let n=this.parseComment(t);return this.range=new H(t,n),n}},Ut=class e extends U{static nextContentHasIndent(t,n,r){let i=U.endOfLine(t,n)+1;n=U.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===V.SEQ_ITEM?V.SEQ:V.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=Lt(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=U.startOfLine(i,n),o=this.items[0];o.context.parent=this,this.valueRange=H.copy(o.valueRange);let s=o.range.start-o.context.lineStart,c=n;c=U.normalizeOffset(i,c);let l=i[c],u=U.endOfWhiteSpace(i,a)===c,d=!1;for(;l;){for(;l===`
74
- `||l===`#`;){if(u&&l===`
75
- `&&!d){let e=new Bt;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 Ht;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=U.endOfIndent(i,a),U.atBlank(i,c)){let e=U.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 G(this,`All collection items must start at the same column`)}if(o.type===V.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 G(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=U.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=Lt(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 U.addStringTerminator(e,n.end,i)}},Wt=class extends U{constructor(){super(V.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 H(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 H(t,n),n}},Gt=class e extends U{static startCommentOrEndBlankLine(e,t){let n=U.endOfWhiteSpace(e,t),r=e[n];return r===`#`||r===`
81
- `?n:t}constructor(){super(V.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(;!U.atDocumentBoundary(n,a,B.DIRECTIVES_END);)switch(a=e.startCommentOrEndBlankLine(n,a),n[a]){case`
82
- `:if(r){let e=new Bt;a=e.parse({src:n},a),a<n.length&&this.directives.push(e)}else a+=1,r=!0;break;case`#`:{let e=new Ht;a=e.parse({src:n},a),this.directives.push(e),r=!1}break;case`%`:{let e=new Wt;a=e.parse({parent:this,src:n},a),this.directives.push(e),i=!0,r=!1}break;default:return i?this.error=new W(this,`Missing directives-end indicator line`):this.directives.length>0&&(this.contents=this.directives,this.directives=[]),a}return n[a]?(this.directivesEndMarker=new H(a,a+3),a+3):(i?this.error=new W(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=U.endOfWhiteSpace(r,t),o=i===t;for(this.valueRange=new H(a);!U.atDocumentBoundary(r,a,B.DOCUMENT_END);){switch(r[a]){case`
83
- `:if(o){let e=new Bt;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 Ht;a=e.parse({src:r},a),this.contents.push(e),o=!1}break;default:{let e=U.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=Lt(t);s&&Array.prototype.push.apply(this.contents,s)}}a=e.startCommentOrEndBlankLine(r,a)}if(this.valueRange.end=a,r[a]&&(this.documentEndMarker=new H(a,a+3),a+=3,r[a])){if(a=U.endOfWhiteSpace(r,a),r[a]===`#`){let e=new Ht;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 G(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===V.COMMENT)&&(r+=`---
85
- `),r+=e.join(``)),r[r.length-1]!==`
86
- `&&(r+=`
87
- `),r}},Kt=class extends U{parse(e,t){this.context=e;let{src:n}=e,r=U.endOfIdentifier(n,t+1);return this.valueRange=new H(t+1,r),r=U.endOfWhiteSpace(n,r),r=this.parseComment(r),r}},qt={CLIP:`CLIP`,KEEP:`KEEP`,STRIP:`STRIP`},Jt=class extends U{constructor(e,t){super(e,t),this.blockIndent=null,this.chomping=qt.CLIP,this.header=null}get includesTrailingLines(){return this.chomping===qt.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===qt.KEEP)break;return``}a===`
89
- `&&(i=t),a=r[t-1]}let o=t+1;i&&(this.chomping===qt.KEEP?(o=i,t=this.valueRange.end):t=i);let s=n+this.blockIndent,c=this.type===V.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=U.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===qt.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=qt.STRIP;break;case`+`:this.chomping=qt.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 H(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,!U.atDocumentBoundary(n,i));e=n[i]){let e=U.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 W(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 W(this,e)}}i=n[e]===`
103
- `?e:a=U.endOfLine(n,e)}return this.chomping!==qt.KEEP&&(i=n[a]?a+1:a),this.valueRange=new H(e+1,i),i}parse(e,t){this.context=e;let{src:n}=e,r=this.parseBlockHeader(t);return r=U.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}},Yt=class extends U{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===V.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=U.endOfWhiteSpace(r,t+1);for(o=r[s];o&&o!==`]`&&o!==`}`;){switch(o){case`
104
- `:if(a=s+1,r[U.endOfWhiteSpace(r,a)]===`
105
- `){let e=new Bt;a=e.parse({src:r},a),this.items.push(e)}s=U.endOfIndent(r,a),s<=a+i&&(o=r[s],s<a+i||o!==`]`&&o!==`}`)&&(this.error=new W(this,`Insufficient indentation in flow collection`));break;case`,`:this.items.push({char:o,offset:s}),s+=1;break;case`#`:{let e=new Ht;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 H(t,s),s;this.items.push(e),s=U.normalizeOffset(r,e.range.end)}}s=U.endOfWhiteSpace(r,s),o=r[s]}return this.valueRange=new H(t,s+1),o&&(this.items.push({char:o,offset:s}),s=U.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 U)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 U),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),U.addStringTerminator(e,n.end,a)}},Xt=class e extends U{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 G(this,`Missing closing "quote`));let a=``;for(let o=t+1;o<n-1;++o){let t=i[o];if(t===`
110
- `){U.atDocumentBoundary(i,o+1)&&e.push(new W(this,`Document boundary indicators are not allowed within string values`));let{fold:t,offset:n,error:s}=U.foldNewline(i,o,r);a+=t,o=n,s&&e.push(new W(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 G(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 G(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 H(n,i),i=U.endOfWhiteSpace(r,i),i=this.parseComment(i),i}},Zt=class e extends U{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 G(this,`Missing closing 'quote`));let a=``;for(let o=t+1;o<n-1;++o){let t=i[o];if(t===`
114
- `){U.atDocumentBoundary(i,o+1)&&e.push(new W(this,`Document boundary indicators are not allowed within string values`));let{fold:t,offset:n,error:s}=U.foldNewline(i,o,r);a+=t,o=n,s&&e.push(new W(this,`Multi-line single-quoted string needs to be sufficiently indented`))}else if(t===`'`)a+=t,o+=1,i[o]!==`'`&&e.push(new G(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 H(n,i),i=U.endOfWhiteSpace(r,i),i=this.parseComment(i),i}},Qt=class e{static parseType(e,t,n){switch(e[t]){case`*`:return V.ALIAS;case`>`:return V.BLOCK_FOLDED;case`|`:return V.BLOCK_LITERAL;case`{`:return V.FLOW_MAP;case`[`:return V.FLOW_SEQ;case`?`:return!n&&U.atBlank(e,t+1,!0)?V.MAP_KEY:V.PLAIN;case`:`:return!n&&U.atBlank(e,t+1,!0)?V.MAP_VALUE:V.PLAIN;case`-`:return!n&&U.atBlank(e,t+1,!0)?V.SEQ_ITEM:V.PLAIN;case`"`:return V.QUOTE_DOUBLE;case`'`:return V.QUOTE_SINGLE;default:return V.PLAIN}}constructor(t={},{atLineStart:n,inCollection:r,inFlow:i,indent:a,lineStart:o,parent:s}={}){z(this,`parseNode`,(t,n)=>{if(U.atDocumentBoundary(this.src,n))return null;let r=new e(this,t),{props:i,type:a,valueStart:o}=r.parseProps(n),s=Rt(a,i),c=n;try{c=s.parse(r,o)}catch(e){let t=e instanceof Error?e.message:String(e);s.error||=new G(s,t)}if(s.range=new H(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===V.DOCUMENT&&(s.error=new G(s,`Block collection must not have preceding content here (e.g. directives-end indicator)`));let t=new Ut(s);return c=t.parse(new e(r),c),t.range=new H(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 Vt)return!0;let i=e.range.end;return r[i]===`
116
- `||r[i-1]===`
117
- `?!1:(i=U.endOfWhiteSpace(r,i),r[i]===`:`)}parseProps(t){let{inFlow:n,parent:r,src:i}=this,a=[],o=!1;t=this.atLineStart?U.endOfIndent(i,t):U.endOfWhiteSpace(i,t);let s=i[t];for(;s===B.ANCHOR||s===B.COMMENT||s===B.TAG||s===`
118
- `;){if(s===`
119
- `){let e=t,n;do n=e+1,e=U.endOfIndent(i,n);while(i[e]===`
120
- `);let a=e-(n+this.indent),s=r.type===V.SEQ_ITEM&&r.context.atLineStart;if(i[e]!==`#`&&!U.nextNodeIsIndented(i[e],a,!s))break;this.atLineStart=!0,this.lineStart=n,o=!1,t=e}else if(s===B.COMMENT){let e=U.endOfLine(i,t+1);a.push(new H(t,e)),t=e}else{let e=U.endOfIdentifier(i,t+1);s===B.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=U.endOfIdentifier(i,e+5)),a.push(new H(t,e)),o=!0,t=U.endOfWhiteSpace(i,e)}s=i[t]}return o&&s===`:`&&U.atBlank(i,t+1,!0)&&--t,{props:a,type:e.parseType(i,t,n),valueStart:t}}}}));function en(e,t,n){return n?`#${n.replace(/[\s\S]^/gm,`$&${t}#`)}\n${t}${e}`:e}function tn(e,t,n){return n?n.indexOf(`
121
- `)===-1?`${e} #${n}`:`${e}\n`+n.replace(/^/gm,`${t||``}#`):e}function K(e,t,n){if(Array.isArray(e))return e.map((e,t)=>K(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 nn(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 rn(e){let t=e instanceof J?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),Number.isInteger(t)&&t>=0?t:null}function an(e,t){let n=t instanceof J?t.value:t;for(let r of e)if(r instanceof Z&&(r.key===t||r.key===n||r.key&&r.key.value===n))return r}function on(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 J||(e=new J(e)),n&&(e.format=n),e}}return n&&(e=n(e)),new J(e)}function sn(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 cn(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 ln(e,t){let{implicitKey:n}=t,{jsonEncoding:r,minMultiLineLength:i}=$.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:sn(s,o,qn,Yn(t))}function un(e,t){if(t.implicitKey){if(/\n/.test(e))return ln(e,t)}else if(/[ \t]\n|\n[ \t]/.test(e))return ln(e,t);let n=t.indent||(Xn(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:sn(r,n,Gn,Yn(t))}function dn({comment:e,type:t,value:n},r,i,a){if(/\n[\t ]+$/.test(n)||/^\s*$/.test(n))return ln(n,r);let o=r.indent||(r.forceBlockIndent||Xn(n)?` `:``),s=o?`2`:`1`,c=t===V.BLOCK_FOLDED?!1:t===V.BLOCK_LITERAL||!cn(n,$.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=sn(`${u}${n}${d}`,o,Kn,$.fold);return`${l}\n${o}${f}`}function fn(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 ln(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?un(o,t):ln(o,t):dn(e,t,n,r);if(!c&&!u&&a!==V.PLAIN&&o.indexOf(`
133
- `)!==-1)return dn(e,t,n,r);if(l===``&&Xn(o))return t.forceBlockIndent=!0,dn(e,t,n,r);let d=o.replace(/\n+/g,`$&\n${l}`);if(s){let{tags:e}=t.doc.schema;if(typeof on(d,e,e.scalarFallback).value!=`string`)return ln(o,t)}let f=c?d:sn(d,l,Gn,Yn(t));return i&&!u&&(f.indexOf(`
134
- `)!==-1||i.indexOf(`
135
- `)!==-1)?(n&&n(),en(f,l,i)):f}function pn(e,t,n,r){let{defaultType:i}=$,{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 V.BLOCK_FOLDED:case V.BLOCK_LITERAL:return dn(e,t,n,r);case V.QUOTE_DOUBLE:return ln(c,t);case V.QUOTE_SINGLE:return un(c,t);case V.PLAIN:return fn(e,t,n,r);default:return null}};(s!==V.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(c)||(a||o)&&(s===V.BLOCK_FOLDED||s===V.BLOCK_LITERAL))&&(s=V.QUOTE_DOUBLE);let u=l(s);if(u===null&&(u=l(i),u===null))throw Error(`Unsupported default string type ${i}`);return u}function mn({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 hn(e,t){let n,r;switch(t.type){case V.FLOW_MAP:n=`}`,r=`flow map`;break;case V.FLOW_SEQ:n=`]`,r=`flow sequence`;break;default:e.push(new W(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!==V.COMMENT){i=n;break}}if(i&&i.char!==n){let a=`Expected ${r} to end with ${n}`,o;typeof i.offset==`number`?(o=new W(t,a),o.offset=i.offset+1):(o=new W(i,a),i.range&&i.range.end&&(o.offset=i.range.end-i.range.start)),e.push(o)}}function gn(e,t){let n=t.context.src[t.range.start-1];n!==`
136
- `&&n!==` `&&n!==` `&&e.push(new W(t,`Comments must be separated from other tokens by white space characters`))}function _n(e,t){let n=String(t),r=n.substr(0,8)+`...`+n.substr(-8);return new W(e,`The "${r}" key is too long`)}function vn(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 yn(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 bn(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 W(t,`The ${n} tag handle is non-default and was not declared.`)}if(!r)throw new W(t,`The ${n} tag has no suffix.`);if(n===`!`&&(e.version||e.options.version)===`1.0`){if(r[0]===`^`)return e.warnings.push(new Pt(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 xn(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 W(t,n))}else if(r===`!`&&!a)i=!0;else try{return bn(e,t)}catch(t){e.errors.push(t)}}switch(r){case V.BLOCK_FOLDED:case V.BLOCK_LITERAL:case V.QUOTE_DOUBLE:case V.QUOTE_SINGLE:return jt.STR;case V.FLOW_MAP:case V.MAP:return jt.MAP;case V.FLOW_SEQ:case V.SEQ:return jt.SEQ;case V.PLAIN:return i?jt.STR:null;default:return null}}function Sn(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 Y?n:new J(n)}}let a=yn(e,t);return typeof a==`string`&&i.length>0?on(a,i,r.scalarFallback):null}function Cn({type:e}){switch(e){case V.FLOW_MAP:case V.MAP:return jt.MAP;case V.FLOW_SEQ:case V.SEQ:return jt.SEQ;default:return jt.STR}}function wn(e,t,n){try{let r=Sn(e,t,n);if(r)return n&&t.tag&&(r.tag=n),r}catch(n){if(n instanceof Mt)n.source||=t,e.errors.push(n);else{let r=n instanceof Error?n.message:String(n);e.errors.push(new W(t,r))}return null}try{let r=Cn(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 Pt(t,i));let a=Sn(e,t,r);return a.tag=n,a}catch(n){let r=new Nt(t,n.message);return r.stack=n.stack,e.errors.push(r),null}}function Tn(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 B.COMMENT:{t.commentHasRequiredWhitespace(o)||e.push(new W(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 B.ANCHOR:r&&e.push(new W(t,`A node can have at most one anchor`)),r=!0;break;case B.TAG:i&&e.push(new W(t,`A node can have at most one tag`)),i=!0}return{comments:n,hasAnchor:r,hasTag:i}}function En(e,t){let{anchors:n,errors:r,schema:i}=e;if(t.type===V.ALIAS){let e=t.rawValue,i=n.getNode(e);if(!i){let n=`Aliased anchor not found: ${e}`;return r.push(new Nt(t,n)),null}let a=new Rn(i);return n._cstAliases.push(a),a}let a=xn(e,t);if(a)return wn(e,t,a);if(t.type!==V.PLAIN){let e=`Failed to resolve ${t.type} node here`;return r.push(new G(t,e)),null}try{return on(yn(e,t),i.tags,i.tags.scalarFallback)}catch(e){return e.source||=t,r.push(e),null}}function Dn(e,t){if(!t)return null;t.error&&e.errors.push(t.error);let{comments:n,hasAnchor:r,hasTag:i}=Tn(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===V.ALIAS&&(r||i)&&e.errors.push(new W(t,`An alias node must not specify any properties`));let a=En(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 On(e,t){if(t.type!==V.MAP&&t.type!==V.FLOW_MAP){let n=`A ${t.type} node cannot be resolved as a mapping`;return e.errors.push(new G(t,n)),null}let{comments:n,items:r}=t.type===V.FLOW_MAP?jn(e,t):An(e,t),i=new Q;i.items=r,vn(i,n);let a=!1;for(let n=0;n<r.length;++n){let{key:i}=r[n];if(i instanceof Y&&(a=!0),e.schema.merge&&i&&i.value===zn){r[n]=new Bn(r[n]);let i=r[n].value.items,a=null;i.some(e=>{if(e instanceof Rn){let{type:t}=e.source;return t===V.MAP||t===V.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 W(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 W(t,n));break}}}return a&&!e.options.mapAsMap&&e.warnings.push(new Pt(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 kn(e,t){if(!Qn(e))return;let n=e.getPropValue(0,B.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 An(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 V.BLANK_LINE:n.push({afterKey:!!i,before:r.length});break;case V.COMMENT:n.push({afterKey:!!i,before:r.length,comment:s.comment});break;case V.MAP_KEY:i!==void 0&&r.push(new Z(i)),s.error&&e.errors.push(s.error),i=Dn(e,s.node),a=null;break;case V.MAP_VALUE:{i===void 0&&(i=null),s.error&&e.errors.push(s.error),!s.context.atLineStart&&s.node&&s.node.type===V.MAP&&!s.node.context.atLineStart&&e.errors.push(new W(s.node,`Nested mappings are not allowed in compact mappings`));let n=s.node;if(!n&&s.props.length>0){n=new Ft(V.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 Z(i,Dn(e,n));kn(s,o),r.push(o),i&&typeof a==`number`&&s.range.start>a+1024&&e.errors.push(_n(t,i)),i=void 0,a=null}break;default:i!==void 0&&r.push(new Z(i)),i=Dn(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 V.BLANK_LINE:case V.COMMENT:continue next;case V.MAP_VALUE:break next;default:e.errors.push(new W(s,`Implicit map keys need to be followed by map values`));break next}}s.valueRangeContainsNewline&&e.errors.push(new W(s,`Implicit map keys need to be on a single line`))}}return i!==void 0&&r.push(new Z(i)),{comments:n,items:r}}function jn(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 Z(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 G(t,u);d.offset=l,e.errors.push(d)}else c.type===V.BLANK_LINE?n.push({afterKey:!!i,before:r.length}):c.type===V.COMMENT?(gn(e.errors,c),n.push({afterKey:!!i,before:r.length,comment:c.comment})):i===void 0?(o===`,`&&e.errors.push(new W(c,`Separator , missing in flow map`)),i=Dn(e,c)):(o!==`,`&&e.errors.push(new W(c,`Indicator : missing in flow map entry`)),r.push(new Z(i,Dn(e,c))),i=void 0,a=!1)}return hn(e.errors,t),i!==void 0&&r.push(new Z(i)),{comments:n,items:r}}function Mn(e,t){if(t.type!==V.SEQ&&t.type!==V.FLOW_SEQ){let n=`A ${t.type} node cannot be resolved as a sequence`;return e.errors.push(new G(t,n)),null}let{comments:n,items:r}=t.type===V.FLOW_SEQ?Pn(e,t):Nn(e,t),i=new X;return i.items=r,vn(i,n),!e.options.mapAsMap&&r.some(e=>e instanceof Z&&e.key instanceof Y)&&e.warnings.push(new Pt(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 Nn(e,t){let n=[],r=[];for(let i=0;i<t.items.length;++i){let a=t.items[i];switch(a.type){case V.BLANK_LINE:n.push({before:r.length});break;case V.COMMENT:n.push({comment:a.comment,before:r.length});break;case V.SEQ_ITEM:a.error&&e.errors.push(a.error),r.push(Dn(e,a.node)),a.hasProps&&e.errors.push(new W(a,`Sequence items cannot have tags or anchors before the - indicator`));break;default:a.error&&e.errors.push(a.error),e.errors.push(new G(a,`Unexpected ${a.type} node in sequence`))}}return{comments:n,items:r}}function Pn(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 Z(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 Z){let n=new W(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(_n(t,a));let{src:r}=c.context;for(let t=o;t<n;++t)if(r[t]===`
141
- `){e.errors.push(new W(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 G(t,r);i.offset=d,e.errors.push(i)}}else if(u.type===V.BLANK_LINE)n.push({before:r.length});else if(u.type===V.COMMENT)gn(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 W(u,t))}let t=Dn(e,u);a===void 0?(r.push(t),c=u):(r.push(new Z(a,t)),a=void 0),o=u.range.start,s=`,`}}return hn(e.errors,t),a!==void 0&&r.push(new Z(a)),{comments:n,items:r}}var q,J,Fn,Y,X,In,Z,Ln,Rn,Q,zn,Bn,Vn,Hn,Un,Wn,$,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n=o((()=>{It(),q=class{},J=class extends q{constructor(e){super(),this.value=e}toJSON(e,t){return t&&t.keep?this.value:K(this.value,e,t)}toString(){return String(this.value)}},Fn=e=>e==null||typeof e==`object`&&e[Symbol.iterator]().next().done,Y=class e extends q{constructor(e){super(),z(this,`items`,[]),this.schema=e}addIn(t,n){if(Fn(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,nn(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 J?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 J&&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,nn(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===V.FLOW_MAP||this.type===V.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=tn(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}},z(Y,`maxFlowStringSingleLineLength`,60),X=class extends Y{add(e){this.items.push(e)}delete(e){let t=rn(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=rn(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&r instanceof J?r.value:r}has(e){let t=rn(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=rn(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(K(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)}},In=(e,t,n)=>t===null?``:typeof t==`object`?e instanceof q&&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),Z=class e extends q{constructor(t,n=null){super(),this.key=t,this.value=n,this.type=e.Type.PAIR}get commentBefore(){return this.key instanceof q?this.key.commentBefore:void 0}set commentBefore(e){if(this.key??=new J(null),this.key instanceof q)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=K(this.key,``,e);if(t instanceof Map){let r=K(this.value,n,e);t.set(n,r)}else if(t instanceof Set)t.add(n);else{let r=In(this.key,n,e),i=K(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 q&&o.comment;if(a){if(c)throw Error(`With simple keys, key nodes cannot have comments`);if(o instanceof Y)throw Error(`With simple keys, collection cannot be used as a key value`)}let l=!a&&(!o||c||(o instanceof q?o instanceof Y||o.type===V.BLOCK_FOLDED||o.type===V.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=tn(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=tn(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=tn(h,e.indent,this.comment),t&&t());let g=``,_=null;if(s instanceof q){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 J&&(e.indentAtStart=h.length+1),m=!1,!i&&r>=2&&!e.inFlow&&!l&&s instanceof X&&s.type!==V.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 Y?(v[0]!==`[`&&v[0]!==`{`||v.includes(`
149
- `))&&(y=`\n${e.indent}`):v[0]===`
150
- `&&(y=``),m&&!_&&n&&n(),tn(h+y+v,e.indent,_)}},z(Z,`Type`,{PAIR:`PAIR`,MERGE_PAIR:`MERGE_PAIR`}),Ln=(e,t)=>{if(e instanceof Rn){let n=t.get(e.source);return n.count*n.aliasCount}if(e instanceof Y){let n=0;for(let r of e.items){let e=Ln(r,t);e>n&&(n=e)}return n}if(e instanceof Z){let n=Ln(e.key,t),r=Ln(e.value,t);return Math.max(n,r)}return 1},Rn=class e extends q{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=V.ALIAS}set tag(e){throw Error(`Alias nodes cannot have tags`)}toJSON(e,t){if(!t)return K(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 Nt(this.cstNode,e):ReferenceError(e)}if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=Ln(this.source,n)),i.count*i.aliasCount>r)){let e=`Excessive alias count indicates a resource exhaustion attack`;throw this.cstNode?new Nt(this.cstNode,e):ReferenceError(e)}return i.res}toString(t){return e.stringify(this,t)}},z(Rn,`default`,!0),Q=class extends Y{add(e,t){e?e instanceof Z||(e=new Z(e.key||e,e.value)):e=new Z(e);let n=an(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=an(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=an(this.items,e),r=n&&n.value;return!t&&r instanceof J?r.value:r}has(e){return!!an(this.items,e)}set(e,t){this.add(new Z(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 Z))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)}},zn=`<<`,Bn=class extends Z{constructor(e){if(e instanceof Z){let t=e.value;t instanceof X||(t=new X,t.items.push(e.value),t.range=e.value.range),super(e.key,t),this.range=e.range}else super(new J(zn),new X);this.type=Z.Type.MERGE_PAIR}addToJSMap(e,t){for(let{source:n}of this.value.items){if(!(n instanceof Q))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}},Vn={defaultType:V.BLOCK_LITERAL,lineWidth:76},Hn={trueStr:`true`,falseStr:`false`},Un={asBigInt:!1},Wn={nullStr:`null`},$={defaultType:V.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},$.fold):$.fold,Xn=e=>/^(%|---|\.\.\.)/m.test(e),Zn=e=>{if(!e)return!1;let{type:t}=e;return t===V.MAP_KEY||t===V.MAP_VALUE||t===V.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]!==B.COMMENT)return!1;for(let t=e;t<i;++t)if(n[t]===`
154
- `)return!1;return!0}}));function er(e,t){let n=Mn(e,t);for(let e=0;e<n.items.length;++e){let r=n.items[e];if(!(r instanceof Z)){if(r instanceof Q){if(r.items.length>1)throw new W(t,`Each pair must have its own sequence indicator`);let e=r.items[0]||new Z;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 Z?r:new Z(r)}}return n}function tr(e,t,n){let r=new X(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 J){if(r.includes(e.value))throw new W(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=On(e,t);if(!n.hasAllNullValues())throw new W(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((()=>{It(),$n(),lr={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve:(e,t)=>{let n=yn(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 Nt(t,`This environment does not support reading binary tags; either Buffer or atob is required`)),null},options:Vn,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||=Vn.defaultType,t===V.QUOTE_DOUBLE)n=o;else{let{lineWidth:e}=Vn,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===V.BLOCK_LITERAL?`
155
- `:` `)}return pn({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 X{constructor(){super(),z(this,`add`,Q.prototype.add.bind(this)),z(this,`delete`,Q.prototype.delete.bind(this)),z(this,`get`,Q.prototype.get.bind(this)),z(this,`has`,Q.prototype.has.bind(this)),z(this,`set`,Q.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 Z?(r=K(e.key,``,t),i=K(e.value,r,t)):r=K(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}},z(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 Q{constructor(){super(),this.tag=e.tag}add(e){let t=e instanceof Z?e:new Z(e);an(this.items,t.key)||this.items.push(t)}get(e,t){let n=an(this.items,e);return!t&&n instanceof Z?n.key instanceof J?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=an(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Z(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`)}},z(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 mn(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 Q(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 X(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):mn(e)}function Tr(e,t,n){let r=t.replace(/_/g,``);if(Un.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 mn(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 q)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 J(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 Rn(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 J(e):e,t&&l.node instanceof q&&(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((()=>{It(),$n(),xr(),Ar={createNode:Sr,default:!0,nodeClass:Q,tag:`tag:yaml.org,2002:map`,resolve:On},jr={createNode:Cr,default:!0,nodeClass:X,tag:`tag:yaml.org,2002:seq`,resolve:Mn},Mr=[Ar,jr,{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:yn,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),pn(e,t,n,r)},options:$}],Nr=e=>typeof e==`bigint`||Number.isInteger(e),Pr=(e,t,n)=>Un.asBigInt?BigInt(e):parseInt(t,n),Fr={identify:e=>e==null,createNode:(e,t,n)=>n.wrapScalars?new J(null):null,default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>null,options:Wn,stringify:()=>Wn.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:Hn,stringify:({value:e})=>e?Hn.trueStr:Hn.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:Un,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:Un,stringify:mn},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:Un,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:mn},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 J(parseFloat(e));return r&&r[r.length-1]===`0`&&(i.minFractionDigits=r.length),i},stringify:mn},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:yn,stringify:Gr},{identify:e=>e==null,createNode:(e,t,n)=>n.wrapScalars?new J(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=>Un.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?Hn.trueStr:Hn.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 J(null):null,default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>null,options:Wn,stringify:()=>Wn.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:Hn,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:Hn,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:mn},{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:mn},{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 J(parseFloat(e.replace(/_/g,``)));if(t){let e=t.replace(/_/g,``);e[e.length-1]===`0`&&(n.minFractionDigits=e.length)}return n},stringify:mn}],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 Z(r,i)}},z(Qr,`defaultPrefix`,At),z(Qr,`defaultTags`,jt)})),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 Rn)return Rn;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 J){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 q)){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 Z)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 J?pn(e,t,n,r):e.toString(t,n,r);return s?e instanceof J||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 G(a,`Document contains trailing content not separated by a ... or --- line`));break}let t=Dn(e,a);i&&=(t.spaceBefore=!0,!1),r=t}else a.comment===null?a.type===V.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 Y&&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 W(t,`Insufficient parameters given for %TAG directive`);if(e.some(e=>e.handle===n))throw new W(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 W(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 Pt(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 W(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 Pt(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 Y)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 zt(e)){let e=new Si(t);e.parse(i,r),n.push(e),r=e}return n}function fi(e,t){let n=zt(e),r=new Si(t).parse(n[0]);return n.length>1&&r.errors.unshift(new W(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((()=>{$t(),It(),$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 Vn},set binary(e){Object.assign(Vn,e)},get bool(){return Hn},set bool(e){Object.assign(Hn,e)},get int(){return Un},set int(e){Object.assign(Un,e)},get null(){return Wn},set null(e){Object.assign(Wn,e)},get str(){return $},set str(e){Object.assign($,e)}},_i={"1.0":{schema:`yaml-1.1`,merge:!0,tagPrefixes:[{handle:`!`,prefix:At},{handle:`!!`,prefix:`tag:private.yaml.org,2002:`}]},1.1:{schema:`yaml-1.1`,merge:!0,tagPrefixes:[{handle:`!`,prefix:`!`},{handle:`!!`,prefix:At}]},1.2:{schema:`core`,merge:!1,tagPrefixes:[{handle:`!`,prefix:`!`},{handle:`!!`,prefix:At}]}},vi=class e{static validAnchorNode(e){return e instanceof J||e instanceof X||e instanceof Q}constructor(e){z(this,`map`,Object.create(null)),this.prefix=e}createAlias(e,t){return this.setAnchor(e,t),new Rn(e)}createMergePair(...e){let t=new Bn;return t.value.items=e.map(e=>{if(e instanceof Rn){if(e.source instanceof Q)return e}else if(e instanceof Q)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 Y?(n&&(t[n]=!0),e.items.forEach(e=>yi(e,t))):e instanceof Z?(yi(e.key,t),yi(e.value,t)):e instanceof J&&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 Fn(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 Y?this.contents.get(e,t):void 0}getIn(e,t){return Fn(e)?!t&&this.contents instanceof J?this.contents.value:this.contents:this.contents instanceof Y?this.contents.getIn(e,t):void 0}has(e){return this.contents instanceof Y&&this.contents.has(e)}hasIn(e){return Fn(e)?this.contents!==void 0:this.contents instanceof Y&&this.contents.hasIn(e)}set(e,t){li(this.contents),this.contents.set(e,t)}setIn(e,t){Fn(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 Mt&&e.makePretty();for(let e of this.warnings)e instanceof Mt&&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 J)),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=K(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 q&&(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(tn(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
- `}},z(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:zt,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=(bt(),d(lt)),r=(bt(),d(lt)),i=(bt(),d(lt)),a=(bt(),d(lt)),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=(bt(),d(lt));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=(bt(),d(lt)),r=(bt(),d(lt));bt();let i=St(),a=(bt(),d(lt)),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 ne(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 E(e,t){for(let n in t.refmap)s.jptr(e,n,{$ref:t.refmap[n]})}function D(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 O(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 re(e){return e&&!e[`x-s2o-delete`]}function ie(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 ae(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 k(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 A(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`){ae(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`),j(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`,j(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);j(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]=k(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 j(e,t){for(let n in e)n.startsWith(`x-`)&&!n.startsWith(`x-s2o`)&&(t[n]=e[n])}function M(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):ie(e.headers[t],i)}}function N(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`&&(ae(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=A(t,d,l,e,o,a,n),n.rbname&&d[n.rbname]===``&&delete d[n.rbname]);for(let t of d.parameters)d=A(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(re))}if(d&&d.security&&D(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];M(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];A(t,null,l,null,o,a,n)}!n.debug&&Array.isArray(l.parameters)&&(l.parameters=l.parameters.filter(re))}}}function P(e,t){let n={};b={schemas:{}},e.security&&D(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]),O(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}},ne),E(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];A(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(M(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):ie(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(N(e.paths,`paths`,t,n,e),e[`x-ms-paths`]&&N(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 F(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 I(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 L(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 oe(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 R(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),oe(e,t),e.openapi&&typeof e.openapi==`string`&&e.openapi.startsWith(`3.`)){t.openapi=f(e),I(t.openapi,t,r),L(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,F(n),i.servers||(i.servers=[]),i.servers.push(n)}else if(e.basePath){let t={};t.url=e.basePath,F(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`]}I(i,t,r),L(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(){P(t.openapi,t),t.direct?n(t.openapi):n(t)}).catch(function(e){console.warn(e),r(e)})}))}function se(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?R(i,t).then(e=>n(e)).catch(e=>r(e)):r(new x(a?a.message:`Could not parse string`))}))}function ce(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){se(e,t).then(e=>n(e)).catch(e=>r(e))}).catch(function(e){r(e)})}))}function le(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,se(a,t).then(e=>r(e)).catch(e=>i(e)))})}))}function ue(e,t,n){return i(n,new Promise(function(n,r){let i=``;e.on(`data`,function(e){i+=e}).on(`end`,function(){se(i,t).then(e=>n(e)).catch(e=>r(e))})}))}t.exports={S2OError:x,targetVersion:y,convert:R,convertObj:R,convertUrl:ce,convertStr:se,convertFile:le,convertStream:ue}})))(),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(/&nbsp;/g,` `).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&#39;/g,`'`).replace(/&amp;/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`,ne=[],E=[],D=[],O,re=!1,ie,ae={};for(let[e,t]of Object.entries(_.responses??{})){if(e==="default"){let e=Fa(l(t)?.content);if(e?.schema){re=!0,i&&(O=ca(e.schema,` `,`T.`)),ie=Da(e.schema,`${m}#/$defs/`);let t=e.media?.example?xa(e.media.example,``,void 0,-1):Ca(e.schema,c,0,[],``,-1);D.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(E.push(Number(e)),n?.schema&&(ae[e]=Da(n.schema,`${m}#/$defs/`)),i&&ne.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));D.push({path:`examples/${v}/${e}.response.json`,content:`${JSON.stringify(t,null,2)}\n`})}}if(re)for(let e of ja)E.includes(e)||(E.push(e),ie&&(ae[String(e)]=ie),O&&ne.push(`${e}: ${O}`));let k=T?.encoding===`multipart`?Ba(T.schema,c):[],A=T?.encoding===`binary`,j=`./${La}`,M=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`)}},N=e=>A?j:k.length?Va(e,k,j):e,P=[],F=e=>{let t=Ra(e);for(;P.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&&P.push({name:F(e),title:n.summary??e,summary:n.description,source:`spec`,...M(!1),body:N(xa(n.value))})}T?.media?.example!==void 0&&P.push({name:F(`example`),title:`Example`,source:`spec`,...M(!1),body:N(xa(T.media.example))});let I={...M(!1),body:T?.schema?N(Ca(T.schema,c,0,[],``,void 0,!1,!0)):void 0},L={...M(!0),body:T?.schema?N(Ca(T.schema,c,0,[],``,void 0,!0,!0)):void 0};P.push({name:F(`default`),title:`Default`,source:`generated`,...I}),JSON.stringify(L)!==JSON.stringify(I)&&P.push({name:F(`dynamic`),title:`Dynamic`,summary:`Generated values, fresh on every play.`,source:`generated`,...L});for(let e of P)D.push({path:`examples/${v}/${e.name}.example.json`,content:`${JSON.stringify(e,null,2)}\n`});(A||k.length)&&D.push({path:`examples/${v}/${La}`,content:`specbook sample file
168
- `}),d.push(...D);let oe=`${m}#/$defs/`,R=e=>{let t=b(e);if(t.length)return{type:`object`,properties:Object.fromEntries(t.map(e=>[e.name,Da(e.schema,oe)])),required:t.filter(e=>e.required).map(e=>e.name)}},se={$id:`specbook://${t.service}/${v}.request`,type:`object`,description:[_.summary,_.description].filter(Boolean).join(`
169
-
170
- `)||void 0,properties:{...R(`path`)?{path:R(`path`)}:{},...R(`query`)?{query:R(`query`)}:{},...R(`header`)?{headers:R(`header`)}:{},...T?.schema?{data:Da(T.schema,oe)}:{}},additionalProperties:!1};d.push({path:`schemas/${v}.responses.schema.json`,content:`${JSON.stringify(ae)}\n`}),d.push({path:`schemas/${v}.request.schema.json`,content:`${JSON.stringify(se)}\n`});let ce=_.security??e.security,le=s&&Array.isArray(ce)&&ce.length>0,ue=s?`, security: ${Array.isArray(ce)&&ce.length>0?`true`:`false`}`:``,de=T&&`mediaType`in T&&typeof T.mediaType==`string`&&!T.mediaType.includes(`*`)?T.mediaType:void 0,fe=(T?`, encoding: '${T.encoding}'`:``)+(de?`, mediaType: ${JSON.stringify(de)}`:``),pe=T?.encoding===`form`?Ia(T.media):{},me=Object.keys(pe).length?`, formArrays: ${JSON.stringify(pe)}`:``,he=k.length?`, files: ${JSON.stringify(k)}`:``,ge=ka(_);a[v]={service:t.service,id:v,method:p.toUpperCase(),path:n,...T?{encoding:T.encoding}:{},...de?{mediaType:de}:{},...k.length?{files:k}:{},...Object.keys(pe).length?{formArrays:pe}:{},...s?{security:Array.isArray(ce)&&ce.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} = defineOperation<{
176
- params: { ${ee} }
177
- body: ${te}
178
- responses: { ${ne.join(`; `)} }
179
- }>({ service: ${JSON.stringify(t.service)}, id: ${JSON.stringify(v)}, method: '${p.toUpperCase()}', path: ${JSON.stringify(n)}${fe}${he}${me}${ue} })
180
- `});let _e=_.tags?.length?_.tags:[`default`];for(let e of _e)g.set(e,[...g.get(e)??[],v]);d.push({path:`docs/${v}.json`,content:`${JSON.stringify({..._.description&&_.description!==ge?{description:_.description}:{},examples:P.map(e=>({name:e.name,title:e.title,source:e.source}))})}\n`}),f.push({id:v,method:p.toUpperCase(),path:n,summary:ge,..._.description&&_.description!==ge?{description:_.description}:{},tags:_e,statuses:E,examples:P.map(e=>({name:e.name,title:e.title,source:e.source})),...le?{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 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=tt(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),Ya=e=>e.replace(/[^A-Za-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).toUpperCase()||`API_KEY`;function Xa(e){let t=e.components?.securitySchemes??e.securityDefinitions??{},n={auth:{},secrets:{}};for(let[e,r]of Object.entries(t)){let t=Ya(e),i=`{{secrets.${t}}}`,a,o=e;if(r.type===`apiKey`){let t=r.name;r.in===`header`?a={headers:{[t]:i}}:r.in===`query`?a={query:{[t]:i}}:r.in===`cookie`&&(a={headers:{cookie:`${t}=${i}`}}),o=`${e} (API key, ${r.in} "${t}")`}else r.type===`http`&&/^bearer$/i.test(r.scheme)?(a={headers:{authorization:`Bearer ${i}`}},o=`${e} (bearer token)`):r.type===`http`&&/^basic$/i.test(r.scheme)||r.type===`basic`?(a={headers:{authorization:`Basic ${i}`}},o=`${e} (basic auth, paste base64 of user:password)`):(r.type===`oauth2`||r.type===`openIdConnect`)&&(a={headers:{authorization:`Bearer ${i}`}},o=`${e} (OAuth, paste an access token)`);a&&(n.auth[e]={title:o,apply:a},n.secrets[t]={})}return n.defaultProfile=(e.security?.flatMap(e=>Object.keys(e)))?.find(e=>n.auth[e])??Object.keys(n.auth)[0],n}function Za(e,t){let n=e.servers?.[0]?.url;if(n)return Ja(n)?n.replace(/\/$/,``):Ja(t)?new URL(n,t).toString().replace(/\/$/,``):void 0;if(e.host)return`${e.schemes?.[0]??`https`}://${e.host}${e.basePath??``}`.replace(/\/$/,``);if(Ja(t))return new URL(t).origin}const Qa=e=>e.trimEnd();function $a(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=Qa(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=Qa(t.content);else if(e[0]===`schemas`&&e[1]?.endsWith(`.responses.schema.json`))n(e[1].replace(/\.responses\.schema\.json$/,``)).responses=Qa(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=Qa(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$/,``)]=Qa(t.content):i.endsWith(`.response.json`)&&(n(r).mock[i.replace(/\.response\.json$/,``)]=Qa(t.content))}}return{ops:t,definitions:r,manifest:i}}const eo=e=>`{${Object.entries(e).map(([e,t])=>`${JSON.stringify(e)}:${t}`).join(`,`)}}`;function to(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":${eo(e.examples)}`),Object.keys(e.mock).length&&t.push(`"mock":${eo(e.mock)}`),`{${t.join(`,`)}}`}const no=26214400,ro=e=>self.postMessage(e);let io;const ao=/* @__PURE__ */ new Map;var oo=class extends Error{code;constructor(e,t){super(e),this.code=t}};const so=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`api`;async function co(e,t){let n;try{n=await fetch(e,{signal:t,redirect:`follow`,credentials:`omit`})}catch{throw t.aborted?new oo(`The server took too long to answer.`,`timeout`):new oo(`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 oo(`The server answered ${n.status} for that address.`,`http`);if(Number(n.headers.get(`content-length`)??0)>no)throw new oo(`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>no)throw await r.cancel(),new oo(`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 lo(e,t,n){let r=performance.now(),i,a,o;if(t.kind===`url`){ro({id:e,progress:`Fetching the document…`});let r=performance.now();i=await co(t.url,n),a=performance.now()-r,o=t.url}else i=t.text,o=t.name;ro({id:e,progress:`Reading the document…`});let s=performance.now(),c;try{c=await Ka(i)}catch(e){throw new oo(e instanceof Error?e.message:String(e),`parse`)}let l=performance.now()-s,{doc:u,warnings:d}=c;ro({id:e,progress:`Preparing operations…`});let f=u.info?.title??`API`,p=so(f),m=performance.now(),h=qa(u,{service:p}),g=performance.now()-m;io=$a(h.files);let _=JSON.parse(io.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)])),{auth:b,secrets:x,defaultProfile:S}=Xa(u),C=Za(u,(t.kind===`url`?t.url:void 0)??o??``),w=typeof u.servers?.[0]?.url==`string`&&!/^https?:\/\//i.test(u.servers[0].url);return{service:p,title:f,manifest:v,metas:h.metas,exampleNames:y,auth:b,secrets:x,defaultProfile:S,baseUrl:C,needsBaseUrl:!C&&w,warnings: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:io.definitions.length}}}self.addEventListener(`message`,async e=>{let t=e.data;try{if(t.type===`cancel`){ao.get(t.id)?.abort();return}if(t.type===`bundle`)return ro({id:t.id,ok:!0,result:to(io?.ops.get(t.opId))});if(t.type===`definitions`)return ro({id:t.id,ok:!0,result:io?.definitions??`{}`});let e=new AbortController;ao.set(t.id,e);let n=setTimeout(()=>e.abort(),3e4);try{let n=await lo(t.id,t.source,e.signal);ro({id:t.id,ok:!0,result:n})}finally{clearTimeout(n),ao.delete(t.id)}}catch(e){e instanceof oo?ro({id:t.id,ok:!1,error:e.message,code:e.code}):ro({id:t.id,ok:!1,error:e instanceof Error?e.message:String(e)})}});