"use strict";
(globalThis["webpackChunkcheckout_for_woocommerce"] = globalThis["webpackChunkcheckout_for_woocommerce"] || []).push([["vendors-admin-settings-node_modules_pnpm_interweave_13_1_1_react_18_3_1_node_modules_interweave_esm_-66f9ad70"],{

/***/ "./node_modules/.pnpm/interweave@13.1.1_react@18.3.1/node_modules/interweave/esm/bundle-7aab7250.js":
/*!**********************************************************************************************************!*\
  !*** ./node_modules/.pnpm/interweave@13.1.1_react@18.3.1/node_modules/interweave/esm/bundle-7aab7250.js ***!
  \**********************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   A: () => (/* binding */ ALLOWED_TAG_LIST),
/* harmony export */   B: () => (/* binding */ BANNED_TAG_LIST),
/* harmony export */   E: () => (/* binding */ Element),
/* harmony export */   F: () => (/* binding */ Filter),
/* harmony export */   M: () => (/* binding */ Matcher),
/* harmony export */   T: () => (/* binding */ TAGS),
/* harmony export */   _: () => (/* binding */ _extends),
/* harmony export */   a: () => (/* binding */ ATTRIBUTES),
/* harmony export */   b: () => (/* binding */ FILTER_DENY),
/* harmony export */   c: () => (/* binding */ ATTRIBUTES_TO_PROPS),
/* harmony export */   d: () => (/* binding */ FILTER_CAST_BOOL),
/* harmony export */   e: () => (/* binding */ FILTER_CAST_NUMBER),
/* harmony export */   f: () => (/* binding */ FILTER_NO_CAST),
/* harmony export */   g: () => (/* binding */ TYPE_FLOW),
/* harmony export */   h: () => (/* binding */ TYPE_SECTION),
/* harmony export */   i: () => (/* binding */ TYPE_HEADING),
/* harmony export */   j: () => (/* binding */ TYPE_PHRASING),
/* harmony export */   k: () => (/* binding */ TYPE_EMBEDDED),
/* harmony export */   l: () => (/* binding */ TYPE_INTERACTIVE),
/* harmony export */   m: () => (/* binding */ TYPE_PALPABLE),
/* harmony export */   n: () => (/* binding */ FILTER_ALLOW),
/* harmony export */   o: () => (/* binding */ match)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
function _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; }

// Bundled with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: esm

/* eslint-disable no-bitwise, no-magic-numbers, sort-keys */
// https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories

const TYPE_FLOW = 1;
const TYPE_SECTION = 1 << 1;
const TYPE_HEADING = 1 << 2;
const TYPE_PHRASING = 1 << 3;
const TYPE_EMBEDDED = 1 << 4;
const TYPE_INTERACTIVE = 1 << 5;
const TYPE_PALPABLE = 1 << 6; // https://developer.mozilla.org/en-US/docs/Web/HTML/Element

const tagConfigs = {
  a: {
    content: TYPE_FLOW | TYPE_PHRASING,
    self: false,
    type: TYPE_FLOW | TYPE_PHRASING | TYPE_INTERACTIVE | TYPE_PALPABLE
  },
  address: {
    invalid: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'address', 'article', 'aside', 'section', 'div', 'header', 'footer'],
    self: false
  },
  audio: {
    children: ['track', 'source']
  },
  br: {
    type: TYPE_FLOW | TYPE_PHRASING,
    void: true
  },
  body: {
    content: TYPE_FLOW | TYPE_SECTION | TYPE_HEADING | TYPE_PHRASING | TYPE_EMBEDDED | TYPE_INTERACTIVE | TYPE_PALPABLE
  },
  button: {
    content: TYPE_PHRASING,
    type: TYPE_FLOW | TYPE_PHRASING | TYPE_INTERACTIVE | TYPE_PALPABLE
  },
  caption: {
    content: TYPE_FLOW,
    parent: ['table']
  },
  col: {
    parent: ['colgroup'],
    void: true
  },
  colgroup: {
    children: ['col'],
    parent: ['table']
  },
  details: {
    children: ['summary'],
    type: TYPE_FLOW | TYPE_INTERACTIVE | TYPE_PALPABLE
  },
  dd: {
    content: TYPE_FLOW,
    parent: ['dl']
  },
  dl: {
    children: ['dt', 'dd'],
    type: TYPE_FLOW
  },
  dt: {
    content: TYPE_FLOW,
    invalid: ['footer', 'header'],
    parent: ['dl']
  },
  figcaption: {
    content: TYPE_FLOW,
    parent: ['figure']
  },
  footer: {
    invalid: ['footer', 'header']
  },
  header: {
    invalid: ['footer', 'header']
  },
  hr: {
    type: TYPE_FLOW,
    void: true
  },
  img: {
    void: true
  },
  li: {
    content: TYPE_FLOW,
    parent: ['ul', 'ol', 'menu']
  },
  main: {
    self: false
  },
  ol: {
    children: ['li'],
    type: TYPE_FLOW
  },
  picture: {
    children: ['source', 'img'],
    type: TYPE_FLOW | TYPE_PHRASING | TYPE_EMBEDDED
  },
  rb: {
    parent: ['ruby', 'rtc']
  },
  rp: {
    parent: ['ruby', 'rtc']
  },
  rt: {
    content: TYPE_PHRASING,
    parent: ['ruby', 'rtc']
  },
  rtc: {
    content: TYPE_PHRASING,
    parent: ['ruby']
  },
  ruby: {
    children: ['rb', 'rp', 'rt', 'rtc']
  },
  source: {
    parent: ['audio', 'video', 'picture'],
    void: true
  },
  summary: {
    content: TYPE_PHRASING,
    parent: ['details']
  },
  table: {
    children: ['caption', 'colgroup', 'thead', 'tbody', 'tfoot', 'tr'],
    type: TYPE_FLOW
  },
  tbody: {
    parent: ['table'],
    children: ['tr']
  },
  td: {
    content: TYPE_FLOW,
    parent: ['tr']
  },
  tfoot: {
    parent: ['table'],
    children: ['tr']
  },
  th: {
    content: TYPE_FLOW,
    parent: ['tr']
  },
  thead: {
    parent: ['table'],
    children: ['tr']
  },
  tr: {
    parent: ['table', 'tbody', 'thead', 'tfoot'],
    children: ['th', 'td']
  },
  track: {
    parent: ['audio', 'video'],
    void: true
  },
  ul: {
    children: ['li'],
    type: TYPE_FLOW
  },
  video: {
    children: ['track', 'source']
  },
  wbr: {
    type: TYPE_FLOW | TYPE_PHRASING,
    void: true
  }
};

function createConfigBuilder(config) {
  return tagName => {
    tagConfigs[tagName] = { ...config,
      ...tagConfigs[tagName]
    };
  };
}

['address', 'main', 'div', 'figure', 'p', 'pre'].forEach(createConfigBuilder({
  content: TYPE_FLOW,
  type: TYPE_FLOW | TYPE_PALPABLE
}));
['abbr', 'b', 'bdi', 'bdo', 'cite', 'code', 'data', 'dfn', 'em', 'i', 'kbd', 'mark', 'q', 'ruby', 'samp', 'strong', 'sub', 'sup', 'time', 'u', 'var'].forEach(createConfigBuilder({
  content: TYPE_PHRASING,
  type: TYPE_FLOW | TYPE_PHRASING | TYPE_PALPABLE
}));
['p', 'pre'].forEach(createConfigBuilder({
  content: TYPE_PHRASING,
  type: TYPE_FLOW | TYPE_PALPABLE
}));
['s', 'small', 'span', 'del', 'ins'].forEach(createConfigBuilder({
  content: TYPE_PHRASING,
  type: TYPE_FLOW | TYPE_PHRASING
}));
['article', 'aside', 'footer', 'header', 'nav', 'section', 'blockquote'].forEach(createConfigBuilder({
  content: TYPE_FLOW,
  type: TYPE_FLOW | TYPE_SECTION | TYPE_PALPABLE
}));
['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].forEach(createConfigBuilder({
  content: TYPE_PHRASING,
  type: TYPE_FLOW | TYPE_HEADING | TYPE_PALPABLE
}));
['audio', 'canvas', 'iframe', 'img', 'video'].forEach(createConfigBuilder({
  type: TYPE_FLOW | TYPE_PHRASING | TYPE_EMBEDDED | TYPE_PALPABLE
})); // Disable this map from being modified

const TAGS = Object.freeze(tagConfigs); // Tags that should never be allowed, even if the allow list is disabled

const BANNED_TAG_LIST = ['applet', 'base', 'body', 'command', 'embed', 'frame', 'frameset', 'head', 'html', 'link', 'meta', 'noscript', 'object', 'script', 'style', 'title'];
const ALLOWED_TAG_LIST = Object.keys(TAGS).filter(tag => tag !== 'canvas' && tag !== 'iframe'); // Filters apply to HTML attributes

const FILTER_ALLOW = 1;
const FILTER_DENY = 2;
const FILTER_CAST_NUMBER = 3;
const FILTER_CAST_BOOL = 4;
const FILTER_NO_CAST = 5; // Attributes not listed here will be denied
// https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes

const ATTRIBUTES = Object.freeze({
  alt: FILTER_ALLOW,
  cite: FILTER_ALLOW,
  class: FILTER_ALLOW,
  colspan: FILTER_CAST_NUMBER,
  controls: FILTER_CAST_BOOL,
  datetime: FILTER_ALLOW,
  default: FILTER_CAST_BOOL,
  disabled: FILTER_CAST_BOOL,
  dir: FILTER_ALLOW,
  height: FILTER_ALLOW,
  href: FILTER_ALLOW,
  id: FILTER_ALLOW,
  kind: FILTER_ALLOW,
  label: FILTER_ALLOW,
  lang: FILTER_ALLOW,
  loading: FILTER_ALLOW,
  loop: FILTER_CAST_BOOL,
  media: FILTER_ALLOW,
  muted: FILTER_CAST_BOOL,
  poster: FILTER_ALLOW,
  rel: FILTER_ALLOW,
  role: FILTER_ALLOW,
  rowspan: FILTER_CAST_NUMBER,
  scope: FILTER_ALLOW,
  sizes: FILTER_ALLOW,
  span: FILTER_CAST_NUMBER,
  start: FILTER_CAST_NUMBER,
  style: FILTER_NO_CAST,
  src: FILTER_ALLOW,
  srclang: FILTER_ALLOW,
  srcset: FILTER_ALLOW,
  tabindex: FILTER_ALLOW,
  target: FILTER_ALLOW,
  title: FILTER_ALLOW,
  type: FILTER_ALLOW,
  width: FILTER_ALLOW
}); // Attributes to camel case for React props

const ATTRIBUTES_TO_PROPS = Object.freeze({
  class: 'className',
  colspan: 'colSpan',
  datetime: 'dateTime',
  rowspan: 'rowSpan',
  srclang: 'srcLang',
  srcset: 'srcSet',
  tabindex: 'tabIndex'
});

function _extends() {
  _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;
  };

  return _extends.apply(this, arguments);
}

function Element({
  attributes = {},
  className,
  children = null,
  selfClose = false,
  tagName
}) {
  const Tag = tagName;
  return selfClose ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Tag, _extends({
    className: className
  }, attributes)) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Tag, _extends({
    className: className
  }, attributes), children);
}

class Filter {
  /**
   * Filter and clean an HTML attribute value.
   */
  attribute(name, value) {
    // eslint-disable-next-line @typescript-eslint/no-unsafe-return
    return value;
  }
  /**
   * Filter and clean an HTML node.
   */


  node(name, node) {
    return node;
  }

}
/**
 * Trigger the actual pattern match and package the matched
 * response through a callback.
 */


function match(string, pattern, process, isVoid = false) {
  const matches = string.match(pattern instanceof RegExp ? pattern : new RegExp(pattern, 'i'));

  if (!matches) {
    return null;
  }

  return {
    match: matches[0],
    void: isVoid,
    ...process(matches),
    index: matches.index,
    length: matches[0].length,
    valid: true
  };
}

class Matcher {
  constructor(name, options, factory) {
    _defineProperty(this, "greedy", false);

    _defineProperty(this, "options", void 0);

    _defineProperty(this, "propName", void 0);

    _defineProperty(this, "inverseName", void 0);

    _defineProperty(this, "factory", void 0);

    if ( true && (!name || name.toLowerCase() === 'html')) {
      throw new Error(`The matcher name "${name}" is not allowed.`);
    } // @ts-expect-error Allow override


    this.options = { ...options
    };
    this.propName = name;
    this.inverseName = `no${name.charAt(0).toUpperCase() + name.slice(1)}`;
    this.factory = factory !== null && factory !== void 0 ? factory : null;
  }
  /**
   * Attempts to create a React element using a custom user provided factory,
   * or the default matcher factory.
   */


  createElement(children, props) {
    const element = this.factory ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(this.factory, props, children) : this.replaceWith(children, props);

    if ( true && typeof element !== 'string' && ! /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().isValidElement(element)) {
      throw new Error(`Invalid React element created from ${this.constructor.name}.`);
    }

    return element;
  }
  /**
   * Trigger the actual pattern match and package the matched
   * response through a callback.
   */


  doMatch(string, pattern, callback, isVoid = false) {
    return match(string, pattern, callback, isVoid);
  }
  /**
   * Callback triggered before parsing.
   */


  onBeforeParse(content, props) {
    return content;
  }
  /**
   * Callback triggered after parsing.
   */


  onAfterParse(content, props) {
    return content;
  }
  /**
   * Replace the match with a React element based on the matched token and optional props.
   */


}


//# sourceMappingURL=bundle-7aab7250.js.map


/***/ }),

/***/ "./node_modules/.pnpm/interweave@13.1.1_react@18.3.1/node_modules/interweave/esm/index.js":
/*!************************************************************************************************!*\
  !*** ./node_modules/.pnpm/interweave@13.1.1_react@18.3.1/node_modules/interweave/esm/index.js ***!
  \************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ALLOWED_TAG_LIST: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.A),
/* harmony export */   ATTRIBUTES: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.a),
/* harmony export */   ATTRIBUTES_TO_PROPS: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.c),
/* harmony export */   BANNED_TAG_LIST: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.B),
/* harmony export */   Element: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.E),
/* harmony export */   FILTER_ALLOW: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.n),
/* harmony export */   FILTER_CAST_BOOL: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.d),
/* harmony export */   FILTER_CAST_NUMBER: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.e),
/* harmony export */   FILTER_DENY: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.b),
/* harmony export */   FILTER_NO_CAST: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.f),
/* harmony export */   Filter: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.F),
/* harmony export */   Interweave: () => (/* binding */ Interweave),
/* harmony export */   Markup: () => (/* binding */ Markup),
/* harmony export */   Matcher: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.M),
/* harmony export */   Parser: () => (/* binding */ Parser),
/* harmony export */   TAGS: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.T),
/* harmony export */   TYPE_EMBEDDED: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.k),
/* harmony export */   TYPE_FLOW: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.g),
/* harmony export */   TYPE_HEADING: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.i),
/* harmony export */   TYPE_INTERACTIVE: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.l),
/* harmony export */   TYPE_PALPABLE: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.m),
/* harmony export */   TYPE_PHRASING: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.j),
/* harmony export */   TYPE_SECTION: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.h),
/* harmony export */   match: () => (/* reexport safe */ _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.o)
/* harmony export */ });
/* harmony import */ var _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bundle-7aab7250.js */ "./node_modules/.pnpm/interweave@13.1.1_react@18.3.1/node_modules/interweave/esm/bundle-7aab7250.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var escape_html__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! escape-html */ "./node_modules/.pnpm/escape-html@1.0.3/node_modules/escape-html/index.js");
/* harmony import */ var escape_html__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(escape_html__WEBPACK_IMPORTED_MODULE_2__);
function _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; }

// Bundled with Packemon: https://packemon.dev
// Platform: browser, Support: stable, Format: esm




const INVALID_STYLES = /(url|image|image-set)\(/i;

class StyleFilter extends _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.F {
  attribute(name, value) {
    if (name === 'style') {
      Object.keys(value).forEach(key => {
        if (String(value[key]).match(INVALID_STYLES)) {
          // eslint-disable-next-line no-param-reassign
          delete value[key];
        }
      });
    } // eslint-disable-next-line @typescript-eslint/no-unsafe-return


    return value;
  }

}
/* eslint-disable no-bitwise, no-cond-assign, complexity, @typescript-eslint/no-unsafe-return */


const ELEMENT_NODE = 1;
const TEXT_NODE = 3;
const INVALID_ROOTS = /^<(!doctype|(html|head|body)(\s|>))/i;
const ALLOWED_ATTRS = /^(aria-|data-|\w+:)/iu;
const OPEN_TOKEN = /{{{(\w+)\/?}}}/;

function createDocument() {
  // Maybe SSR? Just do nothing instead of crashing!
  if (typeof window === 'undefined' || typeof document === 'undefined') {
    return undefined;
  }

  return document.implementation.createHTMLDocument('Interweave');
}

class Parser {
  constructor(markup, props = {}, matchers = [], filters = []) {
    var _props$allowList;

    _defineProperty(this, "allowed", void 0);

    _defineProperty(this, "banned", void 0);

    _defineProperty(this, "blocked", void 0);

    _defineProperty(this, "container", void 0);

    _defineProperty(this, "content", []);

    _defineProperty(this, "props", void 0);

    _defineProperty(this, "matchers", void 0);

    _defineProperty(this, "filters", void 0);

    _defineProperty(this, "keyIndex", void 0);

    if ( true && markup && typeof markup !== 'string') {
      throw new TypeError('Interweave parser requires a valid string.');
    }

    this.props = props;
    this.matchers = matchers;
    this.filters = [...filters, new StyleFilter()];
    this.keyIndex = -1;
    this.container = this.createContainer(markup || '');
    this.allowed = new Set((_props$allowList = props.allowList) !== null && _props$allowList !== void 0 ? _props$allowList : _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.A);
    this.banned = new Set(_bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.B);
    this.blocked = new Set(props.blockList);
  }
  /**
   * Loop through and apply all registered attribute filters.
   */


  applyAttributeFilters(name, value) {
    return this.filters.reduce((nextValue, filter) => nextValue !== null && typeof filter.attribute === 'function' ? filter.attribute(name, nextValue) : nextValue, value);
  }
  /**
   * Loop through and apply all registered node filters.
   */


  applyNodeFilters(name, node) {
    // Allow null to be returned
    return this.filters.reduce((nextNode, filter) => nextNode !== null && typeof filter.node === 'function' ? filter.node(name, nextNode) : nextNode, node);
  }
  /**
   * Loop through and apply all registered matchers to the string.
   * If a match is found, create a React element, and build a new array.
   * This array allows React to interpolate and render accordingly.
   */


  applyMatchers(string, parentConfig) {
    const elements = {};
    const {
      props
    } = this;
    let matchedString = string;
    let elementIndex = 0;
    let parts = null;
    this.matchers.forEach(matcher => {
      const tagName = matcher.asTag().toLowerCase();
      const config = this.getTagConfig(tagName); // Skip matchers that have been disabled from props or are not supported

      if (props[matcher.inverseName] || !this.isTagAllowed(tagName)) {
        return;
      } // Skip matchers in which the child cannot be rendered


      if (!this.canRenderChild(parentConfig, config)) {
        return;
      } // Continuously trigger the matcher until no matches are found


      let tokenizedString = '';

      while (matchedString && (parts = matcher.match(matchedString))) {
        const {
          index,
          length,
          match,
          valid,
          void: isVoid,
          ...partProps
        } = parts;
        const tokenName = matcher.propName + String(elementIndex); // Piece together a new string with interpolated tokens

        if (index > 0) {
          tokenizedString += matchedString.slice(0, index);
        }

        if (valid) {
          tokenizedString += isVoid ? `{{{${tokenName}/}}}` : `{{{${tokenName}}}}${match}{{{/${tokenName}}}}`;
          this.keyIndex += 1;
          elementIndex += 1;
          elements[tokenName] = {
            children: match,
            matcher,
            props: { ...props,
              ...partProps,
              key: this.keyIndex
            }
          };
        } else {
          tokenizedString += match;
        } // Reduce the string being matched against,
        // otherwise we end up in an infinite loop!


        if (matcher.greedy) {
          matchedString = tokenizedString + matchedString.slice(index + length);
          tokenizedString = '';
        } else {
          // eslint-disable-next-line unicorn/explicit-length-check
          matchedString = matchedString.slice(index + (length || match.length));
        }
      } // Update the matched string with the tokenized string,
      // so that the next matcher can apply to it.


      if (!matcher.greedy) {
        matchedString = tokenizedString + matchedString;
      }
    });

    if (elementIndex === 0) {
      return string;
    }

    return this.replaceTokens(matchedString, elements);
  }
  /**
   * Determine whether the child can be rendered within the parent.
   */


  canRenderChild(parentConfig, childConfig) {
    if (!parentConfig.tagName || !childConfig.tagName) {
      return false;
    } // No children


    if (parentConfig.void) {
      return false;
    } // Valid children


    if (parentConfig.children.length > 0) {
      return parentConfig.children.includes(childConfig.tagName);
    }

    if (parentConfig.invalid.length > 0 && parentConfig.invalid.includes(childConfig.tagName)) {
      return false;
    } // Valid parent


    if (childConfig.parent.length > 0) {
      return childConfig.parent.includes(parentConfig.tagName);
    } // Self nesting


    if (!parentConfig.self && parentConfig.tagName === childConfig.tagName) {
      return false;
    } // Content category type


    return Boolean(parentConfig && parentConfig.content & childConfig.type);
  }
  /**
   * Convert line breaks in a string to HTML `<br/>` tags.
   * If the string contains HTML, we should not convert anything,
   * as line breaks should be handled by `<br/>`s in the markup itself.
   */


  convertLineBreaks(markup) {
    const {
      noHtml,
      disableLineBreaks
    } = this.props;

    if (noHtml || disableLineBreaks || markup.match(/<((?:\/[ a-z]+)|(?:[ a-z]+\/))>/gi)) {
      return markup;
    } // Replace carriage returns


    let nextMarkup = markup.replace(/\r\n/g, '\n'); // Replace long line feeds

    nextMarkup = nextMarkup.replace(/\n{3,}/g, '\n\n\n'); // Replace line feeds with `<br/>`s

    nextMarkup = nextMarkup.replace(/\n/g, '<br/>');
    return nextMarkup;
  }
  /**
   * Create a detached HTML document that allows for easy HTML
   * parsing while not triggering scripts or loading external
   * resources.
   */


  createContainer(markup) {
    var _this$props$container;

    const factory = typeof globalThis !== 'undefined' && globalThis.INTERWEAVE_SSR_POLYFILL || createDocument;
    const doc = factory();

    if (!doc) {
      return undefined;
    }

    const tag = (_this$props$container = this.props.containerTagName) !== null && _this$props$container !== void 0 ? _this$props$container : 'body';
    const el = tag === 'body' || tag === 'fragment' ? doc.body : doc.createElement(tag);

    if (markup.match(INVALID_ROOTS)) {
      if (true) {
        throw new Error('HTML documents as Interweave content are not supported.');
      }
    } else {
      el.innerHTML = this.convertLineBreaks(this.props.escapeHtml ? escape_html__WEBPACK_IMPORTED_MODULE_2___default()(markup) : markup);
    }

    return el;
  }
  /**
   * Convert an elements attribute map to an object map.
   * Returns null if no attributes are defined.
   */


  extractAttributes(node) {
    const {
      allowAttributes
    } = this.props;
    const attributes = {};
    let count = 0;

    if (node.nodeType !== ELEMENT_NODE || !node.attributes) {
      return null;
    } // @ts-expect-error Cant type iterator


    [...node.attributes].forEach(attr => {
      const {
        name,
        value
      } = attr;
      const newName = name.toLowerCase();
      const filter = _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.a[newName] || _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.a[name]; // Verify the node is safe from attacks

      if (!this.isSafe(node)) {
        return;
      } // Do not allow denied attributes, excluding ARIA attributes
      // Do not allow events or XSS injections


      if (!newName.match(ALLOWED_ATTRS) && (!allowAttributes && (!filter || filter === _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.b) || newName.startsWith('on') || value.replace(/(\s|\0|&#x0([9AD]);)/, '').match(/(javascript|vbscript|livescript|xss):/i))) {
        return;
      } // Apply attribute filters


      let newValue = newName === 'style' ? this.extractStyleAttribute(node) : value; // Cast to boolean

      if (filter === _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.d) {
        newValue = true; // Cast to number
      } else if (filter === _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.e) {
        newValue = Number.parseFloat(String(newValue)); // Cast to string
      } else if (filter !== _bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.f) {
        newValue = String(newValue);
      }

      attributes[_bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.c[newName] || newName] = this.applyAttributeFilters(newName, newValue);
      count += 1;
    });

    if (count === 0) {
      return null;
    }

    return attributes;
  }
  /**
   * Extract the style attribute as an object and remove values that allow for attack vectors.
   */


  extractStyleAttribute(node) {
    const styles = {}; // eslint-disable-next-line unicorn/prefer-spread

    Array.from(node.style).forEach(key => {
      const value = node.style[key];

      if (typeof value === 'string' || typeof value === 'number') {
        styles[key.replace(/-([a-z])/g, (match, letter) => String(letter).toUpperCase())] = value;
      }
    });
    return styles;
  }
  /**
   * Return configuration for a specific tag.
   */


  getTagConfig(tagName) {
    const common = {
      children: [],
      content: 0,
      invalid: [],
      parent: [],
      self: true,
      tagName: '',
      type: 0,
      void: false
    }; // Only spread when a tag config exists,
    // otherwise we use the empty `tagName`
    // for parent config inheritance.

    if (_bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.T[tagName]) {
      return { ...common,
        ..._bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.T[tagName],
        tagName
      };
    }

    return common;
  }
  /**
   * Verify that a node is safe from XSS and injection attacks.
   */


  isSafe(node) {
    // URLs should only support HTTP, email and phone numbers
    if (typeof HTMLAnchorElement !== 'undefined' && node instanceof HTMLAnchorElement) {
      const href = node.getAttribute('href'); // Fragment protocols start with about:
      // So let's just allow them

      if (href !== null && href !== void 0 && href.startsWith('#')) {
        return true;
      }

      const protocol = node.protocol.toLowerCase();
      return protocol === ':' || protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:' || protocol === 'tel:';
    }

    return true;
  }
  /**
   * Verify that an HTML tag is allowed to render.
   */


  isTagAllowed(tagName) {
    if (this.banned.has(tagName) || this.blocked.has(tagName)) {
      return false;
    } // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing


    return this.props.allowElements || this.allowed.has(tagName);
  }
  /**
   * Parse the markup by injecting it into a detached document,
   * while looping over all child nodes and generating an
   * array to interpolate into JSX.
   */


  parse() {
    if (!this.container) {
      return [];
    }

    return this.parseNode(this.container, this.getTagConfig(this.container.nodeName.toLowerCase()));
  }
  /**
   * Loop over the nodes children and generate a
   * list of text nodes and React elements.
   */


  parseNode(parentNode, parentConfig) {
    const {
      noHtml,
      noHtmlExceptMatchers,
      allowElements,
      transform,
      transformOnlyAllowList
    } = this.props;
    let content = [];
    let mergedText = ''; // @ts-expect-error Cant type iterator

    [...parentNode.childNodes].forEach(node => {
      // Create React elements from HTML elements
      if (node.nodeType === ELEMENT_NODE) {
        const tagName = node.nodeName.toLowerCase();
        const config = this.getTagConfig(tagName); // Persist any previous text

        if (mergedText) {
          content.push(mergedText);
          mergedText = '';
        } // Apply node filters first


        const nextNode = this.applyNodeFilters(tagName, node);

        if (!nextNode) {
          return;
        } // Apply transformation second


        let children;

        if (transform && !(transformOnlyAllowList && !this.isTagAllowed(tagName))) {
          this.keyIndex += 1;
          const key = this.keyIndex; // Must occur after key is set

          children = this.parseNode(nextNode, config);
          const transformed = transform(nextNode, children, config);

          if (transformed === null) {
            return;
          }

          if (typeof transformed !== 'undefined') {
            content.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().cloneElement(transformed, {
              key
            }));
            return;
          } // Reset as we're not using the transformation


          this.keyIndex = key - 1;
        } // Never allow these tags (except via a transformer)


        if (this.banned.has(tagName)) {
          return;
        } // Only render when the following criteria is met:
        //  - HTML has not been disabled
        //  - Tag is allowed
        //  - Child is valid within the parent


        if (!(noHtml || noHtmlExceptMatchers && tagName !== 'br') && this.isTagAllowed(tagName) && (allowElements || this.canRenderChild(parentConfig, config))) {
          var _children;

          this.keyIndex += 1; // Build the props as it makes it easier to test

          const attributes = this.extractAttributes(nextNode);
          const elementProps = {
            tagName
          };

          if (attributes) {
            elementProps.attributes = attributes;
          }

          if (config.void) {
            elementProps.selfClose = config.void;
          }

          content.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.E, { ...elementProps,
            key: this.keyIndex
          }, (_children = children) !== null && _children !== void 0 ? _children : this.parseNode(nextNode, config))); // Render the children of the current element only.
          // Important: If the current element is not allowed,
          // use the parent element for the next scope.
        } else {
          content = [...content, ...this.parseNode(nextNode, config.tagName ? config : parentConfig)];
        } // Apply matchers if a text node

      } else if (node.nodeType === TEXT_NODE) {
        const text = noHtml && !noHtmlExceptMatchers ? node.textContent : // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
        this.applyMatchers(node.textContent || '', parentConfig);

        if (Array.isArray(text)) {
          content = [...content, ...text];
        } else {
          mergedText += text;
        }
      }
    });

    if (mergedText) {
      content.push(mergedText);
    }

    return content;
  }
  /**
   * Deconstruct the string into an array, by replacing custom tokens with React elements,
   * so that React can render it correctly.
   */


  replaceTokens(tokenizedString, elements) {
    if (!tokenizedString.includes('{{{')) {
      return tokenizedString;
    }

    const nodes = [];
    let text = tokenizedString;
    let open = null; // Find an open token tag

    while (open = text.match(OPEN_TOKEN)) {
      const [match, tokenName] = open;
      const startIndex = open.index;
      const isVoid = match.includes('/');

      if ( true && !elements[tokenName]) {
        throw new Error(`Token "${tokenName}" found but no matching element to replace with.`);
      } // Extract the previous non-token text


      if (startIndex > 0) {
        nodes.push(text.slice(0, startIndex)); // Reduce text so that the closing tag will be found after the opening

        text = text.slice(startIndex);
      }

      const {
        children,
        matcher,
        props: elementProps
      } = elements[tokenName];
      let endIndex; // Use tag as-is if void

      if (isVoid) {
        endIndex = match.length;
        nodes.push(matcher.createElement(children, elementProps)); // Find the closing tag if not void
      } else {
        const close = text.match(new RegExp(`{{{/${tokenName}}}}`));

        if ( true && !close) {
          throw new Error(`Closing token missing for interpolated element "${tokenName}".`);
        }

        endIndex = close.index + close[0].length;
        nodes.push(matcher.createElement(this.replaceTokens(text.slice(match.length, close.index), elements), elementProps));
      } // Reduce text for the next interation


      text = text.slice(endIndex);
    } // Extra the remaining text


    if (text.length > 0) {
      nodes.push(text);
    } // Reduce to a string if possible


    if (nodes.length === 0) {
      return '';
    }

    if (nodes.length === 1 && typeof nodes[0] === 'string') {
      return nodes[0];
    }

    return nodes;
  }

}
/* eslint-disable react/jsx-fragments */


function Markup(props) {
  var _ref;

  const {
    attributes,
    className,
    containerTagName,
    content,
    emptyContent,
    parsedContent,
    tagName,
    noWrap: baseNoWrap
  } = props;
  const tag = (_ref = containerTagName !== null && containerTagName !== void 0 ? containerTagName : tagName) !== null && _ref !== void 0 ? _ref : 'span';
  const noWrap = tag === 'fragment' ? true : baseNoWrap;
  let mainContent;

  if (parsedContent) {
    mainContent = parsedContent;
  } else {
    const markup = new Parser(content !== null && content !== void 0 ? content : '', props).parse();

    if (markup.length > 0) {
      mainContent = markup;
    }
  }

  if (!mainContent) {
    mainContent = emptyContent;
  }

  if (noWrap) {
    // eslint-disable-next-line react/jsx-no-useless-fragment
    return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement((react__WEBPACK_IMPORTED_MODULE_1___default().Fragment), null, mainContent);
  }

  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_bundle_7aab7250_js__WEBPACK_IMPORTED_MODULE_0__.E, {
    attributes: attributes,
    className: className,
    tagName: tag
  }, mainContent);
}
/* eslint-disable promise/prefer-await-to-callbacks */


function Interweave(props) {
  const {
    attributes,
    className,
    content = '',
    disableFilters = false,
    disableMatchers = false,
    emptyContent = null,
    filters = [],
    matchers = [],
    onAfterParse = null,
    onBeforeParse = null,
    tagName = 'span',
    noWrap = false,
    ...parserProps
  } = props;
  const allMatchers = disableMatchers ? [] : matchers;
  const allFilters = disableFilters ? [] : filters;
  const beforeCallbacks = onBeforeParse ? [onBeforeParse] : [];
  const afterCallbacks = onAfterParse ? [onAfterParse] : []; // Inherit callbacks from matchers

  allMatchers.forEach(matcher => {
    if (matcher.onBeforeParse) {
      beforeCallbacks.push(matcher.onBeforeParse.bind(matcher));
    }

    if (matcher.onAfterParse) {
      afterCallbacks.push(matcher.onAfterParse.bind(matcher));
    }
  }); // Trigger before callbacks

  const markup = beforeCallbacks.reduce((string, callback) => {
    const nextString = callback(string, props);

    if ( true && typeof nextString !== 'string') {
      throw new TypeError('Interweave `onBeforeParse` must return a valid HTML string.');
    }

    return nextString;
  }, content !== null && content !== void 0 ? content : ''); // Parse the markup

  const parser = new Parser(markup, parserProps, allMatchers, allFilters); // Trigger after callbacks

  const nodes = afterCallbacks.reduce((parserNodes, callback) => {
    const nextNodes = callback(parserNodes, props);

    if ( true && !Array.isArray(nextNodes)) {
      throw new TypeError('Interweave `onAfterParse` must return an array of strings and React elements.');
    }

    return nextNodes;
  }, parser.parse());
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(Markup, {
    attributes: attributes,
    className: className // eslint-disable-next-line react/destructuring-assignment
    ,
    containerTagName: props.containerTagName,
    emptyContent: emptyContent,
    noWrap: noWrap,
    parsedContent: nodes.length === 0 ? undefined : nodes,
    tagName: tagName
  });
}


//# sourceMappingURL=index.js.map


/***/ })

}]);
//# sourceMappingURL=vendors-admin-settings-node_modules_pnpm_interweave_13_1_1_react_18_3_1_node_modules_interweave_esm_-66f9ad70.js.map