text: 'use strict';
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  
  var React$1 = require('react');
  var React$1__default = _interopDefault(React$1);
  var lodash = _interopDefault(require('lodash'));
  var assert = _interopDefault(require('assert'));
  var events = _interopDefault(require('events'));
  var reactReconciler = _interopDefault(require('react-reconciler'));
  var yogaLayoutPrebuilt = _interopDefault(require('yoga-layout-prebuilt'));
  var stripAnsi = _interopDefault(require('strip-ansi'));
  var os = _interopDefault(require('os'));
  var tty = _interopDefault(require('tty'));
  var stream = _interopDefault(require('stream'));
  var fs$1 = _interopDefault(require('fs'));
  var module$1 = _interopDefault(require('module'));
  var react = require('@mdx-js/react');
  var PropTypes = _interopDefault(require('prop-types'));
  
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  
  function createCommonjsModule(fn, basedir, module) {
  	return module = {
  	  path: basedir,
  	  exports: {},
  	  require: function (path, base) {
        return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
      }
  	}, fn(module, module.exports), module.exports;
  }
  
  function getCjsExportFromNamespace (n) {
  	return n && n['default'] || n;
  }
  
  function commonjsRequire () {
  	throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
  }
  
  var _extends_1 = createCommonjsModule(function (module) {
  function _extends() {
    module.exports = _extends = Object.assign || function (target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i];
  
        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
      }
  
      return target;
    };
  
    return _extends.apply(this, arguments);
  }
  
  module.exports = _extends;
  });
  
  var arrRotate = (input, n) => {
    if (!Array.isArray(input)) {
      throw new TypeError(`Expected an array, got ${typeof input}`);
    }
  
    const x = input.slice();
    const num = typeof n === 'number' ? n : 0;
    return x.splice(-num % x.length).concat(x);
  };
  
  /**
   * lodash (Custom Build) <https://lodash.com/>
   * Build: `lodash modularize exports="npm" -o ./`
   * Copyright jQuery Foundation and other contributors <https://jquery.org/>
   * Released under MIT license <https://lodash.com/license>
   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   */
  
  /** Used as the `TypeError` message for "Functions" methods. */
  var FUNC_ERROR_TEXT = 'Expected a function';
  /** Used as references for various `Number` constants. */
  
  var NAN = 0 / 0;
  /** `Object#toString` result references. */
  
  var symbolTag = '[object Symbol]';
  /** Used to match leading and trailing whitespace. */
  
  var reTrim = /^\s+|\s+$/g;
  /** Used to detect bad signed hexadecimal string values. */
  
  var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  /** Used to detect binary string values. */
  
  var reIsBinary = /^0b[01]+$/i;
  /** Used to detect octal string values. */
  
  var reIsOctal = /^0o[0-7]+$/i;
  /** Built-in method references without a dependency on `root`. */
  
  var freeParseInt = parseInt;
  /** Detect free variable `global` from Node.js. */
  
  var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  /** Detect free variable `self`. */
  
  var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  /** Used as a reference to the global object. */
  
  var root = freeGlobal || freeSelf || Function('return this')();
  /** Used for built-in method references. */
  
  var objectProto = Object.prototype;
  /**
   * Used to resolve the
   * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
   * of values.
   */
  
  var objectToString = objectProto.toString;
  /* Built-in method references for those with the same name as other `lodash` methods. */
  
  var nativeMax = Math.max,
      nativeMin = Math.min;
  /**
   * Gets the timestamp of the number of milliseconds that have elapsed since
   * the Unix epoch (1 January 1970 00:00:00 UTC).
   *
   * @static
   * @memberOf _
   * @since 2.4.0
   * @category Date
   * @returns {number} Returns the timestamp.
   * @example
   *
   * _.defer(function(stamp) {
   *   console.log(_.now() - stamp);
   * }, _.now());
   * // => Logs the number of milliseconds it took for the deferred invocation.
   */
  
  var now = function () {
    return root.Date.now();
  };
  /**
   * Creates a debounced function that delays invoking `func` until after `wait`
   * milliseconds have elapsed since the last time the debounced function was
   * invoked. The debounced function comes with a `cancel` method to cancel
   * delayed `func` invocations and a `flush` method to immediately invoke them.
   * Provide `options` to indicate whether `func` should be invoked on the
   * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
   * with the last arguments provided to the debounced function. Subsequent
   * calls to the debounced function return the result of the last `func`
   * invocation.
   *
   * **Note:** If `leading` and `trailing` options are `true`, `func` is
   * invoked on the trailing edge of the timeout only if the debounced function
   * is invoked more than once during the `wait` timeout.
   *
   * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
   * until to the next tick, similar to `setTimeout` with a timeout of `0`.
   *
   * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
   * for details over the differences between `_.debounce` and `_.throttle`.
   *
   * @static
   * @memberOf _
   * @since 0.1.0
   * @category Function
   * @param {Function} func The function to debounce.
   * @param {number} [wait=0] The number of milliseconds to delay.
   * @param {Object} [options={}] The options object.
   * @param {boolean} [options.leading=false]
   *  Specify invoking on the leading edge of the timeout.
   * @param {number} [options.maxWait]
   *  The maximum time `func` is allowed to be delayed before it's invoked.
   * @param {boolean} [options.trailing=true]
   *  Specify invoking on the trailing edge of the timeout.
   * @returns {Function} Returns the new debounced function.
   * @example
   *
   * // Avoid costly calculations while the window size is in flux.
   * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
   *
   * // Invoke `sendMail` when clicked, debouncing subsequent calls.
   * jQuery(element).on('click', _.debounce(sendMail, 300, {
   *   'leading': true,
   *   'trailing': false
   * }));
   *
   * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
   * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
   * var source = new EventSource('/stream');
   * jQuery(source).on('message', debounced);
   *
   * // Cancel the trailing debounced invocation.
   * jQuery(window).on('popstate', debounced.cancel);
   */
  
  
  function debounce(func, wait, options) {
    var lastArgs,
        lastThis,
        maxWait,
        result,
        timerId,
        lastCallTime,
        lastInvokeTime = 0,
        leading = false,
        maxing = false,
        trailing = true;
  
    if (typeof func != 'function') {
      throw new TypeError(FUNC_ERROR_TEXT);
    }
  
    wait = toNumber(wait) || 0;
  
    if (isObject(options)) {
      leading = !!options.leading;
      maxing = 'maxWait' in options;
      maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
      trailing = 'trailing' in options ? !!options.trailing : trailing;
    }
  
    function invokeFunc(time) {
      var args = lastArgs,
          thisArg = lastThis;
      lastArgs = lastThis = undefined;
      lastInvokeTime = time;
      result = func.apply(thisArg, args);
      return result;
    }
  
    function leadingEdge(time) {
      // Reset any `maxWait` timer.
      lastInvokeTime = time; // Start the timer for the trailing edge.
  
      timerId = setTimeout(timerExpired, wait); // Invoke the leading edge.
  
      return leading ? invokeFunc(time) : result;
    }
  
    function remainingWait(time) {
      var timeSinceLastCall = time - lastCallTime,
          timeSinceLastInvoke = time - lastInvokeTime,
          result = wait - timeSinceLastCall;
      return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
    }
  
    function shouldInvoke(time) {
      var timeSinceLastCall = time - lastCallTime,
          timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the
      // trailing edge, the system time has gone backwards and we're treating
      // it as the trailing edge, or we've hit the `maxWait` limit.
  
      return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
    }
  
    function timerExpired() {
      var time = now();
  
      if (shouldInvoke(time)) {
        return trailingEdge(time);
      } // Restart the timer.
  
  
      timerId = setTimeout(timerExpired, remainingWait(time));
    }
  
    function trailingEdge(time) {
      timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been
      // debounced at least once.
  
      if (trailing && lastArgs) {
        return invokeFunc(time);
      }
  
      lastArgs = lastThis = undefined;
      return result;
    }
  
    function cancel() {
      if (timerId !== undefined) {
        clearTimeout(timerId);
      }
  
      lastInvokeTime = 0;
      lastArgs = lastCallTime = lastThis = timerId = undefined;
    }
  
    function flush() {
      return timerId === undefined ? result : trailingEdge(now());
    }
  
    function debounced() {
      var time = now(),
          isInvoking = shouldInvoke(time);
      lastArgs = arguments;
      lastThis = this;
      lastCallTime = time;
  
      if (isInvoking) {
        if (timerId === undefined) {
          return leadingEdge(lastCallTime);
        }
  
        if (maxing) {
          // Handle invocations in a tight loop.
          timerId = setTimeout(timerExpired, wait);
          return invokeFunc(lastCallTime);
        }
      }
  
      if (timerId === undefined) {
        timerId = setTimeout(timerExpired, wait);
      }
  
      return result;
    }
  
    debounced.cancel = cancel;
    debounced.flush = flush;
    return debounced;
  }
  /**
   * Creates a throttled function that only invokes `func` at most once per
   * every `wait` milliseconds. The throttled function comes with a `cancel`
   * method to cancel delayed `func` invocations and a `flush` method to
   * immediately invoke them. Provide `options` to indicate whether `func`
   * should be invoked on the leading and/or trailing edge of the `wait`
   * timeout. The `func` is invoked with the last arguments provided to the
   * throttled function. Subsequent calls to the throttled function return the
   * result of the last `func` invocation.
   *
   * **Note:** If `leading` and `trailing` options are `true`, `func` is
   * invoked on the trailing edge of the timeout only if the throttled function
   * is invoked more than once during the `wait` timeout.
   *
   * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
   * until to the next tick, similar to `setTimeout` with a timeout of `0`.
   *
   * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
   * for details over the differences between `_.throttle` and `_.debounce`.
   *
   * @static
   * @memberOf _
   * @since 0.1.0
   * @category Function
   * @param {Function} func The function to throttle.
   * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
   * @param {Object} [options={}] The options object.
   * @param {boolean} [options.leading=true]
   *  Specify invoking on the leading edge of the timeout.
   * @param {boolean} [options.trailing=true]
   *  Specify invoking on the trailing edge of the timeout.
   * @returns {Function} Returns the new throttled function.
   * @example
   *
   * // Avoid excessively updating the position while scrolling.
   * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
   *
   * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
   * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
   * jQuery(element).on('click', throttled);
   *
   * // Cancel the trailing throttled invocation.
   * jQuery(window).on('popstate', throttled.cancel);
   */
  
  
  function throttle(func, wait, options) {
    var leading = true,
        trailing = true;
  
    if (typeof func != 'function') {
      throw new TypeError(FUNC_ERROR_TEXT);
    }
  
    if (isObject(options)) {
      leading = 'leading' in options ? !!options.leading : leading;
      trailing = 'trailing' in options ? !!options.trailing : trailing;
    }
  
    return debounce(func, wait, {
      'leading': leading,
      'maxWait': wait,
      'trailing': trailing
    });
  }
  /**
   * Checks if `value` is the
   * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
   * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
   *
   * @static
   * @memberOf _
   * @since 0.1.0
   * @category Lang
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if `value` is an object, else `false`.
   * @example
   *
   * _.isObject({});
   * // => true
   *
   * _.isObject([1, 2, 3]);
   * // => true
   *
   * _.isObject(_.noop);
   * // => true
   *
   * _.isObject(null);
   * // => false
   */
  
  
  function isObject(value) {
    var type = typeof value;
    return !!value && (type == 'object' || type == 'function');
  }
  /**
   * Checks if `value` is object-like. A value is object-like if it's not `null`
   * and has a `typeof` result of "object".
   *
   * @static
   * @memberOf _
   * @since 4.0.0
   * @category Lang
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
   * @example
   *
   * _.isObjectLike({});
   * // => true
   *
   * _.isObjectLike([1, 2, 3]);
   * // => true
   *
   * _.isObjectLike(_.noop);
   * // => false
   *
   * _.isObjectLike(null);
   * // => false
   */
  
  
  function isObjectLike(value) {
    return !!value && typeof value == 'object';
  }
  /**
   * Checks if `value` is classified as a `Symbol` primitive or object.
   *
   * @static
   * @memberOf _
   * @since 4.0.0
   * @category Lang
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
   * @example
   *
   * _.isSymbol(Symbol.iterator);
   * // => true
   *
   * _.isSymbol('abc');
   * // => false
   */
  
  
  function isSymbol(value) {
    return typeof value == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag;
  }
  /**
   * Converts `value` to a number.
   *
   * @static
   * @memberOf _
   * @since 4.0.0
   * @category Lang
   * @param {*} value The value to process.
   * @returns {number} Returns the number.
   * @example
   *
   * _.toNumber(3.2);
   * // => 3.2
   *
   * _.toNumber(Number.MIN_VALUE);
   * // => 5e-324
   *
   * _.toNumber(Infinity);
   * // => Infinity
   *
   * _.toNumber('3.2');
   * // => 3.2
   */
  
  
  function toNumber(value) {
    if (typeof value == 'number') {
      return value;
    }
  
    if (isSymbol(value)) {
      return NAN;
    }
  
    if (isObject(value)) {
      var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
      value = isObject(other) ? other + '' : other;
    }
  
    if (typeof value != 'string') {
      return value === 0 ? value : +value;
    }
  
    value = value.replace(reTrim, '');
    var isBinary = reIsBinary.test(value);
    return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  }
  
  var lodash_throttle = throttle;
  
  var ansiEscapes_1 = createCommonjsModule(function (module) {
  
  const ansiEscapes = module.exports; // TODO: remove this in the next major version
  
  module.exports.default = ansiEscapes;
  const ESC = '\u001B[';
  const OSC = '\u001B]';
  const BEL = '\u0007';
  const SEP = ';';
  const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
  
  ansiEscapes.cursorTo = (x, y) => {
    if (typeof x !== 'number') {
      throw new TypeError('The `x` argument is required');
    }
  
    if (typeof y !== 'number') {
      return ESC + (x + 1) + 'G';
    }
  
    return ESC + (y + 1) + ';' + (x + 1) + 'H';
  };
  
  ansiEscapes.cursorMove = (x, y) => {
    if (typeof x !== 'number') {
      throw new TypeError('The `x` argument is required');
    }
  
    let ret = '';
  
    if (x < 0) {
      ret += ESC + -x + 'D';
    } else if (x > 0) {
      ret += ESC + x + 'C';
    }
  
    if (y < 0) {
      ret += ESC + -y + 'A';
    } else if (y > 0) {
      ret += ESC + y + 'B';
    }
  
    return ret;
  };
  
  ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
  
  ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
  
  ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
  
  ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
  
  ansiEscapes.cursorLeft = ESC + 'G';
  ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
  ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
  ansiEscapes.cursorGetPosition = ESC + '6n';
  ansiEscapes.cursorNextLine = ESC + 'E';
  ansiEscapes.cursorPrevLine = ESC + 'F';
  ansiEscapes.cursorHide = ESC + '?25l';
  ansiEscapes.cursorShow = ESC + '?25h';
  
  ansiEscapes.eraseLines = count => {
    let clear = '';
  
    for (let i = 0; i < count; i++) {
      clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
    }
  
    if (count) {
      clear += ansiEscapes.cursorLeft;
    }
  
    return clear;
  };
  
  ansiEscapes.eraseEndLine = ESC + 'K';
  ansiEscapes.eraseStartLine = ESC + '1K';
  ansiEscapes.eraseLine = ESC + '2K';
  ansiEscapes.eraseDown = ESC + 'J';
  ansiEscapes.eraseUp = ESC + '1J';
  ansiEscapes.eraseScreen = ESC + '2J';
  ansiEscapes.scrollUp = ESC + 'S';
  ansiEscapes.scrollDown = ESC + 'T';
  ansiEscapes.clearScreen = '\u001Bc';
  ansiEscapes.clearTerminal = process.platform === 'win32' ? `${ansiEscapes.eraseScreen}${ESC}0f` : // 1. Erases the screen (Only done in case `2` is not supported)
  // 2. Erases the whole screen including scrollback buffer
  // 3. Moves cursor to the top-left position
  // More info: https://www.real-world-systems.com/docs/ANSIcode.html
  `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
  ansiEscapes.beep = BEL;
  
  ansiEscapes.link = (text, url) => {
    return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join('');
  };
  
  ansiEscapes.image = (buffer, options = {}) => {
    let ret = `${OSC}1337;File=inline=1`;
  
    if (options.width) {
      ret += `;width=${options.width}`;
    }
  
    if (options.height) {
      ret += `;height=${options.height}`;
    }
  
    if (options.preserveAspectRatio === false) {
      ret += ';preserveAspectRatio=0';
    }
  
    return ret + ':' + buffer.toString('base64') + BEL;
  };
  
  ansiEscapes.iTerm = {
    setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`
  };
  });
  
  const mimicFn = (to, from) => {
    for (const prop of Reflect.ownKeys(from)) {
      Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
    }
  
    return to;
  };
  
  var mimicFn_1 = mimicFn; // TODO: Remove this for the next major release
  
  var _default = mimicFn;
  mimicFn_1.default = _default;
  
  const calledFunctions = new WeakMap();
  
  const oneTime = (fn, options = {}) => {
    if (typeof fn !== 'function') {
      throw new TypeError('Expected a function');
    }
  
    let ret;
    let isCalled = false;
    let callCount = 0;
    const functionName = fn.displayName || fn.name || '<anonymous>';
  
    const onetime = function (...args) {
      calledFunctions.set(onetime, ++callCount);
  
      if (isCalled) {
        if (options.throw === true) {
          throw new Error(`Function \`${functionName}\` can only be called once`);
        }
  
        return ret;
      }
  
      isCalled = true;
      ret = fn.apply(this, args);
      fn = null;
      return ret;
    };
  
    mimicFn_1(onetime, fn);
    calledFunctions.set(onetime, callCount);
    return onetime;
  };
  
  var onetime = oneTime; // TODO: Remove this for the next major release
  
  var _default$1 = oneTime;
  
  var callCount = fn => {
    if (!calledFunctions.has(fn)) {
      throw new Error(`The given function \`${fn.name}\` is not wrapped by the \`onetime\` package`);
    }
  
    return calledFunctions.get(fn);
  };
  onetime.default = _default$1;
  onetime.callCount = callCount;
  
  var signals = createCommonjsModule(function (module) {
  // This is not the set of all possible signals.
  //
  // It IS, however, the set of all signals that trigger
  // an exit on either Linux or BSD systems.  Linux is a
  // superset of the signal names supported on BSD, and
  // the unknown signals just fail to register, so we can
  // catch that easily enough.
  //
  // Don't bother with SIGKILL.  It's uncatchable, which
  // means that we can't fire any callbacks anyway.
  //
  // If a user does happen to register a handler on a non-
  // fatal signal like SIGWINCH or something, and then
  // exit, it'll end up firing `process.emit('exit')`, so
  // the handler will be fired anyway.
  //
  // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
  // artificially, inherently leave the process in a
  // state from which it is not safe to try and enter JS
  // listeners.
  module.exports = ['SIGABRT', 'SIGALRM', 'SIGHUP', 'SIGINT', 'SIGTERM'];
  
  if (process.platform !== 'win32') {
    module.exports.push('SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT' // should detect profiler and enable/disable accordingly.
    // see #21
    // 'SIGPROF'
    );
  }
  
  if (process.platform === 'linux') {
    module.exports.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT', 'SIGUNUSED');
  }
  });
  
  // Note: since nyc uses this module to output coverage, any lines
  // that are in the direct sync flow of nyc's outputCoverage are
  // ignored, since we can never get coverage for them.
  
  
  var signals$1 = signals;
  
  var isWin = /^win/i.test(process.platform);
  
  var EE = events;
  /* istanbul ignore if */
  
  
  if (typeof EE !== 'function') {
    EE = EE.EventEmitter;
  }
  
  var emitter;
  
  if (process.__signal_exit_emitter__) {
    emitter = process.__signal_exit_emitter__;
  } else {
    emitter = process.__signal_exit_emitter__ = new EE();
    emitter.count = 0;
    emitter.emitted = {};
  } // Because this emitter is a global, we have to check to see if a
  // previous version of this library failed to enable infinite listeners.
  // I know what you're about to say.  But literally everything about
  // signal-exit is a compromise with evil.  Get used to it.
  
  
  if (!emitter.infinite) {
    emitter.setMaxListeners(Infinity);
    emitter.infinite = true;
  }
  
  var signalExit = function (cb, opts) {
    assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
  
    if (loaded === false) {
      load();
    }
  
    var ev = 'exit';
  
    if (opts && opts.alwaysLast) {
      ev = 'afterexit';
    }
  
    var remove = function () {
      emitter.removeListener(ev, cb);
  
      if (emitter.listeners('exit').length === 0 && emitter.listeners('afterexit').length === 0) {
        unload();
      }
    };
  
    emitter.on(ev, cb);
    return remove;
  };
  
  var unload_1 = unload;
  
  function unload() {
    if (!loaded) {
      return;
    }
  
    loaded = false;
    signals$1.forEach(function (sig) {
      try {
        process.removeListener(sig, sigListeners[sig]);
      } catch (er) {}
    });
    process.emit = originalProcessEmit;
    process.reallyExit = originalProcessReallyExit;
    emitter.count -= 1;
  }
  
  function emit(event, code, signal) {
    if (emitter.emitted[event]) {
      return;
    }
  
    emitter.emitted[event] = true;
    emitter.emit(event, code, signal);
  } // { <signal>: <listener fn>, ... }
  
  
  var sigListeners = {};
  signals$1.forEach(function (sig) {
    sigListeners[sig] = function listener() {
      // If there are no other listeners, an exit is coming!
      // Simplest way: remove us and then re-send the signal.
      // We know that this will kill the process, so we can
      // safely emit now.
      var listeners = process.listeners(sig);
  
      if (listeners.length === emitter.count) {
        unload();
        emit('exit', null, sig);
        /* istanbul ignore next */
  
        emit('afterexit', null, sig);
        /* istanbul ignore next */
  
        if (isWin && sig === 'SIGHUP') {
          // "SIGHUP" throws an `ENOSYS` error on Windows,
          // so use a supported signal instead
          sig = 'SIGINT';
        }
  
        process.kill(process.pid, sig);
      }
    };
  });
  
  var signals_1 = function () {
    return signals$1;
  };
  
  var load_1 = load;
  var loaded = false;
  
  function load() {
    if (loaded) {
      return;
    }
  
    loaded = true; // This is the number of onSignalExit's that are in play.
    // It's important so that we can count the correct number of
    // listeners on signals, and don't wait for the other one to
    // handle it instead of us.
  
    emitter.count += 1;
    signals$1 = signals$1.filter(function (sig) {
      try {
        process.on(sig, sigListeners[sig]);
        return true;
      } catch (er) {
        return false;
      }
    });
    process.emit = processEmit;
    process.reallyExit = processReallyExit;
  }
  
  var originalProcessReallyExit = process.reallyExit;
  
  function processReallyExit(code) {
    process.exitCode = code || 0;
    emit('exit', process.exitCode, null);
    /* istanbul ignore next */
  
    emit('afterexit', process.exitCode, null);
    /* istanbul ignore next */
  
    originalProcessReallyExit.call(process, process.exitCode);
  }
  
  var originalProcessEmit = process.emit;
  
  function processEmit(ev, arg) {
    if (ev === 'exit') {
      if (arg !== undefined) {
        process.exitCode = arg;
      }
  
      var ret = originalProcessEmit.apply(this, arguments);
      emit('exit', process.exitCode, null);
      /* istanbul ignore next */
  
      emit('afterexit', process.exitCode, null);
      return ret;
    } else {
      return originalProcessEmit.apply(this, arguments);
    }
  }
  signalExit.unload = unload_1;
  signalExit.signals = signals_1;
  signalExit.load = load_1;
  
  var restoreCursor = onetime(() => {
    signalExit(() => {
      process.stderr.write('\u001B[?25h');
    }, {
      alwaysLast: true
    });
  });
  
  var cliCursor = createCommonjsModule(function (module, exports) {
  
  
  
  let isHidden = false;
  
  exports.show = (writableStream = process.stderr) => {
    if (!writableStream.isTTY) {
      return;
    }
  
    isHidden = false;
    writableStream.write('\u001B[?25h');
  };
  
  exports.hide = (writableStream = process.stderr) => {
    if (!writableStream.isTTY) {
      return;
    }
  
    restoreCursor();
    isHidden = true;
    writableStream.write('\u001B[?25l');
  };
  
  exports.toggle = (force, writableStream) => {
    if (force !== undefined) {
      isHidden = force;
    }
  
    if (isHidden) {
      exports.show(writableStream);
    } else {
      exports.hide(writableStream);
    }
  };
  });
  
  var logUpdate = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const ansi_escapes_1 = __importDefault(ansiEscapes_1);
  
  const cli_cursor_1 = __importDefault(cliCursor);
  
  const create = (stream, {
    showCursor = false
  } = {}) => {
    let previousLineCount = 0;
    let previousOutput = '';
    let hasHiddenCursor = false;
  
    const render = str => {
      if (!showCursor && !hasHiddenCursor) {
        cli_cursor_1.default.hide();
        hasHiddenCursor = true;
      }
  
      const output = str + '\n';
  
      if (output === previousOutput) {
        return;
      }
  
      previousOutput = output;
      stream.write(ansi_escapes_1.default.eraseLines(previousLineCount) + output);
      previousLineCount = output.split('\n').length;
    };
  
    render.clear = () => {
      stream.write(ansi_escapes_1.default.eraseLines(previousLineCount));
      previousOutput = '';
      previousLineCount = 0;
    };
  
    render.done = () => {
      previousOutput = '';
      previousLineCount = 0;
  
      if (!showCursor) {
        cli_cursor_1.default.show();
        hasHiddenCursor = false;
      }
    };
  
    return render;
  };
  
  exports.default = {
    create
  };
  });
  
  var vendors = [
  	{
  		name: "AppVeyor",
  		constant: "APPVEYOR",
  		env: "APPVEYOR",
  		pr: "APPVEYOR_PULL_REQUEST_NUMBER"
  	},
  	{
  		name: "Azure Pipelines",
  		constant: "AZURE_PIPELINES",
  		env: "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",
  		pr: "SYSTEM_PULLREQUEST_PULLREQUESTID"
  	},
  	{
  		name: "Bamboo",
  		constant: "BAMBOO",
  		env: "bamboo_planKey"
  	},
  	{
  		name: "Bitbucket Pipelines",
  		constant: "BITBUCKET",
  		env: "BITBUCKET_COMMIT",
  		pr: "BITBUCKET_PR_ID"
  	},
  	{
  		name: "Bitrise",
  		constant: "BITRISE",
  		env: "BITRISE_IO",
  		pr: "BITRISE_PULL_REQUEST"
  	},
  	{
  		name: "Buddy",
  		constant: "BUDDY",
  		env: "BUDDY_WORKSPACE_ID",
  		pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
  	},
  	{
  		name: "Buildkite",
  		constant: "BUILDKITE",
  		env: "BUILDKITE",
  		pr: {
  			env: "BUILDKITE_PULL_REQUEST",
  			ne: "false"
  		}
  	},
  	{
  		name: "CircleCI",
  		constant: "CIRCLE",
  		env: "CIRCLECI",
  		pr: "CIRCLE_PULL_REQUEST"
  	},
  	{
  		name: "Cirrus CI",
  		constant: "CIRRUS",
  		env: "CIRRUS_CI",
  		pr: "CIRRUS_PR"
  	},
  	{
  		name: "AWS CodeBuild",
  		constant: "CODEBUILD",
  		env: "CODEBUILD_BUILD_ARN"
  	},
  	{
  		name: "Codeship",
  		constant: "CODESHIP",
  		env: {
  			CI_NAME: "codeship"
  		}
  	},
  	{
  		name: "Drone",
  		constant: "DRONE",
  		env: "DRONE",
  		pr: {
  			DRONE_BUILD_EVENT: "pull_request"
  		}
  	},
  	{
  		name: "dsari",
  		constant: "DSARI",
  		env: "DSARI"
  	},
  	{
  		name: "GitLab CI",
  		constant: "GITLAB",
  		env: "GITLAB_CI"
  	},
  	{
  		name: "GoCD",
  		constant: "GOCD",
  		env: "GO_PIPELINE_LABEL"
  	},
  	{
  		name: "Hudson",
  		constant: "HUDSON",
  		env: "HUDSON_URL"
  	},
  	{
  		name: "Jenkins",
  		constant: "JENKINS",
  		env: [
  			"JENKINS_URL",
  			"BUILD_ID"
  		],
  		pr: {
  			any: [
  				"ghprbPullId",
  				"CHANGE_ID"
  			]
  		}
  	},
  	{
  		name: "Magnum CI",
  		constant: "MAGNUM",
  		env: "MAGNUM"
  	},
  	{
  		name: "Netlify CI",
  		constant: "NETLIFY",
  		env: "NETLIFY_BUILD_BASE",
  		pr: {
  			env: "PULL_REQUEST",
  			ne: "false"
  		}
  	},
  	{
  		name: "Sail CI",
  		constant: "SAIL",
  		env: "SAILCI",
  		pr: "SAIL_PULL_REQUEST_NUMBER"
  	},
  	{
  		name: "Semaphore",
  		constant: "SEMAPHORE",
  		env: "SEMAPHORE",
  		pr: "PULL_REQUEST_NUMBER"
  	},
  	{
  		name: "Shippable",
  		constant: "SHIPPABLE",
  		env: "SHIPPABLE",
  		pr: {
  			IS_PULL_REQUEST: "true"
  		}
  	},
  	{
  		name: "Solano CI",
  		constant: "SOLANO",
  		env: "TDDIUM",
  		pr: "TDDIUM_PR_ID"
  	},
  	{
  		name: "Strider CD",
  		constant: "STRIDER",
  		env: "STRIDER"
  	},
  	{
  		name: "TaskCluster",
  		constant: "TASKCLUSTER",
  		env: [
  			"TASK_ID",
  			"RUN_ID"
  		]
  	},
  	{
  		name: "TeamCity",
  		constant: "TEAMCITY",
  		env: "TEAMCITY_VERSION"
  	},
  	{
  		name: "Travis CI",
  		constant: "TRAVIS",
  		env: "TRAVIS",
  		pr: {
  			env: "TRAVIS_PULL_REQUEST",
  			ne: "false"
  		}
  	}
  ];
  
  var vendors$1 = /*#__PURE__*/Object.freeze({
  	__proto__: null,
  	'default': vendors
  });
  
  var vendors$2 = getCjsExportFromNamespace(vendors$1);
  
  var ciInfo = createCommonjsModule(function (module, exports) {
  
  
  
  var env = process.env; // Used for testing only
  
  Object.defineProperty(exports, '_vendors', {
    value: vendors$2.map(function (v) {
      return v.constant;
    })
  });
  exports.name = null;
  exports.isPR = null;
  vendors$2.forEach(function (vendor) {
    var envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
    var isCI = envs.every(function (obj) {
      return checkEnv(obj);
    });
    exports[vendor.constant] = isCI;
  
    if (isCI) {
      exports.name = vendor.name;
  
      switch (typeof vendor.pr) {
        case 'string':
          // "pr": "CIRRUS_PR"
          exports.isPR = !!env[vendor.pr];
          break;
  
        case 'object':
          if ('env' in vendor.pr) {
            // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" }
            exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
          } else if ('any' in vendor.pr) {
            // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
            exports.isPR = vendor.pr.any.some(function (key) {
              return !!env[key];
            });
          } else {
            // "pr": { "DRONE_BUILD_EVENT": "pull_request" }
            exports.isPR = checkEnv(vendor.pr);
          }
  
          break;
  
        default:
          // PR detection not supported for this vendor
          exports.isPR = null;
      }
    }
  });
  exports.isCI = !!(env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
  env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
  env.BUILD_NUMBER || // Jenkins, TeamCity
  env.RUN_ID || // TaskCluster, dsari
  exports.name || false);
  
  function checkEnv(obj) {
    if (typeof obj === 'string') return !!env[obj];
    return Object.keys(obj).every(function (k) {
      return env[k] === obj[k];
    });
  }
  });
  
  var isCi = ciInfo.isCI;
  
  const getAllProperties = object => {
    const properties = new Set();
  
    do {
      for (const key of Reflect.ownKeys(object)) {
        properties.add([object, key]);
      }
    } while ((object = Reflect.getPrototypeOf(object)) && object !== Object.prototype);
  
    return properties;
  };
  
  var autoBind = (self, {
    include,
    exclude
  } = {}) => {
    const filter = key => {
      const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key);
  
      if (include) {
        return include.some(match);
      }
  
      if (exclude) {
        return !exclude.some(match);
      }
  
      return true;
    };
  
    for (const [object, key] of getAllProperties(self.constructor.prototype)) {
      if (key === 'constructor' || !filter(key)) {
        continue;
      }
  
      const descriptor = Reflect.getOwnPropertyDescriptor(object, key);
  
      if (descriptor && typeof descriptor.value === 'function') {
        self[key] = self[key].bind(self);
      }
    }
  
    return self;
  };
  
  var scheduler_production_min = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: !0
  });
  var f, g, h, k, l;
  
  if ("undefined" === typeof window || "function" !== typeof MessageChannel) {
    var p = null,
        q = null,
        t = function () {
      if (null !== p) try {
        var a = exports.unstable_now();
        p(!0, a);
        p = null;
      } catch (b) {
        throw setTimeout(t, 0), b;
      }
    },
        u = Date.now();
  
    exports.unstable_now = function () {
      return Date.now() - u;
    };
  
    f = function (a) {
      null !== p ? setTimeout(f, 0, a) : (p = a, setTimeout(t, 0));
    };
  
    g = function (a, b) {
      q = setTimeout(a, b);
    };
  
    h = function () {
      clearTimeout(q);
    };
  
    k = function () {
      return !1;
    };
  
    l = exports.unstable_forceFrameRate = function () {};
  } else {
    var w = window.performance,
        x = window.Date,
        y = window.setTimeout,
        z = window.clearTimeout;
  
    if ("undefined" !== typeof console) {
      var A = window.cancelAnimationFrame;
      "function" !== typeof window.requestAnimationFrame && console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills");
      "function" !== typeof A && console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills");
    }
  
    if ("object" === typeof w && "function" === typeof w.now) exports.unstable_now = function () {
      return w.now();
    };else {
      var B = x.now();
  
      exports.unstable_now = function () {
        return x.now() - B;
      };
    }
    var C = !1,
        D = null,
        E = -1,
        F = 5,
        G = 0;
  
    k = function () {
      return exports.unstable_now() >= G;
    };
  
    l = function () {};
  
    exports.unstable_forceFrameRate = function (a) {
      0 > a || 125 < a ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported") : F = 0 < a ? Math.floor(1E3 / a) : 5;
    };
  
    var H = new MessageChannel(),
        I = H.port2;
  
    H.port1.onmessage = function () {
      if (null !== D) {
        var a = exports.unstable_now();
        G = a + F;
  
        try {
          D(!0, a) ? I.postMessage(null) : (C = !1, D = null);
        } catch (b) {
          throw I.postMessage(null), b;
        }
      } else C = !1;
    };
  
    f = function (a) {
      D = a;
      C || (C = !0, I.postMessage(null));
    };
  
    g = function (a, b) {
      E = y(function () {
        a(exports.unstable_now());
      }, b);
    };
  
    h = function () {
      z(E);
      E = -1;
    };
  }
  
  function J(a, b) {
    var c = a.length;
    a.push(b);
  
    a: for (;;) {
      var d = Math.floor((c - 1) / 2),
          e = a[d];
      if (void 0 !== e && 0 < K(e, b)) a[d] = b, a[c] = e, c = d;else break a;
    }
  }
  
  function L(a) {
    a = a[0];
    return void 0 === a ? null : a;
  }
  
  function M(a) {
    var b = a[0];
  
    if (void 0 !== b) {
      var c = a.pop();
  
      if (c !== b) {
        a[0] = c;
  
        a: for (var d = 0, e = a.length; d < e;) {
          var m = 2 * (d + 1) - 1,
              n = a[m],
              v = m + 1,
              r = a[v];
          if (void 0 !== n && 0 > K(n, c)) void 0 !== r && 0 > K(r, n) ? (a[d] = r, a[v] = c, d = v) : (a[d] = n, a[m] = c, d = m);else if (void 0 !== r && 0 > K(r, c)) a[d] = r, a[v] = c, d = v;else break a;
        }
      }
  
      return b;
    }
  
    return null;
  }
  
  function K(a, b) {
    var c = a.sortIndex - b.sortIndex;
    return 0 !== c ? c : a.id - b.id;
  }
  
  var N = [],
      O = [],
      P = 1,
      Q = null,
      R = 3,
      S = !1,
      T = !1,
      U = !1;
  
  function V(a) {
    for (var b = L(O); null !== b;) {
      if (null === b.callback) M(O);else if (b.startTime <= a) M(O), b.sortIndex = b.expirationTime, J(N, b);else break;
      b = L(O);
    }
  }
  
  function W(a) {
    U = !1;
    V(a);
    if (!T) if (null !== L(N)) T = !0, f(X);else {
      var b = L(O);
      null !== b && g(W, b.startTime - a);
    }
  }
  
  function X(a, b) {
    T = !1;
    U && (U = !1, h());
    S = !0;
    var c = R;
  
    try {
      V(b);
  
      for (Q = L(N); null !== Q && (!(Q.expirationTime > b) || a && !k());) {
        var d = Q.callback;
  
        if (null !== d) {
          Q.callback = null;
          R = Q.priorityLevel;
          var e = d(Q.expirationTime <= b);
          b = exports.unstable_now();
          "function" === typeof e ? Q.callback = e : Q === L(N) && M(N);
          V(b);
        } else M(N);
  
        Q = L(N);
      }
  
      if (null !== Q) var m = !0;else {
        var n = L(O);
        null !== n && g(W, n.startTime - b);
        m = !1;
      }
      return m;
    } finally {
      Q = null, R = c, S = !1;
    }
  }
  
  function Y(a) {
    switch (a) {
      case 1:
        return -1;
  
      case 2:
        return 250;
  
      case 5:
        return 1073741823;
  
      case 4:
        return 1E4;
  
      default:
        return 5E3;
    }
  }
  
  var Z = l;
  exports.unstable_ImmediatePriority = 1;
  exports.unstable_UserBlockingPriority = 2;
  exports.unstable_NormalPriority = 3;
  exports.unstable_IdlePriority = 5;
  exports.unstable_LowPriority = 4;
  
  exports.unstable_runWithPriority = function (a, b) {
    switch (a) {
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
        break;
  
      default:
        a = 3;
    }
  
    var c = R;
    R = a;
  
    try {
      return b();
    } finally {
      R = c;
    }
  };
  
  exports.unstable_next = function (a) {
    switch (R) {
      case 1:
      case 2:
      case 3:
        var b = 3;
        break;
  
      default:
        b = R;
    }
  
    var c = R;
    R = b;
  
    try {
      return a();
    } finally {
      R = c;
    }
  };
  
  exports.unstable_scheduleCallback = function (a, b, c) {
    var d = exports.unstable_now();
  
    if ("object" === typeof c && null !== c) {
      var e = c.delay;
      e = "number" === typeof e && 0 < e ? d + e : d;
      c = "number" === typeof c.timeout ? c.timeout : Y(a);
    } else c = Y(a), e = d;
  
    c = e + c;
    a = {
      id: P++,
      callback: b,
      priorityLevel: a,
      startTime: e,
      expirationTime: c,
      sortIndex: -1
    };
    e > d ? (a.sortIndex = e, J(O, a), null === L(N) && a === L(O) && (U ? h() : U = !0, g(W, e - d))) : (a.sortIndex = c, J(N, a), T || S || (T = !0, f(X)));
    return a;
  };
  
  exports.unstable_cancelCallback = function (a) {
    a.callback = null;
  };
  
  exports.unstable_wrapCallback = function (a) {
    var b = R;
    return function () {
      var c = R;
      R = b;
  
      try {
        return a.apply(this, arguments);
      } finally {
        R = c;
      }
    };
  };
  
  exports.unstable_getCurrentPriorityLevel = function () {
    return R;
  };
  
  exports.unstable_shouldYield = function () {
    var a = exports.unstable_now();
    V(a);
    var b = L(N);
    return b !== Q && null !== Q && null !== b && null !== b.callback && b.startTime <= a && b.expirationTime < Q.expirationTime || k();
  };
  
  exports.unstable_requestPaint = Z;
  
  exports.unstable_continueExecution = function () {
    T || S || (T = !0, f(X));
  };
  
  exports.unstable_pauseExecution = function () {};
  
  exports.unstable_getFirstCallbackNode = function () {
    return L(N);
  };
  
  exports.unstable_Profiling = null;
  });
  
  var scheduler_development = createCommonjsModule(function (module, exports) {
  
  if (process.env.NODE_ENV !== "production") {
    (function () {
  
      Object.defineProperty(exports, '__esModule', {
        value: true
      });
      var enableSchedulerDebugging = false;
      var enableProfiling = true;
      var requestHostCallback;
      var requestHostTimeout;
      var cancelHostTimeout;
      var shouldYieldToHost;
      var requestPaint;
  
      if ( // If Scheduler runs in a non-DOM environment, it falls back to a naive
      // implementation using setTimeout.
      typeof window === 'undefined' || // Check if MessageChannel is supported, too.
      typeof MessageChannel !== 'function') {
        // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
        // fallback to a naive implementation.
        var _callback = null;
        var _timeoutID = null;
  
        var _flushCallback = function () {
          if (_callback !== null) {
            try {
              var currentTime = exports.unstable_now();
              var hasRemainingTime = true;
  
              _callback(hasRemainingTime, currentTime);
  
              _callback = null;
            } catch (e) {
              setTimeout(_flushCallback, 0);
              throw e;
            }
          }
        };
  
        var initialTime = Date.now();
  
        exports.unstable_now = function () {
          return Date.now() - initialTime;
        };
  
        requestHostCallback = function (cb) {
          if (_callback !== null) {
            // Protect against re-entrancy.
            setTimeout(requestHostCallback, 0, cb);
          } else {
            _callback = cb;
            setTimeout(_flushCallback, 0);
          }
        };
  
        requestHostTimeout = function (cb, ms) {
          _timeoutID = setTimeout(cb, ms);
        };
  
        cancelHostTimeout = function () {
          clearTimeout(_timeoutID);
        };
  
        shouldYieldToHost = function () {
          return false;
        };
  
        requestPaint = exports.unstable_forceFrameRate = function () {};
      } else {
        // Capture local references to native APIs, in case a polyfill overrides them.
        var performance = window.performance;
        var _Date = window.Date;
        var _setTimeout = window.setTimeout;
        var _clearTimeout = window.clearTimeout;
  
        if (typeof console !== 'undefined') {
          // TODO: Scheduler no longer requires these methods to be polyfilled. But
          // maybe we want to continue warning if they don't exist, to preserve the
          // option to rely on it in the future?
          var requestAnimationFrame = window.requestAnimationFrame;
          var cancelAnimationFrame = window.cancelAnimationFrame; // TODO: Remove fb.me link
  
          if (typeof requestAnimationFrame !== 'function') {
            console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
          }
  
          if (typeof cancelAnimationFrame !== 'function') {
            console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
          }
        }
  
        if (typeof performance === 'object' && typeof performance.now === 'function') {
          exports.unstable_now = function () {
            return performance.now();
          };
        } else {
          var _initialTime = _Date.now();
  
          exports.unstable_now = function () {
            return _Date.now() - _initialTime;
          };
        }
  
        var isMessageLoopRunning = false;
        var scheduledHostCallback = null;
        var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main
        // thread, like user events. By default, it yields multiple times per frame.
        // It does not attempt to align with frame boundaries, since most tasks don't
        // need to be frame aligned; for those that do, use requestAnimationFrame.
  
        var yieldInterval = 5;
        var deadline = 0; // TODO: Make this configurable
  
        {
          // `isInputPending` is not available. Since we have no way of knowing if
          // there's pending input, always yield at the end of the frame.
          shouldYieldToHost = function () {
            return exports.unstable_now() >= deadline;
          }; // Since we yield every frame regardless, `requestPaint` has no effect.
  
  
          requestPaint = function () {};
        }
  
        exports.unstable_forceFrameRate = function (fps) {
          if (fps < 0 || fps > 125) {
            console.error('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing framerates higher than 125 fps is not unsupported');
            return;
          }
  
          if (fps > 0) {
            yieldInterval = Math.floor(1000 / fps);
          } else {
            // reset the framerate
            yieldInterval = 5;
          }
        };
  
        var performWorkUntilDeadline = function () {
          if (scheduledHostCallback !== null) {
            var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync
            // cycle. This means there's always time remaining at the beginning of
            // the message event.
  
            deadline = currentTime + yieldInterval;
            var hasTimeRemaining = true;
  
            try {
              var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
  
              if (!hasMoreWork) {
                isMessageLoopRunning = false;
                scheduledHostCallback = null;
              } else {
                // If there's more work, schedule the next message event at the end
                // of the preceding one.
                port.postMessage(null);
              }
            } catch (error) {
              // If a scheduler task throws, exit the current browser task so the
              // error can be observed.
              port.postMessage(null);
              throw error;
            }
          } else {
            isMessageLoopRunning = false;
          } // Yielding to the browser will give it a chance to paint, so we can
        };
  
        var channel = new MessageChannel();
        var port = channel.port2;
        channel.port1.onmessage = performWorkUntilDeadline;
  
        requestHostCallback = function (callback) {
          scheduledHostCallback = callback;
  
          if (!isMessageLoopRunning) {
            isMessageLoopRunning = true;
            port.postMessage(null);
          }
        };
  
        requestHostTimeout = function (callback, ms) {
          taskTimeoutID = _setTimeout(function () {
            callback(exports.unstable_now());
          }, ms);
        };
  
        cancelHostTimeout = function () {
          _clearTimeout(taskTimeoutID);
  
          taskTimeoutID = -1;
        };
      }
  
      function push(heap, node) {
        var index = heap.length;
        heap.push(node);
        siftUp(heap, node, index);
      }
  
      function peek(heap) {
        var first = heap[0];
        return first === undefined ? null : first;
      }
  
      function pop(heap) {
        var first = heap[0];
  
        if (first !== undefined) {
          var last = heap.pop();
  
          if (last !== first) {
            heap[0] = last;
            siftDown(heap, last, 0);
          }
  
          return first;
        } else {
          return null;
        }
      }
  
      function siftUp(heap, node, i) {
        var index = i;
  
        while (true) {
          var parentIndex = Math.floor((index - 1) / 2);
          var parent = heap[parentIndex];
  
          if (parent !== undefined && compare(parent, node) > 0) {
            // The parent is larger. Swap positions.
            heap[parentIndex] = node;
            heap[index] = parent;
            index = parentIndex;
          } else {
            // The parent is smaller. Exit.
            return;
          }
        }
      }
  
      function siftDown(heap, node, i) {
        var index = i;
        var length = heap.length;
  
        while (index < length) {
          var leftIndex = (index + 1) * 2 - 1;
          var left = heap[leftIndex];
          var rightIndex = leftIndex + 1;
          var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
  
          if (left !== undefined && compare(left, node) < 0) {
            if (right !== undefined && compare(right, left) < 0) {
              heap[index] = right;
              heap[rightIndex] = node;
              index = rightIndex;
            } else {
              heap[index] = left;
              heap[leftIndex] = node;
              index = leftIndex;
            }
          } else if (right !== undefined && compare(right, node) < 0) {
            heap[index] = right;
            heap[rightIndex] = node;
            index = rightIndex;
          } else {
            // Neither child is smaller. Exit.
            return;
          }
        }
      }
  
      function compare(a, b) {
        // Compare sort index first, then task id.
        var diff = a.sortIndex - b.sortIndex;
        return diff !== 0 ? diff : a.id - b.id;
      } // TODO: Use symbols?
  
  
      var NoPriority = 0;
      var ImmediatePriority = 1;
      var UserBlockingPriority = 2;
      var NormalPriority = 3;
      var LowPriority = 4;
      var IdlePriority = 5;
      var runIdCounter = 0;
      var mainThreadIdCounter = 0;
      var profilingStateSize = 4;
      var sharedProfilingBuffer =  // $FlowFixMe Flow doesn't know about SharedArrayBuffer
      typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer
      typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9
      ;
      var profilingState =  sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks
  
      var PRIORITY = 0;
      var CURRENT_TASK_ID = 1;
      var CURRENT_RUN_ID = 2;
      var QUEUE_SIZE = 3;
  
      {
        profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue
        // array might include canceled tasks.
  
        profilingState[QUEUE_SIZE] = 0;
        profilingState[CURRENT_TASK_ID] = 0;
      } // Bytes per element is 4
  
  
      var INITIAL_EVENT_LOG_SIZE = 131072;
      var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes
  
      var eventLogSize = 0;
      var eventLogBuffer = null;
      var eventLog = null;
      var eventLogIndex = 0;
      var TaskStartEvent = 1;
      var TaskCompleteEvent = 2;
      var TaskErrorEvent = 3;
      var TaskCancelEvent = 4;
      var TaskRunEvent = 5;
      var TaskYieldEvent = 6;
      var SchedulerSuspendEvent = 7;
      var SchedulerResumeEvent = 8;
  
      function logEvent(entries) {
        if (eventLog !== null) {
          var offset = eventLogIndex;
          eventLogIndex += entries.length;
  
          if (eventLogIndex + 1 > eventLogSize) {
            eventLogSize *= 2;
  
            if (eventLogSize > MAX_EVENT_LOG_SIZE) {
              console.error("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.');
              stopLoggingProfilingEvents();
              return;
            }
  
            var newEventLog = new Int32Array(eventLogSize * 4);
            newEventLog.set(eventLog);
            eventLogBuffer = newEventLog.buffer;
            eventLog = newEventLog;
          }
  
          eventLog.set(entries, offset);
        }
      }
  
      function startLoggingProfilingEvents() {
        eventLogSize = INITIAL_EVENT_LOG_SIZE;
        eventLogBuffer = new ArrayBuffer(eventLogSize * 4);
        eventLog = new Int32Array(eventLogBuffer);
        eventLogIndex = 0;
      }
  
      function stopLoggingProfilingEvents() {
        var buffer = eventLogBuffer;
        eventLogSize = 0;
        eventLogBuffer = null;
        eventLog = null;
        eventLogIndex = 0;
        return buffer;
      }
  
      function markTaskStart(task, ms) {
        {
          profilingState[QUEUE_SIZE]++;
  
          if (eventLog !== null) {
            // performance.now returns a float, representing milliseconds. When the
            // event is logged, it's coerced to an int. Convert to microseconds to
            // maintain extra degrees of precision.
            logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]);
          }
        }
      }
  
      function markTaskCompleted(task, ms) {
        {
          profilingState[PRIORITY] = NoPriority;
          profilingState[CURRENT_TASK_ID] = 0;
          profilingState[QUEUE_SIZE]--;
  
          if (eventLog !== null) {
            logEvent([TaskCompleteEvent, ms * 1000, task.id]);
          }
        }
      }
  
      function markTaskCanceled(task, ms) {
        {
          profilingState[QUEUE_SIZE]--;
  
          if (eventLog !== null) {
            logEvent([TaskCancelEvent, ms * 1000, task.id]);
          }
        }
      }
  
      function markTaskErrored(task, ms) {
        {
          profilingState[PRIORITY] = NoPriority;
          profilingState[CURRENT_TASK_ID] = 0;
          profilingState[QUEUE_SIZE]--;
  
          if (eventLog !== null) {
            logEvent([TaskErrorEvent, ms * 1000, task.id]);
          }
        }
      }
  
      function markTaskRun(task, ms) {
        {
          runIdCounter++;
          profilingState[PRIORITY] = task.priorityLevel;
          profilingState[CURRENT_TASK_ID] = task.id;
          profilingState[CURRENT_RUN_ID] = runIdCounter;
  
          if (eventLog !== null) {
            logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]);
          }
        }
      }
  
      function markTaskYield(task, ms) {
        {
          profilingState[PRIORITY] = NoPriority;
          profilingState[CURRENT_TASK_ID] = 0;
          profilingState[CURRENT_RUN_ID] = 0;
  
          if (eventLog !== null) {
            logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]);
          }
        }
      }
  
      function markSchedulerSuspended(ms) {
        {
          mainThreadIdCounter++;
  
          if (eventLog !== null) {
            logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]);
          }
        }
      }
  
      function markSchedulerUnsuspended(ms) {
        {
          if (eventLog !== null) {
            logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]);
          }
        }
      }
      /* eslint-disable no-var */
      // Math.pow(2, 30) - 1
      // 0b111111111111111111111111111111
  
  
      var maxSigned31BitInt = 1073741823; // Times out immediately
  
      var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
  
      var USER_BLOCKING_PRIORITY = 250;
      var NORMAL_PRIORITY_TIMEOUT = 5000;
      var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
  
      var IDLE_PRIORITY = maxSigned31BitInt; // Tasks are stored on a min heap
  
      var taskQueue = [];
      var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
  
      var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
      var currentTask = null;
      var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy.
  
      var isPerformingWork = false;
      var isHostCallbackScheduled = false;
      var isHostTimeoutScheduled = false;
  
      function advanceTimers(currentTime) {
        // Check for tasks that are no longer delayed and add them to the queue.
        var timer = peek(timerQueue);
  
        while (timer !== null) {
          if (timer.callback === null) {
            // Timer was cancelled.
            pop(timerQueue);
          } else if (timer.startTime <= currentTime) {
            // Timer fired. Transfer to the task queue.
            pop(timerQueue);
            timer.sortIndex = timer.expirationTime;
            push(taskQueue, timer);
  
            {
              markTaskStart(timer, currentTime);
              timer.isQueued = true;
            }
          } else {
            // Remaining timers are pending.
            return;
          }
  
          timer = peek(timerQueue);
        }
      }
  
      function handleTimeout(currentTime) {
        isHostTimeoutScheduled = false;
        advanceTimers(currentTime);
  
        if (!isHostCallbackScheduled) {
          if (peek(taskQueue) !== null) {
            isHostCallbackScheduled = true;
            requestHostCallback(flushWork);
          } else {
            var firstTimer = peek(timerQueue);
  
            if (firstTimer !== null) {
              requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
            }
          }
        }
      }
  
      function flushWork(hasTimeRemaining, initialTime) {
        {
          markSchedulerUnsuspended(initialTime);
        } // We'll need a host callback the next time work is scheduled.
  
  
        isHostCallbackScheduled = false;
  
        if (isHostTimeoutScheduled) {
          // We scheduled a timeout but it's no longer needed. Cancel it.
          isHostTimeoutScheduled = false;
          cancelHostTimeout();
        }
  
        isPerformingWork = true;
        var previousPriorityLevel = currentPriorityLevel;
  
        try {
          if (enableProfiling) {
            try {
              return workLoop(hasTimeRemaining, initialTime);
            } catch (error) {
              if (currentTask !== null) {
                var currentTime = exports.unstable_now();
                markTaskErrored(currentTask, currentTime);
                currentTask.isQueued = false;
              }
  
              throw error;
            }
          } else {
            // No catch in prod codepath.
            return workLoop(hasTimeRemaining, initialTime);
          }
        } finally {
          currentTask = null;
          currentPriorityLevel = previousPriorityLevel;
          isPerformingWork = false;
  
          {
            var _currentTime = exports.unstable_now();
  
            markSchedulerSuspended(_currentTime);
          }
        }
      }
  
      function workLoop(hasTimeRemaining, initialTime) {
        var currentTime = initialTime;
        advanceTimers(currentTime);
        currentTask = peek(taskQueue);
  
        while (currentTask !== null && !(enableSchedulerDebugging )) {
          if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
            // This currentTask hasn't expired, and we've reached the deadline.
            break;
          }
  
          var callback = currentTask.callback;
  
          if (callback !== null) {
            currentTask.callback = null;
            currentPriorityLevel = currentTask.priorityLevel;
            var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
            markTaskRun(currentTask, currentTime);
            var continuationCallback = callback(didUserCallbackTimeout);
            currentTime = exports.unstable_now();
  
            if (typeof continuationCallback === 'function') {
              currentTask.callback = continuationCallback;
              markTaskYield(currentTask, currentTime);
            } else {
              {
                markTaskCompleted(currentTask, currentTime);
                currentTask.isQueued = false;
              }
  
              if (currentTask === peek(taskQueue)) {
                pop(taskQueue);
              }
            }
  
            advanceTimers(currentTime);
          } else {
            pop(taskQueue);
          }
  
          currentTask = peek(taskQueue);
        } // Return whether there's additional work
  
  
        if (currentTask !== null) {
          return true;
        } else {
          var firstTimer = peek(timerQueue);
  
          if (firstTimer !== null) {
            requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
          }
  
          return false;
        }
      }
  
      function unstable_runWithPriority(priorityLevel, eventHandler) {
        switch (priorityLevel) {
          case ImmediatePriority:
          case UserBlockingPriority:
          case NormalPriority:
          case LowPriority:
          case IdlePriority:
            break;
  
          default:
            priorityLevel = NormalPriority;
        }
  
        var previousPriorityLevel = currentPriorityLevel;
        currentPriorityLevel = priorityLevel;
  
        try {
          return eventHandler();
        } finally {
          currentPriorityLevel = previousPriorityLevel;
        }
      }
  
      function unstable_next(eventHandler) {
        var priorityLevel;
  
        switch (currentPriorityLevel) {
          case ImmediatePriority:
          case UserBlockingPriority:
          case NormalPriority:
            // Shift down to normal priority
            priorityLevel = NormalPriority;
            break;
  
          default:
            // Anything lower than normal priority should remain at the current level.
            priorityLevel = currentPriorityLevel;
            break;
        }
  
        var previousPriorityLevel = currentPriorityLevel;
        currentPriorityLevel = priorityLevel;
  
        try {
          return eventHandler();
        } finally {
          currentPriorityLevel = previousPriorityLevel;
        }
      }
  
      function unstable_wrapCallback(callback) {
        var parentPriorityLevel = currentPriorityLevel;
        return function () {
          // This is a fork of runWithPriority, inlined for performance.
          var previousPriorityLevel = currentPriorityLevel;
          currentPriorityLevel = parentPriorityLevel;
  
          try {
            return callback.apply(this, arguments);
          } finally {
            currentPriorityLevel = previousPriorityLevel;
          }
        };
      }
  
      function timeoutForPriorityLevel(priorityLevel) {
        switch (priorityLevel) {
          case ImmediatePriority:
            return IMMEDIATE_PRIORITY_TIMEOUT;
  
          case UserBlockingPriority:
            return USER_BLOCKING_PRIORITY;
  
          case IdlePriority:
            return IDLE_PRIORITY;
  
          case LowPriority:
            return LOW_PRIORITY_TIMEOUT;
  
          case NormalPriority:
          default:
            return NORMAL_PRIORITY_TIMEOUT;
        }
      }
  
      function unstable_scheduleCallback(priorityLevel, callback, options) {
        var currentTime = exports.unstable_now();
        var startTime;
        var timeout;
  
        if (typeof options === 'object' && options !== null) {
          var delay = options.delay;
  
          if (typeof delay === 'number' && delay > 0) {
            startTime = currentTime + delay;
          } else {
            startTime = currentTime;
          }
  
          timeout = typeof options.timeout === 'number' ? options.timeout : timeoutForPriorityLevel(priorityLevel);
        } else {
          timeout = timeoutForPriorityLevel(priorityLevel);
          startTime = currentTime;
        }
  
        var expirationTime = startTime + timeout;
        var newTask = {
          id: taskIdCounter++,
          callback: callback,
          priorityLevel: priorityLevel,
          startTime: startTime,
          expirationTime: expirationTime,
          sortIndex: -1
        };
  
        {
          newTask.isQueued = false;
        }
  
        if (startTime > currentTime) {
          // This is a delayed task.
          newTask.sortIndex = startTime;
          push(timerQueue, newTask);
  
          if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
            // All tasks are delayed, and this is the task with the earliest delay.
            if (isHostTimeoutScheduled) {
              // Cancel an existing timeout.
              cancelHostTimeout();
            } else {
              isHostTimeoutScheduled = true;
            } // Schedule a timeout.
  
  
            requestHostTimeout(handleTimeout, startTime - currentTime);
          }
        } else {
          newTask.sortIndex = expirationTime;
          push(taskQueue, newTask);
  
          {
            markTaskStart(newTask, currentTime);
            newTask.isQueued = true;
          } // Schedule a host callback, if needed. If we're already performing work,
          // wait until the next time we yield.
  
  
          if (!isHostCallbackScheduled && !isPerformingWork) {
            isHostCallbackScheduled = true;
            requestHostCallback(flushWork);
          }
        }
  
        return newTask;
      }
  
      function unstable_pauseExecution() {
      }
  
      function unstable_continueExecution() {
  
        if (!isHostCallbackScheduled && !isPerformingWork) {
          isHostCallbackScheduled = true;
          requestHostCallback(flushWork);
        }
      }
  
      function unstable_getFirstCallbackNode() {
        return peek(taskQueue);
      }
  
      function unstable_cancelCallback(task) {
        {
          if (task.isQueued) {
            var currentTime = exports.unstable_now();
            markTaskCanceled(task, currentTime);
            task.isQueued = false;
          }
        } // Null out the callback to indicate the task has been canceled. (Can't
        // remove from the queue because you can't remove arbitrary nodes from an
        // array based heap, only the first one.)
  
  
        task.callback = null;
      }
  
      function unstable_getCurrentPriorityLevel() {
        return currentPriorityLevel;
      }
  
      function unstable_shouldYield() {
        var currentTime = exports.unstable_now();
        advanceTimers(currentTime);
        var firstTask = peek(taskQueue);
        return firstTask !== currentTask && currentTask !== null && firstTask !== null && firstTask.callback !== null && firstTask.startTime <= currentTime && firstTask.expirationTime < currentTask.expirationTime || shouldYieldToHost();
      }
  
      var unstable_requestPaint = requestPaint;
      var unstable_Profiling =  {
        startLoggingProfilingEvents: startLoggingProfilingEvents,
        stopLoggingProfilingEvents: stopLoggingProfilingEvents,
        sharedProfilingBuffer: sharedProfilingBuffer
      } ;
      exports.unstable_ImmediatePriority = ImmediatePriority;
      exports.unstable_UserBlockingPriority = UserBlockingPriority;
      exports.unstable_NormalPriority = NormalPriority;
      exports.unstable_IdlePriority = IdlePriority;
      exports.unstable_LowPriority = LowPriority;
      exports.unstable_runWithPriority = unstable_runWithPriority;
      exports.unstable_next = unstable_next;
      exports.unstable_scheduleCallback = unstable_scheduleCallback;
      exports.unstable_cancelCallback = unstable_cancelCallback;
      exports.unstable_wrapCallback = unstable_wrapCallback;
      exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
      exports.unstable_shouldYield = unstable_shouldYield;
      exports.unstable_requestPaint = unstable_requestPaint;
      exports.unstable_continueExecution = unstable_continueExecution;
      exports.unstable_pauseExecution = unstable_pauseExecution;
      exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
      exports.unstable_Profiling = unstable_Profiling;
    })();
  }
  });
  
  var scheduler = createCommonjsModule(function (module) {
  
  if (process.env.NODE_ENV === 'production') {
    module.exports = scheduler_production_min;
  } else {
    module.exports = scheduler_development;
  }
  });
  
  /* eslint-disable yoda */
  
  const isFullwidthCodePoint = codePoint => {
    if (Number.isNaN(codePoint)) {
      return false;
    } // Code points are derived from:
    // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
  
  
    if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
    codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
    codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
    // CJK Radicals Supplement .. Enclosed CJK Letters and Months
    0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
    0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals
    0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A
    0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables
    0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs
    0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms
    0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants
    0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms
    0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement
    0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement
    0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
    0x20000 <= codePoint && codePoint <= 0x3FFFD)) {
      return true;
    }
  
    return false;
  };
  
  var isFullwidthCodePoint_1 = isFullwidthCodePoint;
  var _default$2 = isFullwidthCodePoint;
  isFullwidthCodePoint_1.default = _default$2;
  
  var emojiRegex = function () {
    // https://mths.be/emoji
    return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
  };
  
  const stringWidth = string => {
    string = string.replace(emojiRegex(), '  ');
  
    if (typeof string !== 'string' || string.length === 0) {
      return 0;
    }
  
    string = stripAnsi(string);
    let width = 0;
  
    for (let i = 0; i < string.length; i++) {
      const code = string.codePointAt(i); // Ignore control characters
  
      if (code <= 0x1F || code >= 0x7F && code <= 0x9F) {
        continue;
      } // Ignore combining characters
  
  
      if (code >= 0x300 && code <= 0x36F) {
        continue;
      } // Surrogates
  
  
      if (code > 0xFFFF) {
        i++;
      }
  
      width += isFullwidthCodePoint_1(code) ? 2 : 1;
    }
  
    return width;
  };
  
  var stringWidth_1 = stringWidth; // TODO: remove this in the next major version
  
  var _default$3 = stringWidth;
  stringWidth_1.default = _default$3;
  
  const widestLine = input => {
    let max = 0;
  
    for (const line of input.split('\n')) {
      max = Math.max(max, stringWidth_1(line));
    }
  
    return max;
  };
  
  var widestLine_1 = widestLine; // TODO: remove this in the next major version
  
  var _default$4 = widestLine;
  widestLine_1.default = _default$4;
  
  var measureText = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const widest_line_1 = __importDefault(widestLine_1);
  
  const cache = {};
  
  exports.default = text => {
    if (text.length === 0) {
      return {
        width: 0,
        height: 0
      };
    }
  
    if (cache[text]) {
      return cache[text];
    }
  
    const width = widest_line_1.default(text);
    const height = text.split('\n').length;
    cache[text] = {
      width,
      height
    };
    return {
      width,
      height
    };
  };
  });
  
  var styles = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
  
  const yoga_layout_prebuilt_1 = __importDefault(yogaLayoutPrebuilt);
  
  const applyPositionStyles = (node, style) => {
    if ('position' in style) {
      node.setPositionType(style.position === 'absolute' ? yoga_layout_prebuilt_1.default.POSITION_TYPE_ABSOLUTE : yoga_layout_prebuilt_1.default.POSITION_TYPE_RELATIVE);
    }
  };
  
  const applyMarginStyles = (node, style) => {
    if ('marginLeft' in style) {
      node.setMargin(yoga_layout_prebuilt_1.default.EDGE_START, style.marginLeft || 0);
    }
  
    if ('marginRight' in style) {
      node.setMargin(yoga_layout_prebuilt_1.default.EDGE_END, style.marginRight || 0);
    }
  
    if ('marginTop' in style) {
      node.setMargin(yoga_layout_prebuilt_1.default.EDGE_TOP, style.marginTop || 0);
    }
  
    if ('marginBottom' in style) {
      node.setMargin(yoga_layout_prebuilt_1.default.EDGE_BOTTOM, style.marginBottom || 0);
    }
  };
  
  const applyPaddingStyles = (node, style) => {
    if ('paddingLeft' in style) {
      node.setPadding(yoga_layout_prebuilt_1.default.EDGE_LEFT, style.paddingLeft || 0);
    }
  
    if ('paddingRight' in style) {
      node.setPadding(yoga_layout_prebuilt_1.default.EDGE_RIGHT, style.paddingRight || 0);
    }
  
    if ('paddingTop' in style) {
      node.setPadding(yoga_layout_prebuilt_1.default.EDGE_TOP, style.paddingTop || 0);
    }
  
    if ('paddingBottom' in style) {
      node.setPadding(yoga_layout_prebuilt_1.default.EDGE_BOTTOM, style.paddingBottom || 0);
    }
  };
  
  const applyFlexStyles = (node, style) => {
    var _a;
  
    if ('flexGrow' in style) {
      node.setFlexGrow((_a = style.flexGrow) !== null && _a !== void 0 ? _a : 0);
    }
  
    if ('flexShrink' in style) {
      node.setFlexShrink(typeof style.flexShrink === 'number' ? style.flexShrink : 1);
    }
  
    if ('flexDirection' in style) {
      if (style.flexDirection === 'row') {
        node.setFlexDirection(yoga_layout_prebuilt_1.default.FLEX_DIRECTION_ROW);
      }
  
      if (style.flexDirection === 'row-reverse') {
        node.setFlexDirection(yoga_layout_prebuilt_1.default.FLEX_DIRECTION_ROW_REVERSE);
      }
  
      if (style.flexDirection === 'column') {
        node.setFlexDirection(yoga_layout_prebuilt_1.default.FLEX_DIRECTION_COLUMN);
      }
  
      if (style.flexDirection === 'column-reverse') {
        node.setFlexDirection(yoga_layout_prebuilt_1.default.FLEX_DIRECTION_COLUMN_REVERSE);
      }
    }
  
    if ('flexBasis' in style) {
      if (typeof style.flexBasis === 'number') {
        node.setFlexBasis(style.flexBasis);
      } else if (typeof style.flexBasis === 'string') {
        node.setFlexBasisPercent(Number.parseInt(style.flexBasis, 10));
      } else {
        // This should be replaced with node.setFlexBasisAuto() when new Yoga release is out
        node.setFlexBasis(NaN);
      }
    }
  
    if ('alignItems' in style) {
      if (style.alignItems === 'stretch' || !style.alignItems) {
        node.setAlignItems(yoga_layout_prebuilt_1.default.ALIGN_STRETCH);
      }
  
      if (style.alignItems === 'flex-start') {
        node.setAlignItems(yoga_layout_prebuilt_1.default.ALIGN_FLEX_START);
      }
  
      if (style.alignItems === 'center') {
        node.setAlignItems(yoga_layout_prebuilt_1.default.ALIGN_CENTER);
      }
  
      if (style.alignItems === 'flex-end') {
        node.setAlignItems(yoga_layout_prebuilt_1.default.ALIGN_FLEX_END);
      }
    }
  
    if ('alignSelf' in style) {
      if (style.alignSelf === 'auto' || !style.alignSelf) {
        node.setAlignSelf(yoga_layout_prebuilt_1.default.ALIGN_AUTO);
      }
  
      if (style.alignSelf === 'flex-start') {
        node.setAlignSelf(yoga_layout_prebuilt_1.default.ALIGN_FLEX_START);
      }
  
      if (style.alignSelf === 'center') {
        node.setAlignSelf(yoga_layout_prebuilt_1.default.ALIGN_CENTER);
      }
  
      if (style.alignSelf === 'flex-end') {
        node.setAlignSelf(yoga_layout_prebuilt_1.default.ALIGN_FLEX_END);
      }
    }
  
    if ('justifyContent' in style) {
      if (style.justifyContent === 'flex-start' || !style.justifyContent) {
        node.setJustifyContent(yoga_layout_prebuilt_1.default.JUSTIFY_FLEX_START);
      }
  
      if (style.justifyContent === 'center') {
        node.setJustifyContent(yoga_layout_prebuilt_1.default.JUSTIFY_CENTER);
      }
  
      if (style.justifyContent === 'flex-end') {
        node.setJustifyContent(yoga_layout_prebuilt_1.default.JUSTIFY_FLEX_END);
      }
  
      if (style.justifyContent === 'space-between') {
        node.setJustifyContent(yoga_layout_prebuilt_1.default.JUSTIFY_SPACE_BETWEEN);
      }
  
      if (style.justifyContent === 'space-around') {
        node.setJustifyContent(yoga_layout_prebuilt_1.default.JUSTIFY_SPACE_AROUND);
      }
    }
  };
  
  const applyDimensionStyles = (node, style) => {
    var _a, _b;
  
    if ('width' in style) {
      if (typeof style.width === 'number') {
        node.setWidth(style.width);
      } else if (typeof style.width === 'string') {
        node.setWidthPercent(Number.parseInt(style.width, 10));
      } else {
        node.setWidthAuto();
      }
    }
  
    if ('height' in style) {
      if (typeof style.height === 'number') {
        node.setHeight(style.height);
      } else if (typeof style.height === 'string') {
        node.setHeightPercent(Number.parseInt(style.height, 10));
      } else {
        node.setHeightAuto();
      }
    }
  
    if ('minWidth' in style) {
      if (typeof style.minWidth === 'string') {
        node.setMinWidthPercent(Number.parseInt(style.minWidth, 10));
      } else {
        node.setMinWidth((_a = style.minWidth) !== null && _a !== void 0 ? _a : 0);
      }
    }
  
    if ('minHeight' in style) {
      if (typeof style.minHeight === 'string') {
        node.setMinHeightPercent(Number.parseInt(style.minHeight, 10));
      } else {
        node.setMinHeight((_b = style.minHeight) !== null && _b !== void 0 ? _b : 0);
      }
    }
  };
  
  const applyDisplayStyles = (node, style) => {
    if ('display' in style) {
      node.setDisplay(style.display === 'flex' ? yoga_layout_prebuilt_1.default.DISPLAY_FLEX : yoga_layout_prebuilt_1.default.DISPLAY_NONE);
    }
  };
  
  const applyBorderStyles = (node, style) => {
    if ('borderStyle' in style) {
      const borderWidth = typeof style.borderStyle === 'string' ? 1 : 0;
      node.setBorder(yoga_layout_prebuilt_1.default.EDGE_TOP, borderWidth);
      node.setBorder(yoga_layout_prebuilt_1.default.EDGE_BOTTOM, borderWidth);
      node.setBorder(yoga_layout_prebuilt_1.default.EDGE_LEFT, borderWidth);
      node.setBorder(yoga_layout_prebuilt_1.default.EDGE_RIGHT, borderWidth);
    }
  };
  
  exports.default = (node, style = {}) => {
    applyPositionStyles(node, style);
    applyMarginStyles(node, style);
    applyPaddingStyles(node, style);
    applyFlexStyles(node, style);
    applyDimensionStyles(node, style);
    applyDisplayStyles(node, style);
    applyBorderStyles(node, style);
  };
  });
  
  /* eslint-disable yoda */
  
  const isFullwidthCodePoint$1 = codePoint => {
    if (Number.isNaN(codePoint)) {
      return false;
    } // Code points are derived from:
    // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
  
  
    if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
    codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
    codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
    // CJK Radicals Supplement .. Enclosed CJK Letters and Months
    0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
    0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals
    0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A
    0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables
    0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs
    0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms
    0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants
    0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms
    0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement
    0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement
    0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
    0x20000 <= codePoint && codePoint <= 0x3FFFD)) {
      return true;
    }
  
    return false;
  };
  
  var isFullwidthCodePoint_1$1 = isFullwidthCodePoint$1;
  var _default$5 = isFullwidthCodePoint$1;
  isFullwidthCodePoint_1$1.default = _default$5;
  
  var emojiRegex$1 = function () {
    // https://mths.be/emoji
    return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
  };
  
  const stringWidth$1 = string => {
    string = string.replace(emojiRegex$1(), '  ');
  
    if (typeof string !== 'string' || string.length === 0) {
      return 0;
    }
  
    string = stripAnsi(string);
    let width = 0;
  
    for (let i = 0; i < string.length; i++) {
      const code = string.codePointAt(i); // Ignore control characters
  
      if (code <= 0x1F || code >= 0x7F && code <= 0x9F) {
        continue;
      } // Ignore combining characters
  
  
      if (code >= 0x300 && code <= 0x36F) {
        continue;
      } // Surrogates
  
  
      if (code > 0xFFFF) {
        i++;
      }
  
      width += isFullwidthCodePoint_1$1(code) ? 2 : 1;
    }
  
    return width;
  };
  
  var stringWidth_1$1 = stringWidth$1; // TODO: remove this in the next major version
  
  var _default$6 = stringWidth$1;
  stringWidth_1$1.default = _default$6;
  
  var colorName = {
    "aliceblue": [240, 248, 255],
    "antiquewhite": [250, 235, 215],
    "aqua": [0, 255, 255],
    "aquamarine": [127, 255, 212],
    "azure": [240, 255, 255],
    "beige": [245, 245, 220],
    "bisque": [255, 228, 196],
    "black": [0, 0, 0],
    "blanchedalmond": [255, 235, 205],
    "blue": [0, 0, 255],
    "blueviolet": [138, 43, 226],
    "brown": [165, 42, 42],
    "burlywood": [222, 184, 135],
    "cadetblue": [95, 158, 160],
    "chartreuse": [127, 255, 0],
    "chocolate": [210, 105, 30],
    "coral": [255, 127, 80],
    "cornflowerblue": [100, 149, 237],
    "cornsilk": [255, 248, 220],
    "crimson": [220, 20, 60],
    "cyan": [0, 255, 255],
    "darkblue": [0, 0, 139],
    "darkcyan": [0, 139, 139],
    "darkgoldenrod": [184, 134, 11],
    "darkgray": [169, 169, 169],
    "darkgreen": [0, 100, 0],
    "darkgrey": [169, 169, 169],
    "darkkhaki": [189, 183, 107],
    "darkmagenta": [139, 0, 139],
    "darkolivegreen": [85, 107, 47],
    "darkorange": [255, 140, 0],
    "darkorchid": [153, 50, 204],
    "darkred": [139, 0, 0],
    "darksalmon": [233, 150, 122],
    "darkseagreen": [143, 188, 143],
    "darkslateblue": [72, 61, 139],
    "darkslategray": [47, 79, 79],
    "darkslategrey": [47, 79, 79],
    "darkturquoise": [0, 206, 209],
    "darkviolet": [148, 0, 211],
    "deeppink": [255, 20, 147],
    "deepskyblue": [0, 191, 255],
    "dimgray": [105, 105, 105],
    "dimgrey": [105, 105, 105],
    "dodgerblue": [30, 144, 255],
    "firebrick": [178, 34, 34],
    "floralwhite": [255, 250, 240],
    "forestgreen": [34, 139, 34],
    "fuchsia": [255, 0, 255],
    "gainsboro": [220, 220, 220],
    "ghostwhite": [248, 248, 255],
    "gold": [255, 215, 0],
    "goldenrod": [218, 165, 32],
    "gray": [128, 128, 128],
    "green": [0, 128, 0],
    "greenyellow": [173, 255, 47],
    "grey": [128, 128, 128],
    "honeydew": [240, 255, 240],
    "hotpink": [255, 105, 180],
    "indianred": [205, 92, 92],
    "indigo": [75, 0, 130],
    "ivory": [255, 255, 240],
    "khaki": [240, 230, 140],
    "lavender": [230, 230, 250],
    "lavenderblush": [255, 240, 245],
    "lawngreen": [124, 252, 0],
    "lemonchiffon": [255, 250, 205],
    "lightblue": [173, 216, 230],
    "lightcoral": [240, 128, 128],
    "lightcyan": [224, 255, 255],
    "lightgoldenrodyellow": [250, 250, 210],
    "lightgray": [211, 211, 211],
    "lightgreen": [144, 238, 144],
    "lightgrey": [211, 211, 211],
    "lightpink": [255, 182, 193],
    "lightsalmon": [255, 160, 122],
    "lightseagreen": [32, 178, 170],
    "lightskyblue": [135, 206, 250],
    "lightslategray": [119, 136, 153],
    "lightslategrey": [119, 136, 153],
    "lightsteelblue": [176, 196, 222],
    "lightyellow": [255, 255, 224],
    "lime": [0, 255, 0],
    "limegreen": [50, 205, 50],
    "linen": [250, 240, 230],
    "magenta": [255, 0, 255],
    "maroon": [128, 0, 0],
    "mediumaquamarine": [102, 205, 170],
    "mediumblue": [0, 0, 205],
    "mediumorchid": [186, 85, 211],
    "mediumpurple": [147, 112, 219],
    "mediumseagreen": [60, 179, 113],
    "mediumslateblue": [123, 104, 238],
    "mediumspringgreen": [0, 250, 154],
    "mediumturquoise": [72, 209, 204],
    "mediumvioletred": [199, 21, 133],
    "midnightblue": [25, 25, 112],
    "mintcream": [245, 255, 250],
    "mistyrose": [255, 228, 225],
    "moccasin": [255, 228, 181],
    "navajowhite": [255, 222, 173],
    "navy": [0, 0, 128],
    "oldlace": [253, 245, 230],
    "olive": [128, 128, 0],
    "olivedrab": [107, 142, 35],
    "orange": [255, 165, 0],
    "orangered": [255, 69, 0],
    "orchid": [218, 112, 214],
    "palegoldenrod": [238, 232, 170],
    "palegreen": [152, 251, 152],
    "paleturquoise": [175, 238, 238],
    "palevioletred": [219, 112, 147],
    "papayawhip": [255, 239, 213],
    "peachpuff": [255, 218, 185],
    "peru": [205, 133, 63],
    "pink": [255, 192, 203],
    "plum": [221, 160, 221],
    "powderblue": [176, 224, 230],
    "purple": [128, 0, 128],
    "rebeccapurple": [102, 51, 153],
    "red": [255, 0, 0],
    "rosybrown": [188, 143, 143],
    "royalblue": [65, 105, 225],
    "saddlebrown": [139, 69, 19],
    "salmon": [250, 128, 114],
    "sandybrown": [244, 164, 96],
    "seagreen": [46, 139, 87],
    "seashell": [255, 245, 238],
    "sienna": [160, 82, 45],
    "silver": [192, 192, 192],
    "skyblue": [135, 206, 235],
    "slateblue": [106, 90, 205],
    "slategray": [112, 128, 144],
    "slategrey": [112, 128, 144],
    "snow": [255, 250, 250],
    "springgreen": [0, 255, 127],
    "steelblue": [70, 130, 180],
    "tan": [210, 180, 140],
    "teal": [0, 128, 128],
    "thistle": [216, 191, 216],
    "tomato": [255, 99, 71],
    "turquoise": [64, 224, 208],
    "violet": [238, 130, 238],
    "wheat": [245, 222, 179],
    "white": [255, 255, 255],
    "whitesmoke": [245, 245, 245],
    "yellow": [255, 255, 0],
    "yellowgreen": [154, 205, 50]
  };
  
  /* MIT license */
  
  /* eslint-disable no-mixed-operators */
   // NOTE: conversions should only return primitive values (i.e. arrays, or
  //       values that give correct `typeof` results).
  //       do not use box values types (i.e. Number(), String(), etc.)
  
  
  const reverseKeywords = {};
  
  for (const key of Object.keys(colorName)) {
    reverseKeywords[colorName[key]] = key;
  }
  
  const convert = {
    rgb: {
      channels: 3,
      labels: 'rgb'
    },
    hsl: {
      channels: 3,
      labels: 'hsl'
    },
    hsv: {
      channels: 3,
      labels: 'hsv'
    },
    hwb: {
      channels: 3,
      labels: 'hwb'
    },
    cmyk: {
      channels: 4,
      labels: 'cmyk'
    },
    xyz: {
      channels: 3,
      labels: 'xyz'
    },
    lab: {
      channels: 3,
      labels: 'lab'
    },
    lch: {
      channels: 3,
      labels: 'lch'
    },
    hex: {
      channels: 1,
      labels: ['hex']
    },
    keyword: {
      channels: 1,
      labels: ['keyword']
    },
    ansi16: {
      channels: 1,
      labels: ['ansi16']
    },
    ansi256: {
      channels: 1,
      labels: ['ansi256']
    },
    hcg: {
      channels: 3,
      labels: ['h', 'c', 'g']
    },
    apple: {
      channels: 3,
      labels: ['r16', 'g16', 'b16']
    },
    gray: {
      channels: 1,
      labels: ['gray']
    }
  };
  var conversions = convert; // Hide .channels and .labels properties
  
  for (const model of Object.keys(convert)) {
    if (!('channels' in convert[model])) {
      throw new Error('missing channels property: ' + model);
    }
  
    if (!('labels' in convert[model])) {
      throw new Error('missing channel labels property: ' + model);
    }
  
    if (convert[model].labels.length !== convert[model].channels) {
      throw new Error('channel and label counts mismatch: ' + model);
    }
  
    const {
      channels,
      labels
    } = convert[model];
    delete convert[model].channels;
    delete convert[model].labels;
    Object.defineProperty(convert[model], 'channels', {
      value: channels
    });
    Object.defineProperty(convert[model], 'labels', {
      value: labels
    });
  }
  
  convert.rgb.hsl = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const min = Math.min(r, g, b);
    const max = Math.max(r, g, b);
    const delta = max - min;
    let h;
    let s;
  
    if (max === min) {
      h = 0;
    } else if (r === max) {
      h = (g - b) / delta;
    } else if (g === max) {
      h = 2 + (b - r) / delta;
    } else if (b === max) {
      h = 4 + (r - g) / delta;
    }
  
    h = Math.min(h * 60, 360);
  
    if (h < 0) {
      h += 360;
    }
  
    const l = (min + max) / 2;
  
    if (max === min) {
      s = 0;
    } else if (l <= 0.5) {
      s = delta / (max + min);
    } else {
      s = delta / (2 - max - min);
    }
  
    return [h, s * 100, l * 100];
  };
  
  convert.rgb.hsv = function (rgb) {
    let rdif;
    let gdif;
    let bdif;
    let h;
    let s;
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const v = Math.max(r, g, b);
    const diff = v - Math.min(r, g, b);
  
    const diffc = function (c) {
      return (v - c) / 6 / diff + 1 / 2;
    };
  
    if (diff === 0) {
      h = 0;
      s = 0;
    } else {
      s = diff / v;
      rdif = diffc(r);
      gdif = diffc(g);
      bdif = diffc(b);
  
      if (r === v) {
        h = bdif - gdif;
      } else if (g === v) {
        h = 1 / 3 + rdif - bdif;
      } else if (b === v) {
        h = 2 / 3 + gdif - rdif;
      }
  
      if (h < 0) {
        h += 1;
      } else if (h > 1) {
        h -= 1;
      }
    }
  
    return [h * 360, s * 100, v * 100];
  };
  
  convert.rgb.hwb = function (rgb) {
    const r = rgb[0];
    const g = rgb[1];
    let b = rgb[2];
    const h = convert.rgb.hsl(rgb)[0];
    const w = 1 / 255 * Math.min(r, Math.min(g, b));
    b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
    return [h, w * 100, b * 100];
  };
  
  convert.rgb.cmyk = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const k = Math.min(1 - r, 1 - g, 1 - b);
    const c = (1 - r - k) / (1 - k) || 0;
    const m = (1 - g - k) / (1 - k) || 0;
    const y = (1 - b - k) / (1 - k) || 0;
    return [c * 100, m * 100, y * 100, k * 100];
  };
  
  function comparativeDistance(x, y) {
    /*
    	See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
    */
    return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
  }
  
  convert.rgb.keyword = function (rgb) {
    const reversed = reverseKeywords[rgb];
  
    if (reversed) {
      return reversed;
    }
  
    let currentClosestDistance = Infinity;
    let currentClosestKeyword;
  
    for (const keyword of Object.keys(colorName)) {
      const value = colorName[keyword]; // Compute comparative distance
  
      const distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
  
      if (distance < currentClosestDistance) {
        currentClosestDistance = distance;
        currentClosestKeyword = keyword;
      }
    }
  
    return currentClosestKeyword;
  };
  
  convert.keyword.rgb = function (keyword) {
    return colorName[keyword];
  };
  
  convert.rgb.xyz = function (rgb) {
    let r = rgb[0] / 255;
    let g = rgb[1] / 255;
    let b = rgb[2] / 255; // Assume sRGB
  
    r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
    g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
    b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
    const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
    const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
    const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
    return [x * 100, y * 100, z * 100];
  };
  
  convert.rgb.lab = function (rgb) {
    const xyz = convert.rgb.xyz(rgb);
    let x = xyz[0];
    let y = xyz[1];
    let z = xyz[2];
    x /= 95.047;
    y /= 100;
    z /= 108.883;
    x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
    y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
    z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
    const l = 116 * y - 16;
    const a = 500 * (x - y);
    const b = 200 * (y - z);
    return [l, a, b];
  };
  
  convert.hsl.rgb = function (hsl) {
    const h = hsl[0] / 360;
    const s = hsl[1] / 100;
    const l = hsl[2] / 100;
    let t2;
    let t3;
    let val;
  
    if (s === 0) {
      val = l * 255;
      return [val, val, val];
    }
  
    if (l < 0.5) {
      t2 = l * (1 + s);
    } else {
      t2 = l + s - l * s;
    }
  
    const t1 = 2 * l - t2;
    const rgb = [0, 0, 0];
  
    for (let i = 0; i < 3; i++) {
      t3 = h + 1 / 3 * -(i - 1);
  
      if (t3 < 0) {
        t3++;
      }
  
      if (t3 > 1) {
        t3--;
      }
  
      if (6 * t3 < 1) {
        val = t1 + (t2 - t1) * 6 * t3;
      } else if (2 * t3 < 1) {
        val = t2;
      } else if (3 * t3 < 2) {
        val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
      } else {
        val = t1;
      }
  
      rgb[i] = val * 255;
    }
  
    return rgb;
  };
  
  convert.hsl.hsv = function (hsl) {
    const h = hsl[0];
    let s = hsl[1] / 100;
    let l = hsl[2] / 100;
    let smin = s;
    const lmin = Math.max(l, 0.01);
    l *= 2;
    s *= l <= 1 ? l : 2 - l;
    smin *= lmin <= 1 ? lmin : 2 - lmin;
    const v = (l + s) / 2;
    const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
    return [h, sv * 100, v * 100];
  };
  
  convert.hsv.rgb = function (hsv) {
    const h = hsv[0] / 60;
    const s = hsv[1] / 100;
    let v = hsv[2] / 100;
    const hi = Math.floor(h) % 6;
    const f = h - Math.floor(h);
    const p = 255 * v * (1 - s);
    const q = 255 * v * (1 - s * f);
    const t = 255 * v * (1 - s * (1 - f));
    v *= 255;
  
    switch (hi) {
      case 0:
        return [v, t, p];
  
      case 1:
        return [q, v, p];
  
      case 2:
        return [p, v, t];
  
      case 3:
        return [p, q, v];
  
      case 4:
        return [t, p, v];
  
      case 5:
        return [v, p, q];
    }
  };
  
  convert.hsv.hsl = function (hsv) {
    const h = hsv[0];
    const s = hsv[1] / 100;
    const v = hsv[2] / 100;
    const vmin = Math.max(v, 0.01);
    let sl;
    let l;
    l = (2 - s) * v;
    const lmin = (2 - s) * vmin;
    sl = s * vmin;
    sl /= lmin <= 1 ? lmin : 2 - lmin;
    sl = sl || 0;
    l /= 2;
    return [h, sl * 100, l * 100];
  }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
  
  
  convert.hwb.rgb = function (hwb) {
    const h = hwb[0] / 360;
    let wh = hwb[1] / 100;
    let bl = hwb[2] / 100;
    const ratio = wh + bl;
    let f; // Wh + bl cant be > 1
  
    if (ratio > 1) {
      wh /= ratio;
      bl /= ratio;
    }
  
    const i = Math.floor(6 * h);
    const v = 1 - bl;
    f = 6 * h - i;
  
    if ((i & 0x01) !== 0) {
      f = 1 - f;
    }
  
    const n = wh + f * (v - wh); // Linear interpolation
  
    let r;
    let g;
    let b;
    /* eslint-disable max-statements-per-line,no-multi-spaces */
  
    switch (i) {
      default:
      case 6:
      case 0:
        r = v;
        g = n;
        b = wh;
        break;
  
      case 1:
        r = n;
        g = v;
        b = wh;
        break;
  
      case 2:
        r = wh;
        g = v;
        b = n;
        break;
  
      case 3:
        r = wh;
        g = n;
        b = v;
        break;
  
      case 4:
        r = n;
        g = wh;
        b = v;
        break;
  
      case 5:
        r = v;
        g = wh;
        b = n;
        break;
    }
    /* eslint-enable max-statements-per-line,no-multi-spaces */
  
  
    return [r * 255, g * 255, b * 255];
  };
  
  convert.cmyk.rgb = function (cmyk) {
    const c = cmyk[0] / 100;
    const m = cmyk[1] / 100;
    const y = cmyk[2] / 100;
    const k = cmyk[3] / 100;
    const r = 1 - Math.min(1, c * (1 - k) + k);
    const g = 1 - Math.min(1, m * (1 - k) + k);
    const b = 1 - Math.min(1, y * (1 - k) + k);
    return [r * 255, g * 255, b * 255];
  };
  
  convert.xyz.rgb = function (xyz) {
    const x = xyz[0] / 100;
    const y = xyz[1] / 100;
    const z = xyz[2] / 100;
    let r;
    let g;
    let b;
    r = x * 3.2406 + y * -1.5372 + z * -0.4986;
    g = x * -0.9689 + y * 1.8758 + z * 0.0415;
    b = x * 0.0557 + y * -0.2040 + z * 1.0570; // Assume sRGB
  
    r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92;
    g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92;
    b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92;
    r = Math.min(Math.max(0, r), 1);
    g = Math.min(Math.max(0, g), 1);
    b = Math.min(Math.max(0, b), 1);
    return [r * 255, g * 255, b * 255];
  };
  
  convert.xyz.lab = function (xyz) {
    let x = xyz[0];
    let y = xyz[1];
    let z = xyz[2];
    x /= 95.047;
    y /= 100;
    z /= 108.883;
    x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
    y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
    z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
    const l = 116 * y - 16;
    const a = 500 * (x - y);
    const b = 200 * (y - z);
    return [l, a, b];
  };
  
  convert.lab.xyz = function (lab) {
    const l = lab[0];
    const a = lab[1];
    const b = lab[2];
    let x;
    let y;
    let z;
    y = (l + 16) / 116;
    x = a / 500 + y;
    z = y - b / 200;
    const y2 = y ** 3;
    const x2 = x ** 3;
    const z2 = z ** 3;
    y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
    x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
    z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
    x *= 95.047;
    y *= 100;
    z *= 108.883;
    return [x, y, z];
  };
  
  convert.lab.lch = function (lab) {
    const l = lab[0];
    const a = lab[1];
    const b = lab[2];
    let h;
    const hr = Math.atan2(b, a);
    h = hr * 360 / 2 / Math.PI;
  
    if (h < 0) {
      h += 360;
    }
  
    const c = Math.sqrt(a * a + b * b);
    return [l, c, h];
  };
  
  convert.lch.lab = function (lch) {
    const l = lch[0];
    const c = lch[1];
    const h = lch[2];
    const hr = h / 360 * 2 * Math.PI;
    const a = c * Math.cos(hr);
    const b = c * Math.sin(hr);
    return [l, a, b];
  };
  
  convert.rgb.ansi16 = function (args, saturation = null) {
    const [r, g, b] = args;
    let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
  
    value = Math.round(value / 50);
  
    if (value === 0) {
      return 30;
    }
  
    let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
  
    if (value === 2) {
      ansi += 60;
    }
  
    return ansi;
  };
  
  convert.hsv.ansi16 = function (args) {
    // Optimization here; we already know the value and don't need to get
    // it converted for us.
    return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
  };
  
  convert.rgb.ansi256 = function (args) {
    const r = args[0];
    const g = args[1];
    const b = args[2]; // We use the extended greyscale palette here, with the exception of
    // black and white. normal palette only has 4 greyscale shades.
  
    if (r === g && g === b) {
      if (r < 8) {
        return 16;
      }
  
      if (r > 248) {
        return 231;
      }
  
      return Math.round((r - 8) / 247 * 24) + 232;
    }
  
    const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
    return ansi;
  };
  
  convert.ansi16.rgb = function (args) {
    let color = args % 10; // Handle greyscale
  
    if (color === 0 || color === 7) {
      if (args > 50) {
        color += 3.5;
      }
  
      color = color / 10.5 * 255;
      return [color, color, color];
    }
  
    const mult = (~~(args > 50) + 1) * 0.5;
    const r = (color & 1) * mult * 255;
    const g = (color >> 1 & 1) * mult * 255;
    const b = (color >> 2 & 1) * mult * 255;
    return [r, g, b];
  };
  
  convert.ansi256.rgb = function (args) {
    // Handle greyscale
    if (args >= 232) {
      const c = (args - 232) * 10 + 8;
      return [c, c, c];
    }
  
    args -= 16;
    let rem;
    const r = Math.floor(args / 36) / 5 * 255;
    const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
    const b = rem % 6 / 5 * 255;
    return [r, g, b];
  };
  
  convert.rgb.hex = function (args) {
    const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
    const string = integer.toString(16).toUpperCase();
    return '000000'.substring(string.length) + string;
  };
  
  convert.hex.rgb = function (args) {
    const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  
    if (!match) {
      return [0, 0, 0];
    }
  
    let colorString = match[0];
  
    if (match[0].length === 3) {
      colorString = colorString.split('').map(char => {
        return char + char;
      }).join('');
    }
  
    const integer = parseInt(colorString, 16);
    const r = integer >> 16 & 0xFF;
    const g = integer >> 8 & 0xFF;
    const b = integer & 0xFF;
    return [r, g, b];
  };
  
  convert.rgb.hcg = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const max = Math.max(Math.max(r, g), b);
    const min = Math.min(Math.min(r, g), b);
    const chroma = max - min;
    let grayscale;
    let hue;
  
    if (chroma < 1) {
      grayscale = min / (1 - chroma);
    } else {
      grayscale = 0;
    }
  
    if (chroma <= 0) {
      hue = 0;
    } else if (max === r) {
      hue = (g - b) / chroma % 6;
    } else if (max === g) {
      hue = 2 + (b - r) / chroma;
    } else {
      hue = 4 + (r - g) / chroma;
    }
  
    hue /= 6;
    hue %= 1;
    return [hue * 360, chroma * 100, grayscale * 100];
  };
  
  convert.hsl.hcg = function (hsl) {
    const s = hsl[1] / 100;
    const l = hsl[2] / 100;
    const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
    let f = 0;
  
    if (c < 1.0) {
      f = (l - 0.5 * c) / (1.0 - c);
    }
  
    return [hsl[0], c * 100, f * 100];
  };
  
  convert.hsv.hcg = function (hsv) {
    const s = hsv[1] / 100;
    const v = hsv[2] / 100;
    const c = s * v;
    let f = 0;
  
    if (c < 1.0) {
      f = (v - c) / (1 - c);
    }
  
    return [hsv[0], c * 100, f * 100];
  };
  
  convert.hcg.rgb = function (hcg) {
    const h = hcg[0] / 360;
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
  
    if (c === 0.0) {
      return [g * 255, g * 255, g * 255];
    }
  
    const pure = [0, 0, 0];
    const hi = h % 1 * 6;
    const v = hi % 1;
    const w = 1 - v;
    let mg = 0;
    /* eslint-disable max-statements-per-line */
  
    switch (Math.floor(hi)) {
      case 0:
        pure[0] = 1;
        pure[1] = v;
        pure[2] = 0;
        break;
  
      case 1:
        pure[0] = w;
        pure[1] = 1;
        pure[2] = 0;
        break;
  
      case 2:
        pure[0] = 0;
        pure[1] = 1;
        pure[2] = v;
        break;
  
      case 3:
        pure[0] = 0;
        pure[1] = w;
        pure[2] = 1;
        break;
  
      case 4:
        pure[0] = v;
        pure[1] = 0;
        pure[2] = 1;
        break;
  
      default:
        pure[0] = 1;
        pure[1] = 0;
        pure[2] = w;
    }
    /* eslint-enable max-statements-per-line */
  
  
    mg = (1.0 - c) * g;
    return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
  };
  
  convert.hcg.hsv = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const v = c + g * (1.0 - c);
    let f = 0;
  
    if (v > 0.0) {
      f = c / v;
    }
  
    return [hcg[0], f * 100, v * 100];
  };
  
  convert.hcg.hsl = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const l = g * (1.0 - c) + 0.5 * c;
    let s = 0;
  
    if (l > 0.0 && l < 0.5) {
      s = c / (2 * l);
    } else if (l >= 0.5 && l < 1.0) {
      s = c / (2 * (1 - l));
    }
  
    return [hcg[0], s * 100, l * 100];
  };
  
  convert.hcg.hwb = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const v = c + g * (1.0 - c);
    return [hcg[0], (v - c) * 100, (1 - v) * 100];
  };
  
  convert.hwb.hcg = function (hwb) {
    const w = hwb[1] / 100;
    const b = hwb[2] / 100;
    const v = 1 - b;
    const c = v - w;
    let g = 0;
  
    if (c < 1) {
      g = (v - c) / (1 - c);
    }
  
    return [hwb[0], c * 100, g * 100];
  };
  
  convert.apple.rgb = function (apple) {
    return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  };
  
  convert.rgb.apple = function (rgb) {
    return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  };
  
  convert.gray.rgb = function (args) {
    return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  };
  
  convert.gray.hsl = function (args) {
    return [0, 0, args[0]];
  };
  
  convert.gray.hsv = convert.gray.hsl;
  
  convert.gray.hwb = function (gray) {
    return [0, 100, gray[0]];
  };
  
  convert.gray.cmyk = function (gray) {
    return [0, 0, 0, gray[0]];
  };
  
  convert.gray.lab = function (gray) {
    return [gray[0], 0, 0];
  };
  
  convert.gray.hex = function (gray) {
    const val = Math.round(gray[0] / 100 * 255) & 0xFF;
    const integer = (val << 16) + (val << 8) + val;
    const string = integer.toString(16).toUpperCase();
    return '000000'.substring(string.length) + string;
  };
  
  convert.rgb.gray = function (rgb) {
    const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
    return [val / 255 * 100];
  };
  
  /*
  	This function routes a model to all other models.
  
  	all functions that are routed have a property `.conversion` attached
  	to the returned synthetic function. This property is an array
  	of strings, each with the steps in between the 'from' and 'to'
  	color models (inclusive).
  
  	conversions that are not possible simply are not included.
  */
  
  
  function buildGraph() {
    const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
  
    const models = Object.keys(conversions);
  
    for (let len = models.length, i = 0; i < len; i++) {
      graph[models[i]] = {
        // http://jsperf.com/1-vs-infinity
        // micro-opt, but this is simple.
        distance: -1,
        parent: null
      };
    }
  
    return graph;
  } // https://en.wikipedia.org/wiki/Breadth-first_search
  
  
  function deriveBFS(fromModel) {
    const graph = buildGraph();
    const queue = [fromModel]; // Unshift -> queue -> pop
  
    graph[fromModel].distance = 0;
  
    while (queue.length) {
      const current = queue.pop();
      const adjacents = Object.keys(conversions[current]);
  
      for (let len = adjacents.length, i = 0; i < len; i++) {
        const adjacent = adjacents[i];
        const node = graph[adjacent];
  
        if (node.distance === -1) {
          node.distance = graph[current].distance + 1;
          node.parent = current;
          queue.unshift(adjacent);
        }
      }
    }
  
    return graph;
  }
  
  function link(from, to) {
    return function (args) {
      return to(from(args));
    };
  }
  
  function wrapConversion(toModel, graph) {
    const path = [graph[toModel].parent, toModel];
    let fn = conversions[graph[toModel].parent][toModel];
    let cur = graph[toModel].parent;
  
    while (graph[cur].parent) {
      path.unshift(graph[cur].parent);
      fn = link(conversions[graph[cur].parent][cur], fn);
      cur = graph[cur].parent;
    }
  
    fn.conversion = path;
    return fn;
  }
  
  var route = function (fromModel) {
    const graph = deriveBFS(fromModel);
    const conversion = {};
    const models = Object.keys(graph);
  
    for (let len = models.length, i = 0; i < len; i++) {
      const toModel = models[i];
      const node = graph[toModel];
  
      if (node.parent === null) {
        // No possible conversion, or this node is the source model.
        continue;
      }
  
      conversion[toModel] = wrapConversion(toModel, graph);
    }
  
    return conversion;
  };
  
  const convert$1 = {};
  const models = Object.keys(conversions);
  
  function wrapRaw(fn) {
    const wrappedFn = function (...args) {
      const arg0 = args[0];
  
      if (arg0 === undefined || arg0 === null) {
        return arg0;
      }
  
      if (arg0.length > 1) {
        args = arg0;
      }
  
      return fn(args);
    }; // Preserve .conversion property if there is one
  
  
    if ('conversion' in fn) {
      wrappedFn.conversion = fn.conversion;
    }
  
    return wrappedFn;
  }
  
  function wrapRounded(fn) {
    const wrappedFn = function (...args) {
      const arg0 = args[0];
  
      if (arg0 === undefined || arg0 === null) {
        return arg0;
      }
  
      if (arg0.length > 1) {
        args = arg0;
      }
  
      const result = fn(args); // We're assuming the result is an array here.
      // see notice in conversions.js; don't use box types
      // in conversion functions.
  
      if (typeof result === 'object') {
        for (let len = result.length, i = 0; i < len; i++) {
          result[i] = Math.round(result[i]);
        }
      }
  
      return result;
    }; // Preserve .conversion property if there is one
  
  
    if ('conversion' in fn) {
      wrappedFn.conversion = fn.conversion;
    }
  
    return wrappedFn;
  }
  
  models.forEach(fromModel => {
    convert$1[fromModel] = {};
    Object.defineProperty(convert$1[fromModel], 'channels', {
      value: conversions[fromModel].channels
    });
    Object.defineProperty(convert$1[fromModel], 'labels', {
      value: conversions[fromModel].labels
    });
    const routes = route(fromModel);
    const routeModels = Object.keys(routes);
    routeModels.forEach(toModel => {
      const fn = routes[toModel];
      convert$1[fromModel][toModel] = wrapRounded(fn);
      convert$1[fromModel][toModel].raw = wrapRaw(fn);
    });
  });
  var colorConvert = convert$1;
  
  var ansiStyles = createCommonjsModule(function (module) {
  
  const wrapAnsi16 = (fn, offset) => (...args) => {
    const code = fn(...args);
    return `\u001B[${code + offset}m`;
  };
  
  const wrapAnsi256 = (fn, offset) => (...args) => {
    const code = fn(...args);
    return `\u001B[${38 + offset};5;${code}m`;
  };
  
  const wrapAnsi16m = (fn, offset) => (...args) => {
    const rgb = fn(...args);
    return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  };
  
  const ansi2ansi = n => n;
  
  const rgb2rgb = (r, g, b) => [r, g, b];
  
  const setLazyProperty = (object, property, get) => {
    Object.defineProperty(object, property, {
      get: () => {
        const value = get();
        Object.defineProperty(object, property, {
          value,
          enumerable: true,
          configurable: true
        });
        return value;
      },
      enumerable: true,
      configurable: true
    });
  };
  /** @type {typeof import('color-convert')} */
  
  
  let colorConvert$1;
  
  const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
    if (colorConvert$1 === undefined) {
      colorConvert$1 = colorConvert;
    }
  
    const offset = isBackground ? 10 : 0;
    const styles = {};
  
    for (const [sourceSpace, suite] of Object.entries(colorConvert$1)) {
      const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
  
      if (sourceSpace === targetSpace) {
        styles[name] = wrap(identity, offset);
      } else if (typeof suite === 'object') {
        styles[name] = wrap(suite[targetSpace], offset);
      }
    }
  
    return styles;
  };
  
  function assembleStyles() {
    const codes = new Map();
    const styles = {
      modifier: {
        reset: [0, 0],
        // 21 isn't widely supported and 22 does the same thing
        bold: [1, 22],
        dim: [2, 22],
        italic: [3, 23],
        underline: [4, 24],
        inverse: [7, 27],
        hidden: [8, 28],
        strikethrough: [9, 29]
      },
      color: {
        black: [30, 39],
        red: [31, 39],
        green: [32, 39],
        yellow: [33, 39],
        blue: [34, 39],
        magenta: [35, 39],
        cyan: [36, 39],
        white: [37, 39],
        // Bright color
        blackBright: [90, 39],
        redBright: [91, 39],
        greenBright: [92, 39],
        yellowBright: [93, 39],
        blueBright: [94, 39],
        magentaBright: [95, 39],
        cyanBright: [96, 39],
        whiteBright: [97, 39]
      },
      bgColor: {
        bgBlack: [40, 49],
        bgRed: [41, 49],
        bgGreen: [42, 49],
        bgYellow: [43, 49],
        bgBlue: [44, 49],
        bgMagenta: [45, 49],
        bgCyan: [46, 49],
        bgWhite: [47, 49],
        // Bright color
        bgBlackBright: [100, 49],
        bgRedBright: [101, 49],
        bgGreenBright: [102, 49],
        bgYellowBright: [103, 49],
        bgBlueBright: [104, 49],
        bgMagentaBright: [105, 49],
        bgCyanBright: [106, 49],
        bgWhiteBright: [107, 49]
      }
    }; // Alias bright black as gray (and grey)
  
    styles.color.gray = styles.color.blackBright;
    styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
    styles.color.grey = styles.color.blackBright;
    styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
  
    for (const [groupName, group] of Object.entries(styles)) {
      for (const [styleName, style] of Object.entries(group)) {
        styles[styleName] = {
          open: `\u001B[${style[0]}m`,
          close: `\u001B[${style[1]}m`
        };
        group[styleName] = styles[styleName];
        codes.set(style[0], style[1]);
      }
  
      Object.defineProperty(styles, groupName, {
        value: group,
        enumerable: false
      });
    }
  
    Object.defineProperty(styles, 'codes', {
      value: codes,
      enumerable: false
    });
    styles.color.close = '\u001B[39m';
    styles.bgColor.close = '\u001B[49m';
    setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
    setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
    setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
    setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
    setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
    setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
    return styles;
  } // Make the export immutable
  
  
  Object.defineProperty(module, 'exports', {
    enumerable: true,
    get: assembleStyles
  });
  });
  
  const ESCAPES = new Set(['\u001B', '\u009B']);
  const END_CODE = 39;
  
  const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`; // Calculate the length of words split on ' ', ignoring
  // the extra characters added by ansi escape codes
  
  
  const wordLengths = string => string.split(' ').map(character => stringWidth_1$1(character)); // Wrap a long word across multiple rows
  // Ansi escape codes do not count towards length
  
  
  const wrapWord = (rows, word, columns) => {
    const characters = [...word];
    let isInsideEscape = false;
    let visible = stringWidth_1$1(stripAnsi(rows[rows.length - 1]));
  
    for (const [index, character] of characters.entries()) {
      const characterLength = stringWidth_1$1(character);
  
      if (visible + characterLength <= columns) {
        rows[rows.length - 1] += character;
      } else {
        rows.push(character);
        visible = 0;
      }
  
      if (ESCAPES.has(character)) {
        isInsideEscape = true;
      } else if (isInsideEscape && character === 'm') {
        isInsideEscape = false;
        continue;
      }
  
      if (isInsideEscape) {
        continue;
      }
  
      visible += characterLength;
  
      if (visible === columns && index < characters.length - 1) {
        rows.push('');
        visible = 0;
      }
    } // It's possible that the last row we copy over is only
    // ansi escape characters, handle this edge-case
  
  
    if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
      rows[rows.length - 2] += rows.pop();
    }
  }; // Trims spaces from a string ignoring invisible sequences
  
  
  const stringVisibleTrimSpacesRight = str => {
    const words = str.split(' ');
    let last = words.length;
  
    while (last > 0) {
      if (stringWidth_1$1(words[last - 1]) > 0) {
        break;
      }
  
      last--;
    }
  
    if (last === words.length) {
      return str;
    }
  
    return words.slice(0, last).join(' ') + words.slice(last).join('');
  }; // The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode
  //
  // 'hard' will never allow a string to take up more than columns characters
  //
  // 'soft' allows long words to expand past the column length
  
  
  const exec = (string, columns, options = {}) => {
    if (options.trim !== false && string.trim() === '') {
      return '';
    }
  
    let pre = '';
    let ret = '';
    let escapeCode;
    const lengths = wordLengths(string);
    let rows = [''];
  
    for (const [index, word] of string.split(' ').entries()) {
      if (options.trim !== false) {
        rows[rows.length - 1] = rows[rows.length - 1].trimLeft();
      }
  
      let rowLength = stringWidth_1$1(rows[rows.length - 1]);
  
      if (index !== 0) {
        if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
          // If we start with a new word but the current row length equals the length of the columns, add a new row
          rows.push('');
          rowLength = 0;
        }
  
        if (rowLength > 0 || options.trim === false) {
          rows[rows.length - 1] += ' ';
          rowLength++;
        }
      } // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'
  
  
      if (options.hard && lengths[index] > columns) {
        const remainingColumns = columns - rowLength;
        const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
        const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
  
        if (breaksStartingNextLine < breaksStartingThisLine) {
          rows.push('');
        }
  
        wrapWord(rows, word, columns);
        continue;
      }
  
      if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
        if (options.wordWrap === false && rowLength < columns) {
          wrapWord(rows, word, columns);
          continue;
        }
  
        rows.push('');
      }
  
      if (rowLength + lengths[index] > columns && options.wordWrap === false) {
        wrapWord(rows, word, columns);
        continue;
      }
  
      rows[rows.length - 1] += word;
    }
  
    if (options.trim !== false) {
      rows = rows.map(stringVisibleTrimSpacesRight);
    }
  
    pre = rows.join('\n');
  
    for (const [index, character] of [...pre].entries()) {
      ret += character;
  
      if (ESCAPES.has(character)) {
        const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4)));
        escapeCode = code === END_CODE ? null : code;
      }
  
      const code = ansiStyles.codes.get(Number(escapeCode));
  
      if (escapeCode && code) {
        if (pre[index + 1] === '\n') {
          ret += wrapAnsi(code);
        } else if (character === '\n') {
          ret += wrapAnsi(escapeCode);
        }
      }
    }
  
    return ret;
  }; // For each newline, invoke the method separately
  
  
  var wrapAnsi_1 = (string, columns, options) => {
    return String(string).normalize().replace(/\r\n/g, '\n').split('\n').map(line => exec(line, columns, options)).join('\n');
  };
  
  /* eslint-disable yoda */
  
  const isFullwidthCodePoint$2 = codePoint => {
    if (Number.isNaN(codePoint)) {
      return false;
    } // Code points are derived from:
    // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
  
  
    if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
    codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
    codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
    // CJK Radicals Supplement .. Enclosed CJK Letters and Months
    0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
    0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals
    0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A
    0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables
    0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs
    0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms
    0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants
    0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms
    0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement
    0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement
    0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
    0x20000 <= codePoint && codePoint <= 0x3FFFD)) {
      return true;
    }
  
    return false;
  };
  
  var isFullwidthCodePoint_1$2 = isFullwidthCodePoint$2;
  var _default$7 = isFullwidthCodePoint$2;
  isFullwidthCodePoint_1$2.default = _default$7;
  
  const regex = '[\uD800-\uDBFF][\uDC00-\uDFFF]';
  
  const astralRegex = options => options && options.exact ? new RegExp(`^${regex}$`) : new RegExp(regex, 'g');
  
  var astralRegex_1 = astralRegex;
  
  /* MIT license */
  
  /* eslint-disable no-mixed-operators */
   // NOTE: conversions should only return primitive values (i.e. arrays, or
  //       values that give correct `typeof` results).
  //       do not use box values types (i.e. Number(), String(), etc.)
  
  
  const reverseKeywords$1 = {};
  
  for (const key of Object.keys(colorName)) {
    reverseKeywords$1[colorName[key]] = key;
  }
  
  const convert$2 = {
    rgb: {
      channels: 3,
      labels: 'rgb'
    },
    hsl: {
      channels: 3,
      labels: 'hsl'
    },
    hsv: {
      channels: 3,
      labels: 'hsv'
    },
    hwb: {
      channels: 3,
      labels: 'hwb'
    },
    cmyk: {
      channels: 4,
      labels: 'cmyk'
    },
    xyz: {
      channels: 3,
      labels: 'xyz'
    },
    lab: {
      channels: 3,
      labels: 'lab'
    },
    lch: {
      channels: 3,
      labels: 'lch'
    },
    hex: {
      channels: 1,
      labels: ['hex']
    },
    keyword: {
      channels: 1,
      labels: ['keyword']
    },
    ansi16: {
      channels: 1,
      labels: ['ansi16']
    },
    ansi256: {
      channels: 1,
      labels: ['ansi256']
    },
    hcg: {
      channels: 3,
      labels: ['h', 'c', 'g']
    },
    apple: {
      channels: 3,
      labels: ['r16', 'g16', 'b16']
    },
    gray: {
      channels: 1,
      labels: ['gray']
    }
  };
  var conversions$1 = convert$2; // Hide .channels and .labels properties
  
  for (const model of Object.keys(convert$2)) {
    if (!('channels' in convert$2[model])) {
      throw new Error('missing channels property: ' + model);
    }
  
    if (!('labels' in convert$2[model])) {
      throw new Error('missing channel labels property: ' + model);
    }
  
    if (convert$2[model].labels.length !== convert$2[model].channels) {
      throw new Error('channel and label counts mismatch: ' + model);
    }
  
    const {
      channels,
      labels
    } = convert$2[model];
    delete convert$2[model].channels;
    delete convert$2[model].labels;
    Object.defineProperty(convert$2[model], 'channels', {
      value: channels
    });
    Object.defineProperty(convert$2[model], 'labels', {
      value: labels
    });
  }
  
  convert$2.rgb.hsl = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const min = Math.min(r, g, b);
    const max = Math.max(r, g, b);
    const delta = max - min;
    let h;
    let s;
  
    if (max === min) {
      h = 0;
    } else if (r === max) {
      h = (g - b) / delta;
    } else if (g === max) {
      h = 2 + (b - r) / delta;
    } else if (b === max) {
      h = 4 + (r - g) / delta;
    }
  
    h = Math.min(h * 60, 360);
  
    if (h < 0) {
      h += 360;
    }
  
    const l = (min + max) / 2;
  
    if (max === min) {
      s = 0;
    } else if (l <= 0.5) {
      s = delta / (max + min);
    } else {
      s = delta / (2 - max - min);
    }
  
    return [h, s * 100, l * 100];
  };
  
  convert$2.rgb.hsv = function (rgb) {
    let rdif;
    let gdif;
    let bdif;
    let h;
    let s;
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const v = Math.max(r, g, b);
    const diff = v - Math.min(r, g, b);
  
    const diffc = function (c) {
      return (v - c) / 6 / diff + 1 / 2;
    };
  
    if (diff === 0) {
      h = 0;
      s = 0;
    } else {
      s = diff / v;
      rdif = diffc(r);
      gdif = diffc(g);
      bdif = diffc(b);
  
      if (r === v) {
        h = bdif - gdif;
      } else if (g === v) {
        h = 1 / 3 + rdif - bdif;
      } else if (b === v) {
        h = 2 / 3 + gdif - rdif;
      }
  
      if (h < 0) {
        h += 1;
      } else if (h > 1) {
        h -= 1;
      }
    }
  
    return [h * 360, s * 100, v * 100];
  };
  
  convert$2.rgb.hwb = function (rgb) {
    const r = rgb[0];
    const g = rgb[1];
    let b = rgb[2];
    const h = convert$2.rgb.hsl(rgb)[0];
    const w = 1 / 255 * Math.min(r, Math.min(g, b));
    b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
    return [h, w * 100, b * 100];
  };
  
  convert$2.rgb.cmyk = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const k = Math.min(1 - r, 1 - g, 1 - b);
    const c = (1 - r - k) / (1 - k) || 0;
    const m = (1 - g - k) / (1 - k) || 0;
    const y = (1 - b - k) / (1 - k) || 0;
    return [c * 100, m * 100, y * 100, k * 100];
  };
  
  function comparativeDistance$1(x, y) {
    /*
    	See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
    */
    return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
  }
  
  convert$2.rgb.keyword = function (rgb) {
    const reversed = reverseKeywords$1[rgb];
  
    if (reversed) {
      return reversed;
    }
  
    let currentClosestDistance = Infinity;
    let currentClosestKeyword;
  
    for (const keyword of Object.keys(colorName)) {
      const value = colorName[keyword]; // Compute comparative distance
  
      const distance = comparativeDistance$1(rgb, value); // Check if its less, if so set as closest
  
      if (distance < currentClosestDistance) {
        currentClosestDistance = distance;
        currentClosestKeyword = keyword;
      }
    }
  
    return currentClosestKeyword;
  };
  
  convert$2.keyword.rgb = function (keyword) {
    return colorName[keyword];
  };
  
  convert$2.rgb.xyz = function (rgb) {
    let r = rgb[0] / 255;
    let g = rgb[1] / 255;
    let b = rgb[2] / 255; // Assume sRGB
  
    r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
    g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
    b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
    const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
    const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
    const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
    return [x * 100, y * 100, z * 100];
  };
  
  convert$2.rgb.lab = function (rgb) {
    const xyz = convert$2.rgb.xyz(rgb);
    let x = xyz[0];
    let y = xyz[1];
    let z = xyz[2];
    x /= 95.047;
    y /= 100;
    z /= 108.883;
    x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
    y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
    z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
    const l = 116 * y - 16;
    const a = 500 * (x - y);
    const b = 200 * (y - z);
    return [l, a, b];
  };
  
  convert$2.hsl.rgb = function (hsl) {
    const h = hsl[0] / 360;
    const s = hsl[1] / 100;
    const l = hsl[2] / 100;
    let t2;
    let t3;
    let val;
  
    if (s === 0) {
      val = l * 255;
      return [val, val, val];
    }
  
    if (l < 0.5) {
      t2 = l * (1 + s);
    } else {
      t2 = l + s - l * s;
    }
  
    const t1 = 2 * l - t2;
    const rgb = [0, 0, 0];
  
    for (let i = 0; i < 3; i++) {
      t3 = h + 1 / 3 * -(i - 1);
  
      if (t3 < 0) {
        t3++;
      }
  
      if (t3 > 1) {
        t3--;
      }
  
      if (6 * t3 < 1) {
        val = t1 + (t2 - t1) * 6 * t3;
      } else if (2 * t3 < 1) {
        val = t2;
      } else if (3 * t3 < 2) {
        val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
      } else {
        val = t1;
      }
  
      rgb[i] = val * 255;
    }
  
    return rgb;
  };
  
  convert$2.hsl.hsv = function (hsl) {
    const h = hsl[0];
    let s = hsl[1] / 100;
    let l = hsl[2] / 100;
    let smin = s;
    const lmin = Math.max(l, 0.01);
    l *= 2;
    s *= l <= 1 ? l : 2 - l;
    smin *= lmin <= 1 ? lmin : 2 - lmin;
    const v = (l + s) / 2;
    const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
    return [h, sv * 100, v * 100];
  };
  
  convert$2.hsv.rgb = function (hsv) {
    const h = hsv[0] / 60;
    const s = hsv[1] / 100;
    let v = hsv[2] / 100;
    const hi = Math.floor(h) % 6;
    const f = h - Math.floor(h);
    const p = 255 * v * (1 - s);
    const q = 255 * v * (1 - s * f);
    const t = 255 * v * (1 - s * (1 - f));
    v *= 255;
  
    switch (hi) {
      case 0:
        return [v, t, p];
  
      case 1:
        return [q, v, p];
  
      case 2:
        return [p, v, t];
  
      case 3:
        return [p, q, v];
  
      case 4:
        return [t, p, v];
  
      case 5:
        return [v, p, q];
    }
  };
  
  convert$2.hsv.hsl = function (hsv) {
    const h = hsv[0];
    const s = hsv[1] / 100;
    const v = hsv[2] / 100;
    const vmin = Math.max(v, 0.01);
    let sl;
    let l;
    l = (2 - s) * v;
    const lmin = (2 - s) * vmin;
    sl = s * vmin;
    sl /= lmin <= 1 ? lmin : 2 - lmin;
    sl = sl || 0;
    l /= 2;
    return [h, sl * 100, l * 100];
  }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
  
  
  convert$2.hwb.rgb = function (hwb) {
    const h = hwb[0] / 360;
    let wh = hwb[1] / 100;
    let bl = hwb[2] / 100;
    const ratio = wh + bl;
    let f; // Wh + bl cant be > 1
  
    if (ratio > 1) {
      wh /= ratio;
      bl /= ratio;
    }
  
    const i = Math.floor(6 * h);
    const v = 1 - bl;
    f = 6 * h - i;
  
    if ((i & 0x01) !== 0) {
      f = 1 - f;
    }
  
    const n = wh + f * (v - wh); // Linear interpolation
  
    let r;
    let g;
    let b;
    /* eslint-disable max-statements-per-line,no-multi-spaces */
  
    switch (i) {
      default:
      case 6:
      case 0:
        r = v;
        g = n;
        b = wh;
        break;
  
      case 1:
        r = n;
        g = v;
        b = wh;
        break;
  
      case 2:
        r = wh;
        g = v;
        b = n;
        break;
  
      case 3:
        r = wh;
        g = n;
        b = v;
        break;
  
      case 4:
        r = n;
        g = wh;
        b = v;
        break;
  
      case 5:
        r = v;
        g = wh;
        b = n;
        break;
    }
    /* eslint-enable max-statements-per-line,no-multi-spaces */
  
  
    return [r * 255, g * 255, b * 255];
  };
  
  convert$2.cmyk.rgb = function (cmyk) {
    const c = cmyk[0] / 100;
    const m = cmyk[1] / 100;
    const y = cmyk[2] / 100;
    const k = cmyk[3] / 100;
    const r = 1 - Math.min(1, c * (1 - k) + k);
    const g = 1 - Math.min(1, m * (1 - k) + k);
    const b = 1 - Math.min(1, y * (1 - k) + k);
    return [r * 255, g * 255, b * 255];
  };
  
  convert$2.xyz.rgb = function (xyz) {
    const x = xyz[0] / 100;
    const y = xyz[1] / 100;
    const z = xyz[2] / 100;
    let r;
    let g;
    let b;
    r = x * 3.2406 + y * -1.5372 + z * -0.4986;
    g = x * -0.9689 + y * 1.8758 + z * 0.0415;
    b = x * 0.0557 + y * -0.2040 + z * 1.0570; // Assume sRGB
  
    r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92;
    g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92;
    b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92;
    r = Math.min(Math.max(0, r), 1);
    g = Math.min(Math.max(0, g), 1);
    b = Math.min(Math.max(0, b), 1);
    return [r * 255, g * 255, b * 255];
  };
  
  convert$2.xyz.lab = function (xyz) {
    let x = xyz[0];
    let y = xyz[1];
    let z = xyz[2];
    x /= 95.047;
    y /= 100;
    z /= 108.883;
    x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
    y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
    z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
    const l = 116 * y - 16;
    const a = 500 * (x - y);
    const b = 200 * (y - z);
    return [l, a, b];
  };
  
  convert$2.lab.xyz = function (lab) {
    const l = lab[0];
    const a = lab[1];
    const b = lab[2];
    let x;
    let y;
    let z;
    y = (l + 16) / 116;
    x = a / 500 + y;
    z = y - b / 200;
    const y2 = y ** 3;
    const x2 = x ** 3;
    const z2 = z ** 3;
    y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
    x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
    z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
    x *= 95.047;
    y *= 100;
    z *= 108.883;
    return [x, y, z];
  };
  
  convert$2.lab.lch = function (lab) {
    const l = lab[0];
    const a = lab[1];
    const b = lab[2];
    let h;
    const hr = Math.atan2(b, a);
    h = hr * 360 / 2 / Math.PI;
  
    if (h < 0) {
      h += 360;
    }
  
    const c = Math.sqrt(a * a + b * b);
    return [l, c, h];
  };
  
  convert$2.lch.lab = function (lch) {
    const l = lch[0];
    const c = lch[1];
    const h = lch[2];
    const hr = h / 360 * 2 * Math.PI;
    const a = c * Math.cos(hr);
    const b = c * Math.sin(hr);
    return [l, a, b];
  };
  
  convert$2.rgb.ansi16 = function (args, saturation = null) {
    const [r, g, b] = args;
    let value = saturation === null ? convert$2.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
  
    value = Math.round(value / 50);
  
    if (value === 0) {
      return 30;
    }
  
    let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
  
    if (value === 2) {
      ansi += 60;
    }
  
    return ansi;
  };
  
  convert$2.hsv.ansi16 = function (args) {
    // Optimization here; we already know the value and don't need to get
    // it converted for us.
    return convert$2.rgb.ansi16(convert$2.hsv.rgb(args), args[2]);
  };
  
  convert$2.rgb.ansi256 = function (args) {
    const r = args[0];
    const g = args[1];
    const b = args[2]; // We use the extended greyscale palette here, with the exception of
    // black and white. normal palette only has 4 greyscale shades.
  
    if (r === g && g === b) {
      if (r < 8) {
        return 16;
      }
  
      if (r > 248) {
        return 231;
      }
  
      return Math.round((r - 8) / 247 * 24) + 232;
    }
  
    const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
    return ansi;
  };
  
  convert$2.ansi16.rgb = function (args) {
    let color = args % 10; // Handle greyscale
  
    if (color === 0 || color === 7) {
      if (args > 50) {
        color += 3.5;
      }
  
      color = color / 10.5 * 255;
      return [color, color, color];
    }
  
    const mult = (~~(args > 50) + 1) * 0.5;
    const r = (color & 1) * mult * 255;
    const g = (color >> 1 & 1) * mult * 255;
    const b = (color >> 2 & 1) * mult * 255;
    return [r, g, b];
  };
  
  convert$2.ansi256.rgb = function (args) {
    // Handle greyscale
    if (args >= 232) {
      const c = (args - 232) * 10 + 8;
      return [c, c, c];
    }
  
    args -= 16;
    let rem;
    const r = Math.floor(args / 36) / 5 * 255;
    const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
    const b = rem % 6 / 5 * 255;
    return [r, g, b];
  };
  
  convert$2.rgb.hex = function (args) {
    const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
    const string = integer.toString(16).toUpperCase();
    return '000000'.substring(string.length) + string;
  };
  
  convert$2.hex.rgb = function (args) {
    const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  
    if (!match) {
      return [0, 0, 0];
    }
  
    let colorString = match[0];
  
    if (match[0].length === 3) {
      colorString = colorString.split('').map(char => {
        return char + char;
      }).join('');
    }
  
    const integer = parseInt(colorString, 16);
    const r = integer >> 16 & 0xFF;
    const g = integer >> 8 & 0xFF;
    const b = integer & 0xFF;
    return [r, g, b];
  };
  
  convert$2.rgb.hcg = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const max = Math.max(Math.max(r, g), b);
    const min = Math.min(Math.min(r, g), b);
    const chroma = max - min;
    let grayscale;
    let hue;
  
    if (chroma < 1) {
      grayscale = min / (1 - chroma);
    } else {
      grayscale = 0;
    }
  
    if (chroma <= 0) {
      hue = 0;
    } else if (max === r) {
      hue = (g - b) / chroma % 6;
    } else if (max === g) {
      hue = 2 + (b - r) / chroma;
    } else {
      hue = 4 + (r - g) / chroma;
    }
  
    hue /= 6;
    hue %= 1;
    return [hue * 360, chroma * 100, grayscale * 100];
  };
  
  convert$2.hsl.hcg = function (hsl) {
    const s = hsl[1] / 100;
    const l = hsl[2] / 100;
    const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
    let f = 0;
  
    if (c < 1.0) {
      f = (l - 0.5 * c) / (1.0 - c);
    }
  
    return [hsl[0], c * 100, f * 100];
  };
  
  convert$2.hsv.hcg = function (hsv) {
    const s = hsv[1] / 100;
    const v = hsv[2] / 100;
    const c = s * v;
    let f = 0;
  
    if (c < 1.0) {
      f = (v - c) / (1 - c);
    }
  
    return [hsv[0], c * 100, f * 100];
  };
  
  convert$2.hcg.rgb = function (hcg) {
    const h = hcg[0] / 360;
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
  
    if (c === 0.0) {
      return [g * 255, g * 255, g * 255];
    }
  
    const pure = [0, 0, 0];
    const hi = h % 1 * 6;
    const v = hi % 1;
    const w = 1 - v;
    let mg = 0;
    /* eslint-disable max-statements-per-line */
  
    switch (Math.floor(hi)) {
      case 0:
        pure[0] = 1;
        pure[1] = v;
        pure[2] = 0;
        break;
  
      case 1:
        pure[0] = w;
        pure[1] = 1;
        pure[2] = 0;
        break;
  
      case 2:
        pure[0] = 0;
        pure[1] = 1;
        pure[2] = v;
        break;
  
      case 3:
        pure[0] = 0;
        pure[1] = w;
        pure[2] = 1;
        break;
  
      case 4:
        pure[0] = v;
        pure[1] = 0;
        pure[2] = 1;
        break;
  
      default:
        pure[0] = 1;
        pure[1] = 0;
        pure[2] = w;
    }
    /* eslint-enable max-statements-per-line */
  
  
    mg = (1.0 - c) * g;
    return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
  };
  
  convert$2.hcg.hsv = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const v = c + g * (1.0 - c);
    let f = 0;
  
    if (v > 0.0) {
      f = c / v;
    }
  
    return [hcg[0], f * 100, v * 100];
  };
  
  convert$2.hcg.hsl = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const l = g * (1.0 - c) + 0.5 * c;
    let s = 0;
  
    if (l > 0.0 && l < 0.5) {
      s = c / (2 * l);
    } else if (l >= 0.5 && l < 1.0) {
      s = c / (2 * (1 - l));
    }
  
    return [hcg[0], s * 100, l * 100];
  };
  
  convert$2.hcg.hwb = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const v = c + g * (1.0 - c);
    return [hcg[0], (v - c) * 100, (1 - v) * 100];
  };
  
  convert$2.hwb.hcg = function (hwb) {
    const w = hwb[1] / 100;
    const b = hwb[2] / 100;
    const v = 1 - b;
    const c = v - w;
    let g = 0;
  
    if (c < 1) {
      g = (v - c) / (1 - c);
    }
  
    return [hwb[0], c * 100, g * 100];
  };
  
  convert$2.apple.rgb = function (apple) {
    return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  };
  
  convert$2.rgb.apple = function (rgb) {
    return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  };
  
  convert$2.gray.rgb = function (args) {
    return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  };
  
  convert$2.gray.hsl = function (args) {
    return [0, 0, args[0]];
  };
  
  convert$2.gray.hsv = convert$2.gray.hsl;
  
  convert$2.gray.hwb = function (gray) {
    return [0, 100, gray[0]];
  };
  
  convert$2.gray.cmyk = function (gray) {
    return [0, 0, 0, gray[0]];
  };
  
  convert$2.gray.lab = function (gray) {
    return [gray[0], 0, 0];
  };
  
  convert$2.gray.hex = function (gray) {
    const val = Math.round(gray[0] / 100 * 255) & 0xFF;
    const integer = (val << 16) + (val << 8) + val;
    const string = integer.toString(16).toUpperCase();
    return '000000'.substring(string.length) + string;
  };
  
  convert$2.rgb.gray = function (rgb) {
    const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
    return [val / 255 * 100];
  };
  
  /*
  	This function routes a model to all other models.
  
  	all functions that are routed have a property `.conversion` attached
  	to the returned synthetic function. This property is an array
  	of strings, each with the steps in between the 'from' and 'to'
  	color models (inclusive).
  
  	conversions that are not possible simply are not included.
  */
  
  
  function buildGraph$1() {
    const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
  
    const models = Object.keys(conversions$1);
  
    for (let len = models.length, i = 0; i < len; i++) {
      graph[models[i]] = {
        // http://jsperf.com/1-vs-infinity
        // micro-opt, but this is simple.
        distance: -1,
        parent: null
      };
    }
  
    return graph;
  } // https://en.wikipedia.org/wiki/Breadth-first_search
  
  
  function deriveBFS$1(fromModel) {
    const graph = buildGraph$1();
    const queue = [fromModel]; // Unshift -> queue -> pop
  
    graph[fromModel].distance = 0;
  
    while (queue.length) {
      const current = queue.pop();
      const adjacents = Object.keys(conversions$1[current]);
  
      for (let len = adjacents.length, i = 0; i < len; i++) {
        const adjacent = adjacents[i];
        const node = graph[adjacent];
  
        if (node.distance === -1) {
          node.distance = graph[current].distance + 1;
          node.parent = current;
          queue.unshift(adjacent);
        }
      }
    }
  
    return graph;
  }
  
  function link$1(from, to) {
    return function (args) {
      return to(from(args));
    };
  }
  
  function wrapConversion$1(toModel, graph) {
    const path = [graph[toModel].parent, toModel];
    let fn = conversions$1[graph[toModel].parent][toModel];
    let cur = graph[toModel].parent;
  
    while (graph[cur].parent) {
      path.unshift(graph[cur].parent);
      fn = link$1(conversions$1[graph[cur].parent][cur], fn);
      cur = graph[cur].parent;
    }
  
    fn.conversion = path;
    return fn;
  }
  
  var route$1 = function (fromModel) {
    const graph = deriveBFS$1(fromModel);
    const conversion = {};
    const models = Object.keys(graph);
  
    for (let len = models.length, i = 0; i < len; i++) {
      const toModel = models[i];
      const node = graph[toModel];
  
      if (node.parent === null) {
        // No possible conversion, or this node is the source model.
        continue;
      }
  
      conversion[toModel] = wrapConversion$1(toModel, graph);
    }
  
    return conversion;
  };
  
  const convert$3 = {};
  const models$1 = Object.keys(conversions$1);
  
  function wrapRaw$1(fn) {
    const wrappedFn = function (...args) {
      const arg0 = args[0];
  
      if (arg0 === undefined || arg0 === null) {
        return arg0;
      }
  
      if (arg0.length > 1) {
        args = arg0;
      }
  
      return fn(args);
    }; // Preserve .conversion property if there is one
  
  
    if ('conversion' in fn) {
      wrappedFn.conversion = fn.conversion;
    }
  
    return wrappedFn;
  }
  
  function wrapRounded$1(fn) {
    const wrappedFn = function (...args) {
      const arg0 = args[0];
  
      if (arg0 === undefined || arg0 === null) {
        return arg0;
      }
  
      if (arg0.length > 1) {
        args = arg0;
      }
  
      const result = fn(args); // We're assuming the result is an array here.
      // see notice in conversions.js; don't use box types
      // in conversion functions.
  
      if (typeof result === 'object') {
        for (let len = result.length, i = 0; i < len; i++) {
          result[i] = Math.round(result[i]);
        }
      }
  
      return result;
    }; // Preserve .conversion property if there is one
  
  
    if ('conversion' in fn) {
      wrappedFn.conversion = fn.conversion;
    }
  
    return wrappedFn;
  }
  
  models$1.forEach(fromModel => {
    convert$3[fromModel] = {};
    Object.defineProperty(convert$3[fromModel], 'channels', {
      value: conversions$1[fromModel].channels
    });
    Object.defineProperty(convert$3[fromModel], 'labels', {
      value: conversions$1[fromModel].labels
    });
    const routes = route$1(fromModel);
    const routeModels = Object.keys(routes);
    routeModels.forEach(toModel => {
      const fn = routes[toModel];
      convert$3[fromModel][toModel] = wrapRounded$1(fn);
      convert$3[fromModel][toModel].raw = wrapRaw$1(fn);
    });
  });
  var colorConvert$1 = convert$3;
  
  var ansiStyles$1 = createCommonjsModule(function (module) {
  
  const wrapAnsi16 = (fn, offset) => (...args) => {
    const code = fn(...args);
    return `\u001B[${code + offset}m`;
  };
  
  const wrapAnsi256 = (fn, offset) => (...args) => {
    const code = fn(...args);
    return `\u001B[${38 + offset};5;${code}m`;
  };
  
  const wrapAnsi16m = (fn, offset) => (...args) => {
    const rgb = fn(...args);
    return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  };
  
  const ansi2ansi = n => n;
  
  const rgb2rgb = (r, g, b) => [r, g, b];
  
  const setLazyProperty = (object, property, get) => {
    Object.defineProperty(object, property, {
      get: () => {
        const value = get();
        Object.defineProperty(object, property, {
          value,
          enumerable: true,
          configurable: true
        });
        return value;
      },
      enumerable: true,
      configurable: true
    });
  };
  /** @type {typeof import('color-convert')} */
  
  
  let colorConvert;
  
  const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
    if (colorConvert === undefined) {
      colorConvert = colorConvert$1;
    }
  
    const offset = isBackground ? 10 : 0;
    const styles = {};
  
    for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
      const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
  
      if (sourceSpace === targetSpace) {
        styles[name] = wrap(identity, offset);
      } else if (typeof suite === 'object') {
        styles[name] = wrap(suite[targetSpace], offset);
      }
    }
  
    return styles;
  };
  
  function assembleStyles() {
    const codes = new Map();
    const styles = {
      modifier: {
        reset: [0, 0],
        // 21 isn't widely supported and 22 does the same thing
        bold: [1, 22],
        dim: [2, 22],
        italic: [3, 23],
        underline: [4, 24],
        inverse: [7, 27],
        hidden: [8, 28],
        strikethrough: [9, 29]
      },
      color: {
        black: [30, 39],
        red: [31, 39],
        green: [32, 39],
        yellow: [33, 39],
        blue: [34, 39],
        magenta: [35, 39],
        cyan: [36, 39],
        white: [37, 39],
        // Bright color
        blackBright: [90, 39],
        redBright: [91, 39],
        greenBright: [92, 39],
        yellowBright: [93, 39],
        blueBright: [94, 39],
        magentaBright: [95, 39],
        cyanBright: [96, 39],
        whiteBright: [97, 39]
      },
      bgColor: {
        bgBlack: [40, 49],
        bgRed: [41, 49],
        bgGreen: [42, 49],
        bgYellow: [43, 49],
        bgBlue: [44, 49],
        bgMagenta: [45, 49],
        bgCyan: [46, 49],
        bgWhite: [47, 49],
        // Bright color
        bgBlackBright: [100, 49],
        bgRedBright: [101, 49],
        bgGreenBright: [102, 49],
        bgYellowBright: [103, 49],
        bgBlueBright: [104, 49],
        bgMagentaBright: [105, 49],
        bgCyanBright: [106, 49],
        bgWhiteBright: [107, 49]
      }
    }; // Alias bright black as gray (and grey)
  
    styles.color.gray = styles.color.blackBright;
    styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
    styles.color.grey = styles.color.blackBright;
    styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
  
    for (const [groupName, group] of Object.entries(styles)) {
      for (const [styleName, style] of Object.entries(group)) {
        styles[styleName] = {
          open: `\u001B[${style[0]}m`,
          close: `\u001B[${style[1]}m`
        };
        group[styleName] = styles[styleName];
        codes.set(style[0], style[1]);
      }
  
      Object.defineProperty(styles, groupName, {
        value: group,
        enumerable: false
      });
    }
  
    Object.defineProperty(styles, 'codes', {
      value: codes,
      enumerable: false
    });
    styles.color.close = '\u001B[39m';
    styles.bgColor.close = '\u001B[49m';
    setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
    setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
    setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
    setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
    setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
    setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
    return styles;
  } // Make the export immutable
  
  
  Object.defineProperty(module, 'exports', {
    enumerable: true,
    get: assembleStyles
  });
  });
  
  const ESCAPES$1 = ['\u001B', '\u009B'];
  
  const wrapAnsi$1 = code => `${ESCAPES$1[0]}[${code}m`;
  
  const checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
    let output = [];
    ansiCodes = [...ansiCodes];
  
    for (let ansiCode of ansiCodes) {
      const ansiCodeOrigin = ansiCode;
  
      if (ansiCode.match(';')) {
        ansiCode = ansiCode.split(';')[0][0] + '0';
      }
  
      const item = ansiStyles$1.codes.get(parseInt(ansiCode, 10));
  
      if (item) {
        const indexEscape = ansiCodes.indexOf(item.toString());
  
        if (indexEscape >= 0) {
          ansiCodes.splice(indexEscape, 1);
        } else {
          output.push(wrapAnsi$1(isEscapes ? item : ansiCodeOrigin));
        }
      } else if (isEscapes) {
        output.push(wrapAnsi$1(0));
        break;
      } else {
        output.push(wrapAnsi$1(ansiCodeOrigin));
      }
    }
  
    if (isEscapes) {
      output = output.filter((element, index) => output.indexOf(element) === index);
  
      if (endAnsiCode !== undefined) {
        const fistEscapeCode = wrapAnsi$1(ansiStyles$1.codes.get(parseInt(endAnsiCode, 10)));
        output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
      }
    }
  
    return output.join('');
  };
  
  var sliceAnsi = (string, begin, end) => {
    const characters = [...string.normalize()];
    const ansiCodes = [];
    end = typeof end === 'number' ? end : characters.length;
    let isInsideEscape = false;
    let ansiCode;
    let visible = 0;
    let output = '';
  
    for (const [index, character] of characters.entries()) {
      let leftEscape = false;
  
      if (ESCAPES$1.includes(character)) {
        const code = /\d[^m]*/.exec(string.slice(index, index + 18));
        ansiCode = code && code.length > 0 ? code[0] : undefined;
  
        if (visible < end) {
          isInsideEscape = true;
  
          if (ansiCode !== undefined) {
            ansiCodes.push(ansiCode);
          }
        }
      } else if (isInsideEscape && character === 'm') {
        isInsideEscape = false;
        leftEscape = true;
      }
  
      if (!isInsideEscape && !leftEscape) {
        ++visible;
      }
  
      if (!astralRegex_1({
        exact: true
      }).test(character) && isFullwidthCodePoint_1$2(character.codePointAt())) {
        ++visible;
      }
  
      if (visible > begin && visible <= end) {
        output += character;
      } else if (visible === begin && !isInsideEscape && ansiCode !== undefined) {
        output = checkAnsi(ansiCodes);
      } else if (visible >= end) {
        output += checkAnsi(ansiCodes, true, ansiCode);
        break;
      }
    }
  
    return output;
  };
  
  /* eslint-disable yoda */
  
  const isFullwidthCodePoint$3 = codePoint => {
    if (Number.isNaN(codePoint)) {
      return false;
    } // Code points are derived from:
    // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
  
  
    if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
    codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
    codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
    // CJK Radicals Supplement .. Enclosed CJK Letters and Months
    0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
    0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals
    0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A
    0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables
    0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs
    0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms
    0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants
    0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms
    0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement
    0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement
    0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
    0x20000 <= codePoint && codePoint <= 0x3FFFD)) {
      return true;
    }
  
    return false;
  };
  
  var isFullwidthCodePoint_1$3 = isFullwidthCodePoint$3;
  var _default$8 = isFullwidthCodePoint$3;
  isFullwidthCodePoint_1$3.default = _default$8;
  
  var emojiRegex$2 = function () {
    // https://mths.be/emoji
    return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
  };
  
  const stringWidth$2 = string => {
    string = string.replace(emojiRegex$2(), '  ');
  
    if (typeof string !== 'string' || string.length === 0) {
      return 0;
    }
  
    string = stripAnsi(string);
    let width = 0;
  
    for (let i = 0; i < string.length; i++) {
      const code = string.codePointAt(i); // Ignore control characters
  
      if (code <= 0x1F || code >= 0x7F && code <= 0x9F) {
        continue;
      } // Ignore combining characters
  
  
      if (code >= 0x300 && code <= 0x36F) {
        continue;
      } // Surrogates
  
  
      if (code > 0xFFFF) {
        i++;
      }
  
      width += isFullwidthCodePoint_1$3(code) ? 2 : 1;
    }
  
    return width;
  };
  
  var stringWidth_1$2 = stringWidth$2; // TODO: remove this in the next major version
  
  var _default$9 = stringWidth$2;
  stringWidth_1$2.default = _default$9;
  
  function getIndexOfNearestSpace(string, index, shouldSearchRight) {
    if (string.charAt(index) === ' ') {
      return index;
    }
  
    for (let i = 1; i <= 3; i++) {
      if (shouldSearchRight) {
        if (string.charAt(index + i) === ' ') {
          return index + i;
        }
      } else if (string.charAt(index - i) === ' ') {
        return index - i;
      }
    }
  
    return index;
  }
  
  var cliTruncate = (text, columns, options) => {
    options = {
      position: 'end',
      preferTruncationOnSpace: false,
      ...options
    };
    const {
      position,
      space,
      preferTruncationOnSpace
    } = options;
    let ellipsis = '…';
    let ellipsisWidth = 1;
  
    if (typeof text !== 'string') {
      throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
    }
  
    if (typeof columns !== 'number') {
      throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
    }
  
    if (columns < 1) {
      return '';
    }
  
    if (columns === 1) {
      return ellipsis;
    }
  
    const length = stringWidth_1$2(text);
  
    if (length <= columns) {
      return text;
    }
  
    if (position === 'start') {
      if (preferTruncationOnSpace) {
        const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
        return ellipsis + sliceAnsi(text, nearestSpace, length).trim();
      }
  
      if (space === true) {
        ellipsis += ' ';
        ellipsisWidth = 2;
      }
  
      return ellipsis + sliceAnsi(text, length - columns + ellipsisWidth, length);
    }
  
    if (position === 'middle') {
      if (space === true) {
        ellipsis = ' ' + ellipsis + ' ';
        ellipsisWidth = 3;
      }
  
      const half = Math.floor(columns / 2);
  
      if (preferTruncationOnSpace) {
        const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
        const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
        return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + ellipsis + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
      }
  
      return sliceAnsi(text, 0, half) + ellipsis + sliceAnsi(text, length - (columns - half) + ellipsisWidth, length);
    }
  
    if (position === 'end') {
      if (preferTruncationOnSpace) {
        const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
        return sliceAnsi(text, 0, nearestSpace) + ellipsis;
      }
  
      if (space === true) {
        ellipsis = ' ' + ellipsis;
        ellipsisWidth = 2;
      }
  
      return sliceAnsi(text, 0, columns - ellipsisWidth) + ellipsis;
    }
  
    throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
  };
  
  var wrapText = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const wrap_ansi_1 = __importDefault(wrapAnsi_1);
  
  const cli_truncate_1 = __importDefault(cliTruncate);
  
  const cache = {};
  
  exports.default = (text, maxWidth, wrapType) => {
    const cacheKey = text + String(maxWidth) + String(wrapType);
  
    if (cache[cacheKey]) {
      return cache[cacheKey];
    }
  
    let wrappedText = text;
  
    if (wrapType === 'wrap') {
      wrappedText = wrap_ansi_1.default(text, maxWidth, {
        trim: false,
        hard: true
      });
    }
  
    if (wrapType.startsWith('truncate')) {
      let position = 'end';
  
      if (wrapType === 'truncate-middle') {
        position = 'middle';
      }
  
      if (wrapType === 'truncate-start') {
        position = 'start';
      }
  
      wrappedText = cli_truncate_1.default(text, maxWidth, {
        position
      });
    }
  
    cache[cacheKey] = wrappedText;
    return wrappedText;
  };
  });
  
  var squashTextNodes_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  }); // Squashing text nodes allows to combine multiple text nodes into one and write
  // to `Output` instance only once. For example, <Text>hello{' '}world</Text>
  // is actually 3 text nodes, which would result 3 writes to `Output`.
  //
  // Also, this is necessary for libraries like ink-link (https://github.com/sindresorhus/ink-link),
  // which need to wrap all children at once, instead of wrapping 3 text nodes separately.
  
  const squashTextNodes = node => {
    let text = '';
  
    if (node.childNodes.length > 0) {
      for (const childNode of node.childNodes) {
        let nodeText = '';
  
        if (childNode.nodeName === '#text') {
          nodeText = childNode.nodeValue;
        } else {
          if (childNode.nodeName === 'ink-text' || childNode.nodeName === 'ink-virtual-text') {
            nodeText = squashTextNodes(childNode);
          } // Since these text nodes are being concatenated, `Output` instance won't be able to
          // apply children transform, so we have to do it manually here for each text node
  
  
          if (nodeText.length > 0 && typeof childNode.internal_transform === 'function') {
            nodeText = childNode.internal_transform(nodeText);
          }
        }
  
        text += nodeText;
      }
    }
  
    return text;
  };
  
  exports.default = squashTextNodes;
  });
  
  var dom = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.setTextNodeValue = exports.createTextNode = exports.setStyle = exports.setAttribute = exports.removeChildNode = exports.insertBeforeNode = exports.appendChildNode = exports.createNode = exports.TEXT_NAME = void 0;
  
  const yoga_layout_prebuilt_1 = __importDefault(yogaLayoutPrebuilt);
  
  const measure_text_1 = __importDefault(measureText);
  
  const styles_1 = __importDefault(styles);
  
  const wrap_text_1 = __importDefault(wrapText);
  
  const squash_text_nodes_1 = __importDefault(squashTextNodes_1);
  
  exports.TEXT_NAME = '#text';
  
  exports.createNode = nodeName => {
    var _a;
  
    const node = {
      nodeName,
      style: {},
      attributes: {},
      childNodes: [],
      parentNode: null,
      yogaNode: nodeName === 'ink-virtual-text' ? undefined : yoga_layout_prebuilt_1.default.Node.create()
    };
  
    if (nodeName === 'ink-text') {
      (_a = node.yogaNode) === null || _a === void 0 ? void 0 : _a.setMeasureFunc(measureTextNode.bind(null, node));
    }
  
    return node;
  };
  
  exports.appendChildNode = (node, childNode) => {
    var _a;
  
    if (childNode.parentNode) {
      exports.removeChildNode(childNode.parentNode, childNode);
    }
  
    childNode.parentNode = node;
    node.childNodes.push(childNode);
  
    if (childNode.yogaNode) {
      (_a = node.yogaNode) === null || _a === void 0 ? void 0 : _a.insertChild(childNode.yogaNode, node.yogaNode.getChildCount());
    }
  
    if (node.nodeName === 'ink-text' || node.nodeName === 'ink-virtual-text') {
      markNodeAsDirty(node);
    }
  };
  
  exports.insertBeforeNode = (node, newChildNode, beforeChildNode) => {
    var _a, _b;
  
    if (newChildNode.parentNode) {
      exports.removeChildNode(newChildNode.parentNode, newChildNode);
    }
  
    newChildNode.parentNode = node;
    const index = node.childNodes.indexOf(beforeChildNode);
  
    if (index >= 0) {
      node.childNodes.splice(index, 0, newChildNode);
  
      if (newChildNode.yogaNode) {
        (_a = node.yogaNode) === null || _a === void 0 ? void 0 : _a.insertChild(newChildNode.yogaNode, index);
      }
  
      return;
    }
  
    node.childNodes.push(newChildNode);
  
    if (newChildNode.yogaNode) {
      (_b = node.yogaNode) === null || _b === void 0 ? void 0 : _b.insertChild(newChildNode.yogaNode, node.yogaNode.getChildCount());
    }
  
    if (node.nodeName === 'ink-text' || node.nodeName === 'ink-virtual-text') {
      markNodeAsDirty(node);
    }
  };
  
  exports.removeChildNode = (node, removeNode) => {
    var _a, _b;
  
    if (removeNode.yogaNode) {
      (_b = (_a = removeNode.parentNode) === null || _a === void 0 ? void 0 : _a.yogaNode) === null || _b === void 0 ? void 0 : _b.removeChild(removeNode.yogaNode);
    }
  
    removeNode.parentNode = null;
    const index = node.childNodes.indexOf(removeNode);
  
    if (index >= 0) {
      node.childNodes.splice(index, 1);
    }
  
    if (node.nodeName === 'ink-text' || node.nodeName === 'ink-virtual-text') {
      markNodeAsDirty(node);
    }
  };
  
  exports.setAttribute = (node, key, value) => {
    node.attributes[key] = value;
  };
  
  exports.setStyle = (node, style) => {
    node.style = style;
  
    if (node.yogaNode) {
      styles_1.default(node.yogaNode, style);
    }
  };
  
  exports.createTextNode = text => {
    const node = {
      nodeName: '#text',
      nodeValue: text,
      yogaNode: undefined,
      parentNode: null,
      style: {}
    };
    exports.setTextNodeValue(node, text);
    return node;
  };
  
  const measureTextNode = function (node, width) {
    var _a, _b;
  
    const text = node.nodeName === '#text' ? node.nodeValue : squash_text_nodes_1.default(node);
    const dimensions = measure_text_1.default(text); // Text fits into container, no need to wrap
  
    if (dimensions.width <= width) {
      return dimensions;
    } // This is happening when <Box> is shrinking child nodes and Yoga asks
    // if we can fit this text node in a <1px space, so we just tell Yoga "no"
  
  
    if (dimensions.width >= 1 && width > 0 && width < 1) {
      return dimensions;
    }
  
    const textWrap = (_b = (_a = node.style) === null || _a === void 0 ? void 0 : _a.textWrap) !== null && _b !== void 0 ? _b : 'wrap';
    const wrappedText = wrap_text_1.default(text, width, textWrap);
    return measure_text_1.default(wrappedText);
  };
  
  const findClosestYogaNode = node => {
    var _a;
  
    if (!node || !node.parentNode) {
      return undefined;
    }
  
    return (_a = node.yogaNode) !== null && _a !== void 0 ? _a : findClosestYogaNode(node.parentNode);
  };
  
  const markNodeAsDirty = node => {
    // Mark closest Yoga node as dirty to measure text dimensions again
    const yogaNode = findClosestYogaNode(node);
    yogaNode === null || yogaNode === void 0 ? void 0 : yogaNode.markDirty();
  };
  
  exports.setTextNodeValue = (node, text) => {
    if (typeof text !== 'string') {
      text = String(text);
    }
  
    node.nodeValue = text;
    markNodeAsDirty(node);
  };
  });
  
  var reconciler = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const react_reconciler_1 = __importDefault(reactReconciler);
  
  const yoga_layout_prebuilt_1 = __importDefault(yogaLayoutPrebuilt);
  
   // eslint-disable-next-line import/no-unassigned-import
  
  
  
  
  const cleanupYogaNode = node => {
    node === null || node === void 0 ? void 0 : node.unsetMeasureFunc();
    node === null || node === void 0 ? void 0 : node.freeRecursive();
  };
  
  exports.default = react_reconciler_1.default({
    // @ts-ignore
    schedulePassiveEffects: scheduler.unstable_scheduleCallback,
    cancelPassiveEffects: scheduler.unstable_cancelCallback,
    now: Date.now,
    getRootHostContext: () => ({
      isInsideText: false
    }),
    prepareForCommit: () => {},
    resetAfterCommit: rootNode => {
      // Since renders are throttled at the instance level and <Static> component children
      // are rendered only once and then get deleted, we need an escape hatch to
      // trigger an immediate render to ensure <Static> children are written to output before they get erased
      if (rootNode.isStaticDirty) {
        rootNode.isStaticDirty = false;
  
        if (typeof rootNode.onImmediateRender === 'function') {
          rootNode.onImmediateRender();
        }
  
        return;
      }
  
      if (typeof rootNode.onRender === 'function') {
        rootNode.onRender();
      }
    },
    getChildHostContext: (parentHostContext, type) => {
      const previousIsInsideText = parentHostContext.isInsideText;
      const isInsideText = type === 'ink-text' || type === 'ink-virtual-text';
  
      if (previousIsInsideText === isInsideText) {
        return parentHostContext;
      }
  
      return {
        isInsideText
      };
    },
    shouldSetTextContent: () => false,
    createInstance: (originalType, newProps, _root, hostContext) => {
      const type = originalType === 'ink-text' && hostContext.isInsideText ? 'ink-virtual-text' : originalType;
      const node = dom.createNode(type);
  
      for (const [key, value] of Object.entries(newProps)) {
        if (key === 'children') {
          continue;
        } else if (key === 'style') {
          dom.setStyle(node, value);
        } else if (key === 'internal_transform') {
          node.internal_transform = value;
        } else if (key === 'internal_static') {
          node.internal_static = true;
        } else {
          dom.setAttribute(node, key, value);
        }
      }
  
      return node;
    },
    createTextInstance: (text, _root, hostContext) => {
      if (!hostContext.isInsideText) {
        throw new Error(`Text string "${text}" must be rendered inside <Text> component`);
      }
  
      return dom.createTextNode(text);
    },
    resetTextContent: () => {},
    hideTextInstance: node => {
      dom.setTextNodeValue(node, '');
    },
    unhideTextInstance: (node, text) => {
      dom.setTextNodeValue(node, text);
    },
    getPublicInstance: instance => instance,
    hideInstance: node => {
      var _a;
  
      (_a = node.yogaNode) === null || _a === void 0 ? void 0 : _a.setDisplay(yoga_layout_prebuilt_1.default.DISPLAY_NONE);
    },
    unhideInstance: node => {
      var _a;
  
      (_a = node.yogaNode) === null || _a === void 0 ? void 0 : _a.setDisplay(yoga_layout_prebuilt_1.default.DISPLAY_FLEX);
    },
    appendInitialChild: dom.appendChildNode,
    appendChild: dom.appendChildNode,
    insertBefore: dom.insertBeforeNode,
    finalizeInitialChildren: (node, _type, _props, rootNode) => {
      if (node.internal_static) {
        rootNode.isStaticDirty = true; // Save reference to <Static> node to skip traversal of entire
        // node tree to find it
  
        rootNode.staticNode = node;
      }
  
      return false;
    },
    supportsMutation: true,
    appendChildToContainer: dom.appendChildNode,
    insertInContainerBefore: dom.insertBeforeNode,
    removeChildFromContainer: (node, removeNode) => {
      dom.removeChildNode(node, removeNode);
      cleanupYogaNode(removeNode.yogaNode);
    },
    prepareUpdate: (node, _type, oldProps, newProps, rootNode) => {
      if (node.internal_static) {
        rootNode.isStaticDirty = true;
      }
  
      const updatePayload = {};
      const keys = Object.keys(newProps);
  
      for (const key of keys) {
        if (newProps[key] !== oldProps[key]) {
          const isStyle = key === 'style' && typeof newProps.style === 'object' && typeof oldProps.style === 'object';
  
          if (isStyle) {
            const newStyle = newProps.style;
            const oldStyle = oldProps.style;
            const styleKeys = Object.keys(newStyle);
  
            for (const styleKey of styleKeys) {
              if (newStyle[styleKey] !== oldStyle[styleKey]) {
                if (typeof updatePayload.style !== 'object') {
                  // Linter didn't like `= {} as Style`
                  const style = {};
                  updatePayload.style = style;
                }
  
                updatePayload.style[styleKey] = newStyle[styleKey];
              }
            }
  
            continue;
          }
  
          updatePayload[key] = newProps[key];
        }
      }
  
      return updatePayload;
    },
    commitUpdate: (node, updatePayload) => {
      for (const [key, value] of Object.entries(updatePayload)) {
        if (key === 'children') {
          continue;
        } else if (key === 'style') {
          dom.setStyle(node, value);
        } else if (key === 'internal_transform') {
          node.internal_transform = value;
        } else if (key === 'internal_static') {
          node.internal_static = true;
        } else {
          dom.setAttribute(node, key, value);
        }
      }
    },
    commitTextUpdate: (node, _oldText, newText) => {
      dom.setTextNodeValue(node, newText);
    },
    removeChild: (node, removeNode) => {
      dom.removeChildNode(node, removeNode);
      cleanupYogaNode(removeNode.yogaNode);
    }
  });
  });
  
  var indentString = (string, count = 1, options) => {
    options = {
      indent: ' ',
      includeEmptyLines: false,
      ...options
    };
  
    if (typeof string !== 'string') {
      throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof string}\``);
    }
  
    if (typeof count !== 'number') {
      throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof count}\``);
    }
  
    if (typeof options.indent !== 'string') {
      throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof options.indent}\``);
    }
  
    if (count === 0) {
      return string;
    }
  
    const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
    return string.replace(regex, options.indent.repeat(count));
  };
  
  var getMaxWidth = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const yoga_layout_prebuilt_1 = __importDefault(yogaLayoutPrebuilt);
  
  exports.default = yogaNode => {
    return yogaNode.getComputedWidth() - yogaNode.getComputedPadding(yoga_layout_prebuilt_1.default.EDGE_LEFT) - yogaNode.getComputedPadding(yoga_layout_prebuilt_1.default.EDGE_RIGHT) - yogaNode.getComputedBorder(yoga_layout_prebuilt_1.default.EDGE_LEFT) - yogaNode.getComputedBorder(yoga_layout_prebuilt_1.default.EDGE_RIGHT);
  };
  });
  
  var single = {
  	topLeft: "┌",
  	topRight: "┐",
  	bottomRight: "┘",
  	bottomLeft: "└",
  	vertical: "│",
  	horizontal: "─"
  };
  var double = {
  	topLeft: "╔",
  	topRight: "╗",
  	bottomRight: "╝",
  	bottomLeft: "╚",
  	vertical: "║",
  	horizontal: "═"
  };
  var round = {
  	topLeft: "╭",
  	topRight: "╮",
  	bottomRight: "╯",
  	bottomLeft: "╰",
  	vertical: "│",
  	horizontal: "─"
  };
  var bold = {
  	topLeft: "┏",
  	topRight: "┓",
  	bottomRight: "┛",
  	bottomLeft: "┗",
  	vertical: "┃",
  	horizontal: "━"
  };
  var singleDouble = {
  	topLeft: "╓",
  	topRight: "╖",
  	bottomRight: "╜",
  	bottomLeft: "╙",
  	vertical: "║",
  	horizontal: "─"
  };
  var doubleSingle = {
  	topLeft: "╒",
  	topRight: "╕",
  	bottomRight: "╛",
  	bottomLeft: "╘",
  	vertical: "│",
  	horizontal: "═"
  };
  var classic = {
  	topLeft: "+",
  	topRight: "+",
  	bottomRight: "+",
  	bottomLeft: "+",
  	vertical: "|",
  	horizontal: "-"
  };
  var boxes = {
  	single: single,
  	double: double,
  	round: round,
  	bold: bold,
  	singleDouble: singleDouble,
  	doubleSingle: doubleSingle,
  	classic: classic
  };
  
  var boxes$1 = /*#__PURE__*/Object.freeze({
  	__proto__: null,
  	single: single,
  	double: double,
  	round: round,
  	bold: bold,
  	singleDouble: singleDouble,
  	doubleSingle: doubleSingle,
  	classic: classic,
  	'default': boxes
  });
  
  var cliBoxes = getCjsExportFromNamespace(boxes$1);
  
  var cliBoxes_1 = cliBoxes; // TODO: Remove this for the next major release
  
  var _default$a = cliBoxes;
  cliBoxes_1.default = _default$a;
  
  /* MIT license */
  
  /* eslint-disable no-mixed-operators */
   // NOTE: conversions should only return primitive values (i.e. arrays, or
  //       values that give correct `typeof` results).
  //       do not use box values types (i.e. Number(), String(), etc.)
  
  
  const reverseKeywords$2 = {};
  
  for (const key of Object.keys(colorName)) {
    reverseKeywords$2[colorName[key]] = key;
  }
  
  const convert$4 = {
    rgb: {
      channels: 3,
      labels: 'rgb'
    },
    hsl: {
      channels: 3,
      labels: 'hsl'
    },
    hsv: {
      channels: 3,
      labels: 'hsv'
    },
    hwb: {
      channels: 3,
      labels: 'hwb'
    },
    cmyk: {
      channels: 4,
      labels: 'cmyk'
    },
    xyz: {
      channels: 3,
      labels: 'xyz'
    },
    lab: {
      channels: 3,
      labels: 'lab'
    },
    lch: {
      channels: 3,
      labels: 'lch'
    },
    hex: {
      channels: 1,
      labels: ['hex']
    },
    keyword: {
      channels: 1,
      labels: ['keyword']
    },
    ansi16: {
      channels: 1,
      labels: ['ansi16']
    },
    ansi256: {
      channels: 1,
      labels: ['ansi256']
    },
    hcg: {
      channels: 3,
      labels: ['h', 'c', 'g']
    },
    apple: {
      channels: 3,
      labels: ['r16', 'g16', 'b16']
    },
    gray: {
      channels: 1,
      labels: ['gray']
    }
  };
  var conversions$2 = convert$4; // Hide .channels and .labels properties
  
  for (const model of Object.keys(convert$4)) {
    if (!('channels' in convert$4[model])) {
      throw new Error('missing channels property: ' + model);
    }
  
    if (!('labels' in convert$4[model])) {
      throw new Error('missing channel labels property: ' + model);
    }
  
    if (convert$4[model].labels.length !== convert$4[model].channels) {
      throw new Error('channel and label counts mismatch: ' + model);
    }
  
    const {
      channels,
      labels
    } = convert$4[model];
    delete convert$4[model].channels;
    delete convert$4[model].labels;
    Object.defineProperty(convert$4[model], 'channels', {
      value: channels
    });
    Object.defineProperty(convert$4[model], 'labels', {
      value: labels
    });
  }
  
  convert$4.rgb.hsl = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const min = Math.min(r, g, b);
    const max = Math.max(r, g, b);
    const delta = max - min;
    let h;
    let s;
  
    if (max === min) {
      h = 0;
    } else if (r === max) {
      h = (g - b) / delta;
    } else if (g === max) {
      h = 2 + (b - r) / delta;
    } else if (b === max) {
      h = 4 + (r - g) / delta;
    }
  
    h = Math.min(h * 60, 360);
  
    if (h < 0) {
      h += 360;
    }
  
    const l = (min + max) / 2;
  
    if (max === min) {
      s = 0;
    } else if (l <= 0.5) {
      s = delta / (max + min);
    } else {
      s = delta / (2 - max - min);
    }
  
    return [h, s * 100, l * 100];
  };
  
  convert$4.rgb.hsv = function (rgb) {
    let rdif;
    let gdif;
    let bdif;
    let h;
    let s;
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const v = Math.max(r, g, b);
    const diff = v - Math.min(r, g, b);
  
    const diffc = function (c) {
      return (v - c) / 6 / diff + 1 / 2;
    };
  
    if (diff === 0) {
      h = 0;
      s = 0;
    } else {
      s = diff / v;
      rdif = diffc(r);
      gdif = diffc(g);
      bdif = diffc(b);
  
      if (r === v) {
        h = bdif - gdif;
      } else if (g === v) {
        h = 1 / 3 + rdif - bdif;
      } else if (b === v) {
        h = 2 / 3 + gdif - rdif;
      }
  
      if (h < 0) {
        h += 1;
      } else if (h > 1) {
        h -= 1;
      }
    }
  
    return [h * 360, s * 100, v * 100];
  };
  
  convert$4.rgb.hwb = function (rgb) {
    const r = rgb[0];
    const g = rgb[1];
    let b = rgb[2];
    const h = convert$4.rgb.hsl(rgb)[0];
    const w = 1 / 255 * Math.min(r, Math.min(g, b));
    b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
    return [h, w * 100, b * 100];
  };
  
  convert$4.rgb.cmyk = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const k = Math.min(1 - r, 1 - g, 1 - b);
    const c = (1 - r - k) / (1 - k) || 0;
    const m = (1 - g - k) / (1 - k) || 0;
    const y = (1 - b - k) / (1 - k) || 0;
    return [c * 100, m * 100, y * 100, k * 100];
  };
  
  function comparativeDistance$2(x, y) {
    /*
    	See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
    */
    return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
  }
  
  convert$4.rgb.keyword = function (rgb) {
    const reversed = reverseKeywords$2[rgb];
  
    if (reversed) {
      return reversed;
    }
  
    let currentClosestDistance = Infinity;
    let currentClosestKeyword;
  
    for (const keyword of Object.keys(colorName)) {
      const value = colorName[keyword]; // Compute comparative distance
  
      const distance = comparativeDistance$2(rgb, value); // Check if its less, if so set as closest
  
      if (distance < currentClosestDistance) {
        currentClosestDistance = distance;
        currentClosestKeyword = keyword;
      }
    }
  
    return currentClosestKeyword;
  };
  
  convert$4.keyword.rgb = function (keyword) {
    return colorName[keyword];
  };
  
  convert$4.rgb.xyz = function (rgb) {
    let r = rgb[0] / 255;
    let g = rgb[1] / 255;
    let b = rgb[2] / 255; // Assume sRGB
  
    r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
    g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
    b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
    const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
    const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
    const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
    return [x * 100, y * 100, z * 100];
  };
  
  convert$4.rgb.lab = function (rgb) {
    const xyz = convert$4.rgb.xyz(rgb);
    let x = xyz[0];
    let y = xyz[1];
    let z = xyz[2];
    x /= 95.047;
    y /= 100;
    z /= 108.883;
    x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
    y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
    z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
    const l = 116 * y - 16;
    const a = 500 * (x - y);
    const b = 200 * (y - z);
    return [l, a, b];
  };
  
  convert$4.hsl.rgb = function (hsl) {
    const h = hsl[0] / 360;
    const s = hsl[1] / 100;
    const l = hsl[2] / 100;
    let t2;
    let t3;
    let val;
  
    if (s === 0) {
      val = l * 255;
      return [val, val, val];
    }
  
    if (l < 0.5) {
      t2 = l * (1 + s);
    } else {
      t2 = l + s - l * s;
    }
  
    const t1 = 2 * l - t2;
    const rgb = [0, 0, 0];
  
    for (let i = 0; i < 3; i++) {
      t3 = h + 1 / 3 * -(i - 1);
  
      if (t3 < 0) {
        t3++;
      }
  
      if (t3 > 1) {
        t3--;
      }
  
      if (6 * t3 < 1) {
        val = t1 + (t2 - t1) * 6 * t3;
      } else if (2 * t3 < 1) {
        val = t2;
      } else if (3 * t3 < 2) {
        val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
      } else {
        val = t1;
      }
  
      rgb[i] = val * 255;
    }
  
    return rgb;
  };
  
  convert$4.hsl.hsv = function (hsl) {
    const h = hsl[0];
    let s = hsl[1] / 100;
    let l = hsl[2] / 100;
    let smin = s;
    const lmin = Math.max(l, 0.01);
    l *= 2;
    s *= l <= 1 ? l : 2 - l;
    smin *= lmin <= 1 ? lmin : 2 - lmin;
    const v = (l + s) / 2;
    const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
    return [h, sv * 100, v * 100];
  };
  
  convert$4.hsv.rgb = function (hsv) {
    const h = hsv[0] / 60;
    const s = hsv[1] / 100;
    let v = hsv[2] / 100;
    const hi = Math.floor(h) % 6;
    const f = h - Math.floor(h);
    const p = 255 * v * (1 - s);
    const q = 255 * v * (1 - s * f);
    const t = 255 * v * (1 - s * (1 - f));
    v *= 255;
  
    switch (hi) {
      case 0:
        return [v, t, p];
  
      case 1:
        return [q, v, p];
  
      case 2:
        return [p, v, t];
  
      case 3:
        return [p, q, v];
  
      case 4:
        return [t, p, v];
  
      case 5:
        return [v, p, q];
    }
  };
  
  convert$4.hsv.hsl = function (hsv) {
    const h = hsv[0];
    const s = hsv[1] / 100;
    const v = hsv[2] / 100;
    const vmin = Math.max(v, 0.01);
    let sl;
    let l;
    l = (2 - s) * v;
    const lmin = (2 - s) * vmin;
    sl = s * vmin;
    sl /= lmin <= 1 ? lmin : 2 - lmin;
    sl = sl || 0;
    l /= 2;
    return [h, sl * 100, l * 100];
  }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
  
  
  convert$4.hwb.rgb = function (hwb) {
    const h = hwb[0] / 360;
    let wh = hwb[1] / 100;
    let bl = hwb[2] / 100;
    const ratio = wh + bl;
    let f; // Wh + bl cant be > 1
  
    if (ratio > 1) {
      wh /= ratio;
      bl /= ratio;
    }
  
    const i = Math.floor(6 * h);
    const v = 1 - bl;
    f = 6 * h - i;
  
    if ((i & 0x01) !== 0) {
      f = 1 - f;
    }
  
    const n = wh + f * (v - wh); // Linear interpolation
  
    let r;
    let g;
    let b;
    /* eslint-disable max-statements-per-line,no-multi-spaces */
  
    switch (i) {
      default:
      case 6:
      case 0:
        r = v;
        g = n;
        b = wh;
        break;
  
      case 1:
        r = n;
        g = v;
        b = wh;
        break;
  
      case 2:
        r = wh;
        g = v;
        b = n;
        break;
  
      case 3:
        r = wh;
        g = n;
        b = v;
        break;
  
      case 4:
        r = n;
        g = wh;
        b = v;
        break;
  
      case 5:
        r = v;
        g = wh;
        b = n;
        break;
    }
    /* eslint-enable max-statements-per-line,no-multi-spaces */
  
  
    return [r * 255, g * 255, b * 255];
  };
  
  convert$4.cmyk.rgb = function (cmyk) {
    const c = cmyk[0] / 100;
    const m = cmyk[1] / 100;
    const y = cmyk[2] / 100;
    const k = cmyk[3] / 100;
    const r = 1 - Math.min(1, c * (1 - k) + k);
    const g = 1 - Math.min(1, m * (1 - k) + k);
    const b = 1 - Math.min(1, y * (1 - k) + k);
    return [r * 255, g * 255, b * 255];
  };
  
  convert$4.xyz.rgb = function (xyz) {
    const x = xyz[0] / 100;
    const y = xyz[1] / 100;
    const z = xyz[2] / 100;
    let r;
    let g;
    let b;
    r = x * 3.2406 + y * -1.5372 + z * -0.4986;
    g = x * -0.9689 + y * 1.8758 + z * 0.0415;
    b = x * 0.0557 + y * -0.2040 + z * 1.0570; // Assume sRGB
  
    r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92;
    g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92;
    b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92;
    r = Math.min(Math.max(0, r), 1);
    g = Math.min(Math.max(0, g), 1);
    b = Math.min(Math.max(0, b), 1);
    return [r * 255, g * 255, b * 255];
  };
  
  convert$4.xyz.lab = function (xyz) {
    let x = xyz[0];
    let y = xyz[1];
    let z = xyz[2];
    x /= 95.047;
    y /= 100;
    z /= 108.883;
    x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
    y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
    z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
    const l = 116 * y - 16;
    const a = 500 * (x - y);
    const b = 200 * (y - z);
    return [l, a, b];
  };
  
  convert$4.lab.xyz = function (lab) {
    const l = lab[0];
    const a = lab[1];
    const b = lab[2];
    let x;
    let y;
    let z;
    y = (l + 16) / 116;
    x = a / 500 + y;
    z = y - b / 200;
    const y2 = y ** 3;
    const x2 = x ** 3;
    const z2 = z ** 3;
    y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
    x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
    z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
    x *= 95.047;
    y *= 100;
    z *= 108.883;
    return [x, y, z];
  };
  
  convert$4.lab.lch = function (lab) {
    const l = lab[0];
    const a = lab[1];
    const b = lab[2];
    let h;
    const hr = Math.atan2(b, a);
    h = hr * 360 / 2 / Math.PI;
  
    if (h < 0) {
      h += 360;
    }
  
    const c = Math.sqrt(a * a + b * b);
    return [l, c, h];
  };
  
  convert$4.lch.lab = function (lch) {
    const l = lch[0];
    const c = lch[1];
    const h = lch[2];
    const hr = h / 360 * 2 * Math.PI;
    const a = c * Math.cos(hr);
    const b = c * Math.sin(hr);
    return [l, a, b];
  };
  
  convert$4.rgb.ansi16 = function (args, saturation = null) {
    const [r, g, b] = args;
    let value = saturation === null ? convert$4.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
  
    value = Math.round(value / 50);
  
    if (value === 0) {
      return 30;
    }
  
    let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
  
    if (value === 2) {
      ansi += 60;
    }
  
    return ansi;
  };
  
  convert$4.hsv.ansi16 = function (args) {
    // Optimization here; we already know the value and don't need to get
    // it converted for us.
    return convert$4.rgb.ansi16(convert$4.hsv.rgb(args), args[2]);
  };
  
  convert$4.rgb.ansi256 = function (args) {
    const r = args[0];
    const g = args[1];
    const b = args[2]; // We use the extended greyscale palette here, with the exception of
    // black and white. normal palette only has 4 greyscale shades.
  
    if (r === g && g === b) {
      if (r < 8) {
        return 16;
      }
  
      if (r > 248) {
        return 231;
      }
  
      return Math.round((r - 8) / 247 * 24) + 232;
    }
  
    const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
    return ansi;
  };
  
  convert$4.ansi16.rgb = function (args) {
    let color = args % 10; // Handle greyscale
  
    if (color === 0 || color === 7) {
      if (args > 50) {
        color += 3.5;
      }
  
      color = color / 10.5 * 255;
      return [color, color, color];
    }
  
    const mult = (~~(args > 50) + 1) * 0.5;
    const r = (color & 1) * mult * 255;
    const g = (color >> 1 & 1) * mult * 255;
    const b = (color >> 2 & 1) * mult * 255;
    return [r, g, b];
  };
  
  convert$4.ansi256.rgb = function (args) {
    // Handle greyscale
    if (args >= 232) {
      const c = (args - 232) * 10 + 8;
      return [c, c, c];
    }
  
    args -= 16;
    let rem;
    const r = Math.floor(args / 36) / 5 * 255;
    const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
    const b = rem % 6 / 5 * 255;
    return [r, g, b];
  };
  
  convert$4.rgb.hex = function (args) {
    const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
    const string = integer.toString(16).toUpperCase();
    return '000000'.substring(string.length) + string;
  };
  
  convert$4.hex.rgb = function (args) {
    const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  
    if (!match) {
      return [0, 0, 0];
    }
  
    let colorString = match[0];
  
    if (match[0].length === 3) {
      colorString = colorString.split('').map(char => {
        return char + char;
      }).join('');
    }
  
    const integer = parseInt(colorString, 16);
    const r = integer >> 16 & 0xFF;
    const g = integer >> 8 & 0xFF;
    const b = integer & 0xFF;
    return [r, g, b];
  };
  
  convert$4.rgb.hcg = function (rgb) {
    const r = rgb[0] / 255;
    const g = rgb[1] / 255;
    const b = rgb[2] / 255;
    const max = Math.max(Math.max(r, g), b);
    const min = Math.min(Math.min(r, g), b);
    const chroma = max - min;
    let grayscale;
    let hue;
  
    if (chroma < 1) {
      grayscale = min / (1 - chroma);
    } else {
      grayscale = 0;
    }
  
    if (chroma <= 0) {
      hue = 0;
    } else if (max === r) {
      hue = (g - b) / chroma % 6;
    } else if (max === g) {
      hue = 2 + (b - r) / chroma;
    } else {
      hue = 4 + (r - g) / chroma;
    }
  
    hue /= 6;
    hue %= 1;
    return [hue * 360, chroma * 100, grayscale * 100];
  };
  
  convert$4.hsl.hcg = function (hsl) {
    const s = hsl[1] / 100;
    const l = hsl[2] / 100;
    const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
    let f = 0;
  
    if (c < 1.0) {
      f = (l - 0.5 * c) / (1.0 - c);
    }
  
    return [hsl[0], c * 100, f * 100];
  };
  
  convert$4.hsv.hcg = function (hsv) {
    const s = hsv[1] / 100;
    const v = hsv[2] / 100;
    const c = s * v;
    let f = 0;
  
    if (c < 1.0) {
      f = (v - c) / (1 - c);
    }
  
    return [hsv[0], c * 100, f * 100];
  };
  
  convert$4.hcg.rgb = function (hcg) {
    const h = hcg[0] / 360;
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
  
    if (c === 0.0) {
      return [g * 255, g * 255, g * 255];
    }
  
    const pure = [0, 0, 0];
    const hi = h % 1 * 6;
    const v = hi % 1;
    const w = 1 - v;
    let mg = 0;
    /* eslint-disable max-statements-per-line */
  
    switch (Math.floor(hi)) {
      case 0:
        pure[0] = 1;
        pure[1] = v;
        pure[2] = 0;
        break;
  
      case 1:
        pure[0] = w;
        pure[1] = 1;
        pure[2] = 0;
        break;
  
      case 2:
        pure[0] = 0;
        pure[1] = 1;
        pure[2] = v;
        break;
  
      case 3:
        pure[0] = 0;
        pure[1] = w;
        pure[2] = 1;
        break;
  
      case 4:
        pure[0] = v;
        pure[1] = 0;
        pure[2] = 1;
        break;
  
      default:
        pure[0] = 1;
        pure[1] = 0;
        pure[2] = w;
    }
    /* eslint-enable max-statements-per-line */
  
  
    mg = (1.0 - c) * g;
    return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
  };
  
  convert$4.hcg.hsv = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const v = c + g * (1.0 - c);
    let f = 0;
  
    if (v > 0.0) {
      f = c / v;
    }
  
    return [hcg[0], f * 100, v * 100];
  };
  
  convert$4.hcg.hsl = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const l = g * (1.0 - c) + 0.5 * c;
    let s = 0;
  
    if (l > 0.0 && l < 0.5) {
      s = c / (2 * l);
    } else if (l >= 0.5 && l < 1.0) {
      s = c / (2 * (1 - l));
    }
  
    return [hcg[0], s * 100, l * 100];
  };
  
  convert$4.hcg.hwb = function (hcg) {
    const c = hcg[1] / 100;
    const g = hcg[2] / 100;
    const v = c + g * (1.0 - c);
    return [hcg[0], (v - c) * 100, (1 - v) * 100];
  };
  
  convert$4.hwb.hcg = function (hwb) {
    const w = hwb[1] / 100;
    const b = hwb[2] / 100;
    const v = 1 - b;
    const c = v - w;
    let g = 0;
  
    if (c < 1) {
      g = (v - c) / (1 - c);
    }
  
    return [hwb[0], c * 100, g * 100];
  };
  
  convert$4.apple.rgb = function (apple) {
    return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  };
  
  convert$4.rgb.apple = function (rgb) {
    return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  };
  
  convert$4.gray.rgb = function (args) {
    return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  };
  
  convert$4.gray.hsl = function (args) {
    return [0, 0, args[0]];
  };
  
  convert$4.gray.hsv = convert$4.gray.hsl;
  
  convert$4.gray.hwb = function (gray) {
    return [0, 100, gray[0]];
  };
  
  convert$4.gray.cmyk = function (gray) {
    return [0, 0, 0, gray[0]];
  };
  
  convert$4.gray.lab = function (gray) {
    return [gray[0], 0, 0];
  };
  
  convert$4.gray.hex = function (gray) {
    const val = Math.round(gray[0] / 100 * 255) & 0xFF;
    const integer = (val << 16) + (val << 8) + val;
    const string = integer.toString(16).toUpperCase();
    return '000000'.substring(string.length) + string;
  };
  
  convert$4.rgb.gray = function (rgb) {
    const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
    return [val / 255 * 100];
  };
  
  /*
  	This function routes a model to all other models.
  
  	all functions that are routed have a property `.conversion` attached
  	to the returned synthetic function. This property is an array
  	of strings, each with the steps in between the 'from' and 'to'
  	color models (inclusive).
  
  	conversions that are not possible simply are not included.
  */
  
  
  function buildGraph$2() {
    const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
  
    const models = Object.keys(conversions$2);
  
    for (let len = models.length, i = 0; i < len; i++) {
      graph[models[i]] = {
        // http://jsperf.com/1-vs-infinity
        // micro-opt, but this is simple.
        distance: -1,
        parent: null
      };
    }
  
    return graph;
  } // https://en.wikipedia.org/wiki/Breadth-first_search
  
  
  function deriveBFS$2(fromModel) {
    const graph = buildGraph$2();
    const queue = [fromModel]; // Unshift -> queue -> pop
  
    graph[fromModel].distance = 0;
  
    while (queue.length) {
      const current = queue.pop();
      const adjacents = Object.keys(conversions$2[current]);
  
      for (let len = adjacents.length, i = 0; i < len; i++) {
        const adjacent = adjacents[i];
        const node = graph[adjacent];
  
        if (node.distance === -1) {
          node.distance = graph[current].distance + 1;
          node.parent = current;
          queue.unshift(adjacent);
        }
      }
    }
  
    return graph;
  }
  
  function link$2(from, to) {
    return function (args) {
      return to(from(args));
    };
  }
  
  function wrapConversion$2(toModel, graph) {
    const path = [graph[toModel].parent, toModel];
    let fn = conversions$2[graph[toModel].parent][toModel];
    let cur = graph[toModel].parent;
  
    while (graph[cur].parent) {
      path.unshift(graph[cur].parent);
      fn = link$2(conversions$2[graph[cur].parent][cur], fn);
      cur = graph[cur].parent;
    }
  
    fn.conversion = path;
    return fn;
  }
  
  var route$2 = function (fromModel) {
    const graph = deriveBFS$2(fromModel);
    const conversion = {};
    const models = Object.keys(graph);
  
    for (let len = models.length, i = 0; i < len; i++) {
      const toModel = models[i];
      const node = graph[toModel];
  
      if (node.parent === null) {
        // No possible conversion, or this node is the source model.
        continue;
      }
  
      conversion[toModel] = wrapConversion$2(toModel, graph);
    }
  
    return conversion;
  };
  
  const convert$5 = {};
  const models$2 = Object.keys(conversions$2);
  
  function wrapRaw$2(fn) {
    const wrappedFn = function (...args) {
      const arg0 = args[0];
  
      if (arg0 === undefined || arg0 === null) {
        return arg0;
      }
  
      if (arg0.length > 1) {
        args = arg0;
      }
  
      return fn(args);
    }; // Preserve .conversion property if there is one
  
  
    if ('conversion' in fn) {
      wrappedFn.conversion = fn.conversion;
    }
  
    return wrappedFn;
  }
  
  function wrapRounded$2(fn) {
    const wrappedFn = function (...args) {
      const arg0 = args[0];
  
      if (arg0 === undefined || arg0 === null) {
        return arg0;
      }
  
      if (arg0.length > 1) {
        args = arg0;
      }
  
      const result = fn(args); // We're assuming the result is an array here.
      // see notice in conversions.js; don't use box types
      // in conversion functions.
  
      if (typeof result === 'object') {
        for (let len = result.length, i = 0; i < len; i++) {
          result[i] = Math.round(result[i]);
        }
      }
  
      return result;
    }; // Preserve .conversion property if there is one
  
  
    if ('conversion' in fn) {
      wrappedFn.conversion = fn.conversion;
    }
  
    return wrappedFn;
  }
  
  models$2.forEach(fromModel => {
    convert$5[fromModel] = {};
    Object.defineProperty(convert$5[fromModel], 'channels', {
      value: conversions$2[fromModel].channels
    });
    Object.defineProperty(convert$5[fromModel], 'labels', {
      value: conversions$2[fromModel].labels
    });
    const routes = route$2(fromModel);
    const routeModels = Object.keys(routes);
    routeModels.forEach(toModel => {
      const fn = routes[toModel];
      convert$5[fromModel][toModel] = wrapRounded$2(fn);
      convert$5[fromModel][toModel].raw = wrapRaw$2(fn);
    });
  });
  var colorConvert$2 = convert$5;
  
  var ansiStyles$2 = createCommonjsModule(function (module) {
  
  const wrapAnsi16 = (fn, offset) => (...args) => {
    const code = fn(...args);
    return `\u001B[${code + offset}m`;
  };
  
  const wrapAnsi256 = (fn, offset) => (...args) => {
    const code = fn(...args);
    return `\u001B[${38 + offset};5;${code}m`;
  };
  
  const wrapAnsi16m = (fn, offset) => (...args) => {
    const rgb = fn(...args);
    return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  };
  
  const ansi2ansi = n => n;
  
  const rgb2rgb = (r, g, b) => [r, g, b];
  
  const setLazyProperty = (object, property, get) => {
    Object.defineProperty(object, property, {
      get: () => {
        const value = get();
        Object.defineProperty(object, property, {
          value,
          enumerable: true,
          configurable: true
        });
        return value;
      },
      enumerable: true,
      configurable: true
    });
  };
  /** @type {typeof import('color-convert')} */
  
  
  let colorConvert;
  
  const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
    if (colorConvert === undefined) {
      colorConvert = colorConvert$2;
    }
  
    const offset = isBackground ? 10 : 0;
    const styles = {};
  
    for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
      const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
  
      if (sourceSpace === targetSpace) {
        styles[name] = wrap(identity, offset);
      } else if (typeof suite === 'object') {
        styles[name] = wrap(suite[targetSpace], offset);
      }
    }
  
    return styles;
  };
  
  function assembleStyles() {
    const codes = new Map();
    const styles = {
      modifier: {
        reset: [0, 0],
        // 21 isn't widely supported and 22 does the same thing
        bold: [1, 22],
        dim: [2, 22],
        italic: [3, 23],
        underline: [4, 24],
        inverse: [7, 27],
        hidden: [8, 28],
        strikethrough: [9, 29]
      },
      color: {
        black: [30, 39],
        red: [31, 39],
        green: [32, 39],
        yellow: [33, 39],
        blue: [34, 39],
        magenta: [35, 39],
        cyan: [36, 39],
        white: [37, 39],
        // Bright color
        blackBright: [90, 39],
        redBright: [91, 39],
        greenBright: [92, 39],
        yellowBright: [93, 39],
        blueBright: [94, 39],
        magentaBright: [95, 39],
        cyanBright: [96, 39],
        whiteBright: [97, 39]
      },
      bgColor: {
        bgBlack: [40, 49],
        bgRed: [41, 49],
        bgGreen: [42, 49],
        bgYellow: [43, 49],
        bgBlue: [44, 49],
        bgMagenta: [45, 49],
        bgCyan: [46, 49],
        bgWhite: [47, 49],
        // Bright color
        bgBlackBright: [100, 49],
        bgRedBright: [101, 49],
        bgGreenBright: [102, 49],
        bgYellowBright: [103, 49],
        bgBlueBright: [104, 49],
        bgMagentaBright: [105, 49],
        bgCyanBright: [106, 49],
        bgWhiteBright: [107, 49]
      }
    }; // Alias bright black as gray (and grey)
  
    styles.color.gray = styles.color.blackBright;
    styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
    styles.color.grey = styles.color.blackBright;
    styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
  
    for (const [groupName, group] of Object.entries(styles)) {
      for (const [styleName, style] of Object.entries(group)) {
        styles[styleName] = {
          open: `\u001B[${style[0]}m`,
          close: `\u001B[${style[1]}m`
        };
        group[styleName] = styles[styleName];
        codes.set(style[0], style[1]);
      }
  
      Object.defineProperty(styles, groupName, {
        value: group,
        enumerable: false
      });
    }
  
    Object.defineProperty(styles, 'codes', {
      value: codes,
      enumerable: false
    });
    styles.color.close = '\u001B[39m';
    styles.bgColor.close = '\u001B[49m';
    setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
    setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
    setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
    setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
    setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
    setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
    return styles;
  } // Make the export immutable
  
  
  Object.defineProperty(module, 'exports', {
    enumerable: true,
    get: assembleStyles
  });
  });
  
  var hasFlag = (flag, argv = process.argv) => {
    const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
    const position = argv.indexOf(prefix + flag);
    const terminatorPosition = argv.indexOf('--');
    return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
  };
  
  const {
    env
  } = process;
  let forceColor;
  
  if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
    forceColor = 0;
  } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
    forceColor = 1;
  }
  
  if ('FORCE_COLOR' in env) {
    if (env.FORCE_COLOR === 'true') {
      forceColor = 1;
    } else if (env.FORCE_COLOR === 'false') {
      forceColor = 0;
    } else {
      forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
    }
  }
  
  function translateLevel(level) {
    if (level === 0) {
      return false;
    }
  
    return {
      level,
      hasBasic: true,
      has256: level >= 2,
      has16m: level >= 3
    };
  }
  
  function supportsColor(haveStream, streamIsTTY) {
    if (forceColor === 0) {
      return 0;
    }
  
    if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
      return 3;
    }
  
    if (hasFlag('color=256')) {
      return 2;
    }
  
    if (haveStream && !streamIsTTY && forceColor === undefined) {
      return 0;
    }
  
    const min = forceColor || 0;
  
    if (env.TERM === 'dumb') {
      return min;
    }
  
    if (process.platform === 'win32') {
      // Windows 10 build 10586 is the first Windows release that supports 256 colors.
      // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
      const osRelease = os.release().split('.');
  
      if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
        return Number(osRelease[2]) >= 14931 ? 3 : 2;
      }
  
      return 1;
    }
  
    if ('CI' in env) {
      if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
        return 1;
      }
  
      return min;
    }
  
    if ('TEAMCITY_VERSION' in env) {
      return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
    }
  
    if ('GITHUB_ACTIONS' in env) {
      return 1;
    }
  
    if (env.COLORTERM === 'truecolor') {
      return 3;
    }
  
    if ('TERM_PROGRAM' in env) {
      const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
  
      switch (env.TERM_PROGRAM) {
        case 'iTerm.app':
          return version >= 3 ? 3 : 2;
  
        case 'Apple_Terminal':
          return 2;
        // No default
      }
    }
  
    if (/-256(color)?$/i.test(env.TERM)) {
      return 2;
    }
  
    if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
      return 1;
    }
  
    if ('COLORTERM' in env) {
      return 1;
    }
  
    return min;
  }
  
  function getSupportLevel(stream) {
    const level = supportsColor(stream, stream && stream.isTTY);
    return translateLevel(level);
  }
  
  var supportsColor_1 = {
    supportsColor: getSupportLevel,
    stdout: translateLevel(supportsColor(true, tty.isatty(1))),
    stderr: translateLevel(supportsColor(true, tty.isatty(2)))
  };
  
  const stringReplaceAll = (string, substring, replacer) => {
    let index = string.indexOf(substring);
  
    if (index === -1) {
      return string;
    }
  
    const substringLength = substring.length;
    let endIndex = 0;
    let returnValue = '';
  
    do {
      returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
      endIndex = index + substringLength;
      index = string.indexOf(substring, endIndex);
    } while (index !== -1);
  
    returnValue += string.substr(endIndex);
    return returnValue;
  };
  
  const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
    let endIndex = 0;
    let returnValue = '';
  
    do {
      const gotCR = string[index - 1] === '\r';
      returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
      endIndex = index + 1;
      index = string.indexOf('\n', endIndex);
    } while (index !== -1);
  
    returnValue += string.substr(endIndex);
    return returnValue;
  };
  
  var util = {
    stringReplaceAll,
    stringEncaseCRLFWithFirstIndex
  };
  
  const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
  const ESCAPES$2 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
  
  function unescape(c) {
    const u = c[0] === 'u';
    const bracket = c[1] === '{';
  
    if (u && !bracket && c.length === 5 || c[0] === 'x' && c.length === 3) {
      return String.fromCharCode(parseInt(c.slice(1), 16));
    }
  
    if (u && bracket) {
      return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
    }
  
    return ESCAPES$2.get(c) || c;
  }
  
  function parseArguments(name, arguments_) {
    const results = [];
    const chunks = arguments_.trim().split(/\s*,\s*/g);
    let matches;
  
    for (const chunk of chunks) {
      const number = Number(chunk);
  
      if (!Number.isNaN(number)) {
        results.push(number);
      } else if (matches = chunk.match(STRING_REGEX)) {
        results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
      } else {
        throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
      }
    }
  
    return results;
  }
  
  function parseStyle(style) {
    STYLE_REGEX.lastIndex = 0;
    const results = [];
    let matches;
  
    while ((matches = STYLE_REGEX.exec(style)) !== null) {
      const name = matches[1];
  
      if (matches[2]) {
        const args = parseArguments(name, matches[2]);
        results.push([name].concat(args));
      } else {
        results.push([name]);
      }
    }
  
    return results;
  }
  
  function buildStyle(chalk, styles) {
    const enabled = {};
  
    for (const layer of styles) {
      for (const style of layer.styles) {
        enabled[style[0]] = layer.inverse ? null : style.slice(1);
      }
    }
  
    let current = chalk;
  
    for (const [styleName, styles] of Object.entries(enabled)) {
      if (!Array.isArray(styles)) {
        continue;
      }
  
      if (!(styleName in current)) {
        throw new Error(`Unknown Chalk style: ${styleName}`);
      }
  
      current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
    }
  
    return current;
  }
  
  var templates = (chalk, temporary) => {
    const styles = [];
    const chunks = [];
    let chunk = []; // eslint-disable-next-line max-params
  
    temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
      if (escapeCharacter) {
        chunk.push(unescape(escapeCharacter));
      } else if (style) {
        const string = chunk.join('');
        chunk = [];
        chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
        styles.push({
          inverse,
          styles: parseStyle(style)
        });
      } else if (close) {
        if (styles.length === 0) {
          throw new Error('Found extraneous } in Chalk template literal');
        }
  
        chunks.push(buildStyle(chalk, styles)(chunk.join('')));
        chunk = [];
        styles.pop();
      } else {
        chunk.push(character);
      }
    });
    chunks.push(chunk.join(''));
  
    if (styles.length > 0) {
      const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
      throw new Error(errMessage);
    }
  
    return chunks.join('');
  };
  
  const {
    stdout: stdoutColor,
    stderr: stderrColor
  } = supportsColor_1;
  
  const {
    stringReplaceAll: stringReplaceAll$1,
    stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
  } = util;
  
  const {
    isArray
  } = Array; // `supportsColor.level` → `ansiStyles.color[name]` mapping
  
  const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
  const styles$1 = Object.create(null);
  
  const applyOptions = (object, options = {}) => {
    if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
      throw new Error('The `level` option should be an integer from 0 to 3');
    } // Detect level if not set manually
  
  
    const colorLevel = stdoutColor ? stdoutColor.level : 0;
    object.level = options.level === undefined ? colorLevel : options.level;
  };
  
  class ChalkClass {
    constructor(options) {
      // eslint-disable-next-line no-constructor-return
      return chalkFactory(options);
    }
  
  }
  
  const chalkFactory = options => {
    const chalk = {};
    applyOptions(chalk, options);
  
    chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
  
    Object.setPrototypeOf(chalk, Chalk.prototype);
    Object.setPrototypeOf(chalk.template, chalk);
  
    chalk.template.constructor = () => {
      throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
    };
  
    chalk.template.Instance = ChalkClass;
    return chalk.template;
  };
  
  function Chalk(options) {
    return chalkFactory(options);
  }
  
  for (const [styleName, style] of Object.entries(ansiStyles$2)) {
    styles$1[styleName] = {
      get() {
        const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
        Object.defineProperty(this, styleName, {
          value: builder
        });
        return builder;
      }
  
    };
  }
  
  styles$1.visible = {
    get() {
      const builder = createBuilder(this, this._styler, true);
      Object.defineProperty(this, 'visible', {
        value: builder
      });
      return builder;
    }
  
  };
  const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
  
  for (const model of usedModels) {
    styles$1[model] = {
      get() {
        const {
          level
        } = this;
        return function (...arguments_) {
          const styler = createStyler(ansiStyles$2.color[levelMapping[level]][model](...arguments_), ansiStyles$2.color.close, this._styler);
          return createBuilder(this, styler, this._isEmpty);
        };
      }
  
    };
  }
  
  for (const model of usedModels) {
    const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
    styles$1[bgModel] = {
      get() {
        const {
          level
        } = this;
        return function (...arguments_) {
          const styler = createStyler(ansiStyles$2.bgColor[levelMapping[level]][model](...arguments_), ansiStyles$2.bgColor.close, this._styler);
          return createBuilder(this, styler, this._isEmpty);
        };
      }
  
    };
  }
  
  const proto = Object.defineProperties(() => {}, { ...styles$1,
    level: {
      enumerable: true,
  
      get() {
        return this._generator.level;
      },
  
      set(level) {
        this._generator.level = level;
      }
  
    }
  });
  
  const createStyler = (open, close, parent) => {
    let openAll;
    let closeAll;
  
    if (parent === undefined) {
      openAll = open;
      closeAll = close;
    } else {
      openAll = parent.openAll + open;
      closeAll = close + parent.closeAll;
    }
  
    return {
      open,
      close,
      openAll,
      closeAll,
      parent
    };
  };
  
  const createBuilder = (self, _styler, _isEmpty) => {
    const builder = (...arguments_) => {
      if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
        // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
        return applyStyle(builder, chalkTag(builder, ...arguments_));
      } // Single argument is hot path, implicit coercion is faster than anything
      // eslint-disable-next-line no-implicit-coercion
  
  
      return applyStyle(builder, arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' '));
    }; // We alter the prototype because we must return a function, but there is
    // no way to create a function with a different prototype
  
  
    Object.setPrototypeOf(builder, proto);
    builder._generator = self;
    builder._styler = _styler;
    builder._isEmpty = _isEmpty;
    return builder;
  };
  
  const applyStyle = (self, string) => {
    if (self.level <= 0 || !string) {
      return self._isEmpty ? '' : string;
    }
  
    let styler = self._styler;
  
    if (styler === undefined) {
      return string;
    }
  
    const {
      openAll,
      closeAll
    } = styler;
  
    if (string.indexOf('\u001B') !== -1) {
      while (styler !== undefined) {
        // Replace any instances already present with a re-opening code
        // otherwise only the part of the string until said closing code
        // will be colored, and the rest will simply be 'plain'.
        string = stringReplaceAll$1(string, styler.close, styler.open);
        styler = styler.parent;
      }
    } // We can move both next actions out of loop, because remaining actions in loop won't have
    // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
    // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
  
  
    const lfIndex = string.indexOf('\n');
  
    if (lfIndex !== -1) {
      string = stringEncaseCRLFWithFirstIndex$1(string, closeAll, openAll, lfIndex);
    }
  
    return openAll + string + closeAll;
  };
  
  let template;
  
  const chalkTag = (chalk, ...strings) => {
    const [firstString] = strings;
  
    if (!isArray(firstString) || !isArray(firstString.raw)) {
      // If chalk() was called by itself or with a string,
      // return the string itself as a string.
      return strings.join(' ');
    }
  
    const arguments_ = strings.slice(1);
    const parts = [firstString.raw[0]];
  
    for (let i = 1; i < firstString.length; i++) {
      parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), String(firstString.raw[i]));
    }
  
    if (template === undefined) {
      template = templates;
    }
  
    return template(chalk, parts.join(''));
  };
  
  Object.defineProperties(Chalk.prototype, styles$1);
  const chalk = Chalk(); // eslint-disable-line new-cap
  
  chalk.supportsColor = stdoutColor;
  chalk.stderr = Chalk({
    level: stderrColor ? stderrColor.level : 0
  }); // eslint-disable-line new-cap
  
  chalk.stderr.supportsColor = stderrColor;
  var source = chalk;
  
  var colorize = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const chalk_1 = __importDefault(source);
  
  const RGB_LIKE_REGEX = /^(rgb|hsl|hsv|hwb)\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/;
  const ANSI_REGEX = /^(ansi|ansi256)\(\s?(\d+)\s?\)$/;
  
  const getMethod = (name, type) => {
    if (type === 'foreground') {
      return name;
    }
  
    return 'bg' + name[0].toUpperCase() + name.slice(1);
  };
  
  exports.default = (str, color, type) => {
    if (!color) {
      return str;
    }
  
    if (color in chalk_1.default) {
      const method = getMethod(color, type);
      return chalk_1.default[method](str);
    }
  
    if (color.startsWith('#')) {
      const method = getMethod('hex', type);
      return chalk_1.default[method](color)(str);
    }
  
    if (color.startsWith('ansi')) {
      const matches = ANSI_REGEX.exec(color);
  
      if (!matches) {
        return str;
      }
  
      const method = getMethod(matches[1], type);
      const value = Number(matches[2]);
      return chalk_1.default[method](value)(str);
    }
  
    const isRgbLike = color.startsWith('rgb') || color.startsWith('hsl') || color.startsWith('hsv') || color.startsWith('hwb');
  
    if (isRgbLike) {
      const matches = RGB_LIKE_REGEX.exec(color);
  
      if (!matches) {
        return str;
      }
  
      const method = getMethod(matches[1], type);
      const firstValue = Number(matches[2]);
      const secondValue = Number(matches[3]);
      const thirdValue = Number(matches[4]);
      return chalk_1.default[method](firstValue, secondValue, thirdValue)(str);
    }
  
    return str;
  };
  });
  
  var renderBorder = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const cli_boxes_1 = __importDefault(cliBoxes_1);
  
  const colorize_1 = __importDefault(colorize);
  
  exports.default = (x, y, node, output) => {
    if (typeof node.style.borderStyle === 'string') {
      const width = node.yogaNode.getComputedWidth();
      const height = node.yogaNode.getComputedHeight();
      const color = node.style.borderColor;
      const box = cli_boxes_1.default[node.style.borderStyle];
      const topBorder = colorize_1.default(box.topLeft + box.horizontal.repeat(width - 2) + box.topRight, color, 'foreground');
      const verticalBorder = (colorize_1.default(box.vertical, color, 'foreground') + '\n').repeat(height - 2);
      const bottomBorder = colorize_1.default(box.bottomLeft + box.horizontal.repeat(width - 2) + box.bottomRight, color, 'foreground');
      output.write(x, y, topBorder, {
        transformers: []
      });
      output.write(x, y + 1, verticalBorder, {
        transformers: []
      });
      output.write(x + width - 1, y + 1, verticalBorder, {
        transformers: []
      });
      output.write(x, y + height - 1, bottomBorder, {
        transformers: []
      });
    }
  };
  });
  
  var renderNodeToOutput_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const yoga_layout_prebuilt_1 = __importDefault(yogaLayoutPrebuilt);
  
  const widest_line_1 = __importDefault(widestLine_1);
  
  const indent_string_1 = __importDefault(indentString);
  
  const wrap_text_1 = __importDefault(wrapText);
  
  const get_max_width_1 = __importDefault(getMaxWidth);
  
  const squash_text_nodes_1 = __importDefault(squashTextNodes_1);
  
  const render_border_1 = __importDefault(renderBorder); // If parent container is `<Box>`, text nodes will be treated as separate nodes in
  // the tree and will have their own coordinates in the layout.
  // To ensure text nodes are aligned correctly, take X and Y of the first text node
  // and use it as offset for the rest of the nodes
  // Only first node is taken into account, because other text nodes can't have margin or padding,
  // so their coordinates will be relative to the first node anyway
  
  
  const applyPaddingToText = (node, text) => {
    var _a;
  
    const yogaNode = (_a = node.childNodes[0]) === null || _a === void 0 ? void 0 : _a.yogaNode;
  
    if (yogaNode) {
      const offsetX = yogaNode.getComputedLeft();
      const offsetY = yogaNode.getComputedTop();
      text = '\n'.repeat(offsetY) + indent_string_1.default(text, offsetX);
    }
  
    return text;
  }; // After nodes are laid out, render each to output object, which later gets rendered to terminal
  
  
  const renderNodeToOutput = (node, output, options) => {
    var _a;
  
    const {
      offsetX = 0,
      offsetY = 0,
      transformers = [],
      skipStaticElements
    } = options;
  
    if (skipStaticElements && node.internal_static) {
      return;
    }
  
    const {
      yogaNode
    } = node;
  
    if (yogaNode) {
      if (yogaNode.getDisplay() === yoga_layout_prebuilt_1.default.DISPLAY_NONE) {
        return;
      } // Left and top positions in Yoga are relative to their parent node
  
  
      const x = offsetX + yogaNode.getComputedLeft();
      const y = offsetY + yogaNode.getComputedTop(); // Transformers are functions that transform final text output of each component
      // See Output class for logic that applies transformers
  
      let newTransformers = transformers;
  
      if (typeof node.internal_transform === 'function') {
        newTransformers = [node.internal_transform, ...transformers];
      }
  
      if (node.nodeName === 'ink-text') {
        let text = squash_text_nodes_1.default(node);
  
        if (text.length > 0) {
          const currentWidth = widest_line_1.default(text);
          const maxWidth = get_max_width_1.default(yogaNode);
  
          if (currentWidth > maxWidth) {
            const textWrap = (_a = node.style.textWrap) !== null && _a !== void 0 ? _a : 'wrap';
            text = wrap_text_1.default(text, maxWidth, textWrap);
          }
  
          text = applyPaddingToText(node, text);
          output.write(x, y, text, {
            transformers: newTransformers
          });
        }
  
        return;
      }
  
      if (node.nodeName === 'ink-box') {
        render_border_1.default(x, y, node, output);
      }
  
      if (node.nodeName === 'ink-root' || node.nodeName === 'ink-box') {
        for (const childNode of node.childNodes) {
          renderNodeToOutput(childNode, output, {
            offsetX: x,
            offsetY: y,
            transformers: newTransformers,
            skipStaticElements
          });
        }
      }
    }
  };
  
  exports.default = renderNodeToOutput;
  });
  
  const regex$1 = '[\uD800-\uDBFF][\uDC00-\uDFFF]';
  
  var astralRegex$1 = opts => opts && opts.exact ? new RegExp(`^${regex$1}$`) : new RegExp(regex$1, 'g');
  
  const stringLength = string => stripAnsi(string).replace(astralRegex$1(), ' ').length;
  
  var stringLength_1 = stringLength; // TODO: Remove this for the next major release
  
  var _default$b = stringLength;
  stringLength_1.default = _default$b;
  
  var output = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const slice_ansi_1 = __importDefault(sliceAnsi);
  
  const string_length_1 = __importDefault(stringLength_1);
  
  class Output {
    constructor(options) {
      // Initialize output array with a specific set of rows, so that margin/padding at the bottom is preserved
      this.writes = [];
      const {
        width,
        height
      } = options;
      this.width = width;
      this.height = height;
    }
  
    write(x, y, text, options) {
      const {
        transformers
      } = options;
  
      if (!text) {
        return;
      }
  
      this.writes.push({
        x,
        y,
        text,
        transformers
      });
    }
  
    get() {
      const output = [];
  
      for (let y = 0; y < this.height; y++) {
        output.push(' '.repeat(this.width));
      }
  
      for (const write of this.writes) {
        const {
          x,
          y,
          text,
          transformers
        } = write;
        const lines = text.split('\n');
        let offsetY = 0;
  
        for (let line of lines) {
          const currentLine = output[y + offsetY]; // Line can be missing if `text` is taller than height of pre-initialized `this.output`
  
          if (!currentLine) {
            continue;
          }
  
          const length = string_length_1.default(line);
  
          for (const transformer of transformers) {
            line = transformer(line);
          }
  
          output[y + offsetY] = slice_ansi_1.default(currentLine, 0, x) + line + slice_ansi_1.default(currentLine, x + length);
          offsetY++;
        }
      } // eslint-disable-next-line unicorn/prefer-trim-start-end
  
  
      const generatedOutput = output.map(line => line.trimRight()).join('\n');
      return {
        output: generatedOutput,
        height: output.length
      };
    }
  
  }
  
  exports.default = Output;
  });
  
  var renderer = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const yoga_layout_prebuilt_1 = __importDefault(yogaLayoutPrebuilt);
  
  const render_node_to_output_1 = __importDefault(renderNodeToOutput_1);
  
  const output_1 = __importDefault(output);
  
  exports.default = (node, terminalWidth) => {
    var _a;
  
    node.yogaNode.setWidth(terminalWidth);
  
    if (node.yogaNode) {
      node.yogaNode.calculateLayout(undefined, undefined, yoga_layout_prebuilt_1.default.DIRECTION_LTR);
      const output = new output_1.default({
        width: node.yogaNode.getComputedWidth(),
        height: node.yogaNode.getComputedHeight()
      });
      render_node_to_output_1.default(node, output, {
        skipStaticElements: true
      });
      let staticOutput;
  
      if ((_a = node.staticNode) === null || _a === void 0 ? void 0 : _a.yogaNode) {
        staticOutput = new output_1.default({
          width: node.staticNode.yogaNode.getComputedWidth(),
          height: node.staticNode.yogaNode.getComputedHeight()
        });
        render_node_to_output_1.default(node.staticNode, staticOutput, {
          skipStaticElements: false
        });
      }
  
      const {
        output: generatedOutput,
        height: outputHeight
      } = output.get();
      return {
        output: generatedOutput,
        outputHeight,
        // Newline at the end is needed, because static output doesn't have one, so
        // interactive output will override last line of static output
        staticOutput: staticOutput ? `${staticOutput.get().output}\n` : ''
      };
    }
  
    return {
      output: '',
      outputHeight: 0,
      staticOutput: ''
    };
  };
  });
  
  const CONSOLE_METHODS = ['assert', 'count', 'countReset', 'debug', 'dir', 'dirxml', 'error', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'table', 'time', 'timeEnd', 'timeLog', 'trace', 'warn'];
  let originalMethods = {};
  
  const patchConsole = callback => {
    const stdout = new stream.PassThrough();
    const stderr = new stream.PassThrough();
  
    stdout.write = data => callback('stdout', data);
  
    stderr.write = data => callback('stderr', data);
  
    const internalConsole = new console.Console(stdout, stderr);
  
    for (const method of CONSOLE_METHODS) {
      originalMethods[method] = console[method];
      console[method] = internalConsole[method];
    }
  
    return () => {
      for (const method of CONSOLE_METHODS) {
        console[method] = originalMethods[method];
      }
  
      originalMethods = {};
    };
  };
  
  var build = patchConsole;
  
  var instances = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  }); // Store all instances of Ink (instance.js) to ensure that consecutive render() calls
  // use the same instance of Ink and don't create a new one
  //
  // This map has to be stored in a separate file, because render.js creates instances,
  // but instance.js should delete itself from the map on unmount
  
  exports.default = new WeakMap();
  });
  
  var AppContext_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  /**
   * `AppContext` is a React context, which exposes a method to manually exit the app (unmount).
   */
  
  
  const AppContext = React$1__default.createContext({
    exit: () => {}
  });
  AppContext.displayName = 'InternalAppContext';
  exports.default = AppContext;
  });
  
  var StdinContext_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  /**
   * `StdinContext` is a React context, which exposes input stream.
   */
  
  
  const StdinContext = React$1__default.createContext({
    stdin: undefined,
    setRawMode: () => {},
    isRawModeSupported: false
  });
  StdinContext.displayName = 'InternalStdinContext';
  exports.default = StdinContext;
  });
  
  var StdoutContext_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  /**
   * `StdoutContext` is a React context, which exposes stdout stream, where Ink renders your app.
   */
  
  
  const StdoutContext = React$1__default.createContext({
    stdout: undefined,
    write: () => {}
  });
  StdoutContext.displayName = 'InternalStdoutContext';
  exports.default = StdoutContext;
  });
  
  var StderrContext_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  /**
   * `StderrContext` is a React context, which exposes stderr stream.
   */
  
  
  const StderrContext = React$1__default.createContext({
    stderr: undefined,
    write: () => {}
  });
  StderrContext.displayName = 'InternalStderrContext';
  exports.default = StderrContext;
  });
  
  var FocusContext_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const FocusContext = React$1__default.createContext({
    activeId: undefined,
    add: () => {},
    remove: () => {},
    activate: () => {},
    deactivate: () => {},
    enableFocus: () => {},
    disableFocus: () => {},
    focusNext: () => {},
    focusPrevious: () => {}
  });
  FocusContext.displayName = 'InternalFocusContext';
  exports.default = FocusContext;
  });
  
  const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g;
  
  var escapeStringRegexp = string => {
    if (typeof string !== 'string') {
      throw new TypeError('Expected a string');
    }
  
    return string.replace(matchOperatorsRegex, '\\$&');
  };
  
  const natives = [].concat(module$1.builtinModules, 'bootstrap_node', 'node').map(n => new RegExp(`(?:\\(${n}\\.js:\\d+:\\d+\\)$|^\\s*at ${n}\\.js:\\d+:\\d+$)`));
  natives.push(/\(internal\/[^:]+:\d+:\d+\)$/, /\s*at internal\/[^:]+:\d+:\d+$/, /\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/);
  
  class StackUtils {
    constructor(opts) {
      opts = {
        ignoredPackages: [],
        ...opts
      };
  
      if ('internals' in opts === false) {
        opts.internals = StackUtils.nodeInternals();
      }
  
      if ('cwd' in opts === false) {
        opts.cwd = process.cwd();
      }
  
      this._cwd = opts.cwd.replace(/\\/g, '/');
      this._internals = [].concat(opts.internals, ignoredPackagesRegExp(opts.ignoredPackages));
      this._wrapCallSite = opts.wrapCallSite || false;
    }
  
    static nodeInternals() {
      return [...natives];
    }
  
    clean(stack, indent = 0) {
      indent = ' '.repeat(indent);
  
      if (!Array.isArray(stack)) {
        stack = stack.split('\n');
      }
  
      if (!/^\s*at /.test(stack[0]) && /^\s*at /.test(stack[1])) {
        stack = stack.slice(1);
      }
  
      let outdent = false;
      let lastNonAtLine = null;
      const result = [];
      stack.forEach(st => {
        st = st.replace(/\\/g, '/');
  
        if (this._internals.some(internal => internal.test(st))) {
          return;
        }
  
        const isAtLine = /^\s*at /.test(st);
  
        if (outdent) {
          st = st.trimEnd().replace(/^(\s+)at /, '$1');
        } else {
          st = st.trim();
  
          if (isAtLine) {
            st = st.slice(3);
          }
        }
  
        st = st.replace(`${this._cwd}/`, '');
  
        if (st) {
          if (isAtLine) {
            if (lastNonAtLine) {
              result.push(lastNonAtLine);
              lastNonAtLine = null;
            }
  
            result.push(st);
          } else {
            outdent = true;
            lastNonAtLine = st;
          }
        }
      });
      return result.map(line => `${indent}${line}\n`).join('');
    }
  
    captureString(limit, fn = this.captureString) {
      if (typeof limit === 'function') {
        fn = limit;
        limit = Infinity;
      }
  
      const {
        stackTraceLimit
      } = Error;
  
      if (limit) {
        Error.stackTraceLimit = limit;
      }
  
      const obj = {};
      Error.captureStackTrace(obj, fn);
      const {
        stack
      } = obj;
      Error.stackTraceLimit = stackTraceLimit;
      return this.clean(stack);
    }
  
    capture(limit, fn = this.capture) {
      if (typeof limit === 'function') {
        fn = limit;
        limit = Infinity;
      }
  
      const {
        prepareStackTrace,
        stackTraceLimit
      } = Error;
  
      Error.prepareStackTrace = (obj, site) => {
        if (this._wrapCallSite) {
          return site.map(this._wrapCallSite);
        }
  
        return site;
      };
  
      if (limit) {
        Error.stackTraceLimit = limit;
      }
  
      const obj = {};
      Error.captureStackTrace(obj, fn);
      const {
        stack
      } = obj;
      Object.assign(Error, {
        prepareStackTrace,
        stackTraceLimit
      });
      return stack;
    }
  
    at(fn = this.at) {
      const [site] = this.capture(1, fn);
  
      if (!site) {
        return {};
      }
  
      const res = {
        line: site.getLineNumber(),
        column: site.getColumnNumber()
      };
      setFile(res, site.getFileName(), this._cwd);
  
      if (site.isConstructor()) {
        res.constructor = true;
      }
  
      if (site.isEval()) {
        res.evalOrigin = site.getEvalOrigin();
      } // Node v10 stopped with the isNative() on callsites, apparently
  
      /* istanbul ignore next */
  
  
      if (site.isNative()) {
        res.native = true;
      }
  
      let typename;
  
      try {
        typename = site.getTypeName();
      } catch (_) {}
  
      if (typename && typename !== 'Object' && typename !== '[object Object]') {
        res.type = typename;
      }
  
      const fname = site.getFunctionName();
  
      if (fname) {
        res.function = fname;
      }
  
      const meth = site.getMethodName();
  
      if (meth && fname !== meth) {
        res.method = meth;
      }
  
      return res;
    }
  
    parseLine(line) {
      const match = line && line.match(re);
  
      if (!match) {
        return null;
      }
  
      const ctor = match[1] === 'new';
      let fname = match[2];
      const evalOrigin = match[3];
      const evalFile = match[4];
      const evalLine = Number(match[5]);
      const evalCol = Number(match[6]);
      let file = match[7];
      const lnum = match[8];
      const col = match[9];
      const native = match[10] === 'native';
      const closeParen = match[11] === ')';
      let method;
      const res = {};
  
      if (lnum) {
        res.line = Number(lnum);
      }
  
      if (col) {
        res.column = Number(col);
      }
  
      if (closeParen && file) {
        // make sure parens are balanced
        // if we have a file like "asdf) [as foo] (xyz.js", then odds are
        // that the fname should be += " (asdf) [as foo]" and the file
        // should be just "xyz.js"
        // walk backwards from the end to find the last unbalanced (
        let closes = 0;
  
        for (let i = file.length - 1; i > 0; i--) {
          if (file.charAt(i) === ')') {
            closes++;
          } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
            closes--;
  
            if (closes === -1 && file.charAt(i - 1) === ' ') {
              const before = file.slice(0, i - 1);
              const after = file.slice(i + 1);
              file = after;
              fname += ` (${before}`;
              break;
            }
          }
        }
      }
  
      if (fname) {
        const methodMatch = fname.match(methodRe);
  
        if (methodMatch) {
          fname = methodMatch[1];
          method = methodMatch[2];
        }
      }
  
      setFile(res, file, this._cwd);
  
      if (ctor) {
        res.constructor = true;
      }
  
      if (evalOrigin) {
        res.evalOrigin = evalOrigin;
        res.evalLine = evalLine;
        res.evalColumn = evalCol;
        res.evalFile = evalFile && evalFile.replace(/\\/g, '/');
      }
  
      if (native) {
        res.native = true;
      }
  
      if (fname) {
        res.function = fname;
      }
  
      if (method && fname !== method) {
        res.method = method;
      }
  
      return res;
    }
  
  }
  
  function setFile(result, filename, cwd) {
    if (filename) {
      filename = filename.replace(/\\/g, '/');
  
      if (filename.startsWith(`${cwd}/`)) {
        filename = filename.slice(cwd.length + 1);
      }
  
      result.file = filename;
    }
  }
  
  function ignoredPackagesRegExp(ignoredPackages) {
    if (ignoredPackages.length === 0) {
      return [];
    }
  
    const packages = ignoredPackages.map(mod => escapeStringRegexp(mod));
    return new RegExp(`[\/\\\\]node_modules[\/\\\\](?:${packages.join('|')})[\/\\\\][^:]+:\\d+:\\d+`);
  }
  
  const re = new RegExp('^' + // Sometimes we strip out the '    at' because it's noisy
  '(?:\\s*at )?' + // $1 = ctor if 'new'
  '(?:(new) )?' + // $2 = function name (can be literally anything)
  // May contain method at the end as [as xyz]
  '(?:(.*?) \\()?' + // (eval at <anonymous> (file.js:1:1),
  // $3 = eval origin
  // $4:$5:$6 are eval file/line/col, but not normally reported
  '(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' + // file:line:col
  // $7:$8:$9
  // $10 = 'native' if native
  '(?:(.+?):(\\d+):(\\d+)|(native))' + // maybe close the paren, then end
  // if $11 is ), then we only allow balanced parens in the filename
  // any imbalance is placed on the fname.  This is a heuristic, and
  // bound to be incorrect in some edge cases.  The bet is that
  // having weird characters in method names is more common than
  // having weird characters in filenames, which seems reasonable.
  '(\\)?)$');
  const methodRe = /^(.*?) \[as (.*?)\]$/;
  var stackUtils = StackUtils;
  
  var convertToSpaces = (str, spaces) => {
    return str.replace(/^\t+/gm, $1 => ' '.repeat($1.length * (spaces || 2)));
  };
  
  const generateLineNumbers = (line, around) => {
    const lineNumbers = [];
    const min = line - around;
    const max = line + around;
  
    for (let lineNumber = min; lineNumber <= max; lineNumber++) {
      lineNumbers.push(lineNumber);
    }
  
    return lineNumbers;
  };
  
  var codeExcerpt = (source, line, options) => {
    if (typeof source !== 'string') {
      throw new TypeError('Source code is missing.');
    }
  
    if (!line || line < 1) {
      throw new TypeError('Line number must start from `1`.');
    }
  
    source = convertToSpaces(source).split(/\r?\n/);
  
    if (line > source.length) {
      return;
    }
  
    options = {
      around: 3,
      ...options
    };
    return generateLineNumbers(line, options.around).filter(line => source[line - 1] !== undefined).map(line => ({
      line,
      value: source[line - 1]
    }));
  };
  
  var Box_1 = createCommonjsModule(function (module, exports) {
  
  var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, {
      enumerable: true,
      get: function () {
        return m[k];
      }
    });
  } : function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
  });
  
  var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function (o, v) {
    Object.defineProperty(o, "default", {
      enumerable: true,
      value: v
    });
  } : function (o, v) {
    o["default"] = v;
  });
  
  var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  
    __setModuleDefault(result, mod);
  
    return result;
  };
  
  var __rest = commonjsGlobal && commonjsGlobal.__rest || function (s, e) {
    var t = {};
  
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
  
    if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
      if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
    }
    return t;
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
  
  const react_1 = __importStar(React$1__default);
  /**
   * `<Box>` is an essential Ink component to build your layout. It's like `<div style="display: flex">` in the browser.
   */
  
  
  const Box = react_1.forwardRef((_a, ref) => {
    var {
      children
    } = _a,
        style = __rest(_a, ["children"]);
  
    const transformedStyle = Object.assign(Object.assign({}, style), {
      marginLeft: style.marginLeft || style.marginX || style.margin || 0,
      marginRight: style.marginRight || style.marginX || style.margin || 0,
      marginTop: style.marginTop || style.marginY || style.margin || 0,
      marginBottom: style.marginBottom || style.marginY || style.margin || 0,
      paddingLeft: style.paddingLeft || style.paddingX || style.padding || 0,
      paddingRight: style.paddingRight || style.paddingX || style.padding || 0,
      paddingTop: style.paddingTop || style.paddingY || style.padding || 0,
      paddingBottom: style.paddingBottom || style.paddingY || style.padding || 0
    });
    return react_1.default.createElement("ink-box", {
      ref: ref,
      style: transformedStyle
    }, children);
  });
  Box.displayName = 'Box';
  Box.defaultProps = {
    flexDirection: 'row',
    flexGrow: 0,
    flexShrink: 1
  };
  exports.default = Box;
  });
  
  var Text_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const react_1 = __importDefault(React$1__default);
  
  const chalk_1 = __importDefault(source);
  
  const colorize_1 = __importDefault(colorize);
  /**
   * This component can display text, and change its style to make it colorful, bold, underline, italic or strikethrough.
   */
  
  
  const Text = ({
    color,
    backgroundColor,
    dimColor,
    bold,
    italic,
    underline,
    strikethrough,
    wrap,
    children
  }) => {
    if (children === undefined || children === null) {
      return null;
    }
  
    const transform = children => {
      if (dimColor) {
        children = chalk_1.default.dim(children);
      }
  
      if (color) {
        children = colorize_1.default(children, color, 'foreground');
      }
  
      if (backgroundColor) {
        children = colorize_1.default(children, backgroundColor, 'background');
      }
  
      if (bold) {
        children = chalk_1.default.bold(children);
      }
  
      if (italic) {
        children = chalk_1.default.italic(children);
      }
  
      if (underline) {
        children = chalk_1.default.underline(children);
      }
  
      if (strikethrough) {
        children = chalk_1.default.strikethrough(children);
      }
  
      return children;
    };
  
    return react_1.default.createElement("ink-text", {
      style: {
        flexGrow: 0,
        flexShrink: 1,
        flexDirection: 'row',
        textWrap: wrap
      },
      internal_transform: transform
    }, children);
  };
  
  Text.displayName = 'Text';
  Text.defaultProps = {
    dimColor: false,
    bold: false,
    italic: false,
    underline: false,
    strikethrough: false,
    wrap: 'wrap'
  };
  exports.default = Text;
  });
  
  var ErrorOverview_1 = createCommonjsModule(function (module, exports) {
  
  var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, {
      enumerable: true,
      get: function () {
        return m[k];
      }
    });
  } : function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
  });
  
  var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function (o, v) {
    Object.defineProperty(o, "default", {
      enumerable: true,
      value: v
    });
  } : function (o, v) {
    o["default"] = v;
  });
  
  var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  
    __setModuleDefault(result, mod);
  
    return result;
  };
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const fs = __importStar(fs$1);
  
  const react_1 = __importDefault(React$1__default);
  
  const stack_utils_1 = __importDefault(stackUtils);
  
  const code_excerpt_1 = __importDefault(codeExcerpt);
  
  const Box_1$1 = __importDefault(Box_1);
  
  const Text_1$1 = __importDefault(Text_1);
  
  const stackUtils$1 = new stack_utils_1.default({
    cwd: process.cwd(),
    internals: stack_utils_1.default.nodeInternals()
  });
  
  const ErrorOverview = ({
    error
  }) => {
    const stack = error.stack ? error.stack.split('\n').slice(1) : undefined;
    const origin = stack ? stackUtils$1.parseLine(stack[0]) : undefined;
    let excerpt;
    let lineWidth = 0;
  
    if ((origin === null || origin === void 0 ? void 0 : origin.file) && (origin === null || origin === void 0 ? void 0 : origin.line) && fs.existsSync(origin.file)) {
      const sourceCode = fs.readFileSync(origin.file, 'utf8');
      excerpt = code_excerpt_1.default(sourceCode, origin.line);
  
      if (excerpt) {
        for (const {
          line
        } of excerpt) {
          lineWidth = Math.max(lineWidth, String(line).length);
        }
      }
    }
  
    return react_1.default.createElement(Box_1$1.default, {
      flexDirection: "column",
      padding: 1
    }, react_1.default.createElement(Box_1$1.default, null, react_1.default.createElement(Text_1$1.default, {
      backgroundColor: "red",
      color: "white"
    }, ' ', "ERROR", ' '), react_1.default.createElement(Text_1$1.default, null, " ", error.message)), origin && react_1.default.createElement(Box_1$1.default, {
      marginTop: 1
    }, react_1.default.createElement(Text_1$1.default, {
      dimColor: true
    }, origin.file, ":", origin.line, ":", origin.column)), origin && excerpt && react_1.default.createElement(Box_1$1.default, {
      marginTop: 1,
      flexDirection: "column"
    }, excerpt.map(({
      line,
      value
    }) => react_1.default.createElement(Box_1$1.default, {
      key: line
    }, react_1.default.createElement(Box_1$1.default, {
      width: lineWidth + 1
    }, react_1.default.createElement(Text_1$1.default, {
      dimColor: line !== origin.line,
      backgroundColor: line === origin.line ? 'red' : undefined,
      color: line === origin.line ? 'white' : undefined
    }, String(line).padStart(lineWidth, ' '), ":")), react_1.default.createElement(Text_1$1.default, {
      key: line,
      backgroundColor: line === origin.line ? 'red' : undefined,
      color: line === origin.line ? 'white' : undefined
    }, ' ' + value)))), error.stack && react_1.default.createElement(Box_1$1.default, {
      marginTop: 1,
      flexDirection: "column"
    }, error.stack.split('\n').slice(1).map(line => {
      const parsedLine = stackUtils$1.parseLine(line); // If the line from the stack cannot be parsed, we print out the unparsed line.
  
      if (!parsedLine) {
        return react_1.default.createElement(Box_1$1.default, {
          key: line
        }, react_1.default.createElement(Text_1$1.default, {
          dimColor: true
        }, "- "), react_1.default.createElement(Text_1$1.default, {
          dimColor: true,
          bold: true
        }, line));
      }
  
      return react_1.default.createElement(Box_1$1.default, {
        key: line
      }, react_1.default.createElement(Text_1$1.default, {
        dimColor: true
      }, "- "), react_1.default.createElement(Text_1$1.default, {
        dimColor: true,
        bold: true
      }, parsedLine.function), react_1.default.createElement(Text_1$1.default, {
        dimColor: true,
        color: "gray"
      }, ' ', "(", parsedLine.file, ":", parsedLine.line, ":", parsedLine.column, ")"));
    })));
  };
  
  exports.default = ErrorOverview;
  });
  
  var App_1 = createCommonjsModule(function (module, exports) {
  
  var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, {
      enumerable: true,
      get: function () {
        return m[k];
      }
    });
  } : function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
  });
  
  var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function (o, v) {
    Object.defineProperty(o, "default", {
      enumerable: true,
      value: v
    });
  } : function (o, v) {
    o["default"] = v;
  });
  
  var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  
    __setModuleDefault(result, mod);
  
    return result;
  };
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
  
  const react_1 = __importStar(React$1__default);
  
  const cli_cursor_1 = __importDefault(cliCursor);
  
  const AppContext_1$1 = __importDefault(AppContext_1);
  
  const StdinContext_1$1 = __importDefault(StdinContext_1);
  
  const StdoutContext_1$1 = __importDefault(StdoutContext_1);
  
  const StderrContext_1$1 = __importDefault(StderrContext_1);
  
  const FocusContext_1$1 = __importDefault(FocusContext_1);
  
  const ErrorOverview_1$1 = __importDefault(ErrorOverview_1);
  
  const TAB = '\t';
  const SHIFT_TAB = '\u001B[Z';
  const ESC = '\u001B'; // Root component for all Ink apps
  // It renders stdin and stdout contexts, so that children can access them if needed
  // It also handles Ctrl+C exiting and cursor visibility
  
  class App extends react_1.PureComponent {
    constructor() {
      super(...arguments);
      this.state = {
        isFocusEnabled: true,
        activeFocusId: undefined,
        focusables: [],
        error: undefined
      }; // Count how many components enabled raw mode to avoid disabling
      // raw mode until all components don't need it anymore
  
      this.rawModeEnabledCount = 0;
  
      this.handleSetRawMode = isEnabled => {
        const {
          stdin
        } = this.props;
  
        if (!this.isRawModeSupported()) {
          if (stdin === process.stdin) {
            throw new Error('Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported');
          } else {
            throw new Error('Raw mode is not supported on the stdin provided to Ink.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported');
          }
        }
  
        stdin.setEncoding('utf8');
  
        if (isEnabled) {
          // Ensure raw mode is enabled only once
          if (this.rawModeEnabledCount === 0) {
            stdin.addListener('data', this.handleInput);
            stdin.resume();
            stdin.setRawMode(true);
          }
  
          this.rawModeEnabledCount++;
          return;
        } // Disable raw mode only when no components left that are using it
  
  
        if (--this.rawModeEnabledCount === 0) {
          stdin.setRawMode(false);
          stdin.removeListener('data', this.handleInput);
          stdin.pause();
        }
      };
  
      this.handleInput = input => {
        // Exit on Ctrl+C
        // eslint-disable-next-line unicorn/no-hex-escape
        if (input === '\x03' && this.props.exitOnCtrlC) {
          this.handleExit();
        } // Reset focus when there's an active focused component on Esc
  
  
        if (input === ESC && this.state.activeFocusId) {
          this.setState({
            activeFocusId: undefined
          });
        }
  
        if (this.state.isFocusEnabled && this.state.focusables.length > 0) {
          if (input === TAB) {
            this.focusNext();
          }
  
          if (input === SHIFT_TAB) {
            this.focusPrevious();
          }
        }
      };
  
      this.handleExit = error => {
        if (this.isRawModeSupported()) {
          this.handleSetRawMode(false);
        }
  
        this.props.onExit(error);
      };
  
      this.enableFocus = () => {
        this.setState({
          isFocusEnabled: true
        });
      };
  
      this.disableFocus = () => {
        this.setState({
          isFocusEnabled: false
        });
      };
  
      this.focusNext = () => {
        this.setState(previousState => {
          const firstFocusableId = previousState.focusables[0].id;
          const nextFocusableId = this.findNextFocusable(previousState);
          return {
            activeFocusId: nextFocusableId || firstFocusableId
          };
        });
      };
  
      this.focusPrevious = () => {
        this.setState(previousState => {
          const lastFocusableId = previousState.focusables[previousState.focusables.length - 1].id;
          const previousFocusableId = this.findPreviousFocusable(previousState);
          return {
            activeFocusId: previousFocusableId || lastFocusableId
          };
        });
      };
  
      this.addFocusable = (id, {
        autoFocus
      }) => {
        this.setState(previousState => {
          let nextFocusId = previousState.activeFocusId;
  
          if (!nextFocusId && autoFocus) {
            nextFocusId = id;
          }
  
          return {
            activeFocusId: nextFocusId,
            focusables: [...previousState.focusables, {
              id,
              isActive: true
            }]
          };
        });
      };
  
      this.removeFocusable = id => {
        this.setState(previousState => ({
          activeFocusId: previousState.activeFocusId === id ? undefined : previousState.activeFocusId,
          focusables: previousState.focusables.filter(focusable => {
            return focusable.id !== id;
          })
        }));
      };
  
      this.activateFocusable = id => {
        this.setState(previousState => ({
          focusables: previousState.focusables.map(focusable => {
            if (focusable.id !== id) {
              return focusable;
            }
  
            return {
              id,
              isActive: true
            };
          })
        }));
      };
  
      this.deactivateFocusable = id => {
        this.setState(previousState => ({
          activeFocusId: previousState.activeFocusId === id ? undefined : previousState.activeFocusId,
          focusables: previousState.focusables.map(focusable => {
            if (focusable.id !== id) {
              return focusable;
            }
  
            return {
              id,
              isActive: false
            };
          })
        }));
      };
  
      this.findNextFocusable = state => {
        const activeIndex = state.focusables.findIndex(focusable => {
          return focusable.id === state.activeFocusId;
        });
  
        for (let index = activeIndex + 1; index < state.focusables.length; index++) {
          if (state.focusables[index].isActive) {
            return state.focusables[index].id;
          }
        }
  
        return undefined;
      };
  
      this.findPreviousFocusable = state => {
        const activeIndex = state.focusables.findIndex(focusable => {
          return focusable.id === state.activeFocusId;
        });
  
        for (let index = activeIndex - 1; index >= 0; index--) {
          if (state.focusables[index].isActive) {
            return state.focusables[index].id;
          }
        }
  
        return undefined;
      };
    }
  
    static getDerivedStateFromError(error) {
      return {
        error
      };
    } // Determines if TTY is supported on the provided stdin
  
  
    isRawModeSupported() {
      return this.props.stdin.isTTY;
    }
  
    render() {
      return react_1.default.createElement(AppContext_1$1.default.Provider, {
        value: {
          exit: this.handleExit
        }
      }, react_1.default.createElement(StdinContext_1$1.default.Provider, {
        value: {
          stdin: this.props.stdin,
          setRawMode: this.handleSetRawMode,
          isRawModeSupported: this.isRawModeSupported()
        }
      }, react_1.default.createElement(StdoutContext_1$1.default.Provider, {
        value: {
          stdout: this.props.stdout,
          write: this.props.writeToStdout
        }
      }, react_1.default.createElement(StderrContext_1$1.default.Provider, {
        value: {
          stderr: this.props.stderr,
          write: this.props.writeToStderr
        }
      }, react_1.default.createElement(FocusContext_1$1.default.Provider, {
        value: {
          activeId: this.state.activeFocusId,
          add: this.addFocusable,
          remove: this.removeFocusable,
          activate: this.activateFocusable,
          deactivate: this.deactivateFocusable,
          enableFocus: this.enableFocus,
          disableFocus: this.disableFocus,
          focusNext: this.focusNext,
          focusPrevious: this.focusPrevious
        }
      }, this.state.error ? react_1.default.createElement(ErrorOverview_1$1.default, {
        error: this.state.error
      }) : this.props.children)))));
    }
  
    componentDidMount() {
      cli_cursor_1.default.hide(this.props.stdout);
    }
  
    componentWillUnmount() {
      cli_cursor_1.default.show(this.props.stdout); // ignore calling setRawMode on an handle stdin it cannot be called
  
      if (this.isRawModeSupported()) {
        this.handleSetRawMode(false);
      }
    }
  
    componentDidCatch(error) {
      this.handleExit(error);
    }
  
  }
  
  exports.default = App;
  App.displayName = 'InternalApp';
  });
  
  var ink = createCommonjsModule(function (module, exports) {
  
  var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, {
      enumerable: true,
      get: function () {
        return m[k];
      }
    });
  } : function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
  });
  
  var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function (o, v) {
    Object.defineProperty(o, "default", {
      enumerable: true,
      value: v
    });
  } : function (o, v) {
    o["default"] = v;
  });
  
  var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  
    __setModuleDefault(result, mod);
  
    return result;
  };
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const react_1 = __importDefault(React$1__default);
  
  const lodash_throttle_1 = __importDefault(lodash_throttle);
  
  const log_update_1 = __importDefault(logUpdate);
  
  const ansi_escapes_1 = __importDefault(ansiEscapes_1);
  
  const is_ci_1 = __importDefault(isCi);
  
  const auto_bind_1 = __importDefault(autoBind);
  
  const reconciler_1 = __importDefault(reconciler);
  
  const renderer_1 = __importDefault(renderer);
  
  const signal_exit_1 = __importDefault(signalExit);
  
  const patch_console_1 = __importDefault(build);
  
  const dom$1 = __importStar(dom);
  
  const instances_1 = __importDefault(instances);
  
  const App_1$1 = __importDefault(App_1);
  
  const isCI = process.env.CI === 'false' ? false : is_ci_1.default;
  
  const noop = () => {};
  
  class Ink {
    constructor(options) {
      this.resolveExitPromise = () => {};
  
      this.rejectExitPromise = () => {};
  
      this.unsubscribeExit = () => {};
  
      this.onRender = () => {
        var _a;
  
        if (this.isUnmounted) {
          return;
        }
  
        const {
          output,
          outputHeight,
          staticOutput
        } = renderer_1.default(this.rootNode, (_a = // The 'columns' property can be undefined when not using a TTY.
        // In that case we fall back to 80.
        this.options.stdout.columns) !== null && _a !== void 0 ? _a : 80); // If <Static> output isn't empty, it means new children have been added to it
  
        const hasStaticOutput = staticOutput && staticOutput !== '\n';
  
        if (this.options.debug) {
          if (hasStaticOutput) {
            this.fullStaticOutput += staticOutput;
          }
  
          this.options.stdout.write(this.fullStaticOutput + output);
          return;
        }
  
        if (isCI) {
          if (hasStaticOutput) {
            this.options.stdout.write(staticOutput);
          }
  
          this.lastOutput = output;
          return;
        }
  
        if (hasStaticOutput) {
          this.fullStaticOutput += staticOutput;
        }
  
        if (outputHeight >= this.options.stdout.rows) {
          this.options.stdout.write(ansi_escapes_1.default.clearTerminal + this.fullStaticOutput + output);
          this.lastOutput = output;
          return;
        } // To ensure static output is cleanly rendered before main output, clear main output first
  
  
        if (hasStaticOutput) {
          this.log.clear();
          this.options.stdout.write(staticOutput);
          this.log(output);
        }
  
        if (!hasStaticOutput && output !== this.lastOutput) {
          this.throttledLog(output);
        }
  
        this.lastOutput = output;
      };
  
      auto_bind_1.default(this);
      this.options = options;
      this.rootNode = dom$1.createNode('ink-root');
      this.rootNode.onRender = options.debug ? this.onRender : lodash_throttle_1.default(this.onRender, 32, {
        leading: true,
        trailing: true
      });
      this.rootNode.onImmediateRender = this.onRender;
      this.log = log_update_1.default.create(options.stdout);
      this.throttledLog = options.debug ? this.log : lodash_throttle_1.default(this.log, undefined, {
        leading: true,
        trailing: true
      }); // Ignore last render after unmounting a tree to prevent empty output before exit
  
      this.isUnmounted = false; // Store last output to only rerender when needed
  
      this.lastOutput = ''; // This variable is used only in debug mode to store full static output
      // so that it's rerendered every time, not just new static parts, like in non-debug mode
  
      this.fullStaticOutput = '';
      this.container = reconciler_1.default.createContainer(this.rootNode, false, false); // Unmount when process exits
  
      this.unsubscribeExit = signal_exit_1.default(this.unmount, {
        alwaysLast: false
      });
  
      if (process.env.DEV === 'true') {
        reconciler_1.default.injectIntoDevTools({
          bundleType: 0,
          // Reporting React DOM's version, not Ink's
          // See https://github.com/facebook/react/issues/16666#issuecomment-532639905
          version: '16.13.1',
          rendererPackageName: 'ink'
        });
      }
  
      if (options.patchConsole) {
        this.patchConsole();
      }
  
      if (!isCI) {
        options.stdout.on('resize', this.onRender);
  
        this.unsubscribeResize = () => {
          options.stdout.off('resize', this.onRender);
        };
      }
    }
  
    render(node) {
      const tree = react_1.default.createElement(App_1$1.default, {
        stdin: this.options.stdin,
        stdout: this.options.stdout,
        stderr: this.options.stderr,
        writeToStdout: this.writeToStdout,
        writeToStderr: this.writeToStderr,
        exitOnCtrlC: this.options.exitOnCtrlC,
        onExit: this.unmount
      }, node);
      reconciler_1.default.updateContainer(tree, this.container, null, noop);
    }
  
    writeToStdout(data) {
      if (this.isUnmounted) {
        return;
      }
  
      if (this.options.debug) {
        this.options.stdout.write(data + this.fullStaticOutput + this.lastOutput);
        return;
      }
  
      if (isCI) {
        this.options.stdout.write(data);
        return;
      }
  
      this.log.clear();
      this.options.stdout.write(data);
      this.log(this.lastOutput);
    }
  
    writeToStderr(data) {
      if (this.isUnmounted) {
        return;
      }
  
      if (this.options.debug) {
        this.options.stderr.write(data);
        this.options.stdout.write(this.fullStaticOutput + this.lastOutput);
        return;
      }
  
      if (isCI) {
        this.options.stderr.write(data);
        return;
      }
  
      this.log.clear();
      this.options.stderr.write(data);
      this.log(this.lastOutput);
    }
  
    unmount(error) {
      if (this.isUnmounted) {
        return;
      }
  
      this.onRender();
      this.unsubscribeExit();
  
      if (typeof this.restoreConsole === 'function') {
        this.restoreConsole();
      }
  
      if (typeof this.unsubscribeResize === 'function') {
        this.unsubscribeResize();
      } // CIs don't handle erasing ansi escapes well, so it's better to
      // only render last frame of non-static output
  
  
      if (isCI) {
        this.options.stdout.write(this.lastOutput + '\n');
      } else if (!this.options.debug) {
        this.log.done();
      }
  
      this.isUnmounted = true;
      reconciler_1.default.updateContainer(null, this.container, null, noop);
      instances_1.default.delete(this.options.stdout);
  
      if (error instanceof Error) {
        this.rejectExitPromise(error);
      } else {
        this.resolveExitPromise();
      }
    }
  
    waitUntilExit() {
      if (!this.exitPromise) {
        this.exitPromise = new Promise((resolve, reject) => {
          this.resolveExitPromise = resolve;
          this.rejectExitPromise = reject;
        });
      }
  
      return this.exitPromise;
    }
  
    clear() {
      if (!isCI && !this.options.debug) {
        this.log.clear();
      }
    }
  
    patchConsole() {
      if (this.options.debug) {
        return;
      }
  
      this.restoreConsole = patch_console_1.default((stream, data) => {
        if (stream === 'stdout') {
          this.writeToStdout(data);
        }
  
        if (stream === 'stderr') {
          const isReactMessage = data.startsWith('The above error occurred');
  
          if (!isReactMessage) {
            this.writeToStderr(data);
          }
        }
      });
    }
  
  }
  
  exports.default = Ink;
  });
  
  var render_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const ink_1 = __importDefault(ink);
  
  const instances_1 = __importDefault(instances);
  
  
  /**
   * Mount a component and render the output.
   */
  
  
  const render = (node, options) => {
    const inkOptions = Object.assign({
      stdout: process.stdout,
      stdin: process.stdin,
      stderr: process.stderr,
      debug: false,
      exitOnCtrlC: true,
      patchConsole: true
    }, getOptions(options));
    const instance = getInstance(inkOptions.stdout, () => new ink_1.default(inkOptions));
    instance.render(node);
    return {
      rerender: instance.render,
      unmount: () => instance.unmount(),
      waitUntilExit: instance.waitUntilExit,
      cleanup: () => instances_1.default.delete(inkOptions.stdout),
      clear: instance.clear
    };
  };
  
  exports.default = render;
  
  const getOptions = (stdout = {}) => {
    if (stdout instanceof stream.Stream) {
      return {
        stdout,
        stdin: process.stdin
      };
    }
  
    return stdout;
  };
  
  const getInstance = (stdout, createInstance) => {
    let instance;
  
    if (instances_1.default.has(stdout)) {
      instance = instances_1.default.get(stdout);
    } else {
      instance = createInstance();
      instances_1.default.set(stdout, instance);
    }
  
    return instance;
  };
  });
  
  var Static_1 = createCommonjsModule(function (module, exports) {
  
  var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, {
      enumerable: true,
      get: function () {
        return m[k];
      }
    });
  } : function (o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
  });
  
  var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function (o, v) {
    Object.defineProperty(o, "default", {
      enumerable: true,
      value: v
    });
  } : function (o, v) {
    o["default"] = v;
  });
  
  var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  
    __setModuleDefault(result, mod);
  
    return result;
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const react_1 = __importStar(React$1__default);
  /**
   * `<Static>` component permanently renders its output above everything else.
   * It's useful for displaying activity like completed tasks or logs - things that
   * are not changing after they're rendered (hence the name "Static").
   *
   * It's preferred to use `<Static>` for use cases like these, when you can't know
   * or control the amount of items that need to be rendered.
   *
   * For example, [Tap](https://github.com/tapjs/node-tap) uses `<Static>` to display
   * a list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it
   * to display a list of generated pages, while still displaying a live progress bar.
   */
  
  
  const Static = props => {
    const {
      items,
      children: render,
      style: customStyle
    } = props;
    const [index, setIndex] = react_1.useState(0);
    const itemsToRender = react_1.useMemo(() => {
      return items.slice(index);
    }, [items, index]);
    react_1.useEffect(() => {
      setIndex(items.length);
    }, [items.length]);
    const children = itemsToRender.map((item, itemIndex) => {
      return render(item, index + itemIndex);
    });
    const style = react_1.useMemo(() => Object.assign({
      position: 'absolute',
      flexDirection: 'column'
    }, customStyle), [customStyle]);
    return react_1.default.createElement("ink-box", {
      // @ts-ignore
      internal_static: true,
      style: style
    }, children);
  };
  
  Static.displayName = 'Static';
  exports.default = Static;
  });
  
  var Transform_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const react_1 = __importDefault(React$1__default);
  /**
   * Transform a string representation of React components before they are written to output.
   * For example, you might want to apply a gradient to text, add a clickable link or create some text effects.
   * These use cases can't accept React nodes as input, they are expecting a string.
   * That's what <Transform> component does, it gives you an output string of its child components and lets you transform it in any way.
   */
  
  
  const Transform = ({
    children,
    transform
  }) => {
    if (children === undefined || children === null) {
      return null;
    }
  
    return react_1.default.createElement("ink-text", {
      style: {
        flexGrow: 0,
        flexShrink: 1,
        flexDirection: 'row'
      },
      internal_transform: transform
    }, children);
  };
  
  Transform.displayName = 'Transform';
  exports.default = Transform;
  });
  
  var Newline_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const react_1 = __importDefault(React$1__default);
  /**
   * Adds one or more newline (\n) characters. Must be used within <Text> components.
   */
  
  
  const Newline = ({
    count = 1
  }) => react_1.default.createElement("ink-text", null, '\n'.repeat(count));
  
  Newline.displayName = 'Newline';
  exports.default = Newline;
  });
  
  var Spacer_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  const react_1 = __importDefault(React$1__default);
  
  const Box_1$1 = __importDefault(Box_1);
  /**
   * A flexible space that expands along the major axis of its containing layout.
   * It's useful as a shortcut for filling all the available spaces between elements.
   */
  
  
  const Spacer = () => react_1.default.createElement(Box_1$1.default, {
    flexGrow: 1
  });
  
  Spacer.displayName = 'Spacer';
  exports.default = Spacer;
  });
  
  var useStdin_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const StdinContext_1$1 = __importDefault(StdinContext_1);
  /**
   * `useStdin` is a React hook, which exposes stdin stream.
   */
  
  
  const useStdin = () => React$1__default.useContext(StdinContext_1$1.default);
  
  exports.default = useStdin;
  });
  
  var useInput_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const use_stdin_1 = __importDefault(useStdin_1);
  /**
   * This hook is used for handling user input.
   * It's a more convienient alternative to using `StdinContext` and listening to `data` events.
   * The callback you pass to `useInput` is called for each character when user enters any input.
   * However, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.
   *
   * ```
   * import {useInput} from 'ink';
   *
   * const UserInput = () => {
   *   useInput((input, key) => {
   *     if (input === 'q') {
   *       // Exit program
   *     }
   *
   *     if (key.leftArrow) {
   *       // Left arrow key pressed
   *     }
   *   });
   *
   *   return …
   * };
   * ```
   */
  
  
  const useInput = (inputHandler, options = {}) => {
    const {
      stdin,
      setRawMode
    } = use_stdin_1.default();
    React$1__default.useEffect(() => {
      if (options.isActive === false) {
        return;
      }
  
      setRawMode(true);
      return () => {
        setRawMode(false);
      };
    }, [options.isActive, setRawMode]);
    React$1__default.useEffect(() => {
      if (options.isActive === false) {
        return;
      }
  
      const handleData = data => {
        let input = String(data);
        const key = {
          upArrow: input === '\u001B[A',
          downArrow: input === '\u001B[B',
          leftArrow: input === '\u001B[D',
          rightArrow: input === '\u001B[C',
          return: input === '\r',
          escape: input === '\u001B',
          ctrl: false,
          shift: false,
          tab: input === '\t' || input === '\u001B[Z',
          backspace: input === '\u0008',
          delete: input === '\u007F',
          meta: false
        }; // Copied from `keypress` module
  
        if (input <= '\u001A' && !key.return) {
          input = String.fromCharCode(input.charCodeAt(0) + 'a'.charCodeAt(0) - 1);
          key.ctrl = true;
        }
  
        if (input.startsWith('\u001B')) {
          input = input.slice(1);
          key.meta = true;
        }
  
        const isLatinUppercase = input >= 'A' && input <= 'Z';
        const isCyrillicUppercase = input >= 'А' && input <= 'Я';
  
        if (input.length === 1 && (isLatinUppercase || isCyrillicUppercase)) {
          key.shift = true;
        } // Shift+Tab
  
  
        if (key.tab && input === '[Z') {
          key.shift = true;
        }
  
        if (key.tab || key.backspace || key.delete) {
          input = '';
        }
  
        if (!(input === 'c' && key.ctrl)) {
          inputHandler(input, key);
        }
      };
  
      stdin === null || stdin === void 0 ? void 0 : stdin.on('data', handleData);
      return () => {
        stdin === null || stdin === void 0 ? void 0 : stdin.off('data', handleData);
      };
    }, [options.isActive, stdin, inputHandler]);
  };
  
  exports.default = useInput;
  });
  
  var useApp_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const AppContext_1$1 = __importDefault(AppContext_1);
  /**
   * `useApp` is a React hook, which exposes a method to manually exit the app (unmount).
   */
  
  
  const useApp = () => React$1__default.useContext(AppContext_1$1.default);
  
  exports.default = useApp;
  });
  
  var useStdout_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const StdoutContext_1$1 = __importDefault(StdoutContext_1);
  /**
   * `useStdout` is a React hook, which exposes stdout stream.
   */
  
  
  const useStdout = () => React$1__default.useContext(StdoutContext_1$1.default);
  
  exports.default = useStdout;
  });
  
  var useStderr_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const StderrContext_1$1 = __importDefault(StderrContext_1);
  /**
   * `useStderr` is a React hook, which exposes stderr stream.
   */
  
  
  const useStderr = () => React$1__default.useContext(StderrContext_1$1.default);
  
  exports.default = useStderr;
  });
  
  var useFocus_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const FocusContext_1$1 = __importDefault(FocusContext_1);
  
  const use_stdin_1 = __importDefault(useStdin_1);
  /**
   * Component that uses `useFocus` hook becomes "focusable" to Ink,
   * so when user presses <kbd>Tab</kbd>, Ink will switch focus to this component.
   * If there are multiple components that execute `useFocus` hook, focus will be
   * given to them in the order that these components are rendered in.
   * This hook returns an object with `isFocused` boolean property, which
   * determines if this component is focused or not.
   */
  
  
  const useFocus = ({
    isActive = true,
    autoFocus = false
  } = {}) => {
    const {
      isRawModeSupported,
      setRawMode
    } = use_stdin_1.default();
    const {
      activeId,
      add,
      remove,
      activate,
      deactivate
    } = React$1__default.useContext(FocusContext_1$1.default);
    const id = React$1__default.useMemo(() => Math.random().toString().slice(2, 7), []);
    React$1__default.useEffect(() => {
      add(id, {
        autoFocus
      });
      return () => {
        remove(id);
      };
    }, [id, autoFocus]);
    React$1__default.useEffect(() => {
      if (isActive) {
        activate(id);
      } else {
        deactivate(id);
      }
    }, [isActive, id]);
    React$1__default.useEffect(() => {
      if (!isRawModeSupported || !isActive) {
        return;
      }
  
      setRawMode(true);
      return () => {
        setRawMode(false);
      };
    }, [isActive]);
    return {
      isFocused: Boolean(id) && activeId === id
    };
  };
  
  exports.default = useFocus;
  });
  
  var useFocusManager_1 = createCommonjsModule(function (module, exports) {
  
  var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function (mod) {
    return mod && mod.__esModule ? mod : {
      "default": mod
    };
  };
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const FocusContext_1$1 = __importDefault(FocusContext_1);
  /**
   * This hook exposes methods to enable or disable focus management for all
   * components or manually switch focus to next or previous components.
   */
  
  
  const useFocusManager = () => {
    const focusContext = React$1__default.useContext(FocusContext_1$1.default);
    return {
      enableFocus: focusContext.enableFocus,
      disableFocus: focusContext.disableFocus,
      focusNext: focusContext.focusNext,
      focusPrevious: focusContext.focusPrevious
    };
  };
  
  exports.default = useFocusManager;
  });
  
  var measureElement = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  /**
   * Measure the dimensions of a particular `<Box>` element.
   */
  
  exports.default = node => {
    var _a, _b, _c, _d;
  
    return {
      width: (_b = (_a = node.yogaNode) === null || _a === void 0 ? void 0 : _a.getComputedWidth()) !== null && _b !== void 0 ? _b : 0,
      height: (_d = (_c = node.yogaNode) === null || _c === void 0 ? void 0 : _c.getComputedHeight()) !== null && _d !== void 0 ? _d : 0
    };
  };
  });
  
  var build$1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  Object.defineProperty(exports, "render", {
    enumerable: true,
    get: function () {
      return render_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "Box", {
    enumerable: true,
    get: function () {
      return Box_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "Text", {
    enumerable: true,
    get: function () {
      return Text_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "Static", {
    enumerable: true,
    get: function () {
      return Static_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "Transform", {
    enumerable: true,
    get: function () {
      return Transform_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "Newline", {
    enumerable: true,
    get: function () {
      return Newline_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "Spacer", {
    enumerable: true,
    get: function () {
      return Spacer_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "useInput", {
    enumerable: true,
    get: function () {
      return useInput_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "useApp", {
    enumerable: true,
    get: function () {
      return useApp_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "useStdin", {
    enumerable: true,
    get: function () {
      return useStdin_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "useStdout", {
    enumerable: true,
    get: function () {
      return useStdout_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "useStderr", {
    enumerable: true,
    get: function () {
      return useStderr_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "useFocus", {
    enumerable: true,
    get: function () {
      return useFocus_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "useFocusManager", {
    enumerable: true,
    get: function () {
      return useFocusManager_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "measureElement", {
    enumerable: true,
    get: function () {
      return measureElement.default;
    }
  });
  });
  
  var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  
  var escapeStringRegexp$1 = function (str) {
    if (typeof str !== 'string') {
      throw new TypeError('Expected a string');
    }
  
    return str.replace(matchOperatorsRe, '\\$&');
  };
  
  const {
    platform
  } = process;
  const main = {
    tick: '✔',
    cross: '✖',
    star: '★',
    square: '▇',
    squareSmall: '◻',
    squareSmallFilled: '◼',
    play: '▶',
    circle: '◯',
    circleFilled: '◉',
    circleDotted: '◌',
    circleDouble: '◎',
    circleCircle: 'ⓞ',
    circleCross: 'ⓧ',
    circlePipe: 'Ⓘ',
    circleQuestionMark: '?⃝',
    bullet: '●',
    dot: '․',
    line: '─',
    ellipsis: '…',
    pointer: '❯',
    pointerSmall: '›',
    info: 'ℹ',
    warning: '⚠',
    hamburger: '☰',
    smiley: '㋡',
    mustache: '෴',
    heart: '♥',
    nodejs: '⬢',
    arrowUp: '↑',
    arrowDown: '↓',
    arrowLeft: '←',
    arrowRight: '→',
    radioOn: '◉',
    radioOff: '◯',
    checkboxOn: '☒',
    checkboxOff: '☐',
    checkboxCircleOn: 'ⓧ',
    checkboxCircleOff: 'Ⓘ',
    questionMarkPrefix: '?⃝',
    oneHalf: '½',
    oneThird: '⅓',
    oneQuarter: '¼',
    oneFifth: '⅕',
    oneSixth: '⅙',
    oneSeventh: '⅐',
    oneEighth: '⅛',
    oneNinth: '⅑',
    oneTenth: '⅒',
    twoThirds: '⅔',
    twoFifths: '⅖',
    threeQuarters: '¾',
    threeFifths: '⅗',
    threeEighths: '⅜',
    fourFifths: '⅘',
    fiveSixths: '⅚',
    fiveEighths: '⅝',
    sevenEighths: '⅞'
  };
  const windows = {
    tick: '√',
    cross: '×',
    star: '*',
    square: '█',
    squareSmall: '[ ]',
    squareSmallFilled: '[█]',
    play: '►',
    circle: '( )',
    circleFilled: '(*)',
    circleDotted: '( )',
    circleDouble: '( )',
    circleCircle: '(○)',
    circleCross: '(×)',
    circlePipe: '(│)',
    circleQuestionMark: '(?)',
    bullet: '*',
    dot: '.',
    line: '─',
    ellipsis: '...',
    pointer: '>',
    pointerSmall: '»',
    info: 'i',
    warning: '‼',
    hamburger: '≡',
    smiley: '☺',
    mustache: '┌─┐',
    heart: main.heart,
    nodejs: '♦',
    arrowUp: main.arrowUp,
    arrowDown: main.arrowDown,
    arrowLeft: main.arrowLeft,
    arrowRight: main.arrowRight,
    radioOn: '(*)',
    radioOff: '( )',
    checkboxOn: '[×]',
    checkboxOff: '[ ]',
    checkboxCircleOn: '(×)',
    checkboxCircleOff: '( )',
    questionMarkPrefix: '？',
    oneHalf: '1/2',
    oneThird: '1/3',
    oneQuarter: '1/4',
    oneFifth: '1/5',
    oneSixth: '1/6',
    oneSeventh: '1/7',
    oneEighth: '1/8',
    oneNinth: '1/9',
    oneTenth: '1/10',
    twoThirds: '2/3',
    twoFifths: '2/5',
    threeQuarters: '3/4',
    threeFifths: '3/5',
    threeEighths: '3/8',
    fourFifths: '4/5',
    fiveSixths: '5/6',
    fiveEighths: '5/8',
    sevenEighths: '7/8'
  };
  
  if (platform === 'linux') {
    // The main one doesn't look that good on Ubuntu.
    main.questionMarkPrefix = '?';
  }
  
  const figures = platform === 'win32' ? windows : main;
  
  const fn = string => {
    if (figures === main) {
      return string;
    }
  
    for (const [key, value] of Object.entries(main)) {
      if (value === figures[key]) {
        continue;
      }
  
      string = string.replace(new RegExp(escapeStringRegexp$1(value), 'g'), figures[key]);
    }
  
    return string;
  };
  
  var figures_1 = Object.assign(fn, figures);
  var main_1 = main;
  var windows_1 = windows;
  figures_1.main = main_1;
  figures_1.windows = windows_1;
  
  var Indicator_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  
  
  
  
  const Indicator = ({
    isSelected = false
  }) => React$1__default.createElement(build$1.Box, {
    marginRight: 1
  }, isSelected ? React$1__default.createElement(build$1.Text, {
    color: "blue"
  }, figures_1.pointer) : React$1__default.createElement(build$1.Text, null, " "));
  
  exports.default = Indicator;
  });
  
  var Item_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  
  
  const Item = ({
    isSelected = false,
    label
  }) => React$1__default.createElement(build$1.Text, {
    color: isSelected ? 'blue' : undefined
  }, label);
  
  exports.default = Item;
  });
  
  var SelectInput_1 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  const react_1 = React$1__default;
  
  
  
  
  
  
  
  
  
  
  
  const SelectInput = ({
    items = [],
    isFocused = true,
    initialIndex = 0,
    indicatorComponent = Indicator_1.default,
    itemComponent = Item_1.default,
    limit: customLimit,
    onSelect,
    onHighlight
  }) => {
    const [rotateIndex, setRotateIndex] = react_1.useState(0);
    const [selectedIndex, setSelectedIndex] = react_1.useState(initialIndex);
    const hasLimit = typeof customLimit === 'number' && items.length > customLimit;
    const limit = hasLimit ? Math.min(customLimit, items.length) : items.length;
    const previousItems = react_1.useRef(items);
    react_1.useEffect(() => {
      if (!lodash.isEqual(previousItems.current, items)) {
        setRotateIndex(0);
        setSelectedIndex(0);
      }
  
      previousItems.current = items;
    }, [items]);
    build$1.useInput(react_1.useCallback((input, key) => {
      if (input === 'k' || key.upArrow) {
        const lastIndex = (hasLimit ? limit : items.length) - 1;
        const atFirstIndex = selectedIndex === 0;
        const nextIndex = hasLimit ? selectedIndex : lastIndex;
        const nextRotateIndex = atFirstIndex ? rotateIndex + 1 : rotateIndex;
        const nextSelectedIndex = atFirstIndex ? nextIndex : selectedIndex - 1;
        setRotateIndex(nextRotateIndex);
        setSelectedIndex(nextSelectedIndex);
        const slicedItems = hasLimit ? arrRotate(items, nextRotateIndex).slice(0, limit) : items;
  
        if (typeof onHighlight === 'function') {
          onHighlight(slicedItems[nextSelectedIndex]);
        }
      }
  
      if (input === 'j' || key.downArrow) {
        const atLastIndex = selectedIndex === (hasLimit ? limit : items.length) - 1;
        const nextIndex = hasLimit ? selectedIndex : 0;
        const nextRotateIndex = atLastIndex ? rotateIndex - 1 : rotateIndex;
        const nextSelectedIndex = atLastIndex ? nextIndex : selectedIndex + 1;
        setRotateIndex(nextRotateIndex);
        setSelectedIndex(nextSelectedIndex);
        const slicedItems = hasLimit ? arrRotate(items, nextRotateIndex).slice(0, limit) : items;
  
        if (typeof onHighlight === 'function') {
          onHighlight(slicedItems[nextSelectedIndex]);
        }
      }
  
      if (key.return) {
        const slicedItems = hasLimit ? arrRotate(items, rotateIndex).slice(0, limit) : items;
  
        if (typeof onSelect === 'function') {
          onSelect(slicedItems[selectedIndex]);
        }
      }
    }, [hasLimit, limit, rotateIndex, selectedIndex, items, onSelect, onHighlight]), {
      isActive: isFocused
    });
    const slicedItems = hasLimit ? arrRotate(items, rotateIndex).slice(0, limit) : items;
    return React$1__default.createElement(build$1.Box, {
      flexDirection: "column"
    }, slicedItems.map((item, index) => {
      var _a;
  
      const isSelected = index === selectedIndex;
      return React$1__default.createElement(build$1.Box, {
        key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value
      }, React$1__default.createElement(indicatorComponent, {
        isSelected
      }), React$1__default.createElement(itemComponent, { ...item,
        isSelected
      }));
    }));
  };
  
  exports.default = SelectInput;
  });
  
  var build$2 = createCommonjsModule(function (module, exports) {
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  
  
  exports.default = SelectInput_1.default;
  
  
  
  Object.defineProperty(exports, "Indicator", {
    enumerable: true,
    get: function () {
      return Indicator_1.default;
    }
  });
  
  
  
  Object.defineProperty(exports, "Item", {
    enumerable: true,
    get: function () {
      return Item_1.default;
    }
  });
  });
  
  var dots = {
  	interval: 80,
  	frames: [
  		"⠋",
  		"⠙",
  		"⠹",
  		"⠸",
  		"⠼",
  		"⠴",
  		"⠦",
  		"⠧",
  		"⠇",
  		"⠏"
  	]
  };
  var dots2 = {
  	interval: 80,
  	frames: [
  		"⣾",
  		"⣽",
  		"⣻",
  		"⢿",
  		"⡿",
  		"⣟",
  		"⣯",
  		"⣷"
  	]
  };
  var dots3 = {
  	interval: 80,
  	frames: [
  		"⠋",
  		"⠙",
  		"⠚",
  		"⠞",
  		"⠖",
  		"⠦",
  		"⠴",
  		"⠲",
  		"⠳",
  		"⠓"
  	]
  };
  var dots4 = {
  	interval: 80,
  	frames: [
  		"⠄",
  		"⠆",
  		"⠇",
  		"⠋",
  		"⠙",
  		"⠸",
  		"⠰",
  		"⠠",
  		"⠰",
  		"⠸",
  		"⠙",
  		"⠋",
  		"⠇",
  		"⠆"
  	]
  };
  var dots5 = {
  	interval: 80,
  	frames: [
  		"⠋",
  		"⠙",
  		"⠚",
  		"⠒",
  		"⠂",
  		"⠂",
  		"⠒",
  		"⠲",
  		"⠴",
  		"⠦",
  		"⠖",
  		"⠒",
  		"⠐",
  		"⠐",
  		"⠒",
  		"⠓",
  		"⠋"
  	]
  };
  var dots6 = {
  	interval: 80,
  	frames: [
  		"⠁",
  		"⠉",
  		"⠙",
  		"⠚",
  		"⠒",
  		"⠂",
  		"⠂",
  		"⠒",
  		"⠲",
  		"⠴",
  		"⠤",
  		"⠄",
  		"⠄",
  		"⠤",
  		"⠴",
  		"⠲",
  		"⠒",
  		"⠂",
  		"⠂",
  		"⠒",
  		"⠚",
  		"⠙",
  		"⠉",
  		"⠁"
  	]
  };
  var dots7 = {
  	interval: 80,
  	frames: [
  		"⠈",
  		"⠉",
  		"⠋",
  		"⠓",
  		"⠒",
  		"⠐",
  		"⠐",
  		"⠒",
  		"⠖",
  		"⠦",
  		"⠤",
  		"⠠",
  		"⠠",
  		"⠤",
  		"⠦",
  		"⠖",
  		"⠒",
  		"⠐",
  		"⠐",
  		"⠒",
  		"⠓",
  		"⠋",
  		"⠉",
  		"⠈"
  	]
  };
  var dots8 = {
  	interval: 80,
  	frames: [
  		"⠁",
  		"⠁",
  		"⠉",
  		"⠙",
  		"⠚",
  		"⠒",
  		"⠂",
  		"⠂",
  		"⠒",
  		"⠲",
  		"⠴",
  		"⠤",
  		"⠄",
  		"⠄",
  		"⠤",
  		"⠠",
  		"⠠",
  		"⠤",
  		"⠦",
  		"⠖",
  		"⠒",
  		"⠐",
  		"⠐",
  		"⠒",
  		"⠓",
  		"⠋",
  		"⠉",
  		"⠈",
  		"⠈"
  	]
  };
  var dots9 = {
  	interval: 80,
  	frames: [
  		"⢹",
  		"⢺",
  		"⢼",
  		"⣸",
  		"⣇",
  		"⡧",
  		"⡗",
  		"⡏"
  	]
  };
  var dots10 = {
  	interval: 80,
  	frames: [
  		"⢄",
  		"⢂",
  		"⢁",
  		"⡁",
  		"⡈",
  		"⡐",
  		"⡠"
  	]
  };
  var dots11 = {
  	interval: 100,
  	frames: [
  		"⠁",
  		"⠂",
  		"⠄",
  		"⡀",
  		"⢀",
  		"⠠",
  		"⠐",
  		"⠈"
  	]
  };
  var dots12 = {
  	interval: 80,
  	frames: [
  		"⢀⠀",
  		"⡀⠀",
  		"⠄⠀",
  		"⢂⠀",
  		"⡂⠀",
  		"⠅⠀",
  		"⢃⠀",
  		"⡃⠀",
  		"⠍⠀",
  		"⢋⠀",
  		"⡋⠀",
  		"⠍⠁",
  		"⢋⠁",
  		"⡋⠁",
  		"⠍⠉",
  		"⠋⠉",
  		"⠋⠉",
  		"⠉⠙",
  		"⠉⠙",
  		"⠉⠩",
  		"⠈⢙",
  		"⠈⡙",
  		"⢈⠩",
  		"⡀⢙",
  		"⠄⡙",
  		"⢂⠩",
  		"⡂⢘",
  		"⠅⡘",
  		"⢃⠨",
  		"⡃⢐",
  		"⠍⡐",
  		"⢋⠠",
  		"⡋⢀",
  		"⠍⡁",
  		"⢋⠁",
  		"⡋⠁",
  		"⠍⠉",
  		"⠋⠉",
  		"⠋⠉",
  		"⠉⠙",
  		"⠉⠙",
  		"⠉⠩",
  		"⠈⢙",
  		"⠈⡙",
  		"⠈⠩",
  		"⠀⢙",
  		"⠀⡙",
  		"⠀⠩",
  		"⠀⢘",
  		"⠀⡘",
  		"⠀⠨",
  		"⠀⢐",
  		"⠀⡐",
  		"⠀⠠",
  		"⠀⢀",
  		"⠀⡀"
  	]
  };
  var dots8Bit = {
  	interval: 80,
  	frames: [
  		"⠀",
  		"⠁",
  		"⠂",
  		"⠃",
  		"⠄",
  		"⠅",
  		"⠆",
  		"⠇",
  		"⡀",
  		"⡁",
  		"⡂",
  		"⡃",
  		"⡄",
  		"⡅",
  		"⡆",
  		"⡇",
  		"⠈",
  		"⠉",
  		"⠊",
  		"⠋",
  		"⠌",
  		"⠍",
  		"⠎",
  		"⠏",
  		"⡈",
  		"⡉",
  		"⡊",
  		"⡋",
  		"⡌",
  		"⡍",
  		"⡎",
  		"⡏",
  		"⠐",
  		"⠑",
  		"⠒",
  		"⠓",
  		"⠔",
  		"⠕",
  		"⠖",
  		"⠗",
  		"⡐",
  		"⡑",
  		"⡒",
  		"⡓",
  		"⡔",
  		"⡕",
  		"⡖",
  		"⡗",
  		"⠘",
  		"⠙",
  		"⠚",
  		"⠛",
  		"⠜",
  		"⠝",
  		"⠞",
  		"⠟",
  		"⡘",
  		"⡙",
  		"⡚",
  		"⡛",
  		"⡜",
  		"⡝",
  		"⡞",
  		"⡟",
  		"⠠",
  		"⠡",
  		"⠢",
  		"⠣",
  		"⠤",
  		"⠥",
  		"⠦",
  		"⠧",
  		"⡠",
  		"⡡",
  		"⡢",
  		"⡣",
  		"⡤",
  		"⡥",
  		"⡦",
  		"⡧",
  		"⠨",
  		"⠩",
  		"⠪",
  		"⠫",
  		"⠬",
  		"⠭",
  		"⠮",
  		"⠯",
  		"⡨",
  		"⡩",
  		"⡪",
  		"⡫",
  		"⡬",
  		"⡭",
  		"⡮",
  		"⡯",
  		"⠰",
  		"⠱",
  		"⠲",
  		"⠳",
  		"⠴",
  		"⠵",
  		"⠶",
  		"⠷",
  		"⡰",
  		"⡱",
  		"⡲",
  		"⡳",
  		"⡴",
  		"⡵",
  		"⡶",
  		"⡷",
  		"⠸",
  		"⠹",
  		"⠺",
  		"⠻",
  		"⠼",
  		"⠽",
  		"⠾",
  		"⠿",
  		"⡸",
  		"⡹",
  		"⡺",
  		"⡻",
  		"⡼",
  		"⡽",
  		"⡾",
  		"⡿",
  		"⢀",
  		"⢁",
  		"⢂",
  		"⢃",
  		"⢄",
  		"⢅",
  		"⢆",
  		"⢇",
  		"⣀",
  		"⣁",
  		"⣂",
  		"⣃",
  		"⣄",
  		"⣅",
  		"⣆",
  		"⣇",
  		"⢈",
  		"⢉",
  		"⢊",
  		"⢋",
  		"⢌",
  		"⢍",
  		"⢎",
  		"⢏",
  		"⣈",
  		"⣉",
  		"⣊",
  		"⣋",
  		"⣌",
  		"⣍",
  		"⣎",
  		"⣏",
  		"⢐",
  		"⢑",
  		"⢒",
  		"⢓",
  		"⢔",
  		"⢕",
  		"⢖",
  		"⢗",
  		"⣐",
  		"⣑",
  		"⣒",
  		"⣓",
  		"⣔",
  		"⣕",
  		"⣖",
  		"⣗",
  		"⢘",
  		"⢙",
  		"⢚",
  		"⢛",
  		"⢜",
  		"⢝",
  		"⢞",
  		"⢟",
  		"⣘",
  		"⣙",
  		"⣚",
  		"⣛",
  		"⣜",
  		"⣝",
  		"⣞",
  		"⣟",
  		"⢠",
  		"⢡",
  		"⢢",
  		"⢣",
  		"⢤",
  		"⢥",
  		"⢦",
  		"⢧",
  		"⣠",
  		"⣡",
  		"⣢",
  		"⣣",
  		"⣤",
  		"⣥",
  		"⣦",
  		"⣧",
  		"⢨",
  		"⢩",
  		"⢪",
  		"⢫",
  		"⢬",
  		"⢭",
  		"⢮",
  		"⢯",
  		"⣨",
  		"⣩",
  		"⣪",
  		"⣫",
  		"⣬",
  		"⣭",
  		"⣮",
  		"⣯",
  		"⢰",
  		"⢱",
  		"⢲",
  		"⢳",
  		"⢴",
  		"⢵",
  		"⢶",
  		"⢷",
  		"⣰",
  		"⣱",
  		"⣲",
  		"⣳",
  		"⣴",
  		"⣵",
  		"⣶",
  		"⣷",
  		"⢸",
  		"⢹",
  		"⢺",
  		"⢻",
  		"⢼",
  		"⢽",
  		"⢾",
  		"⢿",
  		"⣸",
  		"⣹",
  		"⣺",
  		"⣻",
  		"⣼",
  		"⣽",
  		"⣾",
  		"⣿"
  	]
  };
  var line = {
  	interval: 130,
  	frames: [
  		"-",
  		"\\",
  		"|",
  		"/"
  	]
  };
  var line2 = {
  	interval: 100,
  	frames: [
  		"⠂",
  		"-",
  		"–",
  		"—",
  		"–",
  		"-"
  	]
  };
  var pipe = {
  	interval: 100,
  	frames: [
  		"┤",
  		"┘",
  		"┴",
  		"└",
  		"├",
  		"┌",
  		"┬",
  		"┐"
  	]
  };
  var simpleDots = {
  	interval: 400,
  	frames: [
  		".  ",
  		".. ",
  		"...",
  		"   "
  	]
  };
  var simpleDotsScrolling = {
  	interval: 200,
  	frames: [
  		".  ",
  		".. ",
  		"...",
  		" ..",
  		"  .",
  		"   "
  	]
  };
  var star = {
  	interval: 70,
  	frames: [
  		"✶",
  		"✸",
  		"✹",
  		"✺",
  		"✹",
  		"✷"
  	]
  };
  var star2 = {
  	interval: 80,
  	frames: [
  		"+",
  		"x",
  		"*"
  	]
  };
  var flip = {
  	interval: 70,
  	frames: [
  		"_",
  		"_",
  		"_",
  		"-",
  		"`",
  		"`",
  		"'",
  		"´",
  		"-",
  		"_",
  		"_",
  		"_"
  	]
  };
  var hamburger = {
  	interval: 100,
  	frames: [
  		"☱",
  		"☲",
  		"☴"
  	]
  };
  var growVertical = {
  	interval: 120,
  	frames: [
  		"▁",
  		"▃",
  		"▄",
  		"▅",
  		"▆",
  		"▇",
  		"▆",
  		"▅",
  		"▄",
  		"▃"
  	]
  };
  var growHorizontal = {
  	interval: 120,
  	frames: [
  		"▏",
  		"▎",
  		"▍",
  		"▌",
  		"▋",
  		"▊",
  		"▉",
  		"▊",
  		"▋",
  		"▌",
  		"▍",
  		"▎"
  	]
  };
  var balloon = {
  	interval: 140,
  	frames: [
  		" ",
  		".",
  		"o",
  		"O",
  		"@",
  		"*",
  		" "
  	]
  };
  var balloon2 = {
  	interval: 120,
  	frames: [
  		".",
  		"o",
  		"O",
  		"°",
  		"O",
  		"o",
  		"."
  	]
  };
  var noise = {
  	interval: 100,
  	frames: [
  		"▓",
  		"▒",
  		"░"
  	]
  };
  var bounce = {
  	interval: 120,
  	frames: [
  		"⠁",
  		"⠂",
  		"⠄",
  		"⠂"
  	]
  };
  var boxBounce = {
  	interval: 120,
  	frames: [
  		"▖",
  		"▘",
  		"▝",
  		"▗"
  	]
  };
  var boxBounce2 = {
  	interval: 100,
  	frames: [
  		"▌",
  		"▀",
  		"▐",
  		"▄"
  	]
  };
  var triangle = {
  	interval: 50,
  	frames: [
  		"◢",
  		"◣",
  		"◤",
  		"◥"
  	]
  };
  var arc = {
  	interval: 100,
  	frames: [
  		"◜",
  		"◠",
  		"◝",
  		"◞",
  		"◡",
  		"◟"
  	]
  };
  var circle = {
  	interval: 120,
  	frames: [
  		"◡",
  		"⊙",
  		"◠"
  	]
  };
  var squareCorners = {
  	interval: 180,
  	frames: [
  		"◰",
  		"◳",
  		"◲",
  		"◱"
  	]
  };
  var circleQuarters = {
  	interval: 120,
  	frames: [
  		"◴",
  		"◷",
  		"◶",
  		"◵"
  	]
  };
  var circleHalves = {
  	interval: 50,
  	frames: [
  		"◐",
  		"◓",
  		"◑",
  		"◒"
  	]
  };
  var squish = {
  	interval: 100,
  	frames: [
  		"╫",
  		"╪"
  	]
  };
  var toggle = {
  	interval: 250,
  	frames: [
  		"⊶",
  		"⊷"
  	]
  };
  var toggle2 = {
  	interval: 80,
  	frames: [
  		"▫",
  		"▪"
  	]
  };
  var toggle3 = {
  	interval: 120,
  	frames: [
  		"□",
  		"■"
  	]
  };
  var toggle4 = {
  	interval: 100,
  	frames: [
  		"■",
  		"□",
  		"▪",
  		"▫"
  	]
  };
  var toggle5 = {
  	interval: 100,
  	frames: [
  		"▮",
  		"▯"
  	]
  };
  var toggle6 = {
  	interval: 300,
  	frames: [
  		"ဝ",
  		"၀"
  	]
  };
  var toggle7 = {
  	interval: 80,
  	frames: [
  		"⦾",
  		"⦿"
  	]
  };
  var toggle8 = {
  	interval: 100,
  	frames: [
  		"◍",
  		"◌"
  	]
  };
  var toggle9 = {
  	interval: 100,
  	frames: [
  		"◉",
  		"◎"
  	]
  };
  var toggle10 = {
  	interval: 100,
  	frames: [
  		"㊂",
  		"㊀",
  		"㊁"
  	]
  };
  var toggle11 = {
  	interval: 50,
  	frames: [
  		"⧇",
  		"⧆"
  	]
  };
  var toggle12 = {
  	interval: 120,
  	frames: [
  		"☗",
  		"☖"
  	]
  };
  var toggle13 = {
  	interval: 80,
  	frames: [
  		"=",
  		"*",
  		"-"
  	]
  };
  var arrow = {
  	interval: 100,
  	frames: [
  		"←",
  		"↖",
  		"↑",
  		"↗",
  		"→",
  		"↘",
  		"↓",
  		"↙"
  	]
  };
  var arrow2 = {
  	interval: 80,
  	frames: [
  		"⬆️ ",
  		"↗️ ",
  		"➡️ ",
  		"↘️ ",
  		"⬇️ ",
  		"↙️ ",
  		"⬅️ ",
  		"↖️ "
  	]
  };
  var arrow3 = {
  	interval: 120,
  	frames: [
  		"▹▹▹▹▹",
  		"▸▹▹▹▹",
  		"▹▸▹▹▹",
  		"▹▹▸▹▹",
  		"▹▹▹▸▹",
  		"▹▹▹▹▸"
  	]
  };
  var bouncingBar = {
  	interval: 80,
  	frames: [
  		"[    ]",
  		"[=   ]",
  		"[==  ]",
  		"[=== ]",
  		"[ ===]",
  		"[  ==]",
  		"[   =]",
  		"[    ]",
  		"[   =]",
  		"[  ==]",
  		"[ ===]",
  		"[====]",
  		"[=== ]",
  		"[==  ]",
  		"[=   ]"
  	]
  };
  var bouncingBall = {
  	interval: 80,
  	frames: [
  		"( ●    )",
  		"(  ●   )",
  		"(   ●  )",
  		"(    ● )",
  		"(     ●)",
  		"(    ● )",
  		"(   ●  )",
  		"(  ●   )",
  		"( ●    )",
  		"(●     )"
  	]
  };
  var smiley = {
  	interval: 200,
  	frames: [
  		"😄 ",
  		"😝 "
  	]
  };
  var monkey = {
  	interval: 300,
  	frames: [
  		"🙈 ",
  		"🙈 ",
  		"🙉 ",
  		"🙊 "
  	]
  };
  var hearts = {
  	interval: 100,
  	frames: [
  		"💛 ",
  		"💙 ",
  		"💜 ",
  		"💚 ",
  		"❤️ "
  	]
  };
  var clock = {
  	interval: 100,
  	frames: [
  		"🕛 ",
  		"🕐 ",
  		"🕑 ",
  		"🕒 ",
  		"🕓 ",
  		"🕔 ",
  		"🕕 ",
  		"🕖 ",
  		"🕗 ",
  		"🕘 ",
  		"🕙 ",
  		"🕚 "
  	]
  };
  var earth = {
  	interval: 180,
  	frames: [
  		"🌍 ",
  		"🌎 ",
  		"🌏 "
  	]
  };
  var material = {
  	interval: 17,
  	frames: [
  		"█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"███████▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"████████▁▁▁▁▁▁▁▁▁▁▁▁",
  		"█████████▁▁▁▁▁▁▁▁▁▁▁",
  		"█████████▁▁▁▁▁▁▁▁▁▁▁",
  		"██████████▁▁▁▁▁▁▁▁▁▁",
  		"███████████▁▁▁▁▁▁▁▁▁",
  		"█████████████▁▁▁▁▁▁▁",
  		"██████████████▁▁▁▁▁▁",
  		"██████████████▁▁▁▁▁▁",
  		"▁██████████████▁▁▁▁▁",
  		"▁██████████████▁▁▁▁▁",
  		"▁██████████████▁▁▁▁▁",
  		"▁▁██████████████▁▁▁▁",
  		"▁▁▁██████████████▁▁▁",
  		"▁▁▁▁█████████████▁▁▁",
  		"▁▁▁▁██████████████▁▁",
  		"▁▁▁▁██████████████▁▁",
  		"▁▁▁▁▁██████████████▁",
  		"▁▁▁▁▁██████████████▁",
  		"▁▁▁▁▁██████████████▁",
  		"▁▁▁▁▁▁██████████████",
  		"▁▁▁▁▁▁██████████████",
  		"▁▁▁▁▁▁▁█████████████",
  		"▁▁▁▁▁▁▁█████████████",
  		"▁▁▁▁▁▁▁▁████████████",
  		"▁▁▁▁▁▁▁▁████████████",
  		"▁▁▁▁▁▁▁▁▁███████████",
  		"▁▁▁▁▁▁▁▁▁███████████",
  		"▁▁▁▁▁▁▁▁▁▁██████████",
  		"▁▁▁▁▁▁▁▁▁▁██████████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁████████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
  		"█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
  		"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
  		"██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
  		"███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
  		"████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
  		"█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
  		"█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
  		"██████▁▁▁▁▁▁▁▁▁▁▁▁▁█",
  		"████████▁▁▁▁▁▁▁▁▁▁▁▁",
  		"█████████▁▁▁▁▁▁▁▁▁▁▁",
  		"█████████▁▁▁▁▁▁▁▁▁▁▁",
  		"█████████▁▁▁▁▁▁▁▁▁▁▁",
  		"█████████▁▁▁▁▁▁▁▁▁▁▁",
  		"███████████▁▁▁▁▁▁▁▁▁",
  		"████████████▁▁▁▁▁▁▁▁",
  		"████████████▁▁▁▁▁▁▁▁",
  		"██████████████▁▁▁▁▁▁",
  		"██████████████▁▁▁▁▁▁",
  		"▁██████████████▁▁▁▁▁",
  		"▁██████████████▁▁▁▁▁",
  		"▁▁▁█████████████▁▁▁▁",
  		"▁▁▁▁▁████████████▁▁▁",
  		"▁▁▁▁▁████████████▁▁▁",
  		"▁▁▁▁▁▁███████████▁▁▁",
  		"▁▁▁▁▁▁▁▁█████████▁▁▁",
  		"▁▁▁▁▁▁▁▁█████████▁▁▁",
  		"▁▁▁▁▁▁▁▁▁█████████▁▁",
  		"▁▁▁▁▁▁▁▁▁█████████▁▁",
  		"▁▁▁▁▁▁▁▁▁▁█████████▁",
  		"▁▁▁▁▁▁▁▁▁▁▁████████▁",
  		"▁▁▁▁▁▁▁▁▁▁▁████████▁",
  		"▁▁▁▁▁▁▁▁▁▁▁▁███████▁",
  		"▁▁▁▁▁▁▁▁▁▁▁▁███████▁",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁███████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁",
  		"▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
  	]
  };
  var moon = {
  	interval: 80,
  	frames: [
  		"🌑 ",
  		"🌒 ",
  		"🌓 ",
  		"🌔 ",
  		"🌕 ",
  		"🌖 ",
  		"🌗 ",
  		"🌘 "
  	]
  };
  var runner = {
  	interval: 140,
  	frames: [
  		"🚶 ",
  		"🏃 "
  	]
  };
  var pong = {
  	interval: 80,
  	frames: [
  		"▐⠂       ▌",
  		"▐⠈       ▌",
  		"▐ ⠂      ▌",
  		"▐ ⠠      ▌",
  		"▐  ⡀     ▌",
  		"▐  ⠠     ▌",
  		"▐   ⠂    ▌",
  		"▐   ⠈    ▌",
  		"▐    ⠂   ▌",
  		"▐    ⠠   ▌",
  		"▐     ⡀  ▌",
  		"▐     ⠠  ▌",
  		"▐      ⠂ ▌",
  		"▐      ⠈ ▌",
  		"▐       ⠂▌",
  		"▐       ⠠▌",
  		"▐       ⡀▌",
  		"▐      ⠠ ▌",
  		"▐      ⠂ ▌",
  		"▐     ⠈  ▌",
  		"▐     ⠂  ▌",
  		"▐    ⠠   ▌",
  		"▐    ⡀   ▌",
  		"▐   ⠠    ▌",
  		"▐   ⠂    ▌",
  		"▐  ⠈     ▌",
  		"▐  ⠂     ▌",
  		"▐ ⠠      ▌",
  		"▐ ⡀      ▌",
  		"▐⠠       ▌"
  	]
  };
  var shark = {
  	interval: 120,
  	frames: [
  		"▐|\\____________▌",
  		"▐_|\\___________▌",
  		"▐__|\\__________▌",
  		"▐___|\\_________▌",
  		"▐____|\\________▌",
  		"▐_____|\\_______▌",
  		"▐______|\\______▌",
  		"▐_______|\\_____▌",
  		"▐________|\\____▌",
  		"▐_________|\\___▌",
  		"▐__________|\\__▌",
  		"▐___________|\\_▌",
  		"▐____________|\\▌",
  		"▐____________/|▌",
  		"▐___________/|_▌",
  		"▐__________/|__▌",
  		"▐_________/|___▌",
  		"▐________/|____▌",
  		"▐_______/|_____▌",
  		"▐______/|______▌",
  		"▐_____/|_______▌",
  		"▐____/|________▌",
  		"▐___/|_________▌",
  		"▐__/|__________▌",
  		"▐_/|___________▌",
  		"▐/|____________▌"
  	]
  };
  var dqpb = {
  	interval: 100,
  	frames: [
  		"d",
  		"q",
  		"p",
  		"b"
  	]
  };
  var weather = {
  	interval: 100,
  	frames: [
  		"☀️ ",
  		"☀️ ",
  		"☀️ ",
  		"🌤 ",
  		"⛅️ ",
  		"🌥 ",
  		"☁️ ",
  		"🌧 ",
  		"🌨 ",
  		"🌧 ",
  		"🌨 ",
  		"🌧 ",
  		"🌨 ",
  		"⛈ ",
  		"🌨 ",
  		"🌧 ",
  		"🌨 ",
  		"☁️ ",
  		"🌥 ",
  		"⛅️ ",
  		"🌤 ",
  		"☀️ ",
  		"☀️ "
  	]
  };
  var christmas = {
  	interval: 400,
  	frames: [
  		"🌲",
  		"🎄"
  	]
  };
  var grenade = {
  	interval: 80,
  	frames: [
  		"،   ",
  		"′   ",
  		" ´ ",
  		" ‾ ",
  		"  ⸌",
  		"  ⸊",
  		"  |",
  		"  ⁎",
  		"  ⁕",
  		" ෴ ",
  		"  ⁓",
  		"   ",
  		"   ",
  		"   "
  	]
  };
  var point = {
  	interval: 125,
  	frames: [
  		"∙∙∙",
  		"●∙∙",
  		"∙●∙",
  		"∙∙●",
  		"∙∙∙"
  	]
  };
  var layer = {
  	interval: 150,
  	frames: [
  		"-",
  		"=",
  		"≡"
  	]
  };
  var betaWave = {
  	interval: 80,
  	frames: [
  		"ρββββββ",
  		"βρβββββ",
  		"ββρββββ",
  		"βββρβββ",
  		"ββββρββ",
  		"βββββρβ",
  		"ββββββρ"
  	]
  };
  var spinners = {
  	dots: dots,
  	dots2: dots2,
  	dots3: dots3,
  	dots4: dots4,
  	dots5: dots5,
  	dots6: dots6,
  	dots7: dots7,
  	dots8: dots8,
  	dots9: dots9,
  	dots10: dots10,
  	dots11: dots11,
  	dots12: dots12,
  	dots8Bit: dots8Bit,
  	line: line,
  	line2: line2,
  	pipe: pipe,
  	simpleDots: simpleDots,
  	simpleDotsScrolling: simpleDotsScrolling,
  	star: star,
  	star2: star2,
  	flip: flip,
  	hamburger: hamburger,
  	growVertical: growVertical,
  	growHorizontal: growHorizontal,
  	balloon: balloon,
  	balloon2: balloon2,
  	noise: noise,
  	bounce: bounce,
  	boxBounce: boxBounce,
  	boxBounce2: boxBounce2,
  	triangle: triangle,
  	arc: arc,
  	circle: circle,
  	squareCorners: squareCorners,
  	circleQuarters: circleQuarters,
  	circleHalves: circleHalves,
  	squish: squish,
  	toggle: toggle,
  	toggle2: toggle2,
  	toggle3: toggle3,
  	toggle4: toggle4,
  	toggle5: toggle5,
  	toggle6: toggle6,
  	toggle7: toggle7,
  	toggle8: toggle8,
  	toggle9: toggle9,
  	toggle10: toggle10,
  	toggle11: toggle11,
  	toggle12: toggle12,
  	toggle13: toggle13,
  	arrow: arrow,
  	arrow2: arrow2,
  	arrow3: arrow3,
  	bouncingBar: bouncingBar,
  	bouncingBall: bouncingBall,
  	smiley: smiley,
  	monkey: monkey,
  	hearts: hearts,
  	clock: clock,
  	earth: earth,
  	material: material,
  	moon: moon,
  	runner: runner,
  	pong: pong,
  	shark: shark,
  	dqpb: dqpb,
  	weather: weather,
  	christmas: christmas,
  	grenade: grenade,
  	point: point,
  	layer: layer,
  	betaWave: betaWave
  };
  
  var spinners$1 = /*#__PURE__*/Object.freeze({
  	__proto__: null,
  	dots: dots,
  	dots2: dots2,
  	dots3: dots3,
  	dots4: dots4,
  	dots5: dots5,
  	dots6: dots6,
  	dots7: dots7,
  	dots8: dots8,
  	dots9: dots9,
  	dots10: dots10,
  	dots11: dots11,
  	dots12: dots12,
  	dots8Bit: dots8Bit,
  	line: line,
  	line2: line2,
  	pipe: pipe,
  	simpleDots: simpleDots,
  	simpleDotsScrolling: simpleDotsScrolling,
  	star: star,
  	star2: star2,
  	flip: flip,
  	hamburger: hamburger,
  	growVertical: growVertical,
  	growHorizontal: growHorizontal,
  	balloon: balloon,
  	balloon2: balloon2,
  	noise: noise,
  	bounce: bounce,
  	boxBounce: boxBounce,
  	boxBounce2: boxBounce2,
  	triangle: triangle,
  	arc: arc,
  	circle: circle,
  	squareCorners: squareCorners,
  	circleQuarters: circleQuarters,
  	circleHalves: circleHalves,
  	squish: squish,
  	toggle: toggle,
  	toggle2: toggle2,
  	toggle3: toggle3,
  	toggle4: toggle4,
  	toggle5: toggle5,
  	toggle6: toggle6,
  	toggle7: toggle7,
  	toggle8: toggle8,
  	toggle9: toggle9,
  	toggle10: toggle10,
  	toggle11: toggle11,
  	toggle12: toggle12,
  	toggle13: toggle13,
  	arrow: arrow,
  	arrow2: arrow2,
  	arrow3: arrow3,
  	bouncingBar: bouncingBar,
  	bouncingBall: bouncingBall,
  	smiley: smiley,
  	monkey: monkey,
  	hearts: hearts,
  	clock: clock,
  	earth: earth,
  	material: material,
  	moon: moon,
  	runner: runner,
  	pong: pong,
  	shark: shark,
  	dqpb: dqpb,
  	weather: weather,
  	christmas: christmas,
  	grenade: grenade,
  	point: point,
  	layer: layer,
  	betaWave: betaWave,
  	'default': spinners
  });
  
  var require$$0 = getCjsExportFromNamespace(spinners$1);
  
  const spinners$2 = Object.assign({}, require$$0);
  
  const spinnersList = Object.keys(spinners$2);
  
  Object.defineProperty(spinners$2, 'random', {
  	get() {
  		const randomIndex = Math.floor(Math.random() * spinnersList.length);
  		const spinnerName = spinnersList[randomIndex];
  		return spinners$2[spinnerName];
  	}
  });
  
  var cliSpinners = spinners$2;
  // TODO: Remove this for the next major release
  var _default$c = spinners$2;
  cliSpinners.default = _default$c;
  
  var build$3 = createCommonjsModule(function (module, exports) {
  Object.defineProperty(exports, "__esModule", { value: true });
  
  const react_1 = React$1__default;
  
  
  /**
   * Spinner.
   */
  const Spinner = ({ type = 'dots' }) => {
      const [frame, setFrame] = react_1.useState(0);
      const spinner = cliSpinners.default[type];
      react_1.useEffect(() => {
          const timer = setInterval(() => {
              setFrame(previousFrame => {
                  const isLastFrame = previousFrame === spinner.frames.length - 1;
                  return isLastFrame ? 0 : previousFrame + 1;
              });
          }, spinner.interval);
          return () => {
              clearInterval(timer);
          };
      }, [spinner]);
      return React$1__default.createElement(build$1.Text, null, spinner.frames[frame]);
  };
  exports.default = Spinner;
  });
  
  const InputContext = /*#__PURE__*/React$1__default.createContext({});
  const useInputByKey = key => {
    const context = React$1.useContext(InputContext) || {};
    const result = context[key];
    return result === null || result === void 0 ? void 0 : result.value;
  };
  const useInput = ({
    type = `text`,
    label,
    key = `123`
  }) => {
    const contextVal = useInputByKey(key) || ``;
    const [val, setVal] = React$1.useState(contextVal);
  
    const Input = props => /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("label", null, label), /*#__PURE__*/React$1__default.createElement("input", _extends_1({}, props, {
      type: type,
      value: val,
      onChange: e => setVal(e.target.value)
    })));
  
    return [Input, val];
  };
  const InputProvider = InputContext.Provider;
  
  const ResourceContext = /*#__PURE__*/React$1__default.createContext([]);
  const useResource = key => {
    const context = React$1.useContext(ResourceContext);
    const result = context.find(c => c.resourceDefinitions._key === key);
    return result || {};
  };
  const useResourceByUUID = uuid => {
    const context = React$1.useContext(ResourceContext);
    const result = context.find(c => c._uuid === uuid);
    return result;
  };
  const ResourceProvider = ResourceContext.Provider;
  
  // this file has the best name
  const useProvider = provider => {
    // const context = useContext(ResourceContext)
    // const result = context.find(c => c.resourceDefinitions._key === key)
    // return result
    const providers = {
      contentful: {
        accessToken: process.env.CONTENTFUL_ACCESS_TOKEN
      }
    };
    return providers[provider];
  }; // export const ResourceProvider = ResourceContext.Provider
  
  const transformCodeForEval = jsx => `${jsx}
  
    return React.createElement(MDXProvider, { components },
      React.createElement(MDXContent, props)
    );`;
  
  var StepRenderer = (({
    children: srcCode,
    scope,
    components,
    ...props
  }) => {
    const fullScope = {
      mdx: react.mdx,
      MDXProvider: react.MDXProvider,
      React: React$1__default,
      // need to pass both so that we can guarantee the components we need are passed to MDXProvider for shortcodes and we also need some components to be in direct scope
      ...components,
      components,
      props,
      useInput,
      useInputByKey,
      useResource,
      useProvider,
      ...scope
    };
    const scopeKeys = Object.keys(fullScope);
    const scopeValues = Object.values(fullScope);
    const fn = new Function(...scopeKeys, transformCodeForEval(srcCode));
    return fn(...scopeValues);
  });
  
  var ansiEscapes_1$1 = createCommonjsModule(function (module) {
  
  const ansiEscapes = module.exports; // TODO: remove this in the next major version
  
  module.exports.default = ansiEscapes;
  const ESC = '\u001B[';
  const OSC = '\u001B]';
  const BEL = '\u0007';
  const SEP = ';';
  const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
  
  ansiEscapes.cursorTo = (x, y) => {
    if (typeof x !== 'number') {
      throw new TypeError('The `x` argument is required');
    }
  
    if (typeof y !== 'number') {
      return ESC + (x + 1) + 'G';
    }
  
    return ESC + (y + 1) + ';' + (x + 1) + 'H';
  };
  
  ansiEscapes.cursorMove = (x, y) => {
    if (typeof x !== 'number') {
      throw new TypeError('The `x` argument is required');
    }
  
    let ret = '';
  
    if (x < 0) {
      ret += ESC + -x + 'D';
    } else if (x > 0) {
      ret += ESC + x + 'C';
    }
  
    if (y < 0) {
      ret += ESC + -y + 'A';
    } else if (y > 0) {
      ret += ESC + y + 'B';
    }
  
    return ret;
  };
  
  ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
  
  ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
  
  ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
  
  ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
  
  ansiEscapes.cursorLeft = ESC + 'G';
  ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
  ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
  ansiEscapes.cursorGetPosition = ESC + '6n';
  ansiEscapes.cursorNextLine = ESC + 'E';
  ansiEscapes.cursorPrevLine = ESC + 'F';
  ansiEscapes.cursorHide = ESC + '?25l';
  ansiEscapes.cursorShow = ESC + '?25h';
  
  ansiEscapes.eraseLines = count => {
    let clear = '';
  
    for (let i = 0; i < count; i++) {
      clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
    }
  
    if (count) {
      clear += ansiEscapes.cursorLeft;
    }
  
    return clear;
  };
  
  ansiEscapes.eraseEndLine = ESC + 'K';
  ansiEscapes.eraseStartLine = ESC + '1K';
  ansiEscapes.eraseLine = ESC + '2K';
  ansiEscapes.eraseDown = ESC + 'J';
  ansiEscapes.eraseUp = ESC + '1J';
  ansiEscapes.eraseScreen = ESC + '2J';
  ansiEscapes.scrollUp = ESC + 'S';
  ansiEscapes.scrollDown = ESC + 'T';
  ansiEscapes.clearScreen = '\u001Bc';
  ansiEscapes.clearTerminal = process.platform === 'win32' ? `${ansiEscapes.eraseScreen}${ESC}0f` : // 1. Erases the screen (Only done in case `2` is not supported)
  // 2. Erases the whole screen including scrollback buffer
  // 3. Moves cursor to the top-left position
  // More info: https://www.real-world-systems.com/docs/ANSIcode.html
  `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
  ansiEscapes.beep = BEL;
  
  ansiEscapes.link = (text, url) => {
    return [OSC, '8', SEP, SEP, url, BEL, text, OSC, '8', SEP, SEP, BEL].join('');
  };
  
  ansiEscapes.image = (buffer, options = {}) => {
    let ret = `${OSC}1337;File=inline=1`;
  
    if (options.width) {
      ret += `;width=${options.width}`;
    }
  
    if (options.height) {
      ret += `;height=${options.height}`;
    }
  
    if (options.preserveAspectRatio === false) {
      ret += ';preserveAspectRatio=0';
    }
  
    return ret + ':' + buffer.toString('base64') + BEL;
  };
  
  ansiEscapes.iTerm = {
    setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`
  };
  });
  
  var hasFlag$1 = (flag, argv = process.argv) => {
    const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
    const position = argv.indexOf(prefix + flag);
    const terminatorPosition = argv.indexOf('--');
    return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
  };
  
  const {
    env: env$1
  } = process;
  let forceColor$1;
  
  if (hasFlag$1('no-color') || hasFlag$1('no-colors') || hasFlag$1('color=false') || hasFlag$1('color=never')) {
    forceColor$1 = 0;
  } else if (hasFlag$1('color') || hasFlag$1('colors') || hasFlag$1('color=true') || hasFlag$1('color=always')) {
    forceColor$1 = 1;
  }
  
  if ('FORCE_COLOR' in env$1) {
    if (env$1.FORCE_COLOR === 'true') {
      forceColor$1 = 1;
    } else if (env$1.FORCE_COLOR === 'false') {
      forceColor$1 = 0;
    } else {
      forceColor$1 = env$1.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$1.FORCE_COLOR, 10), 3);
    }
  }
  
  function translateLevel$1(level) {
    if (level === 0) {
      return false;
    }
  
    return {
      level,
      hasBasic: true,
      has256: level >= 2,
      has16m: level >= 3
    };
  }
  
  function supportsColor$1(haveStream, streamIsTTY) {
    if (forceColor$1 === 0) {
      return 0;
    }
  
    if (hasFlag$1('color=16m') || hasFlag$1('color=full') || hasFlag$1('color=truecolor')) {
      return 3;
    }
  
    if (hasFlag$1('color=256')) {
      return 2;
    }
  
    if (haveStream && !streamIsTTY && forceColor$1 === undefined) {
      return 0;
    }
  
    const min = forceColor$1 || 0;
  
    if (env$1.TERM === 'dumb') {
      return min;
    }
  
    if (process.platform === 'win32') {
      // Windows 10 build 10586 is the first Windows release that supports 256 colors.
      // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
      const osRelease = os.release().split('.');
  
      if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
        return Number(osRelease[2]) >= 14931 ? 3 : 2;
      }
  
      return 1;
    }
  
    if ('CI' in env$1) {
      if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') {
        return 1;
      }
  
      return min;
    }
  
    if ('TEAMCITY_VERSION' in env$1) {
      return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
    }
  
    if ('GITHUB_ACTIONS' in env$1) {
      return 1;
    }
  
    if (env$1.COLORTERM === 'truecolor') {
      return 3;
    }
  
    if ('TERM_PROGRAM' in env$1) {
      const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
  
      switch (env$1.TERM_PROGRAM) {
        case 'iTerm.app':
          return version >= 3 ? 3 : 2;
  
        case 'Apple_Terminal':
          return 2;
        // No default
      }
    }
  
    if (/-256(color)?$/i.test(env$1.TERM)) {
      return 2;
    }
  
    if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
      return 1;
    }
  
    if ('COLORTERM' in env$1) {
      return 1;
    }
  
    return min;
  }
  
  function getSupportLevel$1(stream) {
    const level = supportsColor$1(stream, stream && stream.isTTY);
    return translateLevel$1(level);
  }
  
  var supportsColor_1$1 = {
    supportsColor: getSupportLevel$1,
    stdout: translateLevel$1(supportsColor$1(true, tty.isatty(1))),
    stderr: translateLevel$1(supportsColor$1(true, tty.isatty(2)))
  };
  
  function parseVersion(versionString) {
    if (/^\d{3,4}$/.test(versionString)) {
      // Env var doesn't always use dots. example: 4601 => 46.1.0
      const m = /(\d{1,2})(\d{2})/.exec(versionString);
      return {
        major: 0,
        minor: parseInt(m[1], 10),
        patch: parseInt(m[2], 10)
      };
    }
  
    const versions = (versionString || '').split('.').map(n => parseInt(n, 10));
    return {
      major: versions[0],
      minor: versions[1],
      patch: versions[2]
    };
  }
  
  function supportsHyperlink(stream) {
    const {
      env
    } = process;
  
    if ('FORCE_HYPERLINK' in env) {
      return !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);
    }
  
    if (hasFlag$1('no-hyperlink') || hasFlag$1('no-hyperlinks') || hasFlag$1('hyperlink=false') || hasFlag$1('hyperlink=never')) {
      return false;
    }
  
    if (hasFlag$1('hyperlink=true') || hasFlag$1('hyperlink=always')) {
      return true;
    } // If they specify no colors, they probably don't want hyperlinks.
  
  
    if (!supportsColor_1$1.supportsColor(stream)) {
      return false;
    }
  
    if (stream && !stream.isTTY) {
      return false;
    }
  
    if (process.platform === 'win32') {
      return false;
    }
  
    if ('CI' in env) {
      return false;
    }
  
    if ('TEAMCITY_VERSION' in env) {
      return false;
    }
  
    if ('TERM_PROGRAM' in env) {
      const version = parseVersion(env.TERM_PROGRAM_VERSION);
  
      switch (env.TERM_PROGRAM) {
        case 'iTerm.app':
          if (version.major === 3) {
            return version.minor >= 1;
          }
  
          return version.major > 3;
        // No default
      }
    }
  
    if ('VTE_VERSION' in env) {
      // 0.50.0 was supposed to support hyperlinks, but throws a segfault
      if (env.VTE_VERSION === '0.50.0') {
        return false;
      }
  
      const version = parseVersion(env.VTE_VERSION);
      return version.major > 0 || version.minor >= 50;
    }
  
    return false;
  }
  
  var supportsHyperlinks = {
    supportsHyperlink,
    stdout: supportsHyperlink(process.stdout),
    stderr: supportsHyperlink(process.stderr)
  };
  
  var terminalLink_1 = createCommonjsModule(function (module) {
  
  
  
  
  
  const terminalLink = (text, url, {
    target = 'stdout',
    ...options
  } = {}) => {
    if (!supportsHyperlinks[target]) {
      // If the fallback has been explicitly disabled, don't modify the text itself.
      if (options.fallback === false) {
        return text;
      }
  
      return typeof options.fallback === 'function' ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
    }
  
    return ansiEscapes_1$1.link(text, url);
  };
  
  module.exports = (text, url, options = {}) => terminalLink(text, url, options);
  
  module.exports.stderr = (text, url, options = {}) => terminalLink(text, url, {
    target: 'stderr',
    ...options
  });
  
  module.exports.isSupported = supportsHyperlinks.stdout;
  module.exports.stderr.isSupported = supportsHyperlinks.stderr;
  });
  
  const React = require(`react`);
  
  const {
    useState,
    useEffect
  } = require(`react`);
  
  const hicat = require(`hicat`);
  
  const {
    trackCli
  } = require(`gatsby-telemetry`);
  
  const {
    createClient,
    useMutation,
    useSubscription,
    Provider,
    defaultExchanges,
    subscriptionExchange
  } = require(`urql`);
  
  const {
    SubscriptionClient
  } = require(`subscriptions-transport-ws`);
  
  const fetch = require(`node-fetch`);
  
  const ws = require(`ws`);
  
  const semver = require(`semver`);
  
  const remove = require(`unist-util-remove`);
  
  const recipesList = require(`./recipes-list`).default;
  
  const removeJsx = () => tree => {
    remove(tree, `export`, () => true);
    return tree;
  }; // Inline ink-link as it's not upgraded to v3 yet
  
  
  const Link = props => /*#__PURE__*/React.createElement(build$1.Transform, {
    transform: children => terminalLink_1(children, props.url, {
      fallback: props.fallback
    })
  }, /*#__PURE__*/React.createElement(build$1.Text, null, props.children));
  
  Link.propTypes = {
    children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
    url: PropTypes.string,
    fallback: PropTypes.bool
  };
  Link.defaultProps = {
    url: ``,
    fallback: true
  }; // Check for what version of React is loaded & warn if it's too low.
  
  if (semver.lt(React.version, `16.8.0`)) {
    console.log(`Recipes works best with newer versions of React. Please file a bug report if you see this warning.`);
  }
  
  const WelcomeMessage = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(build$1.Box, {
    borderStyle: "double",
    borderColor: "magentaBright",
    padding: 1,
    marginBottom: 1,
    marginLeft: 2,
    marginRight: 2
  }, /*#__PURE__*/React.createElement(build$1.Text, null, "Thank you for trying the experimental version of Gatsby Recipes!")), /*#__PURE__*/React.createElement(Div, {
    marginBottom: 2,
    alignItems: "center"
  }, /*#__PURE__*/React.createElement(build$1.Text, null, "Please ask questions, share your recipes, report bugs, and subscribe for updates in our umbrella issue at https://github.com/gatsbyjs/gatsby/issues/22991")));
  
  const RecipesList = ({
    setRecipe
  }) => {
    const items = recipesList;
    return /*#__PURE__*/React.createElement(build$2.default, {
      items: items,
      onSelect: setRecipe,
      indicatorComponent: item => /*#__PURE__*/React.createElement(build$1.Text, {
        color: item.isSelected ? `yellow` : `magentaBright`
      }, item.isSelected ? `>>` : `  `, item.label),
      itemComponent: props => /*#__PURE__*/React.createElement(build$1.Text, {
        color: "magentaBright"
      }, props.isSelected, ` `, props.label)
    });
  };
  
  const Div = props => /*#__PURE__*/React.createElement(build$1.Box, _extends_1({
    textWrap: "wrap",
    flexDirection: "column",
    marginBottom: 1
  }, props)); // Markdown ignores new lines and so do we.
  
  
  function eliminateNewLines(children) {
    return React.Children.map(children, child => {
      if (!React.isValidElement(child)) {
        return child.replace(/(\r\n|\n|\r)/gm, ` `);
      }
  
      if (child.props.children) {
        child = React.cloneElement(child, {
          children: eliminateNewLines(child.props.children)
        });
      }
  
      return child;
    });
  }
  
  const ResourceComponent = props => {
    var _resource, _resource2, _resource3, _resource4, _resource5;
  
    let resource;
  
    if (props._key) {
      resource = useResource(props._key);
    } else {
      resource = useResourceByUUID(props._uuid);
    }
  
    return /*#__PURE__*/React.createElement(Div, {
      marginBottom: 1
    }, /*#__PURE__*/React.createElement(build$1.Text, {
      color: "yellow",
      backgroundColor: "black",
      bold: true,
      underline: true
    }, resource.resourceName, ":"), /*#__PURE__*/React.createElement(build$1.Text, {
      color: "green"
    }, (_resource = resource) === null || _resource === void 0 ? void 0 : _resource.describe), ((_resource2 = resource) === null || _resource2 === void 0 ? void 0 : _resource2.diff) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(build$1.Text, null, ` `), /*#__PURE__*/React.createElement(build$1.Text, null, (_resource3 = resource) === null || _resource3 === void 0 ? void 0 : _resource3.diff)) : null, ((_resource4 = resource) === null || _resource4 === void 0 ? void 0 : _resource4.error) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(build$1.Text, null, ` `), /*#__PURE__*/React.createElement(build$1.Text, {
      backgroundColor: "#C41E3A",
      color: "white"
    }, (_resource5 = resource) === null || _resource5 === void 0 ? void 0 : _resource5.error)) : null);
  };
  
  const components = {
    inlineCode: props => /*#__PURE__*/React.createElement(build$1.Text, null, "`", props.children, "`"),
    pre: props => /*#__PURE__*/React.createElement(Div, props),
    code: props => {
      // eslint-disable-next-line
      let language = "```";
  
      if (props.className) {
        // eslint-disable-next-line
        language = props.className.split(`-`)[1];
      }
  
      const children = hicat(props.children.trim(), {
        lang: language
      });
      const ansi = `\`\`\`${language}\n${children.ansi}\n\`\`\``;
      return /*#__PURE__*/React.createElement(Div, {
        marginBottom: 1
      }, /*#__PURE__*/React.createElement(build$1.Text, null, ansi));
    },
    h1: props => /*#__PURE__*/React.createElement(build$1.Box, {
      marginBottom: 1
    }, /*#__PURE__*/React.createElement(build$1.Text, _extends_1({
      bold: true,
      underline: true
    }, props))),
    h2: props => /*#__PURE__*/React.createElement(build$1.Text, _extends_1({
      bold: true
    }, props)),
    h3: props => /*#__PURE__*/React.createElement(build$1.Text, _extends_1({
      bold: true,
      italic: true
    }, props)),
    h4: props => /*#__PURE__*/React.createElement(build$1.Text, _extends_1({
      bold: true
    }, props)),
    h5: props => /*#__PURE__*/React.createElement(build$1.Text, _extends_1({
      bold: true
    }, props)),
    h6: props => /*#__PURE__*/React.createElement(build$1.Text, _extends_1({
      bold: true
    }, props)),
    a: ({
      href,
      children
    }) => /*#__PURE__*/React.createElement(Link, {
      url: href
    }, children),
    strong: props => /*#__PURE__*/React.createElement(build$1.Text, _extends_1({
      bold: true
    }, props)),
    em: props => /*#__PURE__*/React.createElement(build$1.Text, _extends_1({
      italic: true
    }, props)),
    p: props => {
      const children = eliminateNewLines(props.children);
      return /*#__PURE__*/React.createElement(Div, null, /*#__PURE__*/React.createElement(build$1.Text, null, children));
    },
    ul: props => /*#__PURE__*/React.createElement(Div, {
      marginBottom: 1
    }, props.children),
    li: props => /*#__PURE__*/React.createElement(build$1.Text, null, "* ", props.children),
    Config: () => null,
    GatsbyPlugin: props => /*#__PURE__*/React.createElement(ResourceComponent, props),
    NPMPackageJson: props => /*#__PURE__*/React.createElement(ResourceComponent, props),
    NPMPackage: props => /*#__PURE__*/React.createElement(ResourceComponent, props),
    File: props => /*#__PURE__*/React.createElement(ResourceComponent, props),
    Directory: props => /*#__PURE__*/React.createElement(ResourceComponent, props),
    GatsbyShadowFile: () => null,
    NPMScript: props => /*#__PURE__*/React.createElement(ResourceComponent, props),
    RecipeIntroduction: props => /*#__PURE__*/React.createElement(Div, props),
    RecipeStep: props => {
      const children = React.Children.toArray(props.children);
      const firstChild = children.shift();
      children.unshift( /*#__PURE__*/React.createElement(build$1.Box, {
        key: "header",
        flexDirection: "row"
      }, /*#__PURE__*/React.createElement(build$1.Text, null, props.step, ")", ` `), firstChild));
      return /*#__PURE__*/React.createElement(Div, null, /*#__PURE__*/React.createElement(build$1.Box, {
        borderStyle: "single",
        padding: 1,
        flexDirection: "column",
        borderColor: "magentaBright"
      }, children));
    },
    div: props => /*#__PURE__*/React.createElement(Div, props)
  };
  var cli = (async ({
    recipe,
    isDevelopMode,
    isInstallMode,
    graphqlPort,
    projectRoot
  }) => {
    try {
      const GRAPHQL_ENDPOINT = `http://localhost:${graphqlPort}/graphql`;
      const subscriptionClient = new SubscriptionClient(`ws://localhost:${graphqlPort}/graphql`, {
        reconnect: true
      }, ws);
      let showRecipesList = false;
  
      if (!recipe) {
        showRecipesList = true;
      }
  
      const client = createClient({
        fetch,
        url: GRAPHQL_ENDPOINT,
        exchanges: [...defaultExchanges, subscriptionExchange({
          forwardSubscription(operation) {
            return subscriptionClient.request(operation);
          }
  
        })]
      });
  
      const Plan = ({
        state,
        localRecipe,
        isDevelopMode
      }) => {
        var _state$context$plan;
  
        const {
          exit
        } = build$1.useApp(); // Exit the app after we render
  
        useEffect(() => {
          if (!isDevelopMode) {
            exit();
          }
        }, []);
        return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResourceProvider // Exclude inputs as they are components (so "plans" currrently
        // (we need to cleanup our names) too like resources which is why we
        // exclude them. The input from the inputs (haha) are ignored unless
        // they're passed as props into a resource component in which case
        // they're validated like normal.
        , {
          value: ((_state$context$plan = state.context.plan) === null || _state$context$plan === void 0 ? void 0 : _state$context$plan.filter(p => p.resourceName !== `Input`)) || []
        }, /*#__PURE__*/React.createElement(WelcomeMessage, null), isDevelopMode ? /*#__PURE__*/React.createElement(build$1.Box, {
          flexDirection: "column",
          marginBottom: 2
        }, /*#__PURE__*/React.createElement(build$1.Text, {
          strong: true,
          underline: true
        }, "DEVELOP MODE")) : null, state.context.stepsAsJS.map((step, i) => {
          var _state$context$export;
  
          return /*#__PURE__*/React.createElement(StepRenderer, {
            key: `step-${i}`,
            components: components,
            remarkPlugins: [removeJsx]
          }, ((_state$context$export = state.context.exports) === null || _state$context$export === void 0 ? void 0 : _state$context$export.join(`\n`)) + `\n\n` + step);
        }), /*#__PURE__*/React.createElement(build$1.Text, null, `\n------\n`), /*#__PURE__*/React.createElement(build$1.Text, {
          color: "yellow"
        }, "To install this recipe, run:"), /*#__PURE__*/React.createElement(build$1.Text, null, ` `), /*#__PURE__*/React.createElement(build$1.Text, null, `  `, "gatsby recipes ", localRecipe, " --install"), /*#__PURE__*/React.createElement(build$1.Text, null, ` `)));
      };
  
      const Installing = ({
        state
      }) => /*#__PURE__*/React.createElement(Div, null, state.context.plan.map((p, i) => /*#__PURE__*/React.createElement(build$1.Box, {
        textWrap: "wrap",
        flexDirection: "column",
        key: `${p.resourceName}-${i}`
      }, /*#__PURE__*/React.createElement(build$1.Text, null, p.isDone ? `✔ ` : /*#__PURE__*/React.createElement(build$3.default, null), ` `, /*#__PURE__*/React.createElement(build$1.Text, {
        italic: true
      }, p.resourceName, ":"), ` `, p.isDone ? p._message : p.describe, ` `, state.context.elapsed > 0 && /*#__PURE__*/React.createElement(build$1.Text, null, "(", state.context.elapsed / 1000, "s elapsed)")))));
  
      let sentContinue = false;
  
      const RecipeInterpreter = () => {
        const {
          exit
        } = build$1.useApp(); // eslint-disable-next-line
  
        const [localRecipe, setRecipe] = useState(recipe);
        const [subscriptionResponse] = useSubscription({
          query: `
            subscription {
              operation {
                state
              }
            }
          `
        }, (_prev, now) => now); // eslint-disable-next-line
  
        const [_, createOperation] = useMutation(`
          mutation ($recipePath: String!, $projectRoot: String!, $isDevelopMode: Boolean!) {
            createOperation(recipePath: $recipePath, projectRoot: $projectRoot, watchChanges: $isDevelopMode)
          }
        `); // eslint-disable-next-line
  
        const [__, _sendEvent] = useMutation(`
          mutation($event: String!, $input: String) {
            sendEvent(event: $event, input: $input)
          }
        `);
  
        const sendEvent = ({
          event,
          input
        }) => {
          if (input) {
            _sendEvent({
              event,
              input: JSON.stringify(input)
            });
          } else {
            _sendEvent({
              event
            });
          }
        };
  
        subscriptionClient.connectionCallback = async () => {
          if (!showRecipesList) {
            try {
              await createOperation({
                recipePath: localRecipe,
                projectRoot,
                isDevelopMode
              });
            } catch (e) {
              console.log(`error creating operation`, e);
            }
          }
        };
  
        const state = subscriptionResponse.data && JSON.parse(subscriptionResponse.data.operation.state);
        build$1.useInput((_, key) => {
          if (showRecipesList) {
            return;
          }
  
          if (key.return) {
            sendEvent({
              event: `CONTINUE`
            });
          }
        });
  
        if (showRecipesList) {
          return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WelcomeMessage, null), /*#__PURE__*/React.createElement(build$1.Text, {
            bold: true,
            underline: true
          }, "Select a recipe to run"), /*#__PURE__*/React.createElement(RecipesList, {
            setRecipe: async recipeItem => {
              setRecipe(recipeItem.value.slice(0, -4));
              trackCli(`RECIPE_RUN`, {
                name: recipeItem.value
              });
              showRecipesList = false;
  
              try {
                await createOperation({
                  recipePath: recipeItem.value,
                  projectRoot,
                  isDevelopMode: false
                });
              } catch (e) {
                console.log(`error creating operation`, e);
              }
            }
          }));
        }
  
        const ValidationErrors = state => {
          var _state$context;
  
          if ((_state$context = state.context) === null || _state$context === void 0 ? void 0 : _state$context.plan) {
            return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(build$1.Text, {
              bold: true
            }, "The recipe didn't validate. Please fix the following errors:"), /*#__PURE__*/React.createElement(build$1.Text, null, `\n`), state.context.plan.filter(p => p.error).map((p, i) => /*#__PURE__*/React.createElement(ResourceComponent, _extends_1({
              key: i
            }, p))));
          } else return null;
        };
  
        const GeneralError = ({
          state
        }) => {
          let errors = [];
  
          if (state.context.error) {
            errors = Array.isArray(state.context.error.error) ? state.context.error.error : [state.context.error.error];
          } else {
            var _state$context$plan2;
  
            // Errors are on a plan.
            errors = (_state$context$plan2 = state.context.plan) === null || _state$context$plan2 === void 0 ? void 0 : _state$context$plan2.filter(p => p.error);
          }
  
          if (errors.length > 0) {
            return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(build$1.Text, {
              bold: true
            }, "The recipe has an error:"), /*#__PURE__*/React.createElement(build$1.Text, null, `\n`), errors.map((error, i) => /*#__PURE__*/React.createElement(build$1.Text, {
              key: i,
              backgroundColor: "#C41E3A",
              color: "white"
            }, error.error)));
          } else return null;
        };
  
        if ((state === null || state === void 0 ? void 0 : state.value) === `doneError`) {
          var _state$context$plan3;
  
          process.nextTick(() => process.exit());
          return /*#__PURE__*/React.createElement(ResourceProvider, {
            value: ((_state$context$plan3 = state.context.plan) === null || _state$context$plan3 === void 0 ? void 0 : _state$context$plan3.filter(p => p.resourceName !== `Input`)) || []
          }, /*#__PURE__*/React.createElement(ValidationErrors, null), /*#__PURE__*/React.createElement(GeneralError, {
            state: state
          }));
        }
  
        let isReady; // If installing, continue from presentPlan to applyingPlan
  
        if ((state === null || state === void 0 ? void 0 : state.value) === `presentPlan` && isInstallMode) {
          if (!sentContinue) {
            sendEvent({
              event: `CONTINUE`
            });
            sentContinue = true;
          }
        } // install mode
  
  
        if (isInstallMode) {
          isReady = (state === null || state === void 0 ? void 0 : state.value) === `applyingPlan` || (state === null || state === void 0 ? void 0 : state.value) === `done`;
        } else {
          isReady = (state === null || state === void 0 ? void 0 : state.value) === `presentPlan`;
        }
  
        if (!isReady) {
          return /*#__PURE__*/React.createElement(build$1.Text, null, /*#__PURE__*/React.createElement(build$3.default, null), " Loading recipe");
        }
  
        const isDone = state.value === `done`;
  
        if (isDone) {
          process.nextTick(() => {
            subscriptionClient.close();
            exit();
            process.stdout.write(`\n\n---\n\n\nThe recipe finished successfully!\n\n`);
            process.exit();
          }); // return null
        }
  
        if (isInstallMode) {
          return /*#__PURE__*/React.createElement(Installing, {
            state: state
          });
        } else {
          return /*#__PURE__*/React.createElement(Plan, {
            state: state,
            localRecipe: localRecipe,
            isDevelopMode: isDevelopMode
          });
        }
      };
  
      const Wrapper = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Provider, {
        value: client
      }, /*#__PURE__*/React.createElement(build$1.Text, null, ` `), /*#__PURE__*/React.createElement(RecipeInterpreter, null)));
  
      const Recipe = () => /*#__PURE__*/React.createElement(Wrapper, null); // Enable experimental mode for more efficient reconciler and renderer
  
  
      const {
        waitUntilExit
      } = build$1.render( /*#__PURE__*/React.createElement(Recipe, null), {
        experimental: true
      });
      await waitUntilExit();
    } catch (e) {
      console.log(e);
    }
  });
  
  const execa = require(`execa`);
  
  const path = require(`path`);
  
  const fs = require(`fs`);
  
  const detectPort = require(`detect-port`);
  
  const {
    getService,
    createServiceLock
  } = require(`gatsby-core-utils`); // NOTE(@mxstbr): The forceStart boolean enforces us to start the recipes graphql server
  // even if another instance might already be running. This is necessary to ensure the gatsby
  // develop command does not _not_ run the server if the user is running gatsby recipes at the same time.
  
  
  var index = (async (programPath, forceStart) => {
    // If this env variable is set, we're in dev mode & assume the recipes API was already started
    // manually.
    if (process.env.RECIPES_DEV_MODE) {
      return {
        port: 50400
      };
    }
  
    let {
      port
    } = (await getService(programPath, `recipesgraphqlserver`)) || {};
  
    if (!port || forceStart) {
      var _subprocess$stderr;
  
      // Use 50400 as our port as it's a highly composite number! Meaning it has
      // more divisors than any smaller positive integer.
      port = await detectPort(50400);
      await createServiceLock(programPath, `recipesgraphqlserver`, {
        port
      });
      const subprocess = execa(`node`, [require.resolve(`gatsby-recipes/dist/graphql-server/server.js`), port], {
        all: true,
        env: {
          // Chalk doesn't want to output color in a child process
          // as it (correctly) thinks it's not in a normal terminal environemnt.
          // Since we're just returning data, we'll override that.
          FORCE_COLOR: `true`
        }
      }); // eslint-disable-next-line no-unused-expressions
  
      (_subprocess$stderr = subprocess.stderr) === null || _subprocess$stderr === void 0 ? void 0 : _subprocess$stderr.on(`data`, data => {
        console.log(data.toString());
      });
      process.on(`exit`, () => {
        subprocess.kill(`SIGTERM`, {
          forceKillAfterTimeout: 2000
        });
      }); // Log server output to a file.
  
      if (process.env.DEBUG) {
        var _subprocess$stdout;
  
        const logFile = path.resolve(`./recipe-server.log`);
        fs.writeFileSync(logFile, `\n-----\n${new Date().toJSON()}\n`);
        const writeStream = fs.createWriteStream(logFile, {
          flags: `a`
        }); // eslint-disable-next-line no-unused-expressions
  
        (_subprocess$stdout = subprocess.stdout) === null || _subprocess$stdout === void 0 ? void 0 : _subprocess$stdout.pipe(writeStream);
      }
    }
  
    return {
      port
    };
  });
  
  const recipesHandler = async data => cli(data);
  
  exports.recipesHandler = recipesHandler;
  exports.startGraphQLServer = index;
  