text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _boom = require('boom');
  
  var _boom2 = _interopRequireDefault(_boom);
  
  var _easycp = require('easycp');
  
  var _easycp2 = _interopRequireDefault(_easycp);
  
  var _ora = require('ora');
  
  var _ora2 = _interopRequireDefault(_ora);
  
  var _reactionBase = require('reaction-base');
  
  var _clean = require('../clean');
  
  var _clean2 = _interopRequireDefault(_clean);
  
  var _createConfig = require('../../createConfig');
  
  var _createConfig2 = _interopRequireDefault(_createConfig);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
  
  exports.default = function () {
    var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(options, config) {
      var _this = this;
  
      var spinner;
      return regeneratorRuntime.wrap(function _callee2$(_context2) {
        while (1) {
          switch (_context2.prev = _context2.next) {
            case 0:
              if (config) {
                _context2.next = 6;
                break;
              }
  
              _context2.next = 3;
              return (0, _createConfig2.default)({ options });
  
            case 3:
              config = _context2.sent;
  
              _reactionBase.log.debug('options', options);
              _reactionBase.log.debug('config', config);
  
            case 6:
              if (!options.clean) {
                _context2.next = 9;
                break;
              }
  
              _context2.next = 9;
              return (0, _clean2.default)(options, config);
  
            case 9:
              spinner = (0, _ora2.default)('starting ios storybook\n').start();
              _context2.next = 12;
              return (0, _easycp.readcp)('which react-native');
  
            case 12:
              if (_context2.sent.length) {
                _context2.next = 15;
                break;
              }
  
              spinner.stop();
              throw _boom2.default.badRequest('react-native not installed');
  
            case 15:
              spinner.stop();
              setTimeout(_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
                return regeneratorRuntime.wrap(function _callee$(_context) {
                  while (1) {
                    switch (_context.prev = _context.next) {
                      case 0:
                        (0, _easycp2.default)(`react-native run-ios --port ${config.ports.native}`);
  
                      case 1:
                      case 'end':
                        return _context.stop();
                    }
                  }
                }, _callee, _this);
              })), 5000);
              _context2.next = 19;
              return (0, _easycp2.default)(`storybook start -p ${config.ports.storybookNative}`);
  
            case 19:
            case 'end':
              return _context2.stop();
          }
        }
      }, _callee2, this);
    }));
  
    function storybookIos(_x, _x2) {
      return _ref.apply(this, arguments);
    }
  
    return storybookIos;
  }();