@innovastudio/contentbuilder-interactive-runtime 1.0.30 → 1.0.32
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.
|
@@ -13,12 +13,12 @@ function fe() {
|
|
|
13
13
|
return c;
|
|
14
14
|
}
|
|
15
15
|
function X(c, e) {
|
|
16
|
-
if ((ge(c) || c === window || c === document) && (c = [c]), !Ot(c) && !
|
|
17
|
-
if (Ot(c) && !
|
|
16
|
+
if ((ge(c) || c === window || c === document) && (c = [c]), !Ot(c) && !Ce(c) && (c = [c]), si(c) != 0) {
|
|
17
|
+
if (Ot(c) && !Ce(c)) {
|
|
18
18
|
let t = c.length, i = 0;
|
|
19
19
|
for (; i < t && e.call(c[i], c[i], i, c) !== !1; i++)
|
|
20
20
|
;
|
|
21
|
-
} else if (
|
|
21
|
+
} else if (Ce(c)) {
|
|
22
22
|
for (let t in c)
|
|
23
23
|
if (Z(c, t) && e.call(c[t], c[t], t, c) === !1)
|
|
24
24
|
break;
|
|
@@ -35,17 +35,17 @@ function qt(c, e = null, t = null) {
|
|
|
35
35
|
function oe(c, { onElement: e, withCallback: t, avoidDuplicate: i = !0, once: s = !1, useCapture: n = !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), s && 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, n);
|
|
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, n), d.all.push({ eventName: c, fn: a }));
|
|
49
49
|
}), a;
|
|
50
50
|
}
|
|
51
51
|
function H(c, e) {
|
|
@@ -65,7 +65,7 @@ function ue(c, e) {
|
|
|
65
65
|
return c;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Le(c, e = "", t = !1) {
|
|
69
69
|
if (!c || e === "")
|
|
70
70
|
return !1;
|
|
71
71
|
if (e === "none")
|
|
@@ -84,7 +84,7 @@ function Ce(c, e = "", t = !1) {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function Be(c, e = "") {
|
|
88
88
|
if (e === "")
|
|
89
89
|
return c.style.webkitTransform = "", c.style.MozTransform = "", c.style.msTransform = "", c.style.OTransform = "", c.style.transform = "", !1;
|
|
90
90
|
c.style.webkitTransform = e, c.style.MozTransform = e, c.style.msTransform = e, c.style.OTransform = e, c.style.transform = e;
|
|
@@ -213,7 +213,7 @@ function ii(c) {
|
|
|
213
213
|
function Ot(c) {
|
|
214
214
|
return c && c.length && isFinite(c.length);
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function Ce(c) {
|
|
217
217
|
return typeof c === "object" && c != null && !G(c) && !ii(c);
|
|
218
218
|
}
|
|
219
219
|
function re(c) {
|
|
@@ -223,7 +223,7 @@ function Z(c, e) {
|
|
|
223
223
|
return c !== null && hasOwnProperty.call(c, e);
|
|
224
224
|
}
|
|
225
225
|
function si(c) {
|
|
226
|
-
if (
|
|
226
|
+
if (Ce(c)) {
|
|
227
227
|
if (c.keys)
|
|
228
228
|
return c.keys().length;
|
|
229
229
|
let e = 0;
|
|
@@ -297,12 +297,12 @@ function Ei(c, e) {
|
|
|
297
297
|
var i = Ti(c, e) / t;
|
|
298
298
|
return i > 1 && (i = 1), Math.acos(i);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function Li(c, e) {
|
|
301
301
|
return c.x * e.y - e.x * c.y;
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function Ci(c, e) {
|
|
304
304
|
var t = Ei(c, e);
|
|
305
|
-
return
|
|
305
|
+
return Li(c, e) > 0 && (t *= -1), t * 180 / Math.PI;
|
|
306
306
|
}
|
|
307
307
|
class Ri {
|
|
308
308
|
constructor(e) {
|
|
@@ -361,12 +361,12 @@ class Mi {
|
|
|
361
361
|
var t = this.preV, i = e.touches.length, s = e.touches[0].pageX, n = e.touches[0].pageY;
|
|
362
362
|
if (this.isDoubleTap = !1, i > 1) {
|
|
363
363
|
var r = e.touches[1].pageX, o = e.touches[1].pageY, a = { x: e.touches[1].pageX - s, y: e.touches[1].pageY - n };
|
|
364
|
-
t.x !== null && (this.pinchStartLen > 0 && (e.zoom = Xe(a) / this.pinchStartLen, this.pinch.dispatch(e, this.element)), e.angle =
|
|
364
|
+
t.x !== null && (this.pinchStartLen > 0 && (e.zoom = Xe(a) / this.pinchStartLen, this.pinch.dispatch(e, this.element)), e.angle = Ci(a, t), this.rotate.dispatch(e, this.element)), t.x = a.x, t.y = a.y, this.x2 !== null && this.sx2 !== null ? (e.deltaX = (s - this.x2 + r - this.sx2) / 2, e.deltaY = (n - this.y2 + o - this.sy2) / 2) : (e.deltaX = 0, e.deltaY = 0), this.twoFingerPressMove.dispatch(e, this.element), this.sx2 = r, this.sy2 = o;
|
|
365
365
|
} else {
|
|
366
366
|
if (this.x2 !== null) {
|
|
367
367
|
e.deltaX = s - this.x2, e.deltaY = n - 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);
|
|
@@ -415,7 +415,7 @@ class Mi {
|
|
|
415
415
|
function lt(c) {
|
|
416
416
|
const e = xi(), t = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
417
417
|
let i = te(c, "gslide-media") ? c : c.querySelector(".gslide-media"), s = ue(i, ".ginner-container"), n = c.querySelector(".gslide-description");
|
|
418
|
-
t > 769 && (i = s), H(i, "greset"),
|
|
418
|
+
t > 769 && (i = s), H(i, "greset"), Be(i, "translate3d(0, 0, 0)"), oe(e, {
|
|
419
419
|
onElement: i,
|
|
420
420
|
once: !0,
|
|
421
421
|
withCallback: (r, o) => {
|
|
@@ -426,11 +426,11 @@ 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, s = !1, n = null, r = null, o = null, a = !1,
|
|
429
|
+
let e = ti(), t = e.width, i = e.height, s = !1, n = 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, y, f, m = 0, v = 0, k = !1, x = !1, S = {}, E = {}, L = 0, A = 0, C;
|
|
430
430
|
const D = document.getElementById("glightbox-slider"), I = document.querySelector(".goverlay"), O = new Mi(D, {
|
|
431
431
|
touchStart: (R) => {
|
|
432
432
|
if (s = !0, (te(R.targetTouches[0].target, "ginner-container") || ue(R.targetTouches[0].target, ".gslide-desc") || R.targetTouches[0].target.nodeName.toLowerCase() == "a") && (s = !1), ue(R.targetTouches[0].target, ".gslide-inline") && !te(R.targetTouches[0].target.parentNode, "gslide-inline") && (s = !1), s) {
|
|
433
|
-
if (E = R.targetTouches[0], S.pageX = R.targetTouches[0].pageX, S.pageY = R.targetTouches[0].pageY,
|
|
433
|
+
if (E = R.targetTouches[0], S.pageX = R.targetTouches[0].pageX, S.pageY = R.targetTouches[0].pageY, L = R.targetTouches[0].clientX, A = R.targetTouches[0].clientY, n = c.activeSlide, r = n.querySelector(".gslide-media"), C = n.querySelector(".gslide-inline"), o = null, te(r, "gslide-image") && (o = r.querySelector("img")), (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) > 769 && (r = n.querySelector(".ginner-container")), J(I, "greset"), R.pageX > 20 && R.pageX < window.innerWidth - 20)
|
|
434
434
|
return;
|
|
435
435
|
R.preventDefault();
|
|
436
436
|
}
|
|
@@ -438,18 +438,18 @@ function Ai(c) {
|
|
|
438
438
|
touchMove: (R) => {
|
|
439
439
|
if (!s || (E = R.targetTouches[0], h || p))
|
|
440
440
|
return;
|
|
441
|
-
if (
|
|
441
|
+
if (C && C.offsetHeight > i) {
|
|
442
442
|
const U = S.pageX - E.pageX;
|
|
443
443
|
if (Math.abs(U) <= 13)
|
|
444
444
|
return !1;
|
|
445
445
|
}
|
|
446
446
|
a = !0;
|
|
447
|
-
let q = R.targetTouches[0].clientX, M = R.targetTouches[0].clientY, T =
|
|
448
|
-
Math.abs(T) > Math.abs($) ? (k = !1, x = !0) : (x = !1, k = !0),
|
|
447
|
+
let q = R.targetTouches[0].clientX, M = R.targetTouches[0].clientY, T = L - q, $ = A - M;
|
|
448
|
+
Math.abs(T) > Math.abs($) ? (k = !1, x = !0) : (x = !1, k = !0), y = E.pageX - S.pageX, m = y * 100 / t, f = E.pageY - S.pageY, v = f * 100 / i;
|
|
449
449
|
let N;
|
|
450
|
-
if (k && o && (N = 1 - Math.abs(f) / i, I.style.opacity = N, c.settings.touchFollowAxis && (m = 0)), x && (N = 1 - Math.abs(
|
|
451
|
-
return
|
|
452
|
-
|
|
450
|
+
if (k && o && (N = 1 - Math.abs(f) / i, I.style.opacity = N, c.settings.touchFollowAxis && (m = 0)), x && (N = 1 - Math.abs(y) / t, r.style.opacity = N, c.settings.touchFollowAxis && (v = 0)), !o)
|
|
451
|
+
return Be(r, `translate3d(${m}%, 0, 0)`);
|
|
452
|
+
Be(r, `translate3d(${m}%, ${v}%, 0)`);
|
|
453
453
|
},
|
|
454
454
|
touchEnd: () => {
|
|
455
455
|
if (!s)
|
|
@@ -458,7 +458,7 @@ function Ai(c) {
|
|
|
458
458
|
_ = b, g = w;
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
|
-
const R = Math.abs(parseInt(
|
|
461
|
+
const R = Math.abs(parseInt(v)), q = Math.abs(parseInt(m));
|
|
462
462
|
if (R > 29 && o) {
|
|
463
463
|
c.close();
|
|
464
464
|
return;
|
|
@@ -472,25 +472,25 @@ 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) {
|
|
490
490
|
var q = E.pageX - S.pageX, M = E.pageY - S.pageY;
|
|
491
491
|
_ && (q = q + _), g && (M = M + g), b = q, w = M;
|
|
492
492
|
let T = `translate3d(${q}px, ${M}px, 0)`;
|
|
493
|
-
l && (T += ` scale3d(${l}, ${l}, 1)`),
|
|
493
|
+
l && (T += ` scale3d(${l}, ${l}, 1)`), Be(o, T);
|
|
494
494
|
}
|
|
495
495
|
},
|
|
496
496
|
swipe: (R) => {
|
|
@@ -643,15 +643,15 @@ function Ii(c, e, t, i) {
|
|
|
643
643
|
H(s, "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="' + n + '" ';
|
|
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="${n}" data-plyr-provider="${
|
|
654
|
-
H(a, `${
|
|
653
|
+
const h = l || _e(`<div id="${n}" data-plyr-provider="${d}" data-plyr-embed-id="${u}"></div>`);
|
|
654
|
+
H(a, `${d}-video gvideo`), a.appendChild(h), a.setAttribute("data-id", n), a.setAttribute("data-index", t);
|
|
655
655
|
const p = Z(this.settings.plyr, "config") ? this.settings.plyr.config : {}, b = new Plyr("#" + n, p);
|
|
656
656
|
b.on("ready", (w) => {
|
|
657
657
|
o[n] = w.detail.plyr, G(i) && i();
|
|
@@ -679,8 +679,8 @@ function Oi(c, e, t, i) {
|
|
|
679
679
|
let a = document.getElementById(n);
|
|
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;
|
|
@@ -716,7 +716,7 @@ class Ni {
|
|
|
716
716
|
content: !1,
|
|
717
717
|
zoomable: !0,
|
|
718
718
|
draggable: !0
|
|
719
|
-
},
|
|
719
|
+
}, Ce(e) && (this.defaults = fe(this.defaults, e));
|
|
720
720
|
}
|
|
721
721
|
/**
|
|
722
722
|
* Get source type
|
|
@@ -730,7 +730,7 @@ class Ni {
|
|
|
730
730
|
}
|
|
731
731
|
parseConfig(e, t) {
|
|
732
732
|
let i = fe({ descPosition: t.descPosition }, this.defaults);
|
|
733
|
-
if (
|
|
733
|
+
if (Ce(e) && !ge(e)) {
|
|
734
734
|
Z(e, "type") || (Z(e, "content") && e.content ? e.type = "inline" : Z(e, "href") && (e.type = this.sourceType(e.href)));
|
|
735
735
|
let o = fe(i, e);
|
|
736
736
|
return this.setSize(o, t), o;
|
|
@@ -738,8 +738,8 @@ class Ni {
|
|
|
738
738
|
let s = "", n = e.getAttribute("data-glightbox"), r = e.nodeName.toLowerCase();
|
|
739
739
|
if (r === "a" && (s = e.href), r === "img" && (s = e.src, i.alt = e.alt), i.href = s, 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 && s && (i.type = this.sourceType(s)), re(n)) {
|
|
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?:|"), n.trim() !== "" && X(i, (a,
|
|
757
|
-
const
|
|
754
|
+
X(i, (a, u) => {
|
|
755
|
+
o.push(";\\s?" + u);
|
|
756
|
+
}), o = o.join("\\s?:|"), n.trim() !== "" && X(i, (a, u) => {
|
|
757
|
+
const d = n, 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 = s.type, o = s.descPosition, a = e.querySelector(".gslide-media"),
|
|
833
|
+
let r = s.type, o = s.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
|
-
}), s.title == "" && s.description == "" ? l && l.parentNode.parentNode.removeChild(l.parentNode) : (
|
|
840
|
+
}), s.title == "" && s.description == "" ? l && l.parentNode.parentNode.removeChild(l.parentNode) : (u && s.title !== "" ? (u.id = p, u.innerHTML = s.title) : u.parentNode.removeChild(u), d && s.description !== "" ? (d.id = b, n && i.moreLength > 0 ? (s.smallDescription = this.slideShortDesc(s.description, i.moreLength, i.moreText), d.innerHTML = s.smallDescription, this.descriptionEvents(d, s)) : d.innerHTML = s.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, s, 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
|
}
|
|
@@ -1055,7 +1055,7 @@ class Ut {
|
|
|
1055
1055
|
const o = e.getAttribute("data-gallery");
|
|
1056
1056
|
o && (this.fullElementsList = this.elements, this.elements = this.getGalleryElements(this.elements, o)), re(i) && (i = this.getElementIndex(e), i < 0 && (i = 0));
|
|
1057
1057
|
}
|
|
1058
|
-
Ge(i) || (i = 0), this.build(),
|
|
1058
|
+
Ge(i) || (i = 0), this.build(), Le(this.overlay, this.settings.openEffect === "none" ? "none" : this.settings.cssEfects.fade.in);
|
|
1059
1059
|
const s = document.body, n = window.innerWidth - document.documentElement.clientWidth;
|
|
1060
1060
|
if (n > 0) {
|
|
1061
1061
|
var r = document.createElement("style");
|
|
@@ -1161,15 +1161,15 @@ class Ut {
|
|
|
1161
1161
|
t < 0 && (t = this.elements.length);
|
|
1162
1162
|
const i = new ze(e, this, t), s = i.getConfig(), n = fe({}, s), r = i.create(), o = this.elements.length - 1;
|
|
1163
1163
|
n.index = t, n.node = !1, n.instance = i, n.slideConfig = s, this.elements.splice(t, 0, n);
|
|
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), n.slideNode = a;
|
|
1173
1173
|
}
|
|
1174
1174
|
this.trigger("slide_inserted", {
|
|
1175
1175
|
index: t,
|
|
@@ -1178,11 +1178,11 @@ class Ut {
|
|
|
1178
1178
|
slideConfig: s,
|
|
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
|
/**
|
|
@@ -1221,7 +1221,7 @@ class Ut {
|
|
|
1221
1221
|
player: this.getSlidePlayerInstance(this.index)
|
|
1222
1222
|
};
|
|
1223
1223
|
if (i.offsetWidth > 0 && s && (ot(s), s.style.display = ""), J(e, this.effectsClasses), t)
|
|
1224
|
-
|
|
1224
|
+
Le(e, this.settings.cssEfects[this.settings.openEffect].in, () => {
|
|
1225
1225
|
this.settings.autoplayVideos && this.slidePlayerPlay(e), this.trigger("slide_changed", {
|
|
1226
1226
|
prev: n,
|
|
1227
1227
|
current: r
|
|
@@ -1229,7 +1229,7 @@ class Ut {
|
|
|
1229
1229
|
});
|
|
1230
1230
|
else {
|
|
1231
1231
|
let o = this.settings.slideEffect, a = o !== "none" ? this.settings.cssEfects[o].in : o;
|
|
1232
|
-
this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (a = this.settings.cssEfects.slideBack.in),
|
|
1232
|
+
this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (a = this.settings.cssEfects.slideBack.in), Le(e, a, () => {
|
|
1233
1233
|
this.settings.autoplayVideos && this.slidePlayerPlay(e), this.trigger("slide_changed", {
|
|
1234
1234
|
prev: n,
|
|
1235
1235
|
current: r
|
|
@@ -1283,7 +1283,7 @@ class Ut {
|
|
|
1283
1283
|
slide: this.activeSlide,
|
|
1284
1284
|
player: this.getSlidePlayerInstance(this.index)
|
|
1285
1285
|
}
|
|
1286
|
-
]), this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (i = this.settings.cssEfects.slideBack.out),
|
|
1286
|
+
]), this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (i = this.settings.cssEfects.slideBack.out), Le(e, i, () => {
|
|
1287
1287
|
let s = e.querySelector(".ginner-container"), n = e.querySelector(".gslide-media"), r = e.querySelector(".gslide-description");
|
|
1288
1288
|
s.style.transform = "", n.style.transform = "", J(n, "greset"), n.style.opacity = "", r && (r.style.opacity = ""), J(e, "prev");
|
|
1289
1289
|
});
|
|
@@ -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 : "", s = Z(this.settings.svg, "prev") ? this.settings.svg.prev : "", n = 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
|
s.querySelector("img");
|
|
1533
1533
|
else if (a) {
|
|
1534
|
-
let
|
|
1534
|
+
let u = n.offsetHeight, d = s.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)`), n.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 - n.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 && n.setAttribute("style", `max-width: ${g.width}px;`);
|
|
@@ -1591,7 +1591,7 @@ class Ut {
|
|
|
1591
1591
|
return !1;
|
|
1592
1592
|
this.closing = !0, this.slidePlayerPause(this.activeSlide), this.fullElementsList && (this.elements = this.fullElementsList), this.bodyHiddenChildElms.length && X(this.bodyHiddenChildElms, (e) => {
|
|
1593
1593
|
e.removeAttribute("aria-hidden");
|
|
1594
|
-
}), H(this.modal, "glightbox-closing"),
|
|
1594
|
+
}), H(this.modal, "glightbox-closing"), Le(this.overlay, this.settings.openEffect == "none" ? "none" : this.settings.cssEfects.fade.out), Le(this.activeSlide, this.settings.cssEfects[this.settings.closeEffect].out, () => {
|
|
1595
1595
|
if (this.activeSlide = null, this.prevActiveSlideIndex = null, this.prevActiveSlide = null, this.built = !1, this.events) {
|
|
1596
1596
|
for (let i in this.events)
|
|
1597
1597
|
this.events.hasOwnProperty(i) && this.events[i].destroy();
|
|
@@ -1666,7 +1666,7 @@ function jt(c, e) {
|
|
|
1666
1666
|
}
|
|
1667
1667
|
return t;
|
|
1668
1668
|
}
|
|
1669
|
-
function
|
|
1669
|
+
function Ft(c) {
|
|
1670
1670
|
for (var e = 1; e < arguments.length; e++) {
|
|
1671
1671
|
var t = arguments[e] != null ? arguments[e] : {};
|
|
1672
1672
|
e % 2 ? jt(Object(t), !0).forEach(function(i) {
|
|
@@ -1737,17 +1737,17 @@ function ji() {
|
|
|
1737
1737
|
return !1;
|
|
1738
1738
|
}
|
|
1739
1739
|
}
|
|
1740
|
-
function
|
|
1740
|
+
function Fi(c) {
|
|
1741
1741
|
if (c === void 0)
|
|
1742
1742
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1743
1743
|
return c;
|
|
1744
1744
|
}
|
|
1745
|
-
function
|
|
1745
|
+
function Bi(c, e) {
|
|
1746
1746
|
if (e && (typeof e == "object" || typeof e == "function"))
|
|
1747
1747
|
return e;
|
|
1748
1748
|
if (e !== void 0)
|
|
1749
1749
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
1750
|
-
return
|
|
1750
|
+
return Fi(c);
|
|
1751
1751
|
}
|
|
1752
1752
|
function Gi(c) {
|
|
1753
1753
|
var e = ji();
|
|
@@ -1758,7 +1758,7 @@ function Gi(c) {
|
|
|
1758
1758
|
s = Reflect.construct(i, arguments, n);
|
|
1759
1759
|
} else
|
|
1760
1760
|
s = i.apply(this, arguments);
|
|
1761
|
-
return
|
|
1761
|
+
return Bi(this, s);
|
|
1762
1762
|
};
|
|
1763
1763
|
}
|
|
1764
1764
|
function Wi(c, e) {
|
|
@@ -2026,7 +2026,7 @@ function pt(c, e) {
|
|
|
2026
2026
|
t.classes = Object.assign({}, c.classes, e.classes);
|
|
2027
2027
|
var i = ["direction", "type", "slide", "arrow", "nav"];
|
|
2028
2028
|
i.forEach(function(s) {
|
|
2029
|
-
e.classes.hasOwnProperty(s) && (t.classes[s] =
|
|
2029
|
+
e.classes.hasOwnProperty(s) && (t.classes[s] = Ft(Ft({}, c.classes[s]), e.classes[s]));
|
|
2030
2030
|
});
|
|
2031
2031
|
}
|
|
2032
2032
|
return e.hasOwnProperty("breakpoints") && (t.breakpoints = Object.assign({}, c.breakpoints, e.breakpoints)), t;
|
|
@@ -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 = s(p);
|
|
2310
|
-
b >
|
|
2310
|
+
b > d && (this._o = !0), c.index = n(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 s(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 n(a,
|
|
2360
|
-
var
|
|
2361
|
-
return a <=
|
|
2359
|
+
function n(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
|
/**
|
|
@@ -2414,21 +2414,21 @@ function Ki(c, e, t) {
|
|
|
2414
2414
|
}
|
|
2415
2415
|
}), i;
|
|
2416
2416
|
}
|
|
2417
|
-
function
|
|
2417
|
+
function Bt() {
|
|
2418
2418
|
return (/* @__PURE__ */ new Date()).getTime();
|
|
2419
2419
|
}
|
|
2420
2420
|
function it(c, e) {
|
|
2421
2421
|
var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i, s, n, r, o = 0, a = function() {
|
|
2422
|
-
o = t.leading === !1 ? 0 :
|
|
2423
|
-
},
|
|
2424
|
-
var l =
|
|
2422
|
+
o = t.leading === !1 ? 0 : Bt(), i = null, r = c.apply(s, n), i || (s = n = null);
|
|
2423
|
+
}, u = function() {
|
|
2424
|
+
var l = Bt();
|
|
2425
2425
|
!o && t.leading === !1 && (o = l);
|
|
2426
2426
|
var h = e - (l - o);
|
|
2427
2427
|
return s = this, n = arguments, h <= 0 || h > e ? (i && (clearTimeout(i), i = null), o = l, r = c.apply(s, n), i || (s = n = 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 = s = n = 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(n) {
|
|
2447
2447
|
for (var r = 0, o = n.length; r < o; r++) {
|
|
2448
|
-
var a = n[r].style,
|
|
2449
|
-
r !== 0 ? a[Ue[
|
|
2448
|
+
var a = n[r].style, u = e.Direction.value;
|
|
2449
|
+
r !== 0 ? a[Ue[u][0]] = "".concat(this.value / 2, "px") : a[Ue[u][0]] = "", r !== n.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 n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], r = e.Html.slides, o = c.settings, a = o.perView,
|
|
2825
|
+
var n = 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), n.push(g);
|
|
2831
2831
|
}
|
|
2832
|
-
for (var
|
|
2833
|
-
var f = b[
|
|
2834
|
-
f.classList.add(
|
|
2832
|
+
for (var y = 0; y < b.length; y++) {
|
|
2833
|
+
var f = b[y].cloneNode(!0);
|
|
2834
|
+
f.classList.add(u.slide.clone), n.unshift(f);
|
|
2835
2835
|
}
|
|
2836
2836
|
}
|
|
2837
2837
|
return n;
|
|
@@ -2842,10 +2842,10 @@ function ls(c, e, t) {
|
|
|
2842
2842
|
* @return {Void}
|
|
2843
2843
|
*/
|
|
2844
2844
|
append: function() {
|
|
2845
|
-
for (var n = this.items, r = e.Html, o = r.wrapper, a = r.slides,
|
|
2845
|
+
for (var n = this.items, r = e.Html, o = r.wrapper, a = r.slides, u = Math.floor(n.length / 2), d = n.slice(0, u).reverse(), l = n.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 < n.length; w++)
|
|
2850
2850
|
n[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(), s = 0, n = 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
|
*
|
|
@@ -3284,8 +3284,8 @@ function ws(c, e, t) {
|
|
|
3284
3284
|
*/
|
|
3285
3285
|
move: function(l) {
|
|
3286
3286
|
if (!c.disabled) {
|
|
3287
|
-
var h = c.settings, p = h.touchAngle, b = h.touchRatio, w = h.classes, _ = this.touches(l), g = Q(_.pageX) - n,
|
|
3288
|
-
if (s = Math.asin(k /
|
|
3287
|
+
var h = c.settings, p = h.touchAngle, b = h.touchRatio, w = h.classes, _ = this.touches(l), g = Q(_.pageX) - n, y = Q(_.pageY) - r, f = Math.abs(g << 2), m = Math.abs(y << 2), v = Math.sqrt(f + m), k = Math.sqrt(m);
|
|
3288
|
+
if (s = Math.asin(k / v), s * 180 / Math.PI < p)
|
|
3289
3289
|
l.stopPropagation(), e.Move.make(g * Yi(b)), e.Html.root.classList.add(w.dragging), t.emit("swipe.move");
|
|
3290
3290
|
else
|
|
3291
3291
|
return !1;
|
|
@@ -3299,8 +3299,8 @@ function ws(c, e, t) {
|
|
|
3299
3299
|
*/
|
|
3300
3300
|
end: function(l) {
|
|
3301
3301
|
if (!c.disabled) {
|
|
3302
|
-
var h = c.settings, p = h.perSwipe, b = h.touchAngle, w = h.classes, _ = this.touches(l), g = this.threshold(l),
|
|
3303
|
-
this.enable(),
|
|
3302
|
+
var h = c.settings, p = h.perSwipe, b = h.touchAngle, w = h.classes, _ = this.touches(l), g = this.threshold(l), y = _.pageX - n, f = s * 180 / Math.PI;
|
|
3303
|
+
this.enable(), y > g && f < b ? e.Run.make(e.Direction.resolve("".concat(p, "<"))) : y < -g && f < b ? e.Run.make(e.Direction.resolve("".concat(p, ">"))) : e.Move.make(), e.Html.root.classList.remove(w.dragging), this.unbindSwipeMove(), this.unbindSwipeEnd(), t.emit("swipe.end");
|
|
3304
3304
|
}
|
|
3305
3305
|
},
|
|
3306
3306
|
/**
|
|
@@ -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(), s = {
|
|
@@ -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
|
});
|
|
@@ -3685,7 +3685,7 @@ function Es(c, e, t) {
|
|
|
3685
3685
|
n.removeBindings(), n.removeActive(), i.destroy();
|
|
3686
3686
|
}), n;
|
|
3687
3687
|
}
|
|
3688
|
-
function
|
|
3688
|
+
function Ls(c, e, t) {
|
|
3689
3689
|
var i = new we(), s = {
|
|
3690
3690
|
/**
|
|
3691
3691
|
* Binds keyboard events on component mount.
|
|
@@ -3733,7 +3733,7 @@ function Cs(c, e, t) {
|
|
|
3733
3733
|
i.destroy();
|
|
3734
3734
|
}), s;
|
|
3735
3735
|
}
|
|
3736
|
-
function
|
|
3736
|
+
function Cs(c, e, t) {
|
|
3737
3737
|
var i = new we(), s = {
|
|
3738
3738
|
/**
|
|
3739
3739
|
* Initializes autoplaying and events.
|
|
@@ -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
|
}
|
|
@@ -3875,8 +3875,8 @@ var Ms = {
|
|
|
3875
3875
|
Images: xs,
|
|
3876
3876
|
Anchors: ks,
|
|
3877
3877
|
Controls: Es,
|
|
3878
|
-
Keyboard:
|
|
3879
|
-
Autoplay:
|
|
3878
|
+
Keyboard: Ls,
|
|
3879
|
+
Autoplay: Cs,
|
|
3880
3880
|
Breakpoints: Rs
|
|
3881
3881
|
}, As = /* @__PURE__ */ (function(c) {
|
|
3882
3882
|
Ui(t, c);
|
|
@@ -3911,7 +3911,7 @@ function li(c) {
|
|
|
3911
3911
|
Te = c;
|
|
3912
3912
|
}
|
|
3913
3913
|
const De = { exec: () => null };
|
|
3914
|
-
function
|
|
3914
|
+
function F(c, e = "") {
|
|
3915
3915
|
let t = typeof c == "string" ? c : c.source;
|
|
3916
3916
|
const i = {
|
|
3917
3917
|
replace: (s, n) => {
|
|
@@ -3979,7 +3979,7 @@ const ie = {
|
|
|
3979
3979
|
fencesBeginRegex: (c) => new RegExp(`^ {0,${Math.min(3, c - 1)}}(?:\`\`\`|~~~)`),
|
|
3980
3980
|
headingBeginRegex: (c) => new RegExp(`^ {0,${Math.min(3, c - 1)}}#`),
|
|
3981
3981
|
htmlBeginRegex: (c) => new RegExp(`^ {0,${Math.min(3, c - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
3982
|
-
}, qs = /^(?:[ \t]*(?:\n|$))+/, Ps = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Is = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, He = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Os = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, xt = /(?:[*+-]|\d{1,9}[.)])/, ai = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ci =
|
|
3982
|
+
}, qs = /^(?:[ \t]*(?:\n|$))+/, Ps = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Is = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, He = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Os = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, xt = /(?:[*+-]|\d{1,9}[.)])/, ai = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ci = F(ai).replace(/bull/g, xt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), $s = F(ai).replace(/bull/g, xt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), kt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ns = /^[^\n]+/, _t = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ds = F(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _t).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Hs = F(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, xt).getRegex(), st = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", St = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, zs = F("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", St).replace("tag", st).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ui = F(kt).replace("hr", He).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", st).getRegex(), Us = F(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ui).getRegex(), Tt = {
|
|
3983
3983
|
blockquote: Us,
|
|
3984
3984
|
code: Ps,
|
|
3985
3985
|
def: Ds,
|
|
@@ -3993,22 +3993,22 @@ const ie = {
|
|
|
3993
3993
|
paragraph: ui,
|
|
3994
3994
|
table: De,
|
|
3995
3995
|
text: Ns
|
|
3996
|
-
}, Jt =
|
|
3996
|
+
}, Jt = F("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", He).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", st).getRegex(), js = {
|
|
3997
3997
|
...Tt,
|
|
3998
3998
|
lheading: $s,
|
|
3999
3999
|
table: Jt,
|
|
4000
|
-
paragraph:
|
|
4001
|
-
},
|
|
4000
|
+
paragraph: F(kt).replace("hr", He).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Jt).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", st).getRegex()
|
|
4001
|
+
}, Fs = {
|
|
4002
4002
|
...Tt,
|
|
4003
|
-
html:
|
|
4003
|
+
html: F(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", St).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
4004
4004
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
4005
4005
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
4006
4006
|
fences: De,
|
|
4007
4007
|
// fences not supported
|
|
4008
4008
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
4009
|
-
paragraph:
|
|
4009
|
+
paragraph: F(kt).replace("hr", He).replace("heading", ` *#{1,6} *[^
|
|
4010
4010
|
]`).replace("lheading", ci).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
4011
|
-
},
|
|
4011
|
+
}, Bs = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Gs = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, di = /^( {2,}|\\)\n(?!\s*$)/, Ws = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, nt = /[\p{P}\p{S}]/u, Et = /[\s\p{P}\p{S}]/u, hi = /[^\s\p{P}\p{S}]/u, Vs = F(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Et).getRegex(), pi = /(?!~)[\p{P}\p{S}]/u, Ys = /(?!~)[\s\p{P}\p{S}]/u, Xs = /(?:[^\s\p{P}\p{S}]|~)/u, Js = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, fi = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Zs = F(fi, "u").replace(/punct/g, nt).getRegex(), Qs = F(fi, "u").replace(/punct/g, pi).getRegex(), gi = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ks = F(gi, "gu").replace(/notPunctSpace/g, hi).replace(/punctSpace/g, Et).replace(/punct/g, nt).getRegex(), en = F(gi, "gu").replace(/notPunctSpace/g, Xs).replace(/punctSpace/g, Ys).replace(/punct/g, pi).getRegex(), tn = F("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, hi).replace(/punctSpace/g, Et).replace(/punct/g, nt).getRegex(), sn = F(/\\(punct)/, "gu").replace(/punct/g, nt).getRegex(), nn = F(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), rn = F(St).replace("(?:-->|$)", "-->").getRegex(), on = F("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", rn).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ze = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, ln = F(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Ze).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), mi = F(/^!?\[(label)\]\[(ref)\]/).replace("label", Ze).replace("ref", _t).getRegex(), bi = F(/^!?\[(ref)\](?:\[\])?/).replace("ref", _t).getRegex(), an = F("reflink|nolink(?!\\()", "g").replace("reflink", mi).replace("nolink", bi).getRegex(), Lt = {
|
|
4012
4012
|
_backpedal: De,
|
|
4013
4013
|
// only used for GFM url
|
|
4014
4014
|
anyPunctuation: sn,
|
|
@@ -4020,7 +4020,7 @@ const ie = {
|
|
|
4020
4020
|
emStrongLDelim: Zs,
|
|
4021
4021
|
emStrongRDelimAst: Ks,
|
|
4022
4022
|
emStrongRDelimUnd: tn,
|
|
4023
|
-
escape:
|
|
4023
|
+
escape: Bs,
|
|
4024
4024
|
link: ln,
|
|
4025
4025
|
nolink: bi,
|
|
4026
4026
|
punctuation: Vs,
|
|
@@ -4030,27 +4030,27 @@ const ie = {
|
|
|
4030
4030
|
text: Ws,
|
|
4031
4031
|
url: De
|
|
4032
4032
|
}, cn = {
|
|
4033
|
-
...
|
|
4034
|
-
link:
|
|
4035
|
-
reflink:
|
|
4033
|
+
...Lt,
|
|
4034
|
+
link: F(/^!?\[(label)\]\((.*?)\)/).replace("label", Ze).getRegex(),
|
|
4035
|
+
reflink: F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ze).getRegex()
|
|
4036
4036
|
}, mt = {
|
|
4037
|
-
...
|
|
4037
|
+
...Lt,
|
|
4038
4038
|
emStrongRDelimAst: en,
|
|
4039
4039
|
emStrongLDelim: Qs,
|
|
4040
|
-
url:
|
|
4040
|
+
url: F(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
4041
4041
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
4042
4042
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
4043
4043
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
4044
4044
|
}, un = {
|
|
4045
4045
|
...mt,
|
|
4046
|
-
br:
|
|
4047
|
-
text:
|
|
4048
|
-
},
|
|
4046
|
+
br: F(di).replace("{2,}", "*").getRegex(),
|
|
4047
|
+
text: F(mt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
4048
|
+
}, Fe = {
|
|
4049
4049
|
normal: Tt,
|
|
4050
4050
|
gfm: js,
|
|
4051
|
-
pedantic:
|
|
4051
|
+
pedantic: Fs
|
|
4052
4052
|
}, Oe = {
|
|
4053
|
-
normal:
|
|
4053
|
+
normal: Lt,
|
|
4054
4054
|
gfm: mt,
|
|
4055
4055
|
breaks: un,
|
|
4056
4056
|
pedantic: cn
|
|
@@ -4079,8 +4079,8 @@ function Qt(c) {
|
|
|
4079
4079
|
}
|
|
4080
4080
|
function Kt(c, e) {
|
|
4081
4081
|
const t = c.replace(ie.findPipe, (n, 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
|
s = s ? `${s}
|
|
4239
|
-
${
|
|
4239
|
+
${d}` : d, n = n ? `${n}
|
|
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,46 +4283,46 @@ ${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
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
4291
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (y) => " ".repeat(3 * y.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),
|
|
4295
|
-
const
|
|
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
|
+
const y = this.rules.other.nextBulletRegex(w), f = this.rules.other.hrRegex(w), m = this.rules.other.fencesBeginRegex(w), v = this.rules.other.headingBeginRegex(w), k = this.rules.other.htmlBeginRegex(w);
|
|
4296
4296
|
for (; e; ) {
|
|
4297
4297
|
const x = e.split(`
|
|
4298
4298
|
`, 1)[0];
|
|
4299
4299
|
let S;
|
|
4300
|
-
if (p = x, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), S = p) : S = p.replace(this.rules.other.tabCharGlobal, " "), m.test(p) ||
|
|
4300
|
+
if (p = x, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), S = p) : S = p.replace(this.rules.other.tabCharGlobal, " "), m.test(p) || v.test(p) || k.test(p) || y.test(p) || f.test(p))
|
|
4301
4301
|
break;
|
|
4302
4302
|
if (S.search(this.rules.other.nonSpaceChar) >= w || !p.trim())
|
|
4303
4303
|
l += `
|
|
4304
4304
|
` + S.slice(w);
|
|
4305
4305
|
else {
|
|
4306
|
-
if (b || h.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || m.test(h) ||
|
|
4306
|
+
if (b || h.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || m.test(h) || v.test(h) || f.test(h))
|
|
4307
4307
|
break;
|
|
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
|
-
n.loose || (o ? n.loose = !0 : this.rules.other.doubleBlankLine.test(
|
|
4315
|
+
n.loose || (o ? n.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, ""))), n.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
|
-
}), n.raw +=
|
|
4325
|
+
}), n.raw += d;
|
|
4326
4326
|
}
|
|
4327
4327
|
const a = n.items.at(-1);
|
|
4328
4328
|
if (a)
|
|
@@ -4330,14 +4330,14 @@ ${l}` : l;
|
|
|
4330
4330
|
else
|
|
4331
4331
|
return;
|
|
4332
4332
|
n.raw = n.raw.trimEnd();
|
|
4333
|
-
for (let
|
|
4334
|
-
if (this.lexer.state.top = !1, n.items[
|
|
4335
|
-
const
|
|
4333
|
+
for (let u = 0; u < n.items.length; u++)
|
|
4334
|
+
if (this.lexer.state.top = !1, n.items[u].tokens = this.lexer.blockTokens(n.items[u].text, []), !n.loose) {
|
|
4335
|
+
const d = n.items[u].tokens.filter((h) => h.type === "space"), l = d.length > 0 && d.some((h) => this.rules.other.anyLine.test(h.raw));
|
|
4336
4336
|
n.loose = l;
|
|
4337
4337
|
}
|
|
4338
4338
|
if (n.loose)
|
|
4339
|
-
for (let
|
|
4340
|
-
n.items[
|
|
4339
|
+
for (let u = 0; u < n.items.length; u++)
|
|
4340
|
+
n.items[u].loose = !0;
|
|
4341
4341
|
return n;
|
|
4342
4342
|
}
|
|
4343
4343
|
}
|
|
@@ -4388,11 +4388,11 @@ ${l}` : l;
|
|
|
4388
4388
|
align: r.align[o]
|
|
4389
4389
|
});
|
|
4390
4390
|
for (const o of n)
|
|
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 (!(s[1] || s[2] || "") || !i || this.rules.inline.punctuation.exec(i)) {
|
|
4506
4506
|
const r = [...s[0]].length - 1;
|
|
4507
|
-
let o, a,
|
|
4507
|
+
let o, a, u = r, d = 0;
|
|
4508
4508
|
const l = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
4509
4509
|
for (l.lastIndex = 0, t = t.slice(-1 * e.length + r); (s = l.exec(t)) != null; ) {
|
|
4510
4510
|
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o)
|
|
4511
4511
|
continue;
|
|
4512
4512
|
if (a = [...o].length, s[3] || s[4]) {
|
|
4513
|
-
|
|
4513
|
+
u += a;
|
|
4514
4514
|
continue;
|
|
4515
4515
|
} else if ((s[5] || s[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 = [...s[0]][0].length, p = e.slice(0, r + s.index + h + a);
|
|
4523
4523
|
if (Math.min(r, a) % 2) {
|
|
4524
4524
|
const w = p.slice(1, -1);
|
|
@@ -4643,17 +4643,17 @@ class le {
|
|
|
4643
4643
|
};
|
|
4644
4644
|
const t = {
|
|
4645
4645
|
other: ie,
|
|
4646
|
-
block:
|
|
4646
|
+
block: Fe.normal,
|
|
4647
4647
|
inline: Oe.normal
|
|
4648
4648
|
};
|
|
4649
|
-
this.options.pedantic ? (t.block =
|
|
4649
|
+
this.options.pedantic ? (t.block = Fe.pedantic, t.inline = Oe.pedantic) : this.options.gfm && (t.block = Fe.gfm, this.options.breaks ? t.inline = Oe.breaks : t.inline = Oe.gfm), this.tokenizer.rules = t;
|
|
4650
4650
|
}
|
|
4651
4651
|
/**
|
|
4652
4652
|
* Expose Rules
|
|
4653
4653
|
*/
|
|
4654
4654
|
static get rules() {
|
|
4655
4655
|
return {
|
|
4656
|
-
block:
|
|
4656
|
+
block: Fe,
|
|
4657
4657
|
inline: Oe
|
|
4658
4658
|
};
|
|
4659
4659
|
}
|
|
@@ -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 && (n = e.substring(0, r + 1));
|
|
4755
4755
|
}
|
|
4756
4756
|
if (this.state.top && (s = this.tokenizer.paragraph(n))) {
|
|
@@ -4801,7 +4801,7 @@ class le {
|
|
|
4801
4801
|
for (; e; ) {
|
|
4802
4802
|
n || (r = ""), n = !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)), n = !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;
|
|
@@ -5006,7 +5006,7 @@ ${e}</tr>
|
|
|
5006
5006
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : pe(e.text);
|
|
5007
5007
|
}
|
|
5008
5008
|
}
|
|
5009
|
-
class
|
|
5009
|
+
class Ct {
|
|
5010
5010
|
// no need for block level renderers
|
|
5011
5011
|
strong({ text: e }) {
|
|
5012
5012
|
return e;
|
|
@@ -5041,7 +5041,7 @@ class ae {
|
|
|
5041
5041
|
renderer;
|
|
5042
5042
|
textRenderer;
|
|
5043
5043
|
constructor(e) {
|
|
5044
|
-
this.options = e || Te, this.options.renderer = this.options.renderer || new Ke(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new
|
|
5044
|
+
this.options = e || Te, this.options.renderer = this.options.renderer || new Ke(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Ct();
|
|
5045
5045
|
}
|
|
5046
5046
|
/**
|
|
5047
5047
|
* Static Parse Method
|
|
@@ -5246,7 +5246,7 @@ class fn {
|
|
|
5246
5246
|
parseInline = this.parseMarkdown(!1);
|
|
5247
5247
|
Parser = ae;
|
|
5248
5248
|
Renderer = Ke;
|
|
5249
|
-
TextRenderer =
|
|
5249
|
+
TextRenderer = Ct;
|
|
5250
5250
|
Lexer = le;
|
|
5251
5251
|
Tokenizer = Qe;
|
|
5252
5252
|
Hooks = Ye;
|
|
@@ -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
|
-
n[o] = (...
|
|
5317
|
-
let l = a.apply(n,
|
|
5318
|
-
return l === !1 && (l =
|
|
5315
|
+
const o = r, a = i.renderer[o], u = n[o];
|
|
5316
|
+
n[o] = (...d) => {
|
|
5317
|
+
let l = a.apply(n, d);
|
|
5318
|
+
return l === !1 && (l = u.apply(n, d)), l || "";
|
|
5319
5319
|
};
|
|
5320
5320
|
}
|
|
5321
5321
|
s.renderer = n;
|
|
@@ -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
|
-
n[o] = (...
|
|
5332
|
-
let l = a.apply(n,
|
|
5333
|
-
return l === !1 && (l =
|
|
5330
|
+
const o = r, a = i.tokenizer[o], u = n[o];
|
|
5331
|
+
n[o] = (...d) => {
|
|
5332
|
+
let l = a.apply(n, d);
|
|
5333
|
+
return l === !1 && (l = u.apply(n, d)), l;
|
|
5334
5334
|
};
|
|
5335
5335
|
}
|
|
5336
5336
|
s.tokenizer = n;
|
|
@@ -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) ? n[o] = (
|
|
5345
|
+
const o = r, a = i.hooks[o], u = n[o];
|
|
5346
|
+
Ye.passThroughHooks.has(r) ? n[o] = (d) => {
|
|
5347
5347
|
if (this.defaults.async)
|
|
5348
|
-
return Promise.resolve(a.call(n,
|
|
5349
|
-
const l = a.call(n,
|
|
5350
|
-
return
|
|
5351
|
-
} : n[o] = (...
|
|
5352
|
-
let l = a.apply(n,
|
|
5353
|
-
return l === !1 && (l =
|
|
5348
|
+
return Promise.resolve(a.call(n, d)).then((h) => u.call(n, h));
|
|
5349
|
+
const l = a.call(n, d);
|
|
5350
|
+
return u.call(n, l);
|
|
5351
|
+
} : n[o] = (...d) => {
|
|
5352
|
+
let l = a.apply(n, d);
|
|
5353
|
+
return l === !1 && (l = u.apply(n, d)), l;
|
|
5354
5354
|
};
|
|
5355
5355
|
}
|
|
5356
5356
|
s.hooks = n;
|
|
@@ -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
|
}
|
|
@@ -5430,7 +5430,7 @@ z.parseInline = Se.parseInline;
|
|
|
5430
5430
|
z.Parser = ae;
|
|
5431
5431
|
z.parser = ae.parse;
|
|
5432
5432
|
z.Renderer = Ke;
|
|
5433
|
-
z.TextRenderer =
|
|
5433
|
+
z.TextRenderer = Ct;
|
|
5434
5434
|
z.Lexer = le;
|
|
5435
5435
|
z.lexer = le.lex;
|
|
5436
5436
|
z.Tokenizer = Qe;
|
|
@@ -5453,7 +5453,7 @@ class gn {
|
|
|
5453
5453
|
async checkIntent(e, t, i) {
|
|
5454
5454
|
let s = "You are an assistant", n = "", 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, n, s, "", o), a ? (
|
|
5501
|
+
}], a = await this.builder.send(r, n, s, "", 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, n, s, "", 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, n, s, "", 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, n, s, "", 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 s = 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, n, "", 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, n, "", 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, n, "", 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, n, "", 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 n = "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, n, "", 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, n, "", 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, n, "", 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, n, "", 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, n, "", 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, n, "", 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, n, "", 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 n.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), s ? (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 n.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, s);
|
|
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, s) {
|
|
6553
|
-
let n, r, o, a = e.model,
|
|
6554
|
-
|
|
6555
|
-
let
|
|
6553
|
+
let n, 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 && (n = o.data.status), !n)
|
|
6571
6571
|
return {
|
|
@@ -6587,13 +6587,13 @@ Check the information and return the details.
|
|
|
6587
6587
|
}
|
|
6588
6588
|
async waitingFal(e, t, i, s) {
|
|
6589
6589
|
let n, 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
|
n = o.status;
|
|
@@ -6625,32 +6625,32 @@ Check the information and return the details.
|
|
|
6625
6625
|
renderResult(e, t, i) {
|
|
6626
6626
|
let s = "", n = "", 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" ? (s += `
|
|
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
|
-
`, n += ``, r.push(d.url), o.push(d.file_url)) : a === "wav" || a === "mp3" ? (s += `
|
|
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
|
-
`, n += ``, r.push(d.url), o.push(d.file_url)) : (s += `
|
|
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
|
-
`, n += `,
|
|
6652
|
+
`, n += ``, r.push(d.url), o.push(d.file_url), u = !0);
|
|
6653
|
+
}), u && (s = `<div class="image-container">${s}</div>`);
|
|
6654
6654
|
} else typeof e == "string" && (s = `
|
|
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), s = {
|
|
6684
|
-
prompt:
|
|
6685
|
-
aspect_ratio:
|
|
6684
|
+
prompt: u,
|
|
6685
|
+
aspect_ratio: d,
|
|
6686
6686
|
num_outputs: l
|
|
6687
6687
|
}, n.model = a, n.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
|
s = {
|
|
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, s = {
|
|
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
|
}, n.model = a, n.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
|
s = {
|
|
6824
6824
|
image: p,
|
|
6825
|
-
prompt: `${
|
|
6825
|
+
prompt: `${u}. No talk. Answer only.`
|
|
6826
6826
|
}, n.model = a, n.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" && (s = {
|
|
6853
6853
|
start_image: p,
|
|
6854
|
-
prompt:
|
|
6855
|
-
duration:
|
|
6854
|
+
prompt: u,
|
|
6855
|
+
duration: d
|
|
6856
6856
|
}), a === "kwaivgi/kling-v1.6-standard" && (s = {
|
|
6857
6857
|
start_image: p,
|
|
6858
|
-
prompt:
|
|
6859
|
-
duration:
|
|
6858
|
+
prompt: u,
|
|
6859
|
+
duration: d
|
|
6860
6860
|
}), a === "minimax/video-01-live" && (s = {
|
|
6861
6861
|
first_frame_image: p,
|
|
6862
|
-
prompt:
|
|
6862
|
+
prompt: u
|
|
6863
6863
|
}), a === "luma/ray" && (s = {
|
|
6864
6864
|
start_image_url: p,
|
|
6865
|
-
prompt:
|
|
6865
|
+
prompt: u
|
|
6866
6866
|
}), n.model = a, n.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" && (s = {
|
|
6884
|
+
prompt: u,
|
|
6885
|
+
duration: d
|
|
6886
6886
|
}), a === "minimax/video-01" && (s = {
|
|
6887
|
-
prompt:
|
|
6887
|
+
prompt: u
|
|
6888
6888
|
}), a === "luma/ray" && (s = {
|
|
6889
|
-
prompt:
|
|
6889
|
+
prompt: u
|
|
6890
6890
|
}), n.model = a, n.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
|
}, n.model = a, n.customData = this.builder.settings.customData;
|
|
6910
6910
|
}
|
|
6911
6911
|
if (n.model.indexOf(":") !== -1) {
|
|
6912
|
-
const
|
|
6913
|
-
n.version =
|
|
6914
|
-
let
|
|
6915
|
-
n.endpoint =
|
|
6912
|
+
const u = n.model.split(":")[1];
|
|
6913
|
+
n.version = u;
|
|
6914
|
+
let d = this.builder.settings.replicateEndpoint1;
|
|
6915
|
+
n.endpoint = d, n.payload = s, 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}", n.model), n.endpoint = a, n.payload = s, 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(n)
|
|
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(n,
|
|
6952
|
+
const p = this.waitingReplicate(n, 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(n)
|
|
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
|
-
for (const
|
|
7008
|
-
|
|
7007
|
+
for (const v of m)
|
|
7008
|
+
u.append("file[]", v), 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
|
-
const
|
|
7014
|
-
|
|
7013
|
+
const v = m[0];
|
|
7014
|
+
u.append("file[]", v), 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), s = {
|
|
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";
|
|
@@ -7047,12 +7047,12 @@ Check the information and return the details.
|
|
|
7047
7047
|
quality: b,
|
|
7048
7048
|
n: w
|
|
7049
7049
|
}, n.model = o, n.customData = this.builder.settings.customData, n.payload = s, this.builder.payloads.push(n), this.builder.settings.consoleLog && console.log(n);
|
|
7050
|
-
const
|
|
7050
|
+
const v = this.builder.settings.generateMediaUrl_OpenAI_CreateImage;
|
|
7051
7051
|
let k = {
|
|
7052
7052
|
"Content-Type": "application/json",
|
|
7053
7053
|
...this.builder.settings.headers
|
|
7054
7054
|
};
|
|
7055
|
-
h = await fetch(
|
|
7055
|
+
h = await fetch(v, {
|
|
7056
7056
|
signal: this.builder.mediaSignal,
|
|
7057
7057
|
method: "POST",
|
|
7058
7058
|
headers: k,
|
|
@@ -7063,13 +7063,13 @@ Check the information and return the details.
|
|
|
7063
7063
|
this.builder.settings.consoleLog && console.log(_), this.builder.isMediaGenerating = !1;
|
|
7064
7064
|
const g = _.data;
|
|
7065
7065
|
this.builder.output.push(_);
|
|
7066
|
-
let
|
|
7066
|
+
let y = this.renderResult(g, t, i);
|
|
7067
7067
|
return {
|
|
7068
7068
|
mediaGenerated: !0,
|
|
7069
7069
|
status: "success",
|
|
7070
|
-
markdown:
|
|
7071
|
-
output:
|
|
7072
|
-
output2:
|
|
7070
|
+
markdown: y.markdown,
|
|
7071
|
+
output: y.output,
|
|
7072
|
+
output2: y.output2
|
|
7073
7073
|
};
|
|
7074
7074
|
}
|
|
7075
7075
|
async generateGoogle(e, t, i) {
|
|
@@ -7087,25 +7087,25 @@ 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
|
-
const
|
|
7099
|
-
if (
|
|
7100
|
-
for (const f of
|
|
7101
|
-
const m = await new Promise((
|
|
7098
|
+
const y = g.value;
|
|
7099
|
+
if (y.length > 0)
|
|
7100
|
+
for (const f of y) {
|
|
7101
|
+
const m = await new Promise((v, k) => {
|
|
7102
7102
|
const x = new FileReader();
|
|
7103
7103
|
x.onload = (S) => {
|
|
7104
7104
|
const E = S.target.result.split(",")[1];
|
|
7105
|
-
|
|
7105
|
+
v(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
|
s = {
|
|
7118
|
-
contents:
|
|
7118
|
+
contents: u
|
|
7119
7119
|
}, n.model = o, n.customData = this.builder.settings.customData, n.payload = s, this.builder.payloads.push(n), this.builder.settings.consoleLog && console.log(n);
|
|
7120
7120
|
const l = this.builder.settings.generateMediaUrl_Google;
|
|
7121
7121
|
let h = {
|
|
@@ -7156,27 +7156,27 @@ Check the information and return the details.
|
|
|
7156
7156
|
status: "error",
|
|
7157
7157
|
message: this.out("Please input a prompt.")
|
|
7158
7158
|
};
|
|
7159
|
-
let _ = e.width || 1280, g = e.height || 768,
|
|
7160
|
-
if (f > 4 && (f = 4),
|
|
7159
|
+
let _ = e.width || 1280, g = e.height || 768, y = e.aspect_ratio, f = e.num_images || 1;
|
|
7160
|
+
if (f > 4 && (f = 4), y) {
|
|
7161
7161
|
let {
|
|
7162
7162
|
w: U,
|
|
7163
|
-
h:
|
|
7164
|
-
} = this.getDimension(
|
|
7165
|
-
_ = U, g =
|
|
7163
|
+
h: B
|
|
7164
|
+
} = this.getDimension(y);
|
|
7165
|
+
_ = U, g = B;
|
|
7166
7166
|
}
|
|
7167
|
-
let m = e.color1_red,
|
|
7168
|
-
m &&
|
|
7167
|
+
let m = e.color1_red, v = e.color1_green, k = e.color1_blue, x = e.color2_red, S = e.color2_green, E = e.color2_blue, L = e.color3_red, A = e.color3_green, C = e.color3_blue, D = e.color4_red, I = e.color4_green, O = e.color4_blue, R = e.color5_red, q = e.color5_green, M = e.color5_blue, T = [];
|
|
7168
|
+
m && v && k && !(m === "0" && v === "0" && k === "0") && T.push({
|
|
7169
7169
|
r: m,
|
|
7170
|
-
g:
|
|
7170
|
+
g: v,
|
|
7171
7171
|
b: k
|
|
7172
7172
|
}), x && S && E && !(x === "0" && S === "0" && E === "0") && T.push({
|
|
7173
7173
|
r: x,
|
|
7174
7174
|
g: S,
|
|
7175
7175
|
b: E
|
|
7176
|
-
}),
|
|
7177
|
-
r:
|
|
7176
|
+
}), L && A && C && !(L === "0" && A === "0" && C === "0") && T.push({
|
|
7177
|
+
r: L,
|
|
7178
7178
|
g: A,
|
|
7179
|
-
b:
|
|
7179
|
+
b: C
|
|
7180
7180
|
}), D && I && O && !(D === "0" && I === "0" && O === "0") && T.push({
|
|
7181
7181
|
r: D,
|
|
7182
7182
|
g: I,
|
|
@@ -7187,8 +7187,8 @@ Check the information and return the details.
|
|
|
7187
7187
|
b: M
|
|
7188
7188
|
});
|
|
7189
7189
|
let N = await (async () => {
|
|
7190
|
-
let U = [],
|
|
7191
|
-
for (const V of
|
|
7190
|
+
let U = [], B = this.builder.getFormValues();
|
|
7191
|
+
for (const V of B)
|
|
7192
7192
|
if (V.value instanceof FileList && V.type === "multifile") {
|
|
7193
7193
|
const de = V.value;
|
|
7194
7194
|
if (de.length > 0) {
|
|
@@ -7221,9 +7221,9 @@ Check the information and return the details.
|
|
|
7221
7221
|
}, b.indexOf("gemini") !== -1 && (n = {
|
|
7222
7222
|
prompt: w,
|
|
7223
7223
|
input_image_urls: N
|
|
7224
|
-
}), b === "fal-ai/ideogram/v2a" && (
|
|
7224
|
+
}), b === "fal-ai/ideogram/v2a" && (y = this.getClosestAspectRatio(_, g), n = {
|
|
7225
7225
|
prompt: w,
|
|
7226
|
-
aspect_ratio:
|
|
7226
|
+
aspect_ratio: y,
|
|
7227
7227
|
num_images: f
|
|
7228
7228
|
}), b.indexOf("recraft") !== -1 && (n = {
|
|
7229
7229
|
prompt: w,
|
|
@@ -7263,15 +7263,15 @@ Check the information and return the details.
|
|
|
7263
7263
|
status: "error",
|
|
7264
7264
|
message: g.error
|
|
7265
7265
|
};
|
|
7266
|
-
let
|
|
7266
|
+
let y = g[e.image_url], f = g[e.image_url + "_mask"];
|
|
7267
7267
|
if (n = {
|
|
7268
|
-
image_url:
|
|
7268
|
+
image_url: y,
|
|
7269
7269
|
mask_url: f,
|
|
7270
7270
|
prompt: w
|
|
7271
7271
|
// num_images,
|
|
7272
7272
|
}, r.model = b, !f) {
|
|
7273
7273
|
n = {
|
|
7274
|
-
image_url:
|
|
7274
|
+
image_url: y,
|
|
7275
7275
|
prompt: w
|
|
7276
7276
|
};
|
|
7277
7277
|
let m = this.validateModel(e.model, s, "edit_image");
|
|
@@ -7293,20 +7293,20 @@ Check the information and return the details.
|
|
|
7293
7293
|
status: "error",
|
|
7294
7294
|
message: this.out("Please input a prompt.")
|
|
7295
7295
|
};
|
|
7296
|
-
let _ = e.width || 1280, g = e.height || 768,
|
|
7297
|
-
|
|
7298
|
-
let f = e.style || "any", m = e.style_id || this.builder.settings._2dIllustrationStyleId,
|
|
7299
|
-
|
|
7300
|
-
r:
|
|
7296
|
+
let _ = e.width || 1280, g = e.height || 768, y = e.num_images || 1;
|
|
7297
|
+
y > 4 && (y = 4);
|
|
7298
|
+
let f = e.style || "any", m = e.style_id || this.builder.settings._2dIllustrationStyleId, v = e.color1_red, k = e.color1_green, x = e.color1_blue, S = e.color2_red, E = e.color2_green, L = e.color2_blue, A = e.color3_red, C = e.color3_green, D = e.color3_blue, I = e.color4_red, O = e.color4_green, R = e.color4_blue, q = e.color5_red, M = e.color5_green, T = e.color5_blue, $ = [];
|
|
7299
|
+
v && k && x && !(v === "0" && k === "0" && x === "0") && $.push({
|
|
7300
|
+
r: v,
|
|
7301
7301
|
g: k,
|
|
7302
7302
|
b: x
|
|
7303
|
-
}), S && E &&
|
|
7303
|
+
}), S && E && L && !(S === "0" && E === "0" && L === "0") && $.push({
|
|
7304
7304
|
r: S,
|
|
7305
7305
|
g: E,
|
|
7306
|
-
b:
|
|
7307
|
-
}), A &&
|
|
7306
|
+
b: L
|
|
7307
|
+
}), A && C && D && !(A === "0" && C === "0" && D === "0") && $.push({
|
|
7308
7308
|
r: A,
|
|
7309
|
-
g:
|
|
7309
|
+
g: C,
|
|
7310
7310
|
b: D
|
|
7311
7311
|
}), I && O && R && !(I === "0" && O === "0" && R === "0") && $.push({
|
|
7312
7312
|
r: I,
|
|
@@ -7322,7 +7322,7 @@ Check the information and return the details.
|
|
|
7322
7322
|
width: _,
|
|
7323
7323
|
height: g
|
|
7324
7324
|
},
|
|
7325
|
-
num_images:
|
|
7325
|
+
num_images: y,
|
|
7326
7326
|
style: f,
|
|
7327
7327
|
style_id: m,
|
|
7328
7328
|
colors: $
|
|
@@ -7342,21 +7342,21 @@ Check the information and return the details.
|
|
|
7342
7342
|
status: "error",
|
|
7343
7343
|
message: this.out("Please input a prompt.")
|
|
7344
7344
|
};
|
|
7345
|
-
let _ = e.width || 1280, g = e.height || 768,
|
|
7346
|
-
|
|
7347
|
-
let f = e.style || "digital_illustration", m = e.color1_red,
|
|
7348
|
-
m &&
|
|
7345
|
+
let _ = e.width || 1280, g = e.height || 768, y = e.num_images || 1;
|
|
7346
|
+
y > 4 && (y = 4);
|
|
7347
|
+
let f = e.style || "digital_illustration", m = e.color1_red, v = e.color1_green, k = e.color1_blue, x = e.color2_red, S = e.color2_green, E = e.color2_blue, L = e.color3_red, A = e.color3_green, C = e.color3_blue, D = e.color4_red, I = e.color4_green, O = e.color4_blue, R = e.color5_red, q = e.color5_green, M = e.color5_blue, T = [];
|
|
7348
|
+
m && v && k && !(m === "0" && v === "0" && k === "0") && T.push({
|
|
7349
7349
|
r: m,
|
|
7350
|
-
g:
|
|
7350
|
+
g: v,
|
|
7351
7351
|
b: k
|
|
7352
7352
|
}), x && S && E && !(x === "0" && S === "0" && E === "0") && T.push({
|
|
7353
7353
|
r: x,
|
|
7354
7354
|
g: S,
|
|
7355
7355
|
b: E
|
|
7356
|
-
}),
|
|
7357
|
-
r:
|
|
7356
|
+
}), L && A && C && !(L === "0" && A === "0" && C === "0") && T.push({
|
|
7357
|
+
r: L,
|
|
7358
7358
|
g: A,
|
|
7359
|
-
b:
|
|
7359
|
+
b: C
|
|
7360
7360
|
}), D && I && O && !(D === "0" && I === "0" && O === "0") && T.push({
|
|
7361
7361
|
r: D,
|
|
7362
7362
|
g: I,
|
|
@@ -7371,7 +7371,7 @@ Check the information and return the details.
|
|
|
7371
7371
|
width: _,
|
|
7372
7372
|
height: g
|
|
7373
7373
|
},
|
|
7374
|
-
num_images:
|
|
7374
|
+
num_images: y,
|
|
7375
7375
|
style: f,
|
|
7376
7376
|
// style_id,
|
|
7377
7377
|
colors: T
|
|
@@ -7391,21 +7391,21 @@ Check the information and return the details.
|
|
|
7391
7391
|
status: "error",
|
|
7392
7392
|
message: this.out("Please input a prompt.")
|
|
7393
7393
|
};
|
|
7394
|
-
let _ = e.width || 1024, g = e.height || 1365,
|
|
7395
|
-
|
|
7396
|
-
let f = "digital_illustration/cover", m = e.color1_red,
|
|
7397
|
-
m &&
|
|
7394
|
+
let _ = e.width || 1024, g = e.height || 1365, y = e.num_images || 1;
|
|
7395
|
+
y > 4 && (y = 1);
|
|
7396
|
+
let f = "digital_illustration/cover", m = e.color1_red, v = e.color1_green, k = e.color1_blue, x = e.color2_red, S = e.color2_green, E = e.color2_blue, L = e.color3_red, A = e.color3_green, C = e.color3_blue, D = e.color4_red, I = e.color4_green, O = e.color4_blue, R = e.color5_red, q = e.color5_green, M = e.color5_blue, T = [];
|
|
7397
|
+
m && v && k && !(m === "0" && v === "0" && k === "0") && T.push({
|
|
7398
7398
|
r: m,
|
|
7399
|
-
g:
|
|
7399
|
+
g: v,
|
|
7400
7400
|
b: k
|
|
7401
7401
|
}), x && S && E && !(x === "0" && S === "0" && E === "0") && T.push({
|
|
7402
7402
|
r: x,
|
|
7403
7403
|
g: S,
|
|
7404
7404
|
b: E
|
|
7405
|
-
}),
|
|
7406
|
-
r:
|
|
7405
|
+
}), L && A && C && !(L === "0" && A === "0" && C === "0") && T.push({
|
|
7406
|
+
r: L,
|
|
7407
7407
|
g: A,
|
|
7408
|
-
b:
|
|
7408
|
+
b: C
|
|
7409
7409
|
}), D && I && O && !(D === "0" && I === "0" && O === "0") && T.push({
|
|
7410
7410
|
r: D,
|
|
7411
7411
|
g: I,
|
|
@@ -7420,7 +7420,7 @@ Check the information and return the details.
|
|
|
7420
7420
|
width: _,
|
|
7421
7421
|
height: g
|
|
7422
7422
|
},
|
|
7423
|
-
num_images:
|
|
7423
|
+
num_images: y,
|
|
7424
7424
|
style: f,
|
|
7425
7425
|
// style_id,
|
|
7426
7426
|
colors: T
|
|
@@ -7485,15 +7485,15 @@ Check the information and return the details.
|
|
|
7485
7485
|
status: "error",
|
|
7486
7486
|
message: g.error
|
|
7487
7487
|
};
|
|
7488
|
-
let
|
|
7489
|
-
if (!
|
|
7488
|
+
let y = g[e.image_url];
|
|
7489
|
+
if (!y)
|
|
7490
7490
|
return {
|
|
7491
7491
|
mediaGenerated: !1,
|
|
7492
7492
|
status: "error",
|
|
7493
7493
|
message: this.out("Image not provided.")
|
|
7494
7494
|
};
|
|
7495
7495
|
n = {
|
|
7496
|
-
image_url:
|
|
7496
|
+
image_url: y,
|
|
7497
7497
|
prompt: `${w}. No talk. Answer only.`
|
|
7498
7498
|
}, r.model = b, r.customData = this.builder.settings.customData;
|
|
7499
7499
|
} else if (e.image_to_video_generation) {
|
|
@@ -7515,8 +7515,8 @@ Check the information and return the details.
|
|
|
7515
7515
|
status: "error",
|
|
7516
7516
|
message: g.error
|
|
7517
7517
|
};
|
|
7518
|
-
let
|
|
7519
|
-
if (!
|
|
7518
|
+
let y = g[e.image_url];
|
|
7519
|
+
if (!y)
|
|
7520
7520
|
return {
|
|
7521
7521
|
mediaGenerated: !1,
|
|
7522
7522
|
status: "error",
|
|
@@ -7524,7 +7524,7 @@ Check the information and return the details.
|
|
|
7524
7524
|
};
|
|
7525
7525
|
n = {
|
|
7526
7526
|
prompt: w,
|
|
7527
|
-
image_url:
|
|
7527
|
+
image_url: y,
|
|
7528
7528
|
duration: _,
|
|
7529
7529
|
aspect_ratio: "16:9"
|
|
7530
7530
|
// 9:16, 1:1
|
|
@@ -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 = n, 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 (s.name = i.name, s.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 {
|
|
@@ -7718,21 +7718,21 @@ Check the information and return the details.
|
|
|
7718
7718
|
message: this.out("Please provide model information in the context.")
|
|
7719
7719
|
};
|
|
7720
7720
|
let h = await this.uploadMultiple();
|
|
7721
|
-
((g,
|
|
7721
|
+
((g, y) => {
|
|
7722
7722
|
const f = (m) => {
|
|
7723
7723
|
if (Array.isArray(m)) {
|
|
7724
|
-
const
|
|
7725
|
-
if (k && m.every((x) => x ===
|
|
7724
|
+
const v = m[0], k = y.find((x) => x.name === v);
|
|
7725
|
+
if (k && m.every((x) => x === v))
|
|
7726
7726
|
return k.files;
|
|
7727
7727
|
for (let x = 0; x < m.length; x++)
|
|
7728
7728
|
m[x] = f(m[x]);
|
|
7729
7729
|
} else if (typeof m == "object" && m !== null)
|
|
7730
|
-
for (let
|
|
7731
|
-
m[
|
|
7730
|
+
for (let v in m)
|
|
7731
|
+
m[v] = f(m[v]);
|
|
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,41 +7740,41 @@ Check the information and return the details.
|
|
|
7740
7740
|
status: "error",
|
|
7741
7741
|
message: w.error
|
|
7742
7742
|
};
|
|
7743
|
-
Object.keys(
|
|
7744
|
-
Object.keys(w).forEach((
|
|
7745
|
-
if (
|
|
7746
|
-
let f = w[
|
|
7747
|
-
|
|
7743
|
+
Object.keys(d).forEach((g) => {
|
|
7744
|
+
Object.keys(w).forEach((y) => {
|
|
7745
|
+
if (d[g] === y) {
|
|
7746
|
+
let f = w[y];
|
|
7747
|
+
d[g] = f;
|
|
7748
7748
|
}
|
|
7749
|
-
if (Array.isArray(
|
|
7750
|
-
for (let f = 0; f <
|
|
7751
|
-
if (
|
|
7752
|
-
let m = w[
|
|
7753
|
-
|
|
7749
|
+
if (Array.isArray(d[g])) {
|
|
7750
|
+
for (let f = 0; f < d[g].length; f++)
|
|
7751
|
+
if (d[g][f] === y) {
|
|
7752
|
+
let m = w[y];
|
|
7753
|
+
d[g][f] = m;
|
|
7754
7754
|
}
|
|
7755
7755
|
}
|
|
7756
7756
|
});
|
|
7757
|
-
}), Object.keys(
|
|
7758
|
-
let
|
|
7759
|
-
if (b(
|
|
7760
|
-
for (const f in
|
|
7761
|
-
Object.prototype.hasOwnProperty.call(
|
|
7762
|
-
if (
|
|
7763
|
-
let
|
|
7764
|
-
|
|
7757
|
+
}), Object.keys(d).forEach((g) => {
|
|
7758
|
+
let y = d[g];
|
|
7759
|
+
if (b(y))
|
|
7760
|
+
for (const f in y)
|
|
7761
|
+
Object.prototype.hasOwnProperty.call(y, f) && Object.keys(w).forEach((m) => {
|
|
7762
|
+
if (y[f] === m) {
|
|
7763
|
+
let v = w[m];
|
|
7764
|
+
y[f] = v, m === v && !v.startsWith("http") && (y[f] = "");
|
|
7765
7765
|
}
|
|
7766
7766
|
});
|
|
7767
|
-
if (Array.isArray(
|
|
7768
|
-
for (let f = 0; f <
|
|
7769
|
-
if (b(
|
|
7770
|
-
for (const m in
|
|
7771
|
-
Object.prototype.hasOwnProperty.call(
|
|
7772
|
-
if (
|
|
7773
|
-
let k = w[
|
|
7774
|
-
|
|
7767
|
+
if (Array.isArray(y)) {
|
|
7768
|
+
for (let f = 0; f < y.length; f++)
|
|
7769
|
+
if (b(y[f]))
|
|
7770
|
+
for (const m in y[f])
|
|
7771
|
+
Object.prototype.hasOwnProperty.call(y[f], m) && Object.keys(w).forEach((v) => {
|
|
7772
|
+
if (y[f][m] === v) {
|
|
7773
|
+
let k = w[v];
|
|
7774
|
+
y[f][m] = k, v === k && !k.startsWith("http") && (y[f][m] = "");
|
|
7775
7775
|
}
|
|
7776
7776
|
});
|
|
7777
|
-
|
|
7777
|
+
d[g] = [...y.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
|
}
|
|
@@ -7841,22 +7841,22 @@ Check the information and return the details.
|
|
|
7841
7841
|
//this.out('Request failed.')
|
|
7842
7842
|
};
|
|
7843
7843
|
{
|
|
7844
|
-
const
|
|
7844
|
+
const y = g.url, f = `
|
|
7845
7845
|
<div class="image-container">
|
|
7846
7846
|
<div>
|
|
7847
|
-
<img src="${
|
|
7847
|
+
<img src="${y}" />
|
|
7848
7848
|
<div>
|
|
7849
|
-
<a class="link-view" href="${
|
|
7850
|
-
<a class="link-download" href="${
|
|
7849
|
+
<a class="link-view" href="${y}" target="_blank" rel="noopener noreferrer">${this.out("View")}</a>
|
|
7850
|
+
<a class="link-download" href="${y}" download>${this.out("Download")}</a>
|
|
7851
7851
|
</div>
|
|
7852
7852
|
</div>
|
|
7853
7853
|
</div>`;
|
|
7854
|
-
let m = ``;
|
|
7855
7855
|
return o ? (r.innerHTML = "", r.remove()) : (r.innerHTML = f, this.builder.outputHtml += `<div class="result-container">${f}</div>`), this.builder.isMediaGenerating = !1, {
|
|
7856
7856
|
mediaGenerated: !0,
|
|
7857
7857
|
status: "success",
|
|
7858
7858
|
markdown: m,
|
|
7859
|
-
output: [
|
|
7859
|
+
output: [y]
|
|
7860
7860
|
};
|
|
7861
7861
|
}
|
|
7862
7862
|
} else {
|
|
@@ -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(n, {
|
|
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, s);
|
|
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, s);
|
|
7950
7950
|
} else {
|
|
7951
|
-
const
|
|
7952
|
-
let l = this.renderResult(
|
|
7951
|
+
const d = u.data;
|
|
7952
|
+
let l = this.renderResult(d, i, s);
|
|
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 ? (n = d.url, s = d.filename, {
|
|
8124
8124
|
filename: s,
|
|
8125
8125
|
url: n
|
|
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 ? (n = u.url, s = u.filename, {
|
|
8140
8140
|
filename: s,
|
|
8141
8141
|
url: n
|
|
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
|
-
n =
|
|
8158
|
+
if (d.ok)
|
|
8159
|
+
n = d.url, s = 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"
|
|
@@ -8288,18 +8288,18 @@ class bn {
|
|
|
8288
8288
|
willReadFrequently: !0
|
|
8289
8289
|
}), _ = document.createElement("canvas"), g = _.getContext("2d", {
|
|
8290
8290
|
willReadFrequently: !0
|
|
8291
|
-
}),
|
|
8291
|
+
}), y = this.element.querySelector(".inp-imagemask"), f = (T) => {
|
|
8292
8292
|
const $ = document.createElement("canvas"), N = $.getContext("2d", {
|
|
8293
8293
|
willReadFrequently: !0
|
|
8294
8294
|
});
|
|
8295
8295
|
$.width = T.width, $.height = T.height, N.clearRect(0, 0, T.width, T.height), N.fillStyle = "black", N.fillRect(0, 0, T.width, T.height), N.drawImage(T, 0, 0);
|
|
8296
8296
|
const U = $.toDataURL("image/png");
|
|
8297
|
-
let
|
|
8298
|
-
|
|
8297
|
+
let B = document.querySelector(".imagemask-output");
|
|
8298
|
+
B || (B = document.createElement("img"), B.className = "imagemask-output", document.body.appendChild(B)), B.src = U, this.empty || (y.value = U);
|
|
8299
8299
|
};
|
|
8300
|
-
let m = [],
|
|
8300
|
+
let m = [], v = [];
|
|
8301
8301
|
const k = () => {
|
|
8302
|
-
m.push(_.toDataURL()), m.length > 10 && m.shift(),
|
|
8302
|
+
m.push(_.toDataURL()), m.length > 10 && m.shift(), v = [];
|
|
8303
8303
|
}, x = (T) => {
|
|
8304
8304
|
const $ = new Image();
|
|
8305
8305
|
$.src = T, $.onload = () => {
|
|
@@ -8308,16 +8308,16 @@ 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) => {
|
|
8314
|
-
T.preventDefault(),
|
|
8312
|
+
T.preventDefault(), m.length > 0 && (v.push(b.toDataURL()), x(m.pop()));
|
|
8313
|
+
}), d.addEventListener("click", (T) => {
|
|
8314
|
+
T.preventDefault(), v.length > 0 && (m.push(b.toDataURL()), x(v.pop()));
|
|
8315
8315
|
});
|
|
8316
8316
|
const S = document.createElement("img");
|
|
8317
8317
|
n.appendChild(S), n.appendChild(b), this.loaded = () => {
|
|
8318
8318
|
n.style.display = "flex";
|
|
8319
8319
|
const T = document.querySelector(".imagemask-controls");
|
|
8320
|
-
T.style.display = "flex", e.style.display = "flex", A(), m = [],
|
|
8320
|
+
T.style.display = "flex", e.style.display = "flex", A(), m = [], v = [], w.clearRect(0, 0, b.width, b.height), g.clearRect(0, 0, _.width, _.height), this.empty = !0, y.value = "";
|
|
8321
8321
|
try {
|
|
8322
8322
|
f(_);
|
|
8323
8323
|
} catch {
|
|
@@ -8325,20 +8325,20 @@ class bn {
|
|
|
8325
8325
|
}, S.onload = () => {
|
|
8326
8326
|
this.loaded();
|
|
8327
8327
|
};
|
|
8328
|
-
let E = null,
|
|
8328
|
+
let E = null, L = null;
|
|
8329
8329
|
const A = () => {
|
|
8330
|
-
b.width > 0 && b.height > 0 && (E = w.getImageData(0, 0, b.width, b.height),
|
|
8330
|
+
b.width > 0 && b.height > 0 && (E = w.getImageData(0, 0, b.width, b.height), L = g.getImageData(0, 0, _.width, _.height));
|
|
8331
8331
|
const T = S.offsetWidth, $ = S.offsetHeight, N = window.devicePixelRatio || 1;
|
|
8332
8332
|
b.width = T * N, b.height = $ * N, w.scale(N, N), b.style.width = `${T}px`, b.style.height = `${$}px`;
|
|
8333
|
-
const U = S.naturalWidth,
|
|
8334
|
-
if (_.width = U * N, _.height =
|
|
8333
|
+
const U = S.naturalWidth, B = S.naturalHeight;
|
|
8334
|
+
if (_.width = U * N, _.height = B * N, g.scale(N, N), _.style.width = `${U}px`, _.style.height = `${B}px`, E) {
|
|
8335
8335
|
const V = document.createElement("canvas");
|
|
8336
8336
|
V.width = E.width, V.height = E.height, V.getContext("2d").putImageData(E, 0, 0);
|
|
8337
8337
|
const ne = document.createElement("canvas");
|
|
8338
|
-
ne.width =
|
|
8338
|
+
ne.width = L.width, ne.height = L.height, ne.getContext("2d").putImageData(L, 0, 0), w.drawImage(V, 0, 0, E.width, E.height, 0, 0, b.width, b.height), g.drawImage(ne, 0, 0, L.width, L.height, 0, 0, _.width, _.height);
|
|
8339
8339
|
}
|
|
8340
8340
|
};
|
|
8341
|
-
let
|
|
8341
|
+
let C = !1, D = parseInt(a.value, 10);
|
|
8342
8342
|
a.addEventListener("input", (T) => {
|
|
8343
8343
|
D = parseInt(T.target.value, 10);
|
|
8344
8344
|
});
|
|
@@ -8356,15 +8356,15 @@ class bn {
|
|
|
8356
8356
|
y: T.clientY - $.top
|
|
8357
8357
|
};
|
|
8358
8358
|
}, O = (T) => {
|
|
8359
|
-
|
|
8359
|
+
C = !0, q(T);
|
|
8360
8360
|
}, R = () => {
|
|
8361
|
-
|
|
8361
|
+
C = !1, w.beginPath(), this.empty = !1, f(_);
|
|
8362
8362
|
}, q = (T) => {
|
|
8363
|
-
if (!
|
|
8363
|
+
if (!C) return;
|
|
8364
8364
|
const {
|
|
8365
8365
|
x: $,
|
|
8366
8366
|
y: N
|
|
8367
|
-
} = I(T), U = _.width / b.width,
|
|
8367
|
+
} = I(T), U = _.width / b.width, B = _.height / b.height, V = $ * U, de = N * B;
|
|
8368
8368
|
w.fillStyle = "rgb(255, 255, 255)", w.beginPath(), w.arc($, N, D / 2, 0, Math.PI * 2), w.fill(), g.fillStyle = "rgb(255, 255, 255)", g.beginPath(), g.arc(V, de, D / 2 * U, 0, Math.PI * 2), g.fill();
|
|
8369
8369
|
};
|
|
8370
8370
|
b.addEventListener("mousedown", O), b.addEventListener("mouseup", R), b.addEventListener("mousemove", q), b.addEventListener("touchstart", (T) => {
|
|
@@ -8378,7 +8378,7 @@ class bn {
|
|
|
8378
8378
|
}, {
|
|
8379
8379
|
passive: !1
|
|
8380
8380
|
}), l.addEventListener("click", (T) => {
|
|
8381
|
-
T.preventDefault(), k(), w.clearRect(0, 0, b.width, b.height), g.clearRect(0, 0, _.width, _.height), this.empty = !0,
|
|
8381
|
+
T.preventDefault(), k(), w.clearRect(0, 0, b.width, b.height), g.clearRect(0, 0, _.width, _.height), this.empty = !0, y.value = "", f(_);
|
|
8382
8382
|
}), window.addEventListener("resize", A);
|
|
8383
8383
|
const M = (T) => {
|
|
8384
8384
|
T ? (e.setAttribute("aria-modal", "true"), e.setAttribute("role", "dialog"), e.classList.add("fullscreen"), t.style.display = "block", i.style.display = "flex", h.style.display = "none") : (e.removeAttribute("aria-modal"), e.removeAttribute("role"), e.classList.remove("fullscreen"), t.style.display = "none", i.style.display = "none", h.style.display = ""), A();
|
|
@@ -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 = s.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(s)).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 ? (n.querySelector(".card-text").appendChild(u), n.classList.remove("cursor-pointer"), n.classList.add("cursor-default")) : (n.classList.add("cursor-pointer"), n.classList.remove("cursor-default")), s.appendChild(n), d || l || n.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
|
s.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 ? (s(), n()) : (o = u, requestAnimationFrame(a));
|
|
8823
8823
|
};
|
|
8824
8824
|
a();
|
|
8825
8825
|
}, 200);
|
|
@@ -8901,8 +8901,8 @@ class yn {
|
|
|
8901
8901
|
} else if (l.tag === "audio") {
|
|
8902
8902
|
const g = document.createElement("audio");
|
|
8903
8903
|
g.controls = !0;
|
|
8904
|
-
let
|
|
8905
|
-
|
|
8904
|
+
let y = document.createElement("source");
|
|
8905
|
+
y.src = l.url, y.type = "audio/mp3", g.appendChild(y), l.displayInOutput || r.appendChild(g);
|
|
8906
8906
|
} else if (l.tag === "img") {
|
|
8907
8907
|
const g = document.createElement("img");
|
|
8908
8908
|
g.src = l.url, g.setAttribute("alt", this.out("Output Image")), l.displayInOutput || r.appendChild(g);
|
|
@@ -8917,15 +8917,15 @@ class yn {
|
|
|
8917
8917
|
if (l.type === "video") {
|
|
8918
8918
|
const g = document.createElement("video");
|
|
8919
8919
|
g.style.width = "100%", g.style.height = "auto", g.controls = !0;
|
|
8920
|
-
let
|
|
8921
|
-
|
|
8920
|
+
let y = document.createElement("source");
|
|
8921
|
+
y.src = l.url, y.type = "video/mp4", g.appendChild(y), l.displayInOutput || r.appendChild(g);
|
|
8922
8922
|
return;
|
|
8923
8923
|
}
|
|
8924
8924
|
if (l.type === "audio") {
|
|
8925
8925
|
const g = document.createElement("audio");
|
|
8926
8926
|
g.controls = !0;
|
|
8927
|
-
let
|
|
8928
|
-
|
|
8927
|
+
let y = document.createElement("source");
|
|
8928
|
+
y.src = l.url, y.type = "audio/mp3", g.appendChild(y), l.displayInOutput || r.appendChild(g);
|
|
8929
8929
|
return;
|
|
8930
8930
|
}
|
|
8931
8931
|
const p = document.createElement("div");
|
|
@@ -8934,8 +8934,8 @@ class yn {
|
|
|
8934
8934
|
let w = l.name;
|
|
8935
8935
|
if (r.querySelector(`[name="${w}"]`) && (o++, w = w + "_" + o), b === "short-text") {
|
|
8936
8936
|
let g = this.getId();
|
|
8937
|
-
const
|
|
8938
|
-
if (
|
|
8937
|
+
const y = document.createElement("label");
|
|
8938
|
+
if (y.setAttribute("for", `short_text_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8939
8939
|
const m = document.createElement("div");
|
|
8940
8940
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
8941
8941
|
}
|
|
@@ -8944,8 +8944,8 @@ class yn {
|
|
|
8944
8944
|
}
|
|
8945
8945
|
if (b === "long-text") {
|
|
8946
8946
|
let g = this.getId();
|
|
8947
|
-
const
|
|
8948
|
-
if (
|
|
8947
|
+
const y = document.createElement("label");
|
|
8948
|
+
if (y.setAttribute("for", `long_text_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8949
8949
|
const m = document.createElement("div");
|
|
8950
8950
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
8951
8951
|
}
|
|
@@ -8954,8 +8954,8 @@ class yn {
|
|
|
8954
8954
|
}
|
|
8955
8955
|
if (b === "number") {
|
|
8956
8956
|
let g = this.getId();
|
|
8957
|
-
const
|
|
8958
|
-
if (
|
|
8957
|
+
const y = document.createElement("label");
|
|
8958
|
+
if (y.setAttribute("for", `number_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8959
8959
|
const m = document.createElement("div");
|
|
8960
8960
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
8961
8961
|
}
|
|
@@ -8965,8 +8965,8 @@ class yn {
|
|
|
8965
8965
|
if (b === "slider") {
|
|
8966
8966
|
p.classList.add("input-slider");
|
|
8967
8967
|
let g = this.getId();
|
|
8968
|
-
const
|
|
8969
|
-
if (
|
|
8968
|
+
const y = document.createElement("label");
|
|
8969
|
+
if (y.setAttribute("for", `number_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8970
8970
|
const E = document.createElement("div");
|
|
8971
8971
|
E.className = "field-note", E.innerHTML = l.fieldNote, p.appendChild(E);
|
|
8972
8972
|
}
|
|
@@ -8974,8 +8974,8 @@ class yn {
|
|
|
8974
8974
|
f.className = "slider-container", p.appendChild(f);
|
|
8975
8975
|
const m = document.createElement("div");
|
|
8976
8976
|
m.className = "slider-values", f.appendChild(m);
|
|
8977
|
-
const
|
|
8978
|
-
m.appendChild(
|
|
8977
|
+
const v = document.createElement("span");
|
|
8978
|
+
m.appendChild(v), v.innerText = l.minValue;
|
|
8979
8979
|
const k = document.createElement("span");
|
|
8980
8980
|
m.appendChild(k), k.innerText = l.maxValue;
|
|
8981
8981
|
const x = document.createElement("input");
|
|
@@ -8987,30 +8987,30 @@ class yn {
|
|
|
8987
8987
|
}
|
|
8988
8988
|
if (b === "select") {
|
|
8989
8989
|
let g = this.getId();
|
|
8990
|
-
const
|
|
8991
|
-
if (
|
|
8990
|
+
const y = document.createElement("div");
|
|
8991
|
+
if (y.id = `radio_group_label_${g}`, y.className = "field-label-normal", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
8992
8992
|
const m = document.createElement("div");
|
|
8993
8993
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
8994
8994
|
}
|
|
8995
8995
|
const f = document.createElement("div");
|
|
8996
|
-
if (f.setAttribute("aria-labelledby", `radio_group_label_${g}`), f.setAttribute("role", "group"), f.className = "div-options", p.appendChild(f), l.choices && l.choices.forEach((m,
|
|
8996
|
+
if (f.setAttribute("aria-labelledby", `radio_group_label_${g}`), f.setAttribute("role", "group"), f.className = "div-options", p.appendChild(f), l.choices && l.choices.forEach((m, v) => {
|
|
8997
8997
|
let k = m;
|
|
8998
|
-
l.choicesText && (k = l.choicesText[
|
|
8998
|
+
l.choicesText && (k = l.choicesText[v] || m);
|
|
8999
8999
|
const x = document.createElement("label");
|
|
9000
|
-
x.setAttribute("for", `${g}_${
|
|
9000
|
+
x.setAttribute("for", `${g}_${v}`), x.className = "option-label", f.appendChild(x);
|
|
9001
9001
|
const S = document.createElement("input");
|
|
9002
|
-
S.type = "radio", S.className = "peer", S.id = `${g}_${
|
|
9002
|
+
S.type = "radio", S.className = "peer", S.id = `${g}_${v}`, S.name = w, S.value = m, x.appendChild(S), v === l.selected && (S.checked = !0);
|
|
9003
9003
|
const E = document.createElement("span");
|
|
9004
9004
|
E.className = "peer-span-rounded", x.appendChild(E);
|
|
9005
|
-
const
|
|
9006
|
-
E.innerHTML =
|
|
9005
|
+
const L = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 7a5 5 0 1 1 -4.995 5.217l-.005 -.217l.005 -.217a5 5 0 0 1 4.995 -4.783z"></path></svg>';
|
|
9006
|
+
E.innerHTML = L, v === 0 && l.isRequired && S.setAttribute("required", "required");
|
|
9007
9007
|
const A = document.createElement("span");
|
|
9008
9008
|
A.innerText = k, x.appendChild(A), S.addEventListener("change", this.changeListener);
|
|
9009
9009
|
}), l.showOtherItem) {
|
|
9010
9010
|
const m = document.createElement("label");
|
|
9011
9011
|
m.setAttribute("for", g + "_other"), m.className = "option-label", f.appendChild(m);
|
|
9012
|
-
const
|
|
9013
|
-
|
|
9012
|
+
const v = document.createElement("input");
|
|
9013
|
+
v.type = "radio", v.className = "peer", v.id = g + "_other", v.name = w, v.value = "other", m.appendChild(v);
|
|
9014
9014
|
const k = document.createElement("span");
|
|
9015
9015
|
k.className = "peer-span-rounded", m.appendChild(k);
|
|
9016
9016
|
const x = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 7a5 5 0 1 1 -4.995 5.217l-.005 -.217l.005 -.217a5 5 0 0 1 4.995 -4.783z"></path></svg>';
|
|
@@ -9019,38 +9019,38 @@ class yn {
|
|
|
9019
9019
|
S.innerText = l.otherText, m.appendChild(S);
|
|
9020
9020
|
const E = document.createElement("div");
|
|
9021
9021
|
p.appendChild(E);
|
|
9022
|
-
const
|
|
9023
|
-
|
|
9022
|
+
const L = document.createElement("input");
|
|
9023
|
+
L.type = "text", L.name = w + "_other", L.className = "inp-base", E.appendChild(L), v.addEventListener("change", this.changeListener), L.addEventListener("input", this.inputListener);
|
|
9024
9024
|
}
|
|
9025
9025
|
}
|
|
9026
9026
|
if (b === "multi-select") {
|
|
9027
9027
|
let g = this.getId();
|
|
9028
|
-
const
|
|
9029
|
-
if (
|
|
9028
|
+
const y = document.createElement("div");
|
|
9029
|
+
if (y.id = `checkbox_group_label_${g}`, y.className = "field-label-normal", y.innerHTML = l.title + (l.isRequired ? ` <span class="text-red-500" aria-hidden="true">*</span><span style="position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden;white-space:nowrap;">(${this.out("required")})</span>` : ""), p.appendChild(y), l.fieldNote) {
|
|
9030
9030
|
const m = document.createElement("div");
|
|
9031
9031
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9032
9032
|
}
|
|
9033
9033
|
const f = document.createElement("div");
|
|
9034
|
-
if (f.setAttribute("aria-labelledby", `checkbox_group_label_${g}`), f.setAttribute("role", "group"), f.className = "div-options", p.appendChild(f), l.choices && l.choices.forEach((m,
|
|
9034
|
+
if (f.setAttribute("aria-labelledby", `checkbox_group_label_${g}`), f.setAttribute("role", "group"), f.className = "div-options", p.appendChild(f), l.choices && l.choices.forEach((m, v) => {
|
|
9035
9035
|
let k = m;
|
|
9036
|
-
l.choicesText && (k = l.choicesText[
|
|
9036
|
+
l.choicesText && (k = l.choicesText[v] || m);
|
|
9037
9037
|
const x = document.createElement("label");
|
|
9038
|
-
x.setAttribute("for", `${g}_${
|
|
9038
|
+
x.setAttribute("for", `${g}_${v}`), x.className = "option-label", f.appendChild(x);
|
|
9039
9039
|
const S = document.createElement("input");
|
|
9040
|
-
S.type = "checkbox", S.className = "peer", S.id = `${g}_${
|
|
9040
|
+
S.type = "checkbox", S.className = "peer", S.id = `${g}_${v}`, S.name = w + "[]", S.value = m, x.appendChild(S);
|
|
9041
9041
|
const E = document.createElement("span");
|
|
9042
9042
|
E.className = "peer-span-square", x.appendChild(E);
|
|
9043
|
-
const
|
|
9043
|
+
const L = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round">
|
|
9044
9044
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10" />
|
|
9045
9045
|
</svg>`;
|
|
9046
|
-
E.innerHTML =
|
|
9046
|
+
E.innerHTML = L;
|
|
9047
9047
|
const A = document.createElement("span");
|
|
9048
9048
|
A.innerText = k, x.appendChild(A), S.addEventListener("change", this.changeListener);
|
|
9049
9049
|
}), l.showOtherItem) {
|
|
9050
9050
|
const m = document.createElement("label");
|
|
9051
9051
|
m.setAttribute("for", g + "_other"), m.className = "option-label", f.appendChild(m);
|
|
9052
|
-
const
|
|
9053
|
-
|
|
9052
|
+
const v = document.createElement("input");
|
|
9053
|
+
v.type = "checkbox", v.className = "peer", v.id = g + "_other", v.name = w, v.value = "other", m.appendChild(v);
|
|
9054
9054
|
const k = document.createElement("span");
|
|
9055
9055
|
k.className = "peer-span-square", m.appendChild(k);
|
|
9056
9056
|
const x = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round">
|
|
@@ -9061,14 +9061,14 @@ class yn {
|
|
|
9061
9061
|
S.innerText = l.otherText, m.appendChild(S);
|
|
9062
9062
|
const E = document.createElement("div");
|
|
9063
9063
|
p.appendChild(E);
|
|
9064
|
-
const
|
|
9065
|
-
|
|
9064
|
+
const L = document.createElement("input");
|
|
9065
|
+
L.type = "text", L.name = w + "_other", L.className = "inp-base", E.appendChild(L), v.addEventListener("change", this.changeListener), L.addEventListener("input", this.inputListener);
|
|
9066
9066
|
}
|
|
9067
9067
|
}
|
|
9068
9068
|
if (b === "switch") {
|
|
9069
9069
|
let g = this.getId();
|
|
9070
|
-
const
|
|
9071
|
-
if (
|
|
9070
|
+
const y = document.createElement("label");
|
|
9071
|
+
if (y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), y.id = `switch_${g}`, p.appendChild(y), l.fieldNote) {
|
|
9072
9072
|
const x = document.createElement("div");
|
|
9073
9073
|
x.className = "field-note", x.innerHTML = l.fieldNote, p.appendChild(x);
|
|
9074
9074
|
}
|
|
@@ -9076,13 +9076,13 @@ class yn {
|
|
|
9076
9076
|
f.className = "switch", f.tabIndex = 0, f.role = "switch", f.setAttribute("aria-labelledby", `switch_${g}`), f.setAttribute("aria-checked", "false"), f.setAttribute("data-checked", "false"), p.appendChild(f);
|
|
9077
9077
|
const m = document.createElement("div");
|
|
9078
9078
|
m.className = "switch-thumb", f.appendChild(m);
|
|
9079
|
-
const
|
|
9080
|
-
|
|
9079
|
+
const v = document.createElement("input");
|
|
9080
|
+
v.id = `switch_input_${g}`, v.setAttribute("aria-hidden", "true"), v.type = "text", v.name = w, v.style.cssText = "position:absolute;bottom:0px;left:25px;width:1px;height:1px;clip-path:inset(50%);overflow:hidden;", v.setAttribute("tabindex", "-1"), l.isRequired && (v.setAttribute("required", "required"), v.setCustomValidity(this.out("Please toggle this switch to proceed.")), f.setAttribute("aria-required", "true")), p.appendChild(v), l.value === "true" ? (f.setAttribute("aria-checked", "true"), f.setAttribute("data-checked", "true"), v.value = "true", l.isRequired && v.setCustomValidity("")) : (f.setAttribute("aria-checked", "false"), f.setAttribute("data-checked", "false"), v.value = "false", l.isRequired && v.setCustomValidity(this.out("Please toggle this switch to proceed."))), y.addEventListener("click", () => {
|
|
9081
9081
|
f.focus();
|
|
9082
9082
|
});
|
|
9083
9083
|
const k = () => {
|
|
9084
9084
|
const x = f.getAttribute("aria-checked") === "true";
|
|
9085
|
-
f.setAttribute("aria-checked", !x), f.setAttribute("data-checked", !x), x ? (
|
|
9085
|
+
f.setAttribute("aria-checked", !x), f.setAttribute("data-checked", !x), x ? (v.value = "false", l.isRequired && v.setCustomValidity(this.out("Please toggle this switch to proceed."))) : (v.value = "true", l.isRequired && v.setCustomValidity(""));
|
|
9086
9086
|
const S = this.getFormValues();
|
|
9087
9087
|
this.settings.onInputChange && this.settings.onInputChange(S);
|
|
9088
9088
|
};
|
|
@@ -9094,8 +9094,8 @@ class yn {
|
|
|
9094
9094
|
}
|
|
9095
9095
|
if (b === "dropdown") {
|
|
9096
9096
|
let g = this.getId();
|
|
9097
|
-
const
|
|
9098
|
-
if (
|
|
9097
|
+
const y = document.createElement("label");
|
|
9098
|
+
if (y.setAttribute("for", `dropdown_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9099
9099
|
const A = document.createElement("div");
|
|
9100
9100
|
A.className = "field-note", A.innerHTML = l.fieldNote, p.appendChild(A);
|
|
9101
9101
|
}
|
|
@@ -9103,17 +9103,17 @@ class yn {
|
|
|
9103
9103
|
f.className = "relative", p.appendChild(f);
|
|
9104
9104
|
const m = document.createElement("div");
|
|
9105
9105
|
m.className = "relative inline-block", f.appendChild(m);
|
|
9106
|
-
const
|
|
9107
|
-
|
|
9106
|
+
const v = document.createElement("select");
|
|
9107
|
+
v.id = `dropdown_${g}`, v.name = w, l.isRequired && v.setAttribute("required", "required"), m.appendChild(v);
|
|
9108
9108
|
const k = document.createElement("option");
|
|
9109
|
-
if (k.setAttribute("selected", "selected"), k.setAttribute("disabled", "disabled"), k.value = "", k.innerText = l.placeholder,
|
|
9109
|
+
if (k.setAttribute("selected", "selected"), k.setAttribute("disabled", "disabled"), k.value = "", k.innerText = l.placeholder, v.appendChild(k), l.choices && l.choices.forEach((A, C) => {
|
|
9110
9110
|
let D = A;
|
|
9111
|
-
l.choicesText && (D = l.choicesText[
|
|
9111
|
+
l.choicesText && (D = l.choicesText[C] || A);
|
|
9112
9112
|
const I = document.createElement("option");
|
|
9113
|
-
I.value = A, I.innerText = D,
|
|
9113
|
+
I.value = A, I.innerText = D, v.appendChild(I), C === l.selected && (k.remove(), I.setAttribute("selected", "selected"));
|
|
9114
9114
|
}), l.showOtherItem) {
|
|
9115
9115
|
const A = document.createElement("option");
|
|
9116
|
-
A.value = "other", A.innerText = l.otherText,
|
|
9116
|
+
A.value = "other", A.innerText = l.otherText, v.appendChild(A);
|
|
9117
9117
|
}
|
|
9118
9118
|
const x = document.createElement("div");
|
|
9119
9119
|
x.className = "select-arrow", m.appendChild(x), this.appendHtml(x, `
|
|
@@ -9123,17 +9123,17 @@ class yn {
|
|
|
9123
9123
|
`);
|
|
9124
9124
|
const S = document.createElement("input");
|
|
9125
9125
|
S.type = "text", S.id = `input_other_${g}`, S.name = w + "_other", S.className = "input-other hidden inp-base", p.appendChild(S);
|
|
9126
|
-
const E = p.querySelector(`#dropdown_${g}`),
|
|
9126
|
+
const E = p.querySelector(`#dropdown_${g}`), L = p.querySelector(`#input_other_${g}`);
|
|
9127
9127
|
E.addEventListener("change", () => {
|
|
9128
|
-
E.value === "other" ? (
|
|
9128
|
+
E.value === "other" ? (L.classList.remove("hidden"), L.focus()) : L.classList.add("hidden");
|
|
9129
9129
|
const A = this.getFormValues();
|
|
9130
9130
|
this.settings.onInputChange && this.settings.onInputChange(A);
|
|
9131
9131
|
}), S.addEventListener("input", this.inputListener);
|
|
9132
9132
|
}
|
|
9133
9133
|
if (b === "date") {
|
|
9134
9134
|
let g = this.getId();
|
|
9135
|
-
const
|
|
9136
|
-
if (
|
|
9135
|
+
const y = document.createElement("label");
|
|
9136
|
+
if (y.setAttribute("for", `date_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9137
9137
|
const m = document.createElement("div");
|
|
9138
9138
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9139
9139
|
}
|
|
@@ -9142,8 +9142,8 @@ class yn {
|
|
|
9142
9142
|
}
|
|
9143
9143
|
if (b === "time") {
|
|
9144
9144
|
let g = this.getId();
|
|
9145
|
-
const
|
|
9146
|
-
if (
|
|
9145
|
+
const y = document.createElement("label");
|
|
9146
|
+
if (y.setAttribute("for", `time_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9147
9147
|
const m = document.createElement("div");
|
|
9148
9148
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9149
9149
|
}
|
|
@@ -9152,8 +9152,8 @@ class yn {
|
|
|
9152
9152
|
}
|
|
9153
9153
|
if (b === "datetime") {
|
|
9154
9154
|
let g = this.getId();
|
|
9155
|
-
const
|
|
9156
|
-
if (
|
|
9155
|
+
const y = document.createElement("label");
|
|
9156
|
+
if (y.setAttribute("for", `datetime_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9157
9157
|
const m = document.createElement("div");
|
|
9158
9158
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9159
9159
|
}
|
|
@@ -9162,8 +9162,8 @@ class yn {
|
|
|
9162
9162
|
}
|
|
9163
9163
|
if (b === "color") {
|
|
9164
9164
|
let g = this.getId();
|
|
9165
|
-
const
|
|
9166
|
-
if (
|
|
9165
|
+
const y = document.createElement("label");
|
|
9166
|
+
if (y.setAttribute("for", `color_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9167
9167
|
const m = document.createElement("div");
|
|
9168
9168
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9169
9169
|
}
|
|
@@ -9172,8 +9172,8 @@ class yn {
|
|
|
9172
9172
|
}
|
|
9173
9173
|
if (b === "file" || b === "multifile") {
|
|
9174
9174
|
let g = this.getId();
|
|
9175
|
-
const
|
|
9176
|
-
if (
|
|
9175
|
+
const y = document.createElement("label");
|
|
9176
|
+
if (y.setAttribute("for", `file_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9177
9177
|
const P = document.createElement("div");
|
|
9178
9178
|
P.className = "field-note", P.innerHTML = l.fieldNote, p.appendChild(P);
|
|
9179
9179
|
}
|
|
@@ -9182,10 +9182,10 @@ class yn {
|
|
|
9182
9182
|
const m = document.createElement("input");
|
|
9183
9183
|
m.id = `input_url_label_${g}`, m.type = "text", m.name = w + "__url", m.value = l.value || "", m.className = "inp-base input-file-url", m.placeholder = l.placeholder || this.out("Enter URL."), p.appendChild(m), m.addEventListener("input", () => {
|
|
9184
9184
|
const P = p.querySelector(".btn-clearfile");
|
|
9185
|
-
P && P.click(), this.inputListener(), m.value !== "" ? l.isRequired &&
|
|
9185
|
+
P && P.click(), this.inputListener(), m.value !== "" ? l.isRequired && v.removeAttribute("required") : l.isRequired && v.setAttribute("required", "required"), rt(m.value), this.clearSelectedFiles();
|
|
9186
9186
|
}), l.useURL ? m.style.display = "" : m.style.display = "none";
|
|
9187
|
-
const
|
|
9188
|
-
|
|
9187
|
+
const v = document.createElement("input");
|
|
9188
|
+
v.id = `file_${g}`, v.type = "file", b === "multifile" && (v.multiple = !0), v.name = w, l.isRequired && v.setAttribute("required", "required"), v.className = "peer", f.appendChild(v);
|
|
9189
9189
|
const k = document.createElement("div");
|
|
9190
9190
|
k.className = "file-drop-area", f.appendChild(k);
|
|
9191
9191
|
const x = document.createElement("div");
|
|
@@ -9199,18 +9199,18 @@ class yn {
|
|
|
9199
9199
|
</svg>
|
|
9200
9200
|
${this.out("Select File")}
|
|
9201
9201
|
`, x.appendChild(E));
|
|
9202
|
-
let
|
|
9203
|
-
(l.source && l.source === "camera" || l.source && l.source === "local_and_camera") && (
|
|
9202
|
+
let L;
|
|
9203
|
+
(l.source && l.source === "camera" || l.source && l.source === "local_and_camera") && (L = document.createElement("button"), L.className = "btn-takephoto", L.innerHTML = `
|
|
9204
9204
|
<svg style="fill:none"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" class="icon-camera">
|
|
9205
9205
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 7h1a2 2 0 0 0 2 -2a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1a2 2 0 0 0 2 2h1a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-9a2 2 0 0 1 2 -2" /><path d="M9 13a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" />
|
|
9206
9206
|
</svg>
|
|
9207
9207
|
${this.out("Take Photo")}
|
|
9208
|
-
`, x.appendChild(
|
|
9208
|
+
`, x.appendChild(L));
|
|
9209
9209
|
const A = document.createElement("div");
|
|
9210
9210
|
A.className = "file-preview-container", f.appendChild(A);
|
|
9211
|
-
const
|
|
9212
|
-
|
|
9213
|
-
P.preventDefault(),
|
|
9211
|
+
const C = document.createElement("div");
|
|
9212
|
+
C.className = "file-drop-info-highlight", C.id = `file_name_${g}`, f.appendChild(C), E && E.addEventListener("click", (P) => {
|
|
9213
|
+
P.preventDefault(), v.click();
|
|
9214
9214
|
}), f.classList.add("disabledrop"), (!l.source || l.source && l.source === "local" || l.source && l.source === "local_and_camera") && (f.classList.remove("disabledrop"), f.addEventListener("dragover", (P) => {
|
|
9215
9215
|
P.preventDefault(), Array.from(P.dataTransfer.items).some((se) => se.kind === "file") && f.classList.add("drag-over");
|
|
9216
9216
|
}), f.addEventListener("dragleave", () => {
|
|
@@ -9219,22 +9219,22 @@ class yn {
|
|
|
9219
9219
|
if (P.preventDefault(), P.dataTransfer.files && P.dataTransfer.files.length > 0) {
|
|
9220
9220
|
f.classList.remove("drag-over");
|
|
9221
9221
|
const Y = P.dataTransfer.files[0];
|
|
9222
|
-
Y && (
|
|
9222
|
+
Y && (v.files = P.dataTransfer.files, qe(Y), this.clearSelectedFiles());
|
|
9223
9223
|
}
|
|
9224
9224
|
}) : b === "multifile" && f.addEventListener("drop", (P) => {
|
|
9225
9225
|
if (P.preventDefault(), P.dataTransfer.files && P.dataTransfer.files.length > 0) {
|
|
9226
9226
|
f.classList.remove("drag-over"), A.innerHTML = "";
|
|
9227
9227
|
const Y = P.dataTransfer.files;
|
|
9228
|
-
Y.length > 0 && (
|
|
9228
|
+
Y.length > 0 && (v.files = Y, Array.from(Y).forEach((se) => {
|
|
9229
9229
|
Pe(se);
|
|
9230
9230
|
}), this.clearSelectedFiles());
|
|
9231
9231
|
}
|
|
9232
|
-
})), b === "file" ?
|
|
9233
|
-
const P =
|
|
9232
|
+
})), b === "file" ? v.addEventListener("change", () => {
|
|
9233
|
+
const P = v.files[0];
|
|
9234
9234
|
P && (qe(P), this.clearSelectedFiles());
|
|
9235
|
-
}) : b === "multifile" &&
|
|
9235
|
+
}) : b === "multifile" && v.addEventListener("change", () => {
|
|
9236
9236
|
A.innerHTML = "";
|
|
9237
|
-
const P =
|
|
9237
|
+
const P = v.files;
|
|
9238
9238
|
Array.from(P).forEach((Y) => {
|
|
9239
9239
|
Y && (Pe(Y), this.clearSelectedFiles());
|
|
9240
9240
|
});
|
|
@@ -9327,7 +9327,7 @@ class yn {
|
|
|
9327
9327
|
}
|
|
9328
9328
|
});
|
|
9329
9329
|
const R = I.map((P) => P.type).join(",");
|
|
9330
|
-
|
|
9330
|
+
v.setAttribute("accept", R);
|
|
9331
9331
|
let q;
|
|
9332
9332
|
if (l.useImageMask) {
|
|
9333
9333
|
p.classList.add("image-mask");
|
|
@@ -9376,7 +9376,7 @@ class yn {
|
|
|
9376
9376
|
</div>
|
|
9377
9377
|
`;
|
|
9378
9378
|
this.appendHtml(f, T);
|
|
9379
|
-
const $ = p.querySelector(".livevideo"), N = p.querySelector(".photo-captured"), U = p.querySelector(".btn-selectfile2"),
|
|
9379
|
+
const $ = p.querySelector(".livevideo"), N = p.querySelector(".photo-captured"), U = p.querySelector(".btn-selectfile2"), B = p.querySelector(".btn-takephoto2"), V = p.querySelector(".btn-capturephoto"), de = p.querySelector(".btn-clearphoto"), ne = p.querySelector(".btn-stopcamera");
|
|
9380
9380
|
this.photoBlob = {};
|
|
9381
9381
|
let be;
|
|
9382
9382
|
U && U.addEventListener("click", (P) => {
|
|
@@ -9390,29 +9390,29 @@ class yn {
|
|
|
9390
9390
|
video: !0
|
|
9391
9391
|
}), $.srcObject = be;
|
|
9392
9392
|
} catch {
|
|
9393
|
-
alert("Unable to access the camera."), $.style.display = "none", V.style.display = "none", ne.style.display = "none", x.style.display = "none",
|
|
9393
|
+
alert("Unable to access the camera."), $.style.display = "none", V.style.display = "none", ne.style.display = "none", x.style.display = "none", C.style.display = "none";
|
|
9394
9394
|
}
|
|
9395
9395
|
setTimeout(() => {
|
|
9396
|
-
|
|
9396
|
+
B.style.display = "none", N.style.display = "none", $.style.display = "", V.style.display = "", de.style.display = "none", U && (U.style.display = "none"), B.style.display = "none", ne.style.display = "", x.style.display = "none", C.style.display = "none";
|
|
9397
9397
|
}, 100);
|
|
9398
9398
|
};
|
|
9399
|
-
|
|
9399
|
+
L && L.addEventListener("click", async (P) => {
|
|
9400
9400
|
P.preventDefault(), Ee();
|
|
9401
|
-
}),
|
|
9401
|
+
}), B.addEventListener("click", async (P) => {
|
|
9402
9402
|
P.preventDefault(), Ee();
|
|
9403
9403
|
}), ne.addEventListener("click", () => {
|
|
9404
|
-
be && be.getTracks().forEach((P) => P.stop()), $.style.display = "none", V.style.display = "none", ne.style.display = "none",
|
|
9404
|
+
be && be.getTracks().forEach((P) => P.stop()), $.style.display = "none", V.style.display = "none", ne.style.display = "none", B.style.display = "none", x.style.display = "", C.style.display = "";
|
|
9405
9405
|
}), V.addEventListener("click", (P) => {
|
|
9406
|
-
if (P.preventDefault(), N.style.display = "", N.width = $.videoWidth, N.height = $.videoHeight, N.getContext("2d").drawImage($, 0, 0, N.width, N.height), be.getTracks().forEach((Y) => Y.stop()), $.style.display = "none", V.style.display = "none", de.style.display = "", U && (U.style.display = ""),
|
|
9407
|
-
this.photoBlob[w] = Y,
|
|
9408
|
-
}, "image/jpeg"),
|
|
9406
|
+
if (P.preventDefault(), N.style.display = "", N.width = $.videoWidth, N.height = $.videoHeight, N.getContext("2d").drawImage($, 0, 0, N.width, N.height), be.getTracks().forEach((Y) => Y.stop()), $.style.display = "none", V.style.display = "none", de.style.display = "", U && (U.style.display = ""), B.style.display = "", ne.style.display = "none", N.toBlob((Y) => {
|
|
9407
|
+
this.photoBlob[w] = Y, v.removeAttribute("required");
|
|
9408
|
+
}, "image/jpeg"), B.style.display = "", l.useImageMask) {
|
|
9409
9409
|
const Y = N.toDataURL("image/jpeg");
|
|
9410
9410
|
q.setImage(Y);
|
|
9411
9411
|
}
|
|
9412
9412
|
this.clearSelectedFiles();
|
|
9413
9413
|
});
|
|
9414
9414
|
const Ae = () => {
|
|
9415
|
-
this.photoBlob[w] = null, N.style.display = "none", N.getContext("2d").clearRect(0, 0, N.width, N.height), m.value !== "" ? l.isRequired &&
|
|
9415
|
+
this.photoBlob[w] = null, N.style.display = "none", N.getContext("2d").clearRect(0, 0, N.width, N.height), m.value !== "" ? l.isRequired && v.removeAttribute("required") : l.isRequired && v.setAttribute("required", "required"), de.style.display = "none", U && (U.style.display = "none"), B.style.display = "none", x.style.display = "", C.style.display = "";
|
|
9416
9416
|
};
|
|
9417
9417
|
de.addEventListener("click", () => {
|
|
9418
9418
|
Ae();
|
|
@@ -9427,17 +9427,17 @@ class yn {
|
|
|
9427
9427
|
return;
|
|
9428
9428
|
q.loadUrl(P);
|
|
9429
9429
|
}
|
|
9430
|
-
Ae(),
|
|
9430
|
+
Ae(), C.innerHTML = "";
|
|
9431
9431
|
const he = document.createElement("div");
|
|
9432
|
-
|
|
9432
|
+
C.appendChild(he);
|
|
9433
9433
|
const K = document.createElement("button");
|
|
9434
9434
|
if (K.className = "btn-clearfile", K.innerHTML = `
|
|
9435
9435
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round">
|
|
9436
9436
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3" /><path d="M18 13.3l-6.3 -6.3" />
|
|
9437
9437
|
</svg>
|
|
9438
|
-
`,
|
|
9438
|
+
`, C.appendChild(K), K.addEventListener("click", (j) => {
|
|
9439
9439
|
let ke = K.closest(".form-field").querySelector(".img-preview");
|
|
9440
|
-
ke && ke.remove(), m.value = "",
|
|
9440
|
+
ke && ke.remove(), m.value = "", v.value = "", C.innerHTML = "", S.innerText = this.out(this.settings.fileUploadText), l.useImageMask && q.clearImage();
|
|
9441
9441
|
const Ie = document.querySelector(".formview-container .submit-container");
|
|
9442
9442
|
Ie && setTimeout(() => {
|
|
9443
9443
|
this.stickyElement(Ie);
|
|
@@ -9470,17 +9470,17 @@ class yn {
|
|
|
9470
9470
|
}
|
|
9471
9471
|
q.loadImage(P);
|
|
9472
9472
|
}
|
|
9473
|
-
Ae(), m.value = "",
|
|
9473
|
+
Ae(), m.value = "", C.innerHTML = "";
|
|
9474
9474
|
const se = document.createElement("div");
|
|
9475
|
-
se.innerText = P.name,
|
|
9475
|
+
se.innerText = P.name, C.appendChild(se);
|
|
9476
9476
|
const ce = document.createElement("button");
|
|
9477
9477
|
if (ce.className = "btn-clearfile", ce.innerHTML = `
|
|
9478
9478
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
9479
9479
|
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
|
9480
9480
|
</svg>
|
|
9481
|
-
`,
|
|
9481
|
+
`, C.appendChild(ce), ce.addEventListener("click", (K) => {
|
|
9482
9482
|
let j = ce.closest(".form-field").querySelector(".img-preview");
|
|
9483
|
-
j && j.remove(),
|
|
9483
|
+
j && j.remove(), v.value = "", C.innerHTML = "", S.innerText = this.out(this.settings.fileUploadText), l.useImageMask && q.clearImage();
|
|
9484
9484
|
const ve = document.querySelector(".formview-container .submit-container");
|
|
9485
9485
|
ve && setTimeout(() => {
|
|
9486
9486
|
this.stickyElement(ve);
|
|
@@ -9520,10 +9520,10 @@ class yn {
|
|
|
9520
9520
|
`, ce.appendChild(he), he.addEventListener("click", (j) => {
|
|
9521
9521
|
const ve = he.closest(".image-item");
|
|
9522
9522
|
ve && ve.remove(), ((yi) => {
|
|
9523
|
-
const Rt = new DataTransfer(), vi =
|
|
9523
|
+
const Rt = new DataTransfer(), vi = v.files;
|
|
9524
9524
|
Array.from(vi).forEach((Mt) => {
|
|
9525
9525
|
Mt !== yi && Rt.items.add(Mt);
|
|
9526
|
-
}),
|
|
9526
|
+
}), v.files = Rt.files;
|
|
9527
9527
|
})(P);
|
|
9528
9528
|
const Ie = document.querySelector(".formview-container .submit-container");
|
|
9529
9529
|
Ie && setTimeout(() => {
|
|
@@ -9547,8 +9547,8 @@ class yn {
|
|
|
9547
9547
|
}
|
|
9548
9548
|
if (b === "email") {
|
|
9549
9549
|
let g = this.getId();
|
|
9550
|
-
const
|
|
9551
|
-
if (
|
|
9550
|
+
const y = document.createElement("label");
|
|
9551
|
+
if (y.setAttribute("for", `email_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9552
9552
|
const m = document.createElement("div");
|
|
9553
9553
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9554
9554
|
}
|
|
@@ -9557,8 +9557,8 @@ class yn {
|
|
|
9557
9557
|
}
|
|
9558
9558
|
if (b === "phone") {
|
|
9559
9559
|
let g = this.getId();
|
|
9560
|
-
const
|
|
9561
|
-
if (
|
|
9560
|
+
const y = document.createElement("label");
|
|
9561
|
+
if (y.setAttribute("for", `phone_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9562
9562
|
const m = document.createElement("div");
|
|
9563
9563
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9564
9564
|
}
|
|
@@ -9567,8 +9567,8 @@ class yn {
|
|
|
9567
9567
|
}
|
|
9568
9568
|
if (b === "url") {
|
|
9569
9569
|
let g = this.getId();
|
|
9570
|
-
const
|
|
9571
|
-
if (
|
|
9570
|
+
const y = document.createElement("label");
|
|
9571
|
+
if (y.setAttribute("for", `url_label_${g}`), y.className = "field-label", y.innerHTML = l.title + (l.isRequired ? ' <span class="text-red-500" aria-hidden="true">*</span>' : ""), p.appendChild(y), l.fieldNote) {
|
|
9572
9572
|
const m = document.createElement("div");
|
|
9573
9573
|
m.className = "field-note", m.innerHTML = l.fieldNote, p.appendChild(m);
|
|
9574
9574
|
}
|
|
@@ -9577,8 +9577,8 @@ class yn {
|
|
|
9577
9577
|
}
|
|
9578
9578
|
if (b === "hidden") {
|
|
9579
9579
|
let g = this.getId();
|
|
9580
|
-
const
|
|
9581
|
-
|
|
9580
|
+
const y = document.createElement("label");
|
|
9581
|
+
y.setAttribute("for", `hidden_label_${g}`), y.className = "field-label hidden", y.innerText = l.title, p.appendChild(y);
|
|
9582
9582
|
const f = document.createElement("input");
|
|
9583
9583
|
f.id = `hidden_label_${g}`, f.type = "hidden", f.name = w, f.value = l.value, p.appendChild(f);
|
|
9584
9584
|
}
|
|
@@ -9622,23 +9622,23 @@ class yn {
|
|
|
9622
9622
|
_.setAttribute("for", `short_text_label_${w}`), _.className = "field-label", _.innerHTML = l, b.appendChild(_);
|
|
9623
9623
|
const g = document.createElement("input");
|
|
9624
9624
|
if (g.id = `short_text_label_${w}`, g.type = "text", g.name = h, g.autocomplete = "off", g.setAttribute("aria-hidden", "true"), g.setAttribute("tabindex", "-1"), g.className = "inp-base", b.appendChild(g), this.settings.captchaContainer) {
|
|
9625
|
-
const
|
|
9626
|
-
f.className = "captcha-container",
|
|
9625
|
+
const y = this.settings.captchaContainerClassName, f = document.createElement("div");
|
|
9626
|
+
f.className = "captcha-container", y && f.classList.add(y), r.appendChild(f);
|
|
9627
9627
|
}
|
|
9628
9628
|
if (t.useSubmitButton) {
|
|
9629
|
-
const
|
|
9630
|
-
|
|
9629
|
+
const y = document.createElement("div");
|
|
9630
|
+
y.className = "submit-container", r.appendChild(y);
|
|
9631
9631
|
let f = !0;
|
|
9632
9632
|
if ("hideReset" in t && (f = t.hideReset), !f) {
|
|
9633
9633
|
const S = document.createElement("button");
|
|
9634
9634
|
S.className = "btn-resetform";
|
|
9635
9635
|
const E = t.resetText || this.settings.resetText;
|
|
9636
|
-
S.innerText = E,
|
|
9636
|
+
S.innerText = E, y.appendChild(S), S.addEventListener("click", (A) => {
|
|
9637
9637
|
A.preventDefault();
|
|
9638
|
-
const
|
|
9639
|
-
|
|
9638
|
+
const C = S.closest("form");
|
|
9639
|
+
C && (C.reset(), C.querySelectorAll(".btn-clearfile").forEach((O) => {
|
|
9640
9640
|
O.click();
|
|
9641
|
-
}),
|
|
9641
|
+
}), C.querySelectorAll(".slider-container").forEach((O) => {
|
|
9642
9642
|
const R = O.querySelector("input");
|
|
9643
9643
|
O.querySelector(".current-value").textContent = R.value;
|
|
9644
9644
|
}));
|
|
@@ -9646,8 +9646,8 @@ class yn {
|
|
|
9646
9646
|
}
|
|
9647
9647
|
const m = document.createElement("button");
|
|
9648
9648
|
m.className = "btn-submitform";
|
|
9649
|
-
const
|
|
9650
|
-
m.innerText =
|
|
9649
|
+
const v = t.submitText;
|
|
9650
|
+
m.innerText = v, y.appendChild(m), (t.fullWidthButton || !1) && m.classList.add("w-full"), this.settings.alwaysVisibleSubmit && y.classList.add("always-visible"), this.stickyElement(y), m.addEventListener("click", async (S) => {
|
|
9651
9651
|
this.trigger("submit", S);
|
|
9652
9652
|
});
|
|
9653
9653
|
const x = r.closest("form");
|
|
@@ -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 n = localStorage.getItem("_results_html");
|
|
9734
9734
|
const r = document.querySelector(this.settings.resultSelector);
|
|
9735
9735
|
r.innerHTML = n, 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" && n.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), s += `
|
|
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 < n.length; a++) {
|
|
9844
|
-
let
|
|
9845
|
-
r.push(
|
|
9846
|
-
let
|
|
9844
|
+
let u = e[a];
|
|
9845
|
+
r.push(u);
|
|
9846
|
+
let d = n[a];
|
|
9847
9847
|
s += `
|
|
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..."), s.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
|
n += 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.."), s.appendChild(u);
|
|
9951
|
+
let d = await this.search(e);
|
|
9952
9952
|
const l = this.settings.scrapeExclude;
|
|
9953
|
-
let h =
|
|
9954
|
-
let
|
|
9955
|
-
return !l.some((f) =>
|
|
9953
|
+
let h = d.filter((g) => {
|
|
9954
|
+
let y = new URL(g.link).hostname;
|
|
9955
|
+
return !l.some((f) => y.includes(f));
|
|
9956
9956
|
});
|
|
9957
9957
|
const p = this.settings.scrapeLimit, b = h.slice(0, p);
|
|
9958
|
-
s.innerHTML = "",
|
|
9958
|
+
s.innerHTML = "", u = document.createElement("p"), u.innerHTML = this.out("Getting more information..."), s.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
|
n += _.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,56 +10089,56 @@ ${e}`);
|
|
|
10089
10089
|
</span>
|
|
10090
10090
|
${this.out("Abort")}
|
|
10091
10091
|
`, this.isNormal = !0), this.isGenerating = !0;
|
|
10092
|
-
let
|
|
10092
|
+
let d = (m, v) => {
|
|
10093
10093
|
if (m === void 0) return "";
|
|
10094
10094
|
if (!isNaN(m)) return m;
|
|
10095
10095
|
let k = m;
|
|
10096
|
-
return
|
|
10096
|
+
return v && v.trim().startsWith("{") && (k = JSON.stringify(m).slice(1, -1)), k;
|
|
10097
10097
|
};
|
|
10098
10098
|
t.innerHTML = "";
|
|
10099
10099
|
let l = JSON.parse(JSON.stringify(this.steps)), h = this.getFormValues();
|
|
10100
10100
|
if (!h) return;
|
|
10101
10101
|
if (!(h && Object.keys(h).length === 0)) {
|
|
10102
10102
|
for (const m of l) {
|
|
10103
|
-
let
|
|
10103
|
+
let v = m.prompt;
|
|
10104
10104
|
if (m.provider === "google") {
|
|
10105
10105
|
for (const x of h)
|
|
10106
10106
|
if (x.value instanceof FileList && x.value.length > 0) {
|
|
10107
10107
|
const E = x.value[0];
|
|
10108
10108
|
if (!E) continue;
|
|
10109
|
-
const
|
|
10109
|
+
const L = await new Promise((A, C) => {
|
|
10110
10110
|
const D = new FileReader();
|
|
10111
10111
|
D.onload = (I) => {
|
|
10112
10112
|
const O = I.target.result.split(",")[1];
|
|
10113
10113
|
A(O);
|
|
10114
|
-
}, D.onerror =
|
|
10114
|
+
}, D.onerror = C, D.readAsDataURL(E);
|
|
10115
10115
|
});
|
|
10116
|
-
|
|
10116
|
+
v = v.replaceAll(`{{${x.name}}}`, L), v = v.replaceAll(`{{${x.name.toUpperCase()}}}`, L);
|
|
10117
10117
|
}
|
|
10118
10118
|
}
|
|
10119
|
-
m.prompt =
|
|
10119
|
+
m.prompt = v;
|
|
10120
10120
|
}
|
|
10121
10121
|
l.forEach((m) => {
|
|
10122
|
-
let
|
|
10122
|
+
let v = m.prompt;
|
|
10123
10123
|
h.forEach((k) => {
|
|
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
|
-
|
|
10127
|
-
} else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (
|
|
10128
|
-
}), m.prompt =
|
|
10126
|
+
v = v.replaceAll(`{{${k.name}}}`, x), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, x);
|
|
10127
|
+
} else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (v = v.replaceAll(`{{${k.name}}}`, k.name), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, k.name)) : (v = v.replaceAll(`{{${k.name}}}`, d(k.value, m.prompt)), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, d(k.value, m.prompt)));
|
|
10128
|
+
}), m.prompt = v;
|
|
10129
10129
|
}), l.forEach((m) => {
|
|
10130
|
-
let
|
|
10130
|
+
let v = m.context;
|
|
10131
10131
|
h.forEach((k) => {
|
|
10132
10132
|
if (k.value || (k.value = ""), typeof k.value == "object" && Array.isArray(k.value)) {
|
|
10133
10133
|
const x = k.value.join(", ");
|
|
10134
|
-
|
|
10135
|
-
} else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (
|
|
10136
|
-
}), m.context =
|
|
10134
|
+
v = v.replaceAll(`{{${k.name}}}`, x), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, x);
|
|
10135
|
+
} else k.value instanceof FileList || typeof k.value == "string" && k.value.indexOf("base64") !== -1 ? (v = v.replaceAll(`{{${k.name}}}`, k.name), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, k.name)) : (v = v.replaceAll(`{{${k.name}}}`, d(k.value, m.prompt)), v = v.replaceAll(`{{${k.name.toUpperCase()}}}`, d(k.value, m.prompt)));
|
|
10136
|
+
}), m.context = v;
|
|
10137
10137
|
});
|
|
10138
10138
|
}
|
|
10139
|
-
const p = async (m,
|
|
10140
|
-
const
|
|
10141
|
-
|
|
10139
|
+
const p = async (m, v, k, x, S, E, L, A) => {
|
|
10140
|
+
const C = document.createElement("div");
|
|
10141
|
+
C.classList.add("result-container"), t.appendChild(C), C.innerHTML = `
|
|
10142
10142
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 20" width="27" height="20" fill="currentColor">
|
|
10143
10143
|
<circle cx="15" cy="15" r="10">
|
|
10144
10144
|
<animate attributeName="cy" dur="0.6s" values="15;5;15" repeatCount="indefinite"></animate>
|
|
@@ -10156,9 +10156,9 @@ ${e}`);
|
|
|
10156
10156
|
try {
|
|
10157
10157
|
I = JSON.parse(m), I && typeof I == "object" && (D = !0);
|
|
10158
10158
|
} catch {
|
|
10159
|
-
return
|
|
10159
|
+
return C.innerHTML = `<p>${this.out("Incorrect JSON format.")}</p>`, !1;
|
|
10160
10160
|
}
|
|
10161
|
-
(
|
|
10161
|
+
(L && (L.image || L.video || L.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>
|
|
@@ -10168,72 +10168,72 @@ ${e}`);
|
|
|
10168
10168
|
|
|
10169
10169
|
`, o.setAttribute("disabled", "")));
|
|
10170
10170
|
let O = "", R = "", q;
|
|
10171
|
-
if (
|
|
10171
|
+
if (L && L.search && (q = await this.getRelevantInfo(m, v, C), q.data !== "" && (v += `
|
|
10172
10172
|
Use the following information to answer the request:
|
|
10173
10173
|
|
|
10174
10174
|
${q.data}
|
|
10175
|
-
`)),
|
|
10176
|
-
const M = await this.media.generate(m,
|
|
10175
|
+
`)), L && (L.image || L.video || L.audio) || D) {
|
|
10176
|
+
const M = await this.media.generate(m, v, k, x, L, C, A);
|
|
10177
10177
|
return this.needCleanup = !0, this.settings.consoleLog && console.log(M), M.mediaGenerated ? {
|
|
10178
10178
|
media: M.output,
|
|
10179
10179
|
media2: M.output2,
|
|
10180
10180
|
markdown: M.markdown
|
|
10181
|
-
} : (
|
|
10181
|
+
} : (C.innerHTML = `<p>${M.message}</p>`, !1);
|
|
10182
10182
|
}
|
|
10183
10183
|
if (this.settings.assistantId) {
|
|
10184
10184
|
if (this.settings.assistantStreamUrl)
|
|
10185
|
-
await this.assistantStream(m,
|
|
10185
|
+
await this.assistantStream(m, v, S, E, async (M) => {
|
|
10186
10186
|
if (!(M && typeof M == "object")) {
|
|
10187
10187
|
if (O += M, !A) {
|
|
10188
10188
|
const T = z.parse(O);
|
|
10189
|
-
|
|
10189
|
+
C.innerHTML = T, R += T;
|
|
10190
10190
|
}
|
|
10191
10191
|
await new Promise((T) => setTimeout(T, 50));
|
|
10192
10192
|
}
|
|
10193
10193
|
}), await new Promise((M) => {
|
|
10194
10194
|
const T = setInterval(() => {
|
|
10195
|
-
|
|
10195
|
+
C.innerHTML === z.parse(O) && (clearInterval(T), M());
|
|
10196
10196
|
}, 10);
|
|
10197
|
-
}), A && (
|
|
10197
|
+
}), A && (C.innerHTML = "", C.remove()), this.outputHtml += `<div class="result-container">${R}</div>`;
|
|
10198
10198
|
else if (this.settings.assistantUrl) {
|
|
10199
|
-
let M = await this.assistant(m,
|
|
10199
|
+
let M = await this.assistant(m, v, S, E);
|
|
10200
10200
|
if (!M)
|
|
10201
10201
|
return !1;
|
|
10202
10202
|
if (O = M, A)
|
|
10203
|
-
|
|
10203
|
+
C.innerHTML = "", C.remove();
|
|
10204
10204
|
else {
|
|
10205
10205
|
const T = z.parse(M);
|
|
10206
|
-
|
|
10206
|
+
C.innerHTML = T, this.outputHtml += `<div class="result-container">${T}</div>`;
|
|
10207
10207
|
}
|
|
10208
10208
|
}
|
|
10209
10209
|
} else if (this.settings.sendCommandStreamUrl) {
|
|
10210
10210
|
let M = "", T = "", $ = "";
|
|
10211
10211
|
const N = async (U) => {
|
|
10212
|
-
let
|
|
10213
|
-
for (;
|
|
10214
|
-
if ($ = M.slice(0, $.length + 1),
|
|
10212
|
+
let B = 0;
|
|
10213
|
+
for (; B < U.length; ) {
|
|
10214
|
+
if ($ = M.slice(0, $.length + 1), B++, !A) {
|
|
10215
10215
|
const V = z.parse($);
|
|
10216
|
-
|
|
10216
|
+
C.innerHTML = V, T = V;
|
|
10217
10217
|
}
|
|
10218
10218
|
await new Promise((V) => setTimeout(V, 50));
|
|
10219
10219
|
}
|
|
10220
10220
|
};
|
|
10221
|
-
await this.sendStream(m,
|
|
10221
|
+
await this.sendStream(m, v, S, x, E, async (U) => {
|
|
10222
10222
|
O += U, M += U, await N(U);
|
|
10223
10223
|
}), await new Promise((U) => {
|
|
10224
|
-
const
|
|
10225
|
-
$.length === M.length && (clearInterval(
|
|
10224
|
+
const B = setInterval(() => {
|
|
10225
|
+
$.length === M.length && (clearInterval(B), U());
|
|
10226
10226
|
}, 10);
|
|
10227
|
-
}), A && (
|
|
10227
|
+
}), A && (C.innerHTML = "", C.remove()), this.outputHtml += `<div class="result-container">${T}</div>`;
|
|
10228
10228
|
} else {
|
|
10229
|
-
let M = await this.send(m,
|
|
10229
|
+
let M = await this.send(m, v, S, x, E);
|
|
10230
10230
|
if (!M)
|
|
10231
10231
|
return !1;
|
|
10232
10232
|
if (O = M, A)
|
|
10233
|
-
|
|
10233
|
+
C.innerHTML = "", C.remove();
|
|
10234
10234
|
else {
|
|
10235
10235
|
const T = z.parse(M);
|
|
10236
|
-
|
|
10236
|
+
C.innerHTML = T, this.outputHtml += `<div class="result-container">${T}</div>`;
|
|
10237
10237
|
}
|
|
10238
10238
|
}
|
|
10239
10239
|
if (!A) {
|
|
@@ -10251,15 +10251,15 @@ ${q.data}
|
|
|
10251
10251
|
}
|
|
10252
10252
|
return this.payloads.push({
|
|
10253
10253
|
prompt: m,
|
|
10254
|
-
context:
|
|
10254
|
+
context: v
|
|
10255
10255
|
}), this.output.push(O), {
|
|
10256
10256
|
media: [],
|
|
10257
10257
|
markdown: O
|
|
10258
10258
|
};
|
|
10259
10259
|
};
|
|
10260
|
-
|
|
10260
|
+
u || await (async (m) => {
|
|
10261
10261
|
this.previousResults = [], this.outputHtml = "";
|
|
10262
|
-
for (let
|
|
10262
|
+
for (let v = 0; v < m.length; v++) {
|
|
10263
10263
|
if (!this.isGenerating)
|
|
10264
10264
|
return;
|
|
10265
10265
|
let {
|
|
@@ -10267,43 +10267,43 @@ ${q.data}
|
|
|
10267
10267
|
context: x,
|
|
10268
10268
|
provider: S,
|
|
10269
10269
|
model: E,
|
|
10270
|
-
system:
|
|
10270
|
+
system: L,
|
|
10271
10271
|
functs: A,
|
|
10272
|
-
tools:
|
|
10272
|
+
tools: C,
|
|
10273
10273
|
hideOutput: D
|
|
10274
|
-
} = m[
|
|
10275
|
-
S = S || "", x = x || "",
|
|
10274
|
+
} = m[v];
|
|
10275
|
+
S = S || "", x = x || "", L = L || "You are an assistant", A = A || [];
|
|
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
|
-
let O = await p(k, x, S, E,
|
|
10284
|
+
let O = await p(k, x, S, E, L, A, C, D);
|
|
10285
10285
|
if (!O)
|
|
10286
10286
|
break;
|
|
10287
10287
|
if (this.mediaGenerated.push(...O.media), O.media && O.media.length === 1) {
|
|
10288
10288
|
let R = O.media[0], q = O.media2 && O.media2.length === 1 && O.media2[0];
|
|
10289
|
-
this.previousResults.push(q || R), D && (this.filesUploaded[`output_step_${
|
|
10289
|
+
this.previousResults.push(q || R), D && (this.filesUploaded[`output_step_${v}`] = R);
|
|
10290
10290
|
} else
|
|
10291
10291
|
this.previousResults.push(O.markdown);
|
|
10292
10292
|
}
|
|
10293
|
-
})(l),
|
|
10293
|
+
})(l), u && (e === 0 && (this.previousResults = []), await (async (v, k) => {
|
|
10294
10294
|
if (!this.isGenerating)
|
|
10295
10295
|
return;
|
|
10296
10296
|
let {
|
|
10297
10297
|
prompt: x,
|
|
10298
10298
|
context: S,
|
|
10299
10299
|
provider: E,
|
|
10300
|
-
model:
|
|
10300
|
+
model: L,
|
|
10301
10301
|
system: A,
|
|
10302
|
-
functs:
|
|
10302
|
+
functs: C,
|
|
10303
10303
|
tools: D,
|
|
10304
10304
|
hideOutput: I
|
|
10305
|
-
} =
|
|
10306
|
-
S = S || "", A = A || "You are an assistant",
|
|
10305
|
+
} = v[k];
|
|
10306
|
+
S = S || "", A = A || "You are an assistant", C = C || [];
|
|
10307
10307
|
let O = x;
|
|
10308
10308
|
this.previousResults && this.previousResults.forEach((q, M) => {
|
|
10309
10309
|
const T = `{{output_step_${M + 1}}}`;
|
|
@@ -10312,7 +10312,7 @@ ${q.data}
|
|
|
10312
10312
|
const T = `{{output_step_${M + 1}}}`;
|
|
10313
10313
|
O = O.replace(new RegExp(T, "g"), q), O = O.replace(new RegExp(T.toUpperCase(), "g"), q);
|
|
10314
10314
|
}), S = O, S = S.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000\uFEFF]/g, " ").trim(), this.settings.consoleLog && console.log(S);
|
|
10315
|
-
let R = await p(x, S, E,
|
|
10315
|
+
let R = await p(x, S, E, L, A, C, D, I);
|
|
10316
10316
|
if (R && (this.mediaGenerated.push(...R.media), !!this.previousResults))
|
|
10317
10317
|
if (R.media && R.media.length === 1) {
|
|
10318
10318
|
let q = R.media[0], M = R.media2 && R.media2.length === 1 && R.media2[0];
|
|
@@ -10322,7 +10322,7 @@ ${q.data}
|
|
|
10322
10322
|
})(l, e)), o.innerHTML = a, o.removeAttribute("disabled"), this.isGenerating = !1;
|
|
10323
10323
|
const w = this.calculateCost();
|
|
10324
10324
|
this.settings.onUsage && this.settings.onUsage(w), this.trigger("usage", w), this.isNormal = !1, this.isSingle = !1;
|
|
10325
|
-
const _ = (m,
|
|
10325
|
+
const _ = (m, v = 100) => {
|
|
10326
10326
|
const k = document.createElement("div");
|
|
10327
10327
|
if (k.innerHTML = m, k.querySelector("video"))
|
|
10328
10328
|
return "Video";
|
|
@@ -10331,7 +10331,7 @@ ${q.data}
|
|
|
10331
10331
|
if (k.querySelector("audio"))
|
|
10332
10332
|
return "Audio";
|
|
10333
10333
|
const x = k.textContent.trim();
|
|
10334
|
-
return x.length >
|
|
10334
|
+
return x.length > v ? x.substring(0, v) + "..." : x;
|
|
10335
10335
|
}, g = Object.keys(this.filesUploaded).length === 0 && this.filesUploaded.constructor === Object;
|
|
10336
10336
|
if (this.needCleanup && !g) {
|
|
10337
10337
|
this.settings.consoleLog && (console.log("Cleanup"), console.log(this.filesUploaded));
|
|
@@ -10345,26 +10345,26 @@ ${q.data}
|
|
|
10345
10345
|
body: JSON.stringify(this.filesUploaded)
|
|
10346
10346
|
});
|
|
10347
10347
|
}
|
|
10348
|
-
let
|
|
10349
|
-
this.mediaGenerated = this.mediaGenerated.filter((m) =>
|
|
10350
|
-
previewText: _(
|
|
10348
|
+
let y = this.outputHtml;
|
|
10349
|
+
this.mediaGenerated = this.mediaGenerated.filter((m) => y.indexOf(m) !== -1), this.trigger("resultReady", {
|
|
10350
|
+
previewText: _(y),
|
|
10351
10351
|
markdown: this.previousResults,
|
|
10352
|
-
html:
|
|
10352
|
+
html: y,
|
|
10353
10353
|
media: this.mediaGenerated,
|
|
10354
10354
|
// return the collected generated media from all steps
|
|
10355
10355
|
input: this.payloads,
|
|
10356
10356
|
output: this.output
|
|
10357
|
-
}), this.settings.saveResults && (localStorage.setItem("_results", JSON.stringify(this.previousResults)), localStorage.setItem("_results_html",
|
|
10358
|
-
m.addEventListener("click", async (
|
|
10359
|
-
|
|
10360
|
-
const k =
|
|
10357
|
+
}), this.settings.saveResults && (localStorage.setItem("_results", JSON.stringify(this.previousResults)), localStorage.setItem("_results_html", y)), this.addResultTool(), t.querySelectorAll(".link-download").forEach((m) => {
|
|
10358
|
+
m.addEventListener("click", async (v) => {
|
|
10359
|
+
v.preventDefault();
|
|
10360
|
+
const k = v.target.href;
|
|
10361
10361
|
try {
|
|
10362
10362
|
const x = await fetch(k, {
|
|
10363
10363
|
mode: "cors"
|
|
10364
10364
|
});
|
|
10365
10365
|
if (!x.ok) throw new Error("Failed to fetch the image.");
|
|
10366
|
-
const S = await x.blob(), E = k.substring(k.lastIndexOf("/") + 1),
|
|
10367
|
-
|
|
10366
|
+
const S = await x.blob(), E = k.substring(k.lastIndexOf("/") + 1), L = document.createElement("a");
|
|
10367
|
+
L.href = URL.createObjectURL(S), L.download = E, L.click(), URL.revokeObjectURL(L.href);
|
|
10368
10368
|
} catch (x) {
|
|
10369
10369
|
console.error("Error downloading the image:", x);
|
|
10370
10370
|
}
|
|
@@ -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 s = [];
|
|
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
|
s.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
|
-
}, s.push(l)), r.useImageMask && (a = a + "_mask",
|
|
10446
|
+
value: d
|
|
10447
|
+
}, s.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
|
}, s.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
|
}, s.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
|
}, s.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
|
}, s.push(l));
|
|
10470
10470
|
}), this.settings.consoleLog && console.log(s), s;
|
|
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
|
n || (n = []), s = s || this.settings.model, n.length > 0 && (s = 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, s, n, 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
|
n || (n = []), s = s || this.settings.model;
|
|
10530
|
-
const
|
|
10530
|
+
const d = {
|
|
10531
10531
|
question: e,
|
|
10532
10532
|
context: t,
|
|
10533
10533
|
system: i,
|
|
10534
10534
|
functs: n,
|
|
10535
10535
|
temperature: o,
|
|
10536
10536
|
topP: a,
|
|
10537
|
-
num:
|
|
10537
|
+
num: u,
|
|
10538
10538
|
model: s,
|
|
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;
|
|
@@ -10557,17 +10557,17 @@ ${q.data}
|
|
|
10557
10557
|
for (; !_; ) {
|
|
10558
10558
|
const {
|
|
10559
10559
|
done: g,
|
|
10560
|
-
value:
|
|
10560
|
+
value: y
|
|
10561
10561
|
} = await p.read();
|
|
10562
10562
|
if (_ = g, _) break;
|
|
10563
|
-
const f = b.decode(
|
|
10563
|
+
const f = b.decode(y, {
|
|
10564
10564
|
stream: !0
|
|
10565
10565
|
});
|
|
10566
10566
|
w += f;
|
|
10567
10567
|
const m = w.split(`
|
|
10568
10568
|
`);
|
|
10569
10569
|
w = "";
|
|
10570
|
-
let
|
|
10570
|
+
let v = 0, k = 0;
|
|
10571
10571
|
for (const x of m)
|
|
10572
10572
|
if (x.trim() !== "" && x.startsWith("data:")) {
|
|
10573
10573
|
const S = x.slice(5).trim();
|
|
@@ -10577,16 +10577,16 @@ ${q.data}
|
|
|
10577
10577
|
}
|
|
10578
10578
|
try {
|
|
10579
10579
|
const E = JSON.parse(S);
|
|
10580
|
-
if (E.usage && (
|
|
10581
|
-
const
|
|
10582
|
-
r && r(
|
|
10580
|
+
if (E.usage && (v = E.usage.prompt_tokens, k = E.usage.completion_tokens), E.choices && E.choices[0].delta && E.choices[0].delta.content) {
|
|
10581
|
+
const L = E.choices[0].delta.content;
|
|
10582
|
+
r && r(L);
|
|
10583
10583
|
}
|
|
10584
10584
|
} catch {
|
|
10585
10585
|
w += x + `
|
|
10586
10586
|
`;
|
|
10587
10587
|
}
|
|
10588
10588
|
}
|
|
10589
|
-
this.tokenInput +=
|
|
10589
|
+
this.tokenInput += v, this.tokenOutput += k;
|
|
10590
10590
|
}
|
|
10591
10591
|
return !0;
|
|
10592
10592
|
} catch (l) {
|
|
@@ -10599,7 +10599,7 @@ ${q.data}
|
|
|
10599
10599
|
s || (s = []);
|
|
10600
10600
|
let a = this.settings.model;
|
|
10601
10601
|
s.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, s, n) {
|
|
10632
10632
|
this.controller = new AbortController(), this.signal = this.controller.signal;
|
|
10633
10633
|
let r = 0.6, o = 0.9, a = 1;
|
|
10634
10634
|
s || (s = []);
|
|
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;
|
|
@@ -10666,20 +10666,20 @@ ${q.data}
|
|
|
10666
10666
|
value: g
|
|
10667
10667
|
} = await h.read();
|
|
10668
10668
|
if (w = _, w) break;
|
|
10669
|
-
const
|
|
10669
|
+
const y = p.decode(g, {
|
|
10670
10670
|
stream: !0
|
|
10671
10671
|
});
|
|
10672
|
-
b +=
|
|
10672
|
+
b += y;
|
|
10673
10673
|
const f = b.split(`
|
|
10674
10674
|
`);
|
|
10675
10675
|
b = "";
|
|
10676
10676
|
for (const m of f)
|
|
10677
10677
|
if (m.trim() !== "")
|
|
10678
10678
|
if (m.startsWith("data:")) {
|
|
10679
|
-
const
|
|
10680
|
-
|
|
10679
|
+
const v = m.slice(5).trim();
|
|
10680
|
+
v === "[DONE]" && this.settings.consoleLog && console.log("Stream completed.");
|
|
10681
10681
|
try {
|
|
10682
|
-
const k = JSON.parse(
|
|
10682
|
+
const k = JSON.parse(v);
|
|
10683
10683
|
if (k.choices && k.choices[0].delta && k.choices[0].delta.content) {
|
|
10684
10684
|
const x = k.choices[0].delta.content;
|
|
10685
10685
|
n && n(x);
|
|
@@ -10689,14 +10689,14 @@ ${q.data}
|
|
|
10689
10689
|
`;
|
|
10690
10690
|
}
|
|
10691
10691
|
} else {
|
|
10692
|
-
const
|
|
10693
|
-
this.tokenInput +=
|
|
10692
|
+
const v = JSON.parse(m);
|
|
10693
|
+
this.tokenInput += v.prompt_tokens, this.tokenOutput += v.completion_tokens;
|
|
10694
10694
|
break;
|
|
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) {
|
|
@@ -10750,6 +10750,10 @@ class vn {
|
|
|
10750
10750
|
// Plugin registry
|
|
10751
10751
|
autoLoad: !0,
|
|
10752
10752
|
pluginBaseUrl: "",
|
|
10753
|
+
autoRegisterPlugins: !0,
|
|
10754
|
+
// Load a plugin found in the content even when it is not registered
|
|
10755
|
+
pluginFolder: "",
|
|
10756
|
+
// Folder holding the plugins (<folder><name>/index.js); found from the registered plugins when empty
|
|
10753
10757
|
allowExternalPlugins: !0,
|
|
10754
10758
|
// Simple on/off for external plugins
|
|
10755
10759
|
trustedDomains: [],
|
|
@@ -10757,18 +10761,54 @@ class vn {
|
|
|
10757
10761
|
onReInit: () => {
|
|
10758
10762
|
},
|
|
10759
10763
|
...e
|
|
10760
|
-
}, this.plugins = /* @__PURE__ */ new Map(), this.loadedStyles = /* @__PURE__ */ new
|
|
10764
|
+
}, this.plugins = /* @__PURE__ */ new Map(), this.loadedStyles = /* @__PURE__ */ new Map(), this.components = /* @__PURE__ */ new Map(), this.externalPlugins = /* @__PURE__ */ new Map(), this.autoPlugins = {}, this.missingPlugins = /* @__PURE__ */ new Set();
|
|
10765
|
+
}
|
|
10766
|
+
/**
|
|
10767
|
+
* Whether a plugin can be loaded. A plugin that is not registered is registered
|
|
10768
|
+
* from the plugins folder (<folder><name>/index.js and style.css), when
|
|
10769
|
+
* autoRegisterPlugins is on. Only a plain name is accepted, so the file always
|
|
10770
|
+
* comes from the plugins folder.
|
|
10771
|
+
*/
|
|
10772
|
+
canLoad(e) {
|
|
10773
|
+
if (this.config.plugins[e] || this.autoPlugins[e]) return !0;
|
|
10774
|
+
if (!this.config.autoRegisterPlugins || e === "code" || this.missingPlugins.has(e) || !/^[a-z0-9][a-z0-9-]*$/.test(e)) return !1;
|
|
10775
|
+
const t = this.getPluginFolder();
|
|
10776
|
+
return t ? (this.autoPlugins[e] = { url: t + e + "/index.js", css: t + e + "/style.css", auto: !0 }, !0) : !1;
|
|
10777
|
+
}
|
|
10778
|
+
/**
|
|
10779
|
+
* The plugins folder: the pluginFolder setting, or the folder of the registered
|
|
10780
|
+
* plugins (a plugin registered as name: { url: '<folder><name>/index.js' }).
|
|
10781
|
+
*/
|
|
10782
|
+
getPluginFolder() {
|
|
10783
|
+
let e = this.config.pluginFolder;
|
|
10784
|
+
if (!e)
|
|
10785
|
+
for (const [t, i] of Object.entries(this.config.plugins)) {
|
|
10786
|
+
if (!i || typeof i.url != "string") continue;
|
|
10787
|
+
const s = "/" + t + "/index.js";
|
|
10788
|
+
if (i.url.endsWith(s)) {
|
|
10789
|
+
e = i.url.slice(0, -s.length + 1);
|
|
10790
|
+
break;
|
|
10791
|
+
}
|
|
10792
|
+
}
|
|
10793
|
+
return e && !e.endsWith("/") && (e += "/"), e || "";
|
|
10794
|
+
}
|
|
10795
|
+
/**
|
|
10796
|
+
* Plugin names written in the content (data-cb-type)
|
|
10797
|
+
*/
|
|
10798
|
+
contentTypes(e = document) {
|
|
10799
|
+
const t = /* @__PURE__ */ new Set();
|
|
10800
|
+
return e.nodeType === 1 && e.dataset.cbType && t.add(e.dataset.cbType), e.querySelectorAll("[data-cb-type]").forEach((i) => t.add(i.dataset.cbType)), t;
|
|
10761
10801
|
}
|
|
10762
10802
|
/**
|
|
10763
10803
|
* Auto-detect and load plugins based on DOM elements
|
|
10764
10804
|
*/
|
|
10765
10805
|
async autoLoadPlugins() {
|
|
10766
|
-
const
|
|
10767
|
-
(
|
|
10806
|
+
const e = this.detectComponentTypes(), t = this.contentTypes(), i = e.filter(
|
|
10807
|
+
(s) => !this.plugins.has(s) && (this.config.plugins[s] || t.has(s) && this.canLoad(s))
|
|
10768
10808
|
);
|
|
10769
|
-
return
|
|
10770
|
-
|
|
10771
|
-
),
|
|
10809
|
+
return i.length > 0 && await Promise.all(
|
|
10810
|
+
i.map((s) => this.loadPlugin(s))
|
|
10811
|
+
), i;
|
|
10772
10812
|
}
|
|
10773
10813
|
/**
|
|
10774
10814
|
* Detect all component types used in the page
|
|
@@ -10792,7 +10832,7 @@ class vn {
|
|
|
10792
10832
|
async loadPlugin(e) {
|
|
10793
10833
|
if (this.plugins.has(e))
|
|
10794
10834
|
return this.plugins.get(e);
|
|
10795
|
-
const t = this.config.plugins[e];
|
|
10835
|
+
const t = this.config.plugins[e] || (this.canLoad(e) ? this.autoPlugins[e] : null);
|
|
10796
10836
|
if (!t)
|
|
10797
10837
|
return console.warn(`[PluginManager] Plugin "${e}" not found in registry`), null;
|
|
10798
10838
|
if (e === "code") {
|
|
@@ -10806,11 +10846,12 @@ class vn {
|
|
|
10806
10846
|
return this.plugins.set(e, i), this.emit("plugin-loaded", { name: e, plugin: i }), i;
|
|
10807
10847
|
}
|
|
10808
10848
|
try {
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10849
|
+
let i = null;
|
|
10850
|
+
t.css && !t.auto && (i = this.loadCSS(this.resolveUrl(t.css)));
|
|
10851
|
+
const s = this.resolveUrl(t.url), n = await this.importModule(s), r = n.default || n;
|
|
10852
|
+
return t.css && t.auto && (i = this.loadCSS(this.resolveUrl(t.css))), i && await i, this.plugins.set(e, r), typeof r.init == "function" && await r.init(this), this.emit("plugin-loaded", { name: e, plugin: r }), r;
|
|
10812
10853
|
} catch (i) {
|
|
10813
|
-
return console.error(`[PluginManager] Failed to load plugin "${e}":`, i), null;
|
|
10854
|
+
return t.auto ? (delete this.autoPlugins[e], this.missingPlugins.add(e), null) : (console.error(`[PluginManager] Failed to load plugin "${e}":`, i), null);
|
|
10814
10855
|
}
|
|
10815
10856
|
}
|
|
10816
10857
|
/**
|
|
@@ -10827,13 +10868,17 @@ class vn {
|
|
|
10827
10868
|
* Load CSS file
|
|
10828
10869
|
*/
|
|
10829
10870
|
loadCSS(e) {
|
|
10830
|
-
if (this.loadedStyles.has(e)) return;
|
|
10871
|
+
if (this.loadedStyles.has(e)) return this.loadedStyles.get(e);
|
|
10831
10872
|
const t = document.createElement("link");
|
|
10832
|
-
t.rel = "stylesheet", t.href = e
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10873
|
+
t.rel = "stylesheet", t.href = e;
|
|
10874
|
+
const i = new Promise((s) => {
|
|
10875
|
+
t.onload = () => {
|
|
10876
|
+
this.emit("css-loaded", { url: e }), s();
|
|
10877
|
+
}, t.onerror = () => {
|
|
10878
|
+
console.error(`[PluginManager] Failed to load CSS: ${e}`), s();
|
|
10879
|
+
};
|
|
10880
|
+
});
|
|
10881
|
+
return document.head.appendChild(t), this.loadedStyles.set(e, i), i;
|
|
10837
10882
|
}
|
|
10838
10883
|
/**
|
|
10839
10884
|
* Resolve URL (handle relative paths)
|
|
@@ -10851,14 +10896,14 @@ class vn {
|
|
|
10851
10896
|
try {
|
|
10852
10897
|
const r = this.parseOptions(t);
|
|
10853
10898
|
let o = t.querySelector(".grid-sortable");
|
|
10854
|
-
o || t.classList.contains("grid-sortable") && (o = t), o && Array.from(o.children).forEach((
|
|
10855
|
-
|
|
10856
|
-
}), t.querySelectorAll(".edit").forEach((
|
|
10899
|
+
o || t.classList.contains("grid-sortable") && (o = t), o && Array.from(o.children).forEach((d, l) => {
|
|
10900
|
+
d.nodeType === 1 && d.tagName !== "STYLE" && d.tagName !== "SCRIPT" && d.setAttribute("data-index", l);
|
|
10901
|
+
}), t.querySelectorAll(".edit").forEach((d, l) => {
|
|
10857
10902
|
const h = `content-${Date.now()}-${i}-${l}`;
|
|
10858
|
-
|
|
10903
|
+
d.setAttribute("data-edit-id", h);
|
|
10859
10904
|
}), t.hasAttribute("data-cb-original-content") || t.setAttribute("data-cb-original-content", t.innerHTML);
|
|
10860
|
-
const
|
|
10861
|
-
this.components.set(t,
|
|
10905
|
+
const u = n.mount(t, r);
|
|
10906
|
+
this.components.set(t, u), this.setupInlineEditing(t, r), t.setAttribute("data-cb-loaded", "true"), typeof t.mount == "function" && t.mount();
|
|
10862
10907
|
} catch (r) {
|
|
10863
10908
|
console.error(`[PluginManager] Failed to mount component "${s}":`, r);
|
|
10864
10909
|
}
|
|
@@ -10906,37 +10951,37 @@ class vn {
|
|
|
10906
10951
|
const n = (r, o) => {
|
|
10907
10952
|
const a = e.getAttribute("data-cb-original-content");
|
|
10908
10953
|
if (!a) return;
|
|
10909
|
-
const
|
|
10910
|
-
|
|
10911
|
-
const l =
|
|
10954
|
+
const u = document.createElement("template");
|
|
10955
|
+
u.innerHTML = a.trim();
|
|
10956
|
+
const l = u.content.querySelector(`[data-edit-id="${r}"]`);
|
|
10912
10957
|
if (l) {
|
|
10913
10958
|
l.innerHTML = o;
|
|
10914
|
-
const h =
|
|
10959
|
+
const h = u.innerHTML;
|
|
10915
10960
|
e.setAttribute("data-cb-original-content", h);
|
|
10916
10961
|
}
|
|
10917
10962
|
};
|
|
10918
10963
|
i.forEach((r) => {
|
|
10919
10964
|
r.setAttribute("contenteditable", "true");
|
|
10920
|
-
const o = (
|
|
10965
|
+
const o = (d) => {
|
|
10921
10966
|
var l = document.createRange();
|
|
10922
|
-
l.selectNodeContents(
|
|
10967
|
+
l.selectNodeContents(d);
|
|
10923
10968
|
var h = window.getSelection();
|
|
10924
10969
|
h.removeAllRanges(), h.addRange(l);
|
|
10925
|
-
}, a = (
|
|
10926
|
-
if ((
|
|
10970
|
+
}, a = (d) => {
|
|
10971
|
+
if ((d.ctrlKey || d.metaKey) && d.which === 65) {
|
|
10927
10972
|
let l;
|
|
10928
10973
|
try {
|
|
10929
|
-
window.getSelection ? l = window.getSelection().getRangeAt(0).commonAncestorContainer.parentNode : document.selection && (l = document.selection.createRange().parentElement()), o(l),
|
|
10974
|
+
window.getSelection ? l = window.getSelection().getRangeAt(0).commonAncestorContainer.parentNode : document.selection && (l = document.selection.createRange().parentElement()), o(l), d.preventDefault(), d.stopImmediatePropagation();
|
|
10930
10975
|
} catch {
|
|
10931
10976
|
}
|
|
10932
10977
|
}
|
|
10933
10978
|
};
|
|
10934
10979
|
r.addEventListener("keydown", a), r._cbKeydownHandler = a;
|
|
10935
|
-
const
|
|
10936
|
-
const
|
|
10937
|
-
n(
|
|
10980
|
+
const u = new MutationObserver(() => {
|
|
10981
|
+
const d = r.getAttribute("data-edit-id"), l = r.innerHTML;
|
|
10982
|
+
n(d, l);
|
|
10938
10983
|
});
|
|
10939
|
-
|
|
10984
|
+
u.observe(r, {
|
|
10940
10985
|
childList: !0,
|
|
10941
10986
|
// Child elements added/removed
|
|
10942
10987
|
characterData: !0,
|
|
@@ -10946,7 +10991,7 @@ class vn {
|
|
|
10946
10991
|
attributes: !0
|
|
10947
10992
|
// Attribute changes
|
|
10948
10993
|
// attributeFilter: ['style'] // Specifically watch style (color picker)
|
|
10949
|
-
}), r._cbObserver =
|
|
10994
|
+
}), r._cbObserver = u;
|
|
10950
10995
|
});
|
|
10951
10996
|
}
|
|
10952
10997
|
/**
|
|
@@ -11014,48 +11059,48 @@ class vn {
|
|
|
11014
11059
|
this.reinitializeInProgress = !0;
|
|
11015
11060
|
try {
|
|
11016
11061
|
const t = [];
|
|
11017
|
-
this.components.forEach((
|
|
11018
|
-
(e === document || e.contains(
|
|
11019
|
-
}), t.forEach(({ element:
|
|
11020
|
-
const d =
|
|
11021
|
-
|
|
11062
|
+
this.components.forEach((a, u) => {
|
|
11063
|
+
(e === document || e.contains(u)) && t.push({ element: u, instance: a });
|
|
11064
|
+
}), t.forEach(({ element: a, instance: u }) => {
|
|
11065
|
+
const d = a.dataset.cbType, l = this.plugins.get(d);
|
|
11066
|
+
l && typeof l.unmount == "function" && l.unmount(a, u), this.components.delete(a);
|
|
11022
11067
|
});
|
|
11023
|
-
const
|
|
11024
|
-
(
|
|
11068
|
+
const i = this.detectComponentTypesInContainer(e), s = this.contentTypes(e), n = i.filter(
|
|
11069
|
+
(a) => !this.plugins.has(a) && (this.config.plugins[a] || s.has(a) && this.canLoad(a))
|
|
11025
11070
|
);
|
|
11026
|
-
|
|
11027
|
-
|
|
11071
|
+
n.length > 0 && await Promise.all(
|
|
11072
|
+
n.map((a) => this.loadPlugin(a))
|
|
11028
11073
|
);
|
|
11029
|
-
const
|
|
11030
|
-
let
|
|
11031
|
-
for (const
|
|
11032
|
-
const
|
|
11074
|
+
const r = e.querySelectorAll("[data-cb-type]");
|
|
11075
|
+
let o = 0;
|
|
11076
|
+
for (const a of r) {
|
|
11077
|
+
const u = a.dataset.cbType, d = this.plugins.get(u);
|
|
11033
11078
|
if (d && typeof d.mount == "function")
|
|
11034
11079
|
try {
|
|
11035
|
-
const
|
|
11036
|
-
let
|
|
11037
|
-
if (
|
|
11038
|
-
|
|
11039
|
-
}),
|
|
11040
|
-
const
|
|
11041
|
-
|
|
11042
|
-
}), !
|
|
11043
|
-
|
|
11080
|
+
const l = this.parseOptions(a);
|
|
11081
|
+
let h = a.querySelector(".grid-sortable");
|
|
11082
|
+
if (h || a.classList.contains("grid-sortable") && (h = a), h && Array.from(h.children).forEach((w, _) => {
|
|
11083
|
+
w.nodeType === 1 && w.tagName !== "STYLE" && w.tagName !== "SCRIPT" && w.setAttribute("data-index", _);
|
|
11084
|
+
}), a.querySelectorAll(".edit").forEach((w, _) => {
|
|
11085
|
+
const g = `content-${Date.now()}-${o}-${_}`;
|
|
11086
|
+
w.setAttribute("data-edit-id", g);
|
|
11087
|
+
}), !a.hasAttribute("data-cb-original-content"))
|
|
11088
|
+
a.setAttribute("data-cb-original-content", a.innerHTML);
|
|
11044
11089
|
else {
|
|
11045
|
-
let
|
|
11046
|
-
|
|
11047
|
-
let
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
}),
|
|
11090
|
+
let w = document.createRange();
|
|
11091
|
+
a.innerHTML = "", a.appendChild(w.createContextualFragment(a.getAttribute("data-cb-original-content")));
|
|
11092
|
+
let _ = !1;
|
|
11093
|
+
a.querySelectorAll(".edit:not([data-edit-id])").forEach((g, y) => {
|
|
11094
|
+
g.setAttribute("data-edit-id", `content-${Date.now()}-${o}-new-${y}`), _ = !0;
|
|
11095
|
+
}), _ && a.setAttribute("data-cb-original-content", a.innerHTML);
|
|
11051
11096
|
}
|
|
11052
|
-
const
|
|
11053
|
-
this.components.set(
|
|
11054
|
-
} catch (
|
|
11055
|
-
console.error(`[PluginManager] Failed to mount component "${
|
|
11097
|
+
const b = await d.mount(a, l);
|
|
11098
|
+
this.components.set(a, b), this.setupInlineEditing(a, l), a.setAttribute("data-cb-loaded", "true"), typeof a.mount == "function" && a.mount(), o++;
|
|
11099
|
+
} catch (l) {
|
|
11100
|
+
console.error(`[PluginManager] Failed to mount component "${u}":`, l);
|
|
11056
11101
|
}
|
|
11057
11102
|
}
|
|
11058
|
-
return typeof this.config.onReInit == "function" && this.config.onReInit(), this.emit("reinitialized", { container: e, count:
|
|
11103
|
+
return typeof this.config.onReInit == "function" && this.config.onReInit(), this.emit("reinitialized", { container: e, count: o }), o;
|
|
11059
11104
|
} finally {
|
|
11060
11105
|
this.reinitializeInProgress = !1;
|
|
11061
11106
|
}
|
|
@@ -11223,7 +11268,34 @@ class vn {
|
|
|
11223
11268
|
this.runtime = e;
|
|
11224
11269
|
}
|
|
11225
11270
|
}
|
|
11226
|
-
|
|
11271
|
+
const wn = 3e3;
|
|
11272
|
+
function xn(c = document) {
|
|
11273
|
+
const e = Date.now(), t = /* @__PURE__ */ new WeakSet(), i = /* @__PURE__ */ new WeakSet(), s = (u) => !!(u && u.matches && u.matches("form[data-cb-protect]") && !u.closest('[contenteditable="true"], .is-builder')), n = (u) => u && u.form instanceof HTMLFormElement ? u.form : u && u.closest ? u.closest("form") : null, r = (u) => {
|
|
11274
|
+
if (!u.isTrusted) return;
|
|
11275
|
+
const d = n(u.target);
|
|
11276
|
+
s(d) && t.add(d);
|
|
11277
|
+
}, o = (u) => {
|
|
11278
|
+
const d = u.target;
|
|
11279
|
+
if (!s(d)) return;
|
|
11280
|
+
const l = (d.getAttribute("data-cb-protect") || "").split(/\s+/);
|
|
11281
|
+
if (l.includes("typed") && !t.has(d)) {
|
|
11282
|
+
u.preventDefault(), u.stopImmediatePropagation();
|
|
11283
|
+
return;
|
|
11284
|
+
}
|
|
11285
|
+
const h = wn - (Date.now() - e);
|
|
11286
|
+
if (l.includes("wait") && h > 0 && (u.preventDefault(), u.stopImmediatePropagation(), t.has(d) && !i.has(d))) {
|
|
11287
|
+
i.add(d);
|
|
11288
|
+
const p = u.submitter && u.submitter.form === d ? u.submitter : null;
|
|
11289
|
+
setTimeout(() => {
|
|
11290
|
+
i.delete(d), d.isConnected && d.requestSubmit(p || void 0);
|
|
11291
|
+
}, h);
|
|
11292
|
+
}
|
|
11293
|
+
}, a = ["keydown", "pointerdown", "click", "input", "change"];
|
|
11294
|
+
return a.forEach((u) => c.addEventListener(u, r, !0)), c.addEventListener("submit", o, !0), () => {
|
|
11295
|
+
a.forEach((u) => c.removeEventListener(u, r, !0)), c.removeEventListener("submit", o, !0);
|
|
11296
|
+
};
|
|
11297
|
+
}
|
|
11298
|
+
class kn {
|
|
11227
11299
|
constructor(e = {}) {
|
|
11228
11300
|
const t = {
|
|
11229
11301
|
skin: "light",
|
|
@@ -11231,6 +11303,10 @@ class wn {
|
|
|
11231
11303
|
// Plugin registry: { 'plugin-name': { url: '...', css: '...' } }
|
|
11232
11304
|
autoLoadPlugins: !0,
|
|
11233
11305
|
// Auto-load plugins based on detected components
|
|
11306
|
+
autoRegisterPlugins: !0,
|
|
11307
|
+
// Load a plugin found in the content even when it is not registered (from pluginFolder)
|
|
11308
|
+
pluginFolder: "",
|
|
11309
|
+
// Folder holding the plugins (<folder><name>/index.js); found from the registered plugins when empty
|
|
11234
11310
|
pluginBaseUrl: "",
|
|
11235
11311
|
// Base URL for plugins if using relative paths
|
|
11236
11312
|
allowExternalPlugins: !0,
|
|
@@ -11241,6 +11317,8 @@ class wn {
|
|
|
11241
11317
|
this.settings = { ...t, ...e }, this.initialized = !1, this.pluginManager = new vn({
|
|
11242
11318
|
plugins: this.settings.plugins,
|
|
11243
11319
|
autoLoad: this.settings.autoLoadPlugins,
|
|
11320
|
+
autoRegisterPlugins: this.settings.autoRegisterPlugins,
|
|
11321
|
+
pluginFolder: this.settings.pluginFolder,
|
|
11244
11322
|
pluginBaseUrl: this.settings.pluginBaseUrl,
|
|
11245
11323
|
allowExternalPlugins: this.settings.allowExternalPlugins,
|
|
11246
11324
|
trustedDomains: this.settings.trustedDomains
|
|
@@ -11340,7 +11418,7 @@ class wn {
|
|
|
11340
11418
|
document.removeEventListener(`contentbox:${e}`, t);
|
|
11341
11419
|
}
|
|
11342
11420
|
init() {
|
|
11343
|
-
this.
|
|
11421
|
+
this.formGuardOff || (this.formGuardOff = xn()), !this.initialized && (this.initCore(), this.initPlugins(), this.initialized = !0, this.emit("init"));
|
|
11344
11422
|
}
|
|
11345
11423
|
async initPlugins() {
|
|
11346
11424
|
this.settings.autoLoadPlugins && await this.pluginManager.autoLoadPlugins(), this.pluginManager.initializeComponents();
|
|
@@ -11377,13 +11455,13 @@ class wn {
|
|
|
11377
11455
|
if (t) {
|
|
11378
11456
|
const o = t.closest("[data-gallery]");
|
|
11379
11457
|
let a = [];
|
|
11380
|
-
o ? a = o.querySelectorAll(".is-lightbox") : document.querySelectorAll(".is-lightbox,.block-click").forEach((
|
|
11381
|
-
|
|
11382
|
-
}), a.forEach((
|
|
11383
|
-
let l =
|
|
11384
|
-
l || (l =
|
|
11458
|
+
o ? a = o.querySelectorAll(".is-lightbox") : document.querySelectorAll(".is-lightbox,.block-click").forEach((d) => {
|
|
11459
|
+
d.closest("[data-gallery]") || a.push(d);
|
|
11460
|
+
}), a.forEach((u, d) => {
|
|
11461
|
+
let l = u.getAttribute("href");
|
|
11462
|
+
l || (l = u.getAttribute("data-modal-url")), s.push({
|
|
11385
11463
|
href: l
|
|
11386
|
-
}), e === l && (n =
|
|
11464
|
+
}), e === l && (n = d);
|
|
11387
11465
|
});
|
|
11388
11466
|
}
|
|
11389
11467
|
const r = document.activeElement;
|
|
@@ -11396,11 +11474,11 @@ class wn {
|
|
|
11396
11474
|
});
|
|
11397
11475
|
}
|
|
11398
11476
|
destroy() {
|
|
11399
|
-
this.glightbox && (this.glightbox.destroy(), this.glightbox = null), document.querySelectorAll(".is-lightbox,.block-click").forEach((t) => {
|
|
11477
|
+
this.formGuardOff && (this.formGuardOff(), this.formGuardOff = null), this.glightbox && (this.glightbox.destroy(), this.glightbox = null), document.querySelectorAll(".is-lightbox,.block-click").forEach((t) => {
|
|
11400
11478
|
t._lightboxHandler && (t.removeEventListener("click", t._lightboxHandler), delete t._lightboxHandler);
|
|
11401
11479
|
}), this.pluginManager.destroy(), this.initialized = !1, this.emit("destroy");
|
|
11402
11480
|
}
|
|
11403
11481
|
}
|
|
11404
11482
|
export {
|
|
11405
|
-
|
|
11483
|
+
kn as default
|
|
11406
11484
|
};
|