var s, T;
function S() {
  if (T)
    return s;
  T = 1, s = c, c.displayName = "markupTemplating", c.aliases = [];
  function c(m) {
    (function(f) {
      function k(r, t) {
        return "___" + r.toUpperCase() + t + "___";
      }
      Object.defineProperties(f.languages["markup-templating"] = {}, {
        buildPlaceholders: {
          /**
           * Tokenize all inline templating expressions matching `placeholderPattern`.
           *
           * If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
           * `true` will be replaced.
           *
           * @param {object} env The environment of the `before-tokenize` hook.
           * @param {string} language The language id.
           * @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
           * @param {(match: string) => boolean} [replaceFilter]
           */
          value: function(r, t, o, p) {
            if (r.language === t) {
              var u = r.tokenStack = [];
              r.code = r.code.replace(o, function(n) {
                if (typeof p == "function" && !p(n))
                  return n;
                for (var i = u.length, a; r.code.indexOf(a = k(t, i)) !== -1; )
                  ++i;
                return u[i] = n, a;
              }), r.grammar = f.languages.markup;
            }
          }
        },
        tokenizePlaceholders: {
          /**
           * Replace placeholders with proper tokens after tokenizing.
           *
           * @param {object} env The environment of the `after-tokenize` hook.
           * @param {string} language The language id.
           */
          value: function(r, t) {
            if (r.language !== t || !r.tokenStack)
              return;
            r.grammar = f.languages[t];
            var o = 0, p = Object.keys(r.tokenStack);
            function u(n) {
              for (var i = 0; i < n.length && !(o >= p.length); i++) {
                var a = n[i];
                if (typeof a == "string" || a.content && typeof a.content == "string") {
                  var y = p[o], d = r.tokenStack[y], l = typeof a == "string" ? a : a.content, h = k(t, y), g = l.indexOf(h);
                  if (g > -1) {
                    ++o;
                    var v = l.substring(0, g), b = new f.Token(t, f.tokenize(d, r.grammar), "language-" + t, d), _ = l.substring(g + h.length), e = [];
                    v && e.push.apply(e, u([v])), e.push(b), _ && e.push.apply(e, u([_])), typeof a == "string" ? n.splice.apply(n, [i, 1].concat(e)) : a.content = e;
                  }
                } else
                  a.content && u(a.content);
              }
              return n;
            }
            u(r.tokens);
          }
        }
      });
    })(m);
  }
  return s;
}
export {
  S as __require
};
