define(["exports", "core/LinterRule", "../l10n", "deps/regenerator"], function (exports, _LinterRule, _l10n) {
  "use strict";

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

  var _LinterRule2 = _interopRequireDefault(_LinterRule);

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

  var _extends = Object.assign || function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];

      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }

    return target;
  };

  var name = "no-headingless-sections";
  var meta = {
    en: {
      description: "All sections must start with a `h2-6` element.",
      howToFix: "Add a `h2-6` to the offending section or use a `<div>`.",
      help: "See developer console."
    },
    nl: {
      description: "Alle secties moeten beginnen met een `h2-6` element.",
      howToFix: "Voeg een `h2-6` toe aan de conflicterende sectie of gebruik een `<div>`.",
      help: "Zie de developer console."
    }
  };

  // Fall back to english, if language is missing
  var lang = _l10n.lang in meta ? _l10n.lang : "en";
  var hasNoHeading = function hasNoHeading(_ref) {
    var elem = _ref.firstElementChild;

    return elem === null || /^h[1-6]$/.test(elem.localName) === false;
  };

  function linterFunction(conf, doc) {
    var offendingElements = Array.from(doc.querySelectorAll("section")).filter(hasNoHeading);
    if (!offendingElements.length) {
      return [];
    }
    return _extends({
      name: name,
      offendingElements: offendingElements,
      occurrences: offendingElements.length
    }, meta[lang]);
  }
  var rule = exports.rule = new _LinterRule2.default(name, linterFunction);
});
//# sourceMappingURL=no-headingless-sections.js.map