"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.container = void 0;
var _wrap_array = require("../helpers/wrap_array");
var _wrap_tokens = require("../helpers/wrap_tokens");
var _plugin = _interopRequireDefault(require("../plugin"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/** @module */

/**
 * Marpit container plugin.
 *
 * @function container
 * @param {MarkdownIt} md markdown-it instance.
 */
function _container(md) {
  const containers = (0, _wrap_array.wrapArray)(md.marpit.options.container);
  if (!containers) return;
  const target = [...containers].reverse();
  md.core.ruler.push('marpit_containers', state => {
    if (state.inlineMode) return;
    for (const cont of target) state.tokens = (0, _wrap_tokens.wrapTokens)(state.Token, 'marpit_containers', cont, state.tokens);
  });
}
const container = exports.container = (0, _plugin.default)(_container);
var _default = exports.default = container;