text: "use strict";
  
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  
  require("core-js/modules/es.reflect.construct.js");
  
  require("core-js/modules/es.symbol.js");
  
  require("core-js/modules/es.symbol.description.js");
  
  require("core-js/modules/es.object.to-string.js");
  
  require("core-js/modules/es.symbol.iterator.js");
  
  require("core-js/modules/es.array.iterator.js");
  
  require("core-js/modules/es.string.iterator.js");
  
  require("core-js/modules/web.dom-collections.iterator.js");
  
  require("core-js/modules/es.array.slice.js");
  
  require("core-js/modules/es.function.name.js");
  
  require("core-js/modules/es.array.from.js");
  
  exports.__esModule = true;
  exports.ComplexPlugin = void 0;
  
  require("core-js/modules/es.math.cosh.js");
  
  require("core-js/modules/es.math.sinh.js");
  
  require("core-js/modules/es.object.get-prototype-of.js");
  
  var _Cell = require("../../Cell");
  
  var _errorMessage = require("../../error-message");
  
  var _ArithmeticHelper = require("../ArithmeticHelper");
  
  var _FunctionPlugin2 = require("./FunctionPlugin");
  
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
  
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
  
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  
  function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
  
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  
  var ComplexPlugin = /*#__PURE__*/function (_FunctionPlugin) {
    _inherits(ComplexPlugin, _FunctionPlugin);
  
    var _super = _createSuper(ComplexPlugin);
  
    function ComplexPlugin() {
      _classCallCheck(this, ComplexPlugin);
  
      return _super.apply(this, arguments);
    }
  
    _createClass(ComplexPlugin, [{
      key: "complex",
      value: function complex(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('COMPLEX'), function (re, im, unit) {
          if (unit !== 'i' && unit !== 'j') {
            return new _Cell.CellError(_Cell.ErrorType.VALUE, _errorMessage.ErrorMessage.ShouldBeIorJ);
          }
  
          return (0, _ArithmeticHelper.coerceComplexToString)([re, im], unit);
        });
      }
    }, {
      key: "imabs",
      value: function imabs(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMABS'), abs);
      }
    }, {
      key: "imaginary",
      value: function imaginary(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMAGINARY'), function (_ref) {
          var _ref2 = _slicedToArray(_ref, 2),
              re = _ref2[0],
              im = _ref2[1];
  
          return im;
        });
      }
    }, {
      key: "imreal",
      value: function imreal(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMREAL'), function (_ref3) {
          var _ref4 = _slicedToArray(_ref3, 2),
              re = _ref4[0],
              im = _ref4[1];
  
          return re;
        });
      }
    }, {
      key: "imargument",
      value: function imargument(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMARGUMENT'), function (_ref5) {
          var _ref6 = _slicedToArray(_ref5, 2),
              re = _ref6[0],
              im = _ref6[1];
  
          if (re === 0 && im === 0) {
            return new _Cell.CellError(_Cell.ErrorType.DIV_BY_ZERO);
          }
  
          return Math.atan2(im, re);
        });
      }
    }, {
      key: "imconjugate",
      value: function imconjugate(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMCONJUGATE'), function (_ref7) {
          var _ref8 = _slicedToArray(_ref7, 2),
              re = _ref8[0],
              im = _ref8[1];
  
          return (0, _ArithmeticHelper.coerceComplexToString)([re, -im]);
        });
      }
    }, {
      key: "imcos",
      value: function imcos(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMCOS'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(cos(arg));
        });
      }
    }, {
      key: "imcosh",
      value: function imcosh(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMCOSH'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(cosh(arg));
        });
      }
    }, {
      key: "imcot",
      value: function imcot(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMCOT'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(div(cos(arg), sin(arg)));
        });
      }
    }, {
      key: "imcsc",
      value: function imcsc(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMCSC'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(div([1, 0], sin(arg)));
        });
      }
    }, {
      key: "imcsch",
      value: function imcsch(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMCSCH'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(div([1, 0], sinh(arg)));
        });
      }
    }, {
      key: "imsec",
      value: function imsec(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMSEC'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(div([1, 0], cos(arg)));
        });
      }
    }, {
      key: "imsech",
      value: function imsech(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMSECH'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(div([1, 0], cosh(arg)));
        });
      }
    }, {
      key: "imsin",
      value: function imsin(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMSIN'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(sin(arg));
        });
      }
    }, {
      key: "imsinh",
      value: function imsinh(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMSINH'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(sinh(arg));
        });
      }
    }, {
      key: "imtan",
      value: function imtan(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMTAN'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(div(sin(arg), cos(arg)));
        });
      }
    }, {
      key: "imdiv",
      value: function imdiv(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMDIV'), function (arg1, arg2) {
          return (0, _ArithmeticHelper.coerceComplexToString)(div(arg1, arg2));
        });
      }
    }, {
      key: "improduct",
      value: function improduct(ast, formulaAddress) {
        var _this = this;
  
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMPRODUCT'), function () {
          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
  
          var coerced = _this.interpreter.arithmeticHelper.coerceComplexExactRanges(args);
  
          if (coerced instanceof _Cell.CellError) {
            return coerced;
          }
  
          var prod = [1, 0];
  
          var _iterator = _createForOfIteratorHelper(coerced),
              _step;
  
          try {
            for (_iterator.s(); !(_step = _iterator.n()).done;) {
              var val = _step.value;
              prod = mul(prod, val);
            }
          } catch (err) {
            _iterator.e(err);
          } finally {
            _iterator.f();
          }
  
          return (0, _ArithmeticHelper.coerceComplexToString)(prod);
        });
      }
    }, {
      key: "imsum",
      value: function imsum(ast, formulaAddress) {
        var _this2 = this;
  
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMSUM'), function () {
          for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
            args[_key2] = arguments[_key2];
          }
  
          var coerced = _this2.interpreter.arithmeticHelper.coerceComplexExactRanges(args);
  
          if (coerced instanceof _Cell.CellError) {
            return coerced;
          }
  
          var sum = [0, 0];
  
          var _iterator2 = _createForOfIteratorHelper(coerced),
              _step2;
  
          try {
            for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
              var val = _step2.value;
              sum = add(sum, val);
            }
          } catch (err) {
            _iterator2.e(err);
          } finally {
            _iterator2.f();
          }
  
          return (0, _ArithmeticHelper.coerceComplexToString)(sum);
        });
      }
    }, {
      key: "imsub",
      value: function imsub(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMSUB'), function (arg1, arg2) {
          return (0, _ArithmeticHelper.coerceComplexToString)(sub(arg1, arg2));
        });
      }
    }, {
      key: "imexp",
      value: function imexp(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMEXP'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(exp(arg));
        });
      }
    }, {
      key: "imln",
      value: function imln(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMLN'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(ln(arg));
        });
      }
    }, {
      key: "imlog10",
      value: function imlog10(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMLOG10'), function (arg) {
          var _ln = ln(arg),
              _ln2 = _slicedToArray(_ln, 2),
              re = _ln2[0],
              im = _ln2[1];
  
          var c = Math.log(10);
          return (0, _ArithmeticHelper.coerceComplexToString)([re / c, im / c]);
        });
      }
    }, {
      key: "imlog2",
      value: function imlog2(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMLOG2'), function (arg) {
          var _ln3 = ln(arg),
              _ln4 = _slicedToArray(_ln3, 2),
              re = _ln4[0],
              im = _ln4[1];
  
          var c = Math.log(2);
          return (0, _ArithmeticHelper.coerceComplexToString)([re / c, im / c]);
        });
      }
    }, {
      key: "impower",
      value: function impower(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMPOWER'), function (arg, n) {
          return (0, _ArithmeticHelper.coerceComplexToString)(power(arg, n));
        });
      }
    }, {
      key: "imsqrt",
      value: function imsqrt(ast, formulaAddress) {
        return this.runFunction(ast.args, formulaAddress, this.metadata('IMSQRT'), function (arg) {
          return (0, _ArithmeticHelper.coerceComplexToString)(power(arg, 0.5));
        });
      }
    }]);
  
    return ComplexPlugin;
  }(_FunctionPlugin2.FunctionPlugin);
  
  exports.ComplexPlugin = ComplexPlugin;
  ComplexPlugin.implementedFunctions = {
    'COMPLEX': {
      method: 'complex',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.NUMBER
      }, {
        argumentType: _FunctionPlugin2.ArgumentTypes.NUMBER
      }, {
        argumentType: _FunctionPlugin2.ArgumentTypes.STRING,
        defaultValue: 'i'
      }]
    },
    'IMABS': {
      method: 'imabs',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMAGINARY': {
      method: 'imaginary',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMREAL': {
      method: 'imreal',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMARGUMENT': {
      method: 'imargument',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMCONJUGATE': {
      method: 'imconjugate',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMCOS': {
      method: 'imcos',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMCOSH': {
      method: 'imcosh',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMCOT': {
      method: 'imcot',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMCSC': {
      method: 'imcsc',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMCSCH': {
      method: 'imcsch',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMSEC': {
      method: 'imsec',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMSECH': {
      method: 'imsech',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMSIN': {
      method: 'imsin',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMSINH': {
      method: 'imsinh',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMTAN': {
      method: 'imtan',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMDIV': {
      method: 'imdiv',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }, {
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMPRODUCT': {
      method: 'improduct',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.ANY
      }],
      repeatLastArgs: 1
    },
    'IMSUM': {
      method: 'imsum',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.ANY
      }],
      repeatLastArgs: 1
    },
    'IMSUB': {
      method: 'imsub',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }, {
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMEXP': {
      method: 'imexp',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMLN': {
      method: 'imln',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMLOG10': {
      method: 'imlog10',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMLOG2': {
      method: 'imlog2',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    },
    'IMPOWER': {
      method: 'impower',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }, {
        argumentType: _FunctionPlugin2.ArgumentTypes.NUMBER
      }]
    },
    'IMSQRT': {
      method: 'imsqrt',
      parameters: [{
        argumentType: _FunctionPlugin2.ArgumentTypes.COMPLEX
      }]
    }
  };
  
  function add(_ref9, _ref10) {
    var _ref11 = _slicedToArray(_ref9, 2),
        re1 = _ref11[0],
        im1 = _ref11[1];
  
    var _ref12 = _slicedToArray(_ref10, 2),
        re2 = _ref12[0],
        im2 = _ref12[1];
  
    return [re1 + re2, im1 + im2];
  }
  
  function sub(_ref13, _ref14) {
    var _ref15 = _slicedToArray(_ref13, 2),
        re1 = _ref15[0],
        im1 = _ref15[1];
  
    var _ref16 = _slicedToArray(_ref14, 2),
        re2 = _ref16[0],
        im2 = _ref16[1];
  
    return [re1 - re2, im1 - im2];
  }
  
  function mul(_ref17, _ref18) {
    var _ref19 = _slicedToArray(_ref17, 2),
        re1 = _ref19[0],
        im1 = _ref19[1];
  
    var _ref20 = _slicedToArray(_ref18, 2),
        re2 = _ref20[0],
        im2 = _ref20[1];
  
    return [re1 * re2 - im1 * im2, re1 * im2 + re2 * im1];
  }
  
  function div(_ref21, _ref22) {
    var _ref23 = _slicedToArray(_ref21, 2),
        re1 = _ref23[0],
        im1 = _ref23[1];
  
    var _ref24 = _slicedToArray(_ref22, 2),
        re2 = _ref24[0],
        im2 = _ref24[1];
  
    var denom = Math.pow(re2, 2) + Math.pow(im2, 2);
  
    var _mul = mul([re1, im1], [re2, -im2]),
        _mul2 = _slicedToArray(_mul, 2),
        nomRe = _mul2[0],
        nomIm = _mul2[1];
  
    return [nomRe / denom, nomIm / denom];
  }
  
  function cos(_ref25) {
    var _ref26 = _slicedToArray(_ref25, 2),
        re = _ref26[0],
        im = _ref26[1];
  
    return [Math.cos(re) * Math.cosh(im), -Math.sin(re) * Math.sinh(im)];
  }
  
  function cosh(_ref27) {
    var _ref28 = _slicedToArray(_ref27, 2),
        re = _ref28[0],
        im = _ref28[1];
  
    return [Math.cosh(re) * Math.cos(im), Math.sinh(re) * Math.sin(im)];
  }
  
  function sin(_ref29) {
    var _ref30 = _slicedToArray(_ref29, 2),
        re = _ref30[0],
        im = _ref30[1];
  
    return [Math.sin(re) * Math.cosh(im), Math.cos(re) * Math.sinh(im)];
  }
  
  function sinh(_ref31) {
    var _ref32 = _slicedToArray(_ref31, 2),
        re = _ref32[0],
        im = _ref32[1];
  
    return [Math.sinh(re) * Math.cos(im), Math.cosh(re) * Math.sin(im)];
  }
  
  function exp(_ref33) {
    var _ref34 = _slicedToArray(_ref33, 2),
        re = _ref34[0],
        im = _ref34[1];
  
    return [Math.exp(re) * Math.cos(im), Math.exp(re) * Math.sin(im)];
  }
  
  function abs(_ref35) {
    var _ref36 = _slicedToArray(_ref35, 2),
        re = _ref36[0],
        im = _ref36[1];
  
    return Math.sqrt(re * re + im * im);
  }
  
  function ln(_ref37) {
    var _ref38 = _slicedToArray(_ref37, 2),
        re = _ref38[0],
        im = _ref38[1];
  
    return [Math.log(abs([re, im])), Math.atan2(im, re)];
  }
  
  function power(arg, n) {
    var _ln5 = ln(arg),
        _ln6 = _slicedToArray(_ln5, 2),
        re = _ln6[0],
        im = _ln6[1];
  
    return exp([n * re, n * im]);
  }