'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() {
    return {
      show: !1,
      tree: {
        '/': { isOpen: !0, isDir: !0, path: '/', name: '', children: [] }
      },
      currentPath: '',
      contextMenu: { show: !1, path: '' },
      confirmInfo: {
        show: !1,
        type: 'error',
        title: '',
        content: '',
        showConfirm: !0,
        showCancel: !0,
        confirmText: '\u786E\u5B9A',
        cancelText: '\u53D6\u6D88',
        callback: null
      }
    }
  }
  const b = require('path'),
    c = require('./0634ee2ebd3e560d9d4804ecc960160f.js'),
    { REHYDRATE: d } = require('redux-persist/constants'),
    e = (a, b) => {
      let c = b[a]
      c &&
        (delete b[a],
        c.children &&
          0 < c.children.length &&
          c.children.forEach(a => {
            e(a, b)
          }))
    }
  module.exports = function(f = a(), g) {
    switch (g.type) {
      case c.COS_SET_WND:
        return _extends({}, f, { show: g.data })
      case c.COS_SET_CURRENT:
        return _extends({}, f, { currentPath: g.data.path })
      case c.COS_SET_DIR: {
        let a = f.tree[g.data.path]
        return a
          ? _extends({}, f, {
              tree: _extends({}, f.tree, {
                [g.data.path]: _extends({}, a, { isOpen: g.data.isOpen })
              })
            })
          : f
      }
      case c.COS_SET_TREE: {
        let a = _extends({}, f.tree),
          c = a[g.data.path]
        if (!c) {
          let a = /\/$/.test(g.data.path)
          c = {
            isDir: a,
            isOpen: !a,
            name: b.basename(g.data.path),
            path: g.data.path,
            children: []
          }
        } else c.children = []
        return (
          g.data.children.forEach(b => {
            ;(a[b.path] = b), c.children.push(b.path)
          }),
          _extends({}, f, { tree: a })
        )
      }
      case c.COS_CUT_TREE: {
        let a = _extends({}, f.tree),
          b = a[g.data.path]
        if (!b) return f
        return e(g.data.path, a), _extends({}, f, { tree: a })
      }
      case c.COS_SET_CONTEXT_MENU:
        return _extends({}, f, { contextMenu: _extends({}, g.data) })
      case c.COS_SET_CONFIRM:
        return _extends({}, f, {
          confirmInfo: _extends({}, f.confirmInfo, { callback: null }, g.data)
        })
      case d:
        return f
      default:
        return f
    }
  }
})(require('lazyload'), require)
