var e = Object.create,
  t = Object.defineProperty,
  n = Object.getOwnPropertyDescriptor,
  r = Object.getOwnPropertyNames,
  i = Object.getPrototypeOf,
  a = Object.prototype.hasOwnProperty,
  o = (e, t) => () => (t || e((t = {
    exports: {}
  }).exports, t), t.exports),
  s = (e, i, o, s) => {
    if (i && typeof i == `object` || typeof i == `function`)
      for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
        get: (e => i[e]).bind(null, d),
        enumerable: !(s = n(i, d)) || s.enumerable
      });
    return e
  },
  c = (n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, `default`, {
    value: n,
    enumerable: !0
  }) : a, n));
(function() {
  let e = document.createElement(`link`).relList;
  if (e && e.supports && e.supports(`modulepreload`)) return;
  for (let e of document.querySelectorAll(`link[rel="modulepreload"]`)) n(e);
  new MutationObserver(e => {
    for (let t of e)
      if (t.type === `childList`)
        for (let e of t.addedNodes) e.tagName === `LINK` && e.rel === `modulepreload` && n(e)
  }).observe(document, {
    childList: !0,
    subtree: !0
  });

  function t(e) {
    let t = {};
    return e.integrity && (t.integrity = e.integrity), e.referrerPolicy && (t.referrerPolicy = e.referrerPolicy), e.crossOrigin === `use-credentials` ? t.credentials = `include` : e.crossOrigin === `anonymous` ? t.credentials = `omit` : t.credentials = `same-origin`, t
  }

  function n(e) {
    if (e.ep) return;
    e.ep = !0;
    let n = t(e);
    fetch(e.href, n)
  }
})();
var l = o(((e, t) => {
    t.exports = n;

    function n(e) {
      return Object.defineProperties(t, {
        defaultLabel: {
          value: ``,
          writable: !0
        },
        labelPadding: {
          value: !0,
          writable: !0
        },
        maxLabelLength: {
          value: 0,
          writable: !0
        },
        labelLength: {
          get() {
            switch (typeof t.labelPadding) {
              case `boolean`:
                return t.labelPadding ? t.maxLabelLength : 0;
              case `number`:
                return t.labelPadding;
              default:
                return 0
            }
          }
        }
      });

      function t(n) {
        t.maxLabelLength = Math.max(t.maxLabelLength, n.length);
        let r = {};
        for (let t of e.levels) r[t] = (...r) => e.logData(r, {
          level: t,
          scope: n
        });
        return r.log = r.info, r
      }
    }
  })),
  u = o(((e, t) => {
    t.exports = class {
      constructor({
        processMessage: e
      }) {
        this.processMessage = e, this.buffer = [], this.enabled = !1, this.begin = this.begin.bind(this), this.commit = this.commit.bind(this), this.reject = this.reject.bind(this)
      }
      addMessage(e) {
        this.buffer.push(e)
      }
      begin() {
        this.enabled = []
      }
      commit() {
        this.enabled = !1, this.buffer.forEach(e => this.processMessage(e)), this.buffer = []
      }
      reject() {
        this.enabled = !1, this.buffer = []
      }
    }
  })),
  d = o(((e, t) => {
    var n = l(),
      r = u();
    t.exports = class e {
      static instances = {};
      dependencies = {};
      errorHandler = null;
      eventLogger = null;
      functions = {};
      hooks = [];
      isDev = !1;
      levels = null;
      logId = null;
      scope = null;
      transports = {};
      variables = {};
      constructor({
        allowUnknownLevel: t = !1,
        dependencies: i = {},
        errorHandler: a,
        eventLogger: o,
        initializeFn: s,
        isDev: c = !1,
        levels: l = [`error`, `warn`, `info`, `verbose`, `debug`, `silly`],
        logId: u,
        transportFactories: d = {},
        variables: ee
      } = {}) {
        this.addLevel = this.addLevel.bind(this), this.create = this.create.bind(this), this.initialize = this.initialize.bind(this), this.logData = this.logData.bind(this), this.processMessage = this.processMessage.bind(this), this.allowUnknownLevel = t, this.buffering = new r(this), this.dependencies = i, this.initializeFn = s, this.isDev = c, this.levels = l, this.logId = u, this.scope = n(this), this.transportFactories = d, this.variables = ee || {};
        for (let e of this.levels) this.addLevel(e, !1);
        this.log = this.info, this.functions.log = this.log, this.errorHandler = a, a?.setOptions({
          ...i,
          logFn: this.error
        }), this.eventLogger = o, o?.setOptions({
          ...i,
          logger: this
        });
        for (let [e, t] of Object.entries(d)) this.transports[e] = t(this, i);
        e.instances[u] = this
      }
      static getInstance({
        logId: e
      }) {
        return this.instances[e] || this.instances.default
      }
      addLevel(e, t = this.levels.length) {
        t !== !1 && this.levels.splice(t, 0, e), this[e] = (...t) => this.logData(t, {
          level: e
        }), this.functions[e] = this[e]
      }
      catchErrors(e) {
        return this.processMessage({
          data: [`log.catchErrors is deprecated. Use log.errorHandler instead`],
          level: `warn`
        }, {
          transports: [`console`]
        }), this.errorHandler.startCatching(e)
      }
      create(t) {
        return typeof t == `string` && (t = {
          logId: t
        }), new e({
          dependencies: this.dependencies,
          errorHandler: this.errorHandler,
          initializeFn: this.initializeFn,
          isDev: this.isDev,
          transportFactories: this.transportFactories,
          variables: {
            ...this.variables
          },
          ...t
        })
      }
      compareLevels(e, t, n = this.levels) {
        let r = n.indexOf(e),
          i = n.indexOf(t);
        return i === -1 || r === -1 ? !0 : i <= r
      }
      initialize(e = {}) {
        this.initializeFn({
          logger: this,
          ...this.dependencies,
          ...e
        })
      }
      logData(e, t = {}) {
        this.buffering.enabled ? this.buffering.addMessage({
          data: e,
          date: new Date,
          ...t
        }) : this.processMessage({
          data: e,
          ...t
        })
      }
      processMessage(e, {
        transports: t = this.transports
      } = {}) {
        if (e.cmd === `errorHandler`) {
          this.errorHandler.handle(e.error, {
            errorName: e.errorName,
            processType: `renderer`,
            showDialog: !!e.showDialog
          });
          return
        }
        let n = e.level;
        this.allowUnknownLevel || (n = this.levels.includes(e.level) ? e.level : `info`);
        let r = {
          date: new Date,
          logId: this.logId,
          ...e,
          level: n,
          variables: {
            ...this.variables,
            ...e.variables
          }
        };
        for (let [n, i] of this.transportEntries(t))
          if (!(typeof i != `function` || i.level === !1) && this.compareLevels(i.level, e.level)) try {
            let e = this.hooks.reduce((e, t) => e && t(e, i, n), r);
            e && i({
              ...e,
              data: [...e.data]
            })
          } catch (e) {
            this.processInternalErrorFn(e)
          }
      }
      processInternalErrorFn(e) {}
      transportEntries(e = this.transports) {
        return (Array.isArray(e) ? e : Object.entries(e)).map(e => {
          switch (typeof e) {
            case `string`:
              return this.transports[e] ? [e, this.transports[e]] : null;
            case `function`:
              return [e.name, e];
            default:
              return Array.isArray(e) ? e : null
          }
        }).filter(Boolean)
      }
    }
  })),
  ee = o(((e, t) => {
    var n = console.error;
    t.exports = class {
      logFn = null;
      onError = null;
      showDialog = !1;
      preventDefault = !0;
      constructor({
        logFn: e = null
      } = {}) {
        this.handleError = this.handleError.bind(this), this.handleRejection = this.handleRejection.bind(this), this.startCatching = this.startCatching.bind(this), this.logFn = e
      }
      handle(e, {
        logFn: t = this.logFn,
        errorName: r = ``,
        onError: i = this.onError,
        showDialog: a = this.showDialog
      } = {}) {
        try {
          i?.({
            error: e,
            errorName: r,
            processType: `renderer`
          }) !== !1 && t({
            error: e,
            errorName: r,
            showDialog: a
          })
        } catch {
          n(e)
        }
      }
      setOptions({
        logFn: e,
        onError: t,
        preventDefault: n,
        showDialog: r
      }) {
        typeof e == `function` && (this.logFn = e), typeof t == `function` && (this.onError = t), typeof n == `boolean` && (this.preventDefault = n), typeof r == `boolean` && (this.showDialog = r)
      }
      startCatching({
        onError: e,
        showDialog: t
      } = {}) {
        this.isActive || (this.isActive = !0, this.setOptions({
          onError: e,
          showDialog: t
        }), window.addEventListener(`error`, e => {
          this.preventDefault && e.preventDefault?.(), this.handleError(e.error || e)
        }), window.addEventListener(`unhandledrejection`, e => {
          this.preventDefault && e.preventDefault?.(), this.handleRejection(e.reason || e)
        }))
      }
      handleError(e) {
        this.handle(e, {
          errorName: `Unhandled`
        })
      }
      handleRejection(e) {
        let t = e instanceof Error ? e : Error(JSON.stringify(e));
        this.handle(t, {
          errorName: `Unhandled rejection`
        })
      }
    }
  })),
  f = o(((e, t) => {
    t.exports = {
      transform: n
    };

    function n({
      logger: e,
      message: t,
      transport: n,
      initialData: r = t?.data || [],
      transforms: i = n?.transforms
    }) {
      return i.reduce((r, i) => typeof i == `function` ? i({
        data: r,
        logger: e,
        message: t,
        transport: n
      }) : r, r)
    }
  })),
  p = o(((e, t) => {
    var {
      transform: n
    } = f();
    t.exports = i;
    var r = {
      error: console.error,
      warn: console.warn,
      info: console.info,
      verbose: console.info,
      debug: console.debug,
      silly: console.debug,
      log: console.log
    };

    function i(e) {
      return Object.assign(t, {
        format: `{h}:{i}:{s}.{ms}{scope} › {text}`,
        transforms: [a],
        writeFn({
          message: {
            level: e,
            data: t
          }
        }) {
          let n = r[e] || r.info;
          setTimeout(() => n(...t))
        }
      });

      function t(r) {
        t.writeFn({
          message: {
            ...r,
            data: n({
              logger: e,
              message: r,
              transport: t
            })
          }
        })
      }
    }

    function a({
      data: e = [],
      logger: t = {},
      message: n = {},
      transport: r = {}
    }) {
      if (typeof r.format == `function`) return r.format({
        data: e,
        level: n?.level || `info`,
        logger: t,
        message: n,
        transport: r
      });
      if (typeof r.format != `string`) return e;
      e.unshift(r.format), typeof e[1] == `string` && e[1].match(/%[1cdfiOos]/) && (e = [`${e[0]}${e[1]}`, ...e.slice(2)]);
      let i = n.date || new Date;
      return e[0] = e[0].replace(/\{(\w+)}/g, (e, r) => {
        switch (r) {
          case `level`:
            return n.level;
          case `logId`:
            return n.logId;
          case `scope`: {
            let e = n.scope || t.scope?.defaultLabel;
            return e ? ` (${e})` : ``
          }
          case `text`:
            return ``;
          case `y`:
            return i.getFullYear().toString(10);
          case `m`:
            return (i.getMonth() + 1).toString(10).padStart(2, `0`);
          case `d`:
            return i.getDate().toString(10).padStart(2, `0`);
          case `h`:
            return i.getHours().toString(10).padStart(2, `0`);
          case `i`:
            return i.getMinutes().toString(10).padStart(2, `0`);
          case `s`:
            return i.getSeconds().toString(10).padStart(2, `0`);
          case `ms`:
            return i.getMilliseconds().toString(10).padStart(3, `0`);
          case `iso`:
            return i.toISOString();
          default:
            return n.variables?.[r] || e
        }
      }).trim(), e
    }
  })),
  te = o(((e, t) => {
    var {
      transform: n
    } = f();
    t.exports = i;
    var r = new Set([Promise, WeakMap, WeakSet]);

    function i(e) {
      return Object.assign(t, {
        depth: 5,
        transforms: [o]
      });

      function t(r) {
        if (!window.__electronLog) {
          e.processMessage({
            data: [`electron-log: logger isn't initialized in the main process`],
            level: `error`
          }, {
            transports: [`console`]
          });
          return
        }
        try {
          let i = n({
            initialData: r,
            logger: e,
            message: r,
            transport: t
          });
          __electronLog.sendToMain(i)
        } catch (t) {
          e.transports.console({
            data: [`electronLog.transports.ipc`, t, `data:`, r.data],
            level: `error`
          })
        }
      }
    }

    function a(e) {
      return Object(e) !== e
    }

    function o({
      data: e,
      depth: t,
      seen: n = new WeakSet,
      transport: i = {}
    } = {}) {
      let s = t || i.depth || 5;
      return n.has(e) ? `[Circular]` : s < 1 ? a(e) ? e : Array.isArray(e) ? `[Array]` : `[${typeof e}]` : [`function`, `symbol`].includes(typeof e) ? e.toString() : a(e) ? e : r.has(e.constructor) ? `[${e.constructor.name}]` : Array.isArray(e) ? e.map(e => o({
        data: e,
        depth: s - 1,
        seen: n
      })) : e instanceof Date ? e.toISOString() : e instanceof Error ? e.stack : e instanceof Map ? new Map(Array.from(e).map(([e, t]) => [o({
        data: e,
        depth: s - 1,
        seen: n
      }), o({
        data: t,
        depth: s - 1,
        seen: n
      })])) : e instanceof Set ? new Set(Array.from(e).map(e => o({
        data: e,
        depth: s - 1,
        seen: n
      }))) : (n.add(e), Object.fromEntries(Object.entries(e).map(([e, t]) => [e, o({
        data: t,
        depth: s - 1,
        seen: n
      })])))
    }
  })),
  ne = o(((e, t) => {
    var n = d(),
      r = ee(),
      i = p(),
      a = te();
    typeof process == `object` && process.type === `browser` && console.warn(`electron-log/renderer is loaded in the main process. It could cause unexpected behaviour.`), t.exports = o(), t.exports.Logger = n, t.exports.default = t.exports;

    function o() {
      let e = new n({
        allowUnknownLevel: !0,
        errorHandler: new r,
        initializeFn: () => {},
        logId: `default`,
        transportFactories: {
          console: i,
          ipc: a
        },
        variables: {
          processType: `renderer`
        }
      });
      return e.errorHandler.setOptions({
        logFn({
          error: t,
          errorName: n,
          showDialog: r
        }) {
          e.transports.console({
            data: [n, t].filter(Boolean),
            level: `error`
          }), e.transports.ipc({
            cmd: `errorHandler`,
            error: {
              cause: t?.cause,
              code: t?.code,
              name: t?.name,
              message: t?.message,
              stack: t?.stack
            },
            errorName: n,
            logId: e.logId,
            showDialog: r
          })
        }
      }), typeof window == `object` && window.addEventListener(`message`, e => {
        let {
          cmd: t,
          logId: r,
          ...i
        } = e.data || {}, a = n.getInstance({
          logId: r
        });
        t === `message` && a.processMessage(i, {
          transports: [`console`]
        })
      }), new Proxy(e, {
        get(t, n) {
          return t[n] === void 0 ? (...t) => e.logData(t, {
            level: n
          }) : t[n]
        }
      })
    }
  })),
  m = c(o(((e, t) => {
    t.exports = ne()
  }))()),
  h = null;

function re() {
  return h
}

function g(e) {
  h = e, _()
}

function _() {
  if (!h) return;
  m.default.log(`Updating UI for user:`, h.name);
  let e = document.getElementById(`user-name`),
    t = document.getElementById(`user-avatar`),
    n = document.getElementById(`settings-user-name`),
    r = document.getElementById(`settings-user-uuid`),
    i = document.getElementById(`settings-user-type`);
  e && (e.innerText = h.name), t && (t.src = `https://minotar.net/helm/${h.uuid??h.name}/100.png`), n && (n.innerText = h.name), r && (r.innerText = `UUID: ${h.uuid}`), i && (i.innerHTML = y(h.meta.type))
}

function v(e) {
  let t = document.querySelector(`.view[data-view="${e}"]`);
  if (!t) return m.default.error(`View ${e} not found`);
  let n = t.classList.contains(`overlay`);
  e === `settings` && oe(), n || document.querySelectorAll(`.view`).forEach(e => {
    e.classList.contains(`overlay`) || e.classList.remove(`active`)
  }), t.classList.add(`active`)
}

function ie(e) {
  setTimeout(() => {
    document.querySelector(`div#view-loading`)?.classList.add(`loaded`)
  }, 400), setTimeout(() => {
    document.querySelector(`div#view-${e}`)?.classList.add(`loaded`)
  }, 200)
}

function ae(e) {
  document.querySelector(`.view[data-view="${e}"]`)?.classList.remove(`active`)
}

function y(e) {
  switch (e) {
    case `msa`:
      return `<i class="fa-brands fa-microsoft"></i>Microsoft account`;
    case `yggdrasil`:
      return `<i class="fa-solid fa-user"></i>Yggdrasil account`;
    case `azuriom`:
      return `<i class="fa-brands fa-globe"></i>Azuriom account`;
    case `crack`:
      return `<i class="fa-solid fa-user-slash"></i>Cracked account`;
    default:
      return `Unknown account type`
  }
}

function oe() {
  let e = document.querySelectorAll(`.nav-btn`),
    t = document.querySelectorAll(`.tab-content`);
  e.forEach(e => e.classList.remove(`active`)), t.forEach(e => e.classList.remove(`active`)), e[0].classList.add(`active`), t[0].classList.add(`active`)
}
var b = {
    login: async (e, t, n) => await window.api.auth.login(e, t, n),
    logout: async () => await window.api.auth.logout(),
    refresh: async () => await window.api.auth.refresh()
  },
  se = {
    get: async () => await window.api.profiles.get()
  },
  ce = {
    getStatus: async (e, t) => await window.api.server.getStatus(e, t)
  },
  le = {
    getNews: async () => await window.api.news.getNews(),
    getCategories: async () => await window.api.news.getCategories()
  },
  ue = {
    get: async () => await window.api.background.get()
  },
  de = {
    get: async () => await window.api.maintenance.get()
  },
  fe = {
    check: async () => await window.api.bootstraps.check(),
    download: async () => await window.api.bootstraps.download(),
    install: async () => await window.api.bootstraps.install(),
    downloadProgress: e => window.api.bootstraps.downloadProgress(e),
    downloadEnd: e => window.api.bootstraps.downloadEnd(e),
    error: e => window.api.bootstraps.error(e)
  },
  x = {
    launch: async e => await window.api.game.launch(e),
    launchComputeDownload: e => window.api.game.launchComputeDownload(e),
    launchDownload: e => window.api.game.launchDownload(e),
    downloadProgress: e => window.api.game.downloadProgress(e),
    downloadError: e => window.api.game.downloadError(e),
    downloadEnd: e => window.api.game.downloadEnd(e),
    launchInstallLoader: e => window.api.game.launchInstallLoader(e),
    launchExtractNatives: e => window.api.game.launchExtractNatives(e),
    extractProgress: e => window.api.game.extractProgress(e),
    extractEnd: e => window.api.game.extractEnd(e),
    launchCopyAssets: e => window.api.game.launchCopyAssets(e),
    copyProgress: e => window.api.game.copyProgress(e),
    copyEnd: e => window.api.game.copyEnd(e),
    launchPatchLoader: e => window.api.game.launchPatchLoader(e),
    patchProgress: e => window.api.game.patchProgress(e),
    patchError: e => window.api.game.patchError(e),
    patchEnd: e => window.api.game.patchEnd(e),
    launchCheckJava: e => window.api.game.launchCheckJava(e),
    javaInfo: e => window.api.game.javaInfo(e),
    launchClean: e => window.api.game.launchClean(e),
    cleanProgress: e => window.api.game.cleanProgress(e),
    cleanEnd: e => window.api.game.cleanEnd(e),
    launchLaunch: e => window.api.game.launchLaunch(e),
    launched: e => window.api.game.launched(e),
    launchData: e => window.api.game.launchData(e),
    launchClose: e => window.api.game.launchClose(e),
    launchDebug: e => window.api.game.launchDebug(e),
    patchDebug: e => window.api.game.patchDebug(e)
  },
  pe = {
    get: () => window.api.settings.get(),
    set: e => window.api.settings.set(e),
    pickJava: () => window.api.settings.pickJava()
  },
  me = {
    getInfo: () => window.api.system.getInfo()
  },
  S = new class {
    overlay;
    messageEl;
    titleEl;
    buttonsEl;
    constructor() {
      this.overlay = document.getElementById(`custom-dialog`), this.messageEl = document.getElementById(`dialog-message`), this.titleEl = document.getElementById(`dialog-title`), this.buttonsEl = document.getElementById(`dialog-buttons`)
    }
    async show(e, t, n) {
      return new Promise(r => {
        this.messageEl.innerText = e, this.buttonsEl.innerHTML = ``, n ? (this.titleEl.innerText = n, this.titleEl.classList.remove(`hidden`)) : this.titleEl.classList.add(`hidden`), (t ?? [{
          text: `Cancel`,
          type: `cancel`
        }, {
          text: `OK`,
          type: `ok`
        }]).forEach(e => {
          let t = document.createElement(`button`);
          t.innerText = e.text, t.className = `btn btn-${e.type===`ok`?`secondary`:e.type===`danger`?`danger`:`secondary`}`, t.onclick = async () => {
            if (this.close(), e.action) {
              let t = await e.action();
              r(t === void 0 ? !0 : t)
            } else switch (e.type) {
              case `cancel`:
                r(!1);
                break;
              case `ok`:
              case `danger`:
                r(!0);
                break;
              case `other`:
                m.default.warn(`The 'other' type button requires an action!`), r(null);
                break
            }
          }, this.buttonsEl.appendChild(t)
        }), this.overlay.classList.remove(`hidden`)
      })
    }
    close() {
      this.overlay.classList.add(`hidden`)
    }
  };

function he() {
  let e = document.getElementById(`btn-login-ms`),
    t = document.getElementById(`input-username`),
    n = document.getElementById(`input-password`),
    r = document.getElementById(`input-twofa`),
    i = document.getElementById(`twofa-group`);
  !e || !t || !n || ([t, n, r].forEach(t => t?.addEventListener(`keydown`, t => {
    t.key === `Enter` && e.click()
  })), e.addEventListener(`click`, async () => {
    let a = t.value.trim(),
      o = n.value;
    if (!a || !o) {
      await S.show(`Merci de renseigner ton identifiant et ton mot de passe.`, [{
        text: `OK`,
        type: `ok`
      }]);
      return
    }
    let s = e.innerHTML;
    e.disabled = !0, e.innerHTML = `<i class="fa-solid fa-circle-notch fa-spin"></i> Connexion...`;
    try {
      let e = i?.classList.contains(`hidden`) ? void 0 : r?.value.trim() || void 0,
        t = await b.login(a, o, e);
      t.success ? (g(t.account), v(`home`)) : `twoFA` in t && t.twoFA ? (i?.classList.remove(`hidden`), r?.focus(), await S.show(`Un code 2FA est requis. Renseigne-le et clique à nouveau sur Se connecter.`, [{
        text: `OK`,
        type: `ok`
      }])) : (m.default.error(t.error), await S.show(`Identifiants incorrects ou compte introuvable.`, [{
        text: `OK`,
        type: `ok`
      }]))
    } catch (e) {
      m.default.error(e), await S.show(`Une erreur est survenue lors de la connexion.`, [{
        text: `OK`,
        type: `ok`
      }])
    } finally {
      e.disabled = !1, e.innerHTML = s
    }
  }))
}

function C() {
  return {
    async: !1,
    breaks: !1,
    extensions: null,
    gfm: !0,
    hooks: null,
    pedantic: !1,
    renderer: null,
    silent: !1,
    tokenizer: null,
    walkTokens: null
  }
}
var w = C();

function T(e) {
  w = e
}
var E = {
  exec: () => null
};

function D(e, t = ``) {
  let n = typeof e == `string` ? e : e.source,
    r = {
      replace: (e, t) => {
        let i = typeof t == `string` ? t : t.source;
        return i = i.replace(k.caret, `$1`), n = n.replace(e, i), r
      },
      getRegex: () => new RegExp(n, t)
    };
  return r
}
var O = (() => {
    try {
      return !0
    } catch {
      return !1
    }
  })(),
  k = {
    codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
    outputLinkReplace: /\\([\[\]])/g,
    indentCodeCompensation: /^(\s+)(?:```)/,
    beginningSpace: /^\s+/,
    endingHash: /#$/,
    startingSpaceChar: /^ /,
    endingSpaceChar: / $/,
    nonSpaceChar: /[^ ]/,
    newLineCharGlobal: /\n/g,
    tabCharGlobal: /\t/g,
    multipleSpaceGlobal: /\s+/g,
    blankLine: /^[ \t]*$/,
    doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
    blockquoteStart: /^ {0,3}>/,
    blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
    blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
    listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
    listIsTask: /^\[[ xX]\] +\S/,
    listReplaceTask: /^\[[ xX]\] +/,
    listTaskCheckbox: /\[[ xX]\]/,
    anyLine: /\n.*\n/,
    hrefBrackets: /^<(.*)>$/,
    tableDelimiter: /[:|]/,
    tableAlignChars: /^\||\| *$/g,
    tableRowBlankLine: /\n[ \t]*$/,
    tableAlignRight: /^ *-+: *$/,
    tableAlignCenter: /^ *:-+: *$/,
    tableAlignLeft: /^ *:-+ *$/,
    startATag: /^<a /i,
    endATag: /^<\/a>/i,
    startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
    endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
    startAngleBracket: /^</,
    endAngleBracket: />$/,
    pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
    unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
    escapeTest: /[&<>"']/,
    escapeReplace: /[&<>"']/g,
    escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
    escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
    caret: /(^|[^\[])\^/g,
    percentDecode: /%25/g,
    findPipe: /\|/g,
    splitPipe: / \|/,
    slashPipe: /\\\|/g,
    carriageReturn: /\r\n|\r/g,
    spaceLine: /^ +$/gm,
    notSpaceStart: /^\S*/,
    endingNewline: /\n$/,
    listItemRegex: e => RegExp(`^( {0,3}${e})((?:[	 ][^\\n]*)?(?:\\n|$))`),
    nextBulletRegex: e => RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),
    hrRegex: e => RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
    fencesBeginRegex: e => RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),
    headingBeginRegex: e => RegExp(`^ {0,${Math.min(3,e-1)}}#`),
    htmlBeginRegex: e => RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`, `i`),
    blockquoteBeginRegex: e => RegExp(`^ {0,${Math.min(3,e-1)}}>`)
  },
  ge = /^(?:[ \t]*(?:\n|$))+/,
  _e = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,
  ve = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
  A = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
  ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
  j = / {0,3}(?:[*+-]|\d{1,9}[.)])/,
  be = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
  xe = D(be).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, ``).getRegex(),
  Se = D(be).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),
  Ce = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
  we = /^[^\n]+/,
  Te = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,
  Ee = D(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`, Te).replace(`title`, /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),
  De = D(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex(),
  M = `address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,
  N = /<!--(?:-?>|[\s\S]*?(?:-->|$))/,
  P = D(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))`, `i`).replace(`comment`, N).replace(`tag`, M).replace(`attribute`, / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),
  Oe = D(Ce).replace(`hr`, A).replace(`heading`, ` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`, ``).replace(`|table`, ``).replace(`blockquote`, ` {0,3}>`).replace(`fences`, " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`, ` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`, `</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`, M).getRegex(),
  ke = {
    blockquote: D(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`, Oe).getRegex(),
    code: _e,
    def: Ee,
    fences: ve,
    heading: ye,
    hr: A,
    html: P,
    lheading: xe,
    list: De,
    newline: ge,
    paragraph: Oe,
    table: E,
    text: we
  },
  Ae = D(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`, A).replace(`heading`, ` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`, ` {0,3}>`).replace(`code`, `(?: {4}| {0,3}	)[^\\n]`).replace(`fences`, " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`, ` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`, `</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`, M).getRegex(),
  je = {
    ...ke,
    lheading: Se,
    table: Ae,
    paragraph: D(Ce).replace(`hr`, A).replace(`heading`, ` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`, ``).replace(`table`, Ae).replace(`blockquote`, ` {0,3}>`).replace(`fences`, " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`, ` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`, `</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`, M).getRegex()
  },
  Me = {
    ...ke,
    html: D(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`, N).replace(/tag/g, `(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),
    def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
    heading: /^(#{1,6})(.*)(?:\n+|$)/,
    fences: E,
    lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
    paragraph: D(Ce).replace(`hr`, A).replace(`heading`, ` *#{1,6} *[^
]`).replace(`lheading`, xe).replace(`|table`, ``).replace(`blockquote`, ` {0,3}>`).replace(`|fences`, ``).replace(`|list`, ``).replace(`|html`, ``).replace(`|tag`, ``).getRegex()
  },
  Ne = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
  Pe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
  F = /^( {2,}|\\)\n(?!\s*$)/,
  Fe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
  I = /[\p{P}\p{S}]/u,
  Ie = /[\s\p{P}\p{S}]/u,
  Le = /[^\s\p{P}\p{S}]/u,
  Re = D(/^((?![*_])punctSpace)/, `u`).replace(/punctSpace/g, Ie).getRegex(),
  ze = /(?!~)[\p{P}\p{S}]/u,
  Be = /(?!~)[\s\p{P}\p{S}]/u,
  Ve = /(?:[^\s\p{P}\p{S}]|~)/u,
  He = D(/link|precode-code|html/, `g`).replace(`link`, /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`, O ? "(?<!`)()" : "(^^|[^`])").replace(`code`, /(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`, /<(?! )[^<>]*?>/).getRegex(),
  L = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,
  Ue = D(L, `u`).replace(/punct/g, I).getRegex(),
  We = D(L, `u`).replace(/punct/g, ze).getRegex(),
  Ge = `^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,
  Ke = D(Ge, `gu`).replace(/notPunctSpace/g, Le).replace(/punctSpace/g, Ie).replace(/punct/g, I).getRegex(),
  qe = D(Ge, `gu`).replace(/notPunctSpace/g, Ve).replace(/punctSpace/g, Be).replace(/punct/g, ze).getRegex(),
  Je = D(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`, `gu`).replace(/notPunctSpace/g, Le).replace(/punctSpace/g, Ie).replace(/punct/g, I).getRegex(),
  Ye = D(/^~~?(?:((?!~)punct)|[^\s~])/, `u`).replace(/punct/g, I).getRegex(),
  R = D(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`, `gu`).replace(/notPunctSpace/g, Le).replace(/punctSpace/g, Ie).replace(/punct/g, I).getRegex(),
  z = D(/\\(punct)/, `gu`).replace(/punct/g, I).getRegex(),
  Xe = D(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`, /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`, /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),
  Ze = D(N).replace(`(?:-->|$)`, `-->`).getRegex(),
  Qe = D(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`, Ze).replace(`attribute`, /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),
  $e = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,
  B = D(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`, $e).replace(`href`, /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`, /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),
  et = D(/^!?\[(label)\]\[(ref)\]/).replace(`label`, $e).replace(`ref`, Te).getRegex(),
  tt = D(/^!?\[(ref)\](?:\[\])?/).replace(`ref`, Te).getRegex(),
  nt = D(`reflink|nolink(?!\\()`, `g`).replace(`reflink`, et).replace(`nolink`, tt).getRegex(),
  rt = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,
  it = {
    _backpedal: E,
    anyPunctuation: z,
    autolink: Xe,
    blockSkip: He,
    br: F,
    code: Pe,
    del: E,
    delLDelim: E,
    delRDelim: E,
    emStrongLDelim: Ue,
    emStrongRDelimAst: Ke,
    emStrongRDelimUnd: Je,
    escape: Ne,
    link: B,
    nolink: tt,
    punctuation: Re,
    reflink: et,
    reflinkSearch: nt,
    tag: Qe,
    text: Fe,
    url: E
  },
  at = {
    ...it,
    link: D(/^!?\[(label)\]\((.*?)\)/).replace(`label`, $e).getRegex(),
    reflink: D(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`, $e).getRegex()
  },
  ot = {
    ...it,
    emStrongRDelimAst: qe,
    emStrongLDelim: We,
    delLDelim: Ye,
    delRDelim: R,
    url: D(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`, rt).replace(`email`, /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
    _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
    del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
    text: D(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`, rt).getRegex()
  },
  st = {
    ...ot,
    br: D(F).replace(`{2,}`, `*`).getRegex(),
    text: D(ot.text).replace(`\\b_`, `\\b_| {2,}\\n`).replace(/\{2,\}/g, `*`).getRegex()
  },
  ct = {
    normal: ke,
    gfm: je,
    pedantic: Me
  },
  lt = {
    normal: it,
    gfm: ot,
    breaks: st,
    pedantic: at
  },
  ut = {
    "&": `&amp;`,
    "<": `&lt;`,
    ">": `&gt;`,
    '"': `&quot;`,
    "'": `&#39;`
  },
  dt = e => ut[e];

function V(e, t) {
  if (t) {
    if (k.escapeTest.test(e)) return e.replace(k.escapeReplace, dt)
  } else if (k.escapeTestNoEncode.test(e)) return e.replace(k.escapeReplaceNoEncode, dt);
  return e
}

function ft(e) {
  try {
    e = encodeURI(e).replace(k.percentDecode, `%`)
  } catch {
    return null
  }
  return e
}

function pt(e, t) {
  let n = e.replace(k.findPipe, (e, t, n) => {
      let r = !1,
        i = t;
      for (; --i >= 0 && n[i] === `\\`;) r = !r;
      return r ? `|` : ` |`
    }).split(k.splitPipe),
    r = 0;
  if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t)
    if (n.length > t) n.splice(t);
    else
      for (; n.length < t;) n.push(``);
  for (; r < n.length; r++) n[r] = n[r].trim().replace(k.slashPipe, `|`);
  return n
}

function H(e, t, n) {
  let r = e.length;
  if (r === 0) return ``;
  let i = 0;
  for (; i < r;) {
    let a = e.charAt(r - i - 1);
    if (a === t && !n) i++;
    else if (a !== t && n) i++;
    else break
  }
  return e.slice(0, r - i)
}

function mt(e) {
  let t = e.split(`
`),
    n = t.length - 1;
  for (; n >= 0 && !t[n].trim();) n--;
  return t.length - n <= 2 ? e : t.slice(0, n + 1).join(`
`)
}

function ht(e, t) {
  if (e.indexOf(t[1]) === -1) return -1;
  let n = 0;
  for (let r = 0; r < e.length; r++)
    if (e[r] === `\\`) r++;
    else if (e[r] === t[0]) n++;
  else if (e[r] === t[1] && (n--, n < 0)) return r;
  return n > 0 ? -2 : -1
}

function gt(e, t = 0) {
  let n = t,
    r = ``;
  for (let t of e)
    if (t === `	`) {
      let e = 4 - n % 4;
      r += ` `.repeat(e), n += e
    } else r += t, n++;
  return r
}

function _t(e, t, n, r, i) {
  let a = t.href,
    o = t.title || null,
    s = e[1].replace(i.other.outputLinkReplace, `$1`);
  r.state.inLink = !0;
  let c = {
    type: e[0].charAt(0) === `!` ? `image` : `link`,
    raw: n,
    href: a,
    title: o,
    text: s,
    tokens: r.inlineTokens(s)
  };
  return r.state.inLink = !1, c
}

function vt(e, t, n) {
  let r = e.match(n.other.indentCodeCompensation);
  if (r === null) return t;
  let i = r[1];
  return t.split(`
`).map(e => {
    let t = e.match(n.other.beginningSpace);
    if (t === null) return e;
    let [r] = t;
    return r.length >= i.length ? e.slice(i.length) : e
  }).join(`
`)
}
var yt = class {
    options;
    rules;
    lexer;
    constructor(e) {
      this.options = e || w
    }
    space(e) {
      let t = this.rules.block.newline.exec(e);
      if (t && t[0].length > 0) return {
        type: `space`,
        raw: t[0]
      }
    }
    code(e) {
      let t = this.rules.block.code.exec(e);
      if (t) {
        let e = this.options.pedantic ? t[0] : mt(t[0]);
        return {
          type: `code`,
          raw: e,
          codeBlockStyle: `indented`,
          text: e.replace(this.rules.other.codeRemoveIndent, ``)
        }
      }
    }
    fences(e) {
      let t = this.rules.block.fences.exec(e);
      if (t) {
        let e = t[0],
          n = vt(e, t[3] || ``, this.rules);
        return {
          type: `code`,
          raw: e,
          lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, `$1`) : t[2],
          text: n
        }
      }
    }
    heading(e) {
      let t = this.rules.block.heading.exec(e);
      if (t) {
        let e = t[2].trim();
        if (this.rules.other.endingHash.test(e)) {
          let t = H(e, `#`);
          (this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim())
        }
        return {
          type: `heading`,
          raw: H(t[0], `
`),
          depth: t[1].length,
          text: e,
          tokens: this.lexer.inline(e)
        }
      }
    }
    hr(e) {
      let t = this.rules.block.hr.exec(e);
      if (t) return {
        type: `hr`,
        raw: H(t[0], `
`)
      }
    }
    blockquote(e) {
      let t = this.rules.block.blockquote.exec(e);
      if (t) {
        let e = H(t[0], `
`).split(`
`),
          n = ``,
          r = ``,
          i = [];
        for (; e.length > 0;) {
          let t = !1,
            a = [],
            o;
          for (o = 0; o < e.length; o++)
            if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
            else if (!t) a.push(e[o]);
          else break;
          e = e.slice(o);
          let s = a.join(`
`),
            c = s.replace(this.rules.other.blockquoteSetextReplace, `
    $1`).replace(this.rules.other.blockquoteSetextReplace2, ``);
          n = n ? `${n}
${s}` : s, r = r ? `${r}
${c}` : c;
          let l = this.lexer.state.top;
          if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
          let u = i.at(-1);
          if (u?.type === `code`) break;
          if (u?.type === `blockquote`) {
            let t = u,
              a = t.raw + `
` + e.join(`
`),
              o = this.blockquote(a);
            i[i.length - 1] = o, n = n.substring(0, n.length - t.raw.length) + o.raw, r = r.substring(0, r.length - t.text.length) + o.text;
            break
          } else if (u?.type === `list`) {
            let t = u,
              a = t.raw + `
` + e.join(`
`),
              o = this.list(a);
            i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split(`
`);
            continue
          }
        }
        return {
          type: `blockquote`,
          raw: n,
          tokens: i,
          text: r
        }
      }
    }
    list(e) {
      let t = this.rules.block.list.exec(e);
      if (t) {
        let n = t[1].trim(),
          r = n.length > 1,
          i = {
            type: `list`,
            raw: ``,
            ordered: r,
            start: r ? +n.slice(0, -1) : ``,
            loose: !1,
            items: []
          };
        n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : `[*+-]`);
        let a = this.rules.other.listItemRegex(n),
          o = !1;
        for (; e;) {
          let n = !1,
            r = ``,
            s = ``;
          if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
          r = t[0], e = e.substring(r.length);
          let c = gt(t[2].split(`
`, 1)[0], t[1].length),
            l = e.split(`
`, 1)[0],
            u = !c.trim(),
            d = 0;
          if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + `
`, e = e.substring(l.length + 1), n = !0), !n) {
            let t = this.rules.other.nextBulletRegex(d),
              n = this.rules.other.hrRegex(d),
              i = this.rules.other.fencesBeginRegex(d),
              a = this.rules.other.headingBeginRegex(d),
              o = this.rules.other.htmlBeginRegex(d),
              ee = this.rules.other.blockquoteBeginRegex(d);
            for (; e;) {
              let f = e.split(`
`, 1)[0],
                p;
              if (l = f, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, `  `), p = l) : p = l.replace(this.rules.other.tabCharGlobal, `    `), i.test(l) || a.test(l) || o.test(l) || ee.test(l) || t.test(l) || n.test(l)) break;
              if (p.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += `
` + p.slice(d);
              else {
                if (u || c.replace(this.rules.other.tabCharGlobal, `    `).search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
                s += `
` + l
              }
              u = !l.trim(), r += f + `
`, e = e.substring(f.length + 1), c = p.slice(d)
            }
          }
          i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
            type: `list_item`,
            raw: r,
            task: !!this.options.gfm && this.rules.other.listIsTask.test(s),
            loose: !1,
            text: s,
            tokens: []
          }), i.raw += r
        }
        let s = i.items.at(-1);
        if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
        else return;
        i.raw = i.raw.trimEnd();
        for (let e of i.items) {
          if (this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []), e.task) {
            if (e.text = e.text.replace(this.rules.other.listReplaceTask, ``), e.tokens[0]?.type === `text` || e.tokens[0]?.type === `paragraph`) {
              e.tokens[0].raw = e.tokens[0].raw.replace(this.rules.other.listReplaceTask, ``), e.tokens[0].text = e.tokens[0].text.replace(this.rules.other.listReplaceTask, ``);
              for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--)
                if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
                  this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, ``);
                  break
                }
            }
            let t = this.rules.other.listTaskCheckbox.exec(e.raw);
            if (t) {
              let n = {
                type: `checkbox`,
                raw: t[0] + ` `,
                checked: t[0] !== `[ ]`
              };
              e.checked = n.checked, i.loose ? e.tokens[0] && [`paragraph`, `text`].includes(e.tokens[0].type) && `tokens` in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = n.raw + e.tokens[0].raw, e.tokens[0].text = n.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(n)) : e.tokens.unshift({
                type: `paragraph`,
                raw: n.raw,
                text: n.raw,
                tokens: [n]
              }) : e.tokens.unshift(n)
            }
          }
          if (!i.loose) {
            let t = e.tokens.filter(e => e.type === `space`);
            i.loose = t.length > 0 && t.some(e => this.rules.other.anyLine.test(e.raw))
          }
        }
        if (i.loose)
          for (let e of i.items) {
            e.loose = !0;
            for (let t of e.tokens) t.type === `text` && (t.type = `paragraph`)
          }
        return i
      }
    }
    html(e) {
      let t = this.rules.block.html.exec(e);
      if (t) {
        let e = mt(t[0]);
        return {
          type: `html`,
          block: !0,
          raw: e,
          pre: t[1] === `pre` || t[1] === `script` || t[1] === `style`,
          text: e
        }
      }
    }
    def(e) {
      let t = this.rules.block.def.exec(e);
      if (t) {
        let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, ` `),
          n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, `$1`).replace(this.rules.inline.anyPunctuation, `$1`) : ``,
          r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, `$1`) : t[3];
        return {
          type: `def`,
          tag: e,
          raw: H(t[0], `
`),
          href: n,
          title: r
        }
      }
    }
    table(e) {
      let t = this.rules.block.table.exec(e);
      if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
      let n = pt(t[1]),
        r = t[2].replace(this.rules.other.tableAlignChars, ``).split(`|`),
        i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, ``).split(`
`) : [],
        a = {
          type: `table`,
          raw: H(t[0], `
`),
          header: [],
          align: [],
          rows: []
        };
      if (n.length === r.length) {
        for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push(`right`) : this.rules.other.tableAlignCenter.test(e) ? a.align.push(`center`) : this.rules.other.tableAlignLeft.test(e) ? a.align.push(`left`) : a.align.push(null);
        for (let e = 0; e < n.length; e++) a.header.push({
          text: n[e],
          tokens: this.lexer.inline(n[e]),
          header: !0,
          align: a.align[e]
        });
        for (let e of i) a.rows.push(pt(e, a.header.length).map((e, t) => ({
          text: e,
          tokens: this.lexer.inline(e),
          header: !1,
          align: a.align[t]
        })));
        return a
      }
    }
    lheading(e) {
      let t = this.rules.block.lheading.exec(e);
      if (t) {
        let e = t[1].trim();
        return {
          type: `heading`,
          raw: H(t[0], `
`),
          depth: t[2].charAt(0) === `=` ? 1 : 2,
          text: e,
          tokens: this.lexer.inline(e)
        }
      }
    }
    paragraph(e) {
      let t = this.rules.block.paragraph.exec(e);
      if (t) {
        let e = t[1].charAt(t[1].length - 1) === `
` ? t[1].slice(0, -1) : t[1];
        return {
          type: `paragraph`,
          raw: t[0],
          text: e,
          tokens: this.lexer.inline(e)
        }
      }
    }
    text(e) {
      let t = this.rules.block.text.exec(e);
      if (t) return {
        type: `text`,
        raw: t[0],
        text: t[0],
        tokens: this.lexer.inline(t[0])
      }
    }
    escape(e) {
      let t = this.rules.inline.escape.exec(e);
      if (t) return {
        type: `escape`,
        raw: t[0],
        text: t[1]
      }
    }
    tag(e) {
      let t = this.rules.inline.tag.exec(e);
      if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
        type: `html`,
        raw: t[0],
        inLink: this.lexer.state.inLink,
        inRawBlock: this.lexer.state.inRawBlock,
        block: !1,
        text: t[0]
      }
    }
    link(e) {
      let t = this.rules.inline.link.exec(e);
      if (t) {
        let e = t[2].trim();
        if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
          if (!this.rules.other.endAngleBracket.test(e)) return;
          let t = H(e.slice(0, -1), `\\`);
          if ((e.length - t.length) % 2 == 0) return
        } else {
          let e = ht(t[2], `()`);
          if (e === -2) return;
          if (e > -1) {
            let n = (t[0].indexOf(`!`) === 0 ? 5 : 4) + t[1].length + e;
            t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = ``
          }
        }
        let n = t[2],
          r = ``;
        if (this.options.pedantic) {
          let e = this.rules.other.pedanticHrefTitle.exec(n);
          e && (n = e[1], r = e[3])
        } else r = t[3] ? t[3].slice(1, -1) : ``;
        return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), _t(t, {
          href: n && n.replace(this.rules.inline.anyPunctuation, `$1`),
          title: r && r.replace(this.rules.inline.anyPunctuation, `$1`)
        }, t[0], this.lexer, this.rules)
      }
    }
    reflink(e, t) {
      let n;
      if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
        let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, ` `).toLowerCase()];
        if (!e) {
          let e = n[0].charAt(0);
          return {
            type: `text`,
            raw: e,
            text: e
          }
        }
        return _t(n, e, n[0], this.lexer, this.rules)
      }
    }
    emStrong(e, t, n = ``) {
      let r = this.rules.inline.emStrongLDelim.exec(e);
      if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
        let n = [...r[0]].length - 1,
          i, a, o = n,
          s = 0,
          c = r[0][0] === `*` ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
        for (c.lastIndex = 0, t = t.slice(-1 * e.length + n);
          (r = c.exec(t)) !== null;) {
          if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
          if (a = [...i].length, r[3] || r[4]) {
            o += a;
            continue
          } else if ((r[5] || r[6]) && n % 3 && !((n + a) % 3)) {
            s += a;
            continue
          }
          if (o -= a, o > 0) continue;
          a = Math.min(a, a + o + s);
          let t = [...r[0]][0].length,
            c = e.slice(0, n + r.index + t + a);
          if (Math.min(n, a) % 2) {
            let e = c.slice(1, -1);
            return {
              type: `em`,
              raw: c,
              text: e,
              tokens: this.lexer.inlineTokens(e)
            }
          }
          let l = c.slice(2, -2);
          return {
            type: `strong`,
            raw: c,
            text: l,
            tokens: this.lexer.inlineTokens(l)
          }
        }
      }
    }
    codespan(e) {
      let t = this.rules.inline.code.exec(e);
      if (t) {
        let e = t[2].replace(this.rules.other.newLineCharGlobal, ` `),
          n = this.rules.other.nonSpaceChar.test(e),
          r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
        return n && r && (e = e.substring(1, e.length - 1)), {
          type: `codespan`,
          raw: t[0],
          text: e
        }
      }
    }
    br(e) {
      let t = this.rules.inline.br.exec(e);
      if (t) return {
        type: `br`,
        raw: t[0]
      }
    }
    del(e, t, n = ``) {
      let r = this.rules.inline.delLDelim.exec(e);
      if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
        let n = [...r[0]].length - 1,
          i, a, o = n,
          s = this.rules.inline.delRDelim;
        for (s.lastIndex = 0, t = t.slice(-1 * e.length + n);
          (r = s.exec(t)) !== null;) {
          if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (a = [...i].length, a !== n)) continue;
          if (r[3] || r[4]) {
            o += a;
            continue
          }
          if (o -= a, o > 0) continue;
          a = Math.min(a, a + o);
          let t = [...r[0]][0].length,
            s = e.slice(0, n + r.index + t + a),
            c = s.slice(n, -n);
          return {
            type: `del`,
            raw: s,
            text: c,
            tokens: this.lexer.inlineTokens(c)
          }
        }
      }
    }
    autolink(e) {
      let t = this.rules.inline.autolink.exec(e);
      if (t) {
        let e, n;
        return t[2] === `@` ? (e = t[1], n = `mailto:` + e) : (e = t[1], n = e), {
          type: `link`,
          raw: t[0],
          text: e,
          href: n,
          tokens: [{
            type: `text`,
            raw: e,
            text: e
          }]
        }
      }
    }
    url(e) {
      let t;
      if (t = this.rules.inline.url.exec(e)) {
        let e, n;
        if (t[2] === `@`) e = t[0], n = `mailto:` + e;
        else {
          let r;
          do r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? ``; while (r !== t[0]);
          e = t[0], n = t[1] === `www.` ? `http://` + t[0] : t[0]
        }
        return {
          type: `link`,
          raw: t[0],
          text: e,
          href: n,
          tokens: [{
            type: `text`,
            raw: e,
            text: e
          }]
        }
      }
    }
    inlineText(e) {
      let t = this.rules.inline.text.exec(e);
      if (t) {
        let e = this.lexer.state.inRawBlock;
        return {
          type: `text`,
          raw: t[0],
          text: t[0],
          escaped: e
        }
      }
    }
  },
  U = class e {
    tokens;
    options;
    state;
    inlineQueue;
    tokenizer;
    constructor(e) {
      this.tokens = [], this.tokens.links = Object.create(null), this.options = e || w, this.options.tokenizer = this.options.tokenizer || new yt, this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
        inLink: !1,
        inRawBlock: !1,
        top: !0
      };
      let t = {
        other: k,
        block: ct.normal,
        inline: lt.normal
      };
      this.options.pedantic ? (t.block = ct.pedantic, t.inline = lt.pedantic) : this.options.gfm && (t.block = ct.gfm, this.options.breaks ? t.inline = lt.breaks : t.inline = lt.gfm), this.tokenizer.rules = t
    }
    static get rules() {
      return {
        block: ct,
        inline: lt
      }
    }
    static lex(t, n) {
      return new e(n).lex(t)
    }
    static lexInline(t, n) {
      return new e(n).inlineTokens(t)
    }
    lex(e) {
      e = e.replace(k.carriageReturn, `
`), this.blockTokens(e, this.tokens);
      for (let e = 0; e < this.inlineQueue.length; e++) {
        let t = this.inlineQueue[e];
        this.inlineTokens(t.src, t.tokens)
      }
      return this.inlineQueue = [], this.tokens
    }
    blockTokens(e, t = [], n = !1) {
      for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(k.tabCharGlobal, `    `).replace(k.spaceLine, ``)); e;) {
        let r;
        if (this.options.extensions?.block?.some(n => (r = n.call({
            lexer: this
          }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
        if (r = this.tokenizer.space(e)) {
          e = e.substring(r.raw.length);
          let n = t.at(-1);
          r.raw.length === 1 && n !== void 0 ? n.raw += `
` : t.push(r);
          continue
        }
        if (r = this.tokenizer.code(e)) {
          e = e.substring(r.raw.length);
          let n = t.at(-1);
          n?.type === `paragraph` || n?.type === `text` ? (n.raw += (n.raw.endsWith(`
`) ? `` : `
`) + r.raw, n.text += `
` + r.text, this.inlineQueue.at(-1).src = n.text) : t.push(r);
          continue
        }
        if (r = this.tokenizer.fences(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.heading(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.hr(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.blockquote(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.list(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.html(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.def(e)) {
          e = e.substring(r.raw.length);
          let n = t.at(-1);
          n?.type === `paragraph` || n?.type === `text` ? (n.raw += (n.raw.endsWith(`
`) ? `` : `
`) + r.raw, n.text += `
` + r.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = {
            href: r.href,
            title: r.title
          }, t.push(r));
          continue
        }
        if (r = this.tokenizer.table(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.lheading(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        let i = e;
        if (this.options.extensions?.startBlock) {
          let t = 1 / 0,
            n = e.slice(1),
            r;
          this.options.extensions.startBlock.forEach(e => {
            r = e.call({
              lexer: this
            }, n), typeof r == `number` && r >= 0 && (t = Math.min(t, r))
          }), t < 1 / 0 && t >= 0 && (i = e.substring(0, t + 1))
        }
        if (this.state.top && (r = this.tokenizer.paragraph(i))) {
          let a = t.at(-1);
          n && a?.type === `paragraph` ? (a.raw += (a.raw.endsWith(`
`) ? `` : `
`) + r.raw, a.text += `
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
          continue
        }
        if (r = this.tokenizer.text(e)) {
          e = e.substring(r.raw.length);
          let n = t.at(-1);
          n?.type === `text` ? (n.raw += (n.raw.endsWith(`
`) ? `` : `
`) + r.raw, n.text += `
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(r);
          continue
        }
        if (e) {
          let t = `Infinite loop on byte: ` + e.charCodeAt(0);
          if (this.options.silent) {
            console.error(t);
            break
          } else throw Error(t)
        }
      }
      return this.state.top = !0, t
    }
    inline(e, t = []) {
      return this.inlineQueue.push({
        src: e,
        tokens: t
      }), t
    }
    inlineTokens(e, t = []) {
      this.tokenizer.lexer = this;
      let n = e,
        r = null;
      if (this.tokens.links) {
        let e = Object.keys(this.tokens.links);
        if (e.length > 0)
          for (;
            (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null;) e.includes(r[0].slice(r[0].lastIndexOf(`[`) + 1, -1)) && (n = n.slice(0, r.index) + `[` + `a`.repeat(r[0].length - 2) + `]` + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))
      }
      for (;
        (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null;) n = n.slice(0, r.index) + `++` + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
      let i;
      for (;
        (r = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null;) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + `[` + `a`.repeat(r[0].length - i - 2) + `]` + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
      n = this.options.hooks?.emStrongMask?.call({
        lexer: this
      }, n) ?? n;
      let a = !1,
        o = ``;
      for (; e;) {
        a || (o = ``), a = !1;
        let r;
        if (this.options.extensions?.inline?.some(n => (r = n.call({
            lexer: this
          }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
        if (r = this.tokenizer.escape(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.tag(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.link(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.reflink(e, this.tokens.links)) {
          e = e.substring(r.raw.length);
          let n = t.at(-1);
          r.type === `text` && n?.type === `text` ? (n.raw += r.raw, n.text += r.text) : t.push(r);
          continue
        }
        if (r = this.tokenizer.emStrong(e, n, o)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.codespan(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.br(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.del(e, n, o)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (r = this.tokenizer.autolink(e)) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        if (!this.state.inLink && (r = this.tokenizer.url(e))) {
          e = e.substring(r.raw.length), t.push(r);
          continue
        }
        let i = e;
        if (this.options.extensions?.startInline) {
          let t = 1 / 0,
            n = e.slice(1),
            r;
          this.options.extensions.startInline.forEach(e => {
            r = e.call({
              lexer: this
            }, n), typeof r == `number` && r >= 0 && (t = Math.min(t, r))
          }), t < 1 / 0 && t >= 0 && (i = e.substring(0, t + 1))
        }
        if (r = this.tokenizer.inlineText(i)) {
          e = e.substring(r.raw.length), r.raw.slice(-1) !== `_` && (o = r.raw.slice(-1)), a = !0;
          let n = t.at(-1);
          n?.type === `text` ? (n.raw += r.raw, n.text += r.text) : t.push(r);
          continue
        }
        if (e) {
          let t = `Infinite loop on byte: ` + e.charCodeAt(0);
          if (this.options.silent) {
            console.error(t);
            break
          } else throw Error(t)
        }
      }
      return t
    }
  },
  bt = class {
    options;
    parser;
    constructor(e) {
      this.options = e || w
    }
    space(e) {
      return ``
    }
    code({
      text: e,
      lang: t,
      escaped: n
    }) {
      let r = (t || ``).match(k.notSpaceStart)?.[0],
        i = e.replace(k.endingNewline, ``) + `
`;
      return r ? `<pre><code class="language-` + V(r) + `">` + (n ? i : V(i, !0)) + `</code></pre>
` : `<pre><code>` + (n ? i : V(i, !0)) + `</code></pre>
`
    }
    blockquote({
      tokens: e
    }) {
      return `<blockquote>
${this.parser.parse(e)}</blockquote>
`
    }
    html({
      text: e
    }) {
      return e
    }
    def(e) {
      return ``
    }
    heading({
      tokens: e,
      depth: t
    }) {
      return `<h${t}>${this.parser.parseInline(e)}</h${t}>
`
    }
    hr(e) {
      return `<hr>
`
    }
    list(e) {
      let t = e.ordered,
        n = e.start,
        r = ``;
      for (let t = 0; t < e.items.length; t++) {
        let n = e.items[t];
        r += this.listitem(n)
      }
      let i = t ? `ol` : `ul`,
        a = t && n !== 1 ? ` start="` + n + `"` : ``;
      return `<` + i + a + `>
` + r + `</` + i + `>
`
    }
    listitem(e) {
      return `<li>${this.parser.parse(e.tokens)}</li>
`
    }
    checkbox({
      checked: e
    }) {
      return `<input ` + (e ? `checked="" ` : ``) + `disabled="" type="checkbox"> `
    }
    paragraph({
      tokens: e
    }) {
      return `<p>${this.parser.parseInline(e)}</p>
`
    }
    table(e) {
      let t = ``,
        n = ``;
      for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
      t += this.tablerow({
        text: n
      });
      let r = ``;
      for (let t = 0; t < e.rows.length; t++) {
        let i = e.rows[t];
        n = ``;
        for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
        r += this.tablerow({
          text: n
        })
      }
      return r &&= `<tbody>${r}</tbody>`, `<table>
<thead>
` + t + `</thead>
` + r + `</table>
`
    }
    tablerow({
      text: e
    }) {
      return `<tr>
${e}</tr>
`
    }
    tablecell(e) {
      let t = this.parser.parseInline(e.tokens),
        n = e.header ? `th` : `td`;
      return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
`
    }
    strong({
      tokens: e
    }) {
      return `<strong>${this.parser.parseInline(e)}</strong>`
    }
    em({
      tokens: e
    }) {
      return `<em>${this.parser.parseInline(e)}</em>`
    }
    codespan({
      text: e
    }) {
      return `<code>${V(e,!0)}</code>`
    }
    br(e) {
      return `<br>`
    }
    del({
      tokens: e
    }) {
      return `<del>${this.parser.parseInline(e)}</del>`
    }
    link({
      href: e,
      title: t,
      tokens: n
    }) {
      let r = this.parser.parseInline(n),
        i = ft(e);
      if (i === null) return r;
      e = i;
      let a = `<a href="` + e + `"`;
      return t && (a += ` title="` + V(t) + `"`), a += `>` + r + `</a>`, a
    }
    image({
      href: e,
      title: t,
      text: n,
      tokens: r
    }) {
      r && (n = this.parser.parseInline(r, this.parser.textRenderer));
      let i = ft(e);
      if (i === null) return V(n);
      e = i;
      let a = `<img src="${e}" alt="${V(n)}"`;
      return t && (a += ` title="${V(t)}"`), a += `>`, a
    }
    text(e) {
      return `tokens` in e && e.tokens ? this.parser.parseInline(e.tokens) : `escaped` in e && e.escaped ? e.text : V(e.text)
    }
  },
  xt = class {
    strong({
      text: e
    }) {
      return e
    }
    em({
      text: e
    }) {
      return e
    }
    codespan({
      text: e
    }) {
      return e
    }
    del({
      text: e
    }) {
      return e
    }
    html({
      text: e
    }) {
      return e
    }
    text({
      text: e
    }) {
      return e
    }
    link({
      text: e
    }) {
      return `` + e
    }
    image({
      text: e
    }) {
      return `` + e
    }
    br() {
      return ``
    }
    checkbox({
      raw: e
    }) {
      return e
    }
  },
  W = class e {
    options;
    renderer;
    textRenderer;
    constructor(e) {
      this.options = e || w, this.options.renderer = this.options.renderer || new bt, this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new xt
    }
    static parse(t, n) {
      return new e(n).parse(t)
    }
    static parseInline(t, n) {
      return new e(n).parseInline(t)
    }
    parse(e) {
      this.renderer.parser = this;
      let t = ``;
      for (let n = 0; n < e.length; n++) {
        let r = e[n];
        if (this.options.extensions?.renderers?.[r.type]) {
          let e = r,
            n = this.options.extensions.renderers[e.type].call({
              parser: this
            }, e);
          if (n !== !1 || ![`space`, `hr`, `heading`, `code`, `table`, `blockquote`, `list`, `html`, `def`, `paragraph`, `text`].includes(e.type)) {
            t += n || ``;
            continue
          }
        }
        let i = r;
        switch (i.type) {
          case `space`:
            t += this.renderer.space(i);
            break;
          case `hr`:
            t += this.renderer.hr(i);
            break;
          case `heading`:
            t += this.renderer.heading(i);
            break;
          case `code`:
            t += this.renderer.code(i);
            break;
          case `table`:
            t += this.renderer.table(i);
            break;
          case `blockquote`:
            t += this.renderer.blockquote(i);
            break;
          case `list`:
            t += this.renderer.list(i);
            break;
          case `checkbox`:
            t += this.renderer.checkbox(i);
            break;
          case `html`:
            t += this.renderer.html(i);
            break;
          case `def`:
            t += this.renderer.def(i);
            break;
          case `paragraph`:
            t += this.renderer.paragraph(i);
            break;
          case `text`:
            t += this.renderer.text(i);
            break;
          default: {
            let e = `Token with "` + i.type + `" type was not found.`;
            if (this.options.silent) return console.error(e), ``;
            throw Error(e)
          }
        }
      }
      return t
    }
    parseInline(e, t = this.renderer) {
      this.renderer.parser = this;
      let n = ``;
      for (let r = 0; r < e.length; r++) {
        let i = e[r];
        if (this.options.extensions?.renderers?.[i.type]) {
          let e = this.options.extensions.renderers[i.type].call({
            parser: this
          }, i);
          if (e !== !1 || ![`escape`, `html`, `link`, `image`, `strong`, `em`, `codespan`, `br`, `del`, `text`].includes(i.type)) {
            n += e || ``;
            continue
          }
        }
        let a = i;
        switch (a.type) {
          case `escape`:
            n += t.text(a);
            break;
          case `html`:
            n += t.html(a);
            break;
          case `link`:
            n += t.link(a);
            break;
          case `image`:
            n += t.image(a);
            break;
          case `checkbox`:
            n += t.checkbox(a);
            break;
          case `strong`:
            n += t.strong(a);
            break;
          case `em`:
            n += t.em(a);
            break;
          case `codespan`:
            n += t.codespan(a);
            break;
          case `br`:
            n += t.br(a);
            break;
          case `del`:
            n += t.del(a);
            break;
          case `text`:
            n += t.text(a);
            break;
          default: {
            let e = `Token with "` + a.type + `" type was not found.`;
            if (this.options.silent) return console.error(e), ``;
            throw Error(e)
          }
        }
      }
      return n
    }
  },
  St = class {
    options;
    block;
    constructor(e) {
      this.options = e || w
    }
    static passThroughHooks = new Set([`preprocess`, `postprocess`, `processAllTokens`, `emStrongMask`]);
    static passThroughHooksRespectAsync = new Set([`preprocess`, `postprocess`, `processAllTokens`]);
    preprocess(e) {
      return e
    }
    postprocess(e) {
      return e
    }
    processAllTokens(e) {
      return e
    }
    emStrongMask(e) {
      return e
    }
    provideLexer(e = this.block) {
      return e ? U.lex : U.lexInline
    }
    provideParser(e = this.block) {
      return e ? W.parse : W.parseInline
    }
  },
  Ct = new class {
    defaults = C();
    options = this.setOptions;
    parse = this.parseMarkdown(!0);
    parseInline = this.parseMarkdown(!1);
    Parser = W;
    Renderer = bt;
    TextRenderer = xt;
    Lexer = U;
    Tokenizer = yt;
    Hooks = St;
    constructor(...e) {
      this.use(...e)
    }
    walkTokens(e, t) {
      let n = [];
      for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
        case `table`: {
          let e = r;
          for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
          for (let r of e.rows)
            for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
          break
        }
        case `list`: {
          let e = r;
          n = n.concat(this.walkTokens(e.items, t));
          break
        }
        default: {
          let e = r;
          this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach(r => {
            let i = e[r].flat(1 / 0);
            n = n.concat(this.walkTokens(i, t))
          }) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)))
        }
      }
      return n
    }
    use(...e) {
      let t = this.defaults.extensions || {
        renderers: {},
        childTokens: {}
      };
      return e.forEach(e => {
        let n = {
          ...e
        };
        if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach(e => {
            if (!e.name) throw Error(`extension name required`);
            if (`renderer` in e) {
              let n = t.renderers[e.name];
              n ? t.renderers[e.name] = function(...t) {
                let r = e.renderer.apply(this, t);
                return r === !1 && (r = n.apply(this, t)), r
              } : t.renderers[e.name] = e.renderer
            }
            if (`tokenizer` in e) {
              if (!e.level || e.level !== `block` && e.level !== `inline`) throw Error(`extension level must be 'block' or 'inline'`);
              let n = t[e.level];
              n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === `block` ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === `inline` && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]))
            }
            `childTokens` in e && e.childTokens && (t.childTokens[e.name] = e.childTokens)
          }), n.extensions = t), e.renderer) {
          let t = this.defaults.renderer || new bt(this.defaults);
          for (let n in e.renderer) {
            if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
            if ([`options`, `parser`].includes(n)) continue;
            let r = n,
              i = e.renderer[r],
              a = t[r];
            t[r] = (...e) => {
              let n = i.apply(t, e);
              return n === !1 && (n = a.apply(t, e)), n || ``
            }
          }
          n.renderer = t
        }
        if (e.tokenizer) {
          let t = this.defaults.tokenizer || new yt(this.defaults);
          for (let n in e.tokenizer) {
            if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
            if ([`options`, `rules`, `lexer`].includes(n)) continue;
            let r = n,
              i = e.tokenizer[r],
              a = t[r];
            t[r] = (...e) => {
              let n = i.apply(t, e);
              return n === !1 && (n = a.apply(t, e)), n
            }
          }
          n.tokenizer = t
        }
        if (e.hooks) {
          let t = this.defaults.hooks || new St;
          for (let n in e.hooks) {
            if (!(n in t)) throw Error(`hook '${n}' does not exist`);
            if ([`options`, `block`].includes(n)) continue;
            let r = n,
              i = e.hooks[r],
              a = t[r];
            St.passThroughHooks.has(n) ? t[r] = e => {
              if (this.defaults.async && St.passThroughHooksRespectAsync.has(n)) return (async () => {
                let n = await i.call(t, e);
                return a.call(t, n)
              })();
              let r = i.call(t, e);
              return a.call(t, r)
            } : t[r] = (...e) => {
              if (this.defaults.async) return (async () => {
                let n = await i.apply(t, e);
                return n === !1 && (n = await a.apply(t, e)), n
              })();
              let n = i.apply(t, e);
              return n === !1 && (n = a.apply(t, e)), n
            }
          }
          n.hooks = t
        }
        if (e.walkTokens) {
          let t = this.defaults.walkTokens,
            r = e.walkTokens;
          n.walkTokens = function(e) {
            let n = [];
            return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n
          }
        }
        this.defaults = {
          ...this.defaults,
          ...n
        }
      }), this
    }
    setOptions(e) {
      return this.defaults = {
        ...this.defaults,
        ...e
      }, this
    }
    lexer(e, t) {
      return U.lex(e, t ?? this.defaults)
    }
    parser(e, t) {
      return W.parse(e, t ?? this.defaults)
    }
    parseMarkdown(e) {
      return (t, n) => {
        let r = {
            ...n
          },
          i = {
            ...this.defaults,
            ...r
          },
          a = this.onError(!!i.silent, !!i.async);
        if (this.defaults.async === !0 && r.async === !1) return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));
        if (typeof t > `u` || t === null) return a(Error(`marked(): input parameter is undefined or null`));
        if (typeof t != `string`) return a(Error(`marked(): input parameter is of type ` + Object.prototype.toString.call(t) + `, string expected`));
        if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
          let n = i.hooks ? await i.hooks.preprocess(t) : t,
            r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? U.lex : U.lexInline)(n, i),
            a = i.hooks ? await i.hooks.processAllTokens(r) : r;
          i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
          let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? W.parse : W.parseInline)(a, i);
          return i.hooks ? await i.hooks.postprocess(o) : o
        })().catch(a);
        try {
          i.hooks && (t = i.hooks.preprocess(t));
          let n = (i.hooks ? i.hooks.provideLexer(e) : e ? U.lex : U.lexInline)(t, i);
          i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
          let r = (i.hooks ? i.hooks.provideParser(e) : e ? W.parse : W.parseInline)(n, i);
          return i.hooks && (r = i.hooks.postprocess(r)), r
        } catch (e) {
          return a(e)
        }
      }
    }
    onError(e, t) {
      return n => {
        if (n.message += `
Please report this to https://github.com/markedjs/marked.`, e) {
          let e = `<p>An error occurred:</p><pre>` + V(n.message + ``, !0) + `</pre>`;
          return t ? Promise.resolve(e) : e
        }
        if (t) return Promise.reject(n);
        throw n
      }
    }
  };

function G(e, t) {
  return Ct.parse(e, t)
}
G.options = G.setOptions = function(e) {
  return Ct.setOptions(e), G.defaults = Ct.defaults, T(G.defaults), G
}, G.getDefaults = C, G.defaults = w, G.use = function(...e) {
  return Ct.use(...e), G.defaults = Ct.defaults, T(G.defaults), G
}, G.walkTokens = function(e, t) {
  return Ct.walkTokens(e, t)
}, G.parseInline = Ct.parseInline, G.Parser = W, G.parser = W.parse, G.Renderer = bt, G.TextRenderer = xt, G.Lexer = U, G.lexer = U.lex, G.Tokenizer = yt, G.Hooks = St, G.parse = G, G.options, G.setOptions, G.use, G.walkTokens, G.parseInline, W.parse, U.lex;
var {
  entries: wt,
  setPrototypeOf: Tt,
  isFrozen: Et,
  getPrototypeOf: Dt,
  getOwnPropertyDescriptor: Ot
} = Object, {
  freeze: K,
  seal: q,
  create: kt
} = Object, {
  apply: At,
  construct: jt
} = typeof Reflect < `u` && Reflect;
K ||= function(e) {
  return e
}, q ||= function(e) {
  return e
}, At ||= function(e, t) {
  var n = [...arguments].slice(2);
  return e.apply(t, n)
}, jt ||= function(e) {
  return new e(...[...arguments].slice(1))
};
var Mt = X(Array.prototype.forEach),
  Nt = X(Array.prototype.lastIndexOf),
  Pt = X(Array.prototype.pop),
  Ft = X(Array.prototype.push),
  It = X(Array.prototype.splice),
  Lt = X(String.prototype.toLowerCase),
  Rt = X(String.prototype.toString),
  zt = X(String.prototype.match),
  Bt = X(String.prototype.replace),
  Vt = X(String.prototype.indexOf),
  Ht = X(String.prototype.trim),
  J = X(Object.prototype.hasOwnProperty),
  Y = X(RegExp.prototype.test),
  Ut = Wt(TypeError);

function X(e) {
  return function(t) {
    t instanceof RegExp && (t.lastIndex = 0);
    var n = [...arguments].slice(1);
    return At(e, t, n)
  }
}

function Wt(e) {
  return function() {
    return jt(e, [...arguments])
  }
}

function Z(e, t) {
  let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Lt;
  Tt && Tt(e, null);
  let r = t.length;
  for (; r--;) {
    let i = t[r];
    if (typeof i == `string`) {
      let e = n(i);
      e !== i && (Et(t) || (t[r] = e), i = e)
    }
    e[i] = !0
  }
  return e
}

function Gt(e) {
  for (let t = 0; t < e.length; t++) J(e, t) || (e[t] = null);
  return e
}

function Q(e) {
  let t = kt(null);
  for (let [n, r] of wt(e)) J(e, n) && (Array.isArray(r) ? t[n] = Gt(r) : r && typeof r == `object` && r.constructor === Object ? t[n] = Q(r) : t[n] = r);
  return t
}

function Kt(e, t) {
  for (; e !== null;) {
    let n = Ot(e, t);
    if (n) {
      if (n.get) return X(n.get);
      if (typeof n.value == `function`) return X(n.value)
    }
    e = Dt(e)
  }

  function n() {
    return null
  }
  return n
}
var qt = K(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),
  Jt = K(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),
  Yt = K([`feBlend`, `feColorMatrix`, `feComponentTransfer`, `feComposite`, `feConvolveMatrix`, `feDiffuseLighting`, `feDisplacementMap`, `feDistantLight`, `feDropShadow`, `feFlood`, `feFuncA`, `feFuncB`, `feFuncG`, `feFuncR`, `feGaussianBlur`, `feImage`, `feMerge`, `feMergeNode`, `feMorphology`, `feOffset`, `fePointLight`, `feSpecularLighting`, `feSpotLight`, `feTile`, `feTurbulence`]),
  Xt = K([`animate`, `color-profile`, `cursor`, `discard`, `font-face`, `font-face-format`, `font-face-name`, `font-face-src`, `font-face-uri`, `foreignobject`, `hatch`, `hatchpath`, `mesh`, `meshgradient`, `meshpatch`, `meshrow`, `missing-glyph`, `script`, `set`, `solidcolor`, `unknown`, `use`]),
  Zt = K(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),
  Qt = K([`maction`, `maligngroup`, `malignmark`, `mlongdiv`, `mscarries`, `mscarry`, `msgroup`, `mstack`, `msline`, `msrow`, `semantics`, `annotation`, `annotation-xml`, `mprescripts`, `none`]),
  $t = K([`#text`]),
  en = K(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns.slot`.split(`.`)),
  tn = K(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),
  nn = K(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),
  rn = K([`xlink:href`, `xml:id`, `xlink:title`, `xml:space`, `xmlns:xlink`]),
  an = q(/\{\{[\w\W]*|[\w\W]*\}\}/gm),
  on = q(/<%[\w\W]*|[\w\W]*%>/gm),
  sn = q(/\$\{[\w\W]*/gm),
  cn = q(/^data-[\-\w.\u00B7-\uFFFF]+$/),
  ln = q(/^aria-[\-\w]+$/),
  un = q(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),
  dn = q(/^(?:\w+script|data):/i),
  fn = q(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),
  pn = q(/^html$/i),
  mn = q(/^[a-z][.\w]*(-[.\w]+)+$/i),
  hn = Object.freeze({
    __proto__: null,
    ARIA_ATTR: ln,
    ATTR_WHITESPACE: fn,
    CUSTOM_ELEMENT: mn,
    DATA_ATTR: cn,
    DOCTYPE_NAME: pn,
    ERB_EXPR: on,
    IS_ALLOWED_URI: un,
    IS_SCRIPT_OR_DATA: dn,
    MUSTACHE_EXPR: an,
    TMPLIT_EXPR: sn
  }),
  gn = {
    element: 1,
    attribute: 2,
    text: 3,
    cdataSection: 4,
    entityReference: 5,
    entityNode: 6,
    progressingInstruction: 7,
    comment: 8,
    document: 9,
    documentType: 10,
    documentFragment: 11,
    notation: 12
  },
  _n = function() {
    return typeof window > `u` ? null : window
  },
  vn = function(e, t) {
    if (typeof e != `object` || typeof e.createPolicy != `function`) return null;
    let n = null,
      r = `data-tt-policy-suffix`;
    t && t.hasAttribute(r) && (n = t.getAttribute(r));
    let i = `dompurify` + (n ? `#` + n : ``);
    try {
      return e.createPolicy(i, {
        createHTML(e) {
          return e
        },
        createScriptURL(e) {
          return e
        }
      })
    } catch {
      return console.warn(`TrustedTypes policy ` + i + ` could not be created.`), null
    }
  },
  yn = function() {
    return {
      afterSanitizeAttributes: [],
      afterSanitizeElements: [],
      afterSanitizeShadowDOM: [],
      beforeSanitizeAttributes: [],
      beforeSanitizeElements: [],
      beforeSanitizeShadowDOM: [],
      uponSanitizeAttribute: [],
      uponSanitizeElement: [],
      uponSanitizeShadowNode: []
    }
  };

function bn() {
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _n(),
    t = e => bn(e);
  if (t.version = `3.3.3`, t.removed = [], !e || !e.document || e.document.nodeType !== gn.document || !e.Element) return t.isSupported = !1, t;
  let {
    document: n
  } = e, r = n, i = r.currentScript, {
    DocumentFragment: a,
    HTMLTemplateElement: o,
    Node: s,
    Element: c,
    NodeFilter: l,
    NamedNodeMap: u = e.NamedNodeMap || e.MozNamedAttrMap,
    HTMLFormElement: d,
    DOMParser: ee,
    trustedTypes: f
  } = e, p = c.prototype, te = Kt(p, `cloneNode`), ne = Kt(p, `remove`), m = Kt(p, `nextSibling`), h = Kt(p, `childNodes`), re = Kt(p, `parentNode`);
  if (typeof o == `function`) {
    let e = n.createElement(`template`);
    e.content && e.content.ownerDocument && (n = e.content.ownerDocument)
  }
  let g, _ = ``,
    {
      implementation: v,
      createNodeIterator: ie,
      createDocumentFragment: ae,
      getElementsByTagName: y
    } = n,
    {
      importNode: oe
    } = r,
    b = yn();
  t.isSupported = typeof wt == `function` && typeof re == `function` && v && v.createHTMLDocument !== void 0;
  let {
    MUSTACHE_EXPR: se,
    ERB_EXPR: ce,
    TMPLIT_EXPR: le,
    DATA_ATTR: ue,
    ARIA_ATTR: de,
    IS_SCRIPT_OR_DATA: fe,
    ATTR_WHITESPACE: x,
    CUSTOM_ELEMENT: pe
  } = hn, {
    IS_ALLOWED_URI: me
  } = hn, S = null, he = Z({}, [...qt, ...Jt, ...Yt, ...Zt, ...$t]), C = null, w = Z({}, [...en, ...tn, ...nn, ...rn]), T = Object.seal(kt(null, {
    tagNameCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeNameCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    allowCustomizedBuiltInElements: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: !1
    }
  })), E = null, D = null, O = Object.seal(kt(null, {
    tagCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    }
  })), k = !0, ge = !0, _e = !1, ve = !0, A = !1, ye = !0, j = !1, be = !1, xe = !1, Se = !1, Ce = !1, we = !1, Te = !0, Ee = !1, De = !0, M = !1, N = {}, P = null, Oe = Z({}, [`annotation-xml`, `audio`, `colgroup`, `desc`, `foreignobject`, `head`, `iframe`, `math`, `mi`, `mn`, `mo`, `ms`, `mtext`, `noembed`, `noframes`, `noscript`, `plaintext`, `script`, `style`, `svg`, `template`, `thead`, `title`, `video`, `xmp`]), ke = null, Ae = Z({}, [`audio`, `video`, `img`, `source`, `image`, `track`]), je = null, Me = Z({}, [`alt`, `class`, `for`, `id`, `label`, `name`, `pattern`, `placeholder`, `role`, `summary`, `title`, `value`, `style`, `xmlns`]), Ne = `http://www.w3.org/1998/Math/MathML`, Pe = `http://www.w3.org/2000/svg`, F = `http://www.w3.org/1999/xhtml`, Fe = F, I = !1, Ie = null, Le = Z({}, [Ne, Pe, F], Rt), Re = Z({}, [`mi`, `mo`, `mn`, `ms`, `mtext`]), ze = Z({}, [`annotation-xml`]), Be = Z({}, [`title`, `style`, `font`, `a`, `script`]), Ve = null, He = [`application/xhtml+xml`, `text/html`], L = null, Ue = null, We = n.createElement(`form`), Ge = function(e) {
    return e instanceof RegExp || e instanceof Function
  }, Ke = function() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (!(Ue && Ue === e)) {
      if ((!e || typeof e != `object`) && (e = {}), e = Q(e), Ve = He.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? `text/html` : e.PARSER_MEDIA_TYPE, L = Ve === `application/xhtml+xml` ? Rt : Lt, S = J(e, `ALLOWED_TAGS`) ? Z({}, e.ALLOWED_TAGS, L) : he, C = J(e, `ALLOWED_ATTR`) ? Z({}, e.ALLOWED_ATTR, L) : w, Ie = J(e, `ALLOWED_NAMESPACES`) ? Z({}, e.ALLOWED_NAMESPACES, Rt) : Le, je = J(e, `ADD_URI_SAFE_ATTR`) ? Z(Q(Me), e.ADD_URI_SAFE_ATTR, L) : Me, ke = J(e, `ADD_DATA_URI_TAGS`) ? Z(Q(Ae), e.ADD_DATA_URI_TAGS, L) : Ae, P = J(e, `FORBID_CONTENTS`) ? Z({}, e.FORBID_CONTENTS, L) : Oe, E = J(e, `FORBID_TAGS`) ? Z({}, e.FORBID_TAGS, L) : Q({}), D = J(e, `FORBID_ATTR`) ? Z({}, e.FORBID_ATTR, L) : Q({}), N = J(e, `USE_PROFILES`) ? e.USE_PROFILES : !1, k = e.ALLOW_ARIA_ATTR !== !1, ge = e.ALLOW_DATA_ATTR !== !1, _e = e.ALLOW_UNKNOWN_PROTOCOLS || !1, ve = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, A = e.SAFE_FOR_TEMPLATES || !1, ye = e.SAFE_FOR_XML !== !1, j = e.WHOLE_DOCUMENT || !1, Se = e.RETURN_DOM || !1, Ce = e.RETURN_DOM_FRAGMENT || !1, we = e.RETURN_TRUSTED_TYPE || !1, xe = e.FORCE_BODY || !1, Te = e.SANITIZE_DOM !== !1, Ee = e.SANITIZE_NAMED_PROPS || !1, De = e.KEEP_CONTENT !== !1, M = e.IN_PLACE || !1, me = e.ALLOWED_URI_REGEXP || un, Fe = e.NAMESPACE || F, Re = e.MATHML_TEXT_INTEGRATION_POINTS || Re, ze = e.HTML_INTEGRATION_POINTS || ze, T = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && Ge(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (T.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Ge(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (T.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == `boolean` && (T.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), A && (ge = !1), Ce && (Se = !0), N && (S = Z({}, $t), C = kt(null), N.html === !0 && (Z(S, qt), Z(C, en)), N.svg === !0 && (Z(S, Jt), Z(C, tn), Z(C, rn)), N.svgFilters === !0 && (Z(S, Yt), Z(C, tn), Z(C, rn)), N.mathMl === !0 && (Z(S, Zt), Z(C, nn), Z(C, rn))), J(e, `ADD_TAGS`) || (O.tagCheck = null), J(e, `ADD_ATTR`) || (O.attributeCheck = null), e.ADD_TAGS && (typeof e.ADD_TAGS == `function` ? O.tagCheck = e.ADD_TAGS : (S === he && (S = Q(S)), Z(S, e.ADD_TAGS, L))), e.ADD_ATTR && (typeof e.ADD_ATTR == `function` ? O.attributeCheck = e.ADD_ATTR : (C === w && (C = Q(C)), Z(C, e.ADD_ATTR, L))), e.ADD_URI_SAFE_ATTR && Z(je, e.ADD_URI_SAFE_ATTR, L), e.FORBID_CONTENTS && (P === Oe && (P = Q(P)), Z(P, e.FORBID_CONTENTS, L)), e.ADD_FORBID_CONTENTS && (P === Oe && (P = Q(P)), Z(P, e.ADD_FORBID_CONTENTS, L)), De && (S[`#text`] = !0), j && Z(S, [`html`, `head`, `body`]), S.table && (Z(S, [`tbody`]), delete E.tbody), e.TRUSTED_TYPES_POLICY) {
        if (typeof e.TRUSTED_TYPES_POLICY.createHTML != `function`) throw Ut(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);
        if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != `function`) throw Ut(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);
        g = e.TRUSTED_TYPES_POLICY, _ = g.createHTML(``)
      } else g === void 0 && (g = vn(f, i)), g !== null && typeof _ == `string` && (_ = g.createHTML(``));
      K && K(e), Ue = e
    }
  }, qe = Z({}, [...Jt, ...Yt, ...Xt]), Je = Z({}, [...Zt, ...Qt]), Ye = function(e) {
    let t = re(e);
    (!t || !t.tagName) && (t = {
      namespaceURI: Fe,
      tagName: `template`
    });
    let n = Lt(e.tagName),
      r = Lt(t.tagName);
    return Ie[e.namespaceURI] ? e.namespaceURI === Pe ? t.namespaceURI === F ? n === `svg` : t.namespaceURI === Ne ? n === `svg` && (r === `annotation-xml` || Re[r]) : !!qe[n] : e.namespaceURI === Ne ? t.namespaceURI === F ? n === `math` : t.namespaceURI === Pe ? n === `math` && ze[r] : !!Je[n] : e.namespaceURI === F ? t.namespaceURI === Pe && !ze[r] || t.namespaceURI === Ne && !Re[r] ? !1 : !Je[n] && (Be[n] || !qe[n]) : !!(Ve === `application/xhtml+xml` && Ie[e.namespaceURI]) : !1
  }, R = function(e) {
    Ft(t.removed, {
      element: e
    });
    try {
      re(e).removeChild(e)
    } catch {
      ne(e)
    }
  }, z = function(e, n) {
    try {
      Ft(t.removed, {
        attribute: n.getAttributeNode(e),
        from: n
      })
    } catch {
      Ft(t.removed, {
        attribute: null,
        from: n
      })
    }
    if (n.removeAttribute(e), e === `is`)
      if (Se || Ce) try {
        R(n)
      } catch {} else try {
        n.setAttribute(e, ``)
      } catch {}
  }, Xe = function(e) {
    let t = null,
      r = null;
    if (xe) e = `<remove></remove>` + e;
    else {
      let t = zt(e, /^[\r\n\t ]+/);
      r = t && t[0]
    }
    Ve === `application/xhtml+xml` && Fe === F && (e = `<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>` + e + `</body></html>`);
    let i = g ? g.createHTML(e) : e;
    if (Fe === F) try {
      t = new ee().parseFromString(i, Ve)
    } catch {}
    if (!t || !t.documentElement) {
      t = v.createDocument(Fe, `template`, null);
      try {
        t.documentElement.innerHTML = I ? _ : i
      } catch {}
    }
    let a = t.body || t.documentElement;
    return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), Fe === F ? y.call(t, j ? `html` : `body`)[0] : j ? t.documentElement : a
  }, Ze = function(e) {
    return ie.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null)
  }, Qe = function(e) {
    return e instanceof d && (typeof e.nodeName != `string` || typeof e.textContent != `string` || typeof e.removeChild != `function` || !(e.attributes instanceof u) || typeof e.removeAttribute != `function` || typeof e.setAttribute != `function` || typeof e.namespaceURI != `string` || typeof e.insertBefore != `function` || typeof e.hasChildNodes != `function`)
  }, $e = function(e) {
    return typeof s == `function` && e instanceof s
  };

  function B(e, n, r) {
    Mt(e, e => {
      e.call(t, n, r, Ue)
    })
  }
  let et = function(e) {
      let n = null;
      if (B(b.beforeSanitizeElements, e, null), Qe(e)) return R(e), !0;
      let r = L(e.nodeName);
      if (B(b.uponSanitizeElement, e, {
          tagName: r,
          allowedTags: S
        }), ye && e.hasChildNodes() && !$e(e.firstElementChild) && Y(/<[/\w!]/g, e.innerHTML) && Y(/<[/\w!]/g, e.textContent) || e.nodeType === gn.progressingInstruction || ye && e.nodeType === gn.comment && Y(/<[/\w]/g, e.data)) return R(e), !0;
      if (!(O.tagCheck instanceof Function && O.tagCheck(r)) && (!S[r] || E[r])) {
        if (!E[r] && nt(r) && (T.tagNameCheck instanceof RegExp && Y(T.tagNameCheck, r) || T.tagNameCheck instanceof Function && T.tagNameCheck(r))) return !1;
        if (De && !P[r]) {
          let t = re(e) || e.parentNode,
            n = h(e) || e.childNodes;
          if (n && t) {
            let r = n.length;
            for (let i = r - 1; i >= 0; --i) {
              let r = te(n[i], !0);
              r.__removalCount = (e.__removalCount || 0) + 1, t.insertBefore(r, m(e))
            }
          }
        }
        return R(e), !0
      }
      return e instanceof c && !Ye(e) || (r === `noscript` || r === `noembed` || r === `noframes`) && Y(/<\/no(script|embed|frames)/i, e.innerHTML) ? (R(e), !0) : (A && e.nodeType === gn.text && (n = e.textContent, Mt([se, ce, le], e => {
        n = Bt(n, e, ` `)
      }), e.textContent !== n && (Ft(t.removed, {
        element: e.cloneNode()
      }), e.textContent = n)), B(b.afterSanitizeElements, e, null), !1)
    },
    tt = function(e, t, r) {
      if (D[t] || Te && (t === `id` || t === `name`) && (r in n || r in We)) return !1;
      if (!(ge && !D[t] && Y(ue, t)) && !(k && Y(de, t)) && !(O.attributeCheck instanceof Function && O.attributeCheck(t, e))) {
        if (!C[t] || D[t]) {
          if (!(nt(e) && (T.tagNameCheck instanceof RegExp && Y(T.tagNameCheck, e) || T.tagNameCheck instanceof Function && T.tagNameCheck(e)) && (T.attributeNameCheck instanceof RegExp && Y(T.attributeNameCheck, t) || T.attributeNameCheck instanceof Function && T.attributeNameCheck(t, e)) || t === `is` && T.allowCustomizedBuiltInElements && (T.tagNameCheck instanceof RegExp && Y(T.tagNameCheck, r) || T.tagNameCheck instanceof Function && T.tagNameCheck(r)))) return !1
        } else if (!je[t] && !Y(me, Bt(r, x, ``)) && !((t === `src` || t === `xlink:href` || t === `href`) && e !== `script` && Vt(r, `data:`) === 0 && ke[e]) && !(_e && !Y(fe, Bt(r, x, ``))) && r) return !1
      }
      return !0
    },
    nt = function(e) {
      return e !== `annotation-xml` && zt(e, pe)
    },
    rt = function(e) {
      B(b.beforeSanitizeAttributes, e, null);
      let {
        attributes: n
      } = e;
      if (!n || Qe(e)) return;
      let r = {
          attrName: ``,
          attrValue: ``,
          keepAttr: !0,
          allowedAttributes: C,
          forceKeepAttr: void 0
        },
        i = n.length;
      for (; i--;) {
        let {
          name: a,
          namespaceURI: o,
          value: s
        } = n[i], c = L(a), l = s, u = a === `value` ? l : Ht(l);
        if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, B(b.uponSanitizeAttribute, e, r), u = r.attrValue, Ee && (c === `id` || c === `name`) && (z(a, e), u = `user-content-` + u), ye && Y(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, u)) {
          z(a, e);
          continue
        }
        if (c === `attributename` && zt(u, `href`)) {
          z(a, e);
          continue
        }
        if (r.forceKeepAttr) continue;
        if (!r.keepAttr) {
          z(a, e);
          continue
        }
        if (!ve && Y(/\/>/i, u)) {
          z(a, e);
          continue
        }
        A && Mt([se, ce, le], e => {
          u = Bt(u, e, ` `)
        });
        let d = L(e.nodeName);
        if (!tt(d, c, u)) {
          z(a, e);
          continue
        }
        if (g && typeof f == `object` && typeof f.getAttributeType == `function` && !o) switch (f.getAttributeType(d, c)) {
          case `TrustedHTML`:
            u = g.createHTML(u);
            break;
          case `TrustedScriptURL`:
            u = g.createScriptURL(u);
            break
        }
        if (u !== l) try {
          o ? e.setAttributeNS(o, a, u) : e.setAttribute(a, u), Qe(e) ? R(e) : Pt(t.removed)
        } catch {
          z(a, e)
        }
      }
      B(b.afterSanitizeAttributes, e, null)
    },
    it = function e(t) {
      let n = null,
        r = Ze(t);
      for (B(b.beforeSanitizeShadowDOM, t, null); n = r.nextNode();) B(b.uponSanitizeShadowNode, n, null), et(n), rt(n), n.content instanceof a && e(n.content);
      B(b.afterSanitizeShadowDOM, t, null)
    };
  return t.sanitize = function(e) {
    let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
      i = null,
      o = null,
      c = null,
      l = null;
    if (I = !e, I && (e = `<!-->`), typeof e != `string` && !$e(e))
      if (typeof e.toString == `function`) {
        if (e = e.toString(), typeof e != `string`) throw Ut(`dirty is not a string, aborting`)
      } else throw Ut(`toString is not a function`);
    if (!t.isSupported) return e;
    if (be || Ke(n), t.removed = [], typeof e == `string` && (M = !1), M) {
      if (e.nodeName) {
        let t = L(e.nodeName);
        if (!S[t] || E[t]) throw Ut(`root node is forbidden and cannot be sanitized in-place`)
      }
    } else if (e instanceof s) i = Xe(`<!---->`), o = i.ownerDocument.importNode(e, !0), o.nodeType === gn.element && o.nodeName === `BODY` || o.nodeName === `HTML` ? i = o : i.appendChild(o);
    else {
      if (!Se && !A && !j && e.indexOf(`<`) === -1) return g && we ? g.createHTML(e) : e;
      if (i = Xe(e), !i) return Se ? null : we ? _ : ``
    }
    i && xe && R(i.firstChild);
    let u = Ze(M ? e : i);
    for (; c = u.nextNode();) et(c), rt(c), c.content instanceof a && it(c.content);
    if (M) return e;
    if (Se) {
      if (Ce)
        for (l = ae.call(i.ownerDocument); i.firstChild;) l.appendChild(i.firstChild);
      else l = i;
      return (C.shadowroot || C.shadowrootmode) && (l = oe.call(r, l, !0)), l
    }
    let d = j ? i.outerHTML : i.innerHTML;
    return j && S[`!doctype`] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && Y(pn, i.ownerDocument.doctype.name) && (d = `<!DOCTYPE ` + i.ownerDocument.doctype.name + `>
` + d), A && Mt([se, ce, le], e => {
      d = Bt(d, e, ` `)
    }), g && we ? g.createHTML(d) : d
  }, t.setConfig = function() {
    Ke(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), be = !0
  }, t.clearConfig = function() {
    Ue = null, be = !1
  }, t.isValidAttribute = function(e, t, n) {
    return Ue || Ke({}), tt(L(e), L(t), n)
  }, t.addHook = function(e, t) {
    typeof t == `function` && Ft(b[e], t)
  }, t.removeHook = function(e, t) {
    if (t !== void 0) {
      let n = Nt(b[e], t);
      return n === -1 ? void 0 : It(b[e], n, 1)[0]
    }
    return Pt(b[e])
  }, t.removeHooks = function(e) {
    b[e] = []
  }, t.removeAllHooks = function() {
    b = yn()
  }, t
}
var xn = bn();
G.use({
  renderer: {
    link(e) {
      return `<a href="${e.href??`#`}" target="_blank" rel="noopener noreferrer"${e.title?` title="${e.title}"`:``}>${e.text}</a>`
    }
  }
});
var Sn = e => new Date(e).toLocaleDateString(`en-US`, {
    month: `short`,
    day: `numeric`,
    year: `numeric`
  }),
  Cn = e => xn.sanitize(G.parse(e), {
    ADD_ATTR: [`target`]
  }),
  wn = e => `rgba(${parseInt(e.slice(1,3),16)}, ${parseInt(e.slice(3,5),16)}, ${parseInt(e.slice(5,7),16)}, 0.1)`;

function Tn() {
  let e = document.body,
    t = document.getElementById(`btn-play`),
    n = document.getElementById(`btn-settings`),
    r = document.getElementById(`launch-progress-container`),
    i = document.getElementById(`launch-progress-bar`),
    a = document.getElementById(`launch-progress-label`),
    o = document.getElementById(`launch-progress-percent`),
    s = document.getElementById(`server-status-dot`),
    c = document.getElementById(`server-status-text`),
    l = document.getElementById(`player-count`),
    u = document.getElementById(`news-list`),
    d = document.getElementById(`profile-selector`),
    ee = document.getElementById(`profile-dropdown`),
    f = document.getElementById(`current-profile-name`),
    p = null,
    te = [],
    ne = 0,
    h = [],
    g = async () => {
      te = await se.get(), te.length > 0 && (ie(te[0]), _())
    }, _ = () => {
      ee && (ee.innerHTML = te.map(e => `
      <div class="profile-option ${p?.id===e.id?`active`:``}" data-id="${e.id}">
        ${e.name}
      </div>
    `).join(``), ee.querySelectorAll(`.profile-option`).forEach(e => {
        e.addEventListener(`click`, e => {
          let t = e.target.dataset.id,
            n = te.find(e => e.id === t);
          n && ie(n), d?.classList.remove(`open`)
        })
      }))
    }, ie = e => {
      p = e, f && (f.innerText = e.name), _(), ae()
    }, ae = async () => {
      s && (s.classList.remove(`online`, `offline`), s.classList.add(`pinging`)), c && (c.innerHTML = `Pinging...`), l && (l.innerHTML = ``);
      let e = p ? await ce.getStatus(p.ip, p.port || 25565) : null;
      e ? (s && (s.classList.remove(`pinging`, `offline`), s.classList.add(`online`)), c && (c.innerHTML = `Online`), l && (l.innerHTML = `<i class="fa-fw fa-solid fa-users"></i>&nbsp;&nbsp;${e.players.online.toLocaleString()} / ${e.players.max.toLocaleString()}`)) : (s && (s.classList.remove(`pinging`, `online`), s.classList.add(`offline`)), c && (c.innerHTML = `Offline`), l && (l.innerHTML = ``))
    };
  g(), ae(), (async () => {
    if (!u) return;
    u.innerHTML = `<div style="text-align:center; padding: 20px; color: #888;">Loading news...</div>`;
    let e = await le.getNews();
    if (u.innerHTML = ``, !e || e.length === 0) {
      u.innerHTML = `<div style="text-align:center; color: #888;">No news available.</div>`;
      return
    }
    e.forEach(e => {
      let t = ``;
      e.tags.forEach(e => {
        t += `<span class="tag" style="color: ${e.color}; background-color: ${wn(e.color)}">${e.name}</span>`
      });
      let n = `
        <article class="news-article">
          <div class="article-meta">
            <div class="author">
              <img src="https://minotar.net/helm/${e.author.username}/24" alt="Author" />
              <span>${e.author.username??`Admin Team`}</span>
            </div>
            <span class="separator">•</span>
            <span class="date">${Sn(e.createdAt)}</span>
            <span class="separator">•</span>
            <div class="tags-container">${t}</div>
          </div>

          <h3>${e.title}</h3>
          
          ${e.image?`<img src="${e.image}" alt="News Image" onerror="this.style.display='none'"/>`:``}

          <div class="article-content">
            ${Cn(e.content)}
          </div>
        </article>
      `;
      u.insertAdjacentHTML(`beforeend`, n)
    })
  })();
  let y = e => {
    !i || !o || (e ? (i.classList.add(`indeterminate`), o.style.display = `none`) : (i.classList.remove(`indeterminate`), o.style.display = `block`))
  };
  n?.addEventListener(`click`, () => {
    v(`settings`)
  }), t?.addEventListener(`click`, async () => {
    y(!0), t && (t.style.display = `none`), r && r.classList.remove(`hidden`), i && (i.style.width = `0%`), o && (o.innerText = `0%`);
    let e = re();
    if (!e) return;
    let n = await pe.get(),
      a = `
Ready to launch the game with the following settings:
      
👤 Account: ${e.name}
🧠 RAM: ${n.memory.min} - ${n.memory.max}
☕️ Java: ${n.java}
🖥️ Resolution: ${n.resolution.width}x${n.resolution.height}
🚀 Action on launch: ${n.launcherAction}
    `;
    m.default.log(a), x.launch({
      account: e,
      settings: n,
      profileSlug: p?.slug
    })
  }), d?.querySelector(`.selected-profile`)?.addEventListener(`click`, () => {
    d.classList.toggle(`open`)
  }), e.addEventListener(`click`, e => {
    d?.contains(e.target) || d?.classList.remove(`open`)
  }), x.launchComputeDownload(() => {
    y(!0), a && (a.innerText = `Preparing download...`), o && (o.innerText = ``)
  }), x.launchDownload(e => {
    y(!1), ne = e.total.size, a && (a.innerText = `Downloading files...`)
  }), x.downloadProgress(e => {
    if (h.find(t => t.type === e.type) ? h[h.findIndex(t => t.type === e.type)].size = e.downloaded.size : h.push({
        type: e.type,
        size: e.downloaded.size
      }), i && a && o) {
      let t = h.reduce((e, t) => e + t.size, 0);
      i.style.width = `${Math.min(t/ne*100,100)}%`, a.innerText = `Downloading ${e.type===`JAVA`?`Java`:`game files`}...`, o.innerText = `${Math.round(Math.min(t/ne*100,100))}%`
    }
  }), x.launchInstallLoader(() => {
    y(!0), a && (a.innerText = `Extracting files...`), o && (o.innerText = ``)
  }), x.launchExtractNatives(() => {
    y(!0), a && (a.innerText = `Extracting files...`)
  }), x.launchCopyAssets(() => {
    y(!0), a && (a.innerText = `Extracting files...`)
  }), x.launchPatchLoader(() => {
    y(!0), a && (a.innerText = `Finalizing setup...`)
  }), x.launchLaunch(() => {
    y(!0), a && (a.innerText = `Launching game...`)
  }), x.launched(() => {
    setTimeout(() => {
      t && (t.style.display = `block`), r && r.classList.add(`hidden`), i && (i.style.width = `0%`), o && (o.innerText = ``)
    }, 1e4)
  })
}
var En = [{
    label: `Auto (default)`,
    value: `854x480`,
    width: 854,
    height: 480
  }, {
    label: `Fullscreen`,
    value: `fullscreen`,
    width: 854,
    height: 480
  }, {
    label: `2560x1440 (1440p)`,
    value: `2560x1440`,
    width: 2560,
    height: 1440
  }, {
    label: `1920x1080 (1080p)`,
    value: `1920x1080`,
    width: 1920,
    height: 1080
  }, {
    label: `1600x900`,
    value: `1600x900`,
    width: 1600,
    height: 900
  }, {
    label: `1366x768`,
    value: `1366x768`,
    width: 1366,
    height: 768
  }, {
    label: `1280x1024`,
    value: `1280x1024`,
    width: 1280,
    height: 1024
  }, {
    label: `1280x720 (720p)`,
    value: `1280x720`,
    width: 1280,
    height: 720
  }, {
    label: `1024x768`,
    value: `1024x768`,
    width: 1024,
    height: 768
  }, {
    label: `800x600`,
    value: `800x600`,
    width: 800,
    height: 600
  }],
  $;
async function Dn() {
  let e = await me.getInfo();
  $ = await pe.get(), On(), kn(e.totalMem), An(e.resolution);
  let t = document.getElementById(`version`);
  t && (t.innerText = `AirfieldZ v${e.version}`)
}

function On() {
  let e = document.getElementById(`btn-close-settings`),
    t = document.querySelectorAll(`.tab-content`),
    n = document.querySelectorAll(`.nav-btn`),
    r = document.getElementById(`btn-logout`);
  e?.addEventListener(`click`, async () => {
    await jn(), ae(`settings`)
  }), r?.addEventListener(`click`, async () => {
    await S.show(`Log out?`, [{
      text: `Cancel`,
      type: `cancel`
    }, {
      text: `Logout`,
      type: `danger`
    }]) && (await b.logout(), ae(`settings`), v(`login`))
  }), n.forEach(e => {
    e.addEventListener(`click`, () => {
      n.forEach(e => e.classList.remove(`active`)), e.classList.add(`active`);
      let r = e.getAttribute(`data-tab`);
      t.forEach(e => e.id === `tab-${r}` ? e.classList.add(`active`) : e.classList.remove(`active`))
    })
  })
}

function kn(e) {
  e = Math.min(e, 16);
  let t = document.getElementById(`ram-min`),
    n = document.getElementById(`ram-max`),
    r = document.getElementById(`ram-track-fill`),
    i = document.getElementById(`ram-min-label`),
    a = document.getElementById(`ram-max-label`);
  if (!t || !n || !r) return;
  t.max = e.toString(), n.max = e.toString();
  let o = .5,
    s = s => {
      let c = parseFloat(t.value),
        l = parseFloat(n.value);
      l - c < o && (s?.target === t ? (t.value = (l - o).toString(), c = parseFloat(t.value)) : (n.value = (c + o).toString(), l = parseFloat(n.value))), i && (i.innerText = `${c} GB`), a && (a.innerText = `${l} GB`);
      let u = e - parseFloat(t.min),
        d = (c - parseFloat(t.min)) / u * 100,
        ee = (l - parseFloat(n.min)) / u * 100;
      r.style.left = `${d}%`, r.style.width = `${ee-d}%`
    };
  t.addEventListener(`input`, s), n.addEventListener(`input`, s), s()
}

function An(e) {
  if (!$) return;
  let t = document.getElementById(`ram-min`),
    n = document.getElementById(`ram-max`),
    r = document.getElementById(`resolution-select`),
    i = document.getElementById(`launcher-action-select`),
    a = document.getElementById(`java-select`);
  if (t && (t.value = $.memory.min + ``), n && (n.value = $.memory.max + ``), r) {
    let t = Mn(e);
    r.innerHTML = ``, t.forEach(e => {
      let t = document.createElement(`option`);
      t.value = e.value, t.innerText = e.label, r.appendChild(t)
    }), r.value = $.resolution.fullscreen ? `fullscreen` : `${$.resolution.width}x${$.resolution.height}`
  }
  i && (i.value = $.launcherAction), a && (a.value = $.java === `bundled` ? `bundled` : `custom`), t.dispatchEvent(new Event(`input`))
}
async function jn() {
  let e = document.getElementById(`ram-min`),
    t = document.getElementById(`ram-max`),
    n = document.getElementById(`launcher-action-select`),
    r = document.getElementById(`resolution-select`),
    i = document.getElementById(`java-select`),
    a = {
      ...$,
      memory: {
        min: parseFloat(e.value),
        max: parseFloat(t.value)
      },
      resolution: {
        height: En.find(e => e.value === r.value)?.height ?? 854,
        width: En.find(e => e.value === r.value)?.width ?? 480,
        fullscreen: r.value === `fullscreen`
      },
      java: i.value === `bundled` ? `bundled` : `path`,
      launcherAction: n.value
    };
  await pe.set(a), $ = a
}

function Mn(e) {
  return En.filter(t => t.width <= e.width && t.height <= e.height)
}
var Nn = `/src/static/images/bg.png`,
  Pn = {
    day: `2-digit`,
    month: `2-digit`,
    year: `numeric`,
    hour: `2-digit`,
    minute: `2-digit`
  };

function Fn(e) {
  return new Promise(t => {
    let n = new Image;
    n.src = e, n.onload = () => t(), n.onerror = () => t()
  })
}
async function In() {
  m.default.log(`Initializing Launcher...`);
  let e = document.querySelector(`.app-background`),
    t = document.getElementById(`maintenance-dates`),
    n = document.getElementById(`maintenance-reason`),
    r = document.getElementById(`update-progress-bar`),
    i = document.getElementById(`update-progress-label`),
    a = document.getElementById(`update-progress-percent`),
    o = e => {
      !r || !a || (e ? (r.classList.add(`indeterminate`), a.style.display = `none`) : (r.classList.remove(`indeterminate`), a.style.display = `block`))
    },
    s = await fe.check(),
    c = await ue.get(),
    l = await de.get(),
    u = c?.file?.url ?? Nn;
  if (s.updateAvailable) {
    o(!1), r.style.width = `0%`, i.innerText = `Preparing update...`, a.innerText = `0%`, ie(`update`), await new Promise(e => setTimeout(e, 500)), fe.downloadProgress(e => {
      i.innerText = `Downloading update...`;
      let t = (e.downloaded.size / e.total.amount * 100).toFixed(2);
      a.innerText = `${t}%`, r.style.width = `${t}%`
    }), fe.downloadEnd(async () => {
      o(!0), i.innerText = `Installing...`, await fe.install()
    }), fe.error(e => {
      m.default.error(`Error while downloading bootstraps:`, e)
    }), await fe.download(), m.default.log(`Update installed, restarting launcher...`), setTimeout(() => {
      window.location.reload()
    }, 1e3);
    return
  }
  if (l) {
    let e = new Date(l.startTime),
      r = new Date(l.endTime);
    t.innerText = `From ${e.toLocaleString([],Pn)} to ${r.toLocaleString([],Pn)}`, n.innerText = l.message ?? `Please come back later.`, ie(`maintenance`);
    return
  }
  try {
    let [t, n] = await Promise.all([Fn(u), b.refresh()]);
    e && (e.style.backgroundImage = `url('${u}')`), n.success ? (g(n.account), v(`home`)) : v(`login`)
  } catch (t) {
    m.default.error(`Error while itializing launcher:`, t), e && (e.style.backgroundImage = `url('${Nn}')`), v(`login`)
  } finally {
    await new Promise(e => setTimeout(e, 400)), document.querySelector(`div#view-loading`)?.classList.add(`loaded`), await new Promise(e => setTimeout(e, 200)), document.body.classList.add(`loaded`)
  }
}
he(), Tn(), Dn(), In();