"use strict";

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

var _handlebars = _interopRequireDefault(require("handlebars"));

var _templates = require("../templates");

var _utils = require("../utils");

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

/**
 * Create HTML for Lab Instructions
 * @param {object} details instruction JSON data
 * @param {string} targetDir target directory
 */
async function createHtmlLabInstructions(details, targetDir) {
  if (!details) {
    return '(No Lab Instructions data available)';
  }

  let {
    text
  } = details;
  text = await (0, _utils.createHtmlText)(text, targetDir, 'lab-instructions');
  const html = await (0, _templates.loadTemplate)('lab.instructions');
  const dataTemplate = {
    text
  };

  const template = _handlebars.default.compile(html);

  return template(dataTemplate);
}