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OACjB,QAAQ,OAAS","file":"/npm/interweave@13.1.1/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/interweave@13.1.1/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// Bundled with Packemon: https://packemon.dev\n// Platform: browser, Support: stable, Format: lib\n'use strict';\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nObject.defineProperties(exports, {\n  __esModule: {\n    value: true\n  },\n  [Symbol.toStringTag]: {\n    value: 'Module'\n  }\n});\n\nconst Matcher = require('./bundle-707b635b.js');\n\nconst React = require('react');\n\nconst escapeHtml = require('escape-html');\n\nconst _interopDefault = e => e && e.__esModule ? e : {\n  default: e\n};\n\nconst React__default = /*#__PURE__*/_interopDefault(React);\n\nconst escapeHtml__default = /*#__PURE__*/_interopDefault(escapeHtml);\n\nconst INVALID_STYLES = /(url|image|image-set)\\(/i;\n\nclass StyleFilter extends Matcher.Filter {\n  attribute(name, value) {\n    if (name === 'style') {\n      Object.keys(value).forEach(key => {\n        if (String(value[key]).match(INVALID_STYLES)) {\n          // eslint-disable-next-line no-param-reassign\n          delete value[key];\n        }\n      });\n    } // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\n\n    return value;\n  }\n\n}\n/* eslint-disable no-bitwise, no-cond-assign, complexity, @typescript-eslint/no-unsafe-return */\n\n\nconst ELEMENT_NODE = 1;\nconst TEXT_NODE = 3;\nconst INVALID_ROOTS = /^<(!doctype|(html|head|body)(\\s|>))/i;\nconst ALLOWED_ATTRS = /^(aria-|data-|\\w+:)/iu;\nconst OPEN_TOKEN = /{{{(\\w+)\\/?}}}/;\n\nfunction createDocument() {\n  // Maybe SSR? Just do nothing instead of crashing!\n  if (typeof window === 'undefined' || typeof document === 'undefined') {\n    return undefined;\n  }\n\n  return document.implementation.createHTMLDocument('Interweave');\n}\n\nclass Parser {\n  constructor(markup, props = {}, matchers = [], filters = []) {\n    var _props$allowList;\n\n    _defineProperty(this, \"allowed\", void 0);\n\n    _defineProperty(this, \"banned\", void 0);\n\n    _defineProperty(this, \"blocked\", void 0);\n\n    _defineProperty(this, \"container\", void 0);\n\n    _defineProperty(this, \"content\", []);\n\n    _defineProperty(this, \"props\", void 0);\n\n    _defineProperty(this, \"matchers\", void 0);\n\n    _defineProperty(this, \"filters\", void 0);\n\n    _defineProperty(this, \"keyIndex\", void 0);\n\n    if (process.env.NODE_ENV !== \"production\" && markup && typeof markup !== 'string') {\n      throw new TypeError('Interweave parser requires a valid string.');\n    }\n\n    this.props = props;\n    this.matchers = matchers;\n    this.filters = [...filters, new StyleFilter()];\n    this.keyIndex = -1;\n    this.container = this.createContainer(markup || '');\n    this.allowed = new Set((_props$allowList = props.allowList) !== null && _props$allowList !== void 0 ? _props$allowList : Matcher.ALLOWED_TAG_LIST);\n    this.banned = new Set(Matcher.BANNED_TAG_LIST);\n    this.blocked = new Set(props.blockList);\n  }\n  /**\n   * Loop through and apply all registered attribute filters.\n   */\n\n\n  applyAttributeFilters(name, value) {\n    return this.filters.reduce((nextValue, filter) => nextValue !== null && typeof filter.attribute === 'function' ? filter.attribute(name, nextValue) : nextValue, value);\n  }\n  /**\n   * Loop through and apply all registered node filters.\n   */\n\n\n  applyNodeFilters(name, node) {\n    // Allow null to be returned\n    return this.filters.reduce((nextNode, filter) => nextNode !== null && typeof filter.node === 'function' ? filter.node(name, nextNode) : nextNode, node);\n  }\n  /**\n   * Loop through and apply all registered matchers to the string.\n   * If a match is found, create a React element, and build a new array.\n   * This array allows React to interpolate and render accordingly.\n   */\n\n\n  applyMatchers(string, parentConfig) {\n    const elements = {};\n    const {\n      props\n    } = this;\n    let matchedString = string;\n    let elementIndex = 0;\n    let parts = null;\n    this.matchers.forEach(matcher => {\n      const tagName = matcher.asTag().toLowerCase();\n      const config = this.getTagConfig(tagName); // Skip matchers that have been disabled from props or are not supported\n\n      if (props[matcher.inverseName] || !this.isTagAllowed(tagName)) {\n        return;\n      } // Skip matchers in which the child cannot be rendered\n\n\n      if (!this.canRenderChild(parentConfig, config)) {\n        return;\n      } // Continuously trigger the matcher until no matches are found\n\n\n      let tokenizedString = '';\n\n      while (matchedString && (parts = matcher.match(matchedString))) {\n        const {\n          index,\n          length,\n          match,\n          valid,\n          void: isVoid,\n          ...partProps\n        } = parts;\n        const tokenName = matcher.propName + String(elementIndex); // Piece together a new string with interpolated tokens\n\n        if (index > 0) {\n          tokenizedString += matchedString.slice(0, index);\n        }\n\n        if (valid) {\n          tokenizedString += isVoid ? `{{{${tokenName}/}}}` : `{{{${tokenName}}}}${match}{{{/${tokenName}}}}`;\n          this.keyIndex += 1;\n          elementIndex += 1;\n          elements[tokenName] = {\n            children: match,\n            matcher,\n            props: { ...props,\n              ...partProps,\n              key: this.keyIndex\n            }\n          };\n        } else {\n          tokenizedString += match;\n        } // Reduce the string being matched against,\n        // otherwise we end up in an infinite loop!\n\n\n        if (matcher.greedy) {\n          matchedString = tokenizedString + matchedString.slice(index + length);\n          tokenizedString = '';\n        } else {\n          // eslint-disable-next-line unicorn/explicit-length-check\n          matchedString = matchedString.slice(index + (length || match.length));\n        }\n      } // Update the matched string with the tokenized string,\n      // so that the next matcher can apply to it.\n\n\n      if (!matcher.greedy) {\n        matchedString = tokenizedString + matchedString;\n      }\n    });\n\n    if (elementIndex === 0) {\n      return string;\n    }\n\n    return this.replaceTokens(matchedString, elements);\n  }\n  /**\n   * Determine whether the child can be rendered within the parent.\n   */\n\n\n  canRenderChild(parentConfig, childConfig) {\n    if (!parentConfig.tagName || !childConfig.tagName) {\n      return false;\n    } // No children\n\n\n    if (parentConfig.void) {\n      return false;\n    } // Valid children\n\n\n    if (parentConfig.children.length > 0) {\n      return parentConfig.children.includes(childConfig.tagName);\n    }\n\n    if (parentConfig.invalid.length > 0 && parentConfig.invalid.includes(childConfig.tagName)) {\n      return false;\n    } // Valid parent\n\n\n    if (childConfig.parent.length > 0) {\n      return childConfig.parent.includes(parentConfig.tagName);\n    } // Self nesting\n\n\n    if (!parentConfig.self && parentConfig.tagName === childConfig.tagName) {\n      return false;\n    } // Content category type\n\n\n    return Boolean(parentConfig && parentConfig.content & childConfig.type);\n  }\n  /**\n   * Convert line breaks in a string to HTML `<br/>` tags.\n   * If the string contains HTML, we should not convert anything,\n   * as line breaks should be handled by `<br/>`s in the markup itself.\n   */\n\n\n  convertLineBreaks(markup) {\n    const {\n      noHtml,\n      disableLineBreaks\n    } = this.props;\n\n    if (noHtml || disableLineBreaks || markup.match(/<((?:\\/[ a-z]+)|(?:[ a-z]+\\/))>/gi)) {\n      return markup;\n    } // Replace carriage returns\n\n\n    let nextMarkup = markup.replace(/\\r\\n/g, '\\n'); // Replace long line feeds\n\n    nextMarkup = nextMarkup.replace(/\\n{3,}/g, '\\n\\n\\n'); // Replace line feeds with `<br/>`s\n\n    nextMarkup = nextMarkup.replace(/\\n/g, '<br/>');\n    return nextMarkup;\n  }\n  /**\n   * Create a detached HTML document that allows for easy HTML\n   * parsing while not triggering scripts or loading external\n   * resources.\n   */\n\n\n  createContainer(markup) {\n    var _this$props$container;\n\n    const factory = typeof global !== 'undefined' && global.INTERWEAVE_SSR_POLYFILL || createDocument;\n    const doc = factory();\n\n    if (!doc) {\n      return undefined;\n    }\n\n    const tag = (_this$props$container = this.props.containerTagName) !== null && _this$props$container !== void 0 ? _this$props$container : 'body';\n    const el = tag === 'body' || tag === 'fragment' ? doc.body : doc.createElement(tag);\n\n    if (markup.match(INVALID_ROOTS)) {\n      if (process.env.NODE_ENV !== \"production\") {\n        throw new Error('HTML documents as Interweave content are not supported.');\n      }\n    } else {\n      el.innerHTML = this.convertLineBreaks(this.props.escapeHtml ? escapeHtml__default.default(markup) : markup);\n    }\n\n    return el;\n  }\n  /**\n   * Convert an elements attribute map to an object map.\n   * Returns null if no attributes are defined.\n   */\n\n\n  extractAttributes(node) {\n    const {\n      allowAttributes\n    } = this.props;\n    const attributes = {};\n    let count = 0;\n\n    if (node.nodeType !== ELEMENT_NODE || !node.attributes) {\n      return null;\n    } // @ts-expect-error Cant type iterator\n\n\n    [...node.attributes].forEach(attr => {\n      const {\n        name,\n        value\n      } = attr;\n      const newName = name.toLowerCase();\n      const filter = Matcher.ATTRIBUTES[newName] || Matcher.ATTRIBUTES[name]; // Verify the node is safe from attacks\n\n      if (!this.isSafe(node)) {\n        return;\n      } // Do not allow denied attributes, excluding ARIA attributes\n      // Do not allow events or XSS injections\n\n\n      if (!newName.match(ALLOWED_ATTRS) && (!allowAttributes && (!filter || filter === Matcher.FILTER_DENY) || newName.startsWith('on') || value.replace(/(\\s|\\0|&#x0([9AD]);)/, '').match(/(javascript|vbscript|livescript|xss):/i))) {\n        return;\n      } // Apply attribute filters\n\n\n      let newValue = newName === 'style' ? this.extractStyleAttribute(node) : value; // Cast to boolean\n\n      if (filter === Matcher.FILTER_CAST_BOOL) {\n        newValue = true; // Cast to number\n      } else if (filter === Matcher.FILTER_CAST_NUMBER) {\n        newValue = Number.parseFloat(String(newValue)); // Cast to string\n      } else if (filter !== Matcher.FILTER_NO_CAST) {\n        newValue = String(newValue);\n      }\n\n      attributes[Matcher.ATTRIBUTES_TO_PROPS[newName] || newName] = this.applyAttributeFilters(newName, newValue);\n      count += 1;\n    });\n\n    if (count === 0) {\n      return null;\n    }\n\n    return attributes;\n  }\n  /**\n   * Extract the style attribute as an object and remove values that allow for attack vectors.\n   */\n\n\n  extractStyleAttribute(node) {\n    const styles = {}; // eslint-disable-next-line unicorn/prefer-spread\n\n    Array.from(node.style).forEach(key => {\n      const value = node.style[key];\n\n      if (typeof value === 'string' || typeof value === 'number') {\n        styles[key.replace(/-([a-z])/g, (match, letter) => String(letter).toUpperCase())] = value;\n      }\n    });\n    return styles;\n  }\n  /**\n   * Return configuration for a specific tag.\n   */\n\n\n  getTagConfig(tagName) {\n    const common = {\n      children: [],\n      content: 0,\n      invalid: [],\n      parent: [],\n      self: true,\n      tagName: '',\n      type: 0,\n      void: false\n    }; // Only spread when a tag config exists,\n    // otherwise we use the empty `tagName`\n    // for parent config inheritance.\n\n    if (Matcher.TAGS[tagName]) {\n      return { ...common,\n        ...Matcher.TAGS[tagName],\n        tagName\n      };\n    }\n\n    return common;\n  }\n  /**\n   * Verify that a node is safe from XSS and injection attacks.\n   */\n\n\n  isSafe(node) {\n    // URLs should only support HTTP, email and phone numbers\n    if (typeof HTMLAnchorElement !== 'undefined' && node instanceof HTMLAnchorElement) {\n      const href = node.getAttribute('href'); // Fragment protocols start with about:\n      // So let's just allow them\n\n      if (href !== null && href !== void 0 && href.startsWith('#')) {\n        return true;\n      }\n\n      const protocol = node.protocol.toLowerCase();\n      return protocol === ':' || protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:' || protocol === 'tel:';\n    }\n\n    return true;\n  }\n  /**\n   * Verify that an HTML tag is allowed to render.\n   */\n\n\n  isTagAllowed(tagName) {\n    if (this.banned.has(tagName) || this.blocked.has(tagName)) {\n      return false;\n    } // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n\n\n    return this.props.allowElements || this.allowed.has(tagName);\n  }\n  /**\n   * Parse the markup by injecting it into a detached document,\n   * while looping over all child nodes and generating an\n   * array to interpolate into JSX.\n   */\n\n\n  parse() {\n    if (!this.container) {\n      return [];\n    }\n\n    return this.parseNode(this.container, this.getTagConfig(this.container.nodeName.toLowerCase()));\n  }\n  /**\n   * Loop over the nodes children and generate a\n   * list of text nodes and React elements.\n   */\n\n\n  parseNode(parentNode, parentConfig) {\n    const {\n      noHtml,\n      noHtmlExceptMatchers,\n      allowElements,\n      transform,\n      transformOnlyAllowList\n    } = this.props;\n    let content = [];\n    let mergedText = ''; // @ts-expect-error Cant type iterator\n\n    [...parentNode.childNodes].forEach(node => {\n      // Create React elements from HTML elements\n      if (node.nodeType === ELEMENT_NODE) {\n        const tagName = node.nodeName.toLowerCase();\n        const config = this.getTagConfig(tagName); // Persist any previous text\n\n        if (mergedText) {\n          content.push(mergedText);\n          mergedText = '';\n        } // Apply node filters first\n\n\n        const nextNode = this.applyNodeFilters(tagName, node);\n\n        if (!nextNode) {\n          return;\n        } // Apply transformation second\n\n\n        let children;\n\n        if (transform && !(transformOnlyAllowList && !this.isTagAllowed(tagName))) {\n          this.keyIndex += 1;\n          const key = this.keyIndex; // Must occur after key is set\n\n          children = this.parseNode(nextNode, config);\n          const transformed = transform(nextNode, children, config);\n\n          if (transformed === null) {\n            return;\n          }\n\n          if (typeof transformed !== 'undefined') {\n            content.push( /*#__PURE__*/React__default.default.cloneElement(transformed, {\n              key\n            }));\n            return;\n          } // Reset as we're not using the transformation\n\n\n          this.keyIndex = key - 1;\n        } // Never allow these tags (except via a transformer)\n\n\n        if (this.banned.has(tagName)) {\n          return;\n        } // Only render when the following criteria is met:\n        //  - HTML has not been disabled\n        //  - Tag is allowed\n        //  - Child is valid within the parent\n\n\n        if (!(noHtml || noHtmlExceptMatchers && tagName !== 'br') && this.isTagAllowed(tagName) && (allowElements || this.canRenderChild(parentConfig, config))) {\n          var _children;\n\n          this.keyIndex += 1; // Build the props as it makes it easier to test\n\n          const attributes = this.extractAttributes(nextNode);\n          const elementProps = {\n            tagName\n          };\n\n          if (attributes) {\n            elementProps.attributes = attributes;\n          }\n\n          if (config.void) {\n            elementProps.selfClose = config.void;\n          }\n\n          content.push( /*#__PURE__*/React__default.default.createElement(Matcher.Element, { ...elementProps,\n            key: this.keyIndex\n          }, (_children = children) !== null && _children !== void 0 ? _children : this.parseNode(nextNode, config))); // Render the children of the current element only.\n          // Important: If the current element is not allowed,\n          // use the parent element for the next scope.\n        } else {\n          content = [...content, ...this.parseNode(nextNode, config.tagName ? config : parentConfig)];\n        } // Apply matchers if a text node\n\n      } else if (node.nodeType === TEXT_NODE) {\n        const text = noHtml && !noHtmlExceptMatchers ? node.textContent : // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n        this.applyMatchers(node.textContent || '', parentConfig);\n\n        if (Array.isArray(text)) {\n          content = [...content, ...text];\n        } else {\n          mergedText += text;\n        }\n      }\n    });\n\n    if (mergedText) {\n      content.push(mergedText);\n    }\n\n    return content;\n  }\n  /**\n   * Deconstruct the string into an array, by replacing custom tokens with React elements,\n   * so that React can render it correctly.\n   */\n\n\n  replaceTokens(tokenizedString, elements) {\n    if (!tokenizedString.includes('{{{')) {\n      return tokenizedString;\n    }\n\n    const nodes = [];\n    let text = tokenizedString;\n    let open = null; // Find an open token tag\n\n    while (open = text.match(OPEN_TOKEN)) {\n      const [match, tokenName] = open;\n      const startIndex = open.index;\n      const isVoid = match.includes('/');\n\n      if (process.env.NODE_ENV !== \"production\" && !elements[tokenName]) {\n        throw new Error(`Token \"${tokenName}\" found but no matching element to replace with.`);\n      } // Extract the previous non-token text\n\n\n      if (startIndex > 0) {\n        nodes.push(text.slice(0, startIndex)); // Reduce text so that the closing tag will be found after the opening\n\n        text = text.slice(startIndex);\n      }\n\n      const {\n        children,\n        matcher,\n        props: elementProps\n      } = elements[tokenName];\n      let endIndex; // Use tag as-is if void\n\n      if (isVoid) {\n        endIndex = match.length;\n        nodes.push(matcher.createElement(children, elementProps)); // Find the closing tag if not void\n      } else {\n        const close = text.match(new RegExp(`{{{/${tokenName}}}}`));\n\n        if (process.env.NODE_ENV !== \"production\" && !close) {\n          throw new Error(`Closing token missing for interpolated element \"${tokenName}\".`);\n        }\n\n        endIndex = close.index + close[0].length;\n        nodes.push(matcher.createElement(this.replaceTokens(text.slice(match.length, close.index), elements), elementProps));\n      } // Reduce text for the next interation\n\n\n      text = text.slice(endIndex);\n    } // Extra the remaining text\n\n\n    if (text.length > 0) {\n      nodes.push(text);\n    } // Reduce to a string if possible\n\n\n    if (nodes.length === 0) {\n      return '';\n    }\n\n    if (nodes.length === 1 && typeof nodes[0] === 'string') {\n      return nodes[0];\n    }\n\n    return nodes;\n  }\n\n}\n/* eslint-disable react/jsx-fragments */\n\n\nfunction Markup(props) {\n  var _ref;\n\n  const {\n    attributes,\n    className,\n    containerTagName,\n    content,\n    emptyContent,\n    parsedContent,\n    tagName,\n    noWrap: baseNoWrap\n  } = props;\n  const tag = (_ref = containerTagName !== null && containerTagName !== void 0 ? containerTagName : tagName) !== null && _ref !== void 0 ? _ref : 'span';\n  const noWrap = tag === 'fragment' ? true : baseNoWrap;\n  let mainContent;\n\n  if (parsedContent) {\n    mainContent = parsedContent;\n  } else {\n    const markup = new Parser(content !== null && content !== void 0 ? content : '', props).parse();\n\n    if (markup.length > 0) {\n      mainContent = markup;\n    }\n  }\n\n  if (!mainContent) {\n    mainContent = emptyContent;\n  }\n\n  if (noWrap) {\n    // eslint-disable-next-line react/jsx-no-useless-fragment\n    return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, mainContent);\n  }\n\n  return /*#__PURE__*/React__default.default.createElement(Matcher.Element, {\n    attributes: attributes,\n    className: className,\n    tagName: tag\n  }, mainContent);\n}\n/* eslint-disable promise/prefer-await-to-callbacks */\n\n\nfunction Interweave(props) {\n  const {\n    attributes,\n    className,\n    content = '',\n    disableFilters = false,\n    disableMatchers = false,\n    emptyContent = null,\n    filters = [],\n    matchers = [],\n    onAfterParse = null,\n    onBeforeParse = null,\n    tagName = 'span',\n    noWrap = false,\n    ...parserProps\n  } = props;\n  const allMatchers = disableMatchers ? [] : matchers;\n  const allFilters = disableFilters ? [] : filters;\n  const beforeCallbacks = onBeforeParse ? [onBeforeParse] : [];\n  const afterCallbacks = onAfterParse ? [onAfterParse] : []; // Inherit callbacks from matchers\n\n  allMatchers.forEach(matcher => {\n    if (matcher.onBeforeParse) {\n      beforeCallbacks.push(matcher.onBeforeParse.bind(matcher));\n    }\n\n    if (matcher.onAfterParse) {\n      afterCallbacks.push(matcher.onAfterParse.bind(matcher));\n    }\n  }); // Trigger before callbacks\n\n  const markup = beforeCallbacks.reduce((string, callback) => {\n    const nextString = callback(string, props);\n\n    if (process.env.NODE_ENV !== \"production\" && typeof nextString !== 'string') {\n      throw new TypeError('Interweave `onBeforeParse` must return a valid HTML string.');\n    }\n\n    return nextString;\n  }, content !== null && content !== void 0 ? content : ''); // Parse the markup\n\n  const parser = new Parser(markup, parserProps, allMatchers, allFilters); // Trigger after callbacks\n\n  const nodes = afterCallbacks.reduce((parserNodes, callback) => {\n    const nextNodes = callback(parserNodes, props);\n\n    if (process.env.NODE_ENV !== \"production\" && !Array.isArray(nextNodes)) {\n      throw new TypeError('Interweave `onAfterParse` must return an array of strings and React elements.');\n    }\n\n    return nextNodes;\n  }, parser.parse());\n  return /*#__PURE__*/React__default.default.createElement(Markup, {\n    attributes: attributes,\n    className: className // eslint-disable-next-line react/destructuring-assignment\n    ,\n    containerTagName: props.containerTagName,\n    emptyContent: emptyContent,\n    noWrap: noWrap,\n    parsedContent: nodes.length === 0 ? undefined : nodes,\n    tagName: tagName\n  });\n}\n\nexports.ALLOWED_TAG_LIST = Matcher.ALLOWED_TAG_LIST;\nexports.ATTRIBUTES = Matcher.ATTRIBUTES;\nexports.ATTRIBUTES_TO_PROPS = Matcher.ATTRIBUTES_TO_PROPS;\nexports.BANNED_TAG_LIST = Matcher.BANNED_TAG_LIST;\nexports.Element = Matcher.Element;\nexports.FILTER_ALLOW = Matcher.FILTER_ALLOW;\nexports.FILTER_CAST_BOOL = Matcher.FILTER_CAST_BOOL;\nexports.FILTER_CAST_NUMBER = Matcher.FILTER_CAST_NUMBER;\nexports.FILTER_DENY = Matcher.FILTER_DENY;\nexports.FILTER_NO_CAST = Matcher.FILTER_NO_CAST;\nexports.Filter = Matcher.Filter;\nexports.Matcher = Matcher.Matcher;\nexports.TAGS = Matcher.TAGS;\nexports.TYPE_EMBEDDED = Matcher.TYPE_EMBEDDED;\nexports.TYPE_FLOW = Matcher.TYPE_FLOW;\nexports.TYPE_HEADING = Matcher.TYPE_HEADING;\nexports.TYPE_INTERACTIVE = Matcher.TYPE_INTERACTIVE;\nexports.TYPE_PALPABLE = Matcher.TYPE_PALPABLE;\nexports.TYPE_PHRASING = Matcher.TYPE_PHRASING;\nexports.TYPE_SECTION = Matcher.TYPE_SECTION;\nexports.match = Matcher.match;\nexports.Interweave = Interweave;\nexports.Markup = Markup;\nexports.Parser = Parser;\n\n"]}