@onedeskpro/chatbot-core 0.5.0 → 0.5.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/index.cjs +25 -25
- package/dist/index.iife.js +25 -25
- package/dist/index.js +267 -258
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -126,8 +126,17 @@ function p(e) {
|
|
|
126
126
|
}
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
var m = /* @__PURE__ */ new Set([
|
|
130
|
+
"https:",
|
|
131
|
+
"http:",
|
|
132
|
+
"blob:"
|
|
133
|
+
]);
|
|
134
|
+
function ee(e) {
|
|
135
|
+
try {
|
|
136
|
+
return m.has(new URL(e).protocol.toLowerCase());
|
|
137
|
+
} catch {
|
|
138
|
+
return !1;
|
|
139
|
+
}
|
|
131
140
|
}
|
|
132
141
|
function h(e) {
|
|
133
142
|
return typeof URL > "u" || typeof URL.createObjectURL != "function" ? "" : URL.createObjectURL(e);
|
|
@@ -135,7 +144,7 @@ function h(e) {
|
|
|
135
144
|
function g(e) {
|
|
136
145
|
e.startsWith("blob:") && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(e);
|
|
137
146
|
}
|
|
138
|
-
function
|
|
147
|
+
function te(e) {
|
|
139
148
|
return {
|
|
140
149
|
type: e.type || "application/octet-stream",
|
|
141
150
|
url: h(e),
|
|
@@ -143,10 +152,10 @@ function ee(e) {
|
|
|
143
152
|
size: e.size
|
|
144
153
|
};
|
|
145
154
|
}
|
|
146
|
-
function
|
|
155
|
+
function ne(e) {
|
|
147
156
|
return !Number.isFinite(e) || e < 0 ? "" : e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(+(e < 10240))} KB` : `${(e / 1048576).toFixed(1)} MB`;
|
|
148
157
|
}
|
|
149
|
-
function
|
|
158
|
+
function re(e) {
|
|
150
159
|
if (!e || typeof e != "object") return [];
|
|
151
160
|
let t = e, n = t.attachments;
|
|
152
161
|
if (!Array.isArray(n) && t.message && typeof t.message == "object" && (n = t.message.attachments), !Array.isArray(n)) return [];
|
|
@@ -164,7 +173,7 @@ function ne(e) {
|
|
|
164
173
|
}
|
|
165
174
|
return r;
|
|
166
175
|
}
|
|
167
|
-
function
|
|
176
|
+
function ie(e, t) {
|
|
168
177
|
let n = e.trim();
|
|
169
178
|
return n ? t.length === 0 ? !1 : t.some((e) => e.fileName === n) || /^\d+ files?$/.test(n) ? !0 : [
|
|
170
179
|
"Image",
|
|
@@ -178,7 +187,7 @@ var _ = 16e3;
|
|
|
178
187
|
function v(e) {
|
|
179
188
|
return (e ?? "").split(";")[0].trim().toLowerCase() || "audio/webm";
|
|
180
189
|
}
|
|
181
|
-
function
|
|
190
|
+
function ae(e) {
|
|
182
191
|
return e.includes("mpeg") || e.includes("mp3") ? "mp3" : e.includes("wav") ? "wav" : e.includes("mp4") || e.includes("m4a") ? "m4a" : e.includes("ogg") ? "ogg" : "webm";
|
|
183
192
|
}
|
|
184
193
|
function y(e) {
|
|
@@ -186,18 +195,18 @@ function y(e) {
|
|
|
186
195
|
let t = Math.floor(e), n = Math.floor(t / 60), r = t % 60;
|
|
187
196
|
return `${n}:${String(r).padStart(2, "0")}`;
|
|
188
197
|
}
|
|
189
|
-
function
|
|
198
|
+
function oe() {
|
|
190
199
|
if (typeof window > "u") return null;
|
|
191
200
|
let e = window;
|
|
192
201
|
return e.AudioContext ?? e.webkitAudioContext ?? null;
|
|
193
202
|
}
|
|
194
|
-
function
|
|
203
|
+
function se() {
|
|
195
204
|
if (typeof window > "u") return null;
|
|
196
205
|
let e = window;
|
|
197
206
|
return e.OfflineAudioContext ?? e.webkitOfflineAudioContext ?? null;
|
|
198
207
|
}
|
|
199
|
-
async function
|
|
200
|
-
let t =
|
|
208
|
+
async function ce(e) {
|
|
209
|
+
let t = oe();
|
|
201
210
|
if (!t) return null;
|
|
202
211
|
let n = new t();
|
|
203
212
|
try {
|
|
@@ -209,8 +218,8 @@ async function se(e) {
|
|
|
209
218
|
await n.close().catch(() => void 0);
|
|
210
219
|
}
|
|
211
220
|
}
|
|
212
|
-
async function
|
|
213
|
-
let t =
|
|
221
|
+
async function le(e) {
|
|
222
|
+
let t = se();
|
|
214
223
|
if (t) try {
|
|
215
224
|
let n = new t(1, Math.max(1, Math.ceil(e.duration * _)), _), r = n.createBufferSource();
|
|
216
225
|
return r.buffer = e, r.connect(n.destination), r.start(0), {
|
|
@@ -223,7 +232,7 @@ async function ce(e) {
|
|
|
223
232
|
sampleRate: e.sampleRate
|
|
224
233
|
};
|
|
225
234
|
}
|
|
226
|
-
function
|
|
235
|
+
function ue(e, t) {
|
|
227
236
|
let n = e.length * 2, r = new ArrayBuffer(44 + n), i = new DataView(r), a = (e, t) => {
|
|
228
237
|
for (let n = 0; n < t.length; n++) i.setUint8(e + n, t.charCodeAt(n));
|
|
229
238
|
};
|
|
@@ -235,7 +244,7 @@ function le(e, t) {
|
|
|
235
244
|
}
|
|
236
245
|
return new Blob([r], { type: "audio/wav" });
|
|
237
246
|
}
|
|
238
|
-
function
|
|
247
|
+
function de(e, t = 48) {
|
|
239
248
|
if (e.length === 0) return [];
|
|
240
249
|
let n = Math.max(1, Math.floor(e.length / t)), r = [], i = 0;
|
|
241
250
|
for (let a = 0; a < t; a++) {
|
|
@@ -249,21 +258,21 @@ function ue(e, t = 48) {
|
|
|
249
258
|
}
|
|
250
259
|
return r.map((e) => i > 0 ? Math.max(8, Math.min(100, Math.round(e / i * 100))) : 8);
|
|
251
260
|
}
|
|
252
|
-
async function
|
|
253
|
-
let t = Date.now(), n = Math.max(1, Math.round(e.durationSeconds || 1)), r = v(e.mimeType ?? e.blob.type), i = await
|
|
261
|
+
async function fe(e) {
|
|
262
|
+
let t = Date.now(), n = Math.max(1, Math.round(e.durationSeconds || 1)), r = v(e.mimeType ?? e.blob.type), i = await ce(e.blob);
|
|
254
263
|
if (!i) return {
|
|
255
|
-
file: new File([e.blob], `voice-message-${t}.${
|
|
264
|
+
file: new File([e.blob], `voice-message-${t}.${ae(r)}`, { type: r }),
|
|
256
265
|
durationSeconds: n
|
|
257
266
|
};
|
|
258
|
-
let { samples: a, sampleRate: o } = await
|
|
267
|
+
let { samples: a, sampleRate: o } = await le(i);
|
|
259
268
|
return {
|
|
260
|
-
file: new File([
|
|
269
|
+
file: new File([ue(a, o)], `voice-message-${t}.wav`, { type: "audio/wav" }),
|
|
261
270
|
durationSeconds: Math.max(1, Math.round(i.duration || n)),
|
|
262
|
-
waveform:
|
|
271
|
+
waveform: de(a)
|
|
263
272
|
};
|
|
264
273
|
}
|
|
265
274
|
// src/event-emitter.ts
|
|
266
|
-
var
|
|
275
|
+
var pe = class {
|
|
267
276
|
constructor() {
|
|
268
277
|
this._listeners = {};
|
|
269
278
|
}
|
|
@@ -290,72 +299,72 @@ Object.keys(b).forEach((e) => {
|
|
|
290
299
|
var S = {
|
|
291
300
|
type: "error",
|
|
292
301
|
data: "parser error"
|
|
293
|
-
},
|
|
302
|
+
}, me = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", he = typeof ArrayBuffer == "function", ge = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e && e.buffer instanceof ArrayBuffer, C = ({ type: e, data: t }, n, r) => me && t instanceof Blob ? n ? r(t) : _e(t, r) : he && (t instanceof ArrayBuffer || ge(t)) ? n ? r(t) : _e(new Blob([t]), r) : r(b[e] + (t || "")), _e = (e, t) => {
|
|
294
303
|
let n = new FileReader();
|
|
295
304
|
return n.onload = function() {
|
|
296
305
|
let e = n.result.split(",")[1];
|
|
297
306
|
t("b" + (e || ""));
|
|
298
307
|
}, n.readAsDataURL(e);
|
|
299
308
|
};
|
|
300
|
-
function
|
|
309
|
+
function ve(e) {
|
|
301
310
|
return e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
302
311
|
}
|
|
303
|
-
var
|
|
304
|
-
function
|
|
305
|
-
if (
|
|
306
|
-
if (
|
|
312
|
+
var ye;
|
|
313
|
+
function be(e, t) {
|
|
314
|
+
if (me && e.data instanceof Blob) return e.data.arrayBuffer().then(ve).then(t);
|
|
315
|
+
if (he && (e.data instanceof ArrayBuffer || ge(e.data))) return t(ve(e.data));
|
|
307
316
|
C(e, !1, (e) => {
|
|
308
|
-
|
|
317
|
+
ye ||= new TextEncoder(), t(ye.encode(e));
|
|
309
318
|
});
|
|
310
319
|
}
|
|
311
320
|
// ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js
|
|
312
|
-
var
|
|
313
|
-
for (let e = 0; e < 64; e++) w[
|
|
314
|
-
var
|
|
321
|
+
var xe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", w = typeof Uint8Array > "u" ? [] : /* @__PURE__ */ new Uint8Array(256);
|
|
322
|
+
for (let e = 0; e < 64; e++) w[xe.charCodeAt(e)] = e;
|
|
323
|
+
var Se = (e) => {
|
|
315
324
|
let t = e.length * .75, n = e.length, r, i = 0, a, o, s, c;
|
|
316
325
|
e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
|
|
317
326
|
let l = new ArrayBuffer(t), u = new Uint8Array(l);
|
|
318
327
|
for (r = 0; r < n; r += 4) a = w[e.charCodeAt(r)], o = w[e.charCodeAt(r + 1)], s = w[e.charCodeAt(r + 2)], c = w[e.charCodeAt(r + 3)], u[i++] = a << 2 | o >> 4, u[i++] = (o & 15) << 4 | s >> 2, u[i++] = (s & 3) << 6 | c & 63;
|
|
319
328
|
return l;
|
|
320
|
-
},
|
|
329
|
+
}, Ce = typeof ArrayBuffer == "function", T = (e, t) => {
|
|
321
330
|
if (typeof e != "string") return {
|
|
322
331
|
type: "message",
|
|
323
|
-
data:
|
|
332
|
+
data: Te(e, t)
|
|
324
333
|
};
|
|
325
334
|
let n = e.charAt(0);
|
|
326
335
|
return n === "b" ? {
|
|
327
336
|
type: "message",
|
|
328
|
-
data:
|
|
337
|
+
data: we(e.substring(1), t)
|
|
329
338
|
} : x[n] ? e.length > 1 ? {
|
|
330
339
|
type: x[n],
|
|
331
340
|
data: e.substring(1)
|
|
332
341
|
} : { type: x[n] } : S;
|
|
333
|
-
},
|
|
342
|
+
}, we = (e, t) => Ce ? Te(Se(e), t) : {
|
|
334
343
|
base64: !0,
|
|
335
344
|
data: e
|
|
336
|
-
},
|
|
345
|
+
}, Te = (e, t) => {
|
|
337
346
|
switch (t) {
|
|
338
347
|
case "blob": return e instanceof Blob ? e : new Blob([e]);
|
|
339
348
|
default: return e instanceof ArrayBuffer ? e : e.buffer;
|
|
340
349
|
}
|
|
341
|
-
},
|
|
350
|
+
}, Ee = "", De = (e, t) => {
|
|
342
351
|
let n = e.length, r = Array(n), i = 0;
|
|
343
352
|
e.forEach((e, a) => {
|
|
344
353
|
C(e, !1, (e) => {
|
|
345
|
-
r[a] = e, ++i === n && t(r.join(
|
|
354
|
+
r[a] = e, ++i === n && t(r.join(Ee));
|
|
346
355
|
});
|
|
347
356
|
});
|
|
348
|
-
},
|
|
349
|
-
let n = e.split(
|
|
357
|
+
}, Oe = (e, t) => {
|
|
358
|
+
let n = e.split(Ee), r = [];
|
|
350
359
|
for (let e = 0; e < n.length; e++) {
|
|
351
360
|
let i = T(n[e], t);
|
|
352
361
|
if (r.push(i), i.type === "error") break;
|
|
353
362
|
}
|
|
354
363
|
return r;
|
|
355
364
|
};
|
|
356
|
-
function
|
|
365
|
+
function ke() {
|
|
357
366
|
return new TransformStream({ transform(e, t) {
|
|
358
|
-
|
|
367
|
+
be(e, (n) => {
|
|
359
368
|
let r = n.length, i;
|
|
360
369
|
if (r < 126) i = /* @__PURE__ */ new Uint8Array(1), new DataView(i.buffer).setUint8(0, r);
|
|
361
370
|
else if (r < 65536) {
|
|
@@ -371,7 +380,7 @@ function Oe() {
|
|
|
371
380
|
});
|
|
372
381
|
} });
|
|
373
382
|
}
|
|
374
|
-
var
|
|
383
|
+
var Ae;
|
|
375
384
|
function E(e) {
|
|
376
385
|
return e.reduce((e, t) => e + t.length, 0);
|
|
377
386
|
}
|
|
@@ -381,8 +390,8 @@ function D(e, t) {
|
|
|
381
390
|
for (let i = 0; i < t; i++) n[i] = e[0][r++], r === e[0].length && (e.shift(), r = 0);
|
|
382
391
|
return e.length && r < e[0].length && (e[0] = e[0].slice(r)), n;
|
|
383
392
|
}
|
|
384
|
-
function
|
|
385
|
-
|
|
393
|
+
function je(e, t) {
|
|
394
|
+
Ae ||= new TextDecoder();
|
|
386
395
|
let n = [], r = 0, i = -1, a = !1;
|
|
387
396
|
return new TransformStream({ transform(o, s) {
|
|
388
397
|
for (n.push(o);;) {
|
|
@@ -405,7 +414,7 @@ function Ae(e, t) {
|
|
|
405
414
|
} else {
|
|
406
415
|
if (E(n) < i) break;
|
|
407
416
|
let e = D(n, i);
|
|
408
|
-
s.enqueue(T(a ? e :
|
|
417
|
+
s.enqueue(T(a ? e : Ae.decode(e), t)), r = 0;
|
|
409
418
|
}
|
|
410
419
|
if (i === 0 || i > e) {
|
|
411
420
|
s.enqueue(S);
|
|
@@ -416,9 +425,9 @@ function Ae(e, t) {
|
|
|
416
425
|
}
|
|
417
426
|
// ../../node_modules/.pnpm/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/esm/index.js
|
|
418
427
|
function O(e) {
|
|
419
|
-
if (e) return
|
|
428
|
+
if (e) return Me(e);
|
|
420
429
|
}
|
|
421
|
-
function
|
|
430
|
+
function Me(e) {
|
|
422
431
|
for (var t in O.prototype) e[t] = O.prototype[t];
|
|
423
432
|
return e;
|
|
424
433
|
}
|
|
@@ -453,34 +462,34 @@ O.prototype.on = O.prototype.addEventListener = function(e, t) {
|
|
|
453
462
|
return !!this.listeners(e).length;
|
|
454
463
|
};
|
|
455
464
|
// ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/globals.js
|
|
456
|
-
var k = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), A = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(),
|
|
465
|
+
var k = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), A = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Ne = "arraybuffer";
|
|
457
466
|
// ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/util.js
|
|
458
|
-
function
|
|
467
|
+
function Pe(e, ...t) {
|
|
459
468
|
return t.reduce((t, n) => (e.hasOwnProperty(n) && (t[n] = e[n]), t), {});
|
|
460
469
|
}
|
|
461
|
-
var
|
|
470
|
+
var Fe = A.setTimeout, Ie = A.clearTimeout;
|
|
462
471
|
function j(e, t) {
|
|
463
|
-
t.useNativeTimers ? (e.setTimeoutFn =
|
|
464
|
-
}
|
|
465
|
-
var Ie = 1.33;
|
|
466
|
-
function Le(e) {
|
|
467
|
-
return typeof e == "string" ? Re(e) : Math.ceil((e.byteLength || e.size) * Ie);
|
|
472
|
+
t.useNativeTimers ? (e.setTimeoutFn = Fe.bind(A), e.clearTimeoutFn = Ie.bind(A)) : (e.setTimeoutFn = A.setTimeout.bind(A), e.clearTimeoutFn = A.clearTimeout.bind(A));
|
|
468
473
|
}
|
|
474
|
+
var Le = 1.33;
|
|
469
475
|
function Re(e) {
|
|
476
|
+
return typeof e == "string" ? ze(e) : Math.ceil((e.byteLength || e.size) * Le);
|
|
477
|
+
}
|
|
478
|
+
function ze(e) {
|
|
470
479
|
let t = 0, n = 0;
|
|
471
480
|
for (let r = 0, i = e.length; r < i; r++) t = e.charCodeAt(r), t < 128 ? n += 1 : t < 2048 ? n += 2 : t < 55296 || t >= 57344 ? n += 3 : (r++, n += 4);
|
|
472
481
|
return n;
|
|
473
482
|
}
|
|
474
|
-
function
|
|
483
|
+
function Be() {
|
|
475
484
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
476
485
|
}
|
|
477
486
|
// ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/contrib/parseqs.js
|
|
478
|
-
function
|
|
487
|
+
function Ve(e) {
|
|
479
488
|
let t = "";
|
|
480
489
|
for (let n in e) e.hasOwnProperty(n) && (t.length && (t += "&"), t += encodeURIComponent(n) + "=" + encodeURIComponent(e[n]));
|
|
481
490
|
return t;
|
|
482
491
|
}
|
|
483
|
-
function
|
|
492
|
+
function He(e) {
|
|
484
493
|
let t = {}, n = e.split("&");
|
|
485
494
|
for (let e = 0, r = n.length; e < r; e++) {
|
|
486
495
|
let r = n[e].split("=");
|
|
@@ -489,7 +498,7 @@ function Ve(e) {
|
|
|
489
498
|
return t;
|
|
490
499
|
}
|
|
491
500
|
// ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/transport.js
|
|
492
|
-
var
|
|
501
|
+
var Ue = class extends Error {
|
|
493
502
|
constructor(e, t, n) {
|
|
494
503
|
super(e), this.description = t, this.context = n, this.type = "TransportError";
|
|
495
504
|
}
|
|
@@ -498,7 +507,7 @@ var He = class extends Error {
|
|
|
498
507
|
super(), this.writable = !1, j(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
|
|
499
508
|
}
|
|
500
509
|
onError(e, t, n) {
|
|
501
|
-
return super.emitReserved("error", new
|
|
510
|
+
return super.emitReserved("error", new Ue(e, t, n)), this;
|
|
502
511
|
}
|
|
503
512
|
open() {
|
|
504
513
|
return this.readyState = "opening", this.doOpen(), this;
|
|
@@ -534,10 +543,10 @@ var He = class extends Error {
|
|
|
534
543
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
535
544
|
}
|
|
536
545
|
_query(e) {
|
|
537
|
-
let t =
|
|
546
|
+
let t = Ve(e);
|
|
538
547
|
return t.length ? "?" + t : "";
|
|
539
548
|
}
|
|
540
|
-
},
|
|
549
|
+
}, We = class extends M {
|
|
541
550
|
constructor() {
|
|
542
551
|
super(...arguments), this._polling = !1;
|
|
543
552
|
}
|
|
@@ -565,7 +574,7 @@ var He = class extends Error {
|
|
|
565
574
|
this._polling = !0, this.doPoll(), this.emitReserved("poll");
|
|
566
575
|
}
|
|
567
576
|
onData(e) {
|
|
568
|
-
|
|
577
|
+
Oe(e, this.socket.binaryType).forEach((e) => {
|
|
569
578
|
if (this.readyState === "opening" && e.type === "open" && this.onOpen(), e.type === "close") return this.onClose({ description: "transport closed by the server" }), !1;
|
|
570
579
|
this.onPacket(e);
|
|
571
580
|
}), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
@@ -577,7 +586,7 @@ var He = class extends Error {
|
|
|
577
586
|
this.readyState === "open" ? e() : this.once("open", e);
|
|
578
587
|
}
|
|
579
588
|
write(e) {
|
|
580
|
-
this.writable = !1,
|
|
589
|
+
this.writable = !1, De(e, (e) => {
|
|
581
590
|
this.doWrite(e, () => {
|
|
582
591
|
this.writable = !0, this.emitReserved("drain");
|
|
583
592
|
});
|
|
@@ -585,16 +594,16 @@ var He = class extends Error {
|
|
|
585
594
|
}
|
|
586
595
|
uri() {
|
|
587
596
|
let e = this.opts.secure ? "https" : "http", t = this.query || {};
|
|
588
|
-
return !1 !== this.opts.timestampRequests && (t[this.opts.timestampParam] =
|
|
597
|
+
return !1 !== this.opts.timestampRequests && (t[this.opts.timestampParam] = Be()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
|
|
589
598
|
}
|
|
590
|
-
},
|
|
599
|
+
}, Ge = !1;
|
|
591
600
|
try {
|
|
592
|
-
|
|
601
|
+
Ge = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
593
602
|
} catch {}
|
|
594
|
-
var
|
|
603
|
+
var Ke = Ge;
|
|
595
604
|
// ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/transports/polling-xhr.js
|
|
596
|
-
function
|
|
597
|
-
var
|
|
605
|
+
function qe() {}
|
|
606
|
+
var Je = class extends We {
|
|
598
607
|
constructor(e) {
|
|
599
608
|
if (super(e), typeof location < "u") {
|
|
600
609
|
let t = location.protocol === "https:", n = location.port;
|
|
@@ -622,7 +631,7 @@ var qe = class extends Ue {
|
|
|
622
631
|
}
|
|
623
632
|
_create() {
|
|
624
633
|
var t;
|
|
625
|
-
let n =
|
|
634
|
+
let n = Pe(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
626
635
|
n.xdomain = !!this._opts.xd;
|
|
627
636
|
let r = this._xhr = this.createRequest(n);
|
|
628
637
|
try {
|
|
@@ -658,7 +667,7 @@ var qe = class extends Ue {
|
|
|
658
667
|
}
|
|
659
668
|
_cleanup(t) {
|
|
660
669
|
if (this._xhr !== void 0 && this._xhr !== null) {
|
|
661
|
-
if (this._xhr.onreadystatechange =
|
|
670
|
+
if (this._xhr.onreadystatechange = qe, t) try {
|
|
662
671
|
this._xhr.abort();
|
|
663
672
|
} catch {}
|
|
664
673
|
typeof document < "u" && delete e.requests[this._index], this._xhr = null;
|
|
@@ -673,44 +682,44 @@ var qe = class extends Ue {
|
|
|
673
682
|
}
|
|
674
683
|
};
|
|
675
684
|
if (N.requestsCount = 0, N.requests = {}, typeof document < "u") {
|
|
676
|
-
if (typeof attachEvent == "function") attachEvent("onunload",
|
|
685
|
+
if (typeof attachEvent == "function") attachEvent("onunload", Ye);
|
|
677
686
|
else if (typeof addEventListener == "function") {
|
|
678
687
|
let e = "onpagehide" in A ? "pagehide" : "unload";
|
|
679
|
-
addEventListener(e,
|
|
688
|
+
addEventListener(e, Ye, !1);
|
|
680
689
|
}
|
|
681
690
|
}
|
|
682
|
-
function
|
|
691
|
+
function Ye() {
|
|
683
692
|
for (let e in N.requests) N.requests.hasOwnProperty(e) && N.requests[e].abort();
|
|
684
693
|
}
|
|
685
|
-
var
|
|
686
|
-
let e =
|
|
694
|
+
var Xe = (function() {
|
|
695
|
+
let e = Qe({ xdomain: !1 });
|
|
687
696
|
return e && e.responseType !== null;
|
|
688
|
-
})(),
|
|
697
|
+
})(), Ze = class extends Je {
|
|
689
698
|
constructor(e) {
|
|
690
699
|
super(e);
|
|
691
700
|
let t = e && e.forceBase64;
|
|
692
|
-
this.supportsBinary =
|
|
701
|
+
this.supportsBinary = Xe && !t;
|
|
693
702
|
}
|
|
694
703
|
request(e = {}) {
|
|
695
|
-
return Object.assign(e, { xd: this.xd }, this.opts), new N(
|
|
704
|
+
return Object.assign(e, { xd: this.xd }, this.opts), new N(Qe, this.uri(), e);
|
|
696
705
|
}
|
|
697
706
|
};
|
|
698
|
-
function
|
|
707
|
+
function Qe(e) {
|
|
699
708
|
let t = e.xdomain;
|
|
700
709
|
try {
|
|
701
|
-
if (typeof XMLHttpRequest < "u" && (!t ||
|
|
710
|
+
if (typeof XMLHttpRequest < "u" && (!t || Ke)) return new XMLHttpRequest();
|
|
702
711
|
} catch {}
|
|
703
712
|
if (!t) try {
|
|
704
713
|
return new A.ActiveXObject("Microsoft.XMLHTTP");
|
|
705
714
|
} catch {}
|
|
706
715
|
}
|
|
707
716
|
// ../../node_modules/.pnpm/engine.io-client@6.6.6_supports-color@8.1.1/node_modules/engine.io-client/build/esm/transports/websocket.js
|
|
708
|
-
var
|
|
717
|
+
var $e = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative", et = class extends M {
|
|
709
718
|
get name() {
|
|
710
719
|
return "websocket";
|
|
711
720
|
}
|
|
712
721
|
doOpen() {
|
|
713
|
-
let e = this.uri(), t = this.opts.protocols, n =
|
|
722
|
+
let e = this.uri(), t = this.opts.protocols, n = $e ? {} : Pe(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
714
723
|
this.opts.extraHeaders && (n.headers = this.opts.extraHeaders);
|
|
715
724
|
try {
|
|
716
725
|
this.ws = this.createSocket(e, t, n);
|
|
@@ -746,12 +755,12 @@ var Qe = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
746
755
|
}
|
|
747
756
|
uri() {
|
|
748
757
|
let e = this.opts.secure ? "wss" : "ws", t = this.query || {};
|
|
749
|
-
return this.opts.timestampRequests && (t[this.opts.timestampParam] =
|
|
758
|
+
return this.opts.timestampRequests && (t[this.opts.timestampParam] = Be()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
|
|
750
759
|
}
|
|
751
|
-
}, P = A.WebSocket || A.MozWebSocket,
|
|
752
|
-
websocket: class extends
|
|
760
|
+
}, P = A.WebSocket || A.MozWebSocket, tt = {
|
|
761
|
+
websocket: class extends et {
|
|
753
762
|
createSocket(e, t, n) {
|
|
754
|
-
return
|
|
763
|
+
return $e ? new P(e, t, n) : t ? new P(e, t) : new P(e);
|
|
755
764
|
}
|
|
756
765
|
doWrite(e, t) {
|
|
757
766
|
this.ws.send(t);
|
|
@@ -773,7 +782,7 @@ var Qe = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
773
782
|
this.onError("webtransport error", e);
|
|
774
783
|
}), this._transport.ready.then(() => {
|
|
775
784
|
this._transport.createBidirectionalStream().then((e) => {
|
|
776
|
-
let t =
|
|
785
|
+
let t = je(2 ** 53 - 1, this.socket.binaryType), n = e.readable.pipeThrough(t).getReader(), r = ke();
|
|
777
786
|
r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
|
|
778
787
|
let i = () => {
|
|
779
788
|
n.read().then(({ done: e, value: t }) => {
|
|
@@ -802,8 +811,8 @@ var Qe = typeof navigator < "u" && typeof navigator.product == "string" && navig
|
|
|
802
811
|
(e = this._transport) == null || e.close();
|
|
803
812
|
}
|
|
804
813
|
},
|
|
805
|
-
polling:
|
|
806
|
-
},
|
|
814
|
+
polling: Ze
|
|
815
|
+
}, nt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, rt = [
|
|
807
816
|
"source",
|
|
808
817
|
"protocol",
|
|
809
818
|
"authority",
|
|
@@ -823,15 +832,15 @@ function F(e) {
|
|
|
823
832
|
if (e.length > 8e3) throw "URI too long";
|
|
824
833
|
let t = e, n = e.indexOf("["), r = e.indexOf("]");
|
|
825
834
|
n != -1 && r != -1 && (e = e.substring(0, n) + e.substring(n, r).replace(/:/g, ";") + e.substring(r, e.length));
|
|
826
|
-
let i =
|
|
827
|
-
for (; o--;) a[
|
|
828
|
-
return n != -1 && r != -1 && (a.source = t, a.host = a.host.substring(1, a.host.length - 1).replace(/;/g, ":"), a.authority = a.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), a.ipv6uri = !0), a.pathNames =
|
|
835
|
+
let i = nt.exec(e || ""), a = {}, o = 14;
|
|
836
|
+
for (; o--;) a[rt[o]] = i[o] || "";
|
|
837
|
+
return n != -1 && r != -1 && (a.source = t, a.host = a.host.substring(1, a.host.length - 1).replace(/;/g, ":"), a.authority = a.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), a.ipv6uri = !0), a.pathNames = it(a, a.path), a.queryKey = at(a, a.query), a;
|
|
829
838
|
}
|
|
830
|
-
function
|
|
839
|
+
function it(e, t) {
|
|
831
840
|
let n = t.replace(/\/{2,9}/g, "/").split("/");
|
|
832
841
|
return (t.slice(0, 1) == "/" || t.length === 0) && n.splice(0, 1), t.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
|
|
833
842
|
}
|
|
834
|
-
function
|
|
843
|
+
function at(e, t) {
|
|
835
844
|
let n = {};
|
|
836
845
|
return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(e, t, r) {
|
|
837
846
|
t && (n[t] = r);
|
|
@@ -844,7 +853,7 @@ I && addEventListener("offline", () => {
|
|
|
844
853
|
}, !1);
|
|
845
854
|
var R = class e extends O {
|
|
846
855
|
constructor(e, t) {
|
|
847
|
-
if (super(), this.binaryType =
|
|
856
|
+
if (super(), this.binaryType = Ne, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = Infinity, e && typeof e == "object" && (t = e, e = null), e) {
|
|
848
857
|
let n = F(e);
|
|
849
858
|
t.hostname = n.host, t.secure = n.protocol === "https" || n.protocol === "wss", t.port = n.port, n.query && (t.query = n.query);
|
|
850
859
|
} else t.host && (t.hostname = F(t.host).host);
|
|
@@ -863,7 +872,7 @@ var R = class e extends O {
|
|
|
863
872
|
perMessageDeflate: { threshold: 1024 },
|
|
864
873
|
transportOptions: {},
|
|
865
874
|
closeOnBeforeunload: !1
|
|
866
|
-
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
875
|
+
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = He(this.opts.query)), I && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
867
876
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
868
877
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
869
878
|
this._onClose("transport close", { description: "network connection lost" });
|
|
@@ -938,7 +947,7 @@ var R = class e extends O {
|
|
|
938
947
|
let e = 1;
|
|
939
948
|
for (let t = 0; t < this.writeBuffer.length; t++) {
|
|
940
949
|
let n = this.writeBuffer[t].data;
|
|
941
|
-
if (n && (e +=
|
|
950
|
+
if (n && (e += Re(n)), t > 0 && e > this._maxPayload) return this.writeBuffer.slice(0, t);
|
|
942
951
|
e += 2;
|
|
943
952
|
}
|
|
944
953
|
return this.writeBuffer;
|
|
@@ -993,7 +1002,7 @@ var R = class e extends O {
|
|
|
993
1002
|
}
|
|
994
1003
|
};
|
|
995
1004
|
R.protocol = 4;
|
|
996
|
-
var
|
|
1005
|
+
var ot = class extends R {
|
|
997
1006
|
constructor() {
|
|
998
1007
|
super(...arguments), this._upgrades = [];
|
|
999
1008
|
}
|
|
@@ -1052,28 +1061,28 @@ var at = class extends R {
|
|
|
1052
1061
|
for (let n = 0; n < e.length; n++) ~this.transports.indexOf(e[n]) && t.push(e[n]);
|
|
1053
1062
|
return t;
|
|
1054
1063
|
}
|
|
1055
|
-
},
|
|
1064
|
+
}, st = class extends ot {
|
|
1056
1065
|
constructor(e, t = {}) {
|
|
1057
1066
|
let n = typeof e == "object", r = n ? { ...e } : { ...t };
|
|
1058
1067
|
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || [
|
|
1059
1068
|
"polling",
|
|
1060
1069
|
"websocket",
|
|
1061
1070
|
"webtransport"
|
|
1062
|
-
]).map((e) =>
|
|
1071
|
+
]).map((e) => tt[e]).filter((e) => !!e)), super(n ? r : e, r);
|
|
1063
1072
|
}
|
|
1064
1073
|
};
|
|
1065
|
-
|
|
1074
|
+
st.protocol;
|
|
1066
1075
|
// ../../node_modules/.pnpm/socket.io-client@4.8.4_supports-color@8.1.1/node_modules/socket.io-client/build/esm/url.js
|
|
1067
|
-
function
|
|
1076
|
+
function ct(e, t = "", n) {
|
|
1068
1077
|
let r = e;
|
|
1069
1078
|
n ||= typeof location < "u" && location, e ??= n.protocol + "//" + n.host, typeof e == "string" && (e.charAt(0) === "/" && (e = e.charAt(1) === "/" ? n.protocol + e : n.host + e), /^(https?|wss?):\/\//.test(e) || (e = n === void 0 ? "https://" + e : n.protocol + "//" + e), r = F(e)), r.port || (/^(http|ws)$/.test(r.protocol) ? r.port = "80" : /^(http|ws)s$/.test(r.protocol) && (r.port = "443")), r.path = r.path || "/";
|
|
1070
1079
|
let i = r.host.indexOf(":") === -1 ? r.host : "[" + r.host + "]";
|
|
1071
1080
|
return r.id = r.protocol + "://" + i + ":" + r.port + t, r.href = r.protocol + "://" + i + (n && n.port === r.port ? "" : ":" + r.port), r;
|
|
1072
1081
|
}
|
|
1073
1082
|
// ../../node_modules/.pnpm/socket.io-parser@4.2.7_supports-color@8.1.1/node_modules/socket.io-parser/build/esm/is-binary.js
|
|
1074
|
-
var
|
|
1083
|
+
var lt = typeof ArrayBuffer == "function", ut = (e) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(e) : e.buffer instanceof ArrayBuffer, dt = Object.prototype.toString, ft = typeof Blob == "function" || typeof Blob < "u" && dt.call(Blob) === "[object BlobConstructor]", pt = typeof File == "function" || typeof File < "u" && dt.call(File) === "[object FileConstructor]";
|
|
1075
1084
|
function z(e) {
|
|
1076
|
-
return
|
|
1085
|
+
return lt && (e instanceof ArrayBuffer || ut(e)) || ft && e instanceof Blob || pt && e instanceof File;
|
|
1077
1086
|
}
|
|
1078
1087
|
function B(e, t) {
|
|
1079
1088
|
if (!e || typeof e != "object") return !1;
|
|
@@ -1087,7 +1096,7 @@ function B(e, t) {
|
|
|
1087
1096
|
return !1;
|
|
1088
1097
|
}
|
|
1089
1098
|
// ../../node_modules/.pnpm/socket.io-parser@4.2.7_supports-color@8.1.1/node_modules/socket.io-parser/build/esm/binary.js
|
|
1090
|
-
function
|
|
1099
|
+
function mt(e) {
|
|
1091
1100
|
let t = [], n = e.data, r = e;
|
|
1092
1101
|
return r.data = V(n, t), r.attachments = t.length, {
|
|
1093
1102
|
packet: r,
|
|
@@ -1116,7 +1125,7 @@ function V(e, t, n) {
|
|
|
1116
1125
|
}
|
|
1117
1126
|
return e;
|
|
1118
1127
|
}
|
|
1119
|
-
function
|
|
1128
|
+
function ht(e, t) {
|
|
1120
1129
|
return e.data = H(e.data, t), delete e.attachments, e;
|
|
1121
1130
|
}
|
|
1122
1131
|
function H(e, t) {
|
|
@@ -1130,13 +1139,13 @@ function H(e, t) {
|
|
|
1130
1139
|
return e;
|
|
1131
1140
|
}
|
|
1132
1141
|
// ../../node_modules/.pnpm/socket.io-parser@4.2.7_supports-color@8.1.1/node_modules/socket.io-parser/build/esm/index.js
|
|
1133
|
-
var
|
|
1134
|
-
Decoder: () =>
|
|
1135
|
-
Encoder: () =>
|
|
1142
|
+
var gt = /* @__PURE__ */ t({
|
|
1143
|
+
Decoder: () => yt,
|
|
1144
|
+
Encoder: () => vt,
|
|
1136
1145
|
PacketType: () => U,
|
|
1137
|
-
isPacketValid: () =>
|
|
1146
|
+
isPacketValid: () => Tt,
|
|
1138
1147
|
protocol: () => 5
|
|
1139
|
-
}),
|
|
1148
|
+
}), _t = [
|
|
1140
1149
|
"connect",
|
|
1141
1150
|
"connect_error",
|
|
1142
1151
|
"disconnect",
|
|
@@ -1147,7 +1156,7 @@ var ht = /* @__PURE__ */ t({
|
|
|
1147
1156
|
(function(e) {
|
|
1148
1157
|
e[e.CONNECT = 0] = "CONNECT", e[e.DISCONNECT = 1] = "DISCONNECT", e[e.EVENT = 2] = "EVENT", e[e.ACK = 3] = "ACK", e[e.CONNECT_ERROR = 4] = "CONNECT_ERROR", e[e.BINARY_EVENT = 5] = "BINARY_EVENT", e[e.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1149
1158
|
})(U ||= {});
|
|
1150
|
-
var
|
|
1159
|
+
var vt = class {
|
|
1151
1160
|
constructor(e) {
|
|
1152
1161
|
this.replacer = e;
|
|
1153
1162
|
}
|
|
@@ -1164,10 +1173,10 @@ var _t = class {
|
|
|
1164
1173
|
return (e.type === U.BINARY_EVENT || e.type === U.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
|
|
1165
1174
|
}
|
|
1166
1175
|
encodeAsBinary(e) {
|
|
1167
|
-
let t =
|
|
1176
|
+
let t = mt(e), n = this.encodeAsString(t.packet), r = t.buffers;
|
|
1168
1177
|
return r.unshift(n), r;
|
|
1169
1178
|
}
|
|
1170
|
-
},
|
|
1179
|
+
}, yt = class e extends O {
|
|
1171
1180
|
constructor(e) {
|
|
1172
1181
|
super(), this.opts = Object.assign({
|
|
1173
1182
|
reviver: void 0,
|
|
@@ -1180,7 +1189,7 @@ var _t = class {
|
|
|
1180
1189
|
if (this.reconstructor) throw Error("got plaintext data when reconstructing a packet");
|
|
1181
1190
|
t = this.decodeString(e);
|
|
1182
1191
|
let n = t.type === U.BINARY_EVENT;
|
|
1183
|
-
n || t.type === U.BINARY_ACK ? (t.type = n ? U.EVENT : U.ACK, this.reconstructor = new
|
|
1192
|
+
n || t.type === U.BINARY_ACK ? (t.type = n ? U.EVENT : U.ACK, this.reconstructor = new bt(t)) : super.emitReserved("decoded", t);
|
|
1184
1193
|
} else if (z(e) || e.base64) {
|
|
1185
1194
|
if (this.reconstructor) t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
1186
1195
|
else throw Error("got binary data when not reconstructing a packet");
|
|
@@ -1195,7 +1204,7 @@ var _t = class {
|
|
|
1195
1204
|
let i = t.substring(e, n);
|
|
1196
1205
|
if (i != Number(i) || t.charAt(n) !== "-") throw Error("Illegal attachments");
|
|
1197
1206
|
let a = Number(i);
|
|
1198
|
-
if (!
|
|
1207
|
+
if (!St(a) || a < 1) throw Error("Illegal attachments");
|
|
1199
1208
|
if (a > this.opts.maxAttachments) throw Error("too many attachments");
|
|
1200
1209
|
r.attachments = a;
|
|
1201
1210
|
}
|
|
@@ -1237,7 +1246,7 @@ var _t = class {
|
|
|
1237
1246
|
case U.DISCONNECT: return t === void 0;
|
|
1238
1247
|
case U.CONNECT_ERROR: return typeof t == "string" || W(t);
|
|
1239
1248
|
case U.EVENT:
|
|
1240
|
-
case U.BINARY_EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" &&
|
|
1249
|
+
case U.BINARY_EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && _t.indexOf(t[0]) === -1);
|
|
1241
1250
|
case U.ACK:
|
|
1242
1251
|
case U.BINARY_ACK: return Array.isArray(t);
|
|
1243
1252
|
}
|
|
@@ -1245,13 +1254,13 @@ var _t = class {
|
|
|
1245
1254
|
destroy() {
|
|
1246
1255
|
this.reconstructor &&= (this.reconstructor.finishedReconstruction(), null);
|
|
1247
1256
|
}
|
|
1248
|
-
},
|
|
1257
|
+
}, bt = class {
|
|
1249
1258
|
constructor(e) {
|
|
1250
1259
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
1251
1260
|
}
|
|
1252
1261
|
takeBinaryData(e) {
|
|
1253
1262
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
1254
|
-
let e =
|
|
1263
|
+
let e = ht(this.reconPack, this.buffers);
|
|
1255
1264
|
return this.finishedReconstruction(), e;
|
|
1256
1265
|
}
|
|
1257
1266
|
return null;
|
|
@@ -1260,30 +1269,30 @@ var _t = class {
|
|
|
1260
1269
|
this.reconPack = null, this.buffers = [];
|
|
1261
1270
|
}
|
|
1262
1271
|
};
|
|
1263
|
-
function
|
|
1272
|
+
function xt(e) {
|
|
1264
1273
|
return typeof e == "string";
|
|
1265
1274
|
}
|
|
1266
|
-
var
|
|
1275
|
+
var St = Number.isInteger || function(e) {
|
|
1267
1276
|
return typeof e == "number" && isFinite(e) && Math.floor(e) === e;
|
|
1268
1277
|
};
|
|
1269
|
-
function
|
|
1270
|
-
return e === void 0 ||
|
|
1278
|
+
function Ct(e) {
|
|
1279
|
+
return e === void 0 || St(e);
|
|
1271
1280
|
}
|
|
1272
1281
|
function W(e) {
|
|
1273
1282
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
1274
1283
|
}
|
|
1275
|
-
function
|
|
1284
|
+
function wt(e, t) {
|
|
1276
1285
|
switch (e) {
|
|
1277
1286
|
case U.CONNECT: return t === void 0 || W(t);
|
|
1278
1287
|
case U.DISCONNECT: return t === void 0;
|
|
1279
|
-
case U.EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" &&
|
|
1288
|
+
case U.EVENT: return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && _t.indexOf(t[0]) === -1);
|
|
1280
1289
|
case U.ACK: return Array.isArray(t);
|
|
1281
1290
|
case U.CONNECT_ERROR: return typeof t == "string" || W(t);
|
|
1282
1291
|
default: return !1;
|
|
1283
1292
|
}
|
|
1284
1293
|
}
|
|
1285
|
-
function
|
|
1286
|
-
return
|
|
1294
|
+
function Tt(e) {
|
|
1295
|
+
return xt(e.nsp) && Ct(e.id) && wt(e.type, e.data);
|
|
1287
1296
|
}
|
|
1288
1297
|
// ../../node_modules/.pnpm/socket.io-client@4.8.4_supports-color@8.1.1/node_modules/socket.io-client/build/esm/on.js
|
|
1289
1298
|
function G(e, t, n) {
|
|
@@ -1292,14 +1301,14 @@ function G(e, t, n) {
|
|
|
1292
1301
|
};
|
|
1293
1302
|
}
|
|
1294
1303
|
// ../../node_modules/.pnpm/socket.io-client@4.8.4_supports-color@8.1.1/node_modules/socket.io-client/build/esm/socket.js
|
|
1295
|
-
var
|
|
1304
|
+
var Et = Object.freeze({
|
|
1296
1305
|
connect: 1,
|
|
1297
1306
|
connect_error: 1,
|
|
1298
1307
|
disconnect: 1,
|
|
1299
1308
|
disconnecting: 1,
|
|
1300
1309
|
newListener: 1,
|
|
1301
1310
|
removeListener: 1
|
|
1302
|
-
}),
|
|
1311
|
+
}), Dt = class extends O {
|
|
1303
1312
|
constructor(e, t, n) {
|
|
1304
1313
|
super(), this.connected = !1, this.recovered = !1, this.receiveBuffer = [], this.sendBuffer = [], this._queue = [], this._queueSeq = 0, this.ids = 0, this.acks = {}, this.flags = {}, this.io = e, this.nsp = t, n && n.auth && (this.auth = n.auth), this._opts = Object.assign({}, n), this.io._autoConnect && this.open();
|
|
1305
1314
|
}
|
|
@@ -1329,7 +1338,7 @@ var Tt = Object.freeze({
|
|
|
1329
1338
|
return e.unshift("message"), this.emit.apply(this, e), this;
|
|
1330
1339
|
}
|
|
1331
1340
|
emit(e, ...t) {
|
|
1332
|
-
if (
|
|
1341
|
+
if (Et.hasOwnProperty(e)) throw Error("\"" + e.toString() + "\" is a reserved event name");
|
|
1333
1342
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile) return this._addToQueue(t), this;
|
|
1334
1343
|
let n = {
|
|
1335
1344
|
type: U.EVENT,
|
|
@@ -1556,7 +1565,7 @@ var q = class extends O {
|
|
|
1556
1565
|
max: this.reconnectionDelayMax(),
|
|
1557
1566
|
jitter: this.randomizationFactor()
|
|
1558
1567
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
1559
|
-
let n = t.parser ||
|
|
1568
|
+
let n = t.parser || gt;
|
|
1560
1569
|
this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
1561
1570
|
}
|
|
1562
1571
|
reconnection(e) {
|
|
@@ -1585,7 +1594,7 @@ var q = class extends O {
|
|
|
1585
1594
|
}
|
|
1586
1595
|
open(e) {
|
|
1587
1596
|
if (~this._readyState.indexOf("open")) return this;
|
|
1588
|
-
this.engine = new
|
|
1597
|
+
this.engine = new st(this.uri, this.opts);
|
|
1589
1598
|
let t = this.engine, n = this;
|
|
1590
1599
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
1591
1600
|
let r = G(t, "open", function() {
|
|
@@ -1631,7 +1640,7 @@ var q = class extends O {
|
|
|
1631
1640
|
}
|
|
1632
1641
|
socket(e, t) {
|
|
1633
1642
|
let n = this.nsps[e];
|
|
1634
|
-
return n ? this._autoConnect && !n.active && n.connect() : (n = new
|
|
1643
|
+
return n ? this._autoConnect && !n.active && n.connect() : (n = new Dt(this, e, t), this.nsps[e] = n), n;
|
|
1635
1644
|
}
|
|
1636
1645
|
_destroy(e) {
|
|
1637
1646
|
let t = Object.keys(this.nsps);
|
|
@@ -1679,17 +1688,17 @@ var q = class extends O {
|
|
|
1679
1688
|
}, J = {};
|
|
1680
1689
|
function Y(e, t) {
|
|
1681
1690
|
typeof e == "object" && (t = e, e = void 0), t ||= {};
|
|
1682
|
-
let n =
|
|
1691
|
+
let n = ct(e, t.path || "/socket.io"), r = n.source, i = n.id, a = n.path, o = J[i] && a in J[i].nsps, s = t.forceNew || t["force new connection"] || !1 === t.multiplex || o, c;
|
|
1683
1692
|
return s ? c = new q(r, t) : (J[i] || (J[i] = new q(r, t)), c = J[i]), n.query && !t.query && (t.query = n.queryKey), c.socket(n.path, t);
|
|
1684
1693
|
}
|
|
1685
1694
|
Object.assign(Y, {
|
|
1686
1695
|
Manager: q,
|
|
1687
|
-
Socket:
|
|
1696
|
+
Socket: Dt,
|
|
1688
1697
|
io: Y,
|
|
1689
1698
|
connect: Y
|
|
1690
1699
|
});
|
|
1691
1700
|
// src/sdk-socket.ts
|
|
1692
|
-
function
|
|
1701
|
+
function Ot(e) {
|
|
1693
1702
|
let t = e.replace(/\/$/, "");
|
|
1694
1703
|
try {
|
|
1695
1704
|
return `${new URL(t).origin}/sdk`;
|
|
@@ -1697,7 +1706,7 @@ function Dt(e) {
|
|
|
1697
1706
|
return `${t}/sdk`;
|
|
1698
1707
|
}
|
|
1699
1708
|
}
|
|
1700
|
-
var
|
|
1709
|
+
var kt = class {
|
|
1701
1710
|
constructor() {
|
|
1702
1711
|
this.socket = null;
|
|
1703
1712
|
}
|
|
@@ -1706,7 +1715,7 @@ var Ot = class {
|
|
|
1706
1715
|
}
|
|
1707
1716
|
connect(e) {
|
|
1708
1717
|
this.disconnect();
|
|
1709
|
-
let t =
|
|
1718
|
+
let t = Ot(e.baseUrl);
|
|
1710
1719
|
this.socket = Y(t, {
|
|
1711
1720
|
auth: {
|
|
1712
1721
|
apiKey: e.apiKey,
|
|
@@ -1730,54 +1739,54 @@ var Ot = class {
|
|
|
1730
1739
|
disconnect() {
|
|
1731
1740
|
this.socket &&= (this.socket.removeAllListeners(), this.socket.disconnect(), null);
|
|
1732
1741
|
}
|
|
1733
|
-
},
|
|
1734
|
-
function
|
|
1742
|
+
}, At = "onedeskpro_visitor_token";
|
|
1743
|
+
function jt(e) {
|
|
1735
1744
|
try {
|
|
1736
1745
|
return typeof window < "u" ? window.localStorage.getItem(e) : null;
|
|
1737
1746
|
} catch {
|
|
1738
1747
|
return null;
|
|
1739
1748
|
}
|
|
1740
1749
|
}
|
|
1741
|
-
function
|
|
1750
|
+
function Mt(e, t) {
|
|
1742
1751
|
try {
|
|
1743
1752
|
typeof window < "u" && window.localStorage.setItem(e, t);
|
|
1744
1753
|
} catch {}
|
|
1745
1754
|
}
|
|
1746
|
-
function
|
|
1755
|
+
function Nt(e) {
|
|
1747
1756
|
try {
|
|
1748
1757
|
typeof window < "u" && window.localStorage.removeItem(e);
|
|
1749
1758
|
} catch {}
|
|
1750
1759
|
}
|
|
1751
|
-
var
|
|
1760
|
+
var Pt = class {
|
|
1752
1761
|
constructor() {
|
|
1753
|
-
this.token = null, this.storageKey =
|
|
1762
|
+
this.token = null, this.storageKey = At;
|
|
1754
1763
|
}
|
|
1755
1764
|
setScope(e) {
|
|
1756
|
-
this.storageKey = e?.trim() ? `${
|
|
1765
|
+
this.storageKey = e?.trim() ? `${At}:${e.trim()}` : At, this.token = jt(this.storageKey);
|
|
1757
1766
|
}
|
|
1758
1767
|
get() {
|
|
1759
|
-
return this.token ??
|
|
1768
|
+
return this.token ?? jt(this.storageKey);
|
|
1760
1769
|
}
|
|
1761
1770
|
set(e) {
|
|
1762
|
-
this.token = e,
|
|
1771
|
+
this.token = e, Mt(this.storageKey, e);
|
|
1763
1772
|
}
|
|
1764
1773
|
clear() {
|
|
1765
|
-
this.token = null,
|
|
1774
|
+
this.token = null, Nt(this.storageKey);
|
|
1766
1775
|
}
|
|
1767
|
-
},
|
|
1776
|
+
}, Ft = 300, It = 250, Lt = 100, Rt = [
|
|
1768
1777
|
"audio/webm;codecs=opus",
|
|
1769
1778
|
"audio/webm",
|
|
1770
1779
|
"audio/mp4",
|
|
1771
1780
|
"audio/ogg;codecs=opus"
|
|
1772
1781
|
];
|
|
1773
|
-
function
|
|
1774
|
-
return typeof MediaRecorder > "u" || typeof MediaRecorder.isTypeSupported != "function" ? "audio/webm" :
|
|
1782
|
+
function zt() {
|
|
1783
|
+
return typeof MediaRecorder > "u" || typeof MediaRecorder.isTypeSupported != "function" ? "audio/webm" : Rt.find((e) => MediaRecorder.isTypeSupported(e)) ?? "audio/webm";
|
|
1775
1784
|
}
|
|
1776
|
-
function
|
|
1785
|
+
function Bt(e) {
|
|
1777
1786
|
let t = e instanceof DOMException ? e.name : "";
|
|
1778
1787
|
return t === "NotAllowedError" || t === "PermissionDeniedError" || t === "SecurityError" ? "Microphone access was denied." : t === "NotFoundError" || t === "DevicesNotFoundError" ? "No microphone was found." : "Could not start recording.";
|
|
1779
1788
|
}
|
|
1780
|
-
var
|
|
1789
|
+
var Vt = class e {
|
|
1781
1790
|
constructor(e, t = 300) {
|
|
1782
1791
|
this.onChange = e, this.maxDurationSeconds = t, this.recorder = null, this.stream = null, this.chunks = [], this.mimeType = "audio/webm", this.startedAt = 0, this.tickTimer = null, this.levelTimer = null, this.maxTimer = null, this.audioContext = null, this.analyser = null, this.snapshot = {
|
|
1783
1792
|
state: "idle",
|
|
@@ -1799,20 +1808,20 @@ var Bt = class e {
|
|
|
1799
1808
|
try {
|
|
1800
1809
|
t = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
1801
1810
|
} catch (e) {
|
|
1802
|
-
throw Error(
|
|
1811
|
+
throw Error(Bt(e));
|
|
1803
1812
|
}
|
|
1804
1813
|
try {
|
|
1805
|
-
this.mimeType =
|
|
1814
|
+
this.mimeType = zt();
|
|
1806
1815
|
let e = new MediaRecorder(t, { mimeType: this.mimeType });
|
|
1807
1816
|
e.ondataavailable = (e) => {
|
|
1808
1817
|
e.data.size > 0 && this.chunks.push(e.data);
|
|
1809
1818
|
}, this.stream = t, this.recorder = e, this.startedAt = Date.now(), e.start(200);
|
|
1810
1819
|
} catch (e) {
|
|
1811
|
-
throw t.getTracks().forEach((e) => e.stop()), this.stream = null, this.recorder = null, Error(
|
|
1820
|
+
throw t.getTracks().forEach((e) => e.stop()), this.stream = null, this.recorder = null, Error(Bt(e));
|
|
1812
1821
|
}
|
|
1813
1822
|
this.startLevelMeter(t), this.tickTimer = setInterval(() => {
|
|
1814
1823
|
this.update({ elapsedSeconds: Math.floor(this.elapsedMs() / 1e3) });
|
|
1815
|
-
},
|
|
1824
|
+
}, It), this.maxTimer = setTimeout(() => void this.stop(), this.maxDurationSeconds * 1e3), this.update({
|
|
1816
1825
|
state: "recording",
|
|
1817
1826
|
elapsedSeconds: 0,
|
|
1818
1827
|
level: 0,
|
|
@@ -1887,7 +1896,7 @@ var Bt = class e {
|
|
|
1887
1896
|
e += n * n;
|
|
1888
1897
|
}
|
|
1889
1898
|
this.update({ level: Math.min(1, Math.sqrt(e / i.length) * 3.2) });
|
|
1890
|
-
},
|
|
1899
|
+
}, Lt);
|
|
1891
1900
|
} catch {}
|
|
1892
1901
|
}
|
|
1893
1902
|
clearTimers() {
|
|
@@ -1905,7 +1914,7 @@ var Bt = class e {
|
|
|
1905
1914
|
}
|
|
1906
1915
|
this.chunks = [], this.releaseMedia();
|
|
1907
1916
|
}
|
|
1908
|
-
},
|
|
1917
|
+
}, Ht = [
|
|
1909
1918
|
{
|
|
1910
1919
|
iso: "BD",
|
|
1911
1920
|
name: "Bangladesh",
|
|
@@ -2272,8 +2281,8 @@ var Bt = class e {
|
|
|
2272
2281
|
dial: "977",
|
|
2273
2282
|
flag: "🇳🇵"
|
|
2274
2283
|
}
|
|
2275
|
-
],
|
|
2276
|
-
function
|
|
2284
|
+
], Ut = Ht.find((e) => e.iso === "BD") ?? Ht[0];
|
|
2285
|
+
function Wt(e, t) {
|
|
2277
2286
|
let n = t.trim();
|
|
2278
2287
|
if (n.startsWith("+")) {
|
|
2279
2288
|
let e = n.replace(/\D/g, "");
|
|
@@ -2283,8 +2292,8 @@ function Ut(e, t) {
|
|
|
2283
2292
|
return !r || (r = r.replace(/^0+/, ""), !r) ? "" : `+${e}${r}`;
|
|
2284
2293
|
}
|
|
2285
2294
|
// src/widget/styles.ts
|
|
2286
|
-
var
|
|
2287
|
-
function
|
|
2295
|
+
var Gt = "(max-width: 640px), (max-height: 500px) and (pointer: coarse)";
|
|
2296
|
+
function Kt(e, t) {
|
|
2288
2297
|
let n = `
|
|
2289
2298
|
--ttcb-bg: #ffffff;
|
|
2290
2299
|
--ttcb-bg-secondary: #f3f4f6;
|
|
@@ -2950,7 +2959,7 @@ function Gt(e, t) {
|
|
|
2950
2959
|
|
|
2951
2960
|
.ttcb-footer.hidden, .ttcb-messages.hidden { display: none; }
|
|
2952
2961
|
|
|
2953
|
-
@media ${
|
|
2962
|
+
@media ${Gt} {
|
|
2954
2963
|
.ttcb-fab.bottom-right { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
|
|
2955
2964
|
.ttcb-fab.bottom-left { left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
|
|
2956
2965
|
/* The open panel covers the launcher; its own close button takes over. */
|
|
@@ -3017,18 +3026,18 @@ function Gt(e, t) {
|
|
|
3017
3026
|
`;
|
|
3018
3027
|
}
|
|
3019
3028
|
// src/widget/render.ts
|
|
3020
|
-
function
|
|
3029
|
+
function qt(e) {
|
|
3021
3030
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3022
3031
|
}
|
|
3023
|
-
function
|
|
3032
|
+
function Jt(e) {
|
|
3024
3033
|
let t = [], n = e.replace(/```[\w]*\n?([\s\S]*?)```/g, (e, n) => {
|
|
3025
3034
|
let r = t.length;
|
|
3026
|
-
return t.push(`<pre><code>${
|
|
3035
|
+
return t.push(`<pre><code>${qt(n.trim())}</code></pre>`), `\x04${r}\x05`;
|
|
3027
3036
|
});
|
|
3028
3037
|
n = n.replace(/`([^`\n]+)`/g, (e, n) => {
|
|
3029
3038
|
let r = t.length;
|
|
3030
|
-
return t.push(`<code>${
|
|
3031
|
-
}), n =
|
|
3039
|
+
return t.push(`<code>${qt(n)}</code>`), `\x02${r}\x03`;
|
|
3040
|
+
}), n = qt(n);
|
|
3032
3041
|
let r = n.split("\n"), i = [], a = "", o = () => {
|
|
3033
3042
|
a &&= (i.push(`</${a}>`), "");
|
|
3034
3043
|
};
|
|
@@ -3045,71 +3054,71 @@ function qt(e) {
|
|
|
3045
3054
|
}).join("") : "";
|
|
3046
3055
|
}).filter(Boolean).join(""), n = n.replace(/\x04(\d+)\x05/g, (e, n) => t[+n] ?? "").replace(/\x02(\d+)\x03/g, (e, n) => t[+n] ?? ""), n;
|
|
3047
3056
|
}
|
|
3048
|
-
function
|
|
3057
|
+
function Yt() {
|
|
3049
3058
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/>\n <line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"14\"/>\n <line x1=\"9\" y1=\"11\" x2=\"15\" y2=\"11\"/>\n </svg>";
|
|
3050
3059
|
}
|
|
3051
|
-
function
|
|
3060
|
+
function Xt() {
|
|
3052
3061
|
return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M20 2H4C2.9 2 2 2.9 2 4v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z\"/>\n </svg>";
|
|
3053
3062
|
}
|
|
3054
|
-
function
|
|
3063
|
+
function Zt() {
|
|
3055
3064
|
return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"/>\n </svg>";
|
|
3056
3065
|
}
|
|
3057
|
-
function
|
|
3066
|
+
function Qt() {
|
|
3058
3067
|
return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z\"/>\n </svg>";
|
|
3059
3068
|
}
|
|
3060
3069
|
function X() {
|
|
3061
3070
|
return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3zm-2 10H6V7h12v12zm-9-6c-.83 0-1.5-.67-1.5-1.5S8.17 10 9 10s1.5.67 1.5 1.5S9.83 13 9 13zm6 0c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13z\"/>\n </svg>";
|
|
3062
3071
|
}
|
|
3063
|
-
function
|
|
3072
|
+
function $t() {
|
|
3064
3073
|
return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\"/>\n </svg>";
|
|
3065
3074
|
}
|
|
3066
|
-
function
|
|
3075
|
+
function en() {
|
|
3067
3076
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2\"/>\n <circle cx=\"12\" cy=\"7\" r=\"4\"/>\n </svg>";
|
|
3068
3077
|
}
|
|
3069
|
-
function
|
|
3078
|
+
function tn() {
|
|
3070
3079
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z\"/>\n <polyline points=\"22,6 12,13 2,6\"/>\n </svg>";
|
|
3071
3080
|
}
|
|
3072
|
-
function
|
|
3081
|
+
function nn() {
|
|
3073
3082
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <polyline points=\"6 9 12 15 18 9\"/>\n </svg>";
|
|
3074
3083
|
}
|
|
3075
|
-
function
|
|
3084
|
+
function rn() {
|
|
3076
3085
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>\n <polyline points=\"12 5 19 12 12 19\"/>\n </svg>";
|
|
3077
3086
|
}
|
|
3078
|
-
function
|
|
3087
|
+
function an() {
|
|
3079
3088
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z\"/>\n <polyline points=\"9 12 11 14 15 10\"/>\n </svg>";
|
|
3080
3089
|
}
|
|
3081
|
-
function
|
|
3090
|
+
function on() {
|
|
3082
3091
|
return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"currentColor\"/>\n <path d=\"M9 12l2 2 4-4\" fill=\"none\" stroke=\"#fff\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>";
|
|
3083
3092
|
}
|
|
3084
|
-
function
|
|
3093
|
+
function sn() {
|
|
3085
3094
|
return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill=\"#F59E0B\" d=\"M8 2.5l1.1 2.2 2.4.3-1.7 1.7.4 2.4L8 8l-2.2 1.1.4-2.4L4.5 5l2.4-.3L8 2.5z\"/>\n <path fill=\"#F59E0B\" d=\"M16 3.5l.8 1.6 1.8.2-1.3 1.3.3 1.8L16 7.5l-1.6.9.3-1.8-1.3-1.3 1.8-.2L16 3.5z\"/>\n <path fill=\"#FBBF24\" d=\"M12 11.5l1 2 2.2.3-1.6 1.6.4 2.2-2-1.1-2 1.1.4-2.2-1.6-1.6 2.2-.3 1-2z\"/>\n </svg>";
|
|
3086
3095
|
}
|
|
3087
|
-
function
|
|
3096
|
+
function cn() {
|
|
3088
3097
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2\"/>\n <circle cx=\"9\" cy=\"7\" r=\"4\"/>\n <path d=\"M23 21v-2a4 4 0 0 0-3-3.87\"/>\n <path d=\"M16 3.13a4 4 0 0 1 0 7.75\"/>\n </svg>";
|
|
3089
3098
|
}
|
|
3090
|
-
function
|
|
3099
|
+
function ln() {
|
|
3091
3100
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/>\n <line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>\n </svg>";
|
|
3092
3101
|
}
|
|
3093
|
-
function
|
|
3102
|
+
function un() {
|
|
3094
3103
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48\"/>\n </svg>";
|
|
3095
3104
|
}
|
|
3096
|
-
function
|
|
3105
|
+
function dn() {
|
|
3097
3106
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"/>\n <circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/>\n <polyline points=\"21 15 16 10 5 21\"/>\n </svg>";
|
|
3098
3107
|
}
|
|
3099
|
-
function
|
|
3108
|
+
function fn() {
|
|
3100
3109
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z\"/>\n <path d=\"M19 10v2a7 7 0 0 1-14 0v-2\"/>\n <line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"23\"/>\n <line x1=\"8\" y1=\"23\" x2=\"16\" y2=\"23\"/>\n </svg>";
|
|
3101
3110
|
}
|
|
3102
|
-
function
|
|
3111
|
+
function pn() {
|
|
3103
3112
|
return "<svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" fill=\"currentColor\"/>\n </svg>";
|
|
3104
3113
|
}
|
|
3105
|
-
function
|
|
3114
|
+
function mn() {
|
|
3106
3115
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <polyline points=\"3 6 5 6 21 6\"/>\n <path d=\"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6\"/>\n <path d=\"M10 11v6\"/>\n <path d=\"M14 11v6\"/>\n <path d=\"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2\"/>\n </svg>";
|
|
3107
3116
|
}
|
|
3108
|
-
function
|
|
3117
|
+
function hn() {
|
|
3109
3118
|
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"/>\n <polyline points=\"14 2 14 8 20 8\"/>\n </svg>";
|
|
3110
3119
|
}
|
|
3111
|
-
function
|
|
3112
|
-
let t =
|
|
3120
|
+
function gn(e) {
|
|
3121
|
+
let t = ee(e.url) ? e.url : "", n = e.type.toLowerCase();
|
|
3113
3122
|
if (t && n.startsWith("image/")) {
|
|
3114
3123
|
let n = document.createElement("a");
|
|
3115
3124
|
n.className = "ttcb-attachment ttcb-attachment-image", n.href = t, n.target = "_blank", n.rel = "noopener noreferrer", n.setAttribute("aria-label", `Open ${e.fileName}`);
|
|
@@ -3133,23 +3142,23 @@ function hn(e) {
|
|
|
3133
3142
|
let r = document.createElement(t ? "a" : "div");
|
|
3134
3143
|
r.className = "ttcb-attachment ttcb-attachment-file", r instanceof HTMLAnchorElement && (r.href = t, r.target = "_blank", r.rel = "noopener noreferrer");
|
|
3135
3144
|
let i = document.createElement("span");
|
|
3136
|
-
i.className = "ttcb-attachment-icon", i.setAttribute("aria-hidden", "true"), i.innerHTML =
|
|
3145
|
+
i.className = "ttcb-attachment-icon", i.setAttribute("aria-hidden", "true"), i.innerHTML = hn();
|
|
3137
3146
|
let a = document.createElement("span");
|
|
3138
3147
|
a.className = "ttcb-attachment-meta";
|
|
3139
3148
|
let o = document.createElement("span");
|
|
3140
3149
|
o.className = "ttcb-attachment-name", o.textContent = e.fileName, a.appendChild(o);
|
|
3141
|
-
let s =
|
|
3150
|
+
let s = ne(e.size);
|
|
3142
3151
|
if (s) {
|
|
3143
3152
|
let e = document.createElement("span");
|
|
3144
3153
|
e.className = "ttcb-attachment-size", e.textContent = s, a.appendChild(e);
|
|
3145
3154
|
}
|
|
3146
3155
|
return r.appendChild(i), r.appendChild(a), r;
|
|
3147
3156
|
}
|
|
3148
|
-
function
|
|
3157
|
+
function _n(e) {
|
|
3149
3158
|
let { type: t, content: n } = e, r = e.attachments ?? [], i = document.createElement("div");
|
|
3150
3159
|
i.className = `ttcb-msg ${t}`, e.pending && i.classList.add("ttcb-pending");
|
|
3151
3160
|
let a = document.createElement("div");
|
|
3152
|
-
a.className = "ttcb-msg-avatar", a.innerHTML = t === "human" ?
|
|
3161
|
+
a.className = "ttcb-msg-avatar", a.innerHTML = t === "human" ? $t() : t === "agent" ? en() : X();
|
|
3153
3162
|
let o = document.createElement("div");
|
|
3154
3163
|
if (o.className = "ttcb-msg-body", t === "agent") {
|
|
3155
3164
|
let e = document.createElement("span");
|
|
@@ -3158,12 +3167,12 @@ function gn(e) {
|
|
|
3158
3167
|
if (r.length > 0) {
|
|
3159
3168
|
let e = document.createElement("div");
|
|
3160
3169
|
e.className = "ttcb-attachments";
|
|
3161
|
-
for (let t of r) e.appendChild(
|
|
3170
|
+
for (let t of r) e.appendChild(gn(t));
|
|
3162
3171
|
o.appendChild(e);
|
|
3163
3172
|
}
|
|
3164
|
-
if (r.length === 0 || !
|
|
3173
|
+
if (r.length === 0 || !ie(n, r)) {
|
|
3165
3174
|
let e = document.createElement("div");
|
|
3166
|
-
e.className = "ttcb-bubble", t === "human" ? e.textContent = n : e.innerHTML =
|
|
3175
|
+
e.className = "ttcb-bubble", t === "human" ? e.textContent = n : e.innerHTML = Jt(n), o.appendChild(e);
|
|
3167
3176
|
}
|
|
3168
3177
|
if (e.pending) {
|
|
3169
3178
|
let e = document.createElement("span");
|
|
@@ -3171,7 +3180,7 @@ function gn(e) {
|
|
|
3171
3180
|
}
|
|
3172
3181
|
return i.appendChild(a), i.appendChild(o), i;
|
|
3173
3182
|
}
|
|
3174
|
-
function
|
|
3183
|
+
function vn() {
|
|
3175
3184
|
let e = document.createElement("div");
|
|
3176
3185
|
e.className = "ttcb-msg ai", e.id = "ttcb-typing";
|
|
3177
3186
|
let t = document.createElement("div");
|
|
@@ -3180,20 +3189,20 @@ function _n() {
|
|
|
3180
3189
|
return n.className = "ttcb-typing", n.innerHTML = "<span></span><span></span><span></span>", e.appendChild(t), e.appendChild(n), e;
|
|
3181
3190
|
}
|
|
3182
3191
|
// src/widget/widget.ts
|
|
3183
|
-
var
|
|
3192
|
+
var yn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mpeg,audio/wav,audio/x-m4a,audio/aac,audio/opus,application/pdf,text/csv", bn = "image/jpeg,image/png,image/gif", xn = class {
|
|
3184
3193
|
constructor(e, t) {
|
|
3185
|
-
this.stopViewportSync = null, this.confirmingNew = !1, this.actionPending = !1, this.ticketMode = "ai", this.pendingFiles = [], this.attachMenuOpen = !1, this.recorder = null, this.voicePreviewUrl = "", this.selectedCountry =
|
|
3194
|
+
this.stopViewportSync = null, this.confirmingNew = !1, this.actionPending = !1, this.ticketMode = "ai", this.pendingFiles = [], this.attachMenuOpen = !1, this.recorder = null, this.voicePreviewUrl = "", this.selectedCountry = Ut, this.countryOpen = !1, this.isOpen = !1, this.destroyed = !1, this.position = e.position ?? "bottom-right", this.callbacks = t, this.autoOpen = e.autoOpen === !0, this.mount(e);
|
|
3186
3195
|
}
|
|
3187
3196
|
mount(e) {
|
|
3188
3197
|
this.host = document.createElement("div"), this.host.id = "onedeskpro-chatbot-host", this.host.style.display = "none", this.shadow = this.host.attachShadow({ mode: "closed" });
|
|
3189
3198
|
let t = document.createElement("style");
|
|
3190
|
-
t.textContent =
|
|
3199
|
+
t.textContent = Kt(e.primaryColor ?? "#2563EB", e.theme ?? "auto"), this.shadow.appendChild(t), this.fab = document.createElement("button"), this.fab.className = `ttcb-fab ${this.position}`, this.fab.setAttribute("aria-label", "Open chat"), this.fab.innerHTML = Xt(), this.fab.addEventListener("click", () => this.toggle()), this.shadow.appendChild(this.fab), this.panel = document.createElement("div"), this.panel.className = `ttcb-panel ${this.position} hidden ttcb-mode-compact`, this.panel.tabIndex = -1, this.panel.setAttribute("role", "dialog"), this.panel.setAttribute("aria-modal", "true"), this.panel.setAttribute("aria-label", e.chatbotName ?? "AI Assistant"), this.panel.appendChild(this.buildHeader(e)), this.identifyContainer = document.createElement("div"), this.identifyContainer.className = "ttcb-identify", this.buildIdentifyForm(this.identifyContainer), this.panel.appendChild(this.identifyContainer), this.messagesContainer = document.createElement("div"), this.messagesContainer.className = "ttcb-messages", this.messagesContainer.setAttribute("aria-live", "polite"), this.messagesContainer.setAttribute("aria-label", "Chat messages"), this.panel.appendChild(this.messagesContainer), this.modeBanner = document.createElement("div"), this.modeBanner.className = "ttcb-mode-banner", this.modeBannerText = document.createElement("span"), this.modeBannerText.className = "ttcb-mode-banner-text", this.modeBannerText.setAttribute("role", "status"), this.cancelHumanBtn = this.buildBannerButton("Cancel request", () => {
|
|
3191
3200
|
this.actionPending || this.callbacks.onCancelHumanRequest();
|
|
3192
3201
|
}), this.cancelHumanBtn.classList.add("hidden"), this.modeBanner.appendChild(this.modeBannerText), this.modeBanner.appendChild(this.cancelHumanBtn), this.panel.appendChild(this.modeBanner), this.panel.appendChild(this.buildConfirmNewBar()), this.footer = document.createElement("div"), this.footer.className = "ttcb-footer", this.pendingTray = document.createElement("div"), this.pendingTray.className = "ttcb-pending-tray", this.pendingTray.setAttribute("role", "list"), this.pendingTray.setAttribute("aria-label", "Files to send"), this.footer.appendChild(this.pendingTray), this.composeError = document.createElement("p"), this.composeError.className = "ttcb-compose-error", this.composeError.setAttribute("role", "alert"), this.footer.appendChild(this.composeError), this.footer.appendChild(this.buildVoiceBar()), this.footer.appendChild(this.buildVoicePreview());
|
|
3193
3202
|
let n = document.createElement("form");
|
|
3194
3203
|
n.className = "ttcb-form", n.addEventListener("submit", (e) => {
|
|
3195
3204
|
e.preventDefault(), this.handleSend();
|
|
3196
|
-
}), this.composeForm = n, n.appendChild(this.buildAttachControls()), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "ttcb-input", this.input.placeholder = e.placeholder ?? "Type your message…", this.input.setAttribute("aria-label", "Message input"), this.input.setAttribute("autocomplete", "off"), this.sendBtn = document.createElement("button"), this.sendBtn.type = "submit", this.sendBtn.className = "ttcb-send-btn", this.sendBtn.innerHTML =
|
|
3205
|
+
}), this.composeForm = n, n.appendChild(this.buildAttachControls()), this.input = document.createElement("input"), this.input.type = "text", this.input.className = "ttcb-input", this.input.placeholder = e.placeholder ?? "Type your message…", this.input.setAttribute("aria-label", "Message input"), this.input.setAttribute("autocomplete", "off"), this.sendBtn = document.createElement("button"), this.sendBtn.type = "submit", this.sendBtn.className = "ttcb-send-btn", this.sendBtn.innerHTML = Qt(), this.sendBtn.setAttribute("aria-label", "Send message"), this.micBtn = document.createElement("button"), this.micBtn.type = "button", this.micBtn.className = "ttcb-mic-btn", this.micBtn.setAttribute("aria-label", "Record voice message"), this.micBtn.title = "Record voice message", this.micBtn.innerHTML = fn(), this.micBtn.addEventListener("click", () => void this.startVoice()), n.appendChild(this.input), n.appendChild(this.micBtn), n.appendChild(this.sendBtn), this.footer.appendChild(n), this.panel.appendChild(this.footer), this.shadow.appendChild(this.panel), this.shadow.addEventListener("click", (e) => {
|
|
3197
3206
|
let t = e.target;
|
|
3198
3207
|
this.attachMenuOpen && !(t && (this.attachBtn.contains(t) || this.attachMenu.contains(t))) && this.closeAttachMenu(), this.countryOpen && (t && (this.dialBtn.contains(t) || this.countryPopover.contains(t)) || this.closeCountryPopover());
|
|
3199
3208
|
}), this.panel.addEventListener("keydown", (e) => {
|
|
@@ -3215,7 +3224,7 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3215
3224
|
let a = document.createElement("div");
|
|
3216
3225
|
a.className = "ttcb-header-title-row", this.headerTitle = document.createElement("span"), this.headerTitle.className = "ttcb-header-title", this.headerTitle.textContent = e.chatbotName ?? "AI Assistant";
|
|
3217
3226
|
let o = document.createElement("span");
|
|
3218
|
-
o.className = "ttcb-verified", o.setAttribute("aria-label", "Verified"), o.innerHTML =
|
|
3227
|
+
o.className = "ttcb-verified", o.setAttribute("aria-label", "Verified"), o.innerHTML = on(), a.appendChild(this.headerTitle), a.appendChild(o);
|
|
3219
3228
|
let s = document.createElement("div");
|
|
3220
3229
|
s.className = "ttcb-header-meta";
|
|
3221
3230
|
let c = document.createElement("span");
|
|
@@ -3223,13 +3232,13 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3223
3232
|
let l = document.createElement("span");
|
|
3224
3233
|
l.className = "ttcb-meta-sep", l.setAttribute("aria-hidden", "true");
|
|
3225
3234
|
let u = document.createElement("span");
|
|
3226
|
-
u.className = "ttcb-meta-replies", u.innerHTML = `${
|
|
3235
|
+
u.className = "ttcb-meta-replies", u.innerHTML = `${sn()}<span>Replies instantly</span>`, s.appendChild(c), s.appendChild(l), s.appendChild(u), i.appendChild(a), i.appendChild(s);
|
|
3227
3236
|
let d = document.createElement("div");
|
|
3228
|
-
d.className = "ttcb-header-actions", this.requestHumanBtn = document.createElement("button"), this.requestHumanBtn.type = "button", this.requestHumanBtn.className = "ttcb-request-human-btn hidden", this.requestHumanBtn.id = "ttcb-request-human-btn", this.requestHumanBtn.setAttribute("aria-label", "Request human agent"), this.requestHumanBtn.title = "Request human agent", this.requestHumanBtn.innerHTML =
|
|
3237
|
+
d.className = "ttcb-header-actions", this.requestHumanBtn = document.createElement("button"), this.requestHumanBtn.type = "button", this.requestHumanBtn.className = "ttcb-request-human-btn hidden", this.requestHumanBtn.id = "ttcb-request-human-btn", this.requestHumanBtn.setAttribute("aria-label", "Request human agent"), this.requestHumanBtn.title = "Request human agent", this.requestHumanBtn.innerHTML = cn(), this.requestHumanBtn.addEventListener("click", () => this.callbacks.onRequestHuman()), this.newSessionBtn = document.createElement("button"), this.newSessionBtn.type = "button", this.newSessionBtn.className = "ttcb-new-session-btn hidden", this.newSessionBtn.setAttribute("aria-label", "New conversation"), this.newSessionBtn.title = "New conversation", this.newSessionBtn.innerHTML = Yt(), this.newSessionBtn.addEventListener("click", () => {
|
|
3229
3238
|
this.actionPending || (this.ticketMode === "closed" ? this.callbacks.onNewConversation() : this.showConfirmNew());
|
|
3230
3239
|
});
|
|
3231
3240
|
let f = document.createElement("button");
|
|
3232
|
-
return f.className = "ttcb-close-btn", f.setAttribute("aria-label", "Close chat"), f.innerHTML =
|
|
3241
|
+
return f.className = "ttcb-close-btn", f.setAttribute("aria-label", "Close chat"), f.innerHTML = Zt(), f.addEventListener("click", () => this.close()), d.appendChild(this.requestHumanBtn), d.appendChild(this.newSessionBtn), d.appendChild(f), t.appendChild(n), t.appendChild(i), t.appendChild(d), t;
|
|
3233
3242
|
}
|
|
3234
3243
|
buildBannerButton(e, t) {
|
|
3235
3244
|
let n = document.createElement("button");
|
|
@@ -3262,16 +3271,16 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3262
3271
|
}
|
|
3263
3272
|
buildAttachControls() {
|
|
3264
3273
|
let e = document.createElement("div");
|
|
3265
|
-
e.className = "ttcb-attach", this.attachBtn = document.createElement("button"), this.attachBtn.type = "button", this.attachBtn.className = "ttcb-attach-btn", this.attachBtn.setAttribute("aria-label", "Add attachment"), this.attachBtn.setAttribute("aria-haspopup", "menu"), this.attachBtn.setAttribute("aria-expanded", "false"), this.attachBtn.title = "Add attachment", this.attachBtn.innerHTML =
|
|
3274
|
+
e.className = "ttcb-attach", this.attachBtn = document.createElement("button"), this.attachBtn.type = "button", this.attachBtn.className = "ttcb-attach-btn", this.attachBtn.setAttribute("aria-label", "Add attachment"), this.attachBtn.setAttribute("aria-haspopup", "menu"), this.attachBtn.setAttribute("aria-expanded", "false"), this.attachBtn.title = "Add attachment", this.attachBtn.innerHTML = ln(), this.attachBtn.addEventListener("click", (e) => {
|
|
3266
3275
|
e.preventDefault(), e.stopPropagation(), this.toggleAttachMenu();
|
|
3267
|
-
}), this.attachMenu = document.createElement("div"), this.attachMenu.className = "ttcb-attach-menu", this.attachMenu.setAttribute("role", "menu"), this.attachFileInput = this.createFileInput(
|
|
3276
|
+
}), this.attachMenu = document.createElement("div"), this.attachMenu.className = "ttcb-attach-menu", this.attachMenu.setAttribute("role", "menu"), this.attachFileInput = this.createFileInput(yn, "Choose files"), this.attachPhotoInput = this.createFileInput(bn, "Choose photos");
|
|
3268
3277
|
let t = [{
|
|
3269
3278
|
label: "Attachment",
|
|
3270
|
-
icon:
|
|
3279
|
+
icon: un(),
|
|
3271
3280
|
input: this.attachFileInput
|
|
3272
3281
|
}, {
|
|
3273
3282
|
label: "Photo",
|
|
3274
|
-
icon:
|
|
3283
|
+
icon: dn(),
|
|
3275
3284
|
input: this.attachPhotoInput
|
|
3276
3285
|
}];
|
|
3277
3286
|
for (let e of t) {
|
|
@@ -3332,12 +3341,12 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3332
3341
|
t.className = "ttcb-pending-thumb", t.src = e.previewUrl, t.alt = "", n.appendChild(t);
|
|
3333
3342
|
} else {
|
|
3334
3343
|
let e = document.createElement("span");
|
|
3335
|
-
e.className = "ttcb-pending-icon", e.setAttribute("aria-hidden", "true"), e.innerHTML =
|
|
3344
|
+
e.className = "ttcb-pending-icon", e.setAttribute("aria-hidden", "true"), e.innerHTML = hn(), n.appendChild(e);
|
|
3336
3345
|
}
|
|
3337
3346
|
let r = document.createElement("span");
|
|
3338
3347
|
r.className = "ttcb-pending-name", r.textContent = e.file.name || "attachment", r.title = e.file.name, n.appendChild(r);
|
|
3339
3348
|
let i = document.createElement("button");
|
|
3340
|
-
i.type = "button", i.className = "ttcb-pending-remove", i.setAttribute("aria-label", `Remove ${e.file.name || "attachment"}`), i.innerHTML =
|
|
3349
|
+
i.type = "button", i.className = "ttcb-pending-remove", i.setAttribute("aria-label", `Remove ${e.file.name || "attachment"}`), i.innerHTML = Zt(), i.addEventListener("click", () => this.removePendingFile(t)), n.appendChild(i), this.pendingTray.appendChild(n);
|
|
3341
3350
|
});
|
|
3342
3351
|
}
|
|
3343
3352
|
buildVoiceBar() {
|
|
@@ -3345,10 +3354,10 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3345
3354
|
let e = document.createElement("span");
|
|
3346
3355
|
e.className = "ttcb-voice-dot", e.setAttribute("aria-hidden", "true"), this.voiceTime = document.createElement("span"), this.voiceTime.className = "ttcb-voice-time", this.voiceTime.setAttribute("role", "timer"), this.voiceTime.textContent = "0:00";
|
|
3347
3356
|
let t = document.createElement("div");
|
|
3348
|
-
return t.className = "ttcb-voice-meter", t.setAttribute("aria-hidden", "true"), this.voiceLevel = document.createElement("span"), this.voiceLevel.className = "ttcb-voice-level", t.appendChild(this.voiceLevel), this.voiceCancelBtn = this.createVoiceButton("Cancel recording",
|
|
3357
|
+
return t.className = "ttcb-voice-meter", t.setAttribute("aria-hidden", "true"), this.voiceLevel = document.createElement("span"), this.voiceLevel.className = "ttcb-voice-level", t.appendChild(this.voiceLevel), this.voiceCancelBtn = this.createVoiceButton("Cancel recording", mn(), () => this.cancelVoice()), this.voiceStopBtn = this.createVoiceButton("Stop recording", pn(), () => void this.stopVoice()), this.voiceStopBtn.classList.add("primary"), this.voiceBar.appendChild(e), this.voiceBar.appendChild(this.voiceTime), this.voiceBar.appendChild(t), this.voiceBar.appendChild(this.voiceCancelBtn), this.voiceBar.appendChild(this.voiceStopBtn), this.voiceBar;
|
|
3349
3358
|
}
|
|
3350
3359
|
buildVoicePreview() {
|
|
3351
|
-
return this.voicePreview = document.createElement("div"), this.voicePreview.className = "ttcb-voice-preview", this.voicePreview.setAttribute("role", "group"), this.voicePreview.setAttribute("aria-label", "Voice message preview"), this.voiceAudio = document.createElement("audio"), this.voiceAudio.className = "ttcb-voice-audio", this.voiceAudio.controls = !0, this.voiceAudio.preload = "metadata", this.voiceAudio.setAttribute("aria-label", "Recorded voice message"), this.voicePreviewTime = document.createElement("span"), this.voicePreviewTime.className = "ttcb-voice-time", this.voiceDiscardBtn = this.createVoiceButton("Discard voice message",
|
|
3360
|
+
return this.voicePreview = document.createElement("div"), this.voicePreview.className = "ttcb-voice-preview", this.voicePreview.setAttribute("role", "group"), this.voicePreview.setAttribute("aria-label", "Voice message preview"), this.voiceAudio = document.createElement("audio"), this.voiceAudio.className = "ttcb-voice-audio", this.voiceAudio.controls = !0, this.voiceAudio.preload = "metadata", this.voiceAudio.setAttribute("aria-label", "Recorded voice message"), this.voicePreviewTime = document.createElement("span"), this.voicePreviewTime.className = "ttcb-voice-time", this.voiceDiscardBtn = this.createVoiceButton("Discard voice message", mn(), () => this.cancelVoice()), this.voiceSendBtn = this.createVoiceButton("Send voice message", Qt(), () => this.sendVoice()), this.voiceSendBtn.classList.add("primary"), this.voicePreview.appendChild(this.voiceAudio), this.voicePreview.appendChild(this.voicePreviewTime), this.voicePreview.appendChild(this.voiceDiscardBtn), this.voicePreview.appendChild(this.voiceSendBtn), this.voicePreview;
|
|
3352
3361
|
}
|
|
3353
3362
|
createVoiceButton(e, t, n) {
|
|
3354
3363
|
let r = document.createElement("button");
|
|
@@ -3356,9 +3365,9 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3356
3365
|
}
|
|
3357
3366
|
async startVoice() {
|
|
3358
3367
|
if (!this.micBtn.disabled) {
|
|
3359
|
-
if (this.closeAttachMenu(), this.showComposeError(""), !
|
|
3368
|
+
if (this.closeAttachMenu(), this.showComposeError(""), !Vt.isSupported()) this.showComposeError("Voice messages are not supported in this browser.");
|
|
3360
3369
|
else {
|
|
3361
|
-
this.recorder?.destroy(), this.recorder = new
|
|
3370
|
+
this.recorder?.destroy(), this.recorder = new Vt((e) => this.renderVoice(e));
|
|
3362
3371
|
try {
|
|
3363
3372
|
await this.recorder.start();
|
|
3364
3373
|
} catch (e) {
|
|
@@ -3410,7 +3419,7 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3410
3419
|
placeholder: "Your name",
|
|
3411
3420
|
type: "text",
|
|
3412
3421
|
autocomplete: "name",
|
|
3413
|
-
icon:
|
|
3422
|
+
icon: en()
|
|
3414
3423
|
}), this.createPhoneField(t), this.emailInput = this.createIconField(t, {
|
|
3415
3424
|
id: "email",
|
|
3416
3425
|
label: "Email (optional)",
|
|
@@ -3419,10 +3428,10 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3419
3428
|
placeholder: "Email (optional)",
|
|
3420
3429
|
type: "email",
|
|
3421
3430
|
autocomplete: "email",
|
|
3422
|
-
icon:
|
|
3423
|
-
}), this.identifyError = document.createElement("p"), this.identifyError.className = "ttcb-identify-error", t.appendChild(this.identifyError), this.identifySubmit = document.createElement("button"), this.identifySubmit.type = "submit", this.identifySubmit.className = "ttcb-identify-submit", this.identifySubmit.innerHTML = `<span>Start Chatting</span>${
|
|
3431
|
+
icon: tn()
|
|
3432
|
+
}), this.identifyError = document.createElement("p"), this.identifyError.className = "ttcb-identify-error", t.appendChild(this.identifyError), this.identifySubmit = document.createElement("button"), this.identifySubmit.type = "submit", this.identifySubmit.className = "ttcb-identify-submit", this.identifySubmit.innerHTML = `<span>Start Chatting</span>${rn()}`, t.appendChild(this.identifySubmit), e.appendChild(t);
|
|
3424
3433
|
let n = document.createElement("div");
|
|
3425
|
-
n.className = "ttcb-trust", n.innerHTML = `${
|
|
3434
|
+
n.className = "ttcb-trust", n.innerHTML = `${an()}<span>Encrypted connection • No spam, ever</span>`, e.appendChild(n);
|
|
3426
3435
|
}
|
|
3427
3436
|
createIconField(e, t) {
|
|
3428
3437
|
let n = document.createElement("div");
|
|
@@ -3452,7 +3461,7 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3452
3461
|
let a = document.createElement("div");
|
|
3453
3462
|
a.className = "ttcb-phone-row", a.id = "ttcb-phone-row", this.dialBtn = document.createElement("button"), this.dialBtn.type = "button", this.dialBtn.className = "ttcb-dial-btn", this.dialBtn.setAttribute("aria-label", "Select country code"), this.dialBtn.setAttribute("aria-haspopup", "listbox"), this.dialBtn.setAttribute("aria-expanded", "false"), this.dialFlag = document.createElement("span"), this.dialFlag.className = "ttcb-dial-flag", this.dialCode = document.createElement("span"), this.dialCode.className = "ttcb-dial-code", this.syncDialButton(), this.dialBtn.appendChild(this.dialFlag), this.dialBtn.appendChild(this.dialCode);
|
|
3454
3463
|
let o = document.createElement("span");
|
|
3455
|
-
o.setAttribute("aria-hidden", "true"), o.innerHTML =
|
|
3464
|
+
o.setAttribute("aria-hidden", "true"), o.innerHTML = nn(), this.dialBtn.appendChild(o), this.dialBtn.addEventListener("click", (e) => {
|
|
3456
3465
|
e.preventDefault(), e.stopPropagation(), this.toggleCountryPopover();
|
|
3457
3466
|
}), this.phoneInput = document.createElement("input"), this.phoneInput.id = "ttcb-tel", this.phoneInput.name = "tel", this.phoneInput.type = "tel", this.phoneInput.className = "ttcb-phone-national", this.phoneInput.placeholder = "1712-345678", this.phoneInput.required = !0, this.phoneInput.autocomplete = "tel-national", this.phoneInput.setAttribute("inputmode", "tel"), a.appendChild(this.dialBtn), a.appendChild(this.phoneInput), this.countryPopover = document.createElement("div"), this.countryPopover.className = "ttcb-country-popover", this.countryPopover.setAttribute("role", "listbox"), this.countrySearch = document.createElement("input"), this.countrySearch.type = "search", this.countrySearch.className = "ttcb-country-search", this.countrySearch.placeholder = "Search country…", this.countrySearch.setAttribute("aria-label", "Search countries"), this.countrySearch.addEventListener("input", () => this.renderCountryList()), this.countryList = document.createElement("div"), this.countryList.className = "ttcb-country-list", this.countryPopover.appendChild(this.countrySearch), this.countryPopover.appendChild(this.countryList), this.renderCountryList(), t.appendChild(n), t.appendChild(a), t.appendChild(this.countryPopover), e.appendChild(t);
|
|
3458
3467
|
}
|
|
@@ -3469,7 +3478,7 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3469
3478
|
this.countryOpen = !1, this.countryPopover.classList.remove("open"), this.dialBtn.setAttribute("aria-expanded", "false");
|
|
3470
3479
|
}
|
|
3471
3480
|
renderCountryList() {
|
|
3472
|
-
let e = this.countrySearch.value.trim().toLowerCase(), t =
|
|
3481
|
+
let e = this.countrySearch.value.trim().toLowerCase(), t = Ht.filter((t) => !e || t.name.toLowerCase().includes(e) || t.dial.includes(e) || t.iso.toLowerCase().includes(e) || `+${t.dial}`.includes(e));
|
|
3473
3482
|
this.countryList.innerHTML = "";
|
|
3474
3483
|
for (let e of t) {
|
|
3475
3484
|
let t = document.createElement("button");
|
|
@@ -3521,7 +3530,7 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3521
3530
|
}
|
|
3522
3531
|
}
|
|
3523
3532
|
handleIdentifySubmit() {
|
|
3524
|
-
let e = this.nameInput.value.trim(), t =
|
|
3533
|
+
let e = this.nameInput.value.trim(), t = Wt(this.selectedCountry.dial, this.phoneInput.value), n = this.emailInput.value.trim();
|
|
3525
3534
|
!e || !t ? this.showIdentifyError("Name and phone are required.") : (this.showIdentifyError(""), this.callbacks.onIdentify({
|
|
3526
3535
|
name: e,
|
|
3527
3536
|
phone: t,
|
|
@@ -3542,13 +3551,13 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3542
3551
|
}
|
|
3543
3552
|
buildMessage(e) {
|
|
3544
3553
|
if ("message" in e) {
|
|
3545
|
-
let t =
|
|
3554
|
+
let t = _n({
|
|
3546
3555
|
...e.message,
|
|
3547
3556
|
pending: e.pending
|
|
3548
3557
|
});
|
|
3549
3558
|
return t.dataset.msgId = String(e.id), t;
|
|
3550
3559
|
}
|
|
3551
|
-
return
|
|
3560
|
+
return _n(e);
|
|
3552
3561
|
}
|
|
3553
3562
|
findMessageEl(e) {
|
|
3554
3563
|
for (let t of this.messagesContainer.querySelectorAll(".ttcb-msg")) if (t.dataset.msgId === String(e)) return t;
|
|
@@ -3561,7 +3570,7 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3561
3570
|
}
|
|
3562
3571
|
}
|
|
3563
3572
|
setLoading(e) {
|
|
3564
|
-
if (this.sendBtn.disabled = e || this.input.disabled, this.attachBtn.disabled = e || this.input.disabled, this.micBtn.disabled = e || this.input.disabled, e) this.closeAttachMenu(), this.shadow.getElementById("ttcb-typing") || (this.messagesContainer.appendChild(
|
|
3573
|
+
if (this.sendBtn.disabled = e || this.input.disabled, this.attachBtn.disabled = e || this.input.disabled, this.micBtn.disabled = e || this.input.disabled, e) this.closeAttachMenu(), this.shadow.getElementById("ttcb-typing") || (this.messagesContainer.appendChild(vn()), this.scrollToBottom()), this.isFullScreen() || this.input.focus();
|
|
3565
3574
|
else {
|
|
3566
3575
|
let e = this.shadow.getElementById("ttcb-typing");
|
|
3567
3576
|
e && e.remove(), !this.input.disabled && !this.isFullScreen() && this.input.focus();
|
|
@@ -3570,7 +3579,7 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3570
3579
|
setIdentifyLoading(e) {
|
|
3571
3580
|
this.identifySubmit.disabled = e, this.nameInput.disabled = e, this.phoneInput.disabled = e, this.emailInput.disabled = e, this.dialBtn.disabled = e, this.shadow.getElementById("ttcb-phone-row")?.classList.toggle("disabled", e);
|
|
3572
3581
|
for (let t of this.identifyContainer.querySelectorAll(".ttcb-input-wrap")) t.classList.toggle("disabled", e);
|
|
3573
|
-
this.identifySubmit.innerHTML = e ? "<span>Starting…</span>" : `<span>Start Chatting</span>${
|
|
3582
|
+
this.identifySubmit.innerHTML = e ? "<span>Starting…</span>" : `<span>Start Chatting</span>${rn()}`, e && this.closeCountryPopover();
|
|
3574
3583
|
}
|
|
3575
3584
|
showIdentifyError(e) {
|
|
3576
3585
|
this.identifyError.textContent = e;
|
|
@@ -3630,7 +3639,7 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3630
3639
|
scrollToBottom() {
|
|
3631
3640
|
this.messagesContainer.scrollTop = this.messagesContainer.scrollHeight;
|
|
3632
3641
|
}
|
|
3633
|
-
},
|
|
3642
|
+
}, Sn = {
|
|
3634
3643
|
apiBaseUrl: u,
|
|
3635
3644
|
chatbotName: "AI Assistant",
|
|
3636
3645
|
primaryColor: "#2563EB",
|
|
@@ -3642,23 +3651,23 @@ var vn = "image/jpeg,image/png,image/gif,video/mp4,video/webm,audio/ogg,audio/mp
|
|
|
3642
3651
|
sessionId: "",
|
|
3643
3652
|
requestTimeoutMs: n
|
|
3644
3653
|
};
|
|
3645
|
-
function
|
|
3654
|
+
function Cn(e) {
|
|
3646
3655
|
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
3647
3656
|
}
|
|
3648
|
-
var
|
|
3657
|
+
var wn = [
|
|
3649
3658
|
5e3,
|
|
3650
3659
|
15e3,
|
|
3651
3660
|
3e4,
|
|
3652
3661
|
6e4
|
|
3653
3662
|
];
|
|
3654
|
-
function
|
|
3663
|
+
function Tn(e) {
|
|
3655
3664
|
return c(e) ? e.status === 0 || e.status >= 500 || e.apiError.code === "BAD_RESPONSE" : !1;
|
|
3656
3665
|
}
|
|
3657
|
-
function
|
|
3666
|
+
function En(e) {
|
|
3658
3667
|
return c(e) ? e.apiError.message : e instanceof Error ? e.message : "Failed to load chatbot config.";
|
|
3659
3668
|
}
|
|
3660
|
-
var
|
|
3661
|
-
function
|
|
3669
|
+
var Dn = 0, Z = () => Date.now() * 1e3 + Dn++ % 1e3;
|
|
3670
|
+
function On(e) {
|
|
3662
3671
|
if (!e || typeof e != "object") return null;
|
|
3663
3672
|
let t = e;
|
|
3664
3673
|
if (typeof t.textMessage == "string" && t.textMessage.trim()) return t.textMessage.trim();
|
|
@@ -3674,7 +3683,7 @@ function Q(e) {
|
|
|
3674
3683
|
let t = (e.attachments ?? []).map((e) => e.url).join("");
|
|
3675
3684
|
return `${e.content}\u0000${t}`;
|
|
3676
3685
|
}
|
|
3677
|
-
function
|
|
3686
|
+
function kn(e) {
|
|
3678
3687
|
if (!e || typeof e != "object") return null;
|
|
3679
3688
|
let t = e;
|
|
3680
3689
|
if (typeof t.id == "string" && t.id) return t.id;
|
|
@@ -3684,9 +3693,9 @@ function On(e) {
|
|
|
3684
3693
|
}
|
|
3685
3694
|
return null;
|
|
3686
3695
|
}
|
|
3687
|
-
var
|
|
3696
|
+
var An = class {
|
|
3688
3697
|
constructor() {
|
|
3689
|
-
this.emitter = new
|
|
3698
|
+
this.emitter = new pe(), this.visitorTokens = new Pt(), this.widget = null, this.sdkSocket = null, this.callerSetName = !1, this.hasActiveTicket = !1, this.retryTimer = null, this.lastPushId = null, this.endedConversationId = null, this.initToken = 0, this._state = {
|
|
3690
3699
|
isOpen: !1,
|
|
3691
3700
|
isLoading: !1,
|
|
3692
3701
|
isReady: !1,
|
|
@@ -3725,8 +3734,8 @@ var kn = class {
|
|
|
3725
3734
|
if (!e.apiKey) throw Error("[onedeskpro-chatbot] `apiKey` is required to initialise the chatbot.");
|
|
3726
3735
|
let t = ++this.initToken;
|
|
3727
3736
|
this.clearRetry(), this.disconnectSdkSocket(), this.widget?.destroy(), this.widget = null, this.callerSetName = e.chatbotName !== void 0, this.options = {
|
|
3728
|
-
...
|
|
3729
|
-
...
|
|
3737
|
+
...Sn,
|
|
3738
|
+
...Cn(e)
|
|
3730
3739
|
}, this.apiClient = new l({
|
|
3731
3740
|
baseUrl: this.options.apiBaseUrl,
|
|
3732
3741
|
apiKey: this.options.apiKey,
|
|
@@ -3748,13 +3757,13 @@ var kn = class {
|
|
|
3748
3757
|
n = await this.apiClient.fetchConfig();
|
|
3749
3758
|
} catch (n) {
|
|
3750
3759
|
if (e !== this.initToken) return;
|
|
3751
|
-
if (
|
|
3760
|
+
if (Tn(n)) {
|
|
3752
3761
|
this.setState({
|
|
3753
3762
|
isReady: !1,
|
|
3754
3763
|
blockReason: "server-unavailable",
|
|
3755
|
-
error:
|
|
3764
|
+
error: En(n)
|
|
3756
3765
|
});
|
|
3757
|
-
let r =
|
|
3766
|
+
let r = wn[t];
|
|
3758
3767
|
if (r !== void 0) {
|
|
3759
3768
|
this.retryTimer = setTimeout(() => {
|
|
3760
3769
|
this.retryTimer = null, this.checkReadiness(e, t + 1);
|
|
@@ -3775,7 +3784,7 @@ var kn = class {
|
|
|
3775
3784
|
}), i ? (this.mountWidget(), this.visitorTokens.setScope(n.agentId), await this.resolveVisitorGate(e), e === this.initToken && (this.widget?.reveal(), this.emitter.emit("ready"))) : this.emitter.emit("ready");
|
|
3776
3785
|
}
|
|
3777
3786
|
mountWidget() {
|
|
3778
|
-
typeof window < "u" && typeof document < "u" && (this.widget = new
|
|
3787
|
+
typeof window < "u" && typeof document < "u" && (this.widget = new xn(this.options, {
|
|
3779
3788
|
onSend: (e) => void this.sendMessage(e),
|
|
3780
3789
|
onSendAttachments: (e, t) => void this.sendAttachments(e, t),
|
|
3781
3790
|
onSendVoice: (e) => void this.sendVoice(e),
|
|
@@ -3799,7 +3808,7 @@ var kn = class {
|
|
|
3799
3808
|
this.setState({
|
|
3800
3809
|
isReady: !1,
|
|
3801
3810
|
blockReason: t,
|
|
3802
|
-
error:
|
|
3811
|
+
error: En(e)
|
|
3803
3812
|
});
|
|
3804
3813
|
}
|
|
3805
3814
|
async resolveVisitorGate(e) {
|
|
@@ -3831,7 +3840,7 @@ var kn = class {
|
|
|
3831
3840
|
}), this.widget?.readyToChat(this.options), this.connectSdkSocket(e), await this.restoreTicketStatus(e, n);
|
|
3832
3841
|
}
|
|
3833
3842
|
connectSdkSocket(e) {
|
|
3834
|
-
this.sdkSocket ||= new
|
|
3843
|
+
this.sdkSocket ||= new kt(), this.sdkSocket.connect({
|
|
3835
3844
|
baseUrl: this.options.apiBaseUrl,
|
|
3836
3845
|
apiKey: this.options.apiKey,
|
|
3837
3846
|
visitorToken: e,
|
|
@@ -3861,9 +3870,9 @@ var kn = class {
|
|
|
3861
3870
|
}
|
|
3862
3871
|
handleMessageReceive(e) {
|
|
3863
3872
|
if (this._state.mode === "ai") return;
|
|
3864
|
-
let t =
|
|
3873
|
+
let t = On(e) ?? "", n = re(e);
|
|
3865
3874
|
if (!t && n.length === 0) return;
|
|
3866
|
-
let r =
|
|
3875
|
+
let r = kn(e), i = this._state.messages[this._state.messages.length - 1];
|
|
3867
3876
|
if (i && Q(i.message) === Q({
|
|
3868
3877
|
content: t,
|
|
3869
3878
|
attachments: n
|
|
@@ -4018,7 +4027,7 @@ var kn = class {
|
|
|
4018
4027
|
r ? this.rejectSend(r) : await this.uploadThenDeliver({
|
|
4019
4028
|
visitorToken: n,
|
|
4020
4029
|
files: e,
|
|
4021
|
-
previews: e.map(
|
|
4030
|
+
previews: e.map(te),
|
|
4022
4031
|
caption: t.trim()
|
|
4023
4032
|
});
|
|
4024
4033
|
}
|
|
@@ -4031,7 +4040,7 @@ var kn = class {
|
|
|
4031
4040
|
if (!e?.blob || e.blob.size === 0 || this._state.isLoading || this._state.needsIdentify) return;
|
|
4032
4041
|
let n;
|
|
4033
4042
|
try {
|
|
4034
|
-
n = await
|
|
4043
|
+
n = await fe(e);
|
|
4035
4044
|
} catch {
|
|
4036
4045
|
this.rejectSend("Could not process the recording.");
|
|
4037
4046
|
return;
|
|
@@ -4111,7 +4120,7 @@ var kn = class {
|
|
|
4111
4120
|
try {
|
|
4112
4121
|
let n = await this.apiClient.sendMessage(e);
|
|
4113
4122
|
this.hasActiveTicket = !0, this.endedConversationId = null;
|
|
4114
|
-
let r = n.mode ?? t, i = [...this._state.messages], a = (n.text ?? "").trim(), o =
|
|
4123
|
+
let r = n.mode ?? t, i = [...this._state.messages], a = (n.text ?? "").trim(), o = re(n);
|
|
4115
4124
|
if (r !== t && (this.setState({ mode: r }), this.syncWidgetMode(r), this.emitter.emit("ticket-status", { mode: r })), a || o.length > 0) {
|
|
4116
4125
|
let e = i[i.length - 1];
|
|
4117
4126
|
if (e?.message.type !== "agent" && e?.message.type !== "ai" || Q(e.message) !== Q({
|
|
@@ -4175,12 +4184,12 @@ var kn = class {
|
|
|
4175
4184
|
needsIdentify: !0
|
|
4176
4185
|
});
|
|
4177
4186
|
}
|
|
4178
|
-
}, $ = null,
|
|
4187
|
+
}, $ = null, jn = {
|
|
4179
4188
|
async init(e) {
|
|
4180
|
-
return $ = new
|
|
4189
|
+
return $ = new An(), await $.init(e), $;
|
|
4181
4190
|
},
|
|
4182
4191
|
getInstance() {
|
|
4183
4192
|
return $;
|
|
4184
4193
|
}
|
|
4185
4194
|
};
|
|
4186
|
-
export { l as ApiClient,
|
|
4195
|
+
export { l as ApiClient, An as ChatbotCore, u as DEFAULT_API_BASE_URL, n as DEFAULT_REQUEST_TIMEOUT_MS, pe as EventEmitter, jn as OnedeskProChatbot, f as SDK_CHAT_MAX_ATTACHMENTS, d as SDK_UPLOAD_MAX_BYTES, kt as SdkSocket, Pt as SessionManager, Ft as VOICE_MAX_DURATION_SECONDS, Vt as VoiceRecorder, c as isChatbotRequestError, Ot as resolveSdkSocketUrl };
|