@innovastudio/contentbuilder-interactive-runtime 1.0.10 → 1.0.11
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.
|
@@ -2,13 +2,13 @@ const At = Date.now();
|
|
|
2
2
|
function fe() {
|
|
3
3
|
let c = {}, e = !0, t = 0, i = arguments.length;
|
|
4
4
|
Object.prototype.toString.call(arguments[0]) === "[object Boolean]" && (e = arguments[0], t++);
|
|
5
|
-
let
|
|
6
|
-
for (let r in
|
|
7
|
-
Object.prototype.hasOwnProperty.call(
|
|
5
|
+
let s = (n) => {
|
|
6
|
+
for (let r in n)
|
|
7
|
+
Object.prototype.hasOwnProperty.call(n, r) && (e && Object.prototype.toString.call(n[r]) === "[object Object]" ? c[r] = fe(!0, c[r], n[r]) : c[r] = n[r]);
|
|
8
8
|
};
|
|
9
9
|
for (; t < i; t++) {
|
|
10
|
-
let
|
|
11
|
-
n
|
|
10
|
+
let n = arguments[t];
|
|
11
|
+
s(n);
|
|
12
12
|
}
|
|
13
13
|
return c;
|
|
14
14
|
}
|
|
@@ -26,26 +26,26 @@ function X(c, e) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
function qt(c, e = null, t = null) {
|
|
29
|
-
const i = c[At] = c[At] || [],
|
|
30
|
-
return e && t && si(i) > 0 && X(i, (
|
|
31
|
-
if (
|
|
32
|
-
return
|
|
33
|
-
}),
|
|
29
|
+
const i = c[At] = c[At] || [], s = { all: i, evt: null, found: null };
|
|
30
|
+
return e && t && si(i) > 0 && X(i, (n, r) => {
|
|
31
|
+
if (n.eventName == e && n.fn.toString() == t.toString())
|
|
32
|
+
return s.found = !0, s.evt = r, !1;
|
|
33
|
+
}), s;
|
|
34
34
|
}
|
|
35
|
-
function oe(c, { onElement: e, withCallback: t, avoidDuplicate: i = !0, once:
|
|
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
38
|
function a(d) {
|
|
39
|
-
G(t) && t.call(r, d, this),
|
|
39
|
+
G(t) && t.call(r, d, this), s && a.destroy();
|
|
40
40
|
}
|
|
41
41
|
return a.destroy = function() {
|
|
42
42
|
X(o, (d) => {
|
|
43
43
|
const u = qt(d, c, a);
|
|
44
|
-
u.found && u.all.splice(u.evt, 1), d.removeEventListener && d.removeEventListener(c, a,
|
|
44
|
+
u.found && u.all.splice(u.evt, 1), d.removeEventListener && d.removeEventListener(c, a, n);
|
|
45
45
|
});
|
|
46
46
|
}, X(o, (d) => {
|
|
47
47
|
const u = qt(d, c, a);
|
|
48
|
-
(d.addEventListener && i && !u.found || !i) && (d.addEventListener(c, a,
|
|
48
|
+
(d.addEventListener && i && !u.found || !i) && (d.addEventListener(c, a, n), u.all.push({ eventName: c, fn: a }));
|
|
49
49
|
}), a;
|
|
50
50
|
}
|
|
51
51
|
function H(c, e) {
|
|
@@ -70,15 +70,15 @@ function Ce(c, e = "", t = !1) {
|
|
|
70
70
|
return !1;
|
|
71
71
|
if (e === "none")
|
|
72
72
|
return G(t) && t(), !1;
|
|
73
|
-
const i = wi(),
|
|
74
|
-
X(
|
|
75
|
-
H(c, "g" +
|
|
73
|
+
const i = wi(), s = e.split(" ");
|
|
74
|
+
X(s, (n) => {
|
|
75
|
+
H(c, "g" + n);
|
|
76
76
|
}), oe(i, {
|
|
77
77
|
onElement: c,
|
|
78
78
|
avoidDuplicate: !1,
|
|
79
79
|
once: !0,
|
|
80
|
-
withCallback: (
|
|
81
|
-
X(
|
|
80
|
+
withCallback: (n, r) => {
|
|
81
|
+
X(s, (o) => {
|
|
82
82
|
J(r, "g" + o);
|
|
83
83
|
}), G(t) && t();
|
|
84
84
|
}
|
|
@@ -131,10 +131,10 @@ function xi() {
|
|
|
131
131
|
return t[c];
|
|
132
132
|
}
|
|
133
133
|
function ki(c) {
|
|
134
|
-
let { url: e, allow: t, callback: i, appendTo:
|
|
135
|
-
return
|
|
136
|
-
|
|
137
|
-
},
|
|
134
|
+
let { url: e, allow: t, callback: i, appendTo: s } = c, n = document.createElement("iframe");
|
|
135
|
+
return n.className = "vimeo-video gvideo", n.src = e, n.style.width = "100%", n.style.height = "100%", t && n.setAttribute("allow", t), n.onload = function() {
|
|
136
|
+
n.onload = null, H(n, "node-ready"), G(i) && i();
|
|
137
|
+
}, s && s.appendChild(n), n;
|
|
138
138
|
}
|
|
139
139
|
function at(c, e, t, i) {
|
|
140
140
|
if (c()) {
|
|
@@ -142,8 +142,8 @@ function at(c, e, t, i) {
|
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
t || (t = 100);
|
|
145
|
-
let
|
|
146
|
-
c() && (clearInterval(
|
|
145
|
+
let s = setInterval(() => {
|
|
146
|
+
c() && (clearInterval(s), e());
|
|
147
147
|
}, t);
|
|
148
148
|
}
|
|
149
149
|
function It(c, e, t) {
|
|
@@ -161,8 +161,8 @@ function It(c, e, t) {
|
|
|
161
161
|
G(t) && t();
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
const
|
|
165
|
-
o.rel = "stylesheet", o.type = "text/css", o.href = c, o.media = "all", r ?
|
|
164
|
+
const n = document.getElementsByTagName("head")[0], r = n.querySelectorAll('link[rel="stylesheet"]'), o = document.createElement("link");
|
|
165
|
+
o.rel = "stylesheet", o.type = "text/css", o.href = c, o.media = "all", r ? n.insertBefore(o, r[0]) : n.appendChild(o), G(t) && t();
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
if (i = document.querySelectorAll('script[src="' + c + '"]'), i && i.length > 0) {
|
|
@@ -178,8 +178,8 @@ function It(c, e, t) {
|
|
|
178
178
|
}
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
|
-
let
|
|
182
|
-
|
|
181
|
+
let s = document.createElement("script");
|
|
182
|
+
s.type = "text/javascript", s.src = c, s.onload = () => {
|
|
183
183
|
if (G(t)) {
|
|
184
184
|
if (Ne(e))
|
|
185
185
|
return at(
|
|
@@ -190,7 +190,7 @@ function It(c, e, t) {
|
|
|
190
190
|
), !1;
|
|
191
191
|
t();
|
|
192
192
|
}
|
|
193
|
-
}, document.body.appendChild(
|
|
193
|
+
}, document.body.appendChild(s);
|
|
194
194
|
}
|
|
195
195
|
function bt() {
|
|
196
196
|
return typeof window > "u" ? !1 : "navigator" in window && window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i);
|
|
@@ -248,9 +248,9 @@ function $t(c = -1) {
|
|
|
248
248
|
t.push(o.getAttribute("data-taborder"));
|
|
249
249
|
});
|
|
250
250
|
const i = Math.max.apply(Math, t.map((o) => parseInt(o)));
|
|
251
|
-
let
|
|
252
|
-
|
|
253
|
-
const r = t.filter((o) => o >= parseInt(
|
|
251
|
+
let s = c < 0 ? 1 : c + 1;
|
|
252
|
+
s > i && (s = "1");
|
|
253
|
+
const r = t.filter((o) => o >= parseInt(s)).sort()[0];
|
|
254
254
|
return document.querySelector(`.gbtn[data-taborder="${r}"]`);
|
|
255
255
|
}
|
|
256
256
|
function Si(c) {
|
|
@@ -262,23 +262,23 @@ function Si(c) {
|
|
|
262
262
|
e = e || window.event;
|
|
263
263
|
const i = e.keyCode;
|
|
264
264
|
if (i == 9) {
|
|
265
|
-
const
|
|
266
|
-
if (!
|
|
265
|
+
const s = document.querySelector(".gbtn.focused");
|
|
266
|
+
if (!s) {
|
|
267
267
|
const a = document.activeElement && document.activeElement.nodeName ? document.activeElement.nodeName.toLocaleLowerCase() : !1;
|
|
268
268
|
if (a == "input" || a == "textarea" || a == "button")
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
e.preventDefault();
|
|
272
|
-
const
|
|
273
|
-
if (!
|
|
272
|
+
const n = document.querySelectorAll(".gbtn[data-taborder]");
|
|
273
|
+
if (!n || n.length <= 0)
|
|
274
274
|
return;
|
|
275
|
-
if (!
|
|
275
|
+
if (!s) {
|
|
276
276
|
const a = $t();
|
|
277
277
|
a && (a.focus(), H(a, "focused"));
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
let r =
|
|
281
|
-
J(
|
|
280
|
+
let r = s.getAttribute("data-taborder"), o = $t(r);
|
|
281
|
+
J(s, "focused"), o && (o.focus(), H(o, "focused"));
|
|
282
282
|
}
|
|
283
283
|
i == 39 && c.nextSlide(), i == 37 && c.prevSlide(), i == 27 && c.close();
|
|
284
284
|
}
|
|
@@ -343,11 +343,11 @@ class Mi {
|
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
345
|
this.now = Date.now(), this.x1 = e.touches[0].pageX, this.y1 = e.touches[0].pageY, this.delta = this.now - (this.last || this.now), this.touchStart.dispatch(e, this.element), this.preTapPosition.x !== null && (this.isDoubleTap = this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30, this.isDoubleTap && clearTimeout(this.singleTapTimeout)), this.preTapPosition.x = this.x1, this.preTapPosition.y = this.y1, this.last = this.now;
|
|
346
|
-
var i = this.preV,
|
|
347
|
-
if (
|
|
346
|
+
var i = this.preV, s = e.touches.length;
|
|
347
|
+
if (s > 1) {
|
|
348
348
|
this._cancelLongTap(), this._cancelSingleTap();
|
|
349
|
-
var
|
|
350
|
-
i.x =
|
|
349
|
+
var n = { x: e.touches[1].pageX - this.x1, y: e.touches[1].pageY - this.y1 };
|
|
350
|
+
i.x = n.x, i.y = n.y, this.pinchStartLen = Xe(i), this.multipointStart.dispatch(e, this.element);
|
|
351
351
|
}
|
|
352
352
|
this._preventTap = !1, this.longTapTimeout = setTimeout(
|
|
353
353
|
(function() {
|
|
@@ -358,20 +358,20 @@ class Mi {
|
|
|
358
358
|
}
|
|
359
359
|
move(e) {
|
|
360
360
|
if (e.touches) {
|
|
361
|
-
var t = this.preV, i = e.touches.length,
|
|
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
|
-
var r = e.touches[1].pageX, o = e.touches[1].pageY, a = { x: e.touches[1].pageX -
|
|
364
|
-
t.x !== null && (this.pinchStartLen > 0 && (e.zoom = Xe(a) / this.pinchStartLen, this.pinch.dispatch(e, this.element)), e.angle = Li(a, t), this.rotate.dispatch(e, this.element)), t.x = a.x, t.y = a.y, this.x2 !== null && this.sx2 !== null ? (e.deltaX = (
|
|
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 = Li(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
|
-
e.deltaX =
|
|
367
|
+
e.deltaX = s - this.x2, e.deltaY = n - this.y2;
|
|
368
368
|
var d = Math.abs(this.x1 - this.x2), u = Math.abs(this.y1 - this.y2);
|
|
369
369
|
(d > 10 || u > 10) && (this._preventTap = !0);
|
|
370
370
|
} else
|
|
371
371
|
e.deltaX = 0, e.deltaY = 0;
|
|
372
372
|
this.pressMove.dispatch(e, this.element);
|
|
373
373
|
}
|
|
374
|
-
this.touchMove.dispatch(e, this.element), this._cancelLongTap(), this.x2 =
|
|
374
|
+
this.touchMove.dispatch(e, this.element), this._cancelLongTap(), this.x2 = s, this.y2 = n, i > 1 && e.preventDefault();
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
end(e) {
|
|
@@ -399,8 +399,8 @@ class Mi {
|
|
|
399
399
|
_cancelSingleTap() {
|
|
400
400
|
clearTimeout(this.singleTapTimeout);
|
|
401
401
|
}
|
|
402
|
-
_swipeDirection(e, t, i,
|
|
403
|
-
return Math.abs(e - t) >= Math.abs(i -
|
|
402
|
+
_swipeDirection(e, t, i, s) {
|
|
403
|
+
return Math.abs(e - t) >= Math.abs(i - s) ? e - t > 0 ? "Left" : "Right" : i - s > 0 ? "Up" : "Down";
|
|
404
404
|
}
|
|
405
405
|
on(e, t) {
|
|
406
406
|
this[e] && this[e].add(t);
|
|
@@ -414,29 +414,29 @@ class Mi {
|
|
|
414
414
|
}
|
|
415
415
|
function lt(c) {
|
|
416
416
|
const e = xi(), t = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
417
|
-
let i = te(c, "gslide-media") ? c : c.querySelector(".gslide-media"),
|
|
418
|
-
t > 769 && (i =
|
|
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"), Fe(i, "translate3d(0, 0, 0)"), oe(e, {
|
|
419
419
|
onElement: i,
|
|
420
420
|
once: !0,
|
|
421
421
|
withCallback: (r, o) => {
|
|
422
422
|
J(i, "greset");
|
|
423
423
|
}
|
|
424
|
-
}), i.style.opacity = "",
|
|
424
|
+
}), i.style.opacity = "", n && (n.style.opacity = "");
|
|
425
425
|
}
|
|
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,
|
|
429
|
+
let e = ti(), t = e.width, i = e.height, s = !1, n = null, r = null, o = null, a = !1, d = 1, u = 4.5, l = 1, h = !1, p = !1, b = null, w = null, _ = null, g = null, v, f, m = 0, y = 0, k = !1, x = !1, S = {}, E = {}, C = 0, A = 0, L;
|
|
430
430
|
const D = document.getElementById("glightbox-slider"), I = document.querySelector(".goverlay"), O = new Mi(D, {
|
|
431
431
|
touchStart: (R) => {
|
|
432
|
-
if (
|
|
433
|
-
if (E = R.targetTouches[0], S.pageX = R.targetTouches[0].pageX, S.pageY = R.targetTouches[0].pageY, C = R.targetTouches[0].clientX, A = R.targetTouches[0].clientY,
|
|
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, C = R.targetTouches[0].clientX, A = R.targetTouches[0].clientY, n = c.activeSlide, r = n.querySelector(".gslide-media"), L = 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
|
}
|
|
437
437
|
},
|
|
438
438
|
touchMove: (R) => {
|
|
439
|
-
if (!
|
|
439
|
+
if (!s || (E = R.targetTouches[0], h || p))
|
|
440
440
|
return;
|
|
441
441
|
if (L && L.offsetHeight > i) {
|
|
442
442
|
const U = S.pageX - E.pageX;
|
|
@@ -452,7 +452,7 @@ function Ai(c) {
|
|
|
452
452
|
Fe(r, `translate3d(${m}%, ${y}%, 0)`);
|
|
453
453
|
},
|
|
454
454
|
touchEnd: () => {
|
|
455
|
-
if (!
|
|
455
|
+
if (!s)
|
|
456
456
|
return;
|
|
457
457
|
if (a = !1, p || h) {
|
|
458
458
|
_ = b, g = w;
|
|
@@ -518,9 +518,9 @@ class qi {
|
|
|
518
518
|
constructor(e, t, i = null) {
|
|
519
519
|
if (this.img = e, this.slide = t, this.onclose = i, this.img.setZoomEvents)
|
|
520
520
|
return !1;
|
|
521
|
-
this.active = !1, this.zoomedIn = !1, this.dragging = !1, this.currentX = null, this.currentY = null, this.initialX = null, this.initialY = null, this.xOffset = 0, this.yOffset = 0, this.img.addEventListener("mousedown", (
|
|
521
|
+
this.active = !1, this.zoomedIn = !1, this.dragging = !1, this.currentX = null, this.currentY = null, this.initialX = null, this.initialY = null, this.xOffset = 0, this.yOffset = 0, this.img.addEventListener("mousedown", (s) => this.dragStart(s), !1), this.img.addEventListener("mouseup", (s) => this.dragEnd(s), !1), this.img.addEventListener("mousemove", (s) => this.drag(s), !1), this.img.addEventListener(
|
|
522
522
|
"click",
|
|
523
|
-
(
|
|
523
|
+
(s) => {
|
|
524
524
|
if (this.slide.classList.contains("dragging-nav"))
|
|
525
525
|
return this.zoomOut(), !1;
|
|
526
526
|
if (!this.zoomedIn)
|
|
@@ -574,8 +574,8 @@ class qi {
|
|
|
574
574
|
}
|
|
575
575
|
class Nt {
|
|
576
576
|
constructor(e = {}) {
|
|
577
|
-
let { dragEl: t, toleranceX: i = 40, toleranceY:
|
|
578
|
-
this.el = t, this.active = !1, this.dragging = !1, this.currentX = null, this.currentY = null, this.initialX = null, this.initialY = null, this.xOffset = 0, this.yOffset = 0, this.direction = null, this.lastDirection = null, this.toleranceX = i, this.toleranceY =
|
|
577
|
+
let { dragEl: t, toleranceX: i = 40, toleranceY: s = 65, slide: n = null, instance: r = null } = e;
|
|
578
|
+
this.el = t, this.active = !1, this.dragging = !1, this.currentX = null, this.currentY = null, this.initialX = null, this.initialY = null, this.xOffset = 0, this.yOffset = 0, this.direction = null, this.lastDirection = null, this.toleranceX = i, this.toleranceY = s, this.toleranceReached = !1, this.dragContainer = this.el, this.slide = n, this.instance = r, this.el.addEventListener("mousedown", (o) => this.dragStart(o), !1), this.el.addEventListener("mouseup", (o) => this.dragEnd(o), !1), this.el.addEventListener("mousemove", (o) => this.drag(o), !1);
|
|
579
579
|
}
|
|
580
580
|
dragStart(e) {
|
|
581
581
|
if (this.slide.classList.contains("zoomed")) {
|
|
@@ -601,16 +601,16 @@ class Nt {
|
|
|
601
601
|
let t = Math.abs(this.currentX), i = Math.abs(this.currentY);
|
|
602
602
|
if (t > 0 && t >= Math.abs(this.currentY) && (!this.lastDirection || this.lastDirection == "x")) {
|
|
603
603
|
this.yOffset = 0, this.lastDirection = "x", this.setTranslate(this.dragContainer, this.currentX, 0);
|
|
604
|
-
let
|
|
605
|
-
if (!this.instance.settings.dragAutoSnap &&
|
|
606
|
-
this.instance.preventOutsideClick = !0, this.toleranceReached = !0, this.active = !1, this.instance.preventOutsideClick = !0, this.dragEnd(null),
|
|
604
|
+
let s = this.shouldChange();
|
|
605
|
+
if (!this.instance.settings.dragAutoSnap && s && (this.doSlideChange = s), this.instance.settings.dragAutoSnap && s) {
|
|
606
|
+
this.instance.preventOutsideClick = !0, this.toleranceReached = !0, this.active = !1, this.instance.preventOutsideClick = !0, this.dragEnd(null), s == "right" && this.instance.prevSlide(), s == "left" && this.instance.nextSlide();
|
|
607
607
|
return;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
if (this.toleranceY > 0 && i > 0 && i >= t && (!this.lastDirection || this.lastDirection == "y")) {
|
|
611
611
|
this.xOffset = 0, this.lastDirection = "y", this.setTranslate(this.dragContainer, 0, this.currentY);
|
|
612
|
-
let
|
|
613
|
-
!this.instance.settings.dragAutoSnap &&
|
|
612
|
+
let s = this.shouldClose();
|
|
613
|
+
!this.instance.settings.dragAutoSnap && s && (this.doSlideClose = !0), this.instance.settings.dragAutoSnap && s && this.instance.close();
|
|
614
614
|
return;
|
|
615
615
|
}
|
|
616
616
|
}
|
|
@@ -627,34 +627,34 @@ class Nt {
|
|
|
627
627
|
let e = !1;
|
|
628
628
|
return Math.abs(this.currentY) >= this.toleranceY && (e = !0), e;
|
|
629
629
|
}
|
|
630
|
-
setTranslate(e, t, i,
|
|
631
|
-
|
|
630
|
+
setTranslate(e, t, i, s = !1) {
|
|
631
|
+
s ? e.style.transition = "all .2s ease" : e.style.transition = "", e.style.transform = `translate3d(${t}px, ${i}px, 0)`;
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
634
|
function Pi(c, e, t, i) {
|
|
635
|
-
const
|
|
636
|
-
let
|
|
637
|
-
|
|
635
|
+
const s = c.querySelector(".gslide-media");
|
|
636
|
+
let n = new Image(), r = "gSlideTitle_" + t, o = "gSlideDesc_" + t;
|
|
637
|
+
n.addEventListener("load", () => {
|
|
638
638
|
G(i) && i();
|
|
639
|
-
}, !1),
|
|
639
|
+
}, !1), n.src = e.href, e.sizes != "" && e.srcset != "" && (n.sizes = e.sizes, n.srcset = e.srcset), n.alt = "", !re(e.alt) && e.alt !== "" && (n.alt = e.alt), e.title !== "" && n.setAttribute("aria-labelledby", r), e.description !== "" && n.setAttribute("aria-describedby", o), e.hasOwnProperty("_hasCustomWidth") && e._hasCustomWidth && (n.style.width = e.width), e.hasOwnProperty("_hasCustomHeight") && e._hasCustomHeight && (n.style.height = e.height), s.insertBefore(n, s.firstChild);
|
|
640
640
|
}
|
|
641
641
|
function Ii(c, e, t, i) {
|
|
642
|
-
const
|
|
643
|
-
H(
|
|
642
|
+
const s = c.querySelector(".ginner-container"), n = "gvideo" + t, r = c.querySelector(".gslide-media"), o = this.getAllPlayers();
|
|
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
646
|
let d = e.href, u = e?.videoProvider, l = !1;
|
|
647
647
|
r.style.maxWidth = e.width, It(this.settings.plyr.js, "Plyr", () => {
|
|
648
648
|
if (!u && d.match(/vimeo\.com\/([0-9]*)/) && (u = "vimeo"), !u && (d.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || d.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || d.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)) && (u = "youtube"), u === "local" || !u) {
|
|
649
649
|
u = "local";
|
|
650
|
-
let w = '<video id="' +
|
|
650
|
+
let w = '<video id="' + n + '" ';
|
|
651
651
|
w += `style="background:#000; max-width: ${e.width};" `, w += 'preload="metadata" ', w += 'x-webkit-airplay="allow" ', w += "playsinline ", w += "controls ", w += 'class="gvideo-local">', w += `<source src="${d}">`, w += "</video>", l = _e(w);
|
|
652
652
|
}
|
|
653
|
-
const h = l || _e(`<div id="${
|
|
654
|
-
H(a, `${u}-video gvideo`), a.appendChild(h), a.setAttribute("data-id",
|
|
655
|
-
const p = Z(this.settings.plyr, "config") ? this.settings.plyr.config : {}, b = new Plyr("#" +
|
|
653
|
+
const h = l || _e(`<div id="${n}" data-plyr-provider="${u}" data-plyr-embed-id="${d}"></div>`);
|
|
654
|
+
H(a, `${u}-video gvideo`), a.appendChild(h), a.setAttribute("data-id", n), a.setAttribute("data-index", t);
|
|
655
|
+
const p = Z(this.settings.plyr, "config") ? this.settings.plyr.config : {}, b = new Plyr("#" + n, p);
|
|
656
656
|
b.on("ready", (w) => {
|
|
657
|
-
o[
|
|
657
|
+
o[n] = w.detail.plyr, G(i) && i();
|
|
658
658
|
}), at(
|
|
659
659
|
() => c.querySelector("iframe") && c.querySelector("iframe").dataset.ready == "true",
|
|
660
660
|
() => {
|
|
@@ -668,15 +668,15 @@ function Dt(c) {
|
|
|
668
668
|
c.type === "enterfullscreen" && H(e, "fullscreen"), c.type === "exitfullscreen" && J(e, "fullscreen");
|
|
669
669
|
}
|
|
670
670
|
function Oi(c, e, t, i) {
|
|
671
|
-
const
|
|
671
|
+
const s = c.querySelector(".gslide-media"), n = Z(e, "href") && e.href ? e.href.split("#").pop().trim() : !1, r = Z(e, "content") && e.content ? e.content : !1;
|
|
672
672
|
let o;
|
|
673
673
|
if (r && (Ne(r) && (o = _e(`<div class="ginlined-content">${r}</div>`)), ge(r))) {
|
|
674
674
|
r.style.display == "none" && (r.style.display = "block");
|
|
675
675
|
const a = document.createElement("div");
|
|
676
676
|
a.className = "ginlined-content", a.appendChild(r), o = a;
|
|
677
677
|
}
|
|
678
|
-
if (
|
|
679
|
-
let a = document.getElementById(
|
|
678
|
+
if (n) {
|
|
679
|
+
let a = document.getElementById(n);
|
|
680
680
|
if (!a)
|
|
681
681
|
return !1;
|
|
682
682
|
const d = a.cloneNode(!0);
|
|
@@ -684,19 +684,19 @@ function Oi(c, e, t, i) {
|
|
|
684
684
|
}
|
|
685
685
|
if (!o)
|
|
686
686
|
return console.error("Unable to append inline slide content", e), !1;
|
|
687
|
-
|
|
688
|
-
onElement:
|
|
687
|
+
s.style.height = e.height, s.style.width = e.width, s.appendChild(o), this.events["inlineclose" + n] = oe("click", {
|
|
688
|
+
onElement: s.querySelectorAll(".gtrigger-close"),
|
|
689
689
|
withCallback: (a) => {
|
|
690
690
|
a.preventDefault(), this.close();
|
|
691
691
|
}
|
|
692
692
|
}), G(i) && i();
|
|
693
693
|
}
|
|
694
694
|
function $i(c, e, t, i) {
|
|
695
|
-
const
|
|
695
|
+
const s = c.querySelector(".gslide-media"), n = ki({
|
|
696
696
|
url: e.href,
|
|
697
697
|
callback: i
|
|
698
698
|
});
|
|
699
|
-
|
|
699
|
+
s.parentNode.style.maxWidth = e.width, s.parentNode.style.height = e.height, s.appendChild(n);
|
|
700
700
|
}
|
|
701
701
|
class Ni {
|
|
702
702
|
constructor(e = {}) {
|
|
@@ -735,12 +735,12 @@ class Ni {
|
|
|
735
735
|
let o = fe(i, e);
|
|
736
736
|
return this.setSize(o, t), o;
|
|
737
737
|
}
|
|
738
|
-
let
|
|
739
|
-
if (r === "a" && (
|
|
738
|
+
let s = "", n = e.getAttribute("data-glightbox"), r = e.nodeName.toLowerCase();
|
|
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
741
|
const d = e.dataset[a];
|
|
742
742
|
re(d) || (i[a] = this.sanitizeValue(d));
|
|
743
|
-
}), i.content && (i.type = "inline"), !i.type &&
|
|
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;
|
|
746
746
|
!re(o) && o !== "" && (i.title = o);
|
|
@@ -753,8 +753,8 @@ class Ni {
|
|
|
753
753
|
let o = [];
|
|
754
754
|
X(i, (a, d) => {
|
|
755
755
|
o.push(";\\s?" + d);
|
|
756
|
-
}), o = o.join("\\s?:|"),
|
|
757
|
-
const u =
|
|
756
|
+
}), o = o.join("\\s?:|"), n.trim() !== "" && X(i, (a, d) => {
|
|
757
|
+
const u = n, l = "s?" + d + "s?:s?(.*?)(" + o + "s?:|$)", h = new RegExp(l), p = u.match(h);
|
|
758
758
|
if (p && p.length && p[1]) {
|
|
759
759
|
const b = p[1].trim().replace(/;\s*$/, "");
|
|
760
760
|
i[d] = this.sanitizeValue(b);
|
|
@@ -787,8 +787,8 @@ class Ni {
|
|
|
787
787
|
* @return { object }
|
|
788
788
|
*/
|
|
789
789
|
setSize(e, t, i = null) {
|
|
790
|
-
const
|
|
791
|
-
return e.width = Z(e, "width") && e.width !== "" ? this.checkSize(e.width) :
|
|
790
|
+
const s = e.type == "video" ? this.checkSize(t.videosWidth) : this.checkSize(t.width), n = this.checkSize(t.height);
|
|
791
|
+
return e.width = Z(e, "width") && e.width !== "" ? this.checkSize(e.width) : s, e.height = Z(e, "height") && e.height !== "" ? this.checkSize(e.height) : n, i && e.type == "image" && (e._hasCustomWidth = !!i.dataset.width, e._hasCustomHeight = !!i.dataset.height), e;
|
|
792
792
|
}
|
|
793
793
|
/**
|
|
794
794
|
* [checkSize size
|
|
@@ -824,29 +824,29 @@ class ze {
|
|
|
824
824
|
setContent(e = null, t = !1) {
|
|
825
825
|
if (te(e, "loaded"))
|
|
826
826
|
return !1;
|
|
827
|
-
const i = this.instance.settings,
|
|
827
|
+
const i = this.instance.settings, s = this.slideConfig, n = bt();
|
|
828
828
|
G(i.beforeSlideLoad) && i.beforeSlideLoad({
|
|
829
829
|
index: this.index,
|
|
830
830
|
slide: e,
|
|
831
831
|
player: !1
|
|
832
832
|
});
|
|
833
|
-
let r =
|
|
833
|
+
let r = s.type, o = s.descPosition, a = e.querySelector(".gslide-media"), d = e.querySelector(".gslide-title"), u = e.querySelector(".gslide-desc"), l = e.querySelector(".gdesc-inner"), h = t, p = "gSlideTitle_" + this.index, b = "gSlideDesc_" + this.index;
|
|
834
834
|
if (G(i.afterSlideLoad) && (h = () => {
|
|
835
835
|
G(t) && t(), i.afterSlideLoad({
|
|
836
836
|
index: this.index,
|
|
837
837
|
slide: e,
|
|
838
838
|
player: this.instance.getSlidePlayerInstance(this.index)
|
|
839
839
|
});
|
|
840
|
-
}),
|
|
841
|
-
Ii.apply(this.instance, [e,
|
|
840
|
+
}), s.title == "" && s.description == "" ? l && l.parentNode.parentNode.removeChild(l.parentNode) : (d && s.title !== "" ? (d.id = p, d.innerHTML = s.title) : d.parentNode.removeChild(d), u && s.description !== "" ? (u.id = b, n && i.moreLength > 0 ? (s.smallDescription = this.slideShortDesc(s.description, i.moreLength, i.moreText), u.innerHTML = s.smallDescription, this.descriptionEvents(u, s)) : u.innerHTML = s.description) : u.parentNode.removeChild(u), H(a.parentNode, `desc-${o}`), H(l.parentNode, `description-${o}`)), H(a, `gslide-${r}`), H(e, "loaded"), r === "video") {
|
|
841
|
+
Ii.apply(this.instance, [e, s, this.index, h]);
|
|
842
842
|
return;
|
|
843
843
|
}
|
|
844
844
|
if (r === "external") {
|
|
845
|
-
$i.apply(this, [e,
|
|
845
|
+
$i.apply(this, [e, s, this.index, h]);
|
|
846
846
|
return;
|
|
847
847
|
}
|
|
848
848
|
if (r === "inline") {
|
|
849
|
-
Oi.apply(this.instance, [e,
|
|
849
|
+
Oi.apply(this.instance, [e, s, this.index, h]), s.draggable && new Nt({
|
|
850
850
|
dragEl: e.querySelector(".gslide-inline"),
|
|
851
851
|
toleranceX: i.dragToleranceX,
|
|
852
852
|
toleranceY: i.dragToleranceY,
|
|
@@ -856,15 +856,15 @@ class ze {
|
|
|
856
856
|
return;
|
|
857
857
|
}
|
|
858
858
|
if (r === "image") {
|
|
859
|
-
Pi(e,
|
|
859
|
+
Pi(e, s, this.index, () => {
|
|
860
860
|
const w = e.querySelector("img");
|
|
861
|
-
|
|
861
|
+
s.draggable && new Nt({
|
|
862
862
|
dragEl: w,
|
|
863
863
|
toleranceX: i.dragToleranceX,
|
|
864
864
|
toleranceY: i.dragToleranceY,
|
|
865
865
|
slide: e,
|
|
866
866
|
instance: this.instance
|
|
867
|
-
}),
|
|
867
|
+
}), s.zoomable && w.naturalWidth > w.offsetWidth && (H(w, "zoomable"), new qi(w, e, () => {
|
|
868
868
|
this.instance.resize();
|
|
869
869
|
})), G(h) && h();
|
|
870
870
|
});
|
|
@@ -873,13 +873,13 @@ class ze {
|
|
|
873
873
|
G(h) && h();
|
|
874
874
|
}
|
|
875
875
|
slideShortDesc(e, t = 50, i = !1) {
|
|
876
|
-
let
|
|
877
|
-
|
|
878
|
-
let
|
|
879
|
-
if (e =
|
|
876
|
+
let s = document.createElement("div");
|
|
877
|
+
s.innerHTML = e;
|
|
878
|
+
let n = s.innerText, r = i;
|
|
879
|
+
if (e = n.trim(), e.length <= t)
|
|
880
880
|
return e;
|
|
881
881
|
let o = e.substr(0, t - 1);
|
|
882
|
-
return r ? (
|
|
882
|
+
return r ? (s = null, o + '... <a href="#" class="desc-more">' + i + "</a>") : o;
|
|
883
883
|
}
|
|
884
884
|
descriptionEvents(e, t) {
|
|
885
885
|
let i = e.querySelector(".desc-more");
|
|
@@ -887,10 +887,10 @@ class ze {
|
|
|
887
887
|
return !1;
|
|
888
888
|
oe("click", {
|
|
889
889
|
onElement: i,
|
|
890
|
-
withCallback: (
|
|
891
|
-
|
|
890
|
+
withCallback: (s, n) => {
|
|
891
|
+
s.preventDefault();
|
|
892
892
|
const r = document.body;
|
|
893
|
-
let o = ue(
|
|
893
|
+
let o = ue(n, ".gslide-desc");
|
|
894
894
|
if (!o)
|
|
895
895
|
return !1;
|
|
896
896
|
o.innerHTML = t.description, H(r, "gdesc-open");
|
|
@@ -1056,12 +1056,12 @@ class Ut {
|
|
|
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
1058
|
Ge(i) || (i = 0), this.build(), Ce(this.overlay, this.settings.openEffect === "none" ? "none" : this.settings.cssEfects.fade.in);
|
|
1059
|
-
const
|
|
1060
|
-
if (
|
|
1059
|
+
const s = document.body, n = window.innerWidth - document.documentElement.clientWidth;
|
|
1060
|
+
if (n > 0) {
|
|
1061
1061
|
var r = document.createElement("style");
|
|
1062
|
-
r.type = "text/css", r.className = "gcss-styles", r.innerText = `.gscrollbar-fixer {margin-right: ${
|
|
1062
|
+
r.type = "text/css", r.className = "gcss-styles", r.innerText = `.gscrollbar-fixer {margin-right: ${n}px}`, document.head.appendChild(r), H(s, "gscrollbar-fixer");
|
|
1063
1063
|
}
|
|
1064
|
-
H(
|
|
1064
|
+
H(s, "glightbox-open"), H(ct, "glightbox-open"), Ht && (H(document.body, "glightbox-mobile"), this.settings.slideEffect = "slide"), this.showSlide(i, !0), this.elements.length === 1 ? (H(this.prevButton, "glightbox-button-hidden"), H(this.nextButton, "glightbox-button-hidden")) : (J(this.prevButton, "glightbox-button-hidden"), J(this.nextButton, "glightbox-button-hidden")), this.lightboxOpen = !0, this.trigger("open"), G(this.settings.onOpen) && this.settings.onOpen(), zt && this.settings.touchNavigation && Ai(this), this.settings.keyboardNavigation && Si(this);
|
|
1065
1065
|
}
|
|
1066
1066
|
/**
|
|
1067
1067
|
* Open at specific index
|
|
@@ -1077,26 +1077,26 @@ class Ut {
|
|
|
1077
1077
|
Pt(this.loader), this.index = parseInt(e);
|
|
1078
1078
|
let i = this.slidesContainer.querySelector(".current");
|
|
1079
1079
|
i && J(i, "current"), this.slideAnimateOut();
|
|
1080
|
-
let
|
|
1081
|
-
if (te(
|
|
1082
|
-
this.slideAnimateIn(
|
|
1080
|
+
let s = this.slidesContainer.querySelectorAll(".gslide")[e];
|
|
1081
|
+
if (te(s, "loaded"))
|
|
1082
|
+
this.slideAnimateIn(s, t), ot(this.loader);
|
|
1083
1083
|
else {
|
|
1084
1084
|
Pt(this.loader);
|
|
1085
|
-
const
|
|
1085
|
+
const n = this.elements[e], r = {
|
|
1086
1086
|
index: this.index,
|
|
1087
|
-
slide:
|
|
1087
|
+
slide: s,
|
|
1088
1088
|
//this will be removed in the future
|
|
1089
|
-
slideNode:
|
|
1090
|
-
slideConfig:
|
|
1089
|
+
slideNode: s,
|
|
1090
|
+
slideConfig: n.slideConfig,
|
|
1091
1091
|
slideIndex: this.index,
|
|
1092
|
-
trigger:
|
|
1092
|
+
trigger: n.node,
|
|
1093
1093
|
player: null
|
|
1094
1094
|
};
|
|
1095
|
-
this.trigger("slide_before_load", r),
|
|
1096
|
-
ot(this.loader), this.resize(), this.slideAnimateIn(
|
|
1095
|
+
this.trigger("slide_before_load", r), n.instance.setContent(s, () => {
|
|
1096
|
+
ot(this.loader), this.resize(), this.slideAnimateIn(s, t), this.trigger("slide_after_load", r);
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
|
-
this.slideDescription =
|
|
1099
|
+
this.slideDescription = s.querySelector(".gslide-description"), this.slideDescriptionContained = this.slideDescription && te(this.slideDescription.parentNode, "gslide-media"), this.settings.preload && (this.preloadSlide(e + 1), this.preloadSlide(e - 1)), this.updateNavigationClasses(), this.activeSlide = s;
|
|
1100
1100
|
}
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Preload slides
|
|
@@ -1109,7 +1109,7 @@ class Ut {
|
|
|
1109
1109
|
let t = this.slidesContainer.querySelectorAll(".gslide")[e];
|
|
1110
1110
|
if (te(t, "loaded"))
|
|
1111
1111
|
return !1;
|
|
1112
|
-
const i = this.elements[e],
|
|
1112
|
+
const i = this.elements[e], s = i.type, n = {
|
|
1113
1113
|
index: e,
|
|
1114
1114
|
slide: t,
|
|
1115
1115
|
//this will be removed in the future
|
|
@@ -1119,12 +1119,12 @@ class Ut {
|
|
|
1119
1119
|
trigger: i.node,
|
|
1120
1120
|
player: null
|
|
1121
1121
|
};
|
|
1122
|
-
this.trigger("slide_before_load",
|
|
1122
|
+
this.trigger("slide_before_load", n), s === "video" || s === "external" ? setTimeout(() => {
|
|
1123
1123
|
i.instance.setContent(t, () => {
|
|
1124
|
-
this.trigger("slide_after_load",
|
|
1124
|
+
this.trigger("slide_after_load", n);
|
|
1125
1125
|
});
|
|
1126
1126
|
}, 200) : i.instance.setContent(t, () => {
|
|
1127
|
-
this.trigger("slide_after_load",
|
|
1127
|
+
this.trigger("slide_after_load", n);
|
|
1128
1128
|
});
|
|
1129
1129
|
}
|
|
1130
1130
|
/**
|
|
@@ -1159,8 +1159,8 @@ class Ut {
|
|
|
1159
1159
|
*/
|
|
1160
1160
|
insertSlide(e = {}, t = -1) {
|
|
1161
1161
|
t < 0 && (t = this.elements.length);
|
|
1162
|
-
const i = new ze(e, this, t),
|
|
1163
|
-
|
|
1162
|
+
const i = new ze(e, this, t), s = i.getConfig(), n = fe({}, s), r = i.create(), o = this.elements.length - 1;
|
|
1163
|
+
n.index = t, n.node = !1, n.instance = i, n.slideConfig = s, this.elements.splice(t, 0, n);
|
|
1164
1164
|
let a = null, d = null;
|
|
1165
1165
|
if (this.slidesContainer) {
|
|
1166
1166
|
if (t > o)
|
|
@@ -1169,13 +1169,13 @@ class Ut {
|
|
|
1169
1169
|
let u = this.slidesContainer.querySelectorAll(".gslide")[t];
|
|
1170
1170
|
this.slidesContainer.insertBefore(r, u);
|
|
1171
1171
|
}
|
|
1172
|
-
(this.settings.preload && this.index == 0 && t == 0 || this.index - 1 == t || this.index + 1 == t) && this.preloadSlide(t), this.index === 0 && t === 0 && (this.index = 1), this.updateNavigationClasses(), a = this.slidesContainer.querySelectorAll(".gslide")[t], d = this.getSlidePlayerInstance(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], d = this.getSlidePlayerInstance(t), n.slideNode = a;
|
|
1173
1173
|
}
|
|
1174
1174
|
this.trigger("slide_inserted", {
|
|
1175
1175
|
index: t,
|
|
1176
1176
|
slide: a,
|
|
1177
1177
|
slideNode: a,
|
|
1178
|
-
slideConfig:
|
|
1178
|
+
slideConfig: s,
|
|
1179
1179
|
slideIndex: t,
|
|
1180
1180
|
trigger: null,
|
|
1181
1181
|
player: d
|
|
@@ -1201,7 +1201,7 @@ class Ut {
|
|
|
1201
1201
|
* @return {null}
|
|
1202
1202
|
*/
|
|
1203
1203
|
slideAnimateIn(e, t) {
|
|
1204
|
-
let i = e.querySelector(".gslide-media"),
|
|
1204
|
+
let i = e.querySelector(".gslide-media"), s = e.querySelector(".gslide-description"), n = {
|
|
1205
1205
|
index: this.prevActiveSlideIndex,
|
|
1206
1206
|
slide: this.prevActiveSlide,
|
|
1207
1207
|
//this will be removed in the future
|
|
@@ -1220,20 +1220,20 @@ class Ut {
|
|
|
1220
1220
|
trigger: this.elements[this.index].node,
|
|
1221
1221
|
player: this.getSlidePlayerInstance(this.index)
|
|
1222
1222
|
};
|
|
1223
|
-
if (i.offsetWidth > 0 &&
|
|
1223
|
+
if (i.offsetWidth > 0 && s && (ot(s), s.style.display = ""), J(e, this.effectsClasses), t)
|
|
1224
1224
|
Ce(e, this.settings.cssEfects[this.settings.openEffect].in, () => {
|
|
1225
1225
|
this.settings.autoplayVideos && this.slidePlayerPlay(e), this.trigger("slide_changed", {
|
|
1226
|
-
prev:
|
|
1226
|
+
prev: n,
|
|
1227
1227
|
current: r
|
|
1228
|
-
}), G(this.settings.afterSlideChange) && this.settings.afterSlideChange.apply(this, [
|
|
1228
|
+
}), G(this.settings.afterSlideChange) && this.settings.afterSlideChange.apply(this, [n, r]);
|
|
1229
1229
|
});
|
|
1230
1230
|
else {
|
|
1231
1231
|
let o = this.settings.slideEffect, a = o !== "none" ? this.settings.cssEfects[o].in : o;
|
|
1232
1232
|
this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (a = this.settings.cssEfects.slideBack.in), Ce(e, a, () => {
|
|
1233
1233
|
this.settings.autoplayVideos && this.slidePlayerPlay(e), this.trigger("slide_changed", {
|
|
1234
|
-
prev:
|
|
1234
|
+
prev: n,
|
|
1235
1235
|
current: r
|
|
1236
|
-
}), G(this.settings.afterSlideChange) && this.settings.afterSlideChange.apply(this, [
|
|
1236
|
+
}), G(this.settings.afterSlideChange) && this.settings.afterSlideChange.apply(this, [n, r]);
|
|
1237
1237
|
});
|
|
1238
1238
|
}
|
|
1239
1239
|
setTimeout(() => {
|
|
@@ -1284,8 +1284,8 @@ class Ut {
|
|
|
1284
1284
|
player: this.getSlidePlayerInstance(this.index)
|
|
1285
1285
|
}
|
|
1286
1286
|
]), this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (i = this.settings.cssEfects.slideBack.out), Ce(e, i, () => {
|
|
1287
|
-
let
|
|
1288
|
-
|
|
1287
|
+
let s = e.querySelector(".ginner-container"), n = e.querySelector(".gslide-media"), r = e.querySelector(".gslide-description");
|
|
1288
|
+
s.style.transform = "", n.style.transform = "", J(n, "greset"), n.style.opacity = "", r && (r.style.opacity = ""), J(e, "prev");
|
|
1289
1289
|
});
|
|
1290
1290
|
}
|
|
1291
1291
|
/**
|
|
@@ -1378,9 +1378,9 @@ class Ut {
|
|
|
1378
1378
|
setElements(e) {
|
|
1379
1379
|
this.settings.elements = !1;
|
|
1380
1380
|
const t = [];
|
|
1381
|
-
e && e.length && X(e, (i,
|
|
1382
|
-
const
|
|
1383
|
-
o.slideConfig = r, o.instance =
|
|
1381
|
+
e && e.length && X(e, (i, s) => {
|
|
1382
|
+
const n = new ze(i, this, s), r = n.getConfig(), o = fe({}, r);
|
|
1383
|
+
o.slideConfig = r, o.instance = n, o.index = s, t.push(o);
|
|
1384
1384
|
}), this.elements = t, this.lightboxOpen && (this.slidesContainer.innerHTML = "", this.elements.length && (X(this.elements, () => {
|
|
1385
1385
|
let i = _e(this.settings.slideHTML);
|
|
1386
1386
|
this.slidesContainer.appendChild(i);
|
|
@@ -1400,9 +1400,9 @@ class Ut {
|
|
|
1400
1400
|
*/
|
|
1401
1401
|
getElementIndex(e) {
|
|
1402
1402
|
let t = !1;
|
|
1403
|
-
return X(this.elements, (i,
|
|
1403
|
+
return X(this.elements, (i, s) => {
|
|
1404
1404
|
if (Z(i, "node") && i.node == e)
|
|
1405
|
-
return t =
|
|
1405
|
+
return t = s, !0;
|
|
1406
1406
|
}), t;
|
|
1407
1407
|
}
|
|
1408
1408
|
/**
|
|
@@ -1415,14 +1415,14 @@ class Ut {
|
|
|
1415
1415
|
*/
|
|
1416
1416
|
getElements() {
|
|
1417
1417
|
let e = [];
|
|
1418
|
-
this.elements = this.elements ? this.elements : [], !re(this.settings.elements) && ii(this.settings.elements) && this.settings.elements.length && X(this.settings.elements, (
|
|
1419
|
-
const r = new ze(
|
|
1420
|
-
a.node = !1, a.index =
|
|
1418
|
+
this.elements = this.elements ? this.elements : [], !re(this.settings.elements) && ii(this.settings.elements) && this.settings.elements.length && X(this.settings.elements, (s, n) => {
|
|
1419
|
+
const r = new ze(s, this, n), o = r.getConfig(), a = fe({}, o);
|
|
1420
|
+
a.node = !1, a.index = n, a.instance = r, a.slideConfig = o, e.push(a);
|
|
1421
1421
|
});
|
|
1422
1422
|
let t = !1;
|
|
1423
|
-
return this.getSelector() && (t = document.querySelectorAll(this.getSelector())), t && X(t, (
|
|
1424
|
-
const r = new ze(
|
|
1425
|
-
a.node =
|
|
1423
|
+
return this.getSelector() && (t = document.querySelectorAll(this.getSelector())), t && X(t, (s, n) => {
|
|
1424
|
+
const r = new ze(s, this, n), o = r.getConfig(), a = fe({}, o);
|
|
1425
|
+
a.node = s, a.index = n, a.instance = r, a.slideConfig = o, a.gallery = s.getAttribute("data-gallery"), e.push(a);
|
|
1426
1426
|
}), e;
|
|
1427
1427
|
}
|
|
1428
1428
|
/**
|
|
@@ -1476,9 +1476,9 @@ class Ut {
|
|
|
1476
1476
|
X(e, (d) => {
|
|
1477
1477
|
d.parentNode == document.body && d.nodeName.charAt(0) !== "#" && d.hasAttribute && !d.hasAttribute("aria-hidden") && (t.push(d), d.setAttribute("aria-hidden", "true"));
|
|
1478
1478
|
});
|
|
1479
|
-
const i = Z(this.settings.svg, "next") ? this.settings.svg.next : "",
|
|
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;
|
|
1481
|
-
r = r.replace(/{nextSVG}/g, i), r = r.replace(/{prevSVG}/g,
|
|
1481
|
+
r = r.replace(/{nextSVG}/g, i), r = r.replace(/{prevSVG}/g, s), r = r.replace(/{closeSVG}/g, n), r = _e(r), document.body.appendChild(r);
|
|
1482
1482
|
const o = document.getElementById("glightbox-body");
|
|
1483
1483
|
this.modal = o;
|
|
1484
1484
|
let a = o.querySelector(".gclose");
|
|
@@ -1522,18 +1522,18 @@ class Ut {
|
|
|
1522
1522
|
resize(e = null) {
|
|
1523
1523
|
if (e = e || this.activeSlide, !e || te(e, "zoomed"))
|
|
1524
1524
|
return;
|
|
1525
|
-
const t = ti(), i = e.querySelector(".gvideo-wrapper"),
|
|
1525
|
+
const t = ti(), i = e.querySelector(".gvideo-wrapper"), s = e.querySelector(".gslide-image"), n = this.slideDescription;
|
|
1526
1526
|
let r = t.width, o = t.height;
|
|
1527
|
-
if (r <= 768 ? H(document.body, "glightbox-mobile") : J(document.body, "glightbox-mobile"), !i && !
|
|
1527
|
+
if (r <= 768 ? H(document.body, "glightbox-mobile") : J(document.body, "glightbox-mobile"), !i && !s)
|
|
1528
1528
|
return;
|
|
1529
1529
|
let a = !1;
|
|
1530
|
-
if (
|
|
1530
|
+
if (n && (te(n, "description-bottom") || te(n, "description-top")) && !te(n, "gabsolute") && (a = !0), s) {
|
|
1531
1531
|
if (r <= 768)
|
|
1532
|
-
|
|
1532
|
+
s.querySelector("img");
|
|
1533
1533
|
else if (a) {
|
|
1534
|
-
let d =
|
|
1534
|
+
let d = n.offsetHeight, u = s.querySelector("img");
|
|
1535
1535
|
const h = this.elements[this.index].node.getAttribute("data-height") ?? "100vh";
|
|
1536
|
-
u.setAttribute("style", `max-height: calc(${h} - ${d}px)`),
|
|
1536
|
+
u.setAttribute("style", `max-height: calc(${h} - ${d}px)`), n.setAttribute("style", `max-width: ${u.offsetWidth}px;`);
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
|
1539
1539
|
if (i) {
|
|
@@ -1545,11 +1545,11 @@ class Ut {
|
|
|
1545
1545
|
let u = d.split(":"), l = this.settings.videosWidth, h = this.settings.videosWidth;
|
|
1546
1546
|
Ge(l) || l.indexOf("px") !== -1 ? h = parseInt(l) : l.indexOf("vw") !== -1 ? h = r * parseInt(l) / 100 : l.indexOf("vh") !== -1 ? h = o * parseInt(l) / 100 : l.indexOf("%") !== -1 ? h = r * parseInt(l) / 100 : h = parseInt(i.clientWidth);
|
|
1547
1547
|
let p = h / (parseInt(u[0]) / parseInt(u[1]));
|
|
1548
|
-
if (p = Math.floor(p), a && (o = o -
|
|
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
|
-
i.parentNode.setAttribute("style", `max-width: ${g.width}px`), a &&
|
|
1550
|
+
i.parentNode.setAttribute("style", `max-width: ${g.width}px`), a && n.setAttribute("style", `max-width: ${g.width}px;`);
|
|
1551
1551
|
} else
|
|
1552
|
-
i.parentNode.style.maxWidth = `${l}`, a &&
|
|
1552
|
+
i.parentNode.style.maxWidth = `${l}`, a && n.setAttribute("style", `max-width: ${l};`);
|
|
1553
1553
|
}
|
|
1554
1554
|
}
|
|
1555
1555
|
/**
|
|
@@ -1632,10 +1632,10 @@ class Ut {
|
|
|
1632
1632
|
*/
|
|
1633
1633
|
trigger(e, t = null) {
|
|
1634
1634
|
const i = [];
|
|
1635
|
-
X(this.apiEvents, (
|
|
1636
|
-
const { evt: r, once: o, callback: a } =
|
|
1637
|
-
r == e && (a(t), o && i.push(
|
|
1638
|
-
}), i.length && X(i, (
|
|
1635
|
+
X(this.apiEvents, (s, n) => {
|
|
1636
|
+
const { evt: r, once: o, callback: a } = s;
|
|
1637
|
+
r == e && (a(t), o && i.push(n));
|
|
1638
|
+
}), i.length && X(i, (s) => this.apiEvents.splice(s, 1));
|
|
1639
1639
|
}
|
|
1640
1640
|
/**
|
|
1641
1641
|
* Removes all events
|
|
@@ -1660,8 +1660,8 @@ function jt(c, e) {
|
|
|
1660
1660
|
var t = Object.keys(c);
|
|
1661
1661
|
if (Object.getOwnPropertySymbols) {
|
|
1662
1662
|
var i = Object.getOwnPropertySymbols(c);
|
|
1663
|
-
e && (i = i.filter(function(
|
|
1664
|
-
return Object.getOwnPropertyDescriptor(c,
|
|
1663
|
+
e && (i = i.filter(function(s) {
|
|
1664
|
+
return Object.getOwnPropertyDescriptor(c, s).enumerable;
|
|
1665
1665
|
})), t.push.apply(t, i);
|
|
1666
1666
|
}
|
|
1667
1667
|
return t;
|
|
@@ -1723,8 +1723,8 @@ function Re(c) {
|
|
|
1723
1723
|
}, Re(c);
|
|
1724
1724
|
}
|
|
1725
1725
|
function ut(c, e) {
|
|
1726
|
-
return ut = Object.setPrototypeOf || function(i,
|
|
1727
|
-
return i.__proto__ =
|
|
1726
|
+
return ut = Object.setPrototypeOf || function(i, s) {
|
|
1727
|
+
return i.__proto__ = s, i;
|
|
1728
1728
|
}, ut(c, e);
|
|
1729
1729
|
}
|
|
1730
1730
|
function ji() {
|
|
@@ -1752,13 +1752,13 @@ function Fi(c, e) {
|
|
|
1752
1752
|
function Gi(c) {
|
|
1753
1753
|
var e = ji();
|
|
1754
1754
|
return function() {
|
|
1755
|
-
var i = Re(c),
|
|
1755
|
+
var i = Re(c), s;
|
|
1756
1756
|
if (e) {
|
|
1757
|
-
var
|
|
1758
|
-
|
|
1757
|
+
var n = Re(this).constructor;
|
|
1758
|
+
s = Reflect.construct(i, arguments, n);
|
|
1759
1759
|
} else
|
|
1760
|
-
|
|
1761
|
-
return Fi(this,
|
|
1760
|
+
s = i.apply(this, arguments);
|
|
1761
|
+
return Fi(this, s);
|
|
1762
1762
|
};
|
|
1763
1763
|
}
|
|
1764
1764
|
function Wi(c, e) {
|
|
@@ -1768,10 +1768,10 @@ function Wi(c, e) {
|
|
|
1768
1768
|
}
|
|
1769
1769
|
function Ve() {
|
|
1770
1770
|
return typeof Reflect < "u" && Reflect.get ? Ve = Reflect.get : Ve = function(e, t, i) {
|
|
1771
|
-
var
|
|
1772
|
-
if (
|
|
1773
|
-
var
|
|
1774
|
-
return
|
|
1771
|
+
var s = Wi(e, t);
|
|
1772
|
+
if (s) {
|
|
1773
|
+
var n = Object.getOwnPropertyDescriptor(s, t);
|
|
1774
|
+
return n.get ? n.get.call(arguments.length < 3 ? e : i) : n.value;
|
|
1775
1775
|
}
|
|
1776
1776
|
}, Ve.apply(this, arguments);
|
|
1777
1777
|
}
|
|
@@ -2006,10 +2006,10 @@ function ht(c) {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
function Xi(c, e, t) {
|
|
2008
2008
|
var i = {};
|
|
2009
|
-
for (var
|
|
2010
|
-
Je(e[
|
|
2011
|
-
for (var
|
|
2012
|
-
Je(i[
|
|
2009
|
+
for (var s in e)
|
|
2010
|
+
Je(e[s]) ? i[s] = e[s](c, i, t) : me("Extension must be a function");
|
|
2011
|
+
for (var n in i)
|
|
2012
|
+
Je(i[n].mount) && i[n].mount();
|
|
2013
2013
|
return i;
|
|
2014
2014
|
}
|
|
2015
2015
|
function W(c, e, t) {
|
|
@@ -2025,8 +2025,8 @@ function pt(c, e) {
|
|
|
2025
2025
|
if (e.hasOwnProperty("classes")) {
|
|
2026
2026
|
t.classes = Object.assign({}, c.classes, e.classes);
|
|
2027
2027
|
var i = ["direction", "type", "slide", "arrow", "nav"];
|
|
2028
|
-
i.forEach(function(
|
|
2029
|
-
e.classes.hasOwnProperty(
|
|
2028
|
+
i.forEach(function(s) {
|
|
2029
|
+
e.classes.hasOwnProperty(s) && (t.classes[s] = Bt(Bt({}, 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;
|
|
@@ -2040,15 +2040,15 @@ var Zi = /* @__PURE__ */ (function() {
|
|
|
2040
2040
|
key: "on",
|
|
2041
2041
|
value: function(t, i) {
|
|
2042
2042
|
if (ht(t)) {
|
|
2043
|
-
for (var
|
|
2044
|
-
this.on(t[
|
|
2043
|
+
for (var s = 0; s < t.length; s++)
|
|
2044
|
+
this.on(t[s], i);
|
|
2045
2045
|
return;
|
|
2046
2046
|
}
|
|
2047
2047
|
this.hop.call(this.events, t) || (this.events[t] = []);
|
|
2048
|
-
var
|
|
2048
|
+
var n = this.events[t].push(i) - 1;
|
|
2049
2049
|
return {
|
|
2050
2050
|
remove: function() {
|
|
2051
|
-
delete this.events[t][
|
|
2051
|
+
delete this.events[t][n];
|
|
2052
2052
|
}
|
|
2053
2053
|
};
|
|
2054
2054
|
}
|
|
@@ -2062,12 +2062,12 @@ var Zi = /* @__PURE__ */ (function() {
|
|
|
2062
2062
|
key: "emit",
|
|
2063
2063
|
value: function(t, i) {
|
|
2064
2064
|
if (ht(t)) {
|
|
2065
|
-
for (var
|
|
2066
|
-
this.emit(t[
|
|
2065
|
+
for (var s = 0; s < t.length; s++)
|
|
2066
|
+
this.emit(t[s], i);
|
|
2067
2067
|
return;
|
|
2068
2068
|
}
|
|
2069
|
-
this.hop.call(this.events, t) && this.events[t].forEach(function(
|
|
2070
|
-
|
|
2069
|
+
this.hop.call(this.events, t) && this.events[t].forEach(function(n) {
|
|
2070
|
+
n(i || {});
|
|
2071
2071
|
});
|
|
2072
2072
|
}
|
|
2073
2073
|
}]), c;
|
|
@@ -2306,8 +2306,8 @@ function Ki(c, e, t) {
|
|
|
2306
2306
|
return;
|
|
2307
2307
|
}
|
|
2308
2308
|
if (h === "|" && (p = c.settings.perView || 1), h === ">" || h === "|" && l === ">") {
|
|
2309
|
-
var b =
|
|
2310
|
-
b > u && (this._o = !0), c.index =
|
|
2309
|
+
var b = s(p);
|
|
2310
|
+
b > u && (this._o = !0), c.index = n(b, p);
|
|
2311
2311
|
return;
|
|
2312
2312
|
}
|
|
2313
2313
|
if (h === "<" || h === "|" && l === "<") {
|
|
@@ -2352,11 +2352,11 @@ function Ki(c, e, t) {
|
|
|
2352
2352
|
return c.isType("slider") && c.settings.focusAt !== "center" && c.settings.bound;
|
|
2353
2353
|
}
|
|
2354
2354
|
};
|
|
2355
|
-
function
|
|
2355
|
+
function s(a) {
|
|
2356
2356
|
var d = c.index;
|
|
2357
2357
|
return c.isType("carousel") ? d + a : d + (a - d % a);
|
|
2358
2358
|
}
|
|
2359
|
-
function
|
|
2359
|
+
function n(a, d) {
|
|
2360
2360
|
var u = i.length;
|
|
2361
2361
|
return a <= u ? a : c.isType("carousel") ? a - (u + 1) : c.settings.rewind ? i.isBound() && !i.isEnd() ? u : 0 : i.isBound() ? u : Math.floor(u / d) * d;
|
|
2362
2362
|
}
|
|
@@ -2418,16 +2418,16 @@ function Ft() {
|
|
|
2418
2418
|
return (/* @__PURE__ */ new Date()).getTime();
|
|
2419
2419
|
}
|
|
2420
2420
|
function it(c, e) {
|
|
2421
|
-
var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i,
|
|
2422
|
-
o = t.leading === !1 ? 0 : Ft(), i = null, r = c.apply(
|
|
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 : Ft(), i = null, r = c.apply(s, n), i || (s = n = null);
|
|
2423
2423
|
}, d = function() {
|
|
2424
2424
|
var l = Ft();
|
|
2425
2425
|
!o && t.leading === !1 && (o = l);
|
|
2426
2426
|
var h = e - (l - o);
|
|
2427
|
-
return
|
|
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
2429
|
return d.cancel = function() {
|
|
2430
|
-
clearTimeout(i), o = 0, i =
|
|
2430
|
+
clearTimeout(i), o = 0, i = s = n = null;
|
|
2431
2431
|
}, d;
|
|
2432
2432
|
}
|
|
2433
2433
|
var Ue = {
|
|
@@ -2443,10 +2443,10 @@ function es(c, e, t) {
|
|
|
2443
2443
|
* @param {HTMLCollection} slides
|
|
2444
2444
|
* @return {Void}
|
|
2445
2445
|
*/
|
|
2446
|
-
apply: function(
|
|
2447
|
-
for (var r = 0, o =
|
|
2448
|
-
var a =
|
|
2449
|
-
r !== 0 ? a[Ue[d][0]] = "".concat(this.value / 2, "px") : a[Ue[d][0]] = "", r !==
|
|
2446
|
+
apply: function(n) {
|
|
2447
|
+
for (var r = 0, o = n.length; r < o; r++) {
|
|
2448
|
+
var a = n[r].style, d = e.Direction.value;
|
|
2449
|
+
r !== 0 ? a[Ue[d][0]] = "".concat(this.value / 2, "px") : a[Ue[d][0]] = "", r !== n.length - 1 ? a[Ue[d][1]] = "".concat(this.value / 2, "px") : a[Ue[d][1]] = "";
|
|
2450
2450
|
}
|
|
2451
2451
|
},
|
|
2452
2452
|
/**
|
|
@@ -2455,9 +2455,9 @@ function es(c, e, t) {
|
|
|
2455
2455
|
* @param {HTMLCollection} slides
|
|
2456
2456
|
* @returns {Void}
|
|
2457
2457
|
*/
|
|
2458
|
-
remove: function(
|
|
2459
|
-
for (var r = 0, o =
|
|
2460
|
-
var a =
|
|
2458
|
+
remove: function(n) {
|
|
2459
|
+
for (var r = 0, o = n.length; r < o; r++) {
|
|
2460
|
+
var a = n[r].style;
|
|
2461
2461
|
a.marginLeft = "", a.marginRight = "";
|
|
2462
2462
|
}
|
|
2463
2463
|
}
|
|
@@ -2489,8 +2489,8 @@ function es(c, e, t) {
|
|
|
2489
2489
|
* @returns {Number}
|
|
2490
2490
|
*/
|
|
2491
2491
|
get: function() {
|
|
2492
|
-
var
|
|
2493
|
-
return i.value * (
|
|
2492
|
+
var n = c.settings.perView;
|
|
2493
|
+
return i.value * (n - 1) / n;
|
|
2494
2494
|
}
|
|
2495
2495
|
}), t.on(["build.after", "update"], it(function() {
|
|
2496
2496
|
i.apply(e.Html.wrapper.children);
|
|
@@ -2524,8 +2524,8 @@ function is(c, e, t) {
|
|
|
2524
2524
|
* Collect slides
|
|
2525
2525
|
*/
|
|
2526
2526
|
collectSlides: function() {
|
|
2527
|
-
this.slides = ft(this.wrapper.children).filter(function(
|
|
2528
|
-
return !
|
|
2527
|
+
this.slides = ft(this.wrapper.children).filter(function(n) {
|
|
2528
|
+
return !n.classList.contains(c.settings.classes.slide.clone);
|
|
2529
2529
|
});
|
|
2530
2530
|
}
|
|
2531
2531
|
};
|
|
@@ -2543,8 +2543,8 @@ function is(c, e, t) {
|
|
|
2543
2543
|
*
|
|
2544
2544
|
* @return {Object}
|
|
2545
2545
|
*/
|
|
2546
|
-
set: function(
|
|
2547
|
-
dt(
|
|
2546
|
+
set: function(n) {
|
|
2547
|
+
dt(n) && (n = document.querySelector(n)), n !== null ? i._r = n : me("Root element must be a existing Html node");
|
|
2548
2548
|
}
|
|
2549
2549
|
}), W(i, "track", {
|
|
2550
2550
|
/**
|
|
@@ -2560,8 +2560,8 @@ function is(c, e, t) {
|
|
|
2560
2560
|
*
|
|
2561
2561
|
* @return {Object}
|
|
2562
2562
|
*/
|
|
2563
|
-
set: function(
|
|
2564
|
-
i._t =
|
|
2563
|
+
set: function(n) {
|
|
2564
|
+
i._t = n;
|
|
2565
2565
|
}
|
|
2566
2566
|
}), W(i, "wrapper", {
|
|
2567
2567
|
/**
|
|
@@ -2602,8 +2602,8 @@ function ss(c, e, t) {
|
|
|
2602
2602
|
* @param {Number|Object} value
|
|
2603
2603
|
* @return {Void}
|
|
2604
2604
|
*/
|
|
2605
|
-
set: function(
|
|
2606
|
-
Me(
|
|
2605
|
+
set: function(n) {
|
|
2606
|
+
Me(n) ? (n.before = Q(n.before), n.after = Q(n.after)) : n = Q(n), i._v = n;
|
|
2607
2607
|
}
|
|
2608
2608
|
}), W(i, "reductor", {
|
|
2609
2609
|
/**
|
|
@@ -2612,8 +2612,8 @@ function ss(c, e, t) {
|
|
|
2612
2612
|
* @returns {Number}
|
|
2613
2613
|
*/
|
|
2614
2614
|
get: function() {
|
|
2615
|
-
var
|
|
2616
|
-
return Me(
|
|
2615
|
+
var n = i.value, r = c.settings.perView;
|
|
2616
|
+
return Me(n) ? n.before / r + n.after / r : n * 2 / r;
|
|
2617
2617
|
}
|
|
2618
2618
|
}), t.on(["resize", "update"], function() {
|
|
2619
2619
|
i.mount();
|
|
@@ -2636,12 +2636,12 @@ function ns(c, e, t) {
|
|
|
2636
2636
|
* @return {Void}
|
|
2637
2637
|
*/
|
|
2638
2638
|
make: function() {
|
|
2639
|
-
var
|
|
2639
|
+
var n = this, r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
2640
2640
|
this.offset = r, t.emit("move", {
|
|
2641
2641
|
movement: this.value
|
|
2642
2642
|
}), e.Transition.after(function() {
|
|
2643
2643
|
t.emit("move.after", {
|
|
2644
|
-
movement:
|
|
2644
|
+
movement: n.value
|
|
2645
2645
|
});
|
|
2646
2646
|
});
|
|
2647
2647
|
}
|
|
@@ -2660,8 +2660,8 @@ function ns(c, e, t) {
|
|
|
2660
2660
|
*
|
|
2661
2661
|
* @return {Object}
|
|
2662
2662
|
*/
|
|
2663
|
-
set: function(
|
|
2664
|
-
i._o = ni(
|
|
2663
|
+
set: function(n) {
|
|
2664
|
+
i._o = ni(n) ? 0 : Q(n);
|
|
2665
2665
|
}
|
|
2666
2666
|
}), W(i, "translate", {
|
|
2667
2667
|
/**
|
|
@@ -2679,8 +2679,8 @@ function ns(c, e, t) {
|
|
|
2679
2679
|
* @return {Number}
|
|
2680
2680
|
*/
|
|
2681
2681
|
get: function() {
|
|
2682
|
-
var
|
|
2683
|
-
return e.Direction.is("rtl") ? r +
|
|
2682
|
+
var n = this.offset, r = this.translate;
|
|
2683
|
+
return e.Direction.is("rtl") ? r + n : r - n;
|
|
2684
2684
|
}
|
|
2685
2685
|
}), t.on(["build.before", "run"], function() {
|
|
2686
2686
|
i.make();
|
|
@@ -2694,8 +2694,8 @@ function rs(c, e, t) {
|
|
|
2694
2694
|
* @return {Void}
|
|
2695
2695
|
*/
|
|
2696
2696
|
setupSlides: function() {
|
|
2697
|
-
for (var
|
|
2698
|
-
r[o].style.width =
|
|
2697
|
+
for (var n = "".concat(this.slideWidth, "px"), r = e.Html.slides, o = 0; o < r.length; o++)
|
|
2698
|
+
r[o].style.width = n;
|
|
2699
2699
|
},
|
|
2700
2700
|
/**
|
|
2701
2701
|
* Setups dimensions of slides wrapper.
|
|
@@ -2711,8 +2711,8 @@ function rs(c, e, t) {
|
|
|
2711
2711
|
* @returns {Void}
|
|
2712
2712
|
*/
|
|
2713
2713
|
remove: function() {
|
|
2714
|
-
for (var
|
|
2715
|
-
|
|
2714
|
+
for (var n = e.Html.slides, r = 0; r < n.length; r++)
|
|
2715
|
+
n[r].style.width = "";
|
|
2716
2716
|
e.Html.wrapper.style.width = "";
|
|
2717
2717
|
}
|
|
2718
2718
|
};
|
|
@@ -2783,9 +2783,9 @@ function os(c, e, t) {
|
|
|
2783
2783
|
* @return {Void}
|
|
2784
2784
|
*/
|
|
2785
2785
|
activeClass: function() {
|
|
2786
|
-
var
|
|
2787
|
-
r && (r.classList.add(
|
|
2788
|
-
o.classList.remove(
|
|
2786
|
+
var n = c.settings.classes, r = e.Html.slides[c.index];
|
|
2787
|
+
r && (r.classList.add(n.slide.active), ri(r).forEach(function(o) {
|
|
2788
|
+
o.classList.remove(n.slide.active);
|
|
2789
2789
|
}));
|
|
2790
2790
|
},
|
|
2791
2791
|
/**
|
|
@@ -2794,7 +2794,7 @@ function os(c, e, t) {
|
|
|
2794
2794
|
* @return {Void}
|
|
2795
2795
|
*/
|
|
2796
2796
|
removeClasses: function() {
|
|
2797
|
-
var
|
|
2797
|
+
var n = c.settings.classes, r = n.type, o = n.slide;
|
|
2798
2798
|
e.Html.root.classList.remove(r[c.settings.type]), e.Html.slides.forEach(function(a) {
|
|
2799
2799
|
a.classList.remove(o.active);
|
|
2800
2800
|
});
|
|
@@ -2822,19 +2822,19 @@ function ls(c, e, t) {
|
|
|
2822
2822
|
* @return {[]}
|
|
2823
2823
|
*/
|
|
2824
2824
|
collect: function() {
|
|
2825
|
-
var
|
|
2825
|
+
var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], r = e.Html.slides, o = c.settings, a = o.perView, d = o.classes, u = o.cloningRatio;
|
|
2826
2826
|
if (r.length > 0)
|
|
2827
2827
|
for (var l = +!!c.settings.peek, h = a + l + Math.round(a / 2), p = r.slice(0, h).reverse(), b = r.slice(h * -1), w = 0; w < Math.max(u, Math.floor(a / r.length)); w++) {
|
|
2828
2828
|
for (var _ = 0; _ < p.length; _++) {
|
|
2829
2829
|
var g = p[_].cloneNode(!0);
|
|
2830
|
-
g.classList.add(d.slide.clone),
|
|
2830
|
+
g.classList.add(d.slide.clone), n.push(g);
|
|
2831
2831
|
}
|
|
2832
2832
|
for (var v = 0; v < b.length; v++) {
|
|
2833
2833
|
var f = b[v].cloneNode(!0);
|
|
2834
|
-
f.classList.add(d.slide.clone),
|
|
2834
|
+
f.classList.add(d.slide.clone), n.unshift(f);
|
|
2835
2835
|
}
|
|
2836
2836
|
}
|
|
2837
|
-
return
|
|
2837
|
+
return n;
|
|
2838
2838
|
},
|
|
2839
2839
|
/**
|
|
2840
2840
|
* Append cloned slides with generated pattern.
|
|
@@ -2842,12 +2842,12 @@ function ls(c, e, t) {
|
|
|
2842
2842
|
* @return {Void}
|
|
2843
2843
|
*/
|
|
2844
2844
|
append: function() {
|
|
2845
|
-
for (var
|
|
2845
|
+
for (var n = this.items, r = e.Html, o = r.wrapper, a = r.slides, d = Math.floor(n.length / 2), u = n.slice(0, d).reverse(), l = n.slice(d * -1).reverse(), h = "".concat(e.Sizes.slideWidth, "px"), p = 0; p < l.length; p++)
|
|
2846
2846
|
o.appendChild(l[p]);
|
|
2847
2847
|
for (var b = 0; b < u.length; b++)
|
|
2848
2848
|
o.insertBefore(u[b], a[0]);
|
|
2849
|
-
for (var w = 0; w <
|
|
2850
|
-
|
|
2849
|
+
for (var w = 0; w < n.length; w++)
|
|
2850
|
+
n[w].style.width = h;
|
|
2851
2851
|
},
|
|
2852
2852
|
/**
|
|
2853
2853
|
* Remove all cloned slides.
|
|
@@ -2855,8 +2855,8 @@ function ls(c, e, t) {
|
|
|
2855
2855
|
* @return {Void}
|
|
2856
2856
|
*/
|
|
2857
2857
|
remove: function() {
|
|
2858
|
-
for (var
|
|
2859
|
-
e.Html.wrapper.removeChild(
|
|
2858
|
+
for (var n = this.items, r = 0; r < n.length; r++)
|
|
2859
|
+
e.Html.wrapper.removeChild(n[r]);
|
|
2860
2860
|
}
|
|
2861
2861
|
};
|
|
2862
2862
|
return W(i, "grow", {
|
|
@@ -2883,11 +2883,11 @@ var we = /* @__PURE__ */ (function() {
|
|
|
2883
2883
|
}
|
|
2884
2884
|
return tt(c, [{
|
|
2885
2885
|
key: "on",
|
|
2886
|
-
value: function(t, i,
|
|
2887
|
-
var
|
|
2886
|
+
value: function(t, i, s) {
|
|
2887
|
+
var n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
|
|
2888
2888
|
dt(t) && (t = [t]);
|
|
2889
2889
|
for (var r = 0; r < t.length; r++)
|
|
2890
|
-
this.listeners[t[r]] =
|
|
2890
|
+
this.listeners[t[r]] = s, i.addEventListener(t[r], this.listeners[t[r]], n);
|
|
2891
2891
|
}
|
|
2892
2892
|
/**
|
|
2893
2893
|
* Removes event listeners from arrows HTML elements.
|
|
@@ -2900,10 +2900,10 @@ var we = /* @__PURE__ */ (function() {
|
|
|
2900
2900
|
}, {
|
|
2901
2901
|
key: "off",
|
|
2902
2902
|
value: function(t, i) {
|
|
2903
|
-
var
|
|
2903
|
+
var s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
|
|
2904
2904
|
dt(t) && (t = [t]);
|
|
2905
|
-
for (var
|
|
2906
|
-
i.removeEventListener(t[
|
|
2905
|
+
for (var n = 0; n < t.length; n++)
|
|
2906
|
+
i.removeEventListener(t[n], this.listeners[t[n]], s);
|
|
2907
2907
|
}
|
|
2908
2908
|
/**
|
|
2909
2909
|
* Destroy collected listeners.
|
|
@@ -2918,7 +2918,7 @@ var we = /* @__PURE__ */ (function() {
|
|
|
2918
2918
|
}]), c;
|
|
2919
2919
|
})();
|
|
2920
2920
|
function as(c, e, t) {
|
|
2921
|
-
var i = new we(),
|
|
2921
|
+
var i = new we(), s = {
|
|
2922
2922
|
/**
|
|
2923
2923
|
* Initializes window bindings.
|
|
2924
2924
|
*/
|
|
@@ -2946,8 +2946,8 @@ function as(c, e, t) {
|
|
|
2946
2946
|
}
|
|
2947
2947
|
};
|
|
2948
2948
|
return t.on("destroy", function() {
|
|
2949
|
-
|
|
2950
|
-
}),
|
|
2949
|
+
s.unbind(), i.destroy();
|
|
2950
|
+
}), s;
|
|
2951
2951
|
}
|
|
2952
2952
|
var cs = ["ltr", "rtl"], us = {
|
|
2953
2953
|
">": "<",
|
|
@@ -2970,9 +2970,9 @@ function ds(c, e, t) {
|
|
|
2970
2970
|
* @param {String} pattern
|
|
2971
2971
|
* @returns {String}
|
|
2972
2972
|
*/
|
|
2973
|
-
resolve: function(
|
|
2974
|
-
var r =
|
|
2975
|
-
return this.is("rtl") ?
|
|
2973
|
+
resolve: function(n) {
|
|
2974
|
+
var r = n.slice(0, 1);
|
|
2975
|
+
return this.is("rtl") ? n.split(r).join(us[r]) : n;
|
|
2976
2976
|
},
|
|
2977
2977
|
/**
|
|
2978
2978
|
* Checks value of direction mode.
|
|
@@ -2980,8 +2980,8 @@ function ds(c, e, t) {
|
|
|
2980
2980
|
* @param {String} direction
|
|
2981
2981
|
* @returns {Boolean}
|
|
2982
2982
|
*/
|
|
2983
|
-
is: function(
|
|
2984
|
-
return this.value ===
|
|
2983
|
+
is: function(n) {
|
|
2984
|
+
return this.value === n;
|
|
2985
2985
|
},
|
|
2986
2986
|
/**
|
|
2987
2987
|
* Applies direction class to the root HTML element.
|
|
@@ -3015,8 +3015,8 @@ function ds(c, e, t) {
|
|
|
3015
3015
|
* @param {String} value
|
|
3016
3016
|
* @return {Void}
|
|
3017
3017
|
*/
|
|
3018
|
-
set: function(
|
|
3019
|
-
cs.indexOf(
|
|
3018
|
+
set: function(n) {
|
|
3019
|
+
cs.indexOf(n) > -1 ? i._v = n : me("Direction value must be `ltr` or `rtl`");
|
|
3020
3020
|
}
|
|
3021
3021
|
}), t.on(["destroy", "update"], function() {
|
|
3022
3022
|
i.removeClass();
|
|
@@ -3048,8 +3048,8 @@ function ps(c, e) {
|
|
|
3048
3048
|
* @return {Number}
|
|
3049
3049
|
*/
|
|
3050
3050
|
modify: function(i) {
|
|
3051
|
-
var
|
|
3052
|
-
return i + e.Gaps.value *
|
|
3051
|
+
var s = Math.floor(i / e.Sizes.slideWidth);
|
|
3052
|
+
return i + e.Gaps.value * s;
|
|
3053
3053
|
}
|
|
3054
3054
|
};
|
|
3055
3055
|
}
|
|
@@ -3076,8 +3076,8 @@ function gs(c, e) {
|
|
|
3076
3076
|
*/
|
|
3077
3077
|
modify: function(i) {
|
|
3078
3078
|
if (c.settings.focusAt >= 0) {
|
|
3079
|
-
var
|
|
3080
|
-
return Me(
|
|
3079
|
+
var s = e.Peek.value;
|
|
3080
|
+
return Me(s) ? i - s.before : i - s;
|
|
3081
3081
|
}
|
|
3082
3082
|
return i;
|
|
3083
3083
|
}
|
|
@@ -3092,8 +3092,8 @@ function ms(c, e) {
|
|
|
3092
3092
|
* @return {Number}
|
|
3093
3093
|
*/
|
|
3094
3094
|
modify: function(i) {
|
|
3095
|
-
var
|
|
3096
|
-
return r === "center" ? i - (
|
|
3095
|
+
var s = e.Gaps.value, n = e.Sizes.width, r = c.settings.focusAt, o = e.Sizes.slideWidth;
|
|
3096
|
+
return r === "center" ? i - (n / 2 - o / 2) : i - o * r - s * r;
|
|
3097
3097
|
}
|
|
3098
3098
|
};
|
|
3099
3099
|
}
|
|
@@ -3106,12 +3106,12 @@ function bs(c, e, t) {
|
|
|
3106
3106
|
* @param {Number} translate
|
|
3107
3107
|
* @return {Number}
|
|
3108
3108
|
*/
|
|
3109
|
-
mutate: function(
|
|
3109
|
+
mutate: function(n) {
|
|
3110
3110
|
for (var r = 0; r < i.length; r++) {
|
|
3111
3111
|
var o = i[r];
|
|
3112
|
-
Je(o) && Je(o().modify) ?
|
|
3112
|
+
Je(o) && Je(o().modify) ? n = o(c, e, t).modify(n) : me("Transformer should be a function that returns an object with `modify()` method");
|
|
3113
3113
|
}
|
|
3114
|
-
return
|
|
3114
|
+
return n;
|
|
3115
3115
|
}
|
|
3116
3116
|
};
|
|
3117
3117
|
}
|
|
@@ -3123,8 +3123,8 @@ function ys(c, e, t) {
|
|
|
3123
3123
|
* @param {Number} value
|
|
3124
3124
|
* @return {Void}
|
|
3125
3125
|
*/
|
|
3126
|
-
set: function(
|
|
3127
|
-
var r = bs(c, e).mutate(
|
|
3126
|
+
set: function(n) {
|
|
3127
|
+
var r = bs(c, e).mutate(n), o = "translate3d(".concat(-1 * r, "px, 0px, 0px)");
|
|
3128
3128
|
e.Html.wrapper.style.mozTransform = o, e.Html.wrapper.style.webkitTransform = o, e.Html.wrapper.style.transform = o;
|
|
3129
3129
|
},
|
|
3130
3130
|
/**
|
|
@@ -3139,31 +3139,31 @@ function ys(c, e, t) {
|
|
|
3139
3139
|
* @return {number}
|
|
3140
3140
|
*/
|
|
3141
3141
|
getStartIndex: function() {
|
|
3142
|
-
var
|
|
3143
|
-
return e.Run.isOffset(">") || e.Run.isOffset("|>") ?
|
|
3142
|
+
var n = e.Sizes.length, r = c.index, o = c.settings.perView;
|
|
3143
|
+
return e.Run.isOffset(">") || e.Run.isOffset("|>") ? n + (r - o) : (r + o) % n;
|
|
3144
3144
|
},
|
|
3145
3145
|
/**
|
|
3146
3146
|
* @return {number}
|
|
3147
3147
|
*/
|
|
3148
3148
|
getTravelDistance: function() {
|
|
3149
|
-
var
|
|
3150
|
-
return e.Run.isOffset(">") || e.Run.isOffset("|>") ?
|
|
3149
|
+
var n = e.Sizes.slideWidth * c.settings.perView;
|
|
3150
|
+
return e.Run.isOffset(">") || e.Run.isOffset("|>") ? n * -1 : n;
|
|
3151
3151
|
}
|
|
3152
3152
|
};
|
|
3153
|
-
return t.on("move", function(
|
|
3153
|
+
return t.on("move", function(s) {
|
|
3154
3154
|
if (!c.isType("carousel") || !e.Run.isOffset())
|
|
3155
|
-
return i.set(
|
|
3155
|
+
return i.set(s.movement);
|
|
3156
3156
|
e.Transition.after(function() {
|
|
3157
3157
|
t.emit("translate.jump"), i.set(e.Sizes.slideWidth * c.index);
|
|
3158
3158
|
});
|
|
3159
|
-
var
|
|
3160
|
-
return i.set(
|
|
3159
|
+
var n = e.Sizes.slideWidth * e.Translate.getStartIndex();
|
|
3160
|
+
return i.set(n - e.Translate.getTravelDistance());
|
|
3161
3161
|
}), t.on("destroy", function() {
|
|
3162
3162
|
i.remove();
|
|
3163
3163
|
}), i;
|
|
3164
3164
|
}
|
|
3165
3165
|
function vs(c, e, t) {
|
|
3166
|
-
var i = !1,
|
|
3166
|
+
var i = !1, s = {
|
|
3167
3167
|
/**
|
|
3168
3168
|
* Composes string of the CSS transition.
|
|
3169
3169
|
*
|
|
@@ -3220,7 +3220,7 @@ function vs(c, e, t) {
|
|
|
3220
3220
|
i = !0, this.set();
|
|
3221
3221
|
}
|
|
3222
3222
|
};
|
|
3223
|
-
return W(
|
|
3223
|
+
return W(s, "duration", {
|
|
3224
3224
|
/**
|
|
3225
3225
|
* Gets duration of the transition based
|
|
3226
3226
|
* on currently running animation type.
|
|
@@ -3232,14 +3232,14 @@ function vs(c, e, t) {
|
|
|
3232
3232
|
return c.isType("slider") && e.Run.offset ? r.rewindDuration : r.animationDuration;
|
|
3233
3233
|
}
|
|
3234
3234
|
}), t.on("move", function() {
|
|
3235
|
-
|
|
3235
|
+
s.set();
|
|
3236
3236
|
}), t.on(["build.before", "resize", "translate.jump"], function() {
|
|
3237
|
-
|
|
3237
|
+
s.disable();
|
|
3238
3238
|
}), t.on("run", function() {
|
|
3239
|
-
|
|
3239
|
+
s.enable();
|
|
3240
3240
|
}), t.on("destroy", function() {
|
|
3241
|
-
|
|
3242
|
-
}),
|
|
3241
|
+
s.remove();
|
|
3242
|
+
}), s;
|
|
3243
3243
|
}
|
|
3244
3244
|
var oi = !1;
|
|
3245
3245
|
try {
|
|
@@ -3253,7 +3253,7 @@ try {
|
|
|
3253
3253
|
}
|
|
3254
3254
|
var gt = oi, je = ["touchstart", "mousedown"], Wt = ["touchmove", "mousemove"], Vt = ["touchend", "touchcancel", "mouseup", "mouseleave"], Yt = ["mousedown", "mousemove", "mouseup", "mouseleave"];
|
|
3255
3255
|
function ws(c, e, t) {
|
|
3256
|
-
var i = new we(),
|
|
3256
|
+
var i = new we(), s = 0, n = 0, r = 0, o = !1, a = gt ? {
|
|
3257
3257
|
passive: !0
|
|
3258
3258
|
} : !1, d = {
|
|
3259
3259
|
/**
|
|
@@ -3274,7 +3274,7 @@ function ws(c, e, t) {
|
|
|
3274
3274
|
if (!o && !c.disabled) {
|
|
3275
3275
|
this.disable();
|
|
3276
3276
|
var h = this.touches(l);
|
|
3277
|
-
|
|
3277
|
+
s = null, n = Q(h.pageX), r = Q(h.pageY), this.bindSwipeMove(), this.bindSwipeEnd(), t.emit("swipe.start");
|
|
3278
3278
|
}
|
|
3279
3279
|
},
|
|
3280
3280
|
/**
|
|
@@ -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) -
|
|
3288
|
-
if (
|
|
3287
|
+
var h = c.settings, p = h.touchAngle, b = h.touchRatio, w = h.classes, _ = this.touches(l), g = Q(_.pageX) - n, v = Q(_.pageY) - r, f = Math.abs(g << 2), m = Math.abs(v << 2), y = Math.sqrt(f + m), k = Math.sqrt(m);
|
|
3288
|
+
if (s = Math.asin(k / y), 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,7 +3299,7 @@ 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), v = _.pageX -
|
|
3302
|
+
var h = c.settings, p = h.perSwipe, b = h.touchAngle, w = h.classes, _ = this.touches(l), g = this.threshold(l), v = _.pageX - n, f = s * 180 / Math.PI;
|
|
3303
3303
|
this.enable(), v > g && f < b ? e.Run.make(e.Direction.resolve("".concat(p, "<"))) : v < -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
|
},
|
|
@@ -3403,7 +3403,7 @@ function ws(c, e, t) {
|
|
|
3403
3403
|
}), d;
|
|
3404
3404
|
}
|
|
3405
3405
|
function xs(c, e, t) {
|
|
3406
|
-
var i = new we(),
|
|
3406
|
+
var i = new we(), s = {
|
|
3407
3407
|
/**
|
|
3408
3408
|
* Binds listener to glide wrapper.
|
|
3409
3409
|
*
|
|
@@ -3438,11 +3438,11 @@ function xs(c, e, t) {
|
|
|
3438
3438
|
}
|
|
3439
3439
|
};
|
|
3440
3440
|
return t.on("destroy", function() {
|
|
3441
|
-
|
|
3442
|
-
}),
|
|
3441
|
+
s.unbind(), i.destroy();
|
|
3442
|
+
}), s;
|
|
3443
3443
|
}
|
|
3444
3444
|
function ks(c, e, t) {
|
|
3445
|
-
var i = new we(),
|
|
3445
|
+
var i = new we(), s = !1, n = !1, r = {
|
|
3446
3446
|
/**
|
|
3447
3447
|
* Setups a initial state of anchors component.
|
|
3448
3448
|
*
|
|
@@ -3474,7 +3474,7 @@ function ks(c, e, t) {
|
|
|
3474
3474
|
* @return {Void}
|
|
3475
3475
|
*/
|
|
3476
3476
|
click: function(a) {
|
|
3477
|
-
|
|
3477
|
+
n && (a.stopPropagation(), a.preventDefault());
|
|
3478
3478
|
},
|
|
3479
3479
|
/**
|
|
3480
3480
|
* Detaches anchors click event inside glide.
|
|
@@ -3482,10 +3482,10 @@ function ks(c, e, t) {
|
|
|
3482
3482
|
* @return {self}
|
|
3483
3483
|
*/
|
|
3484
3484
|
detach: function() {
|
|
3485
|
-
if (
|
|
3485
|
+
if (n = !0, !s) {
|
|
3486
3486
|
for (var a = 0; a < this.items.length; a++)
|
|
3487
3487
|
this.items[a].draggable = !1;
|
|
3488
|
-
|
|
3488
|
+
s = !0;
|
|
3489
3489
|
}
|
|
3490
3490
|
return this;
|
|
3491
3491
|
},
|
|
@@ -3495,10 +3495,10 @@ function ks(c, e, t) {
|
|
|
3495
3495
|
* @return {self}
|
|
3496
3496
|
*/
|
|
3497
3497
|
attach: function() {
|
|
3498
|
-
if (
|
|
3498
|
+
if (n = !1, s) {
|
|
3499
3499
|
for (var a = 0; a < this.items.length; a++)
|
|
3500
3500
|
this.items[a].draggable = !0;
|
|
3501
|
-
|
|
3501
|
+
s = !1;
|
|
3502
3502
|
}
|
|
3503
3503
|
return this;
|
|
3504
3504
|
}
|
|
@@ -3524,9 +3524,9 @@ function ks(c, e, t) {
|
|
|
3524
3524
|
}
|
|
3525
3525
|
var _s = '[data-glide-el="controls[nav]"]', vt = '[data-glide-el^="controls"]', Ss = "".concat(vt, ' [data-glide-dir*="<"]'), Ts = "".concat(vt, ' [data-glide-dir*=">"]');
|
|
3526
3526
|
function Es(c, e, t) {
|
|
3527
|
-
var i = new we(),
|
|
3527
|
+
var i = new we(), s = gt ? {
|
|
3528
3528
|
passive: !0
|
|
3529
|
-
} : !1,
|
|
3529
|
+
} : !1, n = {
|
|
3530
3530
|
/**
|
|
3531
3531
|
* Inits arrows. Binds events listeners
|
|
3532
3532
|
* to the arrows HTML elements.
|
|
@@ -3584,7 +3584,7 @@ function Es(c, e, t) {
|
|
|
3584
3584
|
*/
|
|
3585
3585
|
setArrowState: function() {
|
|
3586
3586
|
if (!c.settings.rewind) {
|
|
3587
|
-
var o =
|
|
3587
|
+
var o = n._arrowControls.next, a = n._arrowControls.previous;
|
|
3588
3588
|
this.resetArrowState(o, a), c.index === 0 && this.disableArrow(a), c.index === e.Run.length && this.disableArrow(o);
|
|
3589
3589
|
}
|
|
3590
3590
|
},
|
|
@@ -3642,7 +3642,7 @@ function Es(c, e, t) {
|
|
|
3642
3642
|
*/
|
|
3643
3643
|
bind: function(o) {
|
|
3644
3644
|
for (var a = 0; a < o.length; a++)
|
|
3645
|
-
i.on("click", o[a], this.click), i.on("touchstart", o[a], this.click,
|
|
3645
|
+
i.on("click", o[a], this.click), i.on("touchstart", o[a], this.click, s);
|
|
3646
3646
|
},
|
|
3647
3647
|
/**
|
|
3648
3648
|
* Unbinds events binded to the arrows HTML elements.
|
|
@@ -3668,25 +3668,25 @@ function Es(c, e, t) {
|
|
|
3668
3668
|
e.Run.make(e.Direction.resolve(a));
|
|
3669
3669
|
}
|
|
3670
3670
|
};
|
|
3671
|
-
return W(
|
|
3671
|
+
return W(n, "items", {
|
|
3672
3672
|
/**
|
|
3673
3673
|
* Gets collection of the controls HTML elements.
|
|
3674
3674
|
*
|
|
3675
3675
|
* @return {HTMLElement[]}
|
|
3676
3676
|
*/
|
|
3677
3677
|
get: function() {
|
|
3678
|
-
return
|
|
3678
|
+
return n._c;
|
|
3679
3679
|
}
|
|
3680
3680
|
}), t.on(["mount.after", "move.after"], function() {
|
|
3681
|
-
|
|
3681
|
+
n.setActive();
|
|
3682
3682
|
}), t.on(["mount.after", "run"], function() {
|
|
3683
|
-
|
|
3683
|
+
n.setArrowState();
|
|
3684
3684
|
}), t.on("destroy", function() {
|
|
3685
|
-
|
|
3686
|
-
}),
|
|
3685
|
+
n.removeBindings(), n.removeActive(), i.destroy();
|
|
3686
|
+
}), n;
|
|
3687
3687
|
}
|
|
3688
3688
|
function Cs(c, e, t) {
|
|
3689
|
-
var i = new we(),
|
|
3689
|
+
var i = new we(), s = {
|
|
3690
3690
|
/**
|
|
3691
3691
|
* Binds keyboard events on component mount.
|
|
3692
3692
|
*
|
|
@@ -3726,15 +3726,15 @@ function Cs(c, e, t) {
|
|
|
3726
3726
|
}
|
|
3727
3727
|
};
|
|
3728
3728
|
return t.on(["destroy", "update"], function() {
|
|
3729
|
-
|
|
3729
|
+
s.unbind();
|
|
3730
3730
|
}), t.on("update", function() {
|
|
3731
|
-
|
|
3731
|
+
s.mount();
|
|
3732
3732
|
}), t.on("destroy", function() {
|
|
3733
3733
|
i.destroy();
|
|
3734
|
-
}),
|
|
3734
|
+
}), s;
|
|
3735
3735
|
}
|
|
3736
3736
|
function Ls(c, e, t) {
|
|
3737
|
-
var i = new we(),
|
|
3737
|
+
var i = new we(), s = {
|
|
3738
3738
|
/**
|
|
3739
3739
|
* Initializes autoplaying and events.
|
|
3740
3740
|
*
|
|
@@ -3801,7 +3801,7 @@ function Ls(c, e, t) {
|
|
|
3801
3801
|
i.off(["mouseover", "mouseout"], e.Html.root);
|
|
3802
3802
|
}
|
|
3803
3803
|
};
|
|
3804
|
-
return W(
|
|
3804
|
+
return W(s, "time", {
|
|
3805
3805
|
/**
|
|
3806
3806
|
* Gets time period value for the autoplay interval. Prioritizes
|
|
3807
3807
|
* times in `data-glide-autoplay` attrubutes over options.
|
|
@@ -3813,26 +3813,26 @@ function Ls(c, e, t) {
|
|
|
3813
3813
|
return Q(r || c.settings.autoplay);
|
|
3814
3814
|
}
|
|
3815
3815
|
}), t.on(["destroy", "update"], function() {
|
|
3816
|
-
|
|
3816
|
+
s.unbind();
|
|
3817
3817
|
}), t.on(["run.before", "swipe.start", "update"], function() {
|
|
3818
|
-
|
|
3818
|
+
s.stop();
|
|
3819
3819
|
}), t.on(["pause", "destroy"], function() {
|
|
3820
|
-
|
|
3820
|
+
s.disable(), s.stop();
|
|
3821
3821
|
}), t.on(["run.after", "swipe.end"], function() {
|
|
3822
|
-
|
|
3822
|
+
s.start();
|
|
3823
3823
|
}), t.on(["play"], function() {
|
|
3824
|
-
|
|
3824
|
+
s.enable(), s.start();
|
|
3825
3825
|
}), t.on("update", function() {
|
|
3826
|
-
|
|
3826
|
+
s.mount();
|
|
3827
3827
|
}), t.on("destroy", function() {
|
|
3828
3828
|
i.destroy();
|
|
3829
|
-
}),
|
|
3829
|
+
}), s;
|
|
3830
3830
|
}
|
|
3831
3831
|
function Xt(c) {
|
|
3832
3832
|
return Me(c) ? Ji(c) : (me("Breakpoints option must be an object"), {});
|
|
3833
3833
|
}
|
|
3834
3834
|
function Rs(c, e, t) {
|
|
3835
|
-
var i = new we(),
|
|
3835
|
+
var i = new we(), s = c.settings, n = Xt(s.breakpoints), r = Object.assign({}, s), o = {
|
|
3836
3836
|
/**
|
|
3837
3837
|
* Matches settings for currectly matching media breakpoint.
|
|
3838
3838
|
*
|
|
@@ -3848,10 +3848,10 @@ function Rs(c, e, t) {
|
|
|
3848
3848
|
return r;
|
|
3849
3849
|
}
|
|
3850
3850
|
};
|
|
3851
|
-
return Object.assign(
|
|
3852
|
-
c.settings = pt(
|
|
3851
|
+
return Object.assign(s, o.match(n)), i.on("resize", window, it(function() {
|
|
3852
|
+
c.settings = pt(s, o.match(n));
|
|
3853
3853
|
}, c.settings.throttle)), t.on("update", function() {
|
|
3854
|
-
|
|
3854
|
+
n = Xt(n), r = Object.assign({}, s);
|
|
3855
3855
|
}), t.on("destroy", function() {
|
|
3856
3856
|
i.off("resize", window);
|
|
3857
3857
|
}), o;
|
|
@@ -3887,8 +3887,8 @@ var Ms = {
|
|
|
3887
3887
|
return tt(t, [{
|
|
3888
3888
|
key: "mount",
|
|
3889
3889
|
value: function() {
|
|
3890
|
-
var
|
|
3891
|
-
return Ve(Re(t.prototype), "mount", this).call(this, Object.assign({}, Ms,
|
|
3890
|
+
var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
3891
|
+
return Ve(Re(t.prototype), "mount", this).call(this, Object.assign({}, Ms, s));
|
|
3892
3892
|
}
|
|
3893
3893
|
}]), t;
|
|
3894
3894
|
})(Qi);
|
|
@@ -3914,9 +3914,9 @@ const De = { exec: () => null };
|
|
|
3914
3914
|
function B(c, e = "") {
|
|
3915
3915
|
let t = typeof c == "string" ? c : c.source;
|
|
3916
3916
|
const i = {
|
|
3917
|
-
replace: (
|
|
3918
|
-
let r = typeof
|
|
3919
|
-
return r = r.replace(ie.caret, "$1"), t = t.replace(
|
|
3917
|
+
replace: (s, n) => {
|
|
3918
|
+
let r = typeof n == "string" ? n : n.source;
|
|
3919
|
+
return r = r.replace(ie.caret, "$1"), t = t.replace(s, r), i;
|
|
3920
3920
|
},
|
|
3921
3921
|
getRegex: () => new RegExp(t, e)
|
|
3922
3922
|
};
|
|
@@ -4078,31 +4078,31 @@ function Qt(c) {
|
|
|
4078
4078
|
return c;
|
|
4079
4079
|
}
|
|
4080
4080
|
function Kt(c, e) {
|
|
4081
|
-
const t = c.replace(ie.findPipe, (
|
|
4081
|
+
const t = c.replace(ie.findPipe, (n, r, o) => {
|
|
4082
4082
|
let a = !1, d = r;
|
|
4083
4083
|
for (; --d >= 0 && o[d] === "\\"; )
|
|
4084
4084
|
a = !a;
|
|
4085
4085
|
return a ? "|" : " |";
|
|
4086
4086
|
}), i = t.split(ie.splitPipe);
|
|
4087
|
-
let
|
|
4087
|
+
let s = 0;
|
|
4088
4088
|
if (i[0].trim() || i.shift(), i.length > 0 && !i.at(-1)?.trim() && i.pop(), e)
|
|
4089
4089
|
if (i.length > e)
|
|
4090
4090
|
i.splice(e);
|
|
4091
4091
|
else
|
|
4092
4092
|
for (; i.length < e; )
|
|
4093
4093
|
i.push("");
|
|
4094
|
-
for (;
|
|
4095
|
-
i[
|
|
4094
|
+
for (; s < i.length; s++)
|
|
4095
|
+
i[s] = i[s].trim().replace(ie.slashPipe, "|");
|
|
4096
4096
|
return i;
|
|
4097
4097
|
}
|
|
4098
4098
|
function $e(c, e, t) {
|
|
4099
4099
|
const i = c.length;
|
|
4100
4100
|
if (i === 0)
|
|
4101
4101
|
return "";
|
|
4102
|
-
let
|
|
4103
|
-
for (;
|
|
4104
|
-
|
|
4105
|
-
return c.slice(0, i -
|
|
4102
|
+
let s = 0;
|
|
4103
|
+
for (; s < i && c.charAt(i - s - 1) === e; )
|
|
4104
|
+
s++;
|
|
4105
|
+
return c.slice(0, i - s);
|
|
4106
4106
|
}
|
|
4107
4107
|
function hn(c, e) {
|
|
4108
4108
|
if (c.indexOf(e[1]) === -1)
|
|
@@ -4117,13 +4117,13 @@ function hn(c, e) {
|
|
|
4117
4117
|
return i;
|
|
4118
4118
|
return t > 0 ? -2 : -1;
|
|
4119
4119
|
}
|
|
4120
|
-
function ei(c, e, t, i,
|
|
4121
|
-
const
|
|
4120
|
+
function ei(c, e, t, i, s) {
|
|
4121
|
+
const n = e.href, r = e.title || null, o = c[1].replace(s.other.outputLinkReplace, "$1");
|
|
4122
4122
|
i.state.inLink = !0;
|
|
4123
4123
|
const a = {
|
|
4124
4124
|
type: c[0].charAt(0) === "!" ? "image" : "link",
|
|
4125
4125
|
raw: t,
|
|
4126
|
-
href:
|
|
4126
|
+
href: n,
|
|
4127
4127
|
title: r,
|
|
4128
4128
|
text: o,
|
|
4129
4129
|
tokens: i.inlineTokens(o)
|
|
@@ -4134,14 +4134,14 @@ function pn(c, e, t) {
|
|
|
4134
4134
|
const i = c.match(t.other.indentCodeCompensation);
|
|
4135
4135
|
if (i === null)
|
|
4136
4136
|
return e;
|
|
4137
|
-
const
|
|
4137
|
+
const s = i[1];
|
|
4138
4138
|
return e.split(`
|
|
4139
|
-
`).map((
|
|
4140
|
-
const r =
|
|
4139
|
+
`).map((n) => {
|
|
4140
|
+
const r = n.match(t.other.beginningSpace);
|
|
4141
4141
|
if (r === null)
|
|
4142
|
-
return
|
|
4142
|
+
return n;
|
|
4143
4143
|
const [o] = r;
|
|
4144
|
-
return o.length >=
|
|
4144
|
+
return o.length >= s.length ? n.slice(s.length) : n;
|
|
4145
4145
|
}).join(`
|
|
4146
4146
|
`);
|
|
4147
4147
|
}
|
|
@@ -4178,12 +4178,12 @@ class Qe {
|
|
|
4178
4178
|
fences(e) {
|
|
4179
4179
|
const t = this.rules.block.fences.exec(e);
|
|
4180
4180
|
if (t) {
|
|
4181
|
-
const i = t[0],
|
|
4181
|
+
const i = t[0], s = pn(i, t[3] || "", this.rules);
|
|
4182
4182
|
return {
|
|
4183
4183
|
type: "code",
|
|
4184
4184
|
raw: i,
|
|
4185
4185
|
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
4186
|
-
text:
|
|
4186
|
+
text: s
|
|
4187
4187
|
};
|
|
4188
4188
|
}
|
|
4189
4189
|
}
|
|
@@ -4192,8 +4192,8 @@ class Qe {
|
|
|
4192
4192
|
if (t) {
|
|
4193
4193
|
let i = t[2].trim();
|
|
4194
4194
|
if (this.rules.other.endingHash.test(i)) {
|
|
4195
|
-
const
|
|
4196
|
-
(this.options.pedantic || !
|
|
4195
|
+
const s = $e(i, "#");
|
|
4196
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (i = s.trim());
|
|
4197
4197
|
}
|
|
4198
4198
|
return {
|
|
4199
4199
|
type: "heading",
|
|
@@ -4218,7 +4218,7 @@ class Qe {
|
|
|
4218
4218
|
if (t) {
|
|
4219
4219
|
let i = $e(t[0], `
|
|
4220
4220
|
`).split(`
|
|
4221
|
-
`),
|
|
4221
|
+
`), s = "", n = "";
|
|
4222
4222
|
const r = [];
|
|
4223
4223
|
for (; i.length > 0; ) {
|
|
4224
4224
|
let o = !1;
|
|
@@ -4235,8 +4235,8 @@ class Qe {
|
|
|
4235
4235
|
const u = a.join(`
|
|
4236
4236
|
`), l = u.replace(this.rules.other.blockquoteSetextReplace, `
|
|
4237
4237
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
4238
|
-
|
|
4239
|
-
${u}` : u,
|
|
4238
|
+
s = s ? `${s}
|
|
4239
|
+
${u}` : u, 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)
|
|
@@ -4248,22 +4248,22 @@ ${l}` : l;
|
|
|
4248
4248
|
const b = p, w = b.raw + `
|
|
4249
4249
|
` + i.join(`
|
|
4250
4250
|
`), _ = this.blockquote(w);
|
|
4251
|
-
r[r.length - 1] = _,
|
|
4251
|
+
r[r.length - 1] = _, s = s.substring(0, s.length - b.raw.length) + _.raw, n = n.substring(0, n.length - b.text.length) + _.text;
|
|
4252
4252
|
break;
|
|
4253
4253
|
} else if (p?.type === "list") {
|
|
4254
4254
|
const b = p, w = b.raw + `
|
|
4255
4255
|
` + i.join(`
|
|
4256
4256
|
`), _ = this.list(w);
|
|
4257
|
-
r[r.length - 1] = _,
|
|
4257
|
+
r[r.length - 1] = _, s = s.substring(0, s.length - p.raw.length) + _.raw, n = n.substring(0, n.length - b.raw.length) + _.raw, i = w.substring(r.at(-1).raw.length).split(`
|
|
4258
4258
|
`);
|
|
4259
4259
|
continue;
|
|
4260
4260
|
}
|
|
4261
4261
|
}
|
|
4262
4262
|
return {
|
|
4263
4263
|
type: "blockquote",
|
|
4264
|
-
raw:
|
|
4264
|
+
raw: s,
|
|
4265
4265
|
tokens: r,
|
|
4266
|
-
text:
|
|
4266
|
+
text: n
|
|
4267
4267
|
};
|
|
4268
4268
|
}
|
|
4269
4269
|
}
|
|
@@ -4271,15 +4271,15 @@ ${l}` : l;
|
|
|
4271
4271
|
let t = this.rules.block.list.exec(e);
|
|
4272
4272
|
if (t) {
|
|
4273
4273
|
let i = t[1].trim();
|
|
4274
|
-
const
|
|
4274
|
+
const s = i.length > 1, n = {
|
|
4275
4275
|
type: "list",
|
|
4276
4276
|
raw: "",
|
|
4277
|
-
ordered:
|
|
4278
|
-
start:
|
|
4277
|
+
ordered: s,
|
|
4278
|
+
start: s ? +i.slice(0, -1) : "",
|
|
4279
4279
|
loose: !1,
|
|
4280
4280
|
items: []
|
|
4281
4281
|
};
|
|
4282
|
-
i =
|
|
4282
|
+
i = s ? `\\d{1,9}\\${i.slice(-1)}` : `\\${i}`, this.options.pedantic && (i = s ? i : "[*+-]");
|
|
4283
4283
|
const r = this.rules.other.listItemRegex(i);
|
|
4284
4284
|
let o = !1;
|
|
4285
4285
|
for (; e; ) {
|
|
@@ -4312,9 +4312,9 @@ ${l}` : l;
|
|
|
4312
4312
|
`, e = e.substring(x.length + 1), h = S.slice(w);
|
|
4313
4313
|
}
|
|
4314
4314
|
}
|
|
4315
|
-
|
|
4315
|
+
n.loose || (o ? n.loose = !0 : this.rules.other.doubleBlankLine.test(u) && (o = !0));
|
|
4316
4316
|
let _ = null, g;
|
|
4317
|
-
this.options.gfm && (_ = this.rules.other.listIsTask.exec(l), _ && (g = _[0] !== "[ ] ", l = l.replace(this.rules.other.listReplaceTask, ""))),
|
|
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
4319
|
raw: u,
|
|
4320
4320
|
task: !!_,
|
|
@@ -4322,23 +4322,23 @@ ${l}` : l;
|
|
|
4322
4322
|
loose: !1,
|
|
4323
4323
|
text: l,
|
|
4324
4324
|
tokens: []
|
|
4325
|
-
}),
|
|
4325
|
+
}), n.raw += u;
|
|
4326
4326
|
}
|
|
4327
|
-
const a =
|
|
4327
|
+
const a = n.items.at(-1);
|
|
4328
4328
|
if (a)
|
|
4329
4329
|
a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();
|
|
4330
4330
|
else
|
|
4331
4331
|
return;
|
|
4332
|
-
|
|
4333
|
-
for (let d = 0; d <
|
|
4334
|
-
if (this.lexer.state.top = !1,
|
|
4335
|
-
const u =
|
|
4336
|
-
|
|
4332
|
+
n.raw = n.raw.trimEnd();
|
|
4333
|
+
for (let d = 0; d < n.items.length; d++)
|
|
4334
|
+
if (this.lexer.state.top = !1, n.items[d].tokens = this.lexer.blockTokens(n.items[d].text, []), !n.loose) {
|
|
4335
|
+
const u = n.items[d].tokens.filter((h) => h.type === "space"), l = u.length > 0 && u.some((h) => this.rules.other.anyLine.test(h.raw));
|
|
4336
|
+
n.loose = l;
|
|
4337
4337
|
}
|
|
4338
|
-
if (
|
|
4339
|
-
for (let d = 0; d <
|
|
4340
|
-
|
|
4341
|
-
return
|
|
4338
|
+
if (n.loose)
|
|
4339
|
+
for (let d = 0; d < n.items.length; d++)
|
|
4340
|
+
n.items[d].loose = !0;
|
|
4341
|
+
return n;
|
|
4342
4342
|
}
|
|
4343
4343
|
}
|
|
4344
4344
|
html(e) {
|
|
@@ -4355,13 +4355,13 @@ ${l}` : l;
|
|
|
4355
4355
|
def(e) {
|
|
4356
4356
|
const t = this.rules.block.def.exec(e);
|
|
4357
4357
|
if (t) {
|
|
4358
|
-
const i = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "),
|
|
4358
|
+
const i = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", n = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
4359
4359
|
return {
|
|
4360
4360
|
type: "def",
|
|
4361
4361
|
tag: i,
|
|
4362
4362
|
raw: t[0],
|
|
4363
|
-
href:
|
|
4364
|
-
title:
|
|
4363
|
+
href: s,
|
|
4364
|
+
title: n
|
|
4365
4365
|
};
|
|
4366
4366
|
}
|
|
4367
4367
|
}
|
|
@@ -4369,7 +4369,7 @@ ${l}` : l;
|
|
|
4369
4369
|
const t = this.rules.block.table.exec(e);
|
|
4370
4370
|
if (!t || !this.rules.other.tableDelimiter.test(t[2]))
|
|
4371
4371
|
return;
|
|
4372
|
-
const i = Kt(t[1]),
|
|
4372
|
+
const i = Kt(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), n = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
4373
4373
|
`) : [], r = {
|
|
4374
4374
|
type: "table",
|
|
4375
4375
|
raw: t[0],
|
|
@@ -4377,8 +4377,8 @@ ${l}` : l;
|
|
|
4377
4377
|
align: [],
|
|
4378
4378
|
rows: []
|
|
4379
4379
|
};
|
|
4380
|
-
if (i.length ===
|
|
4381
|
-
for (const o of
|
|
4380
|
+
if (i.length === s.length) {
|
|
4381
|
+
for (const o of s)
|
|
4382
4382
|
this.rules.other.tableAlignRight.test(o) ? r.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? r.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? r.align.push("left") : r.align.push(null);
|
|
4383
4383
|
for (let o = 0; o < i.length; o++)
|
|
4384
4384
|
r.header.push({
|
|
@@ -4387,7 +4387,7 @@ ${l}` : l;
|
|
|
4387
4387
|
header: !0,
|
|
4388
4388
|
align: r.align[o]
|
|
4389
4389
|
});
|
|
4390
|
-
for (const o of
|
|
4390
|
+
for (const o of n)
|
|
4391
4391
|
r.rows.push(Kt(o, r.header.length).map((a, d) => ({
|
|
4392
4392
|
text: a,
|
|
4393
4393
|
tokens: this.lexer.inline(a),
|
|
@@ -4471,23 +4471,23 @@ ${l}` : l;
|
|
|
4471
4471
|
t[2] = t[2].substring(0, r), t[0] = t[0].substring(0, a).trim(), t[3] = "";
|
|
4472
4472
|
}
|
|
4473
4473
|
}
|
|
4474
|
-
let
|
|
4474
|
+
let s = t[2], n = "";
|
|
4475
4475
|
if (this.options.pedantic) {
|
|
4476
|
-
const r = this.rules.other.pedanticHrefTitle.exec(
|
|
4477
|
-
r && (
|
|
4476
|
+
const r = this.rules.other.pedanticHrefTitle.exec(s);
|
|
4477
|
+
r && (s = r[1], n = r[3]);
|
|
4478
4478
|
} else
|
|
4479
|
-
|
|
4480
|
-
return
|
|
4481
|
-
href:
|
|
4482
|
-
title:
|
|
4479
|
+
n = t[3] ? t[3].slice(1, -1) : "";
|
|
4480
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(i) ? s = s.slice(1) : s = s.slice(1, -1)), ei(t, {
|
|
4481
|
+
href: s && s.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
4482
|
+
title: n && n.replace(this.rules.inline.anyPunctuation, "$1")
|
|
4483
4483
|
}, t[0], this.lexer, this.rules);
|
|
4484
4484
|
}
|
|
4485
4485
|
}
|
|
4486
4486
|
reflink(e, t) {
|
|
4487
4487
|
let i;
|
|
4488
4488
|
if ((i = this.rules.inline.reflink.exec(e)) || (i = this.rules.inline.nolink.exec(e))) {
|
|
4489
|
-
const
|
|
4490
|
-
if (!
|
|
4489
|
+
const s = (i[2] || i[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = t[s.toLowerCase()];
|
|
4490
|
+
if (!n) {
|
|
4491
4491
|
const r = i[0].charAt(0);
|
|
4492
4492
|
return {
|
|
4493
4493
|
type: "text",
|
|
@@ -4495,31 +4495,31 @@ ${l}` : l;
|
|
|
4495
4495
|
text: r
|
|
4496
4496
|
};
|
|
4497
4497
|
}
|
|
4498
|
-
return ei(i,
|
|
4498
|
+
return ei(i, n, i[0], this.lexer, this.rules);
|
|
4499
4499
|
}
|
|
4500
4500
|
}
|
|
4501
4501
|
emStrong(e, t, i = "") {
|
|
4502
|
-
let
|
|
4503
|
-
if (!
|
|
4502
|
+
let s = this.rules.inline.emStrongLDelim.exec(e);
|
|
4503
|
+
if (!s || s[3] && i.match(this.rules.other.unicodeAlphaNumeric))
|
|
4504
4504
|
return;
|
|
4505
|
-
if (!(
|
|
4506
|
-
const r = [...
|
|
4505
|
+
if (!(s[1] || s[2] || "") || !i || this.rules.inline.punctuation.exec(i)) {
|
|
4506
|
+
const r = [...s[0]].length - 1;
|
|
4507
4507
|
let o, a, d = r, u = 0;
|
|
4508
|
-
const l =
|
|
4509
|
-
for (l.lastIndex = 0, t = t.slice(-1 * e.length + r); (
|
|
4510
|
-
if (o =
|
|
4508
|
+
const l = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
4509
|
+
for (l.lastIndex = 0, t = t.slice(-1 * e.length + r); (s = l.exec(t)) != null; ) {
|
|
4510
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o)
|
|
4511
4511
|
continue;
|
|
4512
|
-
if (a = [...o].length,
|
|
4512
|
+
if (a = [...o].length, s[3] || s[4]) {
|
|
4513
4513
|
d += a;
|
|
4514
4514
|
continue;
|
|
4515
|
-
} else if ((
|
|
4515
|
+
} else if ((s[5] || s[6]) && r % 3 && !((r + a) % 3)) {
|
|
4516
4516
|
u += a;
|
|
4517
4517
|
continue;
|
|
4518
4518
|
}
|
|
4519
4519
|
if (d -= a, d > 0)
|
|
4520
4520
|
continue;
|
|
4521
4521
|
a = Math.min(a, a + d + u);
|
|
4522
|
-
const h = [...
|
|
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);
|
|
4525
4525
|
return {
|
|
@@ -4543,8 +4543,8 @@ ${l}` : l;
|
|
|
4543
4543
|
const t = this.rules.inline.code.exec(e);
|
|
4544
4544
|
if (t) {
|
|
4545
4545
|
let i = t[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
4546
|
-
const
|
|
4547
|
-
return
|
|
4546
|
+
const s = this.rules.other.nonSpaceChar.test(i), n = this.rules.other.startingSpaceChar.test(i) && this.rules.other.endingSpaceChar.test(i);
|
|
4547
|
+
return s && n && (i = i.substring(1, i.length - 1)), {
|
|
4548
4548
|
type: "codespan",
|
|
4549
4549
|
raw: t[0],
|
|
4550
4550
|
text: i
|
|
@@ -4572,12 +4572,12 @@ ${l}` : l;
|
|
|
4572
4572
|
autolink(e) {
|
|
4573
4573
|
const t = this.rules.inline.autolink.exec(e);
|
|
4574
4574
|
if (t) {
|
|
4575
|
-
let i,
|
|
4576
|
-
return t[2] === "@" ? (i = t[1],
|
|
4575
|
+
let i, s;
|
|
4576
|
+
return t[2] === "@" ? (i = t[1], s = "mailto:" + i) : (i = t[1], s = i), {
|
|
4577
4577
|
type: "link",
|
|
4578
4578
|
raw: t[0],
|
|
4579
4579
|
text: i,
|
|
4580
|
-
href:
|
|
4580
|
+
href: s,
|
|
4581
4581
|
tokens: [
|
|
4582
4582
|
{
|
|
4583
4583
|
type: "text",
|
|
@@ -4591,21 +4591,21 @@ ${l}` : l;
|
|
|
4591
4591
|
url(e) {
|
|
4592
4592
|
let t;
|
|
4593
4593
|
if (t = this.rules.inline.url.exec(e)) {
|
|
4594
|
-
let i,
|
|
4594
|
+
let i, s;
|
|
4595
4595
|
if (t[2] === "@")
|
|
4596
|
-
i = t[0],
|
|
4596
|
+
i = t[0], s = "mailto:" + i;
|
|
4597
4597
|
else {
|
|
4598
|
-
let
|
|
4598
|
+
let n;
|
|
4599
4599
|
do
|
|
4600
|
-
|
|
4601
|
-
while (
|
|
4602
|
-
i = t[0], t[1] === "www." ?
|
|
4600
|
+
n = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
4601
|
+
while (n !== t[0]);
|
|
4602
|
+
i = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
4603
4603
|
}
|
|
4604
4604
|
return {
|
|
4605
4605
|
type: "link",
|
|
4606
4606
|
raw: t[0],
|
|
4607
4607
|
text: i,
|
|
4608
|
-
href:
|
|
4608
|
+
href: s,
|
|
4609
4609
|
tokens: [
|
|
4610
4610
|
{
|
|
4611
4611
|
type: "text",
|
|
@@ -4683,89 +4683,89 @@ class le {
|
|
|
4683
4683
|
}
|
|
4684
4684
|
blockTokens(e, t = [], i = !1) {
|
|
4685
4685
|
for (this.options.pedantic && (e = e.replace(ie.tabCharGlobal, " ").replace(ie.spaceLine, "")); e; ) {
|
|
4686
|
-
let
|
|
4687
|
-
if (this.options.extensions?.block?.some((r) => (
|
|
4686
|
+
let s;
|
|
4687
|
+
if (this.options.extensions?.block?.some((r) => (s = r.call({ lexer: this }, e, t)) ? (e = e.substring(s.raw.length), t.push(s), !0) : !1))
|
|
4688
4688
|
continue;
|
|
4689
|
-
if (
|
|
4690
|
-
e = e.substring(
|
|
4689
|
+
if (s = this.tokenizer.space(e)) {
|
|
4690
|
+
e = e.substring(s.raw.length);
|
|
4691
4691
|
const r = t.at(-1);
|
|
4692
|
-
|
|
4693
|
-
` : t.push(
|
|
4692
|
+
s.raw.length === 1 && r !== void 0 ? r.raw += `
|
|
4693
|
+
` : t.push(s);
|
|
4694
4694
|
continue;
|
|
4695
4695
|
}
|
|
4696
|
-
if (
|
|
4697
|
-
e = e.substring(
|
|
4696
|
+
if (s = this.tokenizer.code(e)) {
|
|
4697
|
+
e = e.substring(s.raw.length);
|
|
4698
4698
|
const r = t.at(-1);
|
|
4699
4699
|
r?.type === "paragraph" || r?.type === "text" ? (r.raw += `
|
|
4700
|
-
` +
|
|
4701
|
-
` +
|
|
4700
|
+
` + s.raw, r.text += `
|
|
4701
|
+
` + s.text, this.inlineQueue.at(-1).src = r.text) : t.push(s);
|
|
4702
4702
|
continue;
|
|
4703
4703
|
}
|
|
4704
|
-
if (
|
|
4705
|
-
e = e.substring(
|
|
4704
|
+
if (s = this.tokenizer.fences(e)) {
|
|
4705
|
+
e = e.substring(s.raw.length), t.push(s);
|
|
4706
4706
|
continue;
|
|
4707
4707
|
}
|
|
4708
|
-
if (
|
|
4709
|
-
e = e.substring(
|
|
4708
|
+
if (s = this.tokenizer.heading(e)) {
|
|
4709
|
+
e = e.substring(s.raw.length), t.push(s);
|
|
4710
4710
|
continue;
|
|
4711
4711
|
}
|
|
4712
|
-
if (
|
|
4713
|
-
e = e.substring(
|
|
4712
|
+
if (s = this.tokenizer.hr(e)) {
|
|
4713
|
+
e = e.substring(s.raw.length), t.push(s);
|
|
4714
4714
|
continue;
|
|
4715
4715
|
}
|
|
4716
|
-
if (
|
|
4717
|
-
e = e.substring(
|
|
4716
|
+
if (s = this.tokenizer.blockquote(e)) {
|
|
4717
|
+
e = e.substring(s.raw.length), t.push(s);
|
|
4718
4718
|
continue;
|
|
4719
4719
|
}
|
|
4720
|
-
if (
|
|
4721
|
-
e = e.substring(
|
|
4720
|
+
if (s = this.tokenizer.list(e)) {
|
|
4721
|
+
e = e.substring(s.raw.length), t.push(s);
|
|
4722
4722
|
continue;
|
|
4723
4723
|
}
|
|
4724
|
-
if (
|
|
4725
|
-
e = e.substring(
|
|
4724
|
+
if (s = this.tokenizer.html(e)) {
|
|
4725
|
+
e = e.substring(s.raw.length), t.push(s);
|
|
4726
4726
|
continue;
|
|
4727
4727
|
}
|
|
4728
|
-
if (
|
|
4729
|
-
e = e.substring(
|
|
4728
|
+
if (s = this.tokenizer.def(e)) {
|
|
4729
|
+
e = e.substring(s.raw.length);
|
|
4730
4730
|
const r = t.at(-1);
|
|
4731
4731
|
r?.type === "paragraph" || r?.type === "text" ? (r.raw += `
|
|
4732
|
-
` +
|
|
4733
|
-
` +
|
|
4734
|
-
href:
|
|
4735
|
-
title:
|
|
4732
|
+
` + s.raw, r.text += `
|
|
4733
|
+
` + s.raw, this.inlineQueue.at(-1).src = r.text) : this.tokens.links[s.tag] || (this.tokens.links[s.tag] = {
|
|
4734
|
+
href: s.href,
|
|
4735
|
+
title: s.title
|
|
4736
4736
|
});
|
|
4737
4737
|
continue;
|
|
4738
4738
|
}
|
|
4739
|
-
if (
|
|
4740
|
-
e = e.substring(
|
|
4739
|
+
if (s = this.tokenizer.table(e)) {
|
|
4740
|
+
e = e.substring(s.raw.length), t.push(s);
|
|
4741
4741
|
continue;
|
|
4742
4742
|
}
|
|
4743
|
-
if (
|
|
4744
|
-
e = e.substring(
|
|
4743
|
+
if (s = this.tokenizer.lheading(e)) {
|
|
4744
|
+
e = e.substring(s.raw.length), t.push(s);
|
|
4745
4745
|
continue;
|
|
4746
4746
|
}
|
|
4747
|
-
let
|
|
4747
|
+
let n = e;
|
|
4748
4748
|
if (this.options.extensions?.startBlock) {
|
|
4749
4749
|
let r = 1 / 0;
|
|
4750
4750
|
const o = e.slice(1);
|
|
4751
4751
|
let a;
|
|
4752
4752
|
this.options.extensions.startBlock.forEach((d) => {
|
|
4753
4753
|
a = d.call({ lexer: this }, o), typeof a == "number" && a >= 0 && (r = Math.min(r, a));
|
|
4754
|
-
}), r < 1 / 0 && r >= 0 && (
|
|
4754
|
+
}), r < 1 / 0 && r >= 0 && (n = e.substring(0, r + 1));
|
|
4755
4755
|
}
|
|
4756
|
-
if (this.state.top && (
|
|
4756
|
+
if (this.state.top && (s = this.tokenizer.paragraph(n))) {
|
|
4757
4757
|
const r = t.at(-1);
|
|
4758
4758
|
i && r?.type === "paragraph" ? (r.raw += `
|
|
4759
|
-
` +
|
|
4760
|
-
` +
|
|
4759
|
+
` + s.raw, r.text += `
|
|
4760
|
+
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(s), i = n.length !== e.length, e = e.substring(s.raw.length);
|
|
4761
4761
|
continue;
|
|
4762
4762
|
}
|
|
4763
|
-
if (
|
|
4764
|
-
e = e.substring(
|
|
4763
|
+
if (s = this.tokenizer.text(e)) {
|
|
4764
|
+
e = e.substring(s.raw.length);
|
|
4765
4765
|
const r = t.at(-1);
|
|
4766
4766
|
r?.type === "text" ? (r.raw += `
|
|
4767
|
-
` +
|
|
4768
|
-
` +
|
|
4767
|
+
` + s.raw, r.text += `
|
|
4768
|
+
` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(s);
|
|
4769
4769
|
continue;
|
|
4770
4770
|
}
|
|
4771
4771
|
if (e) {
|
|
@@ -4786,20 +4786,20 @@ class le {
|
|
|
4786
4786
|
* Lexing/Compiling
|
|
4787
4787
|
*/
|
|
4788
4788
|
inlineTokens(e, t = []) {
|
|
4789
|
-
let i = e,
|
|
4789
|
+
let i = e, s = null;
|
|
4790
4790
|
if (this.tokens.links) {
|
|
4791
4791
|
const o = Object.keys(this.tokens.links);
|
|
4792
4792
|
if (o.length > 0)
|
|
4793
|
-
for (; (
|
|
4794
|
-
o.includes(
|
|
4795
|
-
}
|
|
4796
|
-
for (; (
|
|
4797
|
-
i = i.slice(0,
|
|
4798
|
-
for (; (
|
|
4799
|
-
i = i.slice(0,
|
|
4800
|
-
let
|
|
4793
|
+
for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(i)) != null; )
|
|
4794
|
+
o.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (i = i.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
4795
|
+
}
|
|
4796
|
+
for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(i)) != null; )
|
|
4797
|
+
i = i.slice(0, s.index) + "++" + i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
4798
|
+
for (; (s = this.tokenizer.rules.inline.blockSkip.exec(i)) != null; )
|
|
4799
|
+
i = i.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
4800
|
+
let n = !1, r = "";
|
|
4801
4801
|
for (; e; ) {
|
|
4802
|
-
|
|
4802
|
+
n || (r = ""), n = !1;
|
|
4803
4803
|
let o;
|
|
4804
4804
|
if (this.options.extensions?.inline?.some((d) => (o = d.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1))
|
|
4805
4805
|
continue;
|
|
@@ -4855,7 +4855,7 @@ class le {
|
|
|
4855
4855
|
}), d < 1 / 0 && d >= 0 && (a = e.substring(0, d + 1));
|
|
4856
4856
|
}
|
|
4857
4857
|
if (o = this.tokenizer.inlineText(a)) {
|
|
4858
|
-
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (r = o.raw.slice(-1)),
|
|
4858
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (r = o.raw.slice(-1)), n = !0;
|
|
4859
4859
|
const d = t.at(-1);
|
|
4860
4860
|
d?.type === "text" ? (d.raw += o.raw, d.text += o.text) : t.push(o);
|
|
4861
4861
|
continue;
|
|
@@ -4883,10 +4883,10 @@ class Ke {
|
|
|
4883
4883
|
return "";
|
|
4884
4884
|
}
|
|
4885
4885
|
code({ text: e, lang: t, escaped: i }) {
|
|
4886
|
-
const
|
|
4886
|
+
const s = (t || "").match(ie.notSpaceStart)?.[0], n = e.replace(ie.endingNewline, "") + `
|
|
4887
4887
|
`;
|
|
4888
|
-
return
|
|
4889
|
-
` : "<pre><code>" + (i ?
|
|
4888
|
+
return s ? '<pre><code class="language-' + pe(s) + '">' + (i ? n : pe(n, !0)) + `</code></pre>
|
|
4889
|
+
` : "<pre><code>" + (i ? n : pe(n, !0)) + `</code></pre>
|
|
4890
4890
|
`;
|
|
4891
4891
|
}
|
|
4892
4892
|
blockquote({ tokens: e }) {
|
|
@@ -4907,14 +4907,14 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
4907
4907
|
}
|
|
4908
4908
|
list(e) {
|
|
4909
4909
|
const t = e.ordered, i = e.start;
|
|
4910
|
-
let
|
|
4910
|
+
let s = "";
|
|
4911
4911
|
for (let o = 0; o < e.items.length; o++) {
|
|
4912
4912
|
const a = e.items[o];
|
|
4913
|
-
|
|
4913
|
+
s += this.listitem(a);
|
|
4914
4914
|
}
|
|
4915
|
-
const
|
|
4916
|
-
return "<" +
|
|
4917
|
-
` +
|
|
4915
|
+
const n = t ? "ol" : "ul", r = t && i !== 1 ? ' start="' + i + '"' : "";
|
|
4916
|
+
return "<" + n + r + `>
|
|
4917
|
+
` + s + "</" + n + `>
|
|
4918
4918
|
`;
|
|
4919
4919
|
}
|
|
4920
4920
|
listitem(e) {
|
|
@@ -4940,21 +4940,21 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
4940
4940
|
}
|
|
4941
4941
|
table(e) {
|
|
4942
4942
|
let t = "", i = "";
|
|
4943
|
-
for (let
|
|
4944
|
-
i += this.tablecell(e.header[
|
|
4943
|
+
for (let n = 0; n < e.header.length; n++)
|
|
4944
|
+
i += this.tablecell(e.header[n]);
|
|
4945
4945
|
t += this.tablerow({ text: i });
|
|
4946
|
-
let
|
|
4947
|
-
for (let
|
|
4948
|
-
const r = e.rows[
|
|
4946
|
+
let s = "";
|
|
4947
|
+
for (let n = 0; n < e.rows.length; n++) {
|
|
4948
|
+
const r = e.rows[n];
|
|
4949
4949
|
i = "";
|
|
4950
4950
|
for (let o = 0; o < r.length; o++)
|
|
4951
4951
|
i += this.tablecell(r[o]);
|
|
4952
|
-
|
|
4952
|
+
s += this.tablerow({ text: i });
|
|
4953
4953
|
}
|
|
4954
|
-
return
|
|
4954
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
4955
4955
|
<thead>
|
|
4956
4956
|
` + t + `</thead>
|
|
4957
|
-
` +
|
|
4957
|
+
` + s + `</table>
|
|
4958
4958
|
`;
|
|
4959
4959
|
}
|
|
4960
4960
|
tablerow({ text: e }) {
|
|
@@ -4986,19 +4986,19 @@ ${e}</tr>
|
|
|
4986
4986
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
4987
4987
|
}
|
|
4988
4988
|
link({ href: e, title: t, tokens: i }) {
|
|
4989
|
-
const
|
|
4990
|
-
if (
|
|
4991
|
-
return
|
|
4992
|
-
e =
|
|
4989
|
+
const s = this.parser.parseInline(i), n = Qt(e);
|
|
4990
|
+
if (n === null)
|
|
4991
|
+
return s;
|
|
4992
|
+
e = n;
|
|
4993
4993
|
let r = '<a href="' + e + '"';
|
|
4994
|
-
return t && (r += ' title="' + pe(t) + '"'), r += ">" +
|
|
4994
|
+
return t && (r += ' title="' + pe(t) + '"'), r += ">" + s + "</a>", r;
|
|
4995
4995
|
}
|
|
4996
|
-
image({ href: e, title: t, text: i, tokens:
|
|
4997
|
-
|
|
4998
|
-
const
|
|
4999
|
-
if (
|
|
4996
|
+
image({ href: e, title: t, text: i, tokens: s }) {
|
|
4997
|
+
s && (i = this.parser.parseInline(s, this.parser.textRenderer));
|
|
4998
|
+
const n = Qt(e);
|
|
4999
|
+
if (n === null)
|
|
5000
5000
|
return pe(i);
|
|
5001
|
-
e =
|
|
5001
|
+
e = n;
|
|
5002
5002
|
let r = `<img src="${e}" alt="${i}"`;
|
|
5003
5003
|
return t && (r += ` title="${pe(t)}"`), r += ">", r;
|
|
5004
5004
|
}
|
|
@@ -5060,16 +5060,16 @@ class ae {
|
|
|
5060
5060
|
*/
|
|
5061
5061
|
parse(e, t = !0) {
|
|
5062
5062
|
let i = "";
|
|
5063
|
-
for (let
|
|
5064
|
-
const
|
|
5065
|
-
if (this.options.extensions?.renderers?.[
|
|
5066
|
-
const o =
|
|
5063
|
+
for (let s = 0; s < e.length; s++) {
|
|
5064
|
+
const n = e[s];
|
|
5065
|
+
if (this.options.extensions?.renderers?.[n.type]) {
|
|
5066
|
+
const o = n, a = this.options.extensions.renderers[o.type].call({ parser: this }, o);
|
|
5067
5067
|
if (a !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(o.type)) {
|
|
5068
5068
|
i += a || "";
|
|
5069
5069
|
continue;
|
|
5070
5070
|
}
|
|
5071
5071
|
}
|
|
5072
|
-
const r =
|
|
5072
|
+
const r = n;
|
|
5073
5073
|
switch (r.type) {
|
|
5074
5074
|
case "space": {
|
|
5075
5075
|
i += this.renderer.space(r);
|
|
@@ -5109,8 +5109,8 @@ class ae {
|
|
|
5109
5109
|
}
|
|
5110
5110
|
case "text": {
|
|
5111
5111
|
let o = r, a = this.renderer.text(o);
|
|
5112
|
-
for (;
|
|
5113
|
-
o = e[++
|
|
5112
|
+
for (; s + 1 < e.length && e[s + 1].type === "text"; )
|
|
5113
|
+
o = e[++s], a += `
|
|
5114
5114
|
` + this.renderer.text(o);
|
|
5115
5115
|
t ? i += this.renderer.paragraph({
|
|
5116
5116
|
type: "paragraph",
|
|
@@ -5135,16 +5135,16 @@ class ae {
|
|
|
5135
5135
|
*/
|
|
5136
5136
|
parseInline(e, t = this.renderer) {
|
|
5137
5137
|
let i = "";
|
|
5138
|
-
for (let
|
|
5139
|
-
const
|
|
5140
|
-
if (this.options.extensions?.renderers?.[
|
|
5141
|
-
const o = this.options.extensions.renderers[
|
|
5142
|
-
if (o !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(
|
|
5138
|
+
for (let s = 0; s < e.length; s++) {
|
|
5139
|
+
const n = e[s];
|
|
5140
|
+
if (this.options.extensions?.renderers?.[n.type]) {
|
|
5141
|
+
const o = this.options.extensions.renderers[n.type].call({ parser: this }, n);
|
|
5142
|
+
if (o !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(n.type)) {
|
|
5143
5143
|
i += o || "";
|
|
5144
5144
|
continue;
|
|
5145
5145
|
}
|
|
5146
5146
|
}
|
|
5147
|
-
const r =
|
|
5147
|
+
const r = n;
|
|
5148
5148
|
switch (r.type) {
|
|
5149
5149
|
case "escape": {
|
|
5150
5150
|
i += t.text(r);
|
|
@@ -5258,28 +5258,28 @@ class fn {
|
|
|
5258
5258
|
*/
|
|
5259
5259
|
walkTokens(e, t) {
|
|
5260
5260
|
let i = [];
|
|
5261
|
-
for (const
|
|
5262
|
-
switch (i = i.concat(t.call(this,
|
|
5261
|
+
for (const s of e)
|
|
5262
|
+
switch (i = i.concat(t.call(this, s)), s.type) {
|
|
5263
5263
|
case "table": {
|
|
5264
|
-
const
|
|
5265
|
-
for (const r of
|
|
5264
|
+
const n = s;
|
|
5265
|
+
for (const r of n.header)
|
|
5266
5266
|
i = i.concat(this.walkTokens(r.tokens, t));
|
|
5267
|
-
for (const r of
|
|
5267
|
+
for (const r of n.rows)
|
|
5268
5268
|
for (const o of r)
|
|
5269
5269
|
i = i.concat(this.walkTokens(o.tokens, t));
|
|
5270
5270
|
break;
|
|
5271
5271
|
}
|
|
5272
5272
|
case "list": {
|
|
5273
|
-
const
|
|
5274
|
-
i = i.concat(this.walkTokens(
|
|
5273
|
+
const n = s;
|
|
5274
|
+
i = i.concat(this.walkTokens(n.items, t));
|
|
5275
5275
|
break;
|
|
5276
5276
|
}
|
|
5277
5277
|
default: {
|
|
5278
|
-
const
|
|
5279
|
-
this.defaults.extensions?.childTokens?.[
|
|
5280
|
-
const o =
|
|
5278
|
+
const n = s;
|
|
5279
|
+
this.defaults.extensions?.childTokens?.[n.type] ? this.defaults.extensions.childTokens[n.type].forEach((r) => {
|
|
5280
|
+
const o = n[r].flat(1 / 0);
|
|
5281
5281
|
i = i.concat(this.walkTokens(o, t));
|
|
5282
|
-
}) :
|
|
5282
|
+
}) : n.tokens && (i = i.concat(this.walkTokens(n.tokens, t)));
|
|
5283
5283
|
}
|
|
5284
5284
|
}
|
|
5285
5285
|
return i;
|
|
@@ -5287,82 +5287,82 @@ class fn {
|
|
|
5287
5287
|
use(...e) {
|
|
5288
5288
|
const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
5289
5289
|
return e.forEach((i) => {
|
|
5290
|
-
const
|
|
5291
|
-
if (
|
|
5292
|
-
if (!
|
|
5290
|
+
const s = { ...i };
|
|
5291
|
+
if (s.async = this.defaults.async || s.async || !1, i.extensions && (i.extensions.forEach((n) => {
|
|
5292
|
+
if (!n.name)
|
|
5293
5293
|
throw new Error("extension name required");
|
|
5294
|
-
if ("renderer" in
|
|
5295
|
-
const r = t.renderers[
|
|
5296
|
-
r ? t.renderers[
|
|
5297
|
-
let a =
|
|
5294
|
+
if ("renderer" in n) {
|
|
5295
|
+
const r = t.renderers[n.name];
|
|
5296
|
+
r ? t.renderers[n.name] = function(...o) {
|
|
5297
|
+
let a = n.renderer.apply(this, o);
|
|
5298
5298
|
return a === !1 && (a = r.apply(this, o)), a;
|
|
5299
|
-
} : t.renderers[
|
|
5299
|
+
} : t.renderers[n.name] = n.renderer;
|
|
5300
5300
|
}
|
|
5301
|
-
if ("tokenizer" in
|
|
5302
|
-
if (!
|
|
5301
|
+
if ("tokenizer" in n) {
|
|
5302
|
+
if (!n.level || n.level !== "block" && n.level !== "inline")
|
|
5303
5303
|
throw new Error("extension level must be 'block' or 'inline'");
|
|
5304
|
-
const r = t[
|
|
5305
|
-
r ? r.unshift(
|
|
5304
|
+
const r = t[n.level];
|
|
5305
|
+
r ? r.unshift(n.tokenizer) : t[n.level] = [n.tokenizer], n.start && (n.level === "block" ? t.startBlock ? t.startBlock.push(n.start) : t.startBlock = [n.start] : n.level === "inline" && (t.startInline ? t.startInline.push(n.start) : t.startInline = [n.start]));
|
|
5306
5306
|
}
|
|
5307
|
-
"childTokens" in
|
|
5308
|
-
}),
|
|
5309
|
-
const
|
|
5307
|
+
"childTokens" in n && n.childTokens && (t.childTokens[n.name] = n.childTokens);
|
|
5308
|
+
}), s.extensions = t), i.renderer) {
|
|
5309
|
+
const n = this.defaults.renderer || new Ke(this.defaults);
|
|
5310
5310
|
for (const r in i.renderer) {
|
|
5311
|
-
if (!(r in
|
|
5311
|
+
if (!(r in n))
|
|
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], d =
|
|
5316
|
-
|
|
5317
|
-
let l = a.apply(
|
|
5318
|
-
return l === !1 && (l = d.apply(
|
|
5315
|
+
const o = r, a = i.renderer[o], d = n[o];
|
|
5316
|
+
n[o] = (...u) => {
|
|
5317
|
+
let l = a.apply(n, u);
|
|
5318
|
+
return l === !1 && (l = d.apply(n, u)), l || "";
|
|
5319
5319
|
};
|
|
5320
5320
|
}
|
|
5321
|
-
|
|
5321
|
+
s.renderer = n;
|
|
5322
5322
|
}
|
|
5323
5323
|
if (i.tokenizer) {
|
|
5324
|
-
const
|
|
5324
|
+
const n = this.defaults.tokenizer || new Qe(this.defaults);
|
|
5325
5325
|
for (const r in i.tokenizer) {
|
|
5326
|
-
if (!(r in
|
|
5326
|
+
if (!(r in n))
|
|
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], d =
|
|
5331
|
-
|
|
5332
|
-
let l = a.apply(
|
|
5333
|
-
return l === !1 && (l = d.apply(
|
|
5330
|
+
const o = r, a = i.tokenizer[o], d = n[o];
|
|
5331
|
+
n[o] = (...u) => {
|
|
5332
|
+
let l = a.apply(n, u);
|
|
5333
|
+
return l === !1 && (l = d.apply(n, u)), l;
|
|
5334
5334
|
};
|
|
5335
5335
|
}
|
|
5336
|
-
|
|
5336
|
+
s.tokenizer = n;
|
|
5337
5337
|
}
|
|
5338
5338
|
if (i.hooks) {
|
|
5339
|
-
const
|
|
5339
|
+
const n = this.defaults.hooks || new Ye();
|
|
5340
5340
|
for (const r in i.hooks) {
|
|
5341
|
-
if (!(r in
|
|
5341
|
+
if (!(r in n))
|
|
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], d =
|
|
5346
|
-
Ye.passThroughHooks.has(r) ?
|
|
5345
|
+
const o = r, a = i.hooks[o], d = n[o];
|
|
5346
|
+
Ye.passThroughHooks.has(r) ? n[o] = (u) => {
|
|
5347
5347
|
if (this.defaults.async)
|
|
5348
|
-
return Promise.resolve(a.call(
|
|
5349
|
-
const l = a.call(
|
|
5350
|
-
return d.call(
|
|
5351
|
-
} :
|
|
5352
|
-
let l = a.apply(
|
|
5353
|
-
return l === !1 && (l = d.apply(
|
|
5348
|
+
return Promise.resolve(a.call(n, u)).then((h) => d.call(n, h));
|
|
5349
|
+
const l = a.call(n, u);
|
|
5350
|
+
return d.call(n, l);
|
|
5351
|
+
} : n[o] = (...u) => {
|
|
5352
|
+
let l = a.apply(n, u);
|
|
5353
|
+
return l === !1 && (l = d.apply(n, u)), l;
|
|
5354
5354
|
};
|
|
5355
5355
|
}
|
|
5356
|
-
|
|
5356
|
+
s.hooks = n;
|
|
5357
5357
|
}
|
|
5358
5358
|
if (i.walkTokens) {
|
|
5359
|
-
const
|
|
5360
|
-
|
|
5359
|
+
const n = this.defaults.walkTokens, r = i.walkTokens;
|
|
5360
|
+
s.walkTokens = function(o) {
|
|
5361
5361
|
let a = [];
|
|
5362
|
-
return a.push(r.call(this, o)),
|
|
5362
|
+
return a.push(r.call(this, o)), n && (a = a.concat(n.call(this, o))), a;
|
|
5363
5363
|
};
|
|
5364
5364
|
}
|
|
5365
|
-
this.defaults = { ...this.defaults, ...
|
|
5365
|
+
this.defaults = { ...this.defaults, ...s };
|
|
5366
5366
|
}), this;
|
|
5367
5367
|
}
|
|
5368
5368
|
setOptions(e) {
|
|
@@ -5375,9 +5375,9 @@ class fn {
|
|
|
5375
5375
|
return ae.parse(e, t ?? this.defaults);
|
|
5376
5376
|
}
|
|
5377
5377
|
parseMarkdown(e) {
|
|
5378
|
-
return (i,
|
|
5379
|
-
const
|
|
5380
|
-
if (this.defaults.async === !0 &&
|
|
5378
|
+
return (i, s) => {
|
|
5379
|
+
const n = { ...s }, r = { ...this.defaults, ...n }, o = this.onError(!!r.silent, !!r.async);
|
|
5380
|
+
if (this.defaults.async === !0 && n.async === !1)
|
|
5381
5381
|
return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
5382
5382
|
if (typeof i > "u" || i === null)
|
|
5383
5383
|
return o(new Error("marked(): input parameter is undefined or null"));
|
|
@@ -5402,8 +5402,8 @@ class fn {
|
|
|
5402
5402
|
return (i) => {
|
|
5403
5403
|
if (i.message += `
|
|
5404
5404
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
5405
|
-
const
|
|
5406
|
-
return t ? Promise.resolve(
|
|
5405
|
+
const s = "<p>An error occurred:</p><pre>" + pe(i.message + "", !0) + "</pre>";
|
|
5406
|
+
return t ? Promise.resolve(s) : s;
|
|
5407
5407
|
}
|
|
5408
5408
|
if (t)
|
|
5409
5409
|
return Promise.reject(i);
|
|
@@ -5451,7 +5451,7 @@ class gn {
|
|
|
5451
5451
|
this.builder = t, this.opts = Object.assign({}, i, e);
|
|
5452
5452
|
}
|
|
5453
5453
|
async checkIntent(e, t, i) {
|
|
5454
|
-
let
|
|
5454
|
+
let s = "You are an assistant", n = "", r = `This is the user's request:
|
|
5455
5455
|
|
|
5456
5456
|
${e}`, o, a, d;
|
|
5457
5457
|
if (i.image && t === "openai")
|
|
@@ -5498,7 +5498,7 @@ Extract some information.
|
|
|
5498
5498
|
},
|
|
5499
5499
|
required: []
|
|
5500
5500
|
}
|
|
5501
|
-
}], a = await this.builder.send(r,
|
|
5501
|
+
}], a = await this.builder.send(r, n, s, "", o), a ? (d = JSON.parse(a), d) : !1;
|
|
5502
5502
|
if (i.image) {
|
|
5503
5503
|
if (r += `
|
|
5504
5504
|
|
|
@@ -5558,7 +5558,7 @@ Check the type of the request:
|
|
|
5558
5558
|
},
|
|
5559
5559
|
required: []
|
|
5560
5560
|
}
|
|
5561
|
-
}], a = await this.builder.send(r,
|
|
5561
|
+
}], a = await this.builder.send(r, n, s, "", o), !a)
|
|
5562
5562
|
return !1;
|
|
5563
5563
|
d = JSON.parse(a);
|
|
5564
5564
|
} else if (i.video) {
|
|
@@ -5586,7 +5586,7 @@ Check the type of the request:
|
|
|
5586
5586
|
},
|
|
5587
5587
|
required: []
|
|
5588
5588
|
}
|
|
5589
|
-
}], a = await this.builder.send(r,
|
|
5589
|
+
}], a = await this.builder.send(r, n, s, "", o), !a)
|
|
5590
5590
|
return !1;
|
|
5591
5591
|
d = JSON.parse(a);
|
|
5592
5592
|
} else if (i.audio) {
|
|
@@ -5608,18 +5608,18 @@ Check the type of the request:
|
|
|
5608
5608
|
},
|
|
5609
5609
|
required: []
|
|
5610
5610
|
}
|
|
5611
|
-
}], a = await this.builder.send(r,
|
|
5611
|
+
}], a = await this.builder.send(r, n, s, "", o), !a)
|
|
5612
5612
|
return !1;
|
|
5613
5613
|
d = JSON.parse(a);
|
|
5614
5614
|
}
|
|
5615
5615
|
return this.builder.settings.consoleLog && console.log(d), this.extractInfo(d, t, e);
|
|
5616
5616
|
}
|
|
5617
5617
|
async extractInfo(e, t, i) {
|
|
5618
|
-
const
|
|
5618
|
+
const s = this.builder.settings.defaultModels;
|
|
5619
5619
|
if (e.text_to_image_generation) {
|
|
5620
|
-
const
|
|
5620
|
+
const n = "You are an assistant", o = `
|
|
5621
5621
|
Thie is the list of models:
|
|
5622
|
-
- ${
|
|
5622
|
+
- ${s.text_to_image_generation[t].join(`
|
|
5623
5623
|
- `)}
|
|
5624
5624
|
`, a = `This is user's request:
|
|
5625
5625
|
|
|
@@ -5722,7 +5722,7 @@ Check the request and return the details.
|
|
|
5722
5722
|
// 'prompt'
|
|
5723
5723
|
]
|
|
5724
5724
|
}
|
|
5725
|
-
}], u = await this.builder.send(a, o,
|
|
5725
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
5726
5726
|
if (!u)
|
|
5727
5727
|
return !1;
|
|
5728
5728
|
let l = JSON.parse(u);
|
|
@@ -5731,9 +5731,9 @@ Check the request and return the details.
|
|
|
5731
5731
|
...l
|
|
5732
5732
|
};
|
|
5733
5733
|
} else if (e.image_to_video_generation) {
|
|
5734
|
-
const
|
|
5734
|
+
const n = "You are an assistant", o = `
|
|
5735
5735
|
Thie is the list of models:
|
|
5736
|
-
- ${
|
|
5736
|
+
- ${s.image_to_video_generation[t].join(`
|
|
5737
5737
|
- `)}
|
|
5738
5738
|
`, a = `This is user's request:
|
|
5739
5739
|
|
|
@@ -5768,7 +5768,7 @@ Check the request and return the details.
|
|
|
5768
5768
|
// 'image_url'
|
|
5769
5769
|
]
|
|
5770
5770
|
}
|
|
5771
|
-
}], u = await this.builder.send(a, o,
|
|
5771
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
5772
5772
|
if (!u)
|
|
5773
5773
|
return !1;
|
|
5774
5774
|
let l = JSON.parse(u);
|
|
@@ -5777,9 +5777,9 @@ Check the request and return the details.
|
|
|
5777
5777
|
...l
|
|
5778
5778
|
};
|
|
5779
5779
|
} else if (e.text_to_video_generation) {
|
|
5780
|
-
const
|
|
5780
|
+
const n = "You are an assistant", o = `
|
|
5781
5781
|
Thie is the list of models:
|
|
5782
|
-
- ${
|
|
5782
|
+
- ${s.text_to_video_generation[t].join(`
|
|
5783
5783
|
- `)}
|
|
5784
5784
|
`;
|
|
5785
5785
|
let a = `This is user's request:
|
|
@@ -5810,7 +5810,7 @@ Check the request and return the details.
|
|
|
5810
5810
|
// 'prompt'
|
|
5811
5811
|
]
|
|
5812
5812
|
}
|
|
5813
|
-
}], u = await this.builder.send(a, o,
|
|
5813
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
5814
5814
|
if (!u)
|
|
5815
5815
|
return !1;
|
|
5816
5816
|
let l = JSON.parse(u);
|
|
@@ -5819,7 +5819,7 @@ Check the request and return the details.
|
|
|
5819
5819
|
...l
|
|
5820
5820
|
};
|
|
5821
5821
|
} else if (e.minimize_image) {
|
|
5822
|
-
let
|
|
5822
|
+
let n = "You are an assistant", r = "", o = `This is user's request:
|
|
5823
5823
|
|
|
5824
5824
|
${i}
|
|
5825
5825
|
|
|
@@ -5837,7 +5837,7 @@ Check the request and return the details.
|
|
|
5837
5837
|
},
|
|
5838
5838
|
required: ["image_url"]
|
|
5839
5839
|
}
|
|
5840
|
-
}], d = await this.builder.send(o, r,
|
|
5840
|
+
}], d = await this.builder.send(o, r, n, "", a);
|
|
5841
5841
|
if (!d)
|
|
5842
5842
|
return !1;
|
|
5843
5843
|
let u = JSON.parse(d);
|
|
@@ -5846,9 +5846,9 @@ Check the request and return the details.
|
|
|
5846
5846
|
...u
|
|
5847
5847
|
};
|
|
5848
5848
|
} else if (e.upscale_image) {
|
|
5849
|
-
const
|
|
5849
|
+
const n = "You are an assistant", o = `
|
|
5850
5850
|
Thie is the list of models:
|
|
5851
|
-
- ${
|
|
5851
|
+
- ${s.upscale_image[t].join(`
|
|
5852
5852
|
- `)}
|
|
5853
5853
|
`;
|
|
5854
5854
|
let a = `This is user's request:
|
|
@@ -5875,7 +5875,7 @@ Check the request and return the details.
|
|
|
5875
5875
|
// 'image_url'
|
|
5876
5876
|
]
|
|
5877
5877
|
}
|
|
5878
|
-
}], u = await this.builder.send(a, o,
|
|
5878
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
5879
5879
|
if (!u)
|
|
5880
5880
|
return !1;
|
|
5881
5881
|
let l = JSON.parse(u);
|
|
@@ -5884,9 +5884,9 @@ Check the request and return the details.
|
|
|
5884
5884
|
...l
|
|
5885
5885
|
};
|
|
5886
5886
|
} else if (e.describe_image) {
|
|
5887
|
-
const
|
|
5887
|
+
const n = "You are an assistant", o = `
|
|
5888
5888
|
Thie is the list of models:
|
|
5889
|
-
- ${
|
|
5889
|
+
- ${s.describe_image[t].join(`
|
|
5890
5890
|
- `)}
|
|
5891
5891
|
`;
|
|
5892
5892
|
let a = `This is user's request:
|
|
@@ -5915,7 +5915,7 @@ Check the request and return the details.
|
|
|
5915
5915
|
},
|
|
5916
5916
|
required: ["image_url", "prompt"]
|
|
5917
5917
|
}
|
|
5918
|
-
}], u = await this.builder.send(a, o,
|
|
5918
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
5919
5919
|
if (!u)
|
|
5920
5920
|
return !1;
|
|
5921
5921
|
let l = JSON.parse(u);
|
|
@@ -5924,7 +5924,7 @@ Check the request and return the details.
|
|
|
5924
5924
|
...l
|
|
5925
5925
|
};
|
|
5926
5926
|
} else if (e.edit_area_in_image) {
|
|
5927
|
-
const
|
|
5927
|
+
const n = "You are an assistant", r = s.edit_area_in_image[t];
|
|
5928
5928
|
let o = "";
|
|
5929
5929
|
r && (o = `
|
|
5930
5930
|
Thie is the list of models:
|
|
@@ -5963,7 +5963,7 @@ Check the request and return the details.
|
|
|
5963
5963
|
// 'image_url'
|
|
5964
5964
|
]
|
|
5965
5965
|
}
|
|
5966
|
-
}], u = await this.builder.send(a, o,
|
|
5966
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
5967
5967
|
if (!u)
|
|
5968
5968
|
return !1;
|
|
5969
5969
|
let l = JSON.parse(u);
|
|
@@ -5972,9 +5972,9 @@ Check the request and return the details.
|
|
|
5972
5972
|
...l
|
|
5973
5973
|
};
|
|
5974
5974
|
} else if (e.text_to_2d_illustration_generation) {
|
|
5975
|
-
const
|
|
5975
|
+
const n = "You are an assistant", o = `
|
|
5976
5976
|
Thie is the list of models:
|
|
5977
|
-
- ${
|
|
5977
|
+
- ${s.text_to_2d_illustration_generation[t].join(`
|
|
5978
5978
|
- `)}
|
|
5979
5979
|
`;
|
|
5980
5980
|
let a = `This is user's request:
|
|
@@ -6085,7 +6085,7 @@ Check the request and return the details.
|
|
|
6085
6085
|
// 'prompt'
|
|
6086
6086
|
]
|
|
6087
6087
|
}
|
|
6088
|
-
}], u = await this.builder.send(a, o,
|
|
6088
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
6089
6089
|
if (!u)
|
|
6090
6090
|
return !1;
|
|
6091
6091
|
let l = JSON.parse(u);
|
|
@@ -6094,9 +6094,9 @@ Check the request and return the details.
|
|
|
6094
6094
|
...l
|
|
6095
6095
|
};
|
|
6096
6096
|
} else if (e.text_to_digital_illustration_generation) {
|
|
6097
|
-
const
|
|
6097
|
+
const n = "You are an assistant", o = `
|
|
6098
6098
|
Thie is the list of models:
|
|
6099
|
-
- ${
|
|
6099
|
+
- ${s.text_to_digital_illustration_generation[t].join(`
|
|
6100
6100
|
- `)}
|
|
6101
6101
|
`;
|
|
6102
6102
|
let a = `This is user's request:
|
|
@@ -6207,7 +6207,7 @@ Check the request and return the details.
|
|
|
6207
6207
|
// 'prompt'
|
|
6208
6208
|
]
|
|
6209
6209
|
}
|
|
6210
|
-
}], u = await this.builder.send(a, o,
|
|
6210
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
6211
6211
|
if (!u)
|
|
6212
6212
|
return !1;
|
|
6213
6213
|
let l = JSON.parse(u);
|
|
@@ -6216,9 +6216,9 @@ Check the request and return the details.
|
|
|
6216
6216
|
...l
|
|
6217
6217
|
};
|
|
6218
6218
|
} else if (e.text_to_book_cover_generation) {
|
|
6219
|
-
const
|
|
6219
|
+
const n = "You are an assistant", o = `
|
|
6220
6220
|
Thie is the list of models:
|
|
6221
|
-
- ${
|
|
6221
|
+
- ${s.text_to_book_cover_generation[t].join(`
|
|
6222
6222
|
- `)}
|
|
6223
6223
|
`;
|
|
6224
6224
|
let a = `This is user's request:
|
|
@@ -6325,7 +6325,7 @@ Check the request and return the details.
|
|
|
6325
6325
|
// 'prompt'
|
|
6326
6326
|
]
|
|
6327
6327
|
}
|
|
6328
|
-
}], u = await this.builder.send(a, o,
|
|
6328
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
6329
6329
|
if (!u)
|
|
6330
6330
|
return !1;
|
|
6331
6331
|
let l = JSON.parse(u);
|
|
@@ -6334,9 +6334,9 @@ Check the request and return the details.
|
|
|
6334
6334
|
...l
|
|
6335
6335
|
};
|
|
6336
6336
|
} else if (e.text_to_speech) {
|
|
6337
|
-
const
|
|
6337
|
+
const n = "You are an assistant", o = `
|
|
6338
6338
|
Thie is the list of models:
|
|
6339
|
-
- ${
|
|
6339
|
+
- ${s.text_to_speech[t].join(`
|
|
6340
6340
|
- `)}
|
|
6341
6341
|
`;
|
|
6342
6342
|
let a = `This is user's request:
|
|
@@ -6369,7 +6369,7 @@ Check the request and return the details.
|
|
|
6369
6369
|
},
|
|
6370
6370
|
required: ["text"]
|
|
6371
6371
|
}
|
|
6372
|
-
}], u = await this.builder.send(a, o,
|
|
6372
|
+
}], u = await this.builder.send(a, o, n, "", d);
|
|
6373
6373
|
if (!u)
|
|
6374
6374
|
return !1;
|
|
6375
6375
|
let l = JSON.parse(u);
|
|
@@ -6381,12 +6381,12 @@ Check the request and return the details.
|
|
|
6381
6381
|
return !1;
|
|
6382
6382
|
}
|
|
6383
6383
|
async checkModel(e) {
|
|
6384
|
-
let t = "You are an assistant", i = "",
|
|
6384
|
+
let t = "You are an assistant", i = "", s = `This is the information:
|
|
6385
6385
|
|
|
6386
6386
|
${e}
|
|
6387
6387
|
|
|
6388
6388
|
Check the information and return the details.
|
|
6389
|
-
`,
|
|
6389
|
+
`, n = [{
|
|
6390
6390
|
name: "check_request",
|
|
6391
6391
|
description: "Check information.",
|
|
6392
6392
|
parameters: {
|
|
@@ -6399,7 +6399,7 @@ Check the information and return the details.
|
|
|
6399
6399
|
},
|
|
6400
6400
|
required: ["model"]
|
|
6401
6401
|
}
|
|
6402
|
-
}], r = await this.builder.send(
|
|
6402
|
+
}], r = await this.builder.send(s, i, t, "", n);
|
|
6403
6403
|
return r ? JSON.parse(r) : !1;
|
|
6404
6404
|
}
|
|
6405
6405
|
getDimension(e) {
|
|
@@ -6434,11 +6434,11 @@ Check the information and return the details.
|
|
|
6434
6434
|
*/
|
|
6435
6435
|
getEndpoint(e, t, i) {
|
|
6436
6436
|
i = i.replace("{REQUEST_ID}", t);
|
|
6437
|
-
let
|
|
6438
|
-
return i = i.replace("{MODEL}",
|
|
6437
|
+
let s = e.split("/").slice(0, 2).join("/");
|
|
6438
|
+
return i = i.replace("{MODEL}", s), i;
|
|
6439
6439
|
}
|
|
6440
|
-
async waitingResultFal(e, t, i,
|
|
6441
|
-
let
|
|
6440
|
+
async waitingResultFal(e, t, i, s) {
|
|
6441
|
+
let n, r;
|
|
6442
6442
|
e.request_id = t;
|
|
6443
6443
|
const o = this.getEndpoint(e.model, t, this.builder.settings.falResultEndpoint);
|
|
6444
6444
|
e.endpoint = o;
|
|
@@ -6446,13 +6446,13 @@ Check the information and return the details.
|
|
|
6446
6446
|
"Content-Type": "application/json",
|
|
6447
6447
|
...this.builder.settings.headers
|
|
6448
6448
|
};
|
|
6449
|
-
|
|
6449
|
+
n = await fetch(this.builder.settings.getResultUrl_Fal, {
|
|
6450
6450
|
signal: this.builder.mediaSignal,
|
|
6451
6451
|
method: "POST",
|
|
6452
6452
|
headers: a,
|
|
6453
6453
|
body: JSON.stringify(e)
|
|
6454
6454
|
});
|
|
6455
|
-
let d = await
|
|
6455
|
+
let d = await n.text();
|
|
6456
6456
|
try {
|
|
6457
6457
|
r = JSON.parse(d);
|
|
6458
6458
|
} catch {
|
|
@@ -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 u == "string" && (l = u, h = u),
|
|
6499
|
+
}), b && (l = `<div class="image-container">${l}</div>`), typeof u == "string" && (l = u, h = u), 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,
|
|
@@ -6505,8 +6505,8 @@ Check the information and return the details.
|
|
|
6505
6505
|
};
|
|
6506
6506
|
}
|
|
6507
6507
|
}
|
|
6508
|
-
async waitingResultReplicate(e, t, i,
|
|
6509
|
-
let
|
|
6508
|
+
async waitingResultReplicate(e, t, i, s) {
|
|
6509
|
+
let n, r;
|
|
6510
6510
|
e.request_id = t;
|
|
6511
6511
|
let o = this.builder.settings.replicateStatusEndpoint;
|
|
6512
6512
|
o = o.replace("{REQUEST_ID}", t), e.endpoint = o;
|
|
@@ -6514,13 +6514,13 @@ Check the information and return the details.
|
|
|
6514
6514
|
"Content-Type": "application/json",
|
|
6515
6515
|
...this.builder.settings.headers
|
|
6516
6516
|
};
|
|
6517
|
-
|
|
6517
|
+
n = await fetch(this.builder.settings.getResultUrl_Replicate, {
|
|
6518
6518
|
signal: this.builder.mediaSignal,
|
|
6519
6519
|
method: "POST",
|
|
6520
6520
|
headers: a,
|
|
6521
6521
|
body: JSON.stringify(e)
|
|
6522
6522
|
});
|
|
6523
|
-
let d = await
|
|
6523
|
+
let d = await n.text();
|
|
6524
6524
|
try {
|
|
6525
6525
|
r = JSON.parse(d);
|
|
6526
6526
|
} catch {
|
|
@@ -6539,7 +6539,7 @@ Check the information and return the details.
|
|
|
6539
6539
|
};
|
|
6540
6540
|
{
|
|
6541
6541
|
const u = r.data;
|
|
6542
|
-
let l = this.renderResult(u, i,
|
|
6542
|
+
let l = this.renderResult(u, i, s);
|
|
6543
6543
|
return {
|
|
6544
6544
|
mediaGenerated: !0,
|
|
6545
6545
|
status: "success",
|
|
@@ -6549,8 +6549,8 @@ Check the information and return the details.
|
|
|
6549
6549
|
};
|
|
6550
6550
|
}
|
|
6551
6551
|
}
|
|
6552
|
-
async waitingReplicate(e, t, i,
|
|
6553
|
-
let
|
|
6552
|
+
async waitingReplicate(e, t, i, s) {
|
|
6553
|
+
let n, r, o, a = e.model, d = this.builder.settings.replicateStatusEndpoint;
|
|
6554
6554
|
d = d.replace("{REQUEST_ID}", t);
|
|
6555
6555
|
let u = {
|
|
6556
6556
|
"Content-Type": "application/json",
|
|
@@ -6567,7 +6567,7 @@ Check the information and return the details.
|
|
|
6567
6567
|
method: "POST",
|
|
6568
6568
|
headers: u,
|
|
6569
6569
|
body: JSON.stringify(l)
|
|
6570
|
-
}), o = await r.json(), o.ok && (
|
|
6570
|
+
}), o = await r.json(), o.ok && (n = o.data.status), !n)
|
|
6571
6571
|
return {
|
|
6572
6572
|
mediaGenerated: !1,
|
|
6573
6573
|
status: "error",
|
|
@@ -6575,9 +6575,9 @@ Check the information and return the details.
|
|
|
6575
6575
|
// for future debugging
|
|
6576
6576
|
message: o.error || o.data && JSON.stringify(o.data) || this.out("Request failed.")
|
|
6577
6577
|
};
|
|
6578
|
-
|
|
6579
|
-
} while (!(
|
|
6580
|
-
return
|
|
6578
|
+
n === "succeeded" || n === "failed" || n === "canceled" || (this.builder.settings.consoleLog && console.log(n), await new Promise((h) => setTimeout(h, 5e3)));
|
|
6579
|
+
} while (!(n === "succeeded" || n === "failed" || n === "canceled"));
|
|
6580
|
+
return n === "succeeded" ? await this.waitingResultReplicate(e, t, i, s) : {
|
|
6581
6581
|
mediaGenerated: !1,
|
|
6582
6582
|
status: "error",
|
|
6583
6583
|
result: o,
|
|
@@ -6585,8 +6585,8 @@ Check the information and return the details.
|
|
|
6585
6585
|
message: o.data && o.data.error || this.out("Request failed.")
|
|
6586
6586
|
};
|
|
6587
6587
|
}
|
|
6588
|
-
async waitingFal(e, t, i,
|
|
6589
|
-
let
|
|
6588
|
+
async waitingFal(e, t, i, s) {
|
|
6589
|
+
let n, r, o, a = e.model;
|
|
6590
6590
|
const d = this.getEndpoint(a, t, this.builder.settings.falStatusEndpoint);
|
|
6591
6591
|
let u = {
|
|
6592
6592
|
"Content-Type": "application/json",
|
|
@@ -6604,12 +6604,12 @@ Check the information and return the details.
|
|
|
6604
6604
|
headers: u,
|
|
6605
6605
|
body: JSON.stringify(l)
|
|
6606
6606
|
}), o = await r.json(), o.ok && o.status)
|
|
6607
|
-
|
|
6607
|
+
n = o.status;
|
|
6608
6608
|
else if (o.data) {
|
|
6609
6609
|
let h = o.data;
|
|
6610
|
-
h.image || h.audio || h.audio_file || h.video ?
|
|
6610
|
+
h.image || h.audio || h.audio_file || h.video ? n = "COMPLETED" : h.detail && typeof h.detail == "string" && h.detail.startsWith("Request is still in progress") ? n = "IN_PROGRESS" : h.status && !h.error && (n = h.status);
|
|
6611
6611
|
}
|
|
6612
|
-
if (!
|
|
6612
|
+
if (!n)
|
|
6613
6613
|
return {
|
|
6614
6614
|
mediaGenerated: !1,
|
|
6615
6615
|
status: "error",
|
|
@@ -6617,31 +6617,31 @@ Check the information and return the details.
|
|
|
6617
6617
|
// for future debugging
|
|
6618
6618
|
message: o.error || o.data && JSON.stringify(o.data) || this.out("Request failed.")
|
|
6619
6619
|
};
|
|
6620
|
-
|
|
6621
|
-
} while (
|
|
6622
|
-
if (
|
|
6623
|
-
return await this.waitingResultFal(e, t, i,
|
|
6620
|
+
n !== "COMPLETED" && (this.builder.settings.consoleLog && console.log(n), this.builder.settings.consoleLog && console.log(o), await new Promise((h) => setTimeout(h, 5e3)));
|
|
6621
|
+
} while (n !== "COMPLETED");
|
|
6622
|
+
if (n === "COMPLETED")
|
|
6623
|
+
return await this.waitingResultFal(e, t, i, s);
|
|
6624
6624
|
}
|
|
6625
6625
|
renderResult(e, t, i) {
|
|
6626
|
-
let
|
|
6626
|
+
let s = "", n = "", r = [], o = [];
|
|
6627
6627
|
if (e.entries) {
|
|
6628
6628
|
let a, d = !1;
|
|
6629
6629
|
e.entries.forEach((u) => {
|
|
6630
|
-
a = u.url.split(".").pop().toLowerCase(), a === "mp4" ? (
|
|
6630
|
+
a = u.url.split(".").pop().toLowerCase(), a === "mp4" ? (s += `
|
|
6631
6631
|
<p class="responsive-video">
|
|
6632
6632
|
<video controls>
|
|
6633
6633
|
<source src="${u.url}" type="video/mp4">
|
|
6634
6634
|
Your browser does not support the video tag.
|
|
6635
6635
|
</video>
|
|
6636
6636
|
</p>
|
|
6637
|
-
`,
|
|
6637
|
+
`, n += ``, r.push(u.url), o.push(u.file_url)) : a === "wav" || a === "mp3" ? (s += `
|
|
6638
6638
|
<p class="responsive-audio">
|
|
6639
6639
|
<audio controls>
|
|
6640
6640
|
<source src="${u.url}" type="audio/mpeg">
|
|
6641
6641
|
Your browser does not support the audio tag.
|
|
6642
6642
|
</audio>
|
|
6643
6643
|
</p>
|
|
6644
|
-
`,
|
|
6644
|
+
`, n += ``, r.push(u.url), o.push(u.file_url)) : (s += `
|
|
6645
6645
|
<div>
|
|
6646
6646
|
<img src="${u.url}" />
|
|
6647
6647
|
<div>
|
|
@@ -6649,20 +6649,20 @@ Check the information and return the details.
|
|
|
6649
6649
|
<a class="link-download" href="${u.url}" download>${this.out("Download")}</a>
|
|
6650
6650
|
</div>
|
|
6651
6651
|
</div>
|
|
6652
|
-
`,
|
|
6653
|
-
}), d && (
|
|
6654
|
-
} else typeof e == "string" && (
|
|
6652
|
+
`, n += ``, r.push(u.url), o.push(u.file_url), d = !0);
|
|
6653
|
+
}), d && (s = `<div class="image-container">${s}</div>`);
|
|
6654
|
+
} else typeof e == "string" && (s = `
|
|
6655
6655
|
<p>
|
|
6656
6656
|
${e}
|
|
6657
|
-
</p>`,
|
|
6658
|
-
return i ? (t.innerHTML = "", t.remove()) : (t.innerHTML =
|
|
6659
|
-
markdown:
|
|
6657
|
+
</p>`, n = e);
|
|
6658
|
+
return i ? (t.innerHTML = "", t.remove()) : (t.innerHTML = s, this.builder.outputHtml += `<div class="result-container">${s}</div>`), {
|
|
6659
|
+
markdown: n,
|
|
6660
6660
|
output: r,
|
|
6661
6661
|
output2: o
|
|
6662
6662
|
};
|
|
6663
6663
|
}
|
|
6664
6664
|
async generateReplicate(e, t, i) {
|
|
6665
|
-
let
|
|
6665
|
+
let s, n = {};
|
|
6666
6666
|
const r = "replicate";
|
|
6667
6667
|
if (e.text_to_image_generation) {
|
|
6668
6668
|
let a = this.validateModel(e.model, r, "text_to_image_generation");
|
|
@@ -6680,11 +6680,11 @@ Check the information and return the details.
|
|
|
6680
6680
|
message: this.out("Please input a prompt.")
|
|
6681
6681
|
};
|
|
6682
6682
|
let u = e.aspect_ratio || "16:9", l = e.num_images || 1;
|
|
6683
|
-
l > 4 && (l = 4),
|
|
6683
|
+
l > 4 && (l = 4), s = {
|
|
6684
6684
|
prompt: d,
|
|
6685
6685
|
aspect_ratio: u,
|
|
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) {
|
|
6689
6689
|
let a = this.validateModel(e.model, l, "edit_area_in_image");
|
|
6690
6690
|
if (!a)
|
|
@@ -6721,12 +6721,12 @@ Check the information and return the details.
|
|
|
6721
6721
|
status: "error",
|
|
6722
6722
|
message: this.out("Image mask not found.")
|
|
6723
6723
|
};
|
|
6724
|
-
|
|
6724
|
+
s = {
|
|
6725
6725
|
prompt: d,
|
|
6726
6726
|
image: p,
|
|
6727
6727
|
mask: b
|
|
6728
6728
|
// num_images,
|
|
6729
|
-
},
|
|
6729
|
+
}, n.model = a, n.customData = this.builder.settings.customData;
|
|
6730
6730
|
} else if (e.text_to_digital_illustration_generation) {
|
|
6731
6731
|
let a = this.validateModel(e.model, r, "text_to_digital_illustration_generation");
|
|
6732
6732
|
if (!a)
|
|
@@ -6743,14 +6743,14 @@ Check the information and return the details.
|
|
|
6743
6743
|
message: this.out("Please input a prompt.")
|
|
6744
6744
|
};
|
|
6745
6745
|
let u = e.width || 1280, l = e.height || 768;
|
|
6746
|
-
e.num_images,
|
|
6746
|
+
e.num_images, s = {
|
|
6747
6747
|
prompt: d,
|
|
6748
6748
|
size: `${u}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
6755
|
let a = this.validateModel(e.model, u, "upscale_image");
|
|
6756
6756
|
if (!a)
|
|
@@ -6780,10 +6780,10 @@ Check the information and return the details.
|
|
|
6780
6780
|
status: "error",
|
|
6781
6781
|
message: this.out("Image not provided.")
|
|
6782
6782
|
};
|
|
6783
|
-
|
|
6783
|
+
s = {
|
|
6784
6784
|
image: h
|
|
6785
6785
|
// scale_factor: 2,
|
|
6786
|
-
},
|
|
6786
|
+
}, n.model = a, n.customData = this.builder.settings.customData;
|
|
6787
6787
|
} else if (e.describe_image) {
|
|
6788
6788
|
let a = this.validateModel(e.model, l, "describe_image");
|
|
6789
6789
|
if (!a)
|
|
@@ -6820,10 +6820,10 @@ Check the information and return the details.
|
|
|
6820
6820
|
status: "error",
|
|
6821
6821
|
message: this.out("Image not provided.")
|
|
6822
6822
|
};
|
|
6823
|
-
|
|
6823
|
+
s = {
|
|
6824
6824
|
image: p,
|
|
6825
6825
|
prompt: `${d}. 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");
|
|
6829
6829
|
if (!a)
|
|
@@ -6849,21 +6849,21 @@ Check the information and return the details.
|
|
|
6849
6849
|
status: "error",
|
|
6850
6850
|
message: this.out("Image reference not found.")
|
|
6851
6851
|
};
|
|
6852
|
-
a === "kwaivgi/kling-v1.6-pro" && (
|
|
6852
|
+
a === "kwaivgi/kling-v1.6-pro" && (s = {
|
|
6853
6853
|
start_image: p,
|
|
6854
6854
|
prompt: d,
|
|
6855
6855
|
duration: u
|
|
6856
|
-
}), a === "kwaivgi/kling-v1.6-standard" && (
|
|
6856
|
+
}), a === "kwaivgi/kling-v1.6-standard" && (s = {
|
|
6857
6857
|
start_image: p,
|
|
6858
6858
|
prompt: d,
|
|
6859
6859
|
duration: u
|
|
6860
|
-
}), a === "minimax/video-01-live" && (
|
|
6860
|
+
}), a === "minimax/video-01-live" && (s = {
|
|
6861
6861
|
first_frame_image: p,
|
|
6862
6862
|
prompt: d
|
|
6863
|
-
}), a === "luma/ray" && (
|
|
6863
|
+
}), a === "luma/ray" && (s = {
|
|
6864
6864
|
start_image_url: p,
|
|
6865
6865
|
prompt: d
|
|
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");
|
|
6869
6869
|
if (!a)
|
|
@@ -6880,14 +6880,14 @@ Check the information and return the details.
|
|
|
6880
6880
|
message: this.out("Please input a prompt.")
|
|
6881
6881
|
};
|
|
6882
6882
|
let u = e.duration || 5;
|
|
6883
|
-
u > 10 && (u = 5), a === "kwaivgi/kling-v1.6-standard" && (
|
|
6883
|
+
u > 10 && (u = 5), a === "kwaivgi/kling-v1.6-standard" && (s = {
|
|
6884
6884
|
prompt: d,
|
|
6885
6885
|
duration: u
|
|
6886
|
-
}), a === "minimax/video-01" && (
|
|
6886
|
+
}), a === "minimax/video-01" && (s = {
|
|
6887
6887
|
prompt: d
|
|
6888
|
-
}), a === "luma/ray" && (
|
|
6888
|
+
}), a === "luma/ray" && (s = {
|
|
6889
6889
|
prompt: d
|
|
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");
|
|
6893
6893
|
if (!a)
|
|
@@ -6902,22 +6902,22 @@ Check the information and return the details.
|
|
|
6902
6902
|
status: "error",
|
|
6903
6903
|
message: this.out("The text exceeds the allowed limit.")
|
|
6904
6904
|
};
|
|
6905
|
-
|
|
6905
|
+
s = {
|
|
6906
6906
|
text: e.text,
|
|
6907
6907
|
voice: e.voice || "af_nicole",
|
|
6908
6908
|
speed: parseFloat(e.speed) || 1
|
|
6909
|
-
},
|
|
6909
|
+
}, n.model = a, n.customData = this.builder.settings.customData;
|
|
6910
6910
|
}
|
|
6911
|
-
if (
|
|
6912
|
-
const d =
|
|
6913
|
-
|
|
6911
|
+
if (n.model.indexOf(":") !== -1) {
|
|
6912
|
+
const d = n.model.split(":")[1];
|
|
6913
|
+
n.version = d;
|
|
6914
6914
|
let u = this.builder.settings.replicateEndpoint1;
|
|
6915
|
-
|
|
6915
|
+
n.endpoint = u, n.payload = s, this.builder.settings.consoleLog && console.log("PAYLOAD 1");
|
|
6916
6916
|
} else {
|
|
6917
6917
|
let a = this.builder.settings.replicateEndpoint2;
|
|
6918
|
-
a = a.replace("{MODEL}",
|
|
6918
|
+
a = a.replace("{MODEL}", n.model), n.endpoint = a, n.payload = s, this.builder.settings.consoleLog && console.log("PAYLOAD 2");
|
|
6919
6919
|
}
|
|
6920
|
-
this.builder.payloads.push(
|
|
6920
|
+
this.builder.payloads.push(n), this.builder.settings.consoleLog && console.log(n);
|
|
6921
6921
|
let o = !1;
|
|
6922
6922
|
if (this.builder.settings.generateMediaUrl_Replicate && (o = !0), o) {
|
|
6923
6923
|
let a = this.builder.settings.generateMediaUrl_Replicate;
|
|
@@ -6934,7 +6934,7 @@ Check the information and return the details.
|
|
|
6934
6934
|
signal: this.builder.mediaSignal,
|
|
6935
6935
|
method: "POST",
|
|
6936
6936
|
headers: u,
|
|
6937
|
-
body: JSON.stringify(
|
|
6937
|
+
body: JSON.stringify(n)
|
|
6938
6938
|
})).json();
|
|
6939
6939
|
if (h.ok) {
|
|
6940
6940
|
if (d = h.data.id, !d)
|
|
@@ -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(
|
|
6952
|
+
const p = this.waitingReplicate(n, d, t, i);
|
|
6953
6953
|
return this.builder.isMediaGenerating = !1, p;
|
|
6954
6954
|
} else {
|
|
6955
6955
|
let a = this.builder.settings.generateMediaUrl;
|
|
@@ -6967,7 +6967,7 @@ Check the information and return the details.
|
|
|
6967
6967
|
signal: this.builder.mediaSignal,
|
|
6968
6968
|
method: "POST",
|
|
6969
6969
|
headers: d,
|
|
6970
|
-
body: JSON.stringify(
|
|
6970
|
+
body: JSON.stringify(n)
|
|
6971
6971
|
})).json();
|
|
6972
6972
|
if (this.builder.isMediaGenerating = !1, l.error)
|
|
6973
6973
|
return this.builder.settings.consoleLog && console.log(l.error), {
|
|
@@ -6990,7 +6990,7 @@ Check the information and return the details.
|
|
|
6990
6990
|
}
|
|
6991
6991
|
}
|
|
6992
6992
|
async generateOpenAI(e, t, i) {
|
|
6993
|
-
let
|
|
6993
|
+
let s, n = {}, o = this.validateModel(e.model, "openai", "image_generation"), a = e.prompt;
|
|
6994
6994
|
if (!a)
|
|
6995
6995
|
return {
|
|
6996
6996
|
mediaGenerated: !1,
|
|
@@ -7026,12 +7026,12 @@ Check the information and return the details.
|
|
|
7026
7026
|
}
|
|
7027
7027
|
let h, p = e.size || "auto", b = e.quality || "auto", w = e.num_images || 1;
|
|
7028
7028
|
if (u) {
|
|
7029
|
-
d.append("size", p), d.append("n", w), d.append("quality", b),
|
|
7029
|
+
d.append("size", p), d.append("n", w), d.append("quality", b), s = {
|
|
7030
7030
|
prompt: a,
|
|
7031
7031
|
size: p,
|
|
7032
7032
|
quality: b,
|
|
7033
7033
|
n: w
|
|
7034
|
-
},
|
|
7034
|
+
}, n.model = o, n.customData = this.builder.settings.customData, n.payload = s, this.builder.payloads.push(n);
|
|
7035
7035
|
let f = this.builder.settings.generateMediaUrl_OpenAI_CreateImageEdit;
|
|
7036
7036
|
h = await fetch(f, {
|
|
7037
7037
|
method: "POST",
|
|
@@ -7039,14 +7039,14 @@ Check the information and return the details.
|
|
|
7039
7039
|
});
|
|
7040
7040
|
} else {
|
|
7041
7041
|
let f = e.background || "auto", m = e.output_format || "png";
|
|
7042
|
-
|
|
7042
|
+
s = {
|
|
7043
7043
|
prompt: a,
|
|
7044
7044
|
background: f,
|
|
7045
7045
|
output_format: m,
|
|
7046
7046
|
size: p,
|
|
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
7050
|
const y = this.builder.settings.generateMediaUrl_OpenAI_CreateImage;
|
|
7051
7051
|
let k = {
|
|
7052
7052
|
"Content-Type": "application/json",
|
|
@@ -7056,7 +7056,7 @@ Check the information and return the details.
|
|
|
7056
7056
|
signal: this.builder.mediaSignal,
|
|
7057
7057
|
method: "POST",
|
|
7058
7058
|
headers: k,
|
|
7059
|
-
body: JSON.stringify(
|
|
7059
|
+
body: JSON.stringify(n)
|
|
7060
7060
|
});
|
|
7061
7061
|
}
|
|
7062
7062
|
const _ = await h.json();
|
|
@@ -7073,7 +7073,7 @@ Check the information and return the details.
|
|
|
7073
7073
|
};
|
|
7074
7074
|
}
|
|
7075
7075
|
async generateGoogle(e, t, i) {
|
|
7076
|
-
let
|
|
7076
|
+
let s, n = {}, o = this.validateModel(e.model, "google", "edit_area_in_image");
|
|
7077
7077
|
if (!o)
|
|
7078
7078
|
return {
|
|
7079
7079
|
mediaGenerated: !1,
|
|
@@ -7114,9 +7114,9 @@ Check the information and return the details.
|
|
|
7114
7114
|
}
|
|
7115
7115
|
}
|
|
7116
7116
|
}
|
|
7117
|
-
|
|
7117
|
+
s = {
|
|
7118
7118
|
contents: d
|
|
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 = {
|
|
7122
7122
|
"Content-Type": "application/json",
|
|
@@ -7126,7 +7126,7 @@ Check the information and return the details.
|
|
|
7126
7126
|
signal: this.builder.mediaSignal,
|
|
7127
7127
|
method: "POST",
|
|
7128
7128
|
headers: h,
|
|
7129
|
-
body: JSON.stringify(
|
|
7129
|
+
body: JSON.stringify(n)
|
|
7130
7130
|
})).json();
|
|
7131
7131
|
this.builder.settings.consoleLog && console.log(b), this.builder.isMediaGenerating = !1;
|
|
7132
7132
|
const w = b.data;
|
|
@@ -7140,9 +7140,9 @@ Check the information and return the details.
|
|
|
7140
7140
|
};
|
|
7141
7141
|
}
|
|
7142
7142
|
async generateFal(e, t, i) {
|
|
7143
|
-
let
|
|
7143
|
+
let s = "fal", n, r = {};
|
|
7144
7144
|
if (e.text_to_image_generation) {
|
|
7145
|
-
let b = this.validateModel(e.model,
|
|
7145
|
+
let b = this.validateModel(e.model, s, "text_to_image_generation");
|
|
7146
7146
|
if (!b)
|
|
7147
7147
|
return {
|
|
7148
7148
|
mediaGenerated: !1,
|
|
@@ -7211,21 +7211,21 @@ Check the information and return the details.
|
|
|
7211
7211
|
}
|
|
7212
7212
|
return U;
|
|
7213
7213
|
})();
|
|
7214
|
-
|
|
7214
|
+
n = {
|
|
7215
7215
|
prompt: w,
|
|
7216
7216
|
image_size: {
|
|
7217
7217
|
width: _,
|
|
7218
7218
|
height: g
|
|
7219
7219
|
},
|
|
7220
7220
|
num_images: f
|
|
7221
|
-
}, b.indexOf("gemini") !== -1 && (
|
|
7221
|
+
}, b.indexOf("gemini") !== -1 && (n = {
|
|
7222
7222
|
prompt: w,
|
|
7223
7223
|
input_image_urls: N
|
|
7224
|
-
}), b === "fal-ai/ideogram/v2a" && (v = this.getClosestAspectRatio(_, g),
|
|
7224
|
+
}), b === "fal-ai/ideogram/v2a" && (v = this.getClosestAspectRatio(_, g), n = {
|
|
7225
7225
|
prompt: w,
|
|
7226
7226
|
aspect_ratio: v,
|
|
7227
7227
|
num_images: f
|
|
7228
|
-
}), b.indexOf("recraft") !== -1 && (
|
|
7228
|
+
}), b.indexOf("recraft") !== -1 && (n = {
|
|
7229
7229
|
prompt: w,
|
|
7230
7230
|
image_size: {
|
|
7231
7231
|
width: _,
|
|
@@ -7236,7 +7236,7 @@ Check the information and return the details.
|
|
|
7236
7236
|
colors: T
|
|
7237
7237
|
}), r.model = b, r.customData = this.builder.settings.customData;
|
|
7238
7238
|
} else if (e.edit_area_in_image) {
|
|
7239
|
-
let b = this.validateModel(e.model,
|
|
7239
|
+
let b = this.validateModel(e.model, s, "edit_area_in_image");
|
|
7240
7240
|
if (!b)
|
|
7241
7241
|
return {
|
|
7242
7242
|
mediaGenerated: !1,
|
|
@@ -7256,7 +7256,7 @@ Check the information and return the details.
|
|
|
7256
7256
|
status: "error",
|
|
7257
7257
|
message: this.out("Image reference not found.")
|
|
7258
7258
|
};
|
|
7259
|
-
const g = await this.builder.upload.getInputURLs(
|
|
7259
|
+
const g = await this.builder.upload.getInputURLs(s);
|
|
7260
7260
|
if (g.error)
|
|
7261
7261
|
return {
|
|
7262
7262
|
mediaGenerated: !1,
|
|
@@ -7264,22 +7264,22 @@ Check the information and return the details.
|
|
|
7264
7264
|
message: g.error
|
|
7265
7265
|
};
|
|
7266
7266
|
let v = g[e.image_url], f = g[e.image_url + "_mask"];
|
|
7267
|
-
if (
|
|
7267
|
+
if (n = {
|
|
7268
7268
|
image_url: v,
|
|
7269
7269
|
mask_url: f,
|
|
7270
7270
|
prompt: w
|
|
7271
7271
|
// num_images,
|
|
7272
7272
|
}, r.model = b, !f) {
|
|
7273
|
-
|
|
7273
|
+
n = {
|
|
7274
7274
|
image_url: v,
|
|
7275
7275
|
prompt: w
|
|
7276
7276
|
};
|
|
7277
|
-
let m = this.validateModel(e.model,
|
|
7277
|
+
let m = this.validateModel(e.model, s, "edit_image");
|
|
7278
7278
|
r.model = m;
|
|
7279
7279
|
}
|
|
7280
7280
|
r.customData = this.builder.settings.customData;
|
|
7281
7281
|
} else if (e.text_to_2d_illustration_generation) {
|
|
7282
|
-
let b = this.validateModel(e.model,
|
|
7282
|
+
let b = this.validateModel(e.model, s, "text_to_2d_illustration_generation");
|
|
7283
7283
|
if (!b)
|
|
7284
7284
|
return {
|
|
7285
7285
|
mediaGenerated: !1,
|
|
@@ -7316,7 +7316,7 @@ Check the information and return the details.
|
|
|
7316
7316
|
r: q,
|
|
7317
7317
|
g: M,
|
|
7318
7318
|
b: T
|
|
7319
|
-
}),
|
|
7319
|
+
}), n = {
|
|
7320
7320
|
prompt: w,
|
|
7321
7321
|
image_size: {
|
|
7322
7322
|
width: _,
|
|
@@ -7328,7 +7328,7 @@ Check the information and return the details.
|
|
|
7328
7328
|
colors: $
|
|
7329
7329
|
}, r.model = b, r.customData = this.builder.settings.customData;
|
|
7330
7330
|
} else if (e.text_to_digital_illustration_generation) {
|
|
7331
|
-
let b = this.validateModel(e.model,
|
|
7331
|
+
let b = this.validateModel(e.model, s, "text_to_digital_illustration_generation");
|
|
7332
7332
|
if (!b)
|
|
7333
7333
|
return {
|
|
7334
7334
|
mediaGenerated: !1,
|
|
@@ -7365,7 +7365,7 @@ Check the information and return the details.
|
|
|
7365
7365
|
r: R,
|
|
7366
7366
|
g: q,
|
|
7367
7367
|
b: M
|
|
7368
|
-
}),
|
|
7368
|
+
}), n = {
|
|
7369
7369
|
prompt: w,
|
|
7370
7370
|
image_size: {
|
|
7371
7371
|
width: _,
|
|
@@ -7377,7 +7377,7 @@ Check the information and return the details.
|
|
|
7377
7377
|
colors: T
|
|
7378
7378
|
}, r.model = b, r.customData = this.builder.settings.customData;
|
|
7379
7379
|
} else if (e.text_to_book_cover_generation) {
|
|
7380
|
-
let b = this.validateModel(e.model,
|
|
7380
|
+
let b = this.validateModel(e.model, s, "text_to_book_cover_generation");
|
|
7381
7381
|
if (!b)
|
|
7382
7382
|
return {
|
|
7383
7383
|
mediaGenerated: !1,
|
|
@@ -7414,7 +7414,7 @@ Check the information and return the details.
|
|
|
7414
7414
|
r: R,
|
|
7415
7415
|
g: q,
|
|
7416
7416
|
b: M
|
|
7417
|
-
}),
|
|
7417
|
+
}), n = {
|
|
7418
7418
|
prompt: w,
|
|
7419
7419
|
image_size: {
|
|
7420
7420
|
width: _,
|
|
@@ -7426,7 +7426,7 @@ Check the information and return the details.
|
|
|
7426
7426
|
colors: T
|
|
7427
7427
|
}, r.model = b, r.customData = this.builder.settings.customData;
|
|
7428
7428
|
} else if (e.upscale_image) {
|
|
7429
|
-
let b = this.validateModel(e.model,
|
|
7429
|
+
let b = this.validateModel(e.model, s, "upscale_image");
|
|
7430
7430
|
if (!b)
|
|
7431
7431
|
return {
|
|
7432
7432
|
mediaGenerated: !1,
|
|
@@ -7439,7 +7439,7 @@ Check the information and return the details.
|
|
|
7439
7439
|
status: "error",
|
|
7440
7440
|
message: this.out("Image reference not found.")
|
|
7441
7441
|
};
|
|
7442
|
-
const _ = await this.builder.upload.getInputURLs(
|
|
7442
|
+
const _ = await this.builder.upload.getInputURLs(s);
|
|
7443
7443
|
if (_.error)
|
|
7444
7444
|
return {
|
|
7445
7445
|
mediaGenerated: !1,
|
|
@@ -7453,12 +7453,12 @@ Check the information and return the details.
|
|
|
7453
7453
|
status: "error",
|
|
7454
7454
|
message: this.out("Image not provided.")
|
|
7455
7455
|
};
|
|
7456
|
-
|
|
7456
|
+
n = {
|
|
7457
7457
|
image_url: g,
|
|
7458
7458
|
upscale_factor: 2
|
|
7459
7459
|
}, r.model = b, r.customData = this.builder.settings.customData;
|
|
7460
7460
|
} else if (e.describe_image) {
|
|
7461
|
-
let b = this.validateModel(e.model,
|
|
7461
|
+
let b = this.validateModel(e.model, s, "describe_image");
|
|
7462
7462
|
if (!b)
|
|
7463
7463
|
return {
|
|
7464
7464
|
mediaGenerated: !1,
|
|
@@ -7478,7 +7478,7 @@ Check the information and return the details.
|
|
|
7478
7478
|
status: "error",
|
|
7479
7479
|
message: this.out("Image reference not found.")
|
|
7480
7480
|
};
|
|
7481
|
-
const g = await this.builder.upload.getInputURLs(
|
|
7481
|
+
const g = await this.builder.upload.getInputURLs(s);
|
|
7482
7482
|
if (g.error)
|
|
7483
7483
|
return {
|
|
7484
7484
|
mediaGenerated: !1,
|
|
@@ -7492,12 +7492,12 @@ Check the information and return the details.
|
|
|
7492
7492
|
status: "error",
|
|
7493
7493
|
message: this.out("Image not provided.")
|
|
7494
7494
|
};
|
|
7495
|
-
|
|
7495
|
+
n = {
|
|
7496
7496
|
image_url: v,
|
|
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) {
|
|
7500
|
-
let b = this.validateModel(e.model,
|
|
7500
|
+
let b = this.validateModel(e.model, s, "image_to_video_generation");
|
|
7501
7501
|
if (!b)
|
|
7502
7502
|
return {
|
|
7503
7503
|
mediaGenerated: !1,
|
|
@@ -7508,7 +7508,7 @@ Check the information and return the details.
|
|
|
7508
7508
|
w = e.prompt || "stunning video";
|
|
7509
7509
|
let _ = e.duration || 5;
|
|
7510
7510
|
_ > 10 && (_ = 5);
|
|
7511
|
-
const g = await this.builder.upload.getInputURLs(
|
|
7511
|
+
const g = await this.builder.upload.getInputURLs(s);
|
|
7512
7512
|
if (g.error)
|
|
7513
7513
|
return {
|
|
7514
7514
|
mediaGenerated: !1,
|
|
@@ -7522,15 +7522,15 @@ Check the information and return the details.
|
|
|
7522
7522
|
status: "error",
|
|
7523
7523
|
message: this.out("Image reference not found.")
|
|
7524
7524
|
};
|
|
7525
|
-
|
|
7525
|
+
n = {
|
|
7526
7526
|
prompt: w,
|
|
7527
7527
|
image_url: v,
|
|
7528
7528
|
duration: _,
|
|
7529
7529
|
aspect_ratio: "16:9"
|
|
7530
7530
|
// 9:16, 1:1
|
|
7531
|
-
}, b.indexOf("fal-ai/luma-dream-machine") !== -1 && delete
|
|
7531
|
+
}, b.indexOf("fal-ai/luma-dream-machine") !== -1 && delete n.duration, r.model = b, r.customData = this.builder.settings.customData;
|
|
7532
7532
|
} else if (e.text_to_video_generation) {
|
|
7533
|
-
let b = this.validateModel(e.model,
|
|
7533
|
+
let b = this.validateModel(e.model, s, "text_to_video_generation");
|
|
7534
7534
|
if (!b)
|
|
7535
7535
|
return {
|
|
7536
7536
|
mediaGenerated: !1,
|
|
@@ -7545,14 +7545,14 @@ Check the information and return the details.
|
|
|
7545
7545
|
message: this.out("Please input a prompt.")
|
|
7546
7546
|
};
|
|
7547
7547
|
let _ = e.duration || 5;
|
|
7548
|
-
_ > 10 && (_ = 5),
|
|
7548
|
+
_ > 10 && (_ = 5), n = {
|
|
7549
7549
|
prompt: w,
|
|
7550
7550
|
duration: _,
|
|
7551
7551
|
aspect_ratio: "16:9"
|
|
7552
7552
|
// 9:16, 1:1
|
|
7553
|
-
}, b.indexOf("fal-ai/luma-dream-machine") !== -1 && delete
|
|
7553
|
+
}, b.indexOf("fal-ai/luma-dream-machine") !== -1 && delete n.duration, r.model = b, r.customData = this.builder.settings.customData;
|
|
7554
7554
|
} else if (e.text_to_speech) {
|
|
7555
|
-
let b = this.validateModel(e.model,
|
|
7555
|
+
let b = this.validateModel(e.model, s, "text_to_speech");
|
|
7556
7556
|
if (!b)
|
|
7557
7557
|
return {
|
|
7558
7558
|
mediaGenerated: !1,
|
|
@@ -7565,14 +7565,14 @@ Check the information and return the details.
|
|
|
7565
7565
|
status: "error",
|
|
7566
7566
|
message: this.out("The text exceeds the allowed limit.")
|
|
7567
7567
|
};
|
|
7568
|
-
|
|
7568
|
+
n = {
|
|
7569
7569
|
text: e.text,
|
|
7570
7570
|
voice: e.voice || "Matilda"
|
|
7571
7571
|
// River
|
|
7572
7572
|
}, r.model = b, r.customData = this.builder.settings.customData;
|
|
7573
7573
|
}
|
|
7574
7574
|
let o = `https://queue.fal.run/${r.model}`;
|
|
7575
|
-
r.endpoint = o, r.payload =
|
|
7575
|
+
r.endpoint = o, r.payload = n, this.builder.payloads.push(r), this.builder.settings.consoleLog && console.log(r);
|
|
7576
7576
|
let a = this.builder.settings.generateMediaUrl_Fal;
|
|
7577
7577
|
if (!a)
|
|
7578
7578
|
return {
|
|
@@ -7602,15 +7602,15 @@ Check the information and return the details.
|
|
|
7602
7602
|
return this.builder.isMediaGenerating = !1, p;
|
|
7603
7603
|
}
|
|
7604
7604
|
validateModel(e, t, i) {
|
|
7605
|
-
const
|
|
7606
|
-
return this.builder.settings.modelFallback ?
|
|
7605
|
+
const n = this.builder.settings.defaultModels[i][t];
|
|
7606
|
+
return this.builder.settings.modelFallback ? n.length === 1 ? (this.builder.settings.consoleLog && console.log("Fixed model: " + n[0]), n[0]) : e && n && n.includes(e) ? (this.builder.settings.consoleLog && console.log("Model is valid: " + e), e) : n.length >= 1 ? (this.builder.settings.consoleLog && console.log("Use default: " + n[0]), n[0]) : !1 : e ? e && n && n.includes(e) ? (this.builder.settings.consoleLog && console.log("Model is valid: " + e), e) : !1 : (this.builder.settings.consoleLog && console.log("Fixed model: " + n[0]), n[0]);
|
|
7607
7607
|
}
|
|
7608
|
-
async generate_GoogleMediaByJSON(e, t, i,
|
|
7608
|
+
async generate_GoogleMediaByJSON(e, t, i, s) {
|
|
7609
7609
|
this.builder.isMediaGenerating = !0, this.mediaController = new AbortController(), this.builder.mediaSignal = this.mediaController.signal;
|
|
7610
|
-
let
|
|
7610
|
+
let n;
|
|
7611
7611
|
if (e.trim().startsWith("{"))
|
|
7612
7612
|
try {
|
|
7613
|
-
|
|
7613
|
+
n = JSON.parse(e);
|
|
7614
7614
|
} catch {
|
|
7615
7615
|
return {
|
|
7616
7616
|
mediaGenerated: !1,
|
|
@@ -7626,7 +7626,7 @@ Check the information and return the details.
|
|
|
7626
7626
|
message: this.out("Please provide model information in the context.")
|
|
7627
7627
|
};
|
|
7628
7628
|
let o = {};
|
|
7629
|
-
o.model = r, o.customData = this.builder.settings.customData, o.payload =
|
|
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
7631
|
let d = {
|
|
7632
7632
|
"Content-Type": "application/json",
|
|
@@ -7640,7 +7640,7 @@ Check the information and return the details.
|
|
|
7640
7640
|
})).json();
|
|
7641
7641
|
this.builder.settings.consoleLog && console.log(l);
|
|
7642
7642
|
const h = l.data;
|
|
7643
|
-
let p = this.renderResult(h, i,
|
|
7643
|
+
let p = this.renderResult(h, i, s);
|
|
7644
7644
|
return {
|
|
7645
7645
|
mediaGenerated: !0,
|
|
7646
7646
|
status: "success",
|
|
@@ -7653,8 +7653,8 @@ Check the information and return the details.
|
|
|
7653
7653
|
let e = [], t = this.builder.getFormValues();
|
|
7654
7654
|
for (const i of t)
|
|
7655
7655
|
if (i.value instanceof FileList && i.type === "multifile") {
|
|
7656
|
-
const
|
|
7657
|
-
if (
|
|
7656
|
+
const s = {};
|
|
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
7660
|
const a = this.builder.selectedFiles[o], d = new FormData();
|
|
@@ -7666,16 +7666,16 @@ Check the information and return the details.
|
|
|
7666
7666
|
})).json();
|
|
7667
7667
|
if (h.ok) {
|
|
7668
7668
|
const p = h.url;
|
|
7669
|
-
|
|
7669
|
+
s.files.push(p), this.builder.filesUploaded["file_" + o] = p;
|
|
7670
7670
|
}
|
|
7671
|
-
r.push(
|
|
7671
|
+
r.push(s);
|
|
7672
7672
|
}
|
|
7673
7673
|
return r;
|
|
7674
7674
|
}
|
|
7675
|
-
const
|
|
7676
|
-
if (
|
|
7675
|
+
const n = i.value;
|
|
7676
|
+
if (n.length > 0) {
|
|
7677
7677
|
let r = 0;
|
|
7678
|
-
for (const o of
|
|
7678
|
+
for (const o of n) {
|
|
7679
7679
|
r++;
|
|
7680
7680
|
const a = new FormData();
|
|
7681
7681
|
a.append("file", o), a.append("customData", this.builder.settings.customData);
|
|
@@ -7686,15 +7686,15 @@ Check the information and return the details.
|
|
|
7686
7686
|
})).json();
|
|
7687
7687
|
if (l.ok) {
|
|
7688
7688
|
const h = l.url;
|
|
7689
|
-
|
|
7689
|
+
s.files.push(h), this.builder.filesUploaded["file_" + r] = h;
|
|
7690
7690
|
}
|
|
7691
7691
|
}
|
|
7692
7692
|
}
|
|
7693
|
-
e.push(
|
|
7693
|
+
e.push(s);
|
|
7694
7694
|
}
|
|
7695
7695
|
return e;
|
|
7696
7696
|
}
|
|
7697
|
-
async generate(e, t, i,
|
|
7697
|
+
async generate(e, t, i, s, n, r, o) {
|
|
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;
|
|
@@ -7797,7 +7797,7 @@ Check the information and return the details.
|
|
|
7797
7797
|
return this.builder.payloads.push(_), this.builder.settings.consoleLog && console.log(_), this.generateMediaByJSON(_, i, r, o);
|
|
7798
7798
|
}
|
|
7799
7799
|
try {
|
|
7800
|
-
if (a = await this.checkIntent(e, i,
|
|
7800
|
+
if (a = await this.checkIntent(e, i, n), this.builder.settings.consoleLog && console.log(a), !a)
|
|
7801
7801
|
return {
|
|
7802
7802
|
mediaGenerated: !1,
|
|
7803
7803
|
status: "aborted",
|
|
@@ -7886,24 +7886,24 @@ Check the information and return the details.
|
|
|
7886
7886
|
message: this.out("Request failed.")
|
|
7887
7887
|
};
|
|
7888
7888
|
}
|
|
7889
|
-
async generateMediaByJSON(e, t, i,
|
|
7890
|
-
let
|
|
7889
|
+
async generateMediaByJSON(e, t, i, s) {
|
|
7890
|
+
let n, r = !1;
|
|
7891
7891
|
if (t === "replicate" && this.builder.settings.generateMediaUrl) {
|
|
7892
|
-
if (
|
|
7892
|
+
if (n = this.builder.settings.generateMediaUrl, !n)
|
|
7893
7893
|
return {
|
|
7894
7894
|
mediaGenerated: !1,
|
|
7895
7895
|
status: "error",
|
|
7896
7896
|
message: this.out("Endpoint not configured: generateMediaUrl.")
|
|
7897
7897
|
};
|
|
7898
7898
|
} else if (t === "replicate" && this.builder.settings.generateMediaUrl_Replicate) {
|
|
7899
|
-
if (
|
|
7899
|
+
if (n = this.builder.settings.generateMediaUrl_Replicate, !n)
|
|
7900
7900
|
return {
|
|
7901
7901
|
mediaGenerated: !1,
|
|
7902
7902
|
status: "error",
|
|
7903
7903
|
message: this.out("Endpoint not configured: generateMediaUrl_Replicate.")
|
|
7904
7904
|
};
|
|
7905
7905
|
r = !0;
|
|
7906
|
-
} else if (t === "fal" && (
|
|
7906
|
+
} else if (t === "fal" && (n = this.builder.settings.generateMediaUrl_Fal, !n))
|
|
7907
7907
|
return {
|
|
7908
7908
|
mediaGenerated: !1,
|
|
7909
7909
|
status: "error",
|
|
@@ -7913,7 +7913,7 @@ Check the information and return the details.
|
|
|
7913
7913
|
"Content-Type": "application/json",
|
|
7914
7914
|
...this.builder.settings.headers
|
|
7915
7915
|
};
|
|
7916
|
-
const d = await (await fetch(
|
|
7916
|
+
const d = await (await fetch(n, {
|
|
7917
7917
|
signal: this.builder.mediaSignal,
|
|
7918
7918
|
method: "POST",
|
|
7919
7919
|
headers: o,
|
|
@@ -7921,7 +7921,7 @@ Check the information and return the details.
|
|
|
7921
7921
|
})).json();
|
|
7922
7922
|
if (this.builder.isMediaGenerating = !1, t === "fal") {
|
|
7923
7923
|
let u = d.request_id;
|
|
7924
|
-
return this.waitingFal(e, u, i,
|
|
7924
|
+
return this.waitingFal(e, u, i, s);
|
|
7925
7925
|
}
|
|
7926
7926
|
if (d.error)
|
|
7927
7927
|
return this.builder.settings.consoleLog && console.log(d.error), {
|
|
@@ -7946,10 +7946,10 @@ Check the information and return the details.
|
|
|
7946
7946
|
message: d.error
|
|
7947
7947
|
//this.out('Generating video request failed.')
|
|
7948
7948
|
};
|
|
7949
|
-
return this.waitingReplicate(e, u, i,
|
|
7949
|
+
return this.waitingReplicate(e, u, i, s);
|
|
7950
7950
|
} else {
|
|
7951
7951
|
const u = d.data;
|
|
7952
|
-
let l = this.renderResult(u, i,
|
|
7952
|
+
let l = this.renderResult(u, i, s);
|
|
7953
7953
|
return {
|
|
7954
7954
|
mediaGenerated: !0,
|
|
7955
7955
|
status: "success",
|
|
@@ -7962,7 +7962,7 @@ Check the information and return the details.
|
|
|
7962
7962
|
getClosestAspectRatio(e, t) {
|
|
7963
7963
|
if (t === 0)
|
|
7964
7964
|
return "3:2";
|
|
7965
|
-
const i = e / t,
|
|
7965
|
+
const i = e / t, s = [{
|
|
7966
7966
|
aspect: "10:16",
|
|
7967
7967
|
ratio: 10 / 16
|
|
7968
7968
|
}, {
|
|
@@ -7996,12 +7996,12 @@ Check the information and return the details.
|
|
|
7996
7996
|
aspect: "2:3",
|
|
7997
7997
|
ratio: 2 / 3
|
|
7998
7998
|
}];
|
|
7999
|
-
let
|
|
8000
|
-
for (let o = 1; o <
|
|
8001
|
-
const a = Math.abs(i -
|
|
8002
|
-
a < r && (r = a,
|
|
7999
|
+
let n = s[0], r = Math.abs(i - s[0].ratio);
|
|
8000
|
+
for (let o = 1; o < s.length; o++) {
|
|
8001
|
+
const a = Math.abs(i - s[o].ratio);
|
|
8002
|
+
a < r && (r = a, n = s[o]);
|
|
8003
8003
|
}
|
|
8004
|
-
return
|
|
8004
|
+
return n.aspect;
|
|
8005
8005
|
}
|
|
8006
8006
|
out(e) {
|
|
8007
8007
|
if (this.opts.lang) {
|
|
@@ -8022,36 +8022,36 @@ class mn {
|
|
|
8022
8022
|
let t = this.builder.getFormValues();
|
|
8023
8023
|
const i = this.builder.filesUploaded;
|
|
8024
8024
|
if (Object.keys(i).length !== 0) return i;
|
|
8025
|
-
for (const
|
|
8026
|
-
if (
|
|
8027
|
-
let
|
|
8028
|
-
|
|
8025
|
+
for (const s of t)
|
|
8026
|
+
if (s.value instanceof FileList) {
|
|
8027
|
+
let n = await this.processMediaInput(s.name, e), r = n.url;
|
|
8028
|
+
s.name === n.url && (r = ""), i[s.name] = r;
|
|
8029
8029
|
} else {
|
|
8030
|
-
if (
|
|
8031
|
-
let
|
|
8032
|
-
if (
|
|
8030
|
+
if (s.name.indexOf("_mask") !== -1) {
|
|
8031
|
+
let n = await this.processMaskInput(s.name, e);
|
|
8032
|
+
if (n.error)
|
|
8033
8033
|
return {
|
|
8034
|
-
error:
|
|
8034
|
+
error: n.error
|
|
8035
8035
|
};
|
|
8036
8036
|
{
|
|
8037
|
-
let r =
|
|
8038
|
-
i[
|
|
8037
|
+
let r = n.url;
|
|
8038
|
+
i[s.name] = r;
|
|
8039
8039
|
}
|
|
8040
8040
|
}
|
|
8041
|
-
if (
|
|
8042
|
-
let
|
|
8043
|
-
this.builder.settings.isBuilder ?
|
|
8044
|
-
const r =
|
|
8041
|
+
if (s.name.indexOf("__url") !== -1) {
|
|
8042
|
+
let n;
|
|
8043
|
+
this.builder.settings.isBuilder ? n = document.querySelector(this.builder.settings.previewSelector) : n = this.builder.element;
|
|
8044
|
+
const r = n.querySelector(`input[name="${s.name}"]`);
|
|
8045
8045
|
if (r) {
|
|
8046
8046
|
const o = r.value;
|
|
8047
|
-
i[
|
|
8047
|
+
i[s.name] = o;
|
|
8048
8048
|
}
|
|
8049
8049
|
}
|
|
8050
8050
|
}
|
|
8051
|
-
return Object.keys(i).forEach((
|
|
8052
|
-
if (
|
|
8053
|
-
const
|
|
8054
|
-
Object.prototype.hasOwnProperty.call(i,
|
|
8051
|
+
return Object.keys(i).forEach((s) => {
|
|
8052
|
+
if (s.endsWith("__url")) {
|
|
8053
|
+
const n = s.replace("__url", "");
|
|
8054
|
+
Object.prototype.hasOwnProperty.call(i, n) && (i[n] = i[s]), delete i[s];
|
|
8055
8055
|
}
|
|
8056
8056
|
}), i;
|
|
8057
8057
|
}
|
|
@@ -8065,22 +8065,22 @@ class mn {
|
|
|
8065
8065
|
i = document.querySelector(this.builder.settings.previewSelector);
|
|
8066
8066
|
} else
|
|
8067
8067
|
i = this.builder.element;
|
|
8068
|
-
const
|
|
8069
|
-
if (!
|
|
8068
|
+
const s = i.querySelector(`input[type="hidden"][name="${e}"]`);
|
|
8069
|
+
if (!s) return {
|
|
8070
8070
|
error: this.out("Unable to perform the request.")
|
|
8071
8071
|
// must be image_to_image_generation, not edit_area_in_image
|
|
8072
8072
|
};
|
|
8073
|
-
if (
|
|
8073
|
+
if (s.value === "")
|
|
8074
8074
|
return {
|
|
8075
8075
|
error: this.out("Please brush the area you want to edit.")
|
|
8076
8076
|
};
|
|
8077
|
-
let
|
|
8078
|
-
if (
|
|
8077
|
+
let n = s.value.replace(/^data:image\/(png|svg\+xml|jpeg|gif|webp);base64,/, "");
|
|
8078
|
+
if (n === "")
|
|
8079
8079
|
return {
|
|
8080
8080
|
error: this.out("Please brush over the areas to remove objects before continuing.")
|
|
8081
8081
|
};
|
|
8082
8082
|
let r, o = this.builder.getId(), a = {
|
|
8083
|
-
image:
|
|
8083
|
+
image: n,
|
|
8084
8084
|
filename: `${e}_${o}.png`,
|
|
8085
8085
|
// inputName + '.png',
|
|
8086
8086
|
customData: this.builder.settings.customData
|
|
@@ -8109,7 +8109,7 @@ class mn {
|
|
|
8109
8109
|
let r = e;
|
|
8110
8110
|
i = this.getFileInput(r) || this.getFileInput();
|
|
8111
8111
|
}
|
|
8112
|
-
let
|
|
8112
|
+
let s = "", n;
|
|
8113
8113
|
if (this.builder.photoBlob[e]) {
|
|
8114
8114
|
let r = this.builder.getId();
|
|
8115
8115
|
const o = new FormData();
|
|
@@ -8120,9 +8120,9 @@ class mn {
|
|
|
8120
8120
|
method: "POST",
|
|
8121
8121
|
body: o
|
|
8122
8122
|
})).json();
|
|
8123
|
-
return u.ok ? (
|
|
8124
|
-
filename:
|
|
8125
|
-
url:
|
|
8123
|
+
return u.ok ? (n = u.url, s = u.filename, {
|
|
8124
|
+
filename: s,
|
|
8125
|
+
url: n
|
|
8126
8126
|
}) : {
|
|
8127
8127
|
error: this.out("Upload file failed.")
|
|
8128
8128
|
};
|
|
@@ -8136,9 +8136,9 @@ class mn {
|
|
|
8136
8136
|
method: "POST",
|
|
8137
8137
|
body: r
|
|
8138
8138
|
})).json();
|
|
8139
|
-
return d.ok ? (
|
|
8140
|
-
filename:
|
|
8141
|
-
url:
|
|
8139
|
+
return d.ok ? (n = d.url, s = d.filename, {
|
|
8140
|
+
filename: s,
|
|
8141
|
+
url: n
|
|
8142
8142
|
}) : {
|
|
8143
8143
|
error: this.out("Upload file failed.")
|
|
8144
8144
|
};
|
|
@@ -8146,7 +8146,7 @@ class mn {
|
|
|
8146
8146
|
if (i) {
|
|
8147
8147
|
const r = i.files[0];
|
|
8148
8148
|
if (r) {
|
|
8149
|
-
|
|
8149
|
+
s = r.name;
|
|
8150
8150
|
const o = new FormData();
|
|
8151
8151
|
o.append("file", r), o.append("customData", this.builder.settings.customData);
|
|
8152
8152
|
let a;
|
|
@@ -8156,18 +8156,18 @@ class mn {
|
|
|
8156
8156
|
body: o
|
|
8157
8157
|
})).json();
|
|
8158
8158
|
if (u.ok)
|
|
8159
|
-
|
|
8159
|
+
n = u.url, s = u.filename;
|
|
8160
8160
|
else
|
|
8161
8161
|
return {
|
|
8162
8162
|
error: this.out("Upload file failed.")
|
|
8163
8163
|
};
|
|
8164
8164
|
} else
|
|
8165
|
-
|
|
8165
|
+
n = e;
|
|
8166
8166
|
} else
|
|
8167
|
-
|
|
8167
|
+
n = e;
|
|
8168
8168
|
return {
|
|
8169
|
-
filename:
|
|
8170
|
-
url:
|
|
8169
|
+
filename: s,
|
|
8170
|
+
url: n
|
|
8171
8171
|
};
|
|
8172
8172
|
}
|
|
8173
8173
|
getFileInput(e) {
|
|
@@ -8236,12 +8236,12 @@ class bn {
|
|
|
8236
8236
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
8237
8237
|
<path d="M18 6l-12 12" /><path d="M6 6l12 12" />
|
|
8238
8238
|
</svg>`, e.appendChild(i);
|
|
8239
|
-
const n = document.createElement("div");
|
|
8240
|
-
n.className = "imagemask-body", e.appendChild(n);
|
|
8241
8239
|
const s = document.createElement("div");
|
|
8242
|
-
s.className = "imagemask-
|
|
8240
|
+
s.className = "imagemask-body", e.appendChild(s);
|
|
8241
|
+
const n = document.createElement("div");
|
|
8242
|
+
n.className = "imagemask-container", s.appendChild(n);
|
|
8243
8243
|
const r = document.createElement("div");
|
|
8244
|
-
r.className = "imagemask-controls",
|
|
8244
|
+
r.className = "imagemask-controls", s.appendChild(r);
|
|
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">`;
|
|
@@ -8281,7 +8281,7 @@ class bn {
|
|
|
8281
8281
|
<path d="M8 4l-4 0l0 4" /><path d="M4 4l6 6" />
|
|
8282
8282
|
</svg>`, r.appendChild(h);
|
|
8283
8283
|
const p = document.createElement("input");
|
|
8284
|
-
p.type = "hidden", p.name = this.settings.name, p.className = "inp-imagemask", p.value = "",
|
|
8284
|
+
p.type = "hidden", p.name = this.settings.name, p.className = "inp-imagemask", p.value = "", s.appendChild(p);
|
|
8285
8285
|
const b = document.createElement("canvas");
|
|
8286
8286
|
b.className = "imagemask";
|
|
8287
8287
|
const w = b.getContext("2d", {
|
|
@@ -8314,8 +8314,8 @@ class bn {
|
|
|
8314
8314
|
T.preventDefault(), y.length > 0 && (m.push(b.toDataURL()), x(y.pop()));
|
|
8315
8315
|
});
|
|
8316
8316
|
const S = document.createElement("img");
|
|
8317
|
-
|
|
8318
|
-
|
|
8317
|
+
n.appendChild(S), n.appendChild(b), this.loaded = () => {
|
|
8318
|
+
n.style.display = "flex";
|
|
8319
8319
|
const T = document.querySelector(".imagemask-controls");
|
|
8320
8320
|
T.style.display = "flex", e.style.display = "flex", A(), m = [], y = [], w.clearRect(0, 0, b.width, b.height), g.clearRect(0, 0, _.width, _.height), this.empty = !0, v.value = "";
|
|
8321
8321
|
try {
|
|
@@ -8534,9 +8534,9 @@ class yn {
|
|
|
8534
8534
|
alwaysVisibleSubmit: !1
|
|
8535
8535
|
};
|
|
8536
8536
|
this.settings = Object.assign({}, i, t), this.listeners = {}, window._txt && (this.settings.lang = window._txt), this.steps = [];
|
|
8537
|
-
let
|
|
8538
|
-
if (this.settings.onChange = (
|
|
8539
|
-
|
|
8537
|
+
let s = this.settings.onChange;
|
|
8538
|
+
if (this.settings.onChange = (n) => {
|
|
8539
|
+
s && s.call(this, n);
|
|
8540
8540
|
}, !e)
|
|
8541
8541
|
throw new Error("A valid DOM element is required.");
|
|
8542
8542
|
e.classList.add("formview-container"), e.classList.add("fb-ui"), this.element = e, this.media = new gn({
|
|
@@ -8563,10 +8563,10 @@ class yn {
|
|
|
8563
8563
|
let e = document.querySelector(this.settings.templatesSelector);
|
|
8564
8564
|
if (e) {
|
|
8565
8565
|
e.classList.remove("hidden"), e.classList.add("formtemplates-container"), e.classList.add("fb-ui");
|
|
8566
|
-
let
|
|
8566
|
+
let s = (await (await fetch(this.settings.templatesUrl, {
|
|
8567
8567
|
method: "GET"
|
|
8568
8568
|
})).json()).data;
|
|
8569
|
-
e.innerHTML = "",
|
|
8569
|
+
e.innerHTML = "", s = s.filter((l) => {
|
|
8570
8570
|
const h = l.supports || [];
|
|
8571
8571
|
if (h.length === 0) return !0;
|
|
8572
8572
|
const {
|
|
@@ -8602,7 +8602,7 @@ class yn {
|
|
|
8602
8602
|
const d = document.createElement("ul");
|
|
8603
8603
|
d.className = "app-list", e.appendChild(d);
|
|
8604
8604
|
const u = (l) => {
|
|
8605
|
-
let h =
|
|
8605
|
+
let h = s.filter((b) => l === "all" || b.categories.includes(l));
|
|
8606
8606
|
const p = this.settings.templateOutput || ["image", "video", "audio", "text"];
|
|
8607
8607
|
h = h.filter((b) => b.categories.every((w) => p.includes(w))), this.renderList(h, d);
|
|
8608
8608
|
};
|
|
@@ -8622,9 +8622,9 @@ class yn {
|
|
|
8622
8622
|
const i = t.querySelector('input[type="file"]');
|
|
8623
8623
|
if (!i || !this.acceptsImagesOnly(i))
|
|
8624
8624
|
return;
|
|
8625
|
-
let
|
|
8626
|
-
e.startsWith("http") ?
|
|
8627
|
-
const r = await (await fetch(
|
|
8625
|
+
let s;
|
|
8626
|
+
e.startsWith("http") ? s = this.settings.viewFileUrl + "?url=" + e : s = e;
|
|
8627
|
+
const r = await (await fetch(s)).blob(), o = new File([r], e.split("/").pop(), {
|
|
8628
8628
|
type: r.type
|
|
8629
8629
|
});
|
|
8630
8630
|
this.element.querySelector(".div-selected-preview") || (this.selectedFiles = []), i && i.hasAttribute("multiple") ? this.selectedFiles.some((u) => u.name === o.name) || this.selectedFiles.push(o) : this.selectedFiles = [o], this.setSelectedFiles(this.selectedFiles), this.renderSelectedFiles(), t.closest(".image-mask") && this.objImageMask && this.objImageMask.loadImage(o);
|
|
@@ -8638,15 +8638,15 @@ class yn {
|
|
|
8638
8638
|
const e = this.element.querySelector(".file-input-wrapper");
|
|
8639
8639
|
if (!e) return;
|
|
8640
8640
|
let t = this.element.querySelector(".div-selected-preview");
|
|
8641
|
-
t ? t.innerHTML = "" : (t = document.createElement("div"), t.classList.add("div-selected-preview"), e.appendChild(t)), this.clearFileInput(), this.selectedFiles && this.selectedFiles.forEach((i,
|
|
8642
|
-
const
|
|
8641
|
+
t ? t.innerHTML = "" : (t = document.createElement("div"), t.classList.add("div-selected-preview"), e.appendChild(t)), this.clearFileInput(), this.selectedFiles && this.selectedFiles.forEach((i, s) => {
|
|
8642
|
+
const n = document.createElement("div"), r = document.createElement("img");
|
|
8643
8643
|
r.src = URL.createObjectURL(i);
|
|
8644
8644
|
const o = document.createElement("button");
|
|
8645
8645
|
o.innerHTML = `<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" class="">
|
|
8646
8646
|
<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" />
|
|
8647
8647
|
</svg>`, o.addEventListener("click", () => {
|
|
8648
|
-
this.selectedFiles.splice(
|
|
8649
|
-
}),
|
|
8648
|
+
this.selectedFiles.splice(s, 1), this.setSelectedFiles(this.selectedFiles), this.renderSelectedFiles(), e.closest(".image-mask") && this.objImageMask && this.objImageMask.clearImage();
|
|
8649
|
+
}), n.appendChild(r), n.appendChild(o), t.appendChild(n);
|
|
8650
8650
|
});
|
|
8651
8651
|
}
|
|
8652
8652
|
clearSelectedFiles() {
|
|
@@ -8668,10 +8668,10 @@ class yn {
|
|
|
8668
8668
|
}
|
|
8669
8669
|
const i = e.querySelector(".file-drop-info-highlight");
|
|
8670
8670
|
i && (i.innerHTML = "");
|
|
8671
|
-
const
|
|
8672
|
-
|
|
8673
|
-
const
|
|
8674
|
-
|
|
8671
|
+
const s = e.querySelector(".img-preview");
|
|
8672
|
+
s && s.remove();
|
|
8673
|
+
const n = e.querySelector(".file-preview-container");
|
|
8674
|
+
n && (n.innerHTML = "");
|
|
8675
8675
|
const r = e.querySelector(".btn-clearphoto");
|
|
8676
8676
|
r && r.click();
|
|
8677
8677
|
const o = this.element.querySelector('input[type="file"]');
|
|
@@ -8686,10 +8686,10 @@ class yn {
|
|
|
8686
8686
|
renderList(e, t) {
|
|
8687
8687
|
t.innerHTML = "", e.forEach((i) => {
|
|
8688
8688
|
if (i.name) {
|
|
8689
|
-
const
|
|
8690
|
-
t.appendChild(
|
|
8691
|
-
const
|
|
8692
|
-
|
|
8689
|
+
const s = document.createElement("li");
|
|
8690
|
+
t.appendChild(s);
|
|
8691
|
+
const n = document.createElement("a");
|
|
8692
|
+
n.setAttribute("href", "#");
|
|
8693
8693
|
let r = this.settings.assetsFolder, o = i.form.thumbnail, a = "";
|
|
8694
8694
|
if (r && o) {
|
|
8695
8695
|
let h = r + o;
|
|
@@ -8714,14 +8714,14 @@ class yn {
|
|
|
8714
8714
|
p.preventDefault(), this.settings.onSelectTemplate && this.settings.onSelectTemplate(i), this.trigger("templateUse", i);
|
|
8715
8715
|
}), l = !0;
|
|
8716
8716
|
}
|
|
8717
|
-
|
|
8717
|
+
n.innerHTML = `
|
|
8718
8718
|
${a}
|
|
8719
8719
|
<div class="card-text">
|
|
8720
8720
|
<div class="title">${i.name}</div>
|
|
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
|
-
`, u || l ? (
|
|
8724
|
+
`, u || l ? (n.querySelector(".card-text").appendChild(d), n.classList.remove("cursor-pointer"), n.classList.add("cursor-default")) : (n.classList.add("cursor-pointer"), n.classList.remove("cursor-default")), s.appendChild(n), u || 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;
|
|
@@ -8735,12 +8735,12 @@ class yn {
|
|
|
8735
8735
|
const e = document.querySelector(this.settings.resultSelector);
|
|
8736
8736
|
if (!e) return;
|
|
8737
8737
|
let t = e.innerHTML;
|
|
8738
|
-
const
|
|
8739
|
-
|
|
8738
|
+
const s = new DOMParser().parseFromString(t, "text/html"), n = s.querySelector(".result-tool");
|
|
8739
|
+
n && n.remove(), s.querySelectorAll(".link-view, .link-download, video, audio").forEach((h) => {
|
|
8740
8740
|
h.remove();
|
|
8741
8741
|
});
|
|
8742
8742
|
let o = !1;
|
|
8743
|
-
|
|
8743
|
+
s.body.innerText.trim() === "" && (o = !0);
|
|
8744
8744
|
const d = document.createElement("div");
|
|
8745
8745
|
d.className = "result-tool", e.appendChild(d);
|
|
8746
8746
|
const u = document.createElement("button");
|
|
@@ -8794,9 +8794,9 @@ class yn {
|
|
|
8794
8794
|
const t = this.getScrollableParent(e);
|
|
8795
8795
|
this._scrollListener && (t ? t.removeEventListener("scroll", this._scrollListener) : window.removeEventListener("scroll", this._scrollListener), window.removeEventListener("resize", this._resizeListener));
|
|
8796
8796
|
let i;
|
|
8797
|
-
const
|
|
8797
|
+
const s = () => {
|
|
8798
8798
|
e.style.position = "", t ? i = e.offsetTop + e.offsetHeight - t.offsetTop : i = e.offsetTop + e.offsetHeight;
|
|
8799
|
-
},
|
|
8799
|
+
}, n = () => {
|
|
8800
8800
|
if (t)
|
|
8801
8801
|
if (t.offsetHeight + t.scrollTop > i)
|
|
8802
8802
|
e.style.position = "", e.style.top = "";
|
|
@@ -8812,18 +8812,18 @@ class yn {
|
|
|
8812
8812
|
}
|
|
8813
8813
|
e.parentNode.offsetWidth !== 0 && (e.style.width = `${e.parentNode.offsetWidth}px`);
|
|
8814
8814
|
};
|
|
8815
|
-
this._scrollListener =
|
|
8815
|
+
this._scrollListener = n;
|
|
8816
8816
|
let r;
|
|
8817
8817
|
this._resizeListener = () => {
|
|
8818
8818
|
r && clearTimeout(r), r = setTimeout(() => {
|
|
8819
8819
|
let o = null;
|
|
8820
8820
|
const a = () => {
|
|
8821
8821
|
const d = e.offsetTop;
|
|
8822
|
-
d === o ? (
|
|
8822
|
+
d === o ? (s(), n()) : (o = d, requestAnimationFrame(a));
|
|
8823
8823
|
};
|
|
8824
8824
|
a();
|
|
8825
8825
|
}, 200);
|
|
8826
|
-
},
|
|
8826
|
+
}, s(), n(), t ? t.addEventListener("scroll", n) : window.addEventListener("scroll", n), window.addEventListener("resize", this._resizeListener);
|
|
8827
8827
|
}
|
|
8828
8828
|
view(e) {
|
|
8829
8829
|
if (!e) return;
|
|
@@ -8836,12 +8836,12 @@ class yn {
|
|
|
8836
8836
|
}
|
|
8837
8837
|
this.json = t, this.inputListener = () => {
|
|
8838
8838
|
clearTimeout(this.debounceTimeout), this.debounceTimeout = setTimeout(() => {
|
|
8839
|
-
const
|
|
8840
|
-
this.settings.onInputChange && this.settings.onInputChange(
|
|
8839
|
+
const n = this.getFormValues();
|
|
8840
|
+
this.settings.onInputChange && this.settings.onInputChange(n);
|
|
8841
8841
|
}, 300);
|
|
8842
8842
|
}, this.changeListener = () => {
|
|
8843
|
-
const
|
|
8844
|
-
this.settings.onInputChange && this.settings.onInputChange(
|
|
8843
|
+
const n = this.getFormValues();
|
|
8844
|
+
this.settings.onInputChange && this.settings.onInputChange(n);
|
|
8845
8845
|
};
|
|
8846
8846
|
let i;
|
|
8847
8847
|
if (this.settings.isBuilder) {
|
|
@@ -9730,9 +9730,9 @@ class yn {
|
|
|
9730
9730
|
if (this.settings.resultSelector && document.querySelector(this.settings.resultSelector).classList.add("result-wrapper"), this.settings.saveResults && this.settings.resultSelector && localStorage.getItem("_results"))
|
|
9731
9731
|
try {
|
|
9732
9732
|
this.previousResults = JSON.parse(localStorage.getItem("_results"));
|
|
9733
|
-
let
|
|
9733
|
+
let n = localStorage.getItem("_results_html");
|
|
9734
9734
|
const r = document.querySelector(this.settings.resultSelector);
|
|
9735
|
-
r.innerHTML =
|
|
9735
|
+
r.innerHTML = n, this.addResultTool(), r.querySelectorAll(".link-download").forEach((a) => {
|
|
9736
9736
|
a.addEventListener("click", async (d) => {
|
|
9737
9737
|
d.preventDefault();
|
|
9738
9738
|
const u = d.target.href;
|
|
@@ -9750,9 +9750,9 @@ class yn {
|
|
|
9750
9750
|
});
|
|
9751
9751
|
} catch {
|
|
9752
9752
|
}
|
|
9753
|
-
const
|
|
9754
|
-
|
|
9755
|
-
this.stickyElement(
|
|
9753
|
+
const s = document.querySelector(".formview-container .submit-container");
|
|
9754
|
+
s && setTimeout(() => {
|
|
9755
|
+
this.stickyElement(s);
|
|
9756
9756
|
}, 1e3);
|
|
9757
9757
|
}
|
|
9758
9758
|
abort() {
|
|
@@ -9774,8 +9774,8 @@ class yn {
|
|
|
9774
9774
|
});
|
|
9775
9775
|
if (!i.ok)
|
|
9776
9776
|
throw new Error("Failed to fetch data");
|
|
9777
|
-
const
|
|
9778
|
-
return (n
|
|
9777
|
+
const s = await i.json(), n = s.organic_results ? "organic_results" : "organic";
|
|
9778
|
+
return (s[n] || []).map((r) => ({
|
|
9779
9779
|
title: r.title,
|
|
9780
9780
|
link: r.link,
|
|
9781
9781
|
snippet: r.snippet || r.description
|
|
@@ -9805,19 +9805,19 @@ class yn {
|
|
|
9805
9805
|
});
|
|
9806
9806
|
if (!i.ok)
|
|
9807
9807
|
throw new Error(`Error: ${i.statusText}`);
|
|
9808
|
-
let
|
|
9809
|
-
const
|
|
9810
|
-
if (this.settings.consoleLog && console.log(
|
|
9811
|
-
return this.settings.consoleLog && console.log(
|
|
9808
|
+
let s = "";
|
|
9809
|
+
const n = await i.json();
|
|
9810
|
+
if (this.settings.consoleLog && console.log(n), n.error)
|
|
9811
|
+
return this.settings.consoleLog && console.log(n.error), {
|
|
9812
9812
|
data: "",
|
|
9813
9813
|
urls: [],
|
|
9814
9814
|
failed: []
|
|
9815
9815
|
};
|
|
9816
9816
|
let r = [], o = [];
|
|
9817
|
-
if (this.settings.scrapeProvider === "firecrawl" &&
|
|
9817
|
+
if (this.settings.scrapeProvider === "firecrawl" && n.forEach((a) => {
|
|
9818
9818
|
if (a.success) {
|
|
9819
9819
|
const d = a.metadata.title, u = a.markdown, l = a.metadata.url;
|
|
9820
|
-
r.push(l),
|
|
9820
|
+
r.push(l), s += `
|
|
9821
9821
|
|
|
9822
9822
|
|
|
9823
9823
|
## ${d}
|
|
@@ -9840,11 +9840,11 @@ class yn {
|
|
|
9840
9840
|
d = a.url.link, o.push(d);
|
|
9841
9841
|
}
|
|
9842
9842
|
}), this.settings.scrapeProvider === "scrapingbee")
|
|
9843
|
-
for (let a = 0; a <
|
|
9843
|
+
for (let a = 0; a < n.length; a++) {
|
|
9844
9844
|
let d = e[a];
|
|
9845
9845
|
r.push(d);
|
|
9846
|
-
let u =
|
|
9847
|
-
|
|
9846
|
+
let u = n[a];
|
|
9847
|
+
s += `
|
|
9848
9848
|
|
|
9849
9849
|
|
|
9850
9850
|
## ${d}
|
|
@@ -9857,11 +9857,11 @@ ${u}
|
|
|
9857
9857
|
|
|
9858
9858
|
`;
|
|
9859
9859
|
}
|
|
9860
|
-
return
|
|
9860
|
+
return s = `These are the information from the URLs:
|
|
9861
9861
|
|
|
9862
|
-
${
|
|
9862
|
+
${s}
|
|
9863
9863
|
`, {
|
|
9864
|
-
data:
|
|
9864
|
+
data: s,
|
|
9865
9865
|
urls: r,
|
|
9866
9866
|
failed: o
|
|
9867
9867
|
};
|
|
@@ -9870,10 +9870,10 @@ ${n}
|
|
|
9870
9870
|
let t = "You are an assistant", i = `This is user's request:
|
|
9871
9871
|
|
|
9872
9872
|
${e}
|
|
9873
|
-
`,
|
|
9873
|
+
`, s = `
|
|
9874
9874
|
Check if the request requires checking certain URLs. If so, returns the URLs.
|
|
9875
9875
|
Also check if the request requires search to find answers by searching on the web to get the current relevant information.
|
|
9876
|
-
`,
|
|
9876
|
+
`, n = [{
|
|
9877
9877
|
name: "check_request",
|
|
9878
9878
|
description: "Check user request.",
|
|
9879
9879
|
parameters: {
|
|
@@ -9922,7 +9922,7 @@ Also check if the request requires search to find answers by searching on the we
|
|
|
9922
9922
|
},
|
|
9923
9923
|
required: ["needsearch", "needscrape"]
|
|
9924
9924
|
}
|
|
9925
|
-
}], r = await this.send(
|
|
9925
|
+
}], r = await this.send(s, i, t, n);
|
|
9926
9926
|
return r ? JSON.parse(r) : !1;
|
|
9927
9927
|
}
|
|
9928
9928
|
async getRelevantInfo(e, t, i) {
|
|
@@ -9931,23 +9931,23 @@ Also check if the request requires search to find answers by searching on the we
|
|
|
9931
9931
|
urls: [],
|
|
9932
9932
|
failed: []
|
|
9933
9933
|
};
|
|
9934
|
-
const
|
|
9935
|
-
|
|
9936
|
-
let
|
|
9934
|
+
const s = document.createElement("div");
|
|
9935
|
+
s.classList.add("status"), i.appendChild(s);
|
|
9936
|
+
let n = "", r = await this.checkPrompt(`${t}
|
|
9937
9937
|
|
|
9938
9938
|
${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
9942
|
let d = document.createElement("p");
|
|
9943
|
-
d.innerHTML = this.out("Fetching data from the web..."),
|
|
9943
|
+
d.innerHTML = this.out("Fetching data from the web..."), s.appendChild(d);
|
|
9944
9944
|
let u = [];
|
|
9945
9945
|
r.url && u.push(r.url), r.url2 && u.push(r.url2), r.url3 && u.push(r.url3), r.url4 && u.push(r.url4), r.url5 && u.push(r.url5), r.url6 && u.push(r.url6), r.url7 && u.push(r.url7), r.url8 && u.push(r.url8);
|
|
9946
9946
|
let l = await this.scrapeUrls(u);
|
|
9947
|
-
|
|
9947
|
+
n += l.data, o = l.urls, a = l.failed;
|
|
9948
9948
|
} else if (this.settings.searchUrl && this.settings.scrapeUrl) {
|
|
9949
9949
|
let d = document.createElement("p");
|
|
9950
|
-
d.innerHTML = this.out("Searching the web.."),
|
|
9950
|
+
d.innerHTML = this.out("Searching the web.."), s.appendChild(d);
|
|
9951
9951
|
let u = await this.search(e);
|
|
9952
9952
|
const l = this.settings.scrapeExclude;
|
|
9953
9953
|
let h = u.filter((g) => {
|
|
@@ -9955,15 +9955,15 @@ ${e}`);
|
|
|
9955
9955
|
return !l.some((f) => v.includes(f));
|
|
9956
9956
|
});
|
|
9957
9957
|
const p = this.settings.scrapeLimit, b = h.slice(0, p);
|
|
9958
|
-
|
|
9958
|
+
s.innerHTML = "", d = document.createElement("p"), d.innerHTML = this.out("Getting more information..."), s.appendChild(d);
|
|
9959
9959
|
let w = [];
|
|
9960
9960
|
for (let g = 0; g < b.length; g++)
|
|
9961
9961
|
w.push(u[g].link);
|
|
9962
9962
|
let _ = await this.scrapeUrls(w);
|
|
9963
|
-
|
|
9963
|
+
n += _.data, o = _.urls, a = _.failed;
|
|
9964
9964
|
}
|
|
9965
9965
|
return {
|
|
9966
|
-
data:
|
|
9966
|
+
data: n,
|
|
9967
9967
|
urls: o,
|
|
9968
9968
|
failed: a
|
|
9969
9969
|
};
|
|
@@ -9989,17 +9989,17 @@ ${e}`);
|
|
|
9989
9989
|
</circle>
|
|
9990
9990
|
</svg>
|
|
9991
9991
|
`;
|
|
9992
|
-
let
|
|
9992
|
+
let s;
|
|
9993
9993
|
if (this.settings.isBuilder) {
|
|
9994
9994
|
if (!this.settings.previewSelector) {
|
|
9995
9995
|
this.settings.consoleLog && console.log("previewSelector not set.");
|
|
9996
9996
|
return;
|
|
9997
9997
|
}
|
|
9998
|
-
|
|
9998
|
+
s = document.querySelector(this.settings.previewSelector);
|
|
9999
9999
|
} else
|
|
10000
|
-
|
|
10001
|
-
let
|
|
10002
|
-
|
|
10000
|
+
s = this.element;
|
|
10001
|
+
let n = s.querySelector(".btn-submitform"), r = n.innerHTML;
|
|
10002
|
+
n.innerHTML = `
|
|
10003
10003
|
<span class="loading-icon" style="width:60px;display:flex;align-items:center;justify-content:center">
|
|
10004
10004
|
<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">
|
|
10005
10005
|
<circle style="opacity: 0.25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
@@ -10008,7 +10008,7 @@ ${e}`);
|
|
|
10008
10008
|
</span>
|
|
10009
10009
|
|
|
10010
10010
|
`, setTimeout(() => {
|
|
10011
|
-
i.innerHTML = e,
|
|
10011
|
+
i.innerHTML = e, n.innerHTML = r;
|
|
10012
10012
|
}, 400);
|
|
10013
10013
|
}
|
|
10014
10014
|
async process(e) {
|
|
@@ -10021,34 +10021,34 @@ ${e}`);
|
|
|
10021
10021
|
console.log("resultElement not found.");
|
|
10022
10022
|
return;
|
|
10023
10023
|
}
|
|
10024
|
-
let i = !1,
|
|
10024
|
+
let i = !1, s = !1;
|
|
10025
10025
|
this.steps.forEach((m) => {
|
|
10026
|
-
m.prompt.trim().startsWith("{") && (i = !0), m.tools && (m.tools.image || m.tools.video || m.tools.audio) && (i = !0), m.tools && m.tools.search && (
|
|
10026
|
+
m.prompt.trim().startsWith("{") && (i = !0), m.tools && (m.tools.image || m.tools.video || m.tools.audio) && (i = !0), m.tools && m.tools.search && (s = !0);
|
|
10027
10027
|
});
|
|
10028
|
-
let
|
|
10028
|
+
let n;
|
|
10029
10029
|
if (i && this.settings.disableMediaGeneration) {
|
|
10030
|
-
|
|
10030
|
+
n = `
|
|
10031
10031
|
<div class="form-info">
|
|
10032
10032
|
<h3>${this.out(this.settings.disableMediaGenerationTitle)}</h3>
|
|
10033
10033
|
<p>
|
|
10034
10034
|
<b>${this.out(this.settings.disableMediaGenerationMessage)}</b>
|
|
10035
10035
|
</p>
|
|
10036
|
-
</div>`, this.showDemoInfo(
|
|
10036
|
+
</div>`, this.showDemoInfo(n);
|
|
10037
10037
|
return;
|
|
10038
10038
|
}
|
|
10039
|
-
if (!this.settings.scrapeUrl &&
|
|
10040
|
-
this.settings.demo ?
|
|
10039
|
+
if (!this.settings.scrapeUrl && s) {
|
|
10040
|
+
this.settings.demo ? n = `
|
|
10041
10041
|
<div class="form-info">
|
|
10042
10042
|
<h3>Demo Info</h3>
|
|
10043
10043
|
<p>
|
|
10044
10044
|
<b>This is an online demo, so web searching and scraping features are currently disabled. In the full version, you’ll have access to all these features!</b>
|
|
10045
10045
|
</p>
|
|
10046
|
-
</div>` :
|
|
10046
|
+
</div>` : n = `
|
|
10047
10047
|
<div class="form-info">
|
|
10048
10048
|
<p>
|
|
10049
10049
|
<b>Web searching and scraping are currently disabled, so your request cannot be processed.</b>
|
|
10050
10050
|
</p>
|
|
10051
|
-
</div>`, this.showDemoInfo(
|
|
10051
|
+
</div>`, this.showDemoInfo(n);
|
|
10052
10052
|
return;
|
|
10053
10053
|
}
|
|
10054
10054
|
let r;
|
|
@@ -10372,14 +10372,14 @@ ${q.data}
|
|
|
10372
10372
|
});
|
|
10373
10373
|
}
|
|
10374
10374
|
calculateCost() {
|
|
10375
|
-
const e = this.settings.inputCost / 1e6, t = this.settings.outputCost / 1e6, i = this.tokenInput * e,
|
|
10376
|
-
return i +
|
|
10375
|
+
const e = this.settings.inputCost / 1e6, t = this.settings.outputCost / 1e6, i = this.tokenInput * e, s = this.tokenOutput * t;
|
|
10376
|
+
return i + s;
|
|
10377
10377
|
}
|
|
10378
10378
|
loadWorkflow(e) {
|
|
10379
10379
|
if (!e) return;
|
|
10380
10380
|
const i = JSON.parse(e).steps;
|
|
10381
|
-
i.forEach((
|
|
10382
|
-
Object.prototype.hasOwnProperty.call(
|
|
10381
|
+
i.forEach((s) => {
|
|
10382
|
+
Object.prototype.hasOwnProperty.call(s, "context") || (s.context = "");
|
|
10383
10383
|
}), this.steps = i;
|
|
10384
10384
|
}
|
|
10385
10385
|
getFileInput(e) {
|
|
@@ -10428,7 +10428,7 @@ ${q.data}
|
|
|
10428
10428
|
} else
|
|
10429
10429
|
i[o] = d;
|
|
10430
10430
|
});
|
|
10431
|
-
let
|
|
10431
|
+
let s = [];
|
|
10432
10432
|
return this.json.elements.forEach((r) => {
|
|
10433
10433
|
let o = r.title, a = r.name, d = r.type;
|
|
10434
10434
|
if (a === "") return;
|
|
@@ -10438,36 +10438,36 @@ ${q.data}
|
|
|
10438
10438
|
value: u,
|
|
10439
10439
|
type: d
|
|
10440
10440
|
};
|
|
10441
|
-
|
|
10441
|
+
s.push(l);
|
|
10442
10442
|
let h = a + "__url";
|
|
10443
10443
|
u = i[h], u && (l = {
|
|
10444
10444
|
questions: o,
|
|
10445
10445
|
name: h,
|
|
10446
10446
|
value: u
|
|
10447
|
-
},
|
|
10447
|
+
}, s.push(l)), r.useImageMask && (a = a + "_mask", u = i[a], l = {
|
|
10448
10448
|
questions: o,
|
|
10449
10449
|
name: a,
|
|
10450
10450
|
value: u
|
|
10451
|
-
},
|
|
10451
|
+
}, s.push(l));
|
|
10452
10452
|
let p = a + "_red";
|
|
10453
10453
|
u = i[p], u !== void 0 && (l = {
|
|
10454
10454
|
questions: o,
|
|
10455
10455
|
name: p,
|
|
10456
10456
|
value: u
|
|
10457
|
-
},
|
|
10457
|
+
}, s.push(l));
|
|
10458
10458
|
let b = a + "_green";
|
|
10459
10459
|
u = i[b], u !== void 0 && (l = {
|
|
10460
10460
|
questions: o,
|
|
10461
10461
|
name: b,
|
|
10462
10462
|
value: u
|
|
10463
|
-
},
|
|
10463
|
+
}, s.push(l));
|
|
10464
10464
|
let w = a + "_blue";
|
|
10465
10465
|
u = i[w], u !== void 0 && (l = {
|
|
10466
10466
|
questions: o,
|
|
10467
10467
|
name: w,
|
|
10468
10468
|
value: u
|
|
10469
|
-
},
|
|
10470
|
-
}), this.settings.consoleLog && console.log(
|
|
10469
|
+
}, s.push(l));
|
|
10470
|
+
}), this.settings.consoleLog && console.log(s), s;
|
|
10471
10471
|
}
|
|
10472
10472
|
setTheme(e, t) {
|
|
10473
10473
|
let i;
|
|
@@ -10479,23 +10479,23 @@ ${q.data}
|
|
|
10479
10479
|
i = {};
|
|
10480
10480
|
}
|
|
10481
10481
|
this.themeData = e;
|
|
10482
|
-
const
|
|
10483
|
-
let
|
|
10484
|
-
t && (r = t),
|
|
10482
|
+
const s = i.cssVariables;
|
|
10483
|
+
let n, r = document.documentElement;
|
|
10484
|
+
t && (r = t), n = s && s["--form-text-color"] || "", r.style.setProperty("--form-text-color", n), n = s && s["--form-primary-color"] || "#3b82f6", r.style.setProperty("--form-primary-color", n), n = s && s["--form-title-color"] || "", r.style.setProperty("--form-title-color", n), n = s && s["--form-desc-color"] || "", r.style.setProperty("--form-desc-color", n), n = s && s["--form-label-color"] || "", r.style.setProperty("--form-label-color", n), n = s && s["--form-label-font-size"] || "", r.style.setProperty("--form-label-font-size", n), n = s && s["--form-input-font-size"] || "", r.style.setProperty("--form-input-font-size", n), n = s && s["--form-input-border-color"] || "", r.style.setProperty("--form-input-border-color", n), n = s && s["--form-primary-border-width"] || "1px", r.style.setProperty("--form-primary-border-width", n), n = s && s["--form-secondary-border-width"] || "2px", r.style.setProperty("--form-secondary-border-width", n), n = s && s["--form-input-background-color"] || "", r.style.setProperty("--form-input-background-color", n), n = s && s["--form-input-text-color"] || "", r.style.setProperty("--form-input-text-color", n), n = s && s["--form-input-placeholder-color"] || "", r.style.setProperty("--form-input-placeholder-color", n), n = s && s["--form-choice-border-color"] || "", r.style.setProperty("--form-choice-border-color", n), n = s && s["--form-switch-background-color"] || "", r.style.setProperty("--form-switch-background-color", n), n = s && s["--form-switch-knob-color"] || "", r.style.setProperty("--form-switch-knob-color", n), n = s && s["--form-switch-focus-offset-color"] || "", r.style.setProperty("--form-switch-focus-offset-color", n), n = s && s["--form-dropfile-border-color"] || "rgb(194 194 194)", r.style.setProperty("--form-dropfile-border-color", n), n = s && s["--form-dropfile-hover-color"] || "", r.style.setProperty("--form-dropfile-hover-color", n), n = s && s["--form-button-background-color"] || "", r.style.setProperty("--form-button-background-color", n), n = s && s["--form-button-hover-background-color"] || "", r.style.setProperty("--form-button-hover-background-color", n), n = s && s["--form-button-text-color"] || "", r.style.setProperty("--form-button-text-color", n), n = s && s["--form-button-hover-text-color"] || "", r.style.setProperty("--form-button-hover-text-color", n), n = s && s["--form-button-border-width"] || "1px", r.style.setProperty("--form-button-border-width", n), n = s && s["--form-button-border-color"] || "", r.style.setProperty("--form-button-border-color", n), n = s && s["--form-button-hover-border-color"] || "", r.style.setProperty("--form-button-hover-border-color", n), n = s && s["--form-reset-background-color"] || "", r.style.setProperty("--form-reset-background-color", n), n = s && s["--form-reset-hover-background-color"] || "", r.style.setProperty("--form-reset-hover-background-color", n), n = s && s["--form-reset-text-color"] || "", r.style.setProperty("--form-reset-text-color", n), n = s && s["--form-reset-hover-text-color"] || "", r.style.setProperty("--form-reset-hover-text-color", n), n = s && s["--form-reset-border-width"] || "1px", r.style.setProperty("--form-reset-border-width", n), n = s && s["--form-reset-border-color"] || "", r.style.setProperty("--form-reset-border-color", n), n = s && s["--form-reset-hover-border-color"] || "", r.style.setProperty("--form-reset-hover-border-color", n);
|
|
10485
10485
|
}
|
|
10486
|
-
async send(e, t, i,
|
|
10486
|
+
async send(e, t, i, s, n) {
|
|
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
10490
|
const d = {
|
|
10491
10491
|
question: e,
|
|
10492
10492
|
context: t,
|
|
10493
10493
|
system: i,
|
|
10494
|
-
functs:
|
|
10494
|
+
functs: n,
|
|
10495
10495
|
temperature: r,
|
|
10496
10496
|
topP: o,
|
|
10497
10497
|
num: a,
|
|
10498
|
-
model:
|
|
10498
|
+
model: s,
|
|
10499
10499
|
customData: this.settings.customData
|
|
10500
10500
|
};
|
|
10501
10501
|
try {
|
|
@@ -10512,7 +10512,7 @@ ${q.data}
|
|
|
10512
10512
|
if (h.error)
|
|
10513
10513
|
return console.log(`Error:
|
|
10514
10514
|
` + h.error), !1;
|
|
10515
|
-
if (h.answer.usage && (this.tokenInput += h.answer.usage.prompt_tokens, this.tokenOutput += h.answer.usage.completion_tokens),
|
|
10515
|
+
if (h.answer.usage && (this.tokenInput += h.answer.usage.prompt_tokens, this.tokenOutput += h.answer.usage.completion_tokens), n.length === 0) {
|
|
10516
10516
|
let p;
|
|
10517
10517
|
return h.answer.choices.forEach((b) => {
|
|
10518
10518
|
p = b.message.content;
|
|
@@ -10523,19 +10523,19 @@ ${q.data}
|
|
|
10523
10523
|
return u.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", u), !1;
|
|
10524
10524
|
}
|
|
10525
10525
|
}
|
|
10526
|
-
async sendStream(e, t, i,
|
|
10526
|
+
async sendStream(e, t, i, s, n, r) {
|
|
10527
10527
|
this.controller = new AbortController(), this.signal = this.controller.signal;
|
|
10528
10528
|
let o = 0.6, a = 0.9, d = 1;
|
|
10529
|
-
|
|
10529
|
+
n || (n = []), s = s || this.settings.model;
|
|
10530
10530
|
const u = {
|
|
10531
10531
|
question: e,
|
|
10532
10532
|
context: t,
|
|
10533
10533
|
system: i,
|
|
10534
|
-
functs:
|
|
10534
|
+
functs: n,
|
|
10535
10535
|
temperature: o,
|
|
10536
10536
|
topP: a,
|
|
10537
10537
|
num: d,
|
|
10538
|
-
model:
|
|
10538
|
+
model: s,
|
|
10539
10539
|
customData: this.settings.customData
|
|
10540
10540
|
};
|
|
10541
10541
|
try {
|
|
@@ -10593,19 +10593,19 @@ ${q.data}
|
|
|
10593
10593
|
return l.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", l), !1;
|
|
10594
10594
|
}
|
|
10595
10595
|
}
|
|
10596
|
-
async assistant(e, t, i,
|
|
10596
|
+
async assistant(e, t, i, s) {
|
|
10597
10597
|
this.controller = new AbortController(), this.signal = this.controller.signal;
|
|
10598
|
-
let
|
|
10599
|
-
|
|
10598
|
+
let n = 0.6, r = 0.9, o = 1;
|
|
10599
|
+
s || (s = []);
|
|
10600
10600
|
let a = this.settings.model;
|
|
10601
|
-
|
|
10601
|
+
s.length > 0 && (a = this.settings.model2);
|
|
10602
10602
|
const d = {
|
|
10603
10603
|
assistantId: this.settings.assistantId,
|
|
10604
10604
|
question: e,
|
|
10605
10605
|
context: t,
|
|
10606
10606
|
system: i,
|
|
10607
|
-
functs:
|
|
10608
|
-
temperature:
|
|
10607
|
+
functs: s,
|
|
10608
|
+
temperature: n,
|
|
10609
10609
|
topP: r,
|
|
10610
10610
|
num: o,
|
|
10611
10611
|
model: a,
|
|
@@ -10628,16 +10628,16 @@ ${q.data}
|
|
|
10628
10628
|
return u.name === "AbortError" ? this.settings.consoleLog && console.log("Request aborted by user.") : console.error("Error:", u), !1;
|
|
10629
10629
|
}
|
|
10630
10630
|
}
|
|
10631
|
-
async assistantStream(e, t, i,
|
|
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
10635
|
const d = {
|
|
10636
10636
|
assistantId: this.settings.assistantId,
|
|
10637
10637
|
question: e,
|
|
10638
10638
|
context: t,
|
|
10639
10639
|
system: i,
|
|
10640
|
-
functs:
|
|
10640
|
+
functs: s,
|
|
10641
10641
|
temperature: r,
|
|
10642
10642
|
topP: o,
|
|
10643
10643
|
num: a,
|
|
@@ -10682,7 +10682,7 @@ ${q.data}
|
|
|
10682
10682
|
const k = JSON.parse(y);
|
|
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);
|
|
10686
10686
|
}
|
|
10687
10687
|
} catch {
|
|
10688
10688
|
b += m + `
|
|
@@ -10700,10 +10700,10 @@ ${q.data}
|
|
|
10700
10700
|
}
|
|
10701
10701
|
}
|
|
10702
10702
|
hexToRgb(e) {
|
|
10703
|
-
const t = e.replace("#", ""), i = parseInt(t, 16),
|
|
10703
|
+
const t = e.replace("#", ""), i = parseInt(t, 16), s = i >> 16 & 255, n = i >> 8 & 255, r = i & 255;
|
|
10704
10704
|
return {
|
|
10705
|
-
red:
|
|
10706
|
-
green:
|
|
10705
|
+
red: s,
|
|
10706
|
+
green: n,
|
|
10707
10707
|
blue: r
|
|
10708
10708
|
};
|
|
10709
10709
|
}
|
|
@@ -10780,8 +10780,8 @@ class vn {
|
|
|
10780
10780
|
}), document.querySelectorAll('[class*="cb-"]').forEach((t) => {
|
|
10781
10781
|
t.classList.forEach((i) => {
|
|
10782
10782
|
if (i.startsWith("cb-")) {
|
|
10783
|
-
const
|
|
10784
|
-
e.add(
|
|
10783
|
+
const s = i.replace("cb-", "");
|
|
10784
|
+
e.add(s);
|
|
10785
10785
|
}
|
|
10786
10786
|
});
|
|
10787
10787
|
}), Array.from(e);
|
|
@@ -10797,8 +10797,8 @@ class vn {
|
|
|
10797
10797
|
return console.warn(`[PluginManager] Plugin "${e}" not found in registry`), null;
|
|
10798
10798
|
try {
|
|
10799
10799
|
t.css && this.loadCSS(this.resolveUrl(t.css));
|
|
10800
|
-
const i = this.resolveUrl(t.url),
|
|
10801
|
-
return this.plugins.set(e,
|
|
10800
|
+
const i = this.resolveUrl(t.url), s = await this.importModule(i), n = s.default || s;
|
|
10801
|
+
return this.plugins.set(e, n), typeof n.init == "function" && await n.init(this), this.emit("plugin-loaded", { name: e, plugin: n }), n;
|
|
10802
10802
|
} catch (i) {
|
|
10803
10803
|
return console.error(`[PluginManager] Failed to load plugin "${e}":`, i), null;
|
|
10804
10804
|
}
|
|
@@ -10836,8 +10836,8 @@ class vn {
|
|
|
10836
10836
|
*/
|
|
10837
10837
|
initializeComponents() {
|
|
10838
10838
|
return document.querySelectorAll("[data-cb-type]").forEach((t, i) => {
|
|
10839
|
-
const
|
|
10840
|
-
if (
|
|
10839
|
+
const s = t.dataset.cbType, n = this.plugins.get(s);
|
|
10840
|
+
if (n && typeof n.mount == "function")
|
|
10841
10841
|
try {
|
|
10842
10842
|
const r = this.parseOptions(t);
|
|
10843
10843
|
let o = t.querySelector(".grid-sortable");
|
|
@@ -10847,10 +10847,10 @@ class vn {
|
|
|
10847
10847
|
const h = `content-${Date.now()}-${i}-${l}`;
|
|
10848
10848
|
u.setAttribute("data-edit-id", h);
|
|
10849
10849
|
}), t.hasAttribute("data-cb-original-content") || t.setAttribute("data-cb-original-content", t.innerHTML);
|
|
10850
|
-
const d =
|
|
10850
|
+
const d = n.mount(t, r);
|
|
10851
10851
|
this.components.set(t, d), this.setupInlineEditing(t, r), t.setAttribute("data-cb-loaded", "true"), typeof t.mount == "function" && t.mount();
|
|
10852
10852
|
} catch (r) {
|
|
10853
|
-
console.error(`[PluginManager] Failed to mount component "${
|
|
10853
|
+
console.error(`[PluginManager] Failed to mount component "${s}":`, r);
|
|
10854
10854
|
}
|
|
10855
10855
|
}), this.components.size;
|
|
10856
10856
|
}
|
|
@@ -10861,8 +10861,8 @@ class vn {
|
|
|
10861
10861
|
const t = {};
|
|
10862
10862
|
return Array.from(e.attributes).forEach((i) => {
|
|
10863
10863
|
if (i.name.startsWith("data-cb-")) {
|
|
10864
|
-
const
|
|
10865
|
-
t[
|
|
10864
|
+
const s = i.name.replace("data-cb-", "").replace(/-([a-z])/g, (n, r) => r.toUpperCase());
|
|
10865
|
+
t[s] = this.parseValue(i.value);
|
|
10866
10866
|
}
|
|
10867
10867
|
}), t;
|
|
10868
10868
|
}
|
|
@@ -10890,10 +10890,10 @@ class vn {
|
|
|
10890
10890
|
const i = e.querySelectorAll(".edit[data-edit-id]");
|
|
10891
10891
|
if (i.length === 0)
|
|
10892
10892
|
return;
|
|
10893
|
-
e.querySelectorAll('[contenteditable="true"]').forEach((r) => {
|
|
10894
|
-
r.removeAttribute("contenteditable"), r._cbObserver && (r._cbObserver.disconnect(), delete r._cbObserver);
|
|
10893
|
+
e.querySelectorAll('.edit[contenteditable="true"]').forEach((r) => {
|
|
10894
|
+
r.removeAttribute("contenteditable"), r._cbObserver && (r._cbObserver.disconnect(), delete r._cbObserver), r._cbKeydownHandler && (r.removeEventListener("keydown", r._cbKeydownHandler), delete r._cbKeydownHandler);
|
|
10895
10895
|
});
|
|
10896
|
-
const
|
|
10896
|
+
const n = (r, o) => {
|
|
10897
10897
|
const a = e.getAttribute("data-cb-original-content");
|
|
10898
10898
|
if (!a) return;
|
|
10899
10899
|
const d = document.createElement("template");
|
|
@@ -10907,11 +10907,26 @@ class vn {
|
|
|
10907
10907
|
};
|
|
10908
10908
|
i.forEach((r) => {
|
|
10909
10909
|
r.setAttribute("contenteditable", "true");
|
|
10910
|
-
const o =
|
|
10911
|
-
|
|
10912
|
-
|
|
10910
|
+
const o = (u) => {
|
|
10911
|
+
var l = document.createRange();
|
|
10912
|
+
l.selectNodeContents(u);
|
|
10913
|
+
var h = window.getSelection();
|
|
10914
|
+
h.removeAllRanges(), h.addRange(l);
|
|
10915
|
+
}, a = (u) => {
|
|
10916
|
+
if ((u.ctrlKey || u.metaKey) && u.which === 65) {
|
|
10917
|
+
let l;
|
|
10918
|
+
try {
|
|
10919
|
+
window.getSelection ? l = window.getSelection().getRangeAt(0).commonAncestorContainer.parentNode : document.selection && (l = document.selection.createRange().parentElement()), o(l), u.preventDefault();
|
|
10920
|
+
} catch {
|
|
10921
|
+
}
|
|
10922
|
+
}
|
|
10923
|
+
};
|
|
10924
|
+
r.addEventListener("keydown", a), r._cbKeydownHandler = a;
|
|
10925
|
+
const d = new MutationObserver(() => {
|
|
10926
|
+
const u = r.getAttribute("data-edit-id"), l = r.innerHTML;
|
|
10927
|
+
n(u, l);
|
|
10913
10928
|
});
|
|
10914
|
-
|
|
10929
|
+
d.observe(r, {
|
|
10915
10930
|
childList: !0,
|
|
10916
10931
|
// Child elements added/removed
|
|
10917
10932
|
characterData: !0,
|
|
@@ -10922,7 +10937,7 @@ class vn {
|
|
|
10922
10937
|
// Attribute changes
|
|
10923
10938
|
attributeFilter: ["style"]
|
|
10924
10939
|
// Specifically watch style (color picker)
|
|
10925
|
-
}), r._cbObserver =
|
|
10940
|
+
}), r._cbObserver = d;
|
|
10926
10941
|
});
|
|
10927
10942
|
}
|
|
10928
10943
|
/**
|
|
@@ -10978,15 +10993,15 @@ class vn {
|
|
|
10978
10993
|
const d = o.dataset.cbType, u = this.plugins.get(d);
|
|
10979
10994
|
u && typeof u.unmount == "function" && u.unmount(o, a), this.components.delete(o);
|
|
10980
10995
|
});
|
|
10981
|
-
const
|
|
10996
|
+
const s = this.detectComponentTypesInContainer(e).filter(
|
|
10982
10997
|
(o) => this.config.plugins[o] && !this.plugins.has(o)
|
|
10983
10998
|
);
|
|
10984
|
-
|
|
10985
|
-
|
|
10999
|
+
s.length > 0 && await Promise.all(
|
|
11000
|
+
s.map((o) => this.loadPlugin(o))
|
|
10986
11001
|
);
|
|
10987
|
-
const
|
|
11002
|
+
const n = e.querySelectorAll("[data-cb-type]");
|
|
10988
11003
|
let r = 0;
|
|
10989
|
-
for (const o of
|
|
11004
|
+
for (const o of n) {
|
|
10990
11005
|
const a = o.dataset.cbType, d = this.plugins.get(a);
|
|
10991
11006
|
if (d && typeof d.mount == "function")
|
|
10992
11007
|
try {
|
|
@@ -11020,8 +11035,8 @@ class vn {
|
|
|
11020
11035
|
*/
|
|
11021
11036
|
detectComponentTypesInContainer(e) {
|
|
11022
11037
|
const t = /* @__PURE__ */ new Set();
|
|
11023
|
-
return e.querySelectorAll("[data-cb-type]").forEach((
|
|
11024
|
-
t.add(
|
|
11038
|
+
return e.querySelectorAll("[data-cb-type]").forEach((s) => {
|
|
11039
|
+
t.add(s.dataset.cbType);
|
|
11025
11040
|
}), Array.from(t);
|
|
11026
11041
|
}
|
|
11027
11042
|
/**
|
|
@@ -11053,13 +11068,13 @@ class vn {
|
|
|
11053
11068
|
source: "external",
|
|
11054
11069
|
loadedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
11055
11070
|
}, this.externalPlugins.set(e, this.config.plugins[e]);
|
|
11056
|
-
const
|
|
11071
|
+
const s = await this.loadPlugin(e);
|
|
11057
11072
|
return this.emit("external-plugin-loaded", {
|
|
11058
11073
|
pluginId: e,
|
|
11059
11074
|
url: t.url
|
|
11060
|
-
}),
|
|
11061
|
-
} catch (
|
|
11062
|
-
throw delete this.config.plugins[e], this.externalPlugins.delete(e), console.error(`[PluginManager] Failed to load external plugin "${e}":`,
|
|
11075
|
+
}), s;
|
|
11076
|
+
} catch (s) {
|
|
11077
|
+
throw delete this.config.plugins[e], this.externalPlugins.delete(e), console.error(`[PluginManager] Failed to load external plugin "${e}":`, s), s;
|
|
11063
11078
|
}
|
|
11064
11079
|
}
|
|
11065
11080
|
/**
|
|
@@ -11080,17 +11095,17 @@ class vn {
|
|
|
11080
11095
|
reason: "External plugins are disabled. Enable allowExternalPlugins in configuration."
|
|
11081
11096
|
};
|
|
11082
11097
|
if (this.config.trustedDomains.length > 0) {
|
|
11083
|
-
const
|
|
11098
|
+
const s = new URL(e).hostname;
|
|
11084
11099
|
if (!this.config.trustedDomains.some((r) => {
|
|
11085
11100
|
if (r.startsWith("*.")) {
|
|
11086
11101
|
const o = r.slice(2);
|
|
11087
|
-
return
|
|
11102
|
+
return s === o || s.endsWith("." + o);
|
|
11088
11103
|
}
|
|
11089
|
-
return
|
|
11104
|
+
return s === r;
|
|
11090
11105
|
}))
|
|
11091
11106
|
return {
|
|
11092
11107
|
allowed: !0,
|
|
11093
|
-
warning: `Loading plugin from external domain: ${
|
|
11108
|
+
warning: `Loading plugin from external domain: ${s}. Only add plugins from sources you trust.`
|
|
11094
11109
|
};
|
|
11095
11110
|
} else
|
|
11096
11111
|
return {
|
|
@@ -11106,12 +11121,12 @@ class vn {
|
|
|
11106
11121
|
*/
|
|
11107
11122
|
async loadExternalPlugins(e) {
|
|
11108
11123
|
const t = [];
|
|
11109
|
-
for (const [i,
|
|
11124
|
+
for (const [i, s] of Object.entries(e))
|
|
11110
11125
|
try {
|
|
11111
|
-
const
|
|
11112
|
-
t.push({ pluginId: i, success: !0, plugin:
|
|
11113
|
-
} catch (
|
|
11114
|
-
t.push({ pluginId: i, success: !1, error:
|
|
11126
|
+
const n = await this.loadExternalPlugin(i, s);
|
|
11127
|
+
t.push({ pluginId: i, success: !0, plugin: n });
|
|
11128
|
+
} catch (n) {
|
|
11129
|
+
t.push({ pluginId: i, success: !1, error: n.message }), console.error(`[PluginManager] Failed to load external plugin "${i}":`, n);
|
|
11115
11130
|
}
|
|
11116
11131
|
return t;
|
|
11117
11132
|
}
|
|
@@ -11123,10 +11138,10 @@ class vn {
|
|
|
11123
11138
|
if (!this.externalPlugins.has(e))
|
|
11124
11139
|
return console.warn(`[PluginManager] Plugin "${e}" is not an external plugin`), !1;
|
|
11125
11140
|
const t = this.plugins.get(e), i = [];
|
|
11126
|
-
return this.components.forEach((
|
|
11127
|
-
|
|
11128
|
-
}), i.forEach(({ element:
|
|
11129
|
-
t && typeof t.unmount == "function" && t.unmount(
|
|
11141
|
+
return this.components.forEach((s, n) => {
|
|
11142
|
+
n.dataset.cbType === e && i.push({ element: n, instance: s });
|
|
11143
|
+
}), i.forEach(({ element: s, instance: n }) => {
|
|
11144
|
+
t && typeof t.unmount == "function" && t.unmount(s, n), this.components.delete(s);
|
|
11130
11145
|
}), t && typeof t.destroy == "function" && t.destroy(this), this.plugins.delete(e), this.externalPlugins.delete(e), delete this.config.plugins[e], this.emit("plugin-unregistered", { pluginId: e }), !0;
|
|
11131
11146
|
}
|
|
11132
11147
|
/**
|
|
@@ -11148,13 +11163,15 @@ class vn {
|
|
|
11148
11163
|
* Destroy all components and plugins
|
|
11149
11164
|
*/
|
|
11150
11165
|
destroy() {
|
|
11151
|
-
this.components.forEach((
|
|
11152
|
-
const
|
|
11153
|
-
s && typeof s.unmount == "function" && s.unmount(
|
|
11154
|
-
}),
|
|
11155
|
-
t.
|
|
11156
|
-
|
|
11157
|
-
|
|
11166
|
+
this.components.forEach((e, t) => {
|
|
11167
|
+
const i = t.dataset.cbType, s = this.plugins.get(i);
|
|
11168
|
+
s && typeof s.unmount == "function" && s.unmount(t, e);
|
|
11169
|
+
}), this.components.forEach((e, t) => {
|
|
11170
|
+
t.querySelectorAll('.edit[contenteditable="true"]').forEach((s) => {
|
|
11171
|
+
s.removeAttribute("contenteditable"), s._cbObserver && (s._cbObserver.disconnect(), delete s._cbObserver), s._cbKeydownHandler && (s.removeEventListener("keydown", s._cbKeydownHandler), delete s._cbKeydownHandler);
|
|
11172
|
+
});
|
|
11173
|
+
}), this.plugins.forEach((e, t) => {
|
|
11174
|
+
typeof e.destroy == "function" && e.destroy(this);
|
|
11158
11175
|
}), this.components.clear(), this.plugins.clear();
|
|
11159
11176
|
}
|
|
11160
11177
|
/**
|
|
@@ -11301,18 +11318,18 @@ class wn {
|
|
|
11301
11318
|
skin: this.settings.skin
|
|
11302
11319
|
};
|
|
11303
11320
|
this.refreshLightbox(e), document.querySelectorAll(".is-lightbox,.block-click").forEach((i) => {
|
|
11304
|
-
const
|
|
11321
|
+
const s = (n) => {
|
|
11305
11322
|
let r = i.getAttribute("href") || i.getAttribute("data-modal-url");
|
|
11306
|
-
this.openLightbox(r, i, e),
|
|
11323
|
+
this.openLightbox(r, i, e), n.preventDefault(), n.stopImmediatePropagation();
|
|
11307
11324
|
};
|
|
11308
|
-
i.addEventListener("click",
|
|
11325
|
+
i.addEventListener("click", s), i._lightboxHandler = s;
|
|
11309
11326
|
});
|
|
11310
11327
|
}
|
|
11311
11328
|
refreshLightbox(e) {
|
|
11312
11329
|
this.glightbox && this.glightbox.destroy(), this.glightbox = new Ut(e), window.GLightbox = Ut.default;
|
|
11313
11330
|
}
|
|
11314
11331
|
openLightbox(e, t, i) {
|
|
11315
|
-
let
|
|
11332
|
+
let s = [], n = 0;
|
|
11316
11333
|
if (t) {
|
|
11317
11334
|
const o = t.closest("[data-gallery]");
|
|
11318
11335
|
let a = [];
|
|
@@ -11320,13 +11337,13 @@ class wn {
|
|
|
11320
11337
|
u.closest("[data-gallery]") || a.push(u);
|
|
11321
11338
|
}), a.forEach((d, u) => {
|
|
11322
11339
|
let l = d.getAttribute("href");
|
|
11323
|
-
l || (l = d.getAttribute("data-modal-url")),
|
|
11340
|
+
l || (l = d.getAttribute("data-modal-url")), s.push({
|
|
11324
11341
|
href: l
|
|
11325
|
-
}), e === l && (
|
|
11342
|
+
}), e === l && (n = u);
|
|
11326
11343
|
});
|
|
11327
11344
|
}
|
|
11328
11345
|
const r = document.activeElement;
|
|
11329
|
-
r?.blur(),
|
|
11346
|
+
r?.blur(), s.length > 0 ? (this.glightbox.setElements(s), this.glightbox.openAt(n)) : (this.glightbox.setElements([
|
|
11330
11347
|
{
|
|
11331
11348
|
href: e
|
|
11332
11349
|
}
|