"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index_dom = require("../decode-named-character-reference/index.dom.cjs");
const index = require("../micromark-util-decode-numeric-character-reference/index.cjs");
const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
function decodeString(value) {
  return value.replace(characterEscapeOrReference, decode);
}
function decode($0, $1, $2) {
  if ($1) {
    return $1;
  }
  const head = $2.charCodeAt(0);
  if (head === 35) {
    const head2 = $2.charCodeAt(1);
    const hex = head2 === 120 || head2 === 88;
    return index.decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);
  }
  return index_dom.decodeNamedCharacterReference($2) || $0;
}
exports.decodeString = decodeString;
//# sourceMappingURL=index.cjs.map
