'use strict'
var _extends =
  Object.assign ||
  function(a) {
    for (var b, c = 1; c < arguments.length; c++)
      for (var d in ((b = arguments[c]), b))
        Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d])
    return a
  }
!(function(require, directRequire) {
  function a() {
    let a = []
    try {
      ;(a = JSON.parse(localStorage.getItem('autoComplete')) || []),
        'array' != e.getType(a) && (a = [])
    } catch (b) {
      a = []
    }
    return {
      url: 'about:blank',
      from: '',
      webview: void 0,
      status: 'none',
      autocomplete: a,
      forbid: { show: !1, errmsg: '' },
      confirmInfo: { show: !1, content: '' },
      tips: { show: !1, message: '' },
      lastGetA8KeyUrl: '',
      purviewFormGetA8key: void 0,
      purviewFromPreVerify: void 0,
      act: {
        load: Date.now(),
        back: Date.now(),
        forward: Date.now(),
        reload: Date.now(),
        blank: Date.now(),
        focusAddress: Date.now()
      },
      jssdkCallbackInfo: { callbackID: null, runtimeID: null, res: {} },
      footer: { show: !1 },
      rightbtn: !0,
      leftbtn: !1,
      shareInfo: {
        show: !1,
        type: '',
        api: '',
        sdkName: '',
        title: '',
        imgUrl: '',
        desc: ''
      },
      cardInfo: {
        show: 'none',
        appid: '',
        args: {},
        callbackID: null,
        runtimeID: null,
        cardInfo: [],
        errData: []
      },
      clickkey: 'none',
      title: '',
      urlcomplete: { show: !1, list: [], current: -1 }
    }
  }
  const b = require('lodash'),
    { REHYDRATE: c } = require('redux-persist/lib/constants'),
    d = require('./822bc5aa1823c9aa222d9ffad72e7f17.js'),
    e = require('./tools.js')
  module.exports = function(b = a(), e) {
    switch (e.type) {
      case d.WEBDEBUGGER_SHOW_DEVTOOLS:
        return _extends({}, b, { webview: e.webview })
      case d.WEBDEBUGGER_SET_URL:
        return _extends({}, b, { url: e.url })
      case d.WEBDEBUGGER_SET_AUTOCOMPLETE: {
        let a = (e.url || '').trim(),
          c = b.autocomplete
        if (a && -1 === a.indexOf('chrome-extension')) {
          let d = b.autocomplete.findIndex(b => {
            return b === a
          })
          ;-1 == d
            ? (c = [a].concat(c))
            : (c.splice(d, 1), (c = [a].concat(c))),
            localStorage.setItem('autoComplete', JSON.stringify(c))
        }
        return _extends({}, b, { autocomplete: c })
      }
      case d.WEBDEBUGGER_CLEAR_AUTOCOMPLETE:
        return (
          localStorage.setItem('autoComplete', JSON.stringify([])),
          _extends({}, b, { autocomplete: [] })
        )
      case d.WEBDEBUGGER_SET_PURVIEW:
        return _extends({}, b, e.data)
      case d.WEBDEBUGGER_SET_TIPS:
        return _extends({}, b, { tips: _extends({}, b.tips, e.data) })
      case d.WEBDEBUGGER_SET_CONFIRM:
        return _extends({}, b, {
          confirmInfo: _extends({}, e.data, { showConfirm: !0 })
        })
      case d.WEBDEBUGGER_SET_FORBID:
        return _extends({}, b, { forbid: _extends({}, b.forbid, e.data) })
      case d.WEBDEBUGGER_SET_ACT: {
        let a = e.data
        return _extends({}, b, {
          act: _extends({}, b.act, { [a]: Date.now() })
        })
      }
      case d.WEBDEBUGGER_SET_FOOTER:
        return _extends({}, b, { footer: _extends({}, b.footer, e.data) })
      case d.WEBDEBUGGER_SET_RIGHTBTN:
        return _extends({}, b, { rightbtn: e.data })
      case d.WEBDEBUGGER_SET_JSSDKCALLBACK:
        return _extends({}, b, { jssdkCallbackInfo: _extends({}, e.data) })
      case d.WEBDEBUGGER_SET_SHARE:
        return _extends({}, b, { shareInfo: _extends({}, b.shareInfo, e.data) })
      case d.WEBDEBUGGER_SET_CARD_VIEW:
        return _extends({}, b, { cardInfo: _extends({}, b.cardInfo, e.data) })
      case d.WEBDEBUGGER_SET_CLICKKEY:
        return _extends({}, b, { clickkey: e.data })
      case d.WEBDEBUGGER_SET_LEFTBTN:
        return _extends({}, b, { leftbtn: e.data })
      case d.WEBDEBUGGER_SET_TITLE:
        return _extends({}, b, { title: e.data })
      case d.WEBDEBUGGER_SET_URLCOMPLETE:
        return _extends({}, b, {
          urlcomplete: _extends({}, b.urlcomplete, e.data)
        })
      case c:
        return b
      default:
        return b
    }
  }
})(require('lazyload'), require)
