'use strict';

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

var _regenerator;

function _load_regenerator() {
  return _regenerator = _interopRequireDefault(require('babel-runtime/regenerator'));
}

var _bluebird;

function _load_bluebird() {
  return _bluebird = require('bluebird');
}

var _path;

function _load_path() {
  return _path = _interopRequireDefault(require('path'));
}

var _removeEmptyDir;

function _load_removeEmptyDir() {
  return _removeEmptyDir = _interopRequireDefault(require('./remove-empty-dir'));
}

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = function () {
  var _ref = (0, (_bluebird || _load_bluebird()).coroutine)( /*#__PURE__*/(_regenerator || _load_regenerator()).default.mark(function _callee(componentDir) {
    var containingDir;
    return (_regenerator || _load_regenerator()).default.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            containingDir = (_path || _load_path()).default.dirname(componentDir);
            return _context.abrupt('return', (0, (_removeEmptyDir || _load_removeEmptyDir()).default)(containingDir));

          case 2:
          case 'end':
            return _context.stop();
        }
      }
    }, _callee, this);
  }));

  function removeContainingDirIfEmpty(_x) {
    return _ref.apply(this, arguments);
  }

  return removeContainingDirIfEmpty;
}();