"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = open;

var _Questionnaire = _interopRequireDefault(require("./Questionnaire"));

var _componentRender = _interopRequireDefault(require("../_utils/component-render"));

var createQuestionnaire = (0, _componentRender.default)(_Questionnaire.default);

function open(position) {
  if (!position) throw new Error('缺少参数 position');
  var vm = createQuestionnaire();
  var promise = vm.getInfo(position).then(function (isTrue) {
    if (isTrue) return vm.run();
  }).catch(function () {
    return false;
  });
  promise.vm = vm;
  return promise;
}