eslint-disable-next-line complexity
331149
function applyMacros({
  path,
  imports,
  source,
  state,
  babel,
  interopRequire,
  resolvePath,
}) {
  /* istanbul ignore next (pretty much only useful for astexplorer I think) */
  const {
    file: {
      opts: {filename = ''},
    },
  } = state
  let hasReferences = false
  const referencePathsByImportName = imports.reduce(
    (byName, {importedName, localName}) => {
      const binding = path.scope.getBinding(localName)

      byName[importedName] = binding.referencePaths
      hasReferences = hasReferences || Boolean(byName[importedName].length)

      return byName
    },
    {},
  )

  const isRelative = source.indexOf('.') === 0
  const requirePath = resolvePath(source, p.dirname(getFullFilename(filename)))

  const macro = interopRequire(requirePath)
  if (!macro.isBabelMacro) {
    throw new Error(
      `The macro imported from "${source}" must be wrapped in "createMacro" ` +
        `which you can get from "babel-plugin-macros". ` +
        `Please refer to the documentation to see how to do this properly: https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md#writing-a-macro`,
    )
  }
  const config = getConfig(macro, filename, source)

  let result
  try {
    /**
     * Other plugins that run before babel-plugin-macros might use path.replace, where a path is
     * put into its own replacement. Apparently babel does not update the scope after such
     * an operation. As a remedy, the whole scope is traversed again with an empty "Identifier"
     * visitor - this makes the problem go away.
     *
     * See: https://github.com/kentcdodds/import-all.macro/issues/7
     */
    state.file.scope.path.traverse({
      Identifier() {},
    })

    result = macro({
      references: referencePathsByImportName,
      source,
      state,
      babel,
      config,
      isBabelMacrosCall: true,
    })
  } catch (error) {
    if (error.name === 'MacroError') {
      throw error
    }
    error.message = `${source}: ${error.message}`
    if (!isRelative) {
      error.message = `${
        error.message
      } Learn more: https://www.npmjs.com/package/${source.replace(
        // remove everything after package name
        // @org/package/macro -> @org/package
        // package/macro      -> package
        /^((?:@[^/]+\/)?[^/]+).*/,
        '$1',
      )}`
    }
    throw error
  }
  return result
}
1231322
function() {
         /* eslint-disable eqeqeq, no-self-compare */
         return [].reduce.call(arguments, function(soFar, x) {
            return soFar || x != x || typeof x != 'number';
         }, false);
         /* eslint-enable eqeqeq, no-self-compare */
      }
1356608
function(keysFunc, undefinedOnly) {
    return function(obj) {
      var length = arguments.length;
      if (length < 2 || obj === null) return obj;
      for (var index = 1; index < length; index++) {
        var source = arguments[index];
        var keys = keysFunc(source);
        var l = keys.length;

        for (var i = 0; i < l; i++) {
          var key = keys[i];
          if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
        }
      }

      return obj;
    };
  }
373386
function substArguments(str, args, key) {
        var reArgs = /\{\{\s*(.+?)\s*\}\}/g;
        return str.replace(reArgs, function(matched_text, arg) {
            if (args && arg in args) {
                return args[arg];
            }
            if (arg in gL10nData) {
                return gL10nData[arg];
            }
            console.log("argument {{" + arg + "}} for #" + key + " is undefined.");
            return matched_text;
        });
    }
1018982
function stringInterner() { // eslint-disable-line no-unused-vars
  const strings = [];
  const ids = {};
  return {
    intern: function internString(s) {
      const find = ids[s];
      if (find === undefined) {
        const id = strings.length;
        ids[s] = id;
        strings.push(s);
        return id;
      } else {
        return find;
      }
    },
    get: function getString(id) {
      return strings[id];
    },
  };
}
615287
function keyFilter(obj, predicate) {
  var result = {}, key; // eslint-disable-line

  for (key in obj) { // eslint-disable-line
    if (obj[key] && predicate(key)) {
      result[key] = obj[key];
    }
  }

  return result;
}
854514
function gulpEslint(options) {
	options = migrateOptions(options) || {};
	const linter = new CLIEngine(options);

	return transform((file, enc, cb) => {
		const filePath = relative(process.cwd(), file.path);

		if (file.isNull()) {
			cb(null, file);
			return;
		}

		if (file.isStream()) {
			cb(new PluginError('gulp-eslint', 'gulp-eslint doesn\'t support vinyl files with Stream contents.'));
			return;
		}

		if (linter.isPathIgnored(filePath)) {
			// Note:
			// Vinyl files can have an independently defined cwd, but ESLint works relative to `process.cwd()`.
			// (https://github.com/gulpjs/gulp/blob/master/docs/recipes/specifying-a-cwd.md)
			// Also, ESLint doesn't adjust file paths relative to an ancestory .eslintignore path.
			// E.g., If ../.eslintignore has "foo/*.js", ESLint will ignore ./foo/*.js, instead of ../foo/*.js.
			// Eslint rolls this into `CLIEngine.executeOnText`. So, gulp-eslint must account for this limitation.

			if (linter.options.ignore && options.warnFileIgnored) {
				// Warn that gulp.src is needlessly reading files that ESLint ignores
				file.eslint = createIgnoreResult(file);
			}
			cb(null, file);
			return;
		}

		let result;

		try {
			result = linter.executeOnText(file.contents.toString(), filePath).results[0];
		} catch (e) {
			cb(new PluginError('gulp-eslint', e));
			return;
		}
		// Note: Fixes are applied as part of "executeOnText".
		// Any applied fix messages have been removed from the result.

		if (options.quiet) {
			// ignore warnings
			file.eslint =  filterResult(result, options.quiet);
		} else {
			file.eslint = result;
		}

		// Update the fixed output; otherwise, fixable messages are simply ignored.
		if (file.eslint.hasOwnProperty('output')) {
			file.contents = Buffer.from(file.eslint.output);
			file.eslint.fixed = true;
		}
		cb(null, file);
	});
}
1118314
function customize(opts /*: Options */) {
  var renderers = opts.renderers || {};

  return function markings(strings /*: Array<string> */ /*::, ...values: Array<ReactNode> */) {
    var values = Array.prototype.slice.call(arguments, 1);
    var input = stripIndent(strings.join(PLACEHOLDER));
    var parser = new Parser();
    var ast = parser.parse(input);

    if (!validate(ast)) {
      throw new Error('react-markings cannot interpolate React elements non-block positions');
    }

    var index = 0;
    var renderer = new Renderer({
      renderers: Object.assign({}, renderers, {
        Paragraph: function(props) {
          if (props.children.length === 1 && props.children[0] === PLACEHOLDER) {
            var value = values[index];
            index = index + 1 < values.length ? index + 1 : 0;
            return value;
          } else if (renderers.Paragraph) {
            return renderers.Paragraph(props);
          } else if (renderers.paragraph) {
            return renderers.paragraph(props);
          } else {
            return React.createElement('p', {}, props.children);
          }
        },
      })
    });

    return React.createElement('div', {}, renderer.render(ast));
  }
}
71953
function thinkrequire(file) {
    try {
        let obj = require(file);
        obj = (obj && obj.__esModule && obj.default) ? obj.default : obj;
        if (lodash.isFunction(obj)) {
            obj.prototype.__filename = file;
        }
        return obj;
    } catch (e) {
        throw Error(e);
    }
}
1261716
function toPxValue(value, defaultWidth) {
  // eslint-disable-line complexity
  if (typeof value === 'string') {
    var matched = value.match(/^([\d.]+)(px|pt|pc|in|cm|mm|em|ex|rem|q|vw|vh|vmax|vmin)$/);

    if (matched) {
      // console.log(matched);
      var size = parseFloat(matched[1]);
      var unit = matched[2];
      value = (0, _utils.sizeToPixel)({
        size: size,
        unit: unit
      });
    } else {
      var _size = Number(value);

      if (!Number.isNaN(_size)) {
        value = _size;
      }
    }
  }

  return value;
}
522705
function accessible() {
  // eslint-disable-next-line no-underscore-dangle
  new chai.Assertion(this._obj).to.be.instanceof(Array);
  // eslint-disable-next-line no-underscore-dangle
  const errors = this._obj
    .filter(test => test.result)
    .reduce((all, test) => all.concat(test.result.violations), [])
    .filter(test => test)
    .map(test => `${JSON.stringify(test, null, 2)}`);

  this.assert(
    errors.length === 0,
    `expected no accessibility violations but got:\n\t${errors[0]}`,
    'expected accessibilty errors but received none',
  );
}
1151136
function deus(one, two, fn) {
  var types = [one, two];
  var type = function(args, arg) {
    var idx = index(types, typeof arg);
    if(idx > -1 && !args[idx]) args[idx] = arg;
    else if(arg) args.splice(args.length, 0, arg);
  };

  return function() {
    var args = [,,];
    for(var i = 0, l = arguments.length; i < l; i++) {
      type(args, arguments[i]);
    }
    return fn.apply(this, args);
  };
}
74469
function camelCase(str, next) {
    let output = '';
    for (const c of str) {
        if (c === '_') {
            next = true;
            continue;
        }
        output += next ? c.toUpperCase() : c;
        next = false;
    }
    return output;
}
1026981
function evaluate(code) {
  const context = {
    module: {
      exports: {},
    },
  };

  // eslint-disable-next-line no-new-func
  const renderFunction = new Function('module', code);
  renderFunction(context.module);

  const template = context.module.exports;

  return template;
}
1141416
function betterIndexOf(arr, value) {
    if (value != value || value === 0) { // eslint-disable-line eqeqeq
        var i = arr.length;
        while (i-- && !is(arr[i], value)) {
            // eslint-disable-line no-empty
        }
    } else {
        i = [].indexOf.call(arr, value);
    }
    return i;
}
228506
function getNextWhile(tokens, index, direction, matcher) {
		var count = 1, 
			token;
		
		direction = direction || 1;
		while (token = tokens[index + (direction * count++)]) {
			if (!matcher(token)) {
				return token;
			}
		}
		
		return undefined;
	}
785493
function baseNth(array, n) {
      var length = array.length;
      if (!length) {
        return;
      }
      n += n < 0 ? length : 0;
      return isIndex(n, length) ? array[n] : undefined$1;
    }