deep-chat-dev 9.0.6 → 9.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/deepChat.js CHANGED
@@ -319,130 +319,38 @@ function getInvalidResponseMessage(r, e, t, n) {
319
319
  return "".concat(s + o, "Make sure the ").concat(e, " message is using the Response format: https://deepchat.dev/docs/connect/#Response \n You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor");
320
320
  }
321
321
  var ErrorMessages = {
322
- INVALID_KEY: "Invalid API Key",
323
- CONNECTION_FAILED: "Failed to connect",
324
- INVALID_RESPONSE: getInvalidResponseMessage,
325
- INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
326
- },
327
- _RequestUtils = /*#__PURE__*/function () {
328
- function D() {
329
- _classCallCheck(this, D);
330
- }
331
- _createClass(D, null, [{
332
- key: "temporarilyRemoveHeader",
333
- value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
334
- // prettier-ignore
335
- function () {
336
- var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, t, n) {
337
- var s;
338
- return _regeneratorRuntime().wrap(function _callee$(_context) {
339
- while (1) switch (_context.prev = _context.next) {
340
- case 0:
341
- if (e != null && e.headers) {
342
- _context.next = 2;
343
- break;
344
- }
345
- throw new Error("Request settings have not been set up");
346
- case 2:
347
- s = e.headers[D.CONTENT_TYPE];
348
- delete e.headers[D.CONTENT_TYPE];
349
- _context.next = 6;
350
- return t(n);
351
- case 6:
352
- e.headers[D.CONTENT_TYPE] = s;
353
- case 7:
354
- case "end":
355
- return _context.stop();
356
- }
357
- }, _callee);
358
- }));
359
- function temporarilyRemoveHeader(_x, _x2, _x3) {
360
- return _temporarilyRemoveHeader.apply(this, arguments);
361
- }
362
- return temporarilyRemoveHeader;
363
- }()
364
- }, {
365
- key: "displayError",
366
- value: function displayError(e, t) {
367
- var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
368
- if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
369
- e.addNewErrorMessage("service", t);
370
- }
371
- }, {
372
- key: "processResponseByType",
373
- value: function processResponseByType(e) {
374
- var t = e.headers.get("content-type");
375
- return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
376
- }
377
- }, {
378
- key: "processRequestInterceptor",
379
- value: function () {
380
- var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
381
- var a, n, s, o;
382
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
383
- while (1) switch (_context2.prev = _context2.next) {
384
- case 0:
385
- _context2.next = 2;
386
- return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
387
- case 2:
388
- _context2.t0 = _context2.sent;
389
- if (_context2.t0) {
390
- _context2.next = 5;
391
- break;
392
- }
393
- _context2.t0 = t;
394
- case 5:
395
- n = _context2.t0;
396
- s = n;
397
- o = n;
398
- return _context2.abrupt("return", {
399
- body: s.body,
400
- headers: s.headers,
401
- error: o.error
402
- });
403
- case 9:
404
- case "end":
405
- return _context2.stop();
406
- }
407
- }, _callee2);
408
- }));
409
- function processRequestInterceptor(_x4, _x5) {
410
- return _processRequestInterceptor.apply(this, arguments);
411
- }
412
- return processRequestInterceptor;
413
- }()
414
- }]);
415
- return D;
416
- }();
417
- _RequestUtils.CONTENT_TYPE = "Content-Type";
418
- var RequestUtils = _RequestUtils;
419
- function getBytes(_x6, _x7) {
322
+ INVALID_KEY: "Invalid API Key",
323
+ CONNECTION_FAILED: "Failed to connect",
324
+ INVALID_RESPONSE: getInvalidResponseMessage,
325
+ INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
326
+ };
327
+ function getBytes(_x, _x2) {
420
328
  return _getBytes.apply(this, arguments);
421
329
  }
422
330
  function _getBytes() {
423
- _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(r, e) {
331
+ _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(r, e) {
424
332
  var t, n;
425
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
426
- while (1) switch (_context71.prev = _context71.next) {
333
+ return _regeneratorRuntime().wrap(function _callee75$(_context75) {
334
+ while (1) switch (_context75.prev = _context75.next) {
427
335
  case 0:
428
336
  t = r.getReader();
429
337
  case 1:
430
- _context71.next = 3;
338
+ _context75.next = 3;
431
339
  return t.read();
432
340
  case 3:
433
- if ((n = _context71.sent).done) {
434
- _context71.next = 7;
341
+ if ((n = _context75.sent).done) {
342
+ _context75.next = 7;
435
343
  break;
436
344
  }
437
345
  e(n.value);
438
346
  case 5:
439
- _context71.next = 1;
347
+ _context75.next = 1;
440
348
  break;
441
349
  case 7:
442
350
  case "end":
443
- return _context71.stop();
351
+ return _context75.stop();
444
352
  }
445
- }, _callee71);
353
+ }, _callee75);
446
354
  }));
447
355
  return _getBytes.apply(this, arguments);
448
356
  }
@@ -531,81 +439,254 @@ function fetchEventSource(r, e) {
531
439
  c = e.openWhenHidden,
532
440
  u = e.fetch,
533
441
  d = __rest(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
534
- return new Promise(function (h, p) {
535
- var f = Object.assign({}, n);
536
- f.accept || (f.accept = EventStreamContentType);
442
+ return new Promise(function (h, f) {
443
+ var p = Object.assign({}, n);
444
+ p.accept || (p.accept = EventStreamContentType);
537
445
  var b;
538
446
  function m() {
539
- b.abort(), document.hidden || I();
447
+ b.abort(), document.hidden || x();
540
448
  }
541
449
  c || document.addEventListener("visibilitychange", m);
542
- var v = DefaultRetryInterval,
543
- g = 0;
450
+ var g = DefaultRetryInterval,
451
+ v = 0;
544
452
  function y() {
545
- document.removeEventListener("visibilitychange", m), window.clearTimeout(g), b.abort();
453
+ document.removeEventListener("visibilitychange", m), window.clearTimeout(v), b.abort();
546
454
  }
547
455
  t == null || t.addEventListener("abort", function () {
548
456
  y(), h();
549
457
  });
550
- var x = u !== null && u !== void 0 ? u : window.fetch,
551
- _ = s !== null && s !== void 0 ? s : defaultOnOpen;
552
- function I() {
553
- return _I.apply(this, arguments);
554
- }
555
- function _I() {
556
- _I = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
557
- var R, w, S;
558
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
559
- while (1) switch (_context3.prev = _context3.next) {
458
+ var S = u !== null && u !== void 0 ? u : window.fetch,
459
+ E = s !== null && s !== void 0 ? s : defaultOnOpen;
460
+ function x() {
461
+ return _x3.apply(this, arguments);
462
+ }
463
+ function _x3() {
464
+ _x3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
465
+ var R, C, _;
466
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
467
+ while (1) switch (_context.prev = _context.next) {
560
468
  case 0:
561
469
  b = new AbortController();
562
- _context3.prev = 1;
563
- _context3.next = 4;
564
- return x(r, Object.assign(Object.assign({}, d), {
565
- headers: f,
470
+ _context.prev = 1;
471
+ _context.next = 4;
472
+ return S(r, Object.assign(Object.assign({}, d), {
473
+ headers: p,
566
474
  signal: b.signal
567
475
  }));
568
476
  case 4:
569
- w = _context3.sent;
570
- _context3.next = 7;
571
- return _(w);
477
+ C = _context.sent;
478
+ _context.next = 7;
479
+ return E(C);
572
480
  case 7:
573
- _context3.next = 9;
574
- return getBytes(w.body, getLines(getMessages(function (S) {
575
- S ? f[LastEventId] = S : delete f[LastEventId];
576
- }, function (S) {
577
- v = S;
481
+ _context.next = 9;
482
+ return getBytes(C.body, getLines(getMessages(function (_) {
483
+ _ ? p[LastEventId] = _ : delete p[LastEventId];
484
+ }, function (_) {
485
+ g = _;
578
486
  }, o)));
579
487
  case 9:
580
488
  a == null || a();
581
489
  y();
582
490
  h();
583
- _context3.next = 17;
491
+ _context.next = 17;
584
492
  break;
585
493
  case 14:
586
- _context3.prev = 14;
587
- _context3.t0 = _context3["catch"](1);
494
+ _context.prev = 14;
495
+ _context.t0 = _context["catch"](1);
588
496
  if (!b.signal.aborted) try {
589
- S = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : v;
590
- window.clearTimeout(g), g = window.setTimeout(I, S);
591
- } catch (S) {
592
- y(), p(S);
497
+ _ = (R = l == null ? void 0 : l(_context.t0)) !== null && R !== void 0 ? R : g;
498
+ window.clearTimeout(v), v = window.setTimeout(x, _);
499
+ } catch (_) {
500
+ y(), f(_);
593
501
  }
594
502
  case 17:
595
503
  case "end":
596
- return _context3.stop();
504
+ return _context.stop();
597
505
  }
598
- }, _callee3, null, [[1, 14]]);
506
+ }, _callee, null, [[1, 14]]);
599
507
  }));
600
- return _I.apply(this, arguments);
508
+ return _x3.apply(this, arguments);
601
509
  }
602
- I();
510
+ x();
603
511
  });
604
512
  }
605
513
  function defaultOnOpen(r) {
606
514
  var e = r.headers.get("content-type");
607
515
  if (!(e != null && e.startsWith(EventStreamContentType))) throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(e));
608
516
  }
517
+ var _RequestUtils = /*#__PURE__*/function () {
518
+ function D() {
519
+ _classCallCheck(this, D);
520
+ }
521
+ _createClass(D, null, [{
522
+ key: "temporarilyRemoveHeader",
523
+ value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
524
+ // prettier-ignore
525
+ function () {
526
+ var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t, n) {
527
+ var s;
528
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
529
+ while (1) switch (_context2.prev = _context2.next) {
530
+ case 0:
531
+ if (e != null && e.headers) {
532
+ _context2.next = 2;
533
+ break;
534
+ }
535
+ throw new Error("Request settings have not been set up");
536
+ case 2:
537
+ s = e.headers[D.CONTENT_TYPE];
538
+ delete e.headers[D.CONTENT_TYPE];
539
+ _context2.next = 6;
540
+ return t(n);
541
+ case 6:
542
+ e.headers[D.CONTENT_TYPE] = s;
543
+ case 7:
544
+ case "end":
545
+ return _context2.stop();
546
+ }
547
+ }, _callee2);
548
+ }));
549
+ function temporarilyRemoveHeader(_x4, _x5, _x6) {
550
+ return _temporarilyRemoveHeader.apply(this, arguments);
551
+ }
552
+ return temporarilyRemoveHeader;
553
+ }()
554
+ }, {
555
+ key: "displayError",
556
+ value: function displayError(e, t) {
557
+ var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
558
+ if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
559
+ e.addNewErrorMessage("service", t);
560
+ }
561
+ }, {
562
+ key: "processResponseByType",
563
+ value: function processResponseByType(e) {
564
+ var t = e.headers.get("content-type");
565
+ return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
566
+ }
567
+ }, {
568
+ key: "processRequestInterceptor",
569
+ value: function () {
570
+ var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, t) {
571
+ var a, n, s, o;
572
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
573
+ while (1) switch (_context3.prev = _context3.next) {
574
+ case 0:
575
+ _context3.next = 2;
576
+ return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
577
+ case 2:
578
+ _context3.t0 = _context3.sent;
579
+ if (_context3.t0) {
580
+ _context3.next = 5;
581
+ break;
582
+ }
583
+ _context3.t0 = t;
584
+ case 5:
585
+ n = _context3.t0;
586
+ s = n;
587
+ o = n;
588
+ return _context3.abrupt("return", {
589
+ body: s.body,
590
+ headers: s.headers,
591
+ error: o.error
592
+ });
593
+ case 9:
594
+ case "end":
595
+ return _context3.stop();
596
+ }
597
+ }, _callee3);
598
+ }));
599
+ function processRequestInterceptor(_x7, _x8) {
600
+ return _processRequestInterceptor.apply(this, arguments);
601
+ }
602
+ return processRequestInterceptor;
603
+ }()
604
+ }]);
605
+ return D;
606
+ }();
607
+ _RequestUtils.CONTENT_TYPE = "Content-Type";
608
+ var RequestUtils = _RequestUtils;
609
+ var _Demo = /*#__PURE__*/function () {
610
+ function A() {
611
+ _classCallCheck(this, A);
612
+ }
613
+ _createClass(A, null, [{
614
+ key: "generateResponseForOneMessage",
615
+ value: function generateResponseForOneMessage(e) {
616
+ if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
617
+ if (e.text) {
618
+ if (e.text.charAt(e.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
619
+ if (e.text.includes("updog")) return "What's updog?";
620
+ }
621
+ return "Hi there! This is a demo response!";
622
+ }
623
+ }, {
624
+ key: "generateResponse",
625
+ value: function generateResponse(e) {
626
+ var t = [];
627
+ for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
628
+ if (t.length === 1) return A.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
629
+ var n = e.messages.findIndex(function (s) {
630
+ return s.text;
631
+ });
632
+ return n !== -1 && t.splice(n, 1), t.length === 1 ? A.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
633
+ }
634
+ }, {
635
+ key: "getCustomResponse",
636
+ value: function getCustomResponse(e, t) {
637
+ return typeof e == "function" ? e(t) : e;
638
+ }
639
+ }, {
640
+ key: "getResponse",
641
+ value: function getResponse(e) {
642
+ return e.customDemoResponse ? A.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
643
+ text: A.generateResponse(e)
644
+ };
645
+ }
646
+ // timeout is used to simulate a timeout for a response to come back
647
+ }, {
648
+ key: "request",
649
+ value: function request(e, t, n) {
650
+ var s = A.getResponse(e);
651
+ setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
652
+ var o;
653
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
654
+ while (1) switch (_context4.prev = _context4.next) {
655
+ case 0:
656
+ _context4.next = 2;
657
+ return n == null ? void 0 : n(s);
658
+ case 2:
659
+ _context4.t0 = _context4.sent;
660
+ if (_context4.t0) {
661
+ _context4.next = 5;
662
+ break;
663
+ }
664
+ _context4.t0 = s;
665
+ case 5:
666
+ o = _context4.t0;
667
+ o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
668
+ case 7:
669
+ case "end":
670
+ return _context4.stop();
671
+ }
672
+ }, _callee4);
673
+ })), 400);
674
+ }
675
+ // timeout is used to simulate a timeout for a response to come back
676
+ }, {
677
+ key: "requestStream",
678
+ value: function requestStream(e, t) {
679
+ setTimeout(function () {
680
+ var s;
681
+ var n = (s = A.getResponse(e)) == null ? void 0 : s.text;
682
+ Stream.simulate(e, t, n);
683
+ }, 400);
684
+ }
685
+ }]);
686
+ return A;
687
+ }();
688
+ _Demo.URL = "deep-chat-demo";
689
+ var Demo = _Demo;
609
690
  var Stream = /*#__PURE__*/function () {
610
691
  function Stream() {
611
692
  _classCallCheck(this, Stream);
@@ -614,11 +695,12 @@ var Stream = /*#__PURE__*/function () {
614
695
  key: "request",
615
696
  value: // prettier-ignore
616
697
  function () {
617
- var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(e, t, n) {
698
+ var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(e, t, n) {
618
699
  var s,
619
- f,
700
+ p,
620
701
  b,
621
702
  m,
703
+ g,
622
704
  v,
623
705
  o,
624
706
  _yield$RequestUtils$p,
@@ -629,20 +711,20 @@ var Stream = /*#__PURE__*/function () {
629
711
  u,
630
712
  d,
631
713
  h,
632
- p,
633
- _args5 = arguments;
634
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
635
- while (1) switch (_context5.prev = _context5.next) {
714
+ f,
715
+ _args6 = arguments;
716
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
717
+ while (1) switch (_context6.prev = _context6.next) {
636
718
  case 0:
637
- s = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : !0;
719
+ s = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : !0;
638
720
  o = {
639
721
  body: t,
640
- headers: (f = e.requestSettings) == null ? void 0 : f.headers
722
+ headers: (p = e.requestSettings) == null ? void 0 : p.headers
641
723
  };
642
- _context5.next = 4;
724
+ _context6.next = 4;
643
725
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
644
726
  case 4:
645
- _yield$RequestUtils$p = _context5.sent;
727
+ _yield$RequestUtils$p = _context6.sent;
646
728
  a = _yield$RequestUtils$p.body;
647
729
  l = _yield$RequestUtils$p.headers;
648
730
  c = _yield$RequestUtils$p.error;
@@ -651,79 +733,85 @@ var Stream = /*#__PURE__*/function () {
651
733
  d = _e$streamHandlers.onClose;
652
734
  h = _e$streamHandlers.abortStream;
653
735
  if (!c) {
654
- _context5.next = 14;
736
+ _context6.next = 14;
655
737
  break;
656
738
  }
657
- return _context5.abrupt("return", Stream.onInterceptorError(n, c, d));
739
+ return _context6.abrupt("return", Stream.onInterceptorError(n, c, d));
658
740
  case 14:
659
- if (!(((b = e.requestSettings) == null ? void 0 : b.url) === Demo.URL)) {
660
- _context5.next = 16;
741
+ if (!((b = e.requestSettings) != null && b.handler)) {
742
+ _context6.next = 16;
661
743
  break;
662
744
  }
663
- return _context5.abrupt("return", Demo.requestStream(n, e.streamHandlers));
745
+ return _context6.abrupt("return", CustomHandler.stream(e, a, n));
664
746
  case 16:
665
- p = null;
666
- fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
747
+ if (!(((m = e.requestSettings) == null ? void 0 : m.url) === Demo.URL)) {
748
+ _context6.next = 18;
749
+ break;
750
+ }
751
+ return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
752
+ case 18:
753
+ f = null;
754
+ fetchEventSource(((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", {
667
755
  method: ((v = e.requestSettings) == null ? void 0 : v.method) || "POST",
668
756
  headers: l,
669
757
  body: s ? JSON.stringify(a) : a,
670
758
  openWhenHidden: !0,
671
759
  // keep stream open when browser tab not open
672
- onopen: function onopen(g) {
673
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
674
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
675
- while (1) switch (_context4.prev = _context4.next) {
760
+ onopen: function onopen(y) {
761
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
762
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
763
+ while (1) switch (_context5.prev = _context5.next) {
676
764
  case 0:
677
- if (!g.ok) {
678
- _context4.next = 2;
765
+ if (!y.ok) {
766
+ _context5.next = 2;
679
767
  break;
680
768
  }
681
- return _context4.abrupt("return", (p = n.addNewStreamedMessage(), u()));
769
+ return _context5.abrupt("return", (f = n.addNewStreamedMessage(), u()));
682
770
  case 2:
683
- _context4.next = 4;
684
- return RequestUtils.processResponseByType(g);
771
+ _context5.next = 4;
772
+ return RequestUtils.processResponseByType(y);
685
773
  case 4:
686
- throw _context4.sent;
774
+ throw _context5.sent;
687
775
  case 5:
688
776
  case "end":
689
- return _context4.stop();
777
+ return _context5.stop();
690
778
  }
691
- }, _callee4);
779
+ }, _callee5);
692
780
  }))();
693
781
  },
694
- onmessage: function onmessage(g) {
695
- var y;
696
- if (JSON.stringify(g.data) !== JSON.stringify("[DONE]")) {
697
- var x = JSON.parse(g.data);
698
- (y = e.extractResultData) == null || y.call(e, x).then(function (_) {
699
- (_ == null ? void 0 : _.text) === void 0 ? console.error("Response data: ".concat(g.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : p && n.updateStreamedMessage(_.text, p);
700
- })["catch"](function (_) {
701
- return RequestUtils.displayError(n, _);
782
+ onmessage: function onmessage(y) {
783
+ var S;
784
+ if (JSON.stringify(y.data) !== JSON.stringify("[DONE]")) {
785
+ var E = JSON.parse(y.data);
786
+ (S = e.extractResultData) == null || S.call(e, E).then(function (x) {
787
+ (x == null ? void 0 : x.text) === void 0 ? console.error("Response data: ".concat(y.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : f && n.updateStreamedMessage(x.text, f);
788
+ })["catch"](function (x) {
789
+ return RequestUtils.displayError(n, x);
702
790
  });
703
791
  }
704
792
  },
705
- onerror: function onerror(g) {
706
- throw d(), g;
793
+ onerror: function onerror(y) {
794
+ throw d(), y;
707
795
  },
708
796
  onclose: function onclose() {
709
797
  n.finaliseStreamedMessage(), d();
710
798
  },
711
799
  signal: h.signal
712
- })["catch"](function (g) {
713
- var y;
714
- (y = e.extractResultData) == null || y.call(e, g).then(function () {
715
- RequestUtils.displayError(n, g);
716
- })["catch"](function (x) {
717
- RequestUtils.displayError(n, x);
800
+ })["catch"](function (y) {
801
+ var S;
802
+ (S = e.extractResultData) == null || S.call(e, y).then(function () {
803
+ RequestUtils.displayError(n, y);
804
+ })["catch"](function (E) {
805
+ RequestUtils.displayError(n, E);
718
806
  });
719
807
  });
720
- case 18:
808
+ case 20:
721
809
  case "end":
722
- return _context5.stop();
810
+ return _context6.stop();
723
811
  }
724
- }, _callee5);
812
+ }, _callee6);
725
813
  }));
726
- function request(_x8, _x9, _x10) {
814
+ function request(_x9, _x10, _x11) {
727
815
  return _request.apply(this, arguments);
728
816
  }
729
817
  return request;
@@ -765,87 +853,180 @@ var Stream = /*#__PURE__*/function () {
765
853
  }]);
766
854
  return Stream;
767
855
  }();
768
- var _Demo = /*#__PURE__*/function () {
769
- function C() {
770
- _classCallCheck(this, C);
856
+ var CustomHandler = /*#__PURE__*/function () {
857
+ function CustomHandler() {
858
+ _classCallCheck(this, CustomHandler);
771
859
  }
772
- _createClass(C, null, [{
773
- key: "generateResponseForOneMessage",
774
- value: function generateResponseForOneMessage(e) {
775
- if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
776
- if (e.text) {
777
- if (e.text.charAt(e.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
778
- if (e.text.includes("updog")) return "What's updog?";
860
+ _createClass(CustomHandler, null, [{
861
+ key: "request",
862
+ value: function () {
863
+ var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
864
+ var l, c, s, o, a;
865
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
866
+ while (1) switch (_context8.prev = _context8.next) {
867
+ case 0:
868
+ s = !0;
869
+ o = /*#__PURE__*/function () {
870
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(u) {
871
+ var h, f, d;
872
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
873
+ while (1) switch (_context7.prev = _context7.next) {
874
+ case 0:
875
+ if (s) {
876
+ _context7.next = 2;
877
+ break;
878
+ }
879
+ return _context7.abrupt("return");
880
+ case 2:
881
+ _context7.next = 4;
882
+ return (f = (h = e.deepChat).responseInterceptor) == null ? void 0 : f.call(h, u);
883
+ case 4:
884
+ _context7.t0 = _context7.sent;
885
+ if (_context7.t0) {
886
+ _context7.next = 7;
887
+ break;
888
+ }
889
+ _context7.t0 = u;
890
+ case 7:
891
+ d = _context7.t0;
892
+ !d || _typeof(d) != "object" || typeof d.error != "string" && typeof d.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(u, "server", !!e.deepChat.responseInterceptor, d)), n.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish()) : typeof d.error == "string" ? (console.error(d.error), n.addNewErrorMessage("service", d.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && d.text ? Stream.simulate(n, e.streamHandlers, d.text) : (n.addNewMessage(d, !0, !0), e.completionsHandlers.onFinish()), s = !1;
893
+ case 9:
894
+ case "end":
895
+ return _context7.stop();
896
+ }
897
+ }, _callee7);
898
+ }));
899
+ return function o(_x15) {
900
+ return _ref2.apply(this, arguments);
901
+ };
902
+ }(), a = CustomHandler.generateOptionalSignals();
903
+ (c = (l = e.requestSettings).handler) == null || c.call(l, t, _objectSpread(_objectSpread({}, a), {}, {
904
+ onResponse: o
905
+ }));
906
+ case 3:
907
+ case "end":
908
+ return _context8.stop();
909
+ }
910
+ }, _callee8);
911
+ }));
912
+ function request(_x12, _x13, _x14) {
913
+ return _request2.apply(this, arguments);
779
914
  }
780
- return "Hi there! This is a demo response!";
781
- }
782
- }, {
783
- key: "generateResponse",
784
- value: function generateResponse(e) {
785
- var t = [];
786
- for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
787
- if (t.length === 1) return C.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
788
- var n = e.messages.findIndex(function (s) {
789
- return s.text;
790
- });
791
- return n !== -1 && t.splice(n, 1), t.length === 1 ? C.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
792
- }
793
- }, {
794
- key: "getCustomResponse",
795
- value: function getCustomResponse(e, t) {
796
- return typeof e == "function" ? e(t) : e;
797
- }
798
- }, {
799
- key: "getResponse",
800
- value: function getResponse(e) {
801
- return e.customDemoResponse ? C.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
802
- text: C.generateResponse(e)
803
- };
804
- }
805
- // timeout is used to simulate a timeout for a response to come back
915
+ return request;
916
+ }() // prettier-ignore
806
917
  }, {
807
- key: "request",
808
- value: function request(e, t, n) {
809
- var s = C.getResponse(e);
810
- setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
811
- var o;
812
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
813
- while (1) switch (_context6.prev = _context6.next) {
918
+ key: "stream",
919
+ value: function () {
920
+ var _stream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, n) {
921
+ var h, f, s, o, a, l, c, u, d;
922
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
923
+ while (1) switch (_context9.prev = _context9.next) {
814
924
  case 0:
815
- _context6.next = 2;
816
- return n == null ? void 0 : n(s);
817
- case 2:
818
- _context6.t0 = _context6.sent;
819
- if (_context6.t0) {
820
- _context6.next = 5;
821
- break;
822
- }
823
- _context6.t0 = s;
925
+ s = !0, o = !1, a = null;
926
+ l = function l() {
927
+ o || !s || (a = n.addNewStreamedMessage(), e.streamHandlers.onOpen(), o = !0);
928
+ }, c = function c() {
929
+ s && (n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1);
930
+ }, u = function u(p) {
931
+ s && (!p || _typeof(p) != "object" || typeof p.error != "string" && typeof p.text != "string" ? console.error(ErrorMessages.INVALID_RESPONSE(p, "server", !1)) : p.error ? (console.error(p.error), n.finaliseStreamedMessage(), e.streamHandlers.onClose(), n.addNewErrorMessage("service", p.error), s = !1) : p.text && a && n.updateStreamedMessage(p.text, a));
932
+ };
933
+ e.streamHandlers.abortStream.abort = function () {
934
+ n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
935
+ };
936
+ d = CustomHandler.generateOptionalSignals();
937
+ (f = (h = e.requestSettings).handler) == null || f.call(h, t, _objectSpread(_objectSpread({}, d), {}, {
938
+ onOpen: l,
939
+ onResponse: u,
940
+ onClose: c,
941
+ stopClicked: e.streamHandlers.stopClicked
942
+ }));
824
943
  case 5:
825
- o = _context6.t0;
826
- o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
827
- case 7:
828
944
  case "end":
829
- return _context6.stop();
945
+ return _context9.stop();
830
946
  }
831
- }, _callee6);
832
- })), 400);
947
+ }, _callee9);
948
+ }));
949
+ function stream(_x16, _x17, _x18) {
950
+ return _stream.apply(this, arguments);
951
+ }
952
+ return stream;
953
+ }() // prettier-ignore
954
+ }, {
955
+ key: "websocket",
956
+ value: function websocket(e, t) {
957
+ var c, u;
958
+ var n = {
959
+ isOpen: !1,
960
+ newUserMessage: {
961
+ listener: function listener() {}
962
+ }
963
+ };
964
+ e.websocket = n;
965
+ var s = function s() {
966
+ t.removeError(), n.isOpen = !0;
967
+ },
968
+ o = function o() {
969
+ n.isOpen = !1;
970
+ },
971
+ a = /*#__PURE__*/function () {
972
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(d) {
973
+ var f, p, h;
974
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
975
+ while (1) switch (_context10.prev = _context10.next) {
976
+ case 0:
977
+ if (n.isOpen) {
978
+ _context10.next = 2;
979
+ break;
980
+ }
981
+ return _context10.abrupt("return");
982
+ case 2:
983
+ _context10.next = 4;
984
+ return (p = (f = e.deepChat).responseInterceptor) == null ? void 0 : p.call(f, d);
985
+ case 4:
986
+ _context10.t0 = _context10.sent;
987
+ if (_context10.t0) {
988
+ _context10.next = 7;
989
+ break;
990
+ }
991
+ _context10.t0 = d;
992
+ case 7:
993
+ h = _context10.t0;
994
+ !h || _typeof(h) != "object" || typeof h.error != "string" && typeof h.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message")) : typeof h.error == "string" ? (console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error)) : e.deepChat.stream ? Stream.simulate(t, e.streamHandlers, h.text) : t.addNewMessage(h, !0, !0);
995
+ case 9:
996
+ case "end":
997
+ return _context10.stop();
998
+ }
999
+ }, _callee10);
1000
+ }));
1001
+ return function a(_x19) {
1002
+ return _ref3.apply(this, arguments);
1003
+ };
1004
+ }(),
1005
+ l = CustomHandler.generateOptionalSignals();
1006
+ (u = (c = e.requestSettings).handler) == null || u.call(c, void 0, _objectSpread(_objectSpread({}, l), {}, {
1007
+ onOpen: s,
1008
+ onResponse: a,
1009
+ onClose: o,
1010
+ newUserMessage: n.newUserMessage
1011
+ }));
833
1012
  }
834
- // timeout is used to simulate a timeout for a response to come back
835
1013
  }, {
836
- key: "requestStream",
837
- value: function requestStream(e, t) {
838
- setTimeout(function () {
839
- var s;
840
- var n = (s = C.getResponse(e)) == null ? void 0 : s.text;
841
- Stream.simulate(e, t, n);
842
- }, 400);
1014
+ key: "generateOptionalSignals",
1015
+ value: function generateOptionalSignals() {
1016
+ return {
1017
+ onClose: function onClose() {},
1018
+ onOpen: function onOpen() {},
1019
+ stopClicked: {
1020
+ listener: function listener() {}
1021
+ },
1022
+ newUserMessage: {
1023
+ listener: function listener() {}
1024
+ }
1025
+ };
843
1026
  }
844
1027
  }]);
845
- return C;
1028
+ return CustomHandler;
846
1029
  }();
847
- _Demo.URL = "deep-chat-demo";
848
- var Demo = _Demo;
849
1030
  var HTTPRequest = /*#__PURE__*/function () {
850
1031
  function HTTPRequest() {
851
1032
  _classCallCheck(this, HTTPRequest);
@@ -854,12 +1035,13 @@ var HTTPRequest = /*#__PURE__*/function () {
854
1035
  key: "request",
855
1036
  value: // prettier-ignore
856
1037
  function () {
857
- var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
1038
+ var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
858
1039
  var s,
859
1040
  h,
860
- p,
861
1041
  f,
1042
+ p,
862
1043
  b,
1044
+ m,
863
1045
  o,
864
1046
  _yield$RequestUtils$p2,
865
1047
  a,
@@ -867,104 +1049,110 @@ var HTTPRequest = /*#__PURE__*/function () {
867
1049
  c,
868
1050
  u,
869
1051
  d,
870
- _args8 = arguments;
871
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
872
- while (1) switch (_context8.prev = _context8.next) {
1052
+ _args12 = arguments;
1053
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1054
+ while (1) switch (_context12.prev = _context12.next) {
873
1055
  case 0:
874
- s = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : !0;
1056
+ s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
875
1057
  o = {
876
1058
  body: t,
877
1059
  headers: (h = e.requestSettings) == null ? void 0 : h.headers
878
1060
  };
879
- _context8.next = 4;
1061
+ _context12.next = 4;
880
1062
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
881
1063
  case 4:
882
- _yield$RequestUtils$p2 = _context8.sent;
1064
+ _yield$RequestUtils$p2 = _context12.sent;
883
1065
  a = _yield$RequestUtils$p2.body;
884
1066
  l = _yield$RequestUtils$p2.headers;
885
1067
  c = _yield$RequestUtils$p2.error;
886
1068
  u = e.completionsHandlers.onFinish;
887
1069
  if (!c) {
888
- _context8.next = 11;
1070
+ _context12.next = 11;
889
1071
  break;
890
1072
  }
891
- return _context8.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
1073
+ return _context12.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
892
1074
  case 11:
893
- if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
894
- _context8.next = 13;
1075
+ if (!((f = e.requestSettings) != null && f.handler)) {
1076
+ _context12.next = 13;
895
1077
  break;
896
1078
  }
897
- return _context8.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1079
+ return _context12.abrupt("return", CustomHandler.request(e, a, n));
898
1080
  case 13:
1081
+ if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
1082
+ _context12.next = 15;
1083
+ break;
1084
+ }
1085
+ return _context12.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1086
+ case 15:
899
1087
  d = !0;
900
- fetch(((f = e.requestSettings) == null ? void 0 : f.url) || e.url || "", {
901
- method: ((b = e.requestSettings) == null ? void 0 : b.method) || "POST",
1088
+ fetch(((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", {
1089
+ method: ((m = e.requestSettings) == null ? void 0 : m.method) || "POST",
902
1090
  headers: l,
903
1091
  body: s ? JSON.stringify(a) : a
904
- }).then(function (m) {
905
- return d = !!m.ok, m;
906
- }).then(function (m) {
907
- return RequestUtils.processResponseByType(m);
1092
+ }).then(function (g) {
1093
+ return d = !!g.ok, g;
1094
+ }).then(function (g) {
1095
+ return RequestUtils.processResponseByType(g);
908
1096
  }).then( /*#__PURE__*/function () {
909
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(m) {
910
- var y, x, v, g;
911
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
912
- while (1) switch (_context7.prev = _context7.next) {
1097
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(g) {
1098
+ var S, E, v, y;
1099
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1100
+ while (1) switch (_context11.prev = _context11.next) {
913
1101
  case 0:
914
1102
  if (e.extractResultData) {
915
- _context7.next = 2;
1103
+ _context11.next = 2;
916
1104
  break;
917
1105
  }
918
- return _context7.abrupt("return");
1106
+ return _context11.abrupt("return");
919
1107
  case 2:
920
- _context7.next = 4;
921
- return (x = (y = e.deepChat).responseInterceptor) == null ? void 0 : x.call(y, m);
1108
+ _context11.next = 4;
1109
+ return (E = (S = e.deepChat).responseInterceptor) == null ? void 0 : E.call(S, g);
922
1110
  case 4:
923
- _context7.t0 = _context7.sent;
924
- if (_context7.t0) {
925
- _context7.next = 7;
1111
+ _context11.t0 = _context11.sent;
1112
+ if (_context11.t0) {
1113
+ _context11.next = 7;
926
1114
  break;
927
1115
  }
928
- _context7.t0 = m;
1116
+ _context11.t0 = g;
929
1117
  case 7:
930
- v = _context7.t0;
931
- _context7.next = 10;
1118
+ v = _context11.t0;
1119
+ _context11.next = 10;
932
1120
  return e.extractResultData(v);
933
1121
  case 10:
934
- g = _context7.sent;
1122
+ y = _context11.sent;
935
1123
  if (d) {
936
- _context7.next = 13;
1124
+ _context11.next = 13;
937
1125
  break;
938
1126
  }
939
- throw m;
1127
+ throw g;
940
1128
  case 13:
941
- if (!(!g || _typeof(g) != "object")) {
942
- _context7.next = 15;
1129
+ if (!(!y || _typeof(y) != "object")) {
1130
+ _context11.next = 15;
943
1131
  break;
944
1132
  }
945
- throw Error(ErrorMessages.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, v));
1133
+ throw Error(ErrorMessages.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, v));
946
1134
  case 15:
947
- g.pollingInAnotherRequest || (e.deepChat.stream && g.text ? Stream.simulate(n, e.streamHandlers, g.text) : (n.addNewMessage(g, !0, !0), u()));
1135
+ y.pollingInAnotherRequest || (e.deepChat.stream && y.text ? Stream.simulate(n, e.streamHandlers, y.text) : (n.addNewMessage(y, !0, !0), u()));
948
1136
  case 16:
949
1137
  case "end":
950
- return _context7.stop();
1138
+ return _context11.stop();
951
1139
  }
952
- }, _callee7);
1140
+ }, _callee11);
953
1141
  }));
954
- return function (_x14) {
955
- return _ref2.apply(this, arguments);
1142
+ return function (_x23) {
1143
+ return _ref4.apply(this, arguments);
956
1144
  };
957
- }())["catch"](function (m) {
958
- RequestUtils.displayError(n, m), u();
1145
+ }())["catch"](function (g) {
1146
+ RequestUtils.displayError(n, g), u();
959
1147
  });
960
- case 15:
1148
+ case 17:
961
1149
  case "end":
962
- return _context8.stop();
1150
+ return _context12.stop();
963
1151
  }
964
- }, _callee8);
1152
+ }, _callee12);
965
1153
  }));
966
- function request(_x11, _x12, _x13) {
967
- return _request2.apply(this, arguments);
1154
+ function request(_x20, _x21, _x22) {
1155
+ return _request3.apply(this, arguments);
968
1156
  }
969
1157
  return request;
970
1158
  }() // prettier-ignore
@@ -976,44 +1164,44 @@ var HTTPRequest = /*#__PURE__*/function () {
976
1164
  fetch(t, n).then(function (a) {
977
1165
  return a.json();
978
1166
  }).then( /*#__PURE__*/function () {
979
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(a) {
1167
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(a) {
980
1168
  var c, u, l;
981
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
982
- while (1) switch (_context9.prev = _context9.next) {
1169
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1170
+ while (1) switch (_context13.prev = _context13.next) {
983
1171
  case 0:
984
1172
  if (e.extractPollResultData) {
985
- _context9.next = 2;
1173
+ _context13.next = 2;
986
1174
  break;
987
1175
  }
988
- return _context9.abrupt("return");
1176
+ return _context13.abrupt("return");
989
1177
  case 2:
990
- _context9.t0 = e;
991
- _context9.next = 5;
1178
+ _context13.t0 = e;
1179
+ _context13.next = 5;
992
1180
  return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
993
1181
  case 5:
994
- _context9.t1 = _context9.sent;
995
- if (_context9.t1) {
996
- _context9.next = 8;
1182
+ _context13.t1 = _context13.sent;
1183
+ if (_context13.t1) {
1184
+ _context13.next = 8;
997
1185
  break;
998
1186
  }
999
- _context9.t1 = a;
1187
+ _context13.t1 = a;
1000
1188
  case 8:
1001
- _context9.t2 = _context9.t1;
1002
- _context9.next = 11;
1003
- return _context9.t0.extractPollResultData.call(_context9.t0, _context9.t2);
1189
+ _context13.t2 = _context13.t1;
1190
+ _context13.next = 11;
1191
+ return _context13.t0.extractPollResultData.call(_context13.t0, _context13.t2);
1004
1192
  case 11:
1005
- l = _context9.sent;
1193
+ l = _context13.sent;
1006
1194
  l.timeoutMS ? setTimeout(function () {
1007
1195
  HTTPRequest.executePollRequest(e, t, n, s);
1008
1196
  }, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
1009
1197
  case 13:
1010
1198
  case "end":
1011
- return _context9.stop();
1199
+ return _context13.stop();
1012
1200
  }
1013
- }, _callee9);
1201
+ }, _callee13);
1014
1202
  }));
1015
- return function (_x15) {
1016
- return _ref3.apply(this, arguments);
1203
+ return function (_x24) {
1204
+ return _ref5.apply(this, arguments);
1017
1205
  };
1018
1206
  }())["catch"](function (a) {
1019
1207
  RequestUtils.displayError(s, a), o();
@@ -1023,9 +1211,9 @@ var HTTPRequest = /*#__PURE__*/function () {
1023
1211
  }, {
1024
1212
  key: "poll",
1025
1213
  value: function () {
1026
- var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
1214
+ var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n) {
1027
1215
  var s,
1028
- f,
1216
+ p,
1029
1217
  b,
1030
1218
  m,
1031
1219
  o,
@@ -1036,42 +1224,42 @@ var HTTPRequest = /*#__PURE__*/function () {
1036
1224
  u,
1037
1225
  d,
1038
1226
  h,
1039
- p,
1040
- _args10 = arguments;
1041
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1042
- while (1) switch (_context10.prev = _context10.next) {
1227
+ f,
1228
+ _args14 = arguments;
1229
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1230
+ while (1) switch (_context14.prev = _context14.next) {
1043
1231
  case 0:
1044
- s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
1232
+ s = _args14.length > 3 && _args14[3] !== undefined ? _args14[3] : !0;
1045
1233
  o = {
1046
1234
  body: t,
1047
- headers: (f = e.requestSettings) == null ? void 0 : f.headers
1235
+ headers: (p = e.requestSettings) == null ? void 0 : p.headers
1048
1236
  };
1049
- _context10.next = 4;
1237
+ _context14.next = 4;
1050
1238
  return RequestUtils.processRequestInterceptor(e.deepChat, o);
1051
1239
  case 4:
1052
- _yield$RequestUtils$p3 = _context10.sent;
1240
+ _yield$RequestUtils$p3 = _context14.sent;
1053
1241
  a = _yield$RequestUtils$p3.body;
1054
1242
  l = _yield$RequestUtils$p3.headers;
1055
1243
  c = _yield$RequestUtils$p3.error;
1056
1244
  if (!c) {
1057
- _context10.next = 10;
1245
+ _context14.next = 10;
1058
1246
  break;
1059
1247
  }
1060
- return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1248
+ return _context14.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1061
1249
  case 10:
1062
- u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a, p = {
1250
+ u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a, f = {
1063
1251
  method: d,
1064
1252
  body: h,
1065
1253
  headers: l
1066
1254
  };
1067
- HTTPRequest.executePollRequest(e, u, p, n);
1255
+ HTTPRequest.executePollRequest(e, u, f, n);
1068
1256
  case 12:
1069
1257
  case "end":
1070
- return _context10.stop();
1258
+ return _context14.stop();
1071
1259
  }
1072
- }, _callee10);
1260
+ }, _callee14);
1073
1261
  }));
1074
- function poll(_x16, _x17, _x18) {
1262
+ function poll(_x25, _x26, _x27) {
1075
1263
  return _poll.apply(this, arguments);
1076
1264
  }
1077
1265
  return poll;
@@ -1112,9 +1300,9 @@ var MessageLimitUtils = /*#__PURE__*/function () {
1112
1300
  var n = 0,
1113
1301
  s = e.length - 1;
1114
1302
  for (s; s >= 0; s -= 1) {
1115
- var a = (o = e[s]) == null ? void 0 : o.text;
1116
- if (a !== void 0 && (n += a.length, n > t)) {
1117
- e[s].text = a.substring(0, a.length - (n - t));
1303
+ var _a = (o = e[s]) == null ? void 0 : o.text;
1304
+ if (_a !== void 0 && (n += _a.length, n > t)) {
1305
+ e[s].text = _a.substring(0, _a.length - (n - t));
1118
1306
  break;
1119
1307
  }
1120
1308
  }
@@ -1164,16 +1352,19 @@ var Websocket = /*#__PURE__*/function () {
1164
1352
  value: function createConnection(e, t) {
1165
1353
  if (!document.body.contains(e.deepChat)) return;
1166
1354
  var n = e.requestSettings.websocket;
1167
- if (n) try {
1168
- var s = typeof n != "boolean" ? n : void 0,
1169
- o = new WebSocket(e.requestSettings.url || "", s);
1170
- e.websocket = o, e.websocket.onopen = function () {
1171
- t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, o, t);
1172
- }, e.websocket.onerror = function (a) {
1173
- console.error(a), Websocket.retryConnection(e, t);
1174
- };
1175
- } catch (s) {
1176
- console.error(s), Websocket.retryConnection(e, t);
1355
+ if (n) {
1356
+ if (e.requestSettings.handler) return CustomHandler.websocket(e, t);
1357
+ try {
1358
+ var _s = typeof n != "boolean" ? n : void 0,
1359
+ _o = new WebSocket(e.requestSettings.url || "", _s);
1360
+ e.websocket = _o, e.websocket.onopen = function () {
1361
+ t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, _o, t);
1362
+ }, e.websocket.onerror = function (a) {
1363
+ console.error(a), Websocket.retryConnection(e, t);
1364
+ };
1365
+ } catch (s) {
1366
+ console.error(s), Websocket.retryConnection(e, t);
1367
+ }
1177
1368
  }
1178
1369
  }
1179
1370
  }, {
@@ -1187,53 +1378,53 @@ var Websocket = /*#__PURE__*/function () {
1187
1378
  key: "assignListeners",
1188
1379
  value: function assignListeners(e, t, n) {
1189
1380
  t.onmessage = /*#__PURE__*/function () {
1190
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
1381
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
1191
1382
  var o, a, l, c, u;
1192
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1193
- while (1) switch (_context11.prev = _context11.next) {
1383
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1384
+ while (1) switch (_context15.prev = _context15.next) {
1194
1385
  case 0:
1195
1386
  if (!e.extractResultData) {
1196
- _context11.next = 20;
1387
+ _context15.next = 20;
1197
1388
  break;
1198
1389
  }
1199
- _context11.prev = 1;
1390
+ _context15.prev = 1;
1200
1391
  l = JSON.parse(s.data);
1201
- _context11.next = 5;
1392
+ _context15.next = 5;
1202
1393
  return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
1203
1394
  case 5:
1204
- _context11.t0 = _context11.sent;
1205
- if (_context11.t0) {
1206
- _context11.next = 8;
1395
+ _context15.t0 = _context15.sent;
1396
+ if (_context15.t0) {
1397
+ _context15.next = 8;
1207
1398
  break;
1208
1399
  }
1209
- _context11.t0 = l;
1400
+ _context15.t0 = l;
1210
1401
  case 8:
1211
- c = _context11.t0;
1212
- _context11.next = 11;
1402
+ c = _context15.t0;
1403
+ _context15.next = 11;
1213
1404
  return e.extractResultData(c);
1214
1405
  case 11:
1215
- u = _context11.sent;
1406
+ u = _context15.sent;
1216
1407
  if (!(!u || _typeof(u) != "object")) {
1217
- _context11.next = 14;
1408
+ _context15.next = 14;
1218
1409
  break;
1219
1410
  }
1220
1411
  throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
1221
1412
  case 14:
1222
1413
  e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
1223
- _context11.next = 20;
1414
+ _context15.next = 20;
1224
1415
  break;
1225
1416
  case 17:
1226
- _context11.prev = 17;
1227
- _context11.t1 = _context11["catch"](1);
1228
- RequestUtils.displayError(n, _context11.t1, "Error in server message");
1417
+ _context15.prev = 17;
1418
+ _context15.t1 = _context15["catch"](1);
1419
+ RequestUtils.displayError(n, _context15.t1, "Error in server message");
1229
1420
  case 20:
1230
1421
  case "end":
1231
- return _context11.stop();
1422
+ return _context15.stop();
1232
1423
  }
1233
- }, _callee11, null, [[1, 17]]);
1424
+ }, _callee15, null, [[1, 17]]);
1234
1425
  }));
1235
- return function (_x19) {
1236
- return _ref4.apply(this, arguments);
1426
+ return function (_x28) {
1427
+ return _ref6.apply(this, arguments);
1237
1428
  };
1238
1429
  }(), t.onclose = function () {
1239
1430
  console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
@@ -1242,7 +1433,7 @@ var Websocket = /*#__PURE__*/function () {
1242
1433
  }, {
1243
1434
  key: "sendWebsocket",
1244
1435
  value: function () {
1245
- var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
1436
+ var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n) {
1246
1437
  var s,
1247
1438
  d,
1248
1439
  h,
@@ -1252,55 +1443,55 @@ var Websocket = /*#__PURE__*/function () {
1252
1443
  l,
1253
1444
  c,
1254
1445
  u,
1255
- _args12 = arguments;
1256
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1257
- while (1) switch (_context12.prev = _context12.next) {
1446
+ _args16 = arguments;
1447
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1448
+ while (1) switch (_context16.prev = _context16.next) {
1258
1449
  case 0:
1259
- s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
1450
+ s = _args16.length > 3 && _args16[3] !== undefined ? _args16[3] : !0;
1260
1451
  o = e.websocket;
1261
1452
  if (!(!o || o === "pending")) {
1262
- _context12.next = 4;
1453
+ _context16.next = 4;
1263
1454
  break;
1264
1455
  }
1265
- return _context12.abrupt("return");
1456
+ return _context16.abrupt("return");
1266
1457
  case 4:
1267
1458
  a = {
1268
1459
  body: t,
1269
1460
  headers: (d = e.requestSettings) == null ? void 0 : d.headers
1270
1461
  };
1271
- _context12.next = 7;
1462
+ _context16.next = 7;
1272
1463
  return RequestUtils.processRequestInterceptor(e.deepChat, a);
1273
1464
  case 7:
1274
- _yield$RequestUtils$p4 = _context12.sent;
1465
+ _yield$RequestUtils$p4 = _context16.sent;
1275
1466
  l = _yield$RequestUtils$p4.body;
1276
1467
  c = _yield$RequestUtils$p4.error;
1277
1468
  if (!c) {
1278
- _context12.next = 12;
1469
+ _context16.next = 12;
1279
1470
  break;
1280
1471
  }
1281
- return _context12.abrupt("return", n.addNewErrorMessage("service", c));
1472
+ return _context16.abrupt("return", n.addNewErrorMessage("service", c));
1282
1473
  case 12:
1283
1474
  if (Websocket.isWebSocket(o)) {
1284
- _context12.next = 14;
1475
+ _context16.next = 14;
1285
1476
  break;
1286
1477
  }
1287
- return _context12.abrupt("return", o.newUserMessage.listener(l));
1478
+ return _context16.abrupt("return", o.newUserMessage.listener(l));
1288
1479
  case 14:
1289
1480
  u = s ? JSON.stringify(l) : l;
1290
1481
  if (!(((h = e.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
1291
- _context12.next = 17;
1482
+ _context16.next = 17;
1292
1483
  break;
1293
1484
  }
1294
- return _context12.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
1485
+ return _context16.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
1295
1486
  case 17:
1296
1487
  o.readyState === void 0 || o.readyState !== o.OPEN ? (console.error("Connection is not open"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error")) : o.send(JSON.stringify(u));
1297
1488
  case 18:
1298
1489
  case "end":
1299
- return _context12.stop();
1490
+ return _context16.stop();
1300
1491
  }
1301
- }, _callee12);
1492
+ }, _callee16);
1302
1493
  }));
1303
- function sendWebsocket(_x20, _x21, _x22) {
1494
+ function sendWebsocket(_x29, _x30, _x31) {
1304
1495
  return _sendWebsocket.apply(this, arguments);
1305
1496
  }
1306
1497
  return sendWebsocket;
@@ -1806,13 +1997,13 @@ function normalizeReference(r) {
1806
1997
  return r.trim().replace(/\s+/g, " ").toUpperCase();
1807
1998
  }
1808
1999
  function parseReference(r, e, t, n) {
1809
- var s, o, a, l, c, u, d, h, p;
2000
+ var s, o, a, l, c, u, d, h, f;
1810
2001
  if (r.charCodeAt(0) !== 91 || r.indexOf("]:") === -1 || (s = new StateInline(r, e, t, n, []), o = parseLinkLabel(s, 0), o < 0 || r.charCodeAt(o + 1) !== 58)) return -1;
1811
2002
  for (l = s.posMax, a = o + 2; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1812
2003
  if (!parseLinkDestination(s, a)) return -1;
1813
2004
  for (d = s.linkContent, a = s.pos, u = a, a = a + 1; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
1814
2005
  for (a < l && u !== a && parseLinkTitle(s, a) ? (h = s.linkContent, a = s.pos) : (h = "", a = u); a < l && s.src.charCodeAt(a) === 32;) a++;
1815
- return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (p = normalizeReference(r.slice(1, o)), _typeof(n.references[p]) > "u" && (n.references[p] = {
2006
+ return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (f = normalizeReference(r.slice(1, o)), _typeof(n.references[f]) > "u" && (n.references[f] = {
1816
2007
  title: h,
1817
2008
  href: d
1818
2009
  }), a);
@@ -1849,9 +2040,9 @@ function footnote_block(r) {
1849
2040
  u,
1850
2041
  d = 0,
1851
2042
  h = !1,
1852
- p = {};
1853
- if (r.env.footnotes && (r.tokens = r.tokens.filter(function (f) {
1854
- return f.type === "footnote_reference_open" ? (h = !0, c = [], u = f.label, !1) : f.type === "footnote_reference_close" ? (h = !1, p[":" + u] = c, !1) : (h && c.push(f), !h);
2043
+ f = {};
2044
+ if (r.env.footnotes && (r.tokens = r.tokens.filter(function (p) {
2045
+ return p.type === "footnote_reference_open" ? (h = !0, c = [], u = p.label, !1) : p.type === "footnote_reference_close" ? (h = !1, f[":" + u] = c, !1) : (h && c.push(p), !h);
1855
2046
  }), !!r.env.footnotes.list)) {
1856
2047
  for (a = r.env.footnotes.list, r.tokens.push({
1857
2048
  type: "footnote_block_open",
@@ -1874,7 +2065,7 @@ function footnote_block(r) {
1874
2065
  type: "paragraph_close",
1875
2066
  tight: !1,
1876
2067
  level: --d
1877
- })) : a[e].label && (l = p[":" + a[e].label]), r.tokens = r.tokens.concat(l), r.tokens[r.tokens.length - 1].type === "paragraph_close" ? o = r.tokens.pop() : o = null, s = a[e].count > 0 ? a[e].count : 1, n = 0; n < s; n++) r.tokens.push({
2068
+ })) : a[e].label && (l = f[":" + a[e].label]), r.tokens = r.tokens.concat(l), r.tokens[r.tokens.length - 1].type === "paragraph_close" ? o = r.tokens.pop() : o = null, s = a[e].count > 0 ? a[e].count : 1, n = 0; n < s; n++) r.tokens.push({
1878
2069
  type: "footnote_anchor",
1879
2070
  id: e,
1880
2071
  subId: n,
@@ -1907,15 +2098,15 @@ function abbr2(r) {
1907
2098
  u,
1908
2099
  d,
1909
2100
  h,
1910
- p,
1911
- f = r.tokens;
2101
+ f,
2102
+ p = r.tokens;
1912
2103
  if (r.env.abbreviations) {
1913
- for (r.env.abbrRegExp || (p = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
2104
+ for (r.env.abbrRegExp || (f = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
1914
2105
  return b.substr(1);
1915
2106
  }).sort(function (b, m) {
1916
2107
  return m.length - b.length;
1917
- }).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(p, "g")), d = r.env.abbrRegExp, t = 0, n = f.length; t < n; t++) if (f[t].type === "inline") {
1918
- for (s = f[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
2108
+ }).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(f, "g")), d = r.env.abbrRegExp, t = 0, n = p.length; t < n; t++) if (p[t].type === "inline") {
2109
+ for (s = p[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
1919
2110
  for (c = 0, a = o.content, d.lastIndex = 0, u = o.level, l = []; h = d.exec(a);) d.lastIndex > c && l.push({
1920
2111
  type: "text",
1921
2112
  content: a.slice(c, h.index + h[1].length),
@@ -1936,7 +2127,7 @@ function abbr2(r) {
1936
2127
  type: "text",
1937
2128
  content: a.slice(c),
1938
2129
  level: u
1939
- }), f[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
2130
+ }), p[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
1940
2131
  }
1941
2132
  }
1942
2133
  }
@@ -1971,29 +2162,29 @@ function replaceAt(r, e, t) {
1971
2162
  return r.substr(0, e) + t + r.substr(e + 1);
1972
2163
  }
1973
2164
  function smartquotes(r) {
1974
- var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m, v, g;
2165
+ var e, t, n, s, o, a, l, c, u, d, h, f, p, b, m, g, v;
1975
2166
  if (r.options.typographer) {
1976
- for (g = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
1977
- for (v = r.tokens[m].children, g.length = 0, e = 0; e < v.length; e++) if (t = v[e], !(t.type !== "text" || QUOTE_TEST_RE.test(t.text))) {
1978
- for (l = v[e].level, f = g.length - 1; f >= 0 && !(g[f].level <= l); f--);
1979
- g.length = f + 1, n = t.content, o = 0, a = n.length;
2167
+ for (v = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
2168
+ for (g = r.tokens[m].children, v.length = 0, e = 0; e < g.length; e++) if (t = g[e], !(t.type !== "text" || QUOTE_TEST_RE.test(t.text))) {
2169
+ for (l = g[e].level, p = v.length - 1; p >= 0 && !(v[p].level <= l); p--);
2170
+ v.length = p + 1, n = t.content, o = 0, a = n.length;
1980
2171
  e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
1981
2172
  if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
1982
2173
  b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
1983
2174
  continue;
1984
2175
  }
1985
- if (h = !u, p = !c, p) {
1986
- for (f = g.length - 1; f >= 0 && (d = g[f], !(g[f].level < l)); f--) if (d.single === b && g[f].level === l) {
1987
- d = g[f], b ? (v[d.token].content = replaceAt(v[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (v[d.token].content = replaceAt(v[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), g.length = f;
2176
+ if (h = !u, f = !c, f) {
2177
+ for (p = v.length - 1; p >= 0 && (d = v[p], !(v[p].level < l)); p--) if (d.single === b && v[p].level === l) {
2178
+ d = v[p], b ? (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (g[d.token].content = replaceAt(g[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), v.length = p;
1988
2179
  continue e;
1989
2180
  }
1990
2181
  }
1991
- h ? g.push({
2182
+ h ? v.push({
1992
2183
  token: e,
1993
2184
  pos: s.index,
1994
2185
  single: b,
1995
2186
  level: l
1996
- }) : p && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
2187
+ }) : f && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
1997
2188
  }
1998
2189
  }
1999
2190
  }
@@ -2105,20 +2296,20 @@ function blockquote(r, e, t, n) {
2105
2296
  u,
2106
2297
  d,
2107
2298
  h,
2108
- p,
2109
2299
  f,
2300
+ p,
2110
2301
  b,
2111
2302
  m = r.bMarks[e] + r.tShift[e],
2112
- v = r.eMarks[e];
2113
- if (m > v || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
2303
+ g = r.eMarks[e];
2304
+ if (m > g || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
2114
2305
  if (n) return !0;
2115
- for (r.src.charCodeAt(m) === 32 && m++, c = r.blkIndent, r.blkIndent = 0, l = [r.bMarks[e]], r.bMarks[e] = m, m = m < v ? r.skipSpaces(m) : m, o = m >= v, a = [r.tShift[e]], r.tShift[e] = m - r.bMarks[e], h = r.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (m = r.bMarks[s] + r.tShift[s], v = r.eMarks[s], !(m >= v)); s++) {
2306
+ for (r.src.charCodeAt(m) === 32 && m++, c = r.blkIndent, r.blkIndent = 0, l = [r.bMarks[e]], r.bMarks[e] = m, m = m < g ? r.skipSpaces(m) : m, o = m >= g, a = [r.tShift[e]], r.tShift[e] = m - r.bMarks[e], h = r.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (m = r.bMarks[s] + r.tShift[s], g = r.eMarks[s], !(m >= g)); s++) {
2116
2307
  if (r.src.charCodeAt(m++) === 62) {
2117
- r.src.charCodeAt(m) === 32 && m++, l.push(r.bMarks[s]), r.bMarks[s] = m, m = m < v ? r.skipSpaces(m) : m, o = m >= v, a.push(r.tShift[s]), r.tShift[s] = m - r.bMarks[s];
2308
+ r.src.charCodeAt(m) === 32 && m++, l.push(r.bMarks[s]), r.bMarks[s] = m, m = m < g ? r.skipSpaces(m) : m, o = m >= g, a.push(r.tShift[s]), r.tShift[s] = m - r.bMarks[s];
2118
2309
  continue;
2119
2310
  }
2120
2311
  if (o) break;
2121
- for (b = !1, p = 0, f = h.length; p < f; p++) if (h[p](r, s, t, !0)) {
2312
+ for (b = !1, f = 0, p = h.length; f < p; f++) if (h[f](r, s, t, !0)) {
2122
2313
  b = !0;
2123
2314
  break;
2124
2315
  }
@@ -2132,7 +2323,7 @@ function blockquote(r, e, t, n) {
2132
2323
  }), r.parser.tokenize(r, e, s), r.tokens.push({
2133
2324
  type: "blockquote_close",
2134
2325
  level: --r.level
2135
- }), r.parentType = u, d[1] = r.line, p = 0; p < a.length; p++) r.bMarks[p + e] = l[p], r.tShift[p + e] = a[p];
2326
+ }), r.parentType = u, d[1] = r.line, f = 0; f < a.length; f++) r.bMarks[f + e] = l[f], r.tShift[f + e] = a[f];
2136
2327
  return r.blkIndent = c, !0;
2137
2328
  }
2138
2329
  function hr(r, e, t, n) {
@@ -2185,55 +2376,55 @@ function list(r, e, t, n) {
2185
2376
  u,
2186
2377
  d,
2187
2378
  h,
2188
- p,
2189
2379
  f,
2380
+ p,
2190
2381
  b,
2191
2382
  m,
2192
- v,
2193
2383
  g,
2384
+ v,
2194
2385
  y,
2386
+ S,
2387
+ E,
2195
2388
  x,
2196
- _,
2197
- I,
2198
2389
  R = !0,
2199
- w,
2200
- S,
2390
+ C,
2391
+ _,
2201
2392
  H,
2202
2393
  F;
2203
- if ((h = skipOrderedListMarker(r, e)) >= 0) v = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) v = !1;else return !1;
2394
+ if ((h = skipOrderedListMarker(r, e)) >= 0) g = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) g = !1;else return !1;
2204
2395
  if (r.level >= r.options.maxNesting) return !1;
2205
2396
  if (m = r.src.charCodeAt(h - 1), n) return !0;
2206
- for (y = r.tokens.length, v ? (d = r.bMarks[e] + r.tShift[e], b = Number(r.src.substr(d, h - d - 1)), r.tokens.push({
2397
+ for (y = r.tokens.length, g ? (d = r.bMarks[e] + r.tShift[e], b = Number(r.src.substr(d, h - d - 1)), r.tokens.push({
2207
2398
  type: "ordered_list_open",
2208
2399
  order: b,
2209
- lines: _ = [e, 0],
2400
+ lines: E = [e, 0],
2210
2401
  level: r.level++
2211
2402
  })) : r.tokens.push({
2212
2403
  type: "bullet_list_open",
2213
- lines: _ = [e, 0],
2404
+ lines: E = [e, 0],
2214
2405
  level: r.level++
2215
- }), s = e, x = !1, w = r.parser.ruler.getRules("list"); s < t && (g = r.skipSpaces(h), p = r.eMarks[s], g >= p ? f = 1 : f = g - h, f > 4 && (f = 1), f < 1 && (f = 1), o = h - r.bMarks[s] + f, r.tokens.push({
2406
+ }), s = e, S = !1, C = r.parser.ruler.getRules("list"); s < t && (v = r.skipSpaces(h), f = r.eMarks[s], v >= f ? p = 1 : p = v - h, p > 4 && (p = 1), p < 1 && (p = 1), o = h - r.bMarks[s] + p, r.tokens.push({
2216
2407
  type: "list_item_open",
2217
- lines: I = [e, 0],
2408
+ lines: x = [e, 0],
2218
2409
  level: r.level++
2219
- }), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = g - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || x) && (R = !1), x = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
2410
+ }), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = v - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || S) && (R = !1), S = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
2220
2411
  type: "list_item_close",
2221
2412
  level: --r.level
2222
- }), s = e = r.line, I[1] = s, g = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2223
- for (F = !1, S = 0, H = w.length; S < H; S++) if (w[S](r, s, t, !0)) {
2413
+ }), s = e = r.line, x[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2414
+ for (F = !1, _ = 0, H = C.length; _ < H; _++) if (C[_](r, s, t, !0)) {
2224
2415
  F = !0;
2225
2416
  break;
2226
2417
  }
2227
2418
  if (F) break;
2228
- if (v) {
2419
+ if (g) {
2229
2420
  if (h = skipOrderedListMarker(r, s), h < 0) break;
2230
2421
  } else if (h = skipBulletListMarker(r, s), h < 0) break;
2231
2422
  if (m !== r.src.charCodeAt(h - 1)) break;
2232
2423
  }
2233
2424
  return r.tokens.push({
2234
- type: v ? "ordered_list_close" : "bullet_list_close",
2425
+ type: g ? "ordered_list_close" : "bullet_list_close",
2235
2426
  level: --r.level
2236
- }), _[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2427
+ }), E[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2237
2428
  }
2238
2429
  function footnote(r, e, t, n) {
2239
2430
  var s,
@@ -2345,21 +2536,21 @@ function getLine(r, e) {
2345
2536
  return r.src.substr(t, n - t);
2346
2537
  }
2347
2538
  function table(r, e, t, n) {
2348
- var s, o, a, l, c, u, d, h, p, f, b;
2539
+ var s, o, a, l, c, u, d, h, f, p, b;
2349
2540
  if (e + 2 > t || (c = e + 1, r.tShift[c] < r.blkIndent) || (a = r.bMarks[c] + r.tShift[c], a >= r.eMarks[c]) || (s = r.src.charCodeAt(a), s !== 124 && s !== 45 && s !== 58) || (o = getLine(r, e + 1), !/^[-:| ]+$/.test(o)) || (u = o.split("|"), u <= 2)) return !1;
2350
2541
  for (h = [], l = 0; l < u.length; l++) {
2351
- if (p = u[l].trim(), !p) {
2542
+ if (f = u[l].trim(), !f) {
2352
2543
  if (l === 0 || l === u.length - 1) continue;
2353
2544
  return !1;
2354
2545
  }
2355
- if (!/^:?-+:?$/.test(p)) return !1;
2356
- p.charCodeAt(p.length - 1) === 58 ? h.push(p.charCodeAt(0) === 58 ? "center" : "right") : p.charCodeAt(0) === 58 ? h.push("left") : h.push("");
2546
+ if (!/^:?-+:?$/.test(f)) return !1;
2547
+ f.charCodeAt(f.length - 1) === 58 ? h.push(f.charCodeAt(0) === 58 ? "center" : "right") : f.charCodeAt(0) === 58 ? h.push("left") : h.push("");
2357
2548
  }
2358
2549
  if (o = getLine(r, e).trim(), o.indexOf("|") === -1 || (u = o.replace(/^\||\|$/g, "").split("|"), h.length !== u.length)) return !1;
2359
2550
  if (n) return !0;
2360
2551
  for (r.tokens.push({
2361
2552
  type: "table_open",
2362
- lines: f = [e, 0],
2553
+ lines: p = [e, 0],
2363
2554
  level: r.level++
2364
2555
  }), r.tokens.push({
2365
2556
  type: "thead_open",
@@ -2422,7 +2613,7 @@ function table(r, e, t, n) {
2422
2613
  }), r.tokens.push({
2423
2614
  type: "table_close",
2424
2615
  level: --r.level
2425
- }), f[1] = b[1] = c, r.line = c, !0;
2616
+ }), p[1] = b[1] = c, r.line = c, !0;
2426
2617
  }
2427
2618
  function skipMarker(r, e) {
2428
2619
  var t,
@@ -2438,7 +2629,7 @@ function markTightParagraphs$1(r, e) {
2438
2629
  for (t = e + 2, n = r.tokens.length - 2; t < n; t++) r.tokens[t].level === s && r.tokens[t].type === "paragraph_open" && (r.tokens[t + 2].tight = !0, r.tokens[t].tight = !0, t += 2);
2439
2630
  }
2440
2631
  function deflist(r, e, t, n) {
2441
- var s, o, a, l, c, u, d, h, p, f, b, m, v, g;
2632
+ var s, o, a, l, c, u, d, h, f, p, b, m, g, v;
2442
2633
  if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
2443
2634
  if (d = e + 1, r.isEmpty(d) && ++d > t || r.tShift[d] < r.blkIndent || (s = skipMarker(r, d), s < 0) || r.level >= r.options.maxNesting) return !1;
2444
2635
  u = r.tokens.length, r.tokens.push({
@@ -2447,7 +2638,7 @@ function deflist(r, e, t, n) {
2447
2638
  level: r.level++
2448
2639
  }), a = e, o = d;
2449
2640
  e: for (;;) {
2450
- for (g = !0, v = !1, r.tokens.push({
2641
+ for (v = !0, g = !1, r.tokens.push({
2451
2642
  type: "dt_open",
2452
2643
  lines: [a, a],
2453
2644
  level: r.level++
@@ -2465,7 +2656,7 @@ function deflist(r, e, t, n) {
2465
2656
  type: "dd_open",
2466
2657
  lines: l = [d, 0],
2467
2658
  level: r.level++
2468
- }), m = r.tight, p = r.ddIndent, h = r.blkIndent, b = r.tShift[o], f = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || v) && (g = !1), v = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = f, r.blkIndent = h, r.ddIndent = p, r.tokens.push({
2659
+ }), m = r.tight, f = r.ddIndent, h = r.blkIndent, b = r.tShift[o], p = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || g) && (v = !1), g = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = p, r.blkIndent = h, r.ddIndent = f, r.tokens.push({
2469
2660
  type: "dd_close",
2470
2661
  level: --r.level
2471
2662
  }), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
@@ -2477,7 +2668,7 @@ function deflist(r, e, t, n) {
2477
2668
  return r.tokens.push({
2478
2669
  type: "dl_close",
2479
2670
  level: --r.level
2480
- }), c[1] = d, r.line = d, g && markTightParagraphs$1(r, u), !0;
2671
+ }), c[1] = d, r.line = d, v && markTightParagraphs$1(r, u), !0;
2481
2672
  }
2482
2673
  function paragraph(r, e) {
2483
2674
  var t,
@@ -2842,21 +3033,21 @@ function links(r, e) {
2842
3033
  u,
2843
3034
  d = !1,
2844
3035
  h = r.pos,
2845
- p = r.posMax,
2846
- f = r.pos,
2847
- b = r.src.charCodeAt(f);
2848
- if (b === 33 && (d = !0, b = r.src.charCodeAt(++f)), b !== 91 || r.level >= r.options.maxNesting || (t = f + 1, n = parseLinkLabel(r, f), n < 0)) return !1;
2849
- if (l = n + 1, l < p && r.src.charCodeAt(l) === 40) {
2850
- for (l++; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2851
- if (l >= p) return !1;
2852
- for (f = l, parseLinkDestination(r, l) ? (o = r.linkContent, l = r.pos) : o = "", f = l; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2853
- if (l < p && f !== l && parseLinkTitle(r, l)) for (a = r.linkContent, l = r.pos; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);else a = "";
2854
- if (l >= p || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
3036
+ f = r.posMax,
3037
+ p = r.pos,
3038
+ b = r.src.charCodeAt(p);
3039
+ if (b === 33 && (d = !0, b = r.src.charCodeAt(++p)), b !== 91 || r.level >= r.options.maxNesting || (t = p + 1, n = parseLinkLabel(r, p), n < 0)) return !1;
3040
+ if (l = n + 1, l < f && r.src.charCodeAt(l) === 40) {
3041
+ for (l++; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3042
+ if (l >= f) return !1;
3043
+ for (p = l, parseLinkDestination(r, l) ? (o = r.linkContent, l = r.pos) : o = "", p = l; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3044
+ if (l < f && p !== l && parseLinkTitle(r, l)) for (a = r.linkContent, l = r.pos; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);else a = "";
3045
+ if (l >= f || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
2855
3046
  l++;
2856
3047
  } else {
2857
3048
  if (r.linkLevel > 0) return !1;
2858
- for (; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
2859
- if (l < p && r.src.charCodeAt(l) === 91 && (f = l + 1, l = parseLinkLabel(r, l), l >= 0 ? s = r.src.slice(f, l++) : l = f - 1), s || (_typeof(s) > "u" && (l = n + 1), s = r.src.slice(t, n)), c = r.env.references[normalizeReference(s)], !c) return r.pos = h, !1;
3049
+ for (; l < f && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
3050
+ if (l < f && r.src.charCodeAt(l) === 91 && (p = l + 1, l = parseLinkLabel(r, l), l >= 0 ? s = r.src.slice(p, l++) : l = p - 1), s || (_typeof(s) > "u" && (l = n + 1), s = r.src.slice(t, n)), c = r.env.references[normalizeReference(s)], !c) return r.pos = h, !1;
2860
3051
  o = c.href, a = c.title;
2861
3052
  }
2862
3053
  return e || (r.pos = t, r.posMax = n, d ? r.push({
@@ -2873,7 +3064,7 @@ function links(r, e) {
2873
3064
  }), r.linkLevel++, r.parser.tokenize(r), r.linkLevel--, r.push({
2874
3065
  type: "link_close",
2875
3066
  level: --r.level
2876
- }))), r.pos = l, r.posMax = p, !0;
3067
+ }))), r.pos = l, r.posMax = f, !0;
2877
3068
  }
2878
3069
  function footnote_inline(r, e) {
2879
3070
  var t,
@@ -3258,10 +3449,10 @@ var SetFileTypes = /*#__PURE__*/function () {
3258
3449
  key: "processMixedFiles",
3259
3450
  value: function processMixedFiles(e, t, n) {
3260
3451
  if (n) {
3261
- var s = {
3452
+ var _s2 = {
3262
3453
  acceptedFormats: ""
3263
3454
  };
3264
- e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, s, t, n);
3455
+ e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, _s2, t, n);
3265
3456
  }
3266
3457
  }
3267
3458
  // needs to be set after audio to overwrite maxNumberOfFiles
@@ -3269,12 +3460,12 @@ var SetFileTypes = /*#__PURE__*/function () {
3269
3460
  }, {
3270
3461
  key: "processMicrophone",
3271
3462
  value: function processMicrophone(e, t, n, s) {
3272
- var _c$files, _p$maxNumberOfFiles;
3273
- var l, c, u, d, h, p;
3463
+ var _c$files, _f$maxNumberOfFiles;
3464
+ var l, c, u, d, h, f;
3274
3465
  var a = _objectSpread({
3275
3466
  acceptedFormats: "audio/*"
3276
3467
  }, ((l = e.fileTypes.audio) == null ? void 0 : l.files) || {});
3277
- n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_p$maxNumberOfFiles = (p = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _p$maxNumberOfFiles !== void 0 ? _p$maxNumberOfFiles : p.maxNumberOfFiles = n.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = SetFileTypes.parseConfig(e.requestSettings, a, t, n)));
3468
+ n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_f$maxNumberOfFiles = (f = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _f$maxNumberOfFiles !== void 0 ? _f$maxNumberOfFiles : f.maxNumberOfFiles = n.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = SetFileTypes.parseConfig(e.requestSettings, a, t, n)));
3278
3469
  }
3279
3470
  // prettier-ignore
3280
3471
  }, {
@@ -3360,11 +3551,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
3360
3551
  }, {
3361
3552
  key: "callServiceAPI",
3362
3553
  value: function () {
3363
- var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
3554
+ var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
3364
3555
  var _c$headers, _u$ContentType;
3365
3556
  var l, c, u, d, s, o, a;
3366
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
3367
- while (1) switch (_context13.prev = _context13.next) {
3557
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3558
+ while (1) switch (_context17.prev = _context17.next) {
3368
3559
  case 0:
3369
3560
  s = _objectSpread({
3370
3561
  messages: t
@@ -3373,26 +3564,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
3373
3564
  (l = this.requestSettings.headers) != null && l["Content-Type"] || ((_c$headers = (c = this.requestSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_u$ContentType = (u = this.requestSettings.headers)["Content-Type"]) !== null && _u$ContentType !== void 0 ? _u$ContentType : u["Content-Type"] = "application/json", o = !0);
3374
3565
  a = this.deepChat.stream;
3375
3566
  if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
3376
- _context13.next = 9;
3567
+ _context17.next = 9;
3377
3568
  break;
3378
3569
  }
3379
- _context13.next = 7;
3570
+ _context17.next = 7;
3380
3571
  return Stream.request(this, s, e);
3381
3572
  case 7:
3382
- _context13.next = 11;
3573
+ _context17.next = 11;
3383
3574
  break;
3384
3575
  case 9:
3385
- _context13.next = 11;
3576
+ _context17.next = 11;
3386
3577
  return HTTPRequest.request(this, s, e);
3387
3578
  case 11:
3388
3579
  o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
3389
3580
  case 12:
3390
3581
  case "end":
3391
- return _context13.stop();
3582
+ return _context17.stop();
3392
3583
  }
3393
- }, _callee13, this);
3584
+ }, _callee17, this);
3394
3585
  }));
3395
- function callServiceAPI(_x23, _x24, _x25) {
3586
+ function callServiceAPI(_x32, _x33, _x34) {
3396
3587
  return _callServiceAPI.apply(this, arguments);
3397
3588
  }
3398
3589
  return callServiceAPI;
@@ -3400,24 +3591,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3400
3591
  }, {
3401
3592
  key: "callApiWithFiles",
3402
3593
  value: function () {
3403
- var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
3594
+ var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n, s) {
3404
3595
  var o, a, l;
3405
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
3406
- while (1) switch (_context14.prev = _context14.next) {
3596
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3597
+ while (1) switch (_context18.prev = _context18.next) {
3407
3598
  case 0:
3408
3599
  o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
3409
3600
  this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
3410
- _context14.next = 4;
3601
+ _context18.next = 4;
3411
3602
  return HTTPRequest.request(this, o, t, !1);
3412
3603
  case 4:
3413
3604
  this.requestSettings = a;
3414
3605
  case 5:
3415
3606
  case "end":
3416
- return _context14.stop();
3607
+ return _context18.stop();
3417
3608
  }
3418
- }, _callee14, this);
3609
+ }, _callee18, this);
3419
3610
  }));
3420
- function callApiWithFiles(_x26, _x27, _x28, _x29) {
3611
+ function callApiWithFiles(_x35, _x36, _x37, _x38) {
3421
3612
  return _callApiWithFiles.apply(this, arguments);
3422
3613
  }
3423
3614
  return callApiWithFiles;
@@ -3425,31 +3616,31 @@ var BaseServiceIO = /*#__PURE__*/function () {
3425
3616
  }, {
3426
3617
  key: "callAPI",
3427
3618
  value: function () {
3428
- var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t) {
3429
- var n, s;
3430
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
3431
- while (1) switch (_context15.prev = _context15.next) {
3619
+ var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e, t) {
3620
+ var n, _s3;
3621
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3622
+ while (1) switch (_context19.prev = _context19.next) {
3432
3623
  case 0:
3433
3624
  if (this.requestSettings) {
3434
- _context15.next = 2;
3625
+ _context19.next = 2;
3435
3626
  break;
3436
3627
  }
3437
3628
  throw new Error("Request settings have not been set up");
3438
3629
  case 2:
3439
3630
  n = MessageLimitUtils.processMessages(e, t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
3440
3631
  if (this.requestSettings.websocket) {
3441
- s = _objectSpread({
3632
+ _s3 = _objectSpread({
3442
3633
  messages: n
3443
3634
  }, this.rawBody);
3444
- Websocket.sendWebsocket(this, s, t, !1);
3635
+ Websocket.sendWebsocket(this, _s3, t, !1);
3445
3636
  } else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
3446
3637
  case 4:
3447
3638
  case "end":
3448
- return _context15.stop();
3639
+ return _context19.stop();
3449
3640
  }
3450
- }, _callee15, this);
3641
+ }, _callee19, this);
3451
3642
  }));
3452
- function callAPI(_x30, _x31) {
3643
+ function callAPI(_x39, _x40) {
3453
3644
  return _callAPI.apply(this, arguments);
3454
3645
  }
3455
3646
  return callAPI;
@@ -3458,24 +3649,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3458
3649
  }, {
3459
3650
  key: "extractResultData",
3460
3651
  value: function () {
3461
- var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e) {
3462
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3463
- while (1) switch (_context16.prev = _context16.next) {
3652
+ var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
3653
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3654
+ while (1) switch (_context20.prev = _context20.next) {
3464
3655
  case 0:
3465
3656
  if (!e.error) {
3466
- _context16.next = 2;
3657
+ _context20.next = 2;
3467
3658
  break;
3468
3659
  }
3469
3660
  throw e.error;
3470
3661
  case 2:
3471
- return _context16.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
3662
+ return _context20.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
3472
3663
  case 3:
3473
3664
  case "end":
3474
- return _context16.stop();
3665
+ return _context20.stop();
3475
3666
  }
3476
- }, _callee16);
3667
+ }, _callee20);
3477
3668
  }));
3478
- function extractResultData(_x32) {
3669
+ function extractResultData(_x41) {
3479
3670
  return _extractResultData.apply(this, arguments);
3480
3671
  }
3481
3672
  return extractResultData;
@@ -3692,8 +3883,8 @@ var InsertKeyView = /*#__PURE__*/function () {
3692
3883
  n.id = "insert-key-help-text-contents";
3693
3884
  var s = InsertKeyView.createFailText();
3694
3885
  if (n.appendChild(s), e) {
3695
- var a = InsertKeyView.createHelpLink(e);
3696
- n.appendChild(a);
3886
+ var _a2 = InsertKeyView.createHelpLink(e);
3887
+ n.appendChild(_a2);
3697
3888
  }
3698
3889
  var o = InsertKeyView.createCautionText();
3699
3890
  return n.appendChild(o), t.appendChild(n), {
@@ -3816,17 +4007,17 @@ var HuggingFaceUtils = /*#__PURE__*/function () {
3816
4007
  return HuggingFaceUtils;
3817
4008
  }();
3818
4009
  var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3819
- _inherits(j, _DirectServiceIO);
3820
- var _super3 = _createSuper(j);
4010
+ _inherits(U, _DirectServiceIO);
4011
+ var _super3 = _createSuper(U);
3821
4012
  // prettier-ignore
3822
- function j(e, t, n, s, o, a) {
4013
+ function U(e, t, n, s, o, a) {
3823
4014
  var _this4;
3824
- _classCallCheck(this, j);
3825
- _this4 = _super3.call(this, e, HuggingFaceUtils.buildKeyVerificationDetails(), HuggingFaceUtils.buildHeaders, o, a), _this4.insertKeyPlaceholderText = "Hugging Face Token", _this4.getKeyLink = "https://huggingface.co/settings/tokens", _this4.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this4.permittedErrorPrefixes = ["Authorization header"], _this4.url = "".concat(j.URL_PREFIX).concat(n), _this4.textInputPlaceholderText = t, _typeof(s) == "object" && (s.model && (_this4.url = "".concat(j.URL_PREFIX).concat(s.model)), s.options && (_this4.rawBody.options = s.options), s.parameters && (_this4.rawBody.parameters = s.parameters));
4015
+ _classCallCheck(this, U);
4016
+ _this4 = _super3.call(this, e, HuggingFaceUtils.buildKeyVerificationDetails(), HuggingFaceUtils.buildHeaders, o, a), _this4.insertKeyPlaceholderText = "Hugging Face Token", _this4.getKeyLink = "https://huggingface.co/settings/tokens", _this4.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this4.permittedErrorPrefixes = ["Authorization header"], _this4.url = "".concat(U.URL_PREFIX).concat(n), _this4.textInputPlaceholderText = t, _typeof(s) == "object" && (s.model && (_this4.url = "".concat(U.URL_PREFIX).concat(s.model)), s.options && (_this4.rawBody.options = s.options), s.parameters && (_this4.rawBody.parameters = s.parameters));
3826
4017
  return _this4;
3827
4018
  }
3828
4019
  // prettier-ignore
3829
- _createClass(j, [{
4020
+ _createClass(U, [{
3830
4021
  key: "preprocessBody",
3831
4022
  value: function preprocessBody(e, t, n) {
3832
4023
  var _s$options;
@@ -3839,13 +4030,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3839
4030
  }, {
3840
4031
  key: "callServiceAPI",
3841
4032
  value: function () {
3842
- var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
4033
+ var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
3843
4034
  var s;
3844
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3845
- while (1) switch (_context17.prev = _context17.next) {
4035
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4036
+ while (1) switch (_context21.prev = _context21.next) {
3846
4037
  case 0:
3847
4038
  if (this.requestSettings) {
3848
- _context17.next = 2;
4039
+ _context21.next = 2;
3849
4040
  break;
3850
4041
  }
3851
4042
  throw new Error("Request settings have not been set up");
@@ -3854,17 +4045,17 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3854
4045
  HTTPRequest.request(this, s, e);
3855
4046
  case 4:
3856
4047
  case "end":
3857
- return _context17.stop();
4048
+ return _context21.stop();
3858
4049
  }
3859
- }, _callee17, this);
4050
+ }, _callee21, this);
3860
4051
  }));
3861
- function callServiceAPI(_x33, _x34, _x35) {
4052
+ function callServiceAPI(_x42, _x43, _x44) {
3862
4053
  return _callServiceAPI2.apply(this, arguments);
3863
4054
  }
3864
4055
  return callServiceAPI;
3865
4056
  }()
3866
4057
  }]);
3867
- return j;
4058
+ return U;
3868
4059
  }(DirectServiceIO);
3869
4060
  _HuggingFaceIO.URL_PREFIX = "https://api-inference.huggingface.co/models/";
3870
4061
  var HuggingFaceIO = _HuggingFaceIO;
@@ -3887,18 +4078,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3887
4078
  }, {
3888
4079
  key: "callServiceAPI",
3889
4080
  value: function () {
3890
- var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n) {
3891
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3892
- while (1) switch (_context18.prev = _context18.next) {
4081
+ var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e, t, n) {
4082
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4083
+ while (1) switch (_context22.prev = _context22.next) {
3893
4084
  case 0:
3894
4085
  if (this.requestSettings) {
3895
- _context18.next = 2;
4086
+ _context22.next = 2;
3896
4087
  break;
3897
4088
  }
3898
4089
  throw new Error("Request settings have not been set up");
3899
4090
  case 2:
3900
4091
  if (n != null && n[0]) {
3901
- _context18.next = 4;
4092
+ _context22.next = 4;
3902
4093
  break;
3903
4094
  }
3904
4095
  throw new Error("No file was added");
@@ -3906,11 +4097,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3906
4097
  HTTPRequest.poll(this, n[0], e, !1);
3907
4098
  case 5:
3908
4099
  case "end":
3909
- return _context18.stop();
4100
+ return _context22.stop();
3910
4101
  }
3911
- }, _callee18, this);
4102
+ }, _callee22, this);
3912
4103
  }));
3913
- function callServiceAPI(_x36, _x37, _x38) {
4104
+ function callServiceAPI(_x45, _x46, _x47) {
3914
4105
  return _callServiceAPI3.apply(this, arguments);
3915
4106
  }
3916
4107
  return callServiceAPI;
@@ -3939,35 +4130,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
3939
4130
  _createClass(HuggingFaceAudioClassificationIO, [{
3940
4131
  key: "extractPollResultData",
3941
4132
  value: function () {
3942
- var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
4133
+ var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e) {
3943
4134
  var t;
3944
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3945
- while (1) switch (_context19.prev = _context19.next) {
4135
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4136
+ while (1) switch (_context23.prev = _context23.next) {
3946
4137
  case 0:
3947
4138
  if (!e.estimated_time) {
3948
- _context19.next = 2;
4139
+ _context23.next = 2;
3949
4140
  break;
3950
4141
  }
3951
- return _context19.abrupt("return", {
4142
+ return _context23.abrupt("return", {
3952
4143
  timeoutMS: (e.estimated_time + 1) * 1e3
3953
4144
  });
3954
4145
  case 2:
3955
4146
  if (!e.error) {
3956
- _context19.next = 4;
4147
+ _context23.next = 4;
3957
4148
  break;
3958
4149
  }
3959
4150
  throw e.error;
3960
4151
  case 4:
3961
- return _context19.abrupt("return", {
4152
+ return _context23.abrupt("return", {
3962
4153
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
3963
4154
  });
3964
4155
  case 5:
3965
4156
  case "end":
3966
- return _context19.stop();
4157
+ return _context23.stop();
3967
4158
  }
3968
- }, _callee19);
4159
+ }, _callee23);
3969
4160
  }));
3970
- function extractPollResultData(_x39) {
4161
+ function extractPollResultData(_x48) {
3971
4162
  return _extractPollResultData.apply(this, arguments);
3972
4163
  }
3973
4164
  return extractPollResultData;
@@ -3990,35 +4181,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
3990
4181
  _createClass(HuggingFaceImageClassificationIO, [{
3991
4182
  key: "extractPollResultData",
3992
4183
  value: function () {
3993
- var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
4184
+ var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
3994
4185
  var t;
3995
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3996
- while (1) switch (_context20.prev = _context20.next) {
4186
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4187
+ while (1) switch (_context24.prev = _context24.next) {
3997
4188
  case 0:
3998
4189
  if (!e.estimated_time) {
3999
- _context20.next = 2;
4190
+ _context24.next = 2;
4000
4191
  break;
4001
4192
  }
4002
- return _context20.abrupt("return", {
4193
+ return _context24.abrupt("return", {
4003
4194
  timeoutMS: (e.estimated_time + 1) * 1e3
4004
4195
  });
4005
4196
  case 2:
4006
4197
  if (!e.error) {
4007
- _context20.next = 4;
4198
+ _context24.next = 4;
4008
4199
  break;
4009
4200
  }
4010
4201
  throw e.error;
4011
4202
  case 4:
4012
- return _context20.abrupt("return", {
4203
+ return _context24.abrupt("return", {
4013
4204
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
4014
4205
  });
4015
4206
  case 5:
4016
4207
  case "end":
4017
- return _context20.stop();
4208
+ return _context24.stop();
4018
4209
  }
4019
- }, _callee20);
4210
+ }, _callee24);
4020
4211
  }));
4021
- function extractPollResultData(_x40) {
4212
+ function extractPollResultData(_x49) {
4022
4213
  return _extractPollResultData2.apply(this, arguments);
4023
4214
  }
4024
4215
  return extractPollResultData;
@@ -4103,19 +4294,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4103
4294
  }, {
4104
4295
  key: "callServiceAPI",
4105
4296
  value: function () {
4106
- var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
4297
+ var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e, t, n) {
4107
4298
  var s;
4108
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4109
- while (1) switch (_context21.prev = _context21.next) {
4299
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4300
+ while (1) switch (_context25.prev = _context25.next) {
4110
4301
  case 0:
4111
4302
  if (this.requestSettings) {
4112
- _context21.next = 2;
4303
+ _context25.next = 2;
4113
4304
  break;
4114
4305
  }
4115
4306
  throw new Error("Request settings have not been set up");
4116
4307
  case 2:
4117
4308
  if (n) {
4118
- _context21.next = 4;
4309
+ _context25.next = 4;
4119
4310
  break;
4120
4311
  }
4121
4312
  throw new Error("Image was not found");
@@ -4124,11 +4315,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4124
4315
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
4125
4316
  case 6:
4126
4317
  case "end":
4127
- return _context21.stop();
4318
+ return _context25.stop();
4128
4319
  }
4129
- }, _callee21, this);
4320
+ }, _callee25, this);
4130
4321
  }));
4131
- function callServiceAPI(_x41, _x42, _x43) {
4322
+ function callServiceAPI(_x50, _x51, _x52) {
4132
4323
  return _callServiceAPI4.apply(this, arguments);
4133
4324
  }
4134
4325
  return callServiceAPI;
@@ -4136,17 +4327,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4136
4327
  }, {
4137
4328
  key: "extractResultData",
4138
4329
  value: function () {
4139
- var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
4140
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4141
- while (1) switch (_context22.prev = _context22.next) {
4330
+ var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
4331
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4332
+ while (1) switch (_context26.prev = _context26.next) {
4142
4333
  case 0:
4143
4334
  if (!e.message) {
4144
- _context22.next = 2;
4335
+ _context26.next = 2;
4145
4336
  break;
4146
4337
  }
4147
4338
  throw e.message;
4148
4339
  case 2:
4149
- return _context22.abrupt("return", {
4340
+ return _context26.abrupt("return", {
4150
4341
  files: e.artifacts.map(function (n) {
4151
4342
  return {
4152
4343
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4156,11 +4347,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4156
4347
  });
4157
4348
  case 3:
4158
4349
  case "end":
4159
- return _context22.stop();
4350
+ return _context26.stop();
4160
4351
  }
4161
- }, _callee22);
4352
+ }, _callee26);
4162
4353
  }));
4163
- function extractResultData(_x44) {
4354
+ function extractResultData(_x53) {
4164
4355
  return _extractResultData2.apply(this, arguments);
4165
4356
  }
4166
4357
  return extractResultData;
@@ -4212,19 +4403,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4212
4403
  }, {
4213
4404
  key: "callServiceAPI",
4214
4405
  value: function () {
4215
- var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
4406
+ var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e, t, n) {
4216
4407
  var a, l, s, o;
4217
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4218
- while (1) switch (_context23.prev = _context23.next) {
4408
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4409
+ while (1) switch (_context27.prev = _context27.next) {
4219
4410
  case 0:
4220
4411
  if (this.requestSettings) {
4221
- _context23.next = 2;
4412
+ _context27.next = 2;
4222
4413
  break;
4223
4414
  }
4224
4415
  throw new Error("Request settings have not been set up");
4225
4416
  case 2:
4226
4417
  if (!(!n || !n[0] || !n[1])) {
4227
- _context23.next = 4;
4418
+ _context27.next = 4;
4228
4419
  break;
4229
4420
  }
4230
4421
  throw new Error("Image was not found");
@@ -4233,11 +4424,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4233
4424
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4234
4425
  case 6:
4235
4426
  case "end":
4236
- return _context23.stop();
4427
+ return _context27.stop();
4237
4428
  }
4238
- }, _callee23, this);
4429
+ }, _callee27, this);
4239
4430
  }));
4240
- function callServiceAPI(_x45, _x46, _x47) {
4431
+ function callServiceAPI(_x54, _x55, _x56) {
4241
4432
  return _callServiceAPI5.apply(this, arguments);
4242
4433
  }
4243
4434
  return callServiceAPI;
@@ -4245,17 +4436,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4245
4436
  }, {
4246
4437
  key: "extractResultData",
4247
4438
  value: function () {
4248
- var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
4249
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4250
- while (1) switch (_context24.prev = _context24.next) {
4439
+ var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4440
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4441
+ while (1) switch (_context28.prev = _context28.next) {
4251
4442
  case 0:
4252
4443
  if (!e.message) {
4253
- _context24.next = 2;
4444
+ _context28.next = 2;
4254
4445
  break;
4255
4446
  }
4256
4447
  throw e.message;
4257
4448
  case 2:
4258
- return _context24.abrupt("return", {
4449
+ return _context28.abrupt("return", {
4259
4450
  files: e.artifacts.map(function (n) {
4260
4451
  return {
4261
4452
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4265,11 +4456,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4265
4456
  });
4266
4457
  case 3:
4267
4458
  case "end":
4268
- return _context24.stop();
4459
+ return _context28.stop();
4269
4460
  }
4270
- }, _callee24);
4461
+ }, _callee28);
4271
4462
  }));
4272
- function extractResultData(_x48) {
4463
+ function extractResultData(_x57) {
4273
4464
  return _extractResultData3.apply(this, arguments);
4274
4465
  }
4275
4466
  return extractResultData;
@@ -4302,34 +4493,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
4302
4493
  _createClass(HuggingFaceAudioRecognitionIO, [{
4303
4494
  key: "extractPollResultData",
4304
4495
  value: function () {
4305
- var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
4306
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4307
- while (1) switch (_context25.prev = _context25.next) {
4496
+ var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4497
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4498
+ while (1) switch (_context29.prev = _context29.next) {
4308
4499
  case 0:
4309
4500
  if (!e.estimated_time) {
4310
- _context25.next = 2;
4501
+ _context29.next = 2;
4311
4502
  break;
4312
4503
  }
4313
- return _context25.abrupt("return", {
4504
+ return _context29.abrupt("return", {
4314
4505
  timeoutMS: (e.estimated_time + 1) * 1e3
4315
4506
  });
4316
4507
  case 2:
4317
4508
  if (!e.error) {
4318
- _context25.next = 4;
4509
+ _context29.next = 4;
4319
4510
  break;
4320
4511
  }
4321
4512
  throw e.error;
4322
4513
  case 4:
4323
- return _context25.abrupt("return", {
4514
+ return _context29.abrupt("return", {
4324
4515
  text: e.text || ""
4325
4516
  });
4326
4517
  case 5:
4327
4518
  case "end":
4328
- return _context25.stop();
4519
+ return _context29.stop();
4329
4520
  }
4330
- }, _callee25);
4521
+ }, _callee29);
4331
4522
  }));
4332
- function extractPollResultData(_x49) {
4523
+ function extractPollResultData(_x58) {
4333
4524
  return _extractPollResultData3.apply(this, arguments);
4334
4525
  }
4335
4526
  return extractPollResultData;
@@ -4350,26 +4541,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
4350
4541
  _createClass(HuggingFaceTextGenerationIO, [{
4351
4542
  key: "extractResultData",
4352
4543
  value: function () {
4353
- var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
4354
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4355
- while (1) switch (_context26.prev = _context26.next) {
4544
+ var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
4545
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4546
+ while (1) switch (_context30.prev = _context30.next) {
4356
4547
  case 0:
4357
4548
  if (!e.error) {
4358
- _context26.next = 2;
4549
+ _context30.next = 2;
4359
4550
  break;
4360
4551
  }
4361
4552
  throw e.error;
4362
4553
  case 2:
4363
- return _context26.abrupt("return", {
4554
+ return _context30.abrupt("return", {
4364
4555
  text: e[0].generated_text || ""
4365
4556
  });
4366
4557
  case 3:
4367
4558
  case "end":
4368
- return _context26.stop();
4559
+ return _context30.stop();
4369
4560
  }
4370
- }, _callee26);
4561
+ }, _callee30);
4371
4562
  }));
4372
- function extractResultData(_x50) {
4563
+ function extractResultData(_x59) {
4373
4564
  return _extractResultData4.apply(this, arguments);
4374
4565
  }
4375
4566
  return extractResultData;
@@ -4406,26 +4597,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
4406
4597
  }, {
4407
4598
  key: "extractResultData",
4408
4599
  value: function () {
4409
- var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
4410
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4411
- while (1) switch (_context27.prev = _context27.next) {
4600
+ var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4601
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4602
+ while (1) switch (_context31.prev = _context31.next) {
4412
4603
  case 0:
4413
4604
  if (!e.error) {
4414
- _context27.next = 2;
4605
+ _context31.next = 2;
4415
4606
  break;
4416
4607
  }
4417
4608
  throw e.error;
4418
4609
  case 2:
4419
- return _context27.abrupt("return", {
4610
+ return _context31.abrupt("return", {
4420
4611
  text: e.answer || ""
4421
4612
  });
4422
4613
  case 3:
4423
4614
  case "end":
4424
- return _context27.stop();
4615
+ return _context31.stop();
4425
4616
  }
4426
- }, _callee27);
4617
+ }, _callee31);
4427
4618
  }));
4428
- function extractResultData(_x51) {
4619
+ function extractResultData(_x60) {
4429
4620
  return _extractResultData5.apply(this, arguments);
4430
4621
  }
4431
4622
  return extractResultData;
@@ -4446,26 +4637,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
4446
4637
  _createClass(HuggingFaceSummarizationIO, [{
4447
4638
  key: "extractResultData",
4448
4639
  value: function () {
4449
- var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4450
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4451
- while (1) switch (_context28.prev = _context28.next) {
4640
+ var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4641
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4642
+ while (1) switch (_context32.prev = _context32.next) {
4452
4643
  case 0:
4453
4644
  if (!e.error) {
4454
- _context28.next = 2;
4645
+ _context32.next = 2;
4455
4646
  break;
4456
4647
  }
4457
4648
  throw e.error;
4458
4649
  case 2:
4459
- return _context28.abrupt("return", {
4650
+ return _context32.abrupt("return", {
4460
4651
  text: e[0].summary_text || ""
4461
4652
  });
4462
4653
  case 3:
4463
4654
  case "end":
4464
- return _context28.stop();
4655
+ return _context32.stop();
4465
4656
  }
4466
- }, _callee28);
4657
+ }, _callee32);
4467
4658
  }));
4468
- function extractResultData(_x52) {
4659
+ function extractResultData(_x61) {
4469
4660
  return _extractResultData6.apply(this, arguments);
4470
4661
  }
4471
4662
  return extractResultData;
@@ -4526,26 +4717,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
4526
4717
  }, {
4527
4718
  key: "extractResultData",
4528
4719
  value: function () {
4529
- var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4530
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4531
- while (1) switch (_context29.prev = _context29.next) {
4720
+ var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e) {
4721
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4722
+ while (1) switch (_context33.prev = _context33.next) {
4532
4723
  case 0:
4533
4724
  if (!e.error) {
4534
- _context29.next = 2;
4725
+ _context33.next = 2;
4535
4726
  break;
4536
4727
  }
4537
4728
  throw e.error;
4538
4729
  case 2:
4539
- return _context29.abrupt("return", {
4730
+ return _context33.abrupt("return", {
4540
4731
  text: e.generated_text || ""
4541
4732
  });
4542
4733
  case 3:
4543
4734
  case "end":
4544
- return _context29.stop();
4735
+ return _context33.stop();
4545
4736
  }
4546
- }, _callee29);
4737
+ }, _callee33);
4547
4738
  }));
4548
- function extractResultData(_x53) {
4739
+ function extractResultData(_x62) {
4549
4740
  return _extractResultData7.apply(this, arguments);
4550
4741
  }
4551
4742
  return extractResultData;
@@ -4587,19 +4778,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4587
4778
  }, {
4588
4779
  key: "callServiceAPI",
4589
4780
  value: function () {
4590
- var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e, t, n) {
4781
+ var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e, t, n) {
4591
4782
  var a, l, s, o;
4592
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4593
- while (1) switch (_context30.prev = _context30.next) {
4783
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4784
+ while (1) switch (_context34.prev = _context34.next) {
4594
4785
  case 0:
4595
4786
  if (this.requestSettings) {
4596
- _context30.next = 2;
4787
+ _context34.next = 2;
4597
4788
  break;
4598
4789
  }
4599
4790
  throw new Error("Request settings have not been set up");
4600
4791
  case 2:
4601
4792
  if (n) {
4602
- _context30.next = 4;
4793
+ _context34.next = 4;
4603
4794
  break;
4604
4795
  }
4605
4796
  throw new Error("Image was not found");
@@ -4608,11 +4799,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4608
4799
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4609
4800
  case 6:
4610
4801
  case "end":
4611
- return _context30.stop();
4802
+ return _context34.stop();
4612
4803
  }
4613
- }, _callee30, this);
4804
+ }, _callee34, this);
4614
4805
  }));
4615
- function callServiceAPI(_x54, _x55, _x56) {
4806
+ function callServiceAPI(_x63, _x64, _x65) {
4616
4807
  return _callServiceAPI6.apply(this, arguments);
4617
4808
  }
4618
4809
  return callServiceAPI;
@@ -4620,17 +4811,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4620
4811
  }, {
4621
4812
  key: "extractResultData",
4622
4813
  value: function () {
4623
- var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4624
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4625
- while (1) switch (_context31.prev = _context31.next) {
4814
+ var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4815
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4816
+ while (1) switch (_context35.prev = _context35.next) {
4626
4817
  case 0:
4627
4818
  if (!e.message) {
4628
- _context31.next = 2;
4819
+ _context35.next = 2;
4629
4820
  break;
4630
4821
  }
4631
4822
  throw e.message;
4632
4823
  case 2:
4633
- return _context31.abrupt("return", {
4824
+ return _context35.abrupt("return", {
4634
4825
  files: e.artifacts.map(function (n) {
4635
4826
  return {
4636
4827
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4640,11 +4831,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4640
4831
  });
4641
4832
  case 3:
4642
4833
  case "end":
4643
- return _context31.stop();
4834
+ return _context35.stop();
4644
4835
  }
4645
- }, _callee31);
4836
+ }, _callee35);
4646
4837
  }));
4647
- function extractResultData(_x57) {
4838
+ function extractResultData(_x66) {
4648
4839
  return _extractResultData8.apply(this, arguments);
4649
4840
  }
4650
4841
  return extractResultData;
@@ -4675,26 +4866,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
4675
4866
  _createClass(HuggingFaceTranslationIO, [{
4676
4867
  key: "extractResultData",
4677
4868
  value: function () {
4678
- var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4679
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4680
- while (1) switch (_context32.prev = _context32.next) {
4869
+ var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e) {
4870
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4871
+ while (1) switch (_context36.prev = _context36.next) {
4681
4872
  case 0:
4682
4873
  if (!e.error) {
4683
- _context32.next = 2;
4874
+ _context36.next = 2;
4684
4875
  break;
4685
4876
  }
4686
4877
  throw e.error;
4687
4878
  case 2:
4688
- return _context32.abrupt("return", {
4879
+ return _context36.abrupt("return", {
4689
4880
  text: e[0].translation_text || ""
4690
4881
  });
4691
4882
  case 3:
4692
4883
  case "end":
4693
- return _context32.stop();
4884
+ return _context36.stop();
4694
4885
  }
4695
- }, _callee32);
4886
+ }, _callee36);
4696
4887
  }));
4697
- function extractResultData(_x58) {
4888
+ function extractResultData(_x67) {
4698
4889
  return _extractResultData9.apply(this, arguments);
4699
4890
  }
4700
4891
  return extractResultData;
@@ -4728,13 +4919,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4728
4919
  }, {
4729
4920
  key: "callServiceAPI",
4730
4921
  value: function () {
4731
- var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t) {
4922
+ var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e, t) {
4732
4923
  var n;
4733
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4734
- while (1) switch (_context33.prev = _context33.next) {
4924
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4925
+ while (1) switch (_context37.prev = _context37.next) {
4735
4926
  case 0:
4736
4927
  if (this.requestSettings) {
4737
- _context33.next = 2;
4928
+ _context37.next = 2;
4738
4929
  break;
4739
4930
  }
4740
4931
  throw new Error("Request settings have not been set up");
@@ -4743,11 +4934,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4743
4934
  HTTPRequest.request(this, n, e);
4744
4935
  case 4:
4745
4936
  case "end":
4746
- return _context33.stop();
4937
+ return _context37.stop();
4747
4938
  }
4748
- }, _callee33, this);
4939
+ }, _callee37, this);
4749
4940
  }));
4750
- function callServiceAPI(_x59, _x60) {
4941
+ function callServiceAPI(_x68, _x69) {
4751
4942
  return _callServiceAPI7.apply(this, arguments);
4752
4943
  }
4753
4944
  return callServiceAPI;
@@ -4755,17 +4946,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4755
4946
  }, {
4756
4947
  key: "extractResultData",
4757
4948
  value: function () {
4758
- var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
4759
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4760
- while (1) switch (_context34.prev = _context34.next) {
4949
+ var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e) {
4950
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4951
+ while (1) switch (_context38.prev = _context38.next) {
4761
4952
  case 0:
4762
4953
  if (!e.message) {
4763
- _context34.next = 2;
4954
+ _context38.next = 2;
4764
4955
  break;
4765
4956
  }
4766
4957
  throw e.message;
4767
4958
  case 2:
4768
- return _context34.abrupt("return", {
4959
+ return _context38.abrupt("return", {
4769
4960
  files: e.artifacts.map(function (n) {
4770
4961
  return {
4771
4962
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4775,11 +4966,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4775
4966
  });
4776
4967
  case 3:
4777
4968
  case "end":
4778
- return _context34.stop();
4969
+ return _context38.stop();
4779
4970
  }
4780
- }, _callee34);
4971
+ }, _callee38);
4781
4972
  }));
4782
- function extractResultData(_x61) {
4973
+ function extractResultData(_x70) {
4783
4974
  return _extractResultData10.apply(this, arguments);
4784
4975
  }
4785
4976
  return extractResultData;
@@ -4812,26 +5003,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
4812
5003
  _createClass(HuggingFaceFillMaskIO, [{
4813
5004
  key: "extractResultData",
4814
5005
  value: function () {
4815
- var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4816
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4817
- while (1) switch (_context35.prev = _context35.next) {
5006
+ var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
5007
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
5008
+ while (1) switch (_context39.prev = _context39.next) {
4818
5009
  case 0:
4819
5010
  if (!e.error) {
4820
- _context35.next = 2;
5011
+ _context39.next = 2;
4821
5012
  break;
4822
5013
  }
4823
5014
  throw e.error;
4824
5015
  case 2:
4825
- return _context35.abrupt("return", {
5016
+ return _context39.abrupt("return", {
4826
5017
  text: e[0].sequence || ""
4827
5018
  });
4828
5019
  case 3:
4829
5020
  case "end":
4830
- return _context35.stop();
5021
+ return _context39.stop();
4831
5022
  }
4832
- }, _callee35);
5023
+ }, _callee39);
4833
5024
  }));
4834
- function extractResultData(_x62) {
5025
+ function extractResultData(_x71) {
4835
5026
  return _extractResultData11.apply(this, arguments);
4836
5027
  }
4837
5028
  return extractResultData;
@@ -4906,13 +5097,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4906
5097
  }, {
4907
5098
  key: "callServiceAPI",
4908
5099
  value: function () {
4909
- var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
5100
+ var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
4910
5101
  var n;
4911
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4912
- while (1) switch (_context36.prev = _context36.next) {
5102
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5103
+ while (1) switch (_context40.prev = _context40.next) {
4913
5104
  case 0:
4914
5105
  if (this.requestSettings) {
4915
- _context36.next = 2;
5106
+ _context40.next = 2;
4916
5107
  break;
4917
5108
  }
4918
5109
  throw new Error("Request settings have not been set up");
@@ -4921,11 +5112,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4921
5112
  HTTPRequest.request(this, n, e);
4922
5113
  case 4:
4923
5114
  case "end":
4924
- return _context36.stop();
5115
+ return _context40.stop();
4925
5116
  }
4926
- }, _callee36, this);
5117
+ }, _callee40, this);
4927
5118
  }));
4928
- function callServiceAPI(_x63, _x64) {
5119
+ function callServiceAPI(_x72, _x73) {
4929
5120
  return _callServiceAPI8.apply(this, arguments);
4930
5121
  }
4931
5122
  return callServiceAPI;
@@ -4933,27 +5124,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4933
5124
  }, {
4934
5125
  key: "extractResultData",
4935
5126
  value: function () {
4936
- var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
5127
+ var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
4937
5128
  var t;
4938
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4939
- while (1) switch (_context37.prev = _context37.next) {
5129
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5130
+ while (1) switch (_context41.prev = _context41.next) {
4940
5131
  case 0:
4941
5132
  if (!e.message) {
4942
- _context37.next = 2;
5133
+ _context41.next = 2;
4943
5134
  break;
4944
5135
  }
4945
5136
  throw e.message;
4946
5137
  case 2:
4947
- return _context37.abrupt("return", {
5138
+ return _context41.abrupt("return", {
4948
5139
  text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
4949
5140
  });
4950
5141
  case 3:
4951
5142
  case "end":
4952
- return _context37.stop();
5143
+ return _context41.stop();
4953
5144
  }
4954
- }, _callee37);
5145
+ }, _callee41);
4955
5146
  }));
4956
- function extractResultData(_x65) {
5147
+ function extractResultData(_x74) {
4957
5148
  return _extractResultData12.apply(this, arguments);
4958
5149
  }
4959
5150
  return extractResultData;
@@ -4983,13 +5174,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
4983
5174
  }, {
4984
5175
  key: "callServiceAPI",
4985
5176
  value: function () {
4986
- var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
5177
+ var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e, t) {
4987
5178
  var n;
4988
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4989
- while (1) switch (_context38.prev = _context38.next) {
5179
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5180
+ while (1) switch (_context42.prev = _context42.next) {
4990
5181
  case 0:
4991
5182
  if (this.requestSettings) {
4992
- _context38.next = 2;
5183
+ _context42.next = 2;
4993
5184
  break;
4994
5185
  }
4995
5186
  throw new Error("Request settings have not been set up");
@@ -4998,11 +5189,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
4998
5189
  HTTPRequest.request(this, n, e);
4999
5190
  case 4:
5000
5191
  case "end":
5001
- return _context38.stop();
5192
+ return _context42.stop();
5002
5193
  }
5003
- }, _callee38, this);
5194
+ }, _callee42, this);
5004
5195
  }));
5005
- function callServiceAPI(_x66, _x67) {
5196
+ function callServiceAPI(_x75, _x76) {
5006
5197
  return _callServiceAPI9.apply(this, arguments);
5007
5198
  }
5008
5199
  return callServiceAPI;
@@ -5010,26 +5201,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
5010
5201
  }, {
5011
5202
  key: "extractResultData",
5012
5203
  value: function () {
5013
- var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
5014
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
5015
- while (1) switch (_context39.prev = _context39.next) {
5204
+ var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e) {
5205
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5206
+ while (1) switch (_context43.prev = _context43.next) {
5016
5207
  case 0:
5017
5208
  if (!e.message) {
5018
- _context39.next = 2;
5209
+ _context43.next = 2;
5019
5210
  break;
5020
5211
  }
5021
5212
  throw e.message;
5022
5213
  case 2:
5023
- return _context39.abrupt("return", {
5214
+ return _context43.abrupt("return", {
5024
5215
  text: e.summary || ""
5025
5216
  });
5026
5217
  case 3:
5027
5218
  case "end":
5028
- return _context39.stop();
5219
+ return _context43.stop();
5029
5220
  }
5030
- }, _callee39);
5221
+ }, _callee43);
5031
5222
  }));
5032
- function extractResultData(_x68) {
5223
+ function extractResultData(_x77) {
5033
5224
  return _extractResultData13.apply(this, arguments);
5034
5225
  }
5035
5226
  return extractResultData;
@@ -5186,13 +5377,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5186
5377
  }, {
5187
5378
  key: "callServiceAPI",
5188
5379
  value: function () {
5189
- var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
5380
+ var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e, t) {
5190
5381
  var n;
5191
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5192
- while (1) switch (_context40.prev = _context40.next) {
5382
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5383
+ while (1) switch (_context44.prev = _context44.next) {
5193
5384
  case 0:
5194
5385
  if (this.requestSettings) {
5195
- _context40.next = 2;
5386
+ _context44.next = 2;
5196
5387
  break;
5197
5388
  }
5198
5389
  throw new Error("Request settings have not been set up");
@@ -5201,11 +5392,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5201
5392
  HTTPRequest.request(this, n, e), this.messages = e;
5202
5393
  case 4:
5203
5394
  case "end":
5204
- return _context40.stop();
5395
+ return _context44.stop();
5205
5396
  }
5206
- }, _callee40, this);
5397
+ }, _callee44, this);
5207
5398
  }));
5208
- function callServiceAPI(_x69, _x70) {
5399
+ function callServiceAPI(_x78, _x79) {
5209
5400
  return _callServiceAPI10.apply(this, arguments);
5210
5401
  }
5211
5402
  return callServiceAPI;
@@ -5213,34 +5404,34 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5213
5404
  }, {
5214
5405
  key: "extractResultData",
5215
5406
  value: function () {
5216
- var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
5217
- var t, n, s;
5218
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5219
- while (1) switch (_context41.prev = _context41.next) {
5407
+ var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e) {
5408
+ var t, n, _s4;
5409
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5410
+ while (1) switch (_context45.prev = _context45.next) {
5220
5411
  case 0:
5221
5412
  if (!e.error) {
5222
- _context41.next = 2;
5413
+ _context45.next = 2;
5223
5414
  break;
5224
5415
  }
5225
5416
  throw e.error.message;
5226
5417
  case 2:
5227
5418
  if (this.messages && this.completionsHandlers) {
5228
- n = e.headers.get("operation-location"), s = {
5419
+ n = e.headers.get("operation-location"), _s4 = {
5229
5420
  method: "GET",
5230
5421
  headers: (t = this.requestSettings) == null ? void 0 : t.headers
5231
5422
  };
5232
- HTTPRequest.executePollRequest(this, n, s, this.messages);
5423
+ HTTPRequest.executePollRequest(this, n, _s4, this.messages);
5233
5424
  }
5234
- return _context41.abrupt("return", {
5425
+ return _context45.abrupt("return", {
5235
5426
  pollingInAnotherRequest: !0
5236
5427
  });
5237
5428
  case 4:
5238
5429
  case "end":
5239
- return _context41.stop();
5430
+ return _context45.stop();
5240
5431
  }
5241
- }, _callee41, this);
5432
+ }, _callee45, this);
5242
5433
  }));
5243
- function extractResultData(_x71) {
5434
+ function extractResultData(_x80) {
5244
5435
  return _extractResultData14.apply(this, arguments);
5245
5436
  }
5246
5437
  return extractResultData;
@@ -5248,33 +5439,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5248
5439
  }, {
5249
5440
  key: "extractPollResultData",
5250
5441
  value: function () {
5251
- var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
5442
+ var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e) {
5252
5443
  var t, _iterator, _step, n;
5253
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5254
- while (1) switch (_context42.prev = _context42.next) {
5444
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5445
+ while (1) switch (_context46.prev = _context46.next) {
5255
5446
  case 0:
5256
5447
  if (!e.error) {
5257
- _context42.next = 2;
5448
+ _context46.next = 2;
5258
5449
  break;
5259
5450
  }
5260
5451
  throw e.error;
5261
5452
  case 2:
5262
5453
  if (!(e.status === "running")) {
5263
- _context42.next = 4;
5454
+ _context46.next = 4;
5264
5455
  break;
5265
5456
  }
5266
- return _context42.abrupt("return", {
5457
+ return _context46.abrupt("return", {
5267
5458
  timeoutMS: 2e3
5268
5459
  });
5269
5460
  case 4:
5270
5461
  if (!(e.errors.length > 0)) {
5271
- _context42.next = 6;
5462
+ _context46.next = 6;
5272
5463
  break;
5273
5464
  }
5274
5465
  throw e.errors[0];
5275
5466
  case 6:
5276
5467
  if (!(e.tasks.items[0].results.errors.length > 0)) {
5277
- _context42.next = 8;
5468
+ _context46.next = 8;
5278
5469
  break;
5279
5470
  }
5280
5471
  throw e.tasks.items[0].results.errors[0];
@@ -5291,16 +5482,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5291
5482
  } finally {
5292
5483
  _iterator.f();
5293
5484
  }
5294
- return _context42.abrupt("return", {
5485
+ return _context46.abrupt("return", {
5295
5486
  text: t || ""
5296
5487
  });
5297
5488
  case 12:
5298
5489
  case "end":
5299
- return _context42.stop();
5490
+ return _context46.stop();
5300
5491
  }
5301
- }, _callee42);
5492
+ }, _callee46);
5302
5493
  }));
5303
- function extractPollResultData(_x72) {
5494
+ function extractPollResultData(_x81) {
5304
5495
  return _extractPollResultData4.apply(this, arguments);
5305
5496
  }
5306
5497
  return extractPollResultData;
@@ -5399,13 +5590,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5399
5590
  }, {
5400
5591
  key: "callServiceAPI",
5401
5592
  value: function () {
5402
- var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
5593
+ var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e, t) {
5403
5594
  var n;
5404
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5405
- while (1) switch (_context43.prev = _context43.next) {
5595
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5596
+ while (1) switch (_context47.prev = _context47.next) {
5406
5597
  case 0:
5407
5598
  if (this.requestSettings) {
5408
- _context43.next = 2;
5599
+ _context47.next = 2;
5409
5600
  break;
5410
5601
  }
5411
5602
  throw new Error("Request settings have not been set up");
@@ -5414,11 +5605,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5414
5605
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
5415
5606
  case 4:
5416
5607
  case "end":
5417
- return _context43.stop();
5608
+ return _context47.stop();
5418
5609
  }
5419
- }, _callee43, this);
5610
+ }, _callee47, this);
5420
5611
  }));
5421
- function callServiceAPI(_x73, _x74) {
5612
+ function callServiceAPI(_x82, _x83) {
5422
5613
  return _callServiceAPI11.apply(this, arguments);
5423
5614
  }
5424
5615
  return callServiceAPI;
@@ -5426,27 +5617,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5426
5617
  }, {
5427
5618
  key: "extractResultData",
5428
5619
  value: function () {
5429
- var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
5620
+ var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e) {
5430
5621
  var t;
5431
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5432
- while (1) switch (_context44.prev = _context44.next) {
5622
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5623
+ while (1) switch (_context48.prev = _context48.next) {
5433
5624
  case 0:
5434
5625
  if (!e.error) {
5435
- _context44.next = 2;
5626
+ _context48.next = 2;
5436
5627
  break;
5437
5628
  }
5438
5629
  throw e.error.message;
5439
5630
  case 2:
5440
- return _context44.abrupt("return", {
5631
+ return _context48.abrupt("return", {
5441
5632
  text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
5442
5633
  });
5443
5634
  case 3:
5444
5635
  case "end":
5445
- return _context44.stop();
5636
+ return _context48.stop();
5446
5637
  }
5447
- }, _callee44);
5638
+ }, _callee48);
5448
5639
  }));
5449
- function extractResultData(_x75) {
5640
+ function extractResultData(_x84) {
5450
5641
  return _extractResultData15.apply(this, arguments);
5451
5642
  }
5452
5643
  return extractResultData;
@@ -5461,17 +5652,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5461
5652
  _createClass(AssemblyAIUtils, null, [{
5462
5653
  key: "poll",
5463
5654
  value: function () {
5464
- var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
5655
+ var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t) {
5465
5656
  var n, l, c, d;
5466
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5467
- while (1) switch (_context45.prev = _context45.next) {
5657
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5658
+ while (1) switch (_context49.prev = _context49.next) {
5468
5659
  case 0:
5469
5660
  n = {
5470
5661
  authorization: e,
5471
5662
  "content-type": "application/json"
5472
5663
  };
5473
- _context45.t0 = "https://api.assemblyai.com/v2/transcript/";
5474
- _context45.next = 4;
5664
+ _context49.t0 = "https://api.assemblyai.com/v2/transcript/";
5665
+ _context49.next = 4;
5475
5666
  return fetch("https://api.assemblyai.com/v2/transcript", {
5476
5667
  method: "POST",
5477
5668
  body: JSON.stringify({
@@ -5480,55 +5671,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5480
5671
  headers: n
5481
5672
  });
5482
5673
  case 4:
5483
- _context45.next = 6;
5484
- return _context45.sent.json();
5674
+ _context49.next = 6;
5675
+ return _context49.sent.json();
5485
5676
  case 6:
5486
- _context45.t1 = _context45.sent.id;
5487
- l = _context45.t0.concat.call(_context45.t0, _context45.t1);
5677
+ _context49.t1 = _context49.sent.id;
5678
+ l = _context49.t0.concat.call(_context49.t0, _context49.t1);
5488
5679
  case 8:
5489
5680
  if (c) {
5490
- _context45.next = 24;
5681
+ _context49.next = 24;
5491
5682
  break;
5492
5683
  }
5493
- _context45.next = 11;
5684
+ _context49.next = 11;
5494
5685
  return fetch(l, {
5495
5686
  headers: n
5496
5687
  });
5497
5688
  case 11:
5498
- _context45.next = 13;
5499
- return _context45.sent.json();
5689
+ _context49.next = 13;
5690
+ return _context49.sent.json();
5500
5691
  case 13:
5501
- d = _context45.sent;
5692
+ d = _context49.sent;
5502
5693
  if (!(d.status === "completed")) {
5503
- _context45.next = 18;
5694
+ _context49.next = 18;
5504
5695
  break;
5505
5696
  }
5506
5697
  c = d;
5507
- _context45.next = 22;
5698
+ _context49.next = 22;
5508
5699
  break;
5509
5700
  case 18:
5510
5701
  if (!(d.status === "error")) {
5511
- _context45.next = 20;
5702
+ _context49.next = 20;
5512
5703
  break;
5513
5704
  }
5514
5705
  throw new Error("Transcription failed: ".concat(d.error));
5515
5706
  case 20:
5516
- _context45.next = 22;
5707
+ _context49.next = 22;
5517
5708
  return new Promise(function (h) {
5518
5709
  return setTimeout(h, 3e3);
5519
5710
  });
5520
5711
  case 22:
5521
- _context45.next = 8;
5712
+ _context49.next = 8;
5522
5713
  break;
5523
5714
  case 24:
5524
- return _context45.abrupt("return", c);
5715
+ return _context49.abrupt("return", c);
5525
5716
  case 25:
5526
5717
  case "end":
5527
- return _context45.stop();
5718
+ return _context49.stop();
5528
5719
  }
5529
- }, _callee45);
5720
+ }, _callee49);
5530
5721
  }));
5531
- function poll(_x76, _x77) {
5722
+ function poll(_x85, _x86) {
5532
5723
  return _poll2.apply(this, arguments);
5533
5724
  }
5534
5725
  return poll;
@@ -5576,19 +5767,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5576
5767
  _createClass(AssemblyAIAudioIO, [{
5577
5768
  key: "callServiceAPI",
5578
5769
  value: function () {
5579
- var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t, n) {
5770
+ var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
5580
5771
  var s;
5581
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5582
- while (1) switch (_context46.prev = _context46.next) {
5772
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5773
+ while (1) switch (_context50.prev = _context50.next) {
5583
5774
  case 0:
5584
5775
  if ((s = this.requestSettings) != null && s.headers) {
5585
- _context46.next = 2;
5776
+ _context50.next = 2;
5586
5777
  break;
5587
5778
  }
5588
5779
  throw new Error("Request settings have not been set up");
5589
5780
  case 2:
5590
5781
  if (n != null && n[0]) {
5591
- _context46.next = 4;
5782
+ _context50.next = 4;
5592
5783
  break;
5593
5784
  }
5594
5785
  throw new Error("No file was added");
@@ -5596,11 +5787,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5596
5787
  HTTPRequest.request(this, n[0], e, !1);
5597
5788
  case 5:
5598
5789
  case "end":
5599
- return _context46.stop();
5790
+ return _context50.stop();
5600
5791
  }
5601
- }, _callee46, this);
5792
+ }, _callee50, this);
5602
5793
  }));
5603
- function callServiceAPI(_x78, _x79, _x80) {
5794
+ function callServiceAPI(_x87, _x88, _x89) {
5604
5795
  return _callServiceAPI12.apply(this, arguments);
5605
5796
  }
5606
5797
  return callServiceAPI;
@@ -5608,32 +5799,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5608
5799
  }, {
5609
5800
  key: "extractResultData",
5610
5801
  value: function () {
5611
- var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
5802
+ var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
5612
5803
  var s, o, t;
5613
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5614
- while (1) switch (_context47.prev = _context47.next) {
5804
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5805
+ while (1) switch (_context51.prev = _context51.next) {
5615
5806
  case 0:
5616
5807
  if (!e.error) {
5617
- _context47.next = 2;
5808
+ _context51.next = 2;
5618
5809
  break;
5619
5810
  }
5620
5811
  throw e.error;
5621
5812
  case 2:
5622
5813
  t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
5623
- _context47.next = 5;
5814
+ _context51.next = 5;
5624
5815
  return AssemblyAIUtils.poll(t, e.upload_url);
5625
5816
  case 5:
5626
- _context47.t0 = _context47.sent.text;
5627
- return _context47.abrupt("return", {
5628
- text: _context47.t0
5817
+ _context51.t0 = _context51.sent.text;
5818
+ return _context51.abrupt("return", {
5819
+ text: _context51.t0
5629
5820
  });
5630
5821
  case 7:
5631
5822
  case "end":
5632
- return _context47.stop();
5823
+ return _context51.stop();
5633
5824
  }
5634
- }, _callee47, this);
5825
+ }, _callee51, this);
5635
5826
  }));
5636
- function extractResultData(_x81) {
5827
+ function extractResultData(_x90) {
5637
5828
  return _extractResultData16.apply(this, arguments);
5638
5829
  }
5639
5830
  return extractResultData;
@@ -5683,13 +5874,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5683
5874
  }, {
5684
5875
  key: "callServiceAPI",
5685
5876
  value: function () {
5686
- var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
5877
+ var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
5687
5878
  var n;
5688
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5689
- while (1) switch (_context48.prev = _context48.next) {
5879
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5880
+ while (1) switch (_context52.prev = _context52.next) {
5690
5881
  case 0:
5691
5882
  if (this.requestSettings) {
5692
- _context48.next = 2;
5883
+ _context52.next = 2;
5693
5884
  break;
5694
5885
  }
5695
5886
  throw new Error("Request settings have not been set up");
@@ -5698,11 +5889,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5698
5889
  HTTPRequest.request(this, n, e, !1);
5699
5890
  case 4:
5700
5891
  case "end":
5701
- return _context48.stop();
5892
+ return _context52.stop();
5702
5893
  }
5703
- }, _callee48, this);
5894
+ }, _callee52, this);
5704
5895
  }));
5705
- function callServiceAPI(_x82, _x83) {
5896
+ function callServiceAPI(_x91, _x92) {
5706
5897
  return _callServiceAPI13.apply(this, arguments);
5707
5898
  }
5708
5899
  return callServiceAPI;
@@ -5710,11 +5901,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5710
5901
  }, {
5711
5902
  key: "extractResultData",
5712
5903
  value: function () {
5713
- var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e) {
5714
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5715
- while (1) switch (_context49.prev = _context49.next) {
5904
+ var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
5905
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5906
+ while (1) switch (_context53.prev = _context53.next) {
5716
5907
  case 0:
5717
- return _context49.abrupt("return", new Promise(function (t) {
5908
+ return _context53.abrupt("return", new Promise(function (t) {
5718
5909
  var n = new FileReader();
5719
5910
  n.readAsDataURL(e), n.onload = function (s) {
5720
5911
  t({
@@ -5727,11 +5918,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5727
5918
  }));
5728
5919
  case 1:
5729
5920
  case "end":
5730
- return _context49.stop();
5921
+ return _context53.stop();
5731
5922
  }
5732
- }, _callee49);
5923
+ }, _callee53);
5733
5924
  }));
5734
- function extractResultData(_x84) {
5925
+ function extractResultData(_x93) {
5735
5926
  return _extractResultData17.apply(this, arguments);
5736
5927
  }
5737
5928
  return extractResultData;
@@ -5744,11 +5935,11 @@ _AzureTextToSpeechIO.HELP_LINK =
5744
5935
  "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
5745
5936
  var AzureTextToSpeechIO = _AzureTextToSpeechIO;
5746
5937
  var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5747
- _inherits(U, _AzureSpeechIO2);
5748
- var _super28 = _createSuper(U);
5749
- function U(e) {
5938
+ _inherits(j, _AzureSpeechIO2);
5939
+ var _super28 = _createSuper(j);
5940
+ function j(e) {
5750
5941
  var _this21;
5751
- _classCallCheck(this, U);
5942
+ _classCallCheck(this, j);
5752
5943
  var a, l, c;
5753
5944
  var t = (l = (a = e.directConnection) == null ? void 0 : a.azure) == null ? void 0 : l.speechToText,
5754
5945
  n = (c = e.directConnection) == null ? void 0 : c.azure,
@@ -5759,27 +5950,27 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5759
5950
  }
5760
5951
  }
5761
5952
  };
5762
- _this21 = _super28.call(this, e, AzureUtils.buildSpeechToTextHeaders, t.region, n, s), _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(U.HELP_LINK, "\">here</a> for more info.\n </p>"), _this21.url = "", _this21.isTextInputDisabled = !0, _this21.textInputPlaceholderText = "Upload an audio file", _this21.canSendMessage = U.canFileSendMessage;
5953
+ _this21 = _super28.call(this, e, AzureUtils.buildSpeechToTextHeaders, t.region, n, s), _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(j.HELP_LINK, "\">here</a> for more info.\n </p>"), _this21.url = "", _this21.isTextInputDisabled = !0, _this21.textInputPlaceholderText = "Upload an audio file", _this21.canSendMessage = j.canFileSendMessage;
5763
5954
  var o = t.lang || "en-US";
5764
5955
  _this21.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(o, "&format=detailed"), _this21.recordAudio = void 0;
5765
5956
  return _this21;
5766
5957
  }
5767
- _createClass(U, [{
5958
+ _createClass(j, [{
5768
5959
  key: "callServiceAPI",
5769
5960
  value: function () {
5770
- var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
5961
+ var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
5771
5962
  var s, o;
5772
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5773
- while (1) switch (_context50.prev = _context50.next) {
5963
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5964
+ while (1) switch (_context54.prev = _context54.next) {
5774
5965
  case 0:
5775
5966
  if ((s = this.requestSettings) != null && s.headers) {
5776
- _context50.next = 2;
5967
+ _context54.next = 2;
5777
5968
  break;
5778
5969
  }
5779
5970
  throw new Error("Request settings have not been set up");
5780
5971
  case 2:
5781
5972
  if (n != null && n[0]) {
5782
- _context50.next = 4;
5973
+ _context54.next = 4;
5783
5974
  break;
5784
5975
  }
5785
5976
  throw new Error("No file was added");
@@ -5787,11 +5978,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5787
5978
  (o = this.requestSettings) != null && o.headers && (this.requestSettings.headers["Content-Type"] = n[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), HTTPRequest.request(this, n[0], e, !1);
5788
5979
  case 5:
5789
5980
  case "end":
5790
- return _context50.stop();
5981
+ return _context54.stop();
5791
5982
  }
5792
- }, _callee50, this);
5983
+ }, _callee54, this);
5793
5984
  }));
5794
- function callServiceAPI(_x85, _x86, _x87) {
5985
+ function callServiceAPI(_x94, _x95, _x96) {
5795
5986
  return _callServiceAPI14.apply(this, arguments);
5796
5987
  }
5797
5988
  return callServiceAPI;
@@ -5799,26 +5990,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5799
5990
  }, {
5800
5991
  key: "extractResultData",
5801
5992
  value: function () {
5802
- var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
5803
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5804
- while (1) switch (_context51.prev = _context51.next) {
5993
+ var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
5994
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5995
+ while (1) switch (_context55.prev = _context55.next) {
5805
5996
  case 0:
5806
5997
  if (!e.error) {
5807
- _context51.next = 2;
5998
+ _context55.next = 2;
5808
5999
  break;
5809
6000
  }
5810
6001
  throw e.error;
5811
6002
  case 2:
5812
- return _context51.abrupt("return", {
6003
+ return _context55.abrupt("return", {
5813
6004
  text: e.DisplayText || ""
5814
6005
  });
5815
6006
  case 3:
5816
6007
  case "end":
5817
- return _context51.stop();
6008
+ return _context55.stop();
5818
6009
  }
5819
- }, _callee51);
6010
+ }, _callee55);
5820
6011
  }));
5821
- function extractResultData(_x88) {
6012
+ function extractResultData(_x97) {
5822
6013
  return _extractResultData18.apply(this, arguments);
5823
6014
  }
5824
6015
  return extractResultData;
@@ -5829,7 +6020,7 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5829
6020
  return !!(t != null && t[0]);
5830
6021
  }
5831
6022
  }]);
5832
- return U;
6023
+ return j;
5833
6024
  }(AzureSpeechIO);
5834
6025
  _AzureSpeechToTextIO.HELP_LINK =
5835
6026
  // eslint-disable-next-line max-len
@@ -5861,13 +6052,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5861
6052
  }, {
5862
6053
  key: "callServiceAPI",
5863
6054
  value: function () {
5864
- var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
6055
+ var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t) {
5865
6056
  var n;
5866
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5867
- while (1) switch (_context52.prev = _context52.next) {
6057
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6058
+ while (1) switch (_context56.prev = _context56.next) {
5868
6059
  case 0:
5869
6060
  if (this.requestSettings) {
5870
- _context52.next = 2;
6061
+ _context56.next = 2;
5871
6062
  break;
5872
6063
  }
5873
6064
  throw new Error("Request settings have not been set up");
@@ -5876,11 +6067,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5876
6067
  HTTPRequest.request(this, n, e);
5877
6068
  case 4:
5878
6069
  case "end":
5879
- return _context52.stop();
6070
+ return _context56.stop();
5880
6071
  }
5881
- }, _callee52, this);
6072
+ }, _callee56, this);
5882
6073
  }));
5883
- function callServiceAPI(_x89, _x90) {
6074
+ function callServiceAPI(_x98, _x99) {
5884
6075
  return _callServiceAPI15.apply(this, arguments);
5885
6076
  }
5886
6077
  return callServiceAPI;
@@ -5888,27 +6079,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5888
6079
  }, {
5889
6080
  key: "extractResultData",
5890
6081
  value: function () {
5891
- var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
6082
+ var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
5892
6083
  var t;
5893
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5894
- while (1) switch (_context53.prev = _context53.next) {
6084
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6085
+ while (1) switch (_context57.prev = _context57.next) {
5895
6086
  case 0:
5896
6087
  if (!Array.isArray(e)) {
5897
- _context53.next = 2;
6088
+ _context57.next = 2;
5898
6089
  break;
5899
6090
  }
5900
- return _context53.abrupt("return", {
6091
+ return _context57.abrupt("return", {
5901
6092
  text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
5902
6093
  });
5903
6094
  case 2:
5904
6095
  throw e.error;
5905
6096
  case 3:
5906
6097
  case "end":
5907
- return _context53.stop();
6098
+ return _context57.stop();
5908
6099
  }
5909
- }, _callee53);
6100
+ }, _callee57);
5910
6101
  }));
5911
- function extractResultData(_x91) {
6102
+ function extractResultData(_x100) {
5912
6103
  return _extractResultData19.apply(this, arguments);
5913
6104
  }
5914
6105
  return extractResultData;
@@ -5917,11 +6108,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5917
6108
  return AzureTranslationIO;
5918
6109
  }(DirectServiceIO);
5919
6110
  var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5920
- _inherits(A, _DirectServiceIO9);
5921
- var _super30 = _createSuper(A);
5922
- function A(e) {
6111
+ _inherits(M, _DirectServiceIO9);
6112
+ var _super30 = _createSuper(M);
6113
+ function M(e) {
5923
6114
  var _this23;
5924
- _classCallCheck(this, A);
6115
+ _classCallCheck(this, M);
5925
6116
  var l;
5926
6117
  var t = e.directConnection,
5927
6118
  n = e.textInput,
@@ -5945,16 +6136,16 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5945
6136
  }
5946
6137
  };
5947
6138
  }
5948
- _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = A.canFileSendMessage;
6139
+ _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = M.canFileSendMessage;
5949
6140
  return _this23;
5950
6141
  }
5951
- _createClass(A, [{
6142
+ _createClass(M, [{
5952
6143
  key: "preprocessBody",
5953
6144
  value: function preprocessBody(e, t) {
5954
6145
  var n = JSON.parse(JSON.stringify(e));
5955
6146
  if (t && t !== "") {
5956
- var s = t.substring(0, this._maxCharLength);
5957
- n.prompt = s;
6147
+ var _s5 = t.substring(0, this._maxCharLength);
6148
+ n.prompt = _s5;
5958
6149
  }
5959
6150
  return n;
5960
6151
  }
@@ -5966,50 +6157,50 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5966
6157
  var s;
5967
6158
  var o = (l = (a = t[t.length - 1]) == null ? void 0 : a.text) == null ? void 0 : l.trim();
5968
6159
  if (n[1] || o && o !== "") {
5969
- this.url = A.IMAGE_EDIT_URL;
6160
+ this.url = M.IMAGE_EDIT_URL;
5970
6161
  var c = this.preprocessBody(this.rawBody, o);
5971
- s = A.createFormDataBody(c, n[0], n[1]);
5972
- } else this.url = A.IMAGE_VARIATIONS_URL, s = A.createFormDataBody(this.rawBody, n[0]);
6162
+ s = M.createFormDataBody(c, n[0], n[1]);
6163
+ } else this.url = M.IMAGE_VARIATIONS_URL, s = M.createFormDataBody(this.rawBody, n[0]);
5973
6164
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
5974
6165
  }
5975
6166
  }, {
5976
6167
  key: "callServiceAPI",
5977
6168
  value: function () {
5978
- var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
5979
- var s, o;
5980
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5981
- while (1) switch (_context54.prev = _context54.next) {
6169
+ var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t, n) {
6170
+ var s, _o2;
6171
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6172
+ while (1) switch (_context58.prev = _context58.next) {
5982
6173
  case 0:
5983
6174
  if ((s = this.requestSettings) != null && s.headers) {
5984
- _context54.next = 2;
6175
+ _context58.next = 2;
5985
6176
  break;
5986
6177
  }
5987
6178
  throw new Error("Request settings have not been set up");
5988
6179
  case 2:
5989
6180
  if (!(n != null && n[0])) {
5990
- _context54.next = 6;
6181
+ _context58.next = 6;
5991
6182
  break;
5992
6183
  }
5993
6184
  this.callApiWithImage(e, t, n);
5994
- _context54.next = 11;
6185
+ _context58.next = 11;
5995
6186
  break;
5996
6187
  case 6:
5997
6188
  if (this.requestSettings) {
5998
- _context54.next = 8;
6189
+ _context58.next = 8;
5999
6190
  break;
6000
6191
  }
6001
6192
  throw new Error("Request settings have not been set up");
6002
6193
  case 8:
6003
- this.url = A.IMAGE_GENERATION_URL;
6004
- o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6005
- HTTPRequest.request(this, o, e);
6194
+ this.url = M.IMAGE_GENERATION_URL;
6195
+ _o2 = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6196
+ HTTPRequest.request(this, _o2, e);
6006
6197
  case 11:
6007
6198
  case "end":
6008
- return _context54.stop();
6199
+ return _context58.stop();
6009
6200
  }
6010
- }, _callee54, this);
6201
+ }, _callee58, this);
6011
6202
  }));
6012
- function callServiceAPI(_x92, _x93, _x94) {
6203
+ function callServiceAPI(_x101, _x102, _x103) {
6013
6204
  return _callServiceAPI16.apply(this, arguments);
6014
6205
  }
6015
6206
  return callServiceAPI;
@@ -6017,17 +6208,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6017
6208
  }, {
6018
6209
  key: "extractResultData",
6019
6210
  value: function () {
6020
- var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
6021
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
6022
- while (1) switch (_context55.prev = _context55.next) {
6211
+ var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
6212
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6213
+ while (1) switch (_context59.prev = _context59.next) {
6023
6214
  case 0:
6024
6215
  if (!e.error) {
6025
- _context55.next = 2;
6216
+ _context59.next = 2;
6026
6217
  break;
6027
6218
  }
6028
6219
  throw e.error.message;
6029
6220
  case 2:
6030
- return _context55.abrupt("return", {
6221
+ return _context59.abrupt("return", {
6031
6222
  files: e.data.map(function (n) {
6032
6223
  return n.url ? {
6033
6224
  src: n.url,
@@ -6040,11 +6231,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6040
6231
  });
6041
6232
  case 3:
6042
6233
  case "end":
6043
- return _context55.stop();
6234
+ return _context59.stop();
6044
6235
  }
6045
- }, _callee55);
6236
+ }, _callee59);
6046
6237
  }));
6047
- function extractResultData(_x95) {
6238
+ function extractResultData(_x104) {
6048
6239
  return _extractResultData20.apply(this, arguments);
6049
6240
  }
6050
6241
  return extractResultData;
@@ -6071,34 +6262,34 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6071
6262
  }), s;
6072
6263
  }
6073
6264
  }]);
6074
- return A;
6265
+ return M;
6075
6266
  }(DirectServiceIO);
6076
6267
  _OpenAIImagesIO.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
6077
6268
  _OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
6078
6269
  _OpenAIImagesIO.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
6079
6270
  var OpenAIImagesIO = _OpenAIImagesIO;
6080
6271
  var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6081
- _inherits(M, _DirectServiceIO10);
6082
- var _super31 = _createSuper(M);
6083
- function M(e) {
6272
+ _inherits(k, _DirectServiceIO10);
6273
+ var _super31 = _createSuper(k);
6274
+ function k(e) {
6084
6275
  var _l$model2;
6085
6276
  var _this24;
6086
- _classCallCheck(this, M);
6277
+ _classCallCheck(this, k);
6087
6278
  var a, l;
6088
6279
  var t = e.directConnection,
6089
6280
  n = e.textInput,
6090
6281
  s = t == null ? void 0 : t.openAI;
6091
6282
  _this24 = _super31.call(this, e, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, s, {
6092
6283
  audio: {}
6093
- }), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url = M.AUDIO_TRANSCRIPTIONS_URL, n != null && n.characterLimit && (_this24._maxCharLength = n.characterLimit);
6284
+ }), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url = k.AUDIO_TRANSCRIPTIONS_URL, n != null && n.characterLimit && (_this24._maxCharLength = n.characterLimit);
6094
6285
  var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.audio;
6095
- _typeof(o) == "object" && (_this24.processConfig(o), M.cleanConfig(o), Object.assign(_this24.rawBody, o)), (_l$model2 = (l = _this24.rawBody).model) !== null && _l$model2 !== void 0 ? _l$model2 : l.model = M.DEFAULT_MODEL, _this24.rawBody.response_format = "json", _this24.canSendMessage = M.canSendFileMessage;
6286
+ _typeof(o) == "object" && (_this24.processConfig(o), k.cleanConfig(o), Object.assign(_this24.rawBody, o)), (_l$model2 = (l = _this24.rawBody).model) !== null && _l$model2 !== void 0 ? _l$model2 : l.model = k.DEFAULT_MODEL, _this24.rawBody.response_format = "json", _this24.canSendMessage = k.canSendFileMessage;
6096
6287
  return _this24;
6097
6288
  }
6098
- _createClass(M, [{
6289
+ _createClass(k, [{
6099
6290
  key: "processConfig",
6100
6291
  value: function processConfig(e) {
6101
- e != null && e.type && e.type === "translation" && (this._service_url = M.AUDIO_TRANSLATIONS_URL, delete e.language);
6292
+ e != null && e.type && e.type === "translation" && (this._service_url = k.AUDIO_TRANSLATIONS_URL, delete e.language);
6102
6293
  }
6103
6294
  }, {
6104
6295
  key: "preprocessBody",
@@ -6116,33 +6307,33 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6116
6307
  }, {
6117
6308
  key: "callServiceAPI",
6118
6309
  value: function () {
6119
- var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
6310
+ var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t, n) {
6120
6311
  var a, s, o;
6121
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6122
- while (1) switch (_context56.prev = _context56.next) {
6312
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6313
+ while (1) switch (_context60.prev = _context60.next) {
6123
6314
  case 0:
6124
6315
  if ((a = this.requestSettings) != null && a.headers) {
6125
- _context56.next = 2;
6316
+ _context60.next = 2;
6126
6317
  break;
6127
6318
  }
6128
6319
  throw new Error("Request settings have not been set up");
6129
6320
  case 2:
6130
6321
  if (n != null && n[0]) {
6131
- _context56.next = 4;
6322
+ _context60.next = 4;
6132
6323
  break;
6133
6324
  }
6134
6325
  throw new Error("No file was added");
6135
6326
  case 4:
6136
6327
  this.url = this.requestSettings.url || this._service_url;
6137
- s = this.preprocessBody(this.rawBody, t, n), o = M.createFormDataBody(s, n[0]);
6328
+ s = this.preprocessBody(this.rawBody, t, n), o = k.createFormDataBody(s, n[0]);
6138
6329
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
6139
6330
  case 7:
6140
6331
  case "end":
6141
- return _context56.stop();
6332
+ return _context60.stop();
6142
6333
  }
6143
- }, _callee56, this);
6334
+ }, _callee60, this);
6144
6335
  }));
6145
- function callServiceAPI(_x96, _x97, _x98) {
6336
+ function callServiceAPI(_x105, _x106, _x107) {
6146
6337
  return _callServiceAPI17.apply(this, arguments);
6147
6338
  }
6148
6339
  return callServiceAPI;
@@ -6150,26 +6341,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6150
6341
  }, {
6151
6342
  key: "extractResultData",
6152
6343
  value: function () {
6153
- var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
6154
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6155
- while (1) switch (_context57.prev = _context57.next) {
6344
+ var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
6345
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6346
+ while (1) switch (_context61.prev = _context61.next) {
6156
6347
  case 0:
6157
6348
  if (!e.error) {
6158
- _context57.next = 2;
6349
+ _context61.next = 2;
6159
6350
  break;
6160
6351
  }
6161
6352
  throw e.error.message;
6162
6353
  case 2:
6163
- return _context57.abrupt("return", {
6354
+ return _context61.abrupt("return", {
6164
6355
  text: e.text
6165
6356
  });
6166
6357
  case 3:
6167
6358
  case "end":
6168
- return _context57.stop();
6359
+ return _context61.stop();
6169
6360
  }
6170
- }, _callee57);
6361
+ }, _callee61);
6171
6362
  }));
6172
- function extractResultData(_x99) {
6363
+ function extractResultData(_x108) {
6173
6364
  return _extractResultData21.apply(this, arguments);
6174
6365
  }
6175
6366
  return extractResultData;
@@ -6193,7 +6384,7 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6193
6384
  }), n;
6194
6385
  }
6195
6386
  }]);
6196
- return M;
6387
+ return k;
6197
6388
  }(DirectServiceIO);
6198
6389
  _OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
6199
6390
  _OpenAIAudioIO.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
@@ -6235,13 +6426,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6235
6426
  }, {
6236
6427
  key: "callServiceAPI",
6237
6428
  value: function () {
6238
- var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
6429
+ var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t) {
6239
6430
  var n;
6240
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6241
- while (1) switch (_context58.prev = _context58.next) {
6431
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6432
+ while (1) switch (_context62.prev = _context62.next) {
6242
6433
  case 0:
6243
6434
  if (this.requestSettings) {
6244
- _context58.next = 2;
6435
+ _context62.next = 2;
6245
6436
  break;
6246
6437
  }
6247
6438
  throw new Error("Request settings have not been set up");
@@ -6250,11 +6441,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6250
6441
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
6251
6442
  case 4:
6252
6443
  case "end":
6253
- return _context58.stop();
6444
+ return _context62.stop();
6254
6445
  }
6255
- }, _callee58, this);
6446
+ }, _callee62, this);
6256
6447
  }));
6257
- function callServiceAPI(_x100, _x101) {
6448
+ function callServiceAPI(_x109, _x110) {
6258
6449
  return _callServiceAPI18.apply(this, arguments);
6259
6450
  }
6260
6451
  return callServiceAPI;
@@ -6262,17 +6453,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6262
6453
  }, {
6263
6454
  key: "extractResultData",
6264
6455
  value: function () {
6265
- var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
6266
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6267
- while (1) switch (_context59.prev = _context59.next) {
6456
+ var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
6457
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6458
+ while (1) switch (_context63.prev = _context63.next) {
6268
6459
  case 0:
6269
6460
  if (!e.error) {
6270
- _context59.next = 2;
6461
+ _context63.next = 2;
6271
6462
  break;
6272
6463
  }
6273
6464
  throw e.error.message;
6274
6465
  case 2:
6275
- return _context59.abrupt("return", e.choices[0].delta ? {
6466
+ return _context63.abrupt("return", e.choices[0].delta ? {
6276
6467
  text: e.choices[0].delta.content || ""
6277
6468
  } : e.choices[0].message ? {
6278
6469
  text: e.choices[0].message.content
@@ -6281,11 +6472,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6281
6472
  });
6282
6473
  case 3:
6283
6474
  case "end":
6284
- return _context59.stop();
6475
+ return _context63.stop();
6285
6476
  }
6286
- }, _callee59);
6477
+ }, _callee63);
6287
6478
  }));
6288
- function extractResultData(_x102) {
6479
+ function extractResultData(_x111) {
6289
6480
  return _extractResultData22.apply(this, arguments);
6290
6481
  }
6291
6482
  return extractResultData;
@@ -6333,13 +6524,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6333
6524
  }, {
6334
6525
  key: "callServiceAPI",
6335
6526
  value: function () {
6336
- var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
6527
+ var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e, t) {
6337
6528
  var n;
6338
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6339
- while (1) switch (_context60.prev = _context60.next) {
6529
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6530
+ while (1) switch (_context64.prev = _context64.next) {
6340
6531
  case 0:
6341
6532
  if (this.requestSettings) {
6342
- _context60.next = 2;
6533
+ _context64.next = 2;
6343
6534
  break;
6344
6535
  }
6345
6536
  throw new Error("Request settings have not been set up");
@@ -6348,11 +6539,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6348
6539
  HTTPRequest.request(this, n, e);
6349
6540
  case 4:
6350
6541
  case "end":
6351
- return _context60.stop();
6542
+ return _context64.stop();
6352
6543
  }
6353
- }, _callee60, this);
6544
+ }, _callee64, this);
6354
6545
  }));
6355
- function callServiceAPI(_x103, _x104) {
6546
+ function callServiceAPI(_x112, _x113) {
6356
6547
  return _callServiceAPI19.apply(this, arguments);
6357
6548
  }
6358
6549
  return callServiceAPI;
@@ -6360,26 +6551,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6360
6551
  }, {
6361
6552
  key: "extractResultData",
6362
6553
  value: function () {
6363
- var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
6364
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6365
- while (1) switch (_context61.prev = _context61.next) {
6554
+ var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e) {
6555
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6556
+ while (1) switch (_context65.prev = _context65.next) {
6366
6557
  case 0:
6367
6558
  if (!e.message) {
6368
- _context61.next = 2;
6559
+ _context65.next = 2;
6369
6560
  break;
6370
6561
  }
6371
6562
  throw e.message;
6372
6563
  case 2:
6373
- return _context61.abrupt("return", {
6564
+ return _context65.abrupt("return", {
6374
6565
  text: e.text
6375
6566
  });
6376
6567
  case 3:
6377
6568
  case "end":
6378
- return _context61.stop();
6569
+ return _context65.stop();
6379
6570
  }
6380
- }, _callee61);
6571
+ }, _callee65);
6381
6572
  }));
6382
- function extractResultData(_x105) {
6573
+ function extractResultData(_x114) {
6383
6574
  return _extractResultData23.apply(this, arguments);
6384
6575
  }
6385
6576
  return extractResultData;
@@ -6546,11 +6737,11 @@ var _TextToSpeech = /*#__PURE__*/function () {
6546
6737
  var n = {};
6547
6738
  setTimeout(function () {
6548
6739
  if (_typeof(e) == "object" && (e.lang && (n.lang = e.lang), e.pitch && (n.pitch = e.pitch), e.rate && (n.rate = e.rate), e.volume && (n.volume = e.volume), e.voiceName)) {
6549
- var s = window.speechSynthesis.getVoices().find(function (o) {
6740
+ var _s6 = window.speechSynthesis.getVoices().find(function (o) {
6550
6741
  var a;
6551
6742
  return o.name.toLocaleLowerCase() === ((a = e.voiceName) == null ? void 0 : a.toLocaleLowerCase());
6552
6743
  });
6553
- s && (n.voice = s);
6744
+ _s6 && (n.voice = _s6);
6554
6745
  }
6555
6746
  t(n);
6556
6747
  }, $.LOAD_VOICES_MS);
@@ -6592,9 +6783,9 @@ var MessageStyleUtils = /*#__PURE__*/function () {
6592
6783
  key: "applyCustomStylesToElements",
6593
6784
  value: function applyCustomStylesToElements(e, t, n) {
6594
6785
  if (n && (Object.assign(e.outerContainer.style, n.outerContainer), Object.assign(e.innerContainer.style, n.innerContainer), Object.assign(e.bubbleElement.style, n.bubble), t)) {
6595
- var s = e.bubbleElement.children[0],
6596
- o = s.tagName.toLocaleLowerCase() !== "a" ? s : s.children[0];
6597
- Object.assign(o.style, n.media);
6786
+ var _s7 = e.bubbleElement.children[0],
6787
+ _o3 = _s7.tagName.toLocaleLowerCase() !== "a" ? _s7 : _s7.children[0];
6788
+ Object.assign(_o3.style, n.media);
6598
6789
  }
6599
6790
  }
6600
6791
  }, {
@@ -6737,24 +6928,24 @@ var FileMessages = /*#__PURE__*/function () {
6737
6928
  }, {
6738
6929
  key: "addNewImageMessage",
6739
6930
  value: function () {
6740
- var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, n) {
6931
+ var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t, n) {
6741
6932
  var s,
6742
6933
  o,
6743
6934
  a,
6744
- _args62 = arguments;
6745
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6746
- while (1) switch (_context62.prev = _context62.next) {
6935
+ _args66 = arguments;
6936
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6937
+ while (1) switch (_context66.prev = _context66.next) {
6747
6938
  case 0:
6748
- s = _args62.length > 3 && _args62[3] !== undefined ? _args62[3] : !1;
6939
+ s = _args66.length > 3 && _args66[3] !== undefined ? _args66[3] : !1;
6749
6940
  o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
6750
6941
  a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
6751
6942
  case 3:
6752
6943
  case "end":
6753
- return _context62.stop();
6944
+ return _context66.stop();
6754
6945
  }
6755
- }, _callee62);
6946
+ }, _callee66);
6756
6947
  }));
6757
- function addNewImageMessage(_x106, _x107, _x108) {
6948
+ function addNewImageMessage(_x115, _x116, _x117) {
6758
6949
  return _addNewImageMessage.apply(this, arguments);
6759
6950
  }
6760
6951
  return addNewImageMessage;
@@ -7090,27 +7281,27 @@ var Messages = /*#__PURE__*/function () {
7090
7281
  }, {
7091
7282
  key: "addMultipleFiles",
7092
7283
  value: function () {
7093
- var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
7284
+ var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
7094
7285
  var _this31 = this;
7095
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
7096
- while (1) switch (_context63.prev = _context63.next) {
7286
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
7287
+ while (1) switch (_context67.prev = _context67.next) {
7097
7288
  case 0:
7098
- return _context63.abrupt("return", Promise.all((e || []).map(function (t) {
7289
+ return _context67.abrupt("return", Promise.all((e || []).map(function (t) {
7099
7290
  return new Promise(function (n) {
7100
7291
  if (!t.type || t.type === "any") {
7101
- var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
7292
+ var _s8 = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
7102
7293
  _this31.addNewMessage({
7103
7294
  files: [{
7104
- name: s,
7295
+ name: _s8,
7105
7296
  type: "any"
7106
7297
  }]
7107
7298
  }, !1, !0), n(!0);
7108
7299
  } else {
7109
- var _s = new FileReader();
7110
- _s.readAsDataURL(t.file), _s.onload = function () {
7300
+ var _s9 = new FileReader();
7301
+ _s9.readAsDataURL(t.file), _s9.onload = function () {
7111
7302
  _this31.addNewMessage({
7112
7303
  files: [{
7113
- src: _s.result,
7304
+ src: _s9.result,
7114
7305
  type: t.type
7115
7306
  }]
7116
7307
  }, !1, !0), n(!0);
@@ -7120,11 +7311,11 @@ var Messages = /*#__PURE__*/function () {
7120
7311
  })));
7121
7312
  case 1:
7122
7313
  case "end":
7123
- return _context63.stop();
7314
+ return _context67.stop();
7124
7315
  }
7125
- }, _callee63);
7316
+ }, _callee67);
7126
7317
  }));
7127
- function addMultipleFiles(_x109) {
7318
+ function addMultipleFiles(_x118) {
7128
7319
  return _addMultipleFiles.apply(this, arguments);
7129
7320
  }
7130
7321
  return addMultipleFiles;
@@ -7198,10 +7389,10 @@ var Messages = /*#__PURE__*/function () {
7198
7389
  return Messages;
7199
7390
  }();
7200
7391
  var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7201
- function E() {
7202
- _classCallCheck(this, E);
7392
+ function w() {
7393
+ _classCallCheck(this, w);
7203
7394
  }
7204
- _createClass(E, null, [{
7395
+ _createClass(w, null, [{
7205
7396
  key: "adjustInputPadding",
7206
7397
  value: function adjustInputPadding(e, t) {
7207
7398
  t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
@@ -7209,7 +7400,7 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7209
7400
  }, {
7210
7401
  key: "adjustForOutsideButton",
7211
7402
  value: function adjustForOutsideButton(e, t, n) {
7212
- n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(E.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(E.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
7403
+ n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(w.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(w.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(w.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(w.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
7213
7404
  }
7214
7405
  // when submit is the only button
7215
7406
  // when submit button is outside by itself - we increase the height for a better look
@@ -7217,10 +7408,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7217
7408
  key: "adjustOutsideSubmit",
7218
7409
  value: function adjustOutsideSubmit(e, t, n) {
7219
7410
  if (!(n["inside-left"].length > 0 || n["inside-right"].length > 0)) {
7220
- if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(E.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
7411
+ if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(w.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(w.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
7221
7412
  return s.button.elementRef.classList.add("submit-button-enlarged");
7222
7413
  });
7223
- if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(E.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
7414
+ if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(w.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(w.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
7224
7415
  return s.button.elementRef.classList.add("submit-button-enlarged");
7225
7416
  });
7226
7417
  }
@@ -7228,10 +7419,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7228
7419
  }, {
7229
7420
  key: "set",
7230
7421
  value: function set(e, t, n, s) {
7231
- !!E.adjustOutsideSubmit(t, n, s) || E.adjustForOutsideButton(t, n, s), E.adjustInputPadding(e, s);
7422
+ !!w.adjustOutsideSubmit(t, n, s) || w.adjustForOutsideButton(t, n, s), w.adjustInputPadding(e, s);
7232
7423
  }
7233
7424
  }]);
7234
- return E;
7425
+ return w;
7235
7426
  }();
7236
7427
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
7237
7428
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
@@ -7395,8 +7586,8 @@ var InputButton = /*#__PURE__*/function () {
7395
7586
  value: function unsetCustomStateStyles(e) {
7396
7587
  if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
7397
7588
  var n = e[t],
7398
- s = n && this._customStyles[n];
7399
- s && ButtonCSS.unsetActionCSS(this.elementRef, s);
7589
+ _s10 = n && this._customStyles[n];
7590
+ _s10 && ButtonCSS.unsetActionCSS(this.elementRef, _s10);
7400
7591
  }
7401
7592
  }
7402
7593
  }, {
@@ -7760,14 +7951,14 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7760
7951
  key: "addAttachmentBasedOnType",
7761
7952
  value: function addAttachmentBasedOnType(e, t, n) {
7762
7953
  if (e.type.startsWith("image")) {
7763
- var s = FileAttachmentsType.createImageAttachment(t);
7764
- this.addFileAttachment(e, "image", s, n);
7954
+ var _s11 = FileAttachmentsType.createImageAttachment(t);
7955
+ this.addFileAttachment(e, "image", _s11, n);
7765
7956
  } else if (e.type.startsWith("audio")) {
7766
- var _s2 = AudioFileAttachmentType.createAudioAttachment(t);
7767
- this.addFileAttachment(e, "audio", _s2, n);
7957
+ var _s12 = AudioFileAttachmentType.createAudioAttachment(t);
7958
+ this.addFileAttachment(e, "audio", _s12, n);
7768
7959
  } else {
7769
- var _s3 = FileAttachmentsType.createAnyFileAttachment(e.name);
7770
- this.addFileAttachment(e, "any", _s3, n);
7960
+ var _s13 = FileAttachmentsType.createAnyFileAttachment(e.name);
7961
+ this.addFileAttachment(e, "any", _s13, n);
7771
7962
  }
7772
7963
  }
7773
7964
  }, {
@@ -7829,15 +8020,15 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7829
8020
  value: function isFileTypeValid(e, t) {
7830
8021
  if (t === "") return !0;
7831
8022
  var n = t.split(",");
7832
- for (var s = 0; s < n.length; s++) {
7833
- var o = n[s].trim();
7834
- if (e.type === o) return !0;
7835
- if (o.startsWith(".")) {
7836
- var a = o.slice(1);
7837
- if (e.name.endsWith(a)) return !0;
8023
+ for (var _s14 = 0; _s14 < n.length; _s14++) {
8024
+ var _o4 = n[_s14].trim();
8025
+ if (e.type === _o4) return !0;
8026
+ if (_o4.startsWith(".")) {
8027
+ var _a3 = _o4.slice(1);
8028
+ if (e.name.endsWith(_a3)) return !0;
7838
8029
  } else {
7839
- if (e.name.endsWith(o)) return !0;
7840
- if (o.endsWith("/*") && e.type.startsWith(o.slice(0, -2))) return !0;
8030
+ if (e.name.endsWith(_o4)) return !0;
8031
+ if (_o4.endsWith("/*") && e.type.startsWith(_o4.slice(0, -2))) return !0;
7841
8032
  }
7842
8033
  }
7843
8034
  return !1;
@@ -7870,18 +8061,18 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7870
8061
  var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
7871
8062
  STOP_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
7872
8063
  _AudioFileAttachmentType = /*#__PURE__*/function (_FileAttachmentsType) {
7873
- _inherits(k, _FileAttachmentsType);
7874
- var _super35 = _createSuper(k);
7875
- function k(e, t, n) {
7876
- _classCallCheck(this, k);
8064
+ _inherits(I, _FileAttachmentsType);
8065
+ var _super35 = _createSuper(I);
8066
+ function I(e, t, n) {
8067
+ _classCallCheck(this, I);
7877
8068
  return _super35.call(this, e, t, n);
7878
8069
  }
7879
- _createClass(k, [{
8070
+ _createClass(I, [{
7880
8071
  key: "createTimer",
7881
8072
  value: function createTimer(e, t) {
7882
8073
  var _this37 = this;
7883
8074
  var n = 0;
7884
- var s = t !== void 0 && t < k.TIMER_LIMIT_S ? t : k.TIMER_LIMIT_S;
8075
+ var s = t !== void 0 && t < I.TIMER_LIMIT_S ? t : I.TIMER_LIMIT_S;
7885
8076
  return setInterval(function () {
7886
8077
  var l;
7887
8078
  n += 1, n === s && ((l = _this37.stopPlaceholderCallback) == null || l.call(_this37), _this37.clearTimer()), n === 600 && e.classList.add("audio-placeholder-text-4-digits");
@@ -7893,7 +8084,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7893
8084
  }, {
7894
8085
  key: "createPlaceholderAudioAttachment",
7895
8086
  value: function createPlaceholderAudioAttachment(e) {
7896
- var t = k.createAudioContainer(),
8087
+ var t = I.createAudioContainer(),
7897
8088
  n = document.createElement("div");
7898
8089
  n.classList.add("audio-placeholder-text-3-digits");
7899
8090
  var s = document.createElement("div");
@@ -7930,7 +8121,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7930
8121
  key: "completePlaceholderAttachment",
7931
8122
  value: function completePlaceholderAttachment(e, t) {
7932
8123
  var n = this._activePlaceholderAttachment;
7933
- n && (n.file = e, k.addAudioElements(n.attachmentContainerElement.children[0], t), n.removeButton = this.createRemoveAttachmentButton(n), n.attachmentContainerElement.appendChild(n.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
8124
+ n && (n.file = e, I.addAudioElements(n.attachmentContainerElement.children[0], t), n.removeButton = this.createRemoveAttachmentButton(n), n.attachmentContainerElement.appendChild(n.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
7934
8125
  }
7935
8126
  }, {
7936
8127
  key: "removePlaceholderAttachment",
@@ -7970,8 +8161,8 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7970
8161
  }, {
7971
8162
  key: "createAudioAttachment",
7972
8163
  value: function createAudioAttachment(e) {
7973
- var t = k.createAudioContainer();
7974
- return k.addAudioElements(t, e), t;
8164
+ var t = I.createAudioContainer();
8165
+ return I.addAudioElements(t, e), t;
7975
8166
  }
7976
8167
  }, {
7977
8168
  key: "stopAttachmentPlayback",
@@ -7980,7 +8171,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7980
8171
  (s = (n = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : n[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
7981
8172
  }
7982
8173
  }]);
7983
- return k;
8174
+ return I;
7984
8175
  }(FileAttachmentsType);
7985
8176
  _AudioFileAttachmentType.TIMER_LIMIT_S = 5999;
7986
8177
  var AudioFileAttachmentType = _AudioFileAttachmentType;
@@ -8034,33 +8225,33 @@ var FileAttachments = /*#__PURE__*/function () {
8034
8225
  }, {
8035
8226
  key: "completePlaceholders",
8036
8227
  value: function () {
8037
- var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
8038
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
8039
- while (1) switch (_context65.prev = _context65.next) {
8228
+ var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69() {
8229
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
8230
+ while (1) switch (_context69.prev = _context69.next) {
8040
8231
  case 0:
8041
- _context65.next = 2;
8232
+ _context69.next = 2;
8042
8233
  return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
8043
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
8234
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
8044
8235
  var t;
8045
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
8046
- while (1) switch (_context64.prev = _context64.next) {
8236
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
8237
+ while (1) switch (_context68.prev = _context68.next) {
8047
8238
  case 0:
8048
- return _context64.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8239
+ return _context68.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8049
8240
  case 1:
8050
8241
  case "end":
8051
- return _context64.stop();
8242
+ return _context68.stop();
8052
8243
  }
8053
- }, _callee64);
8244
+ }, _callee68);
8054
8245
  }));
8055
- return function (_x110) {
8056
- return _ref5.apply(this, arguments);
8246
+ return function (_x119) {
8247
+ return _ref7.apply(this, arguments);
8057
8248
  };
8058
8249
  }()));
8059
8250
  case 2:
8060
8251
  case "end":
8061
- return _context65.stop();
8252
+ return _context69.stop();
8062
8253
  }
8063
- }, _callee65, this);
8254
+ }, _callee69, this);
8064
8255
  }));
8065
8256
  function completePlaceholders() {
8066
8257
  return _completePlaceholders.apply(this, arguments);
@@ -8090,7 +8281,7 @@ var FileAttachments = /*#__PURE__*/function () {
8090
8281
  e.forEach(function (n) {
8091
8282
  var s = new FileReader();
8092
8283
  s.readAsDataURL(n), s.onload = function (o) {
8093
- for (var a = 0; a < t.length && !t[a].attemptAddFile(n, o.target.result); a += 1);
8284
+ for (var _a4 = 0; _a4 < t.length && !t[_a4].attemptAddFile(n, o.target.result); _a4 += 1);
8094
8285
  };
8095
8286
  });
8096
8287
  }
@@ -8200,8 +8391,8 @@ var _Modal = /*#__PURE__*/function () {
8200
8391
  value: function createTextModalFunc(e, t, n) {
8201
8392
  var s;
8202
8393
  if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
8203
- var o = new T(e, ["modal-content"], t.files.infoModal.containerStyle);
8204
- return o.addCloseButton("OK", !1, n), o.openTextModal.bind(o, t.infoModalTextMarkUp || "");
8394
+ var _o5 = new T(e, ["modal-content"], t.files.infoModal.containerStyle);
8395
+ return _o5.addCloseButton("OK", !1, n), _o5.openTextModal.bind(_o5, t.infoModalTextMarkUp || "");
8205
8396
  }
8206
8397
  }
8207
8398
  }]);
@@ -8216,10 +8407,10 @@ var UploadFileButton = /*#__PURE__*/function (_InputButton2) {
8216
8407
  function UploadFileButton(e, t, n, s, o, a) {
8217
8408
  var _this43;
8218
8409
  _classCallCheck(this, UploadFileButton);
8219
- var c, u, d, h, p, f;
8410
+ var c, u, d, h, f, p;
8220
8411
  _this43 = _super36.call(this, UploadFileButton.createButtonElement(), (c = n.button) == null ? void 0 : c.position, n.button, a);
8221
8412
  var l = _this43.createInnerElements(s, o, _this43._customStyles);
8222
- _this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (f = (p = n.files) == null ? void 0 : p.infoModal) == null ? void 0 : f.openModalOnce;
8413
+ _this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (p = (f = n.files) == null ? void 0 : f.infoModal) == null ? void 0 : p.openModalOnce;
8223
8414
  return _this43;
8224
8415
  }
8225
8416
  _createClass(UploadFileButton, [{
@@ -8466,7 +8657,7 @@ var Translate = /*#__PURE__*/function () {
8466
8657
  key: "translate",
8467
8658
  value: function translate(e, t) {
8468
8659
  var n = text_1$3.Text.breakupIntoWordsArr(e);
8469
- for (var s = 0; s < n.length; s += 1) t[n[s]] && (n[s] = t[n[s]]);
8660
+ for (var _s15 = 0; _s15 < n.length; _s15 += 1) t[n[_s15]] && (n[_s15] = t[n[_s15]]);
8470
8661
  return n.join("");
8471
8662
  }
8472
8663
  }]);
@@ -8486,9 +8677,9 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8486
8677
  key: "extract",
8487
8678
  value: function extract(e, t, n) {
8488
8679
  var s = "";
8489
- for (var o = e.resultIndex; o < e.results.length; ++o) {
8490
- var a = e.results[o][0].transcript;
8491
- n && (a = translate_1$1.Translate.translate(a, n)), e.results[o].isFinal ? t += a : s += a;
8680
+ for (var _o6 = e.resultIndex; _o6 < e.results.length; ++_o6) {
8681
+ var _a5 = e.results[_o6][0].transcript;
8682
+ n && (_a5 = translate_1$1.Translate.translate(_a5, n)), e.results[_o6].isFinal ? t += _a5 : s += _a5;
8492
8683
  }
8493
8684
  return {
8494
8685
  interimTranscript: s,
@@ -8501,8 +8692,8 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8501
8692
  value: function extractSafari(e, t, n) {
8502
8693
  var s = "";
8503
8694
  var o = "";
8504
- for (var a = e.resultIndex; a < e.results.length; ++a) {
8505
- var l = e.results[a][0].transcript;
8695
+ for (var _a6 = e.resultIndex; _a6 < e.results.length; ++_a6) {
8696
+ var l = e.results[_a6][0].transcript;
8506
8697
  n && (l = translate_1$1.Translate.translate(l, n)), s += l;
8507
8698
  }
8508
8699
  return {
@@ -8674,8 +8865,8 @@ var Elements = /*#__PURE__*/function () {
8674
8865
  if (e.spansPopulated = !0, e.insertInCursorLocation && document.activeElement === t) {
8675
8866
  var n = window.getSelection();
8676
8867
  if (n != null && n.focusNode) {
8677
- var s = n.getRangeAt(0);
8678
- s.insertNode(e.scrollingSpan), s.insertNode(e.interimSpan), s.insertNode(e.finalSpan), s.collapse(!1), n.removeAllRanges(), n.addRange(s);
8868
+ var _s16 = n.getRangeAt(0);
8869
+ _s16.insertNode(e.scrollingSpan), _s16.insertNode(e.interimSpan), _s16.insertNode(e.finalSpan), _s16.collapse(!1), n.removeAllRanges(), n.addRange(_s16);
8679
8870
  return;
8680
8871
  }
8681
8872
  }
@@ -8709,20 +8900,20 @@ var Cursor = /*#__PURE__*/function () {
8709
8900
  value: function setOffsetForGeneric(e, t) {
8710
8901
  var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
8711
8902
  var s = 0;
8712
- for (var o = 0; o < e.childNodes.length; o += 1) {
8713
- var a = e.childNodes[o];
8714
- if (a.childNodes.length > 0) {
8715
- var l = Cursor.setOffsetForGeneric(a, t, n);
8903
+ for (var _o7 = 0; _o7 < e.childNodes.length; _o7 += 1) {
8904
+ var _a7 = e.childNodes[_o7];
8905
+ if (_a7.childNodes.length > 0) {
8906
+ var l = Cursor.setOffsetForGeneric(_a7, t, n);
8716
8907
  if (l === -1) return -1;
8717
8908
  n += l;
8718
- } else if (a.textContent !== null) {
8719
- if (n + a.textContent.length > t) {
8909
+ } else if (_a7.textContent !== null) {
8910
+ if (n + _a7.textContent.length > t) {
8720
8911
  var _l = document.createRange();
8721
- _l.setStart(a, t - n), _l.collapse(!0);
8912
+ _l.setStart(_a7, t - n), _l.collapse(!0);
8722
8913
  var c = window.getSelection();
8723
8914
  return c == null || c.removeAllRanges(), c == null || c.addRange(_l), e.focus(), -1;
8724
8915
  }
8725
- n += a.textContent.length, s += a.textContent.length;
8916
+ n += _a7.textContent.length, s += _a7.textContent.length;
8726
8917
  }
8727
8918
  }
8728
8919
  return s;
@@ -8740,8 +8931,8 @@ var Cursor = /*#__PURE__*/function () {
8740
8931
  value: function setOffsetForSafariGeneric(e, t) {
8741
8932
  var n = window.getSelection();
8742
8933
  if (n) {
8743
- var s = Cursor.getGenericElementCursorOffset(e, n, !0);
8744
- console.log(s), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, s + t);
8934
+ var _s17 = Cursor.getGenericElementCursorOffset(e, n, !0);
8935
+ console.log(_s17), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, _s17 + t);
8745
8936
  }
8746
8937
  }
8747
8938
  // set to automatically scroll to cursor (scroll does not work in Safari)
@@ -8772,9 +8963,9 @@ var Cursor = /*#__PURE__*/function () {
8772
8963
  value: function getGenericElementCursorOffset(e, t, n) {
8773
8964
  var s = 0;
8774
8965
  if (t.rangeCount > 0) {
8775
- var o = t.getRangeAt(0),
8776
- a = o.cloneRange();
8777
- a.selectNodeContents(e), n ? a.setEnd(o.startContainer, o.startOffset) : a.setEnd(o.endContainer, o.endOffset), s = a.toString().length;
8966
+ var _o8 = t.getRangeAt(0),
8967
+ _a8 = _o8.cloneRange();
8968
+ _a8.selectNodeContents(e), n ? _a8.setEnd(_o8.startContainer, _o8.startOffset) : _a8.setEnd(_o8.endContainer, _o8.endOffset), s = _a8.toString().length;
8778
8969
  }
8779
8970
  return s;
8780
8971
  }
@@ -8837,10 +9028,10 @@ var CommandUtils = /*#__PURE__*/function () {
8837
9028
  key: "checkIfMatchesWord",
8838
9029
  value: function checkIfMatchesWord(e, t, n) {
8839
9030
  var s = e;
8840
- for (var o = n.length - 1; o >= 0; o -= 1) {
8841
- var a = o,
9031
+ for (var _o9 = n.length - 1; _o9 >= 0; _o9 -= 1) {
9032
+ var _a9 = _o9,
8842
9033
  l = s.length - 1;
8843
- for (; n[a] === s[l] && l >= 0;) a -= 1, l -= 1;
9034
+ for (; n[_a9] === s[l] && l >= 0;) _a9 -= 1, l -= 1;
8844
9035
  if (l < 0) return !0;
8845
9036
  }
8846
9037
  return !1;
@@ -8854,31 +9045,31 @@ var CommandUtils = /*#__PURE__*/function () {
8854
9045
  if (!u || !s || !n) return;
8855
9046
  var d = ((a = u.settings) === null || a === void 0 ? void 0 : a.caseSensitive) === !0 ? t : t.toLowerCase(),
8856
9047
  h = text_1$2.Text.breakupIntoWordsArr(d),
8857
- p = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
8858
- if (u.commandMode && p(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
9048
+ f = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
9049
+ if (u.commandMode && f(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
8859
9050
  return CommandUtils.toggleCommandModeOn(e);
8860
9051
  }), {
8861
9052
  doNotProcessTranscription: !1
8862
9053
  };
8863
9054
  if (!(u.commandMode && !e.isWaitingForCommand)) {
8864
- if (u.stop && p(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
9055
+ if (u.stop && f(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
8865
9056
  return e.stop();
8866
9057
  }), {
8867
9058
  doNotProcessTranscription: !1
8868
9059
  };
8869
- if (u.pause && p(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
8870
- var f;
8871
- e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
9060
+ if (u.pause && f(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
9061
+ var p;
9062
+ e.isPaused = !0, (p = e.onPauseTrigger) === null || p === void 0 || p.call(e, !0);
8872
9063
  }), {
8873
9064
  doNotProcessTranscription: !1
8874
9065
  };
8875
- if (u.resume && p(u.resume, d, h)) return e.isPaused = !1, (c = e.onPauseTrigger) === null || c === void 0 || c.call(e, !1), CommandUtils.toggleCommandModeOff(e), e.resetRecording(n), {
9066
+ if (u.resume && f(u.resume, d, h)) return e.isPaused = !1, (c = e.onPauseTrigger) === null || c === void 0 || c.call(e, !1), CommandUtils.toggleCommandModeOff(e), e.resetRecording(n), {
8876
9067
  doNotProcessTranscription: !0
8877
9068
  };
8878
- if (u.reset && p(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
9069
+ if (u.reset && f(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
8879
9070
  doNotProcessTranscription: !0
8880
9071
  };
8881
- if (u.removeAllText && p(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
9072
+ if (u.removeAllText && f(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
8882
9073
  doNotProcessTranscription: !0
8883
9074
  };
8884
9075
  }
@@ -8909,9 +9100,9 @@ var Highlight = /*#__PURE__*/function () {
8909
9100
  value: function setStateForGeneric(e, t) {
8910
9101
  var n = window.getSelection();
8911
9102
  if (n != null && n.focusNode) {
8912
- var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
8913
- o = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
8914
- e.isHighlighted = s !== o;
9103
+ var _s18 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
9104
+ _o10 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
9105
+ e.isHighlighted = _s18 !== _o10;
8915
9106
  }
8916
9107
  }
8917
9108
  }, {
@@ -8924,8 +9115,8 @@ var Highlight = /*#__PURE__*/function () {
8924
9115
  value: function removeForGeneric(e, t) {
8925
9116
  var n = window.getSelection();
8926
9117
  if (n) {
8927
- var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
8928
- n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, s), e.isHighlighted = !1;
9118
+ var _s19 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
9119
+ n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, _s19), e.isHighlighted = !1;
8929
9120
  }
8930
9121
  }
8931
9122
  }, {
@@ -8935,8 +9126,8 @@ var Highlight = /*#__PURE__*/function () {
8935
9126
  s = t.selectionEnd,
8936
9127
  o = t.value;
8937
9128
  if (n && s) {
8938
- var a = o.substring(0, n) + o.substring(s);
8939
- t.value = a, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
9129
+ var _a10 = o.substring(0, n) + o.substring(s);
9130
+ t.value = _a10, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
8940
9131
  }
8941
9132
  e.isHighlighted = !1;
8942
9133
  }
@@ -8960,11 +9151,11 @@ var Padding = /*#__PURE__*/function () {
8960
9151
  key: "setStateForPrimitiveElement",
8961
9152
  value: function setStateForPrimitiveElement(e, t) {
8962
9153
  if (document.activeElement === t && t.selectionStart !== null) {
8963
- var s = t.selectionStart,
8964
- o = t.value[s - 1],
8965
- a = t.selectionEnd === null ? s : t.selectionEnd,
8966
- l = t.value[a];
8967
- text_1$1.Text.isCharDefined(o) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === a;
9154
+ var _s20 = t.selectionStart,
9155
+ _o11 = t.value[_s20 - 1],
9156
+ _a11 = t.selectionEnd === null ? _s20 : t.selectionEnd,
9157
+ l = t.value[_a11];
9158
+ text_1$1.Text.isCharDefined(_o11) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === _a11;
8968
9159
  return;
8969
9160
  }
8970
9161
  var n = t.value[t.value.length - 1];
@@ -9035,11 +9226,11 @@ var Speech = /*#__PURE__*/function () {
9035
9226
  value: function prepareBeforeStart(e) {
9036
9227
  var t, n;
9037
9228
  if (e != null && e.element) if (eventListeners_1.EventListeners.add(this, e), Array.isArray(e.element)) {
9038
- var o = e.element.find(function (a) {
9229
+ var _o12 = e.element.find(function (a) {
9039
9230
  return a === document.activeElement;
9040
9231
  }) || e.element[0];
9041
- if (!o) return;
9042
- this.prepare(o);
9232
+ if (!_o12) return;
9233
+ this.prepare(_o12);
9043
9234
  } else this.prepare(e.element);
9044
9235
  (e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], elements_1.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((n = this._options) === null || n === void 0) && n.commands && (this.commands = commandUtils_1$1.CommandUtils.process(this._options.commands));
9045
9236
  }
@@ -9082,8 +9273,8 @@ var Speech = /*#__PURE__*/function () {
9082
9273
  this.isHighlighted && highlight_1.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), n && padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);
9083
9274
  var s = this.startPadding + this.finalTranscript + t;
9084
9275
  if (e.value = s + this.endPadding, !this.isTargetInShadow) {
9085
- var o = s.length + this.numberOfSpacesAfterNewText;
9086
- cursor_1.Cursor.setOffsetForPrimitive(e, o, this.autoScroll);
9276
+ var _o13 = s.length + this.numberOfSpacesAfterNewText;
9277
+ cursor_1.Cursor.setOffsetForPrimitive(e, _o13, this.autoScroll);
9087
9278
  }
9088
9279
  this.autoScroll && browser_1$1.Browser.IS_SAFARI() && this.isCursorAtEnd && autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e);
9089
9280
  }
@@ -9184,8 +9375,8 @@ var WebSpeech = /*#__PURE__*/function (_speech_1$1$Speech) {
9184
9375
  var _this46$_extractText = _this46._extractText(e, _this46.finalTranscript, _this46._translations),
9185
9376
  t = _this46$_extractText.interimTranscript,
9186
9377
  n = _this46$_extractText.finalTranscript,
9187
- s = _this46$_extractText.newText;
9188
- _this46.updateElements(t, n, s);
9378
+ _s21 = _this46$_extractText.newText;
9379
+ _this46.updateElements(t, n, _s21);
9189
9380
  }
9190
9381
  });
9191
9382
  }
@@ -9280,26 +9471,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9280
9471
  }, {
9281
9472
  key: "getNewSpeechConfig",
9282
9473
  value: function () {
9283
- var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t) {
9284
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
9285
- while (1) switch (_context66.prev = _context66.next) {
9474
+ var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
9475
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9476
+ while (1) switch (_context70.prev = _context70.next) {
9286
9477
  case 0:
9287
9478
  if (!t.region) {
9288
- _context66.next = 2;
9479
+ _context70.next = 2;
9289
9480
  break;
9290
9481
  }
9291
- return _context66.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (n) {
9482
+ return _context70.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (n) {
9292
9483
  return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
9293
9484
  })["catch"](function (n) {
9294
9485
  return console.error(n), null;
9295
9486
  }) : null);
9296
9487
  case 2:
9297
9488
  case "end":
9298
- return _context66.stop();
9489
+ return _context70.stop();
9299
9490
  }
9300
- }, _callee66);
9491
+ }, _callee70);
9301
9492
  }));
9302
- function getNewSpeechConfig(_x111, _x112) {
9493
+ function getNewSpeechConfig(_x120, _x121) {
9303
9494
  return _getNewSpeechConfig.apply(this, arguments);
9304
9495
  }
9305
9496
  return getNewSpeechConfig;
@@ -9312,23 +9503,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9312
9503
  }, {
9313
9504
  key: "get",
9314
9505
  value: function () {
9315
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e, t) {
9506
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e, t) {
9316
9507
  var n;
9317
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
9318
- while (1) switch (_context67.prev = _context67.next) {
9508
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
9509
+ while (1) switch (_context71.prev = _context71.next) {
9319
9510
  case 0:
9320
- _context67.next = 2;
9511
+ _context71.next = 2;
9321
9512
  return AzureSpeechConfig.getNewSpeechConfig(e, t);
9322
9513
  case 2:
9323
- n = _context67.sent;
9324
- return _context67.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9514
+ n = _context71.sent;
9515
+ return _context71.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9325
9516
  case 4:
9326
9517
  case "end":
9327
- return _context67.stop();
9518
+ return _context71.stop();
9328
9519
  }
9329
- }, _callee67);
9520
+ }, _callee71);
9330
9521
  }));
9331
- function get(_x113, _x114) {
9522
+ function get(_x122, _x123) {
9332
9523
  return _get.apply(this, arguments);
9333
9524
  }
9334
9525
  return get;
@@ -9418,28 +9609,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9418
9609
  }, {
9419
9610
  key: "startAsync",
9420
9611
  value: function () {
9421
- var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
9612
+ var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e) {
9422
9613
  var t;
9423
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
9424
- while (1) switch (_context68.prev = _context68.next) {
9614
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
9615
+ while (1) switch (_context72.prev = _context72.next) {
9425
9616
  case 0:
9426
- _context68.t0 = this.validate(e);
9427
- if (!_context68.t0) {
9428
- _context68.next = 6;
9617
+ _context72.t0 = this.validate(e);
9618
+ if (!_context72.t0) {
9619
+ _context72.next = 6;
9429
9620
  break;
9430
9621
  }
9431
- _context68.next = 4;
9622
+ _context72.next = 4;
9432
9623
  return this.instantiateService(e);
9433
9624
  case 4:
9434
9625
  this._translations = e == null ? void 0 : e.translations;
9435
9626
  (t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
9436
9627
  case 6:
9437
9628
  case "end":
9438
- return _context68.stop();
9629
+ return _context72.stop();
9439
9630
  }
9440
- }, _callee68, this);
9631
+ }, _callee72, this);
9441
9632
  }));
9442
- function startAsync(_x115) {
9633
+ function startAsync(_x124) {
9443
9634
  return _startAsync.apply(this, arguments);
9444
9635
  }
9445
9636
  return startAsync;
@@ -9452,28 +9643,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9452
9643
  }, {
9453
9644
  key: "instantiateService",
9454
9645
  value: function () {
9455
- var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e) {
9456
- var t, n, s, o;
9457
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
9458
- while (1) switch (_context69.prev = _context69.next) {
9646
+ var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e) {
9647
+ var t, n, s, _o14;
9648
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
9649
+ while (1) switch (_context73.prev = _context73.next) {
9459
9650
  case 0:
9460
9651
  t = Azure.getAPI();
9461
9652
  n = t.AudioConfig.fromDefaultMicrophoneInput();
9462
- _context69.next = 4;
9653
+ _context73.next = 4;
9463
9654
  return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
9464
9655
  case 4:
9465
- s = _context69.sent;
9656
+ s = _context73.sent;
9466
9657
  if (s) {
9467
- o = new t.SpeechRecognizer(s, n);
9468
- this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9658
+ _o14 = new t.SpeechRecognizer(s, n);
9659
+ this.setEvents(_o14), this._service = _o14, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9469
9660
  } else this.error("Unable to contact Azure server");
9470
9661
  case 6:
9471
9662
  case "end":
9472
- return _context69.stop();
9663
+ return _context73.stop();
9473
9664
  }
9474
- }, _callee69, this);
9665
+ }, _callee73, this);
9475
9666
  }));
9476
- function instantiateService(_x116) {
9667
+ function instantiateService(_x125) {
9477
9668
  return _instantiateService.apply(this, arguments);
9478
9669
  }
9479
9670
  return instantiateService;
@@ -9510,10 +9701,10 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9510
9701
  case window.SpeechSDK.ResultReason.RecognizedSpeech:
9511
9702
  if (n.text && !this._stopping) {
9512
9703
  var _azureTranscript_1$Az2 = azureTranscript_1.AzureTranscript.extract(this._newTextPadding + n.text, this.finalTranscript, !0, this._translations),
9513
- s = _azureTranscript_1$Az2.interimTranscript,
9514
- o = _azureTranscript_1$Az2.finalTranscript,
9515
- a = _azureTranscript_1$Az2.newText;
9516
- stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(s, o, a), o !== "" && (this._newTextPadding = " ");
9704
+ _s22 = _azureTranscript_1$Az2.interimTranscript,
9705
+ _o15 = _azureTranscript_1$Az2.finalTranscript,
9706
+ _a12 = _azureTranscript_1$Az2.newText;
9707
+ stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(_s22, _o15, _a12), _o15 !== "" && (this._newTextPadding = " ");
9517
9708
  }
9518
9709
  break;
9519
9710
  }
@@ -9855,17 +10046,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9855
10046
  }, {
9856
10047
  key: "submit",
9857
10048
  value: function () {
9858
- var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
10049
+ var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(e, t) {
9859
10050
  var l, c, n, s, o, a;
9860
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9861
- while (1) switch (_context70.prev = _context70.next) {
10051
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
10052
+ while (1) switch (_context74.prev = _context74.next) {
9862
10053
  case 0:
9863
- _context70.t0 = e;
9864
- if (_context70.t0) {
9865
- _context70.next = 6;
10054
+ _context74.t0 = e;
10055
+ if (_context74.t0) {
10056
+ _context74.next = 6;
9866
10057
  break;
9867
10058
  }
9868
- _context70.next = 4;
10059
+ _context74.next = 4;
9869
10060
  return this._fileAttachments.completePlaceholders();
9870
10061
  case 4:
9871
10062
  n = this._fileAttachments.getAllFileData();
@@ -9875,40 +10066,40 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9875
10066
  case 6:
9876
10067
  o = t === "" ? void 0 : t;
9877
10068
  if (!(this._isRequestInProgress || !Websocket.canSendMessage(this._serviceIO.websocket))) {
9878
- _context70.next = 9;
10069
+ _context74.next = 9;
9879
10070
  break;
9880
10071
  }
9881
- return _context70.abrupt("return");
10072
+ return _context74.abrupt("return");
9882
10073
  case 9:
9883
10074
  if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
9884
- _context70.next = 14;
10075
+ _context74.next = 14;
9885
10076
  break;
9886
10077
  }
9887
10078
  if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
9888
- _context70.next = 12;
10079
+ _context74.next = 12;
9889
10080
  break;
9890
10081
  }
9891
- return _context70.abrupt("return");
10082
+ return _context74.abrupt("return");
9892
10083
  case 12:
9893
- _context70.next = 16;
10084
+ _context74.next = 16;
9894
10085
  break;
9895
10086
  case 14:
9896
10087
  if (this._serviceIO.canSendMessage(o, s)) {
9897
- _context70.next = 16;
10088
+ _context74.next = 16;
9898
10089
  break;
9899
10090
  }
9900
- return _context70.abrupt("return");
10091
+ return _context74.abrupt("return");
9901
10092
  case 16:
9902
10093
  this.changeToLoadingIcon();
9903
10094
  t !== "" && this._messages.addNewMessage({
9904
10095
  text: t
9905
10096
  }, !1, !0);
9906
- _context70.t1 = n;
9907
- if (!_context70.t1) {
9908
- _context70.next = 22;
10097
+ _context74.t1 = n;
10098
+ if (!_context74.t1) {
10099
+ _context74.next = 22;
9909
10100
  break;
9910
10101
  }
9911
- _context70.next = 22;
10102
+ _context74.next = 22;
9912
10103
  return this._messages.addMultipleFiles(n);
9913
10104
  case 22:
9914
10105
  this._messages.addLoadingMessage();
@@ -9917,17 +10108,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9917
10108
  text: o,
9918
10109
  files: s
9919
10110
  };
9920
- _context70.next = 27;
10111
+ _context74.next = 27;
9921
10112
  return this._serviceIO.callAPI(a, this._messages);
9922
10113
  case 27:
9923
10114
  e || (c = this._fileAttachments) == null || c.removeAllFiles();
9924
10115
  case 28:
9925
10116
  case "end":
9926
- return _context70.stop();
10117
+ return _context74.stop();
9927
10118
  }
9928
- }, _callee70, this);
10119
+ }, _callee74, this);
9929
10120
  }));
9930
- function submit(_x117, _x118) {
10121
+ function submit(_x126, _x127) {
9931
10122
  return _submit.apply(this, arguments);
9932
10123
  }
9933
10124
  return submit;
@@ -10062,13 +10253,13 @@ var CameraModal = /*#__PURE__*/function (_Modal2) {
10062
10253
  t = new Array(e.length);
10063
10254
  for (var l = 0; l < e.length; l++) t[l] = e.charCodeAt(l);
10064
10255
  var n = new Uint8Array(t),
10065
- s = new Blob([n], {
10256
+ _s23 = new Blob([n], {
10066
10257
  type: this._format
10067
10258
  }),
10068
- o = this._format === "image/jpeg" ? "jpeg" : "png",
10069
- a = NewFileName.getFileName(this._newFilePrefix || "photo", o);
10070
- return new File([s], a, {
10071
- type: s.type
10259
+ _o16 = this._format === "image/jpeg" ? "jpeg" : "png",
10260
+ _a13 = NewFileName.getFileName(this._newFilePrefix || "photo", _o16);
10261
+ return new File([_s23], _a13, {
10262
+ type: _s23.type
10072
10263
  });
10073
10264
  }
10074
10265
  }
@@ -10203,9 +10394,9 @@ var Input = /*#__PURE__*/function () {
10203
10394
  u = _FILE_TYPE_BUTTON_ICO.id,
10204
10395
  d = _FILE_TYPE_BUTTON_ICO.svgString,
10205
10396
  h = _FILE_TYPE_BUTTON_ICO.dropupText,
10206
- p = new UploadFileButton(n, c, l, u, d, h);
10397
+ f = new UploadFileButton(n, c, l, u, d, h);
10207
10398
  s[a] = {
10208
- button: p,
10399
+ button: f,
10209
10400
  fileType: c
10210
10401
  };
10211
10402
  }