@enegelai/bot-widget 1.17.1 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/enegelaibot.umd.js +105 -105
- package/dist/index.es.js +602 -530
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as x, customElement as
|
|
1
|
+
import { css as K, LitElement as Fe, html as b, nothing as Ae, svg as pe } from "lit";
|
|
2
|
+
import { property as x, customElement as J, query as xe, state as Va, queryAll as Ua, eventOptions as na } from "lit/decorators.js";
|
|
3
3
|
import { when as W } from "lit/directives/when.js";
|
|
4
4
|
import { unsafeHTML as G } from "lit-html/directives/unsafe-html.js";
|
|
5
5
|
import { registerIconLibrary as qi } from "@shoelace-style/shoelace";
|
|
@@ -29,7 +29,7 @@ import Wt from "highlight.js";
|
|
|
29
29
|
import "@shoelace-style/shoelace/dist/components/popup/popup.js";
|
|
30
30
|
import "@shoelace-style/shoelace/dist/components/rating/rating.js";
|
|
31
31
|
import { createRef as ji, ref as At } from "lit/directives/ref.js";
|
|
32
|
-
function
|
|
32
|
+
function Na(a) {
|
|
33
33
|
return typeof a == "function" ? a() : a;
|
|
34
34
|
}
|
|
35
35
|
const Ht = class Ht extends Event {
|
|
@@ -45,7 +45,7 @@ const Ht = class Ht extends Event {
|
|
|
45
45
|
};
|
|
46
46
|
Ht.eventName = "lit-state-changed";
|
|
47
47
|
let at = Ht;
|
|
48
|
-
const Hi = (a, e) => e !== a && (e === e || a === a),
|
|
48
|
+
const Hi = (a, e) => e !== a && (e === e || a === a), ua = class ua extends EventTarget {
|
|
49
49
|
static initPropertyMap() {
|
|
50
50
|
this.propertyMap || (this.propertyMap = /* @__PURE__ */ new Map());
|
|
51
51
|
}
|
|
@@ -58,7 +58,7 @@ const Hi = (a, e) => e !== a && (e === e || a === a), ba = class ba extends Even
|
|
|
58
58
|
constructor() {
|
|
59
59
|
super(), this.hookMap = /* @__PURE__ */ new Map(), this.constructor.finalize(), this.propertyMap && [...this.propertyMap].forEach(([e, t]) => {
|
|
60
60
|
if (t.initialValue !== void 0) {
|
|
61
|
-
const i =
|
|
61
|
+
const i = Na(t.initialValue);
|
|
62
62
|
this[e] = i, t.value = i;
|
|
63
63
|
}
|
|
64
64
|
});
|
|
@@ -119,8 +119,8 @@ const Hi = (a, e) => e !== a && (e === e || a === a), ba = class ba extends Even
|
|
|
119
119
|
this.dispatchEvent(new at(e, t, i));
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
|
|
123
|
-
let
|
|
122
|
+
ua.finalized = !1;
|
|
123
|
+
let Kt = ua;
|
|
124
124
|
class it {
|
|
125
125
|
constructor(e, t, i) {
|
|
126
126
|
this.host = e, this.state = t, this.callback = i || (() => this.host.requestUpdate()), this.host.addController(this);
|
|
@@ -156,18 +156,18 @@ function Vi(a, e) {
|
|
|
156
156
|
return a;
|
|
157
157
|
}
|
|
158
158
|
new URL(location.href);
|
|
159
|
-
const
|
|
159
|
+
const Ui = {
|
|
160
160
|
prefix: "_ls"
|
|
161
161
|
};
|
|
162
162
|
function ce(a) {
|
|
163
|
-
return a = { ...
|
|
163
|
+
return a = { ...Ui, ...a }, (e, t) => {
|
|
164
164
|
const i = Object.getOwnPropertyDescriptor(e, t);
|
|
165
165
|
if (!i)
|
|
166
166
|
throw new Error("@local-storage decorator need to be called after @property");
|
|
167
167
|
const s = `${a?.prefix || ""}_${a?.key || String(t)}`, r = e.constructor, o = r.propertyMap.get(t), f = o?.type;
|
|
168
168
|
if (o) {
|
|
169
169
|
const w = o.initialValue;
|
|
170
|
-
o.initialValue = () => Vi(localStorage.getItem(s), f) ??
|
|
170
|
+
o.initialValue = () => Vi(localStorage.getItem(s), f) ?? Na(w), r.propertyMap.set(t, { ...o, ...a });
|
|
171
171
|
}
|
|
172
172
|
const p = i?.set, k = {
|
|
173
173
|
...i,
|
|
@@ -181,12 +181,12 @@ function ce(a) {
|
|
|
181
181
|
function Wa(a) {
|
|
182
182
|
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
|
|
183
183
|
}
|
|
184
|
-
var Lt = { exports: {} },
|
|
184
|
+
var Lt = { exports: {} }, Ni = Lt.exports, _a;
|
|
185
185
|
function Wi() {
|
|
186
186
|
return _a || (_a = 1, (function(a) {
|
|
187
187
|
(function(e, t) {
|
|
188
188
|
a.exports ? a.exports = t() : e.log = t();
|
|
189
|
-
})(
|
|
189
|
+
})(Ni, function() {
|
|
190
190
|
var e = function() {
|
|
191
191
|
}, t = "undefined", i = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
|
|
192
192
|
"trace",
|
|
@@ -230,18 +230,18 @@ function Wi() {
|
|
|
230
230
|
return v(M) || w.apply(this, arguments);
|
|
231
231
|
}
|
|
232
232
|
function P(M, L) {
|
|
233
|
-
var C = this, Z,
|
|
233
|
+
var C = this, Z, N, X, te = "loglevel";
|
|
234
234
|
typeof M == "string" ? te += ":" + M : typeof M == "symbol" && (te = void 0);
|
|
235
235
|
function He(H) {
|
|
236
|
-
var
|
|
236
|
+
var U = (s[H] || "silent").toUpperCase();
|
|
237
237
|
if (!(typeof window === t || !te)) {
|
|
238
238
|
try {
|
|
239
|
-
window.localStorage[te] =
|
|
239
|
+
window.localStorage[te] = U;
|
|
240
240
|
return;
|
|
241
241
|
} catch {
|
|
242
242
|
}
|
|
243
243
|
try {
|
|
244
|
-
window.document.cookie = encodeURIComponent(te) + "=" +
|
|
244
|
+
window.document.cookie = encodeURIComponent(te) + "=" + U + ";";
|
|
245
245
|
} catch {
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -255,9 +255,9 @@ function Wi() {
|
|
|
255
255
|
}
|
|
256
256
|
if (typeof H === t)
|
|
257
257
|
try {
|
|
258
|
-
var
|
|
258
|
+
var U = window.document.cookie, $e = encodeURIComponent(te), Pe = U.indexOf($e + "=");
|
|
259
259
|
Pe !== -1 && (H = /^([^;]+)/.exec(
|
|
260
|
-
|
|
260
|
+
U.slice(Pe + $e.length + 1)
|
|
261
261
|
)[1]);
|
|
262
262
|
} catch {
|
|
263
263
|
}
|
|
@@ -277,9 +277,9 @@ function Wi() {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
function ge(H) {
|
|
280
|
-
var
|
|
281
|
-
if (typeof
|
|
282
|
-
return
|
|
280
|
+
var U = H;
|
|
281
|
+
if (typeof U == "string" && C.levels[U.toUpperCase()] !== void 0 && (U = C.levels[U.toUpperCase()]), typeof U == "number" && U >= 0 && U <= C.levels.SILENT)
|
|
282
|
+
return U;
|
|
283
283
|
throw new TypeError("log.setLevel() called with invalid level: " + H);
|
|
284
284
|
}
|
|
285
285
|
C.name = M, C.levels = {
|
|
@@ -290,11 +290,11 @@ function Wi() {
|
|
|
290
290
|
ERROR: 4,
|
|
291
291
|
SILENT: 5
|
|
292
292
|
}, C.methodFactory = L || _, C.getLevel = function() {
|
|
293
|
-
return X ??
|
|
294
|
-
}, C.setLevel = function(H,
|
|
295
|
-
return X = ge(H),
|
|
293
|
+
return X ?? N ?? Z;
|
|
294
|
+
}, C.setLevel = function(H, U) {
|
|
295
|
+
return X = ge(H), U !== !1 && He(X), k.call(C);
|
|
296
296
|
}, C.setDefaultLevel = function(H) {
|
|
297
|
-
|
|
297
|
+
N = ge(H), ae() || C.setLevel(H, !1);
|
|
298
298
|
}, C.resetLevel = function() {
|
|
299
299
|
X = null, he(), k.call(C);
|
|
300
300
|
}, C.enableAll = function(H) {
|
|
@@ -330,7 +330,7 @@ function Wi() {
|
|
|
330
330
|
})(Lt)), Lt.exports;
|
|
331
331
|
}
|
|
332
332
|
var Gi = Wi();
|
|
333
|
-
const
|
|
333
|
+
const Ke = /* @__PURE__ */ Wa(Gi), Xi = K`
|
|
334
334
|
:host {
|
|
335
335
|
--enegelai-bot-width: 420px;
|
|
336
336
|
--enegelai-bot-base-font-size: 16px;
|
|
@@ -414,7 +414,7 @@ const Je = /* @__PURE__ */ Wa(Gi), Xi = J`
|
|
|
414
414
|
border-radius: 0;
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
`, ke =
|
|
417
|
+
`, ke = K`
|
|
418
418
|
:host {
|
|
419
419
|
--primary-color: var(--sl-color-primary-600);
|
|
420
420
|
}
|
|
@@ -638,7 +638,7 @@ const Je = /* @__PURE__ */ Wa(Gi), Xi = J`
|
|
|
638
638
|
}
|
|
639
639
|
|
|
640
640
|
|
|
641
|
-
`, Ga =
|
|
641
|
+
`, Ga = K`
|
|
642
642
|
${ke}
|
|
643
643
|
|
|
644
644
|
:host {
|
|
@@ -663,30 +663,30 @@ const Je = /* @__PURE__ */ Wa(Gi), Xi = J`
|
|
|
663
663
|
color: white;
|
|
664
664
|
}
|
|
665
665
|
`;
|
|
666
|
-
var Yi = Object.defineProperty,
|
|
667
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
666
|
+
var Yi = Object.defineProperty, Ki = Object.getOwnPropertyDescriptor, ra = (a, e, t, i) => {
|
|
667
|
+
for (var s = i > 1 ? void 0 : i ? Ki(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
668
668
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
669
669
|
return i && s && Yi(e, t, s), s;
|
|
670
670
|
};
|
|
671
|
-
let
|
|
671
|
+
let bt = class extends Fe {
|
|
672
672
|
constructor() {
|
|
673
673
|
super(...arguments), this.color = "primary", this.svg = "";
|
|
674
674
|
}
|
|
675
675
|
render() {
|
|
676
|
-
return
|
|
676
|
+
return b`<span class="cb-icon" part="base">${G(this.svg)}</span>`;
|
|
677
677
|
}
|
|
678
678
|
};
|
|
679
|
-
|
|
679
|
+
bt.styles = Ga;
|
|
680
680
|
ra([
|
|
681
681
|
x({ type: String })
|
|
682
|
-
],
|
|
682
|
+
], bt.prototype, "color", 2);
|
|
683
683
|
ra([
|
|
684
684
|
x({ type: String })
|
|
685
|
-
],
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
],
|
|
689
|
-
let
|
|
685
|
+
], bt.prototype, "svg", 2);
|
|
686
|
+
bt = ra([
|
|
687
|
+
J("cb-icon")
|
|
688
|
+
], bt);
|
|
689
|
+
let Ji = (a) => crypto.getRandomValues(new Uint8Array(a)), Zi = (a, e, t) => {
|
|
690
690
|
let i = (2 << Math.log2(a.length - 1)) - 1, s = -~(1.6 * i * e / a.length);
|
|
691
691
|
return (r = e) => {
|
|
692
692
|
let o = "";
|
|
@@ -696,7 +696,7 @@ let Ki = (a) => crypto.getRandomValues(new Uint8Array(a)), Zi = (a, e, t) => {
|
|
|
696
696
|
if (o += a[f[p] & i] || "", o.length >= r) return o;
|
|
697
697
|
}
|
|
698
698
|
};
|
|
699
|
-
}, Qi = (a, e = 21) => Zi(a, e | 0,
|
|
699
|
+
}, Qi = (a, e = 21) => Zi(a, e | 0, Ji);
|
|
700
700
|
const es = Qi("1234567890abcdefghijklmnopqrstuvwxyz", 10);
|
|
701
701
|
function fe(a = 10) {
|
|
702
702
|
return es(a);
|
|
@@ -728,26 +728,26 @@ function Vt(a) {
|
|
|
728
728
|
let i = a.replace(/https?:\/\/[^\s<]+/g, (s) => s.replace(/&/g, e)).replace(/&(?!lt;|gt;)/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
729
729
|
return i = i.replace(/<br\s*\/?>/gi, "<br>"), i = i.replace(new RegExp(e, "g"), "&"), i;
|
|
730
730
|
}
|
|
731
|
-
const
|
|
732
|
-
|
|
731
|
+
const ne = Ke.noConflict();
|
|
732
|
+
ne.setLevel("info");
|
|
733
733
|
const Sa = 3e4;
|
|
734
734
|
class as {
|
|
735
735
|
constructor(e = {}) {
|
|
736
|
-
this.id = 0, this.url = e?.url || null, this.orgId = e?.orgId || null, this.botId = e?.botId || null, this.convId = e?.convId || null, this._options = e || {}, this._ws = null, this.started = !1, this.connected = !1, this.connecting = !1, this.suspendDetected = !1, this.onMessage = e?.onMessage || null, this.onConnecting = e?.onConnecting || null, this.onConnectError = e?.onConnectError || null, this.onClose = e?.onClose || null, this.queue = e?.queue || [], this.pause = (t) => new Promise((i) => setTimeout(i, t)), this.lastTickTs = 0, this.lastAckTs = 0, this.tickInterval = null,
|
|
736
|
+
this.id = 0, this.url = e?.url || null, this.orgId = e?.orgId || null, this.botId = e?.botId || null, this.convId = e?.convId || null, this._options = e || {}, this._ws = null, this.started = !1, this.connected = !1, this.connecting = !1, this.suspendDetected = !1, this.onMessage = e?.onMessage || null, this.onConnecting = e?.onConnecting || null, this.onConnectError = e?.onConnectError || null, this.onClose = e?.onClose || null, this.queue = e?.queue || [], this.pause = (t) => new Promise((i) => setTimeout(i, t)), this.lastTickTs = 0, this.lastAckTs = 0, this.tickInterval = null, ne.info(`WSC: Created, url: ${this.url}`);
|
|
737
737
|
}
|
|
738
738
|
connect(e = {}) {
|
|
739
739
|
if (this._ws)
|
|
740
|
-
return
|
|
740
|
+
return ne.info("WSC: connect - already connecting"), null;
|
|
741
741
|
if (this.url = e?.url || this.url, this.connected = !1, !this.url)
|
|
742
|
-
return
|
|
742
|
+
return ne.error("WSC: URL must be provided to connect"), null;
|
|
743
743
|
this.setConnecting(!0);
|
|
744
744
|
const t = this.url;
|
|
745
|
-
|
|
745
|
+
ne.info(`WSC: ${Date.now()}: Connecting to ${t} ...`), this._ws = new WebSocket(t);
|
|
746
746
|
let i = setTimeout(() => {
|
|
747
|
-
|
|
747
|
+
ne.error(`WSC: ${Date.now()}: connected message not received in time - closing ...`), this._ws.close(), this._ws = null, this.connected = !1;
|
|
748
748
|
}, 3e4);
|
|
749
749
|
this._ws.onopen = () => {
|
|
750
|
-
|
|
750
|
+
ne.info(`WSC: ${Date.now()}: Connection to ${t} opened`);
|
|
751
751
|
}, this._ws.onmessage = (s) => {
|
|
752
752
|
let r = s?.data || null;
|
|
753
753
|
if (!r)
|
|
@@ -756,13 +756,13 @@ class as {
|
|
|
756
756
|
try {
|
|
757
757
|
o = JSON.parse(r);
|
|
758
758
|
} catch {
|
|
759
|
-
|
|
759
|
+
ne.error(`WSC: ${Date.now()}: Failed to parse message: ${r}`);
|
|
760
760
|
return;
|
|
761
761
|
}
|
|
762
762
|
if (o?.type === "connected")
|
|
763
|
-
|
|
763
|
+
ne.info(`WSC: ${Date.now()}: Got connected message`, o), clearTimeout(i), this.connected = !0, this.suspendDetected = !1, this.lastTickTs = Date.now(), this.setConnecting(!1), this.sendClientInfoMessage(), this.sendQueuedMessages();
|
|
764
764
|
else if (o?.type === "connection-error")
|
|
765
|
-
|
|
765
|
+
ne.error(`WSC: ${Date.now()}: Connect error`, o), clearTimeout(i), this.stop().catch(() => {
|
|
766
766
|
}), this.handleWscConnectError(o);
|
|
767
767
|
else if (o?.type === "ack") {
|
|
768
768
|
const f = Date.now();
|
|
@@ -770,9 +770,9 @@ class as {
|
|
|
770
770
|
}
|
|
771
771
|
this.handleWscMessage(o);
|
|
772
772
|
}, this._ws.onerror = (s) => {
|
|
773
|
-
|
|
773
|
+
ne.error(`WSC: ${Date.now()}: Socket error`), clearTimeout(i), this.connected = !1, this._ws = null, this.setConnecting(!1);
|
|
774
774
|
}, this._ws.onclose = (s) => {
|
|
775
|
-
|
|
775
|
+
ne.info(`WSC: ${Date.now()}: Closed - code:${s.code}, reason:"${s.reason}"`), this.connected = !1, this._ws = null, this.handleWscClose(s), this.setConnecting(!1), this.reconnect();
|
|
776
776
|
};
|
|
777
777
|
}
|
|
778
778
|
reconnect(e = 1e3) {
|
|
@@ -782,10 +782,10 @@ class as {
|
|
|
782
782
|
}
|
|
783
783
|
disconnect() {
|
|
784
784
|
if (this.connected = !1, !this._ws) {
|
|
785
|
-
|
|
785
|
+
ne.info("WSC: already disconnected");
|
|
786
786
|
return;
|
|
787
787
|
}
|
|
788
|
-
|
|
788
|
+
ne.info("WSC: disconnect"), this._ws.close();
|
|
789
789
|
}
|
|
790
790
|
setConnecting(e = !1) {
|
|
791
791
|
this.connecting !== e && (this.connecting = e, this.onConnecting && typeof this.onConnecting == "function" && this.onConnecting(this.connecting));
|
|
@@ -808,11 +808,11 @@ class as {
|
|
|
808
808
|
async startOld() {
|
|
809
809
|
let e = 1, t = !0;
|
|
810
810
|
for (; t; ) {
|
|
811
|
-
if (
|
|
812
|
-
return
|
|
811
|
+
if (ne.info(`WSC: start: connecting, attempt ${e}`), await this.connect(), this.connected)
|
|
812
|
+
return ne.info("WSC: connected"), !0;
|
|
813
813
|
e++, t = e <= 4, t && await this.pause(1e3);
|
|
814
814
|
}
|
|
815
|
-
return
|
|
815
|
+
return ne.error(`WSC: start: failed to connect after ${e} attempts, exiting`), !1;
|
|
816
816
|
}
|
|
817
817
|
handleWscConnectError(e) {
|
|
818
818
|
this.onConnectError && typeof this.onConnectError == "function" && this.onConnectError(e);
|
|
@@ -842,7 +842,7 @@ class as {
|
|
|
842
842
|
const e = Date.now();
|
|
843
843
|
let t = !1;
|
|
844
844
|
const i = e - this.lastAckTs;
|
|
845
|
-
i > Sa + 5e3 && (t = !0,
|
|
845
|
+
i > Sa + 5e3 && (t = !0, ne.info(`WSC: checkConnection: connection loss detected - last ack delay ${i} msec, reconnecting`)), t && this.disconnect();
|
|
846
846
|
}
|
|
847
847
|
sendMessage(e) {
|
|
848
848
|
if (this.checkConnection(), !this.connected) {
|
|
@@ -857,7 +857,7 @@ class as {
|
|
|
857
857
|
sendQueuedMessages() {
|
|
858
858
|
if (Array.isArray(this.queue) && this.queue.length > 0)
|
|
859
859
|
for (let e = 0; e < this.queue.length; e++)
|
|
860
|
-
|
|
860
|
+
ne.info("Sending queued message", this.queue[e]), this._ws.send(this.queue[e]);
|
|
861
861
|
this.queue = [];
|
|
862
862
|
}
|
|
863
863
|
// Request assumes that response will be received.
|
|
@@ -930,7 +930,7 @@ class is {
|
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
class
|
|
933
|
+
class Je {
|
|
934
934
|
/**
|
|
935
935
|
* Converts Float32Array of amplitude data to ArrayBuffer in Int16Array format
|
|
936
936
|
* @param {Float32Array} float32Array
|
|
@@ -1025,7 +1025,7 @@ class Ke {
|
|
|
1025
1025
|
};
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
1028
|
-
globalThis.WavPacker =
|
|
1028
|
+
globalThis.WavPacker = Je;
|
|
1029
1029
|
const Ca = [
|
|
1030
1030
|
4186.01,
|
|
1031
1031
|
4434.92,
|
|
@@ -1079,9 +1079,9 @@ class lt {
|
|
|
1079
1079
|
const E = s === "voice" ? Aa : We, M = Array(E.length).fill(r);
|
|
1080
1080
|
for (let L = 0; L < i.length; L++) {
|
|
1081
1081
|
const C = L * p, Z = i[L];
|
|
1082
|
-
for (let
|
|
1083
|
-
if (C > E[
|
|
1084
|
-
M[
|
|
1082
|
+
for (let N = E.length - 1; N >= 0; N--)
|
|
1083
|
+
if (C > E[N]) {
|
|
1084
|
+
M[N] = Math.max(M[N], Z);
|
|
1085
1085
|
break;
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
@@ -1909,9 +1909,9 @@ class AudioProcessor extends AudioWorkletProcessor {
|
|
|
1909
1909
|
}
|
|
1910
1910
|
|
|
1911
1911
|
registerProcessor('audio_processor', AudioProcessor);
|
|
1912
|
-
`,
|
|
1912
|
+
`, us = new Blob([hs], {
|
|
1913
1913
|
type: "application/javascript"
|
|
1914
|
-
}),
|
|
1914
|
+
}), bs = URL.createObjectURL(us), ps = bs;
|
|
1915
1915
|
class gs {
|
|
1916
1916
|
/**
|
|
1917
1917
|
* Create a new WavRecorder instance
|
|
@@ -1959,13 +1959,13 @@ class gs {
|
|
|
1959
1959
|
throw new Error('Must specify "fromSampleRate" when reading from Float32Array, In16Array or Array');
|
|
1960
1960
|
if (i < 3e3)
|
|
1961
1961
|
throw new Error('Minimum "fromSampleRate" is 3000 (3kHz)');
|
|
1962
|
-
w || (w =
|
|
1962
|
+
w || (w = Je.floatTo16BitPCM(k));
|
|
1963
1963
|
const _ = {
|
|
1964
1964
|
bitsPerSample: 16,
|
|
1965
1965
|
channels: [k],
|
|
1966
1966
|
data: w
|
|
1967
1967
|
};
|
|
1968
|
-
o = new
|
|
1968
|
+
o = new Je().pack(i, _).blob, r = await o.arrayBuffer();
|
|
1969
1969
|
}
|
|
1970
1970
|
const f = await s.decodeAudioData(r), p = f.getChannelData(0), v = URL.createObjectURL(o);
|
|
1971
1971
|
return {
|
|
@@ -2138,8 +2138,8 @@ class gs {
|
|
|
2138
2138
|
if (this._chunkProcessorSize) {
|
|
2139
2139
|
const w = this._chunkProcessorBuffer;
|
|
2140
2140
|
this._chunkProcessorBuffer = {
|
|
2141
|
-
raw:
|
|
2142
|
-
mono:
|
|
2141
|
+
raw: Je.mergeBuffers(w.raw, k.raw),
|
|
2142
|
+
mono: Je.mergeBuffers(w.mono, k.mono)
|
|
2143
2143
|
}, this._chunkProcessorBuffer.mono.byteLength >= this._chunkProcessorSize && (this._chunkProcessor(this._chunkProcessorBuffer), this._chunkProcessorBuffer = {
|
|
2144
2144
|
raw: new ArrayBuffer(0),
|
|
2145
2145
|
mono: new ArrayBuffer(0)
|
|
@@ -2225,7 +2225,7 @@ use only for debugging`), o.connect(t.destination)), this.source = i, this.node
|
|
|
2225
2225
|
throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");
|
|
2226
2226
|
this.log("Exporting ...");
|
|
2227
2227
|
const t = await this._event("export");
|
|
2228
|
-
return new
|
|
2228
|
+
return new Je().pack(this.sampleRate, t.audio);
|
|
2229
2229
|
}
|
|
2230
2230
|
/**
|
|
2231
2231
|
* Ends the current recording session and saves the result
|
|
@@ -2237,7 +2237,7 @@ use only for debugging`), o.connect(t.destination)), this.source = i, this.node
|
|
|
2237
2237
|
const e = this.processor;
|
|
2238
2238
|
this.log("Stopping ..."), await this._event("stop"), this.recording = !1, this.stream.getTracks().forEach((o) => o.stop()), this.log("Exporting ...");
|
|
2239
2239
|
const i = await this._event("export", {}, e);
|
|
2240
|
-
return this.processor.disconnect(), this.source.disconnect(), this.node.disconnect(), this.analyser.disconnect(), this.stream = null, this.processor = null, this.source = null, this.node = null, new
|
|
2240
|
+
return this.processor.disconnect(), this.source.disconnect(), this.node.disconnect(), this.analyser.disconnect(), this.stream = null, this.processor = null, this.source = null, this.node = null, new Je().pack(this.sampleRate, i.audio);
|
|
2241
2241
|
}
|
|
2242
2242
|
/**
|
|
2243
2243
|
* Performs a full cleanup of WavRecorder instance
|
|
@@ -2590,15 +2590,15 @@ class ys {
|
|
|
2590
2590
|
this.guardRemain > 0 && this.guardRemain--;
|
|
2591
2591
|
const M = e[E] / 32768, L = M * M;
|
|
2592
2592
|
f = f + (1 - this.alphaFast) * (L - f), p = p + (1 - this.alphaSlow) * (L - p), this.vadEnabled && (f / (p + _) >= P ? v < this.vadAttackSamples && v++ : v = 0, v >= this.vadAttackSamples ? (w = !0, k = this.vadHangSamples) : k > 0 ? (w = !0, k--) : w = !1), w && this._shieldActive && (this._shieldActive = !1, this.target = 1, o = this.escapeAttackSamples, r = o > 0 ? (1 - s) / o : 0);
|
|
2593
|
-
let C = 1, Z = 0,
|
|
2593
|
+
let C = 1, Z = 0, N = !1;
|
|
2594
2594
|
if (this.duckActive) {
|
|
2595
2595
|
const te = this.guardRemain > 0;
|
|
2596
|
-
te && this._shieldActive && !w ? (
|
|
2596
|
+
te && this._shieldActive && !w ? (N = this._shieldHardMute, C = this._shieldHardMute ? 0 : this._shieldFloor, Z = this.attackSamples, this.guardRemain === 0 && (this._shieldActive = !1, this._shieldHardMute = !1)) : w ? (C = 1, Z = this.escapeAttackSamples) : te ? (C = this.floor, Z = this.attackSamples) : (C = 1, Z = this.releaseSamples);
|
|
2597
2597
|
} else
|
|
2598
2598
|
C = 1, Z = this.releaseSamples;
|
|
2599
2599
|
Math.abs(C - this.target) > 1e-4 && (this.target = C, o = Z, r = o > 0 ? (C - s) / o : 0, o === 0 && (s = C)), o > 0 && (s += r, o--, o === 0 && (s = this.target, r = 0));
|
|
2600
2600
|
let X;
|
|
2601
|
-
|
|
2601
|
+
N && !w ? X = 0 : (X = e[E] * s, X > 32767 ? X = 32767 : X < -32768 && (X = -32768)), i[E] = X | 0;
|
|
2602
2602
|
}
|
|
2603
2603
|
return this.gain = s, this._step = r, this.rampRemain = o, this.vadFast = f, this.vadSlow = p, this._speechCount = v, this._hangRemain = k, this._speaking = w, i;
|
|
2604
2604
|
}
|
|
@@ -2702,14 +2702,14 @@ class vs {
|
|
|
2702
2702
|
}
|
|
2703
2703
|
E = Math.sqrt(E) + 1e-12;
|
|
2704
2704
|
const M = this.sr / this.ds, L = (this.baseLatencySec + this.outputLatencySec) * 1e3 + this.latencyCompMs, C = Math.max(0, Math.round(L * M / 1e3)), Z = Math.max(1, Math.round(this.windowMs * M / 1e3));
|
|
2705
|
-
let
|
|
2706
|
-
C > 0 && (
|
|
2705
|
+
let N = 0, X = k;
|
|
2706
|
+
C > 0 && (N = Math.max(0, Math.min(k, C - Z)), X = Math.max(N, Math.min(k, C + Z)));
|
|
2707
2707
|
const te = Math.max(1, Math.floor(this.hop / this.ds));
|
|
2708
2708
|
let He = -1;
|
|
2709
|
-
for (let ae =
|
|
2709
|
+
for (let ae = N; ae <= X; ae += te) {
|
|
2710
2710
|
let he = 0, ge = 0;
|
|
2711
|
-
for (let
|
|
2712
|
-
const $e = _[
|
|
2711
|
+
for (let U = 0; U < o; U++) {
|
|
2712
|
+
const $e = _[U], Pe = P[ae + U];
|
|
2713
2713
|
he += $e * Pe, ge += Pe * Pe;
|
|
2714
2714
|
}
|
|
2715
2715
|
const j = E * (Math.sqrt(ge) + 1e-12), H = j > 0 ? he / j : 0;
|
|
@@ -2954,8 +2954,8 @@ class xs {
|
|
|
2954
2954
|
}
|
|
2955
2955
|
}
|
|
2956
2956
|
}
|
|
2957
|
-
const
|
|
2958
|
-
|
|
2957
|
+
const Ne = Ke.noConflict();
|
|
2958
|
+
Ne.setLevel("info");
|
|
2959
2959
|
class pt extends is {
|
|
2960
2960
|
constructor(e = {}) {
|
|
2961
2961
|
super({ name: "WebAudioProcessorV2" }), this.options = e, this.muted = !1, this.audioRecorder = new ot({
|
|
@@ -3034,13 +3034,13 @@ class pt extends is {
|
|
|
3034
3034
|
e(), this._latencyTimer = setInterval(e, 1e3);
|
|
3035
3035
|
try {
|
|
3036
3036
|
const t = this.audioRecorder.captureInfo?.aecGranted;
|
|
3037
|
-
t &&
|
|
3037
|
+
t && Ne.info("AEC granted:", t);
|
|
3038
3038
|
} catch {
|
|
3039
3039
|
}
|
|
3040
|
-
|
|
3040
|
+
Ne.info("WebAudioProcessorV2 started");
|
|
3041
3041
|
}
|
|
3042
3042
|
async stop() {
|
|
3043
|
-
this._stopRecWatchdog(), this.audioRecorder.getStatus() !== "ended" && (await this.audioRecorder.end(), this.audioRecorder = null), this.audioRecorderAnalyzer = null, this.audioPlayer?.context && (await this.audioPlayer.disconnect(), this.audioPlayer = null), this._latencyTimer && (clearInterval(this._latencyTimer), this._latencyTimer = null), this._didPlayOnce = !1,
|
|
3043
|
+
this._stopRecWatchdog(), this.audioRecorder.getStatus() !== "ended" && (await this.audioRecorder.end(), this.audioRecorder = null), this.audioRecorderAnalyzer = null, this.audioPlayer?.context && (await this.audioPlayer.disconnect(), this.audioPlayer = null), this._latencyTimer && (clearInterval(this._latencyTimer), this._latencyTimer = null), this._didPlayOnce = !1, Ne.info("WebAudioProcessorV2 stopped");
|
|
3044
3044
|
}
|
|
3045
3045
|
get started() {
|
|
3046
3046
|
return !!(this.audioRecorder && this.audioRecorder.getStatus() !== "ended");
|
|
@@ -3062,7 +3062,7 @@ class pt extends is {
|
|
|
3062
3062
|
}
|
|
3063
3063
|
async _checkRecordingHealth(e) {
|
|
3064
3064
|
const i = Date.now() - this._lastMicCaptureTime;
|
|
3065
|
-
i > 2e3 && (
|
|
3065
|
+
i > 2e3 && (Ne.warn(`WebAudioProcessorV2: large gap between mic frames: ${i} ms detected, possible lock or suspend - terminating audio`), this.emit("terminate").catch(() => {
|
|
3066
3066
|
}));
|
|
3067
3067
|
}
|
|
3068
3068
|
// ---- Capture ----
|
|
@@ -3071,7 +3071,7 @@ class pt extends is {
|
|
|
3071
3071
|
* Your existing 'audio' event is preserved: payload includes base64 of Int16 PCM.
|
|
3072
3072
|
*/
|
|
3073
3073
|
async beginAudioCapture() {
|
|
3074
|
-
!this.started || this.recording || (
|
|
3074
|
+
!this.started || this.recording || (Ne.info("WebAudioProcessorV2: beginAudioCapture"), this._lastMicCaptureTime = Date.now(), this._startRecWatchdog(), await this.audioRecorder.record((e) => {
|
|
3075
3075
|
if (e?.mono && e.mono?.byteLength) {
|
|
3076
3076
|
this._lastMicCaptureTime = Date.now();
|
|
3077
3077
|
let t = new Int16Array(e.mono);
|
|
@@ -3081,12 +3081,12 @@ class pt extends is {
|
|
|
3081
3081
|
const i = this.useAdaptiveSuppressor ? this.mixMinusSmooth.filterMicFrame(t) : this.mixMinus.filterMicFrame(t) || new Int16Array(0);
|
|
3082
3082
|
if (i.length === 0) return;
|
|
3083
3083
|
const s = pt.arrayBufferToBase64(i);
|
|
3084
|
-
|
|
3084
|
+
Ne.info(`Audio: mono ${e.mono.byteLength} bytes, base64 ${s.length} bytes`), this.emit("audio", { audio: s });
|
|
3085
3085
|
}
|
|
3086
3086
|
}));
|
|
3087
3087
|
}
|
|
3088
3088
|
async endAudioCapture() {
|
|
3089
|
-
!this.started || !this.recording || (
|
|
3089
|
+
!this.started || !this.recording || (Ne.info("WebAudioProcessorV2: endAudioCapture"), this._stopRecWatchdog(), await this.audioRecorder.pause());
|
|
3090
3090
|
}
|
|
3091
3091
|
// ---- Playback ----
|
|
3092
3092
|
/**
|
|
@@ -3208,7 +3208,7 @@ function Ss() {
|
|
|
3208
3208
|
}
|
|
3209
3209
|
return a;
|
|
3210
3210
|
}
|
|
3211
|
-
function
|
|
3211
|
+
function Ka(a) {
|
|
3212
3212
|
const e = Ss(), t = document.createElement("cb-toast");
|
|
3213
3213
|
return t.message = a.message, t.variant = a.variant ?? "success", t.duration = typeof a.duration == "number" ? a.duration : 3e3, t.closeable = !!a.closeable, t.icon = a.icon ?? "", t.ariaLive = a.ariaLive ?? "polite", e.appendChild(t), t;
|
|
3214
3214
|
}
|
|
@@ -3231,17 +3231,17 @@ let qe = class extends Fe {
|
|
|
3231
3231
|
}
|
|
3232
3232
|
render() {
|
|
3233
3233
|
const a = ["toast", this.variant, this._open ? "open" : "", this._closing ? "closing" : ""].filter(Boolean).join(" "), e = this.icon || this._defaultIcons[this.variant] || this._defaultIcons.success;
|
|
3234
|
-
return
|
|
3234
|
+
return b`
|
|
3235
3235
|
<div
|
|
3236
3236
|
class=${a}
|
|
3237
3237
|
role="status"
|
|
3238
3238
|
aria-live=${this.ariaLive}
|
|
3239
3239
|
>
|
|
3240
|
-
${
|
|
3240
|
+
${b`<span class="icon" aria-hidden="true">${this._renderIcon(e)}</span>`}
|
|
3241
3241
|
<div class="msg">
|
|
3242
|
-
${this.message ?
|
|
3242
|
+
${this.message ? b`${this.message}` : b`<slot></slot>`}
|
|
3243
3243
|
</div>
|
|
3244
|
-
${this.closeable ?
|
|
3244
|
+
${this.closeable ? b`<button class="close" @click=${this.close} aria-label="Close">×</button>` : Ae}
|
|
3245
3245
|
</div>
|
|
3246
3246
|
`;
|
|
3247
3247
|
}
|
|
@@ -3256,10 +3256,10 @@ let qe = class extends Fe {
|
|
|
3256
3256
|
this._timer && (clearTimeout(this._timer), this._timer = void 0);
|
|
3257
3257
|
}
|
|
3258
3258
|
_renderIcon(a) {
|
|
3259
|
-
return a.trim().startsWith("<") ?
|
|
3259
|
+
return a.trim().startsWith("<") ? b`${G(a)}` : a;
|
|
3260
3260
|
}
|
|
3261
3261
|
};
|
|
3262
|
-
qe.styles =
|
|
3262
|
+
qe.styles = K`
|
|
3263
3263
|
:host {
|
|
3264
3264
|
display: block;
|
|
3265
3265
|
pointer-events: auto; /* receive pointer events within toast */
|
|
@@ -3386,7 +3386,7 @@ st([
|
|
|
3386
3386
|
x({ type: String })
|
|
3387
3387
|
], qe.prototype, "ariaLive", 2);
|
|
3388
3388
|
qe = st([
|
|
3389
|
-
|
|
3389
|
+
J("cb-toast")
|
|
3390
3390
|
], qe);
|
|
3391
3391
|
function Q(a) {
|
|
3392
3392
|
return a != null && typeof a == "object" && a["@@functional/placeholder"] === !0;
|
|
@@ -3476,18 +3476,18 @@ var $s = Object.defineProperty, O = (a, e, t, i) => {
|
|
|
3476
3476
|
(o = a[r]) && (s = o(e, t, s) || s);
|
|
3477
3477
|
return s && $s(e, t, s), s;
|
|
3478
3478
|
};
|
|
3479
|
-
const T =
|
|
3479
|
+
const T = Ke.noConflict();
|
|
3480
3480
|
T.setLevel("info");
|
|
3481
|
-
const
|
|
3482
|
-
class R extends
|
|
3481
|
+
const ie = "cb_", Ps = (a) => new Promise((e) => setTimeout(e, a));
|
|
3482
|
+
class R extends Kt {
|
|
3483
3483
|
constructor() {
|
|
3484
|
-
super(), this.actionIdCounter = 0, this.currentLoadContext = {}, this.prefilledFormValues = {}, this.wsClient = null, this.webAudioProcessor = null, this.webAudioTrackId = null, this.webAudioCurrentMark = null, this.replyMessage = null, this.streamingResponseInProgress = !1, this.streamingResponseLastText = null, this.streamingResponseBuffer = null, this.streamingResponseTagStartPos = 0, this.streamingResponseCurrentTag = null, this.tabsBroadcastChannel = new BroadcastChannel("c7o-bot-tabs"), this.tabId = "c7o-bot-tab-" + (self.crypto?.randomUUID?.() || Math.random().toString(36).slice(2)), this.tabsBroadcastChannel.addEventListener("message", this.handleBroadcastMessage.bind(this)), console.log(`c7o: AppState: created, tabId=${this.tabId}`);
|
|
3484
|
+
super(), this.actionIdCounter = 0, this.currentLoadContext = {}, this.prefilledFormValues = {}, this.wsClient = null, this.checkConnectionPromise = null, this.webAudioProcessor = null, this.webAudioTrackId = null, this.webAudioCurrentMark = null, this.replyMessage = null, this.streamingResponseInProgress = !1, this.streamingResponseLastText = null, this.streamingResponseBuffer = null, this.streamingResponseTagStartPos = 0, this.streamingResponseCurrentTag = null, this.tabsBroadcastChannel = new BroadcastChannel("c7o-bot-tabs"), this.tabId = "c7o-bot-tab-" + (self.crypto?.randomUUID?.() || Math.random().toString(36).slice(2)), this.tabsBroadcastChannel.addEventListener("message", this.handleBroadcastMessage.bind(this)), console.log(`c7o: AppState: created, tabId=${this.tabId}`);
|
|
3485
3485
|
}
|
|
3486
3486
|
// this is called at startup
|
|
3487
3487
|
setSetting(e) {
|
|
3488
3488
|
T.info("appState: Startup: setSetting", e);
|
|
3489
3489
|
const t = this.setting;
|
|
3490
|
-
!!t && (t.orgId !== e.orgId || t.botId !== e.botId || t.url !== e.url || t.version !== e.version) && (this.botSettingsInitialized = !1, this.botSettings = null, this.botSettingsRetryTimeout = 5, this.disabled = !1), this.setting = e, this.initBot().catch((s) => {
|
|
3490
|
+
!!t && (t.orgId !== e.orgId || t.botId !== e.botId || t.url !== e.url || t.version !== e.version || t.testMode !== e.testMode) && (this.botSettingsInitialized = !1, this.botSettings = null, this.botSettingsRetryTimeout = 5, this.disabled = !1), this.setting = e, this.initBot().catch((s) => {
|
|
3491
3491
|
T.info(`Exception during bot initialization: ${s.message}`);
|
|
3492
3492
|
});
|
|
3493
3493
|
}
|
|
@@ -3527,7 +3527,7 @@ class R extends Jt {
|
|
|
3527
3527
|
}, this.botSettingsRetryTimeout * 1e3), this.botSettingsRetryTimeout = this.botSettingsRetryTimeout * 2;
|
|
3528
3528
|
return;
|
|
3529
3529
|
}
|
|
3530
|
-
T.info("Got bot settings - bot is enabled", o), this.disabled = !1, this.setting.welcomeMessage = o?.welcomeMessage || "How can I help ?", this.setting.disclaimerMessage = o?.disclaimerMessage && o.disclaimerMessage !== "" ? o.disclaimerMessage : null, this.setting.engageMessage = o?.engageMessage || "How can I help ?", this.setting.engageTimeout = o?.engageTimeout || 5, this.setting.splitMessagesAtBreak = "splitMessagesAtBreak" in o ? o.splitMessagesAtBreak : !1, this.setting.feedbackEnabled = "feedbackEnabled" in o ? o.feedbackEnabled : !1, this.setting.uploadImages = "uploadImages" in o ? o.uploadImages : !1, this.setting.newConversationTimeoutInSec = o?.newConversationTimeoutInSec || 86400, this.setting.enableNotificationSound = "enableNotificationSound" in o ? o.enableNotificationSound : !0, this.setting.botAdvancedSettings = o?.botAdvancedSettings ?? {}, this.setting.startFeedbackFromMessage = "startFeedbackFromMessage" in this.setting.botAdvancedSettings ? this.setting.botAdvancedSettings.startFeedbackFromMessage : 1, this.setting.enableMultiModalConnection = this.setting.botAdvancedSettings?.enableMultiModalConnection ?? !1, this.setting.enablePassContextOnConnect = this.setting.botAdvancedSettings?.enablePassContextOnConnect ?? !1, this.setting.enableShowFullDisclaimerMessage = this.setting.botAdvancedSettings?.enableShowFullDisclaimerMessage ?? !1, this.setting.fileUploadEnabledExtensions = this.setting.botAdvancedSettings?.fileUploadEnabledExtensions || ".jpeg,.jpg,.png,.pdf,.txt,.har,.zip,.mov,.mp4,.mp3", this.setting.fileUploadMaxFileSizeMB = this.setting.botAdvancedSettings?.fileUploadMaxFileSizeMB || 30, this.setting.enableAgentDisconnectedMessage = this.setting.botAdvancedSettings?.enableAgentDisconnectedMessage ?? !1, this.setting.showNewConversationOnAgentDisconnected = this.setting.botAdvancedSettings?.showNewConversationOnAgentDisconnected ?? !1, this.setting.enableMultiModalConnection ? this.setting.enableAudio = !0 : this.setting.enableAudio = !1, this.initConversation(), this.shouldEngage === "true" && setTimeout(() => {
|
|
3530
|
+
T.info("Got bot settings - bot is enabled", o), this.disabled = !1, this.setting.welcomeMessage = o?.welcomeMessage || "How can I help ?", this.setting.disclaimerMessage = o?.disclaimerMessage && o.disclaimerMessage !== "" ? o.disclaimerMessage : null, this.setting.engageMessage = o?.engageMessage || "How can I help ?", this.setting.engageTimeout = o?.engageTimeout || 5, this.setting.splitMessagesAtBreak = "splitMessagesAtBreak" in o ? o.splitMessagesAtBreak : !1, this.setting.feedbackEnabled = "feedbackEnabled" in o ? o.feedbackEnabled : !1, this.setting.uploadImages = "uploadImages" in o ? o.uploadImages : !1, this.setting.newConversationTimeoutInSec = o?.newConversationTimeoutInSec || 86400, this.setting.enableNotificationSound = "enableNotificationSound" in o ? o.enableNotificationSound : !0, this.setting.botAdvancedSettings = o?.botAdvancedSettings ?? {}, this.setting.startFeedbackFromMessage = "startFeedbackFromMessage" in this.setting.botAdvancedSettings ? this.setting.botAdvancedSettings.startFeedbackFromMessage : 1, this.setting.enableMultiModalConnection = this.setting.botAdvancedSettings?.enableMultiModalConnection ?? !1, this.setting.enablePassContextOnConnect = this.setting.botAdvancedSettings?.enablePassContextOnConnect ?? !1, this.setting.enableShowFullDisclaimerMessage = this.setting.botAdvancedSettings?.enableShowFullDisclaimerMessage ?? !1, this.setting.fileUploadEnabledExtensions = this.setting.botAdvancedSettings?.fileUploadEnabledExtensions || ".jpeg,.jpg,.png,.pdf,.txt,.har,.zip,.mov,.mp4,.mp3", this.setting.fileUploadMaxFileSizeMB = this.setting.botAdvancedSettings?.fileUploadMaxFileSizeMB || 30, this.setting.enableAgentDisconnectedMessage = this.setting.botAdvancedSettings?.enableAgentDisconnectedMessage ?? !1, this.setting.showNewConversationOnAgentDisconnected = this.setting.botAdvancedSettings?.showNewConversationOnAgentDisconnected ?? !1, this.setting.engagePopupSuppressPermanently = this.setting.botAdvancedSettings?.engagePopupSuppressPermanently || 0, this.setting.enableMultiModalConnection ? this.setting.enableAudio = !0 : this.setting.enableAudio = !1, this.initConversation(), this.shouldEngage === "true" && setTimeout(() => {
|
|
3531
3531
|
this.showEngagePopup();
|
|
3532
3532
|
}, this.setting.engageTimeout * 1e3);
|
|
3533
3533
|
}
|
|
@@ -3762,7 +3762,7 @@ class R extends Jt {
|
|
|
3762
3762
|
T.info("form has no fields", e);
|
|
3763
3763
|
return;
|
|
3764
3764
|
}
|
|
3765
|
-
const r = `${
|
|
3765
|
+
const r = `${ie}${this.setting.botId}.${this.conversationId}.form.${i}`, o = localStorage.getItem(r);
|
|
3766
3766
|
if (o) {
|
|
3767
3767
|
let f = null;
|
|
3768
3768
|
try {
|
|
@@ -3780,10 +3780,23 @@ class R extends Jt {
|
|
|
3780
3780
|
this.form = t;
|
|
3781
3781
|
}
|
|
3782
3782
|
suppressEngagePopup() {
|
|
3783
|
-
this.engage = !1, this.shouldEngage = "false"
|
|
3783
|
+
if (this.engage = !1, this.shouldEngage = "false", this.setting.engagePopupSuppressPermanently && this.setting.engagePopupSuppressPermanently > 0) {
|
|
3784
|
+
const e = Date.now();
|
|
3785
|
+
localStorage.setItem(`${ie}_engagePopupSuppressed`, `${e}`), T.info(`Engage popup suppressed for ${this.setting.engagePopupSuppressPermanently} days`);
|
|
3786
|
+
}
|
|
3784
3787
|
}
|
|
3785
3788
|
showEngagePopup() {
|
|
3786
|
-
|
|
3789
|
+
if (!this.open) {
|
|
3790
|
+
if (this.setting.engagePopupSuppressPermanently && this.setting.engagePopupSuppressPermanently > 0) {
|
|
3791
|
+
const e = Date.now(), t = this.setting.engagePopupSuppressPermanently * 24 * 60 * 60 * 1e3, i = localStorage.getItem(`${ie}_engagePopupSuppressed`);
|
|
3792
|
+
if (i) {
|
|
3793
|
+
const s = parseInt(i, 10);
|
|
3794
|
+
if (!isNaN(s) && e - s < t)
|
|
3795
|
+
return;
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
T.info("Engaging User"), this.engage = !0, this.playAudioNotification();
|
|
3799
|
+
}
|
|
3787
3800
|
}
|
|
3788
3801
|
playAudioNotification() {
|
|
3789
3802
|
if (!this.setting.enableNotificationSound)
|
|
@@ -3808,7 +3821,7 @@ class R extends Jt {
|
|
|
3808
3821
|
return this.wsClient;
|
|
3809
3822
|
let t = `${this.setting.url.startsWith("localhost") ? "ws" : "wss"}://${this.setting.url}/api/bot/connect/${this.setting.orgId}/${this.setting.botId}/${this.conversationId}`;
|
|
3810
3823
|
const i = new URL(t);
|
|
3811
|
-
if (this.setting.version && this.setting.version !== "current" && i.searchParams.set("version", this.setting.version), this.setting.enableMultiModalConnection && (i.searchParams.set("multiModal", "true"), T.info("MultiModal connection enabled - adding multiModal=true parameter")), this.setting.enablePassContextOnConnect && this.context && typeof this.context == "object")
|
|
3824
|
+
if (this.setting.version && this.setting.version !== "current" && i.searchParams.set("version", this.setting.version), this.setting.testMode && (i.searchParams.set("testMode", "true"), T.info("Test Mode enabled - adding testMode=true parameter")), this.setting.enableMultiModalConnection && (i.searchParams.set("multiModal", "true"), T.info("MultiModal connection enabled - adding multiModal=true parameter")), this.setting.enablePassContextOnConnect && this.context && typeof this.context == "object")
|
|
3812
3825
|
try {
|
|
3813
3826
|
const s = JSON.stringify(this.context);
|
|
3814
3827
|
i.searchParams.set("context", s), T.info("Adding context to connect URL");
|
|
@@ -3838,6 +3851,39 @@ class R extends Jt {
|
|
|
3838
3851
|
T.info(`WSC: connection closed, connected: ${this.wsClient?.connected}`, e), this.stopWebAudio().catch((t) => {
|
|
3839
3852
|
}), this.connected = !1;
|
|
3840
3853
|
}
|
|
3854
|
+
async _checkConnection() {
|
|
3855
|
+
try {
|
|
3856
|
+
const e = await this.getWsClient();
|
|
3857
|
+
if (!e) {
|
|
3858
|
+
T.error("Error - failed to obtain ws client for check connection");
|
|
3859
|
+
return;
|
|
3860
|
+
}
|
|
3861
|
+
e.checkConnection();
|
|
3862
|
+
} catch (e) {
|
|
3863
|
+
T.error(`Check connection failed: ${e.message}`);
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
// Check connection for parallel calls - if there is already a check in progress, wait for it instead of starting a new one
|
|
3867
|
+
async checkConnection() {
|
|
3868
|
+
return this.checkConnectionPromise || (this.checkConnectionPromise = this._checkConnection().finally(() => {
|
|
3869
|
+
this.checkConnectionPromise = null;
|
|
3870
|
+
})), this.checkConnectionPromise;
|
|
3871
|
+
}
|
|
3872
|
+
// Called on browser/app lifecycle resume events to quickly recover stale socket state.
|
|
3873
|
+
handleLifecycleResume(e = "unknown", t = () => {
|
|
3874
|
+
}) {
|
|
3875
|
+
if (e === "visibilitychange" && document.visibilityState !== "visible") {
|
|
3876
|
+
T.info("WSC: lifecycle resume - document not visible, skipping connection check");
|
|
3877
|
+
return;
|
|
3878
|
+
}
|
|
3879
|
+
if (this.isConversationStart()) {
|
|
3880
|
+
T.info("WSC: lifecycle resume - conversation just started, skipping connection check");
|
|
3881
|
+
return;
|
|
3882
|
+
}
|
|
3883
|
+
T.info(`WSC: lifecycle resume (${e})`), this.checkConnection().finally(() => {
|
|
3884
|
+
t();
|
|
3885
|
+
});
|
|
3886
|
+
}
|
|
3841
3887
|
async handleWscConnectError(e) {
|
|
3842
3888
|
T.info("WSC: connect error - resetting conversation", e);
|
|
3843
3889
|
const t = this.wsClient?.url || null;
|
|
@@ -4165,7 +4211,7 @@ class R extends Jt {
|
|
|
4165
4211
|
T.info("submitForm: No form is active - ignored");
|
|
4166
4212
|
return;
|
|
4167
4213
|
}
|
|
4168
|
-
const t = `${
|
|
4214
|
+
const t = `${ie}${this.setting.botId}.${this.conversationId}.form.${this.form.name}`;
|
|
4169
4215
|
await this.sendFormData(this.form.name, e), localStorage.setItem(t, JSON.stringify(e)), "name" in e && (this.feedbackName = e.name), "email" in e && (this.feedbackEmail = e.email), this.form = null;
|
|
4170
4216
|
}
|
|
4171
4217
|
async sendFormData(e, t) {
|
|
@@ -4251,11 +4297,11 @@ class R extends Jt {
|
|
|
4251
4297
|
}
|
|
4252
4298
|
async uploadFiles(e) {
|
|
4253
4299
|
if (!e?.length) return;
|
|
4254
|
-
const t =
|
|
4300
|
+
const t = u.setting.fileUploadMaxFileSizeMB || 30, i = t * 1024 * 1024, s = e?.find((v) => v.size > i);
|
|
4255
4301
|
if (s) {
|
|
4256
4302
|
T.error(
|
|
4257
4303
|
`File "${s.name}" exceeds the ${t} MB limit and will not be uploaded.`
|
|
4258
|
-
),
|
|
4304
|
+
), Ka({
|
|
4259
4305
|
message: `File is larger than ${t} MB`,
|
|
4260
4306
|
variant: "danger",
|
|
4261
4307
|
duration: 3800,
|
|
@@ -4296,42 +4342,42 @@ class R extends Jt {
|
|
|
4296
4342
|
}
|
|
4297
4343
|
}
|
|
4298
4344
|
O([
|
|
4299
|
-
ce({ prefix:
|
|
4345
|
+
ce({ prefix: ie }),
|
|
4300
4346
|
z({ value: "en" })
|
|
4301
4347
|
], R.prototype, "language");
|
|
4302
4348
|
O([
|
|
4303
|
-
ce({ prefix:
|
|
4349
|
+
ce({ prefix: ie }),
|
|
4304
4350
|
z({ value: "light" })
|
|
4305
4351
|
], R.prototype, "theme");
|
|
4306
4352
|
O([
|
|
4307
|
-
ce({ prefix:
|
|
4353
|
+
ce({ prefix: ie }),
|
|
4308
4354
|
z({ type: Boolean, value: !1 })
|
|
4309
4355
|
], R.prototype, "open");
|
|
4310
4356
|
O([
|
|
4311
4357
|
z({ type: Boolean, value: !1 })
|
|
4312
4358
|
], R.prototype, "alwaysOpen");
|
|
4313
4359
|
O([
|
|
4314
|
-
ce({ prefix:
|
|
4360
|
+
ce({ prefix: ie }),
|
|
4315
4361
|
z({ value: "false" })
|
|
4316
4362
|
], R.prototype, "connectWs");
|
|
4317
4363
|
O([
|
|
4318
|
-
ce({ prefix:
|
|
4364
|
+
ce({ prefix: ie }),
|
|
4319
4365
|
z({ value: fe() })
|
|
4320
4366
|
], R.prototype, "conversationId");
|
|
4321
4367
|
O([
|
|
4322
|
-
ce({ prefix:
|
|
4368
|
+
ce({ prefix: ie }),
|
|
4323
4369
|
z({ value: 0 })
|
|
4324
4370
|
], R.prototype, "lastConversationUpdate");
|
|
4325
4371
|
O([
|
|
4326
|
-
ce({ prefix:
|
|
4372
|
+
ce({ prefix: ie }),
|
|
4327
4373
|
z({ type: Array, value: [] })
|
|
4328
4374
|
], R.prototype, "messages");
|
|
4329
4375
|
O([
|
|
4330
|
-
ce({ prefix:
|
|
4376
|
+
ce({ prefix: ie }),
|
|
4331
4377
|
z({ value: 0 })
|
|
4332
4378
|
], R.prototype, "unreadMessages");
|
|
4333
4379
|
O([
|
|
4334
|
-
ce({ prefix:
|
|
4380
|
+
ce({ prefix: ie }),
|
|
4335
4381
|
z({
|
|
4336
4382
|
type: Array,
|
|
4337
4383
|
value: []
|
|
@@ -4376,7 +4422,7 @@ O([
|
|
|
4376
4422
|
})
|
|
4377
4423
|
], R.prototype, "actions");
|
|
4378
4424
|
O([
|
|
4379
|
-
ce({ prefix:
|
|
4425
|
+
ce({ prefix: ie }),
|
|
4380
4426
|
z({ type: Object, value: null })
|
|
4381
4427
|
], R.prototype, "form");
|
|
4382
4428
|
O([
|
|
@@ -4398,21 +4444,21 @@ O([
|
|
|
4398
4444
|
z({ type: Boolean, value: !1 })
|
|
4399
4445
|
], R.prototype, "connected");
|
|
4400
4446
|
O([
|
|
4401
|
-
ce({ prefix:
|
|
4447
|
+
ce({ prefix: ie }),
|
|
4402
4448
|
z({ value: "true" })
|
|
4403
4449
|
], R.prototype, "shouldEngage");
|
|
4404
4450
|
O([
|
|
4405
4451
|
z({ type: Boolean, value: !1 })
|
|
4406
4452
|
], R.prototype, "engage");
|
|
4407
4453
|
O([
|
|
4408
|
-
ce({ prefix:
|
|
4454
|
+
ce({ prefix: ie }),
|
|
4409
4455
|
z({ type: Boolean, value: !1 })
|
|
4410
4456
|
], R.prototype, "showNewConversation");
|
|
4411
4457
|
O([
|
|
4412
4458
|
z({ type: Boolean, value: !1 })
|
|
4413
4459
|
], R.prototype, "typingActive");
|
|
4414
4460
|
O([
|
|
4415
|
-
ce({ prefix:
|
|
4461
|
+
ce({ prefix: ie }),
|
|
4416
4462
|
z({
|
|
4417
4463
|
type: Object,
|
|
4418
4464
|
value: {
|
|
@@ -4420,6 +4466,7 @@ O([
|
|
|
4420
4466
|
botId: null,
|
|
4421
4467
|
url: null,
|
|
4422
4468
|
version: "current",
|
|
4469
|
+
testMode: !1,
|
|
4423
4470
|
welcomeMessage: null,
|
|
4424
4471
|
disclaimerMessage: null,
|
|
4425
4472
|
enableShowFullDisclaimerMessage: !1,
|
|
@@ -4435,12 +4482,13 @@ O([
|
|
|
4435
4482
|
fileUploadEnabledExtensions: ".jpeg,.jpg,.png,.pdf,.txt,.har,.zip,.mov,.mp4,.mp3",
|
|
4436
4483
|
fileUploadMaxFileSizeMB: 30,
|
|
4437
4484
|
enableAgentDisconnectedMessage: !1,
|
|
4438
|
-
showNewConversationOnAgentDisconnected: !1
|
|
4485
|
+
showNewConversationOnAgentDisconnected: !1,
|
|
4486
|
+
engagePopupSuppressPermanently: 0
|
|
4439
4487
|
}
|
|
4440
4488
|
})
|
|
4441
4489
|
], R.prototype, "setting");
|
|
4442
4490
|
O([
|
|
4443
|
-
ce({ prefix:
|
|
4491
|
+
ce({ prefix: ie }),
|
|
4444
4492
|
z({ type: Object, value: {} })
|
|
4445
4493
|
], R.prototype, "context");
|
|
4446
4494
|
O([
|
|
@@ -4474,11 +4522,11 @@ O([
|
|
|
4474
4522
|
z({ type: Array, value: [] })
|
|
4475
4523
|
], R.prototype, "feedbackMessages");
|
|
4476
4524
|
O([
|
|
4477
|
-
ce({ prefix:
|
|
4525
|
+
ce({ prefix: ie }),
|
|
4478
4526
|
z({ type: String, value: "" })
|
|
4479
4527
|
], R.prototype, "feedbackName");
|
|
4480
4528
|
O([
|
|
4481
|
-
ce({ prefix:
|
|
4529
|
+
ce({ prefix: ie }),
|
|
4482
4530
|
z({ type: String, value: "" })
|
|
4483
4531
|
], R.prototype, "feedbackEmail");
|
|
4484
4532
|
O([
|
|
@@ -4493,7 +4541,7 @@ O([
|
|
|
4493
4541
|
O([
|
|
4494
4542
|
z({ type: Boolean, value: !1 })
|
|
4495
4543
|
], R.prototype, "webAudioMuted");
|
|
4496
|
-
const
|
|
4544
|
+
const u = new R(), Ls = K`
|
|
4497
4545
|
${ke}
|
|
4498
4546
|
:host {
|
|
4499
4547
|
position: relative;
|
|
@@ -4613,7 +4661,7 @@ class re extends Fe {
|
|
|
4613
4661
|
zs([
|
|
4614
4662
|
x({ type: String })
|
|
4615
4663
|
], re.prototype, "lang");
|
|
4616
|
-
var Os = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor,
|
|
4664
|
+
var Os = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, Ja = (a, e, t, i) => {
|
|
4617
4665
|
for (var s = i > 1 ? void 0 : i ? Bs(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
4618
4666
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
4619
4667
|
return i && s && Os(e, t, s), s;
|
|
@@ -4629,32 +4677,32 @@ let Ot = class extends re {
|
|
|
4629
4677
|
}
|
|
4630
4678
|
*/
|
|
4631
4679
|
renderExp() {
|
|
4632
|
-
return
|
|
4680
|
+
return b` <header class="cb-header" part="header">
|
|
4633
4681
|
${W(
|
|
4634
|
-
|
|
4635
|
-
() =>
|
|
4636
|
-
() =>
|
|
4682
|
+
u.setting.logoUrl !== "",
|
|
4683
|
+
() => b`<img class="cb-header-logo" part="header-logo" src="${u.setting.logoUrl}" />`,
|
|
4684
|
+
() => b`<div class="cb-header-logo" part="header-logo">${G(u.setting.logoSvg)}</div>`
|
|
4637
4685
|
)}
|
|
4638
4686
|
<div class="cb-header-title" part="header-title">${Vt(this.title)}</div>
|
|
4639
4687
|
${W(
|
|
4640
|
-
|
|
4641
|
-
() =>
|
|
4642
|
-
() =>
|
|
4688
|
+
u.alwaysOpen,
|
|
4689
|
+
() => b``,
|
|
4690
|
+
() => b`<div class="cb-header-close" part="header-close">${G(qs)}</div>`
|
|
4643
4691
|
)}
|
|
4644
4692
|
</header>`;
|
|
4645
4693
|
}
|
|
4646
4694
|
render() {
|
|
4647
|
-
return
|
|
4695
|
+
return b`<header class="cb-header" part="header">
|
|
4648
4696
|
${W(
|
|
4649
|
-
|
|
4650
|
-
() =>
|
|
4651
|
-
() =>
|
|
4697
|
+
u.setting.logoUrl !== "",
|
|
4698
|
+
() => b`<img class="cb-header-img" part="header-logo" src="${u.setting.logoUrl}" />`,
|
|
4699
|
+
() => b`<div class="cb-header-logo" part="header-logo">${G(u.setting.logoSvg)}</div>`
|
|
4652
4700
|
)}
|
|
4653
4701
|
<div class="cb-header-title" part="header-title">${this.title}</div>
|
|
4654
4702
|
${W(
|
|
4655
|
-
|
|
4656
|
-
() =>
|
|
4657
|
-
() =>
|
|
4703
|
+
u.alwaysOpen,
|
|
4704
|
+
() => b`<div></div>`,
|
|
4705
|
+
() => b`<div @click=${this._clickCloseHandler} class="cb-header-close" part="header-close">${G(u.setting.closeSvg)}</div>`
|
|
4658
4706
|
)}
|
|
4659
4707
|
</header>`;
|
|
4660
4708
|
}
|
|
@@ -4682,13 +4730,13 @@ let Ot = class extends re {
|
|
|
4682
4730
|
}
|
|
4683
4731
|
};
|
|
4684
4732
|
Ot.styles = Ls;
|
|
4685
|
-
|
|
4733
|
+
Ja([
|
|
4686
4734
|
x({ type: String, attribute: "title" })
|
|
4687
4735
|
], Ot.prototype, "title", 2);
|
|
4688
|
-
Ot =
|
|
4689
|
-
|
|
4736
|
+
Ot = Ja([
|
|
4737
|
+
J("cb-header")
|
|
4690
4738
|
], Ot);
|
|
4691
|
-
const Ds =
|
|
4739
|
+
const Ds = K`
|
|
4692
4740
|
${ke}
|
|
4693
4741
|
.cb-footer {
|
|
4694
4742
|
line-height: 60px;
|
|
@@ -4708,12 +4756,12 @@ var Fs = Object.getOwnPropertyDescriptor, js = (a, e, t, i) => {
|
|
|
4708
4756
|
(o = a[r]) && (s = o(s) || s);
|
|
4709
4757
|
return s;
|
|
4710
4758
|
};
|
|
4711
|
-
let
|
|
4759
|
+
let Jt = class extends re {
|
|
4712
4760
|
constructor() {
|
|
4713
4761
|
super(...arguments), this.year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
4714
4762
|
}
|
|
4715
4763
|
render() {
|
|
4716
|
-
return
|
|
4764
|
+
return b`
|
|
4717
4765
|
<div class="cb-footer" part="footer">
|
|
4718
4766
|
yugasun@${this.year}
|
|
4719
4767
|
<a
|
|
@@ -4743,11 +4791,11 @@ let Kt = class extends re {
|
|
|
4743
4791
|
`;
|
|
4744
4792
|
}
|
|
4745
4793
|
};
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
],
|
|
4750
|
-
const Hs =
|
|
4794
|
+
Jt.styles = Ds;
|
|
4795
|
+
Jt = js([
|
|
4796
|
+
J("cb-footer")
|
|
4797
|
+
], Jt);
|
|
4798
|
+
const Hs = K`
|
|
4751
4799
|
${ke}
|
|
4752
4800
|
|
|
4753
4801
|
:host {
|
|
@@ -4948,7 +4996,7 @@ const Hs = J`
|
|
|
4948
4996
|
background-size: 100%;
|
|
4949
4997
|
transition: background 0s;
|
|
4950
4998
|
}
|
|
4951
|
-
`, Za =
|
|
4999
|
+
`, Za = K`
|
|
4952
5000
|
:host {
|
|
4953
5001
|
--primary-color: var(--sl-color-primary-600);
|
|
4954
5002
|
}
|
|
@@ -5102,7 +5150,7 @@ const Hs = J`
|
|
|
5102
5150
|
.card-btn[aria-disabled="true"]:focus-visible {
|
|
5103
5151
|
box-shadow: none;
|
|
5104
5152
|
}
|
|
5105
|
-
`, Qa =
|
|
5153
|
+
`, Qa = K`
|
|
5106
5154
|
:host {
|
|
5107
5155
|
--primary-color: var(--sl-color-primary-600);
|
|
5108
5156
|
}
|
|
@@ -5193,8 +5241,8 @@ const Hs = J`
|
|
|
5193
5241
|
}
|
|
5194
5242
|
.split-btn[aria-expanded="true"] .split-btn__caret { transform: rotate(180deg); }
|
|
5195
5243
|
`;
|
|
5196
|
-
var Vs = Object.defineProperty,
|
|
5197
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
5244
|
+
var Vs = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, je = (a, e, t, i) => {
|
|
5245
|
+
for (var s = i > 1 ? void 0 : i ? Us(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
5198
5246
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
5199
5247
|
return i && s && Vs(e, t, s), s;
|
|
5200
5248
|
};
|
|
@@ -5203,10 +5251,10 @@ let gt = class extends Fe {
|
|
|
5203
5251
|
super(...arguments), this.options = [], this.minWidth = 180;
|
|
5204
5252
|
}
|
|
5205
5253
|
render() {
|
|
5206
|
-
return
|
|
5254
|
+
return b`
|
|
5207
5255
|
<div class="menu" part="menu" style="min-width:${Math.max(this.minWidth, 180)}px">
|
|
5208
5256
|
<div class="list" role="menu">
|
|
5209
|
-
${this.options.map((a, e) =>
|
|
5257
|
+
${this.options.map((a, e) => b`
|
|
5210
5258
|
<a
|
|
5211
5259
|
class="item"
|
|
5212
5260
|
role="menuitem"
|
|
@@ -5230,7 +5278,7 @@ let gt = class extends Fe {
|
|
|
5230
5278
|
this.dispatchEvent(new CustomEvent("select", { detail: { option: e }, bubbles: !0, composed: !0 }));
|
|
5231
5279
|
}
|
|
5232
5280
|
};
|
|
5233
|
-
gt.styles =
|
|
5281
|
+
gt.styles = K`
|
|
5234
5282
|
:host {
|
|
5235
5283
|
position: fixed; /* overlay */
|
|
5236
5284
|
left: 0;
|
|
@@ -5290,7 +5338,7 @@ je([
|
|
|
5290
5338
|
x({ type: Number })
|
|
5291
5339
|
], gt.prototype, "minWidth", 2);
|
|
5292
5340
|
gt = je([
|
|
5293
|
-
|
|
5341
|
+
J("cb-split-menu")
|
|
5294
5342
|
], gt);
|
|
5295
5343
|
let Ge = class extends Fe {
|
|
5296
5344
|
constructor() {
|
|
@@ -5306,7 +5354,7 @@ let Ge = class extends Fe {
|
|
|
5306
5354
|
}
|
|
5307
5355
|
render() {
|
|
5308
5356
|
const a = ["split-btn", this.variant, this.size].filter(Boolean).join(" ");
|
|
5309
|
-
return
|
|
5357
|
+
return b`
|
|
5310
5358
|
<button
|
|
5311
5359
|
type="button"
|
|
5312
5360
|
class=${a}
|
|
@@ -5394,14 +5442,14 @@ je([
|
|
|
5394
5442
|
xe(".split-btn")
|
|
5395
5443
|
], Ge.prototype, "_btn", 2);
|
|
5396
5444
|
Ge = je([
|
|
5397
|
-
|
|
5445
|
+
J("cb-split-button")
|
|
5398
5446
|
], Ge);
|
|
5399
|
-
var
|
|
5447
|
+
var Ns = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, wt = (a, e, t, i) => {
|
|
5400
5448
|
for (var s = i > 1 ? void 0 : i ? Ws(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
5401
5449
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
5402
|
-
return i && s &&
|
|
5450
|
+
return i && s && Ns(e, t, s), s;
|
|
5403
5451
|
};
|
|
5404
|
-
const Tt =
|
|
5452
|
+
const Tt = Ke.noConflict(), $a = "M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z", Gs = K`
|
|
5405
5453
|
:host { display: block; width: 100%; color: var(--cb-fg, #111827); }
|
|
5406
5454
|
|
|
5407
5455
|
/* CARD */
|
|
@@ -5509,25 +5557,25 @@ let Me = class extends Fe {
|
|
|
5509
5557
|
}
|
|
5510
5558
|
/* ----------------- CARD ----------------- */
|
|
5511
5559
|
renderCard(a) {
|
|
5512
|
-
const { title: e, subtitle: t, image_url: i, image_alt: s, buttons: r = [] } = a, o = (a.url || "").trim(), f = (a.target || "").trim(), p = o.length > 0, v = a.info?.text, k = typeof a.info?.rating == "number" ? a.info.rating : typeof a.rating == "number" ? a.rating : void 0, w = !!v, _ = typeof k == "number", P = ["card__info", w && _ ? "card__info--between" : ""].filter(Boolean).join(" "), E = r.some((
|
|
5560
|
+
const { title: e, subtitle: t, image_url: i, image_alt: s, buttons: r = [] } = a, o = (a.url || "").trim(), f = (a.target || "").trim(), p = o.length > 0, v = a.info?.text, k = typeof a.info?.rating == "number" ? a.info.rating : typeof a.rating == "number" ? a.rating : void 0, w = !!v, _ = typeof k == "number", P = ["card__info", w && _ ? "card__info--between" : ""].filter(Boolean).join(" "), E = r.some((N) => (N.type ?? "").toLowerCase() === "primary"), M = r.some((N) => (N.type ?? "").toLowerCase() === "secondary"), L = ["card__actions", E && M ? "card__actions--between" : ""].filter(Boolean).join(" "), C = () => {
|
|
5513
5561
|
if (!i) return Ae;
|
|
5514
|
-
const
|
|
5515
|
-
return p ?
|
|
5516
|
-
}, Z = () => e ? p && !i ?
|
|
5517
|
-
return
|
|
5562
|
+
const N = b`<img class="card__image" src=${i} alt=${s ?? e ?? "Image"} draggable="false" />`;
|
|
5563
|
+
return p ? b`<a class="card__image-link" href=${o} target=${f || "_blank"} rel="noopener noreferrer" draggable="false" aria-label=${e ? `Open: ${e}` : "Open"}>${N}</a>` : N;
|
|
5564
|
+
}, Z = () => e ? p && !i ? b`<h3 class="card__title"><a class="card__title-link" href=${o} target=${f || "_blank"} rel="noopener noreferrer" draggable="false">${e}</a></h3>` : b`<h3 class="card__title">${e}</h3>` : Ae;
|
|
5565
|
+
return b`
|
|
5518
5566
|
<div class="card" role="group" aria-label=${e ? `Card: ${e}` : "Card"}>
|
|
5519
5567
|
${C()}
|
|
5520
5568
|
<div class="card__content">
|
|
5521
5569
|
${Z()}
|
|
5522
|
-
${t ?
|
|
5523
|
-
${w || _ ?
|
|
5570
|
+
${t ? b`<div class="card__subtitle">${t}</div>` : Ae}
|
|
5571
|
+
${w || _ ? b`
|
|
5524
5572
|
<div class=${P}>
|
|
5525
|
-
${w ?
|
|
5573
|
+
${w ? b`<div class="card__info-text">${v}</div>` : Ae}
|
|
5526
5574
|
${_ ? this.renderRating(k) : Ae}
|
|
5527
5575
|
</div>` : Ae}
|
|
5528
|
-
${r.length ?
|
|
5576
|
+
${r.length ? b`
|
|
5529
5577
|
<div class=${L}>
|
|
5530
|
-
${r.map((
|
|
5578
|
+
${r.map((N, X) => this.renderAnyButton(N, X))}
|
|
5531
5579
|
</div>` : Ae}
|
|
5532
5580
|
</div>
|
|
5533
5581
|
</div>
|
|
@@ -5539,7 +5587,7 @@ let Me = class extends Fe {
|
|
|
5539
5587
|
}
|
|
5540
5588
|
renderSingleButton(a) {
|
|
5541
5589
|
const t = `card-btn ${(a.type ?? "primary").toLowerCase() === "secondary" ? "secondary" : "primary"}`, i = a.text || "Open";
|
|
5542
|
-
return a.url ?
|
|
5590
|
+
return a.url ? b`
|
|
5543
5591
|
<a
|
|
5544
5592
|
class=${t}
|
|
5545
5593
|
href=${a.url}
|
|
@@ -5549,7 +5597,7 @@ let Me = class extends Fe {
|
|
|
5549
5597
|
@click=${() => this.emitButtonClick(a)}
|
|
5550
5598
|
@pointerdown=${(s) => s.stopPropagation()}
|
|
5551
5599
|
>${i}</a>
|
|
5552
|
-
` :
|
|
5600
|
+
` : b`
|
|
5553
5601
|
<button
|
|
5554
5602
|
type="button"
|
|
5555
5603
|
class=${t}
|
|
@@ -5560,7 +5608,7 @@ let Me = class extends Fe {
|
|
|
5560
5608
|
}
|
|
5561
5609
|
renderSplitButton(a, e) {
|
|
5562
5610
|
const t = (a.type ?? "primary").toLowerCase();
|
|
5563
|
-
return
|
|
5611
|
+
return b`
|
|
5564
5612
|
<cb-split-button
|
|
5565
5613
|
.label=${a.text || "Select"}
|
|
5566
5614
|
.variant=${t}
|
|
@@ -5576,7 +5624,7 @@ let Me = class extends Fe {
|
|
|
5576
5624
|
/* ----------------- Rating ----------------- */
|
|
5577
5625
|
renderRating(a) {
|
|
5578
5626
|
const e = Math.max(0, Math.min(5, a)), t = [0, 1, 2, 3, 4].map((i) => Math.max(0, Math.min(1, e - i)));
|
|
5579
|
-
return
|
|
5627
|
+
return b`<div class="rating" aria-label="${e} out of 5 stars">
|
|
5580
5628
|
<span class="stars">${t.map((i) => this.renderStar(i))}</span>
|
|
5581
5629
|
</div>`;
|
|
5582
5630
|
}
|
|
@@ -5586,7 +5634,7 @@ let Me = class extends Fe {
|
|
|
5586
5634
|
-webkit-mask: linear-gradient(to right, #000 0, #000 ${t}, transparent ${t}, transparent 100%);
|
|
5587
5635
|
mask: linear-gradient(to right, #000 0, #000 ${t}, transparent ${t}, transparent 100%);
|
|
5588
5636
|
`;
|
|
5589
|
-
return
|
|
5637
|
+
return b`
|
|
5590
5638
|
<span class="star" role="img" aria-label="${e.toFixed(2)} filled">
|
|
5591
5639
|
<svg class="star__base" viewBox="0 0 16 16" aria-hidden="true"><path d="${$a}"/></svg>
|
|
5592
5640
|
<div class="star__fill" style="${s}">
|
|
@@ -5598,7 +5646,7 @@ let Me = class extends Fe {
|
|
|
5598
5646
|
/* ----------------- Carousel ----------------- */
|
|
5599
5647
|
renderCarouselSimple(a) {
|
|
5600
5648
|
const e = Array.isArray(a.items) ? a.items : [], t = Math.max(1, a.slidesPerPage || 1), i = t > 1 ? `width: calc((100% - ${(t - 1) * 0.75}em) / ${t}); max-width: none;` : "";
|
|
5601
|
-
return
|
|
5649
|
+
return b`
|
|
5602
5650
|
<div class="hc-wrapper">
|
|
5603
5651
|
<button
|
|
5604
5652
|
type="button"
|
|
@@ -5609,7 +5657,7 @@ let Me = class extends Fe {
|
|
|
5609
5657
|
>❮</button>
|
|
5610
5658
|
|
|
5611
5659
|
<div class="horizontal-carousel" @scroll=${this.onCarouselScroll}>
|
|
5612
|
-
${e.map((s) =>
|
|
5660
|
+
${e.map((s) => b`
|
|
5613
5661
|
<div class="horizontal-carousel__item" style=${i}>
|
|
5614
5662
|
<cb-block .block=${s}></cb-block>
|
|
5615
5663
|
</div>
|
|
@@ -5674,7 +5722,7 @@ let Me = class extends Fe {
|
|
|
5674
5722
|
}
|
|
5675
5723
|
}
|
|
5676
5724
|
renderUnknown(a) {
|
|
5677
|
-
return
|
|
5725
|
+
return b`<div class="unknown">Unknown block type: <code>${a?.type ?? "—"}</code></div>`;
|
|
5678
5726
|
}
|
|
5679
5727
|
/* ----------------- handle clicks ----------------- */
|
|
5680
5728
|
emitButtonClick(a) {
|
|
@@ -5721,7 +5769,7 @@ let Me = class extends Fe {
|
|
|
5721
5769
|
body: JSON.stringify(r)
|
|
5722
5770
|
});
|
|
5723
5771
|
if (!o.ok) {
|
|
5724
|
-
Tt.error("c7o: cart/add.js failed"),
|
|
5772
|
+
Tt.error("c7o: cart/add.js failed"), Ka({
|
|
5725
5773
|
message: "Unable to add item to cart.",
|
|
5726
5774
|
variant: "danger",
|
|
5727
5775
|
duration: 2800,
|
|
@@ -5747,7 +5795,7 @@ wt([
|
|
|
5747
5795
|
Va()
|
|
5748
5796
|
], Me.prototype, "_canNext", 2);
|
|
5749
5797
|
Me = wt([
|
|
5750
|
-
|
|
5798
|
+
J("cb-block")
|
|
5751
5799
|
], Me);
|
|
5752
5800
|
var Xs = Object.defineProperty, Ys = Object.getOwnPropertyDescriptor, ei = (a, e, t, i) => {
|
|
5753
5801
|
for (var s = i > 1 ? void 0 : i ? Ys(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
@@ -5759,14 +5807,14 @@ let Bt = class extends Fe {
|
|
|
5759
5807
|
super(...arguments), this.blocks = [];
|
|
5760
5808
|
}
|
|
5761
5809
|
render() {
|
|
5762
|
-
return !this.blocks || this.blocks.length === 0 ? Ae :
|
|
5810
|
+
return !this.blocks || this.blocks.length === 0 ? Ae : b`
|
|
5763
5811
|
<div class="stack">
|
|
5764
|
-
${this.blocks.map((a) =>
|
|
5812
|
+
${this.blocks.map((a) => b`<cb-block .block=${a}></cb-block>`)}
|
|
5765
5813
|
</div>
|
|
5766
5814
|
`;
|
|
5767
5815
|
}
|
|
5768
5816
|
};
|
|
5769
|
-
Bt.styles =
|
|
5817
|
+
Bt.styles = K`
|
|
5770
5818
|
:host {
|
|
5771
5819
|
display: block;
|
|
5772
5820
|
}
|
|
@@ -5781,14 +5829,14 @@ ei([
|
|
|
5781
5829
|
x({ type: Array })
|
|
5782
5830
|
], Bt.prototype, "blocks", 2);
|
|
5783
5831
|
Bt = ei([
|
|
5784
|
-
|
|
5832
|
+
J("cb-blocks")
|
|
5785
5833
|
], Bt);
|
|
5786
|
-
var Rt = { exports: {} },
|
|
5787
|
-
function
|
|
5834
|
+
var Rt = { exports: {} }, Ks = Rt.exports, Pa;
|
|
5835
|
+
function Js() {
|
|
5788
5836
|
return Pa || (Pa = 1, (function(a, e) {
|
|
5789
5837
|
(function(t, i) {
|
|
5790
5838
|
a.exports = i();
|
|
5791
|
-
})(
|
|
5839
|
+
})(Ks, (function() {
|
|
5792
5840
|
function t(n, c) {
|
|
5793
5841
|
if (!(n instanceof c)) throw new TypeError("Cannot call a class as a function");
|
|
5794
5842
|
}
|
|
@@ -5834,16 +5882,16 @@ function Ks() {
|
|
|
5834
5882
|
return n;
|
|
5835
5883
|
}
|
|
5836
5884
|
function v(n, c) {
|
|
5837
|
-
if ((
|
|
5885
|
+
if ((U(n) || n === window || n === document) && (n = [n]), Pe(n) || Ve(n) || (n = [n]), ba(n) != 0) {
|
|
5838
5886
|
if (Pe(n) && !Ve(n)) for (var l = n.length, d = 0; d < l && c.call(n[d], n[d], d, n) !== !1; d++) ;
|
|
5839
5887
|
else if (Ve(n)) {
|
|
5840
|
-
for (var h in n) if (
|
|
5888
|
+
for (var h in n) if (se(n, h) && c.call(n[h], n[h], h, n) === !1) break;
|
|
5841
5889
|
}
|
|
5842
5890
|
}
|
|
5843
5891
|
}
|
|
5844
5892
|
function k(n) {
|
|
5845
5893
|
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null, l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, d = n[f] = n[f] || [], h = { all: d, evt: null, found: null };
|
|
5846
|
-
return c && l &&
|
|
5894
|
+
return c && l && ba(d) > 0 && v(d, (function(m, g) {
|
|
5847
5895
|
if (m.eventName == c && m.fn.toString() == l.toString()) return h.found = !0, h.evt = g, !1;
|
|
5848
5896
|
})), h;
|
|
5849
5897
|
}
|
|
@@ -5902,7 +5950,7 @@ function Ks() {
|
|
|
5902
5950
|
function Z(n) {
|
|
5903
5951
|
n.style.display = "block";
|
|
5904
5952
|
}
|
|
5905
|
-
function
|
|
5953
|
+
function N(n) {
|
|
5906
5954
|
n.style.display = "none";
|
|
5907
5955
|
}
|
|
5908
5956
|
function X(n) {
|
|
@@ -5928,7 +5976,7 @@ function Ks() {
|
|
|
5928
5976
|
}
|
|
5929
5977
|
}
|
|
5930
5978
|
function he(n, c, l) {
|
|
5931
|
-
if (
|
|
5979
|
+
if (ue(n)) console.error("Inject assets error");
|
|
5932
5980
|
else if (j(c) && (l = c, c = !1), H(c) && c in window) j(l) && l();
|
|
5933
5981
|
else {
|
|
5934
5982
|
var d;
|
|
@@ -5970,7 +6018,7 @@ function Ks() {
|
|
|
5970
6018
|
function H(n) {
|
|
5971
6019
|
return typeof n == "string";
|
|
5972
6020
|
}
|
|
5973
|
-
function
|
|
6021
|
+
function U(n) {
|
|
5974
6022
|
return !(!n || !n.nodeType || n.nodeType != 1);
|
|
5975
6023
|
}
|
|
5976
6024
|
function $e(n) {
|
|
@@ -5982,17 +6030,17 @@ function Ks() {
|
|
|
5982
6030
|
function Ve(n) {
|
|
5983
6031
|
return o(n) === "object" && n != null && !j(n) && !$e(n);
|
|
5984
6032
|
}
|
|
5985
|
-
function
|
|
6033
|
+
function ue(n) {
|
|
5986
6034
|
return n == null;
|
|
5987
6035
|
}
|
|
5988
|
-
function
|
|
6036
|
+
function se(n, c) {
|
|
5989
6037
|
return n !== null && hasOwnProperty.call(n, c);
|
|
5990
6038
|
}
|
|
5991
|
-
function
|
|
6039
|
+
function ba(n) {
|
|
5992
6040
|
if (Ve(n)) {
|
|
5993
6041
|
if (n.keys) return n.keys().length;
|
|
5994
6042
|
var c = 0;
|
|
5995
|
-
for (var l in n)
|
|
6043
|
+
for (var l in n) se(n, l) && c++;
|
|
5996
6044
|
return c;
|
|
5997
6045
|
}
|
|
5998
6046
|
return n.length;
|
|
@@ -6139,7 +6187,7 @@ function Ks() {
|
|
|
6139
6187
|
var h = n.querySelector(".gslide-media"), m = new Image(), g = "gSlideTitle_" + l, y = "gSlideDesc_" + l;
|
|
6140
6188
|
m.addEventListener("load", (function() {
|
|
6141
6189
|
j(d) && d();
|
|
6142
|
-
}), !1), m.src = c.href, c.sizes != "" && c.srcset != "" && (m.sizes = c.sizes, m.srcset = c.srcset), m.alt = "",
|
|
6190
|
+
}), !1), m.src = c.href, c.sizes != "" && c.srcset != "" && (m.sizes = c.sizes, m.srcset = c.srcset), m.alt = "", ue(c.alt) || c.alt === "" || (m.alt = c.alt), c.title !== "" && m.setAttribute("aria-labelledby", g), c.description !== "" && m.setAttribute("aria-describedby", y), c.hasOwnProperty("_hasCustomWidth") && c._hasCustomWidth && (m.style.width = c.width), c.hasOwnProperty("_hasCustomHeight") && c._hasCustomHeight && (m.style.height = c.height), h.insertBefore(m, h.firstChild);
|
|
6143
6191
|
}
|
|
6144
6192
|
function _i(n, c, l, d) {
|
|
6145
6193
|
var h = this, m = n.querySelector(".ginner-container"), g = "gvideo" + l, y = n.querySelector(".gslide-media"), A = this.getAllPlayers();
|
|
@@ -6155,9 +6203,9 @@ function Ks() {
|
|
|
6155
6203
|
}
|
|
6156
6204
|
var D = B || X('<div id="'.concat(g, '" data-plyr-provider="').concat($, '" data-plyr-embed-id="').concat(I, '"></div>'));
|
|
6157
6205
|
_(S, "".concat($, "-video gvideo")), S.appendChild(D), S.setAttribute("data-id", g), S.setAttribute("data-index", l);
|
|
6158
|
-
var ee =
|
|
6159
|
-
me.on("ready", (function(
|
|
6160
|
-
A[g] =
|
|
6206
|
+
var ee = se(h.settings.plyr, "config") ? h.settings.plyr.config : {}, me = new Plyr("#" + g, ee);
|
|
6207
|
+
me.on("ready", (function(be) {
|
|
6208
|
+
A[g] = be.detail.plyr, j(d) && d();
|
|
6161
6209
|
})), ae((function() {
|
|
6162
6210
|
return n.querySelector("iframe") && n.querySelector("iframe").dataset.ready == "true";
|
|
6163
6211
|
}), (function() {
|
|
@@ -6170,8 +6218,8 @@ function Ks() {
|
|
|
6170
6218
|
n.type === "enterfullscreen" && _(c, "fullscreen"), n.type === "exitfullscreen" && P(c, "fullscreen");
|
|
6171
6219
|
}
|
|
6172
6220
|
function Si(n, c, l, d) {
|
|
6173
|
-
var h, m = this, g = n.querySelector(".gslide-media"), y = !(!
|
|
6174
|
-
if (A && (H(A) && (h = X('<div class="ginlined-content">'.concat(A, "</div>"))),
|
|
6221
|
+
var h, m = this, g = n.querySelector(".gslide-media"), y = !(!se(c, "href") || !c.href) && c.href.split("#").pop().trim(), A = !(!se(c, "content") || !c.content) && c.content;
|
|
6222
|
+
if (A && (H(A) && (h = X('<div class="ginlined-content">'.concat(A, "</div>"))), U(A))) {
|
|
6175
6223
|
A.style.display == "none" && (A.style.display = "block");
|
|
6176
6224
|
var S = document.createElement("div");
|
|
6177
6225
|
S.className = "ginlined-content", S.appendChild(A), h = S;
|
|
@@ -6204,33 +6252,33 @@ function Ks() {
|
|
|
6204
6252
|
return (n = n.toLowerCase()).match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/) !== null ? "image" : n.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || n.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || n.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/) || n.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/) || n.match(/vimeo\.com\/([0-9]*)/) || n.match(/\.(mp4|ogg|webm|mov)/) !== null ? "video" : n.match(/\.(mp3|wav|wma|aac|ogg)/) !== null ? "audio" : n.indexOf("#") > -1 && c.split("#").pop().trim() !== "" ? "inline" : n.indexOf("goajax=true") > -1 ? "ajax" : "external";
|
|
6205
6253
|
} }, { key: "parseConfig", value: function(n, c) {
|
|
6206
6254
|
var l = this, d = p({ descPosition: c.descPosition }, this.defaults);
|
|
6207
|
-
if (Ve(n) && !
|
|
6208
|
-
|
|
6255
|
+
if (Ve(n) && !U(n)) {
|
|
6256
|
+
se(n, "type") || (se(n, "content") && n.content ? n.type = "inline" : se(n, "href") && (n.type = this.sourceType(n.href)));
|
|
6209
6257
|
var h = p(d, n);
|
|
6210
6258
|
return this.setSize(h, c), h;
|
|
6211
6259
|
}
|
|
6212
6260
|
var m = "", g = n.getAttribute("data-glightbox"), y = n.nodeName.toLowerCase();
|
|
6213
6261
|
if (y === "a" && (m = n.href), y === "img" && (m = n.src, d.alt = n.alt), d.href = m, v(d, (function(q, D) {
|
|
6214
|
-
|
|
6262
|
+
se(c, D) && D !== "width" && (d[D] = c[D]);
|
|
6215
6263
|
var ee = n.dataset[D];
|
|
6216
|
-
|
|
6217
|
-
})), d.content && (d.type = "inline"), !d.type && m && (d.type = this.sourceType(m)),
|
|
6264
|
+
ue(ee) || (d[D] = l.sanitizeValue(ee));
|
|
6265
|
+
})), d.content && (d.type = "inline"), !d.type && m && (d.type = this.sourceType(m)), ue(g)) {
|
|
6218
6266
|
if (!d.title && y == "a") {
|
|
6219
6267
|
var A = n.title;
|
|
6220
|
-
|
|
6268
|
+
ue(A) || A === "" || (d.title = A);
|
|
6221
6269
|
}
|
|
6222
6270
|
if (!d.title && y == "img") {
|
|
6223
6271
|
var S = n.alt;
|
|
6224
|
-
|
|
6272
|
+
ue(S) || S === "" || (d.title = S);
|
|
6225
6273
|
}
|
|
6226
6274
|
} else {
|
|
6227
6275
|
var I = [];
|
|
6228
6276
|
v(d, (function(q, D) {
|
|
6229
6277
|
I.push(";\\s?" + D);
|
|
6230
6278
|
})), I = I.join("\\s?:|"), g.trim() !== "" && v(d, (function(q, D) {
|
|
6231
|
-
var ee = g, me = new RegExp("s?" + D + "s?:s?(.*?)(" + I + "s?:|$)"),
|
|
6232
|
-
if (
|
|
6233
|
-
var Le =
|
|
6279
|
+
var ee = g, me = new RegExp("s?" + D + "s?:s?(.*?)(" + I + "s?:|$)"), be = ee.match(me);
|
|
6280
|
+
if (be && be.length && be[1]) {
|
|
6281
|
+
var Le = be[1].trim().replace(/;\s*$/, "");
|
|
6234
6282
|
d[D] = l.sanitizeValue(Le);
|
|
6235
6283
|
}
|
|
6236
6284
|
}));
|
|
@@ -6251,7 +6299,7 @@ function Ks() {
|
|
|
6251
6299
|
return this.setSize(d, c, n), this.slideConfig = d, d;
|
|
6252
6300
|
} }, { key: "setSize", value: function(n, c) {
|
|
6253
6301
|
var l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, d = n.type == "video" ? this.checkSize(c.videosWidth) : this.checkSize(c.width), h = this.checkSize(c.height);
|
|
6254
|
-
return n.width =
|
|
6302
|
+
return n.width = se(n, "width") && n.width !== "" ? this.checkSize(n.width) : d, n.height = se(n, "height") && n.height !== "" ? this.checkSize(n.height) : h, l && n.type == "image" && (n._hasCustomWidth = !!l.dataset.width, n._hasCustomHeight = !!l.dataset.height), n;
|
|
6255
6303
|
} }, { key: "checkSize", value: function(n) {
|
|
6256
6304
|
return xt(n) ? "".concat(n, "px") : n;
|
|
6257
6305
|
} }, { key: "sanitizeValue", value: function(n) {
|
|
@@ -6299,7 +6347,7 @@ function Ks() {
|
|
|
6299
6347
|
} }, { key: "create", value: function() {
|
|
6300
6348
|
return X(this.instance.settings.slideHTML);
|
|
6301
6349
|
} }, { key: "getConfig", value: function() {
|
|
6302
|
-
|
|
6350
|
+
U(this.element) || this.element.hasOwnProperty("draggable") || (this.element.draggable = this.instance.settings.draggable);
|
|
6303
6351
|
var n = new Ai(this.instance.settings.slideExtraAttributes);
|
|
6304
6352
|
return this.slideConfig = n.parseConfig(this.element, this.instance.settings), this.slideConfig;
|
|
6305
6353
|
} }]);
|
|
@@ -6400,7 +6448,7 @@ function Ks() {
|
|
|
6400
6448
|
} }, { key: "destroy", value: function() {
|
|
6401
6449
|
return this.singleTapTimeout && clearTimeout(this.singleTapTimeout), this.tapTimeout && clearTimeout(this.tapTimeout), this.longTapTimeout && clearTimeout(this.longTapTimeout), this.swipeTimeout && clearTimeout(this.swipeTimeout), this.element.removeEventListener("touchstart", this.start), this.element.removeEventListener("touchmove", this.move), this.element.removeEventListener("touchend", this.end), this.element.removeEventListener("touchcancel", this.cancel), this.rotate.del(), this.touchStart.del(), this.multipointStart.del(), this.multipointEnd.del(), this.pinch.del(), this.swipe.del(), this.tap.del(), this.doubleTap.del(), this.longTap.del(), this.singleTap.del(), this.pressMove.del(), this.twoFingerPressMove.del(), this.touchMove.del(), this.touchEnd.del(), this.touchCancel.del(), this.preV = this.pinchStartLen = this.zoom = this.isDoubleTap = this.delta = this.last = this.now = this.tapTimeout = this.singleTapTimeout = this.longTapTimeout = this.swipeTimeout = this.x1 = this.x2 = this.y1 = this.y2 = this.preTapPosition = this.rotate = this.touchStart = this.multipointStart = this.multipointEnd = this.pinch = this.swipe = this.tap = this.doubleTap = this.longTap = this.singleTap = this.pressMove = this.touchMove = this.touchEnd = this.touchCancel = this.twoFingerPressMove = null, window.removeEventListener("scroll", this._cancelAllHandler), null;
|
|
6402
6450
|
} }]);
|
|
6403
|
-
function
|
|
6451
|
+
function Nt(n) {
|
|
6404
6452
|
var c = (function() {
|
|
6405
6453
|
var g, y = document.createElement("fakeelement"), A = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };
|
|
6406
6454
|
for (g in A) if (y.style[g] !== void 0) return A[g];
|
|
@@ -6411,7 +6459,7 @@ function Ks() {
|
|
|
6411
6459
|
}
|
|
6412
6460
|
function Ei(n) {
|
|
6413
6461
|
if (n.events.hasOwnProperty("touch")) return !1;
|
|
6414
|
-
var c, l, d, h = te(), m = h.width, g = h.height, y = !1, A = null, S = null, I = null, $ = !1, B = 1, q = 1, D = !1, ee = !1, me = null,
|
|
6462
|
+
var c, l, d, h = te(), m = h.width, g = h.height, y = !1, A = null, S = null, I = null, $ = !1, B = 1, q = 1, D = !1, ee = !1, me = null, be = null, Le = null, oe = null, Re = 0, ze = 0, ht = !1, rt = !1, _e = {}, Se = {}, xa = 0, ka = 0, Li = document.getElementById("glightbox-slider"), St = document.querySelector(".goverlay"), Ri = new Ii(Li, { touchStart: function(Y) {
|
|
6415
6463
|
if (y = !0, (E(Y.targetTouches[0].target, "ginner-container") || M(Y.targetTouches[0].target, ".gslide-desc") || Y.targetTouches[0].target.nodeName.toLowerCase() == "a") && (y = !1), M(Y.targetTouches[0].target, ".gslide-inline") && !E(Y.targetTouches[0].target.parentNode, "gslide-inline") && (y = !1), y) {
|
|
6416
6464
|
if (Se = Y.targetTouches[0], _e.pageX = Y.targetTouches[0].pageX, _e.pageY = Y.targetTouches[0].pageY, xa = Y.targetTouches[0].clientX, ka = Y.targetTouches[0].clientY, A = n.activeSlide, S = A.querySelector(".gslide-media"), d = A.querySelector(".gslide-inline"), I = null, E(S, "gslide-image") && (I = S.querySelector("img")), (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) > 769 && (S = A.querySelector(".ginner-container")), P(St, "greset"), Y.pageX > 20 && Y.pageX < window.innerWidth - 20) return;
|
|
6417
6465
|
Y.preventDefault();
|
|
@@ -6423,15 +6471,15 @@ function Ks() {
|
|
|
6423
6471
|
if (Math.abs(de) <= 13) return !1;
|
|
6424
6472
|
}
|
|
6425
6473
|
$ = !0;
|
|
6426
|
-
var
|
|
6427
|
-
if (Math.abs(Oi) > Math.abs(Bi) ? (ht = !1, rt = !0) : (rt = !1, ht = !0), c = Se.pageX - _e.pageX, Re = 100 * c / m, l = Se.pageY - _e.pageY, ze = 100 * l / g, ht && I && (
|
|
6474
|
+
var Ue, Ct = Y.targetTouches[0].clientX, zi = Y.targetTouches[0].clientY, Oi = xa - Ct, Bi = ka - zi;
|
|
6475
|
+
if (Math.abs(Oi) > Math.abs(Bi) ? (ht = !1, rt = !0) : (rt = !1, ht = !0), c = Se.pageX - _e.pageX, Re = 100 * c / m, l = Se.pageY - _e.pageY, ze = 100 * l / g, ht && I && (Ue = 1 - Math.abs(l) / g, St.style.opacity = Ue, n.settings.touchFollowAxis && (Re = 0)), rt && (Ue = 1 - Math.abs(c) / m, S.style.opacity = Ue, n.settings.touchFollowAxis && (ze = 0)), !I) return C(S, "translate3d(".concat(Re, "%, 0, 0)"));
|
|
6428
6476
|
C(S, "translate3d(".concat(Re, "%, ").concat(ze, "%, 0)"));
|
|
6429
6477
|
}
|
|
6430
6478
|
}, touchEnd: function() {
|
|
6431
6479
|
if (y) {
|
|
6432
|
-
if ($ = !1, ee || D) return Le = me, void (oe =
|
|
6480
|
+
if ($ = !1, ee || D) return Le = me, void (oe = be);
|
|
6433
6481
|
var Y = Math.abs(parseInt(ze)), de = Math.abs(parseInt(Re));
|
|
6434
|
-
if (!(Y > 29 && I)) return Y < 29 && de < 25 ? (_(St, "greset"), St.style.opacity = 1,
|
|
6482
|
+
if (!(Y > 29 && I)) return Y < 29 && de < 25 ? (_(St, "greset"), St.style.opacity = 1, Nt(S)) : void 0;
|
|
6435
6483
|
n.close();
|
|
6436
6484
|
}
|
|
6437
6485
|
}, multipointEnd: function() {
|
|
@@ -6444,24 +6492,24 @@ function Ks() {
|
|
|
6444
6492
|
if (!I || $) return !1;
|
|
6445
6493
|
D = !0, I.scaleX = I.scaleY = B * Y.zoom;
|
|
6446
6494
|
var de = B * Y.zoom;
|
|
6447
|
-
if (ee = !0, de <= 1) return ee = !1, de = 1, oe = null, Le = null, me = null,
|
|
6495
|
+
if (ee = !0, de <= 1) return ee = !1, de = 1, oe = null, Le = null, me = null, be = null, void I.setAttribute("style", "");
|
|
6448
6496
|
de > 4.5 && (de = 4.5), I.style.transform = "scale3d(".concat(de, ", ").concat(de, ", 1)"), q = de;
|
|
6449
6497
|
}, pressMove: function(Y) {
|
|
6450
6498
|
if (ee && !D) {
|
|
6451
|
-
var de = Se.pageX - _e.pageX,
|
|
6452
|
-
Le && (de += Le), oe && (
|
|
6453
|
-
var Ct = "translate3d(".concat(de, "px, ").concat(
|
|
6499
|
+
var de = Se.pageX - _e.pageX, Ue = Se.pageY - _e.pageY;
|
|
6500
|
+
Le && (de += Le), oe && (Ue += oe), me = de, be = Ue;
|
|
6501
|
+
var Ct = "translate3d(".concat(de, "px, ").concat(Ue, "px, 0)");
|
|
6454
6502
|
q && (Ct += " scale3d(".concat(q, ", ").concat(q, ", 1)")), C(I, Ct);
|
|
6455
6503
|
}
|
|
6456
6504
|
}, swipe: function(Y) {
|
|
6457
6505
|
if (!ee) if (D) D = !1;
|
|
6458
6506
|
else {
|
|
6459
6507
|
if (Y.direction == "Left") {
|
|
6460
|
-
if (n.index == n.elements.length - 1) return
|
|
6508
|
+
if (n.index == n.elements.length - 1) return Nt(S);
|
|
6461
6509
|
n.nextSlide();
|
|
6462
6510
|
}
|
|
6463
6511
|
if (Y.direction == "Right") {
|
|
6464
|
-
if (n.index == 0) return
|
|
6512
|
+
if (n.index == 0) return Nt(S);
|
|
6465
6513
|
n.prevSlide();
|
|
6466
6514
|
}
|
|
6467
6515
|
}
|
|
@@ -6503,9 +6551,9 @@ function Ks() {
|
|
|
6503
6551
|
if (this.elements.length === 0) return !1;
|
|
6504
6552
|
this.activeSlide = null, this.prevActiveSlideIndex = null, this.prevActiveSlide = null;
|
|
6505
6553
|
var l = xt(c) ? c : this.settings.startAt;
|
|
6506
|
-
if (
|
|
6554
|
+
if (U(n)) {
|
|
6507
6555
|
var d = n.getAttribute("data-gallery");
|
|
6508
|
-
d && (this.fullElementsList = this.elements, this.elements = this.getGalleryElements(this.elements, d)),
|
|
6556
|
+
d && (this.fullElementsList = this.elements, this.elements = this.getGalleryElements(this.elements, d)), ue(l) && (l = this.getElementIndex(n)) < 0 && (l = 0);
|
|
6509
6557
|
}
|
|
6510
6558
|
xt(l) || (l = 0), this.build(), L(this.overlay, this.settings.openEffect === "none" ? "none" : this.settings.cssEfects.fade.in);
|
|
6511
6559
|
var h = document.body, m = window.innerWidth - document.documentElement.clientWidth;
|
|
@@ -6523,18 +6571,18 @@ function Ks() {
|
|
|
6523
6571
|
var d = this.slidesContainer.querySelector(".current");
|
|
6524
6572
|
d && P(d, "current"), this.slideAnimateOut();
|
|
6525
6573
|
var h = this.slidesContainer.querySelectorAll(".gslide")[c];
|
|
6526
|
-
if (E(h, "loaded")) this.slideAnimateIn(h, l),
|
|
6574
|
+
if (E(h, "loaded")) this.slideAnimateIn(h, l), N(this.loader);
|
|
6527
6575
|
else {
|
|
6528
6576
|
Z(this.loader);
|
|
6529
6577
|
var m = this.elements[c], g = { index: this.index, slide: h, slideNode: h, slideConfig: m.slideConfig, slideIndex: this.index, trigger: m.node, player: null };
|
|
6530
6578
|
this.trigger("slide_before_load", g), m.instance.setContent(h, (function() {
|
|
6531
|
-
|
|
6579
|
+
N(n.loader), n.resize(), n.slideAnimateIn(h, l), n.trigger("slide_after_load", g);
|
|
6532
6580
|
}));
|
|
6533
6581
|
}
|
|
6534
6582
|
this.slideDescription = h.querySelector(".gslide-description"), this.slideDescriptionContained = this.slideDescription && E(this.slideDescription.parentNode, "gslide-media"), this.settings.preload && (this.preloadSlide(c + 1), this.preloadSlide(c - 1)), this.updateNavigationClasses(), this.activeSlide = h;
|
|
6535
6583
|
} }, { key: "preloadSlide", value: function(n) {
|
|
6536
6584
|
var c = this;
|
|
6537
|
-
if (n < 0 || n > this.elements.length - 1 ||
|
|
6585
|
+
if (n < 0 || n > this.elements.length - 1 || ue(this.elements[n])) return !1;
|
|
6538
6586
|
var l = this.slidesContainer.querySelectorAll(".gslide")[n];
|
|
6539
6587
|
if (E(l, "loaded")) return !1;
|
|
6540
6588
|
var d = this.elements[n], h = d.type, m = { index: n, slide: l, slideNode: l, slideConfig: d.slideConfig, slideIndex: n, trigger: d.node, player: null };
|
|
@@ -6574,8 +6622,8 @@ function Ks() {
|
|
|
6574
6622
|
var c = this.slidesContainer && this.slidesContainer.querySelectorAll(".gslide")[n];
|
|
6575
6623
|
c && (this.getActiveSlideIndex() == n && (n == this.elements.length - 1 ? this.prevSlide() : this.nextSlide()), c.parentNode.removeChild(c)), this.elements.splice(n, 1), this.trigger("slide_removed", n), j(this.settings.slideRemoved) && this.settings.slideRemoved(n);
|
|
6576
6624
|
} }, { key: "slideAnimateIn", value: function(n, c) {
|
|
6577
|
-
var l = this, d = n.querySelector(".gslide-media"), h = n.querySelector(".gslide-description"), m = { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlide, slideConfig:
|
|
6578
|
-
if (d.offsetWidth > 0 && h && (
|
|
6625
|
+
var l = this, d = n.querySelector(".gslide-media"), h = n.querySelector(".gslide-description"), m = { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlide, slideConfig: ue(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: ue(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, g = { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideConfig: this.elements[this.index].slideConfig, slideIndex: this.index, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) };
|
|
6626
|
+
if (d.offsetWidth > 0 && h && (N(h), h.style.display = ""), P(n, this.effectsClasses), c) L(n, this.settings.cssEfects[this.settings.openEffect].in, (function() {
|
|
6579
6627
|
l.settings.autoplayVideos && l.slidePlayerPlay(n), l.trigger("slide_changed", { prev: m, current: g }), j(l.settings.afterSlideChange) && l.settings.afterSlideChange.apply(l, [m, g]);
|
|
6580
6628
|
}));
|
|
6581
6629
|
else {
|
|
@@ -6592,7 +6640,7 @@ function Ks() {
|
|
|
6592
6640
|
var n = this.prevActiveSlide;
|
|
6593
6641
|
P(n, this.effectsClasses), _(n, "prev");
|
|
6594
6642
|
var c = this.settings.slideEffect, l = c !== "none" ? this.settings.cssEfects[c].out : c;
|
|
6595
|
-
this.slidePlayerPause(n), this.trigger("slide_before_change", { prev: { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlideIndex, slideConfig:
|
|
6643
|
+
this.slidePlayerPause(n), this.trigger("slide_before_change", { prev: { index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, slideNode: this.prevActiveSlide, slideIndex: this.prevActiveSlideIndex, slideConfig: ue(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig, trigger: ue(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, current: { index: this.index, slide: this.activeSlide, slideNode: this.activeSlide, slideIndex: this.index, slideConfig: this.elements[this.index].slideConfig, trigger: this.elements[this.index].node, player: this.getSlidePlayerInstance(this.index) } }), j(this.settings.beforeSlideChange) && this.settings.beforeSlideChange.apply(this, [{ index: this.prevActiveSlideIndex, slide: this.prevActiveSlide, player: this.getSlidePlayerInstance(this.prevActiveSlideIndex) }, { index: this.index, slide: this.activeSlide, player: this.getSlidePlayerInstance(this.index) }]), this.prevActiveSlideIndex > this.index && this.settings.slideEffect == "slide" && (l = this.settings.cssEfects.slideBack.out), L(n, l, (function() {
|
|
6596
6644
|
var d = n.querySelector(".ginner-container"), h = n.querySelector(".gslide-media"), m = n.querySelector(".gslide-description");
|
|
6597
6645
|
d.style.transform = "", h.style.transform = "", P(h, "greset"), h.style.opacity = "", m && (m.style.opacity = ""), P(n, "prev");
|
|
6598
6646
|
}));
|
|
@@ -6600,9 +6648,9 @@ function Ks() {
|
|
|
6600
6648
|
return this.videoPlayers;
|
|
6601
6649
|
} }, { key: "getSlidePlayerInstance", value: function(n) {
|
|
6602
6650
|
var c = "gvideo" + n, l = this.getAllPlayers();
|
|
6603
|
-
return !(!
|
|
6651
|
+
return !(!se(l, c) || !l[c]) && l[c];
|
|
6604
6652
|
} }, { key: "stopSlideVideo", value: function(n) {
|
|
6605
|
-
if (
|
|
6653
|
+
if (U(n)) {
|
|
6606
6654
|
var c = n.querySelector(".gvideo-wrapper");
|
|
6607
6655
|
c && (n = c.getAttribute("data-index"));
|
|
6608
6656
|
}
|
|
@@ -6610,14 +6658,14 @@ function Ks() {
|
|
|
6610
6658
|
var l = this.getSlidePlayerInstance(n);
|
|
6611
6659
|
l && l.playing && l.pause();
|
|
6612
6660
|
} }, { key: "slidePlayerPause", value: function(n) {
|
|
6613
|
-
if (
|
|
6661
|
+
if (U(n)) {
|
|
6614
6662
|
var c = n.querySelector(".gvideo-wrapper");
|
|
6615
6663
|
c && (n = c.getAttribute("data-index"));
|
|
6616
6664
|
}
|
|
6617
6665
|
var l = this.getSlidePlayerInstance(n);
|
|
6618
6666
|
l && l.playing && l.pause();
|
|
6619
6667
|
} }, { key: "playSlideVideo", value: function(n) {
|
|
6620
|
-
if (
|
|
6668
|
+
if (U(n)) {
|
|
6621
6669
|
var c = n.querySelector(".gvideo-wrapper");
|
|
6622
6670
|
c && (n = c.getAttribute("data-index"));
|
|
6623
6671
|
}
|
|
@@ -6627,7 +6675,7 @@ function Ks() {
|
|
|
6627
6675
|
} }, { key: "slidePlayerPlay", value: function(n) {
|
|
6628
6676
|
var c;
|
|
6629
6677
|
if (!ya || (c = this.settings.plyr.config) !== null && c !== void 0 && c.muted) {
|
|
6630
|
-
if (
|
|
6678
|
+
if (U(n)) {
|
|
6631
6679
|
var l = n.querySelector(".gvideo-wrapper");
|
|
6632
6680
|
l && (n = l.getAttribute("data-index"));
|
|
6633
6681
|
}
|
|
@@ -6648,11 +6696,11 @@ function Ks() {
|
|
|
6648
6696
|
} }, { key: "getElementIndex", value: function(n) {
|
|
6649
6697
|
var c = !1;
|
|
6650
6698
|
return v(this.elements, (function(l, d) {
|
|
6651
|
-
if (
|
|
6699
|
+
if (se(l, "node") && l.node == n) return c = d, !0;
|
|
6652
6700
|
})), c;
|
|
6653
6701
|
} }, { key: "getElements", value: function() {
|
|
6654
6702
|
var n = this, c = [];
|
|
6655
|
-
this.elements = this.elements ? this.elements : [], !
|
|
6703
|
+
this.elements = this.elements ? this.elements : [], !ue(this.settings.elements) && $e(this.settings.elements) && this.settings.elements.length && v(this.settings.elements, (function(d, h) {
|
|
6656
6704
|
var m = new kt(d, n, h), g = m.getConfig(), y = p({}, g);
|
|
6657
6705
|
y.node = !1, y.index = h, y.instance = m, y.slideConfig = g, c.push(y);
|
|
6658
6706
|
}));
|
|
@@ -6685,7 +6733,7 @@ function Ks() {
|
|
|
6685
6733
|
v(c, (function(S) {
|
|
6686
6734
|
S.parentNode == document.body && S.nodeName.charAt(0) !== "#" && S.hasAttribute && !S.hasAttribute("aria-hidden") && (l.push(S), S.setAttribute("aria-hidden", "true"));
|
|
6687
6735
|
}));
|
|
6688
|
-
var d =
|
|
6736
|
+
var d = se(this.settings.svg, "next") ? this.settings.svg.next : "", h = se(this.settings.svg, "prev") ? this.settings.svg.prev : "", m = se(this.settings.svg, "close") ? this.settings.svg.close : "", g = this.settings.lightboxHTML;
|
|
6689
6737
|
g = X(g = (g = (g = g.replace(/{nextSVG}/g, d)).replace(/{prevSVG}/g, h)).replace(/{closeSVG}/g, m)), document.body.appendChild(g);
|
|
6690
6738
|
var y = document.getElementById("glightbox-body");
|
|
6691
6739
|
this.modal = y;
|
|
@@ -6717,10 +6765,10 @@ function Ks() {
|
|
|
6717
6765
|
}
|
|
6718
6766
|
}
|
|
6719
6767
|
if (l) {
|
|
6720
|
-
var D =
|
|
6768
|
+
var D = se(this.settings.plyr.config, "ratio") ? this.settings.plyr.config.ratio : "";
|
|
6721
6769
|
if (!D) {
|
|
6722
|
-
var ee = l.clientWidth, me = l.clientHeight,
|
|
6723
|
-
D = "".concat(ee /
|
|
6770
|
+
var ee = l.clientWidth, me = l.clientHeight, be = ee / me;
|
|
6771
|
+
D = "".concat(ee / be, ":").concat(me / be);
|
|
6724
6772
|
}
|
|
6725
6773
|
var Le = D.split(":"), oe = this.settings.videosWidth, Re = this.settings.videosWidth, ze = (Re = xt(oe) || oe.indexOf("px") !== -1 ? parseInt(oe) : oe.indexOf("vw") !== -1 ? m * parseInt(oe) / 100 : oe.indexOf("vh") !== -1 ? g * parseInt(oe) / 100 : oe.indexOf("%") !== -1 ? m * parseInt(oe) / 100 : parseInt(l.clientWidth)) / (parseInt(Le[0]) / parseInt(Le[1]));
|
|
6726
6774
|
if (ze = Math.floor(ze), y && (g -= h.offsetHeight), Re > m || ze > g || g < ze && m > Re) {
|
|
@@ -6736,8 +6784,8 @@ function Ks() {
|
|
|
6736
6784
|
var n = this.loop();
|
|
6737
6785
|
P(this.nextButton, "disabled"), P(this.prevButton, "disabled"), this.index == 0 && this.elements.length - 1 == 0 ? (_(this.prevButton, "disabled"), _(this.nextButton, "disabled")) : this.index !== 0 || n ? this.index !== this.elements.length - 1 || n || _(this.nextButton, "disabled") : _(this.prevButton, "disabled");
|
|
6738
6786
|
} }, { key: "loop", value: function() {
|
|
6739
|
-
var n =
|
|
6740
|
-
return n =
|
|
6787
|
+
var n = se(this.settings, "loopAtEnd") ? this.settings.loopAtEnd : null;
|
|
6788
|
+
return n = se(this.settings, "loop") ? this.settings.loop : n, n;
|
|
6741
6789
|
} }, { key: "close", value: function() {
|
|
6742
6790
|
var n = this;
|
|
6743
6791
|
if (!this.lightboxOpen) {
|
|
@@ -6788,7 +6836,7 @@ function Ks() {
|
|
|
6788
6836
|
}));
|
|
6789
6837
|
})(Rt)), Rt.exports;
|
|
6790
6838
|
}
|
|
6791
|
-
var Zs =
|
|
6839
|
+
var Zs = Js();
|
|
6792
6840
|
const Qs = /* @__PURE__ */ Wa(Zs);
|
|
6793
6841
|
var en = Object.getOwnPropertyDescriptor, tn = (a, e, t, i) => {
|
|
6794
6842
|
for (var s = i > 1 ? void 0 : i ? en(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
@@ -6797,10 +6845,10 @@ var en = Object.getOwnPropertyDescriptor, tn = (a, e, t, i) => {
|
|
|
6797
6845
|
};
|
|
6798
6846
|
let Zt = class extends Fe {
|
|
6799
6847
|
render() {
|
|
6800
|
-
return
|
|
6848
|
+
return b` <div class="cb-thinking"><span></span><span></span><span></span></div>`;
|
|
6801
6849
|
}
|
|
6802
6850
|
};
|
|
6803
|
-
Zt.styles =
|
|
6851
|
+
Zt.styles = K`
|
|
6804
6852
|
.cb-thinking {
|
|
6805
6853
|
text-align: center;
|
|
6806
6854
|
}
|
|
@@ -6839,7 +6887,7 @@ Zt.styles = J`
|
|
|
6839
6887
|
}
|
|
6840
6888
|
`;
|
|
6841
6889
|
Zt = tn([
|
|
6842
|
-
|
|
6890
|
+
J("cb-thinking")
|
|
6843
6891
|
], Zt);
|
|
6844
6892
|
var an = Object.defineProperty, sn = Object.getOwnPropertyDescriptor, ti = (a, e, t, i) => {
|
|
6845
6893
|
for (var s = i > 1 ? void 0 : i ? sn(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
@@ -6851,18 +6899,18 @@ let qt = class extends re {
|
|
|
6851
6899
|
super(...arguments), this.files = [];
|
|
6852
6900
|
}
|
|
6853
6901
|
render() {
|
|
6854
|
-
return
|
|
6902
|
+
return b` <div class="cb-uploading">
|
|
6855
6903
|
<div class="cb-uploading__title">
|
|
6856
6904
|
<sl-spinner class="cb-spinner"></sl-spinner>
|
|
6857
6905
|
<span>Uploading...</span>
|
|
6858
6906
|
</div>
|
|
6859
6907
|
<div class="cb-uploading__filelist">
|
|
6860
|
-
${this.files.map((a) =>
|
|
6908
|
+
${this.files.map((a) => b`${a.name}<br />`)}
|
|
6861
6909
|
</div>
|
|
6862
6910
|
</div>`;
|
|
6863
6911
|
}
|
|
6864
6912
|
};
|
|
6865
|
-
qt.styles =
|
|
6913
|
+
qt.styles = K`
|
|
6866
6914
|
.cb-uploading {
|
|
6867
6915
|
text-align: left;
|
|
6868
6916
|
}
|
|
@@ -6884,9 +6932,9 @@ ti([
|
|
|
6884
6932
|
x({ type: Array })
|
|
6885
6933
|
], qt.prototype, "files", 2);
|
|
6886
6934
|
qt = ti([
|
|
6887
|
-
|
|
6935
|
+
J("cb-uploading")
|
|
6888
6936
|
], qt);
|
|
6889
|
-
const nn =
|
|
6937
|
+
const nn = K`
|
|
6890
6938
|
${ke}
|
|
6891
6939
|
:host {
|
|
6892
6940
|
}
|
|
@@ -6917,7 +6965,7 @@ let mt = class extends Fe {
|
|
|
6917
6965
|
super(...arguments), this.url = "", this.inverse = !1;
|
|
6918
6966
|
}
|
|
6919
6967
|
render() {
|
|
6920
|
-
return
|
|
6968
|
+
return b`
|
|
6921
6969
|
<a
|
|
6922
6970
|
class="
|
|
6923
6971
|
cb-external-link link__item
|
|
@@ -6932,7 +6980,7 @@ let mt = class extends Fe {
|
|
|
6932
6980
|
`;
|
|
6933
6981
|
}
|
|
6934
6982
|
};
|
|
6935
|
-
mt.styles =
|
|
6983
|
+
mt.styles = K`
|
|
6936
6984
|
:host {
|
|
6937
6985
|
--primary-color: var(--sl-color-primary-600);
|
|
6938
6986
|
}
|
|
@@ -6964,9 +7012,9 @@ ca([
|
|
|
6964
7012
|
x({ type: Boolean })
|
|
6965
7013
|
], mt.prototype, "inverse", 2);
|
|
6966
7014
|
mt = ca([
|
|
6967
|
-
|
|
7015
|
+
J("cb-external-link")
|
|
6968
7016
|
], mt);
|
|
6969
|
-
const cn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-2v-1h2a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.928 15.849v-3.337h1.136v-.662H0v.662h1.134v3.337zm4.689-3.999h-.894L4.9 13.289h-.035l-.832-1.439h-.932l1.228 1.983l-1.24 2.016h.862l.853-1.415h.035l.85 1.415h.907l-1.253-1.992zm1.93.662v3.337h-.794v-3.337H6.619v-.662h3.064v.662H8.546Z"/></svg>', ln = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.6 11.85H0v3.999h.791v-1.342h.803q.43 0 .732-.173q.305-.175.463-.474a1.4 1.4 0 0 0 .161-.677q0-.375-.158-.677a1.2 1.2 0 0 0-.46-.477q-.3-.18-.732-.179m.545 1.333a.8.8 0 0 1-.085.38a.57.57 0 0 1-.238.241a.8.8 0 0 1-.375.082H.788V12.48h.66q.327 0 .512.181q.185.183.185.522m1.217-1.333v3.999h1.46q.602 0 .998-.237a1.45 1.45 0 0 0 .595-.689q.196-.45.196-1.084q0-.63-.196-1.075a1.43 1.43 0 0 0-.589-.68q-.396-.234-1.005-.234zm.791.645h.563q.371 0 .609.152a.9.9 0 0 1 .354.454q.118.302.118.753a2.3 2.3 0 0 1-.068.592a1.1 1.1 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.3 1.3 0 0 1-.483.082h-.563zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638z"/></svg>', dn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2H9v-1h3a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM.706 13.189v2.66H0V11.85h.806l1.14 2.596h.026l1.14-2.596h.8v3.999h-.716v-2.66h-.038l-.946 2.159h-.516l-.952-2.16H.706Zm3.919 2.66V11.85h1.459q.609 0 1.005.234t.589.68q.195.445.196 1.075q0 .634-.196 1.084q-.197.451-.595.689q-.396.237-1 .237H4.626Zm1.353-3.354h-.562v2.707h.562q.279 0 .484-.082a.8.8 0 0 0 .334-.252a1.1 1.1 0 0 0 .196-.422q.067-.252.067-.592a2.1 2.1 0 0 0-.117-.753a.9.9 0 0 0-.354-.454q-.238-.152-.61-.152"/></svg>', fn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM3.517 14.841a1.13 1.13 0 0 0 .401.823q.195.162.478.252q.284.091.665.091q.507 0 .859-.158q.354-.158.539-.44q.187-.284.187-.656q0-.336-.134-.56a1 1 0 0 0-.375-.357a2 2 0 0 0-.566-.21l-.621-.144a1 1 0 0 1-.404-.176a.37.37 0 0 1-.144-.299q0-.234.185-.384q.188-.152.512-.152q.214 0 .37.068a.6.6 0 0 1 .246.181a.56.56 0 0 1 .12.258h.75a1.1 1.1 0 0 0-.2-.566a1.2 1.2 0 0 0-.5-.41a1.8 1.8 0 0 0-.78-.152q-.439 0-.776.15q-.337.149-.527.421q-.19.273-.19.639q0 .302.122.524q.124.223.352.367q.228.143.539.213l.618.144q.31.073.463.193a.39.39 0 0 1 .152.326a.5.5 0 0 1-.085.29a.56.56 0 0 1-.255.193q-.167.07-.413.07q-.175 0-.32-.04a.8.8 0 0 1-.248-.115a.58.58 0 0 1-.255-.384zM.806 13.693q0-.373.102-.633a.87.87 0 0 1 .302-.399a.8.8 0 0 1 .475-.137q.225 0 .398.097a.7.7 0 0 1 .272.26a.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964a1.4 1.4 0 0 0-.489-.272a1.8 1.8 0 0 0-.606-.097q-.534 0-.911.223q-.375.222-.572.632q-.195.41-.196.979v.498q0 .568.193.976q.197.407.572.626q.375.217.914.217q.439 0 .785-.164t.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.8.8 0 0 1-.118.363a.7.7 0 0 1-.272.25a.9.9 0 0 1-.401.087a.85.85 0 0 1-.478-.132a.83.83 0 0 1-.299-.392a1.7 1.7 0 0 1-.102-.627zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879z"/></svg>', hn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.6 11.85H0v3.999h.791v-1.342h.803q.43 0 .732-.173q.305-.175.463-.474a1.4 1.4 0 0 0 .161-.677q0-.375-.158-.677a1.2 1.2 0 0 0-.46-.477q-.3-.18-.732-.179m.545 1.333a.8.8 0 0 1-.085.38a.57.57 0 0 1-.238.241a.8.8 0 0 1-.375.082H.788V12.48h.66q.327 0 .512.181q.185.183.185.522m2.817-1.333h-1.6v3.999h.791v-1.342h.803q.43 0 .732-.173q.305-.175.463-.474q.162-.302.161-.677q0-.375-.158-.677a1.2 1.2 0 0 0-.46-.477q-.3-.18-.732-.179m.545 1.333a.8.8 0 0 1-.085.38a.57.57 0 0 1-.238.241a.8.8 0 0 1-.375.082H4.15V12.48h.66q.327 0 .512.181q.185.183.185.522m2.767-.67v3.336H7.48v-3.337H6.346v-.662h3.065v.662z"/></svg>',
|
|
7017
|
+
const cn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-2v-1h2a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.928 15.849v-3.337h1.136v-.662H0v.662h1.134v3.337zm4.689-3.999h-.894L4.9 13.289h-.035l-.832-1.439h-.932l1.228 1.983l-1.24 2.016h.862l.853-1.415h.035l.85 1.415h.907l-1.253-1.992zm1.93.662v3.337h-.794v-3.337H6.619v-.662h3.064v.662H8.546Z"/></svg>', ln = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.6 11.85H0v3.999h.791v-1.342h.803q.43 0 .732-.173q.305-.175.463-.474a1.4 1.4 0 0 0 .161-.677q0-.375-.158-.677a1.2 1.2 0 0 0-.46-.477q-.3-.18-.732-.179m.545 1.333a.8.8 0 0 1-.085.38a.57.57 0 0 1-.238.241a.8.8 0 0 1-.375.082H.788V12.48h.66q.327 0 .512.181q.185.183.185.522m1.217-1.333v3.999h1.46q.602 0 .998-.237a1.45 1.45 0 0 0 .595-.689q.196-.45.196-1.084q0-.63-.196-1.075a1.43 1.43 0 0 0-.589-.68q-.396-.234-1.005-.234zm.791.645h.563q.371 0 .609.152a.9.9 0 0 1 .354.454q.118.302.118.753a2.3 2.3 0 0 1-.068.592a1.1 1.1 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.3 1.3 0 0 1-.483.082h-.563zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638z"/></svg>', dn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2H9v-1h3a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM.706 13.189v2.66H0V11.85h.806l1.14 2.596h.026l1.14-2.596h.8v3.999h-.716v-2.66h-.038l-.946 2.159h-.516l-.952-2.16H.706Zm3.919 2.66V11.85h1.459q.609 0 1.005.234t.589.68q.195.445.196 1.075q0 .634-.196 1.084q-.197.451-.595.689q-.396.237-1 .237H4.626Zm1.353-3.354h-.562v2.707h.562q.279 0 .484-.082a.8.8 0 0 0 .334-.252a1.1 1.1 0 0 0 .196-.422q.067-.252.067-.592a2.1 2.1 0 0 0-.117-.753a.9.9 0 0 0-.354-.454q-.238-.152-.61-.152"/></svg>', fn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM3.517 14.841a1.13 1.13 0 0 0 .401.823q.195.162.478.252q.284.091.665.091q.507 0 .859-.158q.354-.158.539-.44q.187-.284.187-.656q0-.336-.134-.56a1 1 0 0 0-.375-.357a2 2 0 0 0-.566-.21l-.621-.144a1 1 0 0 1-.404-.176a.37.37 0 0 1-.144-.299q0-.234.185-.384q.188-.152.512-.152q.214 0 .37.068a.6.6 0 0 1 .246.181a.56.56 0 0 1 .12.258h.75a1.1 1.1 0 0 0-.2-.566a1.2 1.2 0 0 0-.5-.41a1.8 1.8 0 0 0-.78-.152q-.439 0-.776.15q-.337.149-.527.421q-.19.273-.19.639q0 .302.122.524q.124.223.352.367q.228.143.539.213l.618.144q.31.073.463.193a.39.39 0 0 1 .152.326a.5.5 0 0 1-.085.29a.56.56 0 0 1-.255.193q-.167.07-.413.07q-.175 0-.32-.04a.8.8 0 0 1-.248-.115a.58.58 0 0 1-.255-.384zM.806 13.693q0-.373.102-.633a.87.87 0 0 1 .302-.399a.8.8 0 0 1 .475-.137q.225 0 .398.097a.7.7 0 0 1 .272.26a.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964a1.4 1.4 0 0 0-.489-.272a1.8 1.8 0 0 0-.606-.097q-.534 0-.911.223q-.375.222-.572.632q-.195.41-.196.979v.498q0 .568.193.976q.197.407.572.626q.375.217.914.217q.439 0 .785-.164t.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.8.8 0 0 1-.118.363a.7.7 0 0 1-.272.25a.9.9 0 0 1-.401.087a.85.85 0 0 1-.478-.132a.83.83 0 0 1-.299-.392a1.7 1.7 0 0 1-.102-.627zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879z"/></svg>', hn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.6 11.85H0v3.999h.791v-1.342h.803q.43 0 .732-.173q.305-.175.463-.474a1.4 1.4 0 0 0 .161-.677q0-.375-.158-.677a1.2 1.2 0 0 0-.46-.477q-.3-.18-.732-.179m.545 1.333a.8.8 0 0 1-.085.38a.57.57 0 0 1-.238.241a.8.8 0 0 1-.375.082H.788V12.48h.66q.327 0 .512.181q.185.183.185.522m2.817-1.333h-1.6v3.999h.791v-1.342h.803q.43 0 .732-.173q.305-.175.463-.474q.162-.302.161-.677q0-.375-.158-.677a1.2 1.2 0 0 0-.46-.477q-.3-.18-.732-.179m.545 1.333a.8.8 0 0 1-.085.38a.57.57 0 0 1-.238.241a.8.8 0 0 1-.375.082H4.15V12.48h.66q.327 0 .512.181q.185.183.185.522m2.767-.67v3.336H7.48v-3.337H6.346v-.662h3.065v.662z"/></svg>', un = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zm-7.839 9.166v.522q0 .384-.117.641a.86.86 0 0 1-.322.387a.9.9 0 0 1-.469.126a.9.9 0 0 1-.471-.126a.87.87 0 0 1-.32-.386a1.55 1.55 0 0 1-.117-.642v-.522q0-.386.117-.641a.87.87 0 0 1 .32-.387a.87.87 0 0 1 .471-.129q.264 0 .469.13a.86.86 0 0 1 .322.386q.117.255.117.641m.803.519v-.513q0-.565-.205-.972a1.46 1.46 0 0 0-.589-.63q-.381-.22-.917-.22q-.533 0-.92.22a1.44 1.44 0 0 0-.589.627q-.204.406-.205.975v.513q0 .563.205.973q.205.406.59.627q.386.216.92.216q.535 0 .916-.216q.383-.22.59-.627q.204-.41.204-.973M0 11.926v4h1.459q.603 0 .999-.238a1.45 1.45 0 0 0 .595-.689q.196-.45.196-1.084q0-.63-.196-1.075a1.43 1.43 0 0 0-.59-.68q-.395-.234-1.004-.234zm.791.645h.563q.371 0 .609.152a.9.9 0 0 1 .354.454q.118.302.118.753a2.3 2.3 0 0 1-.068.592a1.1 1.1 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.3 1.3 0 0 1-.483.082H.79V12.57Zm7.422.483a1.7 1.7 0 0 0-.103.633v.495q0 .369.103.627a.83.83 0 0 0 .298.393a.85.85 0 0 0 .478.131a.9.9 0 0 0 .401-.088a.7.7 0 0 0 .273-.248a.8.8 0 0 0 .117-.364h.765v.076a1.27 1.27 0 0 1-.226.674q-.205.29-.55.454a1.8 1.8 0 0 1-.786.164q-.54 0-.914-.216a1.4 1.4 0 0 1-.571-.627q-.194-.408-.194-.976v-.498q0-.568.197-.978q.195-.411.571-.633q.378-.223.911-.223q.328 0 .607.097q.28.093.489.272a1.33 1.33 0 0 1 .466.964v.073H9.78a.85.85 0 0 0-.12-.38a.7.7 0 0 0-.273-.261a.8.8 0 0 0-.398-.097a.8.8 0 0 0-.475.138a.87.87 0 0 0-.301.398"/></svg>', bn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zm-6.839 9.688v-.522a1.5 1.5 0 0 0-.117-.641a.86.86 0 0 0-.322-.387a.86.86 0 0 0-.469-.129a.87.87 0 0 0-.471.13a.87.87 0 0 0-.32.386a1.5 1.5 0 0 0-.117.641v.522q0 .384.117.641a.87.87 0 0 0 .32.387a.9.9 0 0 0 .471.126a.9.9 0 0 0 .469-.126a.86.86 0 0 0 .322-.386a1.55 1.55 0 0 0 .117-.642m.803-.516v.513q0 .563-.205.973a1.47 1.47 0 0 1-.589.627q-.381.216-.917.216a1.86 1.86 0 0 1-.92-.216a1.46 1.46 0 0 1-.589-.627a2.15 2.15 0 0 1-.205-.973v-.513q0-.569.205-.975q.205-.411.59-.627q.386-.22.92-.22q.535 0 .916.22q.383.219.59.63q.204.406.204.972M1 15.925v-3.999h1.459q.609 0 1.005.235q.396.233.589.68q.196.445.196 1.074q0 .634-.196 1.084q-.197.451-.595.689q-.396.237-.999.237zm1.354-3.354H1.79v2.707h.563q.277 0 .483-.082a.8.8 0 0 0 .334-.252q.132-.17.196-.422a2.3 2.3 0 0 0 .068-.592q0-.45-.118-.753a.9.9 0 0 0-.354-.454q-.237-.152-.61-.152Zm6.756 1.116q0-.373.103-.633a.87.87 0 0 1 .301-.398a.8.8 0 0 1 .475-.138q.225 0 .398.097a.7.7 0 0 1 .273.26a.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964a1.4 1.4 0 0 0-.49-.272a1.8 1.8 0 0 0-.606-.097q-.534 0-.911.223q-.375.222-.571.633q-.197.41-.197.978v.498q0 .568.194.976q.195.406.571.627q.375.216.914.216q.44 0 .785-.164t.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364a.7.7 0 0 1-.273.248a.9.9 0 0 1-.401.088a.85.85 0 0 1-.478-.131a.83.83 0 0 1-.298-.393a1.7 1.7 0 0 1-.103-.627zm5.092-1.76h.894l-1.275 2.006l1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015l-1.228-1.984h.932l.832 1.439h.035z"/></svg>';
|
|
6970
7018
|
var pn = Object.defineProperty, gn = Object.getOwnPropertyDescriptor, la = (a, e, t, i) => {
|
|
6971
7019
|
for (var s = i > 1 ? void 0 : i ? gn(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
6972
7020
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
@@ -6978,8 +7026,8 @@ const La = {
|
|
|
6978
7026
|
md: dn,
|
|
6979
7027
|
csv: fn,
|
|
6980
7028
|
ppd: hn,
|
|
6981
|
-
doc:
|
|
6982
|
-
docx:
|
|
7029
|
+
doc: un,
|
|
7030
|
+
docx: bn
|
|
6983
7031
|
};
|
|
6984
7032
|
let yt = class extends re {
|
|
6985
7033
|
constructor() {
|
|
@@ -6992,7 +7040,7 @@ let yt = class extends re {
|
|
|
6992
7040
|
return e ? e.toLowerCase() : "txt";
|
|
6993
7041
|
}
|
|
6994
7042
|
render() {
|
|
6995
|
-
return
|
|
7043
|
+
return b`
|
|
6996
7044
|
<cb-external-link url="${this.url}" inverse>
|
|
6997
7045
|
<div class="cb-file">
|
|
6998
7046
|
${this.renderFileIcon()}
|
|
@@ -7002,7 +7050,7 @@ let yt = class extends re {
|
|
|
7002
7050
|
`;
|
|
7003
7051
|
}
|
|
7004
7052
|
renderFileIcon() {
|
|
7005
|
-
return
|
|
7053
|
+
return b`
|
|
7006
7054
|
<cb-icon
|
|
7007
7055
|
class="cb-file-icon"
|
|
7008
7056
|
svg="${La[this.type] || La.txt}"
|
|
@@ -7018,9 +7066,9 @@ la([
|
|
|
7018
7066
|
x({ type: String })
|
|
7019
7067
|
], yt.prototype, "url", 2);
|
|
7020
7068
|
yt = la([
|
|
7021
|
-
|
|
7069
|
+
J("cb-file")
|
|
7022
7070
|
], yt);
|
|
7023
|
-
const mn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/></g></svg>', Ra = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 8a3 3 0 1 0 0-6a3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0a2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1s1-4 6-4s6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z"/></svg>', ai = '<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M5 9v12H1V9zm4 12a2 2 0 0 1-2-2V9c0-.55.22-1.05.59-1.41L14.17 1l1.06 1.06c.27.27.44.64.44 1.05l-.03.32L14.69 8H21a2 2 0 0 1 2 2v2c0 .26-.05.5-.14.73l-3.02 7.05C19.54 20.5 18.83 21 18 21zm0-2h9.03L21 12v-2h-8.79l1.13-5.32L9 9.03z"/></svg>', ii = '<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M19 15V3h4v12zM15 3a2 2 0 0 1 2 2v10c0 .55-.22 1.05-.59 1.41L9.83 23l-1.06-1.06c-.27-.27-.44-.64-.44-1.06l.03-.31l.95-4.57H3a2 2 0 0 1-2-2v-2c0-.26.05-.5.14-.73l3.02-7.05C4.46 3.5 5.17 3 6 3zm0 2H5.97L3 12v2h8.78l-1.13 5.32L15 14.97z"/></svg>', yn =
|
|
7071
|
+
const mn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/></g></svg>', Ra = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 8a3 3 0 1 0 0-6a3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0a2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1s1-4 6-4s6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z"/></svg>', ai = '<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M5 9v12H1V9zm4 12a2 2 0 0 1-2-2V9c0-.55.22-1.05.59-1.41L14.17 1l1.06 1.06c.27.27.44.64.44 1.05l-.03.32L14.69 8H21a2 2 0 0 1 2 2v2c0 .26-.05.5-.14.73l-3.02 7.05C19.54 20.5 18.83 21 18 21zm0-2h9.03L21 12v-2h-8.79l1.13-5.32L9 9.03z"/></svg>', ii = '<svg viewBox="0 0 24 24" width="1.2em" height="1.2em" ><path fill="currentColor" d="M19 15V3h4v12zM15 3a2 2 0 0 1 2 2v10c0 .55-.22 1.05-.59 1.41L9.83 23l-1.06-1.06c-.27-.27-.44-.64-.44-1.06l.03-.31l.95-4.57H3a2 2 0 0 1-2-2v-2c0-.26.05-.5.14-.73l3.02-7.05C4.46 3.5 5.17 3 6 3zm0 2H5.97L3 12v2h8.78l-1.13 5.32L15 14.97z"/></svg>', yn = K`
|
|
7024
7072
|
pre code.hljs {
|
|
7025
7073
|
display: block;
|
|
7026
7074
|
overflow-x: auto;
|
|
@@ -8235,7 +8283,7 @@ const mn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="curr
|
|
|
8235
8283
|
white-space: pre-wrap;
|
|
8236
8284
|
color: var(--n-text-color);
|
|
8237
8285
|
}
|
|
8238
|
-
`, vn =
|
|
8286
|
+
`, vn = K`
|
|
8239
8287
|
${ke}
|
|
8240
8288
|
${yn}
|
|
8241
8289
|
|
|
@@ -8498,7 +8546,7 @@ function wn() {
|
|
|
8498
8546
|
}
|
|
8499
8547
|
async function Qt(a) {
|
|
8500
8548
|
const t = wn().render(a);
|
|
8501
|
-
return
|
|
8549
|
+
return b`${G(t)}`;
|
|
8502
8550
|
}
|
|
8503
8551
|
var xn = Object.defineProperty, kn = Object.getOwnPropertyDescriptor, nt = (a, e, t, i) => {
|
|
8504
8552
|
for (var s = i > 1 ? void 0 : i ? kn(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
@@ -8507,7 +8555,7 @@ var xn = Object.defineProperty, kn = Object.getOwnPropertyDescriptor, nt = (a, e
|
|
|
8507
8555
|
};
|
|
8508
8556
|
let De = class extends re {
|
|
8509
8557
|
constructor() {
|
|
8510
|
-
super(...arguments), this.store = new it(this,
|
|
8558
|
+
super(...arguments), this.store = new it(this, u), this.type = "assistant", this.suppressFeedback = !1, this.lightbox = Qs({
|
|
8511
8559
|
touchNavigation: !0,
|
|
8512
8560
|
loop: !0,
|
|
8513
8561
|
autoplayVideos: !0,
|
|
@@ -8591,11 +8639,11 @@ let De = class extends re {
|
|
|
8591
8639
|
return this.renderInfoMessage(this.message);
|
|
8592
8640
|
if (this.message?.type === "blocks") {
|
|
8593
8641
|
const a = this.message?.data?.blocks ?? [];
|
|
8594
|
-
return
|
|
8642
|
+
return b`<cb-blocks .blocks=${a}></cb-blocks>`;
|
|
8595
8643
|
}
|
|
8596
8644
|
return W(
|
|
8597
8645
|
this.message.data || this.message.isThinking,
|
|
8598
|
-
() =>
|
|
8646
|
+
() => b`
|
|
8599
8647
|
<div class="cb-message-row" part="bot-message">
|
|
8600
8648
|
<!-- message -->
|
|
8601
8649
|
${W(
|
|
@@ -8609,7 +8657,7 @@ let De = class extends re {
|
|
|
8609
8657
|
);
|
|
8610
8658
|
}
|
|
8611
8659
|
renderButtons(a = "left") {
|
|
8612
|
-
return
|
|
8660
|
+
return b`<div class="cb-message__buttons ${a}">
|
|
8613
8661
|
<!-- delete button -->
|
|
8614
8662
|
<sl-button class="cb-message__delete-button" name="trash" @click=${this._removeMessageHandler} circle variant="text" size="small">
|
|
8615
8663
|
<cb-icon svg="${mn}" style="font-size: 1em !important;"></cb-icon>
|
|
@@ -8617,7 +8665,7 @@ let De = class extends re {
|
|
|
8617
8665
|
</div>`;
|
|
8618
8666
|
}
|
|
8619
8667
|
renderInfoMessage(a) {
|
|
8620
|
-
return
|
|
8668
|
+
return b`
|
|
8621
8669
|
<div class="cb-message cb-bot-message-wrapper" part="cb-message">
|
|
8622
8670
|
<div class="avatar info-avatar xsmall" part="info-avatar" style="margin-top:4px;">${this.renderInfoMessageAvatar(a)}</div>
|
|
8623
8671
|
<div
|
|
@@ -8629,7 +8677,7 @@ let De = class extends re {
|
|
|
8629
8677
|
>
|
|
8630
8678
|
<div class="cb-message-text">
|
|
8631
8679
|
${Pt(
|
|
8632
|
-
this._getMessageText(a).then((e) =>
|
|
8680
|
+
this._getMessageText(a).then((e) => b`${e}`)
|
|
8633
8681
|
)}
|
|
8634
8682
|
</div>
|
|
8635
8683
|
</div>
|
|
@@ -8638,10 +8686,10 @@ let De = class extends re {
|
|
|
8638
8686
|
}
|
|
8639
8687
|
renderInfoMessageAvatar(a) {
|
|
8640
8688
|
const e = a.data?.userAvatar || "";
|
|
8641
|
-
return e !== "" ?
|
|
8689
|
+
return e !== "" ? b` <img src="${e}" style="width: 24px;height: 24px;" /> ` : pe`${G(u.setting.infoIconSvg)}`;
|
|
8642
8690
|
}
|
|
8643
8691
|
renderMessage(a, e = "bot-message-content") {
|
|
8644
|
-
return
|
|
8692
|
+
return b`
|
|
8645
8693
|
<div
|
|
8646
8694
|
class="cb-message__content
|
|
8647
8695
|
${a.author}-message
|
|
@@ -8658,48 +8706,48 @@ let De = class extends re {
|
|
|
8658
8706
|
return Qt(Vt(a.data.text));
|
|
8659
8707
|
}
|
|
8660
8708
|
renderMessageContent(a) {
|
|
8661
|
-
return a.isThinking ?
|
|
8709
|
+
return a.isThinking ? b`<cb-thinking></cb-thinking>` : a.isUploading ? b`<cb-uploading .files="${a.data.files || []}"></cb-uploading>` : a.type === "text" ? b`<div class="cb-message-text">
|
|
8662
8710
|
${W(
|
|
8663
8711
|
a.data.userName,
|
|
8664
|
-
() =>
|
|
8712
|
+
() => b`<div class="assistant-message-user-name">${a.data.userName}</div>`,
|
|
8665
8713
|
() => null
|
|
8666
8714
|
)}
|
|
8667
8715
|
${Pt(
|
|
8668
|
-
this._getMessageText(a).then((e) =>
|
|
8716
|
+
this._getMessageText(a).then((e) => b`${e}`)
|
|
8669
8717
|
)}
|
|
8670
|
-
</div>` : a.type === "file" ?
|
|
8718
|
+
</div>` : a.type === "file" ? b`${et(
|
|
8671
8719
|
a.data.files || [],
|
|
8672
8720
|
(e) => e.id,
|
|
8673
|
-
(e) =>
|
|
8674
|
-
)}` : a.type === "upload" ?
|
|
8721
|
+
(e) => b`<cb-file filename="${e.name}" url="${e.url}"></cb-file>`
|
|
8722
|
+
)}` : a.type === "upload" ? b`${et(
|
|
8675
8723
|
a.data.uploadedFiles || [],
|
|
8676
8724
|
(e) => e.name,
|
|
8677
|
-
(e) =>
|
|
8678
|
-
)}` :
|
|
8725
|
+
(e) => b`<div>${e.name}</div>`
|
|
8726
|
+
)}` : b`<div class="cb-message-text">
|
|
8679
8727
|
${Pt(
|
|
8680
|
-
Qt(a.data.text?.toString() || "").then((e) =>
|
|
8728
|
+
Qt(a.data.text?.toString() || "").then((e) => b`${e}`)
|
|
8681
8729
|
)}
|
|
8682
8730
|
</div>`;
|
|
8683
8731
|
}
|
|
8684
8732
|
renderMessageUploads(a) {
|
|
8685
8733
|
if (a.type === "upload")
|
|
8686
|
-
return
|
|
8734
|
+
return b`<div class="user-message-uploads">
|
|
8687
8735
|
${et(
|
|
8688
8736
|
a.data.uploadedFiles || [],
|
|
8689
8737
|
(e) => e.name,
|
|
8690
|
-
(e) => (e?.type || "").startsWith("image/") ?
|
|
8738
|
+
(e) => (e?.type || "").startsWith("image/") ? b`<img src="data:${e.type};base64,${e.base64}" alt="${e.name}" />` : null
|
|
8691
8739
|
)}
|
|
8692
8740
|
</div>`;
|
|
8693
8741
|
}
|
|
8694
8742
|
renderBotMessageAvatar(a) {
|
|
8695
8743
|
if (a.data.userName && a.data.userName !== "") {
|
|
8696
8744
|
const e = a.data?.userAvatar || "";
|
|
8697
|
-
return e !== "" ?
|
|
8745
|
+
return e !== "" ? b` <img src="${e}" style="width: 24px;height: 24px;" /> ` : pe`${G(u.setting.agentIconSvg)}`;
|
|
8698
8746
|
}
|
|
8699
|
-
return a.author === "system" ? pe`${G(
|
|
8747
|
+
return a.author === "system" ? pe`${G(u.setting.systemIconSvg)}` : pe`${G(u.setting.botIconSvg)}`;
|
|
8700
8748
|
}
|
|
8701
8749
|
renderBotMessage(a) {
|
|
8702
|
-
return
|
|
8750
|
+
return b`
|
|
8703
8751
|
<div class="cb-message cb-bot-message-wrapper" part="cb-message">
|
|
8704
8752
|
<div class="avatar assistant-avatar xsmall" part="assistant-avatar" style="margin-top:4px;">${this.renderBotMessageAvatar(a)}</div>
|
|
8705
8753
|
${this.renderMessage(a, "bot-message-content")}
|
|
@@ -8708,7 +8756,7 @@ let De = class extends re {
|
|
|
8708
8756
|
`;
|
|
8709
8757
|
}
|
|
8710
8758
|
renderBotMessageFeedback(a) {
|
|
8711
|
-
return this.suppressFeedback || !
|
|
8759
|
+
return this.suppressFeedback || !u.setting.feedbackEnabled || this.index < u.setting.startFeedbackFromMessage * 2 ? null : b`
|
|
8712
8760
|
<div class="cb-message-feedback-tools" part="feedback-wrapper">
|
|
8713
8761
|
<div class="cb-message-feedback-icon cb-feedback-up" part="feedback-up" @click="${() => this.startFeedback(!0, a)}">${pe`${G(ai)}`}</div>
|
|
8714
8762
|
<div class="cb-message-feedback-icon cb-feedback-down" part="feedback-down" @click="${() => this.startFeedback(!1, a)}">${pe`${G(ii)}`}</div>
|
|
@@ -8716,24 +8764,24 @@ let De = class extends re {
|
|
|
8716
8764
|
`;
|
|
8717
8765
|
}
|
|
8718
8766
|
startFeedback(a, e) {
|
|
8719
|
-
console.log("startFeedback", e),
|
|
8767
|
+
console.log("startFeedback", e), u.collectFeedback(a, e);
|
|
8720
8768
|
}
|
|
8721
8769
|
renderUserMessage(a) {
|
|
8722
|
-
return
|
|
8770
|
+
return b`
|
|
8723
8771
|
<div class="cb-message" part="cb-message" style="display: flex; justify-content: end;align-items: start;">
|
|
8724
8772
|
<!--<sl-avatar class="avatar user-avatar small" label="User">
|
|
8725
8773
|
<cb-icon slot="icon" svg="${Ra}" color="white"></cb-icon>
|
|
8726
8774
|
//appState.appearanceUserMessageAvatarPosition
|
|
8727
8775
|
</sl-avatar>-->
|
|
8728
8776
|
${W(
|
|
8729
|
-
|
|
8730
|
-
() =>
|
|
8731
|
-
<div class="avatar user-avatar" part="user-avatar">${G(
|
|
8777
|
+
u.appearanceUserMessageAvatarPosition === "left",
|
|
8778
|
+
() => b`
|
|
8779
|
+
<div class="avatar user-avatar" part="user-avatar">${G(u.setting.userIconSvg)}</div>
|
|
8732
8780
|
${this.renderMessage(a, "user-message-content")}
|
|
8733
8781
|
`,
|
|
8734
|
-
() =>
|
|
8782
|
+
() => b`
|
|
8735
8783
|
${this.renderMessage(a, "user-message-content")}
|
|
8736
|
-
<div class="avatar user-avatar" part="user-avatar">${G(
|
|
8784
|
+
<div class="avatar user-avatar" part="user-avatar">${G(u.setting.userIconSvg)}</div>
|
|
8737
8785
|
`
|
|
8738
8786
|
)}
|
|
8739
8787
|
</div>
|
|
@@ -8742,21 +8790,21 @@ let De = class extends re {
|
|
|
8742
8790
|
}
|
|
8743
8791
|
// todo ???
|
|
8744
8792
|
renderUserMessageUpload(a) {
|
|
8745
|
-
return
|
|
8793
|
+
return b`
|
|
8746
8794
|
<div class="cb-message" part="cb-message" style="display: flex; justify-content: end;align-items: start;">
|
|
8747
8795
|
<!--<sl-avatar class="avatar user-avatar small" label="User">
|
|
8748
8796
|
<cb-icon slot="icon" svg="${Ra}" color="white"></cb-icon>
|
|
8749
8797
|
//appState.appearanceUserMessageAvatarPosition
|
|
8750
8798
|
</sl-avatar>-->
|
|
8751
8799
|
${W(
|
|
8752
|
-
|
|
8753
|
-
() =>
|
|
8754
|
-
<div class="avatar user-avatar">${G(
|
|
8800
|
+
u.appearanceUserMessageAvatarPosition === "left",
|
|
8801
|
+
() => b`
|
|
8802
|
+
<div class="avatar user-avatar">${G(u.setting.userIconSvg)}</div>
|
|
8755
8803
|
${this.renderMessage(a, "user-message-content")}
|
|
8756
8804
|
`,
|
|
8757
|
-
() =>
|
|
8805
|
+
() => b`
|
|
8758
8806
|
${this.renderMessage(a, "user-message-content")}
|
|
8759
|
-
<div class="avatar user-avatar">${G(
|
|
8807
|
+
<div class="avatar user-avatar">${G(u.setting.userIconSvg)}</div>
|
|
8760
8808
|
`
|
|
8761
8809
|
)}
|
|
8762
8810
|
</div>
|
|
@@ -8777,20 +8825,20 @@ nt([
|
|
|
8777
8825
|
x({ type: Boolean })
|
|
8778
8826
|
], De.prototype, "suppressFeedback", 2);
|
|
8779
8827
|
nt([
|
|
8780
|
-
|
|
8828
|
+
Ua(".code-block-header__copy")
|
|
8781
8829
|
], De.prototype, "copyBtns", 2);
|
|
8782
8830
|
nt([
|
|
8783
|
-
|
|
8831
|
+
Ua("img")
|
|
8784
8832
|
], De.prototype, "glightboxImages", 2);
|
|
8785
8833
|
De = nt([
|
|
8786
|
-
|
|
8834
|
+
J("cb-message")
|
|
8787
8835
|
], De);
|
|
8788
8836
|
var _n = Object.defineProperty, Sn = Object.getOwnPropertyDescriptor, Te = (a, e, t, i) => {
|
|
8789
8837
|
for (var s = i > 1 ? void 0 : i ? Sn(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
8790
8838
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
8791
8839
|
return i && s && _n(e, t, s), s;
|
|
8792
8840
|
};
|
|
8793
|
-
const Oe =
|
|
8841
|
+
const Oe = Ke.noConflict();
|
|
8794
8842
|
Oe.setLevel("info");
|
|
8795
8843
|
let ye = class extends re {
|
|
8796
8844
|
constructor() {
|
|
@@ -8820,13 +8868,13 @@ let ye = class extends re {
|
|
|
8820
8868
|
autoplayVideos: true,
|
|
8821
8869
|
});*/
|
|
8822
8870
|
render() {
|
|
8823
|
-
return
|
|
8871
|
+
return b`
|
|
8824
8872
|
<div id="cb-message-list-container" class="cb-message-list" part="bot-message-list">
|
|
8825
8873
|
${this.renderDisclaimerMessage()}
|
|
8826
8874
|
${et(
|
|
8827
8875
|
this.messages,
|
|
8828
8876
|
(a) => a.id + JSON.stringify(a.data),
|
|
8829
|
-
(a, e) =>
|
|
8877
|
+
(a, e) => b`<cb-message .message="${a}" .index="${e}" exportparts="bot-message, cb-message, bot-message-content, user-message-content, user-avatar, assistant-avatar,feedback-wrapper,feedback-up,feedback-down" ?suppressFeedback=${this.suppressFeedback}></cb-message>`
|
|
8830
8878
|
)}
|
|
8831
8879
|
${this.renderActions()} ${this.renderForm()}
|
|
8832
8880
|
<div id="cb-message-list-bottom-anchor"></div>
|
|
@@ -8834,28 +8882,28 @@ let ye = class extends re {
|
|
|
8834
8882
|
`;
|
|
8835
8883
|
}
|
|
8836
8884
|
renderDisclaimerMessage() {
|
|
8837
|
-
return !
|
|
8838
|
-
<details class="cb-disclaimer-wrapper" part="disclaimer-wrapper" ?open=${
|
|
8885
|
+
return !u.setting.disclaimerMessage || !u.isConversationStart() ? null : b`
|
|
8886
|
+
<details class="cb-disclaimer-wrapper" part="disclaimer-wrapper" ?open=${u.setting.enableShowFullDisclaimerMessage}>
|
|
8839
8887
|
<summary class="cb-disclaimer-message" part="disclaimer-message">
|
|
8840
8888
|
${Pt(
|
|
8841
|
-
Qt(
|
|
8889
|
+
Qt(u.setting.disclaimerMessage).then((a) => b`${a}`)
|
|
8842
8890
|
)}
|
|
8843
8891
|
</summary>
|
|
8844
8892
|
</details>
|
|
8845
8893
|
`;
|
|
8846
8894
|
}
|
|
8847
8895
|
renderForm() {
|
|
8848
|
-
return this.form ?
|
|
8896
|
+
return this.form ? b` <form class="cb-input-form" part="form" @submit="${this.handleFormSubmit.bind(this)}">
|
|
8849
8897
|
<div class="cb-input-form-title" part="form-title">${this.form.title}</div>
|
|
8850
8898
|
${et(
|
|
8851
8899
|
this.form.fields,
|
|
8852
8900
|
(a, e) => e,
|
|
8853
8901
|
(a) => {
|
|
8854
|
-
const e = a?.required || !1, t =
|
|
8902
|
+
const e = a?.required || !1, t = u.getPrefilledFormFieldValue(a.name);
|
|
8855
8903
|
switch (a.type) {
|
|
8856
8904
|
case "name":
|
|
8857
8905
|
case "string":
|
|
8858
|
-
return
|
|
8906
|
+
return b`<sl-input
|
|
8859
8907
|
value="${t}"
|
|
8860
8908
|
part="form-input"
|
|
8861
8909
|
class="cb-input-form-input"
|
|
@@ -8865,7 +8913,7 @@ let ye = class extends re {
|
|
|
8865
8913
|
?required="${e}"
|
|
8866
8914
|
></sl-input>`;
|
|
8867
8915
|
case "email":
|
|
8868
|
-
return
|
|
8916
|
+
return b`<sl-input
|
|
8869
8917
|
part="form-input"
|
|
8870
8918
|
value="${t}"
|
|
8871
8919
|
class="cb-input-form-input"
|
|
@@ -8876,7 +8924,7 @@ let ye = class extends re {
|
|
|
8876
8924
|
?required="${e}"
|
|
8877
8925
|
></sl-input>`;
|
|
8878
8926
|
case "phone":
|
|
8879
|
-
return
|
|
8927
|
+
return b`<sl-input
|
|
8880
8928
|
part="form-input"
|
|
8881
8929
|
value="${t}"
|
|
8882
8930
|
class="cb-input-form-input"
|
|
@@ -8888,20 +8936,20 @@ let ye = class extends re {
|
|
|
8888
8936
|
></sl-input>`;
|
|
8889
8937
|
case "select": {
|
|
8890
8938
|
const i = Array.isArray(a.options) ? a.options : a.options.split(",").map((s) => s.trim());
|
|
8891
|
-
return t || i[0],
|
|
8939
|
+
return t || i[0], b`<div class="cb-form-field">
|
|
8892
8940
|
<label class="cb-form-field-label"
|
|
8893
8941
|
>${a.title}
|
|
8894
8942
|
${W(
|
|
8895
8943
|
e,
|
|
8896
|
-
() =>
|
|
8897
|
-
() =>
|
|
8944
|
+
() => b`*`,
|
|
8945
|
+
() => b``
|
|
8898
8946
|
)}
|
|
8899
8947
|
</label>
|
|
8900
8948
|
<select id="${"cb-form-field" + a.name}" class="cb-form-field-select" part="form-input" name="${a.name}">
|
|
8901
8949
|
${et(
|
|
8902
8950
|
i,
|
|
8903
8951
|
(s, r) => r,
|
|
8904
|
-
(s) =>
|
|
8952
|
+
(s) => b`<option value="${s}">${s}</option>`
|
|
8905
8953
|
)}
|
|
8906
8954
|
</select>
|
|
8907
8955
|
</div>`;
|
|
@@ -8926,7 +8974,7 @@ let ye = class extends re {
|
|
|
8926
8974
|
return;
|
|
8927
8975
|
}
|
|
8928
8976
|
}
|
|
8929
|
-
|
|
8977
|
+
u.submitForm(e).then(() => {
|
|
8930
8978
|
Oe.info("Form submitted", e), this.emit("form:submit", {
|
|
8931
8979
|
detail: {
|
|
8932
8980
|
formData: e
|
|
@@ -8948,7 +8996,7 @@ let ye = class extends re {
|
|
|
8948
8996
|
<br /><br />
|
|
8949
8997
|
*/
|
|
8950
8998
|
renderActions() {
|
|
8951
|
-
return !Array.isArray(this.actions) || this.actions.length <= 0 ? null :
|
|
8999
|
+
return !Array.isArray(this.actions) || this.actions.length <= 0 ? null : b`
|
|
8952
9000
|
<div class="cb-actions-list">
|
|
8953
9001
|
${et(
|
|
8954
9002
|
this.actions,
|
|
@@ -8981,7 +9029,7 @@ let ye = class extends re {
|
|
|
8981
9029
|
switch (Oe.info("Got Calendly Event:", a.data), a.data.event) {
|
|
8982
9030
|
case "calendly.event_scheduled": {
|
|
8983
9031
|
const e = this.activeCalendlyAction;
|
|
8984
|
-
e >= 0 && (
|
|
9032
|
+
e >= 0 && (u.removeAction(e, !0, a.data), u.addSystemMessage("Your meeting has been scheduled!"), this.activeCalendlyAction = -1);
|
|
8985
9033
|
}
|
|
8986
9034
|
}
|
|
8987
9035
|
}
|
|
@@ -9002,7 +9050,7 @@ let ye = class extends re {
|
|
|
9002
9050
|
s.origin === "https://calendly.com" && s.data.event && s.data.event.indexOf("calendly.") !== -1 && this.handleCalendlyEvent(s);
|
|
9003
9051
|
}), this.calendlyInjected = !0;
|
|
9004
9052
|
}
|
|
9005
|
-
return
|
|
9053
|
+
return b`
|
|
9006
9054
|
<div class="cb-actions-list">
|
|
9007
9055
|
<div class="cb-action ripple" @click="${this.invokeCalendlyAction.bind(this, a)}">
|
|
9008
9056
|
<div class="cb-action-icon">
|
|
@@ -9019,7 +9067,7 @@ let ye = class extends re {
|
|
|
9019
9067
|
`;
|
|
9020
9068
|
}
|
|
9021
9069
|
renderLinkAction(a) {
|
|
9022
|
-
return
|
|
9070
|
+
return b`
|
|
9023
9071
|
<div class="cb-actions-list">
|
|
9024
9072
|
<div class="cb-action ripple" @click="${this.invokeLinkAction.bind(this, a)}">
|
|
9025
9073
|
<div class="cb-action-icon">
|
|
@@ -9042,7 +9090,7 @@ let ye = class extends re {
|
|
|
9042
9090
|
const t = document.getElementById("enegelai-bot-hubspot-meeting-container"), i = document.querySelector(".enegelai-bot-hubspot-meeting-widget");
|
|
9043
9091
|
if (t && i) {
|
|
9044
9092
|
const s = a.url + "?embed=true";
|
|
9045
|
-
i.setAttribute("data-src", s), this.activeHubspotMeetingAction = a.internalId, t.style.display = "block", window.hbspt.meetings.create(".enegelai-bot-hubspot-meeting-widget"),
|
|
9093
|
+
i.setAttribute("data-src", s), this.activeHubspotMeetingAction = a.internalId, t.style.display = "block", window.hbspt.meetings.create(".enegelai-bot-hubspot-meeting-widget"), u.updateAction(a, {
|
|
9046
9094
|
triggered: e
|
|
9047
9095
|
});
|
|
9048
9096
|
}
|
|
@@ -9054,7 +9102,7 @@ let ye = class extends re {
|
|
|
9054
9102
|
return;
|
|
9055
9103
|
const t = this.activeHubspotMeetingAction;
|
|
9056
9104
|
if (t >= 0) {
|
|
9057
|
-
|
|
9105
|
+
u.removeAction(t, !0, a.data), u.addSystemMessage("Your meeting has been scheduled!"), this.activeHubspotMeetingAction = -1;
|
|
9058
9106
|
const i = document.getElementById("enegelai-bot-hubspot-meeting-container");
|
|
9059
9107
|
i && (i.style.display = "none");
|
|
9060
9108
|
}
|
|
@@ -9085,7 +9133,7 @@ let ye = class extends re {
|
|
|
9085
9133
|
}
|
|
9086
9134
|
return a?.hubspotMeetingAuto && !("triggered" in a) && setTimeout(() => {
|
|
9087
9135
|
this.invokeHubspotMeetingAction(a);
|
|
9088
|
-
}, 500),
|
|
9136
|
+
}, 500), b`
|
|
9089
9137
|
<div class="cb-actions-list">
|
|
9090
9138
|
<div class="cb-action ripple" @click="${this.invokeHubspotMeetingAction.bind(this, a)}">
|
|
9091
9139
|
<div class="cb-action-icon">
|
|
@@ -9131,9 +9179,9 @@ Te([
|
|
|
9131
9179
|
na({ capture: !1, passive: !0 })
|
|
9132
9180
|
], ye.prototype, "invokeHubspotMeetingAction", 1);
|
|
9133
9181
|
ye = Te([
|
|
9134
|
-
|
|
9182
|
+
J("cb-message-list")
|
|
9135
9183
|
], ye);
|
|
9136
|
-
const Cn =
|
|
9184
|
+
const Cn = K`
|
|
9137
9185
|
${ke}
|
|
9138
9186
|
|
|
9139
9187
|
:host {
|
|
@@ -9183,7 +9231,7 @@ var An = Object.defineProperty, Mn = Object.getOwnPropertyDescriptor, Ie = (a, e
|
|
|
9183
9231
|
};
|
|
9184
9232
|
let ve = class extends re {
|
|
9185
9233
|
constructor() {
|
|
9186
|
-
super(...arguments), this.store = new it(this,
|
|
9234
|
+
super(...arguments), this.store = new it(this, u), this.placeholder = "Type a message...", this.sendButtonLabel = "Send", this.enableFileUpload = !1, this.enableAudio = !1, this.value = "", this.loading = !1, this.disabled = !1, this.currentKey = "";
|
|
9187
9235
|
}
|
|
9188
9236
|
connectedCallback() {
|
|
9189
9237
|
super.connectedCallback(), addEventListener("form:submit", this._formSubmitHandler.bind(this)), addEventListener("c7o:bot:input:setvalue", this._inputSetValueHandler.bind(this));
|
|
@@ -9216,7 +9264,7 @@ let ve = class extends re {
|
|
|
9216
9264
|
});
|
|
9217
9265
|
}
|
|
9218
9266
|
async _sendFileHandler() {
|
|
9219
|
-
const a = await Xa(!1,
|
|
9267
|
+
const a = await Xa(!1, u.setting.fileUploadEnabledExtensions);
|
|
9220
9268
|
this.emit("message:send:file", {
|
|
9221
9269
|
detail: {
|
|
9222
9270
|
files: a
|
|
@@ -9227,11 +9275,11 @@ let ve = class extends re {
|
|
|
9227
9275
|
this.emit("audio:toggle", {});
|
|
9228
9276
|
}
|
|
9229
9277
|
render() {
|
|
9230
|
-
return
|
|
9278
|
+
return b`
|
|
9231
9279
|
${W(
|
|
9232
9280
|
this.loading,
|
|
9233
|
-
() =>
|
|
9234
|
-
() =>
|
|
9281
|
+
() => b`<sl-progress-bar style="--height: 2px;" indeterminate></sl-progress-bar>`,
|
|
9282
|
+
() => b``
|
|
9235
9283
|
)}
|
|
9236
9284
|
<div class="cb-user-input-wrapper" part="user-input-wrapper">
|
|
9237
9285
|
<sl-textarea
|
|
@@ -9253,38 +9301,38 @@ let ve = class extends re {
|
|
|
9253
9301
|
<div class="cb-input-buttons" part="user-input-buttons-wrapper">
|
|
9254
9302
|
<sl-button @click=${this._sendHandler} name="send" label="Send" size="small" class="send-button" variant="text" ?disabled=${this.value.length === 0} ?loading=${this.loading} circle>
|
|
9255
9303
|
${W(
|
|
9256
|
-
|
|
9257
|
-
() =>
|
|
9258
|
-
() =>
|
|
9304
|
+
u.setting.sendIconSvg !== "",
|
|
9305
|
+
() => b`<cb-icon part="user-input-send-icon" svg="${u.setting.sendIconSvg}"></cb-icon>`,
|
|
9306
|
+
() => b`<cb-icon part="user-input-send-icon" svg="${si}"></cb-icon>`
|
|
9259
9307
|
)}
|
|
9260
9308
|
</sl-button>
|
|
9261
9309
|
${W(
|
|
9262
9310
|
this.enableFileUpload,
|
|
9263
|
-
() =>
|
|
9311
|
+
() => b`
|
|
9264
9312
|
<sl-button @click=${this._sendFileHandler} name="paperclip" label="Attachment" size="small" class="paperclip-button" variant="text" circle>
|
|
9265
9313
|
${W(
|
|
9266
|
-
|
|
9267
|
-
() =>
|
|
9268
|
-
() =>
|
|
9314
|
+
u.setting.attachIconSvg !== "",
|
|
9315
|
+
() => b`<cb-icon part="user-input-attach-icon" svg="${u.setting.attachIconSvg}"></cb-icon>`,
|
|
9316
|
+
() => b`<cb-icon part="user-input-attach-icon" svg="${ni}"></cb-icon>`
|
|
9269
9317
|
)}
|
|
9270
9318
|
<!-- select file input -->
|
|
9271
9319
|
<input type="file" id="file" name="file" class="file-input" />
|
|
9272
9320
|
</sl-button>
|
|
9273
9321
|
`,
|
|
9274
|
-
() =>
|
|
9322
|
+
() => b``
|
|
9275
9323
|
)}
|
|
9276
9324
|
${W(
|
|
9277
9325
|
this.enableAudio,
|
|
9278
|
-
() =>
|
|
9326
|
+
() => b`
|
|
9279
9327
|
<sl-button @click=${this._toggleAudioHandler} name="paperclip" label="Audio" size="small" class="audio-button" variant="text" circle>
|
|
9280
9328
|
${W(
|
|
9281
|
-
|
|
9282
|
-
() =>
|
|
9283
|
-
() =>
|
|
9329
|
+
u.webAudioStarted,
|
|
9330
|
+
() => b`<cb-icon svg="${da}"></cb-icon>`,
|
|
9331
|
+
() => b`<cb-icon svg="${ri}"></cb-icon>`
|
|
9284
9332
|
)}
|
|
9285
9333
|
</sl-button>
|
|
9286
9334
|
`,
|
|
9287
|
-
() =>
|
|
9335
|
+
() => b``
|
|
9288
9336
|
)}
|
|
9289
9337
|
</div>
|
|
9290
9338
|
</div>
|
|
@@ -9323,9 +9371,9 @@ Ie([
|
|
|
9323
9371
|
xe("sl-textarea")
|
|
9324
9372
|
], ve.prototype, "inputElement", 2);
|
|
9325
9373
|
ve = Ie([
|
|
9326
|
-
|
|
9374
|
+
J("cb-user-input")
|
|
9327
9375
|
], ve);
|
|
9328
|
-
const Tn =
|
|
9376
|
+
const Tn = K`
|
|
9329
9377
|
${ke}
|
|
9330
9378
|
|
|
9331
9379
|
:host {
|
|
@@ -9391,7 +9439,7 @@ var $n = Object.defineProperty, Pn = Object.getOwnPropertyDescriptor, Ee = (a, e
|
|
|
9391
9439
|
};
|
|
9392
9440
|
let we = class extends re {
|
|
9393
9441
|
constructor() {
|
|
9394
|
-
super(...arguments), this.store = new it(this,
|
|
9442
|
+
super(...arguments), this.store = new it(this, u), this.placeholder = "Type a message...", this.sendButtonLabel = "Send", this.enableFileUpload = !1, this.enableAudio = !1, this.value = "", this.loading = !1, this.disabled = !1, this.currentKey = "";
|
|
9395
9443
|
}
|
|
9396
9444
|
connectedCallback() {
|
|
9397
9445
|
super.connectedCallback(), addEventListener("form:submit", this._formSubmitHandler.bind(this)), addEventListener("c7o:bot:input:setvalue", this._inputSetValueHandler.bind(this));
|
|
@@ -9412,7 +9460,7 @@ let we = class extends re {
|
|
|
9412
9460
|
_ctrlHandler() {
|
|
9413
9461
|
if (this.value && this.value !== "")
|
|
9414
9462
|
return this._sendHandler();
|
|
9415
|
-
if (!
|
|
9463
|
+
if (!u.webAudioStarted)
|
|
9416
9464
|
return this._toggleAudioHandler();
|
|
9417
9465
|
}
|
|
9418
9466
|
_sendHandler() {
|
|
@@ -9430,7 +9478,7 @@ let we = class extends re {
|
|
|
9430
9478
|
});
|
|
9431
9479
|
}
|
|
9432
9480
|
async _sendFileHandler() {
|
|
9433
|
-
const a = await Xa(!1,
|
|
9481
|
+
const a = await Xa(!1, u.setting.fileUploadEnabledExtensions);
|
|
9434
9482
|
this.emit("message:send:file", {
|
|
9435
9483
|
detail: {
|
|
9436
9484
|
files: a
|
|
@@ -9459,31 +9507,31 @@ let we = class extends re {
|
|
|
9459
9507
|
}
|
|
9460
9508
|
}
|
|
9461
9509
|
async _toggleAudioHandler() {
|
|
9462
|
-
await
|
|
9510
|
+
await u.toggleAudio();
|
|
9463
9511
|
}
|
|
9464
9512
|
getCtrlIconSvg() {
|
|
9465
|
-
return this.value && this.value !== "" ||
|
|
9513
|
+
return this.value && this.value !== "" || u.webAudioStarted ? Oa : En;
|
|
9466
9514
|
}
|
|
9467
9515
|
getCtrlClass() {
|
|
9468
|
-
return this.value && this.value !== "" ? "" :
|
|
9516
|
+
return this.value && this.value !== "" ? "" : u.webAudioStarted || u.mediaStartAudioRequested ? "disabled" : "";
|
|
9469
9517
|
}
|
|
9470
9518
|
render() {
|
|
9471
|
-
return
|
|
9519
|
+
return b`
|
|
9472
9520
|
${W(
|
|
9473
9521
|
this.loading,
|
|
9474
|
-
() =>
|
|
9475
|
-
() =>
|
|
9522
|
+
() => b`<sl-progress-bar style="--height: 2px;" indeterminate></sl-progress-bar>`,
|
|
9523
|
+
() => b``
|
|
9476
9524
|
)}
|
|
9477
9525
|
<div class="cb-user-input-mm-wrapper" part="user-input-wrapper">
|
|
9478
9526
|
<div class="cb-user-input-mm" part="user-input-inner">
|
|
9479
9527
|
${W(
|
|
9480
9528
|
this.enableFileUpload,
|
|
9481
|
-
() =>
|
|
9529
|
+
() => b`
|
|
9482
9530
|
<button type="button" class="circle-btn" part="upload-button" title="Upload" @click=${this._sendFileHandler}>
|
|
9483
9531
|
${G(In)}
|
|
9484
9532
|
</button>
|
|
9485
9533
|
`,
|
|
9486
|
-
() =>
|
|
9534
|
+
() => b``
|
|
9487
9535
|
)}
|
|
9488
9536
|
<sl-textarea
|
|
9489
9537
|
part="user-input"
|
|
@@ -9507,11 +9555,11 @@ let we = class extends re {
|
|
|
9507
9555
|
`;
|
|
9508
9556
|
}
|
|
9509
9557
|
renderOld() {
|
|
9510
|
-
return
|
|
9558
|
+
return b`
|
|
9511
9559
|
${W(
|
|
9512
9560
|
this.loading,
|
|
9513
|
-
() =>
|
|
9514
|
-
() =>
|
|
9561
|
+
() => b`<sl-progress-bar style="--height: 2px;" indeterminate></sl-progress-bar>`,
|
|
9562
|
+
() => b``
|
|
9515
9563
|
)}
|
|
9516
9564
|
<div class="cb-user-input-mm-wrapper" part="user-input-wrapper">
|
|
9517
9565
|
<sl-textarea
|
|
@@ -9533,38 +9581,38 @@ let we = class extends re {
|
|
|
9533
9581
|
<div class="cb-input-buttons" part="user-input-buttons-wrapper">
|
|
9534
9582
|
<sl-button @click=${this._sendHandler} name="send" label="Send" size="small" class="send-button" variant="text" ?disabled=${this.value.length === 0} ?loading=${this.loading} circle>
|
|
9535
9583
|
${W(
|
|
9536
|
-
|
|
9537
|
-
() =>
|
|
9538
|
-
() =>
|
|
9584
|
+
u.setting.sendIconSvg !== "",
|
|
9585
|
+
() => b`<cb-icon part="user-input-send-icon" svg="${u.setting.sendIconSvg}"></cb-icon>`,
|
|
9586
|
+
() => b`<cb-icon part="user-input-send-icon" svg="${si}"></cb-icon>`
|
|
9539
9587
|
)}
|
|
9540
9588
|
</sl-button>
|
|
9541
9589
|
${W(
|
|
9542
9590
|
this.enableFileUpload,
|
|
9543
|
-
() =>
|
|
9591
|
+
() => b`
|
|
9544
9592
|
<sl-button @click=${this._sendFileHandler} name="paperclip" label="Attachment" size="small" class="paperclip-button" variant="text" circle>
|
|
9545
9593
|
${W(
|
|
9546
|
-
|
|
9547
|
-
() =>
|
|
9548
|
-
() =>
|
|
9594
|
+
u.setting.attachIconSvg !== "",
|
|
9595
|
+
() => b`<cb-icon part="user-input-attach-icon" svg="${u.setting.attachIconSvg}"></cb-icon>`,
|
|
9596
|
+
() => b`<cb-icon part="user-input-attach-icon" svg="${ni}"></cb-icon>`
|
|
9549
9597
|
)}
|
|
9550
9598
|
<!-- select file input -->
|
|
9551
9599
|
<input type="file" id="file" name="file" class="file-input" />
|
|
9552
9600
|
</sl-button>
|
|
9553
9601
|
`,
|
|
9554
|
-
() =>
|
|
9602
|
+
() => b``
|
|
9555
9603
|
)}
|
|
9556
9604
|
${W(
|
|
9557
9605
|
this.enableAudio,
|
|
9558
|
-
() =>
|
|
9606
|
+
() => b`
|
|
9559
9607
|
<sl-button @click=${this._toggleAudioHandler} name="paperclip" label="Audio" size="small" class="audio-button" variant="text" circle>
|
|
9560
9608
|
${W(
|
|
9561
|
-
|
|
9562
|
-
() =>
|
|
9563
|
-
() =>
|
|
9609
|
+
u.webAudioStarted,
|
|
9610
|
+
() => b`<cb-icon svg="${da}"></cb-icon>`,
|
|
9611
|
+
() => b`<cb-icon svg="${ri}"></cb-icon>`
|
|
9564
9612
|
)}
|
|
9565
9613
|
</sl-button>
|
|
9566
9614
|
`,
|
|
9567
|
-
() =>
|
|
9615
|
+
() => b``
|
|
9568
9616
|
)}
|
|
9569
9617
|
</div>
|
|
9570
9618
|
</div>
|
|
@@ -9603,9 +9651,9 @@ Ee([
|
|
|
9603
9651
|
xe("sl-textarea")
|
|
9604
9652
|
], we.prototype, "inputElement", 2);
|
|
9605
9653
|
we = Ee([
|
|
9606
|
-
|
|
9654
|
+
J("cb-user-input-mm")
|
|
9607
9655
|
], we);
|
|
9608
|
-
const oi = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/></svg>', Ln =
|
|
9656
|
+
const oi = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/></svg>', Ln = K`
|
|
9609
9657
|
${ke}
|
|
9610
9658
|
|
|
9611
9659
|
sl-dialog::part(base) {
|
|
@@ -9640,7 +9688,7 @@ const oi = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="c
|
|
|
9640
9688
|
gap: 8px;
|
|
9641
9689
|
}
|
|
9642
9690
|
`;
|
|
9643
|
-
var Rn = Object.defineProperty, zn = Object.getOwnPropertyDescriptor,
|
|
9691
|
+
var Rn = Object.defineProperty, zn = Object.getOwnPropertyDescriptor, Ut = (a, e, t, i) => {
|
|
9644
9692
|
for (var s = i > 1 ? void 0 : i ? zn(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
9645
9693
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
9646
9694
|
return i && s && Rn(e, t, s), s;
|
|
@@ -9653,7 +9701,7 @@ let ct = class extends re {
|
|
|
9653
9701
|
this.emit("cancel");
|
|
9654
9702
|
}
|
|
9655
9703
|
render() {
|
|
9656
|
-
return
|
|
9704
|
+
return b` <sl-dialog
|
|
9657
9705
|
label="Setting"
|
|
9658
9706
|
class="cb-dialog"
|
|
9659
9707
|
style="sl-dialog::part(base) { z-index: ${this.zindex}; }"
|
|
@@ -9663,7 +9711,7 @@ let ct = class extends re {
|
|
|
9663
9711
|
>
|
|
9664
9712
|
<header class="cb-header">
|
|
9665
9713
|
<div class="cb-header__left">
|
|
9666
|
-
${this.label ?
|
|
9714
|
+
${this.label ? b`<span class="title">${this.label}</span>` : ""}
|
|
9667
9715
|
</div>
|
|
9668
9716
|
<sl-button
|
|
9669
9717
|
@click=${this._settingCancelHandler}
|
|
@@ -9690,17 +9738,17 @@ let ct = class extends re {
|
|
|
9690
9738
|
}
|
|
9691
9739
|
};
|
|
9692
9740
|
ct.styles = Ln;
|
|
9693
|
-
|
|
9741
|
+
Ut([
|
|
9694
9742
|
x({ type: Boolean })
|
|
9695
9743
|
], ct.prototype, "open", 2);
|
|
9696
|
-
|
|
9744
|
+
Ut([
|
|
9697
9745
|
x({ type: String, attribute: "label" })
|
|
9698
9746
|
], ct.prototype, "label", 2);
|
|
9699
|
-
|
|
9747
|
+
Ut([
|
|
9700
9748
|
x({ type: Number })
|
|
9701
9749
|
], ct.prototype, "zindex", 2);
|
|
9702
|
-
ct =
|
|
9703
|
-
|
|
9750
|
+
ct = Ut([
|
|
9751
|
+
J("cb-dialog")
|
|
9704
9752
|
], ct);
|
|
9705
9753
|
var On = Object.defineProperty, Bn = Object.getOwnPropertyDescriptor, ci = (a, e, t, i) => {
|
|
9706
9754
|
for (var s = i > 1 ? void 0 : i ? Bn(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
@@ -9712,7 +9760,7 @@ let Dt = class extends re {
|
|
|
9712
9760
|
super(...arguments), this.open = !1;
|
|
9713
9761
|
}
|
|
9714
9762
|
render() {
|
|
9715
|
-
return
|
|
9763
|
+
return b` <cb-dialog
|
|
9716
9764
|
label="Confirm"
|
|
9717
9765
|
class="cb-clear-message-dialog"
|
|
9718
9766
|
?open=${this.open}
|
|
@@ -9741,7 +9789,7 @@ let Dt = class extends re {
|
|
|
9741
9789
|
this.emit("cancel");
|
|
9742
9790
|
}
|
|
9743
9791
|
};
|
|
9744
|
-
Dt.styles =
|
|
9792
|
+
Dt.styles = K`
|
|
9745
9793
|
.cb-clear-message-dialog {
|
|
9746
9794
|
}
|
|
9747
9795
|
|
|
@@ -9753,9 +9801,9 @@ ci([
|
|
|
9753
9801
|
x({ type: Boolean })
|
|
9754
9802
|
], Dt.prototype, "open", 2);
|
|
9755
9803
|
Dt = ci([
|
|
9756
|
-
|
|
9804
|
+
J("cb-clear-message-dialog")
|
|
9757
9805
|
], Dt);
|
|
9758
|
-
const qn =
|
|
9806
|
+
const qn = K`
|
|
9759
9807
|
:host {
|
|
9760
9808
|
// width: 380px;
|
|
9761
9809
|
|
|
@@ -9825,7 +9873,7 @@ let Xe = class extends re {
|
|
|
9825
9873
|
super(...arguments), this.open = !1, this.clearMessageDialogOpen = !1, this.customRequest = !1;
|
|
9826
9874
|
}
|
|
9827
9875
|
render() {
|
|
9828
|
-
return this.customRequest = this.setting.customRequest,
|
|
9876
|
+
return this.customRequest = this.setting.customRequest, b`
|
|
9829
9877
|
<cb-dialog label="Setting" class="cb-dialog" ?open=${this.open} ?no-header=${!0} @cancel=${this._settingCancelHandler}>
|
|
9830
9878
|
<form>
|
|
9831
9879
|
<div class="form-item">
|
|
@@ -9889,7 +9937,7 @@ let Xe = class extends re {
|
|
|
9889
9937
|
`;
|
|
9890
9938
|
}
|
|
9891
9939
|
renderInternalServices() {
|
|
9892
|
-
return
|
|
9940
|
+
return b`
|
|
9893
9941
|
<div class="form-item">
|
|
9894
9942
|
<label class="label">Service</label>
|
|
9895
9943
|
<sl-radio-group name="openai" value="openai" size="small">
|
|
@@ -9956,9 +10004,9 @@ dt([
|
|
|
9956
10004
|
x({ type: Boolean })
|
|
9957
10005
|
], Xe.prototype, "customRequest", 2);
|
|
9958
10006
|
Xe = dt([
|
|
9959
|
-
|
|
10007
|
+
J("cb-setting")
|
|
9960
10008
|
], Xe);
|
|
9961
|
-
const jn =
|
|
10009
|
+
const jn = K`
|
|
9962
10010
|
${ke}
|
|
9963
10011
|
:host {
|
|
9964
10012
|
--primary-color: var(--sl-color-primary-600);
|
|
@@ -10079,7 +10127,7 @@ var Hn = Object.defineProperty, Vn = Object.getOwnPropertyDescriptor, li = (a, e
|
|
|
10079
10127
|
};
|
|
10080
10128
|
let Ft = class extends re {
|
|
10081
10129
|
constructor() {
|
|
10082
|
-
super(...arguments), this.store = new it(this,
|
|
10130
|
+
super(...arguments), this.store = new it(this, u), this.open = !1;
|
|
10083
10131
|
}
|
|
10084
10132
|
// handler click
|
|
10085
10133
|
_clickHandler() {
|
|
@@ -10091,7 +10139,7 @@ let Ft = class extends re {
|
|
|
10091
10139
|
}), this.open = a;
|
|
10092
10140
|
}
|
|
10093
10141
|
_engageClickHandler(a) {
|
|
10094
|
-
console.log("engage close clicked!"),
|
|
10142
|
+
console.log("engage close clicked!"), u.suppressEngagePopup(), a.stopPropagation();
|
|
10095
10143
|
}
|
|
10096
10144
|
/*
|
|
10097
10145
|
${when(
|
|
@@ -10102,28 +10150,28 @@ let Ft = class extends re {
|
|
|
10102
10150
|
*/
|
|
10103
10151
|
getPopupPlacement() {
|
|
10104
10152
|
let a = "top-end";
|
|
10105
|
-
return a =
|
|
10153
|
+
return a = u.appearanceAnchorPopupPosition, a;
|
|
10106
10154
|
}
|
|
10107
10155
|
getBadgeVariant() {
|
|
10108
10156
|
let a = "danger";
|
|
10109
|
-
return a =
|
|
10157
|
+
return a = u.appearanceAnchorBadgeVariant, a;
|
|
10110
10158
|
}
|
|
10111
10159
|
renderPopupLogo() {
|
|
10112
|
-
return
|
|
10160
|
+
return u.setting.popupLogoUrl !== "" ? b`<img class="cb-engage-popup-img" src="${u.setting.popupLogoUrl}" />` : u.setting.popupLogoSvg !== "" ? b`<div class="cb-engage-popup-logo">${pe`${G(u.setting.popupLogoSvg)}`}</div>` : u.setting.logoUrl !== "" ? b`<img class="cb-engage-popup-img" src="${u.setting.logoUrl}" />` : u.setting.logoSvg !== "" ? b`<div class="cb-engage-popup-logo">${pe`${G(u.setting.logoSvg)}`}</div>` : null;
|
|
10113
10161
|
}
|
|
10114
10162
|
render() {
|
|
10115
|
-
return
|
|
10163
|
+
return b`
|
|
10116
10164
|
<div class="cb-anchor ${this.open ? "open" : ""}" part="anchor" @click=${this._clickHandler.bind(this)}>
|
|
10117
|
-
<sl-popup placement="${this.getPopupPlacement()}" distance="16" ?active="${
|
|
10165
|
+
<sl-popup placement="${this.getPopupPlacement()}" distance="16" ?active="${u.engage && !u.open}">
|
|
10118
10166
|
<sl-button slot="anchor" label="Start" size="large" variant="primary" class="anchor-button" circle>
|
|
10119
10167
|
${W(
|
|
10120
10168
|
this.open,
|
|
10121
|
-
() =>
|
|
10122
|
-
() =>
|
|
10169
|
+
() => b`<div class="cb-anchor-icon" part="anchor-icon">${pe`${G(u.setting.anchorCloseSvg)}`}</div>`,
|
|
10170
|
+
() => b`<div class="cb-anchor-icon" part="anchor-icon">${pe`${G(u.setting.anchorOpenSvg)}`}</div>`
|
|
10123
10171
|
)}
|
|
10124
10172
|
${W(
|
|
10125
|
-
!this.open &&
|
|
10126
|
-
() =>
|
|
10173
|
+
!this.open && u.unreadMessages > 0,
|
|
10174
|
+
() => b`<sl-badge part="anchor-badge" class="cb-anchor-badge" variant="${this.getBadgeVariant()}" pill>${u.unreadMessages}</sl-badge>`,
|
|
10127
10175
|
() => null
|
|
10128
10176
|
)}
|
|
10129
10177
|
</sl-button>
|
|
@@ -10131,7 +10179,7 @@ let Ft = class extends re {
|
|
|
10131
10179
|
<div class="cb-engage-popup-close" @click=${this._engageClickHandler.bind(this)}>${pe`${G(oi)}`}</div>
|
|
10132
10180
|
<div class="cb-engage-popup-content">
|
|
10133
10181
|
${this.renderPopupLogo()}
|
|
10134
|
-
<div>${
|
|
10182
|
+
<div>${u.setting.engageMessage}</div>
|
|
10135
10183
|
</div>
|
|
10136
10184
|
</div>
|
|
10137
10185
|
</sl-popup>
|
|
@@ -10144,11 +10192,11 @@ li([
|
|
|
10144
10192
|
x({ type: Boolean })
|
|
10145
10193
|
], Ft.prototype, "open", 2);
|
|
10146
10194
|
Ft = li([
|
|
10147
|
-
|
|
10195
|
+
J("cb-anchor")
|
|
10148
10196
|
], Ft);
|
|
10149
|
-
const
|
|
10197
|
+
const Un = K`
|
|
10150
10198
|
${ke}
|
|
10151
|
-
`, Ba = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M4.54.146A.5.5 0 0 1 4.893 0h6.214a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353zM5.1 1L1 5.1v5.8L5.1 15h5.8l4.1-4.1V5.1L10.9 1z"/><path d="M7.002 11a1 1 0 1 1 2 0a1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/></g></svg>',
|
|
10199
|
+
`, Ba = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M4.54.146A.5.5 0 0 1 4.893 0h6.214a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353zM5.1 1L1 5.1v5.8L5.1 15h5.8l4.1-4.1V5.1L10.9 1z"/><path d="M7.002 11a1 1 0 1 1 2 0a1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/></g></svg>', Nn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016a.15.15 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.2.2 0 0 1-.054.06a.1.1 0 0 1-.066.017H1.146a.1.1 0 0 1-.066-.017a.2.2 0 0 1-.054-.06a.18.18 0 0 1 .002-.183L7.884 2.073a.15.15 0 0 1 .054-.057m1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767z"/><path d="M7.002 12a1 1 0 1 1 2 0a1 1 0 0 1-2 0M7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/></g></svg>', Wn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764a.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0a5.5 5.5 0 1 1-11 0"/><path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293L5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0z"/></g></svg>', Gn = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/><path d="m8.93 6.588l-2.29.287l-.082.38l.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319c.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246c-.275 0-.375-.193-.304-.533zM9 4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0"/></g></svg>';
|
|
10152
10200
|
var Xn = Object.defineProperty, Yn = Object.getOwnPropertyDescriptor, di = (a, e, t, i) => {
|
|
10153
10201
|
for (var s = i > 1 ? void 0 : i ? Yn(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
10154
10202
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
@@ -10165,7 +10213,7 @@ const qa = {
|
|
|
10165
10213
|
},
|
|
10166
10214
|
warning: {
|
|
10167
10215
|
variant: "warning",
|
|
10168
|
-
icon:
|
|
10216
|
+
icon: Nn
|
|
10169
10217
|
},
|
|
10170
10218
|
success: {
|
|
10171
10219
|
variant: "success",
|
|
@@ -10182,7 +10230,7 @@ let jt = class extends re {
|
|
|
10182
10230
|
}
|
|
10183
10231
|
render() {
|
|
10184
10232
|
const { variant: a, icon: e } = qa[this.status] || qa.info;
|
|
10185
|
-
return
|
|
10233
|
+
return b`<cb-icon svg=${e} color="${a}"></cb-icon>`;
|
|
10186
10234
|
}
|
|
10187
10235
|
};
|
|
10188
10236
|
jt.styles = Ga;
|
|
@@ -10190,16 +10238,16 @@ di([
|
|
|
10190
10238
|
x({ type: String })
|
|
10191
10239
|
], jt.prototype, "status", 2);
|
|
10192
10240
|
jt = di([
|
|
10193
|
-
|
|
10241
|
+
J("cb-status-icon")
|
|
10194
10242
|
], jt);
|
|
10195
|
-
var
|
|
10196
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
10243
|
+
var Kn = Object.getOwnPropertyDescriptor, Jn = (a, e, t, i) => {
|
|
10244
|
+
for (var s = i > 1 ? void 0 : i ? Kn(e, t) : e, r = a.length - 1, o; r >= 0; r--)
|
|
10197
10245
|
(o = a[r]) && (s = o(s) || s);
|
|
10198
10246
|
return s;
|
|
10199
10247
|
};
|
|
10200
10248
|
let ea = class extends re {
|
|
10201
10249
|
render() {
|
|
10202
|
-
return
|
|
10250
|
+
return b` <sl-alert variant="danger" open>
|
|
10203
10251
|
<cb-status-icon status="error" slot="icon"></cb-status-icon>
|
|
10204
10252
|
Please config openai api key in the settings.
|
|
10205
10253
|
<span
|
|
@@ -10213,11 +10261,11 @@ let ea = class extends re {
|
|
|
10213
10261
|
this.emit("setting:show");
|
|
10214
10262
|
}
|
|
10215
10263
|
};
|
|
10216
|
-
ea.styles =
|
|
10217
|
-
ea =
|
|
10218
|
-
|
|
10264
|
+
ea.styles = Un;
|
|
10265
|
+
ea = Jn([
|
|
10266
|
+
J("cb-auth-alert")
|
|
10219
10267
|
], ea);
|
|
10220
|
-
const Zn =
|
|
10268
|
+
const Zn = K`
|
|
10221
10269
|
sl-dialog::part(base) {
|
|
10222
10270
|
z-index: 1000;
|
|
10223
10271
|
}
|
|
@@ -10306,10 +10354,10 @@ var Qn = Object.defineProperty, er = Object.getOwnPropertyDescriptor, ft = (a, e
|
|
|
10306
10354
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
10307
10355
|
return i && s && Qn(e, t, s), s;
|
|
10308
10356
|
};
|
|
10309
|
-
const Da =
|
|
10357
|
+
const Da = Ke.noConflict(), tr = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-star-fill" viewBox="0 0 16 16"><path d="M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z"/></svg>';
|
|
10310
10358
|
let Ye = class extends re {
|
|
10311
10359
|
constructor() {
|
|
10312
|
-
super(...arguments), this.store = new it(this,
|
|
10360
|
+
super(...arguments), this.store = new it(this, u), this.zindex = 100;
|
|
10313
10361
|
}
|
|
10314
10362
|
connectedCallback() {
|
|
10315
10363
|
super.connectedCallback(), Da.info("connectedCallback");
|
|
@@ -10322,39 +10370,39 @@ let Ye = class extends re {
|
|
|
10322
10370
|
Da.info(`FEEDBACK: stateEvent: ${t}`, e);
|
|
10323
10371
|
}
|
|
10324
10372
|
_cancelHandler() {
|
|
10325
|
-
|
|
10373
|
+
u.feedback && (console.log("Feedback dialog cancelled"), u.feedback = !1);
|
|
10326
10374
|
}
|
|
10327
10375
|
// todo render empty if feedback is disabled
|
|
10328
10376
|
render() {
|
|
10329
|
-
return
|
|
10377
|
+
return b` <sl-dialog ?no-header=${!0} ?open=${u.feedback} @sl-hide=${this._cancelHandler} class="cb-feedback-dialog">
|
|
10330
10378
|
<div style="">
|
|
10331
10379
|
<h2>Please share your feedback</h2>
|
|
10332
10380
|
<div class="cb-feedback-messages-wrapper">
|
|
10333
|
-
<cb-message-list style="width: 50%;" .messages=${
|
|
10381
|
+
<cb-message-list style="width: 50%;" .messages=${u.feedbackMessages} ?suppressFeedback=${!0}></cb-message-list>
|
|
10334
10382
|
</div>
|
|
10335
10383
|
<div class="cb-feedback-rating-label">Please rate this answer</div>
|
|
10336
10384
|
<div class="cb-feedback-rating-wrapper">
|
|
10337
10385
|
<div
|
|
10338
10386
|
class="cb-feedback-rating-icon"
|
|
10339
10387
|
@click="${() => {
|
|
10340
|
-
|
|
10388
|
+
u.feedbackScore = 0;
|
|
10341
10389
|
}}"
|
|
10342
10390
|
>
|
|
10343
10391
|
${pe`${G(ii)}`}
|
|
10344
10392
|
</div>
|
|
10345
|
-
<sl-rating id="cb-feedback-rating-el" class="cb-feedback-rating" @sl-change="${this._ratingChangeHandler}" label="Rating" precision="1" .value=${
|
|
10393
|
+
<sl-rating id="cb-feedback-rating-el" class="cb-feedback-rating" @sl-change="${this._ratingChangeHandler}" label="Rating" precision="1" .value=${u.feedbackScore}></sl-rating>
|
|
10346
10394
|
<div
|
|
10347
10395
|
class="cb-feedback-rating-icon"
|
|
10348
10396
|
@click="${() => {
|
|
10349
|
-
|
|
10397
|
+
u.feedbackScore = 5;
|
|
10350
10398
|
}}"
|
|
10351
10399
|
>
|
|
10352
10400
|
${pe`${G(ai)}`}
|
|
10353
10401
|
</div>
|
|
10354
10402
|
</div>
|
|
10355
10403
|
<div style="display: flex">
|
|
10356
|
-
<sl-input style="margin-bottom: 4px;width:50%" id="cb-feedback-name-el" placeholder="Your name" value="${
|
|
10357
|
-
<sl-input type="email" style="margin-bottom: 4px;margin-left: 1px;width:50%" id="cb-feedback-email-el" placeholder="Your email" value="${
|
|
10404
|
+
<sl-input style="margin-bottom: 4px;width:50%" id="cb-feedback-name-el" placeholder="Your name" value="${u.feedbackName}" size="medium"></sl-input>
|
|
10405
|
+
<sl-input type="email" style="margin-bottom: 4px;margin-left: 1px;width:50%" id="cb-feedback-email-el" placeholder="Your email" value="${u.feedbackEmail}" size="medium"></sl-input>
|
|
10358
10406
|
</div>
|
|
10359
10407
|
<sl-textarea id="cb-feedback-comments-el" placeholder="Your comments" size="medium" value="" rows="3"></sl-textarea>
|
|
10360
10408
|
</div>
|
|
@@ -10363,11 +10411,11 @@ let Ye = class extends re {
|
|
|
10363
10411
|
</sl-dialog>`;
|
|
10364
10412
|
}
|
|
10365
10413
|
_ratingChangeHandler() {
|
|
10366
|
-
|
|
10414
|
+
u.feedbackScore = this._rating.value;
|
|
10367
10415
|
}
|
|
10368
10416
|
async _submitHandler() {
|
|
10369
10417
|
const a = this._name?.value || "", e = this._email?.value || "", t = Vt(this._comments?.value || "");
|
|
10370
|
-
this._comments.value = "", await
|
|
10418
|
+
this._comments.value = "", await u.submitFeedback(a, e, t);
|
|
10371
10419
|
}
|
|
10372
10420
|
};
|
|
10373
10421
|
Ye.styles = Zn;
|
|
@@ -10387,9 +10435,9 @@ ft([
|
|
|
10387
10435
|
xe("#cb-feedback-email-el")
|
|
10388
10436
|
], Ye.prototype, "_email", 2);
|
|
10389
10437
|
Ye = ft([
|
|
10390
|
-
|
|
10438
|
+
J("cb-dialog-feedback")
|
|
10391
10439
|
], Ye);
|
|
10392
|
-
const ar =
|
|
10440
|
+
const ar = K`
|
|
10393
10441
|
${ke}
|
|
10394
10442
|
:host {
|
|
10395
10443
|
display: block;
|
|
@@ -10937,11 +10985,11 @@ var or = Object.getOwnPropertyDescriptor, cr = (a, e, t, i) => {
|
|
|
10937
10985
|
(o = a[r]) && (s = o(s) || s);
|
|
10938
10986
|
return s;
|
|
10939
10987
|
};
|
|
10940
|
-
const
|
|
10941
|
-
|
|
10988
|
+
const ut = Ke.noConflict();
|
|
10989
|
+
ut.setLevel("info");
|
|
10942
10990
|
let ta = class extends re {
|
|
10943
10991
|
constructor() {
|
|
10944
|
-
super(...arguments), this.store = new it(this,
|
|
10992
|
+
super(...arguments), this.store = new it(this, u), this.unsubscribeTypingActive = u.subscribe(
|
|
10945
10993
|
this._handleTypingActiveChanged.bind(this),
|
|
10946
10994
|
["typingActive"]
|
|
10947
10995
|
), this.volumeVisualizerRef = ji(), this.volumeVisualizerInitialized = !1;
|
|
@@ -10968,16 +11016,16 @@ let ta = class extends re {
|
|
|
10968
11016
|
</header>`;
|
|
10969
11017
|
}*/
|
|
10970
11018
|
render() {
|
|
10971
|
-
return
|
|
11019
|
+
return u.webAudioStarted ? b`<div class="cb-audio-controls-wrapper" part="audio-controls-wrapper">
|
|
10972
11020
|
<div class="cb-audio-controls" part="audio-controls" @click=${this._toggleMute}>
|
|
10973
11021
|
${W(
|
|
10974
11022
|
!0,
|
|
10975
|
-
() =>
|
|
10976
|
-
<button type="button" part="${
|
|
11023
|
+
() => b`
|
|
11024
|
+
<button type="button" part="${u.webAudioMuted ? "audio-unmute-button" : "audio-mute-button"}" class="circle-btn ${u.webAudioMuted ? "danger" : "clear"}" title="${u.webAudioMuted ? "Unmute" : "Mute"}" @click=${this._toggleMute}>
|
|
10977
11025
|
${G(rr)}
|
|
10978
11026
|
</button>
|
|
10979
11027
|
`,
|
|
10980
|
-
() =>
|
|
11028
|
+
() => b``
|
|
10981
11029
|
)}
|
|
10982
11030
|
<div class="cb-audio-controls-viz" part="audio-controls-viz">
|
|
10983
11031
|
${this.renderVisualizer()}
|
|
@@ -10989,21 +11037,21 @@ let ta = class extends re {
|
|
|
10989
11037
|
</div>` : null;
|
|
10990
11038
|
}
|
|
10991
11039
|
renderVisualizer() {
|
|
10992
|
-
switch (
|
|
11040
|
+
switch (u.setting.botAdvancedSettings?.audioVisualizerName || "bars") {
|
|
10993
11041
|
case "default":
|
|
10994
|
-
return
|
|
11042
|
+
return b`
|
|
10995
11043
|
<volume-visualizer ${At(this.volumeVisualizerRef)}></volume-visualizer>
|
|
10996
11044
|
`;
|
|
10997
11045
|
case "liquid":
|
|
10998
|
-
return
|
|
11046
|
+
return b`
|
|
10999
11047
|
<volume-visualizer-liquid ${At(this.volumeVisualizerRef)}></volume-visualizer-liquid>
|
|
11000
11048
|
`;
|
|
11001
11049
|
case "bars":
|
|
11002
|
-
return
|
|
11050
|
+
return b`
|
|
11003
11051
|
<volume-visualizer-bars ${At(this.volumeVisualizerRef)}></volume-visualizer-bars>
|
|
11004
11052
|
`;
|
|
11005
11053
|
default:
|
|
11006
|
-
return
|
|
11054
|
+
return b`
|
|
11007
11055
|
<volume-visualizer ${At(this.volumeVisualizerRef)}></volume-visualizer>
|
|
11008
11056
|
`;
|
|
11009
11057
|
}
|
|
@@ -11011,8 +11059,8 @@ let ta = class extends re {
|
|
|
11011
11059
|
updated(a) {
|
|
11012
11060
|
if (super.updated(a), this.volumeVisualizerRef.value) {
|
|
11013
11061
|
if (!this.volumeVisualizerInitialized) {
|
|
11014
|
-
const e = this.volumeVisualizerRef.value, t =
|
|
11015
|
-
t && (e.connectAnalyzers(t),
|
|
11062
|
+
const e = this.volumeVisualizerRef.value, t = u.getAudioAnalyzers();
|
|
11063
|
+
t && (e.connectAnalyzers(t), ut.info("volumeVisualizerInitialized set to true"), this.volumeVisualizerInitialized = !0);
|
|
11016
11064
|
}
|
|
11017
11065
|
} else
|
|
11018
11066
|
this.volumeVisualizerInitialized && (this.volumeVisualizerInitialized = !1);
|
|
@@ -11030,18 +11078,18 @@ let ta = class extends re {
|
|
|
11030
11078
|
)}
|
|
11031
11079
|
* */
|
|
11032
11080
|
async _toggleMute(a) {
|
|
11033
|
-
a.stopPropagation(),
|
|
11081
|
+
a.stopPropagation(), ut.info("_toggleMute called"), await u.toggleMute(), this.volumeVisualizerRef.value && this.volumeVisualizerRef.value.setMuted(u.webAudioMuted);
|
|
11034
11082
|
}
|
|
11035
11083
|
async _toggleHangup(a) {
|
|
11036
|
-
a.stopPropagation(),
|
|
11084
|
+
a.stopPropagation(), ut.info("_toggleHangup called"), await u.stopAudio();
|
|
11037
11085
|
}
|
|
11038
11086
|
_handleTypingActiveChanged(a, e, t) {
|
|
11039
|
-
|
|
11087
|
+
u.webAudioStarted && (ut.info(`Typing state changed: ${e}`), this.volumeVisualizerRef.value && this.volumeVisualizerRef.value.setThinking(e));
|
|
11040
11088
|
}
|
|
11041
11089
|
};
|
|
11042
11090
|
ta.styles = ar;
|
|
11043
11091
|
ta = cr([
|
|
11044
|
-
|
|
11092
|
+
J("cb-audio-controls")
|
|
11045
11093
|
], ta);
|
|
11046
11094
|
class aa extends Error {
|
|
11047
11095
|
response;
|
|
@@ -11093,7 +11141,7 @@ const ja = (() => {
|
|
|
11093
11141
|
throw s;
|
|
11094
11142
|
}
|
|
11095
11143
|
return a && !e;
|
|
11096
|
-
})(), lr = typeof globalThis.AbortController == "function",
|
|
11144
|
+
})(), lr = typeof globalThis.AbortController == "function", ui = typeof globalThis.AbortSignal == "function" && typeof globalThis.AbortSignal.any == "function", dr = typeof globalThis.ReadableStream == "function", fr = typeof globalThis.FormData == "function", bi = ["get", "post", "put", "patch", "head", "delete"], hr = {
|
|
11097
11145
|
json: "application/json",
|
|
11098
11146
|
text: "text/*",
|
|
11099
11147
|
formData: "multipart/form-data",
|
|
@@ -11102,14 +11150,14 @@ const ja = (() => {
|
|
|
11102
11150
|
// Supported in modern Fetch implementations (for example, browsers and recent Node.js/undici).
|
|
11103
11151
|
// We still feature-check at runtime before exposing the shortcut.
|
|
11104
11152
|
bytes: "*/*"
|
|
11105
|
-
}, Yt = 2147483647,
|
|
11153
|
+
}, Yt = 2147483647, ur = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length, pi = Symbol("stop");
|
|
11106
11154
|
class gi {
|
|
11107
11155
|
options;
|
|
11108
11156
|
constructor(e) {
|
|
11109
11157
|
this.options = e;
|
|
11110
11158
|
}
|
|
11111
11159
|
}
|
|
11112
|
-
const
|
|
11160
|
+
const br = (a) => new gi(a), pr = {
|
|
11113
11161
|
json: !0,
|
|
11114
11162
|
parseJson: !0,
|
|
11115
11163
|
stringifyJson: !0,
|
|
@@ -11147,7 +11195,7 @@ const ur = (a) => new gi(a), pr = {
|
|
|
11147
11195
|
if (a instanceof FormData) {
|
|
11148
11196
|
let e = 0;
|
|
11149
11197
|
for (const [t, i] of a)
|
|
11150
|
-
e +=
|
|
11198
|
+
e += ur, e += new TextEncoder().encode(`Content-Disposition: form-data; name="${t}"`).length, e += typeof i == "string" ? new TextEncoder().encode(i).length : i.size;
|
|
11151
11199
|
return e;
|
|
11152
11200
|
}
|
|
11153
11201
|
if (a instanceof Blob)
|
|
@@ -11277,8 +11325,8 @@ const vi = (a = {}, e = {}) => ({
|
|
|
11277
11325
|
}
|
|
11278
11326
|
Qe(o.hooks) && (i = vi(i, o.hooks), e.hooks = i), Qe(o.headers) && (t = yi(t, o.headers), e.headers = t);
|
|
11279
11327
|
}
|
|
11280
|
-
return s !== void 0 && (e.searchParams = s), r.length > 0 && (r.length === 1 ? e.signal = r[0] :
|
|
11281
|
-
}, kr = (a) =>
|
|
11328
|
+
return s !== void 0 && (e.searchParams = s), r.length > 0 && (r.length === 1 ? e.signal = r[0] : ui ? e.signal = AbortSignal.any(r) : e.signal = r.at(-1)), e.context === void 0 && (e.context = {}), e;
|
|
11329
|
+
}, kr = (a) => bi.includes(a) ? a.toUpperCase() : a, _r = ["get", "put", "head", "delete", "options", "trace"], Sr = [408, 413, 429, 500, 502, 503, 504], Cr = [413, 429, 503], Ha = {
|
|
11282
11330
|
limit: 2,
|
|
11283
11331
|
methods: _r,
|
|
11284
11332
|
statusCodes: Sr,
|
|
@@ -11390,7 +11438,7 @@ class vt {
|
|
|
11390
11438
|
return r;
|
|
11391
11439
|
}
|
|
11392
11440
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
11393
|
-
static #
|
|
11441
|
+
static #u(e) {
|
|
11394
11442
|
return e && typeof e == "object" && !Array.isArray(e) && !(e instanceof URLSearchParams) ? Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)) : e;
|
|
11395
11443
|
}
|
|
11396
11444
|
request;
|
|
@@ -11428,10 +11476,10 @@ class vt {
|
|
|
11428
11476
|
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
11429
11477
|
this.#e.prefixUrl.endsWith("/") || (this.#e.prefixUrl += "/"), this.#t = this.#e.prefixUrl + this.#t;
|
|
11430
11478
|
}
|
|
11431
|
-
lr &&
|
|
11479
|
+
lr && ui && (this.#s = this.#e.signal ?? this.#t.signal, this.#i = new globalThis.AbortController(), this.#e.signal = this.#s ? AbortSignal.any([this.#s, this.#i.signal]) : this.#i.signal), ja && (this.#e.duplex = "half"), this.#e.json !== void 0 && (this.#e.body = this.#e.stringifyJson?.(this.#e.json) ?? JSON.stringify(this.#e.json), this.#e.headers.set("content-type", this.#e.headers.get("content-type") ?? "application/json"));
|
|
11432
11480
|
const i = t.headers && new globalThis.Headers(t.headers).has("content-type");
|
|
11433
11481
|
if (this.#t instanceof globalThis.Request && (fr && this.#e.body instanceof globalThis.FormData || this.#e.body instanceof URLSearchParams) && !i && this.#e.headers.delete("content-type"), this.request = new globalThis.Request(this.#t, this.#e), Er(this.#e.searchParams)) {
|
|
11434
|
-
const r = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(vt.#
|
|
11482
|
+
const r = "?" + (typeof this.#e.searchParams == "string" ? this.#e.searchParams.replace(/^\?/, "") : new URLSearchParams(vt.#u(this.#e.searchParams)).toString()), o = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, r);
|
|
11435
11483
|
this.request = new globalThis.Request(o, this.#e);
|
|
11436
11484
|
}
|
|
11437
11485
|
if (this.#e.onUploadProgress) {
|
|
@@ -11447,7 +11495,7 @@ class vt {
|
|
|
11447
11495
|
let t = e;
|
|
11448
11496
|
return this.#e.retry.jitter === !0 ? t = Math.random() * e : typeof this.#e.retry.jitter == "function" && (t = this.#e.retry.jitter(e), (!Number.isFinite(t) || t < 0) && (t = e)), Math.min(this.#e.retry.backoffLimit, t);
|
|
11449
11497
|
}
|
|
11450
|
-
async #
|
|
11498
|
+
async #b(e) {
|
|
11451
11499
|
if (this.#a++, this.#a > this.#e.retry.limit)
|
|
11452
11500
|
throw e;
|
|
11453
11501
|
const t = e instanceof Error ? e : new hi(e);
|
|
@@ -11486,7 +11534,7 @@ class vt {
|
|
|
11486
11534
|
try {
|
|
11487
11535
|
return await e();
|
|
11488
11536
|
} catch (t) {
|
|
11489
|
-
const i = Math.min(await this.#
|
|
11537
|
+
const i = Math.min(await this.#b(t), Yt);
|
|
11490
11538
|
if (this.#a < 1)
|
|
11491
11539
|
throw t;
|
|
11492
11540
|
if (await Tr(i, this.#s ? { signal: this.#s } : {}), t instanceof Xt && t.customRequest) {
|
|
@@ -11542,9 +11590,9 @@ class vt {
|
|
|
11542
11590
|
}
|
|
11543
11591
|
const sa = (a) => {
|
|
11544
11592
|
const e = (t, i) => vt.create(t, Et(a, i));
|
|
11545
|
-
for (const t of
|
|
11593
|
+
for (const t of bi)
|
|
11546
11594
|
e[t] = (i, s) => vt.create(i, Et(a, s, { method: t }));
|
|
11547
|
-
return e.create = (t) => sa(Et(t)), e.extend = (t) => (typeof t == "function" && (t = t(a ?? {})), sa(Et(a, t))), e.stop = pi, e.retry =
|
|
11595
|
+
return e.create = (t) => sa(Et(t)), e.extend = (t) => (typeof t == "function" && (t = t(a ?? {})), sa(Et(a, t))), e.stop = pi, e.retry = br, e;
|
|
11548
11596
|
}, Lr = sa();
|
|
11549
11597
|
Lr.extend({
|
|
11550
11598
|
hooks: {
|
|
@@ -11580,11 +11628,15 @@ var zr = Object.defineProperty, Or = Object.getOwnPropertyDescriptor, V = (a, e,
|
|
|
11580
11628
|
(o = a[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
11581
11629
|
return i && s && zr(e, t, s), s;
|
|
11582
11630
|
};
|
|
11583
|
-
const Be =
|
|
11631
|
+
const Be = Ke.noConflict();
|
|
11584
11632
|
Be.setLevel("info");
|
|
11633
|
+
function Br() {
|
|
11634
|
+
const a = navigator.userAgent, e = /iPhone|iPad|iPod/.test(a), t = /AppleWebKit/.test(a), i = /Safari/.test(a) && !/CriOS|FxiOS|EdgiOS|OPiOS/.test(a);
|
|
11635
|
+
return e && t && !i;
|
|
11636
|
+
}
|
|
11585
11637
|
let F = class extends re {
|
|
11586
11638
|
constructor() {
|
|
11587
|
-
super(...arguments), this.store = new it(this,
|
|
11639
|
+
super(...arguments), this.store = new it(this, u), this.displayLicense = !1, this.name = "ChatBot", this.orgId = "", this.botId = "", this.version = "current", this.testMode = "false", this.url = "ws://localhost:3070", this.logoUrl = "", this.logoSvg = `<svg width="24" height="24" viewBox="0 0 203 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11588
11640
|
<path d="M100.438 0C155.665 0 200.438 44.7723 200.438 100C200.438 155.228 155.665 200 100.438 200C45.2098 200 0.4375 155.228 0.4375 100C0.4375 44.7723 45.2098 0 100.438 0ZM130.093 60.6063C120.409 60.6063 115.205 61.458 109.344 65.0325C100.122 70.6592 95.629 80.1958 94.2273 93.877C94.1468 94.5544 93.8048 97.2571 93.4091 100.349C93.3152 101.06 93.2281 101.771 93.1409 102.455C92.7318 105.573 92.3093 108.739 92.0142 110.408C90.8808 117.041 89.2914 123.761 83.8927 126.759C83.6915 126.873 83.4702 126.967 83.2556 127.067C78.6013 129.093 72.2905 128.898 72.2905 128.898C72.2905 128.898 69.1988 128.885 69.1787 128.885C69.172 128.885 69.1921 128.885 69.1921 128.898L68.1057 143.632C87.7824 143.666 93.0537 139.213 93.0537 139.213C102.275 133.586 106.768 124.049 108.17 110.368C108.251 109.677 108.593 106.894 109.002 103.735C109.096 103.004 109.196 102.273 109.283 101.576C109.679 98.5246 110.095 95.4798 110.383 93.8435C111.517 87.2108 113.106 80.4842 118.505 77.4931C118.706 77.3791 118.921 77.2852 119.135 77.1846C123.756 75.1727 130.107 75.3471 130.107 75.3471C132.494 75.3269 133.219 75.4007 133.286 75.4074L134.292 60.6264C132.783 60.6264 130.107 60.6264 130.107 60.6264L130.093 60.6063Z" fill="#010101" style="fill:#010101;fill:color(display-p3 0.0039 0.0039 0.0039);fill-opacity:1;"/>
|
|
11589
11641
|
</svg>`, this.closeSvg = '<svg viewBox="0 0 16 16" width="1.4em" height="1.4em"><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"></path></svg>', this.logoSvgGradient = `<svg width="28" height="28" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11590
11642
|
<g clip-path="url(#clip0_830_884)">
|
|
@@ -11602,7 +11654,7 @@ let F = class extends re {
|
|
|
11602
11654
|
<rect width="400" height="400" fill="white"/>
|
|
11603
11655
|
</clipPath>
|
|
11604
11656
|
</defs>
|
|
11605
|
-
</svg>`, this.popupLogoSvg = "", this.popupLogoUrl = "", this.botIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M16 17V19H2V17S2 13 9 13 16 17 16 17M12.5 7.5A3.5 3.5 0 1 0 9 11A3.5 3.5 0 0 0 12.5 7.5M15.94 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13M15 4A3.39 3.39 0 0 0 13.07 4.59A5 5 0 0 1 13.07 10.41A3.39 3.39 0 0 0 15 11A3.5 3.5 0 0 0 15 4Z" /></svg>', this.userIconSvg = '<svg fill="currentColor" viewBox="0 0 24 24" width="24" height="24"> <path d="M12 4a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 10c4.42 0 8 1.79 8 4v2H4v-2c0-2.21 3.58-4 8-4Z" /></svg>', this.systemIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z"/></svg>', this.agentIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M18.72,14.76C19.07,13.91 19.26,13 19.26,12C19.26,11.28 19.15,10.59 18.96,9.95C18.31,10.1 17.63,10.18 16.92,10.18C13.86,10.18 11.15,8.67 9.5,6.34C8.61,8.5 6.91,10.26 4.77,11.22C4.73,11.47 4.73,11.74 4.73,12A7.27,7.27 0 0,0 12,19.27C13.05,19.27 14.06,19.04 14.97,18.63C15.54,19.72 15.8,20.26 15.78,20.26C14.14,20.81 12.87,21.08 12,21.08C9.58,21.08 7.27,20.13 5.57,18.42C4.53,17.38 3.76,16.11 3.33,14.73H2V10.18H3.09C3.93,6.04 7.6,2.92 12,2.92C14.4,2.92 16.71,3.87 18.42,5.58C19.69,6.84 20.54,8.45 20.89,10.18H22V14.67H22V14.69L22,14.73H21.94L18.38,18L13.08,17.4V15.73H17.91L18.72,14.76M9.27,11.77C9.57,11.77 9.86,11.89 10.07,12.11C10.28,12.32 10.4,12.61 10.4,12.91C10.4,13.21 10.28,13.5 10.07,13.71C9.86,13.92 9.57,14.04 9.27,14.04C8.64,14.04 8.13,13.54 8.13,12.91C8.13,12.28 8.64,11.77 9.27,11.77M14.72,11.77C15.35,11.77 15.85,12.28 15.85,12.91C15.85,13.54 15.35,14.04 14.72,14.04C14.09,14.04 13.58,13.54 13.58,12.91A1.14,1.14 0 0,1 14.72,11.77Z" /></svg>', this.infoIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" /></svg>', this.anchorOpenSvg = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M16 8c0 3.866-3.582 7-8 7a9 9 0 0 1-2.347-.306c-.584.296-1.925.864-4.181 1.234c-.2.032-.352-.176-.273-.362c.354-.836.674-1.95.77-2.966C.744 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7M5 8a1 1 0 1 0-2 0a1 1 0 0 0 2 0m4 0a1 1 0 1 0-2 0a1 1 0 0 0 2 0m3 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/></svg>', this.anchorCloseSvg = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/></svg>', this.sendIconSvg = "", this.attachIconSvg = "", this.stream = !1, this.customRequest = !1, this.enableFileUpload = !1, this.uploadFileUrl = "", this.open = !1, this.alwaysOpen = !1, this.prefilledFormFields = "{}", this.loading = !1, this.showSetting = !1, this.showAuthAlert = !1, this.handleAddMessage = (a) => {
|
|
11657
|
+
</svg>`, this.popupLogoSvg = "", this.popupLogoUrl = "", this.botIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M16 17V19H2V17S2 13 9 13 16 17 16 17M12.5 7.5A3.5 3.5 0 1 0 9 11A3.5 3.5 0 0 0 12.5 7.5M15.94 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13M15 4A3.39 3.39 0 0 0 13.07 4.59A5 5 0 0 1 13.07 10.41A3.39 3.39 0 0 0 15 11A3.5 3.5 0 0 0 15 4Z" /></svg>', this.userIconSvg = '<svg fill="currentColor" viewBox="0 0 24 24" width="24" height="24"> <path d="M12 4a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 10c4.42 0 8 1.79 8 4v2H4v-2c0-2.21 3.58-4 8-4Z" /></svg>', this.systemIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z"/></svg>', this.agentIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M18.72,14.76C19.07,13.91 19.26,13 19.26,12C19.26,11.28 19.15,10.59 18.96,9.95C18.31,10.1 17.63,10.18 16.92,10.18C13.86,10.18 11.15,8.67 9.5,6.34C8.61,8.5 6.91,10.26 4.77,11.22C4.73,11.47 4.73,11.74 4.73,12A7.27,7.27 0 0,0 12,19.27C13.05,19.27 14.06,19.04 14.97,18.63C15.54,19.72 15.8,20.26 15.78,20.26C14.14,20.81 12.87,21.08 12,21.08C9.58,21.08 7.27,20.13 5.57,18.42C4.53,17.38 3.76,16.11 3.33,14.73H2V10.18H3.09C3.93,6.04 7.6,2.92 12,2.92C14.4,2.92 16.71,3.87 18.42,5.58C19.69,6.84 20.54,8.45 20.89,10.18H22V14.67H22V14.69L22,14.73H21.94L18.38,18L13.08,17.4V15.73H17.91L18.72,14.76M9.27,11.77C9.57,11.77 9.86,11.89 10.07,12.11C10.28,12.32 10.4,12.61 10.4,12.91C10.4,13.21 10.28,13.5 10.07,13.71C9.86,13.92 9.57,14.04 9.27,14.04C8.64,14.04 8.13,13.54 8.13,12.91C8.13,12.28 8.64,11.77 9.27,11.77M14.72,11.77C15.35,11.77 15.85,12.28 15.85,12.91C15.85,13.54 15.35,14.04 14.72,14.04C14.09,14.04 13.58,13.54 13.58,12.91A1.14,1.14 0 0,1 14.72,11.77Z" /></svg>', this.infoIconSvg = '<svg fill="currentColor" width="24" height="24" viewBox="0 0 24 24"> <path d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" /></svg>', this.anchorOpenSvg = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M16 8c0 3.866-3.582 7-8 7a9 9 0 0 1-2.347-.306c-.584.296-1.925.864-4.181 1.234c-.2.032-.352-.176-.273-.362c.354-.836.674-1.95.77-2.966C.744 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7M5 8a1 1 0 1 0-2 0a1 1 0 0 0 2 0m4 0a1 1 0 1 0-2 0a1 1 0 0 0 2 0m3 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/></svg>', this.anchorCloseSvg = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/></svg>', this.sendIconSvg = "", this.attachIconSvg = "", this.stream = !1, this.customRequest = !1, this.enableFileUpload = !1, this.uploadFileUrl = "", this.open = !1, this.alwaysOpen = !1, this.prefilledFormFields = "{}", this.loading = !1, this.showSetting = !1, this.showAuthAlert = !1, this.lifecycleListenersAttached = !1, this.handleAddMessage = (a) => {
|
|
11606
11658
|
this._addMessageHandler(a);
|
|
11607
11659
|
}, this.handleStateEvent = (a) => {
|
|
11608
11660
|
this._stateEventHandler(a);
|
|
@@ -11610,6 +11662,14 @@ let F = class extends re {
|
|
|
11610
11662
|
this._chatbotToggleHandler(a);
|
|
11611
11663
|
}, this.handleFormSubmitEvent = (a) => {
|
|
11612
11664
|
this._formSubmitHandler(a);
|
|
11665
|
+
}, this.boundScrollToBottomOnUpdate = this._scrollToBottomOnUpdate.bind(this), this.handleVisibilityChange = () => {
|
|
11666
|
+
u.handleLifecycleResume("visibilitychange", this.boundScrollToBottomOnUpdate);
|
|
11667
|
+
}, this.handlePageShow = () => {
|
|
11668
|
+
u.handleLifecycleResume("pageshow", this.boundScrollToBottomOnUpdate);
|
|
11669
|
+
}, this.handleWindowFocus = () => {
|
|
11670
|
+
u.handleLifecycleResume("focus", this.boundScrollToBottomOnUpdate);
|
|
11671
|
+
}, this.handleWindowOnline = () => {
|
|
11672
|
+
u.handleLifecycleResume("online", this.boundScrollToBottomOnUpdate);
|
|
11613
11673
|
}, this.fetchStream = Rr;
|
|
11614
11674
|
}
|
|
11615
11675
|
/**
|
|
@@ -11625,10 +11685,10 @@ let F = class extends re {
|
|
|
11625
11685
|
isThinking: !0,
|
|
11626
11686
|
data: {}
|
|
11627
11687
|
};
|
|
11628
|
-
return
|
|
11688
|
+
return u.addMessage(a), a;
|
|
11629
11689
|
}
|
|
11630
11690
|
addTestMessageRaw(a) {
|
|
11631
|
-
|
|
11691
|
+
u.addMessage(a);
|
|
11632
11692
|
}
|
|
11633
11693
|
addTestMessage(a = "") {
|
|
11634
11694
|
const t = {
|
|
@@ -11639,63 +11699,63 @@ let F = class extends re {
|
|
|
11639
11699
|
text: a !== "" ? a : "Long text.The element may not be scrolled completely to the top or bottom depending on the layout of other elements.The element may not be scrolled completely to the top or bottom depending on the layout of other elements."
|
|
11640
11700
|
}
|
|
11641
11701
|
};
|
|
11642
|
-
return
|
|
11702
|
+
return u.addMessage(t), t;
|
|
11643
11703
|
}
|
|
11644
11704
|
addActions(a = []) {
|
|
11645
|
-
|
|
11705
|
+
u.addActions(a);
|
|
11646
11706
|
}
|
|
11647
11707
|
render() {
|
|
11648
|
-
return
|
|
11649
|
-
<div class="cb-wrapper${
|
|
11708
|
+
return u.disabled && !this.alwaysOpen ? (Be.info("Bot is disabled until settings are loaded"), null) : b`
|
|
11709
|
+
<div class="cb-wrapper${u.open ? " cb-open" : ""}" part="wrapper${u.open ? " open" : ""}" exportparts="new-conversation-wrapper new-conversation-button wrapper${u.open ? " open" : ""}">
|
|
11650
11710
|
<cb-header title="${this.name}" exportparts="header, header-logo, header-title, header-close"></cb-header>
|
|
11651
11711
|
<cb-message-list
|
|
11652
|
-
.messages=${
|
|
11653
|
-
.actions=${
|
|
11654
|
-
.form=${
|
|
11712
|
+
.messages=${u.messages}
|
|
11713
|
+
.actions=${u.actions}
|
|
11714
|
+
.form=${u.form}
|
|
11655
11715
|
exportparts="bot-message-list, disclaimer-message, bot-message, cb-message, bot-message-content, user-message-content, user-avatar, assistant-avatar, feedback-wrapper,feedback-up,feedback-down,form, form-title, form-input, form-submit"
|
|
11656
11716
|
></cb-message-list>
|
|
11657
11717
|
${W(
|
|
11658
|
-
|
|
11659
|
-
() =>
|
|
11718
|
+
u.showNewConversation,
|
|
11719
|
+
() => b`
|
|
11660
11720
|
<div class="cb-new-conversation-wrapper" part="new-conversation-wrapper">
|
|
11661
11721
|
<button type="button" class="card-btn info" part="new-conversation-button" @click=${this.clearConversation}>Start New Conversation</button>
|
|
11662
11722
|
</div>
|
|
11663
11723
|
`,
|
|
11664
|
-
() =>
|
|
11724
|
+
() => b``
|
|
11665
11725
|
)}
|
|
11666
11726
|
<cb-audio-controls exportparts="audio-controls-wrapper, audio-controls, audio-mute-button, audio-unmute-button, audio-end-button, audio-controls-viz"></cb-audio-controls>
|
|
11667
11727
|
${this.renderUserInput()} ${this.renderFeedbackDialog()}
|
|
11668
11728
|
</div>
|
|
11669
|
-
<cb-anchor ?open=${
|
|
11729
|
+
<cb-anchor ?open=${u.open} exportparts="anchor, anchor-badge, anchor-icon"></cb-anchor>
|
|
11670
11730
|
`;
|
|
11671
11731
|
}
|
|
11672
11732
|
renderFeedbackDialog() {
|
|
11673
|
-
return
|
|
11733
|
+
return b`<cb-dialog-feedback></cb-dialog-feedback>`;
|
|
11674
11734
|
}
|
|
11675
11735
|
_dialogCancelHandler() {
|
|
11676
|
-
console.log("Feedback dialog cancelled"),
|
|
11736
|
+
console.log("Feedback dialog cancelled"), u.feedback = !1;
|
|
11677
11737
|
}
|
|
11678
11738
|
renderUserInput() {
|
|
11679
|
-
return
|
|
11739
|
+
return u.form || u.disabled && this.alwaysOpen ? null : u.setting.enableAudio ? b`
|
|
11680
11740
|
<cb-user-input-mm
|
|
11681
11741
|
part="user-input-control"
|
|
11682
|
-
?loading=${
|
|
11683
|
-
?disabled=${
|
|
11684
|
-
?enable-file-upload=${
|
|
11685
|
-
?enable-audio=${
|
|
11742
|
+
?loading=${u.connecting}
|
|
11743
|
+
?disabled=${u.connecting || u.form}
|
|
11744
|
+
?enable-file-upload=${u.setting.uploadImages && u.connected}
|
|
11745
|
+
?enable-audio=${u.setting.enableAudio && u.connected}
|
|
11686
11746
|
exportparts="user-input-control,user-input, user-input-wrapper, user-input-inner, user-input-base, upload-button, control-button, user-input-textarea, user-input-buttons-wrapper, user-input-send-icon, user-input-attach-icon"
|
|
11687
|
-
></cb-user-input-mm>` :
|
|
11747
|
+
></cb-user-input-mm>` : b`
|
|
11688
11748
|
<cb-user-input
|
|
11689
11749
|
part="user-input-control"
|
|
11690
|
-
?loading=${
|
|
11691
|
-
?disabled=${
|
|
11692
|
-
?enable-file-upload=${
|
|
11693
|
-
?enable-audio=${
|
|
11750
|
+
?loading=${u.connecting}
|
|
11751
|
+
?disabled=${u.connecting || u.form}
|
|
11752
|
+
?enable-file-upload=${u.setting.uploadImages && u.connected}
|
|
11753
|
+
?enable-audio=${u.setting.enableAudio && u.connected}
|
|
11694
11754
|
exportparts="user-input-control,user-input, user-input-wrapper, user-input-base, user-input-textarea, user-input-buttons-wrapper, user-input-send-icon, user-input-attach-icon"
|
|
11695
11755
|
></cb-user-input>`;
|
|
11696
11756
|
}
|
|
11697
11757
|
connectedCallback() {
|
|
11698
|
-
super.connectedCallback(), Be.info("connectedCallback"), this.initCssVariables(), addEventListener("c7o:bot:stateEvent", this.handleStateEvent), addEventListener("message:send", this.handleAddMessage), addEventListener("chatbot:toggle", this.handleToggleEvent), addEventListener("form:submit", this.handleFormSubmitEvent), addEventListener("message:send:file", this._uploadFileHandler), addEventListener("audio:toggle", this._audioToggleHandler);
|
|
11758
|
+
super.connectedCallback(), Be.info("connectedCallback"), this.initCssVariables(), addEventListener("c7o:bot:stateEvent", this.handleStateEvent), addEventListener("message:send", this.handleAddMessage), addEventListener("chatbot:toggle", this.handleToggleEvent), addEventListener("form:submit", this.handleFormSubmitEvent), addEventListener("message:send:file", this._uploadFileHandler), addEventListener("audio:toggle", this._audioToggleHandler), this.attachLifecycleListeners();
|
|
11699
11759
|
}
|
|
11700
11760
|
extractCssVariable(a, e, t) {
|
|
11701
11761
|
let i = a.getPropertyValue(e).trim();
|
|
@@ -11704,7 +11764,7 @@ let F = class extends re {
|
|
|
11704
11764
|
// Extract css variables that control the appearance of the chatbot
|
|
11705
11765
|
initCssVariables() {
|
|
11706
11766
|
let a = getComputedStyle(this);
|
|
11707
|
-
|
|
11767
|
+
u.appearanceAnchorPopupPosition = this.extractCssVariable(a, "--enegelai-bot-anchor-popup-position", "top-end"), u.appearanceAnchorBadgeVariant = this.extractCssVariable(a, "--enegelai-bot-anchor-badge-variant", u.appearanceAnchorBadgeVariant), u.appearanceUserMessageAvatarPosition = this.extractCssVariable(a, "--enegelai-bot-user-message-avatar-position", "left");
|
|
11708
11768
|
}
|
|
11709
11769
|
/*
|
|
11710
11770
|
private getPopupPlacement() {
|
|
@@ -11724,47 +11784,56 @@ let F = class extends re {
|
|
|
11724
11784
|
|
|
11725
11785
|
*/
|
|
11726
11786
|
disconnectedCallback() {
|
|
11727
|
-
Be.info("disconnectedCallback"), super.disconnectedCallback(), window.removeEventListener("c7o:bot:stateEvent", this.handleStateEvent), window.removeEventListener("message:send", this.handleAddMessage), window.removeEventListener("chatbot:toggle", this.handleToggleEvent), window.removeEventListener("form:submit", this.handleFormSubmitEvent), window.removeEventListener("message:send:file", this._uploadFileHandler), window.removeEventListener("audio:toggle", this._audioToggleHandler);
|
|
11787
|
+
Be.info("disconnectedCallback"), super.disconnectedCallback(), window.removeEventListener("c7o:bot:stateEvent", this.handleStateEvent), window.removeEventListener("message:send", this.handleAddMessage), window.removeEventListener("chatbot:toggle", this.handleToggleEvent), window.removeEventListener("form:submit", this.handleFormSubmitEvent), window.removeEventListener("message:send:file", this._uploadFileHandler), window.removeEventListener("audio:toggle", this._audioToggleHandler), this.detachLifecycleListeners();
|
|
11788
|
+
}
|
|
11789
|
+
attachLifecycleListeners() {
|
|
11790
|
+
this.lifecycleListenersAttached || Br() && (document.addEventListener("visibilitychange", this.handleVisibilityChange), window.addEventListener("pageshow", this.handlePageShow), window.addEventListener("focus", this.handleWindowFocus), window.addEventListener("online", this.handleWindowOnline), this.lifecycleListenersAttached = !0);
|
|
11791
|
+
}
|
|
11792
|
+
detachLifecycleListeners() {
|
|
11793
|
+
this.lifecycleListenersAttached && (document.removeEventListener("visibilitychange", this.handleVisibilityChange), window.removeEventListener("pageshow", this.handlePageShow), window.removeEventListener("focus", this.handleWindowFocus), window.removeEventListener("online", this.handleWindowOnline), this.lifecycleListenersAttached = !1);
|
|
11728
11794
|
}
|
|
11729
11795
|
// This is called when component is loaded, with all the settings (props) values
|
|
11730
11796
|
// Use to initialize
|
|
11731
11797
|
// This is also called when state changes - ??? - i.e. when message added to the array
|
|
11732
11798
|
updated(a) {
|
|
11733
|
-
super.updated(a), a.size > 0 && (Be.info("updated,_changedProperties:", a), this._initSetting()),
|
|
11799
|
+
super.updated(a), a.size > 0 && (Be.info("updated,_changedProperties:", a), this._initSetting()), this._scrollToBottomOnUpdate();
|
|
11800
|
+
}
|
|
11801
|
+
_scrollToBottomOnUpdate() {
|
|
11802
|
+
this._scrollToBottomTimeout || (this._scrollToBottomTimeout = setTimeout(() => {
|
|
11734
11803
|
this._scrollToBottom(), this._scrollToBottomTimeout = void 0;
|
|
11735
11804
|
}, 200));
|
|
11736
11805
|
}
|
|
11737
11806
|
// initialize setting
|
|
11738
11807
|
_initSetting() {
|
|
11739
11808
|
Be.info("_initSetting");
|
|
11740
|
-
const a =
|
|
11741
|
-
a.orgId = this.orgId, a.botId = this.botId, a.url = this.url, a.version = this.version || "current", a.logoUrl = this.logoUrl, a.logoSvg = this.logoSvg, a.closeSvg = this.closeSvg, a.popupLogoSvg = this.popupLogoSvg, a.popupLogoUrl = this.popupLogoUrl, a.botIconSvg = this.botIconSvg, a.userIconSvg = this.userIconSvg, a.systemIconSvg = this.systemIconSvg, a.agentIconSvg = this.agentIconSvg, a.infoIconSvg = this.infoIconSvg, a.anchorOpenSvg = this.anchorOpenSvg, a.anchorCloseSvg = this.anchorCloseSvg, a.sendIconSvg = this.sendIconSvg, a.attachIconSvg = this.attachIconSvg,
|
|
11809
|
+
const a = u.setting;
|
|
11810
|
+
a.orgId = this.orgId, a.botId = this.botId, a.url = this.url, a.version = this.version || "current", a.testMode = this.testMode === "true", a.logoUrl = this.logoUrl, a.logoSvg = this.logoSvg, a.closeSvg = this.closeSvg, a.popupLogoSvg = this.popupLogoSvg, a.popupLogoUrl = this.popupLogoUrl, a.botIconSvg = this.botIconSvg, a.userIconSvg = this.userIconSvg, a.systemIconSvg = this.systemIconSvg, a.agentIconSvg = this.agentIconSvg, a.infoIconSvg = this.infoIconSvg, a.anchorOpenSvg = this.anchorOpenSvg, a.anchorCloseSvg = this.anchorCloseSvg, a.sendIconSvg = this.sendIconSvg, a.attachIconSvg = this.attachIconSvg, u.setSetting(a);
|
|
11742
11811
|
let e = {};
|
|
11743
11812
|
try {
|
|
11744
11813
|
e = JSON.parse(this.prefilledFormFields);
|
|
11745
11814
|
} catch (t) {
|
|
11746
11815
|
Be.error(`Failed to parse prefilled-form-fields attribute value, error: ${t?.message || ""}`), e = {};
|
|
11747
11816
|
}
|
|
11748
|
-
|
|
11817
|
+
u.setPrefilledFormFields(e), this.open && (u.open = !0), this.alwaysOpen && (u.open = !0, u.alwaysOpen = !0);
|
|
11749
11818
|
}
|
|
11750
11819
|
setLoading(a) {
|
|
11751
11820
|
this.loading = a;
|
|
11752
11821
|
}
|
|
11753
11822
|
clearConversation() {
|
|
11754
|
-
|
|
11823
|
+
u.clearConversation().catch((a) => {
|
|
11755
11824
|
});
|
|
11756
11825
|
}
|
|
11757
11826
|
setPrefilledFormFields(a) {
|
|
11758
|
-
|
|
11827
|
+
u.setPrefilledFormFields(a);
|
|
11759
11828
|
}
|
|
11760
11829
|
setOpen(a = !1) {
|
|
11761
|
-
|
|
11830
|
+
u.open = a;
|
|
11762
11831
|
}
|
|
11763
11832
|
getOpen() {
|
|
11764
|
-
return
|
|
11833
|
+
return u.open;
|
|
11765
11834
|
}
|
|
11766
11835
|
toggleOpen() {
|
|
11767
|
-
|
|
11836
|
+
u.open = !u.open;
|
|
11768
11837
|
}
|
|
11769
11838
|
setInputValue(a = "") {
|
|
11770
11839
|
this.emitExt("c7o:bot:input:setvalue", {
|
|
@@ -11777,15 +11846,15 @@ let F = class extends re {
|
|
|
11777
11846
|
// It can be any data related with current user / current conversation,
|
|
11778
11847
|
// for example, user profile, current product user is viewing on the web page, etc.
|
|
11779
11848
|
setContext(a = {}) {
|
|
11780
|
-
|
|
11849
|
+
u.setContext(a).catch((e) => {
|
|
11781
11850
|
Be.error(`Failed to set context, error: ${e?.message || ""}`);
|
|
11782
11851
|
});
|
|
11783
11852
|
}
|
|
11784
11853
|
getContext() {
|
|
11785
|
-
return
|
|
11854
|
+
return u.getContext();
|
|
11786
11855
|
}
|
|
11787
11856
|
clearContext() {
|
|
11788
|
-
return
|
|
11857
|
+
return u.clearContext();
|
|
11789
11858
|
}
|
|
11790
11859
|
// check auth
|
|
11791
11860
|
_checkAuth() {
|
|
@@ -11842,11 +11911,11 @@ let F = class extends re {
|
|
|
11842
11911
|
}
|
|
11843
11912
|
// [sv2] for testing only
|
|
11844
11913
|
processAgentConnected(a) {
|
|
11845
|
-
|
|
11914
|
+
u.handleAgentConnected(a).catch((e) => {
|
|
11846
11915
|
});
|
|
11847
11916
|
}
|
|
11848
11917
|
processAgentDisconnected(a) {
|
|
11849
|
-
|
|
11918
|
+
u.handleAgentDisconnected(a).catch((e) => {
|
|
11850
11919
|
});
|
|
11851
11920
|
}
|
|
11852
11921
|
_processSendMessage(a) {
|
|
@@ -11854,9 +11923,9 @@ let F = class extends re {
|
|
|
11854
11923
|
console.log("_processSendMessage: input text is empty, ignored", a);
|
|
11855
11924
|
return;
|
|
11856
11925
|
}
|
|
11857
|
-
a.data.text = Vt(a.data.text.trim()),
|
|
11926
|
+
a.data.text = Vt(a.data.text.trim()), u.isConversationStart() && (console.log("Start of conversation detected, emitting c7o:bot:conversationStart", a), a.conversationId = u.conversationId, this.emitExt("c7o:bot:conversationStart", {
|
|
11858
11927
|
detail: a
|
|
11859
|
-
})),
|
|
11928
|
+
})), u.sendMessage(a), setTimeout(() => {
|
|
11860
11929
|
this._scrollToBottom();
|
|
11861
11930
|
}, 50);
|
|
11862
11931
|
}
|
|
@@ -11871,27 +11940,27 @@ let F = class extends re {
|
|
|
11871
11940
|
}
|
|
11872
11941
|
_chatbotToggleHandler(a) {
|
|
11873
11942
|
const e = a.detail;
|
|
11874
|
-
|
|
11943
|
+
u.open = e.open, u.notifyWidgetOpenState(), this.emitExt(e.open ? "c7o:bot:open" : "c7o:bot:close"), u.unreadMessages = 0, u.suppressEngagePopup();
|
|
11875
11944
|
}
|
|
11876
11945
|
_deleteMessageHandler(a) {
|
|
11877
11946
|
const e = a.detail;
|
|
11878
|
-
|
|
11947
|
+
u.removeMessage(e.id);
|
|
11879
11948
|
}
|
|
11880
11949
|
async _uploadFileHandler(a) {
|
|
11881
11950
|
const e = a.detail;
|
|
11882
|
-
await
|
|
11951
|
+
await u.uploadFiles(e.files);
|
|
11883
11952
|
}
|
|
11884
11953
|
async _audioToggleHandler(a) {
|
|
11885
|
-
Be.info("_audioToggleHandler called"), await
|
|
11954
|
+
Be.info("_audioToggleHandler called"), await u.toggleAudio();
|
|
11886
11955
|
}
|
|
11887
11956
|
// setting confirm handler
|
|
11888
11957
|
_settingConfirmHandler(a) {
|
|
11889
11958
|
const e = a.detail;
|
|
11890
|
-
|
|
11959
|
+
u.setSetting(e.setting), this.showSetting = !1, this._checkAuth();
|
|
11891
11960
|
}
|
|
11892
11961
|
_formSubmitHandler(a) {
|
|
11893
11962
|
const e = a.detail;
|
|
11894
|
-
e.conversationId =
|
|
11963
|
+
e.conversationId = u.conversationId, this.emitExt("c7o:bot:formSubmit", {
|
|
11895
11964
|
detail: e
|
|
11896
11965
|
});
|
|
11897
11966
|
}
|
|
@@ -11916,6 +11985,9 @@ V([
|
|
|
11916
11985
|
V([
|
|
11917
11986
|
x({ type: String, attribute: "version" })
|
|
11918
11987
|
], F.prototype, "version", 2);
|
|
11988
|
+
V([
|
|
11989
|
+
x({ type: String, attribute: "test-mode" })
|
|
11990
|
+
], F.prototype, "testMode", 2);
|
|
11919
11991
|
V([
|
|
11920
11992
|
x({ type: String, attribute: "url" })
|
|
11921
11993
|
], F.prototype, "url", 2);
|
|
@@ -11995,7 +12067,7 @@ V([
|
|
|
11995
12067
|
xe("cb-message-list")
|
|
11996
12068
|
], F.prototype, "_messageList", 2);
|
|
11997
12069
|
F = V([
|
|
11998
|
-
|
|
12070
|
+
J("enegelai-bot")
|
|
11999
12071
|
], F);
|
|
12000
12072
|
export {
|
|
12001
12073
|
F as default
|