"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));

// node_modules/concat-map/index.js
var require_concat_map = __commonJS({
  "node_modules/concat-map/index.js"(exports2, module2) {
    module2.exports = function(xs, fn) {
      var res = [];
      for (var i = 0; i < xs.length; i++) {
        var x = fn(xs[i], i);
        if (isArray(x)) res.push.apply(res, x);
        else res.push(x);
      }
      return res;
    };
    var isArray = Array.isArray || function(xs) {
      return Object.prototype.toString.call(xs) === "[object Array]";
    };
  }
});

// node_modules/balanced-match/index.js
var require_balanced_match = __commonJS({
  "node_modules/balanced-match/index.js"(exports2, module2) {
    "use strict";
    module2.exports = balanced;
    function balanced(a, b, str2) {
      if (a instanceof RegExp) a = maybeMatch(a, str2);
      if (b instanceof RegExp) b = maybeMatch(b, str2);
      var r = range(a, b, str2);
      return r && {
        start: r[0],
        end: r[1],
        pre: str2.slice(0, r[0]),
        body: str2.slice(r[0] + a.length, r[1]),
        post: str2.slice(r[1] + b.length)
      };
    }
    function maybeMatch(reg, str2) {
      var m = str2.match(reg);
      return m ? m[0] : null;
    }
    balanced.range = range;
    function range(a, b, str2) {
      var begs, beg, left, right, result;
      var ai = str2.indexOf(a);
      var bi = str2.indexOf(b, ai + 1);
      var i = ai;
      if (ai >= 0 && bi > 0) {
        if (a === b) {
          return [ai, bi];
        }
        begs = [];
        left = str2.length;
        while (i >= 0 && !result) {
          if (i == ai) {
            begs.push(i);
            ai = str2.indexOf(a, i + 1);
          } else if (begs.length == 1) {
            result = [begs.pop(), bi];
          } else {
            beg = begs.pop();
            if (beg < left) {
              left = beg;
              right = bi;
            }
            bi = str2.indexOf(b, i + 1);
          }
          i = ai < bi && ai >= 0 ? ai : bi;
        }
        if (begs.length) {
          result = [left, right];
        }
      }
      return result;
    }
  }
});

// node_modules/brace-expansion/index.js
var require_brace_expansion = __commonJS({
  "node_modules/brace-expansion/index.js"(exports2, module2) {
    var concatMap = require_concat_map();
    var balanced = require_balanced_match();
    module2.exports = expandTop;
    var escSlash = "\0SLASH" + Math.random() + "\0";
    var escOpen = "\0OPEN" + Math.random() + "\0";
    var escClose = "\0CLOSE" + Math.random() + "\0";
    var escComma = "\0COMMA" + Math.random() + "\0";
    var escPeriod = "\0PERIOD" + Math.random() + "\0";
    function numeric(str2) {
      return parseInt(str2, 10) == str2 ? parseInt(str2, 10) : str2.charCodeAt(0);
    }
    function escapeBraces(str2) {
      return str2.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
    }
    function unescapeBraces(str2) {
      return str2.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
    }
    function parseCommaParts(str2) {
      if (!str2)
        return [""];
      var parts = [];
      var m = balanced("{", "}", str2);
      if (!m)
        return str2.split(",");
      var pre = m.pre;
      var body = m.body;
      var post = m.post;
      var p = pre.split(",");
      p[p.length - 1] += "{" + body + "}";
      var postParts = parseCommaParts(post);
      if (post.length) {
        p[p.length - 1] += postParts.shift();
        p.push.apply(p, postParts);
      }
      parts.push.apply(parts, p);
      return parts;
    }
    function expandTop(str2, options) {
      if (!str2)
        return [];
      options = options || {};
      var max = options.max == null ? Infinity : options.max;
      if (str2.substr(0, 2) === "{}") {
        str2 = "\\{\\}" + str2.substr(2);
      }
      return expand(escapeBraces(str2), max, true).map(unescapeBraces);
    }
    function embrace(str2) {
      return "{" + str2 + "}";
    }
    function isPadded(el) {
      return /^-?0\d/.test(el);
    }
    function lte(i, y) {
      return i <= y;
    }
    function gte(i, y) {
      return i >= y;
    }
    function expand(str2, max, isTop) {
      var expansions = [];
      var m = balanced("{", "}", str2);
      if (!m || /\$$/.test(m.pre)) return [str2];
      var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
      var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
      var isSequence = isNumericSequence || isAlphaSequence;
      var isOptions = m.body.indexOf(",") >= 0;
      if (!isSequence && !isOptions) {
        if (m.post.match(/,(?!,).*\}/)) {
          str2 = m.pre + "{" + m.body + escClose + m.post;
          return expand(str2, max, true);
        }
        return [str2];
      }
      var n;
      if (isSequence) {
        n = m.body.split(/\.\./);
      } else {
        n = parseCommaParts(m.body);
        if (n.length === 1) {
          n = expand(n[0], max, false).map(embrace);
          if (n.length === 1) {
            var post = m.post.length ? expand(m.post, max, false) : [""];
            return post.map(function(p) {
              return m.pre + n[0] + p;
            });
          }
        }
      }
      var pre = m.pre;
      var post = m.post.length ? expand(m.post, max, false) : [""];
      var N;
      if (isSequence) {
        var x = numeric(n[0]);
        var y = numeric(n[1]);
        var width = Math.max(n[0].length, n[1].length);
        var incr = n.length == 3 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
        var test = lte;
        var reverse = y < x;
        if (reverse) {
          incr *= -1;
          test = gte;
        }
        var pad = n.some(isPadded);
        N = [];
        for (var i = x; test(i, y); i += incr) {
          var c;
          if (isAlphaSequence) {
            c = String.fromCharCode(i);
            if (c === "\\")
              c = "";
          } else {
            c = String(i);
            if (pad) {
              var need = width - c.length;
              if (need > 0) {
                var z = new Array(need + 1).join("0");
                if (i < 0)
                  c = "-" + z + c.slice(1);
                else
                  c = z + c;
              }
            }
          }
          N.push(c);
        }
      } else {
        N = concatMap(n, function(el) {
          return expand(el, max, false);
        });
      }
      for (var j = 0; j < N.length; j++) {
        for (var k = 0; k < post.length && expansions.length < max; k++) {
          var expansion = pre + N[j] + post[k];
          if (!isTop || isSequence || expansion)
            expansions.push(expansion);
        }
      }
      return expansions;
    }
  }
});

// node_modules/minimatch/minimatch.js
var require_minimatch = __commonJS({
  "node_modules/minimatch/minimatch.js"(exports2, module2) {
    module2.exports = minimatch;
    minimatch.Minimatch = Minimatch;
    var path2 = (function() {
      try {
        return require("path");
      } catch (e) {
      }
    })() || {
      sep: "/"
    };
    minimatch.sep = path2.sep;
    var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
    var expand = require_brace_expansion();
    var plTypes = {
      "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
      "?": { open: "(?:", close: ")?" },
      "+": { open: "(?:", close: ")+" },
      "*": { open: "(?:", close: ")*" },
      "@": { open: "(?:", close: ")" }
    };
    var qmark = "[^/]";
    var star = qmark + "*?";
    var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
    var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
    var reSpecials = charSet("().*{}+?[]^$\\!");
    function charSet(s) {
      return s.split("").reduce(function(set2, c) {
        set2[c] = true;
        return set2;
      }, {});
    }
    var slashSplit = /\/+/;
    minimatch.filter = filter;
    function filter(pattern, options) {
      options = options || {};
      return function(p, i, list) {
        return minimatch(p, pattern, options);
      };
    }
    function ext(a, b) {
      b = b || {};
      var t = {};
      Object.keys(a).forEach(function(k) {
        t[k] = a[k];
      });
      Object.keys(b).forEach(function(k) {
        t[k] = b[k];
      });
      return t;
    }
    minimatch.defaults = function(def) {
      if (!def || typeof def !== "object" || !Object.keys(def).length) {
        return minimatch;
      }
      var orig = minimatch;
      var m = function minimatch2(p, pattern, options) {
        return orig(p, pattern, ext(def, options));
      };
      m.Minimatch = function Minimatch2(pattern, options) {
        return new orig.Minimatch(pattern, ext(def, options));
      };
      m.Minimatch.defaults = function defaults(options) {
        return orig.defaults(ext(def, options)).Minimatch;
      };
      m.filter = function filter2(pattern, options) {
        return orig.filter(pattern, ext(def, options));
      };
      m.defaults = function defaults(options) {
        return orig.defaults(ext(def, options));
      };
      m.makeRe = function makeRe2(pattern, options) {
        return orig.makeRe(pattern, ext(def, options));
      };
      m.braceExpand = function braceExpand2(pattern, options) {
        return orig.braceExpand(pattern, ext(def, options));
      };
      m.match = function(list, pattern, options) {
        return orig.match(list, pattern, ext(def, options));
      };
      return m;
    };
    Minimatch.defaults = function(def) {
      return minimatch.defaults(def).Minimatch;
    };
    function minimatch(p, pattern, options) {
      assertValidPattern(pattern);
      if (!options) options = {};
      if (!options.nocomment && pattern.charAt(0) === "#") {
        return false;
      }
      return new Minimatch(pattern, options).match(p);
    }
    function Minimatch(pattern, options) {
      if (!(this instanceof Minimatch)) {
        return new Minimatch(pattern, options);
      }
      assertValidPattern(pattern);
      if (!options) options = {};
      pattern = pattern.trim();
      if (!options.allowWindowsEscape && path2.sep !== "/") {
        pattern = pattern.split(path2.sep).join("/");
      }
      this.options = options;
      this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
      this.set = [];
      this.pattern = pattern;
      this.regexp = null;
      this.negate = false;
      this.comment = false;
      this.empty = false;
      this.partial = !!options.partial;
      this.make();
    }
    Minimatch.prototype.debug = function() {
    };
    Minimatch.prototype.make = make;
    function make() {
      var pattern = this.pattern;
      var options = this.options;
      if (!options.nocomment && pattern.charAt(0) === "#") {
        this.comment = true;
        return;
      }
      if (!pattern) {
        this.empty = true;
        return;
      }
      this.parseNegate();
      var set2 = this.globSet = this.braceExpand();
      if (options.debug) this.debug = function debug2() {
        console.error.apply(console, arguments);
      };
      this.debug(this.pattern, set2);
      set2 = this.globParts = set2.map(function(s) {
        return s.split(slashSplit);
      });
      this.debug(this.pattern, set2);
      set2 = set2.map(function(s, si, set3) {
        return s.map(this.parse, this);
      }, this);
      this.debug(this.pattern, set2);
      set2 = set2.filter(function(s) {
        return s.indexOf(false) === -1;
      });
      this.debug(this.pattern, set2);
      this.set = set2;
    }
    Minimatch.prototype.parseNegate = parseNegate;
    function parseNegate() {
      var pattern = this.pattern;
      var negate = false;
      var options = this.options;
      var negateOffset = 0;
      if (options.nonegate) return;
      for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
        negate = !negate;
        negateOffset++;
      }
      if (negateOffset) this.pattern = pattern.substr(negateOffset);
      this.negate = negate;
    }
    minimatch.braceExpand = function(pattern, options) {
      return braceExpand(pattern, options);
    };
    Minimatch.prototype.braceExpand = braceExpand;
    function braceExpand(pattern, options) {
      if (!options) {
        if (this instanceof Minimatch) {
          options = this.options;
        } else {
          options = {};
        }
      }
      pattern = typeof pattern === "undefined" ? this.pattern : pattern;
      assertValidPattern(pattern);
      if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
        return [pattern];
      }
      return expand(pattern);
    }
    var MAX_PATTERN_LENGTH = 1024 * 64;
    var assertValidPattern = function(pattern) {
      if (typeof pattern !== "string") {
        throw new TypeError("invalid pattern");
      }
      if (pattern.length > MAX_PATTERN_LENGTH) {
        throw new TypeError("pattern is too long");
      }
    };
    Minimatch.prototype.parse = parse;
    var SUBPARSE = {};
    function parse(pattern, isSub) {
      assertValidPattern(pattern);
      var options = this.options;
      if (pattern === "**") {
        if (!options.noglobstar)
          return GLOBSTAR;
        else
          pattern = "*";
      }
      if (pattern === "") return "";
      var re = "";
      var hasMagic = !!options.nocase;
      var escaping = false;
      var patternListStack = [];
      var negativeLists = [];
      var stateChar;
      var inClass = false;
      var reClassStart = -1;
      var classStart = -1;
      var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
      var self2 = this;
      function clearStateChar() {
        if (stateChar) {
          switch (stateChar) {
            case "*":
              re += star;
              hasMagic = true;
              break;
            case "?":
              re += qmark;
              hasMagic = true;
              break;
            default:
              re += "\\" + stateChar;
              break;
          }
          self2.debug("clearStateChar %j %j", stateChar, re);
          stateChar = false;
        }
      }
      for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
        this.debug("%s	%s %s %j", pattern, i, re, c);
        if (escaping && reSpecials[c]) {
          re += "\\" + c;
          escaping = false;
          continue;
        }
        switch (c) {
          /* istanbul ignore next */
          case "/": {
            return false;
          }
          case "\\":
            clearStateChar();
            escaping = true;
            continue;
          // the various stateChar values
          // for the "extglob" stuff.
          case "?":
          case "*":
          case "+":
          case "@":
          case "!":
            this.debug("%s	%s %s %j <-- stateChar", pattern, i, re, c);
            if (inClass) {
              this.debug("  in class");
              if (c === "!" && i === classStart + 1) c = "^";
              re += c;
              continue;
            }
            if (c === "*" && stateChar === "*") continue;
            self2.debug("call clearStateChar %j", stateChar);
            clearStateChar();
            stateChar = c;
            if (options.noext) clearStateChar();
            continue;
          case "(":
            if (inClass) {
              re += "(";
              continue;
            }
            if (!stateChar) {
              re += "\\(";
              continue;
            }
            patternListStack.push({
              type: stateChar,
              start: i - 1,
              reStart: re.length,
              open: plTypes[stateChar].open,
              close: plTypes[stateChar].close
            });
            re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
            this.debug("plType %j %j", stateChar, re);
            stateChar = false;
            continue;
          case ")":
            if (inClass || !patternListStack.length) {
              re += "\\)";
              continue;
            }
            clearStateChar();
            hasMagic = true;
            var pl = patternListStack.pop();
            re += pl.close;
            if (pl.type === "!") {
              negativeLists.push(pl);
            }
            pl.reEnd = re.length;
            continue;
          case "|":
            if (inClass || !patternListStack.length || escaping) {
              re += "\\|";
              escaping = false;
              continue;
            }
            clearStateChar();
            re += "|";
            continue;
          // these are mostly the same in regexp and glob
          case "[":
            clearStateChar();
            if (inClass) {
              re += "\\" + c;
              continue;
            }
            inClass = true;
            classStart = i;
            reClassStart = re.length;
            re += c;
            continue;
          case "]":
            if (i === classStart + 1 || !inClass) {
              re += "\\" + c;
              escaping = false;
              continue;
            }
            var cs = pattern.substring(classStart + 1, i);
            try {
              RegExp("[" + cs + "]");
            } catch (er) {
              var sp = this.parse(cs, SUBPARSE);
              re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
              hasMagic = hasMagic || sp[1];
              inClass = false;
              continue;
            }
            hasMagic = true;
            inClass = false;
            re += c;
            continue;
          default:
            clearStateChar();
            if (escaping) {
              escaping = false;
            } else if (reSpecials[c] && !(c === "^" && inClass)) {
              re += "\\";
            }
            re += c;
        }
      }
      if (inClass) {
        cs = pattern.substr(classStart + 1);
        sp = this.parse(cs, SUBPARSE);
        re = re.substr(0, reClassStart) + "\\[" + sp[0];
        hasMagic = hasMagic || sp[1];
      }
      for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
        var tail = re.slice(pl.reStart + pl.open.length);
        this.debug("setting tail", re, pl);
        tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
          if (!$2) {
            $2 = "\\";
          }
          return $1 + $1 + $2 + "|";
        });
        this.debug("tail=%j\n   %s", tail, tail, pl, re);
        var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
        hasMagic = true;
        re = re.slice(0, pl.reStart) + t + "\\(" + tail;
      }
      clearStateChar();
      if (escaping) {
        re += "\\\\";
      }
      var addPatternStart = false;
      switch (re.charAt(0)) {
        case "[":
        case ".":
        case "(":
          addPatternStart = true;
      }
      for (var n = negativeLists.length - 1; n > -1; n--) {
        var nl = negativeLists[n];
        var nlBefore = re.slice(0, nl.reStart);
        var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
        var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
        var nlAfter = re.slice(nl.reEnd);
        nlLast += nlAfter;
        var openParensBefore = nlBefore.split("(").length - 1;
        var cleanAfter = nlAfter;
        for (i = 0; i < openParensBefore; i++) {
          cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
        }
        nlAfter = cleanAfter;
        var dollar = "";
        if (nlAfter === "" && isSub !== SUBPARSE) {
          dollar = "$";
        }
        var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
        re = newRe;
      }
      if (re !== "" && hasMagic) {
        re = "(?=.)" + re;
      }
      if (addPatternStart) {
        re = patternStart + re;
      }
      if (isSub === SUBPARSE) {
        return [re, hasMagic];
      }
      if (!hasMagic) {
        return globUnescape(pattern);
      }
      var flags = options.nocase ? "i" : "";
      try {
        var regExp = new RegExp("^" + re + "$", flags);
      } catch (er) {
        return new RegExp("$.");
      }
      regExp._glob = pattern;
      regExp._src = re;
      return regExp;
    }
    minimatch.makeRe = function(pattern, options) {
      return new Minimatch(pattern, options || {}).makeRe();
    };
    Minimatch.prototype.makeRe = makeRe;
    function makeRe() {
      if (this.regexp || this.regexp === false) return this.regexp;
      var set2 = this.set;
      if (!set2.length) {
        this.regexp = false;
        return this.regexp;
      }
      var options = this.options;
      var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
      var flags = options.nocase ? "i" : "";
      var re = set2.map(function(pattern) {
        return pattern.map(function(p) {
          return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
        }).join("\\/");
      }).join("|");
      re = "^(?:" + re + ")$";
      if (this.negate) re = "^(?!" + re + ").*$";
      try {
        this.regexp = new RegExp(re, flags);
      } catch (ex) {
        this.regexp = false;
      }
      return this.regexp;
    }
    minimatch.match = function(list, pattern, options) {
      options = options || {};
      var mm = new Minimatch(pattern, options);
      list = list.filter(function(f) {
        return mm.match(f);
      });
      if (mm.options.nonull && !list.length) {
        list.push(pattern);
      }
      return list;
    };
    Minimatch.prototype.match = function match(f, partial) {
      if (typeof partial === "undefined") partial = this.partial;
      this.debug("match", f, this.pattern);
      if (this.comment) return false;
      if (this.empty) return f === "";
      if (f === "/" && partial) return true;
      var options = this.options;
      if (path2.sep !== "/") {
        f = f.split(path2.sep).join("/");
      }
      f = f.split(slashSplit);
      this.debug(this.pattern, "split", f);
      var set2 = this.set;
      this.debug(this.pattern, "set", set2);
      var filename;
      var i;
      for (i = f.length - 1; i >= 0; i--) {
        filename = f[i];
        if (filename) break;
      }
      for (i = 0; i < set2.length; i++) {
        var pattern = set2[i];
        var file = f;
        if (options.matchBase && pattern.length === 1) {
          file = [filename];
        }
        var hit = this.matchOne(file, pattern, partial);
        if (hit) {
          if (options.flipNegate) return true;
          return !this.negate;
        }
      }
      if (options.flipNegate) return false;
      return this.negate;
    };
    Minimatch.prototype.matchOne = function(file, pattern, partial) {
      if (pattern.indexOf(GLOBSTAR) !== -1) {
        return this._matchGlobstar(file, pattern, partial, 0, 0);
      }
      return this._matchOne(file, pattern, partial, 0, 0);
    };
    Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
      var i;
      var firstgs = -1;
      for (i = patternIndex; i < pattern.length; i++) {
        if (pattern[i] === GLOBSTAR) {
          firstgs = i;
          break;
        }
      }
      var lastgs = -1;
      for (i = pattern.length - 1; i >= 0; i--) {
        if (pattern[i] === GLOBSTAR) {
          lastgs = i;
          break;
        }
      }
      var head = pattern.slice(patternIndex, firstgs);
      var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
      var tail = partial ? [] : pattern.slice(lastgs + 1);
      if (head.length) {
        var fileHead = file.slice(fileIndex, fileIndex + head.length);
        if (!this._matchOne(fileHead, head, partial, 0, 0)) {
          return false;
        }
        fileIndex += head.length;
      }
      var fileTailMatch = 0;
      if (tail.length) {
        if (tail.length + fileIndex > file.length) return false;
        var tailStart = file.length - tail.length;
        if (this._matchOne(file, tail, partial, tailStart, 0)) {
          fileTailMatch = tail.length;
        } else {
          if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
            return false;
          }
          tailStart--;
          if (!this._matchOne(file, tail, partial, tailStart, 0)) {
            return false;
          }
          fileTailMatch = tail.length + 1;
        }
      }
      if (!body.length) {
        var sawSome = !!fileTailMatch;
        for (i = fileIndex; i < file.length - fileTailMatch; i++) {
          var f = String(file[i]);
          sawSome = true;
          if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
            return false;
          }
        }
        return partial || sawSome;
      }
      var bodySegments = [[[], 0]];
      var currentBody = bodySegments[0];
      var nonGsParts = 0;
      var nonGsPartsSums = [0];
      for (var bi = 0; bi < body.length; bi++) {
        var b = body[bi];
        if (b === GLOBSTAR) {
          nonGsPartsSums.push(nonGsParts);
          currentBody = [[], 0];
          bodySegments.push(currentBody);
        } else {
          currentBody[0].push(b);
          nonGsParts++;
        }
      }
      var idx = bodySegments.length - 1;
      var fileLength = file.length - fileTailMatch;
      for (var si = 0; si < bodySegments.length; si++) {
        bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
      }
      return !!this._matchGlobStarBodySections(
        file,
        bodySegments,
        fileIndex,
        0,
        partial,
        0,
        !!fileTailMatch
      );
    };
    Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
      var bs = bodySegments[bodyIndex];
      if (!bs) {
        for (var i = fileIndex; i < file.length; i++) {
          sawTail = true;
          var f = file[i];
          if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
            return false;
          }
        }
        return sawTail;
      }
      var body = bs[0];
      var after = bs[1];
      while (fileIndex <= after) {
        var m = this._matchOne(
          file.slice(0, fileIndex + body.length),
          body,
          partial,
          fileIndex,
          0
        );
        if (m && globStarDepth < this.maxGlobstarRecursion) {
          var sub = this._matchGlobStarBodySections(
            file,
            bodySegments,
            fileIndex + body.length,
            bodyIndex + 1,
            partial,
            globStarDepth + 1,
            sawTail
          );
          if (sub !== false) {
            return sub;
          }
        }
        var f = file[fileIndex];
        if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
          return false;
        }
        fileIndex++;
      }
      return partial || null;
    };
    Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
      var fi, pi, fl, pl;
      for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
        this.debug("matchOne loop");
        var p = pattern[pi];
        var f = file[fi];
        this.debug(pattern, p, f);
        if (p === false || p === GLOBSTAR) return false;
        var hit;
        if (typeof p === "string") {
          hit = f === p;
          this.debug("string match", p, f, hit);
        } else {
          hit = f.match(p);
          this.debug("pattern match", p, f, hit);
        }
        if (!hit) return false;
      }
      if (fi === fl && pi === pl) {
        return true;
      } else if (fi === fl) {
        return partial;
      } else if (pi === pl) {
        return fi === fl - 1 && file[fi] === "";
      }
      throw new Error("wtf?");
    };
    function globUnescape(s) {
      return s.replace(/\\(.)/g, "$1");
    }
    function regExpEscape(s) {
      return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
    }
  }
});

// node_modules/azure-pipelines-task-lib/taskcommand.js
var require_taskcommand = __commonJS({
  "node_modules/azure-pipelines-task-lib/taskcommand.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.commandFromString = exports2.TaskCommand = void 0;
    var CMD_PREFIX = "##vso[";
    var TaskCommand = (
      /** @class */
      (function() {
        function TaskCommand2(command, properties, message) {
          if (!command) {
            command = "missing.command";
          }
          this.command = command;
          this.properties = properties;
          this.message = message;
        }
        TaskCommand2.prototype.toString = function() {
          var cmdStr = CMD_PREFIX + this.command;
          if (this.properties && Object.keys(this.properties).length > 0) {
            cmdStr += " ";
            for (var key in this.properties) {
              if (this.properties.hasOwnProperty(key)) {
                var val = this.properties[key];
                if (val) {
                  cmdStr += key + "=" + escape("" + (val || "")) + ";";
                }
              }
            }
          }
          cmdStr += "]";
          var message = "" + (this.message || "");
          cmdStr += escapedata(message);
          return cmdStr;
        };
        return TaskCommand2;
      })()
    );
    exports2.TaskCommand = TaskCommand;
    function commandFromString(commandLine) {
      var preLen = CMD_PREFIX.length;
      var lbPos = commandLine.indexOf("[");
      var rbPos = commandLine.indexOf("]");
      if (lbPos == -1 || rbPos == -1 || rbPos - lbPos < 3) {
        throw new Error("Invalid command brackets");
      }
      var cmdInfo = commandLine.substring(lbPos + 1, rbPos);
      var spaceIdx = cmdInfo.indexOf(" ");
      var command = cmdInfo;
      var properties = {};
      if (spaceIdx > 0) {
        command = cmdInfo.trim().substring(0, spaceIdx);
        var propSection = cmdInfo.trim().substring(spaceIdx + 1);
        var propLines = propSection.split(";");
        propLines.forEach(function(propLine) {
          propLine = propLine.trim();
          if (propLine.length > 0) {
            var eqIndex = propLine.indexOf("=");
            if (eqIndex == -1) {
              throw new Error("Invalid property: " + propLine);
            }
            var key = propLine.substring(0, eqIndex);
            var val = propLine.substring(eqIndex + 1);
            properties[key] = unescape(val);
          }
        });
      }
      var msg = unescapedata(commandLine.substring(rbPos + 1));
      var cmd = new TaskCommand(command, properties, msg);
      return cmd;
    }
    exports2.commandFromString = commandFromString;
    function escapedata(s) {
      return s.replace(/%/g, "%AZP25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
    }
    function unescapedata(s) {
      return s.replace(/%0D/g, "\r").replace(/%0A/g, "\n").replace(/%AZP25/g, "%");
    }
    function escape(s) {
      return s.replace(/%/g, "%AZP25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/]/g, "%5D").replace(/;/g, "%3B");
    }
    function unescape(s) {
      return s.replace(/%0D/g, "\r").replace(/%0A/g, "\n").replace(/%5D/g, "]").replace(/%3B/g, ";").replace(/%AZP25/g, "%");
    }
  }
});

// node_modules/uuid/lib/rng.js
var require_rng = __commonJS({
  "node_modules/uuid/lib/rng.js"(exports2, module2) {
    var crypto = require("crypto");
    module2.exports = function nodeRNG() {
      return crypto.randomBytes(16);
    };
  }
});

// node_modules/uuid/lib/bytesToUuid.js
var require_bytesToUuid = __commonJS({
  "node_modules/uuid/lib/bytesToUuid.js"(exports2, module2) {
    var byteToHex = [];
    for (i = 0; i < 256; ++i) {
      byteToHex[i] = (i + 256).toString(16).substr(1);
    }
    var i;
    function bytesToUuid(buf, offset) {
      var i2 = offset || 0;
      var bth = byteToHex;
      return [
        bth[buf[i2++]],
        bth[buf[i2++]],
        bth[buf[i2++]],
        bth[buf[i2++]],
        "-",
        bth[buf[i2++]],
        bth[buf[i2++]],
        "-",
        bth[buf[i2++]],
        bth[buf[i2++]],
        "-",
        bth[buf[i2++]],
        bth[buf[i2++]],
        "-",
        bth[buf[i2++]],
        bth[buf[i2++]],
        bth[buf[i2++]],
        bth[buf[i2++]],
        bth[buf[i2++]],
        bth[buf[i2++]]
      ].join("");
    }
    module2.exports = bytesToUuid;
  }
});

// node_modules/uuid/v4.js
var require_v4 = __commonJS({
  "node_modules/uuid/v4.js"(exports2, module2) {
    var rng = require_rng();
    var bytesToUuid = require_bytesToUuid();
    function v4(options, buf, offset) {
      var i = buf && offset || 0;
      if (typeof options == "string") {
        buf = options === "binary" ? new Array(16) : null;
        options = null;
      }
      options = options || {};
      var rnds = options.random || (options.rng || rng)();
      rnds[6] = rnds[6] & 15 | 64;
      rnds[8] = rnds[8] & 63 | 128;
      if (buf) {
        for (var ii = 0; ii < 16; ++ii) {
          buf[i + ii] = rnds[ii];
        }
      }
      return buf || bytesToUuid(rnds);
    }
    module2.exports = v4;
  }
});

// node_modules/azure-pipelines-task-lib/vault.js
var require_vault = __commonJS({
  "node_modules/azure-pipelines-task-lib/vault.js"(exports2) {
    "use strict";
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.Vault = void 0;
    var fs2 = require("fs");
    var path2 = require("path");
    var crypto = require("crypto");
    var uuidV4 = require_v4();
    var algorithm = "aes-256-ctr";
    var encryptEncoding = "hex";
    var unencryptedEncoding = "utf8";
    var Vault = (
      /** @class */
      (function() {
        function Vault2(keyPath) {
          this._keyFile = path2.join(keyPath, ".taskkey");
          this._store = {};
          this.genKey();
        }
        Vault2.prototype.initialize = function() {
        };
        Vault2.prototype.storeSecret = function(name, data) {
          if (!name || name.length == 0) {
            return false;
          }
          name = name.toLowerCase();
          if (!data || data.length == 0) {
            if (this._store.hasOwnProperty(name)) {
              delete this._store[name];
            }
            return false;
          }
          var key = this.getKey();
          var iv = crypto.randomBytes(16);
          var cipher = crypto.createCipheriv(algorithm, key, iv);
          var crypted = cipher.update(data, unencryptedEncoding, encryptEncoding);
          var cryptedFinal = cipher.final(encryptEncoding);
          this._store[name] = iv.toString(encryptEncoding) + crypted + cryptedFinal;
          return true;
        };
        Vault2.prototype.retrieveSecret = function(name) {
          var secret;
          name = (name || "").toLowerCase();
          if (this._store.hasOwnProperty(name)) {
            var key = this.getKey();
            var data = this._store[name];
            var ivDataBuffer = Buffer.from(data, encryptEncoding);
            var iv = ivDataBuffer.slice(0, 16);
            var encryptedText = ivDataBuffer.slice(16);
            var decipher = crypto.createDecipheriv(algorithm, key, iv);
            var dec = decipher.update(encryptedText);
            var decFinal = decipher.final(unencryptedEncoding);
            secret = dec + decFinal;
          }
          return secret;
        };
        Vault2.prototype.getKey = function() {
          var key = fs2.readFileSync(this._keyFile).toString("utf8");
          return crypto.createHash("sha256").update(key).digest();
        };
        Vault2.prototype.genKey = function() {
          fs2.writeFileSync(this._keyFile, uuidV4(), { encoding: "utf8" });
        };
        return Vault2;
      })()
    );
    exports2.Vault = Vault;
  }
});

// node_modules/semver/semver.js
var require_semver = __commonJS({
  "node_modules/semver/semver.js"(exports2, module2) {
    exports2 = module2.exports = SemVer;
    var debug2;
    if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
      debug2 = function() {
        var args = Array.prototype.slice.call(arguments, 0);
        args.unshift("SEMVER");
        console.log.apply(console, args);
      };
    } else {
      debug2 = function() {
      };
    }
    exports2.SEMVER_SPEC_VERSION = "2.0.0";
    var MAX_LENGTH = 256;
    var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
    9007199254740991;
    var MAX_SAFE_COMPONENT_LENGTH = 16;
    var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
    var re = exports2.re = [];
    var safeRe = exports2.safeRe = [];
    var src = exports2.src = [];
    var R = 0;
    var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
    var safeRegexReplacements = [
      ["\\s", 1],
      ["\\d", MAX_LENGTH],
      [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
    ];
    function makeSafeRe(value) {
      for (var i2 = 0; i2 < safeRegexReplacements.length; i2++) {
        var token = safeRegexReplacements[i2][0];
        var max = safeRegexReplacements[i2][1];
        value = value.split(token + "*").join(token + "{0," + max + "}").split(token + "+").join(token + "{1," + max + "}");
      }
      return value;
    }
    var NUMERICIDENTIFIER = R++;
    src[NUMERICIDENTIFIER] = "0|[1-9]\\d*";
    var NUMERICIDENTIFIERLOOSE = R++;
    src[NUMERICIDENTIFIERLOOSE] = "\\d+";
    var NONNUMERICIDENTIFIER = R++;
    src[NONNUMERICIDENTIFIER] = "\\d*[a-zA-Z-]" + LETTERDASHNUMBER + "*";
    var MAINVERSION = R++;
    src[MAINVERSION] = "(" + src[NUMERICIDENTIFIER] + ")\\.(" + src[NUMERICIDENTIFIER] + ")\\.(" + src[NUMERICIDENTIFIER] + ")";
    var MAINVERSIONLOOSE = R++;
    src[MAINVERSIONLOOSE] = "(" + src[NUMERICIDENTIFIERLOOSE] + ")\\.(" + src[NUMERICIDENTIFIERLOOSE] + ")\\.(" + src[NUMERICIDENTIFIERLOOSE] + ")";
    var PRERELEASEIDENTIFIER = R++;
    src[PRERELEASEIDENTIFIER] = "(?:" + src[NUMERICIDENTIFIER] + "|" + src[NONNUMERICIDENTIFIER] + ")";
    var PRERELEASEIDENTIFIERLOOSE = R++;
    src[PRERELEASEIDENTIFIERLOOSE] = "(?:" + src[NUMERICIDENTIFIERLOOSE] + "|" + src[NONNUMERICIDENTIFIER] + ")";
    var PRERELEASE = R++;
    src[PRERELEASE] = "(?:-(" + src[PRERELEASEIDENTIFIER] + "(?:\\." + src[PRERELEASEIDENTIFIER] + ")*))";
    var PRERELEASELOOSE = R++;
    src[PRERELEASELOOSE] = "(?:-?(" + src[PRERELEASEIDENTIFIERLOOSE] + "(?:\\." + src[PRERELEASEIDENTIFIERLOOSE] + ")*))";
    var BUILDIDENTIFIER = R++;
    src[BUILDIDENTIFIER] = LETTERDASHNUMBER + "+";
    var BUILD = R++;
    src[BUILD] = "(?:\\+(" + src[BUILDIDENTIFIER] + "(?:\\." + src[BUILDIDENTIFIER] + ")*))";
    var FULL = R++;
    var FULLPLAIN = "v?" + src[MAINVERSION] + src[PRERELEASE] + "?" + src[BUILD] + "?";
    src[FULL] = "^" + FULLPLAIN + "$";
    var LOOSEPLAIN = "[v=\\s]*" + src[MAINVERSIONLOOSE] + src[PRERELEASELOOSE] + "?" + src[BUILD] + "?";
    var LOOSE = R++;
    src[LOOSE] = "^" + LOOSEPLAIN + "$";
    var GTLT = R++;
    src[GTLT] = "((?:<|>)?=?)";
    var XRANGEIDENTIFIERLOOSE = R++;
    src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + "|x|X|\\*";
    var XRANGEIDENTIFIER = R++;
    src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + "|x|X|\\*";
    var XRANGEPLAIN = R++;
    src[XRANGEPLAIN] = "[v=\\s]*(" + src[XRANGEIDENTIFIER] + ")(?:\\.(" + src[XRANGEIDENTIFIER] + ")(?:\\.(" + src[XRANGEIDENTIFIER] + ")(?:" + src[PRERELEASE] + ")?" + src[BUILD] + "?)?)?";
    var XRANGEPLAINLOOSE = R++;
    src[XRANGEPLAINLOOSE] = "[v=\\s]*(" + src[XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + src[XRANGEIDENTIFIERLOOSE] + ")(?:\\.(" + src[XRANGEIDENTIFIERLOOSE] + ")(?:" + src[PRERELEASELOOSE] + ")?" + src[BUILD] + "?)?)?";
    var XRANGE = R++;
    src[XRANGE] = "^" + src[GTLT] + "\\s*" + src[XRANGEPLAIN] + "$";
    var XRANGELOOSE = R++;
    src[XRANGELOOSE] = "^" + src[GTLT] + "\\s*" + src[XRANGEPLAINLOOSE] + "$";
    var COERCE = R++;
    src[COERCE] = "(?:^|[^\\d])(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "})(?:\\.(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "}))?(?:\\.(\\d{1," + MAX_SAFE_COMPONENT_LENGTH + "}))?(?:$|[^\\d])";
    var LONETILDE = R++;
    src[LONETILDE] = "(?:~>?)";
    var TILDETRIM = R++;
    src[TILDETRIM] = "(\\s*)" + src[LONETILDE] + "\\s+";
    re[TILDETRIM] = new RegExp(src[TILDETRIM], "g");
    safeRe[TILDETRIM] = new RegExp(makeSafeRe(src[TILDETRIM]), "g");
    var tildeTrimReplace = "$1~";
    var TILDE = R++;
    src[TILDE] = "^" + src[LONETILDE] + src[XRANGEPLAIN] + "$";
    var TILDELOOSE = R++;
    src[TILDELOOSE] = "^" + src[LONETILDE] + src[XRANGEPLAINLOOSE] + "$";
    var LONECARET = R++;
    src[LONECARET] = "(?:\\^)";
    var CARETTRIM = R++;
    src[CARETTRIM] = "(\\s*)" + src[LONECARET] + "\\s+";
    re[CARETTRIM] = new RegExp(src[CARETTRIM], "g");
    safeRe[CARETTRIM] = new RegExp(makeSafeRe(src[CARETTRIM]), "g");
    var caretTrimReplace = "$1^";
    var CARET = R++;
    src[CARET] = "^" + src[LONECARET] + src[XRANGEPLAIN] + "$";
    var CARETLOOSE = R++;
    src[CARETLOOSE] = "^" + src[LONECARET] + src[XRANGEPLAINLOOSE] + "$";
    var COMPARATORLOOSE = R++;
    src[COMPARATORLOOSE] = "^" + src[GTLT] + "\\s*(" + LOOSEPLAIN + ")$|^$";
    var COMPARATOR = R++;
    src[COMPARATOR] = "^" + src[GTLT] + "\\s*(" + FULLPLAIN + ")$|^$";
    var COMPARATORTRIM = R++;
    src[COMPARATORTRIM] = "(\\s*)" + src[GTLT] + "\\s*(" + LOOSEPLAIN + "|" + src[XRANGEPLAIN] + ")";
    re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], "g");
    safeRe[COMPARATORTRIM] = new RegExp(makeSafeRe(src[COMPARATORTRIM]), "g");
    var comparatorTrimReplace = "$1$2$3";
    var HYPHENRANGE = R++;
    src[HYPHENRANGE] = "^\\s*(" + src[XRANGEPLAIN] + ")\\s+-\\s+(" + src[XRANGEPLAIN] + ")\\s*$";
    var HYPHENRANGELOOSE = R++;
    src[HYPHENRANGELOOSE] = "^\\s*(" + src[XRANGEPLAINLOOSE] + ")\\s+-\\s+(" + src[XRANGEPLAINLOOSE] + ")\\s*$";
    var STAR = R++;
    src[STAR] = "(<|>)?=?\\s*\\*";
    for (i = 0; i < R; i++) {
      debug2(i, src[i]);
      if (!re[i]) {
        re[i] = new RegExp(src[i]);
        safeRe[i] = new RegExp(makeSafeRe(src[i]));
      }
    }
    var i;
    exports2.parse = parse;
    function parse(version, options) {
      if (!options || typeof options !== "object") {
        options = {
          loose: !!options,
          includePrerelease: false
        };
      }
      if (version instanceof SemVer) {
        return version;
      }
      if (typeof version !== "string") {
        return null;
      }
      if (version.length > MAX_LENGTH) {
        return null;
      }
      var r = options.loose ? safeRe[LOOSE] : safeRe[FULL];
      if (!r.test(version)) {
        return null;
      }
      try {
        return new SemVer(version, options);
      } catch (er) {
        return null;
      }
    }
    exports2.valid = valid;
    function valid(version, options) {
      var v = parse(version, options);
      return v ? v.version : null;
    }
    exports2.clean = clean;
    function clean(version, options) {
      var s = parse(version.trim().replace(/^[=v]+/, ""), options);
      return s ? s.version : null;
    }
    exports2.SemVer = SemVer;
    function SemVer(version, options) {
      if (!options || typeof options !== "object") {
        options = {
          loose: !!options,
          includePrerelease: false
        };
      }
      if (version instanceof SemVer) {
        if (version.loose === options.loose) {
          return version;
        } else {
          version = version.version;
        }
      } else if (typeof version !== "string") {
        throw new TypeError("Invalid Version: " + version);
      }
      if (version.length > MAX_LENGTH) {
        throw new TypeError("version is longer than " + MAX_LENGTH + " characters");
      }
      if (!(this instanceof SemVer)) {
        return new SemVer(version, options);
      }
      debug2("SemVer", version, options);
      this.options = options;
      this.loose = !!options.loose;
      var m = version.trim().match(options.loose ? safeRe[LOOSE] : safeRe[FULL]);
      if (!m) {
        throw new TypeError("Invalid Version: " + version);
      }
      this.raw = version;
      this.major = +m[1];
      this.minor = +m[2];
      this.patch = +m[3];
      if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
        throw new TypeError("Invalid major version");
      }
      if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
        throw new TypeError("Invalid minor version");
      }
      if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
        throw new TypeError("Invalid patch version");
      }
      if (!m[4]) {
        this.prerelease = [];
      } else {
        this.prerelease = m[4].split(".").map(function(id) {
          if (/^[0-9]+$/.test(id)) {
            var num = +id;
            if (num >= 0 && num < MAX_SAFE_INTEGER) {
              return num;
            }
          }
          return id;
        });
      }
      this.build = m[5] ? m[5].split(".") : [];
      this.format();
    }
    SemVer.prototype.format = function() {
      this.version = this.major + "." + this.minor + "." + this.patch;
      if (this.prerelease.length) {
        this.version += "-" + this.prerelease.join(".");
      }
      return this.version;
    };
    SemVer.prototype.toString = function() {
      return this.version;
    };
    SemVer.prototype.compare = function(other) {
      debug2("SemVer.compare", this.version, this.options, other);
      if (!(other instanceof SemVer)) {
        other = new SemVer(other, this.options);
      }
      return this.compareMain(other) || this.comparePre(other);
    };
    SemVer.prototype.compareMain = function(other) {
      if (!(other instanceof SemVer)) {
        other = new SemVer(other, this.options);
      }
      return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
    };
    SemVer.prototype.comparePre = function(other) {
      if (!(other instanceof SemVer)) {
        other = new SemVer(other, this.options);
      }
      if (this.prerelease.length && !other.prerelease.length) {
        return -1;
      } else if (!this.prerelease.length && other.prerelease.length) {
        return 1;
      } else if (!this.prerelease.length && !other.prerelease.length) {
        return 0;
      }
      var i2 = 0;
      do {
        var a = this.prerelease[i2];
        var b = other.prerelease[i2];
        debug2("prerelease compare", i2, a, b);
        if (a === void 0 && b === void 0) {
          return 0;
        } else if (b === void 0) {
          return 1;
        } else if (a === void 0) {
          return -1;
        } else if (a === b) {
          continue;
        } else {
          return compareIdentifiers(a, b);
        }
      } while (++i2);
    };
    SemVer.prototype.inc = function(release, identifier) {
      switch (release) {
        case "premajor":
          this.prerelease.length = 0;
          this.patch = 0;
          this.minor = 0;
          this.major++;
          this.inc("pre", identifier);
          break;
        case "preminor":
          this.prerelease.length = 0;
          this.patch = 0;
          this.minor++;
          this.inc("pre", identifier);
          break;
        case "prepatch":
          this.prerelease.length = 0;
          this.inc("patch", identifier);
          this.inc("pre", identifier);
          break;
        // If the input is a non-prerelease version, this acts the same as
        // prepatch.
        case "prerelease":
          if (this.prerelease.length === 0) {
            this.inc("patch", identifier);
          }
          this.inc("pre", identifier);
          break;
        case "major":
          if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
            this.major++;
          }
          this.minor = 0;
          this.patch = 0;
          this.prerelease = [];
          break;
        case "minor":
          if (this.patch !== 0 || this.prerelease.length === 0) {
            this.minor++;
          }
          this.patch = 0;
          this.prerelease = [];
          break;
        case "patch":
          if (this.prerelease.length === 0) {
            this.patch++;
          }
          this.prerelease = [];
          break;
        // This probably shouldn't be used publicly.
        // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
        case "pre":
          if (this.prerelease.length === 0) {
            this.prerelease = [0];
          } else {
            var i2 = this.prerelease.length;
            while (--i2 >= 0) {
              if (typeof this.prerelease[i2] === "number") {
                this.prerelease[i2]++;
                i2 = -2;
              }
            }
            if (i2 === -1) {
              this.prerelease.push(0);
            }
          }
          if (identifier) {
            if (this.prerelease[0] === identifier) {
              if (isNaN(this.prerelease[1])) {
                this.prerelease = [identifier, 0];
              }
            } else {
              this.prerelease = [identifier, 0];
            }
          }
          break;
        default:
          throw new Error("invalid increment argument: " + release);
      }
      this.format();
      this.raw = this.version;
      return this;
    };
    exports2.inc = inc;
    function inc(version, release, loose, identifier) {
      if (typeof loose === "string") {
        identifier = loose;
        loose = void 0;
      }
      try {
        return new SemVer(version, loose).inc(release, identifier).version;
      } catch (er) {
        return null;
      }
    }
    exports2.diff = diff;
    function diff(version1, version2) {
      if (eq(version1, version2)) {
        return null;
      } else {
        var v1 = parse(version1);
        var v2 = parse(version2);
        var prefix = "";
        if (v1.prerelease.length || v2.prerelease.length) {
          prefix = "pre";
          var defaultResult = "prerelease";
        }
        for (var key in v1) {
          if (key === "major" || key === "minor" || key === "patch") {
            if (v1[key] !== v2[key]) {
              return prefix + key;
            }
          }
        }
        return defaultResult;
      }
    }
    exports2.compareIdentifiers = compareIdentifiers;
    var numeric = /^[0-9]+$/;
    function compareIdentifiers(a, b) {
      var anum = numeric.test(a);
      var bnum = numeric.test(b);
      if (anum && bnum) {
        a = +a;
        b = +b;
      }
      return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
    }
    exports2.rcompareIdentifiers = rcompareIdentifiers;
    function rcompareIdentifiers(a, b) {
      return compareIdentifiers(b, a);
    }
    exports2.major = major;
    function major(a, loose) {
      return new SemVer(a, loose).major;
    }
    exports2.minor = minor;
    function minor(a, loose) {
      return new SemVer(a, loose).minor;
    }
    exports2.patch = patch;
    function patch(a, loose) {
      return new SemVer(a, loose).patch;
    }
    exports2.compare = compare;
    function compare(a, b, loose) {
      return new SemVer(a, loose).compare(new SemVer(b, loose));
    }
    exports2.compareLoose = compareLoose;
    function compareLoose(a, b) {
      return compare(a, b, true);
    }
    exports2.rcompare = rcompare;
    function rcompare(a, b, loose) {
      return compare(b, a, loose);
    }
    exports2.sort = sort;
    function sort(list, loose) {
      return list.sort(function(a, b) {
        return exports2.compare(a, b, loose);
      });
    }
    exports2.rsort = rsort;
    function rsort(list, loose) {
      return list.sort(function(a, b) {
        return exports2.rcompare(a, b, loose);
      });
    }
    exports2.gt = gt;
    function gt(a, b, loose) {
      return compare(a, b, loose) > 0;
    }
    exports2.lt = lt;
    function lt(a, b, loose) {
      return compare(a, b, loose) < 0;
    }
    exports2.eq = eq;
    function eq(a, b, loose) {
      return compare(a, b, loose) === 0;
    }
    exports2.neq = neq;
    function neq(a, b, loose) {
      return compare(a, b, loose) !== 0;
    }
    exports2.gte = gte;
    function gte(a, b, loose) {
      return compare(a, b, loose) >= 0;
    }
    exports2.lte = lte;
    function lte(a, b, loose) {
      return compare(a, b, loose) <= 0;
    }
    exports2.cmp = cmp;
    function cmp(a, op, b, loose) {
      switch (op) {
        case "===":
          if (typeof a === "object")
            a = a.version;
          if (typeof b === "object")
            b = b.version;
          return a === b;
        case "!==":
          if (typeof a === "object")
            a = a.version;
          if (typeof b === "object")
            b = b.version;
          return a !== b;
        case "":
        case "=":
        case "==":
          return eq(a, b, loose);
        case "!=":
          return neq(a, b, loose);
        case ">":
          return gt(a, b, loose);
        case ">=":
          return gte(a, b, loose);
        case "<":
          return lt(a, b, loose);
        case "<=":
          return lte(a, b, loose);
        default:
          throw new TypeError("Invalid operator: " + op);
      }
    }
    exports2.Comparator = Comparator;
    function Comparator(comp, options) {
      if (!options || typeof options !== "object") {
        options = {
          loose: !!options,
          includePrerelease: false
        };
      }
      if (comp instanceof Comparator) {
        if (comp.loose === !!options.loose) {
          return comp;
        } else {
          comp = comp.value;
        }
      }
      if (!(this instanceof Comparator)) {
        return new Comparator(comp, options);
      }
      comp = comp.trim().split(/\s+/).join(" ");
      debug2("comparator", comp, options);
      this.options = options;
      this.loose = !!options.loose;
      this.parse(comp);
      if (this.semver === ANY) {
        this.value = "";
      } else {
        this.value = this.operator + this.semver.version;
      }
      debug2("comp", this);
    }
    var ANY = {};
    Comparator.prototype.parse = function(comp) {
      var r = this.options.loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR];
      var m = comp.match(r);
      if (!m) {
        throw new TypeError("Invalid comparator: " + comp);
      }
      this.operator = m[1];
      if (this.operator === "=") {
        this.operator = "";
      }
      if (!m[2]) {
        this.semver = ANY;
      } else {
        this.semver = new SemVer(m[2], this.options.loose);
      }
    };
    Comparator.prototype.toString = function() {
      return this.value;
    };
    Comparator.prototype.test = function(version) {
      debug2("Comparator.test", version, this.options.loose);
      if (this.semver === ANY) {
        return true;
      }
      if (typeof version === "string") {
        version = new SemVer(version, this.options);
      }
      return cmp(version, this.operator, this.semver, this.options);
    };
    Comparator.prototype.intersects = function(comp, options) {
      if (!(comp instanceof Comparator)) {
        throw new TypeError("a Comparator is required");
      }
      if (!options || typeof options !== "object") {
        options = {
          loose: !!options,
          includePrerelease: false
        };
      }
      var rangeTmp;
      if (this.operator === "") {
        rangeTmp = new Range(comp.value, options);
        return satisfies(this.value, rangeTmp, options);
      } else if (comp.operator === "") {
        rangeTmp = new Range(this.value, options);
        return satisfies(comp.semver, rangeTmp, options);
      }
      var sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">");
      var sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<");
      var sameSemVer = this.semver.version === comp.semver.version;
      var differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<=");
      var oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && ((this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<"));
      var oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && ((this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">"));
      return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
    };
    exports2.Range = Range;
    function Range(range, options) {
      if (!options || typeof options !== "object") {
        options = {
          loose: !!options,
          includePrerelease: false
        };
      }
      if (range instanceof Range) {
        if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
          return range;
        } else {
          return new Range(range.raw, options);
        }
      }
      if (range instanceof Comparator) {
        return new Range(range.value, options);
      }
      if (!(this instanceof Range)) {
        return new Range(range, options);
      }
      this.options = options;
      this.loose = !!options.loose;
      this.includePrerelease = !!options.includePrerelease;
      this.raw = range.trim().split(/\s+/).join(" ");
      this.set = this.raw.split("||").map(function(range2) {
        return this.parseRange(range2.trim());
      }, this).filter(function(c) {
        return c.length;
      });
      if (!this.set.length) {
        throw new TypeError("Invalid SemVer Range: " + this.raw);
      }
      this.format();
    }
    Range.prototype.format = function() {
      this.range = this.set.map(function(comps) {
        return comps.join(" ").trim();
      }).join("||").trim();
      return this.range;
    };
    Range.prototype.toString = function() {
      return this.range;
    };
    Range.prototype.parseRange = function(range) {
      var loose = this.options.loose;
      var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE];
      range = range.replace(hr, hyphenReplace);
      debug2("hyphen replace", range);
      range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace);
      debug2("comparator trim", range, safeRe[COMPARATORTRIM]);
      range = range.replace(safeRe[TILDETRIM], tildeTrimReplace);
      range = range.replace(safeRe[CARETTRIM], caretTrimReplace);
      var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR];
      var set2 = range.split(" ").map(function(comp) {
        return parseComparator(comp, this.options);
      }, this).join(" ").split(/\s+/);
      if (this.options.loose) {
        set2 = set2.filter(function(comp) {
          return !!comp.match(compRe);
        });
      }
      set2 = set2.map(function(comp) {
        return new Comparator(comp, this.options);
      }, this);
      return set2;
    };
    Range.prototype.intersects = function(range, options) {
      if (!(range instanceof Range)) {
        throw new TypeError("a Range is required");
      }
      return this.set.some(function(thisComparators) {
        return thisComparators.every(function(thisComparator) {
          return range.set.some(function(rangeComparators) {
            return rangeComparators.every(function(rangeComparator) {
              return thisComparator.intersects(rangeComparator, options);
            });
          });
        });
      });
    };
    exports2.toComparators = toComparators;
    function toComparators(range, options) {
      return new Range(range, options).set.map(function(comp) {
        return comp.map(function(c) {
          return c.value;
        }).join(" ").trim().split(" ");
      });
    }
    function parseComparator(comp, options) {
      debug2("comp", comp, options);
      comp = replaceCarets(comp, options);
      debug2("caret", comp);
      comp = replaceTildes(comp, options);
      debug2("tildes", comp);
      comp = replaceXRanges(comp, options);
      debug2("xrange", comp);
      comp = replaceStars(comp, options);
      debug2("stars", comp);
      return comp;
    }
    function isX(id) {
      return !id || id.toLowerCase() === "x" || id === "*";
    }
    function replaceTildes(comp, options) {
      return comp.trim().split(/\s+/).map(function(comp2) {
        return replaceTilde(comp2, options);
      }).join(" ");
    }
    function replaceTilde(comp, options) {
      var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE];
      return comp.replace(r, function(_, M, m, p, pr) {
        debug2("tilde", comp, _, M, m, p, pr);
        var ret;
        if (isX(M)) {
          ret = "";
        } else if (isX(m)) {
          ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
        } else if (isX(p)) {
          ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
        } else if (pr) {
          debug2("replaceTilde pr", pr);
          ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
        } else {
          ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
        }
        debug2("tilde return", ret);
        return ret;
      });
    }
    function replaceCarets(comp, options) {
      return comp.trim().split(/\s+/).map(function(comp2) {
        return replaceCaret(comp2, options);
      }).join(" ");
    }
    function replaceCaret(comp, options) {
      debug2("caret", comp, options);
      var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET];
      return comp.replace(r, function(_, M, m, p, pr) {
        debug2("caret", comp, _, M, m, p, pr);
        var ret;
        if (isX(M)) {
          ret = "";
        } else if (isX(m)) {
          ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
        } else if (isX(p)) {
          if (M === "0") {
            ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
          } else {
            ret = ">=" + M + "." + m + ".0 <" + (+M + 1) + ".0.0";
          }
        } else if (pr) {
          debug2("replaceCaret pr", pr);
          if (M === "0") {
            if (m === "0") {
              ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + m + "." + (+p + 1);
            } else {
              ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + M + "." + (+m + 1) + ".0";
            }
          } else {
            ret = ">=" + M + "." + m + "." + p + "-" + pr + " <" + (+M + 1) + ".0.0";
          }
        } else {
          debug2("no pr");
          if (M === "0") {
            if (m === "0") {
              ret = ">=" + M + "." + m + "." + p + " <" + M + "." + m + "." + (+p + 1);
            } else {
              ret = ">=" + M + "." + m + "." + p + " <" + M + "." + (+m + 1) + ".0";
            }
          } else {
            ret = ">=" + M + "." + m + "." + p + " <" + (+M + 1) + ".0.0";
          }
        }
        debug2("caret return", ret);
        return ret;
      });
    }
    function replaceXRanges(comp, options) {
      debug2("replaceXRanges", comp, options);
      return comp.split(/\s+/).map(function(comp2) {
        return replaceXRange(comp2, options);
      }).join(" ");
    }
    function replaceXRange(comp, options) {
      comp = comp.trim();
      var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE];
      return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
        debug2("xRange", comp, ret, gtlt, M, m, p, pr);
        var xM = isX(M);
        var xm = xM || isX(m);
        var xp = xm || isX(p);
        var anyX = xp;
        if (gtlt === "=" && anyX) {
          gtlt = "";
        }
        if (xM) {
          if (gtlt === ">" || gtlt === "<") {
            ret = "<0.0.0";
          } else {
            ret = "*";
          }
        } else if (gtlt && anyX) {
          if (xm) {
            m = 0;
          }
          p = 0;
          if (gtlt === ">") {
            gtlt = ">=";
            if (xm) {
              M = +M + 1;
              m = 0;
              p = 0;
            } else {
              m = +m + 1;
              p = 0;
            }
          } else if (gtlt === "<=") {
            gtlt = "<";
            if (xm) {
              M = +M + 1;
            } else {
              m = +m + 1;
            }
          }
          ret = gtlt + M + "." + m + "." + p;
        } else if (xm) {
          ret = ">=" + M + ".0.0 <" + (+M + 1) + ".0.0";
        } else if (xp) {
          ret = ">=" + M + "." + m + ".0 <" + M + "." + (+m + 1) + ".0";
        }
        debug2("xRange return", ret);
        return ret;
      });
    }
    function replaceStars(comp, options) {
      debug2("replaceStars", comp, options);
      return comp.trim().replace(safeRe[STAR], "");
    }
    function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
      if (isX(fM)) {
        from = "";
      } else if (isX(fm)) {
        from = ">=" + fM + ".0.0";
      } else if (isX(fp)) {
        from = ">=" + fM + "." + fm + ".0";
      } else {
        from = ">=" + from;
      }
      if (isX(tM)) {
        to = "";
      } else if (isX(tm)) {
        to = "<" + (+tM + 1) + ".0.0";
      } else if (isX(tp)) {
        to = "<" + tM + "." + (+tm + 1) + ".0";
      } else if (tpr) {
        to = "<=" + tM + "." + tm + "." + tp + "-" + tpr;
      } else {
        to = "<=" + to;
      }
      return (from + " " + to).trim();
    }
    Range.prototype.test = function(version) {
      if (!version) {
        return false;
      }
      if (typeof version === "string") {
        version = new SemVer(version, this.options);
      }
      for (var i2 = 0; i2 < this.set.length; i2++) {
        if (testSet(this.set[i2], version, this.options)) {
          return true;
        }
      }
      return false;
    };
    function testSet(set2, version, options) {
      for (var i2 = 0; i2 < set2.length; i2++) {
        if (!set2[i2].test(version)) {
          return false;
        }
      }
      if (version.prerelease.length && !options.includePrerelease) {
        for (i2 = 0; i2 < set2.length; i2++) {
          debug2(set2[i2].semver);
          if (set2[i2].semver === ANY) {
            continue;
          }
          if (set2[i2].semver.prerelease.length > 0) {
            var allowed = set2[i2].semver;
            if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
              return true;
            }
          }
        }
        return false;
      }
      return true;
    }
    exports2.satisfies = satisfies;
    function satisfies(version, range, options) {
      try {
        range = new Range(range, options);
      } catch (er) {
        return false;
      }
      return range.test(version);
    }
    exports2.maxSatisfying = maxSatisfying;
    function maxSatisfying(versions, range, options) {
      var max = null;
      var maxSV = null;
      try {
        var rangeObj = new Range(range, options);
      } catch (er) {
        return null;
      }
      versions.forEach(function(v) {
        if (rangeObj.test(v)) {
          if (!max || maxSV.compare(v) === -1) {
            max = v;
            maxSV = new SemVer(max, options);
          }
        }
      });
      return max;
    }
    exports2.minSatisfying = minSatisfying;
    function minSatisfying(versions, range, options) {
      var min = null;
      var minSV = null;
      try {
        var rangeObj = new Range(range, options);
      } catch (er) {
        return null;
      }
      versions.forEach(function(v) {
        if (rangeObj.test(v)) {
          if (!min || minSV.compare(v) === 1) {
            min = v;
            minSV = new SemVer(min, options);
          }
        }
      });
      return min;
    }
    exports2.minVersion = minVersion;
    function minVersion(range, loose) {
      range = new Range(range, loose);
      var minver = new SemVer("0.0.0");
      if (range.test(minver)) {
        return minver;
      }
      minver = new SemVer("0.0.0-0");
      if (range.test(minver)) {
        return minver;
      }
      minver = null;
      for (var i2 = 0; i2 < range.set.length; ++i2) {
        var comparators = range.set[i2];
        comparators.forEach(function(comparator) {
          var compver = new SemVer(comparator.semver.version);
          switch (comparator.operator) {
            case ">":
              if (compver.prerelease.length === 0) {
                compver.patch++;
              } else {
                compver.prerelease.push(0);
              }
              compver.raw = compver.format();
            /* fallthrough */
            case "":
            case ">=":
              if (!minver || gt(minver, compver)) {
                minver = compver;
              }
              break;
            case "<":
            case "<=":
              break;
            /* istanbul ignore next */
            default:
              throw new Error("Unexpected operation: " + comparator.operator);
          }
        });
      }
      if (minver && range.test(minver)) {
        return minver;
      }
      return null;
    }
    exports2.validRange = validRange;
    function validRange(range, options) {
      try {
        return new Range(range, options).range || "*";
      } catch (er) {
        return null;
      }
    }
    exports2.ltr = ltr;
    function ltr(version, range, options) {
      return outside(version, range, "<", options);
    }
    exports2.gtr = gtr;
    function gtr(version, range, options) {
      return outside(version, range, ">", options);
    }
    exports2.outside = outside;
    function outside(version, range, hilo, options) {
      version = new SemVer(version, options);
      range = new Range(range, options);
      var gtfn, ltefn, ltfn, comp, ecomp;
      switch (hilo) {
        case ">":
          gtfn = gt;
          ltefn = lte;
          ltfn = lt;
          comp = ">";
          ecomp = ">=";
          break;
        case "<":
          gtfn = lt;
          ltefn = gte;
          ltfn = gt;
          comp = "<";
          ecomp = "<=";
          break;
        default:
          throw new TypeError('Must provide a hilo val of "<" or ">"');
      }
      if (satisfies(version, range, options)) {
        return false;
      }
      for (var i2 = 0; i2 < range.set.length; ++i2) {
        var comparators = range.set[i2];
        var high = null;
        var low = null;
        comparators.forEach(function(comparator) {
          if (comparator.semver === ANY) {
            comparator = new Comparator(">=0.0.0");
          }
          high = high || comparator;
          low = low || comparator;
          if (gtfn(comparator.semver, high.semver, options)) {
            high = comparator;
          } else if (ltfn(comparator.semver, low.semver, options)) {
            low = comparator;
          }
        });
        if (high.operator === comp || high.operator === ecomp) {
          return false;
        }
        if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
          return false;
        } else if (low.operator === ecomp && ltfn(version, low.semver)) {
          return false;
        }
      }
      return true;
    }
    exports2.prerelease = prerelease;
    function prerelease(version, options) {
      var parsed = parse(version, options);
      return parsed && parsed.prerelease.length ? parsed.prerelease : null;
    }
    exports2.intersects = intersects;
    function intersects(r1, r2, options) {
      r1 = new Range(r1, options);
      r2 = new Range(r2, options);
      return r1.intersects(r2);
    }
    exports2.coerce = coerce;
    function coerce(version) {
      if (version instanceof SemVer) {
        return version;
      }
      if (typeof version !== "string") {
        return null;
      }
      var match = version.match(safeRe[COERCE]);
      if (match == null) {
        return null;
      }
      return parse(match[1] + "." + (match[2] || "0") + "." + (match[3] || "0"));
    }
  }
});

// node_modules/azure-pipelines-task-lib/internal.js
var require_internal = __commonJS({
  "node_modules/azure-pipelines-task-lib/internal.js"(exports2) {
    "use strict";
    var _a;
    var _b;
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.isSigPipeError = exports2._exposeCertSettings = exports2._exposeProxySettings = exports2._normalizeSeparators = exports2._isRooted = exports2._getDirectoryName = exports2._ensureRooted = exports2._isUncPath = exports2._loadData = exports2._ensurePatternRooted = exports2._getFindInfoFromPattern = exports2._cloneMatchOptions = exports2._legacyFindFiles_convertPatternToRegExp = exports2._which = exports2._checkPath = exports2._exist = exports2._debug = exports2._error = exports2._warning = exports2._command = exports2._getVariableKey = exports2._getVariable = exports2._loc = exports2._setResourcePath = exports2._setErrStream = exports2._setStdStream = exports2._writeLine = exports2._truncateBeforeSensitiveKeyword = exports2._endsWith = exports2._startsWith = exports2.IssueAuditAction = exports2.IssueSource = exports2._vault = exports2._knownVariableMap = void 0;
    var fs2 = require("fs");
    var path2 = require("path");
    var os = require("os");
    var minimatch = require_minimatch();
    var util = require("util");
    var tcm = require_taskcommand();
    var vm = require_vault();
    var semver = require_semver();
    var crypto = require("crypto");
    exports2._knownVariableMap = {};
    var _commandCorrelationId;
    var IssueSource;
    (function(IssueSource2) {
      IssueSource2["CustomerScript"] = "CustomerScript";
      IssueSource2["TaskInternal"] = "TaskInternal";
    })(IssueSource = exports2.IssueSource || (exports2.IssueSource = {}));
    var IssueAuditAction;
    (function(IssueAuditAction2) {
      IssueAuditAction2[IssueAuditAction2["Unknown"] = 0] = "Unknown";
      IssueAuditAction2[IssueAuditAction2["ShellTasksValidation"] = 1] = "ShellTasksValidation";
    })(IssueAuditAction = exports2.IssueAuditAction || (exports2.IssueAuditAction = {}));
    if (semver.lt(process.versions.node, "4.2.0")) {
      _warning("Tasks require a new agent.  Upgrade your agent or node to 4.2.0 or later", IssueSource.TaskInternal);
    }
    function _startsWith(str2, start) {
      return str2.slice(0, start.length) == start;
    }
    exports2._startsWith = _startsWith;
    function _endsWith(str2, end) {
      return str2.slice(-end.length) == end;
    }
    exports2._endsWith = _endsWith;
    function _truncateBeforeSensitiveKeyword(str2, sensitiveKeywordsPattern) {
      if (!str2) {
        return str2;
      }
      var index = str2.search(sensitiveKeywordsPattern);
      if (index <= 0) {
        return str2;
      }
      return "".concat(str2.substring(0, index), "...");
    }
    exports2._truncateBeforeSensitiveKeyword = _truncateBeforeSensitiveKeyword;
    var _outStream = process.stdout;
    var _errStream = process.stderr;
    function _writeLine(str2) {
      _outStream.write(str2 + os.EOL);
    }
    exports2._writeLine = _writeLine;
    function _setStdStream(stdStream) {
      _outStream = stdStream;
    }
    exports2._setStdStream = _setStdStream;
    function _setErrStream(errStream) {
      _errStream = errStream;
    }
    exports2._setErrStream = _setErrStream;
    var _locStringCache = {};
    var _resourceFiles = {};
    var _libResourceFileLoaded = false;
    var _resourceCulture = "en-US";
    function _loadResJson(resjsonFile) {
      var resJson;
      if (_exist(resjsonFile)) {
        var resjsonContent = fs2.readFileSync(resjsonFile, "utf8").toString();
        if (resjsonContent.indexOf("\uFEFF") == 0) {
          resjsonContent = resjsonContent.slice(1);
        }
        try {
          resJson = JSON.parse(resjsonContent);
        } catch (err) {
          _debug("unable to parse resjson with err: " + err.message);
        }
      } else {
        _debug(".resjson file not found: " + resjsonFile);
      }
      return resJson;
    }
    function _loadLocStrings(resourceFile, culture) {
      var locStrings = {};
      if (_exist(resourceFile)) {
        var resourceJson = require(resourceFile);
        if (resourceJson && resourceJson.hasOwnProperty("messages")) {
          var locResourceJson;
          var localizedResourceFile = path2.join(path2.dirname(resourceFile), "Strings", "resources.resjson");
          var upperCulture = culture.toUpperCase();
          var cultures = [];
          try {
            cultures = fs2.readdirSync(localizedResourceFile);
          } catch (ex) {
          }
          for (var i = 0; i < cultures.length; i++) {
            if (cultures[i].toUpperCase() == upperCulture) {
              localizedResourceFile = path2.join(localizedResourceFile, cultures[i], "resources.resjson");
              if (_exist(localizedResourceFile)) {
                locResourceJson = _loadResJson(localizedResourceFile);
              }
              break;
            }
          }
          for (var key in resourceJson.messages) {
            if (locResourceJson && locResourceJson.hasOwnProperty("loc.messages." + key)) {
              locStrings[key] = locResourceJson["loc.messages." + key];
            } else {
              locStrings[key] = resourceJson.messages[key];
            }
          }
        }
      } else {
        _warning("LIB_ResourceFile does not exist", IssueSource.TaskInternal);
      }
      return locStrings;
    }
    function _setResourcePath(path3, ignoreWarnings) {
      if (ignoreWarnings === void 0) {
        ignoreWarnings = false;
      }
      if (process.env["TASKLIB_INPROC_UNITS"]) {
        _resourceFiles = {};
        _libResourceFileLoaded = false;
        _locStringCache = {};
        _resourceCulture = "en-US";
      }
      if (!_resourceFiles[path3]) {
        _checkPath(path3, "resource file path");
        _resourceFiles[path3] = path3;
        _debug("adding resource file: " + path3);
        _resourceCulture = _getVariable("system.culture") || _resourceCulture;
        var locStrs = _loadLocStrings(path3, _resourceCulture);
        for (var key in locStrs) {
          _locStringCache[key] = locStrs[key];
        }
      } else {
        if (ignoreWarnings) {
        } else {
          _warning(_loc("LIB_ResourceFileAlreadySet", path3), IssueSource.TaskInternal);
        }
      }
    }
    exports2._setResourcePath = _setResourcePath;
    function _loc(key) {
      var param = [];
      for (var _i = 1; _i < arguments.length; _i++) {
        param[_i - 1] = arguments[_i];
      }
      if (!_libResourceFileLoaded) {
        var libResourceFile = path2.join(__dirname, "lib.json");
        var libLocStrs = _loadLocStrings(libResourceFile, _resourceCulture);
        for (var libKey in libLocStrs) {
          _locStringCache[libKey] = libLocStrs[libKey];
        }
        _libResourceFileLoaded = true;
      }
      var locString;
      ;
      if (_locStringCache.hasOwnProperty(key)) {
        locString = _locStringCache[key];
      } else {
        if (Object.keys(_resourceFiles).length <= 0) {
          _warning("Resource file haven't been set, can't find loc string for key: ".concat(key), IssueSource.TaskInternal);
        } else {
          _warning("Can't find loc string for key: ".concat(key));
        }
        locString = key;
      }
      if (param.length > 0) {
        return util.format.apply(this, [locString].concat(param));
      } else {
        return locString;
      }
    }
    exports2._loc = _loc;
    function _getVariable(name) {
      var varval;
      var info;
      var key = _getVariableKey(name);
      if (exports2._knownVariableMap.hasOwnProperty(key)) {
        info = exports2._knownVariableMap[key];
      }
      if (info && info.secret) {
        varval = exports2._vault.retrieveSecret("SECRET_" + key);
      } else {
        varval = process.env[key];
        if (!varval && name.toUpperCase() == "AGENT.JOBSTATUS") {
          varval = process.env["agent.jobstatus"];
        }
      }
      _debug(name + "=" + varval);
      return varval;
    }
    exports2._getVariable = _getVariable;
    function _getVariableKey(name) {
      if (!name) {
        throw new Error(_loc("LIB_ParameterIsRequired", "name"));
      }
      return name.replace(/\./g, "_").replace(/ /g, "_").toUpperCase();
    }
    exports2._getVariableKey = _getVariableKey;
    function _command(command, properties, message) {
      var taskCmd = new tcm.TaskCommand(command, properties, message);
      _writeLine(taskCmd.toString());
    }
    exports2._command = _command;
    function _warning(message, source, auditAction) {
      if (source === void 0) {
        source = IssueSource.TaskInternal;
      }
      _command("task.issue", {
        "type": "warning",
        "source": source,
        "correlationId": _commandCorrelationId,
        "auditAction": auditAction
      }, message);
    }
    exports2._warning = _warning;
    function _error(message, source, auditAction) {
      if (source === void 0) {
        source = IssueSource.TaskInternal;
      }
      _command("task.issue", {
        "type": "error",
        "source": source,
        "correlationId": _commandCorrelationId,
        "auditAction": auditAction
      }, message);
    }
    exports2._error = _error;
    var debugMode = ((_a = _getVariable("system.debug")) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === "true";
    var shouldCheckDebugMode = ((_b = _getVariable("DistributedTask.Tasks.Node.SkipDebugLogsWhenDebugModeOff")) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "true";
    function _debug(message) {
      if (!shouldCheckDebugMode || shouldCheckDebugMode && debugMode) {
        _command("task.debug", null, message);
      }
    }
    exports2._debug = _debug;
    function _exist(path3) {
      var exist = false;
      try {
        exist = !!(path3 && fs2.statSync(path3) != null);
      } catch (err) {
        if (err && err.code === "ENOENT") {
          exist = false;
        } else {
          throw err;
        }
      }
      return exist;
    }
    exports2._exist = _exist;
    function _checkPath(p, name) {
      _debug("check path : " + p);
      if (!_exist(p)) {
        throw new Error(_loc("LIB_PathNotFound", name, p));
      }
    }
    exports2._checkPath = _checkPath;
    function _which(tool, check) {
      if (!tool) {
        throw new Error("parameter 'tool' is required");
      }
      if (check) {
        var result = _which(tool, false);
        if (result) {
          return result;
        } else {
          if (process.platform == "win32") {
            throw new Error(_loc("LIB_WhichNotFound_Win", tool));
          } else {
            throw new Error(_loc("LIB_WhichNotFound_Linux", tool));
          }
        }
      }
      _debug("which '".concat(tool, "'"));
      try {
        var extensions = [];
        if (process.platform == "win32" && process.env["PATHEXT"]) {
          for (var _i = 0, _a2 = process.env["PATHEXT"].split(path2.delimiter); _i < _a2.length; _i++) {
            var extension = _a2[_i];
            if (extension) {
              extensions.push(extension);
            }
          }
        }
        if (_isRooted(tool)) {
          var filePath = _tryGetExecutablePath(tool, extensions);
          if (filePath) {
            _debug("found: '".concat(filePath, "'"));
            return filePath;
          }
          _debug("not found");
          return "";
        }
        if (tool.indexOf("/") >= 0 || process.platform == "win32" && tool.indexOf("\\") >= 0) {
          _debug("not found");
          return "";
        }
        var directories = [];
        if (process.env["PATH"]) {
          for (var _b2 = 0, _c = process.env["PATH"].split(path2.delimiter); _b2 < _c.length; _b2++) {
            var p = _c[_b2];
            if (p) {
              directories.push(p);
            }
          }
        }
        for (var _d = 0, directories_1 = directories; _d < directories_1.length; _d++) {
          var directory = directories_1[_d];
          var filePath = _tryGetExecutablePath(directory + path2.sep + tool, extensions);
          if (filePath) {
            _debug("found: '".concat(filePath, "'"));
            return filePath;
          }
        }
        _debug("not found");
        return "";
      } catch (err) {
        throw new Error(_loc("LIB_OperationFailed", "which", err.message));
      }
    }
    exports2._which = _which;
    function _tryGetExecutablePath(filePath, extensions) {
      try {
        var stats = fs2.statSync(filePath);
        if (stats.isFile()) {
          if (process.platform == "win32") {
            var isExecutable = false;
            var fileName = path2.basename(filePath);
            var dotIndex = fileName.lastIndexOf(".");
            if (dotIndex >= 0) {
              var upperExt_1 = fileName.substr(dotIndex).toUpperCase();
              if (extensions.some(function(validExt) {
                return validExt.toUpperCase() == upperExt_1;
              })) {
                return filePath;
              }
            }
          } else {
            if (isUnixExecutable(stats)) {
              return filePath;
            }
          }
        }
      } catch (err) {
        if (err.code != "ENOENT") {
          _debug("Unexpected error attempting to determine if executable file exists '".concat(filePath, "': ").concat(err));
        }
      }
      var originalFilePath = filePath;
      for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {
        var extension = extensions_1[_i];
        var found = false;
        var filePath_1 = originalFilePath + extension;
        try {
          var stats = fs2.statSync(filePath_1);
          if (stats.isFile()) {
            if (process.platform == "win32") {
              try {
                var directory = path2.dirname(filePath_1);
                var upperName = path2.basename(filePath_1).toUpperCase();
                for (var _a2 = 0, _b2 = fs2.readdirSync(directory); _a2 < _b2.length; _a2++) {
                  var actualName = _b2[_a2];
                  if (upperName == actualName.toUpperCase()) {
                    filePath_1 = path2.join(directory, actualName);
                    break;
                  }
                }
              } catch (err) {
                _debug("Unexpected error attempting to determine the actual case of the file '".concat(filePath_1, "': ").concat(err));
              }
              return filePath_1;
            } else {
              if (isUnixExecutable(stats)) {
                return filePath_1;
              }
            }
          }
        } catch (err) {
          if (err.code != "ENOENT") {
            _debug("Unexpected error attempting to determine if executable file exists '".concat(filePath_1, "': ").concat(err));
          }
        }
      }
      return "";
    }
    function isUnixExecutable(stats) {
      return (stats.mode & 1) > 0 || (stats.mode & 8) > 0 && stats.gid === process.getgid() || (stats.mode & 64) > 0 && stats.uid === process.getuid();
    }
    function _legacyFindFiles_convertPatternToRegExp(pattern) {
      pattern = (process.platform == "win32" ? pattern.replace(/\\/g, "/") : pattern).replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&").replace(/\\\/\\\*\\\*\\\//g, "((/.+/)|(/))").replace(/\\\*\\\*/g, ".*").replace(/\\\*/g, "[^/]*").replace(/\\\?/g, "[^/]");
      pattern = "^".concat(pattern, "$");
      var flags = process.platform == "win32" ? "i" : "";
      return new RegExp(pattern, flags);
    }
    exports2._legacyFindFiles_convertPatternToRegExp = _legacyFindFiles_convertPatternToRegExp;
    function _cloneMatchOptions(matchOptions) {
      return {
        debug: matchOptions.debug,
        nobrace: matchOptions.nobrace,
        noglobstar: matchOptions.noglobstar,
        dot: matchOptions.dot,
        noext: matchOptions.noext,
        nocase: matchOptions.nocase,
        nonull: matchOptions.nonull,
        matchBase: matchOptions.matchBase,
        nocomment: matchOptions.nocomment,
        nonegate: matchOptions.nonegate,
        flipNegate: matchOptions.flipNegate
      };
    }
    exports2._cloneMatchOptions = _cloneMatchOptions;
    function _getFindInfoFromPattern(defaultRoot, pattern, matchOptions) {
      if (!defaultRoot) {
        throw new Error("getFindRootFromPattern() parameter defaultRoot cannot be empty");
      }
      if (!pattern) {
        throw new Error("getFindRootFromPattern() parameter pattern cannot be empty");
      }
      if (!matchOptions.nobrace) {
        throw new Error("getFindRootFromPattern() expected matchOptions.nobrace to be true");
      }
      matchOptions = _cloneMatchOptions(matchOptions);
      matchOptions.nocase = false;
      if (matchOptions.matchBase && !_isRooted(pattern) && (process.platform == "win32" ? pattern.replace(/\\/g, "/") : pattern).indexOf("/") < 0) {
        return {
          adjustedPattern: pattern,
          findPath: defaultRoot,
          statOnly: false
        };
      }
      var minimatchObj = new minimatch.Minimatch(pattern, matchOptions);
      if (minimatchObj.set.length != 1) {
        throw new Error("getFindRootFromPattern() expected Minimatch(...).set.length to be 1. Actual: " + minimatchObj.set.length);
      }
      var literalSegments = [];
      for (var _i = 0, _a2 = minimatchObj.set[0]; _i < _a2.length; _i++) {
        var parsedSegment = _a2[_i];
        if (typeof parsedSegment == "string") {
          literalSegments.push(parsedSegment);
          continue;
        }
        break;
      }
      var joinedSegments = literalSegments.join("/");
      if (joinedSegments && process.platform == "win32" && _startsWith(pattern.replace(/\\/g, "/"), "//")) {
        joinedSegments = "/" + joinedSegments;
      }
      var findPath;
      if (_isRooted(pattern)) {
        findPath = joinedSegments;
      } else if (joinedSegments) {
        findPath = _ensureRooted(defaultRoot, joinedSegments);
      } else {
        findPath = defaultRoot;
      }
      if (findPath) {
        findPath = _getDirectoryName(_ensureRooted(findPath, "_"));
        findPath = _normalizeSeparators(findPath);
      }
      return {
        adjustedPattern: _ensurePatternRooted(defaultRoot, pattern),
        findPath,
        statOnly: literalSegments.length == minimatchObj.set[0].length
      };
    }
    exports2._getFindInfoFromPattern = _getFindInfoFromPattern;
    function _ensurePatternRooted(root, p) {
      if (!root) {
        throw new Error('ensurePatternRooted() parameter "root" cannot be empty');
      }
      if (!p) {
        throw new Error('ensurePatternRooted() parameter "p" cannot be empty');
      }
      if (_isRooted(p)) {
        return p;
      }
      root = _normalizeSeparators(root);
      root = (process.platform == "win32" ? root : root.replace(/\\/g, "\\\\")).replace(/(\[)(?=[^\/]+\])/g, "[[]").replace(/\?/g, "[?]").replace(/\*/g, "[*]").replace(/\+\(/g, "[+](").replace(/@\(/g, "[@](").replace(/!\(/g, "[!](");
      return _ensureRooted(root, p);
    }
    exports2._ensurePatternRooted = _ensurePatternRooted;
    function _loadData() {
      var keyPath = _getVariable("agent.TempDirectory") || _getVariable("agent.workFolder") || process.cwd();
      exports2._vault = new vm.Vault(keyPath);
      exports2._knownVariableMap = {};
      _debug("loading inputs and endpoints");
      var loaded = 0;
      for (var envvar in process.env) {
        if (_startsWith(envvar, "INPUT_") || _startsWith(envvar, "ENDPOINT_AUTH_") || _startsWith(envvar, "SECUREFILE_TICKET_") || _startsWith(envvar, "SECRET_") || _startsWith(envvar, "VSTS_TASKVARIABLE_")) {
          if (_startsWith(envvar, "SECRET_")) {
            var variableName = envvar.substring("SECRET_".length);
            if (variableName) {
              exports2._knownVariableMap[_getVariableKey(variableName)] = { name: variableName, secret: true };
            }
          }
          var value = process.env[envvar];
          if (value) {
            ++loaded;
            _debug("loading " + envvar);
            exports2._vault.storeSecret(envvar, value);
            delete process.env[envvar];
          }
        }
      }
      _debug("loaded " + loaded);
      var correlationId = process.env["COMMAND_CORRELATION_ID"];
      delete process.env["COMMAND_CORRELATION_ID"];
      _commandCorrelationId = correlationId ? String(correlationId) : "";
      var names;
      try {
        names = JSON.parse(process.env["VSTS_PUBLIC_VARIABLES"] || "[]");
      } catch (err) {
        throw new Error("Failed to parse VSTS_PUBLIC_VARIABLES as JSON. " + err);
      }
      names.forEach(function(name) {
        exports2._knownVariableMap[_getVariableKey(name)] = { name, secret: false };
      });
      delete process.env["VSTS_PUBLIC_VARIABLES"];
      try {
        names = JSON.parse(process.env["VSTS_SECRET_VARIABLES"] || "[]");
      } catch (err) {
        throw new Error("Failed to parse VSTS_SECRET_VARIABLES as JSON. " + err);
      }
      names.forEach(function(name) {
        exports2._knownVariableMap[_getVariableKey(name)] = { name, secret: true };
      });
      delete process.env["VSTS_SECRET_VARIABLES"];
      global["_vsts_task_lib_loaded"] = true;
    }
    exports2._loadData = _loadData;
    function _isUncPath(path3) {
      return /^\\\\[^\\]/.test(path3);
    }
    exports2._isUncPath = _isUncPath;
    function _ensureRooted(root, p) {
      if (!root) {
        throw new Error('ensureRooted() parameter "root" cannot be empty');
      }
      if (!p) {
        throw new Error('ensureRooted() parameter "p" cannot be empty');
      }
      if (_isRooted(p)) {
        return p;
      }
      if (process.platform == "win32" && root.match(/^[A-Z]:$/i)) {
        return root + p;
      }
      if (_endsWith(root, "/") || process.platform == "win32" && _endsWith(root, "\\")) {
      } else {
        root += path2.sep;
      }
      return root + p;
    }
    exports2._ensureRooted = _ensureRooted;
    function _getDirectoryName(p) {
      if (!p) {
        return "";
      }
      p = _normalizeSeparators(p);
      if (process.platform == "win32") {
        if (/^[A-Z]:\\?[^\\]+$/i.test(p)) {
          return p.charAt(2) == "\\" ? p.substring(0, 3) : p.substring(0, 2);
        } else if (/^[A-Z]:\\?$/i.test(p)) {
          return "";
        }
        var lastSlashIndex = p.lastIndexOf("\\");
        if (lastSlashIndex < 0) {
          return "";
        } else if (p == "\\") {
          return "";
        } else if (lastSlashIndex == 0) {
          return "\\";
        } else if (/^\\\\[^\\]+(\\[^\\]*)?$/.test(p)) {
          return "";
        }
        return p.substring(0, lastSlashIndex);
      }
      if (p.indexOf("/") < 0) {
        return "";
      } else if (p == "/") {
        return "";
      } else if (_endsWith(p, "/")) {
        return p.substring(0, p.length - 1);
      }
      return path2.dirname(p);
    }
    exports2._getDirectoryName = _getDirectoryName;
    function _isRooted(p) {
      p = _normalizeSeparators(p);
      if (!p) {
        throw new Error('isRooted() parameter "p" cannot be empty');
      }
      if (process.platform == "win32") {
        return _startsWith(p, "\\") || // e.g. \ or \hello or \\hello
        /^[A-Z]:/i.test(p);
      }
      return _startsWith(p, "/");
    }
    exports2._isRooted = _isRooted;
    function _normalizeSeparators(p) {
      p = p || "";
      if (process.platform == "win32") {
        p = p.replace(/\//g, "\\");
        var isUnc = /^\\\\+[^\\]/.test(p);
        return (isUnc ? "\\" : "") + p.replace(/\\\\+/g, "\\");
      }
      return p.replace(/\/\/+/g, "/");
    }
    exports2._normalizeSeparators = _normalizeSeparators;
    function _exposeProxySettings() {
      var proxyUrl = _getVariable("Agent.ProxyUrl");
      if (proxyUrl && proxyUrl.length > 0) {
        var proxyUsername = _getVariable("Agent.ProxyUsername");
        var proxyPassword = _getVariable("Agent.ProxyPassword");
        var proxyBypassHostsJson = _getVariable("Agent.ProxyBypassList");
        global["_vsts_task_lib_proxy_url"] = proxyUrl;
        global["_vsts_task_lib_proxy_username"] = proxyUsername;
        global["_vsts_task_lib_proxy_bypass"] = proxyBypassHostsJson;
        global["_vsts_task_lib_proxy_password"] = _exposeTaskLibSecret("proxy", proxyPassword || "");
        _debug("expose agent proxy configuration.");
        global["_vsts_task_lib_proxy"] = true;
      }
    }
    exports2._exposeProxySettings = _exposeProxySettings;
    function _exposeCertSettings() {
      var ca = _getVariable("Agent.CAInfo");
      if (ca) {
        global["_vsts_task_lib_cert_ca"] = ca;
      }
      var clientCert = _getVariable("Agent.ClientCert");
      if (clientCert) {
        var clientCertKey = _getVariable("Agent.ClientCertKey");
        var clientCertArchive = _getVariable("Agent.ClientCertArchive");
        var clientCertPassword = _getVariable("Agent.ClientCertPassword");
        global["_vsts_task_lib_cert_clientcert"] = clientCert;
        global["_vsts_task_lib_cert_key"] = clientCertKey;
        global["_vsts_task_lib_cert_archive"] = clientCertArchive;
        global["_vsts_task_lib_cert_passphrase"] = _exposeTaskLibSecret("cert", clientCertPassword || "");
      }
      if (ca || clientCert) {
        _debug("expose agent certificate configuration.");
        global["_vsts_task_lib_cert"] = true;
      }
      var skipCertValidation = _getVariable("Agent.SkipCertValidation") || "false";
      if (skipCertValidation) {
        global["_vsts_task_lib_skip_cert_validation"] = skipCertValidation.toUpperCase() === "TRUE";
      }
    }
    exports2._exposeCertSettings = _exposeCertSettings;
    function _exposeTaskLibSecret(keyFile, secret) {
      if (secret) {
        var encryptKey = crypto.randomBytes(32);
        var iv = crypto.randomBytes(16);
        var cipher = crypto.createCipheriv("aes-256-ctr", encryptKey, iv);
        var encryptedContent = cipher.update(secret, "utf8", "hex");
        encryptedContent += cipher.final("hex");
        var storageFile = path2.join(_getVariable("Agent.TempDirectory") || _getVariable("agent.workFolder") || process.cwd(), keyFile);
        var keyAndIv = encryptKey.toString("base64") + ":" + iv.toString("base64");
        fs2.writeFileSync(storageFile, keyAndIv, { encoding: "utf8" });
        return Buffer.from(storageFile).toString("base64") + ":" + Buffer.from(encryptedContent).toString("base64");
      }
    }
    function isSigPipeError(e) {
      var _a2;
      if (!e || typeof e !== "object") {
        return false;
      }
      return e.code === "EPIPE" && ((_a2 = e.syscall) === null || _a2 === void 0 ? void 0 : _a2.toUpperCase()) === "WRITE";
    }
    exports2.isSigPipeError = isSigPipeError;
  }
});

// node_modules/q/q.js
var require_q = __commonJS({
  "node_modules/q/q.js"(exports2, module2) {
    (function(definition) {
      "use strict";
      if (typeof bootstrap === "function") {
        bootstrap("promise", definition);
      } else if (typeof exports2 === "object" && typeof module2 === "object") {
        module2.exports = definition();
      } else if (typeof define === "function" && define.amd) {
        define(definition);
      } else if (typeof ses !== "undefined") {
        if (!ses.ok()) {
          return;
        } else {
          ses.makeQ = definition;
        }
      } else if (typeof window !== "undefined" || typeof self !== "undefined") {
        var global2 = typeof window !== "undefined" ? window : self;
        var previousQ = global2.Q;
        global2.Q = definition();
        global2.Q.noConflict = function() {
          global2.Q = previousQ;
          return this;
        };
      } else {
        throw new Error("This environment was not anticipated by Q. Please file a bug.");
      }
    })(function() {
      "use strict";
      var hasStacks = false;
      try {
        throw new Error();
      } catch (e) {
        hasStacks = !!e.stack;
      }
      var qStartingLine = captureLine();
      var qFileName;
      var noop = function() {
      };
      var nextTick = (function() {
        var head = { task: void 0, next: null };
        var tail = head;
        var flushing = false;
        var requestTick = void 0;
        var isNodeJS = false;
        var laterQueue = [];
        function flush() {
          var task, domain;
          while (head.next) {
            head = head.next;
            task = head.task;
            head.task = void 0;
            domain = head.domain;
            if (domain) {
              head.domain = void 0;
              domain.enter();
            }
            runSingle(task, domain);
          }
          while (laterQueue.length) {
            task = laterQueue.pop();
            runSingle(task);
          }
          flushing = false;
        }
        function runSingle(task, domain) {
          try {
            task();
          } catch (e) {
            if (isNodeJS) {
              if (domain) {
                domain.exit();
              }
              setTimeout(flush, 0);
              if (domain) {
                domain.enter();
              }
              throw e;
            } else {
              setTimeout(function() {
                throw e;
              }, 0);
            }
          }
          if (domain) {
            domain.exit();
          }
        }
        nextTick = function(task) {
          tail = tail.next = {
            task,
            domain: isNodeJS && process.domain,
            next: null
          };
          if (!flushing) {
            flushing = true;
            requestTick();
          }
        };
        if (typeof process === "object" && process.toString() === "[object process]" && process.nextTick) {
          isNodeJS = true;
          requestTick = function() {
            process.nextTick(flush);
          };
        } else if (typeof setImmediate === "function") {
          if (typeof window !== "undefined") {
            requestTick = setImmediate.bind(window, flush);
          } else {
            requestTick = function() {
              setImmediate(flush);
            };
          }
        } else if (typeof MessageChannel !== "undefined") {
          var channel = new MessageChannel();
          channel.port1.onmessage = function() {
            requestTick = requestPortTick;
            channel.port1.onmessage = flush;
            flush();
          };
          var requestPortTick = function() {
            channel.port2.postMessage(0);
          };
          requestTick = function() {
            setTimeout(flush, 0);
            requestPortTick();
          };
        } else {
          requestTick = function() {
            setTimeout(flush, 0);
          };
        }
        nextTick.runAfter = function(task) {
          laterQueue.push(task);
          if (!flushing) {
            flushing = true;
            requestTick();
          }
        };
        return nextTick;
      })();
      var call = Function.call;
      function uncurryThis(f) {
        return function() {
          return call.apply(f, arguments);
        };
      }
      var array_slice = uncurryThis(Array.prototype.slice);
      var array_reduce = uncurryThis(
        Array.prototype.reduce || function(callback, basis) {
          var index = 0, length = this.length;
          if (arguments.length === 1) {
            do {
              if (index in this) {
                basis = this[index++];
                break;
              }
              if (++index >= length) {
                throw new TypeError();
              }
            } while (1);
          }
          for (; index < length; index++) {
            if (index in this) {
              basis = callback(basis, this[index], index);
            }
          }
          return basis;
        }
      );
      var array_indexOf = uncurryThis(
        Array.prototype.indexOf || function(value) {
          for (var i = 0; i < this.length; i++) {
            if (this[i] === value) {
              return i;
            }
          }
          return -1;
        }
      );
      var array_map = uncurryThis(
        Array.prototype.map || function(callback, thisp) {
          var self2 = this;
          var collect = [];
          array_reduce(self2, function(undefined2, value, index) {
            collect.push(callback.call(thisp, value, index, self2));
          }, void 0);
          return collect;
        }
      );
      var object_create = Object.create || function(prototype) {
        function Type() {
        }
        Type.prototype = prototype;
        return new Type();
      };
      var object_defineProperty = Object.defineProperty || function(obj, prop, descriptor) {
        obj[prop] = descriptor.value;
        return obj;
      };
      var object_hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
      var object_keys = Object.keys || function(object) {
        var keys = [];
        for (var key in object) {
          if (object_hasOwnProperty(object, key)) {
            keys.push(key);
          }
        }
        return keys;
      };
      var object_toString = uncurryThis(Object.prototype.toString);
      function isObject2(value) {
        return value === Object(value);
      }
      function isStopIteration(exception2) {
        return object_toString(exception2) === "[object StopIteration]" || exception2 instanceof QReturnValue;
      }
      var QReturnValue;
      if (typeof ReturnValue !== "undefined") {
        QReturnValue = ReturnValue;
      } else {
        QReturnValue = function(value) {
          this.value = value;
        };
      }
      var STACK_JUMP_SEPARATOR = "From previous event:";
      function makeStackTraceLong(error, promise2) {
        if (hasStacks && promise2.stack && typeof error === "object" && error !== null && error.stack) {
          var stacks = [];
          for (var p = promise2; !!p; p = p.source) {
            if (p.stack && (!error.__minimumStackCounter__ || error.__minimumStackCounter__ > p.stackCounter)) {
              object_defineProperty(error, "__minimumStackCounter__", { value: p.stackCounter, configurable: true });
              stacks.unshift(p.stack);
            }
          }
          stacks.unshift(error.stack);
          var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
          var stack = filterStackString(concatedStacks);
          object_defineProperty(error, "stack", { value: stack, configurable: true });
        }
      }
      function filterStackString(stackString) {
        var lines = stackString.split("\n");
        var desiredLines = [];
        for (var i = 0; i < lines.length; ++i) {
          var line = lines[i];
          if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
            desiredLines.push(line);
          }
        }
        return desiredLines.join("\n");
      }
      function isNodeFrame(stackLine) {
        return stackLine.indexOf("(module.js:") !== -1 || stackLine.indexOf("(node.js:") !== -1;
      }
      function getFileNameAndLineNumber(stackLine) {
        var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
        if (attempt1) {
          return [attempt1[1], Number(attempt1[2])];
        }
        var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
        if (attempt2) {
          return [attempt2[1], Number(attempt2[2])];
        }
        var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
        if (attempt3) {
          return [attempt3[1], Number(attempt3[2])];
        }
      }
      function isInternalFrame(stackLine) {
        var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
        if (!fileNameAndLineNumber) {
          return false;
        }
        var fileName = fileNameAndLineNumber[0];
        var lineNumber = fileNameAndLineNumber[1];
        return fileName === qFileName && lineNumber >= qStartingLine && lineNumber <= qEndingLine;
      }
      function captureLine() {
        if (!hasStacks) {
          return;
        }
        try {
          throw new Error();
        } catch (e) {
          var lines = e.stack.split("\n");
          var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
          var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
          if (!fileNameAndLineNumber) {
            return;
          }
          qFileName = fileNameAndLineNumber[0];
          return fileNameAndLineNumber[1];
        }
      }
      function deprecate(callback, name, alternative) {
        return function() {
          if (typeof console !== "undefined" && typeof console.warn === "function") {
            console.warn(name + " is deprecated, use " + alternative + " instead.", new Error("").stack);
          }
          return callback.apply(callback, arguments);
        };
      }
      function Q(value) {
        if (value instanceof Promise2) {
          return value;
        }
        if (isPromiseAlike(value)) {
          return coerce(value);
        } else {
          return fulfill(value);
        }
      }
      Q.resolve = Q;
      Q.nextTick = nextTick;
      Q.longStackSupport = false;
      var longStackCounter = 1;
      if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) {
        Q.longStackSupport = true;
      }
      Q.defer = defer;
      function defer() {
        var messages = [], progressListeners = [], resolvedPromise;
        var deferred = object_create(defer.prototype);
        var promise2 = object_create(Promise2.prototype);
        promise2.promiseDispatch = function(resolve, op, operands) {
          var args = array_slice(arguments);
          if (messages) {
            messages.push(args);
            if (op === "when" && operands[1]) {
              progressListeners.push(operands[1]);
            }
          } else {
            Q.nextTick(function() {
              resolvedPromise.promiseDispatch.apply(resolvedPromise, args);
            });
          }
        };
        promise2.valueOf = function() {
          if (messages) {
            return promise2;
          }
          var nearerValue = nearer(resolvedPromise);
          if (isPromise(nearerValue)) {
            resolvedPromise = nearerValue;
          }
          return nearerValue;
        };
        promise2.inspect = function() {
          if (!resolvedPromise) {
            return { state: "pending" };
          }
          return resolvedPromise.inspect();
        };
        if (Q.longStackSupport && hasStacks) {
          try {
            throw new Error();
          } catch (e) {
            promise2.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
            promise2.stackCounter = longStackCounter++;
          }
        }
        function become(newPromise) {
          resolvedPromise = newPromise;
          if (Q.longStackSupport && hasStacks) {
            promise2.source = newPromise;
          }
          array_reduce(messages, function(undefined2, message) {
            Q.nextTick(function() {
              newPromise.promiseDispatch.apply(newPromise, message);
            });
          }, void 0);
          messages = void 0;
          progressListeners = void 0;
        }
        deferred.promise = promise2;
        deferred.resolve = function(value) {
          if (resolvedPromise) {
            return;
          }
          become(Q(value));
        };
        deferred.fulfill = function(value) {
          if (resolvedPromise) {
            return;
          }
          become(fulfill(value));
        };
        deferred.reject = function(reason) {
          if (resolvedPromise) {
            return;
          }
          become(reject(reason));
        };
        deferred.notify = function(progress2) {
          if (resolvedPromise) {
            return;
          }
          array_reduce(progressListeners, function(undefined2, progressListener) {
            Q.nextTick(function() {
              progressListener(progress2);
            });
          }, void 0);
        };
        return deferred;
      }
      defer.prototype.makeNodeResolver = function() {
        var self2 = this;
        return function(error, value) {
          if (error) {
            self2.reject(error);
          } else if (arguments.length > 2) {
            self2.resolve(array_slice(arguments, 1));
          } else {
            self2.resolve(value);
          }
        };
      };
      Q.Promise = promise;
      Q.promise = promise;
      function promise(resolver) {
        if (typeof resolver !== "function") {
          throw new TypeError("resolver must be a function.");
        }
        var deferred = defer();
        try {
          resolver(deferred.resolve, deferred.reject, deferred.notify);
        } catch (reason) {
          deferred.reject(reason);
        }
        return deferred.promise;
      }
      promise.race = race;
      promise.all = all;
      promise.reject = reject;
      promise.resolve = Q;
      Q.passByCopy = function(object) {
        return object;
      };
      Promise2.prototype.passByCopy = function() {
        return this;
      };
      Q.join = function(x, y) {
        return Q(x).join(y);
      };
      Promise2.prototype.join = function(that) {
        return Q([this, that]).spread(function(x, y) {
          if (x === y) {
            return x;
          } else {
            throw new Error("Q can't join: not the same: " + x + " " + y);
          }
        });
      };
      Q.race = race;
      function race(answerPs) {
        return promise(function(resolve, reject2) {
          for (var i = 0, len = answerPs.length; i < len; i++) {
            Q(answerPs[i]).then(resolve, reject2);
          }
        });
      }
      Promise2.prototype.race = function() {
        return this.then(Q.race);
      };
      Q.makePromise = Promise2;
      function Promise2(descriptor, fallback, inspect) {
        if (fallback === void 0) {
          fallback = function(op) {
            return reject(new Error(
              "Promise does not support operation: " + op
            ));
          };
        }
        if (inspect === void 0) {
          inspect = function() {
            return { state: "unknown" };
          };
        }
        var promise2 = object_create(Promise2.prototype);
        promise2.promiseDispatch = function(resolve, op, args) {
          var result;
          try {
            if (descriptor[op]) {
              result = descriptor[op].apply(promise2, args);
            } else {
              result = fallback.call(promise2, op, args);
            }
          } catch (exception2) {
            result = reject(exception2);
          }
          if (resolve) {
            resolve(result);
          }
        };
        promise2.inspect = inspect;
        if (inspect) {
          var inspected = inspect();
          if (inspected.state === "rejected") {
            promise2.exception = inspected.reason;
          }
          promise2.valueOf = function() {
            var inspected2 = inspect();
            if (inspected2.state === "pending" || inspected2.state === "rejected") {
              return promise2;
            }
            return inspected2.value;
          };
        }
        return promise2;
      }
      Promise2.prototype.toString = function() {
        return "[object Promise]";
      };
      Promise2.prototype.then = function(fulfilled, rejected, progressed) {
        var self2 = this;
        var deferred = defer();
        var done = false;
        function _fulfilled(value) {
          try {
            return typeof fulfilled === "function" ? fulfilled(value) : value;
          } catch (exception2) {
            return reject(exception2);
          }
        }
        function _rejected(exception2) {
          if (typeof rejected === "function") {
            makeStackTraceLong(exception2, self2);
            try {
              return rejected(exception2);
            } catch (newException) {
              return reject(newException);
            }
          }
          return reject(exception2);
        }
        function _progressed(value) {
          return typeof progressed === "function" ? progressed(value) : value;
        }
        Q.nextTick(function() {
          self2.promiseDispatch(function(value) {
            if (done) {
              return;
            }
            done = true;
            deferred.resolve(_fulfilled(value));
          }, "when", [function(exception2) {
            if (done) {
              return;
            }
            done = true;
            deferred.resolve(_rejected(exception2));
          }]);
        });
        self2.promiseDispatch(void 0, "when", [void 0, function(value) {
          var newValue;
          var threw = false;
          try {
            newValue = _progressed(value);
          } catch (e) {
            threw = true;
            if (Q.onerror) {
              Q.onerror(e);
            } else {
              throw e;
            }
          }
          if (!threw) {
            deferred.notify(newValue);
          }
        }]);
        return deferred.promise;
      };
      Q.tap = function(promise2, callback) {
        return Q(promise2).tap(callback);
      };
      Promise2.prototype.tap = function(callback) {
        callback = Q(callback);
        return this.then(function(value) {
          return callback.fcall(value).thenResolve(value);
        });
      };
      Q.when = when;
      function when(value, fulfilled, rejected, progressed) {
        return Q(value).then(fulfilled, rejected, progressed);
      }
      Promise2.prototype.thenResolve = function(value) {
        return this.then(function() {
          return value;
        });
      };
      Q.thenResolve = function(promise2, value) {
        return Q(promise2).thenResolve(value);
      };
      Promise2.prototype.thenReject = function(reason) {
        return this.then(function() {
          throw reason;
        });
      };
      Q.thenReject = function(promise2, reason) {
        return Q(promise2).thenReject(reason);
      };
      Q.nearer = nearer;
      function nearer(value) {
        if (isPromise(value)) {
          var inspected = value.inspect();
          if (inspected.state === "fulfilled") {
            return inspected.value;
          }
        }
        return value;
      }
      Q.isPromise = isPromise;
      function isPromise(object) {
        return object instanceof Promise2;
      }
      Q.isPromiseAlike = isPromiseAlike;
      function isPromiseAlike(object) {
        return isObject2(object) && typeof object.then === "function";
      }
      Q.isPending = isPending;
      function isPending(object) {
        return isPromise(object) && object.inspect().state === "pending";
      }
      Promise2.prototype.isPending = function() {
        return this.inspect().state === "pending";
      };
      Q.isFulfilled = isFulfilled;
      function isFulfilled(object) {
        return !isPromise(object) || object.inspect().state === "fulfilled";
      }
      Promise2.prototype.isFulfilled = function() {
        return this.inspect().state === "fulfilled";
      };
      Q.isRejected = isRejected;
      function isRejected(object) {
        return isPromise(object) && object.inspect().state === "rejected";
      }
      Promise2.prototype.isRejected = function() {
        return this.inspect().state === "rejected";
      };
      var unhandledReasons = [];
      var unhandledRejections = [];
      var reportedUnhandledRejections = [];
      var trackUnhandledRejections = true;
      function resetUnhandledRejections() {
        unhandledReasons.length = 0;
        unhandledRejections.length = 0;
        if (!trackUnhandledRejections) {
          trackUnhandledRejections = true;
        }
      }
      function trackRejection(promise2, reason) {
        if (!trackUnhandledRejections) {
          return;
        }
        if (typeof process === "object" && typeof process.emit === "function") {
          Q.nextTick.runAfter(function() {
            if (array_indexOf(unhandledRejections, promise2) !== -1) {
              process.emit("unhandledRejection", reason, promise2);
              reportedUnhandledRejections.push(promise2);
            }
          });
        }
        unhandledRejections.push(promise2);
        if (reason && typeof reason.stack !== "undefined") {
          unhandledReasons.push(reason.stack);
        } else {
          unhandledReasons.push("(no stack) " + reason);
        }
      }
      function untrackRejection(promise2) {
        if (!trackUnhandledRejections) {
          return;
        }
        var at = array_indexOf(unhandledRejections, promise2);
        if (at !== -1) {
          if (typeof process === "object" && typeof process.emit === "function") {
            Q.nextTick.runAfter(function() {
              var atReport = array_indexOf(reportedUnhandledRejections, promise2);
              if (atReport !== -1) {
                process.emit("rejectionHandled", unhandledReasons[at], promise2);
                reportedUnhandledRejections.splice(atReport, 1);
              }
            });
          }
          unhandledRejections.splice(at, 1);
          unhandledReasons.splice(at, 1);
        }
      }
      Q.resetUnhandledRejections = resetUnhandledRejections;
      Q.getUnhandledReasons = function() {
        return unhandledReasons.slice();
      };
      Q.stopUnhandledRejectionTracking = function() {
        resetUnhandledRejections();
        trackUnhandledRejections = false;
      };
      resetUnhandledRejections();
      Q.reject = reject;
      function reject(reason) {
        var rejection = Promise2({
          "when": function(rejected) {
            if (rejected) {
              untrackRejection(this);
            }
            return rejected ? rejected(reason) : this;
          }
        }, function fallback() {
          return this;
        }, function inspect() {
          return { state: "rejected", reason };
        });
        trackRejection(rejection, reason);
        return rejection;
      }
      Q.fulfill = fulfill;
      function fulfill(value) {
        return Promise2({
          "when": function() {
            return value;
          },
          "get": function(name) {
            return value[name];
          },
          "set": function(name, rhs) {
            value[name] = rhs;
          },
          "delete": function(name) {
            delete value[name];
          },
          "post": function(name, args) {
            if (name === null || name === void 0) {
              return value.apply(void 0, args);
            } else {
              return value[name].apply(value, args);
            }
          },
          "apply": function(thisp, args) {
            return value.apply(thisp, args);
          },
          "keys": function() {
            return object_keys(value);
          }
        }, void 0, function inspect() {
          return { state: "fulfilled", value };
        });
      }
      function coerce(promise2) {
        var deferred = defer();
        Q.nextTick(function() {
          try {
            promise2.then(deferred.resolve, deferred.reject, deferred.notify);
          } catch (exception2) {
            deferred.reject(exception2);
          }
        });
        return deferred.promise;
      }
      Q.master = master;
      function master(object) {
        return Promise2({
          "isDef": function() {
          }
        }, function fallback(op, args) {
          return dispatch(object, op, args);
        }, function() {
          return Q(object).inspect();
        });
      }
      Q.spread = spread;
      function spread(value, fulfilled, rejected) {
        return Q(value).spread(fulfilled, rejected);
      }
      Promise2.prototype.spread = function(fulfilled, rejected) {
        return this.all().then(function(array) {
          return fulfilled.apply(void 0, array);
        }, rejected);
      };
      Q.async = async;
      function async(makeGenerator) {
        return function() {
          function continuer(verb, arg) {
            var result;
            if (typeof StopIteration === "undefined") {
              try {
                result = generator[verb](arg);
              } catch (exception2) {
                return reject(exception2);
              }
              if (result.done) {
                return Q(result.value);
              } else {
                return when(result.value, callback, errback);
              }
            } else {
              try {
                result = generator[verb](arg);
              } catch (exception2) {
                if (isStopIteration(exception2)) {
                  return Q(exception2.value);
                } else {
                  return reject(exception2);
                }
              }
              return when(result, callback, errback);
            }
          }
          var generator = makeGenerator.apply(this, arguments);
          var callback = continuer.bind(continuer, "next");
          var errback = continuer.bind(continuer, "throw");
          return callback();
        };
      }
      Q.spawn = spawn;
      function spawn(makeGenerator) {
        Q.done(Q.async(makeGenerator)());
      }
      Q["return"] = _return;
      function _return(value) {
        throw new QReturnValue(value);
      }
      Q.promised = promised;
      function promised(callback) {
        return function() {
          return spread([this, all(arguments)], function(self2, args) {
            return callback.apply(self2, args);
          });
        };
      }
      Q.dispatch = dispatch;
      function dispatch(object, op, args) {
        return Q(object).dispatch(op, args);
      }
      Promise2.prototype.dispatch = function(op, args) {
        var self2 = this;
        var deferred = defer();
        Q.nextTick(function() {
          self2.promiseDispatch(deferred.resolve, op, args);
        });
        return deferred.promise;
      };
      Q.get = function(object, key) {
        return Q(object).dispatch("get", [key]);
      };
      Promise2.prototype.get = function(key) {
        return this.dispatch("get", [key]);
      };
      Q.set = function(object, key, value) {
        return Q(object).dispatch("set", [key, value]);
      };
      Promise2.prototype.set = function(key, value) {
        return this.dispatch("set", [key, value]);
      };
      Q.del = // XXX legacy
      Q["delete"] = function(object, key) {
        return Q(object).dispatch("delete", [key]);
      };
      Promise2.prototype.del = // XXX legacy
      Promise2.prototype["delete"] = function(key) {
        return this.dispatch("delete", [key]);
      };
      Q.mapply = // XXX As proposed by "Redsandro"
      Q.post = function(object, name, args) {
        return Q(object).dispatch("post", [name, args]);
      };
      Promise2.prototype.mapply = // XXX As proposed by "Redsandro"
      Promise2.prototype.post = function(name, args) {
        return this.dispatch("post", [name, args]);
      };
      Q.send = // XXX Mark Miller's proposed parlance
      Q.mcall = // XXX As proposed by "Redsandro"
      Q.invoke = function(object, name) {
        return Q(object).dispatch("post", [name, array_slice(arguments, 2)]);
      };
      Promise2.prototype.send = // XXX Mark Miller's proposed parlance
      Promise2.prototype.mcall = // XXX As proposed by "Redsandro"
      Promise2.prototype.invoke = function(name) {
        return this.dispatch("post", [name, array_slice(arguments, 1)]);
      };
      Q.fapply = function(object, args) {
        return Q(object).dispatch("apply", [void 0, args]);
      };
      Promise2.prototype.fapply = function(args) {
        return this.dispatch("apply", [void 0, args]);
      };
      Q["try"] = Q.fcall = function(object) {
        return Q(object).dispatch("apply", [void 0, array_slice(arguments, 1)]);
      };
      Promise2.prototype.fcall = function() {
        return this.dispatch("apply", [void 0, array_slice(arguments)]);
      };
      Q.fbind = function(object) {
        var promise2 = Q(object);
        var args = array_slice(arguments, 1);
        return function fbound() {
          return promise2.dispatch("apply", [
            this,
            args.concat(array_slice(arguments))
          ]);
        };
      };
      Promise2.prototype.fbind = function() {
        var promise2 = this;
        var args = array_slice(arguments);
        return function fbound() {
          return promise2.dispatch("apply", [
            this,
            args.concat(array_slice(arguments))
          ]);
        };
      };
      Q.keys = function(object) {
        return Q(object).dispatch("keys", []);
      };
      Promise2.prototype.keys = function() {
        return this.dispatch("keys", []);
      };
      Q.all = all;
      function all(promises) {
        return when(promises, function(promises2) {
          var pendingCount = 0;
          var deferred = defer();
          array_reduce(promises2, function(undefined2, promise2, index) {
            var snapshot;
            if (isPromise(promise2) && (snapshot = promise2.inspect()).state === "fulfilled") {
              promises2[index] = snapshot.value;
            } else {
              ++pendingCount;
              when(
                promise2,
                function(value) {
                  promises2[index] = value;
                  if (--pendingCount === 0) {
                    deferred.resolve(promises2);
                  }
                },
                deferred.reject,
                function(progress2) {
                  deferred.notify({ index, value: progress2 });
                }
              );
            }
          }, void 0);
          if (pendingCount === 0) {
            deferred.resolve(promises2);
          }
          return deferred.promise;
        });
      }
      Promise2.prototype.all = function() {
        return all(this);
      };
      Q.any = any;
      function any(promises) {
        if (promises.length === 0) {
          return Q.resolve();
        }
        var deferred = Q.defer();
        var pendingCount = 0;
        array_reduce(promises, function(prev, current, index) {
          var promise2 = promises[index];
          pendingCount++;
          when(promise2, onFulfilled, onRejected, onProgress);
          function onFulfilled(result) {
            deferred.resolve(result);
          }
          function onRejected(err) {
            pendingCount--;
            if (pendingCount === 0) {
              var rejection = err || new Error("" + err);
              rejection.message = "Q can't get fulfillment value from any promise, all promises were rejected. Last error message: " + rejection.message;
              deferred.reject(rejection);
            }
          }
          function onProgress(progress2) {
            deferred.notify({
              index,
              value: progress2
            });
          }
        }, void 0);
        return deferred.promise;
      }
      Promise2.prototype.any = function() {
        return any(this);
      };
      Q.allResolved = deprecate(allResolved, "allResolved", "allSettled");
      function allResolved(promises) {
        return when(promises, function(promises2) {
          promises2 = array_map(promises2, Q);
          return when(all(array_map(promises2, function(promise2) {
            return when(promise2, noop, noop);
          })), function() {
            return promises2;
          });
        });
      }
      Promise2.prototype.allResolved = function() {
        return allResolved(this);
      };
      Q.allSettled = allSettled;
      function allSettled(promises) {
        return Q(promises).allSettled();
      }
      Promise2.prototype.allSettled = function() {
        return this.then(function(promises) {
          return all(array_map(promises, function(promise2) {
            promise2 = Q(promise2);
            function regardless() {
              return promise2.inspect();
            }
            return promise2.then(regardless, regardless);
          }));
        });
      };
      Q.fail = // XXX legacy
      Q["catch"] = function(object, rejected) {
        return Q(object).then(void 0, rejected);
      };
      Promise2.prototype.fail = // XXX legacy
      Promise2.prototype["catch"] = function(rejected) {
        return this.then(void 0, rejected);
      };
      Q.progress = progress;
      function progress(object, progressed) {
        return Q(object).then(void 0, void 0, progressed);
      }
      Promise2.prototype.progress = function(progressed) {
        return this.then(void 0, void 0, progressed);
      };
      Q.fin = // XXX legacy
      Q["finally"] = function(object, callback) {
        return Q(object)["finally"](callback);
      };
      Promise2.prototype.fin = // XXX legacy
      Promise2.prototype["finally"] = function(callback) {
        if (!callback || typeof callback.apply !== "function") {
          throw new Error("Q can't apply finally callback");
        }
        callback = Q(callback);
        return this.then(function(value) {
          return callback.fcall().then(function() {
            return value;
          });
        }, function(reason) {
          return callback.fcall().then(function() {
            throw reason;
          });
        });
      };
      Q.done = function(object, fulfilled, rejected, progress2) {
        return Q(object).done(fulfilled, rejected, progress2);
      };
      Promise2.prototype.done = function(fulfilled, rejected, progress2) {
        var onUnhandledError = function(error) {
          Q.nextTick(function() {
            makeStackTraceLong(error, promise2);
            if (Q.onerror) {
              Q.onerror(error);
            } else {
              throw error;
            }
          });
        };
        var promise2 = fulfilled || rejected || progress2 ? this.then(fulfilled, rejected, progress2) : this;
        if (typeof process === "object" && process && process.domain) {
          onUnhandledError = process.domain.bind(onUnhandledError);
        }
        promise2.then(void 0, onUnhandledError);
      };
      Q.timeout = function(object, ms, error) {
        return Q(object).timeout(ms, error);
      };
      Promise2.prototype.timeout = function(ms, error) {
        var deferred = defer();
        var timeoutId = setTimeout(function() {
          if (!error || "string" === typeof error) {
            error = new Error(error || "Timed out after " + ms + " ms");
            error.code = "ETIMEDOUT";
          }
          deferred.reject(error);
        }, ms);
        this.then(function(value) {
          clearTimeout(timeoutId);
          deferred.resolve(value);
        }, function(exception2) {
          clearTimeout(timeoutId);
          deferred.reject(exception2);
        }, deferred.notify);
        return deferred.promise;
      };
      Q.delay = function(object, timeout) {
        if (timeout === void 0) {
          timeout = object;
          object = void 0;
        }
        return Q(object).delay(timeout);
      };
      Promise2.prototype.delay = function(timeout) {
        return this.then(function(value) {
          var deferred = defer();
          setTimeout(function() {
            deferred.resolve(value);
          }, timeout);
          return deferred.promise;
        });
      };
      Q.nfapply = function(callback, args) {
        return Q(callback).nfapply(args);
      };
      Promise2.prototype.nfapply = function(args) {
        var deferred = defer();
        var nodeArgs = array_slice(args);
        nodeArgs.push(deferred.makeNodeResolver());
        this.fapply(nodeArgs).fail(deferred.reject);
        return deferred.promise;
      };
      Q.nfcall = function(callback) {
        var args = array_slice(arguments, 1);
        return Q(callback).nfapply(args);
      };
      Promise2.prototype.nfcall = function() {
        var nodeArgs = array_slice(arguments);
        var deferred = defer();
        nodeArgs.push(deferred.makeNodeResolver());
        this.fapply(nodeArgs).fail(deferred.reject);
        return deferred.promise;
      };
      Q.nfbind = Q.denodeify = function(callback) {
        if (callback === void 0) {
          throw new Error("Q can't wrap an undefined function");
        }
        var baseArgs = array_slice(arguments, 1);
        return function() {
          var nodeArgs = baseArgs.concat(array_slice(arguments));
          var deferred = defer();
          nodeArgs.push(deferred.makeNodeResolver());
          Q(callback).fapply(nodeArgs).fail(deferred.reject);
          return deferred.promise;
        };
      };
      Promise2.prototype.nfbind = Promise2.prototype.denodeify = function() {
        var args = array_slice(arguments);
        args.unshift(this);
        return Q.denodeify.apply(void 0, args);
      };
      Q.nbind = function(callback, thisp) {
        var baseArgs = array_slice(arguments, 2);
        return function() {
          var nodeArgs = baseArgs.concat(array_slice(arguments));
          var deferred = defer();
          nodeArgs.push(deferred.makeNodeResolver());
          function bound() {
            return callback.apply(thisp, arguments);
          }
          Q(bound).fapply(nodeArgs).fail(deferred.reject);
          return deferred.promise;
        };
      };
      Promise2.prototype.nbind = function() {
        var args = array_slice(arguments, 0);
        args.unshift(this);
        return Q.nbind.apply(void 0, args);
      };
      Q.nmapply = // XXX As proposed by "Redsandro"
      Q.npost = function(object, name, args) {
        return Q(object).npost(name, args);
      };
      Promise2.prototype.nmapply = // XXX As proposed by "Redsandro"
      Promise2.prototype.npost = function(name, args) {
        var nodeArgs = array_slice(args || []);
        var deferred = defer();
        nodeArgs.push(deferred.makeNodeResolver());
        this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
        return deferred.promise;
      };
      Q.nsend = // XXX Based on Mark Miller's proposed "send"
      Q.nmcall = // XXX Based on "Redsandro's" proposal
      Q.ninvoke = function(object, name) {
        var nodeArgs = array_slice(arguments, 2);
        var deferred = defer();
        nodeArgs.push(deferred.makeNodeResolver());
        Q(object).dispatch("post", [name, nodeArgs]).fail(deferred.reject);
        return deferred.promise;
      };
      Promise2.prototype.nsend = // XXX Based on Mark Miller's proposed "send"
      Promise2.prototype.nmcall = // XXX Based on "Redsandro's" proposal
      Promise2.prototype.ninvoke = function(name) {
        var nodeArgs = array_slice(arguments, 1);
        var deferred = defer();
        nodeArgs.push(deferred.makeNodeResolver());
        this.dispatch("post", [name, nodeArgs]).fail(deferred.reject);
        return deferred.promise;
      };
      Q.nodeify = nodeify;
      function nodeify(object, nodeback) {
        return Q(object).nodeify(nodeback);
      }
      Promise2.prototype.nodeify = function(nodeback) {
        if (nodeback) {
          this.then(function(value) {
            Q.nextTick(function() {
              nodeback(null, value);
            });
          }, function(error) {
            Q.nextTick(function() {
              nodeback(error);
            });
          });
        } else {
          return this;
        }
      };
      Q.noConflict = function() {
        throw new Error("Q.noConflict only works when Q is used as a global");
      };
      var qEndingLine = captureLine();
      return Q;
    });
  }
});

// node_modules/azure-pipelines-task-lib/toolrunner.js
var require_toolrunner = __commonJS({
  "node_modules/azure-pipelines-task-lib/toolrunner.js"(exports2) {
    "use strict";
    var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
      var extendStatics = function(d, b) {
        extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
          d2.__proto__ = b2;
        } || function(d2, b2) {
          for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
        };
        return extendStatics(d, b);
      };
      return function(d, b) {
        if (typeof b !== "function" && b !== null)
          throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() {
          this.constructor = d;
        }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
      };
    })();
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.ToolRunner = void 0;
    var Q = require_q();
    var os = require("os");
    var events = require("events");
    var child = require("child_process");
    var im = require_internal();
    var fs2 = require("fs");
    var ToolRunner = (
      /** @class */
      (function(_super) {
        __extends(ToolRunner2, _super);
        function ToolRunner2(toolPath) {
          var _this = _super.call(this) || this;
          _this.cmdSpecialChars = [" ", "	", "&", "(", ")", "[", "]", "{", "}", "^", "=", ";", "!", "'", "+", ",", "`", "~", "|", "<", ">", '"'];
          if (!toolPath) {
            throw new Error("Parameter 'toolPath' cannot be null or empty.");
          }
          _this.toolPath = im._which(toolPath, true);
          _this.args = [];
          _this._debug("toolRunner toolPath: " + toolPath);
          return _this;
        }
        ToolRunner2.prototype._debug = function(message) {
          this.emit("debug", message);
        };
        ToolRunner2.prototype._argStringToArray = function(argString) {
          var args = [];
          var inQuotes = false;
          var escaped = false;
          var lastCharWasSpace = true;
          var arg = "";
          var append = function(c2) {
            if (escaped) {
              if (c2 !== '"') {
                arg += "\\";
              } else {
                arg.slice(0, -1);
              }
            }
            arg += c2;
            escaped = false;
          };
          for (var i = 0; i < argString.length; i++) {
            var c = argString.charAt(i);
            if (c === " " && !inQuotes) {
              if (!lastCharWasSpace) {
                args.push(arg);
                arg = "";
              }
              lastCharWasSpace = true;
              continue;
            } else {
              lastCharWasSpace = false;
            }
            if (c === '"') {
              if (!escaped) {
                inQuotes = !inQuotes;
              } else {
                append(c);
              }
              continue;
            }
            if (c === "\\" && escaped) {
              append(c);
              continue;
            }
            if (c === "\\" && inQuotes) {
              escaped = true;
              continue;
            }
            append(c);
            lastCharWasSpace = false;
          }
          if (!lastCharWasSpace) {
            args.push(arg.trim());
          }
          return args;
        };
        ToolRunner2.prototype._getCommandString = function(options, noPrefix) {
          var _this = this;
          var toolPath = this._getSpawnFileName();
          var args = this._getSpawnArgs(options);
          var cmd = noPrefix ? "" : "[command]";
          var commandParts = [];
          if (process.platform == "win32") {
            if (this._isCmdFile()) {
              commandParts.push(toolPath);
              commandParts = commandParts.concat(args);
            } else if (options.windowsVerbatimArguments) {
              commandParts.push('"'.concat(toolPath, '"'));
              commandParts = commandParts.concat(args);
            } else if (options.shell) {
              commandParts.push(this._windowsQuoteCmdArg(toolPath));
              commandParts = commandParts.concat(args);
            } else {
              commandParts.push(this._windowsQuoteCmdArg(toolPath));
              commandParts = commandParts.concat(args.map(function(arg) {
                return _this._windowsQuoteCmdArg(arg);
              }));
            }
          } else {
            commandParts.push(toolPath);
            commandParts = commandParts.concat(args);
          }
          cmd += commandParts.join(" ");
          if (this.pipeOutputToTool) {
            cmd += " | " + this.pipeOutputToTool._getCommandString(
              options,
              /*noPrefix:*/
              true
            );
          }
          return cmd;
        };
        ToolRunner2.prototype._processLineBuffer = function(data, buffer, onLine) {
          var newBuffer = buffer + data.toString();
          try {
            var eolIndex = newBuffer.indexOf(os.EOL);
            while (eolIndex > -1) {
              var line = newBuffer.substring(0, eolIndex);
              onLine(line);
              newBuffer = newBuffer.substring(eolIndex + os.EOL.length);
              eolIndex = newBuffer.indexOf(os.EOL);
            }
          } catch (err) {
            this._debug("error processing line");
          }
          return newBuffer;
        };
        ToolRunner2.prototype._wrapArg = function(arg, wrapChar) {
          if (!this._isWrapped(arg, wrapChar)) {
            return "".concat(wrapChar).concat(arg).concat(wrapChar);
          }
          return arg;
        };
        ToolRunner2.prototype._unwrapArg = function(arg, wrapChar) {
          if (this._isWrapped(arg, wrapChar)) {
            var pattern = new RegExp("(^\\\\?".concat(wrapChar, ")|(\\\\?").concat(wrapChar, "$)"), "g");
            return arg.trim().replace(pattern, "");
          }
          return arg;
        };
        ToolRunner2.prototype._isWrapped = function(arg, wrapChar) {
          var pattern = new RegExp("^\\\\?".concat(wrapChar, ".+\\\\?").concat(wrapChar, "$"));
          return pattern.test(arg.trim());
        };
        ToolRunner2.prototype._getSpawnFileName = function(options) {
          if (process.platform == "win32") {
            if (this._isCmdFile()) {
              return process.env["COMSPEC"] || "cmd.exe";
            }
          }
          if (options && options.shell) {
            return this._wrapArg(this.toolPath, '"');
          }
          return this.toolPath;
        };
        ToolRunner2.prototype._getSpawnArgs = function(options) {
          var _this = this;
          if (process.platform == "win32") {
            if (this._isCmdFile()) {
              var argline = '/D /S /C "'.concat(this._windowsQuoteCmdArg(this.toolPath));
              for (var i = 0; i < this.args.length; i++) {
                argline += " ";
                argline += options.windowsVerbatimArguments ? this.args[i] : this._windowsQuoteCmdArg(this.args[i]);
              }
              argline += '"';
              return [argline];
            }
            if (options.windowsVerbatimArguments) {
              var args_1 = this.args.slice(0);
              args_1.slice = function() {
                if (arguments.length != 1 || arguments[0] != 0) {
                  throw new Error("Unexpected arguments passed to args.slice when windowsVerbatimArguments flag is set.");
                }
                return args_1;
              };
              args_1.unshift = function() {
                if (arguments.length != 1) {
                  throw new Error("Unexpected arguments passed to args.unshift when windowsVerbatimArguments flag is set.");
                }
                return Array.prototype.unshift.call(args_1, '"'.concat(arguments[0], '"'));
              };
              return args_1;
            } else if (options.shell) {
              var args = [];
              for (var _i = 0, _a = this.args; _i < _a.length; _i++) {
                var arg = _a[_i];
                if (this._needQuotesForCmd(arg, "%")) {
                  args.push(this._wrapArg(arg, '"'));
                } else {
                  args.push(arg);
                }
              }
              return args;
            }
          } else if (options.shell) {
            return this.args.map(function(arg2) {
              if (_this._isWrapped(arg2, "'")) {
                return arg2;
              }
              arg2 = _this._unwrapArg(arg2, '"');
              arg2 = _this._escapeChar(arg2, '"');
              return _this._wrapArg(arg2, '"');
            });
          }
          return this.args;
        };
        ToolRunner2.prototype._escapeChar = function(arg, charToEscape) {
          var escChar = "\\";
          var output = "";
          var charIsEscaped = false;
          for (var _i = 0, arg_1 = arg; _i < arg_1.length; _i++) {
            var char = arg_1[_i];
            if (char === charToEscape && !charIsEscaped) {
              output += escChar + char;
            } else {
              output += char;
            }
            charIsEscaped = char === escChar && !charIsEscaped;
          }
          return output;
        };
        ToolRunner2.prototype._isCmdFile = function() {
          var upperToolPath = this.toolPath.toUpperCase();
          return im._endsWith(upperToolPath, ".CMD") || im._endsWith(upperToolPath, ".BAT");
        };
        ToolRunner2.prototype._needQuotesForCmd = function(arg, additionalChars) {
          var specialChars = this.cmdSpecialChars;
          if (additionalChars) {
            specialChars = this.cmdSpecialChars.concat(additionalChars);
          }
          var _loop_1 = function(char2) {
            if (specialChars.some(function(x) {
              return x === char2;
            })) {
              return { value: true };
            }
          };
          for (var _i = 0, arg_2 = arg; _i < arg_2.length; _i++) {
            var char = arg_2[_i];
            var state_1 = _loop_1(char);
            if (typeof state_1 === "object")
              return state_1.value;
          }
          return false;
        };
        ToolRunner2.prototype._windowsQuoteCmdArg = function(arg) {
          if (!this._isCmdFile()) {
            return this._uv_quote_cmd_arg(arg);
          }
          if (!arg) {
            return '""';
          }
          var needsQuotes = this._needQuotesForCmd(arg);
          if (!needsQuotes) {
            return arg;
          }
          var reverse = '"';
          var quote_hit = true;
          for (var i = arg.length; i > 0; i--) {
            reverse += arg[i - 1];
            if (quote_hit && arg[i - 1] == "\\") {
              reverse += "\\";
            } else if (arg[i - 1] == '"') {
              quote_hit = true;
              reverse += '"';
            } else {
              quote_hit = false;
            }
          }
          reverse += '"';
          return reverse.split("").reverse().join("");
        };
        ToolRunner2.prototype._uv_quote_cmd_arg = function(arg) {
          if (!arg) {
            return '""';
          }
          if (arg.indexOf(" ") < 0 && arg.indexOf("	") < 0 && arg.indexOf('"') < 0) {
            return arg;
          }
          if (arg.indexOf('"') < 0 && arg.indexOf("\\") < 0) {
            return '"'.concat(arg, '"');
          }
          var reverse = '"';
          var quote_hit = true;
          for (var i = arg.length; i > 0; i--) {
            reverse += arg[i - 1];
            if (quote_hit && arg[i - 1] == "\\") {
              reverse += "\\";
            } else if (arg[i - 1] == '"') {
              quote_hit = true;
              reverse += "\\";
            } else {
              quote_hit = false;
            }
          }
          reverse += '"';
          return reverse.split("").reverse().join("");
        };
        ToolRunner2.prototype._cloneExecOptions = function(options) {
          options = options || {};
          var result = {
            cwd: options.cwd || process.cwd(),
            env: options.env || process.env,
            silent: options.silent || false,
            failOnStdErr: options.failOnStdErr || false,
            ignoreReturnCode: options.ignoreReturnCode || false,
            windowsVerbatimArguments: options.windowsVerbatimArguments || false,
            shell: options.shell || false
          };
          result.outStream = options.outStream || process.stdout;
          result.errStream = options.errStream || process.stderr;
          return result;
        };
        ToolRunner2.prototype._getSpawnOptions = function(options) {
          options = options || {};
          var result = {};
          result.cwd = options.cwd;
          result.env = options.env;
          result.shell = options.shell;
          result["windowsVerbatimArguments"] = options.windowsVerbatimArguments || this._isCmdFile();
          return result;
        };
        ToolRunner2.prototype._getSpawnSyncOptions = function(options) {
          var result = {};
          result.maxBuffer = 1024 * 1024 * 1024;
          result.cwd = options.cwd;
          result.env = options.env;
          result.shell = options.shell;
          result["windowsVerbatimArguments"] = options.windowsVerbatimArguments || this._isCmdFile();
          return result;
        };
        ToolRunner2.prototype.execWithPipingAsync = function(pipeOutputToTool, options) {
          var _this = this;
          this._debug("exec tool: " + this.toolPath);
          this._debug("arguments:");
          this.args.forEach(function(arg) {
            _this._debug("   " + arg);
          });
          var success = true;
          var optionsNonNull = this._cloneExecOptions(options);
          if (!optionsNonNull.silent) {
            optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
          }
          var cp;
          var toolPath = pipeOutputToTool.toolPath;
          var toolPathFirst;
          var successFirst = true;
          var returnCodeFirst;
          var fileStream;
          var waitingEvents = 0;
          var returnCode = 0;
          var error;
          toolPathFirst = this.toolPath;
          waitingEvents++;
          var cpFirst = child.spawn(this._getSpawnFileName(optionsNonNull), this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(optionsNonNull));
          waitingEvents++;
          cp = child.spawn(pipeOutputToTool._getSpawnFileName(optionsNonNull), pipeOutputToTool._getSpawnArgs(optionsNonNull), pipeOutputToTool._getSpawnOptions(optionsNonNull));
          fileStream = this.pipeOutputToFile ? fs2.createWriteStream(this.pipeOutputToFile) : null;
          return new Promise(function(resolve, reject) {
            var _a, _b, _c, _d;
            if (fileStream) {
              waitingEvents++;
              fileStream.on("finish", function() {
                waitingEvents--;
                fileStream = null;
                if (waitingEvents == 0) {
                  if (error) {
                    reject(error);
                  } else {
                    resolve(returnCode);
                  }
                }
              });
              fileStream.on("error", function(err) {
                waitingEvents--;
                _this._debug("Failed to pipe output of ".concat(toolPathFirst, " to file ").concat(_this.pipeOutputToFile, ". Error = ").concat(err));
                fileStream = null;
                if (waitingEvents == 0) {
                  if (error) {
                    reject(error);
                  } else {
                    resolve(returnCode);
                  }
                }
              });
            }
            (_a = cpFirst.stdout) === null || _a === void 0 ? void 0 : _a.on("data", function(data) {
              var _a2, _b2;
              try {
                if (fileStream) {
                  fileStream.write(data);
                }
                if (!((_a2 = cp.stdin) === null || _a2 === void 0 ? void 0 : _a2.destroyed)) {
                  (_b2 = cp.stdin) === null || _b2 === void 0 ? void 0 : _b2.write(data);
                }
              } catch (err) {
                _this._debug("Failed to pipe output of " + toolPathFirst + " to " + toolPath);
                _this._debug(toolPath + " might have exited due to errors prematurely. Verify the arguments passed are valid.");
              }
            });
            (_b = cpFirst.stderr) === null || _b === void 0 ? void 0 : _b.on("data", function(data) {
              if (fileStream) {
                fileStream.write(data);
              }
              successFirst = !optionsNonNull.failOnStdErr;
              if (!optionsNonNull.silent) {
                var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream;
                s.write(data);
              }
            });
            cpFirst.on("error", function(err) {
              var _a2;
              waitingEvents--;
              if (fileStream) {
                fileStream.end();
              }
              (_a2 = cp.stdin) === null || _a2 === void 0 ? void 0 : _a2.end();
              error = new Error(toolPathFirst + " failed. " + err.message);
              if (waitingEvents == 0) {
                reject(error);
              }
            });
            cpFirst.on("close", function(code, signal) {
              var _a2;
              waitingEvents--;
              if (code != 0 && !optionsNonNull.ignoreReturnCode) {
                successFirst = false;
                returnCodeFirst = code;
                returnCode = returnCodeFirst;
              }
              _this._debug("success of first tool:" + successFirst);
              if (fileStream) {
                fileStream.end();
              }
              (_a2 = cp.stdin) === null || _a2 === void 0 ? void 0 : _a2.end();
              if (waitingEvents == 0) {
                if (error) {
                  reject(error);
                } else {
                  resolve(returnCode);
                }
              }
            });
            var stdLineBuffer = "";
            (_c = cp.stdout) === null || _c === void 0 ? void 0 : _c.on("data", function(data) {
              _this.emit("stdout", data);
              if (!optionsNonNull.silent) {
                optionsNonNull.outStream.write(data);
              }
              stdLineBuffer = _this._processLineBuffer(data, stdLineBuffer, function(line) {
                _this.emit("stdline", line);
              });
            });
            var errLineBuffer = "";
            (_d = cp.stderr) === null || _d === void 0 ? void 0 : _d.on("data", function(data) {
              _this.emit("stderr", data);
              success = !optionsNonNull.failOnStdErr;
              if (!optionsNonNull.silent) {
                var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream;
                s.write(data);
              }
              errLineBuffer = _this._processLineBuffer(data, errLineBuffer, function(line) {
                _this.emit("errline", line);
              });
            });
            cp.on("error", function(err) {
              waitingEvents--;
              error = new Error(toolPath + " failed. " + err.message);
              if (waitingEvents == 0) {
                reject(error);
              }
            });
            cp.on("close", function(code, signal) {
              waitingEvents--;
              _this._debug("rc:" + code);
              returnCode = code;
              if (stdLineBuffer.length > 0) {
                _this.emit("stdline", stdLineBuffer);
              }
              if (errLineBuffer.length > 0) {
                _this.emit("errline", errLineBuffer);
              }
              if (code != 0 && !optionsNonNull.ignoreReturnCode) {
                success = false;
              }
              _this._debug("success:" + success);
              if (!successFirst) {
                error = new Error(toolPathFirst + " failed with return code: " + returnCodeFirst);
              } else if (!success) {
                error = new Error(toolPath + " failed with return code: " + code);
              }
              if (waitingEvents == 0) {
                if (error) {
                  reject(error);
                } else {
                  resolve(returnCode);
                }
              }
            });
          });
        };
        ToolRunner2.prototype.execWithPiping = function(pipeOutputToTool, options) {
          var _this = this;
          var _a, _b, _c, _d;
          var defer = Q.defer();
          this._debug("exec tool: " + this.toolPath);
          this._debug("arguments:");
          this.args.forEach(function(arg) {
            _this._debug("   " + arg);
          });
          var success = true;
          var optionsNonNull = this._cloneExecOptions(options);
          if (!optionsNonNull.silent) {
            optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
          }
          var cp;
          var toolPath = pipeOutputToTool.toolPath;
          var toolPathFirst;
          var successFirst = true;
          var returnCodeFirst;
          var fileStream;
          var waitingEvents = 0;
          var returnCode = 0;
          var error;
          toolPathFirst = this.toolPath;
          waitingEvents++;
          var cpFirst = child.spawn(this._getSpawnFileName(optionsNonNull), this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(optionsNonNull));
          waitingEvents++;
          cp = child.spawn(pipeOutputToTool._getSpawnFileName(optionsNonNull), pipeOutputToTool._getSpawnArgs(optionsNonNull), pipeOutputToTool._getSpawnOptions(optionsNonNull));
          fileStream = this.pipeOutputToFile ? fs2.createWriteStream(this.pipeOutputToFile) : null;
          if (fileStream) {
            waitingEvents++;
            fileStream.on("finish", function() {
              waitingEvents--;
              fileStream = null;
              if (waitingEvents == 0) {
                if (error) {
                  defer.reject(error);
                } else {
                  defer.resolve(returnCode);
                }
              }
            });
            fileStream.on("error", function(err) {
              waitingEvents--;
              _this._debug("Failed to pipe output of ".concat(toolPathFirst, " to file ").concat(_this.pipeOutputToFile, ". Error = ").concat(err));
              fileStream = null;
              if (waitingEvents == 0) {
                if (error) {
                  defer.reject(error);
                } else {
                  defer.resolve(returnCode);
                }
              }
            });
          }
          (_a = cpFirst.stdout) === null || _a === void 0 ? void 0 : _a.on("data", function(data) {
            var _a2;
            try {
              if (fileStream) {
                fileStream.write(data);
              }
              (_a2 = cp.stdin) === null || _a2 === void 0 ? void 0 : _a2.write(data);
            } catch (err) {
              _this._debug("Failed to pipe output of " + toolPathFirst + " to " + toolPath);
              _this._debug(toolPath + " might have exited due to errors prematurely. Verify the arguments passed are valid.");
            }
          });
          (_b = cpFirst.stderr) === null || _b === void 0 ? void 0 : _b.on("data", function(data) {
            if (fileStream) {
              fileStream.write(data);
            }
            successFirst = !optionsNonNull.failOnStdErr;
            if (!optionsNonNull.silent) {
              var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream;
              s.write(data);
            }
          });
          cpFirst.on("error", function(err) {
            var _a2;
            waitingEvents--;
            if (fileStream) {
              fileStream.end();
            }
            (_a2 = cp.stdin) === null || _a2 === void 0 ? void 0 : _a2.end();
            error = new Error(toolPathFirst + " failed. " + err.message);
            if (waitingEvents == 0) {
              defer.reject(error);
            }
          });
          cpFirst.on("close", function(code, signal) {
            var _a2;
            waitingEvents--;
            if (code != 0 && !optionsNonNull.ignoreReturnCode) {
              successFirst = false;
              returnCodeFirst = code;
              returnCode = returnCodeFirst;
            }
            _this._debug("success of first tool:" + successFirst);
            if (fileStream) {
              fileStream.end();
            }
            (_a2 = cp.stdin) === null || _a2 === void 0 ? void 0 : _a2.end();
            if (waitingEvents == 0) {
              if (error) {
                defer.reject(error);
              } else {
                defer.resolve(returnCode);
              }
            }
          });
          var stdLineBuffer = "";
          (_c = cp.stdout) === null || _c === void 0 ? void 0 : _c.on("data", function(data) {
            _this.emit("stdout", data);
            if (!optionsNonNull.silent) {
              optionsNonNull.outStream.write(data);
            }
            stdLineBuffer = _this._processLineBuffer(data, stdLineBuffer, function(line) {
              _this.emit("stdline", line);
            });
          });
          var errLineBuffer = "";
          (_d = cp.stderr) === null || _d === void 0 ? void 0 : _d.on("data", function(data) {
            _this.emit("stderr", data);
            success = !optionsNonNull.failOnStdErr;
            if (!optionsNonNull.silent) {
              var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream;
              s.write(data);
            }
            errLineBuffer = _this._processLineBuffer(data, errLineBuffer, function(line) {
              _this.emit("errline", line);
            });
          });
          cp.on("error", function(err) {
            waitingEvents--;
            error = new Error(toolPath + " failed. " + err.message);
            if (waitingEvents == 0) {
              defer.reject(error);
            }
          });
          cp.on("close", function(code, signal) {
            waitingEvents--;
            _this._debug("rc:" + code);
            returnCode = code;
            if (stdLineBuffer.length > 0) {
              _this.emit("stdline", stdLineBuffer);
            }
            if (errLineBuffer.length > 0) {
              _this.emit("errline", errLineBuffer);
            }
            if (code != 0 && !optionsNonNull.ignoreReturnCode) {
              success = false;
            }
            _this._debug("success:" + success);
            if (!successFirst) {
              error = new Error(toolPathFirst + " failed with return code: " + returnCodeFirst);
            } else if (!success) {
              error = new Error(toolPath + " failed with return code: " + code);
            }
            if (waitingEvents == 0) {
              if (error) {
                defer.reject(error);
              } else {
                defer.resolve(returnCode);
              }
            }
          });
          return defer.promise;
        };
        ToolRunner2.prototype.arg = function(val) {
          if (!val) {
            return this;
          }
          if (val instanceof Array) {
            this._debug(this.toolPath + " arg: " + JSON.stringify(val));
            this.args = this.args.concat(val);
          } else if (typeof val === "string") {
            this._debug(this.toolPath + " arg: " + val);
            this.args = this.args.concat(val.trim());
          }
          return this;
        };
        ToolRunner2.prototype.line = function(val) {
          if (!val) {
            return this;
          }
          this._debug(this.toolPath + " arg: " + val);
          this.args = this.args.concat(this._argStringToArray(val));
          return this;
        };
        ToolRunner2.prototype.argIf = function(condition, val) {
          if (condition) {
            this.arg(val);
          }
          return this;
        };
        ToolRunner2.prototype.pipeExecOutputToTool = function(tool, file) {
          this.pipeOutputToTool = tool;
          this.pipeOutputToFile = file;
          return this;
        };
        ToolRunner2.prototype.execAsync = function(options) {
          var _this = this;
          var _a, _b, _c;
          if (this.pipeOutputToTool) {
            return this.execWithPipingAsync(this.pipeOutputToTool, options);
          }
          this._debug("exec tool: " + this.toolPath);
          this._debug("arguments:");
          this.args.forEach(function(arg) {
            _this._debug("   " + arg);
          });
          var optionsNonNull = this._cloneExecOptions(options);
          if (!optionsNonNull.silent) {
            optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
          }
          var state = new ExecState(optionsNonNull, this.toolPath);
          state.on("debug", function(message) {
            _this._debug(message);
          });
          var stdLineBuffer = "";
          var errLineBuffer = "";
          var emitDoneEvent = function(resolve, reject) {
            state.on("done", function(error, exitCode) {
              if (stdLineBuffer.length > 0) {
                _this.emit("stdline", stdLineBuffer);
              }
              if (errLineBuffer.length > 0) {
                _this.emit("errline", errLineBuffer);
              }
              if (cp) {
                cp.removeAllListeners();
              }
              if (error) {
                reject(error);
              } else {
                resolve(exitCode);
              }
            });
          };
          var cp;
          try {
            cp = child.spawn(this._getSpawnFileName(options), this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(options));
          } catch (error) {
            return new Promise(function(resolve, reject) {
              emitDoneEvent(resolve, reject);
              state.processError = error.message;
              state.processExited = true;
              state.processClosed = true;
              state.CheckComplete();
            });
          }
          this.childProcess = cp;
          (_a = cp.stdout) === null || _a === void 0 ? void 0 : _a.on("finish", function() {
            if (!optionsNonNull.silent) {
              optionsNonNull.outStream.write(os.EOL);
            }
          });
          (_b = cp.stdout) === null || _b === void 0 ? void 0 : _b.on("data", function(data) {
            _this.emit("stdout", data);
            if (!optionsNonNull.silent) {
              optionsNonNull.outStream.write(data);
            }
            stdLineBuffer = _this._processLineBuffer(data, stdLineBuffer, function(line) {
              _this.emit("stdline", line);
            });
          });
          (_c = cp.stderr) === null || _c === void 0 ? void 0 : _c.on("data", function(data) {
            state.processStderr = true;
            _this.emit("stderr", data);
            if (!optionsNonNull.silent) {
              var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream;
              s.write(data);
            }
            errLineBuffer = _this._processLineBuffer(data, errLineBuffer, function(line) {
              _this.emit("errline", line);
            });
          });
          cp.on("error", function(err) {
            state.processError = err.message;
            state.processExited = true;
            state.processClosed = true;
            state.CheckComplete();
          });
          cp.on("exit", function(code, signal) {
            state.processExitCode = code;
            state.processExitSignal = signal;
            state.processExited = true;
            state.CheckComplete();
          });
          cp.on("close", function(code, signal) {
            state.processCloseCode = code;
            state.processCloseSignal = signal;
            state.processClosed = true;
            state.processExited = true;
            state.CheckComplete();
          });
          return new Promise(emitDoneEvent);
        };
        ToolRunner2.prototype.exec = function(options) {
          var _this = this;
          var _a, _b, _c;
          if (this.pipeOutputToTool) {
            return this.execWithPiping(this.pipeOutputToTool, options);
          }
          var defer = Q.defer();
          this._debug("exec tool: " + this.toolPath);
          this._debug("arguments:");
          this.args.forEach(function(arg) {
            _this._debug("   " + arg);
          });
          var optionsNonNull = this._cloneExecOptions(options);
          if (!optionsNonNull.silent) {
            optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
          }
          var state = new ExecState(optionsNonNull, this.toolPath);
          state.on("debug", function(message) {
            _this._debug(message);
          });
          var stdLineBuffer = "";
          var errLineBuffer = "";
          state.on("done", function(error, exitCode) {
            if (stdLineBuffer.length > 0) {
              _this.emit("stdline", stdLineBuffer);
            }
            if (errLineBuffer.length > 0) {
              _this.emit("errline", errLineBuffer);
            }
            if (cp) {
              cp.removeAllListeners();
            }
            if (error) {
              defer.reject(error);
            } else {
              defer.resolve(exitCode);
            }
          });
          var cp;
          try {
            cp = child.spawn(this._getSpawnFileName(options), this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(options));
          } catch (error) {
            state.processError = error.message;
            state.processExited = true;
            state.processClosed = true;
            state.CheckComplete();
            return defer.promise;
          }
          this.childProcess = cp;
          (_a = cp.stdout) === null || _a === void 0 ? void 0 : _a.on("finish", function() {
            if (!optionsNonNull.silent) {
              optionsNonNull.outStream.write(os.EOL);
            }
          });
          (_b = cp.stdout) === null || _b === void 0 ? void 0 : _b.on("data", function(data) {
            _this.emit("stdout", data);
            if (!optionsNonNull.silent) {
              optionsNonNull.outStream.write(data);
            }
            stdLineBuffer = _this._processLineBuffer(data, stdLineBuffer, function(line) {
              _this.emit("stdline", line);
            });
          });
          (_c = cp.stderr) === null || _c === void 0 ? void 0 : _c.on("data", function(data) {
            state.processStderr = true;
            _this.emit("stderr", data);
            if (!optionsNonNull.silent) {
              var s = optionsNonNull.failOnStdErr ? optionsNonNull.errStream : optionsNonNull.outStream;
              s.write(data);
            }
            errLineBuffer = _this._processLineBuffer(data, errLineBuffer, function(line) {
              _this.emit("errline", line);
            });
          });
          cp.on("error", function(err) {
            state.processError = err.message;
            state.processExited = true;
            state.processClosed = true;
            state.CheckComplete();
          });
          cp.on("exit", function(code, signal) {
            state.processExitCode = code;
            state.processExitSignal = signal;
            state.processExited = true;
            state.CheckComplete();
          });
          cp.on("close", function(code, signal) {
            state.processCloseCode = code;
            state.processCloseSignal = signal;
            state.processClosed = true;
            state.processExited = true;
            state.CheckComplete();
          });
          return defer.promise;
        };
        ToolRunner2.prototype.execSync = function(options) {
          var _this = this;
          this._debug("exec tool: " + this.toolPath);
          this._debug("arguments:");
          this.args.forEach(function(arg) {
            _this._debug("   " + arg);
          });
          var success = true;
          options = this._cloneExecOptions(options);
          if (!options.silent) {
            options.outStream.write(this._getCommandString(options) + os.EOL);
          }
          var r = child.spawnSync(this._getSpawnFileName(options), this._getSpawnArgs(options), this._getSpawnSyncOptions(options));
          if (!options.silent && r.stdout && r.stdout.length > 0) {
            options.outStream.write(r.stdout);
          }
          if (!options.silent && r.stderr && r.stderr.length > 0) {
            options.errStream.write(r.stderr);
          }
          var res = { code: r.status, error: r.error };
          res.stdout = r.stdout ? r.stdout.toString() : "";
          res.stderr = r.stderr ? r.stderr.toString() : "";
          return res;
        };
        ToolRunner2.prototype.killChildProcess = function(signal) {
          if (signal === void 0) {
            signal = "SIGTERM";
          }
          if (this.childProcess) {
            this._debug("[killChildProcess] Signal ".concat(signal, " received"));
            this.childProcess.kill(signal);
          }
        };
        return ToolRunner2;
      })(events.EventEmitter)
    );
    exports2.ToolRunner = ToolRunner;
    var ExecState = (
      /** @class */
      (function(_super) {
        __extends(ExecState2, _super);
        function ExecState2(options, toolPath) {
          var _this = _super.call(this) || this;
          _this.delay = 1e4;
          _this.timeout = null;
          if (!toolPath) {
            throw new Error("toolPath must not be empty");
          }
          _this.options = options;
          _this.toolPath = toolPath;
          var delay = process.env["TASKLIB_TEST_TOOLRUNNER_EXITDELAY"];
          if (delay) {
            _this.delay = parseInt(delay);
          }
          return _this;
        }
        ExecState2.prototype.CheckComplete = function() {
          if (this.done) {
            return;
          }
          if (this.processClosed) {
            this._setResult();
          } else if (this.processExited) {
            this.timeout = setTimeout(ExecState2.HandleTimeout, this.delay, this);
          }
        };
        ExecState2.prototype._debug = function(message) {
          this.emit("debug", message);
        };
        ExecState2.prototype._setResult = function() {
          var error;
          if (this.processExited) {
            this._debug("Process exited with code ".concat(this.processExitCode, " and signal ").concat(this.processExitSignal, " for tool '").concat(this.toolPath, "'"));
            if (this.processError) {
              error = new Error(im._loc("LIB_ProcessError", this.toolPath, this.processError));
            } else if (this.processExitCode != 0 && !this.options.ignoreReturnCode) {
              error = new Error(im._loc("LIB_ProcessExitCode", this.toolPath, this.processExitCode));
            } else if (this.processStderr && this.options.failOnStdErr) {
              error = new Error(im._loc("LIB_ProcessStderr", this.toolPath));
            }
          }
          if (this.processClosed) {
            this._debug("STDIO streams have closed and received exit code ".concat(this.processCloseCode, " and signal ").concat(this.processCloseSignal, " for tool '").concat(this.toolPath, "'"));
          }
          if (this.timeout) {
            clearTimeout(this.timeout);
            this.timeout = null;
          }
          this.done = true;
          this.emit("done", error, this.processExitCode);
        };
        ExecState2.HandleTimeout = function(state) {
          if (state.done) {
            return;
          }
          if (!state.processClosed && state.processExited) {
            console.log(im._loc("LIB_StdioNotClosed", state.delay / 1e3, state.toolPath));
            state._debug(im._loc("LIB_StdioNotClosed", state.delay / 1e3, state.toolPath));
          }
          state._setResult();
        };
        return ExecState2;
      })(events.EventEmitter)
    );
  }
});

// node_modules/azure-pipelines-task-lib/task.js
var require_task = __commonJS({
  "node_modules/azure-pipelines-task-lib/task.js"(exports2) {
    "use strict";
    var __spreadArray = exports2 && exports2.__spreadArray || function(to, from, pack) {
      if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
          if (!ar) ar = Array.prototype.slice.call(from, 0, i);
          ar[i] = from[i];
        }
      }
      return to.concat(ar || Array.prototype.slice.call(from));
    };
    Object.defineProperty(exports2, "__esModule", { value: true });
    exports2.getPlatform = exports2.osType = exports2.writeFile = exports2.exist = exports2.stats = exports2.debug = exports2.error = exports2.warning = exports2.command = exports2.setTaskVariable = exports2.getTaskVariable = exports2.getSecureFileTicket = exports2.getSecureFileName = exports2.getEndpointAuthorization = exports2.getEndpointAuthorizationParameterRequired = exports2.getEndpointAuthorizationParameter = exports2.getEndpointAuthorizationSchemeRequired = exports2.getEndpointAuthorizationScheme = exports2.getEndpointDataParameterRequired = exports2.getEndpointDataParameter = exports2.getEndpointUrlRequired = exports2.getEndpointUrl = exports2.getPathInputRequired = exports2.getPathInput = exports2.filePathSupplied = exports2.getDelimitedInput = exports2.getPipelineFeature = exports2.getBoolFeatureFlag = exports2.getBoolInput = exports2.getInputRequired = exports2.getInput = exports2.setSecret = exports2.setVariable = exports2.getVariables = exports2.assertAgent = exports2.getVariable = exports2.loc = exports2.setResourcePath = exports2.setSanitizedResult = exports2.setResult = exports2.setErrStream = exports2.setStdStream = exports2.AgentHostedMode = exports2.Platform = exports2.IssueSource = exports2.FieldType = exports2.ArtifactType = exports2.IssueType = exports2.TaskState = exports2.TaskResult = void 0;
    exports2.updateReleaseName = exports2.addBuildTag = exports2.updateBuildNumber = exports2.uploadBuildLog = exports2.associateArtifact = exports2.uploadArtifact = exports2.logIssue = exports2.logDetail = exports2.setProgress = exports2.setEndpoint = exports2.addAttachment = exports2.uploadSummary = exports2.prependPath = exports2.uploadFile = exports2.CodeCoverageEnabler = exports2.CodeCoveragePublisher = exports2.TestPublisher = exports2.getHttpCertConfiguration = exports2.getHttpProxyConfiguration = exports2.findMatch = exports2.filter = exports2.match = exports2.tool = exports2.execSync = exports2.exec = exports2.execAsync = exports2.rmRF = exports2.legacyFindFiles = exports2.find = exports2.retry = exports2.mv = exports2.cp = exports2.ls = exports2.which = exports2.resolve = exports2.mkdirP = exports2.popd = exports2.pushd = exports2.cd = exports2.checkPath = exports2.cwd = exports2.getSprint = exports2.getAgentMode = exports2.getNodeMajorVersion = void 0;
    var childProcess = require("child_process");
    var fs2 = require("fs");
    var path2 = require("path");
    var os = require("os");
    var minimatch = require_minimatch();
    var im = require_internal();
    var tcm = require_taskcommand();
    var trm = require_toolrunner();
    var semver = require_semver();
    var TaskResult2;
    (function(TaskResult3) {
      TaskResult3[TaskResult3["Succeeded"] = 0] = "Succeeded";
      TaskResult3[TaskResult3["SucceededWithIssues"] = 1] = "SucceededWithIssues";
      TaskResult3[TaskResult3["Failed"] = 2] = "Failed";
      TaskResult3[TaskResult3["Cancelled"] = 3] = "Cancelled";
      TaskResult3[TaskResult3["Skipped"] = 4] = "Skipped";
    })(TaskResult2 = exports2.TaskResult || (exports2.TaskResult = {}));
    var TaskState;
    (function(TaskState2) {
      TaskState2[TaskState2["Unknown"] = 0] = "Unknown";
      TaskState2[TaskState2["Initialized"] = 1] = "Initialized";
      TaskState2[TaskState2["InProgress"] = 2] = "InProgress";
      TaskState2[TaskState2["Completed"] = 3] = "Completed";
    })(TaskState = exports2.TaskState || (exports2.TaskState = {}));
    var IssueType;
    (function(IssueType2) {
      IssueType2[IssueType2["Error"] = 0] = "Error";
      IssueType2[IssueType2["Warning"] = 1] = "Warning";
    })(IssueType = exports2.IssueType || (exports2.IssueType = {}));
    var ArtifactType;
    (function(ArtifactType2) {
      ArtifactType2[ArtifactType2["Container"] = 0] = "Container";
      ArtifactType2[ArtifactType2["FilePath"] = 1] = "FilePath";
      ArtifactType2[ArtifactType2["VersionControl"] = 2] = "VersionControl";
      ArtifactType2[ArtifactType2["GitRef"] = 3] = "GitRef";
      ArtifactType2[ArtifactType2["TfvcLabel"] = 4] = "TfvcLabel";
    })(ArtifactType = exports2.ArtifactType || (exports2.ArtifactType = {}));
    var FieldType;
    (function(FieldType2) {
      FieldType2[FieldType2["AuthParameter"] = 0] = "AuthParameter";
      FieldType2[FieldType2["DataParameter"] = 1] = "DataParameter";
      FieldType2[FieldType2["Url"] = 2] = "Url";
    })(FieldType = exports2.FieldType || (exports2.FieldType = {}));
    exports2.IssueSource = im.IssueSource;
    var Platform;
    (function(Platform2) {
      Platform2[Platform2["Windows"] = 0] = "Windows";
      Platform2[Platform2["MacOS"] = 1] = "MacOS";
      Platform2[Platform2["Linux"] = 2] = "Linux";
    })(Platform = exports2.Platform || (exports2.Platform = {}));
    var AgentHostedMode;
    (function(AgentHostedMode2) {
      AgentHostedMode2[AgentHostedMode2["Unknown"] = 0] = "Unknown";
      AgentHostedMode2[AgentHostedMode2["SelfHosted"] = 1] = "SelfHosted";
      AgentHostedMode2[AgentHostedMode2["MsHosted"] = 2] = "MsHosted";
    })(AgentHostedMode = exports2.AgentHostedMode || (exports2.AgentHostedMode = {}));
    var SPRINT_ONE_START_UTC_MS = Date.UTC(2010, 7, 14, 0, 0, 0, 0);
    var DAYS_PER_WEEK = 7;
    var DAYS_PER_SPRINT = 21;
    var MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1e3;
    exports2.setStdStream = im._setStdStream;
    exports2.setErrStream = im._setErrStream;
    function setResult2(result, message, done) {
      (0, exports2.debug)("task result: " + TaskResult2[result]);
      if (result == TaskResult2.Failed && message) {
        (0, exports2.error)(message, exports2.IssueSource.TaskInternal);
      } else if (result == TaskResult2.SucceededWithIssues && message) {
        (0, exports2.warning)(message, exports2.IssueSource.TaskInternal);
      }
      var properties = { "result": TaskResult2[result] };
      if (done) {
        properties["done"] = "true";
      }
      (0, exports2.command)("task.complete", properties, message);
    }
    exports2.setResult = setResult2;
    function setSanitizedResult(result, message, done) {
      var pattern = /password|key|secret|bearer|authorization|token|pat/i;
      var sanitizedMessage = im._truncateBeforeSensitiveKeyword(message, pattern);
      setResult2(result, sanitizedMessage, done);
    }
    exports2.setSanitizedResult = setSanitizedResult;
    process.on("uncaughtException", function(err) {
      if (!im.isSigPipeError(err)) {
        setResult2(TaskResult2.Failed, (0, exports2.loc)("LIB_UnhandledEx", err.message));
        (0, exports2.error)(String(err.stack), im.IssueSource.TaskInternal);
      }
    });
    process.on("unhandledRejection", function(reason) {
      if (reason instanceof Error) {
        throw reason;
      } else {
        throw new Error(reason);
      }
    });
    exports2.setResourcePath = im._setResourcePath;
    exports2.loc = im._loc;
    exports2.getVariable = im._getVariable;
    function assertAgent(minimum) {
      if (semver.lt(minimum, "2.104.1")) {
        throw new Error("assertAgent() requires the parameter to be 2.104.1 or higher");
      }
      var agent = (0, exports2.getVariable)("Agent.Version");
      (0, exports2.debug)("Detected Agent.Version=" + (agent ? agent : "undefined"));
      if (agent && semver.lt(agent, minimum)) {
        throw new Error("Agent version ".concat(minimum, " or higher is required. Detected Agent version: ").concat(agent));
      }
    }
    exports2.assertAgent = assertAgent;
    function getVariables() {
      return Object.keys(im._knownVariableMap).map(function(key) {
        var info = im._knownVariableMap[key];
        return { name: info.name, value: (0, exports2.getVariable)(info.name), secret: info.secret };
      });
    }
    exports2.getVariables = getVariables;
    function setVariable(name, val, secret, isOutput) {
      if (secret === void 0) {
        secret = false;
      }
      if (isOutput === void 0) {
        isOutput = false;
      }
      var key = im._getVariableKey(name);
      if (im._knownVariableMap.hasOwnProperty(key)) {
        secret = secret || im._knownVariableMap[key].secret;
      }
      var varValue = val || "";
      (0, exports2.debug)("set " + name + "=" + (secret && varValue ? "********" : varValue));
      if (secret) {
        if (varValue && varValue.match(/\r|\n/) && "".concat(process.env["SYSTEM_UNSAFEALLOWMULTILINESECRET"]).toUpperCase() != "TRUE") {
          throw new Error((0, exports2.loc)("LIB_MultilineSecret"));
        }
        im._vault.storeSecret("SECRET_" + key, varValue);
        delete process.env[key];
      } else {
        process.env[key] = varValue;
      }
      im._knownVariableMap[key] = { name, secret };
      (0, exports2.command)("task.setvariable", { "variable": name || "", isOutput: (isOutput || false).toString(), "issecret": (secret || false).toString() }, varValue);
    }
    exports2.setVariable = setVariable;
    function setSecret2(val) {
      if (val) {
        if (val.match(/\r|\n/) && "".concat(process.env["SYSTEM_UNSAFEALLOWMULTILINESECRET"]).toUpperCase() !== "TRUE") {
          throw new Error((0, exports2.loc)("LIB_MultilineSecret"));
        }
        (0, exports2.command)("task.setsecret", {}, val);
      }
    }
    exports2.setSecret = setSecret2;
    function getInput2(name, required) {
      var inval = im._vault.retrieveSecret("INPUT_" + im._getVariableKey(name));
      if (required && !inval) {
        throw new Error((0, exports2.loc)("LIB_InputRequired", name));
      }
      (0, exports2.debug)(name + "=" + inval);
      return inval;
    }
    exports2.getInput = getInput2;
    function getInputRequired(name) {
      return getInput2(name, true);
    }
    exports2.getInputRequired = getInputRequired;
    function getBoolInput(name, required) {
      return (getInput2(name, required) || "").toUpperCase() == "TRUE";
    }
    exports2.getBoolInput = getBoolInput;
    function getBoolFeatureFlag(ffName, defaultValue) {
      if (defaultValue === void 0) {
        defaultValue = false;
      }
      var ffValue = process.env[ffName];
      if (!ffValue) {
        (0, exports2.debug)("Feature flag ".concat(ffName, " not found. Returning ").concat(defaultValue, " as default."));
        return defaultValue;
      }
      (0, exports2.debug)("Feature flag ".concat(ffName, " = ").concat(ffValue));
      return ffValue.toLowerCase() === "true";
    }
    exports2.getBoolFeatureFlag = getBoolFeatureFlag;
    function getPipelineFeature(featureName) {
      var variableName = im._getVariableKey("DistributedTask.Tasks.".concat(featureName));
      var featureValue = process.env[variableName];
      if (!featureValue) {
        (0, exports2.debug)("Feature '".concat(featureName, "' not found. Returning false as default."));
        return false;
      }
      var boolValue = featureValue.toLowerCase() === "true";
      (0, exports2.debug)("Feature '".concat(featureName, "' = '").concat(featureValue, "'. Processed as '").concat(boolValue, "'."));
      return boolValue;
    }
    exports2.getPipelineFeature = getPipelineFeature;
    function getDelimitedInput(name, delim, required) {
      var inputVal = getInput2(name, required);
      if (!inputVal) {
        return [];
      }
      var result = [];
      inputVal.split(delim).forEach(function(x) {
        if (x) {
          result.push(x);
        }
      });
      return result;
    }
    exports2.getDelimitedInput = getDelimitedInput;
    function filePathSupplied(name) {
      var pathValue = this.resolve(this.getPathInput(name) || "");
      var repoRoot = this.resolve((0, exports2.getVariable)("build.sourcesDirectory") || (0, exports2.getVariable)("system.defaultWorkingDirectory") || "");
      var supplied = pathValue !== repoRoot;
      (0, exports2.debug)(name + "path supplied :" + supplied);
      return supplied;
    }
    exports2.filePathSupplied = filePathSupplied;
    function getPathInput(name, required, check) {
      var inval = getInput2(name, required);
      if (inval) {
        if (check) {
          (0, exports2.checkPath)(inval, name);
        }
      }
      return inval;
    }
    exports2.getPathInput = getPathInput;
    function getPathInputRequired(name, check) {
      return getPathInput(name, true, check);
    }
    exports2.getPathInputRequired = getPathInputRequired;
    function getEndpointUrl2(id, optional) {
      var urlval = process.env["ENDPOINT_URL_" + id];
      if (!optional && !urlval) {
        throw new Error((0, exports2.loc)("LIB_EndpointNotExist", id));
      }
      (0, exports2.debug)(id + "=" + urlval);
      return urlval;
    }
    exports2.getEndpointUrl = getEndpointUrl2;
    function getEndpointUrlRequired(id) {
      return getEndpointUrl2(id, false);
    }
    exports2.getEndpointUrlRequired = getEndpointUrlRequired;
    function getEndpointDataParameter(id, key, optional) {
      var dataParamVal = process.env["ENDPOINT_DATA_" + id + "_" + key.toUpperCase()];
      if (!optional && !dataParamVal) {
        throw new Error((0, exports2.loc)("LIB_EndpointDataNotExist", id, key));
      }
      (0, exports2.debug)(id + " data " + key + " = " + dataParamVal);
      return dataParamVal;
    }
    exports2.getEndpointDataParameter = getEndpointDataParameter;
    function getEndpointDataParameterRequired(id, key) {
      return getEndpointDataParameter(id, key, false);
    }
    exports2.getEndpointDataParameterRequired = getEndpointDataParameterRequired;
    function getEndpointAuthorizationScheme(id, optional) {
      var authScheme = im._vault.retrieveSecret("ENDPOINT_AUTH_SCHEME_" + id);
      if (!optional && !authScheme) {
        throw new Error((0, exports2.loc)("LIB_EndpointAuthNotExist", id));
      }
      (0, exports2.debug)(id + " auth scheme = " + authScheme);
      return authScheme;
    }
    exports2.getEndpointAuthorizationScheme = getEndpointAuthorizationScheme;
    function getEndpointAuthorizationSchemeRequired(id) {
      return getEndpointAuthorizationScheme(id, false);
    }
    exports2.getEndpointAuthorizationSchemeRequired = getEndpointAuthorizationSchemeRequired;
    function getEndpointAuthorizationParameter2(id, key, optional) {
      var authParam = im._vault.retrieveSecret("ENDPOINT_AUTH_PARAMETER_" + id + "_" + key.toUpperCase());
      if (!optional && !authParam) {
        throw new Error((0, exports2.loc)("LIB_EndpointAuthNotExist", id));
      }
      (0, exports2.debug)(id + " auth param " + key + " = " + authParam);
      return authParam;
    }
    exports2.getEndpointAuthorizationParameter = getEndpointAuthorizationParameter2;
    function getEndpointAuthorizationParameterRequired(id, key) {
      return getEndpointAuthorizationParameter2(id, key, false);
    }
    exports2.getEndpointAuthorizationParameterRequired = getEndpointAuthorizationParameterRequired;
    function getEndpointAuthorization2(id, optional) {
      var aval = im._vault.retrieveSecret("ENDPOINT_AUTH_" + id);
      if (!optional && !aval) {
        setResult2(TaskResult2.Failed, (0, exports2.loc)("LIB_EndpointAuthNotExist", id));
      }
      (0, exports2.debug)(id + " exists " + !!aval);
      var auth;
      try {
        if (aval) {
          auth = JSON.parse(aval);
        }
      } catch (err) {
        throw new Error((0, exports2.loc)("LIB_InvalidEndpointAuth", aval));
      }
      return auth;
    }
    exports2.getEndpointAuthorization = getEndpointAuthorization2;
    function getSecureFileName(id) {
      var name = process.env["SECUREFILE_NAME_" + id];
      (0, exports2.debug)("secure file name for id " + id + " = " + name);
      return name;
    }
    exports2.getSecureFileName = getSecureFileName;
    function getSecureFileTicket(id) {
      var ticket = im._vault.retrieveSecret("SECUREFILE_TICKET_" + id);
      (0, exports2.debug)("secure file ticket for id " + id + " = " + ticket);
      return ticket;
    }
    exports2.getSecureFileTicket = getSecureFileTicket;
    function getTaskVariable(name) {
      assertAgent("2.115.0");
      var inval = im._vault.retrieveSecret("VSTS_TASKVARIABLE_" + im._getVariableKey(name));
      if (inval) {
        inval = inval.trim();
      }
      (0, exports2.debug)("task variable: " + name + "=" + inval);
      return inval;
    }
    exports2.getTaskVariable = getTaskVariable;
    function setTaskVariable(name, val, secret) {
      if (secret === void 0) {
        secret = false;
      }
      assertAgent("2.115.0");
      var key = im._getVariableKey(name);
      var varValue = val || "";
      (0, exports2.debug)("set task variable: " + name + "=" + (secret && varValue ? "********" : varValue));
      im._vault.storeSecret("VSTS_TASKVARIABLE_" + key, varValue);
      delete process.env[key];
      (0, exports2.command)("task.settaskvariable", { "variable": name || "", "issecret": (secret || false).toString() }, varValue);
    }
    exports2.setTaskVariable = setTaskVariable;
    exports2.command = im._command;
    exports2.warning = im._warning;
    exports2.error = im._error;
    exports2.debug = im._debug;
    function stats(path3) {
      return fs2.statSync(path3);
    }
    exports2.stats = stats;
    exports2.exist = im._exist;
    function writeFile(file, data, options) {
      if (typeof options === "string") {
        fs2.writeFileSync(file, data, { encoding: options });
      } else {
        fs2.writeFileSync(file, data, options);
      }
    }
    exports2.writeFile = writeFile;
    function osType() {
      return os.type();
    }
    exports2.osType = osType;
    function getPlatform() {
      switch (process.platform) {
        case "win32":
          return Platform.Windows;
        case "darwin":
          return Platform.MacOS;
        case "linux":
          return Platform.Linux;
        default:
          throw Error((0, exports2.loc)("LIB_PlatformNotSupported", process.platform));
      }
    }
    exports2.getPlatform = getPlatform;
    function getNodeMajorVersion() {
      var _a;
      var version = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node;
      if (!version) {
        throw new Error((0, exports2.loc)("LIB_UndefinedNodeVersion"));
      }
      var parts = version.split(".").map(Number);
      if (parts.length < 1) {
        return NaN;
      }
      return parts[0];
    }
    exports2.getNodeMajorVersion = getNodeMajorVersion;
    function getAgentMode() {
      var agentCloudId = (0, exports2.getVariable)("Agent.CloudId");
      if (agentCloudId === void 0)
        return AgentHostedMode.Unknown;
      if (agentCloudId)
        return AgentHostedMode.MsHosted;
      return AgentHostedMode.SelfHosted;
    }
    exports2.getAgentMode = getAgentMode;
    function getSprint(date) {
      var targetDate = date || /* @__PURE__ */ new Date();
      var elapsedDays = Math.floor((targetDate.getTime() - SPRINT_ONE_START_UTC_MS) / MILLISECONDS_PER_DAY);
      var sprintIndex = Math.floor(elapsedDays / DAYS_PER_SPRINT);
      var dayWithinSprint = (elapsedDays % DAYS_PER_SPRINT + DAYS_PER_SPRINT) % DAYS_PER_SPRINT;
      return {
        sprint: sprintIndex + 1,
        week: Math.floor(dayWithinSprint / DAYS_PER_WEEK) + 1
      };
    }
    exports2.getSprint = getSprint;
    function cwd() {
      return process.cwd();
    }
    exports2.cwd = cwd;
    exports2.checkPath = im._checkPath;
    function cd(path3) {
      if (path3 === "-") {
        if (!process.env.OLDPWD) {
          throw new Error((0, exports2.loc)("LIB_NotFoundPreviousDirectory"));
        } else {
          path3 = process.env.OLDPWD;
        }
      }
      if (path3 === "~") {
        path3 = os.homedir();
      }
      if (!fs2.existsSync(path3)) {
        throw new Error((0, exports2.loc)("LIB_PathNotFound", "cd", path3));
      }
      if (!fs2.statSync(path3).isDirectory()) {
        throw new Error((0, exports2.loc)("LIB_PathIsNotADirectory", path3));
      }
      try {
        var currentPath = process.cwd();
        process.chdir(path3);
        process.env.OLDPWD = currentPath;
      } catch (error) {
        (0, exports2.debug)((0, exports2.loc)("LIB_OperationFailed", "cd", error));
      }
    }
    exports2.cd = cd;
    var dirStack = [];
    function getActualStack() {
      return [process.cwd()].concat(dirStack);
    }
    function pushd(dir) {
      if (dir === void 0) {
        dir = "";
      }
      var dirs = getActualStack();
      var maybeIndex = parseInt(dir);
      if (dir === "+0") {
        return dirs;
      } else if (dir.length === 0) {
        if (dirs.length > 1) {
          dirs.splice.apply(dirs, __spreadArray([0, 0], dirs.splice(1, 1), false));
        } else {
          throw new Error((0, exports2.loc)("LIB_DirectoryStackEmpty"));
        }
      } else if (!isNaN(maybeIndex)) {
        if (maybeIndex < dirStack.length + 1) {
          maybeIndex = dir.charAt(0) === "-" ? maybeIndex - 1 : maybeIndex;
        }
        dirs.splice.apply(dirs, __spreadArray([0, dirs.length], dirs.slice(maybeIndex).concat(dirs.slice(0, maybeIndex)), false));
      } else {
        dirs.unshift(dir);
      }
      var _path = path2.resolve(dirs.shift());
      try {
        cd(_path);
      } catch (error) {
        if (!fs2.existsSync(_path)) {
          throw new Error((0, exports2.loc)("Not found", "pushd", _path));
        }
        throw error;
      }
      dirStack.splice.apply(dirStack, __spreadArray([0, dirStack.length], dirs, false));
      return getActualStack();
    }
    exports2.pushd = pushd;
    function popd(index) {
      if (index === void 0) {
        index = "";
      }
      if (dirStack.length === 0) {
        throw new Error((0, exports2.loc)("LIB_DirectoryStackEmpty"));
      }
      var maybeIndex = parseInt(index);
      if (isNaN(maybeIndex)) {
        maybeIndex = 0;
      } else if (maybeIndex < dirStack.length + 1) {
        maybeIndex = index.charAt(0) === "-" ? maybeIndex - 1 : maybeIndex;
      }
      if (maybeIndex > 0 || dirStack.length + maybeIndex === 0) {
        maybeIndex = maybeIndex > 0 ? maybeIndex - 1 : maybeIndex;
        dirStack.splice(maybeIndex, 1);
      } else {
        var _path = path2.resolve(dirStack.shift());
        cd(_path);
      }
      return getActualStack();
    }
    exports2.popd = popd;
    function mkdirP(p) {
      if (!p) {
        throw new Error((0, exports2.loc)("LIB_ParameterIsRequired", "p"));
      }
      var stack = [];
      var testDir = p;
      while (true) {
        if (stack.length >= Number(process.env["TASKLIB_TEST_MKDIRP_FAILSAFE"] || 1e3)) {
          (0, exports2.debug)("loop is out of control");
          fs2.mkdirSync(p);
          return;
        }
        (0, exports2.debug)("testing directory '".concat(testDir, "'"));
        var stats_1 = void 0;
        try {
          stats_1 = fs2.statSync(testDir);
        } catch (err) {
          if (err.code == "ENOENT") {
            var parentDir = path2.dirname(testDir);
            if (testDir == parentDir) {
              throw new Error((0, exports2.loc)("LIB_MkdirFailedInvalidDriveRoot", p, testDir));
            }
            stack.push(testDir);
            testDir = parentDir;
            continue;
          } else if (err.code == "UNKNOWN") {
            throw new Error((0, exports2.loc)("LIB_MkdirFailedInvalidShare", p, testDir));
          } else {
            throw err;
          }
        }
        if (!stats_1.isDirectory()) {
          throw new Error((0, exports2.loc)("LIB_MkdirFailedFileExists", p, testDir));
        }
        break;
      }
      while (stack.length) {
        var dir = stack.pop();
        (0, exports2.debug)("mkdir '".concat(dir, "'"));
        try {
          fs2.mkdirSync(dir);
        } catch (err) {
          throw new Error((0, exports2.loc)("LIB_MkdirFailed", p, err.message));
        }
      }
    }
    exports2.mkdirP = mkdirP;
    function resolve() {
      var pathSegments = [];
      for (var _i = 0; _i < arguments.length; _i++) {
        pathSegments[_i] = arguments[_i];
      }
      var absolutePath = path2.resolve.apply(this, pathSegments);
      (0, exports2.debug)("Absolute path for pathSegments: " + pathSegments + " = " + absolutePath);
      return absolutePath;
    }
    exports2.resolve = resolve;
    exports2.which = im._which;
    function ls(optionsOrPaths) {
      var paths = [];
      for (var _i = 1; _i < arguments.length; _i++) {
        paths[_i - 1] = arguments[_i];
      }
      var isRecursive = false;
      var includeHidden = false;
      if (typeof optionsOrPaths === "string" && optionsOrPaths.startsWith("-")) {
        var options = String(optionsOrPaths).toLowerCase();
        isRecursive = options.includes("r");
        includeHidden = options.includes("a");
      }
      if (Array.isArray(paths)) {
        paths = flattenArray(paths);
      }
      if (typeof optionsOrPaths !== "string" || !optionsOrPaths.startsWith("-")) {
        var pathsFromOptions = [];
        if (Array.isArray(optionsOrPaths)) {
          pathsFromOptions = optionsOrPaths;
        } else if (optionsOrPaths && typeof optionsOrPaths === "string") {
          pathsFromOptions = [optionsOrPaths];
        }
        if (paths === void 0 || paths.length === 0) {
          paths = pathsFromOptions;
        } else {
          paths.push.apply(paths, pathsFromOptions);
        }
      }
      if (paths.length === 0) {
        paths.push(path2.resolve("."));
      }
      var pathsCopy = __spreadArray([], paths, true);
      var preparedPaths = [];
      var fileEntries = [];
      try {
        var remainingPaths = [];
        while (paths.length > 0) {
          var pathEntry = resolve(paths.shift());
          if (pathEntry === null || pathEntry === void 0 ? void 0 : pathEntry.includes("*")) {
            remainingPaths.push(pathEntry);
            continue;
          }
          var stats_2 = fs2.lstatSync(pathEntry);
          if (stats_2.isFile()) {
            var fileName = path2.basename(pathEntry);
            fileEntries.push(fileName);
          } else {
            remainingPaths.push(pathEntry);
          }
        }
        paths.push.apply(paths, remainingPaths);
        var _loop_1 = function() {
          var pathEntry2 = resolve(paths.shift());
          if (pathEntry2 === null || pathEntry2 === void 0 ? void 0 : pathEntry2.includes("*")) {
            paths.push.apply(paths, findMatch(path2.dirname(pathEntry2), [path2.basename(pathEntry2)]));
            return "continue";
          }
          if (fs2.lstatSync(pathEntry2).isDirectory()) {
            preparedPaths.push.apply(preparedPaths, fs2.readdirSync(pathEntry2).map(function(file) {
              return path2.join(pathEntry2, file);
            }));
          } else {
            preparedPaths.push(pathEntry2);
          }
        };
        while (paths.length > 0) {
          _loop_1();
        }
        var entries = [];
        var _loop_2 = function() {
          var entry = preparedPaths.shift();
          var entrybasename = path2.basename(entry);
          if (entry === null || entry === void 0 ? void 0 : entry.includes("*")) {
            preparedPaths.push.apply(preparedPaths, findMatch(path2.dirname(entry), [entrybasename]));
            return "continue";
          }
          if (!includeHidden && entrybasename.startsWith(".") && entrybasename !== "." && entrybasename !== "..") {
            return "continue";
          }
          var baseDir = safeFind(pathsCopy, function(p) {
            return entry.startsWith(path2.resolve(p));
          }) || path2.resolve(".");
          if (fs2.lstatSync(entry).isDirectory() && isRecursive) {
            preparedPaths.push.apply(preparedPaths, fs2.readdirSync(entry).map(function(x) {
              return path2.join(entry, x);
            }));
            entries.push(path2.relative(baseDir, entry));
          } else {
            entries.push(path2.relative(baseDir, entry));
          }
        };
        while (preparedPaths.length > 0) {
          _loop_2();
        }
        var finalResults = __spreadArray(__spreadArray([], fileEntries, true), entries, true);
        return finalResults;
      } catch (error) {
        if (error.code === "ENOENT") {
          throw new Error((0, exports2.loc)("LIB_PathNotFound", "ls", error.message));
        } else {
          throw new Error((0, exports2.loc)("LIB_OperationFailed", "ls", error));
        }
      }
    }
    exports2.ls = ls;
    function flattenArray(arr) {
      return arr.reduce(function(flat, toFlatten) {
        return flat.concat(Array.isArray(toFlatten) ? flattenArray(toFlatten) : toFlatten);
      }, []);
    }
    function cp(sourceOrOptions, destinationOrSource, optionsOrDestination, continueOnError, retryCount) {
      if (continueOnError === void 0) {
        continueOnError = false;
      }
      if (retryCount === void 0) {
        retryCount = 0;
      }
      retry(function() {
        var recursive = false;
        var force = true;
        var source = String(sourceOrOptions);
        var destination = destinationOrSource;
        var options = "";
        if (typeof sourceOrOptions === "string" && sourceOrOptions.startsWith("-")) {
          options = sourceOrOptions.toLowerCase();
          recursive = options.includes("r");
          force = !options.includes("n");
          source = destinationOrSource;
          destination = String(optionsOrDestination);
        } else if (typeof optionsOrDestination === "string" && optionsOrDestination && optionsOrDestination.startsWith("-")) {
          options = optionsOrDestination.toLowerCase();
          recursive = options.includes("r");
          force = !options.includes("n");
          source = String(sourceOrOptions);
          destination = destinationOrSource;
        }
        if (!fs2.existsSync(destination) && !force) {
          throw new Error((0, exports2.loc)("LIB_PathNotFound", "cp", destination));
        }
        var isPattern = /[*?{\[]/.test(source) || /^[#!]/.test(source) || /[@+!]\(/.test(source);
        if (isPattern) {
          var sourcesToProcess = [];
          var sourceDir = path2.dirname(source);
          sourceDir = sourceDir == "." ? path2.resolve() : sourceDir;
          sourcesToProcess = findMatch(sourceDir, [path2.basename(source)]);
          if (sourcesToProcess.length === 0) {
            (0, exports2.debug)("No matches found for pattern: ".concat(source));
          }
          for (var _i = 0, sourcesToProcess_1 = sourcesToProcess; _i < sourcesToProcess_1.length; _i++) {
            var src = sourcesToProcess_1[_i];
            cp(src, destination, options, continueOnError, retryCount);
          }
          return;
        }
        var lstatSource = fs2.lstatSync(source);
        if (!recursive && lstatSource.isDirectory()) {
          throw new Error((0, exports2.loc)("LIB_CopyDirectoryWithoutRecursiveOption", source));
        }
        if (!force && fs2.existsSync(destination)) {
          return;
        }
        try {
          if (fs2.existsSync(destination) && fs2.lstatSync(destination).isDirectory()) {
            destination = path2.join(destination, path2.basename(source));
          }
          copyWithPreservedSymlinks(source, destination, force);
        } catch (error) {
          throw new Error((0, exports2.loc)("LIB_OperationFailed", "cp", error));
        }
      }, [], { retryCount, continueOnError });
    }
    exports2.cp = cp;
    var copyWithPreservedSymlinks = function(source, destination, force) {
      var lstatSource = fs2.lstatSync(source);
      if (lstatSource.isSymbolicLink()) {
        var symlinkTarget = fs2.readlinkSync(source);
        if (force && fs2.existsSync(destination)) {
          var destStats = fs2.lstatSync(destination);
          if (destStats.isSymbolicLink()) {
            fs2.unlinkSync(destination);
          } else {
            fs2.rmSync(destination, { recursive: true, force: true });
          }
        }
        fs2.symlinkSync(symlinkTarget, destination);
      } else if (lstatSource.isFile()) {
        if (force) {
          fs2.copyFileSync(source, destination);
        } else {
          fs2.copyFileSync(source, destination, fs2.constants.COPYFILE_EXCL);
        }
      } else {
        var entries = fs2.readdirSync(source, { withFileTypes: true });
        if (!fs2.existsSync(destination)) {
          fs2.mkdirSync(destination, { recursive: true });
        }
        for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
          var entry = entries_1[_i];
          var srcPath = path2.join(source, entry.name);
          var destPath = path2.join(destination, entry.name);
          copyWithPreservedSymlinks(srcPath, destPath, force);
        }
      }
    };
    function mv(source, dest, options, continueOnError) {
      var force = false;
      if (options && typeof options === "string" && options.startsWith("-")) {
        var lowercasedOptions = String(options).toLowerCase();
        force = lowercasedOptions.includes("f") && !lowercasedOptions.includes("n");
      }
      var sourceExists = fs2.existsSync(source);
      var destExists = fs2.existsSync(dest);
      var sources = [];
      try {
        if (!sourceExists) {
          if (source.includes("*")) {
            sources.push.apply(sources, findMatch(path2.resolve(path2.dirname(source)), [path2.basename(source)]));
          } else {
            throw new Error((0, exports2.loc)("LIB_PathNotFound", "mv", source));
          }
        } else {
          sources.push(source);
        }
        if (destExists && !force) {
          throw new Error("File already exists at ".concat(dest));
        }
        for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) {
          var source_1 = sources_1[_i];
          fs2.renameSync(source_1, dest);
        }
      } catch (error) {
        (0, exports2.debug)("mv failed");
        var errMsg = (0, exports2.loc)("LIB_OperationFailed", "mv", error);
        (0, exports2.debug)(errMsg);
        if (!continueOnError) {
          throw new Error(errMsg);
        }
      }
    }
    exports2.mv = mv;
    function retry(func, args, retryOptions) {
      if (retryOptions === void 0) {
        retryOptions = { continueOnError: false, retryCount: 0 };
      }
      while (retryOptions.retryCount >= 0) {
        try {
          return func.apply(void 0, args);
        } catch (e) {
          if (retryOptions.retryCount <= 0) {
            if (retryOptions.continueOnError) {
              (0, exports2.warning)(e, exports2.IssueSource.TaskInternal);
              break;
            } else {
              throw e;
            }
          } else {
            (0, exports2.debug)('Attempt to execute function "'.concat(func === null || func === void 0 ? void 0 : func.name, '" failed, retries left: ').concat(retryOptions.retryCount));
            retryOptions.retryCount--;
          }
        }
      }
    }
    exports2.retry = retry;
    function _getStats(path3, followSymbolicLink, allowBrokenSymbolicLinks) {
      var stats2;
      if (followSymbolicLink) {
        try {
          stats2 = fs2.statSync(path3);
        } catch (err) {
          if (err.code == "ENOENT" && allowBrokenSymbolicLinks) {
            stats2 = fs2.lstatSync(path3);
            (0, exports2.debug)("  ".concat(path3, " (broken symlink)"));
          } else {
            throw err;
          }
        }
      } else {
        stats2 = fs2.lstatSync(path3);
      }
      return stats2;
    }
    function find(findPath, options) {
      if (!findPath) {
        (0, exports2.debug)("no path specified");
        return [];
      }
      findPath = path2.normalize(findPath);
      (0, exports2.debug)("findPath: '".concat(findPath, "'"));
      options = options || _getDefaultFindOptions();
      _debugFindOptions(options);
      try {
        fs2.lstatSync(findPath);
      } catch (err) {
        if (err.code == "ENOENT") {
          (0, exports2.debug)("0 results");
          return [];
        }
        throw err;
      }
      try {
        var result = [];
        var stack = [new _FindItem(findPath, 1)];
        var traversalChain = [];
        var _loop_3 = function() {
          var item = stack.pop();
          var stats_3 = void 0;
          try {
            var isPathToSearch = !result.length;
            var followSpecifiedSymbolicLink = options.followSpecifiedSymbolicLink && isPathToSearch;
            var followSymbolicLink = options.followSymbolicLinks || followSpecifiedSymbolicLink;
            stats_3 = _getStats(item.path, followSymbolicLink, options.allowBrokenSymbolicLinks);
          } catch (err) {
            if (err.code == "ENOENT" && options.skipMissingFiles) {
              (0, exports2.warning)('No such file or directory: "'.concat(item.path, '" - skipping.'), exports2.IssueSource.TaskInternal);
              return "continue";
            }
            throw err;
          }
          result.push(item.path);
          if (stats_3.isDirectory()) {
            (0, exports2.debug)("  ".concat(item.path, " (directory)"));
            if (options.followSymbolicLinks) {
              var realPath_1;
              if (im._isUncPath(item.path)) {
                realPath_1 = retry(fs2.realpathSync, [item.path], { continueOnError: false, retryCount: 5 });
              } else {
                realPath_1 = fs2.realpathSync(item.path);
              }
              while (traversalChain.length >= item.level) {
                traversalChain.pop();
              }
              if (traversalChain.some(function(x) {
                return x == realPath_1;
              })) {
                (0, exports2.debug)("    cycle detected");
                return "continue";
              }
              traversalChain.push(realPath_1);
            }
            var childLevel_1 = item.level + 1;
            var childItems = fs2.readdirSync(item.path).map(function(childName) {
              return new _FindItem(path2.join(item.path, childName), childLevel_1);
            });
            for (var i = childItems.length - 1; i >= 0; i--) {
              stack.push(childItems[i]);
            }
          } else {
            (0, exports2.debug)("  ".concat(item.path, " (file)"));
          }
        };
        while (stack.length) {
          _loop_3();
        }
        (0, exports2.debug)("".concat(result.length, " results"));
        return result;
      } catch (err) {
        throw new Error((0, exports2.loc)("LIB_OperationFailed", "find", err.message));
      }
    }
    exports2.find = find;
    var _FindItem = (
      /** @class */
      /* @__PURE__ */ (function() {
        function _FindItem2(path3, level) {
          this.path = path3;
          this.level = level;
        }
        return _FindItem2;
      })()
    );
    function _debugFindOptions(options) {
      (0, exports2.debug)("findOptions.allowBrokenSymbolicLinks: '".concat(options.allowBrokenSymbolicLinks, "'"));
      (0, exports2.debug)("findOptions.followSpecifiedSymbolicLink: '".concat(options.followSpecifiedSymbolicLink, "'"));
      (0, exports2.debug)("findOptions.followSymbolicLinks: '".concat(options.followSymbolicLinks, "'"));
      (0, exports2.debug)("findOptions.skipMissingFiles: '".concat(options.skipMissingFiles, "'"));
    }
    function _getDefaultFindOptions() {
      return {
        allowBrokenSymbolicLinks: false,
        followSpecifiedSymbolicLink: true,
        followSymbolicLinks: true,
        skipMissingFiles: false
      };
    }
    function legacyFindFiles(rootDirectory, pattern, includeFiles, includeDirectories) {
      if (!pattern) {
        throw new Error("pattern parameter cannot be empty");
      }
      (0, exports2.debug)("legacyFindFiles rootDirectory: '".concat(rootDirectory, "'"));
      (0, exports2.debug)("pattern: '".concat(pattern, "'"));
      (0, exports2.debug)("includeFiles: '".concat(includeFiles, "'"));
      (0, exports2.debug)("includeDirectories: '".concat(includeDirectories, "'"));
      if (!includeFiles && !includeDirectories) {
        includeFiles = true;
      }
      var includePatterns = [];
      var excludePatterns = [];
      pattern = pattern.replace(/;;/g, "\0");
      for (var _i = 0, _a = pattern.split(";"); _i < _a.length; _i++) {
        var pat = _a[_i];
        if (!pat) {
          continue;
        }
        pat = pat.replace(/\0/g, ";");
        var isIncludePattern = void 0;
        if (im._startsWith(pat, "+:")) {
          pat = pat.substring(2);
          isIncludePattern = true;
        } else if (im._startsWith(pat, "-:")) {
          pat = pat.substring(2);
          isIncludePattern = false;
        } else {
          isIncludePattern = true;
        }
        if (im._endsWith(pat, "/") || process.platform == "win32" && im._endsWith(pat, "\\")) {
          throw new Error((0, exports2.loc)("LIB_InvalidPattern", pat));
        }
        if (rootDirectory && !path2.isAbsolute(pat)) {
          pat = path2.join(rootDirectory, pat);
          if (im._endsWith(pat, "\\")) {
            pat = pat.substring(0, pat.length - 1);
          }
        }
        if (isIncludePattern) {
          includePatterns.push(pat);
        } else {
          excludePatterns.push(im._legacyFindFiles_convertPatternToRegExp(pat));
        }
      }
      var count = 0;
      var result = _legacyFindFiles_getMatchingItems(includePatterns, excludePatterns, !!includeFiles, !!includeDirectories);
      (0, exports2.debug)("all matches:");
      for (var _b = 0, result_1 = result; _b < result_1.length; _b++) {
        var resultItem = result_1[_b];
        (0, exports2.debug)(" " + resultItem);
      }
      (0, exports2.debug)("total matched: " + result.length);
      return result;
    }
    exports2.legacyFindFiles = legacyFindFiles;
    function _legacyFindFiles_getMatchingItems(includePatterns, excludePatterns, includeFiles, includeDirectories) {
      (0, exports2.debug)("getMatchingItems()");
      for (var _i = 0, includePatterns_1 = includePatterns; _i < includePatterns_1.length; _i++) {
        var pattern = includePatterns_1[_i];
        (0, exports2.debug)("includePattern: '".concat(pattern, "'"));
      }
      for (var _a = 0, excludePatterns_1 = excludePatterns; _a < excludePatterns_1.length; _a++) {
        var pattern = excludePatterns_1[_a];
        (0, exports2.debug)("excludePattern: ".concat(pattern));
      }
      (0, exports2.debug)("includeFiles: " + includeFiles);
      (0, exports2.debug)("includeDirectories: " + includeDirectories);
      var allFiles = {};
      var _loop_4 = function(pattern2) {
        var findPath = void 0;
        var starIndex = pattern2.indexOf("*");
        var questionIndex = pattern2.indexOf("?");
        if (starIndex < 0 && questionIndex < 0) {
          findPath = im._getDirectoryName(pattern2);
        } else {
          var index = Math.min(starIndex >= 0 ? starIndex : questionIndex, questionIndex >= 0 ? questionIndex : starIndex);
          findPath = im._getDirectoryName(pattern2.substring(0, index));
        }
        if (!findPath) {
          return "continue";
        }
        var patternRegex = im._legacyFindFiles_convertPatternToRegExp(pattern2);
        var items = find(findPath, { followSymbolicLinks: true }).filter(function(item) {
          if (includeFiles && includeDirectories) {
            return true;
          }
          var isDir = fs2.statSync(item).isDirectory();
          return includeFiles && !isDir || includeDirectories && isDir;
        }).forEach(function(item) {
          var normalizedPath = process.platform == "win32" ? item.replace(/\\/g, "/") : item;
          var alternatePath = "".concat(normalizedPath, "/");
          var isMatch = false;
          if (patternRegex.test(normalizedPath) || includeDirectories && patternRegex.test(alternatePath)) {
            isMatch = true;
            for (var _i2 = 0, excludePatterns_2 = excludePatterns; _i2 < excludePatterns_2.length; _i2++) {
              var regex = excludePatterns_2[_i2];
              if (regex.test(normalizedPath) || includeDirectories && regex.test(alternatePath)) {
                isMatch = false;
                break;
              }
            }
          }
          if (isMatch) {
            allFiles[item] = item;
          }
        });
      };
      for (var _b = 0, includePatterns_2 = includePatterns; _b < includePatterns_2.length; _b++) {
        var pattern = includePatterns_2[_b];
        _loop_4(pattern);
      }
      return Object.keys(allFiles).sort();
    }
    function rmRF(inputPath) {
      (0, exports2.debug)("rm -rf " + inputPath);
      if (getPlatform() == Platform.Windows) {
        try {
          var lstats = fs2.lstatSync(inputPath);
          if (lstats.isDirectory() && !lstats.isSymbolicLink()) {
            (0, exports2.debug)("removing directory " + inputPath);
            childProcess.execFileSync("cmd.exe", ["/c", "rd", "/s", "/q", im._normalizeSeparators(inputPath)]);
          } else if (lstats.isSymbolicLink()) {
            (0, exports2.debug)("removing symbolic link " + inputPath);
            var realPath = fs2.readlinkSync(inputPath);
            if (fs2.existsSync(realPath)) {
              var stats_4 = fs2.statSync(realPath);
              if (stats_4.isDirectory()) {
                childProcess.execFileSync("cmd.exe", ["/c", "rd", "/s", "/q", im._normalizeSeparators(realPath)]);
                fs2.unlinkSync(inputPath);
              } else {
                fs2.unlinkSync(inputPath);
              }
            } else {
              (0, exports2.debug)("Symbolic link '".concat(inputPath, "' points to a non-existing target '").concat(realPath, "'. Removing the symbolic link."));
              fs2.unlinkSync(inputPath);
            }
          } else {
            (0, exports2.debug)("removing file " + inputPath);
            childProcess.execFileSync("cmd.exe", ["/c", "del", "/f", "/a", im._normalizeSeparators(inputPath)]);
          }
        } catch (err) {
          (0, exports2.debug)("Error: " + err.message);
          if (err.code != "ENOENT") {
            throw new Error((0, exports2.loc)("LIB_OperationFailed", "rmRF", err.message));
          }
        }
      } else {
        var lstats = void 0;
        try {
          if (inputPath.includes("*")) {
            var entries = findMatch(path2.dirname(inputPath), [path2.basename(inputPath)]);
            for (var _i = 0, entries_2 = entries; _i < entries_2.length; _i++) {
              var entry = entries_2[_i];
              rmRF(entry);
            }
          } else {
            lstats = fs2.lstatSync(inputPath);
            if (lstats.isDirectory() && !lstats.isSymbolicLink()) {
              (0, exports2.debug)("removing directory " + inputPath);
              fs2.rmSync(inputPath, { recursive: true, force: true });
            } else if (lstats.isSymbolicLink()) {
              (0, exports2.debug)("removing symbolic link " + inputPath);
              var realPath = fs2.readlinkSync(inputPath);
              if (fs2.existsSync(realPath)) {
                var stats_5 = fs2.statSync(realPath);
                if (stats_5.isDirectory()) {
                  fs2.rmSync(realPath, { recursive: true, force: true });
                  fs2.unlinkSync(inputPath);
                } else {
                  fs2.unlinkSync(inputPath);
                }
              } else {
                (0, exports2.debug)("Symbolic link '".concat(inputPath, "' points to a non-existing target '").concat(realPath, "'. Removing the symbolic link."));
                fs2.unlinkSync(inputPath);
              }
            } else {
              (0, exports2.debug)("removing file " + inputPath);
              fs2.unlinkSync(inputPath);
            }
          }
        } catch (err) {
          (0, exports2.debug)("Error: " + err.message);
          if (err.code != "ENOENT") {
            throw new Error((0, exports2.loc)("LIB_OperationFailed", "rmRF", err.message));
          }
        }
      }
    }
    exports2.rmRF = rmRF;
    function execAsync(tool2, args, options) {
      var tr = this.tool(tool2);
      if (args) {
        if (args instanceof Array) {
          tr.arg(args);
        } else if (typeof args === "string") {
          tr.line(args);
        }
      }
      return tr.execAsync(options);
    }
    exports2.execAsync = execAsync;
    function exec(tool2, args, options) {
      var tr = this.tool(tool2);
      if (args) {
        if (args instanceof Array) {
          tr.arg(args);
        } else if (typeof args === "string") {
          tr.line(args);
        }
      }
      return tr.exec(options);
    }
    exports2.exec = exec;
    function execSync(tool2, args, options) {
      var tr = this.tool(tool2);
      if (args) {
        if (args instanceof Array) {
          tr.arg(args);
        } else if (typeof args === "string") {
          tr.line(args);
        }
      }
      return tr.execSync(options);
    }
    exports2.execSync = execSync;
    function tool(tool2) {
      var tr = new trm.ToolRunner(tool2);
      tr.on("debug", function(message) {
        (0, exports2.debug)(message);
      });
      return tr;
    }
    exports2.tool = tool;
    function match(list, patterns, patternRoot, options) {
      (0, exports2.debug)("patternRoot: '".concat(patternRoot, "'"));
      options = options || _getDefaultMatchOptions();
      _debugMatchOptions(options);
      if (typeof patterns == "string") {
        patterns = [patterns];
      }
      var map2 = {};
      var originalOptions = options;
      for (var _i = 0, patterns_1 = patterns; _i < patterns_1.length; _i++) {
        var pattern = patterns_1[_i];
        (0, exports2.debug)("pattern: '".concat(pattern, "'"));
        pattern = (pattern || "").trim();
        if (!pattern) {
          (0, exports2.debug)("skipping empty pattern");
          continue;
        }
        var options_1 = im._cloneMatchOptions(originalOptions);
        if (!options_1.nocomment && im._startsWith(pattern, "#")) {
          (0, exports2.debug)("skipping comment");
          continue;
        }
        options_1.nocomment = true;
        var negateCount = 0;
        if (!options_1.nonegate) {
          while (pattern.charAt(negateCount) == "!") {
            negateCount++;
          }
          pattern = pattern.substring(negateCount);
          if (negateCount) {
            (0, exports2.debug)("trimmed leading '!'. pattern: '".concat(pattern, "'"));
          }
        }
        var isIncludePattern = negateCount == 0 || negateCount % 2 == 0 && !options_1.flipNegate || negateCount % 2 == 1 && options_1.flipNegate;
        options_1.nonegate = true;
        options_1.flipNegate = false;
        var expanded = void 0;
        var preExpanded = pattern;
        if (options_1.nobrace) {
          expanded = [pattern];
        } else {
          (0, exports2.debug)("expanding braces");
          var convertedPattern = process.platform == "win32" ? pattern.replace(/\\/g, "/") : pattern;
          expanded = minimatch.braceExpand(convertedPattern);
        }
        options_1.nobrace = true;
        for (var _a = 0, expanded_1 = expanded; _a < expanded_1.length; _a++) {
          var pattern_1 = expanded_1[_a];
          if (expanded.length != 1 || pattern_1 != preExpanded) {
            (0, exports2.debug)("pattern: '".concat(pattern_1, "'"));
          }
          pattern_1 = (pattern_1 || "").trim();
          if (!pattern_1) {
            (0, exports2.debug)("skipping empty pattern");
            continue;
          }
          if (patternRoot && // patternRoot supplied
          !im._isRooted(pattern_1) && // AND pattern not rooted
          // AND matchBase:false or not basename only
          (!options_1.matchBase || (process.platform == "win32" ? pattern_1.replace(/\\/g, "/") : pattern_1).indexOf("/") >= 0)) {
            pattern_1 = im._ensureRooted(patternRoot, pattern_1);
            (0, exports2.debug)("rooted pattern: '".concat(pattern_1, "'"));
          }
          if (isIncludePattern) {
            (0, exports2.debug)("applying include pattern against original list");
            var matchResults = minimatch.match(list, pattern_1, options_1);
            (0, exports2.debug)(matchResults.length + " matches");
            for (var _b = 0, matchResults_1 = matchResults; _b < matchResults_1.length; _b++) {
              var matchResult = matchResults_1[_b];
              map2[matchResult] = true;
            }
          } else {
            (0, exports2.debug)("applying exclude pattern against original list");
            var matchResults = minimatch.match(list, pattern_1, options_1);
            (0, exports2.debug)(matchResults.length + " matches");
            for (var _c = 0, matchResults_2 = matchResults; _c < matchResults_2.length; _c++) {
              var matchResult = matchResults_2[_c];
              delete map2[matchResult];
            }
          }
        }
      }
      var result = list.filter(function(item) {
        return map2.hasOwnProperty(item);
      });
      (0, exports2.debug)(result.length + " final results");
      return result;
    }
    exports2.match = match;
    function filter(pattern, options) {
      options = options || _getDefaultMatchOptions();
      return minimatch.filter(pattern, options);
    }
    exports2.filter = filter;
    function _debugMatchOptions(options) {
      (0, exports2.debug)("matchOptions.debug: '".concat(options.debug, "'"));
      (0, exports2.debug)("matchOptions.nobrace: '".concat(options.nobrace, "'"));
      (0, exports2.debug)("matchOptions.noglobstar: '".concat(options.noglobstar, "'"));
      (0, exports2.debug)("matchOptions.dot: '".concat(options.dot, "'"));
      (0, exports2.debug)("matchOptions.noext: '".concat(options.noext, "'"));
      (0, exports2.debug)("matchOptions.nocase: '".concat(options.nocase, "'"));
      (0, exports2.debug)("matchOptions.nonull: '".concat(options.nonull, "'"));
      (0, exports2.debug)("matchOptions.matchBase: '".concat(options.matchBase, "'"));
      (0, exports2.debug)("matchOptions.nocomment: '".concat(options.nocomment, "'"));
      (0, exports2.debug)("matchOptions.nonegate: '".concat(options.nonegate, "'"));
      (0, exports2.debug)("matchOptions.flipNegate: '".concat(options.flipNegate, "'"));
    }
    function _getDefaultMatchOptions() {
      return {
        debug: false,
        nobrace: true,
        noglobstar: false,
        dot: true,
        noext: false,
        nocase: process.platform == "win32",
        nonull: false,
        matchBase: false,
        nocomment: false,
        nonegate: false,
        flipNegate: false
      };
    }
    function findMatch(defaultRoot, patterns, findOptions, matchOptions) {
      defaultRoot = defaultRoot || this.getVariable("system.defaultWorkingDirectory") || process.cwd();
      (0, exports2.debug)("defaultRoot: '".concat(defaultRoot, "'"));
      patterns = patterns || [];
      patterns = typeof patterns == "string" ? [patterns] : patterns;
      findOptions = findOptions || _getDefaultFindOptions();
      _debugFindOptions(findOptions);
      matchOptions = matchOptions || _getDefaultMatchOptions();
      _debugMatchOptions(matchOptions);
      defaultRoot = im._normalizeSeparators(defaultRoot);
      var results = {};
      var originalMatchOptions = matchOptions;
      for (var _i = 0, _a = patterns || []; _i < _a.length; _i++) {
        var pattern = _a[_i];
        (0, exports2.debug)("pattern: '".concat(pattern, "'"));
        pattern = (pattern || "").trim();
        if (!pattern) {
          (0, exports2.debug)("skipping empty pattern");
          continue;
        }
        var matchOptions_1 = im._cloneMatchOptions(originalMatchOptions);
        if (!matchOptions_1.nocomment && im._startsWith(pattern, "#")) {
          (0, exports2.debug)("skipping comment");
          continue;
        }
        matchOptions_1.nocomment = true;
        var negateCount = 0;
        if (!matchOptions_1.nonegate) {
          while (pattern.charAt(negateCount) == "!") {
            negateCount++;
          }
          pattern = pattern.substring(negateCount);
          if (negateCount) {
            (0, exports2.debug)("trimmed leading '!'. pattern: '".concat(pattern, "'"));
          }
        }
        var isIncludePattern = negateCount == 0 || negateCount % 2 == 0 && !matchOptions_1.flipNegate || negateCount % 2 == 1 && matchOptions_1.flipNegate;
        matchOptions_1.nonegate = true;
        matchOptions_1.flipNegate = false;
        var expanded = void 0;
        var preExpanded = pattern;
        if (matchOptions_1.nobrace) {
          expanded = [pattern];
        } else {
          (0, exports2.debug)("expanding braces");
          var convertedPattern = process.platform == "win32" ? pattern.replace(/\\/g, "/") : pattern;
          expanded = minimatch.braceExpand(convertedPattern);
        }
        matchOptions_1.nobrace = true;
        for (var _b = 0, expanded_2 = expanded; _b < expanded_2.length; _b++) {
          var pattern_2 = expanded_2[_b];
          if (expanded.length != 1 || pattern_2 != preExpanded) {
            (0, exports2.debug)("pattern: '".concat(pattern_2, "'"));
          }
          pattern_2 = (pattern_2 || "").trim();
          if (!pattern_2) {
            (0, exports2.debug)("skipping empty pattern");
            continue;
          }
          if (isIncludePattern) {
            var findInfo = im._getFindInfoFromPattern(defaultRoot, pattern_2, matchOptions_1);
            var findPath = findInfo.findPath;
            (0, exports2.debug)("findPath: '".concat(findPath, "'"));
            if (!findPath) {
              (0, exports2.debug)("skipping empty path");
              continue;
            }
            (0, exports2.debug)("statOnly: '".concat(findInfo.statOnly, "'"));
            var findResults = [];
            if (findInfo.statOnly) {
              try {
                fs2.statSync(findPath);
                findResults.push(findPath);
              } catch (err) {
                if (err.code != "ENOENT") {
                  throw err;
                }
                (0, exports2.debug)("ENOENT");
              }
            } else {
              findResults = find(findPath, findOptions);
            }
            (0, exports2.debug)("found ".concat(findResults.length, " paths"));
            (0, exports2.debug)("applying include pattern");
            if (findInfo.adjustedPattern != pattern_2) {
              (0, exports2.debug)("adjustedPattern: '".concat(findInfo.adjustedPattern, "'"));
              pattern_2 = findInfo.adjustedPattern;
            }
            var matchResults = minimatch.match(findResults, pattern_2, matchOptions_1);
            (0, exports2.debug)(matchResults.length + " matches");
            for (var _c = 0, matchResults_3 = matchResults; _c < matchResults_3.length; _c++) {
              var matchResult = matchResults_3[_c];
              var key = process.platform == "win32" ? matchResult.toUpperCase() : matchResult;
              results[key] = matchResult;
            }
          } else {
            if (matchOptions_1.matchBase && !im._isRooted(pattern_2) && (process.platform == "win32" ? pattern_2.replace(/\\/g, "/") : pattern_2).indexOf("/") < 0) {
              (0, exports2.debug)("matchBase and basename only");
            } else {
              pattern_2 = im._ensurePatternRooted(defaultRoot, pattern_2);
              (0, exports2.debug)("after ensurePatternRooted, pattern: '".concat(pattern_2, "'"));
            }
            (0, exports2.debug)("applying exclude pattern");
            var matchResults = minimatch.match(Object.keys(results).map(function(key2) {
              return results[key2];
            }), pattern_2, matchOptions_1);
            (0, exports2.debug)(matchResults.length + " matches");
            for (var _d = 0, matchResults_4 = matchResults; _d < matchResults_4.length; _d++) {
              var matchResult = matchResults_4[_d];
              var key = process.platform == "win32" ? matchResult.toUpperCase() : matchResult;
              delete results[key];
            }
          }
        }
      }
      var finalResult = Object.keys(results).map(function(key2) {
        return results[key2];
      }).sort();
      (0, exports2.debug)(finalResult.length + " final results");
      return finalResult;
    }
    exports2.findMatch = findMatch;
    function getProxyFormattedUrl(proxyUrl, proxyUsername, proxyPassword) {
      var parsedUrl = new URL(proxyUrl);
      var proxyAddress = "".concat(parsedUrl.protocol, "//").concat(parsedUrl.host);
      if (proxyUsername) {
        proxyAddress = "".concat(parsedUrl.protocol, "//").concat(proxyUsername, ":").concat(proxyPassword, "@").concat(parsedUrl.host);
      }
      return proxyAddress;
    }
    function getHttpProxyConfiguration(requestUrl) {
      var proxyUrl = (0, exports2.getVariable)("Agent.ProxyUrl");
      if (proxyUrl && proxyUrl.length > 0) {
        var proxyUsername = (0, exports2.getVariable)("Agent.ProxyUsername");
        var proxyPassword = (0, exports2.getVariable)("Agent.ProxyPassword");
        var proxyBypassHosts = JSON.parse((0, exports2.getVariable)("Agent.ProxyBypassList") || "[]");
        var bypass_1 = false;
        if (requestUrl) {
          proxyBypassHosts.forEach(function(bypassHost) {
            if (new RegExp(bypassHost, "i").test(requestUrl)) {
              bypass_1 = true;
            }
          });
        }
        if (bypass_1) {
          return null;
        } else {
          var proxyAddress = getProxyFormattedUrl(proxyUrl, proxyUsername, proxyPassword);
          return {
            proxyUrl,
            proxyUsername,
            proxyPassword,
            proxyBypassHosts,
            proxyFormattedUrl: proxyAddress
          };
        }
      } else {
        return null;
      }
    }
    exports2.getHttpProxyConfiguration = getHttpProxyConfiguration;
    function getHttpCertConfiguration() {
      var ca = (0, exports2.getVariable)("Agent.CAInfo");
      var clientCert = (0, exports2.getVariable)("Agent.ClientCert");
      if (ca || clientCert) {
        var certConfig = {};
        certConfig.caFile = ca;
        certConfig.certFile = clientCert;
        if (clientCert) {
          var clientCertKey = (0, exports2.getVariable)("Agent.ClientCertKey");
          var clientCertArchive = (0, exports2.getVariable)("Agent.ClientCertArchive");
          var clientCertPassword = (0, exports2.getVariable)("Agent.ClientCertPassword");
          certConfig.keyFile = clientCertKey;
          certConfig.certArchiveFile = clientCertArchive;
          certConfig.passphrase = clientCertPassword;
        }
        return certConfig;
      } else {
        return null;
      }
    }
    exports2.getHttpCertConfiguration = getHttpCertConfiguration;
    var TestPublisher = (
      /** @class */
      (function() {
        function TestPublisher2(testRunner) {
          this.testRunner = testRunner;
        }
        TestPublisher2.prototype.publish = function(resultFiles, mergeResults, platform, config, runTitle, publishRunAttachments, testRunSystem) {
          testRunSystem = testRunSystem || "VSTSTask";
          var properties = {};
          properties["type"] = this.testRunner;
          if (mergeResults) {
            properties["mergeResults"] = mergeResults;
          }
          if (platform) {
            properties["platform"] = platform;
          }
          if (config) {
            properties["config"] = config;
          }
          if (runTitle) {
            properties["runTitle"] = runTitle;
          }
          if (publishRunAttachments) {
            properties["publishRunAttachments"] = publishRunAttachments;
          }
          if (resultFiles) {
            properties["resultFiles"] = Array.isArray(resultFiles) ? resultFiles.join() : resultFiles;
          }
          properties["testRunSystem"] = testRunSystem;
          (0, exports2.command)("results.publish", properties, "");
        };
        return TestPublisher2;
      })()
    );
    exports2.TestPublisher = TestPublisher;
    var CodeCoveragePublisher = (
      /** @class */
      (function() {
        function CodeCoveragePublisher2() {
        }
        CodeCoveragePublisher2.prototype.publish = function(codeCoverageTool, summaryFileLocation, reportDirectory, additionalCodeCoverageFiles) {
          var properties = {};
          if (codeCoverageTool) {
            properties["codecoveragetool"] = codeCoverageTool;
          }
          if (summaryFileLocation) {
            properties["summaryfile"] = summaryFileLocation;
          }
          if (reportDirectory) {
            properties["reportdirectory"] = reportDirectory;
          }
          if (additionalCodeCoverageFiles) {
            properties["additionalcodecoveragefiles"] = Array.isArray(additionalCodeCoverageFiles) ? additionalCodeCoverageFiles.join() : additionalCodeCoverageFiles;
          }
          (0, exports2.command)("codecoverage.publish", properties, "");
        };
        return CodeCoveragePublisher2;
      })()
    );
    exports2.CodeCoveragePublisher = CodeCoveragePublisher;
    var CodeCoverageEnabler = (
      /** @class */
      (function() {
        function CodeCoverageEnabler2(buildTool, ccTool) {
          this.buildTool = buildTool;
          this.ccTool = ccTool;
        }
        CodeCoverageEnabler2.prototype.enableCodeCoverage = function(buildProps) {
          buildProps["buildtool"] = this.buildTool;
          buildProps["codecoveragetool"] = this.ccTool;
          (0, exports2.command)("codecoverage.enable", buildProps, "");
        };
        return CodeCoverageEnabler2;
      })()
    );
    exports2.CodeCoverageEnabler = CodeCoverageEnabler;
    function uploadFile(path3) {
      (0, exports2.command)("task.uploadfile", null, path3);
    }
    exports2.uploadFile = uploadFile;
    function prependPath(path3) {
      assertAgent("2.115.0");
      (0, exports2.command)("task.prependpath", null, path3);
    }
    exports2.prependPath = prependPath;
    function uploadSummary(path3) {
      (0, exports2.command)("task.uploadsummary", null, path3);
    }
    exports2.uploadSummary = uploadSummary;
    function addAttachment(type2, name, path3) {
      (0, exports2.command)("task.addattachment", { "type": type2, "name": name }, path3);
    }
    exports2.addAttachment = addAttachment;
    function setEndpoint(id, field, key, value) {
      (0, exports2.command)("task.setendpoint", { "id": id, "field": FieldType[field].toLowerCase(), "key": key }, value);
    }
    exports2.setEndpoint = setEndpoint;
    function setProgress(percent, currentOperation) {
      (0, exports2.command)("task.setprogress", { "value": "".concat(percent) }, currentOperation);
    }
    exports2.setProgress = setProgress;
    function logDetail(id, message, parentId, recordType, recordName, order, startTime, finishTime, progress, state, result) {
      var properties = {
        "id": id,
        "parentid": parentId,
        "type": recordType,
        "name": recordName,
        "order": order ? order.toString() : void 0,
        "starttime": startTime,
        "finishtime": finishTime,
        "progress": progress ? progress.toString() : void 0,
        "state": state ? TaskState[state] : void 0,
        "result": result ? TaskResult2[result] : void 0
      };
      (0, exports2.command)("task.logdetail", properties, message);
    }
    exports2.logDetail = logDetail;
    function logIssue(type2, message, sourcePath, lineNumber, columnNumber, errorCode) {
      var properties = {
        "type": IssueType[type2].toLowerCase(),
        "code": errorCode,
        "sourcepath": sourcePath,
        "linenumber": lineNumber ? lineNumber.toString() : void 0,
        "columnnumber": columnNumber ? columnNumber.toString() : void 0
      };
      (0, exports2.command)("task.logissue", properties, message);
    }
    exports2.logIssue = logIssue;
    function uploadArtifact(containerFolder, path3, name) {
      (0, exports2.command)("artifact.upload", { "containerfolder": containerFolder, "artifactname": name }, path3);
    }
    exports2.uploadArtifact = uploadArtifact;
    function associateArtifact(name, path3, artifactType) {
      (0, exports2.command)("artifact.associate", { "type": ArtifactType[artifactType].toLowerCase(), "artifactname": name }, path3);
    }
    exports2.associateArtifact = associateArtifact;
    function uploadBuildLog(path3) {
      (0, exports2.command)("build.uploadlog", null, path3);
    }
    exports2.uploadBuildLog = uploadBuildLog;
    function updateBuildNumber(value) {
      (0, exports2.command)("build.updatebuildnumber", null, value);
    }
    exports2.updateBuildNumber = updateBuildNumber;
    function addBuildTag(value) {
      (0, exports2.command)("build.addbuildtag", null, value);
    }
    exports2.addBuildTag = addBuildTag;
    function updateReleaseName(name) {
      assertAgent("2.132.0");
      (0, exports2.command)("release.updatereleasename", null, name);
    }
    exports2.updateReleaseName = updateReleaseName;
    exports2.TaskCommand = tcm.TaskCommand;
    exports2.commandFromString = tcm.commandFromString;
    exports2.ToolRunner = trm.ToolRunner;
    if (semver.lt(process.versions.node, "4.2.0")) {
      (0, exports2.warning)("Tasks require a new agent.  Upgrade your agent or node to 4.2.0 or later", exports2.IssueSource.TaskInternal);
    }
    if (!global["_vsts_task_lib_loaded"]) {
      im._loadData();
      im._exposeProxySettings();
      im._exposeCertSettings();
    }
    function safeFind(arr, predicate) {
      for (var i = 0; i < arr.length; i++) {
        if (predicate(arr[i])) {
          return arr[i];
        }
      }
      return void 0;
    }
  }
});

// yarnrcauth.ts
var fs = __toESM(require("fs"));
var path = __toESM(require("path"));

// node_modules/js-yaml/dist/js-yaml.mjs
function isNothing(subject) {
  return typeof subject === "undefined" || subject === null;
}
function isObject(subject) {
  return typeof subject === "object" && subject !== null;
}
function toArray(sequence) {
  if (Array.isArray(sequence)) return sequence;
  else if (isNothing(sequence)) return [];
  return [sequence];
}
function extend(target, source) {
  var index, length, key, sourceKeys;
  if (source) {
    sourceKeys = Object.keys(source);
    for (index = 0, length = sourceKeys.length; index < length; index += 1) {
      key = sourceKeys[index];
      target[key] = source[key];
    }
  }
  return target;
}
function repeat(string, count) {
  var result = "", cycle;
  for (cycle = 0; cycle < count; cycle += 1) {
    result += string;
  }
  return result;
}
function isNegativeZero(number) {
  return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
}
var isNothing_1 = isNothing;
var isObject_1 = isObject;
var toArray_1 = toArray;
var repeat_1 = repeat;
var isNegativeZero_1 = isNegativeZero;
var extend_1 = extend;
var common = {
  isNothing: isNothing_1,
  isObject: isObject_1,
  toArray: toArray_1,
  repeat: repeat_1,
  isNegativeZero: isNegativeZero_1,
  extend: extend_1
};
function formatError(exception2, compact) {
  var where = "", message = exception2.reason || "(unknown reason)";
  if (!exception2.mark) return message;
  if (exception2.mark.name) {
    where += 'in "' + exception2.mark.name + '" ';
  }
  where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
  if (!compact && exception2.mark.snippet) {
    where += "\n\n" + exception2.mark.snippet;
  }
  return message + " " + where;
}
function YAMLException$1(reason, mark) {
  Error.call(this);
  this.name = "YAMLException";
  this.reason = reason;
  this.mark = mark;
  this.message = formatError(this, false);
  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, this.constructor);
  } else {
    this.stack = new Error().stack || "";
  }
}
YAMLException$1.prototype = Object.create(Error.prototype);
YAMLException$1.prototype.constructor = YAMLException$1;
YAMLException$1.prototype.toString = function toString(compact) {
  return this.name + ": " + formatError(this, compact);
};
var exception = YAMLException$1;
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
  var head = "";
  var tail = "";
  var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
  if (position - lineStart > maxHalfLength) {
    head = " ... ";
    lineStart = position - maxHalfLength + head.length;
  }
  if (lineEnd - position > maxHalfLength) {
    tail = " ...";
    lineEnd = position + maxHalfLength - tail.length;
  }
  return {
    str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
    pos: position - lineStart + head.length
    // relative position
  };
}
function padStart(string, max) {
  return common.repeat(" ", max - string.length) + string;
}
function makeSnippet(mark, options) {
  options = Object.create(options || null);
  if (!mark.buffer) return null;
  if (!options.maxLength) options.maxLength = 79;
  if (typeof options.indent !== "number") options.indent = 1;
  if (typeof options.linesBefore !== "number") options.linesBefore = 3;
  if (typeof options.linesAfter !== "number") options.linesAfter = 2;
  var re = /\r?\n|\r|\0/g;
  var lineStarts = [0];
  var lineEnds = [];
  var match;
  var foundLineNo = -1;
  while (match = re.exec(mark.buffer)) {
    lineEnds.push(match.index);
    lineStarts.push(match.index + match[0].length);
    if (mark.position <= match.index && foundLineNo < 0) {
      foundLineNo = lineStarts.length - 2;
    }
  }
  if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
  var result = "", i, line;
  var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
  var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
  for (i = 1; i <= options.linesBefore; i++) {
    if (foundLineNo - i < 0) break;
    line = getLine(
      mark.buffer,
      lineStarts[foundLineNo - i],
      lineEnds[foundLineNo - i],
      mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
      maxLineLength
    );
    result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
  }
  line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
  result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
  result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
  for (i = 1; i <= options.linesAfter; i++) {
    if (foundLineNo + i >= lineEnds.length) break;
    line = getLine(
      mark.buffer,
      lineStarts[foundLineNo + i],
      lineEnds[foundLineNo + i],
      mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
      maxLineLength
    );
    result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
  }
  return result.replace(/\n$/, "");
}
var snippet = makeSnippet;
var TYPE_CONSTRUCTOR_OPTIONS = [
  "kind",
  "multi",
  "resolve",
  "construct",
  "instanceOf",
  "predicate",
  "represent",
  "representName",
  "defaultStyle",
  "styleAliases"
];
var YAML_NODE_KINDS = [
  "scalar",
  "sequence",
  "mapping"
];
function compileStyleAliases(map2) {
  var result = {};
  if (map2 !== null) {
    Object.keys(map2).forEach(function(style) {
      map2[style].forEach(function(alias) {
        result[String(alias)] = style;
      });
    });
  }
  return result;
}
function Type$1(tag, options) {
  options = options || {};
  Object.keys(options).forEach(function(name) {
    if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
      throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
    }
  });
  this.options = options;
  this.tag = tag;
  this.kind = options["kind"] || null;
  this.resolve = options["resolve"] || function() {
    return true;
  };
  this.construct = options["construct"] || function(data) {
    return data;
  };
  this.instanceOf = options["instanceOf"] || null;
  this.predicate = options["predicate"] || null;
  this.represent = options["represent"] || null;
  this.representName = options["representName"] || null;
  this.defaultStyle = options["defaultStyle"] || null;
  this.multi = options["multi"] || false;
  this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
  if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
    throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
  }
}
var type = Type$1;
function compileList(schema2, name) {
  var result = [];
  schema2[name].forEach(function(currentType) {
    var newIndex = result.length;
    result.forEach(function(previousType, previousIndex) {
      if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
        newIndex = previousIndex;
      }
    });
    result[newIndex] = currentType;
  });
  return result;
}
function compileMap() {
  var result = {
    scalar: {},
    sequence: {},
    mapping: {},
    fallback: {},
    multi: {
      scalar: [],
      sequence: [],
      mapping: [],
      fallback: []
    }
  }, index, length;
  function collectType(type2) {
    if (type2.multi) {
      result.multi[type2.kind].push(type2);
      result.multi["fallback"].push(type2);
    } else {
      result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
    }
  }
  for (index = 0, length = arguments.length; index < length; index += 1) {
    arguments[index].forEach(collectType);
  }
  return result;
}
function Schema$1(definition) {
  return this.extend(definition);
}
Schema$1.prototype.extend = function extend2(definition) {
  var implicit = [];
  var explicit = [];
  if (definition instanceof type) {
    explicit.push(definition);
  } else if (Array.isArray(definition)) {
    explicit = explicit.concat(definition);
  } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
    if (definition.implicit) implicit = implicit.concat(definition.implicit);
    if (definition.explicit) explicit = explicit.concat(definition.explicit);
  } else {
    throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
  }
  implicit.forEach(function(type$1) {
    if (!(type$1 instanceof type)) {
      throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
    }
    if (type$1.loadKind && type$1.loadKind !== "scalar") {
      throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
    }
    if (type$1.multi) {
      throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
    }
  });
  explicit.forEach(function(type$1) {
    if (!(type$1 instanceof type)) {
      throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
    }
  });
  var result = Object.create(Schema$1.prototype);
  result.implicit = (this.implicit || []).concat(implicit);
  result.explicit = (this.explicit || []).concat(explicit);
  result.compiledImplicit = compileList(result, "implicit");
  result.compiledExplicit = compileList(result, "explicit");
  result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
  return result;
};
var schema = Schema$1;
var str = new type("tag:yaml.org,2002:str", {
  kind: "scalar",
  construct: function(data) {
    return data !== null ? data : "";
  }
});
var seq = new type("tag:yaml.org,2002:seq", {
  kind: "sequence",
  construct: function(data) {
    return data !== null ? data : [];
  }
});
var map = new type("tag:yaml.org,2002:map", {
  kind: "mapping",
  construct: function(data) {
    return data !== null ? data : {};
  }
});
var failsafe = new schema({
  explicit: [
    str,
    seq,
    map
  ]
});
function resolveYamlNull(data) {
  if (data === null) return true;
  var max = data.length;
  return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
}
function constructYamlNull() {
  return null;
}
function isNull(object) {
  return object === null;
}
var _null = new type("tag:yaml.org,2002:null", {
  kind: "scalar",
  resolve: resolveYamlNull,
  construct: constructYamlNull,
  predicate: isNull,
  represent: {
    canonical: function() {
      return "~";
    },
    lowercase: function() {
      return "null";
    },
    uppercase: function() {
      return "NULL";
    },
    camelcase: function() {
      return "Null";
    },
    empty: function() {
      return "";
    }
  },
  defaultStyle: "lowercase"
});
function resolveYamlBoolean(data) {
  if (data === null) return false;
  var max = data.length;
  return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
}
function constructYamlBoolean(data) {
  return data === "true" || data === "True" || data === "TRUE";
}
function isBoolean(object) {
  return Object.prototype.toString.call(object) === "[object Boolean]";
}
var bool = new type("tag:yaml.org,2002:bool", {
  kind: "scalar",
  resolve: resolveYamlBoolean,
  construct: constructYamlBoolean,
  predicate: isBoolean,
  represent: {
    lowercase: function(object) {
      return object ? "true" : "false";
    },
    uppercase: function(object) {
      return object ? "TRUE" : "FALSE";
    },
    camelcase: function(object) {
      return object ? "True" : "False";
    }
  },
  defaultStyle: "lowercase"
});
function isHexCode(c) {
  return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
}
function isOctCode(c) {
  return 48 <= c && c <= 55;
}
function isDecCode(c) {
  return 48 <= c && c <= 57;
}
function resolveYamlInteger(data) {
  if (data === null) return false;
  var max = data.length, index = 0, hasDigits = false, ch;
  if (!max) return false;
  ch = data[index];
  if (ch === "-" || ch === "+") {
    ch = data[++index];
  }
  if (ch === "0") {
    if (index + 1 === max) return true;
    ch = data[++index];
    if (ch === "b") {
      index++;
      for (; index < max; index++) {
        ch = data[index];
        if (ch === "_") continue;
        if (ch !== "0" && ch !== "1") return false;
        hasDigits = true;
      }
      return hasDigits && ch !== "_";
    }
    if (ch === "x") {
      index++;
      for (; index < max; index++) {
        ch = data[index];
        if (ch === "_") continue;
        if (!isHexCode(data.charCodeAt(index))) return false;
        hasDigits = true;
      }
      return hasDigits && ch !== "_";
    }
    if (ch === "o") {
      index++;
      for (; index < max; index++) {
        ch = data[index];
        if (ch === "_") continue;
        if (!isOctCode(data.charCodeAt(index))) return false;
        hasDigits = true;
      }
      return hasDigits && ch !== "_";
    }
  }
  if (ch === "_") return false;
  for (; index < max; index++) {
    ch = data[index];
    if (ch === "_") continue;
    if (!isDecCode(data.charCodeAt(index))) {
      return false;
    }
    hasDigits = true;
  }
  if (!hasDigits || ch === "_") return false;
  return true;
}
function constructYamlInteger(data) {
  var value = data, sign = 1, ch;
  if (value.indexOf("_") !== -1) {
    value = value.replace(/_/g, "");
  }
  ch = value[0];
  if (ch === "-" || ch === "+") {
    if (ch === "-") sign = -1;
    value = value.slice(1);
    ch = value[0];
  }
  if (value === "0") return 0;
  if (ch === "0") {
    if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
    if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
    if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
  }
  return sign * parseInt(value, 10);
}
function isInteger(object) {
  return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
}
var int = new type("tag:yaml.org,2002:int", {
  kind: "scalar",
  resolve: resolveYamlInteger,
  construct: constructYamlInteger,
  predicate: isInteger,
  represent: {
    binary: function(obj) {
      return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
    },
    octal: function(obj) {
      return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
    },
    decimal: function(obj) {
      return obj.toString(10);
    },
    /* eslint-disable max-len */
    hexadecimal: function(obj) {
      return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
    }
  },
  defaultStyle: "decimal",
  styleAliases: {
    binary: [2, "bin"],
    octal: [8, "oct"],
    decimal: [10, "dec"],
    hexadecimal: [16, "hex"]
  }
});
var YAML_FLOAT_PATTERN = new RegExp(
  // 2.5e4, 2.5 and integers
  "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
);
function resolveYamlFloat(data) {
  if (data === null) return false;
  if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
  // Probably should update regexp & check speed
  data[data.length - 1] === "_") {
    return false;
  }
  return true;
}
function constructYamlFloat(data) {
  var value, sign;
  value = data.replace(/_/g, "").toLowerCase();
  sign = value[0] === "-" ? -1 : 1;
  if ("+-".indexOf(value[0]) >= 0) {
    value = value.slice(1);
  }
  if (value === ".inf") {
    return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
  } else if (value === ".nan") {
    return NaN;
  }
  return sign * parseFloat(value, 10);
}
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
function representYamlFloat(object, style) {
  var res;
  if (isNaN(object)) {
    switch (style) {
      case "lowercase":
        return ".nan";
      case "uppercase":
        return ".NAN";
      case "camelcase":
        return ".NaN";
    }
  } else if (Number.POSITIVE_INFINITY === object) {
    switch (style) {
      case "lowercase":
        return ".inf";
      case "uppercase":
        return ".INF";
      case "camelcase":
        return ".Inf";
    }
  } else if (Number.NEGATIVE_INFINITY === object) {
    switch (style) {
      case "lowercase":
        return "-.inf";
      case "uppercase":
        return "-.INF";
      case "camelcase":
        return "-.Inf";
    }
  } else if (common.isNegativeZero(object)) {
    return "-0.0";
  }
  res = object.toString(10);
  return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
}
function isFloat(object) {
  return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
}
var float = new type("tag:yaml.org,2002:float", {
  kind: "scalar",
  resolve: resolveYamlFloat,
  construct: constructYamlFloat,
  predicate: isFloat,
  represent: representYamlFloat,
  defaultStyle: "lowercase"
});
var json = failsafe.extend({
  implicit: [
    _null,
    bool,
    int,
    float
  ]
});
var core = json;
var YAML_DATE_REGEXP = new RegExp(
  "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
);
var YAML_TIMESTAMP_REGEXP = new 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 resolveYamlTimestamp(data) {
  if (data === null) return false;
  if (YAML_DATE_REGEXP.exec(data) !== null) return true;
  if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
  return false;
}
function constructYamlTimestamp(data) {
  var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
  match = YAML_DATE_REGEXP.exec(data);
  if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
  if (match === null) throw new Error("Date resolve error");
  year = +match[1];
  month = +match[2] - 1;
  day = +match[3];
  if (!match[4]) {
    return new Date(Date.UTC(year, month, day));
  }
  hour = +match[4];
  minute = +match[5];
  second = +match[6];
  if (match[7]) {
    fraction = match[7].slice(0, 3);
    while (fraction.length < 3) {
      fraction += "0";
    }
    fraction = +fraction;
  }
  if (match[9]) {
    tz_hour = +match[10];
    tz_minute = +(match[11] || 0);
    delta = (tz_hour * 60 + tz_minute) * 6e4;
    if (match[9] === "-") delta = -delta;
  }
  date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
  if (delta) date.setTime(date.getTime() - delta);
  return date;
}
function representYamlTimestamp(object) {
  return object.toISOString();
}
var timestamp = new type("tag:yaml.org,2002:timestamp", {
  kind: "scalar",
  resolve: resolveYamlTimestamp,
  construct: constructYamlTimestamp,
  instanceOf: Date,
  represent: representYamlTimestamp
});
function resolveYamlMerge(data) {
  return data === "<<" || data === null;
}
var merge = new type("tag:yaml.org,2002:merge", {
  kind: "scalar",
  resolve: resolveYamlMerge
});
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
function resolveYamlBinary(data) {
  if (data === null) return false;
  var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
  for (idx = 0; idx < max; idx++) {
    code = map2.indexOf(data.charAt(idx));
    if (code > 64) continue;
    if (code < 0) return false;
    bitlen += 6;
  }
  return bitlen % 8 === 0;
}
function constructYamlBinary(data) {
  var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
  for (idx = 0; idx < max; idx++) {
    if (idx % 4 === 0 && idx) {
      result.push(bits >> 16 & 255);
      result.push(bits >> 8 & 255);
      result.push(bits & 255);
    }
    bits = bits << 6 | map2.indexOf(input.charAt(idx));
  }
  tailbits = max % 4 * 6;
  if (tailbits === 0) {
    result.push(bits >> 16 & 255);
    result.push(bits >> 8 & 255);
    result.push(bits & 255);
  } else if (tailbits === 18) {
    result.push(bits >> 10 & 255);
    result.push(bits >> 2 & 255);
  } else if (tailbits === 12) {
    result.push(bits >> 4 & 255);
  }
  return new Uint8Array(result);
}
function representYamlBinary(object) {
  var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
  for (idx = 0; idx < max; idx++) {
    if (idx % 3 === 0 && idx) {
      result += map2[bits >> 18 & 63];
      result += map2[bits >> 12 & 63];
      result += map2[bits >> 6 & 63];
      result += map2[bits & 63];
    }
    bits = (bits << 8) + object[idx];
  }
  tail = max % 3;
  if (tail === 0) {
    result += map2[bits >> 18 & 63];
    result += map2[bits >> 12 & 63];
    result += map2[bits >> 6 & 63];
    result += map2[bits & 63];
  } else if (tail === 2) {
    result += map2[bits >> 10 & 63];
    result += map2[bits >> 4 & 63];
    result += map2[bits << 2 & 63];
    result += map2[64];
  } else if (tail === 1) {
    result += map2[bits >> 2 & 63];
    result += map2[bits << 4 & 63];
    result += map2[64];
    result += map2[64];
  }
  return result;
}
function isBinary(obj) {
  return Object.prototype.toString.call(obj) === "[object Uint8Array]";
}
var binary = new type("tag:yaml.org,2002:binary", {
  kind: "scalar",
  resolve: resolveYamlBinary,
  construct: constructYamlBinary,
  predicate: isBinary,
  represent: representYamlBinary
});
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
var _toString$2 = Object.prototype.toString;
function resolveYamlOmap(data) {
  if (data === null) return true;
  var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
  for (index = 0, length = object.length; index < length; index += 1) {
    pair = object[index];
    pairHasKey = false;
    if (_toString$2.call(pair) !== "[object Object]") return false;
    for (pairKey in pair) {
      if (_hasOwnProperty$3.call(pair, pairKey)) {
        if (!pairHasKey) pairHasKey = true;
        else return false;
      }
    }
    if (!pairHasKey) return false;
    if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
    else return false;
  }
  return true;
}
function constructYamlOmap(data) {
  return data !== null ? data : [];
}
var omap = new type("tag:yaml.org,2002:omap", {
  kind: "sequence",
  resolve: resolveYamlOmap,
  construct: constructYamlOmap
});
var _toString$1 = Object.prototype.toString;
function resolveYamlPairs(data) {
  if (data === null) return true;
  var index, length, pair, keys, result, object = data;
  result = new Array(object.length);
  for (index = 0, length = object.length; index < length; index += 1) {
    pair = object[index];
    if (_toString$1.call(pair) !== "[object Object]") return false;
    keys = Object.keys(pair);
    if (keys.length !== 1) return false;
    result[index] = [keys[0], pair[keys[0]]];
  }
  return true;
}
function constructYamlPairs(data) {
  if (data === null) return [];
  var index, length, pair, keys, result, object = data;
  result = new Array(object.length);
  for (index = 0, length = object.length; index < length; index += 1) {
    pair = object[index];
    keys = Object.keys(pair);
    result[index] = [keys[0], pair[keys[0]]];
  }
  return result;
}
var pairs = new type("tag:yaml.org,2002:pairs", {
  kind: "sequence",
  resolve: resolveYamlPairs,
  construct: constructYamlPairs
});
var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
function resolveYamlSet(data) {
  if (data === null) return true;
  var key, object = data;
  for (key in object) {
    if (_hasOwnProperty$2.call(object, key)) {
      if (object[key] !== null) return false;
    }
  }
  return true;
}
function constructYamlSet(data) {
  return data !== null ? data : {};
}
var set = new type("tag:yaml.org,2002:set", {
  kind: "mapping",
  resolve: resolveYamlSet,
  construct: constructYamlSet
});
var _default = core.extend({
  implicit: [
    timestamp,
    merge
  ],
  explicit: [
    binary,
    omap,
    pairs,
    set
  ]
});
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
var CONTEXT_FLOW_IN = 1;
var CONTEXT_FLOW_OUT = 2;
var CONTEXT_BLOCK_IN = 3;
var CONTEXT_BLOCK_OUT = 4;
var CHOMPING_CLIP = 1;
var CHOMPING_STRIP = 2;
var CHOMPING_KEEP = 3;
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
function _class(obj) {
  return Object.prototype.toString.call(obj);
}
function is_EOL(c) {
  return c === 10 || c === 13;
}
function is_WHITE_SPACE(c) {
  return c === 9 || c === 32;
}
function is_WS_OR_EOL(c) {
  return c === 9 || c === 32 || c === 10 || c === 13;
}
function is_FLOW_INDICATOR(c) {
  return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
}
function fromHexCode(c) {
  var lc;
  if (48 <= c && c <= 57) {
    return c - 48;
  }
  lc = c | 32;
  if (97 <= lc && lc <= 102) {
    return lc - 97 + 10;
  }
  return -1;
}
function escapedHexLen(c) {
  if (c === 120) {
    return 2;
  }
  if (c === 117) {
    return 4;
  }
  if (c === 85) {
    return 8;
  }
  return 0;
}
function fromDecimalCode(c) {
  if (48 <= c && c <= 57) {
    return c - 48;
  }
  return -1;
}
function simpleEscapeSequence(c) {
  return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "	" : c === 9 ? "	" : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
}
function charFromCodepoint(c) {
  if (c <= 65535) {
    return String.fromCharCode(c);
  }
  return String.fromCharCode(
    (c - 65536 >> 10) + 55296,
    (c - 65536 & 1023) + 56320
  );
}
function setProperty(object, key, value) {
  if (key === "__proto__") {
    Object.defineProperty(object, key, {
      configurable: true,
      enumerable: true,
      writable: true,
      value
    });
  } else {
    object[key] = value;
  }
}
var simpleEscapeCheck = new Array(256);
var simpleEscapeMap = new Array(256);
for (i = 0; i < 256; i++) {
  simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
  simpleEscapeMap[i] = simpleEscapeSequence(i);
}
var i;
function State$1(input, options) {
  this.input = input;
  this.filename = options["filename"] || null;
  this.schema = options["schema"] || _default;
  this.onWarning = options["onWarning"] || null;
  this.legacy = options["legacy"] || false;
  this.json = options["json"] || false;
  this.listener = options["listener"] || null;
  this.implicitTypes = this.schema.compiledImplicit;
  this.typeMap = this.schema.compiledTypeMap;
  this.length = input.length;
  this.position = 0;
  this.line = 0;
  this.lineStart = 0;
  this.lineIndent = 0;
  this.firstTabInLine = -1;
  this.documents = [];
}
function generateError(state, message) {
  var mark = {
    name: state.filename,
    buffer: state.input.slice(0, -1),
    // omit trailing \0
    position: state.position,
    line: state.line,
    column: state.position - state.lineStart
  };
  mark.snippet = snippet(mark);
  return new exception(message, mark);
}
function throwError(state, message) {
  throw generateError(state, message);
}
function throwWarning(state, message) {
  if (state.onWarning) {
    state.onWarning.call(null, generateError(state, message));
  }
}
var directiveHandlers = {
  YAML: function handleYamlDirective(state, name, args) {
    var match, major, minor;
    if (state.version !== null) {
      throwError(state, "duplication of %YAML directive");
    }
    if (args.length !== 1) {
      throwError(state, "YAML directive accepts exactly one argument");
    }
    match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
    if (match === null) {
      throwError(state, "ill-formed argument of the YAML directive");
    }
    major = parseInt(match[1], 10);
    minor = parseInt(match[2], 10);
    if (major !== 1) {
      throwError(state, "unacceptable YAML version of the document");
    }
    state.version = args[0];
    state.checkLineBreaks = minor < 2;
    if (minor !== 1 && minor !== 2) {
      throwWarning(state, "unsupported YAML version of the document");
    }
  },
  TAG: function handleTagDirective(state, name, args) {
    var handle, prefix;
    if (args.length !== 2) {
      throwError(state, "TAG directive accepts exactly two arguments");
    }
    handle = args[0];
    prefix = args[1];
    if (!PATTERN_TAG_HANDLE.test(handle)) {
      throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
    }
    if (_hasOwnProperty$1.call(state.tagMap, handle)) {
      throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
    }
    if (!PATTERN_TAG_URI.test(prefix)) {
      throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
    }
    try {
      prefix = decodeURIComponent(prefix);
    } catch (err) {
      throwError(state, "tag prefix is malformed: " + prefix);
    }
    state.tagMap[handle] = prefix;
  }
};
function captureSegment(state, start, end, checkJson) {
  var _position, _length, _character, _result;
  if (start < end) {
    _result = state.input.slice(start, end);
    if (checkJson) {
      for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
        _character = _result.charCodeAt(_position);
        if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
          throwError(state, "expected valid JSON character");
        }
      }
    } else if (PATTERN_NON_PRINTABLE.test(_result)) {
      throwError(state, "the stream contains non-printable characters");
    }
    state.result += _result;
  }
}
function mergeMappings(state, destination, source, overridableKeys) {
  var sourceKeys, key, index, quantity;
  if (!common.isObject(source)) {
    throwError(state, "cannot merge mappings; the provided source object is unacceptable");
  }
  sourceKeys = Object.keys(source);
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
    key = sourceKeys[index];
    if (!_hasOwnProperty$1.call(destination, key)) {
      setProperty(destination, key, source[key]);
      overridableKeys[key] = true;
    }
  }
}
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
  var index, quantity;
  if (Array.isArray(keyNode)) {
    keyNode = Array.prototype.slice.call(keyNode);
    for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
      if (Array.isArray(keyNode[index])) {
        throwError(state, "nested arrays are not supported inside keys");
      }
      if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
        keyNode[index] = "[object Object]";
      }
    }
  }
  if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
    keyNode = "[object Object]";
  }
  keyNode = String(keyNode);
  if (_result === null) {
    _result = {};
  }
  if (keyTag === "tag:yaml.org,2002:merge") {
    if (Array.isArray(valueNode)) {
      for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
        mergeMappings(state, _result, valueNode[index], overridableKeys);
      }
    } else {
      mergeMappings(state, _result, valueNode, overridableKeys);
    }
  } else {
    if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
      state.line = startLine || state.line;
      state.lineStart = startLineStart || state.lineStart;
      state.position = startPos || state.position;
      throwError(state, "duplicated mapping key");
    }
    setProperty(_result, keyNode, valueNode);
    delete overridableKeys[keyNode];
  }
  return _result;
}
function readLineBreak(state) {
  var ch;
  ch = state.input.charCodeAt(state.position);
  if (ch === 10) {
    state.position++;
  } else if (ch === 13) {
    state.position++;
    if (state.input.charCodeAt(state.position) === 10) {
      state.position++;
    }
  } else {
    throwError(state, "a line break is expected");
  }
  state.line += 1;
  state.lineStart = state.position;
  state.firstTabInLine = -1;
}
function skipSeparationSpace(state, allowComments, checkIndent) {
  var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
  while (ch !== 0) {
    while (is_WHITE_SPACE(ch)) {
      if (ch === 9 && state.firstTabInLine === -1) {
        state.firstTabInLine = state.position;
      }
      ch = state.input.charCodeAt(++state.position);
    }
    if (allowComments && ch === 35) {
      do {
        ch = state.input.charCodeAt(++state.position);
      } while (ch !== 10 && ch !== 13 && ch !== 0);
    }
    if (is_EOL(ch)) {
      readLineBreak(state);
      ch = state.input.charCodeAt(state.position);
      lineBreaks++;
      state.lineIndent = 0;
      while (ch === 32) {
        state.lineIndent++;
        ch = state.input.charCodeAt(++state.position);
      }
    } else {
      break;
    }
  }
  if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
    throwWarning(state, "deficient indentation");
  }
  return lineBreaks;
}
function testDocumentSeparator(state) {
  var _position = state.position, ch;
  ch = state.input.charCodeAt(_position);
  if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
    _position += 3;
    ch = state.input.charCodeAt(_position);
    if (ch === 0 || is_WS_OR_EOL(ch)) {
      return true;
    }
  }
  return false;
}
function writeFoldedLines(state, count) {
  if (count === 1) {
    state.result += " ";
  } else if (count > 1) {
    state.result += common.repeat("\n", count - 1);
  }
}
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
  var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
  ch = state.input.charCodeAt(state.position);
  if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
    return false;
  }
  if (ch === 63 || ch === 45) {
    following = state.input.charCodeAt(state.position + 1);
    if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
      return false;
    }
  }
  state.kind = "scalar";
  state.result = "";
  captureStart = captureEnd = state.position;
  hasPendingContent = false;
  while (ch !== 0) {
    if (ch === 58) {
      following = state.input.charCodeAt(state.position + 1);
      if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
        break;
      }
    } else if (ch === 35) {
      preceding = state.input.charCodeAt(state.position - 1);
      if (is_WS_OR_EOL(preceding)) {
        break;
      }
    } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
      break;
    } else if (is_EOL(ch)) {
      _line = state.line;
      _lineStart = state.lineStart;
      _lineIndent = state.lineIndent;
      skipSeparationSpace(state, false, -1);
      if (state.lineIndent >= nodeIndent) {
        hasPendingContent = true;
        ch = state.input.charCodeAt(state.position);
        continue;
      } else {
        state.position = captureEnd;
        state.line = _line;
        state.lineStart = _lineStart;
        state.lineIndent = _lineIndent;
        break;
      }
    }
    if (hasPendingContent) {
      captureSegment(state, captureStart, captureEnd, false);
      writeFoldedLines(state, state.line - _line);
      captureStart = captureEnd = state.position;
      hasPendingContent = false;
    }
    if (!is_WHITE_SPACE(ch)) {
      captureEnd = state.position + 1;
    }
    ch = state.input.charCodeAt(++state.position);
  }
  captureSegment(state, captureStart, captureEnd, false);
  if (state.result) {
    return true;
  }
  state.kind = _kind;
  state.result = _result;
  return false;
}
function readSingleQuotedScalar(state, nodeIndent) {
  var ch, captureStart, captureEnd;
  ch = state.input.charCodeAt(state.position);
  if (ch !== 39) {
    return false;
  }
  state.kind = "scalar";
  state.result = "";
  state.position++;
  captureStart = captureEnd = state.position;
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
    if (ch === 39) {
      captureSegment(state, captureStart, state.position, true);
      ch = state.input.charCodeAt(++state.position);
      if (ch === 39) {
        captureStart = state.position;
        state.position++;
        captureEnd = state.position;
      } else {
        return true;
      }
    } else if (is_EOL(ch)) {
      captureSegment(state, captureStart, captureEnd, true);
      writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
      captureStart = captureEnd = state.position;
    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
      throwError(state, "unexpected end of the document within a single quoted scalar");
    } else {
      state.position++;
      captureEnd = state.position;
    }
  }
  throwError(state, "unexpected end of the stream within a single quoted scalar");
}
function readDoubleQuotedScalar(state, nodeIndent) {
  var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
  ch = state.input.charCodeAt(state.position);
  if (ch !== 34) {
    return false;
  }
  state.kind = "scalar";
  state.result = "";
  state.position++;
  captureStart = captureEnd = state.position;
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
    if (ch === 34) {
      captureSegment(state, captureStart, state.position, true);
      state.position++;
      return true;
    } else if (ch === 92) {
      captureSegment(state, captureStart, state.position, true);
      ch = state.input.charCodeAt(++state.position);
      if (is_EOL(ch)) {
        skipSeparationSpace(state, false, nodeIndent);
      } else if (ch < 256 && simpleEscapeCheck[ch]) {
        state.result += simpleEscapeMap[ch];
        state.position++;
      } else if ((tmp = escapedHexLen(ch)) > 0) {
        hexLength = tmp;
        hexResult = 0;
        for (; hexLength > 0; hexLength--) {
          ch = state.input.charCodeAt(++state.position);
          if ((tmp = fromHexCode(ch)) >= 0) {
            hexResult = (hexResult << 4) + tmp;
          } else {
            throwError(state, "expected hexadecimal character");
          }
        }
        state.result += charFromCodepoint(hexResult);
        state.position++;
      } else {
        throwError(state, "unknown escape sequence");
      }
      captureStart = captureEnd = state.position;
    } else if (is_EOL(ch)) {
      captureSegment(state, captureStart, captureEnd, true);
      writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
      captureStart = captureEnd = state.position;
    } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
      throwError(state, "unexpected end of the document within a double quoted scalar");
    } else {
      state.position++;
      captureEnd = state.position;
    }
  }
  throwError(state, "unexpected end of the stream within a double quoted scalar");
}
function readFlowCollection(state, nodeIndent) {
  var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
  ch = state.input.charCodeAt(state.position);
  if (ch === 91) {
    terminator = 93;
    isMapping = false;
    _result = [];
  } else if (ch === 123) {
    terminator = 125;
    isMapping = true;
    _result = {};
  } else {
    return false;
  }
  if (state.anchor !== null) {
    state.anchorMap[state.anchor] = _result;
  }
  ch = state.input.charCodeAt(++state.position);
  while (ch !== 0) {
    skipSeparationSpace(state, true, nodeIndent);
    ch = state.input.charCodeAt(state.position);
    if (ch === terminator) {
      state.position++;
      state.tag = _tag;
      state.anchor = _anchor;
      state.kind = isMapping ? "mapping" : "sequence";
      state.result = _result;
      return true;
    } else if (!readNext) {
      throwError(state, "missed comma between flow collection entries");
    } else if (ch === 44) {
      throwError(state, "expected the node content, but found ','");
    }
    keyTag = keyNode = valueNode = null;
    isPair = isExplicitPair = false;
    if (ch === 63) {
      following = state.input.charCodeAt(state.position + 1);
      if (is_WS_OR_EOL(following)) {
        isPair = isExplicitPair = true;
        state.position++;
        skipSeparationSpace(state, true, nodeIndent);
      }
    }
    _line = state.line;
    _lineStart = state.lineStart;
    _pos = state.position;
    composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
    keyTag = state.tag;
    keyNode = state.result;
    skipSeparationSpace(state, true, nodeIndent);
    ch = state.input.charCodeAt(state.position);
    if ((isExplicitPair || state.line === _line) && ch === 58) {
      isPair = true;
      ch = state.input.charCodeAt(++state.position);
      skipSeparationSpace(state, true, nodeIndent);
      composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
      valueNode = state.result;
    }
    if (isMapping) {
      storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
    } else if (isPair) {
      _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
    } else {
      _result.push(keyNode);
    }
    skipSeparationSpace(state, true, nodeIndent);
    ch = state.input.charCodeAt(state.position);
    if (ch === 44) {
      readNext = true;
      ch = state.input.charCodeAt(++state.position);
    } else {
      readNext = false;
    }
  }
  throwError(state, "unexpected end of the stream within a flow collection");
}
function readBlockScalar(state, nodeIndent) {
  var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
  ch = state.input.charCodeAt(state.position);
  if (ch === 124) {
    folding = false;
  } else if (ch === 62) {
    folding = true;
  } else {
    return false;
  }
  state.kind = "scalar";
  state.result = "";
  while (ch !== 0) {
    ch = state.input.charCodeAt(++state.position);
    if (ch === 43 || ch === 45) {
      if (CHOMPING_CLIP === chomping) {
        chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
      } else {
        throwError(state, "repeat of a chomping mode identifier");
      }
    } else if ((tmp = fromDecimalCode(ch)) >= 0) {
      if (tmp === 0) {
        throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
      } else if (!detectedIndent) {
        textIndent = nodeIndent + tmp - 1;
        detectedIndent = true;
      } else {
        throwError(state, "repeat of an indentation width identifier");
      }
    } else {
      break;
    }
  }
  if (is_WHITE_SPACE(ch)) {
    do {
      ch = state.input.charCodeAt(++state.position);
    } while (is_WHITE_SPACE(ch));
    if (ch === 35) {
      do {
        ch = state.input.charCodeAt(++state.position);
      } while (!is_EOL(ch) && ch !== 0);
    }
  }
  while (ch !== 0) {
    readLineBreak(state);
    state.lineIndent = 0;
    ch = state.input.charCodeAt(state.position);
    while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
      state.lineIndent++;
      ch = state.input.charCodeAt(++state.position);
    }
    if (!detectedIndent && state.lineIndent > textIndent) {
      textIndent = state.lineIndent;
    }
    if (is_EOL(ch)) {
      emptyLines++;
      continue;
    }
    if (state.lineIndent < textIndent) {
      if (chomping === CHOMPING_KEEP) {
        state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
      } else if (chomping === CHOMPING_CLIP) {
        if (didReadContent) {
          state.result += "\n";
        }
      }
      break;
    }
    if (folding) {
      if (is_WHITE_SPACE(ch)) {
        atMoreIndented = true;
        state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
      } else if (atMoreIndented) {
        atMoreIndented = false;
        state.result += common.repeat("\n", emptyLines + 1);
      } else if (emptyLines === 0) {
        if (didReadContent) {
          state.result += " ";
        }
      } else {
        state.result += common.repeat("\n", emptyLines);
      }
    } else {
      state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
    }
    didReadContent = true;
    detectedIndent = true;
    emptyLines = 0;
    captureStart = state.position;
    while (!is_EOL(ch) && ch !== 0) {
      ch = state.input.charCodeAt(++state.position);
    }
    captureSegment(state, captureStart, state.position, false);
  }
  return true;
}
function readBlockSequence(state, nodeIndent) {
  var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
  if (state.firstTabInLine !== -1) return false;
  if (state.anchor !== null) {
    state.anchorMap[state.anchor] = _result;
  }
  ch = state.input.charCodeAt(state.position);
  while (ch !== 0) {
    if (state.firstTabInLine !== -1) {
      state.position = state.firstTabInLine;
      throwError(state, "tab characters must not be used in indentation");
    }
    if (ch !== 45) {
      break;
    }
    following = state.input.charCodeAt(state.position + 1);
    if (!is_WS_OR_EOL(following)) {
      break;
    }
    detected = true;
    state.position++;
    if (skipSeparationSpace(state, true, -1)) {
      if (state.lineIndent <= nodeIndent) {
        _result.push(null);
        ch = state.input.charCodeAt(state.position);
        continue;
      }
    }
    _line = state.line;
    composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
    _result.push(state.result);
    skipSeparationSpace(state, true, -1);
    ch = state.input.charCodeAt(state.position);
    if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
      throwError(state, "bad indentation of a sequence entry");
    } else if (state.lineIndent < nodeIndent) {
      break;
    }
  }
  if (detected) {
    state.tag = _tag;
    state.anchor = _anchor;
    state.kind = "sequence";
    state.result = _result;
    return true;
  }
  return false;
}
function readBlockMapping(state, nodeIndent, flowIndent) {
  var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
  if (state.firstTabInLine !== -1) return false;
  if (state.anchor !== null) {
    state.anchorMap[state.anchor] = _result;
  }
  ch = state.input.charCodeAt(state.position);
  while (ch !== 0) {
    if (!atExplicitKey && state.firstTabInLine !== -1) {
      state.position = state.firstTabInLine;
      throwError(state, "tab characters must not be used in indentation");
    }
    following = state.input.charCodeAt(state.position + 1);
    _line = state.line;
    if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
      if (ch === 63) {
        if (atExplicitKey) {
          storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
          keyTag = keyNode = valueNode = null;
        }
        detected = true;
        atExplicitKey = true;
        allowCompact = true;
      } else if (atExplicitKey) {
        atExplicitKey = false;
        allowCompact = true;
      } else {
        throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
      }
      state.position += 1;
      ch = following;
    } else {
      _keyLine = state.line;
      _keyLineStart = state.lineStart;
      _keyPos = state.position;
      if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
        break;
      }
      if (state.line === _line) {
        ch = state.input.charCodeAt(state.position);
        while (is_WHITE_SPACE(ch)) {
          ch = state.input.charCodeAt(++state.position);
        }
        if (ch === 58) {
          ch = state.input.charCodeAt(++state.position);
          if (!is_WS_OR_EOL(ch)) {
            throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
          }
          if (atExplicitKey) {
            storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
            keyTag = keyNode = valueNode = null;
          }
          detected = true;
          atExplicitKey = false;
          allowCompact = false;
          keyTag = state.tag;
          keyNode = state.result;
        } else if (detected) {
          throwError(state, "can not read an implicit mapping pair; a colon is missed");
        } else {
          state.tag = _tag;
          state.anchor = _anchor;
          return true;
        }
      } else if (detected) {
        throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
      } else {
        state.tag = _tag;
        state.anchor = _anchor;
        return true;
      }
    }
    if (state.line === _line || state.lineIndent > nodeIndent) {
      if (atExplicitKey) {
        _keyLine = state.line;
        _keyLineStart = state.lineStart;
        _keyPos = state.position;
      }
      if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
        if (atExplicitKey) {
          keyNode = state.result;
        } else {
          valueNode = state.result;
        }
      }
      if (!atExplicitKey) {
        storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
        keyTag = keyNode = valueNode = null;
      }
      skipSeparationSpace(state, true, -1);
      ch = state.input.charCodeAt(state.position);
    }
    if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
      throwError(state, "bad indentation of a mapping entry");
    } else if (state.lineIndent < nodeIndent) {
      break;
    }
  }
  if (atExplicitKey) {
    storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
  }
  if (detected) {
    state.tag = _tag;
    state.anchor = _anchor;
    state.kind = "mapping";
    state.result = _result;
  }
  return detected;
}
function readTagProperty(state) {
  var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
  ch = state.input.charCodeAt(state.position);
  if (ch !== 33) return false;
  if (state.tag !== null) {
    throwError(state, "duplication of a tag property");
  }
  ch = state.input.charCodeAt(++state.position);
  if (ch === 60) {
    isVerbatim = true;
    ch = state.input.charCodeAt(++state.position);
  } else if (ch === 33) {
    isNamed = true;
    tagHandle = "!!";
    ch = state.input.charCodeAt(++state.position);
  } else {
    tagHandle = "!";
  }
  _position = state.position;
  if (isVerbatim) {
    do {
      ch = state.input.charCodeAt(++state.position);
    } while (ch !== 0 && ch !== 62);
    if (state.position < state.length) {
      tagName = state.input.slice(_position, state.position);
      ch = state.input.charCodeAt(++state.position);
    } else {
      throwError(state, "unexpected end of the stream within a verbatim tag");
    }
  } else {
    while (ch !== 0 && !is_WS_OR_EOL(ch)) {
      if (ch === 33) {
        if (!isNamed) {
          tagHandle = state.input.slice(_position - 1, state.position + 1);
          if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
            throwError(state, "named tag handle cannot contain such characters");
          }
          isNamed = true;
          _position = state.position + 1;
        } else {
          throwError(state, "tag suffix cannot contain exclamation marks");
        }
      }
      ch = state.input.charCodeAt(++state.position);
    }
    tagName = state.input.slice(_position, state.position);
    if (PATTERN_FLOW_INDICATORS.test(tagName)) {
      throwError(state, "tag suffix cannot contain flow indicator characters");
    }
  }
  if (tagName && !PATTERN_TAG_URI.test(tagName)) {
    throwError(state, "tag name cannot contain such characters: " + tagName);
  }
  try {
    tagName = decodeURIComponent(tagName);
  } catch (err) {
    throwError(state, "tag name is malformed: " + tagName);
  }
  if (isVerbatim) {
    state.tag = tagName;
  } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
    state.tag = state.tagMap[tagHandle] + tagName;
  } else if (tagHandle === "!") {
    state.tag = "!" + tagName;
  } else if (tagHandle === "!!") {
    state.tag = "tag:yaml.org,2002:" + tagName;
  } else {
    throwError(state, 'undeclared tag handle "' + tagHandle + '"');
  }
  return true;
}
function readAnchorProperty(state) {
  var _position, ch;
  ch = state.input.charCodeAt(state.position);
  if (ch !== 38) return false;
  if (state.anchor !== null) {
    throwError(state, "duplication of an anchor property");
  }
  ch = state.input.charCodeAt(++state.position);
  _position = state.position;
  while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
    ch = state.input.charCodeAt(++state.position);
  }
  if (state.position === _position) {
    throwError(state, "name of an anchor node must contain at least one character");
  }
  state.anchor = state.input.slice(_position, state.position);
  return true;
}
function readAlias(state) {
  var _position, alias, ch;
  ch = state.input.charCodeAt(state.position);
  if (ch !== 42) return false;
  ch = state.input.charCodeAt(++state.position);
  _position = state.position;
  while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
    ch = state.input.charCodeAt(++state.position);
  }
  if (state.position === _position) {
    throwError(state, "name of an alias node must contain at least one character");
  }
  alias = state.input.slice(_position, state.position);
  if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
    throwError(state, 'unidentified alias "' + alias + '"');
  }
  state.result = state.anchorMap[alias];
  skipSeparationSpace(state, true, -1);
  return true;
}
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
  var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
  if (state.listener !== null) {
    state.listener("open", state);
  }
  state.tag = null;
  state.anchor = null;
  state.kind = null;
  state.result = null;
  allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
  if (allowToSeek) {
    if (skipSeparationSpace(state, true, -1)) {
      atNewLine = true;
      if (state.lineIndent > parentIndent) {
        indentStatus = 1;
      } else if (state.lineIndent === parentIndent) {
        indentStatus = 0;
      } else if (state.lineIndent < parentIndent) {
        indentStatus = -1;
      }
    }
  }
  if (indentStatus === 1) {
    while (readTagProperty(state) || readAnchorProperty(state)) {
      if (skipSeparationSpace(state, true, -1)) {
        atNewLine = true;
        allowBlockCollections = allowBlockStyles;
        if (state.lineIndent > parentIndent) {
          indentStatus = 1;
        } else if (state.lineIndent === parentIndent) {
          indentStatus = 0;
        } else if (state.lineIndent < parentIndent) {
          indentStatus = -1;
        }
      } else {
        allowBlockCollections = false;
      }
    }
  }
  if (allowBlockCollections) {
    allowBlockCollections = atNewLine || allowCompact;
  }
  if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
    if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
      flowIndent = parentIndent;
    } else {
      flowIndent = parentIndent + 1;
    }
    blockIndent = state.position - state.lineStart;
    if (indentStatus === 1) {
      if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
        hasContent = true;
      } else {
        if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
          hasContent = true;
        } else if (readAlias(state)) {
          hasContent = true;
          if (state.tag !== null || state.anchor !== null) {
            throwError(state, "alias node should not have any properties");
          }
        } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
          hasContent = true;
          if (state.tag === null) {
            state.tag = "?";
          }
        }
        if (state.anchor !== null) {
          state.anchorMap[state.anchor] = state.result;
        }
      }
    } else if (indentStatus === 0) {
      hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
    }
  }
  if (state.tag === null) {
    if (state.anchor !== null) {
      state.anchorMap[state.anchor] = state.result;
    }
  } else if (state.tag === "?") {
    if (state.result !== null && state.kind !== "scalar") {
      throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
    }
    for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
      type2 = state.implicitTypes[typeIndex];
      if (type2.resolve(state.result)) {
        state.result = type2.construct(state.result);
        state.tag = type2.tag;
        if (state.anchor !== null) {
          state.anchorMap[state.anchor] = state.result;
        }
        break;
      }
    }
  } else if (state.tag !== "!") {
    if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
      type2 = state.typeMap[state.kind || "fallback"][state.tag];
    } else {
      type2 = null;
      typeList = state.typeMap.multi[state.kind || "fallback"];
      for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
        if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
          type2 = typeList[typeIndex];
          break;
        }
      }
    }
    if (!type2) {
      throwError(state, "unknown tag !<" + state.tag + ">");
    }
    if (state.result !== null && type2.kind !== state.kind) {
      throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
    }
    if (!type2.resolve(state.result, state.tag)) {
      throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
    } else {
      state.result = type2.construct(state.result, state.tag);
      if (state.anchor !== null) {
        state.anchorMap[state.anchor] = state.result;
      }
    }
  }
  if (state.listener !== null) {
    state.listener("close", state);
  }
  return state.tag !== null || state.anchor !== null || hasContent;
}
function readDocument(state) {
  var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
  state.version = null;
  state.checkLineBreaks = state.legacy;
  state.tagMap = /* @__PURE__ */ Object.create(null);
  state.anchorMap = /* @__PURE__ */ Object.create(null);
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
    skipSeparationSpace(state, true, -1);
    ch = state.input.charCodeAt(state.position);
    if (state.lineIndent > 0 || ch !== 37) {
      break;
    }
    hasDirectives = true;
    ch = state.input.charCodeAt(++state.position);
    _position = state.position;
    while (ch !== 0 && !is_WS_OR_EOL(ch)) {
      ch = state.input.charCodeAt(++state.position);
    }
    directiveName = state.input.slice(_position, state.position);
    directiveArgs = [];
    if (directiveName.length < 1) {
      throwError(state, "directive name must not be less than one character in length");
    }
    while (ch !== 0) {
      while (is_WHITE_SPACE(ch)) {
        ch = state.input.charCodeAt(++state.position);
      }
      if (ch === 35) {
        do {
          ch = state.input.charCodeAt(++state.position);
        } while (ch !== 0 && !is_EOL(ch));
        break;
      }
      if (is_EOL(ch)) break;
      _position = state.position;
      while (ch !== 0 && !is_WS_OR_EOL(ch)) {
        ch = state.input.charCodeAt(++state.position);
      }
      directiveArgs.push(state.input.slice(_position, state.position));
    }
    if (ch !== 0) readLineBreak(state);
    if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
      directiveHandlers[directiveName](state, directiveName, directiveArgs);
    } else {
      throwWarning(state, 'unknown document directive "' + directiveName + '"');
    }
  }
  skipSeparationSpace(state, true, -1);
  if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
    state.position += 3;
    skipSeparationSpace(state, true, -1);
  } else if (hasDirectives) {
    throwError(state, "directives end mark is expected");
  }
  composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
  skipSeparationSpace(state, true, -1);
  if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
    throwWarning(state, "non-ASCII line breaks are interpreted as content");
  }
  state.documents.push(state.result);
  if (state.position === state.lineStart && testDocumentSeparator(state)) {
    if (state.input.charCodeAt(state.position) === 46) {
      state.position += 3;
      skipSeparationSpace(state, true, -1);
    }
    return;
  }
  if (state.position < state.length - 1) {
    throwError(state, "end of the stream or a document separator is expected");
  } else {
    return;
  }
}
function loadDocuments(input, options) {
  input = String(input);
  options = options || {};
  if (input.length !== 0) {
    if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
      input += "\n";
    }
    if (input.charCodeAt(0) === 65279) {
      input = input.slice(1);
    }
  }
  var state = new State$1(input, options);
  var nullpos = input.indexOf("\0");
  if (nullpos !== -1) {
    state.position = nullpos;
    throwError(state, "null byte is not allowed in input");
  }
  state.input += "\0";
  while (state.input.charCodeAt(state.position) === 32) {
    state.lineIndent += 1;
    state.position += 1;
  }
  while (state.position < state.length - 1) {
    readDocument(state);
  }
  return state.documents;
}
function loadAll$1(input, iterator, options) {
  if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
    options = iterator;
    iterator = null;
  }
  var documents = loadDocuments(input, options);
  if (typeof iterator !== "function") {
    return documents;
  }
  for (var index = 0, length = documents.length; index < length; index += 1) {
    iterator(documents[index]);
  }
}
function load$1(input, options) {
  var documents = loadDocuments(input, options);
  if (documents.length === 0) {
    return void 0;
  } else if (documents.length === 1) {
    return documents[0];
  }
  throw new exception("expected a single document in the stream, but found more");
}
var loadAll_1 = loadAll$1;
var load_1 = load$1;
var loader = {
  loadAll: loadAll_1,
  load: load_1
};
var _toString = Object.prototype.toString;
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var CHAR_BOM = 65279;
var CHAR_TAB = 9;
var CHAR_LINE_FEED = 10;
var CHAR_CARRIAGE_RETURN = 13;
var CHAR_SPACE = 32;
var CHAR_EXCLAMATION = 33;
var CHAR_DOUBLE_QUOTE = 34;
var CHAR_SHARP = 35;
var CHAR_PERCENT = 37;
var CHAR_AMPERSAND = 38;
var CHAR_SINGLE_QUOTE = 39;
var CHAR_ASTERISK = 42;
var CHAR_COMMA = 44;
var CHAR_MINUS = 45;
var CHAR_COLON = 58;
var CHAR_EQUALS = 61;
var CHAR_GREATER_THAN = 62;
var CHAR_QUESTION = 63;
var CHAR_COMMERCIAL_AT = 64;
var CHAR_LEFT_SQUARE_BRACKET = 91;
var CHAR_RIGHT_SQUARE_BRACKET = 93;
var CHAR_GRAVE_ACCENT = 96;
var CHAR_LEFT_CURLY_BRACKET = 123;
var CHAR_VERTICAL_LINE = 124;
var CHAR_RIGHT_CURLY_BRACKET = 125;
var ESCAPE_SEQUENCES = {};
ESCAPE_SEQUENCES[0] = "\\0";
ESCAPE_SEQUENCES[7] = "\\a";
ESCAPE_SEQUENCES[8] = "\\b";
ESCAPE_SEQUENCES[9] = "\\t";
ESCAPE_SEQUENCES[10] = "\\n";
ESCAPE_SEQUENCES[11] = "\\v";
ESCAPE_SEQUENCES[12] = "\\f";
ESCAPE_SEQUENCES[13] = "\\r";
ESCAPE_SEQUENCES[27] = "\\e";
ESCAPE_SEQUENCES[34] = '\\"';
ESCAPE_SEQUENCES[92] = "\\\\";
ESCAPE_SEQUENCES[133] = "\\N";
ESCAPE_SEQUENCES[160] = "\\_";
ESCAPE_SEQUENCES[8232] = "\\L";
ESCAPE_SEQUENCES[8233] = "\\P";
var DEPRECATED_BOOLEANS_SYNTAX = [
  "y",
  "Y",
  "yes",
  "Yes",
  "YES",
  "on",
  "On",
  "ON",
  "n",
  "N",
  "no",
  "No",
  "NO",
  "off",
  "Off",
  "OFF"
];
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
function compileStyleMap(schema2, map2) {
  var result, keys, index, length, tag, style, type2;
  if (map2 === null) return {};
  result = {};
  keys = Object.keys(map2);
  for (index = 0, length = keys.length; index < length; index += 1) {
    tag = keys[index];
    style = String(map2[tag]);
    if (tag.slice(0, 2) === "!!") {
      tag = "tag:yaml.org,2002:" + tag.slice(2);
    }
    type2 = schema2.compiledTypeMap["fallback"][tag];
    if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
      style = type2.styleAliases[style];
    }
    result[tag] = style;
  }
  return result;
}
function encodeHex(character) {
  var string, handle, length;
  string = character.toString(16).toUpperCase();
  if (character <= 255) {
    handle = "x";
    length = 2;
  } else if (character <= 65535) {
    handle = "u";
    length = 4;
  } else if (character <= 4294967295) {
    handle = "U";
    length = 8;
  } else {
    throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
  }
  return "\\" + handle + common.repeat("0", length - string.length) + string;
}
var QUOTING_TYPE_SINGLE = 1;
var QUOTING_TYPE_DOUBLE = 2;
function State(options) {
  this.schema = options["schema"] || _default;
  this.indent = Math.max(1, options["indent"] || 2);
  this.noArrayIndent = options["noArrayIndent"] || false;
  this.skipInvalid = options["skipInvalid"] || false;
  this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
  this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
  this.sortKeys = options["sortKeys"] || false;
  this.lineWidth = options["lineWidth"] || 80;
  this.noRefs = options["noRefs"] || false;
  this.noCompatMode = options["noCompatMode"] || false;
  this.condenseFlow = options["condenseFlow"] || false;
  this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
  this.forceQuotes = options["forceQuotes"] || false;
  this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
  this.implicitTypes = this.schema.compiledImplicit;
  this.explicitTypes = this.schema.compiledExplicit;
  this.tag = null;
  this.result = "";
  this.duplicates = [];
  this.usedDuplicates = null;
}
function indentString(string, spaces) {
  var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
  while (position < length) {
    next = string.indexOf("\n", position);
    if (next === -1) {
      line = string.slice(position);
      position = length;
    } else {
      line = string.slice(position, next + 1);
      position = next + 1;
    }
    if (line.length && line !== "\n") result += ind;
    result += line;
  }
  return result;
}
function generateNextLine(state, level) {
  return "\n" + common.repeat(" ", state.indent * level);
}
function testImplicitResolving(state, str2) {
  var index, length, type2;
  for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
    type2 = state.implicitTypes[index];
    if (type2.resolve(str2)) {
      return true;
    }
  }
  return false;
}
function isWhitespace(c) {
  return c === CHAR_SPACE || c === CHAR_TAB;
}
function isPrintable(c) {
  return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
}
function isNsCharOrWhitespace(c) {
  return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
}
function isPlainSafe(c, prev, inblock) {
  var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
  var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
  return (
    // ns-plain-safe
    (inblock ? (
      // c = flow-in
      cIsNsCharOrWhitespace
    ) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
  );
}
function isPlainSafeFirst(c) {
  return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
}
function isPlainSafeLast(c) {
  return !isWhitespace(c) && c !== CHAR_COLON;
}
function codePointAt(string, pos) {
  var first = string.charCodeAt(pos), second;
  if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
    second = string.charCodeAt(pos + 1);
    if (second >= 56320 && second <= 57343) {
      return (first - 55296) * 1024 + second - 56320 + 65536;
    }
  }
  return first;
}
function needIndentIndicator(string) {
  var leadingSpaceRe = /^\n* /;
  return leadingSpaceRe.test(string);
}
var STYLE_PLAIN = 1;
var STYLE_SINGLE = 2;
var STYLE_LITERAL = 3;
var STYLE_FOLDED = 4;
var STYLE_DOUBLE = 5;
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
  var i;
  var char = 0;
  var prevChar = null;
  var hasLineBreak = false;
  var hasFoldableLine = false;
  var shouldTrackWidth = lineWidth !== -1;
  var previousLineBreak = -1;
  var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
  if (singleLineOnly || forceQuotes) {
    for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
      char = codePointAt(string, i);
      if (!isPrintable(char)) {
        return STYLE_DOUBLE;
      }
      plain = plain && isPlainSafe(char, prevChar, inblock);
      prevChar = char;
    }
  } else {
    for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
      char = codePointAt(string, i);
      if (char === CHAR_LINE_FEED) {
        hasLineBreak = true;
        if (shouldTrackWidth) {
          hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
          i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
          previousLineBreak = i;
        }
      } else if (!isPrintable(char)) {
        return STYLE_DOUBLE;
      }
      plain = plain && isPlainSafe(char, prevChar, inblock);
      prevChar = char;
    }
    hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
  }
  if (!hasLineBreak && !hasFoldableLine) {
    if (plain && !forceQuotes && !testAmbiguousType(string)) {
      return STYLE_PLAIN;
    }
    return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
  }
  if (indentPerLevel > 9 && needIndentIndicator(string)) {
    return STYLE_DOUBLE;
  }
  if (!forceQuotes) {
    return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
  }
  return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
}
function writeScalar(state, string, level, iskey, inblock) {
  state.dump = (function() {
    if (string.length === 0) {
      return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
    }
    if (!state.noCompatMode) {
      if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
        return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
      }
    }
    var indent = state.indent * Math.max(1, level);
    var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
    var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
    function testAmbiguity(string2) {
      return testImplicitResolving(state, string2);
    }
    switch (chooseScalarStyle(
      string,
      singleLineOnly,
      state.indent,
      lineWidth,
      testAmbiguity,
      state.quotingType,
      state.forceQuotes && !iskey,
      inblock
    )) {
      case STYLE_PLAIN:
        return string;
      case STYLE_SINGLE:
        return "'" + string.replace(/'/g, "''") + "'";
      case STYLE_LITERAL:
        return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
      case STYLE_FOLDED:
        return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
      case STYLE_DOUBLE:
        return '"' + escapeString(string) + '"';
      default:
        throw new exception("impossible error: invalid scalar style");
    }
  })();
}
function blockHeader(string, indentPerLevel) {
  var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
  var clip = string[string.length - 1] === "\n";
  var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
  var chomp = keep ? "+" : clip ? "" : "-";
  return indentIndicator + chomp + "\n";
}
function dropEndingNewline(string) {
  return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
}
function foldString(string, width) {
  var lineRe = /(\n+)([^\n]*)/g;
  var result = (function() {
    var nextLF = string.indexOf("\n");
    nextLF = nextLF !== -1 ? nextLF : string.length;
    lineRe.lastIndex = nextLF;
    return foldLine(string.slice(0, nextLF), width);
  })();
  var prevMoreIndented = string[0] === "\n" || string[0] === " ";
  var moreIndented;
  var match;
  while (match = lineRe.exec(string)) {
    var prefix = match[1], line = match[2];
    moreIndented = line[0] === " ";
    result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
    prevMoreIndented = moreIndented;
  }
  return result;
}
function foldLine(line, width) {
  if (line === "" || line[0] === " ") return line;
  var breakRe = / [^ ]/g;
  var match;
  var start = 0, end, curr = 0, next = 0;
  var result = "";
  while (match = breakRe.exec(line)) {
    next = match.index;
    if (next - start > width) {
      end = curr > start ? curr : next;
      result += "\n" + line.slice(start, end);
      start = end + 1;
    }
    curr = next;
  }
  result += "\n";
  if (line.length - start > width && curr > start) {
    result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
  } else {
    result += line.slice(start);
  }
  return result.slice(1);
}
function escapeString(string) {
  var result = "";
  var char = 0;
  var escapeSeq;
  for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
    char = codePointAt(string, i);
    escapeSeq = ESCAPE_SEQUENCES[char];
    if (!escapeSeq && isPrintable(char)) {
      result += string[i];
      if (char >= 65536) result += string[i + 1];
    } else {
      result += escapeSeq || encodeHex(char);
    }
  }
  return result;
}
function writeFlowSequence(state, level, object) {
  var _result = "", _tag = state.tag, index, length, value;
  for (index = 0, length = object.length; index < length; index += 1) {
    value = object[index];
    if (state.replacer) {
      value = state.replacer.call(object, String(index), value);
    }
    if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
      if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
      _result += state.dump;
    }
  }
  state.tag = _tag;
  state.dump = "[" + _result + "]";
}
function writeBlockSequence(state, level, object, compact) {
  var _result = "", _tag = state.tag, index, length, value;
  for (index = 0, length = object.length; index < length; index += 1) {
    value = object[index];
    if (state.replacer) {
      value = state.replacer.call(object, String(index), value);
    }
    if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
      if (!compact || _result !== "") {
        _result += generateNextLine(state, level);
      }
      if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
        _result += "-";
      } else {
        _result += "- ";
      }
      _result += state.dump;
    }
  }
  state.tag = _tag;
  state.dump = _result || "[]";
}
function writeFlowMapping(state, level, object) {
  var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
    pairBuffer = "";
    if (_result !== "") pairBuffer += ", ";
    if (state.condenseFlow) pairBuffer += '"';
    objectKey = objectKeyList[index];
    objectValue = object[objectKey];
    if (state.replacer) {
      objectValue = state.replacer.call(object, objectKey, objectValue);
    }
    if (!writeNode(state, level, objectKey, false, false)) {
      continue;
    }
    if (state.dump.length > 1024) pairBuffer += "? ";
    pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
    if (!writeNode(state, level, objectValue, false, false)) {
      continue;
    }
    pairBuffer += state.dump;
    _result += pairBuffer;
  }
  state.tag = _tag;
  state.dump = "{" + _result + "}";
}
function writeBlockMapping(state, level, object, compact) {
  var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
  if (state.sortKeys === true) {
    objectKeyList.sort();
  } else if (typeof state.sortKeys === "function") {
    objectKeyList.sort(state.sortKeys);
  } else if (state.sortKeys) {
    throw new exception("sortKeys must be a boolean or a function");
  }
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
    pairBuffer = "";
    if (!compact || _result !== "") {
      pairBuffer += generateNextLine(state, level);
    }
    objectKey = objectKeyList[index];
    objectValue = object[objectKey];
    if (state.replacer) {
      objectValue = state.replacer.call(object, objectKey, objectValue);
    }
    if (!writeNode(state, level + 1, objectKey, true, true, true)) {
      continue;
    }
    explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
    if (explicitPair) {
      if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
        pairBuffer += "?";
      } else {
        pairBuffer += "? ";
      }
    }
    pairBuffer += state.dump;
    if (explicitPair) {
      pairBuffer += generateNextLine(state, level);
    }
    if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
      continue;
    }
    if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
      pairBuffer += ":";
    } else {
      pairBuffer += ": ";
    }
    pairBuffer += state.dump;
    _result += pairBuffer;
  }
  state.tag = _tag;
  state.dump = _result || "{}";
}
function detectType(state, object, explicit) {
  var _result, typeList, index, length, type2, style;
  typeList = explicit ? state.explicitTypes : state.implicitTypes;
  for (index = 0, length = typeList.length; index < length; index += 1) {
    type2 = typeList[index];
    if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
      if (explicit) {
        if (type2.multi && type2.representName) {
          state.tag = type2.representName(object);
        } else {
          state.tag = type2.tag;
        }
      } else {
        state.tag = "?";
      }
      if (type2.represent) {
        style = state.styleMap[type2.tag] || type2.defaultStyle;
        if (_toString.call(type2.represent) === "[object Function]") {
          _result = type2.represent(object, style);
        } else if (_hasOwnProperty.call(type2.represent, style)) {
          _result = type2.represent[style](object, style);
        } else {
          throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
        }
        state.dump = _result;
      }
      return true;
    }
  }
  return false;
}
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
  state.tag = null;
  state.dump = object;
  if (!detectType(state, object, false)) {
    detectType(state, object, true);
  }
  var type2 = _toString.call(state.dump);
  var inblock = block;
  var tagStr;
  if (block) {
    block = state.flowLevel < 0 || state.flowLevel > level;
  }
  var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
  if (objectOrArray) {
    duplicateIndex = state.duplicates.indexOf(object);
    duplicate = duplicateIndex !== -1;
  }
  if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
    compact = false;
  }
  if (duplicate && state.usedDuplicates[duplicateIndex]) {
    state.dump = "*ref_" + duplicateIndex;
  } else {
    if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
      state.usedDuplicates[duplicateIndex] = true;
    }
    if (type2 === "[object Object]") {
      if (block && Object.keys(state.dump).length !== 0) {
        writeBlockMapping(state, level, state.dump, compact);
        if (duplicate) {
          state.dump = "&ref_" + duplicateIndex + state.dump;
        }
      } else {
        writeFlowMapping(state, level, state.dump);
        if (duplicate) {
          state.dump = "&ref_" + duplicateIndex + " " + state.dump;
        }
      }
    } else if (type2 === "[object Array]") {
      if (block && state.dump.length !== 0) {
        if (state.noArrayIndent && !isblockseq && level > 0) {
          writeBlockSequence(state, level - 1, state.dump, compact);
        } else {
          writeBlockSequence(state, level, state.dump, compact);
        }
        if (duplicate) {
          state.dump = "&ref_" + duplicateIndex + state.dump;
        }
      } else {
        writeFlowSequence(state, level, state.dump);
        if (duplicate) {
          state.dump = "&ref_" + duplicateIndex + " " + state.dump;
        }
      }
    } else if (type2 === "[object String]") {
      if (state.tag !== "?") {
        writeScalar(state, state.dump, level, iskey, inblock);
      }
    } else if (type2 === "[object Undefined]") {
      return false;
    } else {
      if (state.skipInvalid) return false;
      throw new exception("unacceptable kind of an object to dump " + type2);
    }
    if (state.tag !== null && state.tag !== "?") {
      tagStr = encodeURI(
        state.tag[0] === "!" ? state.tag.slice(1) : state.tag
      ).replace(/!/g, "%21");
      if (state.tag[0] === "!") {
        tagStr = "!" + tagStr;
      } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
        tagStr = "!!" + tagStr.slice(18);
      } else {
        tagStr = "!<" + tagStr + ">";
      }
      state.dump = tagStr + " " + state.dump;
    }
  }
  return true;
}
function getDuplicateReferences(object, state) {
  var objects = [], duplicatesIndexes = [], index, length;
  inspectNode(object, objects, duplicatesIndexes);
  for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
    state.duplicates.push(objects[duplicatesIndexes[index]]);
  }
  state.usedDuplicates = new Array(length);
}
function inspectNode(object, objects, duplicatesIndexes) {
  var objectKeyList, index, length;
  if (object !== null && typeof object === "object") {
    index = objects.indexOf(object);
    if (index !== -1) {
      if (duplicatesIndexes.indexOf(index) === -1) {
        duplicatesIndexes.push(index);
      }
    } else {
      objects.push(object);
      if (Array.isArray(object)) {
        for (index = 0, length = object.length; index < length; index += 1) {
          inspectNode(object[index], objects, duplicatesIndexes);
        }
      } else {
        objectKeyList = Object.keys(object);
        for (index = 0, length = objectKeyList.length; index < length; index += 1) {
          inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
        }
      }
    }
  }
}
function dump$1(input, options) {
  options = options || {};
  var state = new State(options);
  if (!state.noRefs) getDuplicateReferences(input, state);
  var value = input;
  if (state.replacer) {
    value = state.replacer.call({ "": value }, "", value);
  }
  if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
  return "";
}
var dump_1 = dump$1;
var dumper = {
  dump: dump_1
};
function renamed(from, to) {
  return function() {
    throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
  };
}
var load = loader.load;
var loadAll = loader.loadAll;
var dump = dumper.dump;
var safeLoad = renamed("safeLoad", "load");
var safeLoadAll = renamed("safeLoadAll", "loadAll");
var safeDump = renamed("safeDump", "dump");

// yarnrcauth.ts
var tl = __toESM(require_task());
function normalizeRegistry(raw) {
  if (!raw) {
    return "";
  }
  let candidate = raw.trim();
  if (!candidate) {
    return "";
  }
  if (!/^https?:\/\//i.test(candidate)) {
    candidate = `https://${candidate}`;
  }
  const u = new URL(candidate);
  u.hash = "";
  u.search = "";
  const normalizedPath = u.pathname.endsWith("/") ? u.pathname : `${u.pathname}/`;
  return `${u.protocol}//${u.host.toLowerCase()}${normalizedPath}`;
}
function parseEndpointIds(input) {
  if (!input) {
    return [];
  }
  return input.split(",").map((id) => id.trim()).filter((id) => id.length > 0);
}
function resolveEndpointCredential(endpointId) {
  const registryUrl = normalizeRegistry(
    tl.getEndpointUrl(endpointId, false) || ""
  );
  const auth = tl.getEndpointAuthorization(
    endpointId,
    false
  );
  const scheme = (auth?.scheme || "").toLowerCase();
  const parameters = auth?.parameters || {};
  if (scheme === "token") {
    const token = parameters.apitoken || parameters.AccessToken || parameters.accessToken || "";
    if (!token) {
      throw new Error(
        `Endpoint ${endpointId} uses Token auth but no token parameter was found.`
      );
    }
    tl.setSecret(token);
    return { registryUrl, token, authIdent: "" };
  }
  if (scheme === "usernamepassword") {
    const username = parameters.username || "";
    const password = parameters.password || "";
    if (!username || !password) {
      throw new Error(
        `Endpoint ${endpointId} uses UsernamePassword auth but credentials are incomplete.`
      );
    }
    tl.setSecret(password);
    return { registryUrl, token: "", authIdent: `${username}:${password}` };
  }
  throw new Error(
    `Unsupported endpoint auth scheme '${auth?.scheme || "unknown"}' for endpoint ${endpointId}.`
  );
}
function resolveSystemAccessToken() {
  const fromVariable = tl.getVariable("System.AccessToken") || process.env.SYSTEM_ACCESSTOKEN || "";
  if (fromVariable) {
    return fromVariable;
  }
  try {
    return tl.getEndpointAuthorizationParameter(
      "SYSTEMVSSCONNECTION",
      "AccessToken",
      false
    ) || "";
  } catch {
    return "";
  }
}
function ensureObject(parent, key) {
  const current = parent[key];
  if (!current || typeof current !== "object" || Array.isArray(current)) {
    parent[key] = {};
  }
  return parent[key];
}
async function run() {
  try {
    tl.setResourcePath(path.join(__dirname, "..", "task.json"));
    const workingFile = tl.getInput("workingFile", true);
    if (!workingFile.endsWith(".yarnrc.yml") && !workingFile.endsWith(".yarnrc.yaml")) {
      throw new Error(
        `workingFile must point to .yarnrc.yml or .yarnrc.yaml. Received: ${workingFile}`
      );
    }
    if (!fs.existsSync(workingFile)) {
      throw new Error(`The file '${workingFile}' does not exist.`);
    }
    const endpointIds = parseEndpointIds(
      tl.getInput("customEndpoint", false) || ""
    );
    const endpointCredentials = endpointIds.map(resolveEndpointCredential);
    const byRegistry = /* @__PURE__ */ new Map();
    endpointCredentials.forEach(
      (cred) => byRegistry.set(cred.registryUrl, cred)
    );
    const systemAccessToken = resolveSystemAccessToken();
    if (systemAccessToken) {
      tl.setSecret(systemAccessToken);
    }
    const content = fs.readFileSync(workingFile, "utf8");
    const doc = load(content) || {};
    const npmScopes = ensureObject(doc, "npmScopes");
    const npmRegistries = ensureObject(doc, "npmRegistries");
    let updatedScopes = 0;
    let fallbackScopes = 0;
    let fallbackRegistries = 0;
    Object.keys(npmScopes).forEach((scopeName) => {
      const scopeConfig = ensureObject(npmScopes, scopeName);
      const registry = normalizeRegistry(
        String(scopeConfig.npmRegistryServer || "")
      );
      if (!registry) {
        return;
      }
      const cred = byRegistry.get(registry);
      if (!cred && !systemAccessToken) {
        tl.warning(
          `No endpoint matching registry '${registry}' for npm scope '${scopeName}', and System.AccessToken is not available.`
        );
        return;
      }
      const effectiveCred = cred || {
        registryUrl: registry,
        token: systemAccessToken,
        authIdent: ""
      };
      if (!cred) {
        console.log(
          `No endpoint matching registry '${registry}' for npm scope '${scopeName}'. Falling back to System.AccessToken.`
        );
        fallbackScopes += 1;
        const fallbackRegConfig = ensureObject(npmRegistries, registry);
        fallbackRegConfig.npmAlwaysAuth = true;
        fallbackRegConfig.npmAuthToken = systemAccessToken;
        delete fallbackRegConfig.npmAuthIdent;
        fallbackRegistries += 1;
      }
      scopeConfig.npmAlwaysAuth = true;
      if (effectiveCred.token) {
        scopeConfig.npmAuthToken = effectiveCred.token;
        delete scopeConfig.npmAuthIdent;
      } else {
        scopeConfig.npmAuthIdent = effectiveCred.authIdent;
        delete scopeConfig.npmAuthToken;
      }
      updatedScopes += 1;
    });
    let updatedRegistries = 0;
    endpointCredentials.forEach((cred) => {
      const regConfig = ensureObject(npmRegistries, cred.registryUrl);
      regConfig.npmAlwaysAuth = true;
      if (cred.token) {
        regConfig.npmAuthToken = cred.token;
        delete regConfig.npmAuthIdent;
      } else {
        regConfig.npmAuthIdent = cred.authIdent;
        delete regConfig.npmAuthToken;
      }
      updatedRegistries += 1;
    });
    const updated = dump(doc, { lineWidth: -1, noRefs: true });
    fs.writeFileSync(workingFile, updated, "utf8");
    tl.debug(`Updated scopes: ${updatedScopes}`);
    tl.debug(`Updated registries: ${updatedRegistries}`);
    tl.debug(`Fallback scopes: ${fallbackScopes}`);
    tl.debug(`Fallback registries: ${fallbackRegistries}`);
    console.log(
      `Updated ${updatedScopes} npmScopes and ${updatedRegistries} npmRegistries in ${workingFile}. Fallback applied to ${fallbackScopes} scopes and ${fallbackRegistries} registries using System.AccessToken.`
    );
  } catch (err) {
    const message = err instanceof Error ? err.message : String(err);
    tl.setResult(tl.TaskResult.Failed, message);
  }
}
void run();
/*! Bundled license information:

q/q.js:
  (*!
   *
   * Copyright 2009-2017 Kris Kowal under the terms of the MIT
   * license found at https://github.com/kriskowal/q/blob/v1/LICENSE
   *
   * With parts by Tyler Close
   * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
   * at http://www.opensource.org/licenses/mit-license.html
   * Forked at ref_send.js version: 2009-05-11
   *
   * With parts by Mark Miller
   * Copyright (C) 2011 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   *)

js-yaml/dist/js-yaml.mjs:
  (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
*/
