"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _compiler = _interopRequireDefault(require("./compiler"));

var _builtins = _interopRequireDefault(require("./builtins.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var _default = function _default(sourceCode) {
  var compiledFunction = eval((0, _compiler.default)(sourceCode)); // eslint-disable-line no-eval

  return function (input, variables) {
    return compiledFunction(_objectSpread({}, _builtins.default, JSON.parse(JSON.stringify(variables || {}))))(input);
  };
};

exports.default = _default;