mark-deco-cli 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  * name: mark-deco-cli
4
- * version: 0.7.0
4
+ * version: 0.8.0
5
5
  * description: Command-line interface for mark-deco Markdown to HTML conversion processor
6
6
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
7
7
  * license: MIT
8
8
  * repository.url: https://github.com/kekyo/mark-deco.git
9
- * git.commit.hash: 2b8fc59fb30d614d1c529a3d2c9ec721a49c9115
9
+ * git.commit.hash: cc985acbf6dd451ba9668a6c148f9e041c1032c5
10
10
  */
11
11
  "use strict";
12
12
  const commander = require("commander");
@@ -21417,12 +21417,12 @@ var load = loader.load;
21417
21417
  var dump = dumper.dump;
21418
21418
  /*!
21419
21419
  * name: mark-deco
21420
- * version: 0.7.0
21420
+ * version: 0.8.0
21421
21421
  * description: Flexible Markdown to HTML conversion library
21422
21422
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
21423
21423
  * license: MIT
21424
21424
  * repository.url: https://github.com/kekyo/mark-deco.git
21425
- * git.commit.hash: 2b8fc59fb30d614d1c529a3d2c9ec721a49c9115
21425
+ * git.commit.hash: cc985acbf6dd451ba9668a6c148f9e041c1032c5
21426
21426
  */
21427
21427
  const qd = (e) => {
21428
21428
  try {
@@ -21460,7 +21460,7 @@ const qd = (e) => {
21460
21460
  }, Ys = () => "width: 100%; height: auto; display: block; object-fit: contain; object-position: center;", ou = (e, t, u, r) => {
21461
21461
  const a = Ys(), i = "", n = r ? ` ${r}` : "";
21462
21462
  return `<img src="${e}" alt="${t}"${i} style="${a}"${n} />`;
21463
- }, At$1 = (e, t, u, r, a) => {
21463
+ }, At = (e, t, u, r, a) => {
21464
21464
  const i = ou(e, t, r, a);
21465
21465
  return `<div class="${u}">
21466
21466
  ${i}
@@ -21587,8 +21587,8 @@ const qd = (e) => {
21587
21587
  if (h) {
21588
21588
  const m = h[0].match(/href=['"]([^'"]+)['"]/i);
21589
21589
  if (m && m[1]) {
21590
- const f = m[1], T2 = $s(f), A = new URL(T2, e).toString();
21591
- return u.info("getOEmbedUrl: Discovered oEmbed endpoint:", A), A;
21590
+ const f = m[1], T = $s(f), A2 = new URL(T, e).toString();
21591
+ return u.info("getOEmbedUrl: Discovered oEmbed endpoint:", A2), A2;
21592
21592
  }
21593
21593
  }
21594
21594
  } catch (c) {
@@ -21611,11 +21611,11 @@ const qd = (e) => {
21611
21611
  headers: h
21612
21612
  }, f = Er(u);
21613
21613
  m.signal = i ? Tr(i, f) : f;
21614
- const T2 = await fetch(n, m);
21615
- if (T2.status >= 300 && T2.status < 400) {
21616
- const A = T2.headers.get("location");
21617
- if (A) {
21618
- n = new URL(A, n).toString(), c++;
21614
+ const T = await fetch(n, m);
21615
+ if (T.status >= 300 && T.status < 400) {
21616
+ const A2 = T.headers.get("location");
21617
+ if (A2) {
21618
+ n = new URL(A2, n).toString(), c++;
21619
21619
  continue;
21620
21620
  }
21621
21621
  }
@@ -21655,13 +21655,13 @@ const Gd = async (e, t, u, r, a) => {
21655
21655
  );
21656
21656
  const m = await Ws(r, a), f = await zs(h, m, r);
21657
21657
  i.info("fetchOEmbedData: oEmbed API URL:", f);
21658
- const T2 = await js(
21658
+ const T = await js(
21659
21659
  c,
21660
21660
  f,
21661
21661
  n,
21662
21662
  i
21663
21663
  );
21664
- return i.info("fetchOEmbedData: Parsed JSON data:", T2), T2.web_page || (T2.web_page = h), T2;
21664
+ return i.info("fetchOEmbedData: Parsed JSON data:", T), T.web_page || (T.web_page = h), T;
21665
21665
  } catch (h) {
21666
21666
  throw vt$1(h) ? (typeof window < "u" ? i.debug(
21667
21667
  "fetchOEmbedData: Browser CORS restrictions block oEmbed API access for URL:",
@@ -21730,29 +21730,29 @@ const Gd = async (e, t, u, r, a) => {
21730
21730
  const i = e.title || "Untitled", n = e.author_name || "Unknown", c = e.url || "", h = e.width || 0, m = e.height || 0;
21731
21731
  let f = "";
21732
21732
  h > 0 && m > 0 && (f = ` width="${h}" height="${m}"`);
21733
- const T2 = [];
21734
- if (r.title !== void 0 && T2.push({
21733
+ const T = [];
21734
+ if (r.title !== void 0 && T.push({
21735
21735
  order: r.title,
21736
21736
  html: `<div class="oembed-title">${R(i)}</div>`
21737
- }), r.author !== void 0 && T2.push({
21737
+ }), r.author !== void 0 && T.push({
21738
21738
  order: r.author,
21739
21739
  html: `<div class="oembed-author">by ${R(n)}</div>`
21740
- }), r.provider !== void 0 && T2.push({
21740
+ }), r.provider !== void 0 && T.push({
21741
21741
  order: r.provider,
21742
21742
  html: `<div class="oembed-provider">${R(u)}</div>`
21743
- }), r.description !== void 0 && e.author_name && T2.push({
21743
+ }), r.description !== void 0 && e.author_name && T.push({
21744
21744
  order: r.description,
21745
21745
  html: `<div class="oembed-description">${R(e.author_name)}</div>`
21746
- }), r.thumbnail !== void 0 && e.thumbnail_url && T2.push({
21746
+ }), r.thumbnail !== void 0 && e.thumbnail_url && T.push({
21747
21747
  order: r.thumbnail,
21748
- html: At$1(
21748
+ html: At(
21749
21749
  R(e.thumbnail_url),
21750
21750
  R(i),
21751
21751
  "oembed-thumbnail"
21752
21752
  )
21753
21753
  }), r.embeddedContent !== void 0 && c) {
21754
21754
  const M2 = f ? f.trim() : "";
21755
- T2.push({
21755
+ T.push({
21756
21756
  order: r.embeddedContent,
21757
21757
  html: ou(
21758
21758
  R(c),
@@ -21764,7 +21764,7 @@ const Gd = async (e, t, u, r, a) => {
21764
21764
  }
21765
21765
  if (r.externalLink !== void 0) {
21766
21766
  const M2 = a.useMetadataUrlLink && e.web_page || t;
21767
- T2.push({
21767
+ T.push({
21768
21768
  order: r.externalLink,
21769
21769
  html: `<div class="oembed-external-link">
21770
21770
  <a href="${R(M2)}" target="_blank" rel="noopener noreferrer">
@@ -21773,17 +21773,17 @@ const Gd = async (e, t, u, r, a) => {
21773
21773
  </div>`
21774
21774
  });
21775
21775
  }
21776
- const A = T2.sort((M2, ee2) => M2.order - ee2.order), w = [], v = [];
21777
- A.forEach((M2) => {
21776
+ const A2 = T.sort((M2, ee) => M2.order - ee.order), w = [], v = [];
21777
+ A2.forEach((M2) => {
21778
21778
  M2.html.includes("oembed-title") || M2.html.includes("oembed-author") || M2.html.includes("oembed-provider") || M2.html.includes("oembed-description") ? w.push(M2.html) : v.push(M2.html);
21779
21779
  });
21780
- let S2 = "";
21781
- w.length > 0 && (S2 = `<div class="oembed-header">${w.join("")}</div>`);
21780
+ let S = "";
21781
+ w.length > 0 && (S = `<div class="oembed-header">${w.join("")}</div>`);
21782
21782
  let U2 = "";
21783
21783
  return v.length > 0 && (U2 = `<div class="oembed-content">
21784
21784
  ${v.join("")}
21785
21785
  </div>`), `<div class="oembed-container oembed-photo">
21786
- ${S2}
21786
+ ${S}
21787
21787
  ${U2}
21788
21788
  </div>`;
21789
21789
  }, Js = (e, t, u, r, a) => {
@@ -21802,7 +21802,7 @@ const Gd = async (e, t, u, r, a) => {
21802
21802
  html: `<div class="oembed-description">${R(e.author_name)}</div>`
21803
21803
  }), r.thumbnail !== void 0 && e.thumbnail_url && m.push({
21804
21804
  order: r.thumbnail,
21805
- html: At$1(
21805
+ html: At(
21806
21806
  R(e.thumbnail_url),
21807
21807
  R(i),
21808
21808
  "oembed-thumbnail"
@@ -21811,25 +21811,25 @@ const Gd = async (e, t, u, r, a) => {
21811
21811
  order: r.embeddedContent,
21812
21812
  html: h
21813
21813
  }), r.externalLink !== void 0) {
21814
- const S2 = a.useMetadataUrlLink && e.web_page || t;
21814
+ const S = a.useMetadataUrlLink && e.web_page || t;
21815
21815
  m.push({
21816
21816
  order: r.externalLink,
21817
21817
  html: `<div class="oembed-external-link">
21818
- <a href="${R(S2)}" target="_blank" rel="noopener noreferrer">
21818
+ <a href="${R(S)}" target="_blank" rel="noopener noreferrer">
21819
21819
  Visit ${R(u)}
21820
21820
  </a>
21821
21821
  </div>`
21822
21822
  });
21823
21823
  }
21824
- const f = m.sort((S2, U2) => S2.order - U2.order), T2 = [], A = [];
21825
- f.forEach((S2) => {
21826
- S2.html.includes("oembed-title") || S2.html.includes("oembed-author") || S2.html.includes("oembed-provider") || S2.html.includes("oembed-description") ? T2.push(S2.html) : A.push(S2.html);
21824
+ const f = m.sort((S, U2) => S.order - U2.order), T = [], A2 = [];
21825
+ f.forEach((S) => {
21826
+ S.html.includes("oembed-title") || S.html.includes("oembed-author") || S.html.includes("oembed-provider") || S.html.includes("oembed-description") ? T.push(S.html) : A2.push(S.html);
21827
21827
  });
21828
21828
  let w = "";
21829
- T2.length > 0 && (w = `<div class="oembed-header">${T2.join("")}</div>`);
21829
+ T.length > 0 && (w = `<div class="oembed-header">${T.join("")}</div>`);
21830
21830
  let v = "";
21831
- return A.length > 0 && (v = `<div class="oembed-content">
21832
- ${A.join("")}
21831
+ return A2.length > 0 && (v = `<div class="oembed-content">
21832
+ ${A2.join("")}
21833
21833
  </div>`), `<div class="oembed-container oembed-video">
21834
21834
  ${w}
21835
21835
  ${v}
@@ -21850,7 +21850,7 @@ const Gd = async (e, t, u, r, a) => {
21850
21850
  html: `<div class="oembed-description">${R(n)}</div>`
21851
21851
  }), r.thumbnail !== void 0 && c && h.push({
21852
21852
  order: r.thumbnail,
21853
- html: At$1(
21853
+ html: At(
21854
21854
  R(c),
21855
21855
  R(i),
21856
21856
  "oembed-thumbnail"
@@ -21867,15 +21867,15 @@ const Gd = async (e, t, u, r, a) => {
21867
21867
  </a>`
21868
21868
  });
21869
21869
  }
21870
- const m = h.sort((v, S2) => v.order - S2.order), f = [], T2 = [];
21870
+ const m = h.sort((v, S) => v.order - S.order), f = [], T = [];
21871
21871
  m.forEach((v) => {
21872
- v.html.includes("oembed-title") || v.html.includes("oembed-author") || v.html.includes("oembed-provider") || v.html.includes("oembed-description") ? f.push(v.html) : T2.push(v.html);
21872
+ v.html.includes("oembed-title") || v.html.includes("oembed-author") || v.html.includes("oembed-provider") || v.html.includes("oembed-description") ? f.push(v.html) : T.push(v.html);
21873
21873
  });
21874
- let A = "";
21875
- f.length > 0 && (A = `<div class="oembed-header">${f.join("")}</div>`);
21874
+ let A2 = "";
21875
+ f.length > 0 && (A2 = `<div class="oembed-header">${f.join("")}</div>`);
21876
21876
  let w = "";
21877
- return T2.length > 0 && (w = `<div class="oembed-content">${T2.join("")}</div>`), `<div class="oembed-container oembed-link">
21878
- ${A}
21877
+ return T.length > 0 && (w = `<div class="oembed-content">${T.join("")}</div>`), `<div class="oembed-container oembed-link">
21878
+ ${A2}
21879
21879
  ${w}
21880
21880
  </div>`;
21881
21881
  }, ta = (e, t) => {
@@ -22718,10 +22718,10 @@ function za(e) {
22718
22718
  Q(m, "id", "id", h), Q(m, "title", "title", h);
22719
22719
  const f = (c = lt("link", h)) === null || c === void 0 ? void 0 : c.attribs.href;
22720
22720
  f && (m.link = f);
22721
- const T2 = fe("summary", h) || fe("content", h);
22722
- T2 && (m.description = T2);
22723
- const A = fe("updated", h);
22724
- return A && (m.pubDate = new Date(A)), m;
22721
+ const T = fe("summary", h) || fe("content", h);
22722
+ T && (m.description = T);
22723
+ const A2 = fe("updated", h);
22724
+ return A2 && (m.pubDate = new Date(A2)), m;
22725
22725
  })
22726
22726
  };
22727
22727
  Q(r, "id", "id", u), Q(r, "title", "title", u);
@@ -22831,7 +22831,7 @@ const St$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
22831
22831
  }, Symbol.toStringTag, { value: "Module" })), Ja = {
22832
22832
  _useHtmlParser2: false
22833
22833
  };
22834
- function Kt(e, t) {
22834
+ function Kt$1(e, t) {
22835
22835
  if (!e)
22836
22836
  return t ?? Ja;
22837
22837
  const u = {
@@ -22850,7 +22850,7 @@ function ei(e, t) {
22850
22850
  function ti(e, t) {
22851
22851
  const u = ei(e) ? (t = e, void 0) : e, r = {
22852
22852
  ...this === null || this === void 0 ? void 0 : this._options,
22853
- ...Kt(t)
22853
+ ...Kt$1(t)
22854
22854
  };
22855
22855
  return Dr(this, u, r);
22856
22856
  }
@@ -22926,7 +22926,7 @@ function oi(e) {
22926
22926
  function ci(e) {
22927
22927
  return e.replace(/[A-Z]/g, "-$&").toLowerCase();
22928
22928
  }
22929
- function P(e, t) {
22929
+ function P$1(e, t) {
22930
22930
  const u = e.length;
22931
22931
  for (let r = 0; r < u; r++)
22932
22932
  t(e[r], r);
@@ -22936,7 +22936,7 @@ var ve;
22936
22936
  (function(e) {
22937
22937
  e[e.LowerA = 97] = "LowerA", e[e.LowerZ = 122] = "LowerZ", e[e.UpperA = 65] = "UpperA", e[e.UpperZ = 90] = "UpperZ", e[e.Exclamation = 33] = "Exclamation";
22938
22938
  })(ve || (ve = {}));
22939
- function Xt$1(e) {
22939
+ function Xt(e) {
22940
22940
  const t = e.indexOf("<");
22941
22941
  if (t === -1 || t > e.length - 3)
22942
22942
  return false;
@@ -23001,14 +23001,14 @@ var be;
23001
23001
  (function(e) {
23002
23002
  e[e.VALUE_LENGTH = 49152] = "VALUE_LENGTH", e[e.BRANCH_LENGTH = 16256] = "BRANCH_LENGTH", e[e.JUMP_TABLE = 127] = "JUMP_TABLE";
23003
23003
  })(be || (be = {}));
23004
- function Zt$1(e) {
23004
+ function Zt(e) {
23005
23005
  return e >= V.ZERO && e <= V.NINE;
23006
23006
  }
23007
23007
  function fi(e) {
23008
23008
  return e >= V.UPPER_A && e <= V.UPPER_F || e >= V.LOWER_A && e <= V.LOWER_F;
23009
23009
  }
23010
23010
  function bi(e) {
23011
- return e >= V.UPPER_A && e <= V.UPPER_Z || e >= V.LOWER_A && e <= V.LOWER_Z || Zt$1(e);
23011
+ return e >= V.UPPER_A && e <= V.UPPER_Z || e >= V.LOWER_A && e <= V.LOWER_Z || Zt(e);
23012
23012
  }
23013
23013
  function Ei(e) {
23014
23014
  return e === V.EQUALS || bi(e);
@@ -23085,7 +23085,7 @@ let Ti = class {
23085
23085
  const r = u;
23086
23086
  for (; u < t.length; ) {
23087
23087
  const a = t.charCodeAt(u);
23088
- if (Zt$1(a) || fi(a))
23088
+ if (Zt(a) || fi(a))
23089
23089
  u += 1;
23090
23090
  else
23091
23091
  return this.addToNumericResult(t, r, u, 16), this.emitNumericEntity(a, 3);
@@ -23105,7 +23105,7 @@ let Ti = class {
23105
23105
  const r = u;
23106
23106
  for (; u < t.length; ) {
23107
23107
  const a = t.charCodeAt(u);
23108
- if (Zt$1(a))
23108
+ if (Zt(a))
23109
23109
  u += 1;
23110
23110
  else
23111
23111
  return this.addToNumericResult(t, r, u, 10), this.emitNumericEntity(a, 2);
@@ -23743,17 +23743,17 @@ let xi = class {
23743
23743
  onclosetag(t, u) {
23744
23744
  var r, a, i, n, c, h, m, f;
23745
23745
  this.endIndex = u;
23746
- let T2 = this.getSlice(t, u);
23747
- if (this.lowerCaseTagNames && (T2 = T2.toLowerCase()), this.htmlMode && (ju.has(T2) || Vu.has(T2)) && this.foreignContext.shift(), this.isVoidElement(T2))
23748
- this.htmlMode && T2 === "br" && ((n = (i = this.cbs).onopentagname) === null || n === void 0 || n.call(i, "br"), (h = (c = this.cbs).onopentag) === null || h === void 0 || h.call(c, "br", {}, true), (f = (m = this.cbs).onclosetag) === null || f === void 0 || f.call(m, "br", false));
23746
+ let T = this.getSlice(t, u);
23747
+ if (this.lowerCaseTagNames && (T = T.toLowerCase()), this.htmlMode && (ju.has(T) || Vu.has(T)) && this.foreignContext.shift(), this.isVoidElement(T))
23748
+ this.htmlMode && T === "br" && ((n = (i = this.cbs).onopentagname) === null || n === void 0 || n.call(i, "br"), (h = (c = this.cbs).onopentag) === null || h === void 0 || h.call(c, "br", {}, true), (f = (m = this.cbs).onclosetag) === null || f === void 0 || f.call(m, "br", false));
23749
23749
  else {
23750
- const A = this.stack.indexOf(T2);
23751
- if (A !== -1)
23752
- for (let w = 0; w <= A; w++) {
23750
+ const A2 = this.stack.indexOf(T);
23751
+ if (A2 !== -1)
23752
+ for (let w = 0; w <= A2; w++) {
23753
23753
  const v = this.stack.shift();
23754
- (a = (r = this.cbs).onclosetag) === null || a === void 0 || a.call(r, v, w !== A);
23754
+ (a = (r = this.cbs).onclosetag) === null || a === void 0 || a.call(r, v, w !== A2);
23755
23755
  }
23756
- else this.htmlMode && T2 === "p" && (this.emitOpenTag("p"), this.closeCurrentTag(true));
23756
+ else this.htmlMode && T === "p" && (this.emitOpenTag("p"), this.closeCurrentTag(true));
23757
23757
  }
23758
23758
  this.startIndex = u + 1;
23759
23759
  }
@@ -23817,10 +23817,10 @@ let xi = class {
23817
23817
  }
23818
23818
  /** @internal */
23819
23819
  oncdata(t, u, r) {
23820
- var a, i, n, c, h, m, f, T2, A, w;
23820
+ var a, i, n, c, h, m, f, T, A2, w;
23821
23821
  this.endIndex = u;
23822
23822
  const v = this.getSlice(t, u - r);
23823
- !this.htmlMode || this.options.recognizeCDATA ? ((i = (a = this.cbs).oncdatastart) === null || i === void 0 || i.call(a), (c = (n = this.cbs).ontext) === null || c === void 0 || c.call(n, v), (m = (h = this.cbs).oncdataend) === null || m === void 0 || m.call(h)) : ((T2 = (f = this.cbs).oncomment) === null || T2 === void 0 || T2.call(f, `[CDATA[${v}]]`), (w = (A = this.cbs).oncommentend) === null || w === void 0 || w.call(A)), this.startIndex = u + 1;
23823
+ !this.htmlMode || this.options.recognizeCDATA ? ((i = (a = this.cbs).oncdatastart) === null || i === void 0 || i.call(a), (c = (n = this.cbs).ontext) === null || c === void 0 || c.call(n, v), (m = (h = this.cbs).oncdataend) === null || m === void 0 || m.call(h)) : ((T = (f = this.cbs).oncomment) === null || T === void 0 || T.call(f, `[CDATA[${v}]]`), (w = (A2 = this.cbs).oncommentend) === null || w === void 0 || w.call(A2)), this.startIndex = u + 1;
23824
23824
  }
23825
23825
  /** @internal */
23826
23826
  onend() {
@@ -23948,11 +23948,11 @@ function Ci(e, t) {
23948
23948
  if (typeof t == "function") {
23949
23949
  if (typeof e != "string")
23950
23950
  throw new Error("Bad combination of arguments.");
23951
- return P(this, (u, r) => {
23951
+ return P$1(this, (u, r) => {
23952
23952
  I(u) && Oe(u, e, t.call(u, r, u.attribs[e]));
23953
23953
  });
23954
23954
  }
23955
- return P(this, (u) => {
23955
+ return P$1(this, (u) => {
23956
23956
  if (I(u))
23957
23957
  if (typeof e == "object")
23958
23958
  for (const r of Object.keys(e)) {
@@ -24013,11 +24013,11 @@ function yi(e, t) {
24013
24013
  if (typeof t == "function") {
24014
24014
  if (typeof e == "object")
24015
24015
  throw new TypeError("Bad combination of arguments.");
24016
- return P(this, (r, a) => {
24016
+ return P$1(this, (r, a) => {
24017
24017
  I(r) && Ft$1(r, e, t.call(r, a, $u(r, e, this.options.xmlMode)), this.options.xmlMode);
24018
24018
  });
24019
24019
  }
24020
- return P(this, (r) => {
24020
+ return P$1(this, (r) => {
24021
24021
  if (I(r))
24022
24022
  if (typeof e == "object")
24023
24023
  for (const a of Object.keys(e)) {
@@ -24072,7 +24072,7 @@ function Ri(e, t) {
24072
24072
  if (!r || !I(r))
24073
24073
  return;
24074
24074
  const a = r;
24075
- return (u = a.data) !== null && u !== void 0 || (a.data = {}), e == null ? Oi(a) : typeof e == "object" || t !== void 0 ? (P(this, (i) => {
24075
+ return (u = a.data) !== null && u !== void 0 || (a.data = {}), e == null ? Oi(a) : typeof e == "object" || t !== void 0 ? (P$1(this, (i) => {
24076
24076
  I(i) && (typeof e == "object" ? Gu(i, e) : Gu(i, e, t));
24077
24077
  }), this) : Li(a, e);
24078
24078
  }
@@ -24110,7 +24110,7 @@ function pt(e) {
24110
24110
  function ki(e) {
24111
24111
  const t = pt(e);
24112
24112
  for (const u of t)
24113
- P(this, (r) => {
24113
+ P$1(this, (r) => {
24114
24114
  I(r) && Mr(r, u);
24115
24115
  });
24116
24116
  return this;
@@ -24130,7 +24130,7 @@ function Pi(e) {
24130
24130
  }
24131
24131
  function Br(e) {
24132
24132
  if (typeof e == "function")
24133
- return P(this, (r, a) => {
24133
+ return P$1(this, (r, a) => {
24134
24134
  if (I(r)) {
24135
24135
  const i = r.attribs.class || "";
24136
24136
  Br.call([r], e.call(r, a, i));
@@ -24158,11 +24158,11 @@ function Br(e) {
24158
24158
  }
24159
24159
  function Ur(e) {
24160
24160
  if (typeof e == "function")
24161
- return P(this, (a, i) => {
24161
+ return P$1(this, (a, i) => {
24162
24162
  I(a) && Ur.call([a], e.call(a, i, a.attribs.class || ""));
24163
24163
  });
24164
24164
  const t = pt(e), u = t.length, r = arguments.length === 0;
24165
- return P(this, (a) => {
24165
+ return P$1(this, (a) => {
24166
24166
  if (I(a))
24167
24167
  if (r)
24168
24168
  a.attribs.class = "";
@@ -24179,7 +24179,7 @@ function Ur(e) {
24179
24179
  }
24180
24180
  function Fr(e, t) {
24181
24181
  if (typeof e == "function")
24182
- return P(this, (n, c) => {
24182
+ return P$1(this, (n, c) => {
24183
24183
  I(n) && Fr.call([n], e.call(n, c, n.attribs.class || "", t), t);
24184
24184
  });
24185
24185
  if (!e || typeof e != "string")
@@ -24214,17 +24214,17 @@ var N;
24214
24214
  (function(e) {
24215
24215
  e.Attribute = "attribute", e.Pseudo = "pseudo", e.PseudoElement = "pseudo-element", e.Tag = "tag", e.Universal = "universal", e.Adjacent = "adjacent", e.Child = "child", e.Descendant = "descendant", e.Parent = "parent", e.Sibling = "sibling", e.ColumnCombinator = "column-combinator";
24216
24216
  })(N || (N = {}));
24217
- var H;
24217
+ var H$1;
24218
24218
  (function(e) {
24219
24219
  e.Any = "any", e.Element = "element", e.End = "end", e.Equals = "equals", e.Exists = "exists", e.Hyphen = "hyphen", e.Not = "not", e.Start = "start";
24220
- })(H || (H = {}));
24220
+ })(H$1 || (H$1 = {}));
24221
24221
  const Wu = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/, Bi = /\\([\da-f]{1,6}\s?|(\s)|.)/gi, Ui = /* @__PURE__ */ new Map([
24222
- [126, H.Element],
24223
- [94, H.Start],
24224
- [36, H.End],
24225
- [42, H.Any],
24226
- [33, H.Not],
24227
- [124, H.Hyphen]
24222
+ [126, H$1.Element],
24223
+ [94, H$1.Start],
24224
+ [36, H$1.End],
24225
+ [42, H$1.Any],
24226
+ [33, H$1.Not],
24227
+ [124, H$1.Hyphen]
24228
24228
  ]), Fi = /* @__PURE__ */ new Set([
24229
24229
  "has",
24230
24230
  "not",
@@ -24275,30 +24275,30 @@ function Ct$1(e) {
24275
24275
  }
24276
24276
  function Hr(e, t, u) {
24277
24277
  let r = [];
24278
- function a(A) {
24279
- const w = t.slice(u + A).match(Wu);
24278
+ function a(A2) {
24279
+ const w = t.slice(u + A2).match(Wu);
24280
24280
  if (!w)
24281
24281
  throw new Error(`Expected name, found ${t.slice(u)}`);
24282
24282
  const [v] = w;
24283
- return u += A + v.length, Be(v);
24283
+ return u += A2 + v.length, Be(v);
24284
24284
  }
24285
- function i(A) {
24286
- for (u += A; u < t.length && zu(t.charCodeAt(u)); )
24285
+ function i(A2) {
24286
+ for (u += A2; u < t.length && zu(t.charCodeAt(u)); )
24287
24287
  u++;
24288
24288
  }
24289
24289
  function n() {
24290
24290
  u += 1;
24291
- const A = u;
24291
+ const A2 = u;
24292
24292
  let w = 1;
24293
24293
  for (; w > 0 && u < t.length; u++)
24294
24294
  t.charCodeAt(u) === 40 && !c(u) ? w++ : t.charCodeAt(u) === 41 && !c(u) && w--;
24295
24295
  if (w)
24296
24296
  throw new Error("Parenthesis not matched");
24297
- return Be(t.slice(A, u - 1));
24297
+ return Be(t.slice(A2, u - 1));
24298
24298
  }
24299
- function c(A) {
24299
+ function c(A2) {
24300
24300
  let w = 0;
24301
- for (; t.charCodeAt(--A) === 92; )
24301
+ for (; t.charCodeAt(--A2) === 92; )
24302
24302
  w++;
24303
24303
  return (w & 1) === 1;
24304
24304
  }
@@ -24306,24 +24306,24 @@ function Hr(e, t, u) {
24306
24306
  if (r.length > 0 && qe(r[r.length - 1]))
24307
24307
  throw new Error("Did not expect successive traversals.");
24308
24308
  }
24309
- function m(A) {
24309
+ function m(A2) {
24310
24310
  if (r.length > 0 && r[r.length - 1].type === N.Descendant) {
24311
- r[r.length - 1].type = A;
24311
+ r[r.length - 1].type = A2;
24312
24312
  return;
24313
24313
  }
24314
- h(), r.push({ type: A });
24314
+ h(), r.push({ type: A2 });
24315
24315
  }
24316
- function f(A, w) {
24316
+ function f(A2, w) {
24317
24317
  r.push({
24318
24318
  type: N.Attribute,
24319
- name: A,
24319
+ name: A2,
24320
24320
  action: w,
24321
24321
  value: a(1),
24322
24322
  namespace: null,
24323
24323
  ignoreCase: "quirks"
24324
24324
  });
24325
24325
  }
24326
- function T2() {
24326
+ function T() {
24327
24327
  if (r.length && r[r.length - 1].type === N.Descendant && r.pop(), r.length === 0)
24328
24328
  throw new Error("Empty sub-selector");
24329
24329
  e.push(r);
@@ -24331,8 +24331,8 @@ function Hr(e, t, u) {
24331
24331
  if (i(0), t.length === u)
24332
24332
  return u;
24333
24333
  e: for (; u < t.length; ) {
24334
- const A = t.charCodeAt(u);
24335
- switch (A) {
24334
+ const A2 = t.charCodeAt(u);
24335
+ switch (A2) {
24336
24336
  // Whitespace
24337
24337
  case 32:
24338
24338
  case 9:
@@ -24361,26 +24361,26 @@ function Hr(e, t, u) {
24361
24361
  }
24362
24362
  // Special attribute selectors: .class, #id
24363
24363
  case 46: {
24364
- f("class", H.Element);
24364
+ f("class", H$1.Element);
24365
24365
  break;
24366
24366
  }
24367
24367
  case 35: {
24368
- f("id", H.Equals);
24368
+ f("id", H$1.Equals);
24369
24369
  break;
24370
24370
  }
24371
24371
  case 91: {
24372
24372
  i(1);
24373
24373
  let w, v = null;
24374
24374
  t.charCodeAt(u) === 124 ? w = a(1) : t.startsWith("*|", u) ? (v = "*", w = a(2)) : (w = a(0), t.charCodeAt(u) === 124 && t.charCodeAt(u + 1) !== 61 && (v = w, w = a(1))), i(0);
24375
- let S2 = H.Exists;
24375
+ let S = H$1.Exists;
24376
24376
  const U2 = Ui.get(t.charCodeAt(u));
24377
24377
  if (U2) {
24378
- if (S2 = U2, t.charCodeAt(u + 1) !== 61)
24378
+ if (S = U2, t.charCodeAt(u + 1) !== 61)
24379
24379
  throw new Error("Expected `=`");
24380
24380
  i(2);
24381
- } else t.charCodeAt(u) === 61 && (S2 = H.Equals, i(1));
24382
- let M2 = "", ee2 = null;
24383
- if (S2 !== "exists") {
24381
+ } else t.charCodeAt(u) === 61 && (S = H$1.Equals, i(1));
24382
+ let M2 = "", ee = null;
24383
+ if (S !== "exists") {
24384
24384
  if (Ht$1(t.charCodeAt(u))) {
24385
24385
  const ge = t.charCodeAt(u);
24386
24386
  let ie = u + 1;
@@ -24397,7 +24397,7 @@ function Hr(e, t, u) {
24397
24397
  }
24398
24398
  i(0);
24399
24399
  const ae = t.charCodeAt(u) | 32;
24400
- ae === 115 ? (ee2 = false, i(1)) : ae === 105 && (ee2 = true, i(1));
24400
+ ae === 115 ? (ee = false, i(1)) : ae === 105 && (ee = true, i(1));
24401
24401
  }
24402
24402
  if (t.charCodeAt(u) !== 93)
24403
24403
  throw new Error("Attribute selector didn't terminate");
@@ -24405,10 +24405,10 @@ function Hr(e, t, u) {
24405
24405
  const he = {
24406
24406
  type: N.Attribute,
24407
24407
  name: w,
24408
- action: S2,
24408
+ action: S,
24409
24409
  value: M2,
24410
24410
  namespace: v,
24411
- ignoreCase: ee2
24411
+ ignoreCase: ee
24412
24412
  };
24413
24413
  r.push(he);
24414
24414
  break;
@@ -24433,8 +24433,8 @@ function Hr(e, t, u) {
24433
24433
  u += 1;
24434
24434
  } else {
24435
24435
  if (v = n(), Hi.has(w)) {
24436
- const S2 = v.charCodeAt(0);
24437
- S2 === v.charCodeAt(v.length - 1) && Ht$1(S2) && (v = v.slice(1, -1));
24436
+ const S = v.charCodeAt(0);
24437
+ S === v.charCodeAt(v.length - 1) && Ht$1(S) && (v = v.slice(1, -1));
24438
24438
  }
24439
24439
  v = Be(v);
24440
24440
  }
@@ -24442,21 +24442,21 @@ function Hr(e, t, u) {
24442
24442
  break;
24443
24443
  }
24444
24444
  case 44: {
24445
- T2(), r = [], i(1);
24445
+ T(), r = [], i(1);
24446
24446
  break;
24447
24447
  }
24448
24448
  default: {
24449
24449
  if (t.startsWith("/*", u)) {
24450
- const S2 = t.indexOf("*/", u + 2);
24451
- if (S2 < 0)
24450
+ const S = t.indexOf("*/", u + 2);
24451
+ if (S < 0)
24452
24452
  throw new Error("Comment was not terminated");
24453
- u = S2 + 2, r.length === 0 && i(0);
24453
+ u = S + 2, r.length === 0 && i(0);
24454
24454
  break;
24455
24455
  }
24456
24456
  let w = null, v;
24457
- if (A === 42)
24457
+ if (A2 === 42)
24458
24458
  u += 1, v = "*";
24459
- else if (A === 124) {
24459
+ else if (A2 === 124) {
24460
24460
  if (v = "", t.charCodeAt(u + 1) === 124) {
24461
24461
  m(N.ColumnCombinator), i(2);
24462
24462
  break;
@@ -24469,7 +24469,7 @@ function Hr(e, t, u) {
24469
24469
  }
24470
24470
  }
24471
24471
  }
24472
- return T2(), u;
24472
+ return T(), u;
24473
24473
  }
24474
24474
  function Yi(e) {
24475
24475
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -24496,12 +24496,12 @@ function Au(e) {
24496
24496
  return !qr.has(e.type);
24497
24497
  }
24498
24498
  const Vi = /* @__PURE__ */ new Map([
24499
- [H.Exists, 10],
24500
- [H.Equals, 8],
24501
- [H.Not, 7],
24502
- [H.Start, 6],
24503
- [H.End, 6],
24504
- [H.Any, 5]
24499
+ [H$1.Exists, 10],
24500
+ [H$1.Equals, 8],
24501
+ [H$1.Not, 7],
24502
+ [H$1.Start, 6],
24503
+ [H$1.End, 6],
24504
+ [H$1.Any, 5]
24505
24505
  ]);
24506
24506
  function $i(e) {
24507
24507
  const t = e.map(Yr);
@@ -24517,7 +24517,7 @@ function $i(e) {
24517
24517
  function Yr(e) {
24518
24518
  var t, u;
24519
24519
  let r = (t = qr.get(e.type)) !== null && t !== void 0 ? t : -1;
24520
- return e.type === N.Attribute ? (r = (u = Vi.get(e.action)) !== null && u !== void 0 ? u : 4, e.action === H.Equals && e.name === "id" && (r = 9), e.ignoreCase && (r >>= 1)) : e.type === N.Pseudo && (e.data ? e.name === "has" || e.name === "contains" ? r = 0 : Array.isArray(e.data) ? (r = Math.min(...e.data.map((a) => Math.min(...a.map(Yr)))), r < 0 && (r = 0)) : r = 2 : r = 3), r;
24520
+ return e.type === N.Attribute ? (r = (u = Vi.get(e.action)) !== null && u !== void 0 ? u : 4, e.action === H$1.Equals && e.name === "id" && (r = 9), e.ignoreCase && (r >>= 1)) : e.type === N.Pseudo && (e.data ? e.name === "has" || e.name === "contains" ? r = 0 : Array.isArray(e.data) ? (r = Math.min(...e.data.map((a) => Math.min(...a.map(Yr)))), r < 0 && (r = 0)) : r = 2 : r = 3), r;
24521
24521
  }
24522
24522
  const Gi = /[-[\]{}()*+?.,\\^$|#\s]/g;
24523
24523
  function Ku(e) {
@@ -24775,11 +24775,11 @@ const eu = {
24775
24775
  const { equals: a } = u;
24776
24776
  return !r || r.length === 0 ? eu.root(e, t, u) : r.length === 1 ? (i) => a(r[0], i) && e(i) : (i) => r.includes(i) && e(i);
24777
24777
  },
24778
- hover: Yt("isHovered"),
24779
- visited: Yt("isVisited"),
24780
- active: Yt("isActive")
24778
+ hover: Yt$1("isHovered"),
24779
+ visited: Yt$1("isVisited"),
24780
+ active: Yt$1("isActive")
24781
24781
  };
24782
- function Yt(e) {
24782
+ function Yt$1(e) {
24783
24783
  return function(u, r, { adapter: a }) {
24784
24784
  const i = a[e];
24785
24785
  return typeof i != "function" ? C.falseFunc : function(c) {
@@ -24926,11 +24926,11 @@ const jt = (e, t, u, r, a) => {
24926
24926
  const m = en(h, i);
24927
24927
  if (c && h !== C.trueFunc) {
24928
24928
  const { shouldTestNextSiblings: f = false } = h;
24929
- return (T2) => {
24930
- if (!e(T2))
24929
+ return (T) => {
24930
+ if (!e(T))
24931
24931
  return false;
24932
- c[0] = T2;
24933
- const A = i.getChildren(T2), w = f ? [...A, ...Vr(T2, i)] : A;
24932
+ c[0] = T;
24933
+ const A2 = i.getChildren(T), w = f ? [...A2, ...Vr(T, i)] : A2;
24934
24934
  return i.existsOne(m, w);
24935
24935
  };
24936
24936
  }
@@ -24958,7 +24958,7 @@ function tn(e, t, u, r, a) {
24958
24958
  return eu[n](e, c, u, r);
24959
24959
  if (n in Zu) {
24960
24960
  const f = Zu[n];
24961
- return Ju(f, n, c, 2), (T2) => f(T2, u, c) && e(T2);
24961
+ return Ju(f, n, c, 2), (T) => f(T, u, c) && e(T);
24962
24962
  }
24963
24963
  throw new Error(`Unknown pseudo-class :${n}`);
24964
24964
  }
@@ -25033,10 +25033,10 @@ function un(e, t, u, r, a) {
25033
25033
  return function(h) {
25034
25034
  const m = i.getSiblings(h);
25035
25035
  for (let f = 0; f < m.length; f++) {
25036
- const T2 = m[f];
25037
- if (n(h, T2))
25036
+ const T = m[f];
25037
+ if (n(h, T))
25038
25038
  break;
25039
- if (i.isTag(T2) && e(T2))
25039
+ if (i.isTag(T) && e(T))
25040
25040
  return true;
25041
25041
  }
25042
25042
  return false;
@@ -25048,11 +25048,11 @@ function un(e, t, u, r, a) {
25048
25048
  } : function(h) {
25049
25049
  const m = i.getSiblings(h);
25050
25050
  let f;
25051
- for (let T2 = 0; T2 < m.length; T2++) {
25052
- const A = m[T2];
25053
- if (n(h, A))
25051
+ for (let T = 0; T < m.length; T++) {
25052
+ const A2 = m[T];
25053
+ if (n(h, A2))
25054
25054
  break;
25055
- i.isTag(A) && (f = A);
25055
+ i.isTag(A2) && (f = A2);
25056
25056
  }
25057
25057
  return !!f && e(f);
25058
25058
  };
@@ -25276,15 +25276,15 @@ function Et$1(e, t, u, r, a) {
25276
25276
  const i = t.findIndex(bt$1), n = t.slice(0, i), c = t[i], h = t.length - 1 === i ? a : 1 / 0, m = fn(c.name, c.data, h);
25277
25277
  if (m === 0)
25278
25278
  return [];
25279
- const T2 = (n.length === 0 && !Array.isArray(e) ? It$1(e).filter(I) : n.length === 0 ? (Array.isArray(e) ? e : [e]).filter(I) : r || n.some(qe) ? uu(e, [n], u, m) : ru(e, [n], u)).slice(0, m);
25280
- let A = _n(c.name, T2, c.data, u);
25281
- if (A.length === 0 || t.length === i + 1)
25282
- return A;
25279
+ const T = (n.length === 0 && !Array.isArray(e) ? It$1(e).filter(I) : n.length === 0 ? (Array.isArray(e) ? e : [e]).filter(I) : r || n.some(qe) ? uu(e, [n], u, m) : ru(e, [n], u)).slice(0, m);
25280
+ let A2 = _n(c.name, T, c.data, u);
25281
+ if (A2.length === 0 || t.length === i + 1)
25282
+ return A2;
25283
25283
  const w = t.slice(i + 1), v = w.some(qe);
25284
25284
  if (v) {
25285
25285
  if (qe(w[0])) {
25286
- const { type: S2 } = w[0];
25287
- (S2 === N.Sibling || S2 === N.Adjacent) && (A = zr(A, St$1, true)), w.unshift(En);
25286
+ const { type: S } = w[0];
25287
+ (S === N.Sibling || S === N.Adjacent) && (A2 = zr(A2, St$1, true)), w.unshift(En);
25288
25288
  }
25289
25289
  u = {
25290
25290
  ...u,
@@ -25294,15 +25294,15 @@ function Et$1(e, t, u, r, a) {
25294
25294
  * Add a custom root func, to make sure traversals don't match elements
25295
25295
  * that aren't a part of the considered tree.
25296
25296
  */
25297
- rootFunc: (S2) => A.includes(S2)
25297
+ rootFunc: (S) => A2.includes(S)
25298
25298
  };
25299
25299
  } else u.rootFunc && u.rootFunc !== ft.trueFunc && (u = { ...u, rootFunc: ft.trueFunc });
25300
- return w.some(bt$1) ? Et$1(A, w, u, false, a) : v ? (
25300
+ return w.some(bt$1) ? Et$1(A2, w, u, false, a) : v ? (
25301
25301
  // Query existing elements to resolve traversal.
25302
- uu(A, [w], u, a)
25302
+ uu(A2, [w], u, a)
25303
25303
  ) : (
25304
25304
  // If we don't have any more traversals, simply filter elements.
25305
- ru(A, [w], u)
25305
+ ru(A2, [w], u)
25306
25306
  );
25307
25307
  }
25308
25308
  function uu(e, t, u, r) {
@@ -25375,7 +25375,7 @@ function Iu(e, ...t) {
25375
25375
  let u = null;
25376
25376
  const r = Nu((a, i) => {
25377
25377
  const n = [];
25378
- return P(i, (c) => {
25378
+ return P$1(i, (c) => {
25379
25379
  for (let h; (h = a(c)) && !u?.(h, n.length); c = h)
25380
25380
  n.push(h);
25381
25381
  }), n;
@@ -25404,7 +25404,7 @@ function Sn(e) {
25404
25404
  xmlMode: this.options.xmlMode,
25405
25405
  root: (t = this._root) === null || t === void 0 ? void 0 : t[0]
25406
25406
  }, a = typeof e == "string" ? (i) => Qr(i, e, r) : tt(e);
25407
- return P(this, (i) => {
25407
+ return P$1(this, (i) => {
25408
25408
  for (i && !Te(i) && !I(i) && (i = i.parent); i && I(i); ) {
25409
25409
  if (a(i, 0)) {
25410
25410
  u.includes(i) || u.push(i);
@@ -25594,7 +25594,7 @@ function to(e, t) {
25594
25594
  function ts(e) {
25595
25595
  return function(...t) {
25596
25596
  const u = this.length - 1;
25597
- return P(this, (r, a) => {
25597
+ return P$1(this, (r, a) => {
25598
25598
  if (!B$1(r))
25599
25599
  return;
25600
25600
  const i = typeof t[0] == "function" ? t[0].call(r, a, this._render(r.children)) : t, n = this._makeDomArray(i, a < u);
@@ -25610,12 +25610,12 @@ function _e(e, t, u, r, a) {
25610
25610
  ...r
25611
25611
  ], h = t === 0 ? null : e[t - 1], m = t + u >= e.length ? null : e[t + u];
25612
25612
  for (let f = 0; f < r.length; ++f) {
25613
- const T2 = r[f], A = T2.parent;
25614
- if (A) {
25615
- const v = A.children.indexOf(T2);
25616
- v !== -1 && (A.children.splice(v, 1), a === A && t > v && c[0]--);
25613
+ const T = r[f], A2 = T.parent;
25614
+ if (A2) {
25615
+ const v = A2.children.indexOf(T);
25616
+ v !== -1 && (A2.children.splice(v, 1), a === A2 && t > v && c[0]--);
25617
25617
  }
25618
- T2.parent = a, T2.prev && (T2.prev.next = (i = T2.next) !== null && i !== void 0 ? i : null), T2.next && (T2.next.prev = (n = T2.prev) !== null && n !== void 0 ? n : null), T2.prev = f === 0 ? h : r[f - 1], T2.next = f === r.length - 1 ? m : r[f + 1];
25618
+ T.parent = a, T.prev && (T.prev.next = (i = T.next) !== null && i !== void 0 ? i : null), T.next && (T.next.prev = (n = T.prev) !== null && n !== void 0 ? n : null), T.prev = f === 0 ? h : r[f - 1], T.next = f === r.length - 1 ? m : r[f + 1];
25619
25619
  }
25620
25620
  return h && (h.next = r[0]), m && (m.prev = r[r.length - 1]), e.splice(...c);
25621
25621
  }
@@ -25634,7 +25634,7 @@ function us(e) {
25634
25634
  return function(t) {
25635
25635
  const u = this.length - 1, r = this.parents().last();
25636
25636
  for (let a = 0; a < this.length; a++) {
25637
- const i = this[a], n = typeof t == "function" ? t.call(i, a, i) : typeof t == "string" && !Xt$1(t) ? r.find(t).clone() : t, [c] = this._makeDomArray(n, a < u);
25637
+ const i = this[a], n = typeof t == "function" ? t.call(i, a, i) : typeof t == "string" && !Xt(t) ? r.find(t).clone() : t, [c] = this._makeDomArray(n, a < u);
25638
25638
  if (!c || !B$1(c))
25639
25639
  continue;
25640
25640
  let h = c, m = 0;
@@ -25679,7 +25679,7 @@ function co(e) {
25679
25679
  }
25680
25680
  function ho(...e) {
25681
25681
  const t = this.length - 1;
25682
- return P(this, (u, r) => {
25682
+ return P$1(this, (u, r) => {
25683
25683
  if (!B$1(u) || !u.parent)
25684
25684
  return;
25685
25685
  const a = u.parent.children, i = a.indexOf(u);
@@ -25703,7 +25703,7 @@ function lo(e) {
25703
25703
  }
25704
25704
  function mo(...e) {
25705
25705
  const t = this.length - 1;
25706
- return P(this, (u, r) => {
25706
+ return P$1(this, (u, r) => {
25707
25707
  if (!B$1(u) || !u.parent)
25708
25708
  return;
25709
25709
  const a = u.parent.children, i = a.indexOf(u);
@@ -25717,7 +25717,7 @@ function po(e) {
25717
25717
  const t = this._make(e);
25718
25718
  this.remove();
25719
25719
  const u = [];
25720
- return P(t, (r) => {
25720
+ return P$1(t, (r) => {
25721
25721
  const a = this.clone().toArray(), { parent: i } = r;
25722
25722
  if (!i)
25723
25723
  return;
@@ -25727,12 +25727,12 @@ function po(e) {
25727
25727
  }
25728
25728
  function fo(e) {
25729
25729
  const t = e ? this.filter(e) : this;
25730
- return P(t, (u) => {
25730
+ return P$1(t, (u) => {
25731
25731
  Ie(u), u.prev = u.next = u.parent = null;
25732
25732
  }), this;
25733
25733
  }
25734
25734
  function bo(e) {
25735
- return P(this, (t, u) => {
25735
+ return P$1(this, (t, u) => {
25736
25736
  const { parent: r } = t;
25737
25737
  if (!r)
25738
25738
  return;
@@ -25743,7 +25743,7 @@ function bo(e) {
25743
25743
  });
25744
25744
  }
25745
25745
  function Eo() {
25746
- return P(this, (e) => {
25746
+ return P$1(this, (e) => {
25747
25747
  if (B$1(e)) {
25748
25748
  for (const t of e.children)
25749
25749
  t.next = t.prev = t.parent = null;
@@ -25756,7 +25756,7 @@ function To(e) {
25756
25756
  const t = this[0];
25757
25757
  return !t || !B$1(t) ? null : this._render(t.children);
25758
25758
  }
25759
- return P(this, (t) => {
25759
+ return P$1(this, (t) => {
25760
25760
  if (!B$1(t))
25761
25761
  return;
25762
25762
  for (const r of t.children)
@@ -25769,7 +25769,7 @@ function _o() {
25769
25769
  return this._render(this);
25770
25770
  }
25771
25771
  function go(e) {
25772
- return e === void 0 ? Qe(this) : typeof e == "function" ? P(this, (t, u) => this._make(t).text(e.call(t, u, Qe([t])))) : P(this, (t) => {
25772
+ return e === void 0 ? Qe(this) : typeof e == "function" ? P$1(this, (t, u) => this._make(t).text(e.call(t, u, Qe([t])))) : P$1(this, (t) => {
25773
25773
  if (!B$1(t))
25774
25774
  return;
25775
25775
  for (const r of t.children)
@@ -25810,7 +25810,7 @@ const vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
25810
25810
  function wo(e, t) {
25811
25811
  if (e != null && t != null || // When `prop` is a "plain" object
25812
25812
  typeof e == "object" && !Array.isArray(e))
25813
- return P(this, (u, r) => {
25813
+ return P$1(this, (u, r) => {
25814
25814
  I(u) && rs(u, e, t, r);
25815
25815
  });
25816
25816
  if (this.length !== 0)
@@ -25943,26 +25943,26 @@ function ko(e, t) {
25943
25943
  return function u(r, a, i = true) {
25944
25944
  if (r == null)
25945
25945
  throw new Error("cheerio.load() expects a string");
25946
- const n = Kt(a), c = e(r, n, i, null);
25946
+ const n = Kt$1(a), c = e(r, n, i, null);
25947
25947
  class h extends ut {
25948
- _make(T2, A) {
25949
- const w = m(T2, A);
25948
+ _make(T, A2) {
25949
+ const w = m(T, A2);
25950
25950
  return w.prevObject = this, w;
25951
25951
  }
25952
- _parse(T2, A, w, v) {
25953
- return e(T2, A, w, v);
25952
+ _parse(T, A2, w, v) {
25953
+ return e(T, A2, w, v);
25954
25954
  }
25955
- _render(T2) {
25956
- return t(T2, this.options);
25955
+ _render(T) {
25956
+ return t(T, this.options);
25957
25957
  }
25958
25958
  }
25959
- function m(f, T2, A = c, w) {
25959
+ function m(f, T, A2 = c, w) {
25960
25960
  if (f && de(f))
25961
25961
  return f;
25962
- const v = Kt(w, n), S2 = typeof A == "string" ? [e(A, v, false, null)] : "length" in A ? A : [A], U2 = de(S2) ? S2 : new h(S2, null, v);
25962
+ const v = Kt$1(w, n), S = typeof A2 == "string" ? [e(A2, v, false, null)] : "length" in A2 ? A2 : [A2], U2 = de(S) ? S : new h(S, null, v);
25963
25963
  if (U2._root = U2, !f)
25964
25964
  return new h(void 0, U2, v);
25965
- const M2 = typeof f == "string" && Xt$1(f) ? (
25965
+ const M2 = typeof f == "string" && Xt(f) ? (
25966
25966
  // $(<html>)
25967
25967
  e(f, v, false, null).children
25968
25968
  ) : Po(f) ? (
@@ -25971,29 +25971,29 @@ function ko(e, t) {
25971
25971
  ) : Array.isArray(f) ? (
25972
25972
  // $([dom])
25973
25973
  f
25974
- ) : void 0, ee2 = new h(M2, U2, v);
25974
+ ) : void 0, ee = new h(M2, U2, v);
25975
25975
  if (M2)
25976
- return ee2;
25976
+ return ee;
25977
25977
  if (typeof f != "string")
25978
25978
  throw new TypeError("Unexpected type of selector");
25979
25979
  let he = f;
25980
- const ae = T2 ? (
25980
+ const ae = T ? (
25981
25981
  // If we don't have a context, maybe we have a root, from loading
25982
- typeof T2 == "string" ? Xt$1(T2) ? (
25982
+ typeof T == "string" ? Xt(T) ? (
25983
25983
  // $('li', '<ul>...</ul>')
25984
- new h([e(T2, v, false, null)], U2, v)
25984
+ new h([e(T, v, false, null)], U2, v)
25985
25985
  ) : (
25986
25986
  // $('li', 'ul')
25987
- (he = `${T2} ${he}`, U2)
25988
- ) : de(T2) ? (
25987
+ (he = `${T} ${he}`, U2)
25988
+ ) : de(T) ? (
25989
25989
  // $('li', $)
25990
- T2
25990
+ T
25991
25991
  ) : (
25992
25992
  // $('li', node), $('li', [nodes])
25993
- new h(Array.isArray(T2) ? T2 : [T2], U2, v)
25993
+ new h(Array.isArray(T) ? T : [T], U2, v)
25994
25994
  )
25995
25995
  ) : U2;
25996
- return ae ? ae.find(he) : ee2;
25996
+ return ae ? ae.find(he) : ee;
25997
25997
  }
25998
25998
  return Object.assign(m, ni, {
25999
25999
  load: u,
@@ -29860,7 +29860,7 @@ class Es {
29860
29860
  case l.IN_TABLE:
29861
29861
  case l.IN_TABLE_BODY:
29862
29862
  case l.IN_ROW: {
29863
- Wt(this, t);
29863
+ Wt$1(this, t);
29864
29864
  break;
29865
29865
  }
29866
29866
  case l.IN_TABLE_TEXT: {
@@ -29868,7 +29868,7 @@ class Es {
29868
29868
  break;
29869
29869
  }
29870
29870
  case l.IN_COLUMN_GROUP: {
29871
- _t$1(this, t);
29871
+ _t(this, t);
29872
29872
  break;
29873
29873
  }
29874
29874
  case l.AFTER_BODY: {
@@ -29919,11 +29919,11 @@ class Es {
29919
29919
  case l.IN_TABLE:
29920
29920
  case l.IN_TABLE_BODY:
29921
29921
  case l.IN_ROW: {
29922
- Wt(this, t);
29922
+ Wt$1(this, t);
29923
29923
  break;
29924
29924
  }
29925
29925
  case l.IN_COLUMN_GROUP: {
29926
- _t$1(this, t);
29926
+ _t(this, t);
29927
29927
  break;
29928
29928
  }
29929
29929
  case l.AFTER_BODY: {
@@ -30305,7 +30305,7 @@ class Es {
30305
30305
  case l.IN_TABLE:
30306
30306
  case l.IN_TABLE_BODY:
30307
30307
  case l.IN_ROW: {
30308
- Wt(this, t);
30308
+ Wt$1(this, t);
30309
30309
  break;
30310
30310
  }
30311
30311
  case l.IN_TABLE_TEXT: {
@@ -31111,7 +31111,7 @@ function M0(e, t) {
31111
31111
  function B0(e, t) {
31112
31112
  e._err(t, b.eofInElementThatCanContainOnlyText), e.openElements.pop(), e.insertionMode = e.originalInsertionMode, e.onEof(t);
31113
31113
  }
31114
- function Wt(e, t) {
31114
+ function Wt$1(e, t) {
31115
31115
  if (e.openElements.currentTagId !== void 0 && bs.has(e.openElements.currentTagId))
31116
31116
  switch (e.pendingCharacterTokens.length = 0, e.hasNonWhitespacePendingCharacterToken = false, e.originalInsertionMode = e.insertionMode, e.insertionMode = l.IN_TABLE_TEXT, t.type) {
31117
31117
  case O.CHARACTER: {
@@ -31287,7 +31287,7 @@ function Lu(e, t) {
31287
31287
  break;
31288
31288
  }
31289
31289
  default:
31290
- _t$1(e, t);
31290
+ _t(e, t);
31291
31291
  }
31292
31292
  }
31293
31293
  function z0(e, t) {
@@ -31303,10 +31303,10 @@ function z0(e, t) {
31303
31303
  case s.COL:
31304
31304
  break;
31305
31305
  default:
31306
- _t$1(e, t);
31306
+ _t(e, t);
31307
31307
  }
31308
31308
  }
31309
- function _t$1(e, t) {
31309
+ function _t(e, t) {
31310
31310
  e.openElements.currentTagId === s.COLGROUP && (e.openElements.pop(), e.insertionMode = l.IN_TABLE, e._processToken(t));
31311
31311
  }
31312
31312
  function Rt(e, t) {
@@ -32177,20 +32177,20 @@ const Ld = (e) => {
32177
32177
  if (r?.debug(
32178
32178
  `extractField: Found ${h.length} elements for selector "${c}"`
32179
32179
  ), h.each((m, f) => {
32180
- let T2;
32180
+ let T;
32181
32181
  switch (i) {
32182
32182
  case "attr":
32183
- T2 = t(f).attr(e.attr || "href") || "";
32183
+ T = t(f).attr(e.attr || "href") || "";
32184
32184
  break;
32185
32185
  case "html":
32186
- T2 = t(f).html() || "";
32186
+ T = t(f).html() || "";
32187
32187
  break;
32188
32188
  case "text":
32189
32189
  default:
32190
- T2 = t(f).text().trim();
32190
+ T = t(f).text().trim();
32191
32191
  break;
32192
32192
  }
32193
- T2 && n.push(T2);
32193
+ T && n.push(T);
32194
32194
  }), !e.multiple && n.length > 0)
32195
32195
  break;
32196
32196
  }
@@ -32435,20 +32435,20 @@ const Ld = (e) => {
32435
32435
  }, a = u.displayFields || r, i = (y) => {
32436
32436
  const W2 = e[y];
32437
32437
  return typeof W2 == "string" ? W2 : void 0;
32438
- }, n = fr(i("title") || "Untitled"), c = i("description") || "", h = i("image") || "", m = i("favicon"), f = u.useMetadataUrlLink && i("url") || t, T2 = i("siteName") || Bs(f), A = pr(n, 80), w = pr(fr(c), 160), v = [];
32438
+ }, n = fr(i("title") || "Untitled"), c = i("description") || "", h = i("image") || "", m = i("favicon"), f = u.useMetadataUrlLink && i("url") || t, T = i("siteName") || Bs(f), A2 = pr(n, 80), w = pr(fr(c), 160), v = [];
32439
32439
  h && a.image !== void 0 && v.push({
32440
32440
  order: a.image,
32441
32441
  section: "image",
32442
- html: At$1(
32442
+ html: At(
32443
32443
  j$1(h),
32444
- j$1(A),
32444
+ j$1(A2),
32445
32445
  "card-image",
32446
32446
  void 0,
32447
32447
  'loading="lazy"'
32448
32448
  )
32449
32449
  });
32450
- let S2 = "";
32451
- m && a.favicon !== void 0 && (S2 = ou(
32450
+ let S = "";
32451
+ m && a.favicon !== void 0 && (S = ou(
32452
32452
  j$1(m),
32453
32453
  "",
32454
32454
  void 0,
@@ -32459,14 +32459,14 @@ const Ld = (e) => {
32459
32459
  order: a.title,
32460
32460
  section: "header",
32461
32461
  isHeader: true,
32462
- html: `<div class="card-title">${j$1(A)}</div>`
32462
+ html: `<div class="card-title">${j$1(A2)}</div>`
32463
32463
  }), a.siteName !== void 0 && U2.push({
32464
32464
  order: a.siteName,
32465
32465
  section: "header",
32466
32466
  isHeader: true,
32467
32467
  html: `<div class="card-provider">
32468
- ${a.favicon !== void 0 ? S2 : ""}
32469
- <span>${j$1(T2)}</span>
32468
+ ${a.favicon !== void 0 ? S : ""}
32469
+ <span>${j$1(T)}</span>
32470
32470
  </div>`
32471
32471
  }), w && a.description !== void 0 && v.push({
32472
32472
  order: a.description,
@@ -32518,7 +32518,7 @@ const Ld = (e) => {
32518
32518
  "locale",
32519
32519
  "favicon"
32520
32520
  ].includes(y) || a[y] === void 0 && M2.push(y);
32521
- let ee2 = 1e3;
32521
+ let ee = 1e3;
32522
32522
  for (const y of M2) {
32523
32523
  const W2 = e[y];
32524
32524
  let Ce = "";
@@ -32534,7 +32534,7 @@ const Ld = (e) => {
32534
32534
  <span class="field-value">${j$1(String(W2))}</span>
32535
32535
  </div>`;
32536
32536
  v.push({
32537
- order: ee2++,
32537
+ order: ee++,
32538
32538
  section: "enhanced",
32539
32539
  html: Ce
32540
32540
  });
@@ -32563,33 +32563,33 @@ const Ld = (e) => {
32563
32563
  };
32564
32564
  /*!
32565
32565
  * name: mark-deco
32566
- * version: 0.7.0
32566
+ * version: 0.8.0
32567
32567
  * description: Flexible Markdown to HTML conversion library
32568
32568
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
32569
32569
  * license: MIT
32570
32570
  * repository.url: https://github.com/kekyo/mark-deco.git
32571
- * git.commit.hash: 2b8fc59fb30d614d1c529a3d2c9ec721a49c9115
32571
+ * git.commit.hash: cc985acbf6dd451ba9668a6c148f9e041c1032c5
32572
32572
  */
32573
- function gt(e) {
32574
- const t = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/, r = e.match(t);
32575
- if (!r)
32573
+ function B(e) {
32574
+ const t = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/, n = e.match(t);
32575
+ if (!n)
32576
32576
  return {
32577
32577
  data: {},
32578
32578
  content: e
32579
32579
  };
32580
- const o2 = r[1] || "", n = e.slice(r[0].length);
32580
+ const o2 = n[1] || "", r = e.slice(n[0].length);
32581
32581
  try {
32582
32582
  const s2 = load(o2, { schema: JSON_SCHEMA });
32583
32583
  return {
32584
32584
  data: s2 && typeof s2 == "object" && !Array.isArray(s2) ? s2 : {},
32585
- content: n
32585
+ content: r
32586
32586
  };
32587
32587
  } catch (s2) {
32588
32588
  const h = s2 instanceof Error ? s2.message : "Unknown YAML parsing error";
32589
32589
  throw new Error(`Failed to parse frontmatter YAML: ${h}`);
32590
32590
  }
32591
32591
  }
32592
- function wt(e) {
32592
+ function gt(e) {
32593
32593
  if (!e || Object.keys(e).length === 0)
32594
32594
  return "";
32595
32595
  const t = dump(e, { lineWidth: 0 });
@@ -32597,176 +32597,176 @@ function wt(e) {
32597
32597
  `) ? t : `${t}
32598
32598
  `;
32599
32599
  }
32600
- function vt(e, t) {
32601
- const r = t ?? "";
32600
+ function wt(e, t) {
32601
+ const n = t ?? "";
32602
32602
  return `${`---
32603
- ${wt(e)}---
32604
- `}${r}`;
32605
- }
32606
- const T = () => {
32607
- }, kt = {
32608
- debug: T,
32609
- info: T,
32610
- warn: T,
32611
- error: T
32603
+ ${gt(e)}---
32604
+ `}${n}`;
32605
+ }
32606
+ const P = () => {
32607
+ }, vt = {
32608
+ debug: P,
32609
+ info: P,
32610
+ warn: P,
32611
+ error: P
32612
32612
  }, Et = {
32613
32613
  debug: console.debug,
32614
32614
  info: console.info,
32615
32615
  warn: console.warn,
32616
32616
  error: console.error
32617
- }, bt = () => kt, Gt = () => Et, S = (e) => {
32618
- const t = {}, r = e.slice(1, -1).trim(), o2 = r.match(/\.([a-zA-Z0-9_-]+)/g);
32617
+ }, kt = () => vt, Kt = () => Et, H = (e) => {
32618
+ const t = {}, n = e.slice(1, -1).trim(), o2 = n.match(/\.([a-zA-Z0-9_-]+)/g);
32619
32619
  if (o2) {
32620
- const h = o2.map((p2) => p2.slice(1));
32620
+ const h = o2.map((m) => m.slice(1));
32621
32621
  t.class = h.join(" ");
32622
32622
  }
32623
- const n = r.match(/#([a-zA-Z0-9_-]+)/);
32624
- n && n[1] && (t.id = n[1]);
32625
- const s2 = r.match(/([a-zA-Z0-9_-]+)=["']?([^"'\s]*)["']?/g);
32623
+ const r = n.match(/#([a-zA-Z0-9_-]+)/);
32624
+ r && r[1] && (t.id = r[1]);
32625
+ const s2 = n.match(/([a-zA-Z0-9_-]+)=["']?([^"'\s]*)["']?/g);
32626
32626
  if (s2)
32627
32627
  for (const h of s2) {
32628
- const [p2, d2] = h.split("=");
32629
- p2 && d2 && p2 !== "class" && p2 !== "id" && (t[p2] = d2.replace(/["']/g, ""));
32628
+ const [m, d2] = h.split("=");
32629
+ m && d2 && m !== "class" && m !== "id" && (t[m] = d2.replace(/["']/g, ""));
32630
32630
  }
32631
32631
  return t;
32632
- }, $t = (e) => {
32633
- const t = e.lang ? ` class="language-${e.lang}"` : "", r = e.value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
32634
- return `<pre><code${t}>${r}</code></pre>`;
32632
+ }, bt = (e) => {
32633
+ const t = e.lang ? ` class="language-${e.lang}"` : "", n = e.value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
32634
+ return `<pre><code${t}>${n}</code></pre>`;
32635
32635
  }, F = (e, t) => {
32636
- e.data || (e.data = {}), e.data.hProperties || (e.data.hProperties = {}), Object.entries(t).forEach(([r, o2]) => {
32637
- if (r === "class") {
32638
- const n = e.data.hProperties.class;
32639
- n ? typeof n == "string" && n.startsWith("language-") ? e.data.hProperties.class = `${n} ${o2}` : e.data.hProperties.class = `${n} ${o2}` : e.data.hProperties.class = o2;
32636
+ e.data || (e.data = {}), e.data.hProperties || (e.data.hProperties = {}), Object.entries(t).forEach(([n, o2]) => {
32637
+ if (n === "class") {
32638
+ const r = e.data.hProperties.class;
32639
+ r ? typeof r == "string" && r.startsWith("language-") ? e.data.hProperties.class = `${r} ${o2}` : e.data.hProperties.class = `${r} ${o2}` : e.data.hProperties.class = o2;
32640
32640
  } else
32641
- e.data.hProperties[r] = o2;
32641
+ e.data.hProperties[n] = o2;
32642
32642
  });
32643
- }, St = () => (e) => {
32644
- visit(e, (t, r, o2) => {
32643
+ }, $t = () => (e) => {
32644
+ visit(e, (t, n, o2) => {
32645
32645
  if (t.type === "heading" && t.children?.length > 0) {
32646
- const n = t.children[t.children.length - 1];
32647
- if (n?.type === "text" && n.value) {
32648
- const s2 = n.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32646
+ const r = t.children[t.children.length - 1];
32647
+ if (r?.type === "text" && r.value) {
32648
+ const s2 = r.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32649
32649
  if (s2) {
32650
- const h = s2[1].trim(), p2 = s2[2], d2 = S(p2);
32651
- n.value = h, F(t, d2);
32650
+ const h = s2[1].trim(), m = s2[2], d2 = H(m);
32651
+ r.value = h, F(t, d2);
32652
32652
  }
32653
32653
  }
32654
32654
  }
32655
32655
  if (t.type === "paragraph" && t.children?.length > 0) {
32656
- const n = t.children[t.children.length - 1];
32657
- if (n?.type === "text" && n.value) {
32658
- const s2 = n.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32656
+ const r = t.children[t.children.length - 1];
32657
+ if (r?.type === "text" && r.value) {
32658
+ const s2 = r.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32659
32659
  if (s2) {
32660
- const h = s2[1].trim(), p2 = s2[2], d2 = S(p2);
32661
- n.value = h, F(t, d2);
32660
+ const h = s2[1].trim(), m = s2[2], d2 = H(m);
32661
+ r.value = h, F(t, d2);
32662
32662
  }
32663
32663
  }
32664
32664
  }
32665
- if (t.type === "link" && o2 && typeof r == "number") {
32666
- const n = o2.children[r + 1];
32667
- if (n?.type === "text" && n.value) {
32668
- const s2 = n.value.match(/^\s*(\{[^}]+\})/);
32665
+ if (t.type === "link" && o2 && typeof n == "number") {
32666
+ const r = o2.children[n + 1];
32667
+ if (r?.type === "text" && r.value) {
32668
+ const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32669
32669
  if (s2) {
32670
- const h = s2[1], p2 = S(h);
32671
- F(t, p2), n.value = n.value.replace(s2[0], "");
32670
+ const h = s2[1], m = H(h);
32671
+ F(t, m), r.value = r.value.replace(s2[0], "");
32672
32672
  }
32673
32673
  }
32674
32674
  }
32675
- if (t.type === "image" && o2 && typeof r == "number") {
32676
- const n = o2.children[r + 1];
32677
- if (n?.type === "text" && n.value) {
32678
- const s2 = n.value.match(/^\s*(\{[^}]+\})/);
32675
+ if (t.type === "image" && o2 && typeof n == "number") {
32676
+ const r = o2.children[n + 1];
32677
+ if (r?.type === "text" && r.value) {
32678
+ const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32679
32679
  if (s2) {
32680
- const h = s2[1], p2 = S(h);
32681
- F(t, p2), n.value = n.value.replace(s2[0], "");
32680
+ const h = s2[1], m = H(h);
32681
+ F(t, m), r.value = r.value.replace(s2[0], "");
32682
32682
  }
32683
32683
  }
32684
32684
  }
32685
32685
  if (t.type === "listItem" && t.children?.length > 0) {
32686
- const n = t.children[t.children.length - 1];
32687
- if (n?.type === "paragraph" && n.children?.length > 0) {
32688
- const s2 = n.children[n.children.length - 1];
32686
+ const r = t.children[t.children.length - 1];
32687
+ if (r?.type === "paragraph" && r.children?.length > 0) {
32688
+ const s2 = r.children[r.children.length - 1];
32689
32689
  if (s2?.type === "text" && s2.value) {
32690
32690
  const h = s2.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32691
32691
  if (h) {
32692
- const p2 = h[1].trim(), d2 = h[2], a = S(d2);
32693
- s2.value = p2, F(t, a);
32692
+ const m = h[1].trim(), d2 = h[2], c = H(d2);
32693
+ s2.value = m, F(t, c);
32694
32694
  }
32695
32695
  }
32696
32696
  }
32697
32697
  }
32698
- if (t.type === "list" && o2 && typeof r == "number") {
32699
- const n = o2.children[r + 1];
32700
- if (n?.type === "paragraph" && n.children?.length === 1) {
32701
- const s2 = n.children[0];
32698
+ if (t.type === "list" && o2 && typeof n == "number") {
32699
+ const r = o2.children[n + 1];
32700
+ if (r?.type === "paragraph" && r.children?.length === 1) {
32701
+ const s2 = r.children[0];
32702
32702
  if (s2?.type === "text" && s2.value) {
32703
32703
  const h = s2.value.match(/^\s*(\{[^}]+\})\s*$/);
32704
32704
  if (h) {
32705
- const p2 = h[1], d2 = S(p2);
32706
- F(t, d2), o2.children.splice(r + 1, 1);
32705
+ const m = h[1], d2 = H(m);
32706
+ F(t, d2), o2.children.splice(n + 1, 1);
32707
32707
  }
32708
32708
  }
32709
32709
  }
32710
32710
  }
32711
32711
  if (t.type === "blockquote" && t.children?.length > 0) {
32712
- const n = t.children[t.children.length - 1];
32713
- if (n?.type === "paragraph" && n.children?.length > 0) {
32714
- const s2 = n.children[n.children.length - 1];
32712
+ const r = t.children[t.children.length - 1];
32713
+ if (r?.type === "paragraph" && r.children?.length > 0) {
32714
+ const s2 = r.children[r.children.length - 1];
32715
32715
  if (s2?.type === "text" && s2.value) {
32716
32716
  const h = s2.value.match(/^(.*?)\s*(\{[^}]+\})\s*$/);
32717
32717
  if (h) {
32718
- const p2 = h[1].trim(), d2 = h[2], a = S(d2);
32719
- s2.value = p2, F(t, a);
32718
+ const m = h[1].trim(), d2 = h[2], c = H(d2);
32719
+ s2.value = m, F(t, c);
32720
32720
  }
32721
32721
  }
32722
32722
  }
32723
32723
  }
32724
- if (t.type === "blockquote" && o2 && typeof r == "number") {
32725
- const n = o2.children[r + 1];
32726
- if (n?.type === "paragraph" && n.children?.length === 1) {
32727
- const s2 = n.children[0];
32724
+ if (t.type === "blockquote" && o2 && typeof n == "number") {
32725
+ const r = o2.children[n + 1];
32726
+ if (r?.type === "paragraph" && r.children?.length === 1) {
32727
+ const s2 = r.children[0];
32728
32728
  if (s2?.type === "text" && s2.value) {
32729
32729
  const h = s2.value.match(/^\s*(\{[^}]+\})\s*$/);
32730
32730
  if (h) {
32731
- const p2 = h[1], d2 = S(p2);
32732
- F(t, d2), o2.children.splice(r + 1, 1);
32731
+ const m = h[1], d2 = H(m);
32732
+ F(t, d2), o2.children.splice(n + 1, 1);
32733
32733
  }
32734
32734
  }
32735
32735
  }
32736
32736
  }
32737
- if (t.type === "inlineCode" && o2 && typeof r == "number") {
32738
- const n = o2.children[r + 1];
32739
- if (n?.type === "text" && n.value) {
32740
- const s2 = n.value.match(/^\s*(\{[^}]+\})/);
32737
+ if (t.type === "inlineCode" && o2 && typeof n == "number") {
32738
+ const r = o2.children[n + 1];
32739
+ if (r?.type === "text" && r.value) {
32740
+ const s2 = r.value.match(/^\s*(\{[^}]+\})/);
32741
32741
  if (s2) {
32742
- const h = s2[1], p2 = S(h);
32743
- F(t, p2), n.value = n.value.replace(s2[0], "");
32742
+ const h = s2[1], m = H(h);
32743
+ F(t, m), r.value = r.value.replace(s2[0], "");
32744
32744
  }
32745
32745
  }
32746
32746
  }
32747
32747
  if (t.type === "code" && t.meta) {
32748
- const n = t.meta.match(/\{([^}]+)\}/);
32749
- if (n) {
32750
- const s2 = `{${n[1]}}`, h = S(s2), p2 = {
32748
+ const r = t.meta.match(/\{([^}]+)\}/);
32749
+ if (r) {
32750
+ const s2 = `{${r[1]}}`, h = H(s2), m = {
32751
32751
  type: "html",
32752
32752
  value: `<div class="${h.class || ""}" ${Object.entries(
32753
32753
  h
32754
- ).filter(([d2]) => d2 !== "class").map(([d2, a]) => `${d2}="${a}"`).join(" ")}>${$t(t)}</div>`
32754
+ ).filter(([d2]) => d2 !== "class").map(([d2, c]) => `${d2}="${c}"`).join(" ")}>${bt(t)}</div>`
32755
32755
  };
32756
- o2 && typeof r == "number" && (o2.children[r] = p2), t.meta = t.meta.replace(n[0], "").trim() || null;
32756
+ o2 && typeof n == "number" && (o2.children[n] = m), t.meta = t.meta.replace(r[0], "").trim() || null;
32757
32757
  }
32758
32758
  }
32759
32759
  });
32760
- }, xt = () => (e) => {
32760
+ }, St = () => (e) => {
32761
32761
  visit(e, "element", (t) => {
32762
32762
  if (t.tagName === "img") {
32763
- const r = Ys();
32763
+ const n = Ys();
32764
32764
  t.properties || (t.properties = {});
32765
- const o2 = t.properties.style || "", n = o2 ? `${o2}; ${r}` : r;
32766
- t.properties.style = n;
32765
+ const o2 = t.properties.style || "", r = o2 ? `${o2}; ${n}` : n;
32766
+ t.properties.style = r;
32767
32767
  }
32768
32768
  });
32769
- }, { html: Ft } = Y$1, Ht = {
32769
+ }, { html: xt } = Y$1, Ht = {
32770
32770
  indent_size: 2,
32771
32771
  indent_char: " ",
32772
32772
  max_preserve_newlines: 2,
@@ -32778,46 +32778,29 @@ const T = () => {
32778
32778
  unformatted: ["code", "pre", "textarea"],
32779
32779
  content_unformatted: ["pre", "code", "textarea"],
32780
32780
  extra_liners: []
32781
- }, Ct = (e) => {
32782
- const t = (r) => {
32783
- if (r instanceof Date)
32784
- return new Date(r.getTime());
32785
- if (Array.isArray(r))
32786
- return r.map(t);
32787
- if (r && typeof r == "object") {
32788
- const o2 = {};
32789
- for (const [n, s2] of Object.entries(
32790
- r
32791
- ))
32792
- o2[n] = t(s2);
32793
- return o2;
32794
- }
32795
- return r;
32796
- };
32797
- return t(e ?? {});
32798
32781
  }, M = (e) => {
32799
32782
  if (e instanceof Date)
32800
32783
  return e.toISOString();
32801
32784
  if (Array.isArray(e))
32802
32785
  return e.map(M);
32803
32786
  if (e && typeof e == "object") {
32804
- const t = Object.entries(e).filter(([, o2]) => o2 !== void 0).sort(([o2], [n]) => o2 < n ? -1 : o2 > n ? 1 : 0), r = {};
32805
- for (const [o2, n] of t)
32806
- r[o2] = M(n);
32807
- return r;
32787
+ const t = Object.entries(e).filter(([, o2]) => o2 !== void 0).sort(([o2], [r]) => o2 < r ? -1 : o2 > r ? 1 : 0), n = {};
32788
+ for (const [o2, r] of t)
32789
+ n[o2] = M(r);
32790
+ return n;
32808
32791
  }
32809
32792
  return e;
32810
- }, B = (e) => JSON.stringify(M(e ?? {})), U = (e) => e.type === "text" || e.type === "inlineCode" ? e.value || "" : e.children && Array.isArray(e.children) ? e.children.map(U).join("") : "", Ot = (e, t) => `${e}-${t.join("-")}`, It = (e) => {
32811
- const t = [], r = [];
32793
+ }, A = (e) => JSON.stringify(M(e ?? {})), U = (e) => e.type === "text" || e.type === "inlineCode" ? e.value || "" : e.children && Array.isArray(e.children) ? e.children.map(U).join("") : "", Ft = (e, t) => `${e}-${t.join("-")}`, Ct = (e) => {
32794
+ const t = [], n = [];
32812
32795
  for (const o2 of e) {
32813
- const n = o2.level;
32814
- for (; r.length > n; )
32815
- r.pop();
32816
- for (; r.length < n; )
32817
- r.push(0);
32818
- const s2 = n - 1;
32819
- r[s2] = (r[s2] || 0) + 1;
32820
- const h = r.slice(0, n);
32796
+ const r = o2.level;
32797
+ for (; n.length > r; )
32798
+ n.pop();
32799
+ for (; n.length < r; )
32800
+ n.push(0);
32801
+ const s2 = r - 1;
32802
+ n[s2] = (n[s2] || 0) + 1;
32803
+ const h = n.slice(0, r);
32821
32804
  t.push({
32822
32805
  level: o2.level,
32823
32806
  text: o2.text,
@@ -32825,242 +32808,262 @@ const T = () => {
32825
32808
  });
32826
32809
  }
32827
32810
  return t;
32828
- }, K = (e, t, r) => {
32811
+ }, K = (e, t, n) => {
32829
32812
  const o2 = jd(t);
32830
- return o2 !== void 0 ? `${e}-${o2}` : r();
32831
- }, Lt = (e) => {
32832
- const t = [], r = [];
32813
+ return o2 !== void 0 ? `${e}-${o2}` : n();
32814
+ }, It = (e) => {
32815
+ const t = [], n = [];
32833
32816
  for (const o2 of e) {
32834
- const n = {
32817
+ const r = {
32835
32818
  level: o2.level,
32836
32819
  text: o2.text,
32837
32820
  id: o2.id,
32838
32821
  children: []
32839
32822
  };
32840
- for (; r.length > 0; ) {
32841
- const s2 = r[r.length - 1];
32823
+ for (; n.length > 0; ) {
32824
+ const s2 = n[n.length - 1];
32842
32825
  if (s2 && s2.level >= o2.level)
32843
- r.pop();
32826
+ n.pop();
32844
32827
  else
32845
32828
  break;
32846
32829
  }
32847
- if (r.length === 0)
32848
- t.push(n);
32830
+ if (n.length === 0)
32831
+ t.push(r);
32849
32832
  else {
32850
- const s2 = r[r.length - 1];
32851
- s2 && s2.children.push(n);
32833
+ const s2 = n[n.length - 1];
32834
+ s2 && s2.children.push(r);
32852
32835
  }
32853
- r.push(n);
32836
+ n.push(r);
32854
32837
  }
32855
32838
  return t;
32856
- }, Vt = (e) => {
32857
- const { plugins: t = [], logger: r = bt(), fetcher: o2 } = e, n = /* @__PURE__ */ new Map();
32839
+ }, Wt = (e) => {
32840
+ const { plugins: t = [], logger: n = kt(), fetcher: o2 } = e, r = /* @__PURE__ */ new Map();
32858
32841
  for (const a of t) {
32859
- if (n.has(a.name))
32842
+ if (r.has(a.name))
32860
32843
  throw new Error(
32861
32844
  `Plugin with name '${a.name}' is already registered`
32862
32845
  );
32863
- n.set(a.name, a);
32864
- }
32865
- const s2 = async (a, c, i) => {
32866
- const l2 = n.get(a);
32867
- return l2 ? await l2.processBlock(c, i) : `<pre><code class="language-${a}">${R(c)}</code></pre>`;
32868
- }, h = (a, c, i) => {
32869
- const l2 = {
32870
- logger: r,
32871
- signal: c,
32846
+ r.set(a.name, a);
32847
+ }
32848
+ const s2 = async (a, f, u) => {
32849
+ const p2 = r.get(a);
32850
+ return p2 ? await p2.processBlock(f, u) : `<pre><code class="language-${a}">${R(f)}</code></pre>`;
32851
+ }, h = (a, f, u) => {
32852
+ const p2 = {
32853
+ logger: n,
32854
+ signal: f,
32872
32855
  frontmatter: a,
32873
- getUniqueId: i,
32856
+ getUniqueId: u,
32874
32857
  fetcher: o2
32875
32858
  };
32876
- return () => async (f) => {
32877
- const u = [];
32859
+ return () => async (y) => {
32860
+ const g2 = [];
32878
32861
  visit(
32879
- f,
32862
+ y,
32880
32863
  "code",
32881
- (m, y, w) => {
32882
- if (!m.lang || !n.has(m.lang))
32864
+ (w, E2, k2) => {
32865
+ if (!w.lang || !r.has(w.lang))
32883
32866
  return;
32884
- const g2 = (async () => {
32867
+ const b2 = (async () => {
32885
32868
  const v = {
32886
32869
  type: "html",
32887
32870
  value: await s2(
32888
- m.lang,
32889
- m.value,
32890
- l2
32871
+ w.lang,
32872
+ w.value,
32873
+ p2
32891
32874
  )
32892
32875
  };
32893
- w && typeof y == "number" && (w.children[y] = v);
32876
+ k2 && typeof E2 == "number" && (k2.children[E2] = v);
32894
32877
  })();
32895
- u.push(g2);
32878
+ g2.push(b2);
32896
32879
  }
32897
- ), await Promise.all(u);
32880
+ ), await Promise.all(g2);
32898
32881
  };
32899
- }, p2 = (a, c, i = false, l2 = false, f = "") => () => (u) => {
32900
- const m = [], y = [];
32901
- visit(u, "heading", (v) => {
32902
- v.depth >= 1 && v.depth <= 6 && y.push(v);
32882
+ }, m = (a, f, u = false, p2 = false, y = "") => () => (g2) => {
32883
+ const w = [], E2 = [];
32884
+ visit(g2, "heading", (v) => {
32885
+ v.depth >= 1 && v.depth <= 6 && E2.push(v);
32903
32886
  });
32904
- let w = [];
32905
- if (i) {
32906
- const v = y.map((b2) => ({
32907
- level: b2.depth,
32908
- text: U(b2)
32887
+ let k2 = [];
32888
+ if (u) {
32889
+ const v = E2.map((L2) => ({
32890
+ level: L2.depth,
32891
+ text: U(L2)
32909
32892
  }));
32910
- w = It(v);
32911
- }
32912
- const g2 = [];
32913
- y.forEach((v, b2) => {
32914
- const x2 = U(v), C2 = v.data?.hProperties?.id;
32915
- let $2;
32916
- if (C2)
32917
- $2 = C2;
32918
- else if (i && l2) {
32919
- const H2 = K(
32920
- f,
32921
- x2,
32922
- () => c(x2)
32923
- ).replace(`${f}-`, "");
32924
- for (; g2.length > 0; ) {
32925
- const I2 = g2[g2.length - 1];
32926
- if (I2 && I2.level >= v.depth)
32927
- g2.pop();
32893
+ k2 = Ct(v);
32894
+ }
32895
+ const b2 = [];
32896
+ E2.forEach((v, L2) => {
32897
+ const C2 = U(v), N2 = v.data?.hProperties?.id;
32898
+ let S;
32899
+ if (N2)
32900
+ S = N2;
32901
+ else if (u && p2) {
32902
+ const I2 = K(
32903
+ y,
32904
+ C2,
32905
+ () => f(C2)
32906
+ ).replace(`${y}-`, "");
32907
+ for (; b2.length > 0; ) {
32908
+ const x2 = b2[b2.length - 1];
32909
+ if (x2 && x2.level >= v.depth)
32910
+ b2.pop();
32928
32911
  else
32929
32912
  break;
32930
32913
  }
32931
- const O2 = g2.map((I2) => I2.contentId);
32932
- $2 = O2.length > 0 ? `${f}-${O2.join("-")}-${H2}` : `${f}-${H2}`, g2.push({
32914
+ const T = b2.map((x2) => x2.contentId);
32915
+ S = T.length > 0 ? `${y}-${T.join("-")}-${I2}` : `${y}-${I2}`, b2.push({
32933
32916
  level: v.depth,
32934
- contentId: H2
32917
+ contentId: I2
32935
32918
  });
32936
- } else if (i && b2 < w.length) {
32937
- const H2 = w[b2];
32938
- H2 ? $2 = Ot(
32939
- f,
32940
- H2.numbers
32941
- ) : $2 = c(x2);
32919
+ } else if (u && L2 < k2.length) {
32920
+ const I2 = k2[L2];
32921
+ I2 ? S = Ft(
32922
+ y,
32923
+ I2.numbers
32924
+ ) : S = f(C2);
32942
32925
  } else
32943
- $2 = c(x2);
32944
- v.data || (v.data = {}), v.data.hProperties || (v.data.hProperties = {}), C2 || (v.data.hProperties.id = $2), m.push({
32926
+ S = f(C2);
32927
+ v.data || (v.data = {}), v.data.hProperties || (v.data.hProperties = {}), N2 || (v.data.hProperties.id = S), w.push({
32945
32928
  level: v.depth,
32946
- text: x2,
32947
- id: $2
32929
+ text: C2,
32930
+ id: S
32948
32931
  });
32949
32932
  });
32950
- const E2 = Lt(m);
32951
- a.push(...E2);
32933
+ const O2 = It(w);
32934
+ a.push(...O2);
32935
+ }, d2 = (a) => {
32936
+ throw n.error(
32937
+ `Failed to process markdown: ${a instanceof Error ? a.message : "Unknown error"}`
32938
+ ), new Error(
32939
+ `Failed to process markdown: ${a instanceof Error ? a.message : "Unknown error"}`
32940
+ );
32941
+ }, c = async (a, f, u, p2, y, g2) => {
32942
+ const {
32943
+ signal: w,
32944
+ useContentStringHeaderId: E2 = false,
32945
+ useHierarchicalHeadingId: k2 = true,
32946
+ advancedOptions: b2
32947
+ } = u ?? {}, {
32948
+ allowDangerousHtml: O2 = true,
32949
+ htmlOptions: v = Ht,
32950
+ gfmOptions: L2 = {},
32951
+ remarkPlugins: C2 = [],
32952
+ rehypePlugins: N2 = []
32953
+ } = b2 || {}, S = [];
32954
+ let I2 = 0;
32955
+ const T = () => `${f}-${++I2}`;
32956
+ let _2 = unified().use(remarkParse);
32957
+ if (C2)
32958
+ for (const $2 of C2)
32959
+ Array.isArray($2) ? _2 = _2.use($2[0], $2[1]) : _2 = _2.use($2);
32960
+ let x2 = _2.use(remarkGfm, L2).use($t).use(
32961
+ m(
32962
+ S,
32963
+ E2 ? ($2) => K(f, $2, T) : T,
32964
+ k2,
32965
+ E2,
32966
+ f
32967
+ )
32968
+ ).use(h(p2, w, T)).use(remarkRehype, { allowDangerousHtml: O2 }).use(St).use(rehypeStringify, { allowDangerousHtml: O2 });
32969
+ if (N2)
32970
+ for (const $2 of N2)
32971
+ Array.isArray($2) ? x2 = x2.use($2[0], $2[1]) : x2 = x2.use($2);
32972
+ const Z2 = await x2.process(y), X2 = String(Z2);
32973
+ return {
32974
+ html: xt(X2, v),
32975
+ frontmatter: p2,
32976
+ changed: g2,
32977
+ headingTree: S,
32978
+ composeMarkdown: () => g2 ? wt(p2, y) : a
32979
+ };
32952
32980
  };
32953
32981
  return {
32954
- process: async (a, c, {
32955
- signal: i,
32956
- useContentStringHeaderId: l2 = false,
32957
- useHierarchicalHeadingId: f = true,
32958
- advancedOptions: u,
32959
- frontmatterTransform: m
32960
- } = {}) => {
32961
- const {
32962
- allowDangerousHtml: y = true,
32963
- htmlOptions: w = Ht,
32964
- gfmOptions: g2 = {},
32965
- remarkPlugins: E2 = [],
32966
- rehypePlugins: v = []
32967
- } = u || {};
32982
+ process: async (a, f, u = {}) => {
32968
32983
  try {
32969
- const b2 = a, { data: x2, content: C2 } = gt(a);
32970
- let $2 = x2;
32971
- const H2 = B(x2);
32972
- let O2 = false;
32973
- if (m) {
32974
- const k2 = {
32975
- originalFrontmatter: Ct(x2),
32976
- markdownContent: C2
32977
- }, R2 = m(k2);
32978
- R2 !== void 0 && ($2 = R2, O2 = B(R2) !== H2);
32979
- }
32980
- const A = [];
32981
- let I2 = 0;
32982
- const P2 = () => `${c}-${++I2}`;
32983
- let L2 = unified().use(remarkParse);
32984
- if (E2)
32985
- for (const k2 of E2)
32986
- Array.isArray(k2) ? L2 = L2.use(k2[0], k2[1]) : L2 = L2.use(k2);
32987
- let N2 = L2.use(remarkGfm, g2).use(St).use(
32988
- p2(
32989
- A,
32990
- l2 ? (k2) => K(c, k2, P2) : P2,
32991
- f,
32992
- l2,
32993
- c
32994
- )
32995
- ).use(h($2, i, P2)).use(remarkRehype, { allowDangerousHtml: y }).use(xt).use(rehypeStringify, { allowDangerousHtml: y });
32996
- if (v)
32997
- for (const k2 of v)
32998
- Array.isArray(k2) ? N2 = N2.use(k2[0], k2[1]) : N2 = N2.use(k2);
32999
- const Z2 = await N2.process(C2), X2 = String(Z2);
33000
- return {
33001
- html: Ft(X2, w),
33002
- frontmatter: $2,
33003
- changed: O2,
33004
- headingTree: A,
33005
- composeMarkdown: () => O2 ? vt($2, C2) : b2
33006
- };
33007
- } catch (b2) {
33008
- throw r.error(
33009
- `Failed to process markdown: ${b2 instanceof Error ? b2.message : "Unknown error"}`
33010
- ), new Error(
33011
- `Failed to process markdown: ${b2 instanceof Error ? b2.message : "Unknown error"}`
32984
+ const { data: p2, content: y } = B(a);
32985
+ return await c(
32986
+ a,
32987
+ f,
32988
+ u,
32989
+ p2,
32990
+ y,
32991
+ false
32992
+ );
32993
+ } catch (p2) {
32994
+ return d2(p2);
32995
+ }
32996
+ },
32997
+ processWithFrontmatterTransform: async (a, f, u, p2 = {}) => {
32998
+ try {
32999
+ const { data: y, content: g2 } = B(a), w = A(y), k2 = u({
33000
+ originalFrontmatter: y,
33001
+ markdownContent: g2
33002
+ });
33003
+ if (k2 === void 0)
33004
+ return;
33005
+ const b2 = k2, O2 = A(k2 === y ? y : k2) !== w;
33006
+ return await c(
33007
+ a,
33008
+ f,
33009
+ p2,
33010
+ b2,
33011
+ g2,
33012
+ O2
33012
33013
  );
33014
+ } catch (y) {
33015
+ return d2(y);
33013
33016
  }
33014
33017
  }
33015
33018
  };
33016
- }, Qt = (e, t = {}) => {
33017
- const { maxRedirects: r = 5, timeoutEachRedirect: o2 = 1e4 } = t;
33019
+ }, Gt = (e, t = {}) => {
33020
+ const { maxRedirects: n = 5, timeoutEachRedirect: o2 = 1e4 } = t;
33018
33021
  return {
33019
33022
  name: "oembed",
33020
33023
  processBlock: async (s2, h) => {
33021
- const p2 = s2.trim();
33022
- if (!qd(p2))
33023
- throw new Error(`Invalid URL: ${p2}`);
33024
+ const m = s2.trim();
33025
+ if (!qd(m))
33026
+ throw new Error(`Invalid URL: ${m}`);
33024
33027
  try {
33025
33028
  const d2 = await Gd(
33026
- p2,
33027
- r,
33029
+ m,
33030
+ n,
33028
33031
  o2,
33029
33032
  h,
33030
33033
  e
33031
33034
  );
33032
- return Wd(d2, p2, t);
33035
+ return Wd(d2, m, t);
33033
33036
  } catch (d2) {
33034
- h.logger.warn("oEmbed fetch failed for URL:", p2, d2);
33035
- const a = Vd(d2);
33036
- return typeof window < "u" ? Xs(p2, a) : Xs(p2, a);
33037
+ h.logger.warn("oEmbed fetch failed for URL:", m, d2);
33038
+ const c = Vd(d2);
33039
+ return typeof window < "u" ? Xs(m, c) : Xs(m, c);
33037
33040
  }
33038
33041
  }
33039
33042
  };
33040
- }, Zt = (e = {}) => ({
33043
+ }, Qt = (e = {}) => ({
33041
33044
  name: "card",
33042
- processBlock: async (r, o2) => {
33043
- const n = r.trim();
33044
- if (!Xd(n))
33045
- throw new Error(`Invalid URL: ${n}`);
33045
+ processBlock: async (n, o2) => {
33046
+ const r = n.trim();
33047
+ if (!Xd(r))
33048
+ throw new Error(`Invalid URL: ${r}`);
33046
33049
  try {
33047
- const s2 = await Jd(n, e, o2);
33048
- return th(s2, n, e);
33050
+ const s2 = await Jd(r, e, o2);
33051
+ return th(s2, r, e);
33049
33052
  } catch (s2) {
33050
- o2.logger.warn("Card plugin fetch failed for URL:", n, s2);
33053
+ o2.logger.warn("Card plugin fetch failed for URL:", r, s2);
33051
33054
  const h = Vd(s2);
33052
- return typeof window < "u" ? eh(n, h) : eh(n, h);
33055
+ return typeof window < "u" ? eh(r, h) : eh(r, h);
33053
33056
  }
33054
33057
  }
33055
- }), Xt = (e = {}) => {
33056
- const { className: t = "mermaid", includeId: r = true } = e;
33058
+ }), Vt = (e = {}) => {
33059
+ const { className: t = "mermaid", includeId: n = true } = e;
33057
33060
  return {
33058
33061
  name: "mermaid",
33059
- processBlock: async (n, s2) => {
33060
- const h = n.trim();
33062
+ processBlock: async (r, s2) => {
33063
+ const h = r.trim();
33061
33064
  if (!h) {
33062
33065
  s2.logger.warn("Mermaid plugin received empty content");
33063
- const c = r ? ` id="${s2.getUniqueId()}"` : "";
33066
+ const l2 = n ? ` id="${s2.getUniqueId()}"` : "";
33064
33067
  return `<div class="${t}-wrapper">
33065
33068
  <style>
33066
33069
  .${t}-wrapper .${t} > svg {
@@ -33069,10 +33072,10 @@ const T = () => {
33069
33072
  max-width: none !important;
33070
33073
  }
33071
33074
  </style>
33072
- <div class="${t}"${c}><!-- Empty mermaid content --></div>
33075
+ <div class="${t}"${l2}><!-- Empty mermaid content --></div>
33073
33076
  </div>`;
33074
33077
  }
33075
- const p2 = r ? ` id="${s2.getUniqueId()}"` : "", d2 = h.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), a = `<div class="${t}-wrapper">
33078
+ const m = n ? ` id="${s2.getUniqueId()}"` : "", d2 = h.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), c = `<div class="${t}-wrapper">
33076
33079
  <style>
33077
33080
  .${t}-wrapper .${t} > svg {
33078
33081
  width: auto !important;
@@ -33080,13 +33083,13 @@ const T = () => {
33080
33083
  max-width: none !important;
33081
33084
  }
33082
33085
  </style>
33083
- <div class="${t}"${p2}>${d2}</div>
33086
+ <div class="${t}"${m}>${d2}</div>
33084
33087
  </div>`;
33085
33088
  return s2.logger.debug("Mermaid plugin processed content:", {
33086
33089
  contentLength: h.length,
33087
33090
  className: t,
33088
- includeId: r
33089
- }), a;
33091
+ includeId: n
33092
+ }), c;
33090
33093
  }
33091
33094
  };
33092
33095
  };
@@ -33103,7 +33106,7 @@ const W = () => {
33103
33106
  }, G = {
33104
33107
  release: W,
33105
33108
  [Symbol.dispose]: W
33106
- }, Nt = (e, t) => {
33109
+ }, Ot = (e, t) => {
33107
33110
  if (!e)
33108
33111
  return G;
33109
33112
  if (e.aborted) {
@@ -33114,10 +33117,10 @@ const W = () => {
33114
33117
  }
33115
33118
  return G;
33116
33119
  }
33117
- let r;
33118
- r = () => {
33119
- if (r) {
33120
- e.removeEventListener("abort", r), r = void 0;
33120
+ let n;
33121
+ n = () => {
33122
+ if (n) {
33123
+ e.removeEventListener("abort", n), n = void 0;
33121
33124
  try {
33122
33125
  t();
33123
33126
  } catch (s2) {
@@ -33126,73 +33129,73 @@ const W = () => {
33126
33129
  }
33127
33130
  };
33128
33131
  const o2 = () => {
33129
- r && (e.removeEventListener("abort", r), r = void 0);
33132
+ n && (e.removeEventListener("abort", n), n = void 0);
33130
33133
  };
33131
- return e.addEventListener("abort", r, { once: true }), {
33134
+ return e.addEventListener("abort", n, { once: true }), {
33132
33135
  release: o2,
33133
33136
  [Symbol.dispose]: o2
33134
33137
  };
33135
- }, Tt = (e) => {
33138
+ }, Lt = (e) => {
33136
33139
  typeof setImmediate == "function" ? setImmediate(e) : setTimeout(e, 0);
33137
- }, j = () => new Error("Lock acquisition was aborted"), _t = (e) => {
33140
+ }, j = () => new Error("Lock acquisition was aborted"), Nt = (e) => {
33138
33141
  let t = true;
33139
- const r = () => {
33142
+ const n = () => {
33140
33143
  t && (t = false, e());
33141
33144
  };
33142
33145
  return {
33143
33146
  get isActive() {
33144
33147
  return t;
33145
33148
  },
33146
- release: r,
33147
- [Symbol.dispose]: r
33149
+ release: n,
33150
+ [Symbol.dispose]: n
33148
33151
  };
33149
33152
  }, q = (e = 20) => {
33150
33153
  let t = false;
33151
- const r = [];
33154
+ const n = [];
33152
33155
  let o2 = 0;
33153
- const n = () => {
33154
- var c;
33155
- if (t || r.length === 0)
33156
+ const r = () => {
33157
+ var l2;
33158
+ if (t || n.length === 0)
33156
33159
  return;
33157
- const i = r.shift();
33158
- if ((c = i.signal) != null && c.aborted) {
33160
+ const i = n.shift();
33161
+ if ((l2 = i.signal) != null && l2.aborted) {
33159
33162
  i.reject(j()), s2();
33160
33163
  return;
33161
33164
  }
33162
33165
  t = true;
33163
- const l2 = _t(h);
33164
- i.resolve(l2);
33166
+ const a = Nt(h);
33167
+ i.resolve(a);
33165
33168
  }, s2 = () => {
33166
- o2++, o2 >= e ? (o2 = 0, Tt(n)) : n();
33169
+ o2++, o2 >= e ? (o2 = 0, Lt(r)) : r();
33167
33170
  }, h = () => {
33168
33171
  t && (t = false, s2());
33169
- }, p2 = (c) => {
33170
- const i = r.indexOf(c);
33171
- i !== -1 && r.splice(i, 1);
33172
- }, d2 = async (c) => {
33173
- if (c) {
33174
- if (c.aborted)
33172
+ }, m = (l2) => {
33173
+ const i = n.indexOf(l2);
33174
+ i !== -1 && n.splice(i, 1);
33175
+ }, d2 = async (l2) => {
33176
+ if (l2) {
33177
+ if (l2.aborted)
33175
33178
  throw j();
33176
- return new Promise((i, l2) => {
33179
+ return new Promise((i, a) => {
33177
33180
  const f = {
33178
33181
  resolve: void 0,
33179
33182
  reject: void 0,
33180
- signal: c
33181
- }, u = Nt(c, () => {
33182
- p2(f), l2(j());
33183
+ signal: l2
33184
+ }, u = Ot(l2, () => {
33185
+ m(f), a(j());
33183
33186
  });
33184
- f.resolve = (m) => {
33185
- u.release(), i(m);
33186
- }, f.reject = (m) => {
33187
- u.release(), l2(m);
33188
- }, r.push(f), n();
33187
+ f.resolve = (p2) => {
33188
+ u.release(), i(p2);
33189
+ }, f.reject = (p2) => {
33190
+ u.release(), a(p2);
33191
+ }, n.push(f), r();
33189
33192
  });
33190
33193
  } else
33191
- return new Promise((i, l2) => {
33192
- r.push({
33194
+ return new Promise((i, a) => {
33195
+ n.push({
33193
33196
  resolve: i,
33194
- reject: l2
33195
- }), n();
33197
+ reject: a
33198
+ }), r();
33196
33199
  });
33197
33200
  };
33198
33201
  return {
@@ -33204,57 +33207,57 @@ const W = () => {
33204
33207
  return t;
33205
33208
  },
33206
33209
  get pendingCount() {
33207
- return r.length;
33210
+ return n.length;
33208
33211
  }
33209
33212
  };
33210
- }, At = () => {
33211
- const e = /* @__PURE__ */ new Map(), t = q(), r = (d2 = Date.now()) => {
33212
- const a = [];
33213
- for (const [c, i] of e.entries())
33214
- i.ttl !== void 0 && (i.ttl === 0 || d2 > i.timestamp + i.ttl) && a.push(c);
33215
- for (const c of a)
33216
- e.delete(c);
33217
- return a;
33213
+ }, Tt = () => {
33214
+ const e = /* @__PURE__ */ new Map(), t = q(), n = (d2 = Date.now()) => {
33215
+ const c = [];
33216
+ for (const [l2, i] of e.entries())
33217
+ i.ttl !== void 0 && (i.ttl === 0 || d2 > i.timestamp + i.ttl) && c.push(l2);
33218
+ for (const l2 of c)
33219
+ e.delete(l2);
33220
+ return c;
33218
33221
  };
33219
33222
  return {
33220
33223
  get: async (d2) => {
33221
- const a = e.get(d2);
33222
- if (!a)
33224
+ const c = e.get(d2);
33225
+ if (!c)
33223
33226
  return null;
33224
- if (a.ttl !== void 0 && (a.ttl === 0 || Date.now() > a.timestamp + a.ttl)) {
33227
+ if (c.ttl !== void 0 && (c.ttl === 0 || Date.now() > c.timestamp + c.ttl)) {
33225
33228
  const i = await t.lock();
33226
33229
  try {
33227
- const l2 = e.get(d2);
33228
- if (l2 && l2.ttl !== void 0) {
33230
+ const a = e.get(d2);
33231
+ if (a && a.ttl !== void 0) {
33229
33232
  const f = Date.now();
33230
- (l2.ttl === 0 || f > l2.timestamp + l2.ttl) && e.delete(d2);
33233
+ (a.ttl === 0 || f > a.timestamp + a.ttl) && e.delete(d2);
33231
33234
  }
33232
33235
  return null;
33233
33236
  } finally {
33234
33237
  i.release();
33235
33238
  }
33236
33239
  }
33237
- return a.data;
33240
+ return c.data;
33238
33241
  },
33239
- set: async (d2, a, c) => {
33242
+ set: async (d2, c, l2) => {
33240
33243
  const i = {
33241
- data: a,
33244
+ data: c,
33242
33245
  timestamp: Date.now()
33243
33246
  };
33244
- c !== void 0 && (i.ttl = c);
33245
- const l2 = await t.lock();
33247
+ l2 !== void 0 && (i.ttl = l2);
33248
+ const a = await t.lock();
33246
33249
  try {
33247
33250
  e.set(d2, i);
33248
33251
  } finally {
33249
- l2.release();
33252
+ a.release();
33250
33253
  }
33251
33254
  },
33252
33255
  delete: async (d2) => {
33253
- const a = await t.lock();
33256
+ const c = await t.lock();
33254
33257
  try {
33255
33258
  e.delete(d2);
33256
33259
  } finally {
33257
- a.release();
33260
+ c.release();
33258
33261
  }
33259
33262
  },
33260
33263
  clear: async () => {
@@ -33268,36 +33271,36 @@ const W = () => {
33268
33271
  size: async () => {
33269
33272
  if (Array.from(e.entries()).length === 0)
33270
33273
  return 0;
33271
- const a = await t.lock();
33274
+ const c = await t.lock();
33272
33275
  try {
33273
- return r(), e.size;
33276
+ return n(), e.size;
33274
33277
  } finally {
33275
- a.release();
33278
+ c.release();
33276
33279
  }
33277
33280
  }
33278
33281
  };
33279
33282
  };
33280
- function D(e, t, r) {
33281
- return `fetch:${e}:${t}:${r}`;
33283
+ function D(e, t, n) {
33284
+ return `fetch:${e}:${t}:${n}`;
33282
33285
  }
33283
- const ee = (e, t = 6e4, r, o2) => {
33286
+ const Yt = (e, t = 6e4, n, o2) => {
33284
33287
  const {
33285
- cache: n = true,
33288
+ cache: r = true,
33286
33289
  cacheTTL: s2 = 3600 * 1e3,
33287
33290
  // 1 hour default
33288
33291
  cacheFailures: h = true,
33289
- failureCacheTTL: p2 = 300 * 1e3
33292
+ failureCacheTTL: m = 300 * 1e3
33290
33293
  // 5 minutes default for failures
33291
- } = {}, d2 = n ? r || At() : void 0;
33294
+ } = {}, d2 = r ? n || Tt() : void 0;
33292
33295
  return {
33293
- rawFetcher: async (c, i, l2, f) => {
33294
- if (n && d2) {
33295
- const y = D(c, i, e), w = await d2.get(y);
33296
- if (w)
33296
+ rawFetcher: async (l2, i, a, f) => {
33297
+ if (r && d2) {
33298
+ const y = D(l2, i, e), g2 = await d2.get(y);
33299
+ if (g2)
33297
33300
  try {
33298
- const g2 = JSON.parse(w);
33299
- if (g2.type === "success")
33300
- return f?.info(`Cache HIT (success) for URL: ${c}`), new Response(g2.data, {
33301
+ const w = JSON.parse(g2);
33302
+ if (w.type === "success")
33303
+ return f?.info(`Cache HIT (success) for URL: ${l2}`), new Response(w.data, {
33301
33304
  status: 200,
33302
33305
  statusText: "OK",
33303
33306
  headers: {
@@ -33305,73 +33308,73 @@ const ee = (e, t = 6e4, r, o2) => {
33305
33308
  "X-Cache": "HIT"
33306
33309
  }
33307
33310
  });
33308
- if (g2.type === "error" && h)
33309
- throw f?.info(`Cache HIT (error) for URL: ${c}`), new Error("Cached error");
33311
+ if (w.type === "error" && h)
33312
+ throw f?.info(`Cache HIT (error) for URL: ${l2}`), new Error("Cached error");
33310
33313
  f?.debug(
33311
- `Cache entry type ${g2.type} not eligible for use, cacheFailures: ${h}`
33314
+ `Cache entry type ${w.type} not eligible for use, cacheFailures: ${h}`
33312
33315
  );
33313
- } catch (g2) {
33316
+ } catch (w) {
33314
33317
  if (f?.warn(
33315
- `Failed to parse cached entry for URL ${c}:`,
33316
- g2
33317
- ), g2 instanceof SyntaxError)
33318
+ `Failed to parse cached entry for URL ${l2}:`,
33319
+ w
33320
+ ), w instanceof SyntaxError)
33318
33321
  f?.debug("JSON parse error, continuing to network fetch");
33319
33322
  else
33320
- throw g2;
33323
+ throw w;
33321
33324
  }
33322
33325
  else
33323
- f?.info(`Cache MISS for URL: ${c}`);
33326
+ f?.info(`Cache MISS for URL: ${l2}`);
33324
33327
  }
33325
- let u, m = null;
33328
+ let u, p2 = null;
33326
33329
  try {
33327
33330
  u = await Yd(
33328
- c,
33331
+ l2,
33329
33332
  i,
33330
33333
  e,
33331
33334
  t,
33332
- l2,
33335
+ a,
33333
33336
  f
33334
33337
  );
33335
33338
  } catch (y) {
33336
- if (m = y, n && d2 && h)
33339
+ if (p2 = y, r && d2 && h)
33337
33340
  try {
33338
- const w = D(c, i, e), g2 = {
33341
+ const g2 = D(l2, i, e), w = {
33339
33342
  type: "error",
33340
33343
  data: "",
33341
33344
  error: {
33342
- message: m.message,
33343
- ...m.message.includes("HTTP error, status:") && {
33345
+ message: p2.message,
33346
+ ...p2.message.includes("HTTP error, status:") && {
33344
33347
  status: parseInt(
33345
- m.message.match(/status: (\d+)/)?.[1] || "0"
33348
+ p2.message.match(/status: (\d+)/)?.[1] || "0"
33346
33349
  )
33347
33350
  }
33348
33351
  },
33349
33352
  timestamp: Date.now()
33350
33353
  };
33351
33354
  await d2.set(
33352
- w,
33353
- JSON.stringify(g2),
33354
- p2
33355
- ), f?.debug(`Cached error for URL: ${c}`);
33356
- } catch (w) {
33357
- f?.warn(`Failed to cache error for URL ${c}:`, w), console.warn("Failed to cache error:", w);
33355
+ g2,
33356
+ JSON.stringify(w),
33357
+ m
33358
+ ), f?.debug(`Cached error for URL: ${l2}`);
33359
+ } catch (g2) {
33360
+ f?.warn(`Failed to cache error for URL ${l2}:`, g2), console.warn("Failed to cache error:", g2);
33358
33361
  }
33359
- throw m;
33362
+ throw p2;
33360
33363
  }
33361
- if (n && d2 && u.ok)
33364
+ if (r && d2 && u.ok)
33362
33365
  try {
33363
- const y = await u.clone().text(), w = D(c, i, e), g2 = {
33366
+ const y = await u.clone().text(), g2 = D(l2, i, e), w = {
33364
33367
  type: "success",
33365
33368
  data: y,
33366
33369
  timestamp: Date.now()
33367
33370
  };
33368
33371
  await d2.set(
33369
- w,
33370
- JSON.stringify(g2),
33372
+ g2,
33373
+ JSON.stringify(w),
33371
33374
  s2
33372
- ), f?.debug(`Cached successful response for URL: ${c}`);
33375
+ ), f?.debug(`Cached successful response for URL: ${l2}`);
33373
33376
  } catch (y) {
33374
- f?.warn(`Failed to cache response for URL ${c}:`, y), console.warn("Failed to cache response:", y);
33377
+ f?.warn(`Failed to cache response for URL ${l2}:`, y), console.warn("Failed to cache response:", y);
33375
33378
  }
33376
33379
  return u;
33377
33380
  },
@@ -33380,23 +33383,23 @@ const ee = (e, t = 6e4, r, o2) => {
33380
33383
  };
33381
33384
  function setupProcessor(config) {
33382
33385
  const plugins = [];
33383
- const logger = Gt();
33384
- const fetcher = ee(
33386
+ const logger = Kt();
33387
+ const fetcher = Yt(
33385
33388
  "mark-deco-cli/0.0.1",
33386
33389
  5e3,
33387
- At()
33390
+ Tt()
33388
33391
  );
33389
33392
  const enabledPlugins = config.noPlugins ? [] : Array.isArray(config.plugins) ? config.plugins : ["oembed", "card", "mermaid"];
33390
33393
  if (enabledPlugins.includes("oembed") && config.oembed?.enabled !== false) {
33391
- plugins.push(Qt($d, {}));
33394
+ plugins.push(Gt($d, {}));
33392
33395
  }
33393
33396
  if (enabledPlugins.includes("card") && config.card?.enabled !== false) {
33394
- plugins.push(Zt({}));
33397
+ plugins.push(Qt({}));
33395
33398
  }
33396
33399
  if (enabledPlugins.includes("mermaid") && config.mermaid?.enabled !== false) {
33397
- plugins.push(Xt({}));
33400
+ plugins.push(Vt({}));
33398
33401
  }
33399
- return Vt({
33402
+ return Wt({
33400
33403
  plugins,
33401
33404
  logger,
33402
33405
  fetcher