/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ 2:
/***/ ((__unused_webpack_module, exports) => {



Object.defineProperty(exports, "__esModule", ({
  value: true
}));
exports.waitDom = exports.sleep = exports.setStorage = exports.getStorage = exports.getCurrentDate = exports.addToClipBoard = exports.showMsg = void 0; // 添加消息

var style = document.createElement('style');
style.innerText = "\n@media (min-width: 100px){\n  .plugin-pop-cls{\n    position: fixed;\n    width:100vw;\n    top:0vh;\n    height: 1px;\n    text-align: center;\n    z-index:100000;\n    left: 0;\n  }\n}\n\n@media (min-width: 900px){\n  .plugin-pop-cls{\n    position: fixed;\n    width:30vw;\n    top:15vh;\n    height: 1px;\n    left:34vw;\n    text-align: center;\n    z-index:100000\n  }\n}\n\n\n.plugin-alert{\n  width:100%;\n  font-size:14px;\n  padding:10px;\n  text-align: center;\n  margin-bottom: 20px;\n  border-width: 1px;\n  border-style: solid;\n  border-radius: 4px;\n}\n.plugin-success{\n  color:rgb(60, 118, 61);\n  background-color: rgb(223, 240, 216);\n  border-color: rgb(214, 233, 198);\n}\n.plugin-warning{\n  color: #a94442;\n  background-color: #f2dede;\n  border-color: #ebccd1;\n}\ninput,button,select,textarea{outline:none}";

var _interval = setInterval(function () {
  if (document.head) {
    clearInterval(_interval);
    document.head.appendChild(style);
  }
}, 2000);

function showMsg(title) {
  var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "success";
  var during = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2000;

  if ($('.plugin-pop-cls').length == 0) {
    $('body').append('<div class="plugin-pop-cls"></div>');
  }

  var cls = "cls" + new Date().getTime();
  var statusClass = '';

  if (status == 'success') {
    statusClass = 'plugin-success';
  } else {
    statusClass = 'plugin-warning';
  }

  $('.plugin-pop-cls').append("<div class=\"plugin-alert ".concat(cls, " ").concat(statusClass, "\">").concat(title, "</div>"));
  setTimeout(function () {
    $(".".concat(cls)).remove();
  }, during);
}

exports.showMsg = showMsg; // 复制到剪切板

function addToClipBoard(str) {
  var transfer = document.createElement('input');
  $('body').append(transfer);
  transfer.value = str;
  transfer.focus();
  transfer.select();

  if (document.execCommand('copy')) {
    document.execCommand('copy');
  }

  transfer.blur();
  $('body input').remove();
}

exports.addToClipBoard = addToClipBoard; // 获取当前日期

function getCurrentDate() {
  var current_date = new Date();
  var years = current_date.getFullYear();
  var month = current_date.getMonth() + 1;
  month = month < 10 ? '0' + month : month;
  var day = current_date.getDate();
  day = day < 10 ? '0' + day : day;
  var hours = current_date.getHours();
  var minute = current_date.getMinutes();
  return [years, month, day, hours, minute];
}

exports.getCurrentDate = getCurrentDate;

function getClipInfo() {
  var helperdiv = document.createElement("div");
  document.body.appendChild(helperdiv);
  helperdiv.contentEditable = true; // focus the helper div's content

  var range = document.createRange();
  range.selectNode(helperdiv);
  var selection = window.getSelection();
  selection && selection.removeAllRanges();
  selection && selection.addRange(range);
  helperdiv.focus(); // trigger the paste action

  document.execCommand("Paste"); // read the clipboard contents from the helperdiv

  var clipboardContents = helperdiv.innerHTML;
  console.log("\u5F53\u524D\u526A\u5207\u677F\u5185\u5BB9\u4E3A:".concat(clipboardContents));
  document.body.removeChild(helperdiv);
  return clipboardContents;
}

function getStorage(_arr) {
  return new Promise(function (resolve) {
    chrome.storage.local.get(_arr, function (res) {
      resolve(res);
    });
  });
}

exports.getStorage = getStorage;

function setStorage(obj) {
  return new Promise(function (resolve) {
    chrome.storage.local.set(obj, function () {
      resolve('');
    });
  });
}

exports.setStorage = setStorage;

function sleep(ts) {
  return new Promise(function (resolve) {
    setTimeout(function () {
      resolve('');
    }, ts);
  });
}

exports.sleep = sleep;

function waitDom(dom) {
  return new Promise(function (resolve) {
    var interval = setInterval(function () {
      if ($(dom).length) {
        clearInterval(interval);
        resolve('');
      }
    }, 100);
  });
}

exports.waitDom = waitDom;

/***/ }),

/***/ 14:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {



function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }

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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }

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; }

var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
  function adopt(value) {
    return value instanceof P ? value : new P(function (resolve) {
      resolve(value);
    });
  }

  return new (P || (P = Promise))(function (resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }

    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }

    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }

    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
};

Object.defineProperty(exports, "__esModule", ({
  value: true
}));

var tools_1 = __webpack_require__(2);

function addInfoHtml() {
  $('.container').html("<div class=\"info\">\n\n    <div class=\"item\">\n      <div style=\"width:15%\">\u8DDF\u5356\u7CBE\u7075ERP\u8D26\u53F7:</div>\n      <div style=\"width:85%\">\n          <input type=\"text\" id=\"erpAccount\" style=\"width: 100%;\" placeholder=\"\" />\n      </div>\n    </div>\n\n    <div class=\"item\">\n      <div style=\"width:15%\">\u8DDF\u5356\u7CBE\u7075ERP\u5BC6\u7801:</div>\n      <div style=\"width:85%\">\n          <input type=\"password\" id=\"erpPassword\" style=\"width: 100%;\" placeholder=\"\" />\n      </div>\n    </div>\n\n    <div class=\"item\">\n      <div style=\"width:15%\">\u53D1\u9001\u7EDF\u8BA1:</div>\n      <div style=\"width:85%;height: 100px;overflow-y: scroll;\" class=\"sendHistory\">\n      </div>\n    </div>\n\n    <div class=\"item\">\n      <span class=\"run-status\"></span>\n      <span class=\"run-last-time\" style=\"margin-left: 30px;\"></span>\n    </div>\n\n\n    \n    <div class=\"item button-list\">\n      <button class=\"toLogin\">\u4FDD\u5B58</button>\n      <button class=\"startRun\" country=\"us\">\u7F8E\u56FD</button>\n      <button class=\"startRun\" country=\"ca\">\u52A0\u62FF\u5927</button>\n      <button class=\"startRun\" country=\"mx\">\u58A8\u897F\u54E5</button>\n      <button class=\"reset\" style=\"background: red;\">\u505C\u6B62</button>\n      <a class=\"logout\">\u9000\u51FA\u767B\u5F55</a>\n    </div>\n    <div class=\"item button-list\">\n    \n       <button class=\"startRun\" country=\"uk\">\u82F1\u56FD</button>\n        <button class=\"startRun\" country=\"de\">\u5FB7\u56FD</button>\n         <button class=\"startRun\" country=\"fr\">\u6CD5\u56FD</button>\n          <button class=\"startRun\" country=\"au\">\u6FB3\u5927\u5229\u4E9A</button>\n           <button class=\"startRun\" country=\"jp\">\u65E5\u672C</button>\n    \n    </div>\n\n        \n  </div>");
}

function addLoginHtml() {
  $('.container').html("    <div class=\"login\" >\n\n      <div class=\"item\">\n        <div style=\"width:15%\">\u8D26\u53F7:</div>\n        <div style=\"width:85%\">\n          <input type=\"text\" id=\"account\" style=\"width: 100%;\" placeholder=\"\" />\n        </div>\n      </div>\n\n      <div class=\"item\">\n        <div style=\"width:15%\">\u5BC6\u7801:</div>\n        <div style=\"width:85%\">\n          <input type=\"text\" id=\"password\" style=\"width: 100%;\" placeholder=\"\" />\n        </div>\n      </div>\n\n      <div class=\"item button-list\">\n\n        <button class=\"login2\">\u767B\u5F55</button>\n\n      </div>\n\n    </div>");
}

$('body').on('click', '.toLogin', function () {
  var erpAccount = $('#erpAccount').val().trim();
  var erpPassword = $('#erpPassword').val().trim();

  if (!erpAccount || !erpPassword) {
    (0, tools_1.showMsg)('账号和密码不能为空', 'warning');
    return false;
  }

  var zhiying = erpAccount + '-' + erpPassword;
  chrome.storage.local.set({
    zhiying: zhiying,
    interval: "5-10"
  }, function () {
    (0, tools_1.showMsg)('操作成功');
  });
});
$('body').on('click', '.reset', function () {
  chrome.storage.local.remove('mode', function () {
    (0, tools_1.showMsg)('操作完成');
  });
});
$('body').on('click', '.login2', function () {
  var account = $('#account').val().trim();
  var password = $('#password').val().trim();

  if (!account || !password) {
    (0, tools_1.showMsg)('请输入账号和密码', 'warning');
    return false;
  }

  fetch("".concat("https://www.genmaijl.com", "/manage/user/aiLogin"), {
    // fetch('http://127.0.0.1:8000/manage/user/aiLogin', {
    headers: {
      'content-type': "application/json"
    },
    method: "post",
    body: JSON.stringify({
      account: account,
      password: password
    })
  }).then(function (res) {
    return res.json();
  }).then(function (res) {
    if (res.code == 0) {
      chrome.storage.local.set({
        'crx-token': res.data
      }, function () {
        (0, tools_1.showMsg)('登录成功');
        init();
        getCategory();
      });
    } else {
      (0, tools_1.showMsg)(res.msg, 'warning');
    }
  });
});
$('body').on('click', '.logout', function () {
  chrome.storage.local.remove('crx-token', function () {
    (0, tools_1.showMsg)("操作成功");
    init();
  });
});
$('body').on('click', '.startRun', function () {
  var _this = this;

  chrome.storage.local.get("level", function (res) {
    if ((res === null || res === void 0 ? void 0 : res.level) != 0) {
      var country = $(_this).attr('country');
      chrome.storage.local.set({
        country: country,
        mode: "collectData",
        lastTime: new Date().getTime()
      }, function () {
        chrome.runtime.sendMessage({
          type: "getAsin"
        });
      });
      getCategory();
    } else {
      (0, tools_1.showMsg)('会员身份已到期', 'wanring');
    }
  });
});

function init() {
  var _this2 = this;

  chrome.storage.local.get(['sendTotal', 'lastTime', 'mode', 'zhiying', 'crx-token'], function (res) {
    return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
      var token, account, keys, _iterator, _step, row;

      return _regeneratorRuntime().wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              console.log('res', res);
              _context.prev = 1;
              token = JSON.parse(window.atob(res['crx-token']));
              console.log('token', token);

              if (token.account) {
                console.log('add info');
                addInfoHtml();
              } else {
                console.log('add login');
                addLoginHtml();
              }

              _context.next = 11;
              break;

            case 7:
              _context.prev = 7;
              _context.t0 = _context["catch"](1);
              addLoginHtml();
              return _context.abrupt("return", false);

            case 11:
              _context.next = 13;
              return (0, tools_1.sleep)(1000);

            case 13:
              $('.run-status').text("\u8FD0\u884C\u72B6\u6001\uFF1A".concat(res.mode == 'collectData' ? '收集数据' : '未执行'));
              (res === null || res === void 0 ? void 0 : res.lastTime) && $('.run-last-time').text("\u6700\u540E\u8FD0\u884C\u65F6\u95F4:".concat(new Date(res === null || res === void 0 ? void 0 : res.lastTime).toLocaleDateString(), " ").concat(new Date(res === null || res === void 0 ? void 0 : res.lastTime).toLocaleTimeString())); // $('#interval').val(res.interval)

              account = (res.zhiying || '').split('-');
              $('#erpAccount').val(account.shift() || '');
              $('#erpPassword').val(account.pop() || '');
              $('#remark').val(res.remark);
              keys = Object.keys((res === null || res === void 0 ? void 0 : res.sendTotal) || {}).sort(function (a, b) {
                return new Date(a) > new Date(b) ? -1 : 1;
              });
              _iterator = _createForOfIteratorHelper(keys);

              try {
                for (_iterator.s(); !(_step = _iterator.n()).done;) {
                  row = _step.value;
                  $('.sendHistory').append("<div>".concat(row, ": ").concat(res.sendTotal[row], "\u6B21</div>"));
                }
              } catch (err) {
                _iterator.e(err);
              } finally {
                _iterator.f();
              }

            case 22:
            case "end":
              return _context.stop();
          }
        }
      }, _callee, null, [[1, 7]]);
    }));
  });
}

init();

function getCategory() {
  fetch("".concat("https://www.genmaijl.com", "/ai/asin/getCategory")).then(function (res) {
    return res.json();
  }).then(function (res) {
    if (res.code == 0) {
      chrome.storage.local.set({
        category: res.data
      });
    }
  });
}

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module is referenced by other modules so it can't be inlined
/******/ 	var __webpack_exports__ = __webpack_require__(14);
/******/ 	
/******/ })()
;