text: 'use strict';
  
  var QRMath = require('./QRMath.js');
  
  /**
   * @module Polynomial
   * @author nuintun
   * @author Kazuhiko Arase
   */
  var Polynomial = /*#__PURE__*/ (function () {
      function Polynomial(num, shift) {
          if (shift === void 0) { shift = 0; }
          this.num = [];
          var offset = 0;
          var length = num.length;
          while (offset < length && num[offset] === 0) {
              offset++;
          }
          length -= offset;
          for (var i = 0; i < length; i++) {
              this.num.push(num[offset + i]);
          }
          for (var i = 0; i < shift; i++) {
              this.num.push(0);
          }
      }
      Polynomial.prototype.getAt = function (index) {
          return this.num[index];
      };
      Polynomial.prototype.getLength = function () {
          return this.num.length;
      };
      Polynomial.prototype.multiply = function (e) {
          var num = [];
          var eLength = e.getLength();
          var tLength = this.getLength();
          var dLength = tLength + eLength - 1;
          for (var i = 0; i < dLength; i++) {
              num.push(0);
          }
          for (var i = 0; i < tLength; i++) {
              for (var j = 0; j < eLength; j++) {
                  num[i + j] ^= QRMath.gexp(QRMath.glog(this.getAt(i)) + QRMath.glog(e.getAt(j)));
              }
          }
          return new Polynomial(num);
      };
      Polynomial.prototype.mod = function (e) {
          var eLength = e.getLength();
          var tLength = this.getLength();
          if (tLength - eLength < 0) {
              return this;
          }
          var ratio = QRMath.glog(this.getAt(0)) - QRMath.glog(e.getAt(0));
          // Create copy
          var num = [];
          for (var i = 0; i < tLength; i++) {
              num.push(this.getAt(i));
          }
          // Subtract and calc rest.
          for (var i = 0; i < eLength; i++) {
              num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i)) + ratio);
          }
          // Call recursively
          return new Polynomial(num).mod(e);
      };
      return Polynomial;
  }());
  
  exports.Polynomial = Polynomial;
  