deep-chat-dev 9.0.1 → 9.0.3

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.
Files changed (78) hide show
  1. package/custom-elements.json +535 -468
  2. package/dist/deepChat.bundle.js +1 -1
  3. package/dist/deepChat.d.ts.map +1 -1
  4. package/dist/deepChat.js +1187 -1029
  5. package/dist/services/assemblyAI/assemblyAIAudioIO.d.ts +2 -2
  6. package/dist/services/assemblyAI/assemblyAIAudioIO.d.ts.map +1 -1
  7. package/dist/services/azure/azureSpeechToTextIO.d.ts +2 -2
  8. package/dist/services/azure/azureSpeechToTextIO.d.ts.map +1 -1
  9. package/dist/services/azure/azureTextToSpeechIO.d.ts +2 -2
  10. package/dist/services/azure/azureTextToSpeechIO.d.ts.map +1 -1
  11. package/dist/services/azure/azureTranslationIO.d.ts +2 -2
  12. package/dist/services/azure/azureTranslationIO.d.ts.map +1 -1
  13. package/dist/services/cohere/cohereChatIO.d.ts +2 -2
  14. package/dist/services/cohere/cohereChatIO.d.ts.map +1 -1
  15. package/dist/services/cohere/cohereSummarizationIO.d.ts +2 -2
  16. package/dist/services/cohere/cohereSummarizationIO.d.ts.map +1 -1
  17. package/dist/services/cohere/cohereTextGenerationIO.d.ts +2 -2
  18. package/dist/services/cohere/cohereTextGenerationIO.d.ts.map +1 -1
  19. package/dist/services/huggingFace/huggingFaceConversationIO.d.ts +2 -2
  20. package/dist/services/huggingFace/huggingFaceConversationIO.d.ts.map +1 -1
  21. package/dist/services/huggingFace/huggingFaceFillMaskIO.d.ts +2 -2
  22. package/dist/services/huggingFace/huggingFaceFillMaskIO.d.ts.map +1 -1
  23. package/dist/services/huggingFace/huggingFaceQuestionAnswerIO.d.ts +2 -2
  24. package/dist/services/huggingFace/huggingFaceQuestionAnswerIO.d.ts.map +1 -1
  25. package/dist/services/huggingFace/huggingFaceSummarizationIO.d.ts +2 -2
  26. package/dist/services/huggingFace/huggingFaceSummarizationIO.d.ts.map +1 -1
  27. package/dist/services/huggingFace/huggingFaceTextGenerationIO.d.ts +2 -2
  28. package/dist/services/huggingFace/huggingFaceTextGenerationIO.d.ts.map +1 -1
  29. package/dist/services/huggingFace/huggingFaceTranslationIO.d.ts +2 -2
  30. package/dist/services/huggingFace/huggingFaceTranslationIO.d.ts.map +1 -1
  31. package/dist/services/openAI/openAIAudioIO.d.ts +2 -2
  32. package/dist/services/openAI/openAIAudioIO.d.ts.map +1 -1
  33. package/dist/services/openAI/openAIChatIO.d.ts +2 -2
  34. package/dist/services/openAI/openAIChatIO.d.ts.map +1 -1
  35. package/dist/services/openAI/openAICompletionsIO.d.ts +2 -2
  36. package/dist/services/openAI/openAICompletionsIO.d.ts.map +1 -1
  37. package/dist/services/openAI/openAIImagesIO.d.ts +2 -2
  38. package/dist/services/openAI/openAIImagesIO.d.ts.map +1 -1
  39. package/dist/services/serviceIO.d.ts +6 -4
  40. package/dist/services/serviceIO.d.ts.map +1 -1
  41. package/dist/services/stabilityAI/stabilityAIImageToImageIO.d.ts +2 -2
  42. package/dist/services/stabilityAI/stabilityAIImageToImageIO.d.ts.map +1 -1
  43. package/dist/services/stabilityAI/stabilityAIImageToImageMaskingIO.d.ts +2 -2
  44. package/dist/services/stabilityAI/stabilityAIImageToImageMaskingIO.d.ts.map +1 -1
  45. package/dist/services/stabilityAI/stabilityAIImageToImageUpscaleIO.d.ts +2 -2
  46. package/dist/services/stabilityAI/stabilityAIImageToImageUpscaleIO.d.ts.map +1 -1
  47. package/dist/services/stabilityAI/stabilityAITextToImageIO.d.ts +2 -2
  48. package/dist/services/stabilityAI/stabilityAITextToImageIO.d.ts.map +1 -1
  49. package/dist/services/utils/baseServiceIO.d.ts +2 -3
  50. package/dist/services/utils/baseServiceIO.d.ts.map +1 -1
  51. package/dist/types/demo.d.ts +2 -2
  52. package/dist/types/demo.d.ts.map +1 -1
  53. package/dist/types/handler.d.ts +15 -0
  54. package/dist/types/handler.d.ts.map +1 -0
  55. package/dist/types/interceptors.d.ts +2 -2
  56. package/dist/types/interceptors.d.ts.map +1 -1
  57. package/dist/types/request.d.ts +3 -2
  58. package/dist/types/request.d.ts.map +1 -1
  59. package/dist/types/{result.d.ts → response.d.ts} +3 -2
  60. package/dist/types/response.d.ts.map +1 -0
  61. package/dist/utils/HTTP/HTTPRequest.d.ts.map +1 -1
  62. package/dist/utils/HTTP/customHandler.d.ts +8 -0
  63. package/dist/utils/HTTP/customHandler.d.ts.map +1 -0
  64. package/dist/utils/HTTP/requestUtils.d.ts +1 -1
  65. package/dist/utils/HTTP/requestUtils.d.ts.map +1 -1
  66. package/dist/utils/HTTP/stream.d.ts.map +1 -1
  67. package/dist/utils/HTTP/websocket.d.ts +4 -3
  68. package/dist/utils/HTTP/websocket.d.ts.map +1 -1
  69. package/dist/utils/demo/demo.d.ts.map +1 -1
  70. package/dist/views/chat/input/buttons/submit/submitButton.d.ts +1 -0
  71. package/dist/views/chat/input/buttons/submit/submitButton.d.ts.map +1 -1
  72. package/dist/views/chat/messages/fileMessages.d.ts.map +1 -1
  73. package/dist/views/chat/messages/messages.d.ts +4 -1
  74. package/dist/views/chat/messages/messages.d.ts.map +1 -1
  75. package/package.json +1 -1
  76. package/dist/types/customService.d.ts +0 -6
  77. package/dist/types/customService.d.ts.map +0 -1
  78. package/dist/types/result.d.ts.map +0 -1
package/dist/deepChat.js CHANGED
@@ -316,13 +316,13 @@ function getInterceptorMessage(r) {
316
316
  function getInvalidResponseMessage(r, e, t, n) {
317
317
  var s = "\n".concat(capitalizeFirstLetter(e), " message: ").concat(JSON.stringify(r), " \n"),
318
318
  o = t ? "".concat(capitalizeFirstLetter(e), " message after interceptor: ").concat(getInterceptorMessage(n), " \n") : "";
319
- return "".concat(s + o, "Make sure the ").concat(e, " message is using the Result format: https://deepchat.dev/docs/connect/#Result \n You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor");
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
322
  INVALID_KEY: "Invalid API Key",
323
323
  CONNECTION_FAILED: "Failed to connect",
324
324
  INVALID_RESPONSE: getInvalidResponseMessage,
325
- INVALID_STREAM_RESPONSE: "Make sure the events are using the Result format: https://deepchat.dev/docs/connect/#Result \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
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
326
  },
327
327
  _RequestUtils = /*#__PURE__*/function () {
328
328
  function D() {
@@ -375,9 +375,9 @@ var ErrorMessages = {
375
375
  return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
376
376
  }
377
377
  }, {
378
- key: "processResponseInterceptor",
378
+ key: "processRequestInterceptor",
379
379
  value: function () {
380
- var _processResponseInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
380
+ var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
381
381
  var a, n, s, o;
382
382
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
383
383
  while (1) switch (_context2.prev = _context2.next) {
@@ -406,10 +406,10 @@ var ErrorMessages = {
406
406
  }
407
407
  }, _callee2);
408
408
  }));
409
- function processResponseInterceptor(_x4, _x5) {
410
- return _processResponseInterceptor.apply(this, arguments);
409
+ function processRequestInterceptor(_x4, _x5) {
410
+ return _processRequestInterceptor.apply(this, arguments);
411
411
  }
412
- return processResponseInterceptor;
412
+ return processRequestInterceptor;
413
413
  }()
414
414
  }]);
415
415
  return D;
@@ -420,29 +420,29 @@ function getBytes(_x6, _x7) {
420
420
  return _getBytes.apply(this, arguments);
421
421
  }
422
422
  function _getBytes() {
423
- _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(r, e) {
423
+ _getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(r, e) {
424
424
  var t, n;
425
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
426
- while (1) switch (_context71.prev = _context71.next) {
425
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
426
+ while (1) switch (_context74.prev = _context74.next) {
427
427
  case 0:
428
428
  t = r.getReader();
429
429
  case 1:
430
- _context71.next = 3;
430
+ _context74.next = 3;
431
431
  return t.read();
432
432
  case 3:
433
- if ((n = _context71.sent).done) {
434
- _context71.next = 7;
433
+ if ((n = _context74.sent).done) {
434
+ _context74.next = 7;
435
435
  break;
436
436
  }
437
437
  e(n.value);
438
438
  case 5:
439
- _context71.next = 1;
439
+ _context74.next = 1;
440
440
  break;
441
441
  case 7:
442
442
  case "end":
443
- return _context71.stop();
443
+ return _context74.stop();
444
444
  }
445
- }, _callee71);
445
+ }, _callee74);
446
446
  }));
447
447
  return _getBytes.apply(this, arguments);
448
448
  }
@@ -536,25 +536,25 @@ function fetchEventSource(r, e) {
536
536
  f.accept || (f.accept = EventStreamContentType);
537
537
  var b;
538
538
  function m() {
539
- b.abort(), document.hidden || I();
539
+ b.abort(), document.hidden || x();
540
540
  }
541
541
  c || document.addEventListener("visibilitychange", m);
542
- var v = DefaultRetryInterval,
543
- g = 0;
542
+ var g = DefaultRetryInterval,
543
+ v = 0;
544
544
  function y() {
545
- document.removeEventListener("visibilitychange", m), window.clearTimeout(g), b.abort();
545
+ document.removeEventListener("visibilitychange", m), window.clearTimeout(v), b.abort();
546
546
  }
547
547
  t == null || t.addEventListener("abort", function () {
548
548
  y(), h();
549
549
  });
550
550
  var S = 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);
551
+ E = s !== null && s !== void 0 ? s : defaultOnOpen;
552
+ function x() {
553
+ return _x8.apply(this, arguments);
554
554
  }
555
- function _I() {
556
- _I = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
557
- var R, w, x;
555
+ function _x8() {
556
+ _x8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
557
+ var R, w, _;
558
558
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
559
559
  while (1) switch (_context3.prev = _context3.next) {
560
560
  case 0:
@@ -568,13 +568,13 @@ function fetchEventSource(r, e) {
568
568
  case 4:
569
569
  w = _context3.sent;
570
570
  _context3.next = 7;
571
- return _(w);
571
+ return E(w);
572
572
  case 7:
573
573
  _context3.next = 9;
574
- return getBytes(w.body, getLines(getMessages(function (x) {
575
- x ? f[LastEventId] = x : delete f[LastEventId];
576
- }, function (x) {
577
- v = x;
574
+ return getBytes(w.body, getLines(getMessages(function (_) {
575
+ _ ? f[LastEventId] = _ : delete f[LastEventId];
576
+ }, function (_) {
577
+ g = _;
578
578
  }, o)));
579
579
  case 9:
580
580
  a == null || a();
@@ -586,10 +586,10 @@ function fetchEventSource(r, e) {
586
586
  _context3.prev = 14;
587
587
  _context3.t0 = _context3["catch"](1);
588
588
  if (!b.signal.aborted) try {
589
- x = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : v;
590
- window.clearTimeout(g), g = window.setTimeout(I, x);
591
- } catch (x) {
592
- y(), p(x);
589
+ _ = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : g;
590
+ window.clearTimeout(v), v = window.setTimeout(x, _);
591
+ } catch (_) {
592
+ y(), p(_);
593
593
  }
594
594
  case 17:
595
595
  case "end":
@@ -597,15 +597,96 @@ function fetchEventSource(r, e) {
597
597
  }
598
598
  }, _callee3, null, [[1, 14]]);
599
599
  }));
600
- return _I.apply(this, arguments);
600
+ return _x8.apply(this, arguments);
601
601
  }
602
- I();
602
+ x();
603
603
  });
604
604
  }
605
605
  function defaultOnOpen(r) {
606
606
  var e = r.headers.get("content-type");
607
607
  if (!(e != null && e.startsWith(EventStreamContentType))) throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(e));
608
608
  }
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
700
  f,
620
701
  b,
621
702
  m,
703
+ g,
622
704
  v,
623
705
  o,
624
706
  _yield$RequestUtils$p,
@@ -630,19 +712,19 @@ var Stream = /*#__PURE__*/function () {
630
712
  d,
631
713
  h,
632
714
  p,
633
- _args5 = arguments;
634
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
635
- while (1) switch (_context5.prev = _context5.next) {
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
722
  headers: (f = e.requestSettings) == null ? void 0 : f.headers
641
723
  };
642
- _context5.next = 4;
643
- return RequestUtils.processResponseInterceptor(e.deepChat, o);
724
+ _context6.next = 4;
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.streamHandler)) {
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:
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:
665
753
  p = null;
666
- fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
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", (p = 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 S = JSON.parse(g.data);
698
- (y = e.extractResultData) == null || y.call(e, S).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)) : p && n.updateStreamedMessage(x.text, p);
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 (S) {
717
- RequestUtils.displayError(n, S);
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,89 +853,113 @@ 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?";
779
- }
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
- result: {
803
- text: C.generateResponse(e)
804
- }
805
- };
806
- }
807
- // timeout is used to simulate a timeout for a response to come back
808
- }, {
860
+ _createClass(CustomHandler, null, [{
809
861
  key: "request",
810
- value: function request(e, t, n) {
811
- var s = C.getResponse(e);
812
- setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
813
- var o;
814
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
815
- while (1) switch (_context6.prev = _context6.next) {
862
+ value: function () {
863
+ var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
864
+ var s, o;
865
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
866
+ while (1) switch (_context8.prev = _context8.next) {
816
867
  case 0:
817
- _context6.next = 2;
818
- return n == null ? void 0 : n(s);
819
- case 2:
820
- _context6.t0 = _context6.sent;
821
- if (_context6.t0) {
822
- _context6.next = 5;
823
- break;
824
- }
825
- _context6.t0 = s;
826
- case 5:
827
- o = _context6.t0;
828
- o.error ? e.addNewErrorMessage("service", o.error) : o.result && e.addNewMessage(o.result, !0, !0), t();
829
- case 7:
868
+ (o = (s = e.requestSettings).handler) == null || o.call(s, t).then( /*#__PURE__*/function () {
869
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(a) {
870
+ var u, d, l, c;
871
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
872
+ while (1) switch (_context7.prev = _context7.next) {
873
+ case 0:
874
+ if (e.extractResultData) {
875
+ _context7.next = 2;
876
+ break;
877
+ }
878
+ return _context7.abrupt("return");
879
+ case 2:
880
+ _context7.next = 4;
881
+ return (d = (u = e.deepChat).responseInterceptor) == null ? void 0 : d.call(u, a);
882
+ case 4:
883
+ _context7.t0 = _context7.sent;
884
+ if (_context7.t0) {
885
+ _context7.next = 7;
886
+ break;
887
+ }
888
+ _context7.t0 = a;
889
+ case 7:
890
+ l = _context7.t0;
891
+ _context7.next = 10;
892
+ return e.extractResultData(l);
893
+ case 10:
894
+ c = _context7.sent;
895
+ if (!(!c || _typeof(c) != "object")) {
896
+ _context7.next = 13;
897
+ break;
898
+ }
899
+ throw Error(ErrorMessages.INVALID_RESPONSE(a, "response", !!e.deepChat.responseInterceptor, c));
900
+ case 13:
901
+ e.deepChat.stream && c.text ? Stream.simulate(n, e.streamHandlers, c.text) : (n.addNewMessage(c, !0, !0), e.completionsHandlers.onFinish());
902
+ case 14:
903
+ case "end":
904
+ return _context7.stop();
905
+ }
906
+ }, _callee7);
907
+ }));
908
+ return function (_x15) {
909
+ return _ref2.apply(this, arguments);
910
+ };
911
+ }())["catch"](function (a) {
912
+ RequestUtils.displayError(n, a), e.completionsHandlers.onFinish();
913
+ });
914
+ case 1:
830
915
  case "end":
831
- return _context6.stop();
916
+ return _context8.stop();
832
917
  }
833
- }, _callee6);
834
- })), 400);
835
- }
836
- // timeout is used to simulate a timeout for a response to come back
918
+ }, _callee8);
919
+ }));
920
+ function request(_x12, _x13, _x14) {
921
+ return _request2.apply(this, arguments);
922
+ }
923
+ return request;
924
+ }()
837
925
  }, {
838
- key: "requestStream",
839
- value: function requestStream(e, t) {
840
- setTimeout(function () {
841
- var s, o;
842
- var n = (o = (s = C.getResponse(e)) == null ? void 0 : s.result) == null ? void 0 : o.text;
843
- Stream.simulate(e, t, n);
844
- }, 400);
845
- }
926
+ key: "stream",
927
+ value: function () {
928
+ var _stream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(e, t, n) {
929
+ var d, h, s, o, a, l, c, u;
930
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
931
+ while (1) switch (_context9.prev = _context9.next) {
932
+ case 0:
933
+ s = !0, o = !1, a = null;
934
+ l = function l() {
935
+ o || !s || (a = n.addNewStreamedMessage(), e.streamHandlers.onOpen(), o = !0);
936
+ }, c = function c() {
937
+ s && (n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1);
938
+ }, u = function u(p) {
939
+ s && (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));
940
+ };
941
+ e.streamHandlers.abortStream.abort = function () {
942
+ n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
943
+ }, (h = (d = e.requestSettings).streamHandler) == null || h.call(d, t, {
944
+ onOpen: l,
945
+ onResult: u,
946
+ onClose: c,
947
+ stopClicked: e.streamHandlers.stopClicked
948
+ });
949
+ case 3:
950
+ case "end":
951
+ return _context9.stop();
952
+ }
953
+ }, _callee9);
954
+ }));
955
+ function stream(_x16, _x17, _x18) {
956
+ return _stream.apply(this, arguments);
957
+ }
958
+ return stream;
959
+ }()
846
960
  }]);
847
- return C;
961
+ return CustomHandler;
848
962
  }();
849
- _Demo.URL = "deep-chat-demo";
850
- var Demo = _Demo;
851
963
  var HTTPRequest = /*#__PURE__*/function () {
852
964
  function HTTPRequest() {
853
965
  _classCallCheck(this, HTTPRequest);
@@ -856,12 +968,13 @@ var HTTPRequest = /*#__PURE__*/function () {
856
968
  key: "request",
857
969
  value: // prettier-ignore
858
970
  function () {
859
- var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
971
+ var _request3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(e, t, n) {
860
972
  var s,
861
973
  h,
862
974
  p,
863
975
  f,
864
976
  b,
977
+ m,
865
978
  o,
866
979
  _yield$RequestUtils$p2,
867
980
  a,
@@ -869,104 +982,110 @@ var HTTPRequest = /*#__PURE__*/function () {
869
982
  c,
870
983
  u,
871
984
  d,
872
- _args8 = arguments;
873
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
874
- while (1) switch (_context8.prev = _context8.next) {
985
+ _args11 = arguments;
986
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
987
+ while (1) switch (_context11.prev = _context11.next) {
875
988
  case 0:
876
- s = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : !0;
989
+ s = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : !0;
877
990
  o = {
878
991
  body: t,
879
992
  headers: (h = e.requestSettings) == null ? void 0 : h.headers
880
993
  };
881
- _context8.next = 4;
882
- return RequestUtils.processResponseInterceptor(e.deepChat, o);
994
+ _context11.next = 4;
995
+ return RequestUtils.processRequestInterceptor(e.deepChat, o);
883
996
  case 4:
884
- _yield$RequestUtils$p2 = _context8.sent;
997
+ _yield$RequestUtils$p2 = _context11.sent;
885
998
  a = _yield$RequestUtils$p2.body;
886
999
  l = _yield$RequestUtils$p2.headers;
887
1000
  c = _yield$RequestUtils$p2.error;
888
1001
  u = e.completionsHandlers.onFinish;
889
1002
  if (!c) {
890
- _context8.next = 11;
1003
+ _context11.next = 11;
891
1004
  break;
892
1005
  }
893
- return _context8.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
1006
+ return _context11.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
894
1007
  case 11:
895
- if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
896
- _context8.next = 13;
1008
+ if (!((p = e.requestSettings) != null && p.handler)) {
1009
+ _context11.next = 13;
897
1010
  break;
898
1011
  }
899
- return _context8.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1012
+ return _context11.abrupt("return", CustomHandler.request(e, a, n));
900
1013
  case 13:
1014
+ if (!(((f = e.requestSettings) == null ? void 0 : f.url) === Demo.URL)) {
1015
+ _context11.next = 15;
1016
+ break;
1017
+ }
1018
+ return _context11.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
1019
+ case 15:
901
1020
  d = !0;
902
- fetch(((f = e.requestSettings) == null ? void 0 : f.url) || e.url || "", {
903
- method: ((b = e.requestSettings) == null ? void 0 : b.method) || "POST",
1021
+ fetch(((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", {
1022
+ method: ((m = e.requestSettings) == null ? void 0 : m.method) || "POST",
904
1023
  headers: l,
905
1024
  body: s ? JSON.stringify(a) : a
906
- }).then(function (m) {
907
- return d = !!m.ok, m;
908
- }).then(function (m) {
909
- return RequestUtils.processResponseByType(m);
1025
+ }).then(function (g) {
1026
+ return d = !!g.ok, g;
1027
+ }).then(function (g) {
1028
+ return RequestUtils.processResponseByType(g);
910
1029
  }).then( /*#__PURE__*/function () {
911
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(m) {
912
- var y, S, v, g;
913
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
914
- while (1) switch (_context7.prev = _context7.next) {
1030
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(g) {
1031
+ var S, E, v, y;
1032
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1033
+ while (1) switch (_context10.prev = _context10.next) {
915
1034
  case 0:
916
1035
  if (e.extractResultData) {
917
- _context7.next = 2;
1036
+ _context10.next = 2;
918
1037
  break;
919
1038
  }
920
- return _context7.abrupt("return");
1039
+ return _context10.abrupt("return");
921
1040
  case 2:
922
- _context7.next = 4;
923
- return (S = (y = e.deepChat).responseInterceptor) == null ? void 0 : S.call(y, m);
1041
+ _context10.next = 4;
1042
+ return (E = (S = e.deepChat).responseInterceptor) == null ? void 0 : E.call(S, g);
924
1043
  case 4:
925
- _context7.t0 = _context7.sent;
926
- if (_context7.t0) {
927
- _context7.next = 7;
1044
+ _context10.t0 = _context10.sent;
1045
+ if (_context10.t0) {
1046
+ _context10.next = 7;
928
1047
  break;
929
1048
  }
930
- _context7.t0 = m;
1049
+ _context10.t0 = g;
931
1050
  case 7:
932
- v = _context7.t0;
933
- _context7.next = 10;
1051
+ v = _context10.t0;
1052
+ _context10.next = 10;
934
1053
  return e.extractResultData(v);
935
1054
  case 10:
936
- g = _context7.sent;
1055
+ y = _context10.sent;
937
1056
  if (d) {
938
- _context7.next = 13;
1057
+ _context10.next = 13;
939
1058
  break;
940
1059
  }
941
- throw m;
1060
+ throw g;
942
1061
  case 13:
943
- if (!(!g || _typeof(g) != "object")) {
944
- _context7.next = 15;
1062
+ if (!(!y || _typeof(y) != "object")) {
1063
+ _context10.next = 15;
945
1064
  break;
946
1065
  }
947
- throw Error(ErrorMessages.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, v));
1066
+ throw Error(ErrorMessages.INVALID_RESPONSE(g, "response", !!e.deepChat.responseInterceptor, v));
948
1067
  case 15:
949
- g.pollingInAnotherRequest || (e.deepChat.stream && g.text ? Stream.simulate(n, e.streamHandlers, g.text) : (n.addNewMessage(g, !0, !0), u()));
1068
+ y.pollingInAnotherRequest || (e.deepChat.stream && y.text ? Stream.simulate(n, e.streamHandlers, y.text) : (n.addNewMessage(y, !0, !0), u()));
950
1069
  case 16:
951
1070
  case "end":
952
- return _context7.stop();
1071
+ return _context10.stop();
953
1072
  }
954
- }, _callee7);
1073
+ }, _callee10);
955
1074
  }));
956
- return function (_x14) {
957
- return _ref2.apply(this, arguments);
1075
+ return function (_x22) {
1076
+ return _ref3.apply(this, arguments);
958
1077
  };
959
- }())["catch"](function (m) {
960
- RequestUtils.displayError(n, m), u();
1078
+ }())["catch"](function (g) {
1079
+ RequestUtils.displayError(n, g), u();
961
1080
  });
962
- case 15:
1081
+ case 17:
963
1082
  case "end":
964
- return _context8.stop();
1083
+ return _context11.stop();
965
1084
  }
966
- }, _callee8);
1085
+ }, _callee11);
967
1086
  }));
968
- function request(_x11, _x12, _x13) {
969
- return _request2.apply(this, arguments);
1087
+ function request(_x19, _x20, _x21) {
1088
+ return _request3.apply(this, arguments);
970
1089
  }
971
1090
  return request;
972
1091
  }() // prettier-ignore
@@ -978,44 +1097,44 @@ var HTTPRequest = /*#__PURE__*/function () {
978
1097
  fetch(t, n).then(function (a) {
979
1098
  return a.json();
980
1099
  }).then( /*#__PURE__*/function () {
981
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(a) {
1100
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(a) {
982
1101
  var c, u, l;
983
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
984
- while (1) switch (_context9.prev = _context9.next) {
1102
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1103
+ while (1) switch (_context12.prev = _context12.next) {
985
1104
  case 0:
986
1105
  if (e.extractPollResultData) {
987
- _context9.next = 2;
1106
+ _context12.next = 2;
988
1107
  break;
989
1108
  }
990
- return _context9.abrupt("return");
1109
+ return _context12.abrupt("return");
991
1110
  case 2:
992
- _context9.t0 = e;
993
- _context9.next = 5;
1111
+ _context12.t0 = e;
1112
+ _context12.next = 5;
994
1113
  return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
995
1114
  case 5:
996
- _context9.t1 = _context9.sent;
997
- if (_context9.t1) {
998
- _context9.next = 8;
1115
+ _context12.t1 = _context12.sent;
1116
+ if (_context12.t1) {
1117
+ _context12.next = 8;
999
1118
  break;
1000
1119
  }
1001
- _context9.t1 = a;
1120
+ _context12.t1 = a;
1002
1121
  case 8:
1003
- _context9.t2 = _context9.t1;
1004
- _context9.next = 11;
1005
- return _context9.t0.extractPollResultData.call(_context9.t0, _context9.t2);
1122
+ _context12.t2 = _context12.t1;
1123
+ _context12.next = 11;
1124
+ return _context12.t0.extractPollResultData.call(_context12.t0, _context12.t2);
1006
1125
  case 11:
1007
- l = _context9.sent;
1126
+ l = _context12.sent;
1008
1127
  l.timeoutMS ? setTimeout(function () {
1009
1128
  HTTPRequest.executePollRequest(e, t, n, s);
1010
1129
  }, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
1011
1130
  case 13:
1012
1131
  case "end":
1013
- return _context9.stop();
1132
+ return _context12.stop();
1014
1133
  }
1015
- }, _callee9);
1134
+ }, _callee12);
1016
1135
  }));
1017
- return function (_x15) {
1018
- return _ref3.apply(this, arguments);
1136
+ return function (_x23) {
1137
+ return _ref4.apply(this, arguments);
1019
1138
  };
1020
1139
  }())["catch"](function (a) {
1021
1140
  RequestUtils.displayError(s, a), o();
@@ -1025,7 +1144,7 @@ var HTTPRequest = /*#__PURE__*/function () {
1025
1144
  }, {
1026
1145
  key: "poll",
1027
1146
  value: function () {
1028
- var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
1147
+ var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
1029
1148
  var s,
1030
1149
  f,
1031
1150
  b,
@@ -1039,27 +1158,27 @@ var HTTPRequest = /*#__PURE__*/function () {
1039
1158
  d,
1040
1159
  h,
1041
1160
  p,
1042
- _args10 = arguments;
1043
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1044
- while (1) switch (_context10.prev = _context10.next) {
1161
+ _args13 = arguments;
1162
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1163
+ while (1) switch (_context13.prev = _context13.next) {
1045
1164
  case 0:
1046
- s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
1165
+ s = _args13.length > 3 && _args13[3] !== undefined ? _args13[3] : !0;
1047
1166
  o = {
1048
1167
  body: t,
1049
1168
  headers: (f = e.requestSettings) == null ? void 0 : f.headers
1050
1169
  };
1051
- _context10.next = 4;
1052
- return RequestUtils.processResponseInterceptor(e.deepChat, o);
1170
+ _context13.next = 4;
1171
+ return RequestUtils.processRequestInterceptor(e.deepChat, o);
1053
1172
  case 4:
1054
- _yield$RequestUtils$p3 = _context10.sent;
1173
+ _yield$RequestUtils$p3 = _context13.sent;
1055
1174
  a = _yield$RequestUtils$p3.body;
1056
1175
  l = _yield$RequestUtils$p3.headers;
1057
1176
  c = _yield$RequestUtils$p3.error;
1058
1177
  if (!c) {
1059
- _context10.next = 10;
1178
+ _context13.next = 10;
1060
1179
  break;
1061
1180
  }
1062
- return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1181
+ return _context13.abrupt("return", HTTPRequest.onInterceptorError(n, c));
1063
1182
  case 10:
1064
1183
  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 = {
1065
1184
  method: d,
@@ -1069,11 +1188,11 @@ var HTTPRequest = /*#__PURE__*/function () {
1069
1188
  HTTPRequest.executePollRequest(e, u, p, n);
1070
1189
  case 12:
1071
1190
  case "end":
1072
- return _context10.stop();
1191
+ return _context13.stop();
1073
1192
  }
1074
- }, _callee10);
1193
+ }, _callee13);
1075
1194
  }));
1076
- function poll(_x16, _x17, _x18) {
1195
+ function poll(_x24, _x25, _x26) {
1077
1196
  return _poll.apply(this, arguments);
1078
1197
  }
1079
1198
  return poll;
@@ -1114,9 +1233,9 @@ var MessageLimitUtils = /*#__PURE__*/function () {
1114
1233
  var n = 0,
1115
1234
  s = e.length - 1;
1116
1235
  for (s; s >= 0; s -= 1) {
1117
- var a = (o = e[s]) == null ? void 0 : o.text;
1118
- if (a !== void 0 && (n += a.length, n > t)) {
1119
- e[s].text = a.substring(0, a.length - (n - t));
1236
+ var _a = (o = e[s]) == null ? void 0 : o.text;
1237
+ if (_a !== void 0 && (n += _a.length, n > t)) {
1238
+ e[s].text = _a.substring(0, _a.length - (n - t));
1120
1239
  break;
1121
1240
  }
1122
1241
  }
@@ -1158,83 +1277,94 @@ var Websocket = /*#__PURE__*/function () {
1158
1277
  }
1159
1278
  _createClass(Websocket, null, [{
1160
1279
  key: "setup",
1161
- value: function setup(e, t) {
1162
- if (e.requestSettings.url !== Demo.URL) {
1163
- var n = typeof t != "boolean" ? t : void 0;
1164
- try {
1165
- e.websocket = Websocket.connect(e.requestSettings.url, n), console.log("got here"), e.permittedErrorPrefixes = ["Connection error", "Error in server message"];
1166
- } catch (_unused2) {
1167
- console.log("error caught");
1168
- }
1280
+ value: function setup(e) {
1281
+ e.requestSettings.url !== Demo.URL && (e.permittedErrorPrefixes = ["Connection error", "Error in server message"], e.websocket = "pending");
1282
+ }
1283
+ }, {
1284
+ key: "createConnection",
1285
+ value: function createConnection(e, t) {
1286
+ if (!document.body.contains(e.deepChat)) return;
1287
+ var n = e.requestSettings.websocket;
1288
+ if (n) try {
1289
+ var _s = typeof n != "boolean" ? n : void 0;
1290
+ e.websocket = new WebSocket(e.requestSettings.url || "", _s), e.websocket.onopen = function () {
1291
+ t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, e.websocket, t);
1292
+ }, e.websocket.onerror = function (o) {
1293
+ console.error(o), Websocket.retryConnection(e, t);
1294
+ };
1295
+ } catch (s) {
1296
+ console.error(s), Websocket.retryConnection(e, t);
1169
1297
  }
1170
1298
  }
1171
1299
  }, {
1172
- key: "connect",
1173
- value: function connect(e, t) {
1174
- return new WebSocket(e || "", t);
1300
+ key: "retryConnection",
1301
+ value: function retryConnection(e, t) {
1302
+ document.body.contains(e.deepChat) && (e.websocket = "pending", t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error"), setTimeout(function () {
1303
+ Websocket.createConnection(e, t);
1304
+ }, 5e3));
1175
1305
  }
1176
1306
  }, {
1177
1307
  key: "assignListeners",
1178
- value: function assignListeners(e, t) {
1179
- e.websocket && (e.websocket.onmessage = /*#__PURE__*/function () {
1180
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(n) {
1181
- var s, o, a, l, c;
1182
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1183
- while (1) switch (_context11.prev = _context11.next) {
1308
+ value: function assignListeners(e, t, n) {
1309
+ t.onmessage = /*#__PURE__*/function () {
1310
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
1311
+ var o, a, l, c, u;
1312
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1313
+ while (1) switch (_context14.prev = _context14.next) {
1184
1314
  case 0:
1185
1315
  if (!e.extractResultData) {
1186
- _context11.next = 20;
1316
+ _context14.next = 20;
1187
1317
  break;
1188
1318
  }
1189
- _context11.prev = 1;
1190
- a = JSON.parse(n.data);
1191
- _context11.next = 5;
1192
- return (o = (s = e.deepChat).responseInterceptor) == null ? void 0 : o.call(s, a);
1319
+ _context14.prev = 1;
1320
+ l = JSON.parse(s.data);
1321
+ _context14.next = 5;
1322
+ return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
1193
1323
  case 5:
1194
- _context11.t0 = _context11.sent;
1195
- if (_context11.t0) {
1196
- _context11.next = 8;
1324
+ _context14.t0 = _context14.sent;
1325
+ if (_context14.t0) {
1326
+ _context14.next = 8;
1197
1327
  break;
1198
1328
  }
1199
- _context11.t0 = a;
1329
+ _context14.t0 = l;
1200
1330
  case 8:
1201
- l = _context11.t0;
1202
- _context11.next = 11;
1203
- return e.extractResultData(l);
1331
+ c = _context14.t0;
1332
+ _context14.next = 11;
1333
+ return e.extractResultData(c);
1204
1334
  case 11:
1205
- c = _context11.sent;
1206
- if (!(!c || _typeof(c) != "object")) {
1207
- _context11.next = 14;
1335
+ u = _context14.sent;
1336
+ if (!(!u || _typeof(u) != "object")) {
1337
+ _context14.next = 14;
1208
1338
  break;
1209
1339
  }
1210
- throw Error(ErrorMessages.INVALID_RESPONSE(a, "server", !!e.deepChat.responseInterceptor, l));
1340
+ throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
1211
1341
  case 14:
1212
- e.deepChat.stream && c.text ? Stream.simulate(t, e.streamHandlers, c.text) : t.addNewMessage(c, !0, !0);
1213
- _context11.next = 20;
1342
+ e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
1343
+ _context14.next = 20;
1214
1344
  break;
1215
1345
  case 17:
1216
- _context11.prev = 17;
1217
- _context11.t1 = _context11["catch"](1);
1218
- RequestUtils.displayError(t, _context11.t1, "Error in server message");
1346
+ _context14.prev = 17;
1347
+ _context14.t1 = _context14["catch"](1);
1348
+ RequestUtils.displayError(n, _context14.t1, "Error in server message");
1219
1349
  case 20:
1220
1350
  case "end":
1221
- return _context11.stop();
1351
+ return _context14.stop();
1222
1352
  }
1223
- }, _callee11, null, [[1, 17]]);
1353
+ }, _callee14, null, [[1, 17]]);
1224
1354
  }));
1225
- return function (_x19) {
1226
- return _ref4.apply(this, arguments);
1355
+ return function (_x27) {
1356
+ return _ref5.apply(this, arguments);
1227
1357
  };
1228
- }(), e.websocket.onerror = function (n) {
1229
- console.error(n), t.addNewErrorMessage("service", "Connection error");
1230
- }, e.websocket.onclose = function () {
1231
- console.error("Connection closed"), t.isLastMessageError() || t.addNewErrorMessage("service", "Connection error");
1232
- });
1358
+ }(), t.onerror = function (s) {
1359
+ console.error(s), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error");
1360
+ }, t.onclose = function () {
1361
+ console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
1362
+ };
1233
1363
  }
1234
1364
  }, {
1235
1365
  key: "sendWebsocket",
1236
1366
  value: function () {
1237
- var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n, s) {
1367
+ var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t, n, s) {
1238
1368
  var o,
1239
1369
  d,
1240
1370
  h,
@@ -1243,42 +1373,42 @@ var Websocket = /*#__PURE__*/function () {
1243
1373
  l,
1244
1374
  c,
1245
1375
  u,
1246
- _args12 = arguments;
1247
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1248
- while (1) switch (_context12.prev = _context12.next) {
1376
+ _args15 = arguments;
1377
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1378
+ while (1) switch (_context15.prev = _context15.next) {
1249
1379
  case 0:
1250
- o = _args12.length > 4 && _args12[4] !== undefined ? _args12[4] : !0;
1380
+ o = _args15.length > 4 && _args15[4] !== undefined ? _args15[4] : !0;
1251
1381
  a = {
1252
1382
  body: n,
1253
1383
  headers: (d = t.requestSettings) == null ? void 0 : d.headers
1254
1384
  };
1255
- _context12.next = 4;
1256
- return RequestUtils.processResponseInterceptor(t.deepChat, a);
1385
+ _context15.next = 4;
1386
+ return RequestUtils.processRequestInterceptor(t.deepChat, a);
1257
1387
  case 4:
1258
- _yield$RequestUtils$p4 = _context12.sent;
1388
+ _yield$RequestUtils$p4 = _context15.sent;
1259
1389
  l = _yield$RequestUtils$p4.body;
1260
1390
  c = _yield$RequestUtils$p4.error;
1261
1391
  if (!c) {
1262
- _context12.next = 9;
1392
+ _context15.next = 9;
1263
1393
  break;
1264
1394
  }
1265
- return _context12.abrupt("return", s.addNewErrorMessage("service", c));
1395
+ return _context15.abrupt("return", s.addNewErrorMessage("service", c));
1266
1396
  case 9:
1267
1397
  u = o ? JSON.stringify(l) : l;
1268
1398
  if (!(((h = t.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
1269
- _context12.next = 12;
1399
+ _context15.next = 12;
1270
1400
  break;
1271
1401
  }
1272
- return _context12.abrupt("return", Demo.request(s, t.completionsHandlers.onFinish, t.deepChat.responseInterceptor));
1402
+ return _context15.abrupt("return", Demo.request(s, t.completionsHandlers.onFinish, t.deepChat.responseInterceptor));
1273
1403
  case 12:
1274
- e.readyState !== e.OPEN ? (console.error("Connection is not open"), s.addNewErrorMessage("service", "Connection error")) : e.send(JSON.stringify(u));
1404
+ e.readyState === void 0 || e.readyState !== e.OPEN ? (console.error("Connection is not open"), s.isLastMessageError() || s.addNewErrorMessage("service", "Connection error")) : e.send(JSON.stringify(u));
1275
1405
  case 13:
1276
1406
  case "end":
1277
- return _context12.stop();
1407
+ return _context15.stop();
1278
1408
  }
1279
- }, _callee12);
1409
+ }, _callee15);
1280
1410
  }));
1281
- function sendWebsocket(_x20, _x21, _x22, _x23) {
1411
+ function sendWebsocket(_x28, _x29, _x30, _x31) {
1282
1412
  return _sendWebsocket.apply(this, arguments);
1283
1413
  }
1284
1414
  return sendWebsocket;
@@ -1722,7 +1852,7 @@ function normalizeLink(r) {
1722
1852
  var e = replaceEntities(r);
1723
1853
  try {
1724
1854
  e = decodeURI(e);
1725
- } catch (_unused3) {}
1855
+ } catch (_unused2) {}
1726
1856
  return encodeURI(e);
1727
1857
  }
1728
1858
  function parseLinkDestination(r, e) {
@@ -1938,24 +2068,24 @@ function replaceAt(r, e, t) {
1938
2068
  return r.substr(0, e) + t + r.substr(e + 1);
1939
2069
  }
1940
2070
  function smartquotes(r) {
1941
- var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m, v, g;
2071
+ var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m, g, v;
1942
2072
  if (r.options.typographer) {
1943
- for (g = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
1944
- 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))) {
1945
- for (l = v[e].level, f = g.length - 1; f >= 0 && !(g[f].level <= l); f--);
1946
- g.length = f + 1, n = t.content, o = 0, a = n.length;
2073
+ for (v = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
2074
+ 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))) {
2075
+ for (l = g[e].level, f = v.length - 1; f >= 0 && !(v[f].level <= l); f--);
2076
+ v.length = f + 1, n = t.content, o = 0, a = n.length;
1947
2077
  e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
1948
2078
  if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
1949
2079
  b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
1950
2080
  continue;
1951
2081
  }
1952
2082
  if (h = !u, p = !c, p) {
1953
- for (f = g.length - 1; f >= 0 && (d = g[f], !(g[f].level < l)); f--) if (d.single === b && g[f].level === l) {
1954
- 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;
2083
+ for (f = v.length - 1; f >= 0 && (d = v[f], !(v[f].level < l)); f--) if (d.single === b && v[f].level === l) {
2084
+ d = v[f], 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 = f;
1955
2085
  continue e;
1956
2086
  }
1957
2087
  }
1958
- h ? g.push({
2088
+ h ? v.push({
1959
2089
  token: e,
1960
2090
  pos: s.index,
1961
2091
  single: b,
@@ -2076,12 +2206,12 @@ function blockquote(r, e, t, n) {
2076
2206
  f,
2077
2207
  b,
2078
2208
  m = r.bMarks[e] + r.tShift[e],
2079
- v = r.eMarks[e];
2080
- if (m > v || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
2209
+ g = r.eMarks[e];
2210
+ if (m > g || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
2081
2211
  if (n) return !0;
2082
- 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++) {
2212
+ 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++) {
2083
2213
  if (r.src.charCodeAt(m++) === 62) {
2084
- 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];
2214
+ 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];
2085
2215
  continue;
2086
2216
  }
2087
2217
  if (o) break;
@@ -2156,51 +2286,51 @@ function list(r, e, t, n) {
2156
2286
  f,
2157
2287
  b,
2158
2288
  m,
2159
- v,
2160
2289
  g,
2290
+ v,
2161
2291
  y,
2162
2292
  S,
2163
- _,
2164
- I,
2293
+ E,
2294
+ x,
2165
2295
  R = !0,
2166
2296
  w,
2167
- x,
2297
+ _,
2168
2298
  H,
2169
2299
  F;
2170
- if ((h = skipOrderedListMarker(r, e)) >= 0) v = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) v = !1;else return !1;
2300
+ if ((h = skipOrderedListMarker(r, e)) >= 0) g = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) g = !1;else return !1;
2171
2301
  if (r.level >= r.options.maxNesting) return !1;
2172
2302
  if (m = r.src.charCodeAt(h - 1), n) return !0;
2173
- 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({
2303
+ 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({
2174
2304
  type: "ordered_list_open",
2175
2305
  order: b,
2176
- lines: _ = [e, 0],
2306
+ lines: E = [e, 0],
2177
2307
  level: r.level++
2178
2308
  })) : r.tokens.push({
2179
2309
  type: "bullet_list_open",
2180
- lines: _ = [e, 0],
2310
+ lines: E = [e, 0],
2181
2311
  level: r.level++
2182
- }), s = e, S = !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({
2312
+ }), s = e, S = !1, w = r.parser.ruler.getRules("list"); s < t && (v = r.skipSpaces(h), p = r.eMarks[s], v >= p ? f = 1 : f = v - h, f > 4 && (f = 1), f < 1 && (f = 1), o = h - r.bMarks[s] + f, r.tokens.push({
2183
2313
  type: "list_item_open",
2184
- lines: I = [e, 0],
2314
+ lines: x = [e, 0],
2185
2315
  level: r.level++
2186
- }), 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 || 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({
2316
+ }), 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({
2187
2317
  type: "list_item_close",
2188
2318
  level: --r.level
2189
- }), s = e = r.line, I[1] = s, g = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2190
- for (F = !1, x = 0, H = w.length; x < H; x++) if (w[x](r, s, t, !0)) {
2319
+ }), s = e = r.line, x[1] = s, v = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
2320
+ for (F = !1, _ = 0, H = w.length; _ < H; _++) if (w[_](r, s, t, !0)) {
2191
2321
  F = !0;
2192
2322
  break;
2193
2323
  }
2194
2324
  if (F) break;
2195
- if (v) {
2325
+ if (g) {
2196
2326
  if (h = skipOrderedListMarker(r, s), h < 0) break;
2197
2327
  } else if (h = skipBulletListMarker(r, s), h < 0) break;
2198
2328
  if (m !== r.src.charCodeAt(h - 1)) break;
2199
2329
  }
2200
2330
  return r.tokens.push({
2201
- type: v ? "ordered_list_close" : "bullet_list_close",
2331
+ type: g ? "ordered_list_close" : "bullet_list_close",
2202
2332
  level: --r.level
2203
- }), _[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2333
+ }), E[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
2204
2334
  }
2205
2335
  function footnote(r, e, t, n) {
2206
2336
  var s,
@@ -2405,7 +2535,7 @@ function markTightParagraphs$1(r, e) {
2405
2535
  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);
2406
2536
  }
2407
2537
  function deflist(r, e, t, n) {
2408
- var s, o, a, l, c, u, d, h, p, f, b, m, v, g;
2538
+ var s, o, a, l, c, u, d, h, p, f, b, m, g, v;
2409
2539
  if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
2410
2540
  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;
2411
2541
  u = r.tokens.length, r.tokens.push({
@@ -2414,7 +2544,7 @@ function deflist(r, e, t, n) {
2414
2544
  level: r.level++
2415
2545
  }), a = e, o = d;
2416
2546
  e: for (;;) {
2417
- for (g = !0, v = !1, r.tokens.push({
2547
+ for (v = !0, g = !1, r.tokens.push({
2418
2548
  type: "dt_open",
2419
2549
  lines: [a, a],
2420
2550
  level: r.level++
@@ -2432,7 +2562,7 @@ function deflist(r, e, t, n) {
2432
2562
  type: "dd_open",
2433
2563
  lines: l = [d, 0],
2434
2564
  level: r.level++
2435
- }), 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({
2565
+ }), 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 || g) && (v = !1), g = 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({
2436
2566
  type: "dd_close",
2437
2567
  level: --r.level
2438
2568
  }), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
@@ -2444,7 +2574,7 @@ function deflist(r, e, t, n) {
2444
2574
  return r.tokens.push({
2445
2575
  type: "dl_close",
2446
2576
  level: --r.level
2447
- }), c[1] = d, r.line = d, g && markTightParagraphs$1(r, u), !0;
2577
+ }), c[1] = d, r.line = d, v && markTightParagraphs$1(r, u), !0;
2448
2578
  }
2449
2579
  function paragraph(r, e) {
2450
2580
  var t,
@@ -3169,12 +3299,12 @@ var RemarkableConfig = /*#__PURE__*/function () {
3169
3299
  highlight: function highlight(t, n) {
3170
3300
  if (n && e.getLanguage(n)) try {
3171
3301
  return e.highlight(n, t).value;
3172
- } catch (_unused4) {
3302
+ } catch (_unused3) {
3173
3303
  console.error("failed to setup the highlight dependency");
3174
3304
  }
3175
3305
  try {
3176
3306
  return e.highlightAuto(t).value;
3177
- } catch (_unused5) {
3307
+ } catch (_unused4) {
3178
3308
  console.error("failed to automatically highlight messages");
3179
3309
  }
3180
3310
  return "";
@@ -3225,10 +3355,10 @@ var SetFileTypes = /*#__PURE__*/function () {
3225
3355
  key: "processMixedFiles",
3226
3356
  value: function processMixedFiles(e, t, n) {
3227
3357
  if (n) {
3228
- var s = {
3358
+ var _s2 = {
3229
3359
  acceptedFormats: ""
3230
3360
  };
3231
- e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, s, t, n);
3361
+ e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, _s2, t, n);
3232
3362
  }
3233
3363
  }
3234
3364
  // needs to be set after audio to overwrite maxNumberOfFiles
@@ -3308,7 +3438,7 @@ var BaseServiceIO = /*#__PURE__*/function () {
3308
3438
  var _l$url;
3309
3439
  _classCallCheck(this, BaseServiceIO);
3310
3440
  var s, o, a, l;
3311
- this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage = BaseServiceIO.canSendMessage, this.requestSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = n, Object.assign(this.rawBody, (s = e.request) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.totalMessagesMaxCharLength, this.maxMessages = (a = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : a.maxMessages, SetFileTypes.set(e, this, t), e.request && (this.requestSettings = e.request), this.demo && ((_l$url = (l = this.requestSettings).url) !== null && _l$url !== void 0 ? _l$url : l.url = Demo.URL), this._directServiceRequiresFiles = !!t && Object.keys(t).length > 0, this.requestSettings.websocket && Websocket.setup(this, this.requestSettings.websocket);
3441
+ this.rawBody = {}, this.validateConfigKey = !1, this.canSendMessage = BaseServiceIO.canSendMessage, this.requestSettings = {}, this.fileTypes = {}, this.completionsHandlers = {}, this.streamHandlers = {}, this.deepChat = e, this.demo = n, Object.assign(this.rawBody, (s = e.request) == null ? void 0 : s.additionalBodyProps), this.totalMessagesMaxCharLength = (o = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : o.totalMessagesMaxCharLength, this.maxMessages = (a = e == null ? void 0 : e.requestBodyLimits) == null ? void 0 : a.maxMessages, SetFileTypes.set(e, this, t), e.request && (this.requestSettings = e.request), this.demo && ((_l$url = (l = this.requestSettings).url) !== null && _l$url !== void 0 ? _l$url : l.url = Demo.URL), this._directServiceRequiresFiles = !!t && Object.keys(t).length > 0, this.requestSettings.websocket && Websocket.setup(this);
3312
3442
  }
3313
3443
  _createClass(BaseServiceIO, [{
3314
3444
  key: "verifyKey",
@@ -3327,11 +3457,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
3327
3457
  }, {
3328
3458
  key: "callServiceAPI",
3329
3459
  value: function () {
3330
- var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
3460
+ var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e, t, n) {
3331
3461
  var _c$headers, _u$ContentType;
3332
3462
  var l, c, u, d, s, o, a;
3333
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
3334
- while (1) switch (_context13.prev = _context13.next) {
3463
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3464
+ while (1) switch (_context16.prev = _context16.next) {
3335
3465
  case 0:
3336
3466
  s = _objectSpread({
3337
3467
  messages: t
@@ -3340,26 +3470,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
3340
3470
  (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);
3341
3471
  a = this.deepChat.stream;
3342
3472
  if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
3343
- _context13.next = 9;
3473
+ _context16.next = 9;
3344
3474
  break;
3345
3475
  }
3346
- _context13.next = 7;
3476
+ _context16.next = 7;
3347
3477
  return Stream.request(this, s, e);
3348
3478
  case 7:
3349
- _context13.next = 11;
3479
+ _context16.next = 11;
3350
3480
  break;
3351
3481
  case 9:
3352
- _context13.next = 11;
3482
+ _context16.next = 11;
3353
3483
  return HTTPRequest.request(this, s, e);
3354
3484
  case 11:
3355
3485
  o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
3356
3486
  case 12:
3357
3487
  case "end":
3358
- return _context13.stop();
3488
+ return _context16.stop();
3359
3489
  }
3360
- }, _callee13, this);
3490
+ }, _callee16, this);
3361
3491
  }));
3362
- function callServiceAPI(_x24, _x25, _x26) {
3492
+ function callServiceAPI(_x32, _x33, _x34) {
3363
3493
  return _callServiceAPI.apply(this, arguments);
3364
3494
  }
3365
3495
  return callServiceAPI;
@@ -3367,24 +3497,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
3367
3497
  }, {
3368
3498
  key: "callApiWithFiles",
3369
3499
  value: function () {
3370
- var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
3500
+ var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n, s) {
3371
3501
  var o, a, l;
3372
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
3373
- while (1) switch (_context14.prev = _context14.next) {
3502
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3503
+ while (1) switch (_context17.prev = _context17.next) {
3374
3504
  case 0:
3375
3505
  o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
3376
3506
  this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
3377
- _context14.next = 4;
3507
+ _context17.next = 4;
3378
3508
  return HTTPRequest.request(this, o, t, !1);
3379
3509
  case 4:
3380
3510
  this.requestSettings = a;
3381
3511
  case 5:
3382
3512
  case "end":
3383
- return _context14.stop();
3513
+ return _context17.stop();
3384
3514
  }
3385
- }, _callee14, this);
3515
+ }, _callee17, this);
3386
3516
  }));
3387
- function callApiWithFiles(_x27, _x28, _x29, _x30) {
3517
+ function callApiWithFiles(_x35, _x36, _x37, _x38) {
3388
3518
  return _callApiWithFiles.apply(this, arguments);
3389
3519
  }
3390
3520
  return callApiWithFiles;
@@ -3392,56 +3522,57 @@ var BaseServiceIO = /*#__PURE__*/function () {
3392
3522
  }, {
3393
3523
  key: "callAPI",
3394
3524
  value: function () {
3395
- var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t) {
3396
- var n, s;
3397
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
3398
- while (1) switch (_context15.prev = _context15.next) {
3525
+ var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t) {
3526
+ var n, _s3;
3527
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3528
+ while (1) switch (_context18.prev = _context18.next) {
3399
3529
  case 0:
3400
3530
  if (this.requestSettings) {
3401
- _context15.next = 2;
3531
+ _context18.next = 2;
3402
3532
  break;
3403
3533
  }
3404
3534
  throw new Error("Request settings have not been set up");
3405
3535
  case 2:
3406
3536
  n = MessageLimitUtils.processMessages(e, t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
3407
3537
  if (this.websocket) {
3408
- s = _objectSpread({
3538
+ _s3 = _objectSpread({
3409
3539
  messages: n
3410
3540
  }, this.rawBody);
3411
- Websocket.sendWebsocket(this.websocket, this, s, t, !1);
3541
+ Websocket.sendWebsocket(this.websocket, this, _s3, t, !1);
3412
3542
  } else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
3413
3543
  case 4:
3414
3544
  case "end":
3415
- return _context15.stop();
3545
+ return _context18.stop();
3416
3546
  }
3417
- }, _callee15, this);
3547
+ }, _callee18, this);
3418
3548
  }));
3419
- function callAPI(_x31, _x32) {
3549
+ function callAPI(_x39, _x40) {
3420
3550
  return _callAPI.apply(this, arguments);
3421
3551
  }
3422
3552
  return callAPI;
3423
- }()
3553
+ }() // WORK - validation to say that the response should have text, files or error property, link to example
3554
+ // and responseInterceptor
3424
3555
  }, {
3425
3556
  key: "extractResultData",
3426
3557
  value: function () {
3427
- var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e) {
3428
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
3429
- while (1) switch (_context16.prev = _context16.next) {
3558
+ var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
3559
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3560
+ while (1) switch (_context19.prev = _context19.next) {
3430
3561
  case 0:
3431
3562
  if (!e.error) {
3432
- _context16.next = 2;
3563
+ _context19.next = 2;
3433
3564
  break;
3434
3565
  }
3435
3566
  throw e.error;
3436
3567
  case 2:
3437
- return _context16.abrupt("return", e.result);
3568
+ return _context19.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);
3438
3569
  case 3:
3439
3570
  case "end":
3440
- return _context16.stop();
3571
+ return _context19.stop();
3441
3572
  }
3442
- }, _callee16);
3573
+ }, _callee19);
3443
3574
  }));
3444
- function extractResultData(_x33) {
3575
+ function extractResultData(_x41) {
3445
3576
  return _extractResultData.apply(this, arguments);
3446
3577
  }
3447
3578
  return extractResultData;
@@ -3658,8 +3789,8 @@ var InsertKeyView = /*#__PURE__*/function () {
3658
3789
  n.id = "insert-key-help-text-contents";
3659
3790
  var s = InsertKeyView.createFailText();
3660
3791
  if (n.appendChild(s), e) {
3661
- var a = InsertKeyView.createHelpLink(e);
3662
- n.appendChild(a);
3792
+ var _a2 = InsertKeyView.createHelpLink(e);
3793
+ n.appendChild(_a2);
3663
3794
  }
3664
3795
  var o = InsertKeyView.createCautionText();
3665
3796
  return n.appendChild(o), t.appendChild(n), {
@@ -3782,17 +3913,17 @@ var HuggingFaceUtils = /*#__PURE__*/function () {
3782
3913
  return HuggingFaceUtils;
3783
3914
  }();
3784
3915
  var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3785
- _inherits(U, _DirectServiceIO);
3786
- var _super3 = _createSuper(U);
3916
+ _inherits(j, _DirectServiceIO);
3917
+ var _super3 = _createSuper(j);
3787
3918
  // prettier-ignore
3788
- function U(e, t, n, s, o, a) {
3919
+ function j(e, t, n, s, o, a) {
3789
3920
  var _this4;
3790
- _classCallCheck(this, U);
3791
- _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));
3921
+ _classCallCheck(this, j);
3922
+ _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));
3792
3923
  return _this4;
3793
3924
  }
3794
3925
  // prettier-ignore
3795
- _createClass(U, [{
3926
+ _createClass(j, [{
3796
3927
  key: "preprocessBody",
3797
3928
  value: function preprocessBody(e, t, n) {
3798
3929
  var _s$options;
@@ -3805,13 +3936,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3805
3936
  }, {
3806
3937
  key: "callServiceAPI",
3807
3938
  value: function () {
3808
- var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
3939
+ var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e, t, n) {
3809
3940
  var s;
3810
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
3811
- while (1) switch (_context17.prev = _context17.next) {
3941
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3942
+ while (1) switch (_context20.prev = _context20.next) {
3812
3943
  case 0:
3813
3944
  if (this.requestSettings) {
3814
- _context17.next = 2;
3945
+ _context20.next = 2;
3815
3946
  break;
3816
3947
  }
3817
3948
  throw new Error("Request settings have not been set up");
@@ -3820,17 +3951,17 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
3820
3951
  HTTPRequest.request(this, s, e);
3821
3952
  case 4:
3822
3953
  case "end":
3823
- return _context17.stop();
3954
+ return _context20.stop();
3824
3955
  }
3825
- }, _callee17, this);
3956
+ }, _callee20, this);
3826
3957
  }));
3827
- function callServiceAPI(_x34, _x35, _x36) {
3958
+ function callServiceAPI(_x42, _x43, _x44) {
3828
3959
  return _callServiceAPI2.apply(this, arguments);
3829
3960
  }
3830
3961
  return callServiceAPI;
3831
3962
  }()
3832
3963
  }]);
3833
- return U;
3964
+ return j;
3834
3965
  }(DirectServiceIO);
3835
3966
  _HuggingFaceIO.URL_PREFIX = "https://api-inference.huggingface.co/models/";
3836
3967
  var HuggingFaceIO = _HuggingFaceIO;
@@ -3853,18 +3984,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3853
3984
  }, {
3854
3985
  key: "callServiceAPI",
3855
3986
  value: function () {
3856
- var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n) {
3857
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
3858
- while (1) switch (_context18.prev = _context18.next) {
3987
+ var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
3988
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
3989
+ while (1) switch (_context21.prev = _context21.next) {
3859
3990
  case 0:
3860
3991
  if (this.requestSettings) {
3861
- _context18.next = 2;
3992
+ _context21.next = 2;
3862
3993
  break;
3863
3994
  }
3864
3995
  throw new Error("Request settings have not been set up");
3865
3996
  case 2:
3866
3997
  if (n != null && n[0]) {
3867
- _context18.next = 4;
3998
+ _context21.next = 4;
3868
3999
  break;
3869
4000
  }
3870
4001
  throw new Error("No file was added");
@@ -3872,11 +4003,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
3872
4003
  HTTPRequest.poll(this, n[0], e, !1);
3873
4004
  case 5:
3874
4005
  case "end":
3875
- return _context18.stop();
4006
+ return _context21.stop();
3876
4007
  }
3877
- }, _callee18, this);
4008
+ }, _callee21, this);
3878
4009
  }));
3879
- function callServiceAPI(_x37, _x38, _x39) {
4010
+ function callServiceAPI(_x45, _x46, _x47) {
3880
4011
  return _callServiceAPI3.apply(this, arguments);
3881
4012
  }
3882
4013
  return callServiceAPI;
@@ -3905,35 +4036,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
3905
4036
  _createClass(HuggingFaceAudioClassificationIO, [{
3906
4037
  key: "extractPollResultData",
3907
4038
  value: function () {
3908
- var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
4039
+ var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
3909
4040
  var t;
3910
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3911
- while (1) switch (_context19.prev = _context19.next) {
4041
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4042
+ while (1) switch (_context22.prev = _context22.next) {
3912
4043
  case 0:
3913
4044
  if (!e.estimated_time) {
3914
- _context19.next = 2;
4045
+ _context22.next = 2;
3915
4046
  break;
3916
4047
  }
3917
- return _context19.abrupt("return", {
4048
+ return _context22.abrupt("return", {
3918
4049
  timeoutMS: (e.estimated_time + 1) * 1e3
3919
4050
  });
3920
4051
  case 2:
3921
4052
  if (!e.error) {
3922
- _context19.next = 4;
4053
+ _context22.next = 4;
3923
4054
  break;
3924
4055
  }
3925
4056
  throw e.error;
3926
4057
  case 4:
3927
- return _context19.abrupt("return", {
4058
+ return _context22.abrupt("return", {
3928
4059
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
3929
4060
  });
3930
4061
  case 5:
3931
4062
  case "end":
3932
- return _context19.stop();
4063
+ return _context22.stop();
3933
4064
  }
3934
- }, _callee19);
4065
+ }, _callee22);
3935
4066
  }));
3936
- function extractPollResultData(_x40) {
4067
+ function extractPollResultData(_x48) {
3937
4068
  return _extractPollResultData.apply(this, arguments);
3938
4069
  }
3939
4070
  return extractPollResultData;
@@ -3956,35 +4087,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
3956
4087
  _createClass(HuggingFaceImageClassificationIO, [{
3957
4088
  key: "extractPollResultData",
3958
4089
  value: function () {
3959
- var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
4090
+ var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e) {
3960
4091
  var t;
3961
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3962
- while (1) switch (_context20.prev = _context20.next) {
4092
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4093
+ while (1) switch (_context23.prev = _context23.next) {
3963
4094
  case 0:
3964
4095
  if (!e.estimated_time) {
3965
- _context20.next = 2;
4096
+ _context23.next = 2;
3966
4097
  break;
3967
4098
  }
3968
- return _context20.abrupt("return", {
4099
+ return _context23.abrupt("return", {
3969
4100
  timeoutMS: (e.estimated_time + 1) * 1e3
3970
4101
  });
3971
4102
  case 2:
3972
4103
  if (!e.error) {
3973
- _context20.next = 4;
4104
+ _context23.next = 4;
3974
4105
  break;
3975
4106
  }
3976
4107
  throw e.error;
3977
4108
  case 4:
3978
- return _context20.abrupt("return", {
4109
+ return _context23.abrupt("return", {
3979
4110
  text: ((t = e[0]) == null ? void 0 : t.label) || ""
3980
4111
  });
3981
4112
  case 5:
3982
4113
  case "end":
3983
- return _context20.stop();
4114
+ return _context23.stop();
3984
4115
  }
3985
- }, _callee20);
4116
+ }, _callee23);
3986
4117
  }));
3987
- function extractPollResultData(_x41) {
4118
+ function extractPollResultData(_x49) {
3988
4119
  return _extractPollResultData2.apply(this, arguments);
3989
4120
  }
3990
4121
  return extractPollResultData;
@@ -4069,19 +4200,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4069
4200
  }, {
4070
4201
  key: "callServiceAPI",
4071
4202
  value: function () {
4072
- var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
4203
+ var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e, t, n) {
4073
4204
  var s;
4074
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
4075
- while (1) switch (_context21.prev = _context21.next) {
4205
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4206
+ while (1) switch (_context24.prev = _context24.next) {
4076
4207
  case 0:
4077
4208
  if (this.requestSettings) {
4078
- _context21.next = 2;
4209
+ _context24.next = 2;
4079
4210
  break;
4080
4211
  }
4081
4212
  throw new Error("Request settings have not been set up");
4082
4213
  case 2:
4083
4214
  if (n) {
4084
- _context21.next = 4;
4215
+ _context24.next = 4;
4085
4216
  break;
4086
4217
  }
4087
4218
  throw new Error("Image was not found");
@@ -4090,11 +4221,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4090
4221
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
4091
4222
  case 6:
4092
4223
  case "end":
4093
- return _context21.stop();
4224
+ return _context24.stop();
4094
4225
  }
4095
- }, _callee21, this);
4226
+ }, _callee24, this);
4096
4227
  }));
4097
- function callServiceAPI(_x42, _x43, _x44) {
4228
+ function callServiceAPI(_x50, _x51, _x52) {
4098
4229
  return _callServiceAPI4.apply(this, arguments);
4099
4230
  }
4100
4231
  return callServiceAPI;
@@ -4102,17 +4233,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4102
4233
  }, {
4103
4234
  key: "extractResultData",
4104
4235
  value: function () {
4105
- var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
4106
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
4107
- while (1) switch (_context22.prev = _context22.next) {
4236
+ var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
4237
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4238
+ while (1) switch (_context25.prev = _context25.next) {
4108
4239
  case 0:
4109
4240
  if (!e.message) {
4110
- _context22.next = 2;
4241
+ _context25.next = 2;
4111
4242
  break;
4112
4243
  }
4113
4244
  throw e.message;
4114
4245
  case 2:
4115
- return _context22.abrupt("return", {
4246
+ return _context25.abrupt("return", {
4116
4247
  files: e.artifacts.map(function (n) {
4117
4248
  return {
4118
4249
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4122,11 +4253,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
4122
4253
  });
4123
4254
  case 3:
4124
4255
  case "end":
4125
- return _context22.stop();
4256
+ return _context25.stop();
4126
4257
  }
4127
- }, _callee22);
4258
+ }, _callee25);
4128
4259
  }));
4129
- function extractResultData(_x45) {
4260
+ function extractResultData(_x53) {
4130
4261
  return _extractResultData2.apply(this, arguments);
4131
4262
  }
4132
4263
  return extractResultData;
@@ -4178,19 +4309,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4178
4309
  }, {
4179
4310
  key: "callServiceAPI",
4180
4311
  value: function () {
4181
- var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
4312
+ var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e, t, n) {
4182
4313
  var a, l, s, o;
4183
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
4184
- while (1) switch (_context23.prev = _context23.next) {
4314
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4315
+ while (1) switch (_context26.prev = _context26.next) {
4185
4316
  case 0:
4186
4317
  if (this.requestSettings) {
4187
- _context23.next = 2;
4318
+ _context26.next = 2;
4188
4319
  break;
4189
4320
  }
4190
4321
  throw new Error("Request settings have not been set up");
4191
4322
  case 2:
4192
4323
  if (!(!n || !n[0] || !n[1])) {
4193
- _context23.next = 4;
4324
+ _context26.next = 4;
4194
4325
  break;
4195
4326
  }
4196
4327
  throw new Error("Image was not found");
@@ -4199,11 +4330,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4199
4330
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4200
4331
  case 6:
4201
4332
  case "end":
4202
- return _context23.stop();
4333
+ return _context26.stop();
4203
4334
  }
4204
- }, _callee23, this);
4335
+ }, _callee26, this);
4205
4336
  }));
4206
- function callServiceAPI(_x46, _x47, _x48) {
4337
+ function callServiceAPI(_x54, _x55, _x56) {
4207
4338
  return _callServiceAPI5.apply(this, arguments);
4208
4339
  }
4209
4340
  return callServiceAPI;
@@ -4211,17 +4342,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4211
4342
  }, {
4212
4343
  key: "extractResultData",
4213
4344
  value: function () {
4214
- var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
4215
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
4216
- while (1) switch (_context24.prev = _context24.next) {
4345
+ var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
4346
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4347
+ while (1) switch (_context27.prev = _context27.next) {
4217
4348
  case 0:
4218
4349
  if (!e.message) {
4219
- _context24.next = 2;
4350
+ _context27.next = 2;
4220
4351
  break;
4221
4352
  }
4222
4353
  throw e.message;
4223
4354
  case 2:
4224
- return _context24.abrupt("return", {
4355
+ return _context27.abrupt("return", {
4225
4356
  files: e.artifacts.map(function (n) {
4226
4357
  return {
4227
4358
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4231,11 +4362,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
4231
4362
  });
4232
4363
  case 3:
4233
4364
  case "end":
4234
- return _context24.stop();
4365
+ return _context27.stop();
4235
4366
  }
4236
- }, _callee24);
4367
+ }, _callee27);
4237
4368
  }));
4238
- function extractResultData(_x49) {
4369
+ function extractResultData(_x57) {
4239
4370
  return _extractResultData3.apply(this, arguments);
4240
4371
  }
4241
4372
  return extractResultData;
@@ -4268,34 +4399,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
4268
4399
  _createClass(HuggingFaceAudioRecognitionIO, [{
4269
4400
  key: "extractPollResultData",
4270
4401
  value: function () {
4271
- var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
4272
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
4273
- while (1) switch (_context25.prev = _context25.next) {
4402
+ var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4403
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4404
+ while (1) switch (_context28.prev = _context28.next) {
4274
4405
  case 0:
4275
4406
  if (!e.estimated_time) {
4276
- _context25.next = 2;
4407
+ _context28.next = 2;
4277
4408
  break;
4278
4409
  }
4279
- return _context25.abrupt("return", {
4410
+ return _context28.abrupt("return", {
4280
4411
  timeoutMS: (e.estimated_time + 1) * 1e3
4281
4412
  });
4282
4413
  case 2:
4283
4414
  if (!e.error) {
4284
- _context25.next = 4;
4415
+ _context28.next = 4;
4285
4416
  break;
4286
4417
  }
4287
4418
  throw e.error;
4288
4419
  case 4:
4289
- return _context25.abrupt("return", {
4420
+ return _context28.abrupt("return", {
4290
4421
  text: e.text || ""
4291
4422
  });
4292
4423
  case 5:
4293
4424
  case "end":
4294
- return _context25.stop();
4425
+ return _context28.stop();
4295
4426
  }
4296
- }, _callee25);
4427
+ }, _callee28);
4297
4428
  }));
4298
- function extractPollResultData(_x50) {
4429
+ function extractPollResultData(_x58) {
4299
4430
  return _extractPollResultData3.apply(this, arguments);
4300
4431
  }
4301
4432
  return extractPollResultData;
@@ -4316,26 +4447,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
4316
4447
  _createClass(HuggingFaceTextGenerationIO, [{
4317
4448
  key: "extractResultData",
4318
4449
  value: function () {
4319
- var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
4320
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
4321
- while (1) switch (_context26.prev = _context26.next) {
4450
+ var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4451
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4452
+ while (1) switch (_context29.prev = _context29.next) {
4322
4453
  case 0:
4323
4454
  if (!e.error) {
4324
- _context26.next = 2;
4455
+ _context29.next = 2;
4325
4456
  break;
4326
4457
  }
4327
4458
  throw e.error;
4328
4459
  case 2:
4329
- return _context26.abrupt("return", {
4460
+ return _context29.abrupt("return", {
4330
4461
  text: e[0].generated_text || ""
4331
4462
  });
4332
4463
  case 3:
4333
4464
  case "end":
4334
- return _context26.stop();
4465
+ return _context29.stop();
4335
4466
  }
4336
- }, _callee26);
4467
+ }, _callee29);
4337
4468
  }));
4338
- function extractResultData(_x51) {
4469
+ function extractResultData(_x59) {
4339
4470
  return _extractResultData4.apply(this, arguments);
4340
4471
  }
4341
4472
  return extractResultData;
@@ -4372,26 +4503,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
4372
4503
  }, {
4373
4504
  key: "extractResultData",
4374
4505
  value: function () {
4375
- var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
4376
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
4377
- while (1) switch (_context27.prev = _context27.next) {
4506
+ var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e) {
4507
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4508
+ while (1) switch (_context30.prev = _context30.next) {
4378
4509
  case 0:
4379
4510
  if (!e.error) {
4380
- _context27.next = 2;
4511
+ _context30.next = 2;
4381
4512
  break;
4382
4513
  }
4383
4514
  throw e.error;
4384
4515
  case 2:
4385
- return _context27.abrupt("return", {
4516
+ return _context30.abrupt("return", {
4386
4517
  text: e.answer || ""
4387
4518
  });
4388
4519
  case 3:
4389
4520
  case "end":
4390
- return _context27.stop();
4521
+ return _context30.stop();
4391
4522
  }
4392
- }, _callee27);
4523
+ }, _callee30);
4393
4524
  }));
4394
- function extractResultData(_x52) {
4525
+ function extractResultData(_x60) {
4395
4526
  return _extractResultData5.apply(this, arguments);
4396
4527
  }
4397
4528
  return extractResultData;
@@ -4412,26 +4543,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
4412
4543
  _createClass(HuggingFaceSummarizationIO, [{
4413
4544
  key: "extractResultData",
4414
4545
  value: function () {
4415
- var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
4416
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
4417
- while (1) switch (_context28.prev = _context28.next) {
4546
+ var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4547
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4548
+ while (1) switch (_context31.prev = _context31.next) {
4418
4549
  case 0:
4419
4550
  if (!e.error) {
4420
- _context28.next = 2;
4551
+ _context31.next = 2;
4421
4552
  break;
4422
4553
  }
4423
4554
  throw e.error;
4424
4555
  case 2:
4425
- return _context28.abrupt("return", {
4556
+ return _context31.abrupt("return", {
4426
4557
  text: e[0].summary_text || ""
4427
4558
  });
4428
4559
  case 3:
4429
4560
  case "end":
4430
- return _context28.stop();
4561
+ return _context31.stop();
4431
4562
  }
4432
- }, _callee28);
4563
+ }, _callee31);
4433
4564
  }));
4434
- function extractResultData(_x53) {
4565
+ function extractResultData(_x61) {
4435
4566
  return _extractResultData6.apply(this, arguments);
4436
4567
  }
4437
4568
  return extractResultData;
@@ -4492,26 +4623,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
4492
4623
  }, {
4493
4624
  key: "extractResultData",
4494
4625
  value: function () {
4495
- var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
4496
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
4497
- while (1) switch (_context29.prev = _context29.next) {
4626
+ var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4627
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4628
+ while (1) switch (_context32.prev = _context32.next) {
4498
4629
  case 0:
4499
4630
  if (!e.error) {
4500
- _context29.next = 2;
4631
+ _context32.next = 2;
4501
4632
  break;
4502
4633
  }
4503
4634
  throw e.error;
4504
4635
  case 2:
4505
- return _context29.abrupt("return", {
4636
+ return _context32.abrupt("return", {
4506
4637
  text: e.generated_text || ""
4507
4638
  });
4508
4639
  case 3:
4509
4640
  case "end":
4510
- return _context29.stop();
4641
+ return _context32.stop();
4511
4642
  }
4512
- }, _callee29);
4643
+ }, _callee32);
4513
4644
  }));
4514
- function extractResultData(_x54) {
4645
+ function extractResultData(_x62) {
4515
4646
  return _extractResultData7.apply(this, arguments);
4516
4647
  }
4517
4648
  return extractResultData;
@@ -4553,19 +4684,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4553
4684
  }, {
4554
4685
  key: "callServiceAPI",
4555
4686
  value: function () {
4556
- var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e, t, n) {
4687
+ var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t, n) {
4557
4688
  var a, l, s, o;
4558
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
4559
- while (1) switch (_context30.prev = _context30.next) {
4689
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4690
+ while (1) switch (_context33.prev = _context33.next) {
4560
4691
  case 0:
4561
4692
  if (this.requestSettings) {
4562
- _context30.next = 2;
4693
+ _context33.next = 2;
4563
4694
  break;
4564
4695
  }
4565
4696
  throw new Error("Request settings have not been set up");
4566
4697
  case 2:
4567
4698
  if (n) {
4568
- _context30.next = 4;
4699
+ _context33.next = 4;
4569
4700
  break;
4570
4701
  }
4571
4702
  throw new Error("Image was not found");
@@ -4574,11 +4705,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4574
4705
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
4575
4706
  case 6:
4576
4707
  case "end":
4577
- return _context30.stop();
4708
+ return _context33.stop();
4578
4709
  }
4579
- }, _callee30, this);
4710
+ }, _callee33, this);
4580
4711
  }));
4581
- function callServiceAPI(_x55, _x56, _x57) {
4712
+ function callServiceAPI(_x63, _x64, _x65) {
4582
4713
  return _callServiceAPI6.apply(this, arguments);
4583
4714
  }
4584
4715
  return callServiceAPI;
@@ -4586,17 +4717,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4586
4717
  }, {
4587
4718
  key: "extractResultData",
4588
4719
  value: function () {
4589
- var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
4590
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
4591
- while (1) switch (_context31.prev = _context31.next) {
4720
+ var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
4721
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4722
+ while (1) switch (_context34.prev = _context34.next) {
4592
4723
  case 0:
4593
4724
  if (!e.message) {
4594
- _context31.next = 2;
4725
+ _context34.next = 2;
4595
4726
  break;
4596
4727
  }
4597
4728
  throw e.message;
4598
4729
  case 2:
4599
- return _context31.abrupt("return", {
4730
+ return _context34.abrupt("return", {
4600
4731
  files: e.artifacts.map(function (n) {
4601
4732
  return {
4602
4733
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4606,11 +4737,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
4606
4737
  });
4607
4738
  case 3:
4608
4739
  case "end":
4609
- return _context31.stop();
4740
+ return _context34.stop();
4610
4741
  }
4611
- }, _callee31);
4742
+ }, _callee34);
4612
4743
  }));
4613
- function extractResultData(_x58) {
4744
+ function extractResultData(_x66) {
4614
4745
  return _extractResultData8.apply(this, arguments);
4615
4746
  }
4616
4747
  return extractResultData;
@@ -4641,26 +4772,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
4641
4772
  _createClass(HuggingFaceTranslationIO, [{
4642
4773
  key: "extractResultData",
4643
4774
  value: function () {
4644
- var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
4645
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
4646
- while (1) switch (_context32.prev = _context32.next) {
4775
+ var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4776
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4777
+ while (1) switch (_context35.prev = _context35.next) {
4647
4778
  case 0:
4648
4779
  if (!e.error) {
4649
- _context32.next = 2;
4780
+ _context35.next = 2;
4650
4781
  break;
4651
4782
  }
4652
4783
  throw e.error;
4653
4784
  case 2:
4654
- return _context32.abrupt("return", {
4785
+ return _context35.abrupt("return", {
4655
4786
  text: e[0].translation_text || ""
4656
4787
  });
4657
4788
  case 3:
4658
4789
  case "end":
4659
- return _context32.stop();
4790
+ return _context35.stop();
4660
4791
  }
4661
- }, _callee32);
4792
+ }, _callee35);
4662
4793
  }));
4663
- function extractResultData(_x59) {
4794
+ function extractResultData(_x67) {
4664
4795
  return _extractResultData9.apply(this, arguments);
4665
4796
  }
4666
4797
  return extractResultData;
@@ -4694,13 +4825,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4694
4825
  }, {
4695
4826
  key: "callServiceAPI",
4696
4827
  value: function () {
4697
- var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t) {
4828
+ var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
4698
4829
  var n;
4699
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
4700
- while (1) switch (_context33.prev = _context33.next) {
4830
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4831
+ while (1) switch (_context36.prev = _context36.next) {
4701
4832
  case 0:
4702
4833
  if (this.requestSettings) {
4703
- _context33.next = 2;
4834
+ _context36.next = 2;
4704
4835
  break;
4705
4836
  }
4706
4837
  throw new Error("Request settings have not been set up");
@@ -4709,11 +4840,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4709
4840
  HTTPRequest.request(this, n, e);
4710
4841
  case 4:
4711
4842
  case "end":
4712
- return _context33.stop();
4843
+ return _context36.stop();
4713
4844
  }
4714
- }, _callee33, this);
4845
+ }, _callee36, this);
4715
4846
  }));
4716
- function callServiceAPI(_x60, _x61) {
4847
+ function callServiceAPI(_x68, _x69) {
4717
4848
  return _callServiceAPI7.apply(this, arguments);
4718
4849
  }
4719
4850
  return callServiceAPI;
@@ -4721,17 +4852,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4721
4852
  }, {
4722
4853
  key: "extractResultData",
4723
4854
  value: function () {
4724
- var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
4725
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
4726
- while (1) switch (_context34.prev = _context34.next) {
4855
+ var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
4856
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4857
+ while (1) switch (_context37.prev = _context37.next) {
4727
4858
  case 0:
4728
4859
  if (!e.message) {
4729
- _context34.next = 2;
4860
+ _context37.next = 2;
4730
4861
  break;
4731
4862
  }
4732
4863
  throw e.message;
4733
4864
  case 2:
4734
- return _context34.abrupt("return", {
4865
+ return _context37.abrupt("return", {
4735
4866
  files: e.artifacts.map(function (n) {
4736
4867
  return {
4737
4868
  src: "".concat(BASE_64_PREFIX).concat(n.base64),
@@ -4741,11 +4872,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
4741
4872
  });
4742
4873
  case 3:
4743
4874
  case "end":
4744
- return _context34.stop();
4875
+ return _context37.stop();
4745
4876
  }
4746
- }, _callee34);
4877
+ }, _callee37);
4747
4878
  }));
4748
- function extractResultData(_x62) {
4879
+ function extractResultData(_x70) {
4749
4880
  return _extractResultData10.apply(this, arguments);
4750
4881
  }
4751
4882
  return extractResultData;
@@ -4778,26 +4909,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
4778
4909
  _createClass(HuggingFaceFillMaskIO, [{
4779
4910
  key: "extractResultData",
4780
4911
  value: function () {
4781
- var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
4782
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
4783
- while (1) switch (_context35.prev = _context35.next) {
4912
+ var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e) {
4913
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4914
+ while (1) switch (_context38.prev = _context38.next) {
4784
4915
  case 0:
4785
4916
  if (!e.error) {
4786
- _context35.next = 2;
4917
+ _context38.next = 2;
4787
4918
  break;
4788
4919
  }
4789
4920
  throw e.error;
4790
4921
  case 2:
4791
- return _context35.abrupt("return", {
4922
+ return _context38.abrupt("return", {
4792
4923
  text: e[0].sequence || ""
4793
4924
  });
4794
4925
  case 3:
4795
4926
  case "end":
4796
- return _context35.stop();
4927
+ return _context38.stop();
4797
4928
  }
4798
- }, _callee35);
4929
+ }, _callee38);
4799
4930
  }));
4800
- function extractResultData(_x63) {
4931
+ function extractResultData(_x71) {
4801
4932
  return _extractResultData11.apply(this, arguments);
4802
4933
  }
4803
4934
  return extractResultData;
@@ -4872,13 +5003,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4872
5003
  }, {
4873
5004
  key: "callServiceAPI",
4874
5005
  value: function () {
4875
- var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
5006
+ var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e, t) {
4876
5007
  var n;
4877
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
4878
- while (1) switch (_context36.prev = _context36.next) {
5008
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
5009
+ while (1) switch (_context39.prev = _context39.next) {
4879
5010
  case 0:
4880
5011
  if (this.requestSettings) {
4881
- _context36.next = 2;
5012
+ _context39.next = 2;
4882
5013
  break;
4883
5014
  }
4884
5015
  throw new Error("Request settings have not been set up");
@@ -4887,11 +5018,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4887
5018
  HTTPRequest.request(this, n, e);
4888
5019
  case 4:
4889
5020
  case "end":
4890
- return _context36.stop();
5021
+ return _context39.stop();
4891
5022
  }
4892
- }, _callee36, this);
5023
+ }, _callee39, this);
4893
5024
  }));
4894
- function callServiceAPI(_x64, _x65) {
5025
+ function callServiceAPI(_x72, _x73) {
4895
5026
  return _callServiceAPI8.apply(this, arguments);
4896
5027
  }
4897
5028
  return callServiceAPI;
@@ -4899,27 +5030,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
4899
5030
  }, {
4900
5031
  key: "extractResultData",
4901
5032
  value: function () {
4902
- var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
5033
+ var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e) {
4903
5034
  var t;
4904
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
4905
- while (1) switch (_context37.prev = _context37.next) {
5035
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5036
+ while (1) switch (_context40.prev = _context40.next) {
4906
5037
  case 0:
4907
5038
  if (!e.message) {
4908
- _context37.next = 2;
5039
+ _context40.next = 2;
4909
5040
  break;
4910
5041
  }
4911
5042
  throw e.message;
4912
5043
  case 2:
4913
- return _context37.abrupt("return", {
5044
+ return _context40.abrupt("return", {
4914
5045
  text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
4915
5046
  });
4916
5047
  case 3:
4917
5048
  case "end":
4918
- return _context37.stop();
5049
+ return _context40.stop();
4919
5050
  }
4920
- }, _callee37);
5051
+ }, _callee40);
4921
5052
  }));
4922
- function extractResultData(_x66) {
5053
+ function extractResultData(_x74) {
4923
5054
  return _extractResultData12.apply(this, arguments);
4924
5055
  }
4925
5056
  return extractResultData;
@@ -4949,13 +5080,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
4949
5080
  }, {
4950
5081
  key: "callServiceAPI",
4951
5082
  value: function () {
4952
- var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
5083
+ var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e, t) {
4953
5084
  var n;
4954
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
4955
- while (1) switch (_context38.prev = _context38.next) {
5085
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5086
+ while (1) switch (_context41.prev = _context41.next) {
4956
5087
  case 0:
4957
5088
  if (this.requestSettings) {
4958
- _context38.next = 2;
5089
+ _context41.next = 2;
4959
5090
  break;
4960
5091
  }
4961
5092
  throw new Error("Request settings have not been set up");
@@ -4964,11 +5095,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
4964
5095
  HTTPRequest.request(this, n, e);
4965
5096
  case 4:
4966
5097
  case "end":
4967
- return _context38.stop();
5098
+ return _context41.stop();
4968
5099
  }
4969
- }, _callee38, this);
5100
+ }, _callee41, this);
4970
5101
  }));
4971
- function callServiceAPI(_x67, _x68) {
5102
+ function callServiceAPI(_x75, _x76) {
4972
5103
  return _callServiceAPI9.apply(this, arguments);
4973
5104
  }
4974
5105
  return callServiceAPI;
@@ -4976,26 +5107,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
4976
5107
  }, {
4977
5108
  key: "extractResultData",
4978
5109
  value: function () {
4979
- var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
4980
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
4981
- while (1) switch (_context39.prev = _context39.next) {
5110
+ var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
5111
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5112
+ while (1) switch (_context42.prev = _context42.next) {
4982
5113
  case 0:
4983
5114
  if (!e.message) {
4984
- _context39.next = 2;
5115
+ _context42.next = 2;
4985
5116
  break;
4986
5117
  }
4987
5118
  throw e.message;
4988
5119
  case 2:
4989
- return _context39.abrupt("return", {
5120
+ return _context42.abrupt("return", {
4990
5121
  text: e.summary || ""
4991
5122
  });
4992
5123
  case 3:
4993
5124
  case "end":
4994
- return _context39.stop();
5125
+ return _context42.stop();
4995
5126
  }
4996
- }, _callee39);
5127
+ }, _callee42);
4997
5128
  }));
4998
- function extractResultData(_x69) {
5129
+ function extractResultData(_x77) {
4999
5130
  return _extractResultData13.apply(this, arguments);
5000
5131
  }
5001
5132
  return extractResultData;
@@ -5152,13 +5283,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5152
5283
  }, {
5153
5284
  key: "callServiceAPI",
5154
5285
  value: function () {
5155
- var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
5286
+ var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
5156
5287
  var n;
5157
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
5158
- while (1) switch (_context40.prev = _context40.next) {
5288
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5289
+ while (1) switch (_context43.prev = _context43.next) {
5159
5290
  case 0:
5160
5291
  if (this.requestSettings) {
5161
- _context40.next = 2;
5292
+ _context43.next = 2;
5162
5293
  break;
5163
5294
  }
5164
5295
  throw new Error("Request settings have not been set up");
@@ -5167,11 +5298,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5167
5298
  HTTPRequest.request(this, n, e), this.messages = e;
5168
5299
  case 4:
5169
5300
  case "end":
5170
- return _context40.stop();
5301
+ return _context43.stop();
5171
5302
  }
5172
- }, _callee40, this);
5303
+ }, _callee43, this);
5173
5304
  }));
5174
- function callServiceAPI(_x70, _x71) {
5305
+ function callServiceAPI(_x78, _x79) {
5175
5306
  return _callServiceAPI10.apply(this, arguments);
5176
5307
  }
5177
5308
  return callServiceAPI;
@@ -5179,34 +5310,34 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5179
5310
  }, {
5180
5311
  key: "extractResultData",
5181
5312
  value: function () {
5182
- var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
5183
- var t, n, s;
5184
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
5185
- while (1) switch (_context41.prev = _context41.next) {
5313
+ var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
5314
+ var t, n, _s4;
5315
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5316
+ while (1) switch (_context44.prev = _context44.next) {
5186
5317
  case 0:
5187
5318
  if (!e.error) {
5188
- _context41.next = 2;
5319
+ _context44.next = 2;
5189
5320
  break;
5190
5321
  }
5191
5322
  throw e.error.message;
5192
5323
  case 2:
5193
5324
  if (this.messages && this.completionsHandlers) {
5194
- n = e.headers.get("operation-location"), s = {
5325
+ n = e.headers.get("operation-location"), _s4 = {
5195
5326
  method: "GET",
5196
5327
  headers: (t = this.requestSettings) == null ? void 0 : t.headers
5197
5328
  };
5198
- HTTPRequest.executePollRequest(this, n, s, this.messages);
5329
+ HTTPRequest.executePollRequest(this, n, _s4, this.messages);
5199
5330
  }
5200
- return _context41.abrupt("return", {
5331
+ return _context44.abrupt("return", {
5201
5332
  pollingInAnotherRequest: !0
5202
5333
  });
5203
5334
  case 4:
5204
5335
  case "end":
5205
- return _context41.stop();
5336
+ return _context44.stop();
5206
5337
  }
5207
- }, _callee41, this);
5338
+ }, _callee44, this);
5208
5339
  }));
5209
- function extractResultData(_x72) {
5340
+ function extractResultData(_x80) {
5210
5341
  return _extractResultData14.apply(this, arguments);
5211
5342
  }
5212
5343
  return extractResultData;
@@ -5214,33 +5345,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5214
5345
  }, {
5215
5346
  key: "extractPollResultData",
5216
5347
  value: function () {
5217
- var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
5348
+ var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e) {
5218
5349
  var t, _iterator, _step, n;
5219
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
5220
- while (1) switch (_context42.prev = _context42.next) {
5350
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5351
+ while (1) switch (_context45.prev = _context45.next) {
5221
5352
  case 0:
5222
5353
  if (!e.error) {
5223
- _context42.next = 2;
5354
+ _context45.next = 2;
5224
5355
  break;
5225
5356
  }
5226
5357
  throw e.error;
5227
5358
  case 2:
5228
5359
  if (!(e.status === "running")) {
5229
- _context42.next = 4;
5360
+ _context45.next = 4;
5230
5361
  break;
5231
5362
  }
5232
- return _context42.abrupt("return", {
5363
+ return _context45.abrupt("return", {
5233
5364
  timeoutMS: 2e3
5234
5365
  });
5235
5366
  case 4:
5236
5367
  if (!(e.errors.length > 0)) {
5237
- _context42.next = 6;
5368
+ _context45.next = 6;
5238
5369
  break;
5239
5370
  }
5240
5371
  throw e.errors[0];
5241
5372
  case 6:
5242
5373
  if (!(e.tasks.items[0].results.errors.length > 0)) {
5243
- _context42.next = 8;
5374
+ _context45.next = 8;
5244
5375
  break;
5245
5376
  }
5246
5377
  throw e.tasks.items[0].results.errors[0];
@@ -5257,16 +5388,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
5257
5388
  } finally {
5258
5389
  _iterator.f();
5259
5390
  }
5260
- return _context42.abrupt("return", {
5391
+ return _context45.abrupt("return", {
5261
5392
  text: t || ""
5262
5393
  });
5263
5394
  case 12:
5264
5395
  case "end":
5265
- return _context42.stop();
5396
+ return _context45.stop();
5266
5397
  }
5267
- }, _callee42);
5398
+ }, _callee45);
5268
5399
  }));
5269
- function extractPollResultData(_x73) {
5400
+ function extractPollResultData(_x81) {
5270
5401
  return _extractPollResultData4.apply(this, arguments);
5271
5402
  }
5272
5403
  return extractPollResultData;
@@ -5365,13 +5496,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5365
5496
  }, {
5366
5497
  key: "callServiceAPI",
5367
5498
  value: function () {
5368
- var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
5499
+ var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t) {
5369
5500
  var n;
5370
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
5371
- while (1) switch (_context43.prev = _context43.next) {
5501
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5502
+ while (1) switch (_context46.prev = _context46.next) {
5372
5503
  case 0:
5373
5504
  if (this.requestSettings) {
5374
- _context43.next = 2;
5505
+ _context46.next = 2;
5375
5506
  break;
5376
5507
  }
5377
5508
  throw new Error("Request settings have not been set up");
@@ -5380,11 +5511,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5380
5511
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
5381
5512
  case 4:
5382
5513
  case "end":
5383
- return _context43.stop();
5514
+ return _context46.stop();
5384
5515
  }
5385
- }, _callee43, this);
5516
+ }, _callee46, this);
5386
5517
  }));
5387
- function callServiceAPI(_x74, _x75) {
5518
+ function callServiceAPI(_x82, _x83) {
5388
5519
  return _callServiceAPI11.apply(this, arguments);
5389
5520
  }
5390
5521
  return callServiceAPI;
@@ -5392,27 +5523,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
5392
5523
  }, {
5393
5524
  key: "extractResultData",
5394
5525
  value: function () {
5395
- var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
5526
+ var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
5396
5527
  var t;
5397
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
5398
- while (1) switch (_context44.prev = _context44.next) {
5528
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5529
+ while (1) switch (_context47.prev = _context47.next) {
5399
5530
  case 0:
5400
5531
  if (!e.error) {
5401
- _context44.next = 2;
5532
+ _context47.next = 2;
5402
5533
  break;
5403
5534
  }
5404
5535
  throw e.error.message;
5405
5536
  case 2:
5406
- return _context44.abrupt("return", {
5537
+ return _context47.abrupt("return", {
5407
5538
  text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
5408
5539
  });
5409
5540
  case 3:
5410
5541
  case "end":
5411
- return _context44.stop();
5542
+ return _context47.stop();
5412
5543
  }
5413
- }, _callee44);
5544
+ }, _callee47);
5414
5545
  }));
5415
- function extractResultData(_x76) {
5546
+ function extractResultData(_x84) {
5416
5547
  return _extractResultData15.apply(this, arguments);
5417
5548
  }
5418
5549
  return extractResultData;
@@ -5427,17 +5558,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5427
5558
  _createClass(AssemblyAIUtils, null, [{
5428
5559
  key: "poll",
5429
5560
  value: function () {
5430
- var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
5561
+ var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
5431
5562
  var n, l, c, d;
5432
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
5433
- while (1) switch (_context45.prev = _context45.next) {
5563
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5564
+ while (1) switch (_context48.prev = _context48.next) {
5434
5565
  case 0:
5435
5566
  n = {
5436
5567
  authorization: e,
5437
5568
  "content-type": "application/json"
5438
5569
  };
5439
- _context45.t0 = "https://api.assemblyai.com/v2/transcript/";
5440
- _context45.next = 4;
5570
+ _context48.t0 = "https://api.assemblyai.com/v2/transcript/";
5571
+ _context48.next = 4;
5441
5572
  return fetch("https://api.assemblyai.com/v2/transcript", {
5442
5573
  method: "POST",
5443
5574
  body: JSON.stringify({
@@ -5446,55 +5577,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
5446
5577
  headers: n
5447
5578
  });
5448
5579
  case 4:
5449
- _context45.next = 6;
5450
- return _context45.sent.json();
5580
+ _context48.next = 6;
5581
+ return _context48.sent.json();
5451
5582
  case 6:
5452
- _context45.t1 = _context45.sent.id;
5453
- l = _context45.t0.concat.call(_context45.t0, _context45.t1);
5583
+ _context48.t1 = _context48.sent.id;
5584
+ l = _context48.t0.concat.call(_context48.t0, _context48.t1);
5454
5585
  case 8:
5455
5586
  if (c) {
5456
- _context45.next = 24;
5587
+ _context48.next = 24;
5457
5588
  break;
5458
5589
  }
5459
- _context45.next = 11;
5590
+ _context48.next = 11;
5460
5591
  return fetch(l, {
5461
5592
  headers: n
5462
5593
  });
5463
5594
  case 11:
5464
- _context45.next = 13;
5465
- return _context45.sent.json();
5595
+ _context48.next = 13;
5596
+ return _context48.sent.json();
5466
5597
  case 13:
5467
- d = _context45.sent;
5598
+ d = _context48.sent;
5468
5599
  if (!(d.status === "completed")) {
5469
- _context45.next = 18;
5600
+ _context48.next = 18;
5470
5601
  break;
5471
5602
  }
5472
5603
  c = d;
5473
- _context45.next = 22;
5604
+ _context48.next = 22;
5474
5605
  break;
5475
5606
  case 18:
5476
5607
  if (!(d.status === "error")) {
5477
- _context45.next = 20;
5608
+ _context48.next = 20;
5478
5609
  break;
5479
5610
  }
5480
5611
  throw new Error("Transcription failed: ".concat(d.error));
5481
5612
  case 20:
5482
- _context45.next = 22;
5613
+ _context48.next = 22;
5483
5614
  return new Promise(function (h) {
5484
5615
  return setTimeout(h, 3e3);
5485
5616
  });
5486
5617
  case 22:
5487
- _context45.next = 8;
5618
+ _context48.next = 8;
5488
5619
  break;
5489
5620
  case 24:
5490
- return _context45.abrupt("return", c);
5621
+ return _context48.abrupt("return", c);
5491
5622
  case 25:
5492
5623
  case "end":
5493
- return _context45.stop();
5624
+ return _context48.stop();
5494
5625
  }
5495
- }, _callee45);
5626
+ }, _callee48);
5496
5627
  }));
5497
- function poll(_x77, _x78) {
5628
+ function poll(_x85, _x86) {
5498
5629
  return _poll2.apply(this, arguments);
5499
5630
  }
5500
5631
  return poll;
@@ -5542,19 +5673,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5542
5673
  _createClass(AssemblyAIAudioIO, [{
5543
5674
  key: "callServiceAPI",
5544
5675
  value: function () {
5545
- var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t, n) {
5676
+ var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e, t, n) {
5546
5677
  var s;
5547
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
5548
- while (1) switch (_context46.prev = _context46.next) {
5678
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5679
+ while (1) switch (_context49.prev = _context49.next) {
5549
5680
  case 0:
5550
5681
  if ((s = this.requestSettings) != null && s.headers) {
5551
- _context46.next = 2;
5682
+ _context49.next = 2;
5552
5683
  break;
5553
5684
  }
5554
5685
  throw new Error("Request settings have not been set up");
5555
5686
  case 2:
5556
5687
  if (n != null && n[0]) {
5557
- _context46.next = 4;
5688
+ _context49.next = 4;
5558
5689
  break;
5559
5690
  }
5560
5691
  throw new Error("No file was added");
@@ -5562,11 +5693,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5562
5693
  HTTPRequest.request(this, n[0], e, !1);
5563
5694
  case 5:
5564
5695
  case "end":
5565
- return _context46.stop();
5696
+ return _context49.stop();
5566
5697
  }
5567
- }, _callee46, this);
5698
+ }, _callee49, this);
5568
5699
  }));
5569
- function callServiceAPI(_x79, _x80, _x81) {
5700
+ function callServiceAPI(_x87, _x88, _x89) {
5570
5701
  return _callServiceAPI12.apply(this, arguments);
5571
5702
  }
5572
5703
  return callServiceAPI;
@@ -5574,32 +5705,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
5574
5705
  }, {
5575
5706
  key: "extractResultData",
5576
5707
  value: function () {
5577
- var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
5708
+ var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e) {
5578
5709
  var s, o, t;
5579
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
5580
- while (1) switch (_context47.prev = _context47.next) {
5710
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5711
+ while (1) switch (_context50.prev = _context50.next) {
5581
5712
  case 0:
5582
5713
  if (!e.error) {
5583
- _context47.next = 2;
5714
+ _context50.next = 2;
5584
5715
  break;
5585
5716
  }
5586
5717
  throw e.error;
5587
5718
  case 2:
5588
5719
  t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
5589
- _context47.next = 5;
5720
+ _context50.next = 5;
5590
5721
  return AssemblyAIUtils.poll(t, e.upload_url);
5591
5722
  case 5:
5592
- _context47.t0 = _context47.sent.text;
5593
- return _context47.abrupt("return", {
5594
- text: _context47.t0
5723
+ _context50.t0 = _context50.sent.text;
5724
+ return _context50.abrupt("return", {
5725
+ text: _context50.t0
5595
5726
  });
5596
5727
  case 7:
5597
5728
  case "end":
5598
- return _context47.stop();
5729
+ return _context50.stop();
5599
5730
  }
5600
- }, _callee47, this);
5731
+ }, _callee50, this);
5601
5732
  }));
5602
- function extractResultData(_x82) {
5733
+ function extractResultData(_x90) {
5603
5734
  return _extractResultData16.apply(this, arguments);
5604
5735
  }
5605
5736
  return extractResultData;
@@ -5649,13 +5780,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5649
5780
  }, {
5650
5781
  key: "callServiceAPI",
5651
5782
  value: function () {
5652
- var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
5783
+ var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e, t) {
5653
5784
  var n;
5654
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
5655
- while (1) switch (_context48.prev = _context48.next) {
5785
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5786
+ while (1) switch (_context51.prev = _context51.next) {
5656
5787
  case 0:
5657
5788
  if (this.requestSettings) {
5658
- _context48.next = 2;
5789
+ _context51.next = 2;
5659
5790
  break;
5660
5791
  }
5661
5792
  throw new Error("Request settings have not been set up");
@@ -5664,11 +5795,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5664
5795
  HTTPRequest.request(this, n, e, !1);
5665
5796
  case 4:
5666
5797
  case "end":
5667
- return _context48.stop();
5798
+ return _context51.stop();
5668
5799
  }
5669
- }, _callee48, this);
5800
+ }, _callee51, this);
5670
5801
  }));
5671
- function callServiceAPI(_x83, _x84) {
5802
+ function callServiceAPI(_x91, _x92) {
5672
5803
  return _callServiceAPI13.apply(this, arguments);
5673
5804
  }
5674
5805
  return callServiceAPI;
@@ -5676,11 +5807,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5676
5807
  }, {
5677
5808
  key: "extractResultData",
5678
5809
  value: function () {
5679
- var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e) {
5680
- return _regeneratorRuntime().wrap(function _callee49$(_context49) {
5681
- while (1) switch (_context49.prev = _context49.next) {
5810
+ var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e) {
5811
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5812
+ while (1) switch (_context52.prev = _context52.next) {
5682
5813
  case 0:
5683
- return _context49.abrupt("return", new Promise(function (t) {
5814
+ return _context52.abrupt("return", new Promise(function (t) {
5684
5815
  var n = new FileReader();
5685
5816
  n.readAsDataURL(e), n.onload = function (s) {
5686
5817
  t({
@@ -5693,11 +5824,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
5693
5824
  }));
5694
5825
  case 1:
5695
5826
  case "end":
5696
- return _context49.stop();
5827
+ return _context52.stop();
5697
5828
  }
5698
- }, _callee49);
5829
+ }, _callee52);
5699
5830
  }));
5700
- function extractResultData(_x85) {
5831
+ function extractResultData(_x93) {
5701
5832
  return _extractResultData17.apply(this, arguments);
5702
5833
  }
5703
5834
  return extractResultData;
@@ -5710,11 +5841,11 @@ _AzureTextToSpeechIO.HELP_LINK =
5710
5841
  "https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
5711
5842
  var AzureTextToSpeechIO = _AzureTextToSpeechIO;
5712
5843
  var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5713
- _inherits(j, _AzureSpeechIO2);
5714
- var _super28 = _createSuper(j);
5715
- function j(e) {
5844
+ _inherits(U, _AzureSpeechIO2);
5845
+ var _super28 = _createSuper(U);
5846
+ function U(e) {
5716
5847
  var _this21;
5717
- _classCallCheck(this, j);
5848
+ _classCallCheck(this, U);
5718
5849
  var a, l, c;
5719
5850
  var t = (l = (a = e.directConnection) == null ? void 0 : a.azure) == null ? void 0 : l.speechToText,
5720
5851
  n = (c = e.directConnection) == null ? void 0 : c.azure,
@@ -5725,27 +5856,27 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5725
5856
  }
5726
5857
  }
5727
5858
  };
5728
- _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;
5859
+ _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;
5729
5860
  var o = t.lang || "en-US";
5730
5861
  _this21.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(o, "&format=detailed"), _this21.recordAudio = void 0;
5731
5862
  return _this21;
5732
5863
  }
5733
- _createClass(j, [{
5864
+ _createClass(U, [{
5734
5865
  key: "callServiceAPI",
5735
5866
  value: function () {
5736
- var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
5867
+ var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e, t, n) {
5737
5868
  var s, o;
5738
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
5739
- while (1) switch (_context50.prev = _context50.next) {
5869
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5870
+ while (1) switch (_context53.prev = _context53.next) {
5740
5871
  case 0:
5741
5872
  if ((s = this.requestSettings) != null && s.headers) {
5742
- _context50.next = 2;
5873
+ _context53.next = 2;
5743
5874
  break;
5744
5875
  }
5745
5876
  throw new Error("Request settings have not been set up");
5746
5877
  case 2:
5747
5878
  if (n != null && n[0]) {
5748
- _context50.next = 4;
5879
+ _context53.next = 4;
5749
5880
  break;
5750
5881
  }
5751
5882
  throw new Error("No file was added");
@@ -5753,11 +5884,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5753
5884
  (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);
5754
5885
  case 5:
5755
5886
  case "end":
5756
- return _context50.stop();
5887
+ return _context53.stop();
5757
5888
  }
5758
- }, _callee50, this);
5889
+ }, _callee53, this);
5759
5890
  }));
5760
- function callServiceAPI(_x86, _x87, _x88) {
5891
+ function callServiceAPI(_x94, _x95, _x96) {
5761
5892
  return _callServiceAPI14.apply(this, arguments);
5762
5893
  }
5763
5894
  return callServiceAPI;
@@ -5765,26 +5896,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5765
5896
  }, {
5766
5897
  key: "extractResultData",
5767
5898
  value: function () {
5768
- var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
5769
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
5770
- while (1) switch (_context51.prev = _context51.next) {
5899
+ var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e) {
5900
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5901
+ while (1) switch (_context54.prev = _context54.next) {
5771
5902
  case 0:
5772
5903
  if (!e.error) {
5773
- _context51.next = 2;
5904
+ _context54.next = 2;
5774
5905
  break;
5775
5906
  }
5776
5907
  throw e.error;
5777
5908
  case 2:
5778
- return _context51.abrupt("return", {
5909
+ return _context54.abrupt("return", {
5779
5910
  text: e.DisplayText || ""
5780
5911
  });
5781
5912
  case 3:
5782
5913
  case "end":
5783
- return _context51.stop();
5914
+ return _context54.stop();
5784
5915
  }
5785
- }, _callee51);
5916
+ }, _callee54);
5786
5917
  }));
5787
- function extractResultData(_x89) {
5918
+ function extractResultData(_x97) {
5788
5919
  return _extractResultData18.apply(this, arguments);
5789
5920
  }
5790
5921
  return extractResultData;
@@ -5795,7 +5926,7 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
5795
5926
  return !!(t != null && t[0]);
5796
5927
  }
5797
5928
  }]);
5798
- return j;
5929
+ return U;
5799
5930
  }(AzureSpeechIO);
5800
5931
  _AzureSpeechToTextIO.HELP_LINK =
5801
5932
  // eslint-disable-next-line max-len
@@ -5827,13 +5958,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5827
5958
  }, {
5828
5959
  key: "callServiceAPI",
5829
5960
  value: function () {
5830
- var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
5961
+ var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e, t) {
5831
5962
  var n;
5832
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
5833
- while (1) switch (_context52.prev = _context52.next) {
5963
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5964
+ while (1) switch (_context55.prev = _context55.next) {
5834
5965
  case 0:
5835
5966
  if (this.requestSettings) {
5836
- _context52.next = 2;
5967
+ _context55.next = 2;
5837
5968
  break;
5838
5969
  }
5839
5970
  throw new Error("Request settings have not been set up");
@@ -5842,11 +5973,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5842
5973
  HTTPRequest.request(this, n, e);
5843
5974
  case 4:
5844
5975
  case "end":
5845
- return _context52.stop();
5976
+ return _context55.stop();
5846
5977
  }
5847
- }, _callee52, this);
5978
+ }, _callee55, this);
5848
5979
  }));
5849
- function callServiceAPI(_x90, _x91) {
5980
+ function callServiceAPI(_x98, _x99) {
5850
5981
  return _callServiceAPI15.apply(this, arguments);
5851
5982
  }
5852
5983
  return callServiceAPI;
@@ -5854,27 +5985,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5854
5985
  }, {
5855
5986
  key: "extractResultData",
5856
5987
  value: function () {
5857
- var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
5988
+ var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e) {
5858
5989
  var t;
5859
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
5860
- while (1) switch (_context53.prev = _context53.next) {
5990
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5991
+ while (1) switch (_context56.prev = _context56.next) {
5861
5992
  case 0:
5862
5993
  if (!Array.isArray(e)) {
5863
- _context53.next = 2;
5994
+ _context56.next = 2;
5864
5995
  break;
5865
5996
  }
5866
- return _context53.abrupt("return", {
5997
+ return _context56.abrupt("return", {
5867
5998
  text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
5868
5999
  });
5869
6000
  case 2:
5870
6001
  throw e.error;
5871
6002
  case 3:
5872
6003
  case "end":
5873
- return _context53.stop();
6004
+ return _context56.stop();
5874
6005
  }
5875
- }, _callee53);
6006
+ }, _callee56);
5876
6007
  }));
5877
- function extractResultData(_x92) {
6008
+ function extractResultData(_x100) {
5878
6009
  return _extractResultData19.apply(this, arguments);
5879
6010
  }
5880
6011
  return extractResultData;
@@ -5883,11 +6014,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
5883
6014
  return AzureTranslationIO;
5884
6015
  }(DirectServiceIO);
5885
6016
  var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5886
- _inherits(A, _DirectServiceIO9);
5887
- var _super30 = _createSuper(A);
5888
- function A(e) {
6017
+ _inherits(M, _DirectServiceIO9);
6018
+ var _super30 = _createSuper(M);
6019
+ function M(e) {
5889
6020
  var _this23;
5890
- _classCallCheck(this, A);
6021
+ _classCallCheck(this, M);
5891
6022
  var l;
5892
6023
  var t = e.directConnection,
5893
6024
  n = e.textInput,
@@ -5911,16 +6042,16 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5911
6042
  }
5912
6043
  };
5913
6044
  }
5914
- _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = A.canFileSendMessage;
6045
+ _typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = M.canFileSendMessage;
5915
6046
  return _this23;
5916
6047
  }
5917
- _createClass(A, [{
6048
+ _createClass(M, [{
5918
6049
  key: "preprocessBody",
5919
6050
  value: function preprocessBody(e, t) {
5920
6051
  var n = JSON.parse(JSON.stringify(e));
5921
6052
  if (t && t !== "") {
5922
- var s = t.substring(0, this._maxCharLength);
5923
- n.prompt = s;
6053
+ var _s5 = t.substring(0, this._maxCharLength);
6054
+ n.prompt = _s5;
5924
6055
  }
5925
6056
  return n;
5926
6057
  }
@@ -5932,50 +6063,50 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5932
6063
  var s;
5933
6064
  var o = (l = (a = t[t.length - 1]) == null ? void 0 : a.text) == null ? void 0 : l.trim();
5934
6065
  if (n[1] || o && o !== "") {
5935
- this.url = A.IMAGE_EDIT_URL;
6066
+ this.url = M.IMAGE_EDIT_URL;
5936
6067
  var c = this.preprocessBody(this.rawBody, o);
5937
- s = A.createFormDataBody(c, n[0], n[1]);
5938
- } else this.url = A.IMAGE_VARIATIONS_URL, s = A.createFormDataBody(this.rawBody, n[0]);
6068
+ s = M.createFormDataBody(c, n[0], n[1]);
6069
+ } else this.url = M.IMAGE_VARIATIONS_URL, s = M.createFormDataBody(this.rawBody, n[0]);
5939
6070
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
5940
6071
  }
5941
6072
  }, {
5942
6073
  key: "callServiceAPI",
5943
6074
  value: function () {
5944
- var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
5945
- var s, o;
5946
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5947
- while (1) switch (_context54.prev = _context54.next) {
6075
+ var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e, t, n) {
6076
+ var s, _o;
6077
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6078
+ while (1) switch (_context57.prev = _context57.next) {
5948
6079
  case 0:
5949
6080
  if ((s = this.requestSettings) != null && s.headers) {
5950
- _context54.next = 2;
6081
+ _context57.next = 2;
5951
6082
  break;
5952
6083
  }
5953
6084
  throw new Error("Request settings have not been set up");
5954
6085
  case 2:
5955
6086
  if (!(n != null && n[0])) {
5956
- _context54.next = 6;
6087
+ _context57.next = 6;
5957
6088
  break;
5958
6089
  }
5959
6090
  this.callApiWithImage(e, t, n);
5960
- _context54.next = 11;
6091
+ _context57.next = 11;
5961
6092
  break;
5962
6093
  case 6:
5963
6094
  if (this.requestSettings) {
5964
- _context54.next = 8;
6095
+ _context57.next = 8;
5965
6096
  break;
5966
6097
  }
5967
6098
  throw new Error("Request settings have not been set up");
5968
6099
  case 8:
5969
- this.url = A.IMAGE_GENERATION_URL;
5970
- o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
5971
- HTTPRequest.request(this, o, e);
6100
+ this.url = M.IMAGE_GENERATION_URL;
6101
+ _o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
6102
+ HTTPRequest.request(this, _o, e);
5972
6103
  case 11:
5973
6104
  case "end":
5974
- return _context54.stop();
6105
+ return _context57.stop();
5975
6106
  }
5976
- }, _callee54, this);
6107
+ }, _callee57, this);
5977
6108
  }));
5978
- function callServiceAPI(_x93, _x94, _x95) {
6109
+ function callServiceAPI(_x101, _x102, _x103) {
5979
6110
  return _callServiceAPI16.apply(this, arguments);
5980
6111
  }
5981
6112
  return callServiceAPI;
@@ -5983,17 +6114,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
5983
6114
  }, {
5984
6115
  key: "extractResultData",
5985
6116
  value: function () {
5986
- var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
5987
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5988
- while (1) switch (_context55.prev = _context55.next) {
6117
+ var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e) {
6118
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6119
+ while (1) switch (_context58.prev = _context58.next) {
5989
6120
  case 0:
5990
6121
  if (!e.error) {
5991
- _context55.next = 2;
6122
+ _context58.next = 2;
5992
6123
  break;
5993
6124
  }
5994
6125
  throw e.error.message;
5995
6126
  case 2:
5996
- return _context55.abrupt("return", {
6127
+ return _context58.abrupt("return", {
5997
6128
  files: e.data.map(function (n) {
5998
6129
  return n.url ? {
5999
6130
  src: n.url,
@@ -6006,11 +6137,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6006
6137
  });
6007
6138
  case 3:
6008
6139
  case "end":
6009
- return _context55.stop();
6140
+ return _context58.stop();
6010
6141
  }
6011
- }, _callee55);
6142
+ }, _callee58);
6012
6143
  }));
6013
- function extractResultData(_x96) {
6144
+ function extractResultData(_x104) {
6014
6145
  return _extractResultData20.apply(this, arguments);
6015
6146
  }
6016
6147
  return extractResultData;
@@ -6037,34 +6168,34 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
6037
6168
  }), s;
6038
6169
  }
6039
6170
  }]);
6040
- return A;
6171
+ return M;
6041
6172
  }(DirectServiceIO);
6042
6173
  _OpenAIImagesIO.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
6043
6174
  _OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
6044
6175
  _OpenAIImagesIO.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
6045
6176
  var OpenAIImagesIO = _OpenAIImagesIO;
6046
6177
  var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6047
- _inherits(M, _DirectServiceIO10);
6048
- var _super31 = _createSuper(M);
6049
- function M(e) {
6178
+ _inherits(k, _DirectServiceIO10);
6179
+ var _super31 = _createSuper(k);
6180
+ function k(e) {
6050
6181
  var _l$model2;
6051
6182
  var _this24;
6052
- _classCallCheck(this, M);
6183
+ _classCallCheck(this, k);
6053
6184
  var a, l;
6054
6185
  var t = e.directConnection,
6055
6186
  n = e.textInput,
6056
6187
  s = t == null ? void 0 : t.openAI;
6057
6188
  _this24 = _super31.call(this, e, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, s, {
6058
6189
  audio: {}
6059
- }), _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);
6190
+ }), _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);
6060
6191
  var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.audio;
6061
- _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;
6192
+ _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;
6062
6193
  return _this24;
6063
6194
  }
6064
- _createClass(M, [{
6195
+ _createClass(k, [{
6065
6196
  key: "processConfig",
6066
6197
  value: function processConfig(e) {
6067
- e != null && e.type && e.type === "translation" && (this._service_url = M.AUDIO_TRANSLATIONS_URL, delete e.language);
6198
+ e != null && e.type && e.type === "translation" && (this._service_url = k.AUDIO_TRANSLATIONS_URL, delete e.language);
6068
6199
  }
6069
6200
  }, {
6070
6201
  key: "preprocessBody",
@@ -6082,33 +6213,33 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6082
6213
  }, {
6083
6214
  key: "callServiceAPI",
6084
6215
  value: function () {
6085
- var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
6216
+ var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e, t, n) {
6086
6217
  var a, s, o;
6087
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
6088
- while (1) switch (_context56.prev = _context56.next) {
6218
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6219
+ while (1) switch (_context59.prev = _context59.next) {
6089
6220
  case 0:
6090
6221
  if ((a = this.requestSettings) != null && a.headers) {
6091
- _context56.next = 2;
6222
+ _context59.next = 2;
6092
6223
  break;
6093
6224
  }
6094
6225
  throw new Error("Request settings have not been set up");
6095
6226
  case 2:
6096
6227
  if (n != null && n[0]) {
6097
- _context56.next = 4;
6228
+ _context59.next = 4;
6098
6229
  break;
6099
6230
  }
6100
6231
  throw new Error("No file was added");
6101
6232
  case 4:
6102
6233
  this.url = this.requestSettings.url || this._service_url;
6103
- s = this.preprocessBody(this.rawBody, t, n), o = M.createFormDataBody(s, n[0]);
6234
+ s = this.preprocessBody(this.rawBody, t, n), o = k.createFormDataBody(s, n[0]);
6104
6235
  RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
6105
6236
  case 7:
6106
6237
  case "end":
6107
- return _context56.stop();
6238
+ return _context59.stop();
6108
6239
  }
6109
- }, _callee56, this);
6240
+ }, _callee59, this);
6110
6241
  }));
6111
- function callServiceAPI(_x97, _x98, _x99) {
6242
+ function callServiceAPI(_x105, _x106, _x107) {
6112
6243
  return _callServiceAPI17.apply(this, arguments);
6113
6244
  }
6114
6245
  return callServiceAPI;
@@ -6116,26 +6247,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6116
6247
  }, {
6117
6248
  key: "extractResultData",
6118
6249
  value: function () {
6119
- var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
6120
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
6121
- while (1) switch (_context57.prev = _context57.next) {
6250
+ var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e) {
6251
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6252
+ while (1) switch (_context60.prev = _context60.next) {
6122
6253
  case 0:
6123
6254
  if (!e.error) {
6124
- _context57.next = 2;
6255
+ _context60.next = 2;
6125
6256
  break;
6126
6257
  }
6127
6258
  throw e.error.message;
6128
6259
  case 2:
6129
- return _context57.abrupt("return", {
6260
+ return _context60.abrupt("return", {
6130
6261
  text: e.text
6131
6262
  });
6132
6263
  case 3:
6133
6264
  case "end":
6134
- return _context57.stop();
6265
+ return _context60.stop();
6135
6266
  }
6136
- }, _callee57);
6267
+ }, _callee60);
6137
6268
  }));
6138
- function extractResultData(_x100) {
6269
+ function extractResultData(_x108) {
6139
6270
  return _extractResultData21.apply(this, arguments);
6140
6271
  }
6141
6272
  return extractResultData;
@@ -6159,7 +6290,7 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
6159
6290
  }), n;
6160
6291
  }
6161
6292
  }]);
6162
- return M;
6293
+ return k;
6163
6294
  }(DirectServiceIO);
6164
6295
  _OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
6165
6296
  _OpenAIAudioIO.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
@@ -6201,13 +6332,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6201
6332
  }, {
6202
6333
  key: "callServiceAPI",
6203
6334
  value: function () {
6204
- var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
6335
+ var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e, t) {
6205
6336
  var n;
6206
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
6207
- while (1) switch (_context58.prev = _context58.next) {
6337
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6338
+ while (1) switch (_context61.prev = _context61.next) {
6208
6339
  case 0:
6209
6340
  if (this.requestSettings) {
6210
- _context58.next = 2;
6341
+ _context61.next = 2;
6211
6342
  break;
6212
6343
  }
6213
6344
  throw new Error("Request settings have not been set up");
@@ -6216,11 +6347,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6216
6347
  this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
6217
6348
  case 4:
6218
6349
  case "end":
6219
- return _context58.stop();
6350
+ return _context61.stop();
6220
6351
  }
6221
- }, _callee58, this);
6352
+ }, _callee61, this);
6222
6353
  }));
6223
- function callServiceAPI(_x101, _x102) {
6354
+ function callServiceAPI(_x109, _x110) {
6224
6355
  return _callServiceAPI18.apply(this, arguments);
6225
6356
  }
6226
6357
  return callServiceAPI;
@@ -6228,17 +6359,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6228
6359
  }, {
6229
6360
  key: "extractResultData",
6230
6361
  value: function () {
6231
- var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
6232
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
6233
- while (1) switch (_context59.prev = _context59.next) {
6362
+ var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e) {
6363
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6364
+ while (1) switch (_context62.prev = _context62.next) {
6234
6365
  case 0:
6235
6366
  if (!e.error) {
6236
- _context59.next = 2;
6367
+ _context62.next = 2;
6237
6368
  break;
6238
6369
  }
6239
6370
  throw e.error.message;
6240
6371
  case 2:
6241
- return _context59.abrupt("return", e.choices[0].delta ? {
6372
+ return _context62.abrupt("return", e.choices[0].delta ? {
6242
6373
  text: e.choices[0].delta.content || ""
6243
6374
  } : e.choices[0].message ? {
6244
6375
  text: e.choices[0].message.content
@@ -6247,11 +6378,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
6247
6378
  });
6248
6379
  case 3:
6249
6380
  case "end":
6250
- return _context59.stop();
6381
+ return _context62.stop();
6251
6382
  }
6252
- }, _callee59);
6383
+ }, _callee62);
6253
6384
  }));
6254
- function extractResultData(_x103) {
6385
+ function extractResultData(_x111) {
6255
6386
  return _extractResultData22.apply(this, arguments);
6256
6387
  }
6257
6388
  return extractResultData;
@@ -6299,13 +6430,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6299
6430
  }, {
6300
6431
  key: "callServiceAPI",
6301
6432
  value: function () {
6302
- var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
6433
+ var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e, t) {
6303
6434
  var n;
6304
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
6305
- while (1) switch (_context60.prev = _context60.next) {
6435
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6436
+ while (1) switch (_context63.prev = _context63.next) {
6306
6437
  case 0:
6307
6438
  if (this.requestSettings) {
6308
- _context60.next = 2;
6439
+ _context63.next = 2;
6309
6440
  break;
6310
6441
  }
6311
6442
  throw new Error("Request settings have not been set up");
@@ -6314,11 +6445,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6314
6445
  HTTPRequest.request(this, n, e);
6315
6446
  case 4:
6316
6447
  case "end":
6317
- return _context60.stop();
6448
+ return _context63.stop();
6318
6449
  }
6319
- }, _callee60, this);
6450
+ }, _callee63, this);
6320
6451
  }));
6321
- function callServiceAPI(_x104, _x105) {
6452
+ function callServiceAPI(_x112, _x113) {
6322
6453
  return _callServiceAPI19.apply(this, arguments);
6323
6454
  }
6324
6455
  return callServiceAPI;
@@ -6326,26 +6457,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
6326
6457
  }, {
6327
6458
  key: "extractResultData",
6328
6459
  value: function () {
6329
- var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
6330
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6331
- while (1) switch (_context61.prev = _context61.next) {
6460
+ var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
6461
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6462
+ while (1) switch (_context64.prev = _context64.next) {
6332
6463
  case 0:
6333
6464
  if (!e.message) {
6334
- _context61.next = 2;
6465
+ _context64.next = 2;
6335
6466
  break;
6336
6467
  }
6337
6468
  throw e.message;
6338
6469
  case 2:
6339
- return _context61.abrupt("return", {
6470
+ return _context64.abrupt("return", {
6340
6471
  text: e.text
6341
6472
  });
6342
6473
  case 3:
6343
6474
  case "end":
6344
- return _context61.stop();
6475
+ return _context64.stop();
6345
6476
  }
6346
- }, _callee61);
6477
+ }, _callee64);
6347
6478
  }));
6348
- function extractResultData(_x106) {
6479
+ function extractResultData(_x114) {
6349
6480
  return _extractResultData23.apply(this, arguments);
6350
6481
  }
6351
6482
  return extractResultData;
@@ -6512,11 +6643,11 @@ var _TextToSpeech = /*#__PURE__*/function () {
6512
6643
  var n = {};
6513
6644
  setTimeout(function () {
6514
6645
  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)) {
6515
- var s = window.speechSynthesis.getVoices().find(function (o) {
6646
+ var _s6 = window.speechSynthesis.getVoices().find(function (o) {
6516
6647
  var a;
6517
6648
  return o.name.toLocaleLowerCase() === ((a = e.voiceName) == null ? void 0 : a.toLocaleLowerCase());
6518
6649
  });
6519
- s && (n.voice = s);
6650
+ _s6 && (n.voice = _s6);
6520
6651
  }
6521
6652
  t(n);
6522
6653
  }, $.LOAD_VOICES_MS);
@@ -6558,9 +6689,9 @@ var MessageStyleUtils = /*#__PURE__*/function () {
6558
6689
  key: "applyCustomStylesToElements",
6559
6690
  value: function applyCustomStylesToElements(e, t, n) {
6560
6691
  if (n && (Object.assign(e.outerContainer.style, n.outerContainer), Object.assign(e.innerContainer.style, n.innerContainer), Object.assign(e.bubbleElement.style, n.bubble), t)) {
6561
- var s = e.bubbleElement.children[0],
6562
- o = s.tagName.toLocaleLowerCase() !== "a" ? s : s.children[0];
6563
- Object.assign(o.style, n.media);
6692
+ var _s7 = e.bubbleElement.children[0],
6693
+ _o2 = _s7.tagName.toLocaleLowerCase() !== "a" ? _s7 : _s7.children[0];
6694
+ Object.assign(_o2.style, n.media);
6564
6695
  }
6565
6696
  }
6566
6697
  }, {
@@ -6678,7 +6809,7 @@ var _FileMessageUtils = /*#__PURE__*/function () {
6678
6809
  })["catch"](function () {})["finally"](function () {
6679
6810
  B.waitToLoadThenScroll(t);
6680
6811
  });
6681
- } catch (_unused6) {
6812
+ } catch (_unused5) {
6682
6813
  t.scrollTop = t.scrollHeight;
6683
6814
  }
6684
6815
  }
@@ -6698,27 +6829,29 @@ var FileMessages = /*#__PURE__*/function () {
6698
6829
  var n = new Image();
6699
6830
  return n.src = e.src, FileMessageUtils.scrollDownOnImageLoad(n.src, t), FileMessageUtils.processContent(n, n.src);
6700
6831
  }
6832
+ // WORK - should base64 images be clickable?
6833
+ // WORK - image still does not scroll down when loaded
6701
6834
  }, {
6702
6835
  key: "addNewImageMessage",
6703
6836
  value: function () {
6704
- var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, n) {
6837
+ var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(e, t, n) {
6705
6838
  var s,
6706
6839
  o,
6707
6840
  a,
6708
- _args62 = arguments;
6709
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6710
- while (1) switch (_context62.prev = _context62.next) {
6841
+ _args65 = arguments;
6842
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6843
+ while (1) switch (_context65.prev = _context65.next) {
6711
6844
  case 0:
6712
- s = _args62.length > 3 && _args62[3] !== undefined ? _args62[3] : !1;
6845
+ s = _args65.length > 3 && _args65[3] !== undefined ? _args65[3] : !1;
6713
6846
  o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
6714
6847
  a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
6715
6848
  case 3:
6716
6849
  case "end":
6717
- return _context62.stop();
6850
+ return _context65.stop();
6718
6851
  }
6719
- }, _callee62);
6852
+ }, _callee65);
6720
6853
  }));
6721
- function addNewImageMessage(_x107, _x108, _x109) {
6854
+ function addNewImageMessage(_x115, _x116, _x117) {
6722
6855
  return _addNewImageMessage.apply(this, arguments);
6723
6856
  }
6724
6857
  return addNewImageMessage;
@@ -6989,11 +7122,27 @@ var Messages = /*#__PURE__*/function () {
6989
7122
  }
6990
7123
  }
6991
7124
  }
7125
+ }, {
7126
+ key: "getLastMessageElement",
7127
+ value: function getLastMessageElement() {
7128
+ return this.elementRef.children[this.elementRef.children.length - 1];
7129
+ }
7130
+ }, {
7131
+ key: "getLastMessageBubbleElement",
7132
+ value: function getLastMessageBubbleElement() {
7133
+ var e, t, n, s;
7134
+ return (s = (n = (t = (e = this.getLastMessageElement()) == null ? void 0 : e.children) == null ? void 0 : t[0]) == null ? void 0 : n.children) == null ? void 0 : s[0];
7135
+ }
6992
7136
  }, {
6993
7137
  key: "isLastMessageError",
6994
7138
  value: function isLastMessageError() {
6995
- var e, t, n, s, o;
6996
- return (o = (s = (n = (t = (e = this.elementRef.children[this.elementRef.children.length - 1]) == null ? void 0 : e.children) == null ? void 0 : t[0]) == null ? void 0 : n.children) == null ? void 0 : s[0]) == null ? void 0 : o.classList.contains("error-message-text");
7139
+ var e;
7140
+ return (e = this.getLastMessageBubbleElement()) == null ? void 0 : e.classList.contains("error-message-text");
7141
+ }
7142
+ }, {
7143
+ key: "removeError",
7144
+ value: function removeError() {
7145
+ this.isLastMessageError() && this.getLastMessageElement().remove();
6997
7146
  }
6998
7147
  }, {
6999
7148
  key: "addLoadingMessage",
@@ -7028,7 +7177,7 @@ var Messages = /*#__PURE__*/function () {
7028
7177
  }, {
7029
7178
  key: "finaliseStreamedMessage",
7030
7179
  value: function finaliseStreamedMessage() {
7031
- this.messages[this.messages.length - 1].text = this._streamedText, this.sendClientUpdate(Messages.createMessageContent(!0, this._streamedText), !1), this._textToSpeech && TextToSpeech.speak(this._streamedText, this._textToSpeech), this._streamedText = "";
7180
+ this.getLastMessageBubbleElement().classList.contains("streamed-message") && (this.messages[this.messages.length - 1].text = this._streamedText, this.sendClientUpdate(Messages.createMessageContent(!0, this._streamedText), !1), this._textToSpeech && TextToSpeech.speak(this._streamedText, this._textToSpeech), this._streamedText = "");
7032
7181
  }
7033
7182
  }, {
7034
7183
  key: "populateIntroPanel",
@@ -7038,27 +7187,27 @@ var Messages = /*#__PURE__*/function () {
7038
7187
  }, {
7039
7188
  key: "addMultipleFiles",
7040
7189
  value: function () {
7041
- var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
7190
+ var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e) {
7042
7191
  var _this31 = this;
7043
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
7044
- while (1) switch (_context63.prev = _context63.next) {
7192
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
7193
+ while (1) switch (_context66.prev = _context66.next) {
7045
7194
  case 0:
7046
- return _context63.abrupt("return", Promise.all((e || []).map(function (t) {
7195
+ return _context66.abrupt("return", Promise.all((e || []).map(function (t) {
7047
7196
  return new Promise(function (n) {
7048
7197
  if (!t.type || t.type === "any") {
7049
- var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
7198
+ var _s8 = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
7050
7199
  _this31.addNewMessage({
7051
7200
  files: [{
7052
- name: s,
7201
+ name: _s8,
7053
7202
  type: "any"
7054
7203
  }]
7055
7204
  }, !1, !0), n(!0);
7056
7205
  } else {
7057
- var _s = new FileReader();
7058
- _s.readAsDataURL(t.file), _s.onload = function () {
7206
+ var _s9 = new FileReader();
7207
+ _s9.readAsDataURL(t.file), _s9.onload = function () {
7059
7208
  _this31.addNewMessage({
7060
7209
  files: [{
7061
- src: _s.result,
7210
+ src: _s9.result,
7062
7211
  type: t.type
7063
7212
  }]
7064
7213
  }, !1, !0), n(!0);
@@ -7068,11 +7217,11 @@ var Messages = /*#__PURE__*/function () {
7068
7217
  })));
7069
7218
  case 1:
7070
7219
  case "end":
7071
- return _context63.stop();
7220
+ return _context66.stop();
7072
7221
  }
7073
- }, _callee63);
7222
+ }, _callee66);
7074
7223
  }));
7075
- function addMultipleFiles(_x110) {
7224
+ function addMultipleFiles(_x118) {
7076
7225
  return _addMultipleFiles.apply(this, arguments);
7077
7226
  }
7078
7227
  return addMultipleFiles;
@@ -7146,10 +7295,10 @@ var Messages = /*#__PURE__*/function () {
7146
7295
  return Messages;
7147
7296
  }();
7148
7297
  var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7149
- function E() {
7150
- _classCallCheck(this, E);
7298
+ function T() {
7299
+ _classCallCheck(this, T);
7151
7300
  }
7152
- _createClass(E, null, [{
7301
+ _createClass(T, null, [{
7153
7302
  key: "adjustInputPadding",
7154
7303
  value: function adjustInputPadding(e, t) {
7155
7304
  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");
@@ -7157,7 +7306,7 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7157
7306
  }, {
7158
7307
  key: "adjustForOutsideButton",
7159
7308
  value: function adjustForOutsideButton(e, t, n) {
7160
- 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));
7309
+ n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(T.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(T.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
7161
7310
  }
7162
7311
  // when submit is the only button
7163
7312
  // when submit button is outside by itself - we increase the height for a better look
@@ -7165,10 +7314,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7165
7314
  key: "adjustOutsideSubmit",
7166
7315
  value: function adjustOutsideSubmit(e, t, n) {
7167
7316
  if (!(n["inside-left"].length > 0 || n["inside-right"].length > 0)) {
7168
- 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) {
7317
+ if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(T.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
7169
7318
  return s.button.elementRef.classList.add("submit-button-enlarged");
7170
7319
  });
7171
- 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) {
7320
+ if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(T.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(T.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
7172
7321
  return s.button.elementRef.classList.add("submit-button-enlarged");
7173
7322
  });
7174
7323
  }
@@ -7176,10 +7325,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
7176
7325
  }, {
7177
7326
  key: "set",
7178
7327
  value: function set(e, t, n, s) {
7179
- !!E.adjustOutsideSubmit(t, n, s) || E.adjustForOutsideButton(t, n, s), E.adjustInputPadding(e, s);
7328
+ !!T.adjustOutsideSubmit(t, n, s) || T.adjustForOutsideButton(t, n, s), T.adjustInputPadding(e, s);
7180
7329
  }
7181
7330
  }]);
7182
- return E;
7331
+ return T;
7183
7332
  }();
7184
7333
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
7185
7334
  _InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
@@ -7343,8 +7492,8 @@ var InputButton = /*#__PURE__*/function () {
7343
7492
  value: function unsetCustomStateStyles(e) {
7344
7493
  if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
7345
7494
  var n = e[t],
7346
- s = n && this._customStyles[n];
7347
- s && ButtonCSS.unsetActionCSS(this.elementRef, s);
7495
+ _s10 = n && this._customStyles[n];
7496
+ _s10 && ButtonCSS.unsetActionCSS(this.elementRef, _s10);
7348
7497
  }
7349
7498
  }
7350
7499
  }, {
@@ -7708,14 +7857,14 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7708
7857
  key: "addAttachmentBasedOnType",
7709
7858
  value: function addAttachmentBasedOnType(e, t, n) {
7710
7859
  if (e.type.startsWith("image")) {
7711
- var s = FileAttachmentsType.createImageAttachment(t);
7712
- this.addFileAttachment(e, "image", s, n);
7860
+ var _s11 = FileAttachmentsType.createImageAttachment(t);
7861
+ this.addFileAttachment(e, "image", _s11, n);
7713
7862
  } else if (e.type.startsWith("audio")) {
7714
- var _s2 = AudioFileAttachmentType.createAudioAttachment(t);
7715
- this.addFileAttachment(e, "audio", _s2, n);
7863
+ var _s12 = AudioFileAttachmentType.createAudioAttachment(t);
7864
+ this.addFileAttachment(e, "audio", _s12, n);
7716
7865
  } else {
7717
- var _s3 = FileAttachmentsType.createAnyFileAttachment(e.name);
7718
- this.addFileAttachment(e, "any", _s3, n);
7866
+ var _s13 = FileAttachmentsType.createAnyFileAttachment(e.name);
7867
+ this.addFileAttachment(e, "any", _s13, n);
7719
7868
  }
7720
7869
  }
7721
7870
  }, {
@@ -7777,15 +7926,15 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7777
7926
  value: function isFileTypeValid(e, t) {
7778
7927
  if (t === "") return !0;
7779
7928
  var n = t.split(",");
7780
- for (var s = 0; s < n.length; s++) {
7781
- var o = n[s].trim();
7782
- if (e.type === o) return !0;
7783
- if (o.startsWith(".")) {
7784
- var a = o.slice(1);
7785
- if (e.name.endsWith(a)) return !0;
7929
+ for (var _s14 = 0; _s14 < n.length; _s14++) {
7930
+ var _o3 = n[_s14].trim();
7931
+ if (e.type === _o3) return !0;
7932
+ if (_o3.startsWith(".")) {
7933
+ var _a3 = _o3.slice(1);
7934
+ if (e.name.endsWith(_a3)) return !0;
7786
7935
  } else {
7787
- if (e.name.endsWith(o)) return !0;
7788
- if (o.endsWith("/*") && e.type.startsWith(o.slice(0, -2))) return !0;
7936
+ if (e.name.endsWith(_o3)) return !0;
7937
+ if (_o3.endsWith("/*") && e.type.startsWith(_o3.slice(0, -2))) return !0;
7789
7938
  }
7790
7939
  }
7791
7940
  return !1;
@@ -7818,18 +7967,18 @@ var FileAttachmentsType = /*#__PURE__*/function () {
7818
7967
  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>",
7819
7968
  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>",
7820
7969
  _AudioFileAttachmentType = /*#__PURE__*/function (_FileAttachmentsType) {
7821
- _inherits(k, _FileAttachmentsType);
7822
- var _super35 = _createSuper(k);
7823
- function k(e, t, n) {
7824
- _classCallCheck(this, k);
7970
+ _inherits(I, _FileAttachmentsType);
7971
+ var _super35 = _createSuper(I);
7972
+ function I(e, t, n) {
7973
+ _classCallCheck(this, I);
7825
7974
  return _super35.call(this, e, t, n);
7826
7975
  }
7827
- _createClass(k, [{
7976
+ _createClass(I, [{
7828
7977
  key: "createTimer",
7829
7978
  value: function createTimer(e, t) {
7830
7979
  var _this37 = this;
7831
7980
  var n = 0;
7832
- var s = t !== void 0 && t < k.TIMER_LIMIT_S ? t : k.TIMER_LIMIT_S;
7981
+ var s = t !== void 0 && t < I.TIMER_LIMIT_S ? t : I.TIMER_LIMIT_S;
7833
7982
  return setInterval(function () {
7834
7983
  var l;
7835
7984
  n += 1, n === s && ((l = _this37.stopPlaceholderCallback) == null || l.call(_this37), _this37.clearTimer()), n === 600 && e.classList.add("audio-placeholder-text-4-digits");
@@ -7841,7 +7990,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7841
7990
  }, {
7842
7991
  key: "createPlaceholderAudioAttachment",
7843
7992
  value: function createPlaceholderAudioAttachment(e) {
7844
- var t = k.createAudioContainer(),
7993
+ var t = I.createAudioContainer(),
7845
7994
  n = document.createElement("div");
7846
7995
  n.classList.add("audio-placeholder-text-3-digits");
7847
7996
  var s = document.createElement("div");
@@ -7878,7 +8027,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7878
8027
  key: "completePlaceholderAttachment",
7879
8028
  value: function completePlaceholderAttachment(e, t) {
7880
8029
  var n = this._activePlaceholderAttachment;
7881
- 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());
8030
+ 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());
7882
8031
  }
7883
8032
  }, {
7884
8033
  key: "removePlaceholderAttachment",
@@ -7918,8 +8067,8 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7918
8067
  }, {
7919
8068
  key: "createAudioAttachment",
7920
8069
  value: function createAudioAttachment(e) {
7921
- var t = k.createAudioContainer();
7922
- return k.addAudioElements(t, e), t;
8070
+ var t = I.createAudioContainer();
8071
+ return I.addAudioElements(t, e), t;
7923
8072
  }
7924
8073
  }, {
7925
8074
  key: "stopAttachmentPlayback",
@@ -7928,7 +8077,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
7928
8077
  (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();
7929
8078
  }
7930
8079
  }]);
7931
- return k;
8080
+ return I;
7932
8081
  }(FileAttachmentsType);
7933
8082
  _AudioFileAttachmentType.TIMER_LIMIT_S = 5999;
7934
8083
  var AudioFileAttachmentType = _AudioFileAttachmentType;
@@ -7982,33 +8131,33 @@ var FileAttachments = /*#__PURE__*/function () {
7982
8131
  }, {
7983
8132
  key: "completePlaceholders",
7984
8133
  value: function () {
7985
- var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
7986
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
7987
- while (1) switch (_context65.prev = _context65.next) {
8134
+ var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68() {
8135
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
8136
+ while (1) switch (_context68.prev = _context68.next) {
7988
8137
  case 0:
7989
- _context65.next = 2;
8138
+ _context68.next = 2;
7990
8139
  return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
7991
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
8140
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e) {
7992
8141
  var t;
7993
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
7994
- while (1) switch (_context64.prev = _context64.next) {
8142
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
8143
+ while (1) switch (_context67.prev = _context67.next) {
7995
8144
  case 0:
7996
- return _context64.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
8145
+ return _context67.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
7997
8146
  case 1:
7998
8147
  case "end":
7999
- return _context64.stop();
8148
+ return _context67.stop();
8000
8149
  }
8001
- }, _callee64);
8150
+ }, _callee67);
8002
8151
  }));
8003
- return function (_x111) {
8004
- return _ref5.apply(this, arguments);
8152
+ return function (_x119) {
8153
+ return _ref6.apply(this, arguments);
8005
8154
  };
8006
8155
  }()));
8007
8156
  case 2:
8008
8157
  case "end":
8009
- return _context65.stop();
8158
+ return _context68.stop();
8010
8159
  }
8011
- }, _callee65, this);
8160
+ }, _callee68, this);
8012
8161
  }));
8013
8162
  function completePlaceholders() {
8014
8163
  return _completePlaceholders.apply(this, arguments);
@@ -8038,7 +8187,7 @@ var FileAttachments = /*#__PURE__*/function () {
8038
8187
  e.forEach(function (n) {
8039
8188
  var s = new FileReader();
8040
8189
  s.readAsDataURL(n), s.onload = function (o) {
8041
- for (var a = 0; a < t.length && !t[a].attemptAddFile(n, o.target.result); a += 1);
8190
+ for (var _a4 = 0; _a4 < t.length && !t[_a4].attemptAddFile(n, o.target.result); _a4 += 1);
8042
8191
  };
8043
8192
  });
8044
8193
  }
@@ -8046,11 +8195,11 @@ var FileAttachments = /*#__PURE__*/function () {
8046
8195
  return FileAttachments;
8047
8196
  }();
8048
8197
  var _Modal = /*#__PURE__*/function () {
8049
- function T(e, t, n) {
8050
- _classCallCheck(this, T);
8051
- this._isOpen = !1, this._contentRef = T.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = T.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = T.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = T.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
8198
+ function C(e, t, n) {
8199
+ _classCallCheck(this, C);
8200
+ this._isOpen = !1, this._contentRef = C.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = C.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = C.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = C.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
8052
8201
  }
8053
- _createClass(T, [{
8202
+ _createClass(C, [{
8054
8203
  key: "isOpen",
8055
8204
  value: function isOpen() {
8056
8205
  return this._isOpen;
@@ -8072,7 +8221,7 @@ var _Modal = /*#__PURE__*/function () {
8072
8221
  var _this40 = this;
8073
8222
  this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
8074
8223
  _this40._elementRef.style.display = "none", _this40._backgroundPanelRef.style.display = "none";
8075
- }, T.MODAL_CLOSE_TIMEOUT_MS);
8224
+ }, C.MODAL_CLOSE_TIMEOUT_MS);
8076
8225
  }
8077
8226
  }, {
8078
8227
  key: "displayModalElements",
@@ -8088,7 +8237,7 @@ var _Modal = /*#__PURE__*/function () {
8088
8237
  key: "addCloseButton",
8089
8238
  value: function addCloseButton(e, t, n) {
8090
8239
  var _this41 = this;
8091
- var s = t ? T.createSVGButton(e) : T.createTextButton(e);
8240
+ var s = t ? C.createSVGButton(e) : C.createTextButton(e);
8092
8241
  return this.addButtons(s), s.onclick = function () {
8093
8242
  _this41.close(), setTimeout(function () {
8094
8243
  n == null || n();
@@ -8148,12 +8297,12 @@ var _Modal = /*#__PURE__*/function () {
8148
8297
  value: function createTextModalFunc(e, t, n) {
8149
8298
  var s;
8150
8299
  if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
8151
- var o = new T(e, ["modal-content"], t.files.infoModal.containerStyle);
8152
- return o.addCloseButton("OK", !1, n), o.openTextModal.bind(o, t.infoModalTextMarkUp || "");
8300
+ var _o4 = new C(e, ["modal-content"], t.files.infoModal.containerStyle);
8301
+ return _o4.addCloseButton("OK", !1, n), _o4.openTextModal.bind(_o4, t.infoModalTextMarkUp || "");
8153
8302
  }
8154
8303
  }
8155
8304
  }]);
8156
- return T;
8305
+ return C;
8157
8306
  }();
8158
8307
  _Modal.MODAL_CLOSE_TIMEOUT_MS = 190;
8159
8308
  var Modal = _Modal;
@@ -8414,7 +8563,7 @@ var Translate = /*#__PURE__*/function () {
8414
8563
  key: "translate",
8415
8564
  value: function translate(e, t) {
8416
8565
  var n = text_1$3.Text.breakupIntoWordsArr(e);
8417
- for (var s = 0; s < n.length; s += 1) t[n[s]] && (n[s] = t[n[s]]);
8566
+ for (var _s15 = 0; _s15 < n.length; _s15 += 1) t[n[_s15]] && (n[_s15] = t[n[_s15]]);
8418
8567
  return n.join("");
8419
8568
  }
8420
8569
  }]);
@@ -8434,9 +8583,9 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8434
8583
  key: "extract",
8435
8584
  value: function extract(e, t, n) {
8436
8585
  var s = "";
8437
- for (var o = e.resultIndex; o < e.results.length; ++o) {
8438
- var a = e.results[o][0].transcript;
8439
- n && (a = translate_1$1.Translate.translate(a, n)), e.results[o].isFinal ? t += a : s += a;
8586
+ for (var _o5 = e.resultIndex; _o5 < e.results.length; ++_o5) {
8587
+ var _a5 = e.results[_o5][0].transcript;
8588
+ n && (_a5 = translate_1$1.Translate.translate(_a5, n)), e.results[_o5].isFinal ? t += _a5 : s += _a5;
8440
8589
  }
8441
8590
  return {
8442
8591
  interimTranscript: s,
@@ -8449,8 +8598,8 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
8449
8598
  value: function extractSafari(e, t, n) {
8450
8599
  var s = "";
8451
8600
  var o = "";
8452
- for (var a = e.resultIndex; a < e.results.length; ++a) {
8453
- var l = e.results[a][0].transcript;
8601
+ for (var _a6 = e.resultIndex; _a6 < e.results.length; ++_a6) {
8602
+ var l = e.results[_a6][0].transcript;
8454
8603
  n && (l = translate_1$1.Translate.translate(l, n)), s += l;
8455
8604
  }
8456
8605
  return {
@@ -8622,8 +8771,8 @@ var Elements = /*#__PURE__*/function () {
8622
8771
  if (e.spansPopulated = !0, e.insertInCursorLocation && document.activeElement === t) {
8623
8772
  var n = window.getSelection();
8624
8773
  if (n != null && n.focusNode) {
8625
- var s = n.getRangeAt(0);
8626
- s.insertNode(e.scrollingSpan), s.insertNode(e.interimSpan), s.insertNode(e.finalSpan), s.collapse(!1), n.removeAllRanges(), n.addRange(s);
8774
+ var _s16 = n.getRangeAt(0);
8775
+ _s16.insertNode(e.scrollingSpan), _s16.insertNode(e.interimSpan), _s16.insertNode(e.finalSpan), _s16.collapse(!1), n.removeAllRanges(), n.addRange(_s16);
8627
8776
  return;
8628
8777
  }
8629
8778
  }
@@ -8657,20 +8806,20 @@ var Cursor = /*#__PURE__*/function () {
8657
8806
  value: function setOffsetForGeneric(e, t) {
8658
8807
  var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
8659
8808
  var s = 0;
8660
- for (var o = 0; o < e.childNodes.length; o += 1) {
8661
- var a = e.childNodes[o];
8662
- if (a.childNodes.length > 0) {
8663
- var l = Cursor.setOffsetForGeneric(a, t, n);
8809
+ for (var _o6 = 0; _o6 < e.childNodes.length; _o6 += 1) {
8810
+ var _a7 = e.childNodes[_o6];
8811
+ if (_a7.childNodes.length > 0) {
8812
+ var l = Cursor.setOffsetForGeneric(_a7, t, n);
8664
8813
  if (l === -1) return -1;
8665
8814
  n += l;
8666
- } else if (a.textContent !== null) {
8667
- if (n + a.textContent.length > t) {
8815
+ } else if (_a7.textContent !== null) {
8816
+ if (n + _a7.textContent.length > t) {
8668
8817
  var _l = document.createRange();
8669
- _l.setStart(a, t - n), _l.collapse(!0);
8818
+ _l.setStart(_a7, t - n), _l.collapse(!0);
8670
8819
  var c = window.getSelection();
8671
8820
  return c == null || c.removeAllRanges(), c == null || c.addRange(_l), e.focus(), -1;
8672
8821
  }
8673
- n += a.textContent.length, s += a.textContent.length;
8822
+ n += _a7.textContent.length, s += _a7.textContent.length;
8674
8823
  }
8675
8824
  }
8676
8825
  return s;
@@ -8688,8 +8837,8 @@ var Cursor = /*#__PURE__*/function () {
8688
8837
  value: function setOffsetForSafariGeneric(e, t) {
8689
8838
  var n = window.getSelection();
8690
8839
  if (n) {
8691
- var s = Cursor.getGenericElementCursorOffset(e, n, !0);
8692
- console.log(s), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, s + t);
8840
+ var _s17 = Cursor.getGenericElementCursorOffset(e, n, !0);
8841
+ console.log(_s17), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, _s17 + t);
8693
8842
  }
8694
8843
  }
8695
8844
  // set to automatically scroll to cursor (scroll does not work in Safari)
@@ -8720,9 +8869,9 @@ var Cursor = /*#__PURE__*/function () {
8720
8869
  value: function getGenericElementCursorOffset(e, t, n) {
8721
8870
  var s = 0;
8722
8871
  if (t.rangeCount > 0) {
8723
- var o = t.getRangeAt(0),
8724
- a = o.cloneRange();
8725
- a.selectNodeContents(e), n ? a.setEnd(o.startContainer, o.startOffset) : a.setEnd(o.endContainer, o.endOffset), s = a.toString().length;
8872
+ var _o7 = t.getRangeAt(0),
8873
+ _a8 = _o7.cloneRange();
8874
+ _a8.selectNodeContents(e), n ? _a8.setEnd(_o7.startContainer, _o7.startOffset) : _a8.setEnd(_o7.endContainer, _o7.endOffset), s = _a8.toString().length;
8726
8875
  }
8727
8876
  return s;
8728
8877
  }
@@ -8785,10 +8934,10 @@ var CommandUtils = /*#__PURE__*/function () {
8785
8934
  key: "checkIfMatchesWord",
8786
8935
  value: function checkIfMatchesWord(e, t, n) {
8787
8936
  var s = e;
8788
- for (var o = n.length - 1; o >= 0; o -= 1) {
8789
- var a = o,
8937
+ for (var _o8 = n.length - 1; _o8 >= 0; _o8 -= 1) {
8938
+ var _a9 = _o8,
8790
8939
  l = s.length - 1;
8791
- for (; n[a] === s[l] && l >= 0;) a -= 1, l -= 1;
8940
+ for (; n[_a9] === s[l] && l >= 0;) _a9 -= 1, l -= 1;
8792
8941
  if (l < 0) return !0;
8793
8942
  }
8794
8943
  return !1;
@@ -8857,9 +9006,9 @@ var Highlight = /*#__PURE__*/function () {
8857
9006
  value: function setStateForGeneric(e, t) {
8858
9007
  var n = window.getSelection();
8859
9008
  if (n != null && n.focusNode) {
8860
- var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
8861
- o = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
8862
- e.isHighlighted = s !== o;
9009
+ var _s18 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
9010
+ _o9 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
9011
+ e.isHighlighted = _s18 !== _o9;
8863
9012
  }
8864
9013
  }
8865
9014
  }, {
@@ -8872,8 +9021,8 @@ var Highlight = /*#__PURE__*/function () {
8872
9021
  value: function removeForGeneric(e, t) {
8873
9022
  var n = window.getSelection();
8874
9023
  if (n) {
8875
- var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
8876
- n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, s), e.isHighlighted = !1;
9024
+ var _s19 = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
9025
+ n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, _s19), e.isHighlighted = !1;
8877
9026
  }
8878
9027
  }
8879
9028
  }, {
@@ -8883,8 +9032,8 @@ var Highlight = /*#__PURE__*/function () {
8883
9032
  s = t.selectionEnd,
8884
9033
  o = t.value;
8885
9034
  if (n && s) {
8886
- var a = o.substring(0, n) + o.substring(s);
8887
- t.value = a, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
9035
+ var _a10 = o.substring(0, n) + o.substring(s);
9036
+ t.value = _a10, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
8888
9037
  }
8889
9038
  e.isHighlighted = !1;
8890
9039
  }
@@ -8908,11 +9057,11 @@ var Padding = /*#__PURE__*/function () {
8908
9057
  key: "setStateForPrimitiveElement",
8909
9058
  value: function setStateForPrimitiveElement(e, t) {
8910
9059
  if (document.activeElement === t && t.selectionStart !== null) {
8911
- var s = t.selectionStart,
8912
- o = t.value[s - 1],
8913
- a = t.selectionEnd === null ? s : t.selectionEnd,
8914
- l = t.value[a];
8915
- 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;
9060
+ var _s20 = t.selectionStart,
9061
+ _o10 = t.value[_s20 - 1],
9062
+ _a11 = t.selectionEnd === null ? _s20 : t.selectionEnd,
9063
+ l = t.value[_a11];
9064
+ text_1$1.Text.isCharDefined(_o10) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === _a11;
8916
9065
  return;
8917
9066
  }
8918
9067
  var n = t.value[t.value.length - 1];
@@ -8983,11 +9132,11 @@ var Speech = /*#__PURE__*/function () {
8983
9132
  value: function prepareBeforeStart(e) {
8984
9133
  var t, n;
8985
9134
  if (e != null && e.element) if (eventListeners_1.EventListeners.add(this, e), Array.isArray(e.element)) {
8986
- var o = e.element.find(function (a) {
9135
+ var _o11 = e.element.find(function (a) {
8987
9136
  return a === document.activeElement;
8988
9137
  }) || e.element[0];
8989
- if (!o) return;
8990
- this.prepare(o);
9138
+ if (!_o11) return;
9139
+ this.prepare(_o11);
8991
9140
  } else this.prepare(e.element);
8992
9141
  (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));
8993
9142
  }
@@ -9030,8 +9179,8 @@ var Speech = /*#__PURE__*/function () {
9030
9179
  this.isHighlighted && highlight_1.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), n && padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);
9031
9180
  var s = this.startPadding + this.finalTranscript + t;
9032
9181
  if (e.value = s + this.endPadding, !this.isTargetInShadow) {
9033
- var o = s.length + this.numberOfSpacesAfterNewText;
9034
- cursor_1.Cursor.setOffsetForPrimitive(e, o, this.autoScroll);
9182
+ var _o12 = s.length + this.numberOfSpacesAfterNewText;
9183
+ cursor_1.Cursor.setOffsetForPrimitive(e, _o12, this.autoScroll);
9035
9184
  }
9036
9185
  this.autoScroll && browser_1$1.Browser.IS_SAFARI() && this.isCursorAtEnd && autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e);
9037
9186
  }
@@ -9132,8 +9281,8 @@ var WebSpeech = /*#__PURE__*/function (_speech_1$1$Speech) {
9132
9281
  var _this46$_extractText = _this46._extractText(e, _this46.finalTranscript, _this46._translations),
9133
9282
  t = _this46$_extractText.interimTranscript,
9134
9283
  n = _this46$_extractText.finalTranscript,
9135
- s = _this46$_extractText.newText;
9136
- _this46.updateElements(t, n, s);
9284
+ _s21 = _this46$_extractText.newText;
9285
+ _this46.updateElements(t, n, _s21);
9137
9286
  }
9138
9287
  });
9139
9288
  }
@@ -9228,26 +9377,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9228
9377
  }, {
9229
9378
  key: "getNewSpeechConfig",
9230
9379
  value: function () {
9231
- var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t) {
9232
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
9233
- while (1) switch (_context66.prev = _context66.next) {
9380
+ var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e, t) {
9381
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
9382
+ while (1) switch (_context69.prev = _context69.next) {
9234
9383
  case 0:
9235
9384
  if (!t.region) {
9236
- _context66.next = 2;
9385
+ _context69.next = 2;
9237
9386
  break;
9238
9387
  }
9239
- 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) {
9388
+ return _context69.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) {
9240
9389
  return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
9241
9390
  })["catch"](function (n) {
9242
9391
  return console.error(n), null;
9243
9392
  }) : null);
9244
9393
  case 2:
9245
9394
  case "end":
9246
- return _context66.stop();
9395
+ return _context69.stop();
9247
9396
  }
9248
- }, _callee66);
9397
+ }, _callee69);
9249
9398
  }));
9250
- function getNewSpeechConfig(_x112, _x113) {
9399
+ function getNewSpeechConfig(_x120, _x121) {
9251
9400
  return _getNewSpeechConfig.apply(this, arguments);
9252
9401
  }
9253
9402
  return getNewSpeechConfig;
@@ -9260,23 +9409,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
9260
9409
  }, {
9261
9410
  key: "get",
9262
9411
  value: function () {
9263
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e, t) {
9412
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
9264
9413
  var n;
9265
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
9266
- while (1) switch (_context67.prev = _context67.next) {
9414
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9415
+ while (1) switch (_context70.prev = _context70.next) {
9267
9416
  case 0:
9268
- _context67.next = 2;
9417
+ _context70.next = 2;
9269
9418
  return AzureSpeechConfig.getNewSpeechConfig(e, t);
9270
9419
  case 2:
9271
- n = _context67.sent;
9272
- return _context67.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9420
+ n = _context70.sent;
9421
+ return _context70.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
9273
9422
  case 4:
9274
9423
  case "end":
9275
- return _context67.stop();
9424
+ return _context70.stop();
9276
9425
  }
9277
- }, _callee67);
9426
+ }, _callee70);
9278
9427
  }));
9279
- function get(_x114, _x115) {
9428
+ function get(_x122, _x123) {
9280
9429
  return _get.apply(this, arguments);
9281
9430
  }
9282
9431
  return get;
@@ -9366,28 +9515,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9366
9515
  }, {
9367
9516
  key: "startAsync",
9368
9517
  value: function () {
9369
- var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
9518
+ var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(e) {
9370
9519
  var t;
9371
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
9372
- while (1) switch (_context68.prev = _context68.next) {
9520
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
9521
+ while (1) switch (_context71.prev = _context71.next) {
9373
9522
  case 0:
9374
- _context68.t0 = this.validate(e);
9375
- if (!_context68.t0) {
9376
- _context68.next = 6;
9523
+ _context71.t0 = this.validate(e);
9524
+ if (!_context71.t0) {
9525
+ _context71.next = 6;
9377
9526
  break;
9378
9527
  }
9379
- _context68.next = 4;
9528
+ _context71.next = 4;
9380
9529
  return this.instantiateService(e);
9381
9530
  case 4:
9382
9531
  this._translations = e == null ? void 0 : e.translations;
9383
9532
  (t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
9384
9533
  case 6:
9385
9534
  case "end":
9386
- return _context68.stop();
9535
+ return _context71.stop();
9387
9536
  }
9388
- }, _callee68, this);
9537
+ }, _callee71, this);
9389
9538
  }));
9390
- function startAsync(_x116) {
9539
+ function startAsync(_x124) {
9391
9540
  return _startAsync.apply(this, arguments);
9392
9541
  }
9393
9542
  return startAsync;
@@ -9400,28 +9549,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9400
9549
  }, {
9401
9550
  key: "instantiateService",
9402
9551
  value: function () {
9403
- var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e) {
9404
- var t, n, s, o;
9405
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
9406
- while (1) switch (_context69.prev = _context69.next) {
9552
+ var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(e) {
9553
+ var t, n, s, _o13;
9554
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
9555
+ while (1) switch (_context72.prev = _context72.next) {
9407
9556
  case 0:
9408
9557
  t = Azure.getAPI();
9409
9558
  n = t.AudioConfig.fromDefaultMicrophoneInput();
9410
- _context69.next = 4;
9559
+ _context72.next = 4;
9411
9560
  return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
9412
9561
  case 4:
9413
- s = _context69.sent;
9562
+ s = _context72.sent;
9414
9563
  if (s) {
9415
- o = new t.SpeechRecognizer(s, n);
9416
- this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9564
+ _o13 = new t.SpeechRecognizer(s, n);
9565
+ this.setEvents(_o13), this._service = _o13, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
9417
9566
  } else this.error("Unable to contact Azure server");
9418
9567
  case 6:
9419
9568
  case "end":
9420
- return _context69.stop();
9569
+ return _context72.stop();
9421
9570
  }
9422
- }, _callee69, this);
9571
+ }, _callee72, this);
9423
9572
  }));
9424
- function instantiateService(_x117) {
9573
+ function instantiateService(_x125) {
9425
9574
  return _instantiateService.apply(this, arguments);
9426
9575
  }
9427
9576
  return instantiateService;
@@ -9458,10 +9607,10 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
9458
9607
  case window.SpeechSDK.ResultReason.RecognizedSpeech:
9459
9608
  if (n.text && !this._stopping) {
9460
9609
  var _azureTranscript_1$Az2 = azureTranscript_1.AzureTranscript.extract(this._newTextPadding + n.text, this.finalTranscript, !0, this._translations),
9461
- s = _azureTranscript_1$Az2.interimTranscript,
9462
- o = _azureTranscript_1$Az2.finalTranscript,
9463
- a = _azureTranscript_1$Az2.newText;
9464
- stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(s, o, a), o !== "" && (this._newTextPadding = " ");
9610
+ _s22 = _azureTranscript_1$Az2.interimTranscript,
9611
+ _o14 = _azureTranscript_1$Az2.finalTranscript,
9612
+ _a12 = _azureTranscript_1$Az2.newText;
9613
+ stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(_s22, _o14, _a12), _o14 !== "" && (this._newTextPadding = " ");
9465
9614
  }
9466
9615
  break;
9467
9616
  }
@@ -9743,7 +9892,9 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9743
9892
  var _this54;
9744
9893
  _classCallCheck(this, SubmitButton);
9745
9894
  var a;
9746
- _this54 = _super42.call(this, SubmitButton.createButtonContainerElement(), (a = e.submitButtonStyles) == null ? void 0 : a.position, e.submitButtonStyles), _this54._isRequestInProgress = !1, _this54._isLoadingActive = !1, _this54._isSVGLoadingIconOverriden = !1, _this54._messages = n, _this54._inputElementRef = t, _this54._fileAttachments = o, _this54._innerElements = _this54.createInnerElements(), _this54._abortStream = new AbortController(), _this54._serviceIO = s, _this54.attemptOverwriteLoadingStyle(e), _this54.changeToSubmitIcon(), _this54.assignHandlers();
9895
+ _this54 = _super42.call(this, SubmitButton.createButtonContainerElement(), (a = e.submitButtonStyles) == null ? void 0 : a.position, e.submitButtonStyles), _this54._isRequestInProgress = !1, _this54._isLoadingActive = !1, _this54._isSVGLoadingIconOverriden = !1, _this54._messages = n, _this54._inputElementRef = t, _this54._fileAttachments = o, _this54._innerElements = _this54.createInnerElements(), _this54._abortStream = new AbortController(), _this54._stopClicked = {
9896
+ listener: function listener() {}
9897
+ }, _this54._serviceIO = s, _this54.attemptOverwriteLoadingStyle(e), _this54.changeToSubmitIcon(), _this54.assignHandlers();
9747
9898
  return _this54;
9748
9899
  }
9749
9900
  // prettier-ignore
@@ -9779,7 +9930,8 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9779
9930
  }, this._serviceIO.streamHandlers = {
9780
9931
  onOpen: this.changeToStopIcon.bind(this),
9781
9932
  onClose: this.changeToSubmitIcon.bind(this),
9782
- abortStream: this._abortStream
9933
+ abortStream: this._abortStream,
9934
+ stopClicked: this._stopClicked
9783
9935
  };
9784
9936
  var e = this._serviceIO.deepChat.stream;
9785
9937
  _typeof(e) == "object" && typeof e.simulation == "number" && (this._serviceIO.streamHandlers.simulationInterim = e.simulation);
@@ -9795,90 +9947,99 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
9795
9947
  }
9796
9948
  // TO-DO - button should be disabled if validateMessageBeforeSending is not valid
9797
9949
  // TO-DO - button should be disabled if websocket connection is not open
9950
+ // TO-DO - should be disabled when websocket is connecting and option when loading history
9951
+ // prettier-ignore
9798
9952
  }, {
9799
9953
  key: "submit",
9800
9954
  value: function () {
9801
- var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
9802
- var l, c, n, s, o, a;
9803
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
9804
- while (1) switch (_context70.prev = _context70.next) {
9955
+ var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(e, t) {
9956
+ var c, u, n, s, o, a, l;
9957
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
9958
+ while (1) switch (_context73.prev = _context73.next) {
9805
9959
  case 0:
9806
- _context70.t0 = e;
9807
- if (_context70.t0) {
9808
- _context70.next = 6;
9960
+ _context73.t0 = e;
9961
+ if (_context73.t0) {
9962
+ _context73.next = 6;
9809
9963
  break;
9810
9964
  }
9811
- _context70.next = 4;
9965
+ _context73.next = 4;
9812
9966
  return this._fileAttachments.completePlaceholders();
9813
9967
  case 4:
9814
9968
  n = this._fileAttachments.getAllFileData();
9815
- s = n == null ? void 0 : n.map(function (u) {
9816
- return u.file;
9969
+ s = n == null ? void 0 : n.map(function (d) {
9970
+ return d.file;
9817
9971
  });
9818
9972
  case 6:
9819
9973
  o = t === "" ? void 0 : t;
9820
9974
  if (!this._isRequestInProgress) {
9821
- _context70.next = 9;
9975
+ _context73.next = 9;
9822
9976
  break;
9823
9977
  }
9824
- return _context70.abrupt("return");
9978
+ return _context73.abrupt("return");
9825
9979
  case 9:
9826
- if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
9827
- _context70.next = 14;
9980
+ a = this._serviceIO.websocket;
9981
+ if (!(a && (a === "pending" || a.readyState === void 0 || a.readyState !== a.OPEN))) {
9982
+ _context73.next = 12;
9983
+ break;
9984
+ }
9985
+ return _context73.abrupt("return");
9986
+ case 12:
9987
+ if (!((c = this._serviceIO.deepChat) != null && c.validateMessageBeforeSending)) {
9988
+ _context73.next = 17;
9828
9989
  break;
9829
9990
  }
9830
9991
  if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
9831
- _context70.next = 12;
9992
+ _context73.next = 15;
9832
9993
  break;
9833
9994
  }
9834
- return _context70.abrupt("return");
9835
- case 12:
9836
- _context70.next = 16;
9995
+ return _context73.abrupt("return");
9996
+ case 15:
9997
+ _context73.next = 19;
9837
9998
  break;
9838
- case 14:
9999
+ case 17:
9839
10000
  if (this._serviceIO.canSendMessage(o, s)) {
9840
- _context70.next = 16;
10001
+ _context73.next = 19;
9841
10002
  break;
9842
10003
  }
9843
- return _context70.abrupt("return");
9844
- case 16:
10004
+ return _context73.abrupt("return");
10005
+ case 19:
9845
10006
  this.changeToLoadingIcon();
9846
10007
  t !== "" && this._messages.addNewMessage({
9847
10008
  text: t
9848
10009
  }, !1, !0);
9849
- _context70.t1 = n;
9850
- if (!_context70.t1) {
9851
- _context70.next = 22;
10010
+ _context73.t1 = n;
10011
+ if (!_context73.t1) {
10012
+ _context73.next = 25;
9852
10013
  break;
9853
10014
  }
9854
- _context70.next = 22;
10015
+ _context73.next = 25;
9855
10016
  return this._messages.addMultipleFiles(n);
9856
- case 22:
10017
+ case 25:
9857
10018
  this._messages.addLoadingMessage();
9858
10019
  e || TextInputEl.clear(this._inputElementRef);
9859
- a = {
10020
+ l = {
9860
10021
  text: o,
9861
10022
  files: s
9862
10023
  };
9863
- _context70.next = 27;
9864
- return this._serviceIO.callAPI(a, this._messages);
9865
- case 27:
9866
- e || (c = this._fileAttachments) == null || c.removeAllFiles();
9867
- case 28:
10024
+ _context73.next = 30;
10025
+ return this._serviceIO.callAPI(l, this._messages);
10026
+ case 30:
10027
+ e || (u = this._fileAttachments) == null || u.removeAllFiles();
10028
+ case 31:
9868
10029
  case "end":
9869
- return _context70.stop();
10030
+ return _context73.stop();
9870
10031
  }
9871
- }, _callee70, this);
10032
+ }, _callee73, this);
9872
10033
  }));
9873
- function submit(_x118, _x119) {
10034
+ function submit(_x126, _x127) {
9874
10035
  return _submit.apply(this, arguments);
9875
10036
  }
9876
10037
  return submit;
9877
- }() // This will not stop the stream on the server side
10038
+ }()
9878
10039
  }, {
9879
10040
  key: "stopStream",
9880
10041
  value: function stopStream() {
9881
- this._abortStream.abort(), this.changeToSubmitIcon();
10042
+ this._abortStream.abort(), this._stopClicked.listener(), this.changeToSubmitIcon();
9882
10043
  }
9883
10044
  }, {
9884
10045
  key: "changeToStopIcon",
@@ -10004,13 +10165,13 @@ var CameraModal = /*#__PURE__*/function (_Modal2) {
10004
10165
  t = new Array(e.length);
10005
10166
  for (var l = 0; l < e.length; l++) t[l] = e.charCodeAt(l);
10006
10167
  var n = new Uint8Array(t),
10007
- s = new Blob([n], {
10168
+ _s23 = new Blob([n], {
10008
10169
  type: this._format
10009
10170
  }),
10010
- o = this._format === "image/jpeg" ? "jpeg" : "png",
10011
- a = NewFileName.getFileName(this._newFilePrefix || "photo", o);
10012
- return new File([s], a, {
10013
- type: s.type
10171
+ _o15 = this._format === "image/jpeg" ? "jpeg" : "png",
10172
+ _a13 = NewFileName.getFileName(this._newFilePrefix || "photo", _o15);
10173
+ return new File([_s23], _a13, {
10174
+ type: _s23.type
10014
10175
  });
10015
10176
  }
10016
10177
  }
@@ -10175,7 +10336,7 @@ var ChatView = /*#__PURE__*/function () {
10175
10336
  var s = document.createElement("div");
10176
10337
  s.id = "chat-view";
10177
10338
  var o = new Messages(e, t, n);
10178
- t.websocket && Websocket.assignListeners(t, o);
10339
+ t.websocket && Websocket.createConnection(t, o);
10179
10340
  var a = new Input(e, o, t, s);
10180
10341
  return ElementUtils.addElements(s, o.elementRef, a.elementRef), s;
10181
10342
  }
@@ -10202,10 +10363,7 @@ var DeepChat = /*#__PURE__*/function (_InternalHTML2) {
10202
10363
  function DeepChat() {
10203
10364
  var _this60;
10204
10365
  _classCallCheck(this, DeepChat);
10205
- _this60 = _super45.call(this), _this60.request = {
10206
- url: "ws://loasdasdsacalhost:8080",
10207
- websocket: !0
10208
- }, _this60.getMessages = function () {
10366
+ _this60 = _super45.call(this), _this60.getMessages = function () {
10209
10367
  return [];
10210
10368
  }, _this60.submitUserMessage = function () {
10211
10369
  return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
@@ -10229,7 +10387,7 @@ var DeepChat = /*#__PURE__*/function (_InternalHTML2) {
10229
10387
  value: function onRender() {
10230
10388
  var _this$_activeService, _this$_childElement;
10231
10389
  var e, t, n;
10232
- (_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = ServiceIOFactory.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (WebComponentStyleUtils.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Object.assign(this._elementRef.style, this.containerStyle), this._activeService.key && this._activeService.validateConfigKey ? ValidateKeyPropertyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : this._activeService instanceof DirectServiceIO && this._activeService.key || (e = this.request) != null && e.url || (t = this.request) != null && t.handler || (n = this.directConnection) != null && n.demo ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], ChatView.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof DirectServiceIO ? InsertKeyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : (console.log("here"), ErrorView.render(this._elementRef, 'Please define "request" with a "url"')), this._hasBeenRendered = !0, FireEvents.onRender(this));
10390
+ (_this$_activeService = this._activeService) !== null && _this$_activeService !== void 0 ? _this$_activeService : this._activeService = ServiceIOFactory.create(this), this._activeService && (this.auxiliaryStyle && !this._auxiliaryStyleApplied && (WebComponentStyleUtils.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Object.assign(this._elementRef.style, this.containerStyle), this._activeService.key && this._activeService.validateConfigKey ? ValidateKeyPropertyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : this._activeService instanceof DirectServiceIO && this._activeService.key || (e = this.request) != null && e.url || (t = this.request) != null && t.handler || (n = this.directConnection) != null && n.demo ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], ChatView.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof DirectServiceIO ? InsertKeyView.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : ErrorView.render(this._elementRef, 'Please define "request" with a "url"'), this._hasBeenRendered = !0, FireEvents.onRender(this));
10233
10391
  }
10234
10392
  }]);
10235
10393
  return DeepChat;