'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 _scope;

function _load_scope() {
  return _scope = require('../../../scope');
}

var _modelComponent;

function _load_modelComponent() {
  return _modelComponent = _interopRequireDefault(require('../../../scope/models/model-component'));
}

var _object;

function _load_object() {
  return _object = _interopRequireDefault(require('../../../scope/objects/object'));
}

var _symlink;

function _load_symlink() {
  return _symlink = _interopRequireDefault(require('../../../scope/models/symlink'));
}

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(path, full) {
    var scope, bitObjects;
    return (_regenerator || _load_regenerator()).default.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            _context.next = 2;
            return (0, (_scope || _load_scope()).loadScope)(path);

          case 2:
            scope = _context.sent;
            _context.next = 5;
            return scope.objects.list();

          case 5:
            bitObjects = _context.sent;
            return _context.abrupt('return', full ? bitObjects : bitObjects.filter(function (obj) {
              return obj instanceof (_modelComponent || _load_modelComponent()).default || obj instanceof (_symlink || _load_symlink()).default;
            }));

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

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

  return catScope;
}();