@innovastudio/contentbuilder-interactive-runtime 1.0.8 → 1.0.9

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.
@@ -35,17 +35,17 @@ function qt(c, e = null, t = null) {
35
35
  function oe(c, { onElement: e, withCallback: t, avoidDuplicate: i = !0, once: n = !1, useCapture: s = !1 } = {}, r) {
36
36
  let o = e || [];
37
37
  Ne(o) && (o = document.querySelectorAll(o));
38
- function a(u) {
39
- G(t) && t.call(r, u, this), n && a.destroy();
38
+ function a(d) {
39
+ G(t) && t.call(r, d, this), n && a.destroy();
40
40
  }
41
41
  return a.destroy = function() {
42
- X(o, (u) => {
43
- const d = qt(u, c, a);
44
- d.found && d.all.splice(d.evt, 1), u.removeEventListener && u.removeEventListener(c, a, s);
42
+ X(o, (d) => {
43
+ const u = qt(d, c, a);
44
+ u.found && u.all.splice(u.evt, 1), d.removeEventListener && d.removeEventListener(c, a, s);
45
45
  });
46
- }, X(o, (u) => {
47
- const d = qt(u, c, a);
48
- (u.addEventListener && i && !d.found || !i) && (u.addEventListener(c, a, s), d.all.push({ eventName: c, fn: a }));
46
+ }, X(o, (d) => {
47
+ const u = qt(d, c, a);
48
+ (d.addEventListener && i && !u.found || !i) && (d.addEventListener(c, a, s), u.all.push({ eventName: c, fn: a }));
49
49
  }), a;
50
50
  }
51
51
  function H(c, e) {
@@ -365,8 +365,8 @@ class Mi {
365
365
  } else {
366
366
  if (this.x2 !== null) {
367
367
  e.deltaX = n - this.x2, e.deltaY = s - this.y2;
368
- var u = Math.abs(this.x1 - this.x2), d = Math.abs(this.y1 - this.y2);
369
- (u > 10 || d > 10) && (this._preventTap = !0);
368
+ var d = Math.abs(this.x1 - this.x2), u = Math.abs(this.y1 - this.y2);
369
+ (d > 10 || u > 10) && (this._preventTap = !0);
370
370
  } else
371
371
  e.deltaX = 0, e.deltaY = 0;
372
372
  this.pressMove.dispatch(e, this.element);
@@ -426,7 +426,7 @@ function lt(c) {
426
426
  function Ai(c) {
427
427
  if (c.events.hasOwnProperty("touch"))
428
428
  return !1;
429
- let e = ti(), t = e.width, i = e.height, n = !1, s = null, r = null, o = null, a = !1, u = 1, d = 4.5, l = 1, h = !1, p = !1, b = null, w = null, _ = null, g = null, v, f, m = 0, y = 0, k = !1, x = !1, S = {}, E = {}, C = 0, A = 0, L;
429
+ let e = ti(), t = e.width, i = e.height, n = !1, s = null, r = null, o = null, a = !1, d = 1, u = 4.5, l = 1, h = !1, p = !1, b = null, w = null, _ = null, g = null, v, f, m = 0, y = 0, k = !1, x = !1, S = {}, E = {}, C = 0, A = 0, L;
430
430
  const D = document.getElementById("glightbox-slider"), I = document.querySelector(".goverlay"), O = new Mi(D, {
431
431
  touchStart: (R) => {
432
432
  if (n = !0, (te(R.targetTouches[0].target, "ginner-container") || ue(R.targetTouches[0].target, ".gslide-desc") || R.targetTouches[0].target.nodeName.toLowerCase() == "a") && (n = !1), ue(R.targetTouches[0].target, ".gslide-inline") && !te(R.targetTouches[0].target.parentNode, "gslide-inline") && (n = !1), n) {
@@ -472,18 +472,18 @@ function Ai(c) {
472
472
  }, 50);
473
473
  },
474
474
  multipointStart: () => {
475
- h = !0, u = l || 1;
475
+ h = !0, d = l || 1;
476
476
  },
477
477
  pinch: (R) => {
478
478
  if (!o || a)
479
479
  return !1;
480
- h = !0, o.scaleX = o.scaleY = u * R.zoom;
481
- let q = u * R.zoom;
480
+ h = !0, o.scaleX = o.scaleY = d * R.zoom;
481
+ let q = d * R.zoom;
482
482
  if (p = !0, q <= 1) {
483
483
  p = !1, q = 1, g = null, _ = null, b = null, w = null, o.setAttribute("style", "");
484
484
  return;
485
485
  }
486
- q > d && (q = d), o.style.transform = `scale3d(${q}, ${q}, 1)`, l = q;
486
+ q > u && (q = u), o.style.transform = `scale3d(${q}, ${q}, 1)`, l = q;
487
487
  },
488
488
  pressMove: (R) => {
489
489
  if (p && !h) {
@@ -643,15 +643,15 @@ function Ii(c, e, t, i) {
643
643
  H(n, "gvideo-container"), r.insertBefore(_e('<div class="gvideo-wrapper"></div>'), r.firstChild);
644
644
  const a = c.querySelector(".gvideo-wrapper");
645
645
  It(this.settings.plyr.css, "Plyr");
646
- let u = e.href, d = e?.videoProvider, l = !1;
646
+ let d = e.href, u = e?.videoProvider, l = !1;
647
647
  r.style.maxWidth = e.width, It(this.settings.plyr.js, "Plyr", () => {
648
- if (!d && u.match(/vimeo\.com\/([0-9]*)/) && (d = "vimeo"), !d && (u.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || u.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || u.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)) && (d = "youtube"), d === "local" || !d) {
649
- d = "local";
648
+ if (!u && d.match(/vimeo\.com\/([0-9]*)/) && (u = "vimeo"), !u && (d.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || d.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || d.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)) && (u = "youtube"), u === "local" || !u) {
649
+ u = "local";
650
650
  let w = '<video id="' + s + '" ';
651
- w += `style="background:#000; max-width: ${e.width};" `, w += 'preload="metadata" ', w += 'x-webkit-airplay="allow" ', w += "playsinline ", w += "controls ", w += 'class="gvideo-local">', w += `<source src="${u}">`, w += "</video>", l = _e(w);
651
+ w += `style="background:#000; max-width: ${e.width};" `, w += 'preload="metadata" ', w += 'x-webkit-airplay="allow" ', w += "playsinline ", w += "controls ", w += 'class="gvideo-local">', w += `<source src="${d}">`, w += "</video>", l = _e(w);
652
652
  }
653
- const h = l || _e(`<div id="${s}" data-plyr-provider="${d}" data-plyr-embed-id="${u}"></div>`);
654
- H(a, `${d}-video gvideo`), a.appendChild(h), a.setAttribute("data-id", s), a.setAttribute("data-index", t);
653
+ const h = l || _e(`<div id="${s}" data-plyr-provider="${u}" data-plyr-embed-id="${d}"></div>`);
654
+ H(a, `${u}-video gvideo`), a.appendChild(h), a.setAttribute("data-id", s), a.setAttribute("data-index", t);
655
655
  const p = Z(this.settings.plyr, "config") ? this.settings.plyr.config : {}, b = new Plyr("#" + s, p);
656
656
  b.on("ready", (w) => {
657
657
  o[s] = w.detail.plyr, G(i) && i();
@@ -679,8 +679,8 @@ function Oi(c, e, t, i) {
679
679
  let a = document.getElementById(s);
680
680
  if (!a)
681
681
  return !1;
682
- const u = a.cloneNode(!0);
683
- u.style.height = e.height, u.style.maxWidth = e.width, H(u, "ginlined-content"), o = u;
682
+ const d = a.cloneNode(!0);
683
+ d.style.height = e.height, d.style.maxWidth = e.width, H(d, "ginlined-content"), o = d;
684
684
  }
685
685
  if (!o)
686
686
  return console.error("Unable to append inline slide content", e), !1;
@@ -738,8 +738,8 @@ class Ni {
738
738
  let n = "", s = e.getAttribute("data-glightbox"), r = e.nodeName.toLowerCase();
739
739
  if (r === "a" && (n = e.href), r === "img" && (n = e.src, i.alt = e.alt), i.href = n, X(i, (o, a) => {
740
740
  Z(t, a) && a !== "width" && (i[a] = t[a]);
741
- const u = e.dataset[a];
742
- re(u) || (i[a] = this.sanitizeValue(u));
741
+ const d = e.dataset[a];
742
+ re(d) || (i[a] = this.sanitizeValue(d));
743
743
  }), i.content && (i.type = "inline"), !i.type && n && (i.type = this.sourceType(n)), re(s)) {
744
744
  if (!i.title && r == "a") {
745
745
  let o = e.title;
@@ -751,13 +751,13 @@ class Ni {
751
751
  }
752
752
  } else {
753
753
  let o = [];
754
- X(i, (a, u) => {
755
- o.push(";\\s?" + u);
756
- }), o = o.join("\\s?:|"), s.trim() !== "" && X(i, (a, u) => {
757
- const d = s, l = "s?" + u + "s?:s?(.*?)(" + o + "s?:|$)", h = new RegExp(l), p = d.match(h);
754
+ X(i, (a, d) => {
755
+ o.push(";\\s?" + d);
756
+ }), o = o.join("\\s?:|"), s.trim() !== "" && X(i, (a, d) => {
757
+ const u = s, l = "s?" + d + "s?:s?(.*?)(" + o + "s?:|$)", h = new RegExp(l), p = u.match(h);
758
758
  if (p && p.length && p[1]) {
759
759
  const b = p[1].trim().replace(/;\s*$/, "");
760
- i[u] = this.sanitizeValue(b);
760
+ i[d] = this.sanitizeValue(b);
761
761
  }
762
762
  });
763
763
  }
@@ -830,14 +830,14 @@ class ze {
830
830
  slide: e,
831
831
  player: !1
832
832
  });
833
- let r = n.type, o = n.descPosition, a = e.querySelector(".gslide-media"), u = e.querySelector(".gslide-title"), d = e.querySelector(".gslide-desc"), l = e.querySelector(".gdesc-inner"), h = t, p = "gSlideTitle_" + this.index, b = "gSlideDesc_" + this.index;
833
+ let r = n.type, o = n.descPosition, a = e.querySelector(".gslide-media"), d = e.querySelector(".gslide-title"), u = e.querySelector(".gslide-desc"), l = e.querySelector(".gdesc-inner"), h = t, p = "gSlideTitle_" + this.index, b = "gSlideDesc_" + this.index;
834
834
  if (G(i.afterSlideLoad) && (h = () => {
835
835
  G(t) && t(), i.afterSlideLoad({
836
836
  index: this.index,
837
837
  slide: e,
838
838
  player: this.instance.getSlidePlayerInstance(this.index)
839
839
  });
840
- }), n.title == "" && n.description == "" ? l && l.parentNode.parentNode.removeChild(l.parentNode) : (u && n.title !== "" ? (u.id = p, u.innerHTML = n.title) : u.parentNode.removeChild(u), d && n.description !== "" ? (d.id = b, s && i.moreLength > 0 ? (n.smallDescription = this.slideShortDesc(n.description, i.moreLength, i.moreText), d.innerHTML = n.smallDescription, this.descriptionEvents(d, n)) : d.innerHTML = n.description) : d.parentNode.removeChild(d), H(a.parentNode, `desc-${o}`), H(l.parentNode, `description-${o}`)), H(a, `gslide-${r}`), H(e, "loaded"), r === "video") {
840
+ }), n.title == "" && n.description == "" ? l && l.parentNode.parentNode.removeChild(l.parentNode) : (d && n.title !== "" ? (d.id = p, d.innerHTML = n.title) : d.parentNode.removeChild(d), u && n.description !== "" ? (u.id = b, s && i.moreLength > 0 ? (n.smallDescription = this.slideShortDesc(n.description, i.moreLength, i.moreText), u.innerHTML = n.smallDescription, this.descriptionEvents(u, n)) : u.innerHTML = n.description) : u.parentNode.removeChild(u), H(a.parentNode, `desc-${o}`), H(l.parentNode, `description-${o}`)), H(a, `gslide-${r}`), H(e, "loaded"), r === "video") {
841
841
  Ii.apply(this.instance, [e, n, this.index, h]);
842
842
  return;
843
843
  }
@@ -896,8 +896,8 @@ class ze {
896
896
  o.innerHTML = t.description, H(r, "gdesc-open");
897
897
  let a = oe("click", {
898
898
  onElement: [r, ue(o, ".gslide-description")],
899
- withCallback: (u, d) => {
900
- u.target.nodeName.toLowerCase() !== "a" && (J(r, "gdesc-open"), H(r, "gdesc-closed"), o.innerHTML = t.smallDescription, this.descriptionEvents(o, t), setTimeout(() => {
899
+ withCallback: (d, u) => {
900
+ d.target.nodeName.toLowerCase() !== "a" && (J(r, "gdesc-open"), H(r, "gdesc-closed"), o.innerHTML = t.smallDescription, this.descriptionEvents(o, t), setTimeout(() => {
901
901
  J(r, "gdesc-closed");
902
902
  }, 400), a.destroy());
903
903
  }
@@ -1161,15 +1161,15 @@ class Ut {
1161
1161
  t < 0 && (t = this.elements.length);
1162
1162
  const i = new ze(e, this, t), n = i.getConfig(), s = fe({}, n), r = i.create(), o = this.elements.length - 1;
1163
1163
  s.index = t, s.node = !1, s.instance = i, s.slideConfig = n, this.elements.splice(t, 0, s);
1164
- let a = null, u = null;
1164
+ let a = null, d = null;
1165
1165
  if (this.slidesContainer) {
1166
1166
  if (t > o)
1167
1167
  this.slidesContainer.appendChild(r);
1168
1168
  else {
1169
- let d = this.slidesContainer.querySelectorAll(".gslide")[t];
1170
- this.slidesContainer.insertBefore(r, d);
1169
+ let u = this.slidesContainer.querySelectorAll(".gslide")[t];
1170
+ this.slidesContainer.insertBefore(r, u);
1171
1171
  }
1172
- (this.settings.preload && this.index == 0 && t == 0 || this.index - 1 == t || this.index + 1 == t) && this.preloadSlide(t), this.index === 0 && t === 0 && (this.index = 1), this.updateNavigationClasses(), a = this.slidesContainer.querySelectorAll(".gslide")[t], u = this.getSlidePlayerInstance(t), s.slideNode = a;
1172
+ (this.settings.preload && this.index == 0 && t == 0 || this.index - 1 == t || this.index + 1 == t) && this.preloadSlide(t), this.index === 0 && t === 0 && (this.index = 1), this.updateNavigationClasses(), a = this.slidesContainer.querySelectorAll(".gslide")[t], d = this.getSlidePlayerInstance(t), s.slideNode = a;
1173
1173
  }
1174
1174
  this.trigger("slide_inserted", {
1175
1175
  index: t,
@@ -1178,11 +1178,11 @@ class Ut {
1178
1178
  slideConfig: n,
1179
1179
  slideIndex: t,
1180
1180
  trigger: null,
1181
- player: u
1181
+ player: d
1182
1182
  }), G(this.settings.slideInserted) && this.settings.slideInserted({
1183
1183
  index: t,
1184
1184
  slide: a,
1185
- player: u
1185
+ player: d
1186
1186
  });
1187
1187
  }
1188
1188
  /**
@@ -1473,8 +1473,8 @@ class Ut {
1473
1473
  if (this.built)
1474
1474
  return !1;
1475
1475
  const e = document.body.childNodes, t = [];
1476
- X(e, (u) => {
1477
- u.parentNode == document.body && u.nodeName.charAt(0) !== "#" && u.hasAttribute && !u.hasAttribute("aria-hidden") && (t.push(u), u.setAttribute("aria-hidden", "true"));
1476
+ X(e, (d) => {
1477
+ d.parentNode == document.body && d.nodeName.charAt(0) !== "#" && d.hasAttribute && !d.hasAttribute("aria-hidden") && (t.push(d), d.setAttribute("aria-hidden", "true"));
1478
1478
  });
1479
1479
  const i = Z(this.settings.svg, "next") ? this.settings.svg.next : "", n = Z(this.settings.svg, "prev") ? this.settings.svg.prev : "", s = Z(this.settings.svg, "close") ? this.settings.svg.close : "";
1480
1480
  let r = this.settings.lightboxHTML;
@@ -1484,26 +1484,26 @@ class Ut {
1484
1484
  let a = o.querySelector(".gclose");
1485
1485
  this.prevButton = o.querySelector(".gprev"), this.nextButton = o.querySelector(".gnext"), this.overlay = o.querySelector(".goverlay"), this.loader = o.querySelector(".gloader"), this.slidesContainer = document.getElementById("glightbox-slider"), this.bodyHiddenChildElms = t, this.events = {}, H(this.modal, "glightbox-" + this.settings.skin), this.settings.closeButton && a && (this.events.close = oe("click", {
1486
1486
  onElement: a,
1487
- withCallback: (u, d) => {
1488
- u.preventDefault(), this.close();
1487
+ withCallback: (d, u) => {
1488
+ d.preventDefault(), this.close();
1489
1489
  }
1490
1490
  })), a && !this.settings.closeButton && a.parentNode.removeChild(a), this.nextButton && (this.events.next = oe("click", {
1491
1491
  onElement: this.nextButton,
1492
- withCallback: (u, d) => {
1493
- u.preventDefault(), this.nextSlide();
1492
+ withCallback: (d, u) => {
1493
+ d.preventDefault(), this.nextSlide();
1494
1494
  }
1495
1495
  })), this.prevButton && (this.events.prev = oe("click", {
1496
1496
  onElement: this.prevButton,
1497
- withCallback: (u, d) => {
1498
- u.preventDefault(), this.prevSlide();
1497
+ withCallback: (d, u) => {
1498
+ d.preventDefault(), this.prevSlide();
1499
1499
  }
1500
1500
  })), this.settings.closeOnOutsideClick && (this.events.outClose = oe("click", {
1501
1501
  onElement: o,
1502
- withCallback: (u, d) => {
1503
- !this.preventOutsideClick && !te(document.body, "glightbox-mobile") && !ue(u.target, ".ginner-container") && !ue(u.target, ".gbtn") && !te(u.target, "gnext") && !te(u.target, "gprev") && this.close();
1502
+ withCallback: (d, u) => {
1503
+ !this.preventOutsideClick && !te(document.body, "glightbox-mobile") && !ue(d.target, ".ginner-container") && !ue(d.target, ".gbtn") && !te(d.target, "gnext") && !te(d.target, "gprev") && this.close();
1504
1504
  }
1505
- })), X(this.elements, (u, d) => {
1506
- this.slidesContainer.appendChild(u.instance.create()), u.slideNode = this.slidesContainer.querySelectorAll(".gslide")[d];
1505
+ })), X(this.elements, (d, u) => {
1506
+ this.slidesContainer.appendChild(d.instance.create()), d.slideNode = this.slidesContainer.querySelectorAll(".gslide")[u];
1507
1507
  }), zt && H(document.body, "glightbox-touch"), this.events.resize = oe("resize", {
1508
1508
  onElement: window,
1509
1509
  withCallback: () => {
@@ -1531,20 +1531,20 @@ class Ut {
1531
1531
  if (r <= 768)
1532
1532
  n.querySelector("img");
1533
1533
  else if (a) {
1534
- let u = s.offsetHeight, d = n.querySelector("img");
1534
+ let d = s.offsetHeight, u = n.querySelector("img");
1535
1535
  const h = this.elements[this.index].node.getAttribute("data-height") ?? "100vh";
1536
- d.setAttribute("style", `max-height: calc(${h} - ${u}px)`), s.setAttribute("style", `max-width: ${d.offsetWidth}px;`);
1536
+ u.setAttribute("style", `max-height: calc(${h} - ${d}px)`), s.setAttribute("style", `max-width: ${u.offsetWidth}px;`);
1537
1537
  }
1538
1538
  }
1539
1539
  if (i) {
1540
- let u = Z(this.settings.plyr.config, "ratio") ? this.settings.plyr.config.ratio : "";
1541
- if (!u) {
1540
+ let d = Z(this.settings.plyr.config, "ratio") ? this.settings.plyr.config.ratio : "";
1541
+ if (!d) {
1542
1542
  const b = i.clientWidth, w = i.clientHeight, _ = b / w;
1543
- u = `${b / _}:${w / _}`;
1543
+ d = `${b / _}:${w / _}`;
1544
1544
  }
1545
- let d = u.split(":"), l = this.settings.videosWidth, h = this.settings.videosWidth;
1545
+ let u = d.split(":"), l = this.settings.videosWidth, h = this.settings.videosWidth;
1546
1546
  Ge(l) || l.indexOf("px") !== -1 ? h = parseInt(l) : l.indexOf("vw") !== -1 ? h = r * parseInt(l) / 100 : l.indexOf("vh") !== -1 ? h = o * parseInt(l) / 100 : l.indexOf("%") !== -1 ? h = r * parseInt(l) / 100 : h = parseInt(i.clientWidth);
1547
- let p = h / (parseInt(d[0]) / parseInt(d[1]));
1547
+ let p = h / (parseInt(u[0]) / parseInt(u[1]));
1548
1548
  if (p = Math.floor(p), a && (o = o - s.offsetHeight), h > r || p > o || o < p && r > h) {
1549
1549
  let b = i.offsetWidth, w = i.offsetHeight, _ = o / w, g = { width: b * _ };
1550
1550
  i.parentNode.setAttribute("style", `max-width: ${g.width}px`), a && s.setAttribute("style", `max-width: ${g.width}px;`);
@@ -2276,10 +2276,10 @@ function Ki(c, e, t) {
2276
2276
  *
2277
2277
  * @param {String} move
2278
2278
  */
2279
- make: function(u) {
2280
- var d = this;
2281
- c.disabled || (!c.settings.waitForTransition || c.disable(), this.move = u, t.emit("run.before", this.move), this.calculate(), t.emit("run", this.move), e.Transition.after(function() {
2282
- d.isStart() && t.emit("run.start", d.move), d.isEnd() && t.emit("run.end", d.move), d.isOffset() && (d._o = !1, t.emit("run.offset", d.move)), t.emit("run.after", d.move), c.enable();
2279
+ make: function(d) {
2280
+ var u = this;
2281
+ c.disabled || (!c.settings.waitForTransition || c.disable(), this.move = d, t.emit("run.before", this.move), this.calculate(), t.emit("run", this.move), e.Transition.after(function() {
2282
+ u.isStart() && t.emit("run.start", u.move), u.isEnd() && t.emit("run.end", u.move), u.isOffset() && (u._o = !1, t.emit("run.offset", u.move)), t.emit("run.after", u.move), c.enable();
2283
2283
  }));
2284
2284
  },
2285
2285
  /**
@@ -2288,17 +2288,17 @@ function Ki(c, e, t) {
2288
2288
  * @return {Number|Undefined}
2289
2289
  */
2290
2290
  calculate: function() {
2291
- var u = this.move, d = this.length, l = u.steps, h = u.direction, p = 1;
2291
+ var d = this.move, u = this.length, l = d.steps, h = d.direction, p = 1;
2292
2292
  if (h === "=") {
2293
- if (c.settings.bound && Q(l) > d) {
2294
- c.index = d;
2293
+ if (c.settings.bound && Q(l) > u) {
2294
+ c.index = u;
2295
2295
  return;
2296
2296
  }
2297
2297
  c.index = l;
2298
2298
  return;
2299
2299
  }
2300
2300
  if (h === ">" && l === ">") {
2301
- c.index = d;
2301
+ c.index = u;
2302
2302
  return;
2303
2303
  }
2304
2304
  if (h === "<" && l === "<") {
@@ -2307,7 +2307,7 @@ function Ki(c, e, t) {
2307
2307
  }
2308
2308
  if (h === "|" && (p = c.settings.perView || 1), h === ">" || h === "|" && l === ">") {
2309
2309
  var b = n(p);
2310
- b > d && (this._o = !0), c.index = s(b, p);
2310
+ b > u && (this._o = !0), c.index = s(b, p);
2311
2311
  return;
2312
2312
  }
2313
2313
  if (h === "<" || h === "|" && l === "<") {
@@ -2340,8 +2340,8 @@ function Ki(c, e, t) {
2340
2340
  * @return {Boolean}
2341
2341
  */
2342
2342
  isOffset: function() {
2343
- var u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
2344
- return u ? this._o ? u === "|>" ? this.move.direction === "|" && this.move.steps === ">" : u === "|<" ? this.move.direction === "|" && this.move.steps === "<" : this.move.direction === u : !1 : this._o;
2343
+ var d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
2344
+ return d ? this._o ? d === "|>" ? this.move.direction === "|" && this.move.steps === ">" : d === "|<" ? this.move.direction === "|" && this.move.steps === "<" : this.move.direction === d : !1 : this._o;
2345
2345
  },
2346
2346
  /**
2347
2347
  * Checks if bound mode is active
@@ -2353,23 +2353,23 @@ function Ki(c, e, t) {
2353
2353
  }
2354
2354
  };
2355
2355
  function n(a) {
2356
- var u = c.index;
2357
- return c.isType("carousel") ? u + a : u + (a - u % a);
2356
+ var d = c.index;
2357
+ return c.isType("carousel") ? d + a : d + (a - d % a);
2358
2358
  }
2359
- function s(a, u) {
2360
- var d = i.length;
2361
- return a <= d ? a : c.isType("carousel") ? a - (d + 1) : c.settings.rewind ? i.isBound() && !i.isEnd() ? d : 0 : i.isBound() ? d : Math.floor(d / u) * u;
2359
+ function s(a, d) {
2360
+ var u = i.length;
2361
+ return a <= u ? a : c.isType("carousel") ? a - (u + 1) : c.settings.rewind ? i.isBound() && !i.isEnd() ? u : 0 : i.isBound() ? u : Math.floor(u / d) * d;
2362
2362
  }
2363
2363
  function r(a) {
2364
- var u = c.index;
2364
+ var d = c.index;
2365
2365
  if (c.isType("carousel"))
2366
- return u - a;
2367
- var d = Math.ceil(u / a);
2368
- return (d - 1) * a;
2366
+ return d - a;
2367
+ var u = Math.ceil(d / a);
2368
+ return (u - 1) * a;
2369
2369
  }
2370
- function o(a, u) {
2371
- var d = i.length;
2372
- return a >= 0 ? a : c.isType("carousel") ? a + (d + 1) : c.settings.rewind ? i.isBound() && i.isStart() ? d : Math.floor(d / u) * u : 0;
2370
+ function o(a, d) {
2371
+ var u = i.length;
2372
+ return a >= 0 ? a : c.isType("carousel") ? a + (u + 1) : c.settings.rewind ? i.isBound() && i.isStart() ? u : Math.floor(u / d) * d : 0;
2373
2373
  }
2374
2374
  return W(i, "move", {
2375
2375
  /**
@@ -2385,11 +2385,11 @@ function Ki(c, e, t) {
2385
2385
  *
2386
2386
  * @returns {Object}
2387
2387
  */
2388
- set: function(u) {
2389
- var d = u.substr(1);
2388
+ set: function(d) {
2389
+ var u = d.substr(1);
2390
2390
  this._m = {
2391
- direction: u.substr(0, 1),
2392
- steps: d ? Q(d) ? Q(d) : d : 0
2391
+ direction: d.substr(0, 1),
2392
+ steps: u ? Q(u) ? Q(u) : u : 0
2393
2393
  };
2394
2394
  }
2395
2395
  }), W(i, "length", {
@@ -2400,8 +2400,8 @@ function Ki(c, e, t) {
2400
2400
  * @return {Number}
2401
2401
  */
2402
2402
  get: function() {
2403
- var u = c.settings, d = e.Html.slides.length;
2404
- return this.isBound() ? d - 1 - (Q(u.perView) - 1) + Q(u.focusAt) : d - 1;
2403
+ var d = c.settings, u = e.Html.slides.length;
2404
+ return this.isBound() ? u - 1 - (Q(d.perView) - 1) + Q(d.focusAt) : u - 1;
2405
2405
  }
2406
2406
  }), W(i, "offset", {
2407
2407
  /**
@@ -2420,15 +2420,15 @@ function Ft() {
2420
2420
  function it(c, e) {
2421
2421
  var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, n, s, r, o = 0, a = function() {
2422
2422
  o = t.leading === !1 ? 0 : Ft(), i = null, r = c.apply(n, s), i || (n = s = null);
2423
- }, u = function() {
2423
+ }, d = function() {
2424
2424
  var l = Ft();
2425
2425
  !o && t.leading === !1 && (o = l);
2426
2426
  var h = e - (l - o);
2427
2427
  return n = this, s = arguments, h <= 0 || h > e ? (i && (clearTimeout(i), i = null), o = l, r = c.apply(n, s), i || (n = s = null)) : !i && t.trailing !== !1 && (i = setTimeout(a, h)), r;
2428
2428
  };
2429
- return u.cancel = function() {
2429
+ return d.cancel = function() {
2430
2430
  clearTimeout(i), o = 0, i = n = s = null;
2431
- }, u;
2431
+ }, d;
2432
2432
  }
2433
2433
  var Ue = {
2434
2434
  ltr: ["marginLeft", "marginRight"],
@@ -2445,8 +2445,8 @@ function es(c, e, t) {
2445
2445
  */
2446
2446
  apply: function(s) {
2447
2447
  for (var r = 0, o = s.length; r < o; r++) {
2448
- var a = s[r].style, u = e.Direction.value;
2449
- r !== 0 ? a[Ue[u][0]] = "".concat(this.value / 2, "px") : a[Ue[u][0]] = "", r !== s.length - 1 ? a[Ue[u][1]] = "".concat(this.value / 2, "px") : a[Ue[u][1]] = "";
2448
+ var a = s[r].style, d = e.Direction.value;
2449
+ r !== 0 ? a[Ue[d][0]] = "".concat(this.value / 2, "px") : a[Ue[d][0]] = "", r !== s.length - 1 ? a[Ue[d][1]] = "".concat(this.value / 2, "px") : a[Ue[d][1]] = "";
2450
2450
  }
2451
2451
  },
2452
2452
  /**
@@ -2822,16 +2822,16 @@ function ls(c, e, t) {
2822
2822
  * @return {[]}
2823
2823
  */
2824
2824
  collect: function() {
2825
- var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], r = e.Html.slides, o = c.settings, a = o.perView, u = o.classes, d = o.cloningRatio;
2825
+ var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], r = e.Html.slides, o = c.settings, a = o.perView, d = o.classes, u = o.cloningRatio;
2826
2826
  if (r.length > 0)
2827
- for (var l = +!!c.settings.peek, h = a + l + Math.round(a / 2), p = r.slice(0, h).reverse(), b = r.slice(h * -1), w = 0; w < Math.max(d, Math.floor(a / r.length)); w++) {
2827
+ for (var l = +!!c.settings.peek, h = a + l + Math.round(a / 2), p = r.slice(0, h).reverse(), b = r.slice(h * -1), w = 0; w < Math.max(u, Math.floor(a / r.length)); w++) {
2828
2828
  for (var _ = 0; _ < p.length; _++) {
2829
2829
  var g = p[_].cloneNode(!0);
2830
- g.classList.add(u.slide.clone), s.push(g);
2830
+ g.classList.add(d.slide.clone), s.push(g);
2831
2831
  }
2832
2832
  for (var v = 0; v < b.length; v++) {
2833
2833
  var f = b[v].cloneNode(!0);
2834
- f.classList.add(u.slide.clone), s.unshift(f);
2834
+ f.classList.add(d.slide.clone), s.unshift(f);
2835
2835
  }
2836
2836
  }
2837
2837
  return s;
@@ -2842,10 +2842,10 @@ function ls(c, e, t) {
2842
2842
  * @return {Void}
2843
2843
  */
2844
2844
  append: function() {
2845
- for (var s = this.items, r = e.Html, o = r.wrapper, a = r.slides, u = Math.floor(s.length / 2), d = s.slice(0, u).reverse(), l = s.slice(u * -1).reverse(), h = "".concat(e.Sizes.slideWidth, "px"), p = 0; p < l.length; p++)
2845
+ for (var s = this.items, r = e.Html, o = r.wrapper, a = r.slides, d = Math.floor(s.length / 2), u = s.slice(0, d).reverse(), l = s.slice(d * -1).reverse(), h = "".concat(e.Sizes.slideWidth, "px"), p = 0; p < l.length; p++)
2846
2846
  o.appendChild(l[p]);
2847
- for (var b = 0; b < d.length; b++)
2848
- o.insertBefore(d[b], a[0]);
2847
+ for (var b = 0; b < u.length; b++)
2848
+ o.insertBefore(u[b], a[0]);
2849
2849
  for (var w = 0; w < s.length; w++)
2850
2850
  s[w].style.width = h;
2851
2851
  },
@@ -3255,7 +3255,7 @@ var gt = oi, je = ["touchstart", "mousedown"], Wt = ["touchmove", "mousemove"],
3255
3255
  function ws(c, e, t) {
3256
3256
  var i = new we(), n = 0, s = 0, r = 0, o = !1, a = gt ? {
3257
3257
  passive: !0
3258
- } : !1, u = {
3258
+ } : !1, d = {
3259
3259
  /**
3260
3260
  * Initializes swipe bindings.
3261
3261
  *
@@ -3399,8 +3399,8 @@ function ws(c, e, t) {
3399
3399
  return t.on("build.after", function() {
3400
3400
  e.Html.root.classList.add(c.settings.classes.swipeable);
3401
3401
  }), t.on("destroy", function() {
3402
- u.unbindSwipeStart(), u.unbindSwipeMove(), u.unbindSwipeEnd(), i.destroy();
3403
- }), u;
3402
+ d.unbindSwipeStart(), d.unbindSwipeMove(), d.unbindSwipeEnd(), i.destroy();
3403
+ }), d;
3404
3404
  }
3405
3405
  function xs(c, e, t) {
3406
3406
  var i = new we(), n = {
@@ -3564,9 +3564,9 @@ function Es(c, e, t) {
3564
3564
  * @return {Void}
3565
3565
  */
3566
3566
  addClass: function(o) {
3567
- var a = c.settings, u = o[c.index];
3568
- u && (u.classList.add(a.classes.nav.active), ri(u).forEach(function(d) {
3569
- d.classList.remove(a.classes.nav.active);
3567
+ var a = c.settings, d = o[c.index];
3568
+ d && (d.classList.add(a.classes.nav.active), ri(d).forEach(function(u) {
3569
+ u.classList.remove(a.classes.nav.active);
3570
3570
  }));
3571
3571
  },
3572
3572
  /**
@@ -3594,9 +3594,9 @@ function Es(c, e, t) {
3594
3594
  * @param {NodeList[]} lists
3595
3595
  */
3596
3596
  resetArrowState: function() {
3597
- for (var o = c.settings, a = arguments.length, u = new Array(a), d = 0; d < a; d++)
3598
- u[d] = arguments[d];
3599
- u.forEach(function(l) {
3597
+ for (var o = c.settings, a = arguments.length, d = new Array(a), u = 0; u < a; u++)
3598
+ d[u] = arguments[u];
3599
+ d.forEach(function(l) {
3600
3600
  ft(l).forEach(function(h) {
3601
3601
  h.classList.remove(o.classes.arrow.disabled);
3602
3602
  });
@@ -3608,9 +3608,9 @@ function Es(c, e, t) {
3608
3608
  * @param {NodeList[]} lists
3609
3609
  */
3610
3610
  disableArrow: function() {
3611
- for (var o = c.settings, a = arguments.length, u = new Array(a), d = 0; d < a; d++)
3612
- u[d] = arguments[d];
3613
- u.forEach(function(l) {
3611
+ for (var o = c.settings, a = arguments.length, d = new Array(a), u = 0; u < a; u++)
3612
+ d[u] = arguments[u];
3613
+ d.forEach(function(l) {
3614
3614
  ft(l).forEach(function(h) {
3615
3615
  h.classList.add(o.classes.arrow.disabled);
3616
3616
  });
@@ -3839,11 +3839,11 @@ function Rs(c, e, t) {
3839
3839
  * @param {Object} points
3840
3840
  * @returns {Object}
3841
3841
  */
3842
- match: function(u) {
3842
+ match: function(d) {
3843
3843
  if (typeof window.matchMedia < "u") {
3844
- for (var d in u)
3845
- if (u.hasOwnProperty(d) && window.matchMedia("(max-width: ".concat(d, "px)")).matches)
3846
- return u[d];
3844
+ for (var u in d)
3845
+ if (d.hasOwnProperty(u) && window.matchMedia("(max-width: ".concat(u, "px)")).matches)
3846
+ return d[u];
3847
3847
  }
3848
3848
  return r;
3849
3849
  }
@@ -4079,8 +4079,8 @@ function Qt(c) {
4079
4079
  }
4080
4080
  function Kt(c, e) {
4081
4081
  const t = c.replace(ie.findPipe, (s, r, o) => {
4082
- let a = !1, u = r;
4083
- for (; --u >= 0 && o[u] === "\\"; )
4082
+ let a = !1, d = r;
4083
+ for (; --d >= 0 && o[d] === "\\"; )
4084
4084
  a = !a;
4085
4085
  return a ? "|" : " |";
4086
4086
  }), i = t.split(ie.splitPipe);
@@ -4223,20 +4223,20 @@ class Qe {
4223
4223
  for (; i.length > 0; ) {
4224
4224
  let o = !1;
4225
4225
  const a = [];
4226
- let u;
4227
- for (u = 0; u < i.length; u++)
4228
- if (this.rules.other.blockquoteStart.test(i[u]))
4229
- a.push(i[u]), o = !0;
4226
+ let d;
4227
+ for (d = 0; d < i.length; d++)
4228
+ if (this.rules.other.blockquoteStart.test(i[d]))
4229
+ a.push(i[d]), o = !0;
4230
4230
  else if (!o)
4231
- a.push(i[u]);
4231
+ a.push(i[d]);
4232
4232
  else
4233
4233
  break;
4234
- i = i.slice(u);
4235
- const d = a.join(`
4236
- `), l = d.replace(this.rules.other.blockquoteSetextReplace, `
4234
+ i = i.slice(d);
4235
+ const u = a.join(`
4236
+ `), l = u.replace(this.rules.other.blockquoteSetextReplace, `
4237
4237
  $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
4238
4238
  n = n ? `${n}
4239
- ${d}` : d, s = s ? `${s}
4239
+ ${u}` : u, s = s ? `${s}
4240
4240
  ${l}` : l;
4241
4241
  const h = this.lexer.state.top;
4242
4242
  if (this.lexer.state.top = !0, this.lexer.blockTokens(l, r, !0), this.lexer.state.top = h, i.length === 0)
@@ -4283,15 +4283,15 @@ ${l}` : l;
4283
4283
  const r = this.rules.other.listItemRegex(i);
4284
4284
  let o = !1;
4285
4285
  for (; e; ) {
4286
- let u = !1, d = "", l = "";
4286
+ let d = !1, u = "", l = "";
4287
4287
  if (!(t = r.exec(e)) || this.rules.block.hr.test(e))
4288
4288
  break;
4289
- d = t[0], e = e.substring(d.length);
4289
+ u = t[0], e = e.substring(u.length);
4290
4290
  let h = t[2].split(`
4291
4291
  `, 1)[0].replace(this.rules.other.listReplaceTabs, (v) => " ".repeat(3 * v.length)), p = e.split(`
4292
4292
  `, 1)[0], b = !h.trim(), w = 0;
4293
- if (this.options.pedantic ? (w = 2, l = h.trimStart()) : b ? w = t[1].length + 1 : (w = t[2].search(this.rules.other.nonSpaceChar), w = w > 4 ? 1 : w, l = h.slice(w), w += t[1].length), b && this.rules.other.blankLine.test(p) && (d += p + `
4294
- `, e = e.substring(p.length + 1), u = !0), !u) {
4293
+ if (this.options.pedantic ? (w = 2, l = h.trimStart()) : b ? w = t[1].length + 1 : (w = t[2].search(this.rules.other.nonSpaceChar), w = w > 4 ? 1 : w, l = h.slice(w), w += t[1].length), b && this.rules.other.blankLine.test(p) && (u += p + `
4294
+ `, e = e.substring(p.length + 1), d = !0), !d) {
4295
4295
  const v = this.rules.other.nextBulletRegex(w), f = this.rules.other.hrRegex(w), m = this.rules.other.fencesBeginRegex(w), y = this.rules.other.headingBeginRegex(w), k = this.rules.other.htmlBeginRegex(w);
4296
4296
  for (; e; ) {
4297
4297
  const x = e.split(`
@@ -4308,21 +4308,21 @@ ${l}` : l;
4308
4308
  l += `
4309
4309
  ` + p;
4310
4310
  }
4311
- !b && !p.trim() && (b = !0), d += x + `
4311
+ !b && !p.trim() && (b = !0), u += x + `
4312
4312
  `, e = e.substring(x.length + 1), h = S.slice(w);
4313
4313
  }
4314
4314
  }
4315
- s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(d) && (o = !0));
4315
+ s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(u) && (o = !0));
4316
4316
  let _ = null, g;
4317
4317
  this.options.gfm && (_ = this.rules.other.listIsTask.exec(l), _ && (g = _[0] !== "[ ] ", l = l.replace(this.rules.other.listReplaceTask, ""))), s.items.push({
4318
4318
  type: "list_item",
4319
- raw: d,
4319
+ raw: u,
4320
4320
  task: !!_,
4321
4321
  checked: g,
4322
4322
  loose: !1,
4323
4323
  text: l,
4324
4324
  tokens: []
4325
- }), s.raw += d;
4325
+ }), s.raw += u;
4326
4326
  }
4327
4327
  const a = s.items.at(-1);
4328
4328
  if (a)
@@ -4330,14 +4330,14 @@ ${l}` : l;
4330
4330
  else
4331
4331
  return;
4332
4332
  s.raw = s.raw.trimEnd();
4333
- for (let u = 0; u < s.items.length; u++)
4334
- if (this.lexer.state.top = !1, s.items[u].tokens = this.lexer.blockTokens(s.items[u].text, []), !s.loose) {
4335
- const d = s.items[u].tokens.filter((h) => h.type === "space"), l = d.length > 0 && d.some((h) => this.rules.other.anyLine.test(h.raw));
4333
+ for (let d = 0; d < s.items.length; d++)
4334
+ if (this.lexer.state.top = !1, s.items[d].tokens = this.lexer.blockTokens(s.items[d].text, []), !s.loose) {
4335
+ const u = s.items[d].tokens.filter((h) => h.type === "space"), l = u.length > 0 && u.some((h) => this.rules.other.anyLine.test(h.raw));
4336
4336
  s.loose = l;
4337
4337
  }
4338
4338
  if (s.loose)
4339
- for (let u = 0; u < s.items.length; u++)
4340
- s.items[u].loose = !0;
4339
+ for (let d = 0; d < s.items.length; d++)
4340
+ s.items[d].loose = !0;
4341
4341
  return s;
4342
4342
  }
4343
4343
  }
@@ -4388,11 +4388,11 @@ ${l}` : l;
4388
4388
  align: r.align[o]
4389
4389
  });
4390
4390
  for (const o of s)
4391
- r.rows.push(Kt(o, r.header.length).map((a, u) => ({
4391
+ r.rows.push(Kt(o, r.header.length).map((a, d) => ({
4392
4392
  text: a,
4393
4393
  tokens: this.lexer.inline(a),
4394
4394
  header: !1,
4395
- align: r.align[u]
4395
+ align: r.align[d]
4396
4396
  })));
4397
4397
  return r;
4398
4398
  }
@@ -4504,21 +4504,21 @@ ${l}` : l;
4504
4504
  return;
4505
4505
  if (!(n[1] || n[2] || "") || !i || this.rules.inline.punctuation.exec(i)) {
4506
4506
  const r = [...n[0]].length - 1;
4507
- let o, a, u = r, d = 0;
4507
+ let o, a, d = r, u = 0;
4508
4508
  const l = n[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
4509
4509
  for (l.lastIndex = 0, t = t.slice(-1 * e.length + r); (n = l.exec(t)) != null; ) {
4510
4510
  if (o = n[1] || n[2] || n[3] || n[4] || n[5] || n[6], !o)
4511
4511
  continue;
4512
4512
  if (a = [...o].length, n[3] || n[4]) {
4513
- u += a;
4513
+ d += a;
4514
4514
  continue;
4515
4515
  } else if ((n[5] || n[6]) && r % 3 && !((r + a) % 3)) {
4516
- d += a;
4516
+ u += a;
4517
4517
  continue;
4518
4518
  }
4519
- if (u -= a, u > 0)
4519
+ if (d -= a, d > 0)
4520
4520
  continue;
4521
- a = Math.min(a, a + u + d);
4521
+ a = Math.min(a, a + d + u);
4522
4522
  const h = [...n[0]][0].length, p = e.slice(0, r + n.index + h + a);
4523
4523
  if (Math.min(r, a) % 2) {
4524
4524
  const w = p.slice(1, -1);
@@ -4749,8 +4749,8 @@ class le {
4749
4749
  let r = 1 / 0;
4750
4750
  const o = e.slice(1);
4751
4751
  let a;
4752
- this.options.extensions.startBlock.forEach((u) => {
4753
- a = u.call({ lexer: this }, o), typeof a == "number" && a >= 0 && (r = Math.min(r, a));
4752
+ this.options.extensions.startBlock.forEach((d) => {
4753
+ a = d.call({ lexer: this }, o), typeof a == "number" && a >= 0 && (r = Math.min(r, a));
4754
4754
  }), r < 1 / 0 && r >= 0 && (s = e.substring(0, r + 1));
4755
4755
  }
4756
4756
  if (this.state.top && (n = this.tokenizer.paragraph(s))) {
@@ -4801,7 +4801,7 @@ class le {
4801
4801
  for (; e; ) {
4802
4802
  s || (r = ""), s = !1;
4803
4803
  let o;
4804
- if (this.options.extensions?.inline?.some((u) => (o = u.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1))
4804
+ if (this.options.extensions?.inline?.some((d) => (o = d.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1))
4805
4805
  continue;
4806
4806
  if (o = this.tokenizer.escape(e)) {
4807
4807
  e = e.substring(o.raw.length), t.push(o);
@@ -4817,8 +4817,8 @@ class le {
4817
4817
  }
4818
4818
  if (o = this.tokenizer.reflink(e, this.tokens.links)) {
4819
4819
  e = e.substring(o.raw.length);
4820
- const u = t.at(-1);
4821
- o.type === "text" && u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
4820
+ const d = t.at(-1);
4821
+ o.type === "text" && d?.type === "text" ? (d.raw += o.raw, d.text += o.text) : t.push(o);
4822
4822
  continue;
4823
4823
  }
4824
4824
  if (o = this.tokenizer.emStrong(e, i, r)) {
@@ -4847,26 +4847,26 @@ class le {
4847
4847
  }
4848
4848
  let a = e;
4849
4849
  if (this.options.extensions?.startInline) {
4850
- let u = 1 / 0;
4851
- const d = e.slice(1);
4850
+ let d = 1 / 0;
4851
+ const u = e.slice(1);
4852
4852
  let l;
4853
4853
  this.options.extensions.startInline.forEach((h) => {
4854
- l = h.call({ lexer: this }, d), typeof l == "number" && l >= 0 && (u = Math.min(u, l));
4855
- }), u < 1 / 0 && u >= 0 && (a = e.substring(0, u + 1));
4854
+ l = h.call({ lexer: this }, u), typeof l == "number" && l >= 0 && (d = Math.min(d, l));
4855
+ }), d < 1 / 0 && d >= 0 && (a = e.substring(0, d + 1));
4856
4856
  }
4857
4857
  if (o = this.tokenizer.inlineText(a)) {
4858
4858
  e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (r = o.raw.slice(-1)), s = !0;
4859
- const u = t.at(-1);
4860
- u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
4859
+ const d = t.at(-1);
4860
+ d?.type === "text" ? (d.raw += o.raw, d.text += o.text) : t.push(o);
4861
4861
  continue;
4862
4862
  }
4863
4863
  if (e) {
4864
- const u = "Infinite loop on byte: " + e.charCodeAt(0);
4864
+ const d = "Infinite loop on byte: " + e.charCodeAt(0);
4865
4865
  if (this.options.silent) {
4866
- console.error(u);
4866
+ console.error(d);
4867
4867
  break;
4868
4868
  } else
4869
- throw new Error(u);
4869
+ throw new Error(d);
4870
4870
  }
4871
4871
  }
4872
4872
  return t;
@@ -5312,10 +5312,10 @@ class fn {
5312
5312
  throw new Error(`renderer '${r}' does not exist`);
5313
5313
  if (["options", "parser"].includes(r))
5314
5314
  continue;
5315
- const o = r, a = i.renderer[o], u = s[o];
5316
- s[o] = (...d) => {
5317
- let l = a.apply(s, d);
5318
- return l === !1 && (l = u.apply(s, d)), l || "";
5315
+ const o = r, a = i.renderer[o], d = s[o];
5316
+ s[o] = (...u) => {
5317
+ let l = a.apply(s, u);
5318
+ return l === !1 && (l = d.apply(s, u)), l || "";
5319
5319
  };
5320
5320
  }
5321
5321
  n.renderer = s;
@@ -5327,10 +5327,10 @@ class fn {
5327
5327
  throw new Error(`tokenizer '${r}' does not exist`);
5328
5328
  if (["options", "rules", "lexer"].includes(r))
5329
5329
  continue;
5330
- const o = r, a = i.tokenizer[o], u = s[o];
5331
- s[o] = (...d) => {
5332
- let l = a.apply(s, d);
5333
- return l === !1 && (l = u.apply(s, d)), l;
5330
+ const o = r, a = i.tokenizer[o], d = s[o];
5331
+ s[o] = (...u) => {
5332
+ let l = a.apply(s, u);
5333
+ return l === !1 && (l = d.apply(s, u)), l;
5334
5334
  };
5335
5335
  }
5336
5336
  n.tokenizer = s;
@@ -5342,15 +5342,15 @@ class fn {
5342
5342
  throw new Error(`hook '${r}' does not exist`);
5343
5343
  if (["options", "block"].includes(r))
5344
5344
  continue;
5345
- const o = r, a = i.hooks[o], u = s[o];
5346
- Ye.passThroughHooks.has(r) ? s[o] = (d) => {
5345
+ const o = r, a = i.hooks[o], d = s[o];
5346
+ Ye.passThroughHooks.has(r) ? s[o] = (u) => {
5347
5347
  if (this.defaults.async)
5348
- return Promise.resolve(a.call(s, d)).then((h) => u.call(s, h));
5349
- const l = a.call(s, d);
5350
- return u.call(s, l);
5351
- } : s[o] = (...d) => {
5352
- let l = a.apply(s, d);
5353
- return l === !1 && (l = u.apply(s, d)), l;
5348
+ return Promise.resolve(a.call(s, u)).then((h) => d.call(s, h));
5349
+ const l = a.call(s, u);
5350
+ return d.call(s, l);
5351
+ } : s[o] = (...u) => {
5352
+ let l = a.apply(s, u);
5353
+ return l === !1 && (l = d.apply(s, u)), l;
5354
5354
  };
5355
5355
  }
5356
5356
  n.hooks = s;
@@ -5384,17 +5384,17 @@ class fn {
5384
5384
  if (typeof i != "string")
5385
5385
  return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(i) + ", string expected"));
5386
5386
  r.hooks && (r.hooks.options = r, r.hooks.block = e);
5387
- const a = r.hooks ? r.hooks.provideLexer() : e ? le.lex : le.lexInline, u = r.hooks ? r.hooks.provideParser() : e ? ae.parse : ae.parseInline;
5387
+ const a = r.hooks ? r.hooks.provideLexer() : e ? le.lex : le.lexInline, d = r.hooks ? r.hooks.provideParser() : e ? ae.parse : ae.parseInline;
5388
5388
  if (r.async)
5389
- return Promise.resolve(r.hooks ? r.hooks.preprocess(i) : i).then((d) => a(d, r)).then((d) => r.hooks ? r.hooks.processAllTokens(d) : d).then((d) => r.walkTokens ? Promise.all(this.walkTokens(d, r.walkTokens)).then(() => d) : d).then((d) => u(d, r)).then((d) => r.hooks ? r.hooks.postprocess(d) : d).catch(o);
5389
+ return Promise.resolve(r.hooks ? r.hooks.preprocess(i) : i).then((u) => a(u, r)).then((u) => r.hooks ? r.hooks.processAllTokens(u) : u).then((u) => r.walkTokens ? Promise.all(this.walkTokens(u, r.walkTokens)).then(() => u) : u).then((u) => d(u, r)).then((u) => r.hooks ? r.hooks.postprocess(u) : u).catch(o);
5390
5390
  try {
5391
5391
  r.hooks && (i = r.hooks.preprocess(i));
5392
- let d = a(i, r);
5393
- r.hooks && (d = r.hooks.processAllTokens(d)), r.walkTokens && this.walkTokens(d, r.walkTokens);
5394
- let l = u(d, r);
5392
+ let u = a(i, r);
5393
+ r.hooks && (u = r.hooks.processAllTokens(u)), r.walkTokens && this.walkTokens(u, r.walkTokens);
5394
+ let l = d(u, r);
5395
5395
  return r.hooks && (l = r.hooks.postprocess(l)), l;
5396
- } catch (d) {
5397
- return o(d);
5396
+ } catch (u) {
5397
+ return o(u);
5398
5398
  }
5399
5399
  };
5400
5400
  }
@@ -5453,7 +5453,7 @@ class gn {
5453
5453
  async checkIntent(e, t, i) {
5454
5454
  let n = "You are an assistant", s = "", r = `This is the user's request:
5455
5455
 
5456
- ${e}`, o, a, u;
5456
+ ${e}`, o, a, d;
5457
5457
  if (i.image && t === "openai")
5458
5458
  return r += `
5459
5459
  Extract some information.
@@ -5498,7 +5498,7 @@ Extract some information.
5498
5498
  },
5499
5499
  required: []
5500
5500
  }
5501
- }], a = await this.builder.send(r, s, n, "", o), a ? (u = JSON.parse(a), u) : !1;
5501
+ }], a = await this.builder.send(r, s, n, "", o), a ? (d = JSON.parse(a), d) : !1;
5502
5502
  if (i.image) {
5503
5503
  if (r += `
5504
5504
 
@@ -5560,7 +5560,7 @@ Check the type of the request:
5560
5560
  }
5561
5561
  }], a = await this.builder.send(r, s, n, "", o), !a)
5562
5562
  return !1;
5563
- u = JSON.parse(a);
5563
+ d = JSON.parse(a);
5564
5564
  } else if (i.video) {
5565
5565
  if (r += `
5566
5566
 
@@ -5588,7 +5588,7 @@ Check the type of the request:
5588
5588
  }
5589
5589
  }], a = await this.builder.send(r, s, n, "", o), !a)
5590
5590
  return !1;
5591
- u = JSON.parse(a);
5591
+ d = JSON.parse(a);
5592
5592
  } else if (i.audio) {
5593
5593
  if (r += `
5594
5594
 
@@ -5610,9 +5610,9 @@ Check the type of the request:
5610
5610
  }
5611
5611
  }], a = await this.builder.send(r, s, n, "", o), !a)
5612
5612
  return !1;
5613
- u = JSON.parse(a);
5613
+ d = JSON.parse(a);
5614
5614
  }
5615
- return this.builder.settings.consoleLog && console.log(u), this.extractInfo(u, t, e);
5615
+ return this.builder.settings.consoleLog && console.log(d), this.extractInfo(d, t, e);
5616
5616
  }
5617
5617
  async extractInfo(e, t, i) {
5618
5618
  const n = this.builder.settings.defaultModels;
@@ -5627,7 +5627,7 @@ ${i}
5627
5627
 
5628
5628
  Check the request and return the details.
5629
5629
  `;
5630
- let u = [{
5630
+ let d = [{
5631
5631
  name: "check_request",
5632
5632
  description: "Check user request.",
5633
5633
  parameters: {
@@ -5722,10 +5722,10 @@ Check the request and return the details.
5722
5722
  // 'prompt'
5723
5723
  ]
5724
5724
  }
5725
- }], d = await this.builder.send(a, o, s, "", u);
5726
- if (!d)
5725
+ }], u = await this.builder.send(a, o, s, "", d);
5726
+ if (!u)
5727
5727
  return !1;
5728
- let l = JSON.parse(d);
5728
+ let l = JSON.parse(u);
5729
5729
  return {
5730
5730
  ...e,
5731
5731
  ...l
@@ -5741,7 +5741,7 @@ ${i}
5741
5741
 
5742
5742
  Check the request and return the details.
5743
5743
  `;
5744
- let u = [{
5744
+ let d = [{
5745
5745
  name: "check_request",
5746
5746
  description: "Check user request.",
5747
5747
  parameters: {
@@ -5768,10 +5768,10 @@ Check the request and return the details.
5768
5768
  // 'image_url'
5769
5769
  ]
5770
5770
  }
5771
- }], d = await this.builder.send(a, o, s, "", u);
5772
- if (!d)
5771
+ }], u = await this.builder.send(a, o, s, "", d);
5772
+ if (!u)
5773
5773
  return !1;
5774
- let l = JSON.parse(d);
5774
+ let l = JSON.parse(u);
5775
5775
  return {
5776
5776
  ...e,
5777
5777
  ...l
@@ -5787,7 +5787,7 @@ Thie is the list of models:
5787
5787
  ${i}
5788
5788
 
5789
5789
  Check the request and return the details.
5790
- `, u = [{
5790
+ `, d = [{
5791
5791
  name: "check_request",
5792
5792
  description: "Check user request.",
5793
5793
  parameters: {
@@ -5810,10 +5810,10 @@ Check the request and return the details.
5810
5810
  // 'prompt'
5811
5811
  ]
5812
5812
  }
5813
- }], d = await this.builder.send(a, o, s, "", u);
5814
- if (!d)
5813
+ }], u = await this.builder.send(a, o, s, "", d);
5814
+ if (!u)
5815
5815
  return !1;
5816
- let l = JSON.parse(d);
5816
+ let l = JSON.parse(u);
5817
5817
  return {
5818
5818
  ...e,
5819
5819
  ...l
@@ -5837,13 +5837,13 @@ Check the request and return the details.
5837
5837
  },
5838
5838
  required: ["image_url"]
5839
5839
  }
5840
- }], u = await this.builder.send(o, r, s, "", a);
5841
- if (!u)
5840
+ }], d = await this.builder.send(o, r, s, "", a);
5841
+ if (!d)
5842
5842
  return !1;
5843
- let d = JSON.parse(u);
5843
+ let u = JSON.parse(d);
5844
5844
  return {
5845
5845
  ...e,
5846
- ...d
5846
+ ...u
5847
5847
  };
5848
5848
  } else if (e.upscale_image) {
5849
5849
  const s = "You are an assistant", o = `
@@ -5856,7 +5856,7 @@ Thie is the list of models:
5856
5856
  ${i}
5857
5857
 
5858
5858
  Check the request and return the details.
5859
- `, u = [{
5859
+ `, d = [{
5860
5860
  name: "check_request",
5861
5861
  description: "Check user request.",
5862
5862
  parameters: {
@@ -5875,10 +5875,10 @@ Check the request and return the details.
5875
5875
  // 'image_url'
5876
5876
  ]
5877
5877
  }
5878
- }], d = await this.builder.send(a, o, s, "", u);
5879
- if (!d)
5878
+ }], u = await this.builder.send(a, o, s, "", d);
5879
+ if (!u)
5880
5880
  return !1;
5881
- let l = JSON.parse(d);
5881
+ let l = JSON.parse(u);
5882
5882
  return {
5883
5883
  ...e,
5884
5884
  ...l
@@ -5894,7 +5894,7 @@ Thie is the list of models:
5894
5894
  ${i}
5895
5895
 
5896
5896
  Check the request and return the details.
5897
- `, u = [{
5897
+ `, d = [{
5898
5898
  name: "check_request",
5899
5899
  description: "Check user request.",
5900
5900
  parameters: {
@@ -5915,10 +5915,10 @@ Check the request and return the details.
5915
5915
  },
5916
5916
  required: ["image_url", "prompt"]
5917
5917
  }
5918
- }], d = await this.builder.send(a, o, s, "", u);
5919
- if (!d)
5918
+ }], u = await this.builder.send(a, o, s, "", d);
5919
+ if (!u)
5920
5920
  return !1;
5921
- let l = JSON.parse(d);
5921
+ let l = JSON.parse(u);
5922
5922
  return {
5923
5923
  ...e,
5924
5924
  ...l
@@ -5936,7 +5936,7 @@ Thie is the list of models:
5936
5936
  ${i}
5937
5937
 
5938
5938
  Check the request and return the details.
5939
- `, u = [{
5939
+ `, d = [{
5940
5940
  name: "check_request",
5941
5941
  description: "Check user request.",
5942
5942
  parameters: {
@@ -5963,10 +5963,10 @@ Check the request and return the details.
5963
5963
  // 'image_url'
5964
5964
  ]
5965
5965
  }
5966
- }], d = await this.builder.send(a, o, s, "", u);
5967
- if (!d)
5966
+ }], u = await this.builder.send(a, o, s, "", d);
5967
+ if (!u)
5968
5968
  return !1;
5969
- let l = JSON.parse(d);
5969
+ let l = JSON.parse(u);
5970
5970
  return {
5971
5971
  ...e,
5972
5972
  ...l
@@ -5982,7 +5982,7 @@ Thie is the list of models:
5982
5982
  ${i}
5983
5983
 
5984
5984
  Check the request and return the details.
5985
- `, u = [{
5985
+ `, d = [{
5986
5986
  name: "check_request",
5987
5987
  description: "Check user request.",
5988
5988
  parameters: {
@@ -6085,10 +6085,10 @@ Check the request and return the details.
6085
6085
  // 'prompt'
6086
6086
  ]
6087
6087
  }
6088
- }], d = await this.builder.send(a, o, s, "", u);
6089
- if (!d)
6088
+ }], u = await this.builder.send(a, o, s, "", d);
6089
+ if (!u)
6090
6090
  return !1;
6091
- let l = JSON.parse(d);
6091
+ let l = JSON.parse(u);
6092
6092
  return {
6093
6093
  ...e,
6094
6094
  ...l
@@ -6104,7 +6104,7 @@ Thie is the list of models:
6104
6104
  ${i}
6105
6105
 
6106
6106
  Check the request and return the details.
6107
- `, u = [{
6107
+ `, d = [{
6108
6108
  name: "check_request",
6109
6109
  description: "Check user request.",
6110
6110
  parameters: {
@@ -6207,10 +6207,10 @@ Check the request and return the details.
6207
6207
  // 'prompt'
6208
6208
  ]
6209
6209
  }
6210
- }], d = await this.builder.send(a, o, s, "", u);
6211
- if (!d)
6210
+ }], u = await this.builder.send(a, o, s, "", d);
6211
+ if (!u)
6212
6212
  return !1;
6213
- let l = JSON.parse(d);
6213
+ let l = JSON.parse(u);
6214
6214
  return {
6215
6215
  ...e,
6216
6216
  ...l
@@ -6226,7 +6226,7 @@ Thie is the list of models:
6226
6226
  ${i}
6227
6227
 
6228
6228
  Check the request and return the details.
6229
- `, u = [{
6229
+ `, d = [{
6230
6230
  name: "check_request",
6231
6231
  description: "Check user request.",
6232
6232
  parameters: {
@@ -6325,10 +6325,10 @@ Check the request and return the details.
6325
6325
  // 'prompt'
6326
6326
  ]
6327
6327
  }
6328
- }], d = await this.builder.send(a, o, s, "", u);
6329
- if (!d)
6328
+ }], u = await this.builder.send(a, o, s, "", d);
6329
+ if (!u)
6330
6330
  return !1;
6331
- let l = JSON.parse(d);
6331
+ let l = JSON.parse(u);
6332
6332
  return {
6333
6333
  ...e,
6334
6334
  ...l
@@ -6344,7 +6344,7 @@ Thie is the list of models:
6344
6344
  ${i}
6345
6345
 
6346
6346
  Check the request and return the details.
6347
- `, u = [{
6347
+ `, d = [{
6348
6348
  name: "check_request",
6349
6349
  description: "Check user request.",
6350
6350
  parameters: {
@@ -6369,10 +6369,10 @@ Check the request and return the details.
6369
6369
  },
6370
6370
  required: ["text"]
6371
6371
  }
6372
- }], d = await this.builder.send(a, o, s, "", u);
6373
- if (!d)
6372
+ }], u = await this.builder.send(a, o, s, "", d);
6373
+ if (!u)
6374
6374
  return !1;
6375
- let l = JSON.parse(d);
6375
+ let l = JSON.parse(u);
6376
6376
  return {
6377
6377
  ...e,
6378
6378
  ...l
@@ -6452,14 +6452,14 @@ Check the information and return the details.
6452
6452
  headers: a,
6453
6453
  body: JSON.stringify(e)
6454
6454
  });
6455
- let u = await s.text();
6455
+ let d = await s.text();
6456
6456
  try {
6457
- r = JSON.parse(u);
6457
+ r = JSON.parse(d);
6458
6458
  } catch {
6459
6459
  return {
6460
6460
  mediaGenerated: !1,
6461
6461
  status: "error",
6462
- message: u
6462
+ message: d
6463
6463
  };
6464
6464
  }
6465
6465
  if (this.builder.output.push(r), r.error)
@@ -6470,9 +6470,9 @@ Check the information and return the details.
6470
6470
  //this.out('Request failed.')
6471
6471
  };
6472
6472
  {
6473
- const d = r.data;
6473
+ const u = r.data;
6474
6474
  let l = "", h = "", p, b = !1, w = [], _ = [];
6475
- return d.entries && d.entries.forEach((g) => {
6475
+ return u.entries && u.entries.forEach((g) => {
6476
6476
  p = g.url.split(".").pop().toLowerCase(), p === "mp4" ? (l += `
6477
6477
  <p class="responsive-video">
6478
6478
  <video controls>
@@ -6496,7 +6496,7 @@ Check the information and return the details.
6496
6496
  </div>
6497
6497
  </div>
6498
6498
  `, h += `![](${g.url})`, b = !0), w.push(g.url), _.push(g.file_url);
6499
- }), b && (l = `<div class="image-container">${l}</div>`), typeof d == "string" && (l = d, h = d), n ? (i.innerHTML = "", i.remove()) : (i.innerHTML = l, this.builder.outputHtml += `<div class="result-container">${l}</div>`), {
6499
+ }), b && (l = `<div class="image-container">${l}</div>`), typeof u == "string" && (l = u, h = u), n ? (i.innerHTML = "", i.remove()) : (i.innerHTML = l, this.builder.outputHtml += `<div class="result-container">${l}</div>`), {
6500
6500
  mediaGenerated: !0,
6501
6501
  status: "success",
6502
6502
  markdown: h,
@@ -6520,14 +6520,14 @@ Check the information and return the details.
6520
6520
  headers: a,
6521
6521
  body: JSON.stringify(e)
6522
6522
  });
6523
- let u = await s.text();
6523
+ let d = await s.text();
6524
6524
  try {
6525
- r = JSON.parse(u);
6525
+ r = JSON.parse(d);
6526
6526
  } catch {
6527
6527
  return {
6528
6528
  mediaGenerated: !1,
6529
6529
  status: "error",
6530
- message: u
6530
+ message: d
6531
6531
  };
6532
6532
  }
6533
6533
  if (this.builder.output.push(r), r.error)
@@ -6538,8 +6538,8 @@ Check the information and return the details.
6538
6538
  //this.out('Request failed.')
6539
6539
  };
6540
6540
  {
6541
- const d = r.data;
6542
- let l = this.renderResult(d, i, n);
6541
+ const u = r.data;
6542
+ let l = this.renderResult(u, i, n);
6543
6543
  return {
6544
6544
  mediaGenerated: !0,
6545
6545
  status: "success",
@@ -6550,14 +6550,14 @@ Check the information and return the details.
6550
6550
  }
6551
6551
  }
6552
6552
  async waitingReplicate(e, t, i, n) {
6553
- let s, r, o, a = e.model, u = this.builder.settings.replicateStatusEndpoint;
6554
- u = u.replace("{REQUEST_ID}", t);
6555
- let d = {
6553
+ let s, r, o, a = e.model, d = this.builder.settings.replicateStatusEndpoint;
6554
+ d = d.replace("{REQUEST_ID}", t);
6555
+ let u = {
6556
6556
  "Content-Type": "application/json",
6557
6557
  ...this.builder.settings.headers
6558
6558
  }, l = {
6559
6559
  model: a,
6560
- endpoint: u,
6560
+ endpoint: d,
6561
6561
  request_id: t
6562
6562
  // customData: this.builder.settings.customData
6563
6563
  };
@@ -6565,7 +6565,7 @@ Check the information and return the details.
6565
6565
  if (r = await fetch(this.builder.settings.checkRequestStatusUrl_Replicate, {
6566
6566
  signal: this.builder.mediaSignal,
6567
6567
  method: "POST",
6568
- headers: d,
6568
+ headers: u,
6569
6569
  body: JSON.stringify(l)
6570
6570
  }), o = await r.json(), o.ok && (s = o.data.status), !s)
6571
6571
  return {
@@ -6587,13 +6587,13 @@ Check the information and return the details.
6587
6587
  }
6588
6588
  async waitingFal(e, t, i, n) {
6589
6589
  let s, r, o, a = e.model;
6590
- const u = this.getEndpoint(a, t, this.builder.settings.falStatusEndpoint);
6591
- let d = {
6590
+ const d = this.getEndpoint(a, t, this.builder.settings.falStatusEndpoint);
6591
+ let u = {
6592
6592
  "Content-Type": "application/json",
6593
6593
  ...this.builder.settings.headers
6594
6594
  }, l = {
6595
6595
  model: a,
6596
- endpoint: u,
6596
+ endpoint: d,
6597
6597
  request_id: t
6598
6598
  // customData: this.builder.settings.customData
6599
6599
  };
@@ -6601,7 +6601,7 @@ Check the information and return the details.
6601
6601
  if (r = await fetch(this.builder.settings.checkRequestStatusUrl_Fal, {
6602
6602
  signal: this.builder.mediaSignal,
6603
6603
  method: "POST",
6604
- headers: d,
6604
+ headers: u,
6605
6605
  body: JSON.stringify(l)
6606
6606
  }), o = await r.json(), o.ok && o.status)
6607
6607
  s = o.status;
@@ -6625,32 +6625,32 @@ Check the information and return the details.
6625
6625
  renderResult(e, t, i) {
6626
6626
  let n = "", s = "", r = [], o = [];
6627
6627
  if (e.entries) {
6628
- let a, u = !1;
6629
- e.entries.forEach((d) => {
6630
- a = d.url.split(".").pop().toLowerCase(), a === "mp4" ? (n += `
6628
+ let a, d = !1;
6629
+ e.entries.forEach((u) => {
6630
+ a = u.url.split(".").pop().toLowerCase(), a === "mp4" ? (n += `
6631
6631
  <p class="responsive-video">
6632
6632
  <video controls>
6633
- <source src="${d.url}" type="video/mp4">
6633
+ <source src="${u.url}" type="video/mp4">
6634
6634
  Your browser does not support the video tag.
6635
6635
  </video>
6636
6636
  </p>
6637
- `, s += `![](${d.url})`, r.push(d.url), o.push(d.file_url)) : a === "wav" || a === "mp3" ? (n += `
6637
+ `, s += `![](${u.url})`, r.push(u.url), o.push(u.file_url)) : a === "wav" || a === "mp3" ? (n += `
6638
6638
  <p class="responsive-audio">
6639
6639
  <audio controls>
6640
- <source src="${d.url}" type="audio/mpeg">
6640
+ <source src="${u.url}" type="audio/mpeg">
6641
6641
  Your browser does not support the audio tag.
6642
6642
  </audio>
6643
6643
  </p>
6644
- `, s += `![](${d.url})`, r.push(d.url), o.push(d.file_url)) : (n += `
6644
+ `, s += `![](${u.url})`, r.push(u.url), o.push(u.file_url)) : (n += `
6645
6645
  <div>
6646
- <img src="${d.url}" />
6646
+ <img src="${u.url}" />
6647
6647
  <div>
6648
- <a class="link-view" href="${d.url}" target="_blank" rel="noopener noreferrer">${this.out("View")}</a>
6649
- <a class="link-download" href="${d.url}" download>${this.out("Download")}</a>
6648
+ <a class="link-view" href="${u.url}" target="_blank" rel="noopener noreferrer">${this.out("View")}</a>
6649
+ <a class="link-download" href="${u.url}" download>${this.out("Download")}</a>
6650
6650
  </div>
6651
6651
  </div>
6652
- `, s += `![](${d.url})`, r.push(d.url), o.push(d.file_url), u = !0);
6653
- }), u && (n = `<div class="image-container">${n}</div>`);
6652
+ `, s += `![](${u.url})`, r.push(u.url), o.push(u.file_url), d = !0);
6653
+ }), d && (n = `<div class="image-container">${n}</div>`);
6654
6654
  } else typeof e == "string" && (n = `
6655
6655
  <p>
6656
6656
  ${e}
@@ -6672,17 +6672,17 @@ Check the information and return the details.
6672
6672
  status: "error",
6673
6673
  message: this.out("Model not found.")
6674
6674
  };
6675
- let u = e.prompt;
6676
- if (!u)
6675
+ let d = e.prompt;
6676
+ if (!d)
6677
6677
  return {
6678
6678
  mediaGenerated: !1,
6679
6679
  status: "error",
6680
6680
  message: this.out("Please input a prompt.")
6681
6681
  };
6682
- let d = e.aspect_ratio || "16:9", l = e.num_images || 1;
6682
+ let u = e.aspect_ratio || "16:9", l = e.num_images || 1;
6683
6683
  l > 4 && (l = 4), n = {
6684
- prompt: u,
6685
- aspect_ratio: d,
6684
+ prompt: d,
6685
+ aspect_ratio: u,
6686
6686
  num_outputs: l
6687
6687
  }, s.model = a, s.customData = this.builder.settings.customData;
6688
6688
  } else if (e.edit_area_in_image) {
@@ -6693,8 +6693,8 @@ Check the information and return the details.
6693
6693
  status: "error",
6694
6694
  message: this.out("Model not found.")
6695
6695
  };
6696
- let u = e.prompt;
6697
- if (!u)
6696
+ let d = e.prompt;
6697
+ if (!d)
6698
6698
  return {
6699
6699
  mediaGenerated: !1,
6700
6700
  status: "error",
@@ -6722,7 +6722,7 @@ Check the information and return the details.
6722
6722
  message: this.out("Image mask not found.")
6723
6723
  };
6724
6724
  n = {
6725
- prompt: u,
6725
+ prompt: d,
6726
6726
  image: p,
6727
6727
  mask: b
6728
6728
  // num_images,
@@ -6735,24 +6735,24 @@ Check the information and return the details.
6735
6735
  status: "error",
6736
6736
  message: this.out("Model not found.")
6737
6737
  };
6738
- let u = e.prompt;
6739
- if (!u)
6738
+ let d = e.prompt;
6739
+ if (!d)
6740
6740
  return {
6741
6741
  mediaGenerated: !1,
6742
6742
  status: "error",
6743
6743
  message: this.out("Please input a prompt.")
6744
6744
  };
6745
- let d = e.width || 1280, l = e.height || 768;
6745
+ let u = e.width || 1280, l = e.height || 768;
6746
6746
  e.num_images, n = {
6747
- prompt: u,
6748
- size: `${d}x${l}`,
6747
+ prompt: d,
6748
+ size: `${u}x${l}`,
6749
6749
  // num_images,
6750
6750
  style: "digital_illustration"
6751
6751
  // style_id,
6752
6752
  // colors,
6753
6753
  }, s.model = a, s.customData = this.builder.settings.customData;
6754
6754
  } else if (e.upscale_image) {
6755
- let a = this.validateModel(e.model, d, "upscale_image");
6755
+ let a = this.validateModel(e.model, u, "upscale_image");
6756
6756
  if (!a)
6757
6757
  return {
6758
6758
  mediaGenerated: !1,
@@ -6765,8 +6765,8 @@ Check the information and return the details.
6765
6765
  status: "error",
6766
6766
  message: this.out("Image reference not found.")
6767
6767
  };
6768
- let d = "replicate";
6769
- const l = await this.builder.upload.getInputURLs(d);
6768
+ let u = "replicate";
6769
+ const l = await this.builder.upload.getInputURLs(u);
6770
6770
  if (l.error)
6771
6771
  return {
6772
6772
  mediaGenerated: !1,
@@ -6792,8 +6792,8 @@ Check the information and return the details.
6792
6792
  status: "error",
6793
6793
  message: this.out("Model not found.")
6794
6794
  };
6795
- let u = e.prompt;
6796
- if (!u)
6795
+ let d = e.prompt;
6796
+ if (!d)
6797
6797
  return {
6798
6798
  mediaGenerated: !1,
6799
6799
  status: "error",
@@ -6822,7 +6822,7 @@ Check the information and return the details.
6822
6822
  };
6823
6823
  n = {
6824
6824
  image: p,
6825
- prompt: `${u}. No talk. Answer only.`
6825
+ prompt: `${d}. No talk. Answer only.`
6826
6826
  }, s.model = a, s.customData = this.builder.settings.customData;
6827
6827
  } else if (e.image_to_video_generation) {
6828
6828
  let a = this.validateModel(e.model, l, "image_to_video_generation");
@@ -6832,8 +6832,8 @@ Check the information and return the details.
6832
6832
  status: "error",
6833
6833
  message: this.out("Model not found.")
6834
6834
  };
6835
- let u = e.prompt || "stunning video", d = e.duration || 5;
6836
- d > 10 && (d = 5);
6835
+ let d = e.prompt || "stunning video", u = e.duration || 5;
6836
+ u > 10 && (u = 5);
6837
6837
  let l = "replicate";
6838
6838
  const h = await this.builder.upload.getInputURLs(l);
6839
6839
  if (h.error)
@@ -6851,18 +6851,18 @@ Check the information and return the details.
6851
6851
  };
6852
6852
  a === "kwaivgi/kling-v1.6-pro" && (n = {
6853
6853
  start_image: p,
6854
- prompt: u,
6855
- duration: d
6854
+ prompt: d,
6855
+ duration: u
6856
6856
  }), a === "kwaivgi/kling-v1.6-standard" && (n = {
6857
6857
  start_image: p,
6858
- prompt: u,
6859
- duration: d
6858
+ prompt: d,
6859
+ duration: u
6860
6860
  }), a === "minimax/video-01-live" && (n = {
6861
6861
  first_frame_image: p,
6862
- prompt: u
6862
+ prompt: d
6863
6863
  }), a === "luma/ray" && (n = {
6864
6864
  start_image_url: p,
6865
- prompt: u
6865
+ prompt: d
6866
6866
  }), s.model = a, s.customData = this.builder.settings.customData;
6867
6867
  } else if (e.text_to_video_generation) {
6868
6868
  let a = this.validateModel(e.model, r, "text_to_video_generation");
@@ -6872,21 +6872,21 @@ Check the information and return the details.
6872
6872
  status: "error",
6873
6873
  message: this.out("Model not found.")
6874
6874
  };
6875
- let u = e.prompt;
6876
- if (!u)
6875
+ let d = e.prompt;
6876
+ if (!d)
6877
6877
  return {
6878
6878
  mediaGenerated: !1,
6879
6879
  status: "error",
6880
6880
  message: this.out("Please input a prompt.")
6881
6881
  };
6882
- let d = e.duration || 5;
6883
- d > 10 && (d = 5), a === "kwaivgi/kling-v1.6-standard" && (n = {
6884
- prompt: u,
6885
- duration: d
6882
+ let u = e.duration || 5;
6883
+ u > 10 && (u = 5), a === "kwaivgi/kling-v1.6-standard" && (n = {
6884
+ prompt: d,
6885
+ duration: u
6886
6886
  }), a === "minimax/video-01" && (n = {
6887
- prompt: u
6887
+ prompt: d
6888
6888
  }), a === "luma/ray" && (n = {
6889
- prompt: u
6889
+ prompt: d
6890
6890
  }), s.model = a, s.customData = this.builder.settings.customData;
6891
6891
  } else if (e.text_to_speech) {
6892
6892
  let a = this.validateModel(e.model, r, "text_to_speech");
@@ -6909,10 +6909,10 @@ Check the information and return the details.
6909
6909
  }, s.model = a, s.customData = this.builder.settings.customData;
6910
6910
  }
6911
6911
  if (s.model.indexOf(":") !== -1) {
6912
- const u = s.model.split(":")[1];
6913
- s.version = u;
6914
- let d = this.builder.settings.replicateEndpoint1;
6915
- s.endpoint = d, s.payload = n, this.builder.settings.consoleLog && console.log("PAYLOAD 1");
6912
+ const d = s.model.split(":")[1];
6913
+ s.version = d;
6914
+ let u = this.builder.settings.replicateEndpoint1;
6915
+ s.endpoint = u, s.payload = n, this.builder.settings.consoleLog && console.log("PAYLOAD 1");
6916
6916
  } else {
6917
6917
  let a = this.builder.settings.replicateEndpoint2;
6918
6918
  a = a.replace("{MODEL}", s.model), s.endpoint = a, s.payload = n, this.builder.settings.consoleLog && console.log("PAYLOAD 2");
@@ -6927,17 +6927,17 @@ Check the information and return the details.
6927
6927
  status: "error",
6928
6928
  message: this.out("Endpoint not configured.")
6929
6929
  };
6930
- let u, d = {
6930
+ let d, u = {
6931
6931
  "Content-Type": "application/json",
6932
6932
  ...this.builder.settings.headers
6933
6933
  }, h = await (await fetch(a, {
6934
6934
  signal: this.builder.mediaSignal,
6935
6935
  method: "POST",
6936
- headers: d,
6936
+ headers: u,
6937
6937
  body: JSON.stringify(s)
6938
6938
  })).json();
6939
6939
  if (h.ok) {
6940
- if (u = h.data.id, !u)
6940
+ if (d = h.data.id, !d)
6941
6941
  return {
6942
6942
  mediaGenerated: !1,
6943
6943
  status: "error",
@@ -6949,7 +6949,7 @@ Check the information and return the details.
6949
6949
  status: "error",
6950
6950
  message: h.error
6951
6951
  };
6952
- const p = this.waitingReplicate(s, u, t, i);
6952
+ const p = this.waitingReplicate(s, d, t, i);
6953
6953
  return this.builder.isMediaGenerating = !1, p;
6954
6954
  } else {
6955
6955
  let a = this.builder.settings.generateMediaUrl;
@@ -6959,14 +6959,14 @@ Check the information and return the details.
6959
6959
  status: "error",
6960
6960
  message: this.out("Endpoint not configured: generateMediaUrl.")
6961
6961
  };
6962
- let u = {
6962
+ let d = {
6963
6963
  "Content-Type": "application/json",
6964
6964
  ...this.builder.settings.headers
6965
6965
  };
6966
6966
  const l = await (await fetch(a, {
6967
6967
  signal: this.builder.mediaSignal,
6968
6968
  method: "POST",
6969
- headers: u,
6969
+ headers: d,
6970
6970
  body: JSON.stringify(s)
6971
6971
  })).json();
6972
6972
  if (this.builder.isMediaGenerating = !1, l.error)
@@ -6997,36 +6997,36 @@ Check the information and return the details.
6997
6997
  status: "error",
6998
6998
  message: this.out("Please input a prompt.")
6999
6999
  };
7000
- const u = new FormData();
7001
- u.append("customData", JSON.stringify(this.builder.settings.customData)), u.append("model", o), u.append("prompt", a);
7002
- let d = !1, l = this.builder.getFormValues();
7000
+ const d = new FormData();
7001
+ d.append("customData", JSON.stringify(this.builder.settings.customData)), d.append("model", o), d.append("prompt", a);
7002
+ let u = !1, l = this.builder.getFormValues();
7003
7003
  for (const f of l) {
7004
7004
  if (f.value instanceof FileList && f.type === "multifile") {
7005
7005
  const m = f.value;
7006
7006
  if (m.length > 0)
7007
7007
  for (const y of m)
7008
- u.append("file[]", y), d = !0;
7008
+ d.append("file[]", y), u = !0;
7009
7009
  }
7010
7010
  if (f.value instanceof FileList && f.type === "file") {
7011
7011
  const m = f.value;
7012
7012
  if (m.length > 0) {
7013
7013
  const y = m[0];
7014
- u.append("file[]", y), d = !0;
7014
+ d.append("file[]", y), u = !0;
7015
7015
  }
7016
7016
  }
7017
7017
  if (typeof f.value == "string" && f.value.indexOf("base64") !== -1) {
7018
7018
  let m = f.value.replace(/^data:image\/(png|svg\+xml|jpeg|gif|webp);base64,/, "");
7019
- u.append("mask", m);
7019
+ d.append("mask", m);
7020
7020
  }
7021
7021
  }
7022
7022
  if (this.builder.selectedFiles && this.builder.selectedFiles.length > 0)
7023
7023
  for (let f = 0; f < this.builder.selectedFiles.length; f++) {
7024
7024
  const m = this.builder.selectedFiles[f];
7025
- u.append("file[]", m), d = !0;
7025
+ d.append("file[]", m), u = !0;
7026
7026
  }
7027
7027
  let h, p = e.size || "auto", b = e.quality || "auto", w = e.num_images || 1;
7028
- if (d) {
7029
- u.append("size", p), u.append("n", w), u.append("quality", b), n = {
7028
+ if (u) {
7029
+ d.append("size", p), d.append("n", w), d.append("quality", b), n = {
7030
7030
  prompt: a,
7031
7031
  size: p,
7032
7032
  quality: b,
@@ -7035,7 +7035,7 @@ Check the information and return the details.
7035
7035
  let f = this.builder.settings.generateMediaUrl_OpenAI_CreateImageEdit;
7036
7036
  h = await fetch(f, {
7037
7037
  method: "POST",
7038
- body: u
7038
+ body: d
7039
7039
  });
7040
7040
  } else {
7041
7041
  let f = e.background || "auto", m = e.output_format || "png";
@@ -7087,13 +7087,13 @@ Check the information and return the details.
7087
7087
  status: "error",
7088
7088
  message: this.out("Please input a prompt.")
7089
7089
  };
7090
- let u = [];
7091
- u.push({
7090
+ let d = [];
7091
+ d.push({
7092
7092
  text: a
7093
7093
  });
7094
- let d = this.builder.getFormValues();
7095
- if (!(d && Object.keys(d).length === 0)) {
7096
- for (const g of d)
7094
+ let u = this.builder.getFormValues();
7095
+ if (!(u && Object.keys(u).length === 0)) {
7096
+ for (const g of u)
7097
7097
  if (g.value instanceof FileList && g.type === "multifile") {
7098
7098
  const v = g.value;
7099
7099
  if (v.length > 0)
@@ -7105,7 +7105,7 @@ Check the information and return the details.
7105
7105
  y(E);
7106
7106
  }, x.onerror = k, x.readAsDataURL(f);
7107
7107
  });
7108
- u.push({
7108
+ d.push({
7109
7109
  inlineData: {
7110
7110
  mimeType: "image/png",
7111
7111
  data: m
@@ -7115,7 +7115,7 @@ Check the information and return the details.
7115
7115
  }
7116
7116
  }
7117
7117
  n = {
7118
- contents: u
7118
+ contents: d
7119
7119
  }, s.model = o, s.customData = this.builder.settings.customData, s.payload = n, this.builder.payloads.push(s), this.builder.settings.consoleLog && console.log(s);
7120
7120
  const l = this.builder.settings.generateMediaUrl_Google;
7121
7121
  let h = {
@@ -7580,17 +7580,17 @@ Check the information and return the details.
7580
7580
  status: "error",
7581
7581
  message: this.out("Endpoint not configured: generateMediaUrl_Fal.")
7582
7582
  };
7583
- let u, d = {
7583
+ let d, u = {
7584
7584
  "Content-Type": "application/json",
7585
7585
  ...this.builder.settings.headers
7586
7586
  }, h = await (await fetch(a, {
7587
7587
  signal: this.builder.mediaSignal,
7588
7588
  method: "POST",
7589
- headers: d,
7589
+ headers: u,
7590
7590
  body: JSON.stringify(r)
7591
7591
  })).json();
7592
7592
  if (h.ok)
7593
- u = h.request_id;
7593
+ d = h.request_id;
7594
7594
  else
7595
7595
  return {
7596
7596
  mediaGenerated: !1,
@@ -7598,7 +7598,7 @@ Check the information and return the details.
7598
7598
  message: h.error
7599
7599
  //this.out('Generating video request failed.')
7600
7600
  };
7601
- const p = this.waitingFal(r, u, t, i);
7601
+ const p = this.waitingFal(r, d, t, i);
7602
7602
  return this.builder.isMediaGenerating = !1, p;
7603
7603
  }
7604
7604
  validateModel(e, t, i) {
@@ -7628,14 +7628,14 @@ Check the information and return the details.
7628
7628
  let o = {};
7629
7629
  o.model = r, o.customData = this.builder.settings.customData, o.payload = s, this.builder.payloads.push(o), this.builder.settings.consoleLog && console.log(o);
7630
7630
  const a = this.builder.settings.generateMediaUrl_Google;
7631
- let u = {
7631
+ let d = {
7632
7632
  "Content-Type": "application/json",
7633
7633
  ...this.builder.settings.headers
7634
7634
  };
7635
7635
  const l = await (await fetch(a, {
7636
7636
  signal: this.builder.mediaSignal,
7637
7637
  method: "POST",
7638
- headers: u,
7638
+ headers: d,
7639
7639
  body: JSON.stringify(o)
7640
7640
  })).json();
7641
7641
  this.builder.settings.consoleLog && console.log(l);
@@ -7657,12 +7657,12 @@ Check the information and return the details.
7657
7657
  if (n.name = i.name, n.files = [], this.builder.selectedFiles && this.builder.selectedFiles.length > 0) {
7658
7658
  const r = [];
7659
7659
  for (let o = 0; o < this.builder.selectedFiles.length; o++) {
7660
- const a = this.builder.selectedFiles[o], u = new FormData();
7661
- u.append("file", a), u.append("customData", this.builder.settings.customData);
7662
- let d = this.builder.settings.uploadMediaUrl_Fal;
7663
- const h = await (await fetch(d, {
7660
+ const a = this.builder.selectedFiles[o], d = new FormData();
7661
+ d.append("file", a), d.append("customData", this.builder.settings.customData);
7662
+ let u = this.builder.settings.uploadMediaUrl_Fal;
7663
+ const h = await (await fetch(u, {
7664
7664
  method: "POST",
7665
- body: u
7665
+ body: d
7666
7666
  })).json();
7667
7667
  if (h.ok) {
7668
7668
  const p = h.url;
@@ -7679,8 +7679,8 @@ Check the information and return the details.
7679
7679
  r++;
7680
7680
  const a = new FormData();
7681
7681
  a.append("file", o), a.append("customData", this.builder.settings.customData);
7682
- let u = this.builder.settings.uploadMediaUrl_Fal;
7683
- const l = await (await fetch(u, {
7682
+ let d = this.builder.settings.uploadMediaUrl_Fal;
7683
+ const l = await (await fetch(d, {
7684
7684
  method: "POST",
7685
7685
  body: a
7686
7686
  })).json();
@@ -7698,10 +7698,10 @@ Check the information and return the details.
7698
7698
  if (i = i || this.builder.settings.defaultMediaGenerationProvider, i === "google" && e.trim().startsWith("{"))
7699
7699
  return this.generate_GoogleMediaByJSON(e, t, r, o);
7700
7700
  this.builder.isMediaGenerating = !0, this.mediaController = new AbortController(), this.builder.mediaSignal = this.mediaController.signal;
7701
- let a, u = !1, d;
7701
+ let a, d = !1, u;
7702
7702
  if (e.trim().startsWith("{"))
7703
7703
  try {
7704
- d = JSON.parse(e), d && typeof d == "object" && (u = !0);
7704
+ u = JSON.parse(e), u && typeof u == "object" && (d = !0);
7705
7705
  } catch {
7706
7706
  return {
7707
7707
  mediaGenerated: !1,
@@ -7709,7 +7709,7 @@ Check the information and return the details.
7709
7709
  message: this.out("Incorrect JSON format.")
7710
7710
  };
7711
7711
  }
7712
- if (u) {
7712
+ if (d) {
7713
7713
  let l = t.trim();
7714
7714
  if (!l)
7715
7715
  return {
@@ -7732,7 +7732,7 @@ Check the information and return the details.
7732
7732
  return m;
7733
7733
  };
7734
7734
  return f(g);
7735
- })(d, h), i || (l.startsWith("fal") ? i = "fal" : i = "replicate");
7735
+ })(u, h), i || (l.startsWith("fal") ? i = "fal" : i = "replicate");
7736
7736
  const b = (g) => typeof g == "object" && g !== null && !Array.isArray(g), w = await this.builder.upload.getInputURLs(i);
7737
7737
  if (w.error)
7738
7738
  return {
@@ -7740,22 +7740,22 @@ Check the information and return the details.
7740
7740
  status: "error",
7741
7741
  message: w.error
7742
7742
  };
7743
- Object.keys(d).forEach((g) => {
7743
+ Object.keys(u).forEach((g) => {
7744
7744
  Object.keys(w).forEach((v) => {
7745
- if (d[g] === v) {
7745
+ if (u[g] === v) {
7746
7746
  let f = w[v];
7747
- d[g] = f;
7747
+ u[g] = f;
7748
7748
  }
7749
- if (Array.isArray(d[g])) {
7750
- for (let f = 0; f < d[g].length; f++)
7751
- if (d[g][f] === v) {
7749
+ if (Array.isArray(u[g])) {
7750
+ for (let f = 0; f < u[g].length; f++)
7751
+ if (u[g][f] === v) {
7752
7752
  let m = w[v];
7753
- d[g][f] = m;
7753
+ u[g][f] = m;
7754
7754
  }
7755
7755
  }
7756
7756
  });
7757
- }), Object.keys(d).forEach((g) => {
7758
- let v = d[g];
7757
+ }), Object.keys(u).forEach((g) => {
7758
+ let v = u[g];
7759
7759
  if (b(v))
7760
7760
  for (const f in v)
7761
7761
  Object.prototype.hasOwnProperty.call(v, f) && Object.keys(w).forEach((m) => {
@@ -7774,7 +7774,7 @@ Check the information and return the details.
7774
7774
  v[f][m] = k, y === k && !k.startsWith("http") && (v[f][m] = "");
7775
7775
  }
7776
7776
  });
7777
- d[g] = [...v.filter((f) => f !== "")];
7777
+ u[g] = [...v.filter((f) => f !== "")];
7778
7778
  }
7779
7779
  });
7780
7780
  let _ = {};
@@ -7785,14 +7785,14 @@ Check the information and return the details.
7785
7785
  if (i === "replicate")
7786
7786
  if (l.indexOf(":") !== -1) {
7787
7787
  let g = this.builder.settings.replicateEndpoint1;
7788
- _.endpoint = g, _.payload = d, this.builder.settings.consoleLog && console.log("JSON PAYLOAD 1");
7788
+ _.endpoint = g, _.payload = u, this.builder.settings.consoleLog && console.log("JSON PAYLOAD 1");
7789
7789
  } else {
7790
7790
  let g = this.builder.settings.replicateEndpoint2;
7791
- g = g.replace("{MODEL}", _.model), _.endpoint = g, _.payload = d, this.builder.settings.consoleLog && console.log("JSON PAYLOAD 2");
7791
+ g = g.replace("{MODEL}", _.model), _.endpoint = g, _.payload = u, this.builder.settings.consoleLog && console.log("JSON PAYLOAD 2");
7792
7792
  }
7793
7793
  else if (i === "fal") {
7794
7794
  let g = `https://queue.fal.run/${_.model}`;
7795
- _.endpoint = g, _.payload = d, this.builder.settings.consoleLog && console.log("JSON PAYLOAD");
7795
+ _.endpoint = g, _.payload = u, this.builder.settings.consoleLog && console.log("JSON PAYLOAD");
7796
7796
  }
7797
7797
  return this.builder.payloads.push(_), this.builder.settings.consoleLog && console.log(_), this.generateMediaByJSON(_, i, r, o);
7798
7798
  }
@@ -7913,43 +7913,43 @@ Check the information and return the details.
7913
7913
  "Content-Type": "application/json",
7914
7914
  ...this.builder.settings.headers
7915
7915
  };
7916
- const u = await (await fetch(s, {
7916
+ const d = await (await fetch(s, {
7917
7917
  signal: this.builder.mediaSignal,
7918
7918
  method: "POST",
7919
7919
  headers: o,
7920
7920
  body: JSON.stringify(e)
7921
7921
  })).json();
7922
7922
  if (this.builder.isMediaGenerating = !1, t === "fal") {
7923
- let d = u.request_id;
7924
- return this.waitingFal(e, d, i, n);
7923
+ let u = d.request_id;
7924
+ return this.waitingFal(e, u, i, n);
7925
7925
  }
7926
- if (u.error)
7927
- return this.builder.settings.consoleLog && console.log(u.error), {
7926
+ if (d.error)
7927
+ return this.builder.settings.consoleLog && console.log(d.error), {
7928
7928
  mediaGenerated: !1,
7929
7929
  status: "error",
7930
- message: u.error
7930
+ message: d.error
7931
7931
  //this.out('Request failed.')
7932
7932
  };
7933
7933
  if (r) {
7934
- let d;
7935
- if (u.ok) {
7936
- if (d = u.data.id, !d)
7934
+ let u;
7935
+ if (d.ok) {
7936
+ if (u = d.data.id, !u)
7937
7937
  return {
7938
7938
  mediaGenerated: !1,
7939
7939
  status: "error",
7940
- message: u.data && u.data.detail
7940
+ message: d.data && d.data.detail
7941
7941
  };
7942
7942
  } else
7943
7943
  return {
7944
7944
  mediaGenerated: !1,
7945
7945
  status: "error",
7946
- message: u.error
7946
+ message: d.error
7947
7947
  //this.out('Generating video request failed.')
7948
7948
  };
7949
- return this.waitingReplicate(e, d, i, n);
7949
+ return this.waitingReplicate(e, u, i, n);
7950
7950
  } else {
7951
- const d = u.data;
7952
- let l = this.renderResult(d, i, n);
7951
+ const u = d.data;
7952
+ let l = this.renderResult(u, i, n);
7953
7953
  return {
7954
7954
  mediaGenerated: !0,
7955
7955
  status: "success",
@@ -8084,15 +8084,15 @@ class mn {
8084
8084
  filename: `${e}_${o}.png`,
8085
8085
  // inputName + '.png',
8086
8086
  customData: this.builder.settings.customData
8087
- }, u;
8088
- t === "replicate" ? u = this.builder.settings.uploadBase64Url : t === "fal" ? u = this.builder.settings.uploadBase64Url_Fal : u = this.builder.settings.uploadBase64Url_Fal || this.builder.settings.uploadBase64Url;
8089
- let d = {
8087
+ }, d;
8088
+ t === "replicate" ? d = this.builder.settings.uploadBase64Url : t === "fal" ? d = this.builder.settings.uploadBase64Url_Fal : d = this.builder.settings.uploadBase64Url_Fal || this.builder.settings.uploadBase64Url;
8089
+ let u = {
8090
8090
  "Content-Type": "application/json",
8091
8091
  ...this.builder.settings.headers
8092
- }, h = await (await fetch(u, {
8092
+ }, h = await (await fetch(d, {
8093
8093
  signal: this.builder.mediaSignal,
8094
8094
  method: "POST",
8095
- headers: d,
8095
+ headers: u,
8096
8096
  body: JSON.stringify(a)
8097
8097
  })).json();
8098
8098
  return h.ok && (r = h.url), r ? {
@@ -8116,11 +8116,11 @@ class mn {
8116
8116
  o.append("file", this.builder.photoBlob[e], `photo_${r}.jpg`), o.append("customData", this.builder.settings.customData);
8117
8117
  let a;
8118
8118
  t === "replicate" ? a = this.builder.settings.uploadMediaUrl : t === "fal" ? a = this.builder.settings.uploadMediaUrl_Fal : a = this.builder.settings.uploadMediaUrl_Fal || this.builder.settings.uploadMediaUrl;
8119
- const d = await (await fetch(a, {
8119
+ const u = await (await fetch(a, {
8120
8120
  method: "POST",
8121
8121
  body: o
8122
8122
  })).json();
8123
- return d.ok ? (s = d.url, n = d.filename, {
8123
+ return u.ok ? (s = u.url, n = u.filename, {
8124
8124
  filename: n,
8125
8125
  url: s
8126
8126
  }) : {
@@ -8132,11 +8132,11 @@ class mn {
8132
8132
  r.append("file", this.builder.selectedFiles[0]), r.append("customData", this.builder.settings.customData);
8133
8133
  let o;
8134
8134
  t === "replicate" ? o = this.builder.settings.uploadMediaUrl : t === "fal" ? o = this.builder.settings.uploadMediaUrl_Fal : o = this.builder.settings.uploadMediaUrl_Fal || this.builder.settings.uploadMediaUrl;
8135
- const u = await (await fetch(o, {
8135
+ const d = await (await fetch(o, {
8136
8136
  method: "POST",
8137
8137
  body: r
8138
8138
  })).json();
8139
- return u.ok ? (s = u.url, n = u.filename, {
8139
+ return d.ok ? (s = d.url, n = d.filename, {
8140
8140
  filename: n,
8141
8141
  url: s
8142
8142
  }) : {
@@ -8151,12 +8151,12 @@ class mn {
8151
8151
  o.append("file", r), o.append("customData", this.builder.settings.customData);
8152
8152
  let a;
8153
8153
  t === "replicate" ? a = this.builder.settings.uploadMediaUrl : t === "fal" ? a = this.builder.settings.uploadMediaUrl_Fal : a = this.builder.settings.uploadMediaUrl_Fal || this.builder.settings.uploadMediaUrl;
8154
- const d = await (await fetch(a, {
8154
+ const u = await (await fetch(a, {
8155
8155
  method: "POST",
8156
8156
  body: o
8157
8157
  })).json();
8158
- if (d.ok)
8159
- s = d.url, n = d.filename;
8158
+ if (u.ok)
8159
+ s = u.url, n = u.filename;
8160
8160
  else
8161
8161
  return {
8162
8162
  error: this.out("Upload file failed.")
@@ -8245,22 +8245,22 @@ class bn {
8245
8245
  const o = document.createElement("label");
8246
8246
  r.appendChild(o), o.innerHTML = `${this.out("Brush Size")}:
8247
8247
  <input type="range" class="brush-size" min="5" max="100" value="30">`;
8248
- const a = o.querySelector(".brush-size"), u = document.createElement("button");
8249
- u.className = "btn-undobrush", u.title = this.out("Undo"), u.innerHTML = `
8248
+ const a = o.querySelector(".brush-size"), d = document.createElement("button");
8249
+ d.className = "btn-undobrush", d.title = this.out("Undo"), d.innerHTML = `
8250
8250
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
8251
8251
  class="icon-undo">
8252
8252
  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
8253
8253
  <path d="M9 14l-4 -4l4 -4"></path>
8254
8254
  <path d="M5 10h11a4 4 0 1 1 0 8h-1"></path>
8255
- </svg>`, r.appendChild(u);
8256
- const d = document.createElement("button");
8257
- d.className = "btn-redobrush", d.title = this.out("Redo"), d.innerHTML = `
8255
+ </svg>`, r.appendChild(d);
8256
+ const u = document.createElement("button");
8257
+ u.className = "btn-redobrush", u.title = this.out("Redo"), u.innerHTML = `
8258
8258
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
8259
8259
  class="icon-redo">
8260
8260
  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
8261
8261
  <path d="M15 14l4 -4l-4 -4"></path>
8262
8262
  <path d="M19 10h-11a4 4 0 1 0 0 8h1"></path>
8263
- </svg>`, r.appendChild(d);
8263
+ </svg>`, r.appendChild(u);
8264
8264
  const l = document.createElement("button");
8265
8265
  l.className = "btn-clearbrush", l.title = this.out("Clear"), l.innerHTML = `
8266
8266
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
@@ -8308,9 +8308,9 @@ class bn {
8308
8308
  };
8309
8309
  b.addEventListener("mousedown", () => {
8310
8310
  k();
8311
- }), u.addEventListener("click", (T) => {
8312
- T.preventDefault(), m.length > 0 && (y.push(b.toDataURL()), x(m.pop()));
8313
8311
  }), d.addEventListener("click", (T) => {
8312
+ T.preventDefault(), m.length > 0 && (y.push(b.toDataURL()), x(m.pop()));
8313
+ }), u.addEventListener("click", (T) => {
8314
8314
  T.preventDefault(), y.length > 0 && (m.push(b.toDataURL()), x(y.pop()));
8315
8315
  });
8316
8316
  const S = document.createElement("img");
@@ -8599,19 +8599,19 @@ class yn {
8599
8599
  }
8600
8600
  }, a = document.createElement("div");
8601
8601
  a.className = "app-filters", e.appendChild(a);
8602
- const u = document.createElement("ul");
8603
- u.className = "app-list", e.appendChild(u);
8604
- const d = (l) => {
8602
+ const d = document.createElement("ul");
8603
+ d.className = "app-list", e.appendChild(d);
8604
+ const u = (l) => {
8605
8605
  let h = n.filter((b) => l === "all" || b.categories.includes(l));
8606
8606
  const p = this.settings.templateOutput || ["image", "video", "audio", "text"];
8607
- h = h.filter((b) => b.categories.every((w) => p.includes(w))), this.renderList(h, u);
8607
+ h = h.filter((b) => b.categories.every((w) => p.includes(w))), this.renderList(h, d);
8608
8608
  };
8609
8609
  r.forEach((l) => {
8610
8610
  const h = document.createElement("button");
8611
8611
  h.textContent = o[l].desc, h.setAttribute("data-value", l), l === "all" && h.classList.add("active"), h.addEventListener("click", () => {
8612
- a.querySelectorAll("button").forEach((b) => b.classList.remove("active")), h.classList.add("active"), d(l);
8612
+ a.querySelectorAll("button").forEach((b) => b.classList.remove("active")), h.classList.add("active"), u(l);
8613
8613
  }), a.appendChild(h);
8614
- }), d("all");
8614
+ }), u("all");
8615
8615
  }
8616
8616
  }
8617
8617
  //NEW
@@ -8627,7 +8627,7 @@ class yn {
8627
8627
  const r = await (await fetch(n)).blob(), o = new File([r], e.split("/").pop(), {
8628
8628
  type: r.type
8629
8629
  });
8630
- this.element.querySelector(".div-selected-preview") || (this.selectedFiles = []), i && i.hasAttribute("multiple") ? this.selectedFiles.some((d) => d.name === o.name) || this.selectedFiles.push(o) : this.selectedFiles = [o], this.setSelectedFiles(this.selectedFiles), this.renderSelectedFiles(), t.closest(".image-mask") && this.objImageMask && this.objImageMask.loadImage(o);
8630
+ this.element.querySelector(".div-selected-preview") || (this.selectedFiles = []), i && i.hasAttribute("multiple") ? this.selectedFiles.some((u) => u.name === o.name) || this.selectedFiles.push(o) : this.selectedFiles = [o], this.setSelectedFiles(this.selectedFiles), this.renderSelectedFiles(), t.closest(".image-mask") && this.objImageMask && this.objImageMask.loadImage(o);
8631
8631
  }
8632
8632
  setSelectedFiles(e) {
8633
8633
  this.selectedFiles = e;
@@ -8695,22 +8695,22 @@ class yn {
8695
8695
  let h = r + o;
8696
8696
  a = `<img class="thumbnail" src="${h}" alt="${i.name}" />`, i.form.thumbnailFit && (a = `<img class="thumbnail" style="object-fit:${i.form.thumbnailFit}" src="${h}" alt="${i.name}" />`);
8697
8697
  }
8698
- const u = document.createElement("div");
8699
- u.className = "div-template-buttons";
8700
- let d = !1, l = !1;
8698
+ const d = document.createElement("div");
8699
+ d.className = "div-template-buttons";
8700
+ let u = !1, l = !1;
8701
8701
  if (this.settings.templateButtons && this.settings.templateButtons.viewButton && this.settings.templateButtons.viewButton.text) {
8702
8702
  const h = document.createElement("button");
8703
- h.className = "btn-template-view", h.innerText = this.out(this.settings.templateButtons.viewButton.text), u.appendChild(h), h.addEventListener("click", (p) => {
8703
+ h.className = "btn-template-view", h.innerText = this.out(this.settings.templateButtons.viewButton.text), d.appendChild(h), h.addEventListener("click", (p) => {
8704
8704
  if (p.preventDefault(), this.isGenerating) {
8705
8705
  alert(this.out("Please wait until generation is complete."));
8706
8706
  return;
8707
8707
  }
8708
8708
  this.settings.onSelectTemplate && this.settings.onSelectTemplate(i), this.trigger("templateView", i);
8709
- }), d = !0;
8709
+ }), u = !0;
8710
8710
  }
8711
8711
  if (this.settings.templateButtons && this.settings.templateButtons.useButton && this.settings.templateButtons.useButton.text) {
8712
8712
  const h = document.createElement("button");
8713
- h.className = "btn-template-use", h.innerText = this.out(this.settings.templateButtons.useButton.text), u.appendChild(h), h.addEventListener("click", (p) => {
8713
+ h.className = "btn-template-use", h.innerText = this.out(this.settings.templateButtons.useButton.text), d.appendChild(h), h.addEventListener("click", (p) => {
8714
8714
  p.preventDefault(), this.settings.onSelectTemplate && this.settings.onSelectTemplate(i), this.trigger("templateUse", i);
8715
8715
  }), l = !0;
8716
8716
  }
@@ -8721,7 +8721,7 @@ class yn {
8721
8721
  <div class="description">${i.form.description}</div>
8722
8722
  ${i.info ? ` <div class="info mt-1">${i.info}</div>` : ""}
8723
8723
  </div>
8724
- `, d || l ? (s.querySelector(".card-text").appendChild(u), s.classList.remove("cursor-pointer"), s.classList.add("cursor-default")) : (s.classList.add("cursor-pointer"), s.classList.remove("cursor-default")), n.appendChild(s), d || l || s.addEventListener("click", (h) => {
8724
+ `, u || l ? (s.querySelector(".card-text").appendChild(d), s.classList.remove("cursor-pointer"), s.classList.add("cursor-default")) : (s.classList.add("cursor-pointer"), s.classList.remove("cursor-default")), n.appendChild(s), u || l || s.addEventListener("click", (h) => {
8725
8725
  if (h.preventDefault(), this.isGenerating) {
8726
8726
  alert(this.out("Please wait until generation is complete."));
8727
8727
  return;
@@ -8741,35 +8741,35 @@ class yn {
8741
8741
  });
8742
8742
  let o = !1;
8743
8743
  n.body.innerText.trim() === "" && (o = !0);
8744
- const u = document.createElement("div");
8745
- u.className = "result-tool", e.appendChild(u);
8746
- const d = document.createElement("button");
8747
- d.className = "btn-result-tool", d.innerHTML = `
8744
+ const d = document.createElement("div");
8745
+ d.className = "result-tool", e.appendChild(d);
8746
+ const u = document.createElement("button");
8747
+ u.className = "btn-result-tool", u.innerHTML = `
8748
8748
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">
8749
8749
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" />
8750
8750
  </svg>
8751
8751
  <span>${this.out("Copy")}</span>
8752
- `, o || u.appendChild(d);
8752
+ `, o || d.appendChild(u);
8753
8753
  const l = document.createElement("button");
8754
8754
  l.className = "btn-result-tool", l.innerHTML = `
8755
8755
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">
8756
8756
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 7l16 0" /><path d="M10 11l0 6" /><path d="M14 11l0 6" /><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12" /><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3" />
8757
8757
  </svg>
8758
8758
  <span>${this.out("Clear")}</span>
8759
- `, u.appendChild(l), d && d.addEventListener("click", (h) => {
8759
+ `, d.appendChild(l), u && u.addEventListener("click", (h) => {
8760
8760
  h.preventDefault();
8761
8761
  const p = e.cloneNode(!0), b = p.querySelector(".result-tool");
8762
8762
  b && b.remove(), p.querySelectorAll(".link-view, .link-download").forEach((g) => {
8763
8763
  g.remove();
8764
8764
  }), p.style.position = "fixed", p.style.left = "-9999px", document.body.appendChild(p);
8765
8765
  const _ = p.innerText.trim();
8766
- document.body.removeChild(p), navigator.clipboard.writeText(_), d.innerHTML = `
8766
+ document.body.removeChild(p), navigator.clipboard.writeText(_), u.innerHTML = `
8767
8767
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">
8768
8768
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path stroke="none" d="M0 0h24v24H0z" /><path d="M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2 2 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" /><path d="M11 14l2 2l4 -4" />
8769
8769
  </svg>
8770
8770
  <span>${this.out("Copied")}</span>
8771
8771
  `, setTimeout(() => {
8772
- d.innerHTML = `
8772
+ u.innerHTML = `
8773
8773
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round">
8774
8774
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" />
8775
8775
  </svg>
@@ -8818,8 +8818,8 @@ class yn {
8818
8818
  r && clearTimeout(r), r = setTimeout(() => {
8819
8819
  let o = null;
8820
8820
  const a = () => {
8821
- const u = e.offsetTop;
8822
- u === o ? (n(), s()) : (o = u, requestAnimationFrame(a));
8821
+ const d = e.offsetTop;
8822
+ d === o ? (n(), s()) : (o = d, requestAnimationFrame(a));
8823
8823
  };
8824
8824
  a();
8825
8825
  }, 200);
@@ -9658,34 +9658,34 @@ class yn {
9658
9658
  });
9659
9659
  }
9660
9660
  }
9661
- let u, d;
9662
- this.settings.resultSelector && (u = document.querySelector(this.settings.resultSelector), u.classList.add("result-wrapper"), u.innerHTML = "", d = document.createElement("div"), d.classList.add("result-container"), u.appendChild(d)), t.elements && u && t.elements.forEach((l) => {
9661
+ let d, u;
9662
+ this.settings.resultSelector && (d = document.querySelector(this.settings.resultSelector), d.classList.add("result-wrapper"), d.innerHTML = "", u = document.createElement("div"), u.classList.add("result-container"), d.appendChild(u)), t.elements && d && t.elements.forEach((l) => {
9663
9663
  if (l.displayInOutput) {
9664
9664
  if (l.type === "spacer") {
9665
9665
  const p = document.createElement("div");
9666
- p.className = "form-spacer", l.spacerHeight && !isNaN(parseFloat(l.spacerHeight)) && (p.style.height = l.spacerHeight + "px"), d.appendChild(p);
9666
+ p.className = "form-spacer", l.spacerHeight && !isNaN(parseFloat(l.spacerHeight)) && (p.style.height = l.spacerHeight + "px"), u.appendChild(p);
9667
9667
  return;
9668
9668
  }
9669
9669
  if (l.type === "separator") {
9670
9670
  const p = document.createElement("hr");
9671
- p.style.borderTopColor = l.color, d.appendChild(p);
9671
+ p.style.borderTopColor = l.color, u.appendChild(p);
9672
9672
  return;
9673
9673
  }
9674
9674
  if (l.type === "html") {
9675
9675
  if (l.html) {
9676
9676
  const p = document.createElement("div");
9677
- p.innerHTML = l.html, d.appendChild(p);
9677
+ p.innerHTML = l.html, u.appendChild(p);
9678
9678
  }
9679
9679
  return;
9680
9680
  }
9681
9681
  if (l.type === "heading") {
9682
9682
  const p = document.createElement(l.heading || "h2");
9683
- p.innerHTML = l.headingText || this.out("Your Heading Here!"), d.appendChild(p);
9683
+ p.innerHTML = l.headingText || this.out("Your Heading Here!"), u.appendChild(p);
9684
9684
  return;
9685
9685
  }
9686
9686
  if (l.type === "paragraph") {
9687
9687
  const p = document.createElement("p");
9688
- p.innerHTML = l.paragraphText || this.out("Your paragraph content here!"), d.appendChild(p);
9688
+ p.innerHTML = l.paragraphText || this.out("Your paragraph content here!"), u.appendChild(p);
9689
9689
  return;
9690
9690
  }
9691
9691
  if (l.type === "media") {
@@ -9693,35 +9693,35 @@ class yn {
9693
9693
  const p = document.createElement("video");
9694
9694
  p.style.width = "100%", p.style.height = "auto", p.controls = !0;
9695
9695
  var h = document.createElement("source");
9696
- h.src = l.url, h.type = "video/mp4", p.appendChild(h), d.appendChild(p);
9696
+ h.src = l.url, h.type = "video/mp4", p.appendChild(h), u.appendChild(p);
9697
9697
  } else if (l.tag === "audio") {
9698
9698
  const p = document.createElement("audio");
9699
9699
  p.controls = !0;
9700
9700
  let b = document.createElement("source");
9701
- b.src = l.url, b.type = "audio/mp3", p.appendChild(b), d.appendChild(p);
9701
+ b.src = l.url, b.type = "audio/mp3", p.appendChild(b), u.appendChild(p);
9702
9702
  } else if (l.tag === "img") {
9703
9703
  const p = document.createElement("img");
9704
- p.src = l.url, p.setAttribute("alt", this.out("Output Image")), d.appendChild(p);
9704
+ p.src = l.url, p.setAttribute("alt", this.out("Output Image")), u.appendChild(p);
9705
9705
  }
9706
9706
  return;
9707
9707
  }
9708
9708
  if (l.type === "image") {
9709
9709
  const p = document.createElement("img");
9710
- p.src = l.url, p.setAttribute("alt", this.out("Output Image")), d.appendChild(p);
9710
+ p.src = l.url, p.setAttribute("alt", this.out("Output Image")), u.appendChild(p);
9711
9711
  return;
9712
9712
  }
9713
9713
  if (l.type === "video") {
9714
9714
  const p = document.createElement("video");
9715
9715
  p.style.width = "100%", p.style.height = "auto", p.controls = !0;
9716
9716
  let b = document.createElement("source");
9717
- b.src = l.url, b.type = "video/mp4", p.appendChild(b), d.appendChild(p);
9717
+ b.src = l.url, b.type = "video/mp4", p.appendChild(b), u.appendChild(p);
9718
9718
  return;
9719
9719
  }
9720
9720
  if (l.type === "audio") {
9721
9721
  const p = document.createElement("audio");
9722
9722
  p.controls = !0;
9723
9723
  let b = document.createElement("source");
9724
- b.src = l.url, b.type = "audio/mp3", p.appendChild(b), d.appendChild(p);
9724
+ b.src = l.url, b.type = "audio/mp3", p.appendChild(b), u.appendChild(p);
9725
9725
  return;
9726
9726
  }
9727
9727
  }
@@ -9733,15 +9733,15 @@ class yn {
9733
9733
  let s = localStorage.getItem("_results_html");
9734
9734
  const r = document.querySelector(this.settings.resultSelector);
9735
9735
  r.innerHTML = s, this.addResultTool(), r.querySelectorAll(".link-download").forEach((a) => {
9736
- a.addEventListener("click", async (u) => {
9737
- u.preventDefault();
9738
- const d = u.target.href;
9736
+ a.addEventListener("click", async (d) => {
9737
+ d.preventDefault();
9738
+ const u = d.target.href;
9739
9739
  try {
9740
- const l = await fetch(d, {
9740
+ const l = await fetch(u, {
9741
9741
  mode: "cors"
9742
9742
  });
9743
9743
  if (!l.ok) throw new Error("Failed to fetch the image.");
9744
- const h = await l.blob(), p = d.substring(d.lastIndexOf("/") + 1), b = document.createElement("a");
9744
+ const h = await l.blob(), p = u.substring(u.lastIndexOf("/") + 1), b = document.createElement("a");
9745
9745
  b.href = URL.createObjectURL(h), b.download = p, b.click(), URL.revokeObjectURL(b.href);
9746
9746
  } catch (l) {
9747
9747
  console.error("Error downloading the image:", l);
@@ -9816,15 +9816,15 @@ class yn {
9816
9816
  let r = [], o = [];
9817
9817
  if (this.settings.scrapeProvider === "firecrawl" && s.forEach((a) => {
9818
9818
  if (a.success) {
9819
- const u = a.metadata.title, d = a.markdown, l = a.metadata.url;
9819
+ const d = a.metadata.title, u = a.markdown, l = a.metadata.url;
9820
9820
  r.push(l), n += `
9821
9821
 
9822
9822
 
9823
- ## ${u}
9823
+ ## ${d}
9824
9824
 
9825
9825
  Source: ${l}
9826
9826
 
9827
- ${d}
9827
+ ${u}
9828
9828
 
9829
9829
 
9830
9830
  ----------------
@@ -9832,24 +9832,24 @@ class yn {
9832
9832
 
9833
9833
  `;
9834
9834
  } else {
9835
- let u = a.url;
9836
- if (u) {
9837
- const d = a.url;
9838
- o.push(d);
9835
+ let d = a.url;
9836
+ if (d) {
9837
+ const u = a.url;
9838
+ o.push(u);
9839
9839
  } else
9840
- u = a.url.link, o.push(u);
9840
+ d = a.url.link, o.push(d);
9841
9841
  }
9842
9842
  }), this.settings.scrapeProvider === "scrapingbee")
9843
9843
  for (let a = 0; a < s.length; a++) {
9844
- let u = e[a];
9845
- r.push(u);
9846
- let d = s[a];
9844
+ let d = e[a];
9845
+ r.push(d);
9846
+ let u = s[a];
9847
9847
  n += `
9848
9848
 
9849
9849
 
9850
- ## ${u}
9850
+ ## ${d}
9851
9851
 
9852
- ${d}
9852
+ ${u}
9853
9853
 
9854
9854
 
9855
9855
  ----------------
@@ -9939,26 +9939,26 @@ ${e}`);
9939
9939
  this.settings.consoleLog && console.log(r);
9940
9940
  let o = [], a = [];
9941
9941
  if (r.url && r.needscrape && this.settings.scrapeUrl) {
9942
- let u = document.createElement("p");
9943
- u.innerHTML = this.out("Fetching data from the web..."), n.appendChild(u);
9944
- let d = [];
9945
- r.url && d.push(r.url), r.url2 && d.push(r.url2), r.url3 && d.push(r.url3), r.url4 && d.push(r.url4), r.url5 && d.push(r.url5), r.url6 && d.push(r.url6), r.url7 && d.push(r.url7), r.url8 && d.push(r.url8);
9946
- let l = await this.scrapeUrls(d);
9942
+ let d = document.createElement("p");
9943
+ d.innerHTML = this.out("Fetching data from the web..."), n.appendChild(d);
9944
+ let u = [];
9945
+ r.url && u.push(r.url), r.url2 && u.push(r.url2), r.url3 && u.push(r.url3), r.url4 && u.push(r.url4), r.url5 && u.push(r.url5), r.url6 && u.push(r.url6), r.url7 && u.push(r.url7), r.url8 && u.push(r.url8);
9946
+ let l = await this.scrapeUrls(u);
9947
9947
  s += l.data, o = l.urls, a = l.failed;
9948
9948
  } else if (this.settings.searchUrl && this.settings.scrapeUrl) {
9949
- let u = document.createElement("p");
9950
- u.innerHTML = this.out("Searching the web.."), n.appendChild(u);
9951
- let d = await this.search(e);
9949
+ let d = document.createElement("p");
9950
+ d.innerHTML = this.out("Searching the web.."), n.appendChild(d);
9951
+ let u = await this.search(e);
9952
9952
  const l = this.settings.scrapeExclude;
9953
- let h = d.filter((g) => {
9953
+ let h = u.filter((g) => {
9954
9954
  let v = new URL(g.link).hostname;
9955
9955
  return !l.some((f) => v.includes(f));
9956
9956
  });
9957
9957
  const p = this.settings.scrapeLimit, b = h.slice(0, p);
9958
- n.innerHTML = "", u = document.createElement("p"), u.innerHTML = this.out("Getting more information..."), n.appendChild(u);
9958
+ n.innerHTML = "", d = document.createElement("p"), d.innerHTML = this.out("Getting more information..."), n.appendChild(d);
9959
9959
  let w = [];
9960
9960
  for (let g = 0; g < b.length; g++)
9961
- w.push(d[g].link);
9961
+ w.push(u[g].link);
9962
9962
  let _ = await this.scrapeUrls(w);
9963
9963
  s += _.data, o = _.urls, a = _.failed;
9964
9964
  }
@@ -10062,8 +10062,8 @@ ${e}`);
10062
10062
  r = this.element;
10063
10063
  let o = r.querySelector(".btn-submitform"), a = o.innerHTML;
10064
10064
  this.tokenInput = 0, this.tokenOutput = 0;
10065
- let u = !1;
10066
- if (e != null && (u = !0), this.singleStep = u, u || (this.filesUploaded = {}), this.isNormal && !u) {
10065
+ let d = !1;
10066
+ if (e != null && (d = !0), this.singleStep = d, d || (this.filesUploaded = {}), this.isNormal && !d) {
10067
10067
  if (this.isMediaGenerating) {
10068
10068
  alert(this.out("The media generation process cannot be aborted."));
10069
10069
  return;
@@ -10071,9 +10071,9 @@ ${e}`);
10071
10071
  this.abort(), o.innerHTML = a, o.removeAttribute("disabled"), this.isGenerating = !1;
10072
10072
  return;
10073
10073
  }
10074
- if (this.isNormal && u || this.isSingle && !u || this.isSingle && u)
10074
+ if (this.isNormal && d || this.isSingle && !d || this.isSingle && d)
10075
10075
  return;
10076
- this.isNormal = !1, this.isSingle = !1, u ? (o.innerHTML = `
10076
+ this.isNormal = !1, this.isSingle = !1, d ? (o.innerHTML = `
10077
10077
  <span class="loading-icon">
10078
10078
  <svg class="animate-spin" style="margin: 0;margin-right: 0.6rem;width: 1rem;height: 1rem;" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
10079
10079
  <circle style="opacity: 0.25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
@@ -10089,7 +10089,7 @@ ${e}`);
10089
10089
  </span>
10090
10090
  ${this.out("Abort")}
10091
10091
  `, this.isNormal = !0), this.isGenerating = !0;
10092
- let d = (m, y) => {
10092
+ let u = (m, y) => {
10093
10093
  if (m === void 0) return "";
10094
10094
  if (!isNaN(m)) return m;
10095
10095
  let k = m;
@@ -10124,7 +10124,7 @@ ${e}`);
10124
10124
  if (k.value === void 0 && (k.value = ""), typeof k.value == "object" && Array.isArray(k.value)) {
10125
10125
  const x = k.value.join(", ");
10126
10126
  y = y.replaceAll(`{{${k.name}}}`, x), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, x);
10127
- } else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (y = y.replaceAll(`{{${k.name}}}`, k.name), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, k.name)) : (y = y.replaceAll(`{{${k.name}}}`, d(k.value, m.prompt)), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, d(k.value, m.prompt)));
10127
+ } else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (y = y.replaceAll(`{{${k.name}}}`, k.name), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, k.name)) : (y = y.replaceAll(`{{${k.name}}}`, u(k.value, m.prompt)), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, u(k.value, m.prompt)));
10128
10128
  }), m.prompt = y;
10129
10129
  }), l.forEach((m) => {
10130
10130
  let y = m.context;
@@ -10132,7 +10132,7 @@ ${e}`);
10132
10132
  if (k.value || (k.value = ""), typeof k.value == "object" && Array.isArray(k.value)) {
10133
10133
  const x = k.value.join(", ");
10134
10134
  y = y.replaceAll(`{{${k.name}}}`, x), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, x);
10135
- } else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (y = y.replaceAll(`{{${k.name}}}`, k.name), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, k.name)) : (y = y.replaceAll(`{{${k.name}}}`, d(k.value, m.prompt)), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, d(k.value, m.prompt)));
10135
+ } else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (y = y.replaceAll(`{{${k.name}}}`, k.name), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, k.name)) : (y = y.replaceAll(`{{${k.name}}}`, u(k.value, m.prompt)), y = y.replaceAll(`{{${k.name.toUpperCase()}}}`, u(k.value, m.prompt)));
10136
10136
  }), m.context = y;
10137
10137
  });
10138
10138
  }
@@ -10158,7 +10158,7 @@ ${e}`);
10158
10158
  } catch {
10159
10159
  return L.innerHTML = `<p>${this.out("Incorrect JSON format.")}</p>`, !1;
10160
10160
  }
10161
- (C && (C.image || C.video || C.audio) || D) && (u || (o.innerHTML = `&nbsp;
10161
+ (C && (C.image || C.video || C.audio) || D) && (d || (o.innerHTML = `&nbsp;
10162
10162
  <span class="loading-icon" style="width:60px;display:flex;align-items:center;justify-content:center">
10163
10163
  <svg class="animate-spin" style="margin: 0;width: 1.25rem;height: 1.25rem;" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
10164
10164
  <circle style="opacity: 0.25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
@@ -10257,7 +10257,7 @@ ${q.data}
10257
10257
  markdown: O
10258
10258
  };
10259
10259
  };
10260
- u || await (async (m) => {
10260
+ d || await (async (m) => {
10261
10261
  this.previousResults = [], this.outputHtml = "";
10262
10262
  for (let y = 0; y < m.length; y++) {
10263
10263
  if (!this.isGenerating)
@@ -10276,10 +10276,10 @@ ${q.data}
10276
10276
  let I = k;
10277
10277
  this.previousResults.forEach((R, q) => {
10278
10278
  const M = `{{output_step_${q + 1}}}`;
10279
- I = I.replace(new RegExp(M, "g"), d(R, k)), I = I.replace(new RegExp(M.toUpperCase(), "g"), d(R, k));
10279
+ I = I.replace(new RegExp(M, "g"), u(R, k)), I = I.replace(new RegExp(M.toUpperCase(), "g"), u(R, k));
10280
10280
  }), k = I, k = k.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g, " ").trim(), this.settings.consoleLog && console.log(k), I = x, this.previousResults.forEach((R, q) => {
10281
10281
  const M = `{{output_step_${q + 1}}}`;
10282
- I = I.replace(new RegExp(M, "g"), d(R, k)), I = I.replace(new RegExp(M.toUpperCase(), "g"), d(R, k));
10282
+ I = I.replace(new RegExp(M, "g"), u(R, k)), I = I.replace(new RegExp(M.toUpperCase(), "g"), u(R, k));
10283
10283
  }), x = I, x = x.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g, " ").trim();
10284
10284
  let O = await p(k, x, S, E, C, A, L, D);
10285
10285
  if (!O)
@@ -10290,7 +10290,7 @@ ${q.data}
10290
10290
  } else
10291
10291
  this.previousResults.push(O.markdown);
10292
10292
  }
10293
- })(l), u && (e === 0 && (this.previousResults = []), await (async (y, k) => {
10293
+ })(l), d && (e === 0 && (this.previousResults = []), await (async (y, k) => {
10294
10294
  if (!this.isGenerating)
10295
10295
  return;
10296
10296
  let {
@@ -10406,66 +10406,66 @@ ${q.data}
10406
10406
  let {
10407
10407
  name: o,
10408
10408
  type: a,
10409
- value: u,
10410
- checked: d,
10409
+ value: d,
10410
+ checked: u,
10411
10411
  files: l
10412
10412
  } = r;
10413
10413
  if (a === "checkbox")
10414
- o = o.replace("[]", ""), d && (i[o] = i[o] || [], u === "other" && (u = e.querySelector(`[name="${o + "_other"}"]`).value), i[o].push(u));
10414
+ o = o.replace("[]", ""), u && (i[o] = i[o] || [], d === "other" && (d = e.querySelector(`[name="${o + "_other"}"]`).value), i[o].push(d));
10415
10415
  else if (a === "radio")
10416
- d && (u === "other" && (u = e.querySelector(`[name="${o + "_other"}"]`).value), i[o] = u);
10416
+ u && (d === "other" && (d = e.querySelector(`[name="${o + "_other"}"]`).value), i[o] = d);
10417
10417
  else if (a === "select-one")
10418
- u === "other" && (u = e.querySelector(`[name="${o + "_other"}"]`).value), i[o] = u;
10418
+ d === "other" && (d = e.querySelector(`[name="${o + "_other"}"]`).value), i[o] = d;
10419
10419
  else if (a === "file")
10420
10420
  i[o] = l;
10421
10421
  else if (a === "select-multiple") {
10422
10422
  const h = Array.from(r.selectedOptions);
10423
10423
  i[o] = h.map((p) => p.value);
10424
10424
  } else if (a === "color") {
10425
- i[o] = u;
10426
- const h = this.hexToRgb(u);
10425
+ i[o] = d;
10426
+ const h = this.hexToRgb(d);
10427
10427
  i[o + "_red"] = h.red, i[o + "_green"] = h.green, i[o + "_blue"] = h.blue;
10428
10428
  } else
10429
- i[o] = u;
10429
+ i[o] = d;
10430
10430
  });
10431
10431
  let n = [];
10432
10432
  return this.json.elements.forEach((r) => {
10433
- let o = r.title, a = r.name, u = r.type;
10433
+ let o = r.title, a = r.name, d = r.type;
10434
10434
  if (a === "") return;
10435
- let d = i[a], l = {
10435
+ let u = i[a], l = {
10436
10436
  questions: o,
10437
10437
  name: a,
10438
- value: d,
10439
- type: u
10438
+ value: u,
10439
+ type: d
10440
10440
  };
10441
10441
  n.push(l);
10442
10442
  let h = a + "__url";
10443
- d = i[h], d && (l = {
10443
+ u = i[h], u && (l = {
10444
10444
  questions: o,
10445
10445
  name: h,
10446
- value: d
10447
- }, n.push(l)), r.useImageMask && (a = a + "_mask", d = i[a], l = {
10446
+ value: u
10447
+ }, n.push(l)), r.useImageMask && (a = a + "_mask", u = i[a], l = {
10448
10448
  questions: o,
10449
10449
  name: a,
10450
- value: d
10450
+ value: u
10451
10451
  }, n.push(l));
10452
10452
  let p = a + "_red";
10453
- d = i[p], d !== void 0 && (l = {
10453
+ u = i[p], u !== void 0 && (l = {
10454
10454
  questions: o,
10455
10455
  name: p,
10456
- value: d
10456
+ value: u
10457
10457
  }, n.push(l));
10458
10458
  let b = a + "_green";
10459
- d = i[b], d !== void 0 && (l = {
10459
+ u = i[b], u !== void 0 && (l = {
10460
10460
  questions: o,
10461
10461
  name: b,
10462
- value: d
10462
+ value: u
10463
10463
  }, n.push(l));
10464
10464
  let w = a + "_blue";
10465
- d = i[w], d !== void 0 && (l = {
10465
+ u = i[w], u !== void 0 && (l = {
10466
10466
  questions: o,
10467
10467
  name: w,
10468
- value: d
10468
+ value: u
10469
10469
  }, n.push(l));
10470
10470
  }), this.settings.consoleLog && console.log(n), n;
10471
10471
  }
@@ -10487,7 +10487,7 @@ ${q.data}
10487
10487
  this.controller = new AbortController(), this.signal = this.controller.signal;
10488
10488
  let r = 0.6, o = 0.9, a = 1;
10489
10489
  s || (s = []), n = n || this.settings.model, s.length > 0 && (n = this.settings.model2);
10490
- const u = {
10490
+ const d = {
10491
10491
  question: e,
10492
10492
  context: t,
10493
10493
  system: i,
@@ -10499,15 +10499,15 @@ ${q.data}
10499
10499
  customData: this.settings.customData
10500
10500
  };
10501
10501
  try {
10502
- let d = {
10502
+ let u = {
10503
10503
  "Content-Type": "application/json",
10504
10504
  ...this.settings.headers
10505
10505
  }, h = await (await fetch(this.settings.sendCommandUrl, {
10506
10506
  signal: this.signal,
10507
10507
  // Abort
10508
10508
  method: "POST",
10509
- headers: d,
10510
- body: JSON.stringify(u)
10509
+ headers: u,
10510
+ body: JSON.stringify(d)
10511
10511
  })).json();
10512
10512
  if (h.error)
10513
10513
  return console.log(`Error:
@@ -10519,22 +10519,22 @@ ${q.data}
10519
10519
  }), p;
10520
10520
  } else
10521
10521
  return h.answer;
10522
- } catch (d) {
10523
- return d.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", d), !1;
10522
+ } catch (u) {
10523
+ return u.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", u), !1;
10524
10524
  }
10525
10525
  }
10526
10526
  async sendStream(e, t, i, n, s, r) {
10527
10527
  this.controller = new AbortController(), this.signal = this.controller.signal;
10528
- let o = 0.6, a = 0.9, u = 1;
10528
+ let o = 0.6, a = 0.9, d = 1;
10529
10529
  s || (s = []), n = n || this.settings.model;
10530
- const d = {
10530
+ const u = {
10531
10531
  question: e,
10532
10532
  context: t,
10533
10533
  system: i,
10534
10534
  functs: s,
10535
10535
  temperature: o,
10536
10536
  topP: a,
10537
- num: u,
10537
+ num: d,
10538
10538
  model: n,
10539
10539
  customData: this.settings.customData
10540
10540
  };
@@ -10548,7 +10548,7 @@ ${q.data}
10548
10548
  // Abort
10549
10549
  method: "POST",
10550
10550
  headers: l,
10551
- body: JSON.stringify(d)
10551
+ body: JSON.stringify(u)
10552
10552
  });
10553
10553
  if (!h.ok)
10554
10554
  return console.error("Error:", h.statusText), !1;
@@ -10599,7 +10599,7 @@ ${q.data}
10599
10599
  n || (n = []);
10600
10600
  let a = this.settings.model;
10601
10601
  n.length > 0 && (a = this.settings.model2);
10602
- const u = {
10602
+ const d = {
10603
10603
  assistantId: this.settings.assistantId,
10604
10604
  question: e,
10605
10605
  context: t,
@@ -10612,27 +10612,27 @@ ${q.data}
10612
10612
  customData: this.settings.customData
10613
10613
  };
10614
10614
  try {
10615
- let d = {
10615
+ let u = {
10616
10616
  "Content-Type": "application/json",
10617
10617
  ...this.settings.headers
10618
10618
  }, h = await (await fetch(this.settings.assistantUrl, {
10619
10619
  signal: this.signal,
10620
10620
  // Abort
10621
10621
  method: "POST",
10622
- headers: d,
10623
- body: JSON.stringify(u)
10622
+ headers: u,
10623
+ body: JSON.stringify(d)
10624
10624
  })).json();
10625
10625
  return h.error ? (console.log(`Error:
10626
10626
  ` + h.error), !1) : (h.usage && (this.tokenInput += h.usage.prompt_tokens, this.tokenOutput += h.usage.completion_tokens), h.answer.content[0].text.value);
10627
- } catch (d) {
10628
- return d.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", d), !1;
10627
+ } catch (u) {
10628
+ return u.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", u), !1;
10629
10629
  }
10630
10630
  }
10631
10631
  async assistantStream(e, t, i, n, s) {
10632
10632
  this.controller = new AbortController(), this.signal = this.controller.signal;
10633
10633
  let r = 0.6, o = 0.9, a = 1;
10634
10634
  n || (n = []);
10635
- const u = {
10635
+ const d = {
10636
10636
  assistantId: this.settings.assistantId,
10637
10637
  question: e,
10638
10638
  context: t,
@@ -10645,7 +10645,7 @@ ${q.data}
10645
10645
  customData: this.settings.customData
10646
10646
  };
10647
10647
  try {
10648
- let d = {
10648
+ let u = {
10649
10649
  "Content-Type": "application/json",
10650
10650
  ...this.settings.headers
10651
10651
  };
@@ -10653,8 +10653,8 @@ ${q.data}
10653
10653
  signal: this.signal,
10654
10654
  // Abort
10655
10655
  method: "POST",
10656
- headers: d,
10657
- body: JSON.stringify(u)
10656
+ headers: u,
10657
+ body: JSON.stringify(d)
10658
10658
  });
10659
10659
  if (!l.ok)
10660
10660
  return console.error("Error:", l.statusText), !1;
@@ -10695,8 +10695,8 @@ ${q.data}
10695
10695
  }
10696
10696
  }
10697
10697
  return !0;
10698
- } catch (d) {
10699
- return d.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", d), !1;
10698
+ } catch (u) {
10699
+ return u.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", u), !1;
10700
10700
  }
10701
10701
  }
10702
10702
  hexToRgb(e) {
@@ -10833,19 +10833,22 @@ class vn {
10833
10833
  * Initialize all components in the page
10834
10834
  */
10835
10835
  initializeComponents() {
10836
- return document.querySelectorAll("[data-cb-type]").forEach((t) => {
10837
- const i = t.dataset.cbType, n = this.plugins.get(i);
10838
- if (n && typeof n.mount == "function")
10836
+ return document.querySelectorAll("[data-cb-type]").forEach((t, i) => {
10837
+ const n = t.dataset.cbType, s = this.plugins.get(n);
10838
+ if (s && typeof s.mount == "function")
10839
10839
  try {
10840
- const s = this.parseOptions(t);
10841
- let r = t.querySelector(".grid-sortable");
10842
- r || t.classList.contains("grid-sortable") && (r = t), r && Array.from(r.children).forEach((a, u) => {
10843
- a.nodeType === 1 && a.tagName !== "STYLE" && a.tagName !== "SCRIPT" && a.setAttribute("data-index", u);
10840
+ const r = this.parseOptions(t);
10841
+ let o = t.querySelector(".grid-sortable");
10842
+ o || t.classList.contains("grid-sortable") && (o = t), o && Array.from(o.children).forEach((u, l) => {
10843
+ u.nodeType === 1 && u.tagName !== "STYLE" && u.tagName !== "SCRIPT" && u.setAttribute("data-index", l);
10844
+ }), t.querySelectorAll(".edit").forEach((u, l) => {
10845
+ const h = `content-${Date.now()}-${i}-${l}`;
10846
+ u.setAttribute("data-edit-id", h);
10844
10847
  }), t.hasAttribute("data-cb-original-content") || t.setAttribute("data-cb-original-content", t.innerHTML);
10845
- const o = n.mount(t, s);
10846
- this.components.set(t, o), t.setAttribute("data-cb-loaded", "true");
10847
- } catch (s) {
10848
- console.error(`[PluginManager] Failed to mount component "${i}":`, s);
10848
+ const d = s.mount(t, r);
10849
+ this.components.set(t, d), this.setupInlineEditing(t, r), t.setAttribute("data-cb-loaded", "true");
10850
+ } catch (r) {
10851
+ console.error(`[PluginManager] Failed to mount component "${n}":`, r);
10849
10852
  }
10850
10853
  }), this.components.size;
10851
10854
  }
@@ -10874,6 +10877,52 @@ class vn {
10874
10877
  return e;
10875
10878
  }
10876
10879
  }
10880
+ /**
10881
+ * Setup inline editing for elements with .edit[data-edit-id]
10882
+ * Automatically enables contenteditable and syncs changes to data-cb-original-content
10883
+ * @param {HTMLElement} element - Plugin element
10884
+ * @param {Object} options - Plugin options
10885
+ */
10886
+ setupInlineEditing(e, t) {
10887
+ if (!e.closest(".data-editor")) return;
10888
+ const i = e.querySelectorAll(".edit[data-edit-id]");
10889
+ if (i.length === 0)
10890
+ return;
10891
+ e.querySelectorAll('[contenteditable="true"]').forEach((r) => {
10892
+ r.removeAttribute("contenteditable"), r._cbObserver && (r._cbObserver.disconnect(), delete r._cbObserver);
10893
+ });
10894
+ const s = (r, o) => {
10895
+ const a = e.getAttribute("data-cb-original-content");
10896
+ if (!a) return;
10897
+ const l = new DOMParser().parseFromString(a, "text/html").body;
10898
+ if (!l) return;
10899
+ const h = l.querySelector(`[data-edit-id="${r}"]`);
10900
+ if (h) {
10901
+ h.innerHTML = o;
10902
+ const p = l.innerHTML;
10903
+ e.setAttribute("data-cb-original-content", p);
10904
+ }
10905
+ };
10906
+ i.forEach((r) => {
10907
+ r.setAttribute("contenteditable", "true");
10908
+ const o = new MutationObserver(() => {
10909
+ const a = r.getAttribute("data-edit-id"), d = r.innerHTML;
10910
+ s(a, d);
10911
+ });
10912
+ o.observe(r, {
10913
+ childList: !0,
10914
+ // Child elements added/removed
10915
+ characterData: !0,
10916
+ // Text content changes
10917
+ subtree: !0,
10918
+ // Watch all descendants
10919
+ attributes: !0,
10920
+ // Attribute changes
10921
+ attributeFilter: ["style"]
10922
+ // Specifically watch style (color picker)
10923
+ }), r._cbObserver = o;
10924
+ });
10925
+ }
10877
10926
  /**
10878
10927
  * Manually load a plugin (if not auto-loaded)
10879
10928
  */
@@ -10909,71 +10958,6 @@ class vn {
10909
10958
  * Useful when content is dynamically updated
10910
10959
  * @param {HTMLElement} container - Container element (defaults to document)
10911
10960
  */
10912
- /*
10913
- async reinitialize(container = document) {
10914
- console.log('[PluginManager] Reinitializing components in container');
10915
-
10916
- // Step 1: Destroy existing components in this container
10917
- const elementsToDestroy = [];
10918
- this.components.forEach((instance, element) => {
10919
- if (container === document || container.contains(element)) {
10920
- elementsToDestroy.push({ element, instance });
10921
- }
10922
- });
10923
-
10924
- elementsToDestroy.forEach(({ element, instance }) => {
10925
- const type = element.dataset.cbType;
10926
- const plugin = this.plugins.get(type);
10927
-
10928
- if (plugin && typeof plugin.unmount === 'function') {
10929
- plugin.unmount(element, instance);
10930
- }
10931
-
10932
- this.components.delete(element);
10933
- });
10934
-
10935
- console.log(`[PluginManager] Destroyed ${elementsToDestroy.length} components`);
10936
-
10937
- // Step 2: Detect new component types in container
10938
- const componentTypes = this.detectComponentTypesInContainer(container);
10939
-
10940
- // Step 3: Load any new plugins that aren't loaded yet
10941
- const pluginsToLoad = componentTypes.filter(type =>
10942
- this.config.plugins[type] && !this.plugins.has(type)
10943
- );
10944
-
10945
- if (pluginsToLoad.length > 0) {
10946
- await Promise.all(
10947
- pluginsToLoad.map(type => this.loadPlugin(type))
10948
- );
10949
- }
10950
-
10951
- // Step 4: Initialize all components in container
10952
- const newElements = container.querySelectorAll('[data-cb-type]');
10953
- let mountedCount = 0;
10954
-
10955
- newElements.forEach(el => {
10956
- const type = el.dataset.cbType;
10957
- const plugin = this.plugins.get(type);
10958
-
10959
- if (plugin && typeof plugin.mount === 'function') {
10960
- try {
10961
- const options = this.parseOptions(el);
10962
- const instance = plugin.mount(el, options);
10963
- this.components.set(el, instance);
10964
- mountedCount++;
10965
- } catch (error) {
10966
- console.error(`[PluginManager] Failed to mount component "${type}":`, error);
10967
- }
10968
- }
10969
- });
10970
-
10971
- console.log(`[PluginManager] Mounted ${mountedCount} new components`);
10972
- this.emit('reinitialized', { container, count: mountedCount });
10973
-
10974
- return mountedCount;
10975
- }
10976
- */
10977
10961
  async reinitialize(e = document) {
10978
10962
  if (this.reinitializeInProgress)
10979
10963
  return clearTimeout(this.pendingReinitialize), new Promise((t) => {
@@ -10989,8 +10973,8 @@ class vn {
10989
10973
  this.components.forEach((o, a) => {
10990
10974
  (e === document || e.contains(a)) && t.push({ element: a, instance: o });
10991
10975
  }), t.forEach(({ element: o, instance: a }) => {
10992
- const u = o.dataset.cbType, d = this.plugins.get(u);
10993
- d && typeof d.unmount == "function" && d.unmount(o, a), this.components.delete(o);
10976
+ const d = o.dataset.cbType, u = this.plugins.get(d);
10977
+ u && typeof u.unmount == "function" && u.unmount(o, a), this.components.delete(o);
10994
10978
  });
10995
10979
  const n = this.detectComponentTypesInContainer(e).filter(
10996
10980
  (o) => this.config.plugins[o] && !this.plugins.has(o)
@@ -11001,18 +10985,21 @@ class vn {
11001
10985
  const s = e.querySelectorAll("[data-cb-type]");
11002
10986
  let r = 0;
11003
10987
  for (const o of s) {
11004
- const a = o.dataset.cbType, u = this.plugins.get(a);
11005
- if (u && typeof u.mount == "function")
10988
+ const a = o.dataset.cbType, d = this.plugins.get(a);
10989
+ if (d && typeof d.mount == "function")
11006
10990
  try {
11007
- const d = this.parseOptions(o);
10991
+ const u = this.parseOptions(o);
11008
10992
  let l = o.querySelector(".grid-sortable");
11009
- l || o.classList.contains("grid-sortable") && (l = o), l && Array.from(l.children).forEach((p, b) => {
11010
- p.nodeType === 1 && p.tagName !== "STYLE" && p.tagName !== "SCRIPT" && p.setAttribute("data-index", b);
10993
+ l || o.classList.contains("grid-sortable") && (l = o), l && Array.from(l.children).forEach((b, w) => {
10994
+ b.nodeType === 1 && b.tagName !== "STYLE" && b.tagName !== "SCRIPT" && b.setAttribute("data-index", w);
10995
+ }), o.querySelectorAll(".edit").forEach((b, w) => {
10996
+ const _ = `content-${Date.now()}-${r}-${w}`;
10997
+ b.setAttribute("data-edit-id", _);
11011
10998
  }), o.hasAttribute("data-cb-original-content") ? o.innerHTML = o.getAttribute("data-cb-original-content") : o.setAttribute("data-cb-original-content", o.innerHTML);
11012
- const h = await u.mount(o, d);
11013
- this.components.set(o, h), o.setAttribute("data-cb-loaded", "true"), r++;
11014
- } catch (d) {
11015
- console.error(`[PluginManager] Failed to mount component "${a}":`, d);
10999
+ const p = await d.mount(o, u);
11000
+ this.components.set(o, p), this.setupInlineEditing(o, u), o.setAttribute("data-cb-loaded", "true"), r++;
11001
+ } catch (u) {
11002
+ console.error(`[PluginManager] Failed to mount component "${a}":`, u);
11016
11003
  }
11017
11004
  }
11018
11005
  return this.emit("reinitialized", { container: e, count: r }), r;
@@ -11154,11 +11141,13 @@ class vn {
11154
11141
  * Destroy all components and plugins
11155
11142
  */
11156
11143
  destroy() {
11157
- this.components.forEach((e, t) => {
11158
- const i = t.dataset.cbType, n = this.plugins.get(i);
11159
- n && typeof n.unmount == "function" && n.unmount(t, e);
11160
- }), this.plugins.forEach((e, t) => {
11161
- typeof e.destroy == "function" && e.destroy(this);
11144
+ this.components.forEach((t, i) => {
11145
+ const n = i.dataset.cbType, s = this.plugins.get(n);
11146
+ s && typeof s.unmount == "function" && s.unmount(i, t);
11147
+ }), element.querySelectorAll('[contenteditable="true"]').forEach((t) => {
11148
+ t.removeAttribute("contenteditable"), t._cbObserver && (t._cbObserver.disconnect(), delete t._cbObserver);
11149
+ }), this.plugins.forEach((t, i) => {
11150
+ typeof t.destroy == "function" && t.destroy(this);
11162
11151
  }), this.components.clear(), this.plugins.clear();
11163
11152
  }
11164
11153
  /**
@@ -11320,13 +11309,13 @@ class wn {
11320
11309
  if (t) {
11321
11310
  const o = t.closest("[data-gallery]");
11322
11311
  let a = [];
11323
- o ? a = o.querySelectorAll(".is-lightbox") : document.querySelectorAll(".is-lightbox,.block-click").forEach((d) => {
11324
- d.closest("[data-gallery]") || a.push(d);
11325
- }), a.forEach((u, d) => {
11326
- let l = u.getAttribute("href");
11327
- l || (l = u.getAttribute("data-modal-url")), n.push({
11312
+ o ? a = o.querySelectorAll(".is-lightbox") : document.querySelectorAll(".is-lightbox,.block-click").forEach((u) => {
11313
+ u.closest("[data-gallery]") || a.push(u);
11314
+ }), a.forEach((d, u) => {
11315
+ let l = d.getAttribute("href");
11316
+ l || (l = d.getAttribute("data-modal-url")), n.push({
11328
11317
  href: l
11329
- }), e === l && (s = d);
11318
+ }), e === l && (s = u);
11330
11319
  });
11331
11320
  }
11332
11321
  const r = document.activeElement;