@innovastudio/contentbuilder-interactive-runtime 1.0.5 → 1.0.7
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(
|
|
39
|
-
G(t) && t.call(r,
|
|
38
|
+
function a(u) {
|
|
39
|
+
G(t) && t.call(r, u, this), n && a.destroy();
|
|
40
40
|
}
|
|
41
41
|
return a.destroy = function() {
|
|
42
|
-
X(o, (
|
|
43
|
-
const
|
|
44
|
-
|
|
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);
|
|
45
45
|
});
|
|
46
|
-
}, X(o, (
|
|
47
|
-
const
|
|
48
|
-
(
|
|
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 }));
|
|
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
|
|
369
|
-
(
|
|
368
|
+
var u = Math.abs(this.x1 - this.x2), d = Math.abs(this.y1 - this.y2);
|
|
369
|
+
(u > 10 || d > 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,
|
|
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;
|
|
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,
|
|
475
|
+
h = !0, u = l || 1;
|
|
476
476
|
},
|
|
477
477
|
pinch: (R) => {
|
|
478
478
|
if (!o || a)
|
|
479
479
|
return !1;
|
|
480
|
-
h = !0, o.scaleX = o.scaleY =
|
|
481
|
-
let q =
|
|
480
|
+
h = !0, o.scaleX = o.scaleY = u * R.zoom;
|
|
481
|
+
let q = u * 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 >
|
|
486
|
+
q > d && (q = d), 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
|
|
646
|
+
let u = e.href, d = e?.videoProvider, l = !1;
|
|
647
647
|
r.style.maxWidth = e.width, It(this.settings.plyr.js, "Plyr", () => {
|
|
648
|
-
if (!
|
|
649
|
-
|
|
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";
|
|
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="${
|
|
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);
|
|
652
652
|
}
|
|
653
|
-
const h = l || _e(`<div id="${s}" data-plyr-provider="${
|
|
654
|
-
H(a, `${
|
|
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);
|
|
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
|
|
683
|
-
|
|
682
|
+
const u = a.cloneNode(!0);
|
|
683
|
+
u.style.height = e.height, u.style.maxWidth = e.width, H(u, "ginlined-content"), o = u;
|
|
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
|
|
742
|
-
re(
|
|
741
|
+
const u = e.dataset[a];
|
|
742
|
+
re(u) || (i[a] = this.sanitizeValue(u));
|
|
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,
|
|
755
|
-
o.push(";\\s?" +
|
|
756
|
-
}), o = o.join("\\s?:|"), s.trim() !== "" && X(i, (a,
|
|
757
|
-
const
|
|
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);
|
|
758
758
|
if (p && p.length && p[1]) {
|
|
759
759
|
const b = p[1].trim().replace(/;\s*$/, "");
|
|
760
|
-
i[
|
|
760
|
+
i[u] = 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"),
|
|
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;
|
|
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) : (
|
|
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") {
|
|
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: (
|
|
900
|
-
|
|
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(() => {
|
|
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,
|
|
1164
|
+
let a = null, u = null;
|
|
1165
1165
|
if (this.slidesContainer) {
|
|
1166
1166
|
if (t > o)
|
|
1167
1167
|
this.slidesContainer.appendChild(r);
|
|
1168
1168
|
else {
|
|
1169
|
-
let
|
|
1170
|
-
this.slidesContainer.insertBefore(r,
|
|
1169
|
+
let d = this.slidesContainer.querySelectorAll(".gslide")[t];
|
|
1170
|
+
this.slidesContainer.insertBefore(r, d);
|
|
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],
|
|
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;
|
|
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:
|
|
1181
|
+
player: u
|
|
1182
1182
|
}), G(this.settings.slideInserted) && this.settings.slideInserted({
|
|
1183
1183
|
index: t,
|
|
1184
1184
|
slide: a,
|
|
1185
|
-
player:
|
|
1185
|
+
player: u
|
|
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, (
|
|
1477
|
-
|
|
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"));
|
|
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: (
|
|
1488
|
-
|
|
1487
|
+
withCallback: (u, d) => {
|
|
1488
|
+
u.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: (
|
|
1493
|
-
|
|
1492
|
+
withCallback: (u, d) => {
|
|
1493
|
+
u.preventDefault(), this.nextSlide();
|
|
1494
1494
|
}
|
|
1495
1495
|
})), this.prevButton && (this.events.prev = oe("click", {
|
|
1496
1496
|
onElement: this.prevButton,
|
|
1497
|
-
withCallback: (
|
|
1498
|
-
|
|
1497
|
+
withCallback: (u, d) => {
|
|
1498
|
+
u.preventDefault(), this.prevSlide();
|
|
1499
1499
|
}
|
|
1500
1500
|
})), this.settings.closeOnOutsideClick && (this.events.outClose = oe("click", {
|
|
1501
1501
|
onElement: o,
|
|
1502
|
-
withCallback: (
|
|
1503
|
-
!this.preventOutsideClick && !te(document.body, "glightbox-mobile") && !ue(
|
|
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();
|
|
1504
1504
|
}
|
|
1505
|
-
})), X(this.elements, (
|
|
1506
|
-
this.slidesContainer.appendChild(
|
|
1505
|
+
})), X(this.elements, (u, d) => {
|
|
1506
|
+
this.slidesContainer.appendChild(u.instance.create()), u.slideNode = this.slidesContainer.querySelectorAll(".gslide")[d];
|
|
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
|
|
1534
|
+
let u = s.offsetHeight, d = n.querySelector("img");
|
|
1535
1535
|
const h = this.elements[this.index].node.getAttribute("data-height") ?? "100vh";
|
|
1536
|
-
|
|
1536
|
+
d.setAttribute("style", `max-height: calc(${h} - ${u}px)`), s.setAttribute("style", `max-width: ${d.offsetWidth}px;`);
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
|
1539
1539
|
if (i) {
|
|
1540
|
-
let
|
|
1541
|
-
if (!
|
|
1540
|
+
let u = Z(this.settings.plyr.config, "ratio") ? this.settings.plyr.config.ratio : "";
|
|
1541
|
+
if (!u) {
|
|
1542
1542
|
const b = i.clientWidth, w = i.clientHeight, _ = b / w;
|
|
1543
|
-
|
|
1543
|
+
u = `${b / _}:${w / _}`;
|
|
1544
1544
|
}
|
|
1545
|
-
let
|
|
1545
|
+
let d = u.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(
|
|
1547
|
+
let p = h / (parseInt(d[0]) / parseInt(d[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(
|
|
2280
|
-
var
|
|
2281
|
-
c.disabled || (!c.settings.waitForTransition || c.disable(), this.move =
|
|
2282
|
-
|
|
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();
|
|
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
|
|
2291
|
+
var u = this.move, d = this.length, l = u.steps, h = u.direction, p = 1;
|
|
2292
2292
|
if (h === "=") {
|
|
2293
|
-
if (c.settings.bound && Q(l) >
|
|
2294
|
-
c.index =
|
|
2293
|
+
if (c.settings.bound && Q(l) > d) {
|
|
2294
|
+
c.index = d;
|
|
2295
2295
|
return;
|
|
2296
2296
|
}
|
|
2297
2297
|
c.index = l;
|
|
2298
2298
|
return;
|
|
2299
2299
|
}
|
|
2300
2300
|
if (h === ">" && l === ">") {
|
|
2301
|
-
c.index =
|
|
2301
|
+
c.index = d;
|
|
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 >
|
|
2310
|
+
b > d && (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
|
|
2344
|
-
return
|
|
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;
|
|
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
|
|
2357
|
-
return c.isType("carousel") ?
|
|
2356
|
+
var u = c.index;
|
|
2357
|
+
return c.isType("carousel") ? u + a : u + (a - u % a);
|
|
2358
2358
|
}
|
|
2359
|
-
function s(a,
|
|
2360
|
-
var
|
|
2361
|
-
return a <=
|
|
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;
|
|
2362
2362
|
}
|
|
2363
2363
|
function r(a) {
|
|
2364
|
-
var
|
|
2364
|
+
var u = c.index;
|
|
2365
2365
|
if (c.isType("carousel"))
|
|
2366
|
-
return
|
|
2367
|
-
var
|
|
2368
|
-
return (
|
|
2366
|
+
return u - a;
|
|
2367
|
+
var d = Math.ceil(u / a);
|
|
2368
|
+
return (d - 1) * a;
|
|
2369
2369
|
}
|
|
2370
|
-
function o(a,
|
|
2371
|
-
var
|
|
2372
|
-
return a >= 0 ? a : c.isType("carousel") ? a + (
|
|
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;
|
|
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(
|
|
2389
|
-
var
|
|
2388
|
+
set: function(u) {
|
|
2389
|
+
var d = u.substr(1);
|
|
2390
2390
|
this._m = {
|
|
2391
|
-
direction:
|
|
2392
|
-
steps:
|
|
2391
|
+
direction: u.substr(0, 1),
|
|
2392
|
+
steps: d ? Q(d) ? Q(d) : d : 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
|
|
2404
|
-
return this.isBound() ?
|
|
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;
|
|
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
|
-
},
|
|
2423
|
+
}, u = 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
|
|
2429
|
+
return u.cancel = function() {
|
|
2430
2430
|
clearTimeout(i), o = 0, i = n = s = null;
|
|
2431
|
-
},
|
|
2431
|
+
}, u;
|
|
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,
|
|
2449
|
-
r !== 0 ? a[Ue[
|
|
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]] = "";
|
|
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,
|
|
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;
|
|
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(
|
|
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++) {
|
|
2828
2828
|
for (var _ = 0; _ < p.length; _++) {
|
|
2829
2829
|
var g = p[_].cloneNode(!0);
|
|
2830
|
-
g.classList.add(
|
|
2830
|
+
g.classList.add(u.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(
|
|
2834
|
+
f.classList.add(u.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,
|
|
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++)
|
|
2846
2846
|
o.appendChild(l[p]);
|
|
2847
|
-
for (var b = 0; b <
|
|
2848
|
-
o.insertBefore(
|
|
2847
|
+
for (var b = 0; b < d.length; b++)
|
|
2848
|
+
o.insertBefore(d[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,
|
|
3258
|
+
} : !1, u = {
|
|
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
|
-
|
|
3403
|
-
}),
|
|
3402
|
+
u.unbindSwipeStart(), u.unbindSwipeMove(), u.unbindSwipeEnd(), i.destroy();
|
|
3403
|
+
}), u;
|
|
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,
|
|
3568
|
-
|
|
3569
|
-
|
|
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);
|
|
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,
|
|
3598
|
-
d
|
|
3599
|
-
|
|
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) {
|
|
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,
|
|
3612
|
-
d
|
|
3613
|
-
|
|
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) {
|
|
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(
|
|
3842
|
+
match: function(u) {
|
|
3843
3843
|
if (typeof window.matchMedia < "u") {
|
|
3844
|
-
for (var
|
|
3845
|
-
if (
|
|
3846
|
-
return d
|
|
3844
|
+
for (var d in u)
|
|
3845
|
+
if (u.hasOwnProperty(d) && window.matchMedia("(max-width: ".concat(d, "px)")).matches)
|
|
3846
|
+
return u[d];
|
|
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,
|
|
4083
|
-
for (; --
|
|
4082
|
+
let a = !1, u = r;
|
|
4083
|
+
for (; --u >= 0 && o[u] === "\\"; )
|
|
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
|
|
4227
|
-
for (
|
|
4228
|
-
if (this.rules.other.blockquoteStart.test(i[
|
|
4229
|
-
a.push(i[
|
|
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;
|
|
4230
4230
|
else if (!o)
|
|
4231
|
-
a.push(i[
|
|
4231
|
+
a.push(i[u]);
|
|
4232
4232
|
else
|
|
4233
4233
|
break;
|
|
4234
|
-
i = i.slice(
|
|
4235
|
-
const
|
|
4236
|
-
`), l =
|
|
4234
|
+
i = i.slice(u);
|
|
4235
|
+
const d = a.join(`
|
|
4236
|
+
`), l = d.replace(this.rules.other.blockquoteSetextReplace, `
|
|
4237
4237
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
4238
4238
|
n = n ? `${n}
|
|
4239
|
-
${
|
|
4239
|
+
${d}` : d, 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
|
|
4286
|
+
let u = !1, d = "", l = "";
|
|
4287
4287
|
if (!(t = r.exec(e)) || this.rules.block.hr.test(e))
|
|
4288
4288
|
break;
|
|
4289
|
-
|
|
4289
|
+
d = t[0], e = e.substring(d.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) && (
|
|
4294
|
-
`, e = e.substring(p.length + 1),
|
|
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) {
|
|
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),
|
|
4311
|
+
!b && !p.trim() && (b = !0), d += 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(
|
|
4315
|
+
s.loose || (o ? s.loose = !0 : this.rules.other.doubleBlankLine.test(d) && (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:
|
|
4319
|
+
raw: d,
|
|
4320
4320
|
task: !!_,
|
|
4321
4321
|
checked: g,
|
|
4322
4322
|
loose: !1,
|
|
4323
4323
|
text: l,
|
|
4324
4324
|
tokens: []
|
|
4325
|
-
}), s.raw +=
|
|
4325
|
+
}), s.raw += d;
|
|
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
|
|
4334
|
-
if (this.lexer.state.top = !1, s.items[
|
|
4335
|
-
const
|
|
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));
|
|
4336
4336
|
s.loose = l;
|
|
4337
4337
|
}
|
|
4338
4338
|
if (s.loose)
|
|
4339
|
-
for (let
|
|
4340
|
-
s.items[
|
|
4339
|
+
for (let u = 0; u < s.items.length; u++)
|
|
4340
|
+
s.items[u].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,
|
|
4391
|
+
r.rows.push(Kt(o, r.header.length).map((a, u) => ({
|
|
4392
4392
|
text: a,
|
|
4393
4393
|
tokens: this.lexer.inline(a),
|
|
4394
4394
|
header: !1,
|
|
4395
|
-
align: r.align[
|
|
4395
|
+
align: r.align[u]
|
|
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,
|
|
4507
|
+
let o, a, u = r, d = 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
|
-
|
|
4513
|
+
u += a;
|
|
4514
4514
|
continue;
|
|
4515
4515
|
} else if ((n[5] || n[6]) && r % 3 && !((r + a) % 3)) {
|
|
4516
|
-
|
|
4516
|
+
d += a;
|
|
4517
4517
|
continue;
|
|
4518
4518
|
}
|
|
4519
|
-
if (
|
|
4519
|
+
if (u -= a, u > 0)
|
|
4520
4520
|
continue;
|
|
4521
|
-
a = Math.min(a, a +
|
|
4521
|
+
a = Math.min(a, a + u + d);
|
|
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((
|
|
4753
|
-
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));
|
|
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((
|
|
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))
|
|
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
|
|
4821
|
-
o.type === "text" &&
|
|
4820
|
+
const u = t.at(-1);
|
|
4821
|
+
o.type === "text" && u?.type === "text" ? (u.raw += o.raw, u.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
|
|
4851
|
-
const
|
|
4850
|
+
let u = 1 / 0;
|
|
4851
|
+
const d = e.slice(1);
|
|
4852
4852
|
let l;
|
|
4853
4853
|
this.options.extensions.startInline.forEach((h) => {
|
|
4854
|
-
l = h.call({ lexer: this },
|
|
4855
|
-
}),
|
|
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));
|
|
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
|
|
4860
|
-
|
|
4859
|
+
const u = t.at(-1);
|
|
4860
|
+
u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
4861
4861
|
continue;
|
|
4862
4862
|
}
|
|
4863
4863
|
if (e) {
|
|
4864
|
-
const
|
|
4864
|
+
const u = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
4865
4865
|
if (this.options.silent) {
|
|
4866
|
-
console.error(
|
|
4866
|
+
console.error(u);
|
|
4867
4867
|
break;
|
|
4868
4868
|
} else
|
|
4869
|
-
throw new Error(
|
|
4869
|
+
throw new Error(u);
|
|
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],
|
|
5316
|
-
s[o] = (...
|
|
5317
|
-
let l = a.apply(s,
|
|
5318
|
-
return l === !1 && (l =
|
|
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 || "";
|
|
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],
|
|
5331
|
-
s[o] = (...
|
|
5332
|
-
let l = a.apply(s,
|
|
5333
|
-
return l === !1 && (l =
|
|
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;
|
|
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],
|
|
5346
|
-
Ye.passThroughHooks.has(r) ? s[o] = (
|
|
5345
|
+
const o = r, a = i.hooks[o], u = s[o];
|
|
5346
|
+
Ye.passThroughHooks.has(r) ? s[o] = (d) => {
|
|
5347
5347
|
if (this.defaults.async)
|
|
5348
|
-
return Promise.resolve(a.call(s,
|
|
5349
|
-
const l = a.call(s,
|
|
5350
|
-
return
|
|
5351
|
-
} : s[o] = (...
|
|
5352
|
-
let l = a.apply(s,
|
|
5353
|
-
return l === !1 && (l =
|
|
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;
|
|
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,
|
|
5387
|
+
const a = r.hooks ? r.hooks.provideLexer() : e ? le.lex : le.lexInline, u = 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((
|
|
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);
|
|
5390
5390
|
try {
|
|
5391
5391
|
r.hooks && (i = r.hooks.preprocess(i));
|
|
5392
|
-
let
|
|
5393
|
-
r.hooks && (
|
|
5394
|
-
let l = d
|
|
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);
|
|
5395
5395
|
return r.hooks && (l = r.hooks.postprocess(l)), l;
|
|
5396
|
-
} catch (
|
|
5397
|
-
return o(
|
|
5396
|
+
} catch (d) {
|
|
5397
|
+
return o(d);
|
|
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,
|
|
5456
|
+
${e}`, o, a, u;
|
|
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 ? (
|
|
5501
|
+
}], a = await this.builder.send(r, s, n, "", o), a ? (u = JSON.parse(a), u) : !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
|
-
|
|
5563
|
+
u = 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
|
-
|
|
5591
|
+
u = 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
|
-
|
|
5613
|
+
u = JSON.parse(a);
|
|
5614
5614
|
}
|
|
5615
|
-
return this.builder.settings.consoleLog && console.log(
|
|
5615
|
+
return this.builder.settings.consoleLog && console.log(u), this.extractInfo(u, 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
|
|
5630
|
+
let u = [{
|
|
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
|
-
}],
|
|
5726
|
-
if (!
|
|
5725
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
5726
|
+
if (!d)
|
|
5727
5727
|
return !1;
|
|
5728
|
-
let l = JSON.parse(
|
|
5728
|
+
let l = JSON.parse(d);
|
|
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
|
|
5744
|
+
let u = [{
|
|
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
|
-
}],
|
|
5772
|
-
if (!
|
|
5771
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
5772
|
+
if (!d)
|
|
5773
5773
|
return !1;
|
|
5774
|
-
let l = JSON.parse(
|
|
5774
|
+
let l = JSON.parse(d);
|
|
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
|
-
`,
|
|
5790
|
+
`, u = [{
|
|
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
|
-
}],
|
|
5814
|
-
if (!
|
|
5813
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
5814
|
+
if (!d)
|
|
5815
5815
|
return !1;
|
|
5816
|
-
let l = JSON.parse(
|
|
5816
|
+
let l = JSON.parse(d);
|
|
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
|
-
}],
|
|
5841
|
-
if (!
|
|
5840
|
+
}], u = await this.builder.send(o, r, s, "", a);
|
|
5841
|
+
if (!u)
|
|
5842
5842
|
return !1;
|
|
5843
|
-
let
|
|
5843
|
+
let d = JSON.parse(u);
|
|
5844
5844
|
return {
|
|
5845
5845
|
...e,
|
|
5846
|
-
...
|
|
5846
|
+
...d
|
|
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
|
-
`,
|
|
5859
|
+
`, u = [{
|
|
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
|
-
}],
|
|
5879
|
-
if (!
|
|
5878
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
5879
|
+
if (!d)
|
|
5880
5880
|
return !1;
|
|
5881
|
-
let l = JSON.parse(
|
|
5881
|
+
let l = JSON.parse(d);
|
|
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
|
-
`,
|
|
5897
|
+
`, u = [{
|
|
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
|
-
}],
|
|
5919
|
-
if (!
|
|
5918
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
5919
|
+
if (!d)
|
|
5920
5920
|
return !1;
|
|
5921
|
-
let l = JSON.parse(
|
|
5921
|
+
let l = JSON.parse(d);
|
|
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
|
-
`,
|
|
5939
|
+
`, u = [{
|
|
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
|
-
}],
|
|
5967
|
-
if (!
|
|
5966
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
5967
|
+
if (!d)
|
|
5968
5968
|
return !1;
|
|
5969
|
-
let l = JSON.parse(
|
|
5969
|
+
let l = JSON.parse(d);
|
|
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
|
-
`,
|
|
5985
|
+
`, u = [{
|
|
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
|
-
}],
|
|
6089
|
-
if (!
|
|
6088
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
6089
|
+
if (!d)
|
|
6090
6090
|
return !1;
|
|
6091
|
-
let l = JSON.parse(
|
|
6091
|
+
let l = JSON.parse(d);
|
|
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
|
-
`,
|
|
6107
|
+
`, u = [{
|
|
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
|
-
}],
|
|
6211
|
-
if (!
|
|
6210
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
6211
|
+
if (!d)
|
|
6212
6212
|
return !1;
|
|
6213
|
-
let l = JSON.parse(
|
|
6213
|
+
let l = JSON.parse(d);
|
|
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
|
-
`,
|
|
6229
|
+
`, u = [{
|
|
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
|
-
}],
|
|
6329
|
-
if (!
|
|
6328
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
6329
|
+
if (!d)
|
|
6330
6330
|
return !1;
|
|
6331
|
-
let l = JSON.parse(
|
|
6331
|
+
let l = JSON.parse(d);
|
|
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
|
-
`,
|
|
6347
|
+
`, u = [{
|
|
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
|
-
}],
|
|
6373
|
-
if (!
|
|
6372
|
+
}], d = await this.builder.send(a, o, s, "", u);
|
|
6373
|
+
if (!d)
|
|
6374
6374
|
return !1;
|
|
6375
|
-
let l = JSON.parse(
|
|
6375
|
+
let l = JSON.parse(d);
|
|
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
|
|
6455
|
+
let u = await s.text();
|
|
6456
6456
|
try {
|
|
6457
|
-
r = JSON.parse(
|
|
6457
|
+
r = JSON.parse(u);
|
|
6458
6458
|
} catch {
|
|
6459
6459
|
return {
|
|
6460
6460
|
mediaGenerated: !1,
|
|
6461
6461
|
status: "error",
|
|
6462
|
-
message:
|
|
6462
|
+
message: u
|
|
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
|
|
6473
|
+
const d = r.data;
|
|
6474
6474
|
let l = "", h = "", p, b = !1, w = [], _ = [];
|
|
6475
|
-
return
|
|
6475
|
+
return d.entries && d.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 += ``, b = !0), w.push(g.url), _.push(g.file_url);
|
|
6499
|
-
}), b && (l = `<div class="image-container">${l}</div>`), typeof
|
|
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>`), {
|
|
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
|
|
6523
|
+
let u = await s.text();
|
|
6524
6524
|
try {
|
|
6525
|
-
r = JSON.parse(
|
|
6525
|
+
r = JSON.parse(u);
|
|
6526
6526
|
} catch {
|
|
6527
6527
|
return {
|
|
6528
6528
|
mediaGenerated: !1,
|
|
6529
6529
|
status: "error",
|
|
6530
|
-
message:
|
|
6530
|
+
message: u
|
|
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
|
|
6542
|
-
let l = this.renderResult(
|
|
6541
|
+
const d = r.data;
|
|
6542
|
+
let l = this.renderResult(d, 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,
|
|
6554
|
-
|
|
6555
|
-
let
|
|
6553
|
+
let s, r, o, a = e.model, u = this.builder.settings.replicateStatusEndpoint;
|
|
6554
|
+
u = u.replace("{REQUEST_ID}", t);
|
|
6555
|
+
let d = {
|
|
6556
6556
|
"Content-Type": "application/json",
|
|
6557
6557
|
...this.builder.settings.headers
|
|
6558
6558
|
}, l = {
|
|
6559
6559
|
model: a,
|
|
6560
|
-
endpoint:
|
|
6560
|
+
endpoint: u,
|
|
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:
|
|
6568
|
+
headers: d,
|
|
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
|
|
6591
|
-
let
|
|
6590
|
+
const u = this.getEndpoint(a, t, this.builder.settings.falStatusEndpoint);
|
|
6591
|
+
let d = {
|
|
6592
6592
|
"Content-Type": "application/json",
|
|
6593
6593
|
...this.builder.settings.headers
|
|
6594
6594
|
}, l = {
|
|
6595
6595
|
model: a,
|
|
6596
|
-
endpoint:
|
|
6596
|
+
endpoint: u,
|
|
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:
|
|
6604
|
+
headers: d,
|
|
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,
|
|
6629
|
-
e.entries.forEach((
|
|
6630
|
-
a =
|
|
6628
|
+
let a, u = !1;
|
|
6629
|
+
e.entries.forEach((d) => {
|
|
6630
|
+
a = d.url.split(".").pop().toLowerCase(), a === "mp4" ? (n += `
|
|
6631
6631
|
<p class="responsive-video">
|
|
6632
6632
|
<video controls>
|
|
6633
|
-
<source src="${
|
|
6633
|
+
<source src="${d.url}" type="video/mp4">
|
|
6634
6634
|
Your browser does not support the video tag.
|
|
6635
6635
|
</video>
|
|
6636
6636
|
</p>
|
|
6637
|
-
`, s += ``, r.push(d.url), o.push(d.file_url)) : a === "wav" || a === "mp3" ? (n += `
|
|
6638
6638
|
<p class="responsive-audio">
|
|
6639
6639
|
<audio controls>
|
|
6640
|
-
<source src="${
|
|
6640
|
+
<source src="${d.url}" type="audio/mpeg">
|
|
6641
6641
|
Your browser does not support the audio tag.
|
|
6642
6642
|
</audio>
|
|
6643
6643
|
</p>
|
|
6644
|
-
`, s += ``, r.push(d.url), o.push(d.file_url)) : (n += `
|
|
6645
6645
|
<div>
|
|
6646
|
-
<img src="${
|
|
6646
|
+
<img src="${d.url}" />
|
|
6647
6647
|
<div>
|
|
6648
|
-
<a class="link-view" href="${
|
|
6649
|
-
<a class="link-download" href="${
|
|
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>
|
|
6650
6650
|
</div>
|
|
6651
6651
|
</div>
|
|
6652
|
-
`, s += `,
|
|
6652
|
+
`, s += ``, r.push(d.url), o.push(d.file_url), u = !0);
|
|
6653
|
+
}), u && (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
|
|
6676
|
-
if (!
|
|
6675
|
+
let u = e.prompt;
|
|
6676
|
+
if (!u)
|
|
6677
6677
|
return {
|
|
6678
6678
|
mediaGenerated: !1,
|
|
6679
6679
|
status: "error",
|
|
6680
6680
|
message: this.out("Please input a prompt.")
|
|
6681
6681
|
};
|
|
6682
|
-
let
|
|
6682
|
+
let d = e.aspect_ratio || "16:9", l = e.num_images || 1;
|
|
6683
6683
|
l > 4 && (l = 4), n = {
|
|
6684
|
-
prompt:
|
|
6685
|
-
aspect_ratio:
|
|
6684
|
+
prompt: u,
|
|
6685
|
+
aspect_ratio: d,
|
|
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
|
|
6697
|
-
if (!
|
|
6696
|
+
let u = e.prompt;
|
|
6697
|
+
if (!u)
|
|
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:
|
|
6725
|
+
prompt: u,
|
|
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
|
|
6739
|
-
if (!
|
|
6738
|
+
let u = e.prompt;
|
|
6739
|
+
if (!u)
|
|
6740
6740
|
return {
|
|
6741
6741
|
mediaGenerated: !1,
|
|
6742
6742
|
status: "error",
|
|
6743
6743
|
message: this.out("Please input a prompt.")
|
|
6744
6744
|
};
|
|
6745
|
-
let
|
|
6745
|
+
let d = e.width || 1280, l = e.height || 768;
|
|
6746
6746
|
e.num_images, n = {
|
|
6747
|
-
prompt:
|
|
6748
|
-
size: `${
|
|
6747
|
+
prompt: u,
|
|
6748
|
+
size: `${d}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,
|
|
6755
|
+
let a = this.validateModel(e.model, d, "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
|
|
6769
|
-
const l = await this.builder.upload.getInputURLs(
|
|
6768
|
+
let d = "replicate";
|
|
6769
|
+
const l = await this.builder.upload.getInputURLs(d);
|
|
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
|
|
6796
|
-
if (!
|
|
6795
|
+
let u = e.prompt;
|
|
6796
|
+
if (!u)
|
|
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: `${
|
|
6825
|
+
prompt: `${u}. 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
|
|
6836
|
-
|
|
6835
|
+
let u = e.prompt || "stunning video", d = e.duration || 5;
|
|
6836
|
+
d > 10 && (d = 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:
|
|
6855
|
-
duration:
|
|
6854
|
+
prompt: u,
|
|
6855
|
+
duration: d
|
|
6856
6856
|
}), a === "kwaivgi/kling-v1.6-standard" && (n = {
|
|
6857
6857
|
start_image: p,
|
|
6858
|
-
prompt:
|
|
6859
|
-
duration:
|
|
6858
|
+
prompt: u,
|
|
6859
|
+
duration: d
|
|
6860
6860
|
}), a === "minimax/video-01-live" && (n = {
|
|
6861
6861
|
first_frame_image: p,
|
|
6862
|
-
prompt:
|
|
6862
|
+
prompt: u
|
|
6863
6863
|
}), a === "luma/ray" && (n = {
|
|
6864
6864
|
start_image_url: p,
|
|
6865
|
-
prompt:
|
|
6865
|
+
prompt: u
|
|
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
|
|
6876
|
-
if (!
|
|
6875
|
+
let u = e.prompt;
|
|
6876
|
+
if (!u)
|
|
6877
6877
|
return {
|
|
6878
6878
|
mediaGenerated: !1,
|
|
6879
6879
|
status: "error",
|
|
6880
6880
|
message: this.out("Please input a prompt.")
|
|
6881
6881
|
};
|
|
6882
|
-
let
|
|
6883
|
-
|
|
6884
|
-
prompt:
|
|
6885
|
-
duration:
|
|
6882
|
+
let d = e.duration || 5;
|
|
6883
|
+
d > 10 && (d = 5), a === "kwaivgi/kling-v1.6-standard" && (n = {
|
|
6884
|
+
prompt: u,
|
|
6885
|
+
duration: d
|
|
6886
6886
|
}), a === "minimax/video-01" && (n = {
|
|
6887
|
-
prompt:
|
|
6887
|
+
prompt: u
|
|
6888
6888
|
}), a === "luma/ray" && (n = {
|
|
6889
|
-
prompt:
|
|
6889
|
+
prompt: u
|
|
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
|
|
6913
|
-
s.version =
|
|
6914
|
-
let
|
|
6915
|
-
s.endpoint =
|
|
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");
|
|
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
|
|
6930
|
+
let u, d = {
|
|
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:
|
|
6936
|
+
headers: d,
|
|
6937
6937
|
body: JSON.stringify(s)
|
|
6938
6938
|
})).json();
|
|
6939
6939
|
if (h.ok) {
|
|
6940
|
-
if (
|
|
6940
|
+
if (u = h.data.id, !u)
|
|
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,
|
|
6952
|
+
const p = this.waitingReplicate(s, u, 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
|
|
6962
|
+
let u = {
|
|
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:
|
|
6969
|
+
headers: u,
|
|
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
|
|
7001
|
-
|
|
7002
|
-
let
|
|
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();
|
|
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
|
-
|
|
7008
|
+
u.append("file[]", y), d = !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
|
-
|
|
7014
|
+
u.append("file[]", y), d = !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
|
-
|
|
7019
|
+
u.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
|
-
|
|
7025
|
+
u.append("file[]", m), d = !0;
|
|
7026
7026
|
}
|
|
7027
7027
|
let h, p = e.size || "auto", b = e.quality || "auto", w = e.num_images || 1;
|
|
7028
|
-
if (
|
|
7029
|
-
|
|
7028
|
+
if (d) {
|
|
7029
|
+
u.append("size", p), u.append("n", w), u.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:
|
|
7038
|
+
body: u
|
|
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
|
|
7091
|
-
|
|
7090
|
+
let u = [];
|
|
7091
|
+
u.push({
|
|
7092
7092
|
text: a
|
|
7093
7093
|
});
|
|
7094
|
-
let
|
|
7095
|
-
if (!(
|
|
7096
|
-
for (const g of
|
|
7094
|
+
let d = this.builder.getFormValues();
|
|
7095
|
+
if (!(d && Object.keys(d).length === 0)) {
|
|
7096
|
+
for (const g of d)
|
|
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
|
-
|
|
7108
|
+
u.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:
|
|
7118
|
+
contents: u
|
|
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
|
|
7583
|
+
let u, d = {
|
|
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:
|
|
7589
|
+
headers: d,
|
|
7590
7590
|
body: JSON.stringify(r)
|
|
7591
7591
|
})).json();
|
|
7592
7592
|
if (h.ok)
|
|
7593
|
-
|
|
7593
|
+
u = 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,
|
|
7601
|
+
const p = this.waitingFal(r, u, 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
|
|
7631
|
+
let u = {
|
|
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:
|
|
7638
|
+
headers: u,
|
|
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],
|
|
7661
|
-
|
|
7662
|
-
let
|
|
7663
|
-
const h = await (await fetch(
|
|
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, {
|
|
7664
7664
|
method: "POST",
|
|
7665
|
-
body:
|
|
7665
|
+
body: u
|
|
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
|
|
7683
|
-
const l = await (await fetch(
|
|
7682
|
+
let u = this.builder.settings.uploadMediaUrl_Fal;
|
|
7683
|
+
const l = await (await fetch(u, {
|
|
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,
|
|
7701
|
+
let a, u = !1, d;
|
|
7702
7702
|
if (e.trim().startsWith("{"))
|
|
7703
7703
|
try {
|
|
7704
|
-
|
|
7704
|
+
d = JSON.parse(e), d && typeof d == "object" && (u = !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 (
|
|
7712
|
+
if (u) {
|
|
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
|
-
})(
|
|
7735
|
+
})(d, 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(
|
|
7743
|
+
Object.keys(d).forEach((g) => {
|
|
7744
7744
|
Object.keys(w).forEach((v) => {
|
|
7745
|
-
if (
|
|
7745
|
+
if (d[g] === v) {
|
|
7746
7746
|
let f = w[v];
|
|
7747
|
-
|
|
7747
|
+
d[g] = f;
|
|
7748
7748
|
}
|
|
7749
|
-
if (Array.isArray(
|
|
7750
|
-
for (let f = 0; f <
|
|
7751
|
-
if (
|
|
7749
|
+
if (Array.isArray(d[g])) {
|
|
7750
|
+
for (let f = 0; f < d[g].length; f++)
|
|
7751
|
+
if (d[g][f] === v) {
|
|
7752
7752
|
let m = w[v];
|
|
7753
|
-
|
|
7753
|
+
d[g][f] = m;
|
|
7754
7754
|
}
|
|
7755
7755
|
}
|
|
7756
7756
|
});
|
|
7757
|
-
}), Object.keys(
|
|
7758
|
-
let v =
|
|
7757
|
+
}), Object.keys(d).forEach((g) => {
|
|
7758
|
+
let v = d[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
|
-
|
|
7777
|
+
d[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 =
|
|
7788
|
+
_.endpoint = g, _.payload = d, 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 =
|
|
7791
|
+
g = g.replace("{MODEL}", _.model), _.endpoint = g, _.payload = d, 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 =
|
|
7795
|
+
_.endpoint = g, _.payload = d, 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
|
|
7916
|
+
const u = 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
|
|
7924
|
-
return this.waitingFal(e,
|
|
7923
|
+
let d = u.request_id;
|
|
7924
|
+
return this.waitingFal(e, d, i, n);
|
|
7925
7925
|
}
|
|
7926
|
-
if (
|
|
7927
|
-
return this.builder.settings.consoleLog && console.log(
|
|
7926
|
+
if (u.error)
|
|
7927
|
+
return this.builder.settings.consoleLog && console.log(u.error), {
|
|
7928
7928
|
mediaGenerated: !1,
|
|
7929
7929
|
status: "error",
|
|
7930
|
-
message:
|
|
7930
|
+
message: u.error
|
|
7931
7931
|
//this.out('Request failed.')
|
|
7932
7932
|
};
|
|
7933
7933
|
if (r) {
|
|
7934
|
-
let
|
|
7935
|
-
if (
|
|
7936
|
-
if (
|
|
7934
|
+
let d;
|
|
7935
|
+
if (u.ok) {
|
|
7936
|
+
if (d = u.data.id, !d)
|
|
7937
7937
|
return {
|
|
7938
7938
|
mediaGenerated: !1,
|
|
7939
7939
|
status: "error",
|
|
7940
|
-
message:
|
|
7940
|
+
message: u.data && u.data.detail
|
|
7941
7941
|
};
|
|
7942
7942
|
} else
|
|
7943
7943
|
return {
|
|
7944
7944
|
mediaGenerated: !1,
|
|
7945
7945
|
status: "error",
|
|
7946
|
-
message:
|
|
7946
|
+
message: u.error
|
|
7947
7947
|
//this.out('Generating video request failed.')
|
|
7948
7948
|
};
|
|
7949
|
-
return this.waitingReplicate(e,
|
|
7949
|
+
return this.waitingReplicate(e, d, i, n);
|
|
7950
7950
|
} else {
|
|
7951
|
-
const
|
|
7952
|
-
let l = this.renderResult(
|
|
7951
|
+
const d = u.data;
|
|
7952
|
+
let l = this.renderResult(d, 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
|
-
},
|
|
8088
|
-
t === "replicate" ?
|
|
8089
|
-
let
|
|
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 = {
|
|
8090
8090
|
"Content-Type": "application/json",
|
|
8091
8091
|
...this.builder.settings.headers
|
|
8092
|
-
}, h = await (await fetch(
|
|
8092
|
+
}, h = await (await fetch(u, {
|
|
8093
8093
|
signal: this.builder.mediaSignal,
|
|
8094
8094
|
method: "POST",
|
|
8095
|
-
headers:
|
|
8095
|
+
headers: d,
|
|
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
|
|
8119
|
+
const d = await (await fetch(a, {
|
|
8120
8120
|
method: "POST",
|
|
8121
8121
|
body: o
|
|
8122
8122
|
})).json();
|
|
8123
|
-
return
|
|
8123
|
+
return d.ok ? (s = d.url, n = d.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
|
|
8135
|
+
const u = await (await fetch(o, {
|
|
8136
8136
|
method: "POST",
|
|
8137
8137
|
body: r
|
|
8138
8138
|
})).json();
|
|
8139
|
-
return
|
|
8139
|
+
return u.ok ? (s = u.url, n = u.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
|
|
8154
|
+
const d = await (await fetch(a, {
|
|
8155
8155
|
method: "POST",
|
|
8156
8156
|
body: o
|
|
8157
8157
|
})).json();
|
|
8158
|
-
if (
|
|
8159
|
-
s =
|
|
8158
|
+
if (d.ok)
|
|
8159
|
+
s = d.url, n = d.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"),
|
|
8249
|
-
|
|
8248
|
+
const a = o.querySelector(".brush-size"), u = document.createElement("button");
|
|
8249
|
+
u.className = "btn-undobrush", u.title = this.out("Undo"), u.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(
|
|
8256
|
-
const
|
|
8257
|
-
|
|
8255
|
+
</svg>`, r.appendChild(u);
|
|
8256
|
+
const d = document.createElement("button");
|
|
8257
|
+
d.className = "btn-redobrush", d.title = this.out("Redo"), d.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(
|
|
8263
|
+
</svg>`, r.appendChild(d);
|
|
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
|
-
}), d.addEventListener("click", (T) => {
|
|
8312
|
-
T.preventDefault(), m.length > 0 && (y.push(b.toDataURL()), x(m.pop()));
|
|
8313
8311
|
}), u.addEventListener("click", (T) => {
|
|
8312
|
+
T.preventDefault(), m.length > 0 && (y.push(b.toDataURL()), x(m.pop()));
|
|
8313
|
+
}), d.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
|
|
8603
|
-
|
|
8604
|
-
const
|
|
8602
|
+
const u = document.createElement("ul");
|
|
8603
|
+
u.className = "app-list", e.appendChild(u);
|
|
8604
|
+
const d = (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,
|
|
8607
|
+
h = h.filter((b) => b.categories.every((w) => p.includes(w))), this.renderList(h, u);
|
|
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"),
|
|
8612
|
+
a.querySelectorAll("button").forEach((b) => b.classList.remove("active")), h.classList.add("active"), d(l);
|
|
8613
8613
|
}), a.appendChild(h);
|
|
8614
|
-
}),
|
|
8614
|
+
}), d("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((
|
|
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);
|
|
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
|
|
8699
|
-
|
|
8700
|
-
let
|
|
8698
|
+
const u = document.createElement("div");
|
|
8699
|
+
u.className = "div-template-buttons";
|
|
8700
|
+
let d = !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),
|
|
8703
|
+
h.className = "btn-template-view", h.innerText = this.out(this.settings.templateButtons.viewButton.text), u.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
|
-
}),
|
|
8709
|
+
}), d = !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),
|
|
8713
|
+
h.className = "btn-template-use", h.innerText = this.out(this.settings.templateButtons.useButton.text), u.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
|
-
`,
|
|
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) => {
|
|
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
|
|
8745
|
-
|
|
8746
|
-
const
|
|
8747
|
-
|
|
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 = `
|
|
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 ||
|
|
8752
|
+
`, o || u.appendChild(d);
|
|
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
|
-
`,
|
|
8759
|
+
`, u.appendChild(l), d && d.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(_),
|
|
8766
|
+
document.body.removeChild(p), navigator.clipboard.writeText(_), d.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
|
-
|
|
8772
|
+
d.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
|
|
8822
|
-
|
|
8821
|
+
const u = e.offsetTop;
|
|
8822
|
+
u === o ? (n(), s()) : (o = u, requestAnimationFrame(a));
|
|
8823
8823
|
};
|
|
8824
8824
|
a();
|
|
8825
8825
|
}, 200);
|
|
@@ -9658,34 +9658,34 @@ class yn {
|
|
|
9658
9658
|
});
|
|
9659
9659
|
}
|
|
9660
9660
|
}
|
|
9661
|
-
let
|
|
9662
|
-
this.settings.resultSelector && (
|
|
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) => {
|
|
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"),
|
|
9666
|
+
p.className = "form-spacer", l.spacerHeight && !isNaN(parseFloat(l.spacerHeight)) && (p.style.height = l.spacerHeight + "px"), d.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,
|
|
9671
|
+
p.style.borderTopColor = l.color, d.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,
|
|
9677
|
+
p.innerHTML = l.html, d.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!"),
|
|
9683
|
+
p.innerHTML = l.headingText || this.out("Your Heading Here!"), d.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!"),
|
|
9688
|
+
p.innerHTML = l.paragraphText || this.out("Your paragraph content here!"), d.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),
|
|
9696
|
+
h.src = l.url, h.type = "video/mp4", p.appendChild(h), d.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),
|
|
9701
|
+
b.src = l.url, b.type = "audio/mp3", p.appendChild(b), d.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")),
|
|
9704
|
+
p.src = l.url, p.setAttribute("alt", this.out("Output Image")), d.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")),
|
|
9710
|
+
p.src = l.url, p.setAttribute("alt", this.out("Output Image")), d.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),
|
|
9717
|
+
b.src = l.url, b.type = "video/mp4", p.appendChild(b), d.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),
|
|
9724
|
+
b.src = l.url, b.type = "audio/mp3", p.appendChild(b), d.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 (
|
|
9737
|
-
|
|
9738
|
-
const
|
|
9736
|
+
a.addEventListener("click", async (u) => {
|
|
9737
|
+
u.preventDefault();
|
|
9738
|
+
const d = u.target.href;
|
|
9739
9739
|
try {
|
|
9740
|
-
const l = await fetch(
|
|
9740
|
+
const l = await fetch(d, {
|
|
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 =
|
|
9744
|
+
const h = await l.blob(), p = d.substring(d.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
|
|
9819
|
+
const u = a.metadata.title, d = a.markdown, l = a.metadata.url;
|
|
9820
9820
|
r.push(l), n += `
|
|
9821
9821
|
|
|
9822
9822
|
|
|
9823
|
-
## ${
|
|
9823
|
+
## ${u}
|
|
9824
9824
|
|
|
9825
9825
|
Source: ${l}
|
|
9826
9826
|
|
|
9827
|
-
${
|
|
9827
|
+
${d}
|
|
9828
9828
|
|
|
9829
9829
|
|
|
9830
9830
|
----------------
|
|
@@ -9832,24 +9832,24 @@ class yn {
|
|
|
9832
9832
|
|
|
9833
9833
|
`;
|
|
9834
9834
|
} else {
|
|
9835
|
-
let
|
|
9836
|
-
if (
|
|
9837
|
-
const
|
|
9838
|
-
o.push(
|
|
9835
|
+
let u = a.url;
|
|
9836
|
+
if (u) {
|
|
9837
|
+
const d = a.url;
|
|
9838
|
+
o.push(d);
|
|
9839
9839
|
} else
|
|
9840
|
-
|
|
9840
|
+
u = a.url.link, o.push(u);
|
|
9841
9841
|
}
|
|
9842
9842
|
}), this.settings.scrapeProvider === "scrapingbee")
|
|
9843
9843
|
for (let a = 0; a < s.length; a++) {
|
|
9844
|
-
let
|
|
9845
|
-
r.push(
|
|
9846
|
-
let
|
|
9844
|
+
let u = e[a];
|
|
9845
|
+
r.push(u);
|
|
9846
|
+
let d = s[a];
|
|
9847
9847
|
n += `
|
|
9848
9848
|
|
|
9849
9849
|
|
|
9850
|
-
## ${
|
|
9850
|
+
## ${u}
|
|
9851
9851
|
|
|
9852
|
-
${
|
|
9852
|
+
${d}
|
|
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
|
|
9943
|
-
|
|
9944
|
-
let
|
|
9945
|
-
r.url &&
|
|
9946
|
-
let l = await this.scrapeUrls(
|
|
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);
|
|
9947
9947
|
s += l.data, o = l.urls, a = l.failed;
|
|
9948
9948
|
} else if (this.settings.searchUrl && this.settings.scrapeUrl) {
|
|
9949
|
-
let
|
|
9950
|
-
|
|
9951
|
-
let
|
|
9949
|
+
let u = document.createElement("p");
|
|
9950
|
+
u.innerHTML = this.out("Searching the web.."), n.appendChild(u);
|
|
9951
|
+
let d = await this.search(e);
|
|
9952
9952
|
const l = this.settings.scrapeExclude;
|
|
9953
|
-
let h =
|
|
9953
|
+
let h = d.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 = "",
|
|
9958
|
+
n.innerHTML = "", u = document.createElement("p"), u.innerHTML = this.out("Getting more information..."), n.appendChild(u);
|
|
9959
9959
|
let w = [];
|
|
9960
9960
|
for (let g = 0; g < b.length; g++)
|
|
9961
|
-
w.push(
|
|
9961
|
+
w.push(d[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
|
|
10066
|
-
if (e != null && (
|
|
10065
|
+
let u = !1;
|
|
10066
|
+
if (e != null && (u = !0), this.singleStep = u, u || (this.filesUploaded = {}), this.isNormal && !u) {
|
|
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 &&
|
|
10074
|
+
if (this.isNormal && u || this.isSingle && !u || this.isSingle && u)
|
|
10075
10075
|
return;
|
|
10076
|
-
this.isNormal = !1, this.isSingle = !1,
|
|
10076
|
+
this.isNormal = !1, this.isSingle = !1, u ? (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
|
|
10092
|
+
let d = (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}}}`,
|
|
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)));
|
|
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}}}`,
|
|
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)));
|
|
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) && (
|
|
10161
|
+
(C && (C.image || C.video || C.audio) || D) && (u || (o.innerHTML = `
|
|
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
|
-
|
|
10260
|
+
u || 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"),
|
|
10279
|
+
I = I.replace(new RegExp(M, "g"), d(R, k)), I = I.replace(new RegExp(M.toUpperCase(), "g"), d(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"),
|
|
10282
|
+
I = I.replace(new RegExp(M, "g"), d(R, k)), I = I.replace(new RegExp(M.toUpperCase(), "g"), d(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),
|
|
10293
|
+
})(l), u && (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:
|
|
10410
|
-
checked:
|
|
10409
|
+
value: u,
|
|
10410
|
+
checked: d,
|
|
10411
10411
|
files: l
|
|
10412
10412
|
} = r;
|
|
10413
10413
|
if (a === "checkbox")
|
|
10414
|
-
o = o.replace("[]", ""),
|
|
10414
|
+
o = o.replace("[]", ""), d && (i[o] = i[o] || [], u === "other" && (u = e.querySelector(`[name="${o + "_other"}"]`).value), i[o].push(u));
|
|
10415
10415
|
else if (a === "radio")
|
|
10416
|
-
|
|
10416
|
+
d && (u === "other" && (u = e.querySelector(`[name="${o + "_other"}"]`).value), i[o] = u);
|
|
10417
10417
|
else if (a === "select-one")
|
|
10418
|
-
|
|
10418
|
+
u === "other" && (u = e.querySelector(`[name="${o + "_other"}"]`).value), i[o] = u;
|
|
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] =
|
|
10426
|
-
const h = this.hexToRgb(
|
|
10425
|
+
i[o] = u;
|
|
10426
|
+
const h = this.hexToRgb(u);
|
|
10427
10427
|
i[o + "_red"] = h.red, i[o + "_green"] = h.green, i[o + "_blue"] = h.blue;
|
|
10428
10428
|
} else
|
|
10429
|
-
i[o] =
|
|
10429
|
+
i[o] = u;
|
|
10430
10430
|
});
|
|
10431
10431
|
let n = [];
|
|
10432
10432
|
return this.json.elements.forEach((r) => {
|
|
10433
|
-
let o = r.title, a = r.name,
|
|
10433
|
+
let o = r.title, a = r.name, u = r.type;
|
|
10434
10434
|
if (a === "") return;
|
|
10435
|
-
let
|
|
10435
|
+
let d = i[a], l = {
|
|
10436
10436
|
questions: o,
|
|
10437
10437
|
name: a,
|
|
10438
|
-
value:
|
|
10439
|
-
type:
|
|
10438
|
+
value: d,
|
|
10439
|
+
type: u
|
|
10440
10440
|
};
|
|
10441
10441
|
n.push(l);
|
|
10442
10442
|
let h = a + "__url";
|
|
10443
|
-
|
|
10443
|
+
d = i[h], d && (l = {
|
|
10444
10444
|
questions: o,
|
|
10445
10445
|
name: h,
|
|
10446
|
-
value:
|
|
10447
|
-
}, n.push(l)), r.useImageMask && (a = a + "_mask",
|
|
10446
|
+
value: d
|
|
10447
|
+
}, n.push(l)), r.useImageMask && (a = a + "_mask", d = i[a], l = {
|
|
10448
10448
|
questions: o,
|
|
10449
10449
|
name: a,
|
|
10450
|
-
value:
|
|
10450
|
+
value: d
|
|
10451
10451
|
}, n.push(l));
|
|
10452
10452
|
let p = a + "_red";
|
|
10453
|
-
|
|
10453
|
+
d = i[p], d !== void 0 && (l = {
|
|
10454
10454
|
questions: o,
|
|
10455
10455
|
name: p,
|
|
10456
|
-
value:
|
|
10456
|
+
value: d
|
|
10457
10457
|
}, n.push(l));
|
|
10458
10458
|
let b = a + "_green";
|
|
10459
|
-
|
|
10459
|
+
d = i[b], d !== void 0 && (l = {
|
|
10460
10460
|
questions: o,
|
|
10461
10461
|
name: b,
|
|
10462
|
-
value:
|
|
10462
|
+
value: d
|
|
10463
10463
|
}, n.push(l));
|
|
10464
10464
|
let w = a + "_blue";
|
|
10465
|
-
|
|
10465
|
+
d = i[w], d !== void 0 && (l = {
|
|
10466
10466
|
questions: o,
|
|
10467
10467
|
name: w,
|
|
10468
|
-
value:
|
|
10468
|
+
value: d
|
|
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
|
|
10490
|
+
const u = {
|
|
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
|
|
10502
|
+
let d = {
|
|
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:
|
|
10510
|
-
body: JSON.stringify(
|
|
10509
|
+
headers: d,
|
|
10510
|
+
body: JSON.stringify(u)
|
|
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 (
|
|
10523
|
-
return
|
|
10522
|
+
} catch (d) {
|
|
10523
|
+
return d.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", d), !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,
|
|
10528
|
+
let o = 0.6, a = 0.9, u = 1;
|
|
10529
10529
|
s || (s = []), n = n || this.settings.model;
|
|
10530
|
-
const
|
|
10530
|
+
const d = {
|
|
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:
|
|
10537
|
+
num: u,
|
|
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(
|
|
10551
|
+
body: JSON.stringify(d)
|
|
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
|
|
10602
|
+
const u = {
|
|
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
|
|
10615
|
+
let d = {
|
|
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:
|
|
10623
|
-
body: JSON.stringify(
|
|
10622
|
+
headers: d,
|
|
10623
|
+
body: JSON.stringify(u)
|
|
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 (
|
|
10628
|
-
return
|
|
10627
|
+
} catch (d) {
|
|
10628
|
+
return d.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", d), !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
|
|
10635
|
+
const u = {
|
|
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
|
|
10648
|
+
let d = {
|
|
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:
|
|
10657
|
-
body: JSON.stringify(
|
|
10656
|
+
headers: d,
|
|
10657
|
+
body: JSON.stringify(u)
|
|
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 (
|
|
10699
|
-
return
|
|
10698
|
+
} catch (d) {
|
|
10699
|
+
return d.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", d), !1;
|
|
10700
10700
|
}
|
|
10701
10701
|
}
|
|
10702
10702
|
hexToRgb(e) {
|
|
@@ -10837,9 +10837,12 @@ class vn {
|
|
|
10837
10837
|
if (n && typeof n.mount == "function")
|
|
10838
10838
|
try {
|
|
10839
10839
|
const s = this.parseOptions(t);
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10840
|
+
let r = t.querySelector(".grid-sortable");
|
|
10841
|
+
r || t.classList.contains("grid-sortable") && (r = t), r && Array.from(r.children).forEach((a, u) => {
|
|
10842
|
+
a.nodeType === 1 && a.tagName !== "STYLE" && a.tagName !== "SCRIPT" && a.setAttribute("data-index", u);
|
|
10843
|
+
}), t.hasAttribute("data-cb-original-content") || t.setAttribute("data-cb-original-content", t.innerHTML);
|
|
10844
|
+
const o = n.mount(t, s);
|
|
10845
|
+
this.components.set(t, o), t.setAttribute("data-cb-loaded", "true");
|
|
10843
10846
|
} catch (s) {
|
|
10844
10847
|
console.error(`[PluginManager] Failed to mount component "${i}":`, s);
|
|
10845
10848
|
}
|
|
@@ -10985,8 +10988,8 @@ class vn {
|
|
|
10985
10988
|
this.components.forEach((o, a) => {
|
|
10986
10989
|
(e === document || e.contains(a)) && t.push({ element: a, instance: o });
|
|
10987
10990
|
}), t.forEach(({ element: o, instance: a }) => {
|
|
10988
|
-
const
|
|
10989
|
-
|
|
10991
|
+
const u = o.dataset.cbType, d = this.plugins.get(u);
|
|
10992
|
+
d && typeof d.unmount == "function" && d.unmount(o, a), this.components.delete(o);
|
|
10990
10993
|
});
|
|
10991
10994
|
const n = this.detectComponentTypesInContainer(e).filter(
|
|
10992
10995
|
(o) => this.config.plugins[o] && !this.plugins.has(o)
|
|
@@ -10997,15 +11000,18 @@ class vn {
|
|
|
10997
11000
|
const s = e.querySelectorAll("[data-cb-type]");
|
|
10998
11001
|
let r = 0;
|
|
10999
11002
|
for (const o of s) {
|
|
11000
|
-
const a = o.dataset.cbType,
|
|
11001
|
-
if (
|
|
11003
|
+
const a = o.dataset.cbType, u = this.plugins.get(a);
|
|
11004
|
+
if (u && typeof u.mount == "function")
|
|
11002
11005
|
try {
|
|
11003
|
-
const
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11006
|
+
const d = this.parseOptions(o);
|
|
11007
|
+
let l = o.querySelector(".grid-sortable");
|
|
11008
|
+
l || o.classList.contains("grid-sortable") && (l = o), l && Array.from(l.children).forEach((p, b) => {
|
|
11009
|
+
p.nodeType === 1 && p.tagName !== "STYLE" && p.tagName !== "SCRIPT" && p.setAttribute("data-index", b);
|
|
11010
|
+
}), o.hasAttribute("data-cb-original-content") ? o.innerHTML = o.getAttribute("data-cb-original-content") : o.setAttribute("data-cb-original-content", o.innerHTML);
|
|
11011
|
+
const h = await u.mount(o, d);
|
|
11012
|
+
this.components.set(o, h), o.setAttribute("data-cb-loaded", "true"), r++;
|
|
11013
|
+
} catch (d) {
|
|
11014
|
+
console.error(`[PluginManager] Failed to mount component "${a}":`, d);
|
|
11009
11015
|
}
|
|
11010
11016
|
}
|
|
11011
11017
|
return this.emit("reinitialized", { container: e, count: r }), r;
|
|
@@ -11313,13 +11319,13 @@ class wn {
|
|
|
11313
11319
|
if (t) {
|
|
11314
11320
|
const o = t.closest("[data-gallery]");
|
|
11315
11321
|
let a = [];
|
|
11316
|
-
o ? a = o.querySelectorAll(".is-lightbox") : document.querySelectorAll(".is-lightbox,.block-click").forEach((
|
|
11317
|
-
|
|
11318
|
-
}), a.forEach((
|
|
11319
|
-
let l =
|
|
11320
|
-
l || (l =
|
|
11322
|
+
o ? a = o.querySelectorAll(".is-lightbox") : document.querySelectorAll(".is-lightbox,.block-click").forEach((d) => {
|
|
11323
|
+
d.closest("[data-gallery]") || a.push(d);
|
|
11324
|
+
}), a.forEach((u, d) => {
|
|
11325
|
+
let l = u.getAttribute("href");
|
|
11326
|
+
l || (l = u.getAttribute("data-modal-url")), n.push({
|
|
11321
11327
|
href: l
|
|
11322
|
-
}), e === l && (s =
|
|
11328
|
+
}), e === l && (s = d);
|
|
11323
11329
|
});
|
|
11324
11330
|
}
|
|
11325
11331
|
const r = document.activeElement;
|